diff --git a/public/assets/css/general.css b/public/assets/css/general.css index 5480be2b939be0ebfa75d01807402853ceafaa33..6d326464e6f4d785064e5e4ddd09996b1bb94840 100644 --- a/public/assets/css/general.css +++ b/public/assets/css/general.css @@ -125,3 +125,7 @@ body, html { grid-column: 2/5; grid-row: 4/5; } +#map { + height: 400px; + width: 100%; + } \ No newline at end of file diff --git a/public/assets/dist/map.css b/public/assets/dist/map.css new file mode 100644 index 0000000000000000000000000000000000000000..1345edc362c8718b67c55deb5c088ff62cdfa1b6 --- /dev/null +++ b/public/assets/dist/map.css @@ -0,0 +1,277 @@ +.ol-box { + box-sizing: border-box; + border-radius: 2px; + border: 2px solid blue; +} + +.ol-mouse-position { + top: 8px; + right: 8px; + position: absolute; +} + +.ol-scale-line { + background: rgba(0,60,136,0.3); + border-radius: 4px; + bottom: 8px; + left: 8px; + padding: 2px; + position: absolute; +} +.ol-scale-line-inner { + border: 1px solid #eee; + border-top: none; + color: #eee; + font-size: 10px; + text-align: center; + margin: 1px; + will-change: contents, width; + transition: all 0.25s; +} +.ol-scale-bar { + position: absolute; + bottom: 8px; + left: 8px; +} +.ol-scale-step-marker { + width: 1px; + height: 15px; + background-color: #000000; + float: right; + z-Index: 10; +} +.ol-scale-step-text { + position: absolute; + bottom: -5px; + font-size: 12px; + z-Index: 11; + color: #000000; + text-shadow: -2px 0 #FFFFFF, 0 2px #FFFFFF, 2px 0 #FFFFFF, 0 -2px #FFFFFF; +} +.ol-scale-text { + position: absolute; + font-size: 14px; + text-align: center; + bottom: 25px; + color: #000000; + text-shadow: -2px 0 #FFFFFF, 0 2px #FFFFFF, 2px 0 #FFFFFF, 0 -2px #FFFFFF; +} +.ol-scale-singlebar { + position: relative; + height: 10px; + z-Index: 9; + box-sizing: border-box; + border: 1px solid black; +} + +.ol-unsupported { + display: none; +} +.ol-viewport, .ol-unselectable { + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} +.ol-selectable { + -webkit-touch-callout: default; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} +.ol-grabbing { + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + cursor: grabbing; +} +.ol-grab { + cursor: move; + cursor: -webkit-grab; + cursor: -moz-grab; + cursor: grab; +} +.ol-control { + position: absolute; + background-color: rgba(255,255,255,0.4); + border-radius: 4px; + padding: 2px; +} +.ol-control:hover { + background-color: rgba(255,255,255,0.6); +} +.ol-zoom { + top: .5em; + left: .5em; +} +.ol-rotate { + top: .5em; + right: .5em; + transition: opacity .25s linear, visibility 0s linear; +} +.ol-rotate.ol-hidden { + opacity: 0; + visibility: hidden; + transition: opacity .25s linear, visibility 0s linear .25s; +} +.ol-zoom-extent { + top: 4.643em; + left: .5em; +} +.ol-full-screen { + right: .5em; + top: .5em; +} + +.ol-control button { + display: block; + margin: 1px; + padding: 0; + color: white; + font-size: 1.14em; + font-weight: bold; + text-decoration: none; + text-align: center; + height: 1.375em; + width: 1.375em; + line-height: .4em; + background-color: rgba(0,60,136,0.5); + border: none; + border-radius: 2px; +} +.ol-control button::-moz-focus-inner { + border: none; + padding: 0; +} +.ol-zoom-extent button { + line-height: 1.4em; +} +.ol-compass { + display: block; + font-weight: normal; + font-size: 1.2em; + will-change: transform; +} +.ol-touch .ol-control button { + font-size: 1.5em; +} +.ol-touch .ol-zoom-extent { + top: 5.5em; +} +.ol-control button:hover, +.ol-control button:focus { + text-decoration: none; + background-color: rgba(0,60,136,0.7); +} +.ol-zoom .ol-zoom-in { + border-radius: 2px 2px 0 0; +} +.ol-zoom .ol-zoom-out { + border-radius: 0 0 2px 2px; +} + + +.ol-attribution { + text-align: right; + bottom: .5em; + right: .5em; + max-width: calc(100% - 1.3em); +} + +.ol-attribution ul { + margin: 0; + padding: 0 .5em; + color: #000; + text-shadow: 0 0 2px #fff; +} +.ol-attribution li { + display: inline; + list-style: none; +} +.ol-attribution li:not(:last-child):after { + content: " "; +} +.ol-attribution img { + max-height: 2em; + max-width: inherit; + vertical-align: middle; +} +.ol-attribution ul, .ol-attribution button { + display: inline-block; +} +.ol-attribution.ol-collapsed ul { + display: none; +} +.ol-attribution:not(.ol-collapsed) { + background: rgba(255,255,255,0.8); +} +.ol-attribution.ol-uncollapsible { + bottom: 0; + right: 0; + border-radius: 4px 0 0; +} +.ol-attribution.ol-uncollapsible img { + margin-top: -.2em; + max-height: 1.6em; +} +.ol-attribution.ol-uncollapsible button { + display: none; +} + +.ol-zoomslider { + top: 4.5em; + left: .5em; + height: 200px; +} +.ol-zoomslider button { + position: relative; + height: 10px; +} + +.ol-touch .ol-zoomslider { + top: 5.5em; +} + +.ol-overviewmap { + left: 0.5em; + bottom: 0.5em; +} +.ol-overviewmap.ol-uncollapsible { + bottom: 0; + left: 0; + border-radius: 0 4px 0 0; +} +.ol-overviewmap .ol-overviewmap-map, +.ol-overviewmap button { + display: inline-block; +} +.ol-overviewmap .ol-overviewmap-map { + border: 1px solid #7b98bc; + height: 150px; + margin: 2px; + width: 150px; +} +.ol-overviewmap:not(.ol-collapsed) button{ + bottom: 1px; + left: 2px; + position: absolute; +} +.ol-overviewmap.ol-collapsed .ol-overviewmap-map, +.ol-overviewmap.ol-uncollapsible button { + display: none; +} +.ol-overviewmap:not(.ol-collapsed) { + background: rgba(255,255,255,0.8); +} +.ol-overviewmap-box { + border: 2px dotted rgba(0,60,136,0.7); +} + +.ol-overviewmap .ol-overviewmap-box:hover { + cursor: move; +} + + +/*# sourceMappingURL=/map.css.map */ \ No newline at end of file diff --git a/public/assets/dist/map.css.map b/public/assets/dist/map.css.map new file mode 100644 index 0000000000000000000000000000000000000000..f73c9cba471e210b3e390d89761ab16cbeb9ed48 --- /dev/null +++ b/public/assets/dist/map.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../node_modules/ol/ol.css"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"map.css","sourceRoot":"../js","sourcesContent":[".ol-box {\n box-sizing: border-box;\n border-radius: 2px;\n border: 2px solid blue;\n}\n\n.ol-mouse-position {\n top: 8px;\n right: 8px;\n position: absolute;\n}\n\n.ol-scale-line {\n background: rgba(0,60,136,0.3);\n border-radius: 4px;\n bottom: 8px;\n left: 8px;\n padding: 2px;\n position: absolute;\n}\n.ol-scale-line-inner {\n border: 1px solid #eee;\n border-top: none;\n color: #eee;\n font-size: 10px;\n text-align: center;\n margin: 1px;\n will-change: contents, width;\n transition: all 0.25s;\n}\n.ol-scale-bar {\n position: absolute;\n bottom: 8px;\n left: 8px;\n}\n.ol-scale-step-marker {\n width: 1px;\n height: 15px;\n background-color: #000000;\n float: right;\n z-Index: 10;\n}\n.ol-scale-step-text {\n position: absolute;\n bottom: -5px;\n font-size: 12px;\n z-Index: 11;\n color: #000000;\n text-shadow: -2px 0 #FFFFFF, 0 2px #FFFFFF, 2px 0 #FFFFFF, 0 -2px #FFFFFF;\n}\n.ol-scale-text {\n position: absolute;\n font-size: 14px;\n text-align: center;\n bottom: 25px;\n color: #000000;\n text-shadow: -2px 0 #FFFFFF, 0 2px #FFFFFF, 2px 0 #FFFFFF, 0 -2px #FFFFFF;\n}\n.ol-scale-singlebar {\n position: relative;\n height: 10px;\n z-Index: 9;\n box-sizing: border-box;\n border: 1px solid black;\n}\n\n.ol-unsupported {\n display: none;\n}\n.ol-viewport, .ol-unselectable {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n}\n.ol-selectable {\n -webkit-touch-callout: default;\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n}\n.ol-grabbing {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n.ol-grab {\n cursor: move;\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n}\n.ol-control {\n position: absolute;\n background-color: rgba(255,255,255,0.4);\n border-radius: 4px;\n padding: 2px;\n}\n.ol-control:hover {\n background-color: rgba(255,255,255,0.6);\n}\n.ol-zoom {\n top: .5em;\n left: .5em;\n}\n.ol-rotate {\n top: .5em;\n right: .5em;\n transition: opacity .25s linear, visibility 0s linear;\n}\n.ol-rotate.ol-hidden {\n opacity: 0;\n visibility: hidden;\n transition: opacity .25s linear, visibility 0s linear .25s;\n}\n.ol-zoom-extent {\n top: 4.643em;\n left: .5em;\n}\n.ol-full-screen {\n right: .5em;\n top: .5em;\n}\n\n.ol-control button {\n display: block;\n margin: 1px;\n padding: 0;\n color: white;\n font-size: 1.14em;\n font-weight: bold;\n text-decoration: none;\n text-align: center;\n height: 1.375em;\n width: 1.375em;\n line-height: .4em;\n background-color: rgba(0,60,136,0.5);\n border: none;\n border-radius: 2px;\n}\n.ol-control button::-moz-focus-inner {\n border: none;\n padding: 0;\n}\n.ol-zoom-extent button {\n line-height: 1.4em;\n}\n.ol-compass {\n display: block;\n font-weight: normal;\n font-size: 1.2em;\n will-change: transform;\n}\n.ol-touch .ol-control button {\n font-size: 1.5em;\n}\n.ol-touch .ol-zoom-extent {\n top: 5.5em;\n}\n.ol-control button:hover,\n.ol-control button:focus {\n text-decoration: none;\n background-color: rgba(0,60,136,0.7);\n}\n.ol-zoom .ol-zoom-in {\n border-radius: 2px 2px 0 0;\n}\n.ol-zoom .ol-zoom-out {\n border-radius: 0 0 2px 2px;\n}\n\n\n.ol-attribution {\n text-align: right;\n bottom: .5em;\n right: .5em;\n max-width: calc(100% - 1.3em);\n}\n\n.ol-attribution ul {\n margin: 0;\n padding: 0 .5em;\n color: #000;\n text-shadow: 0 0 2px #fff;\n}\n.ol-attribution li {\n display: inline;\n list-style: none;\n}\n.ol-attribution li:not(:last-child):after {\n content: \" \";\n}\n.ol-attribution img {\n max-height: 2em;\n max-width: inherit;\n vertical-align: middle;\n}\n.ol-attribution ul, .ol-attribution button {\n display: inline-block;\n}\n.ol-attribution.ol-collapsed ul {\n display: none;\n}\n.ol-attribution:not(.ol-collapsed) {\n background: rgba(255,255,255,0.8);\n}\n.ol-attribution.ol-uncollapsible {\n bottom: 0;\n right: 0;\n border-radius: 4px 0 0;\n}\n.ol-attribution.ol-uncollapsible img {\n margin-top: -.2em;\n max-height: 1.6em;\n}\n.ol-attribution.ol-uncollapsible button {\n display: none;\n}\n\n.ol-zoomslider {\n top: 4.5em;\n left: .5em;\n height: 200px;\n}\n.ol-zoomslider button {\n position: relative;\n height: 10px;\n}\n\n.ol-touch .ol-zoomslider {\n top: 5.5em;\n}\n\n.ol-overviewmap {\n left: 0.5em;\n bottom: 0.5em;\n}\n.ol-overviewmap.ol-uncollapsible {\n bottom: 0;\n left: 0;\n border-radius: 0 4px 0 0;\n}\n.ol-overviewmap .ol-overviewmap-map,\n.ol-overviewmap button {\n display: inline-block;\n}\n.ol-overviewmap .ol-overviewmap-map {\n border: 1px solid #7b98bc;\n height: 150px;\n margin: 2px;\n width: 150px;\n}\n.ol-overviewmap:not(.ol-collapsed) button{\n bottom: 1px;\n left: 2px;\n position: absolute;\n}\n.ol-overviewmap.ol-collapsed .ol-overviewmap-map,\n.ol-overviewmap.ol-uncollapsible button {\n display: none;\n}\n.ol-overviewmap:not(.ol-collapsed) {\n background: rgba(255,255,255,0.8);\n}\n.ol-overviewmap-box {\n border: 2px dotted rgba(0,60,136,0.7);\n}\n\n.ol-overviewmap .ol-overviewmap-box:hover {\n cursor: move;\n}\n"]} \ No newline at end of file diff --git a/public/assets/dist/map.js b/public/assets/dist/map.js new file mode 100644 index 0000000000000000000000000000000000000000..b23136941ec4598a25d674e656030af3c504ae31 --- /dev/null +++ b/public/assets/dist/map.js @@ -0,0 +1,57025 @@ +// modules are defined as an array +// [ module function, map of requires ] +// +// map of requires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles +parcelRequire = (function (modules, cache, entry, globalName) { + // Save the require from previous bundle to this closure if any + var previousRequire = typeof parcelRequire === 'function' && parcelRequire; + var nodeRequire = typeof require === 'function' && require; + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = typeof parcelRequire === 'function' && parcelRequire; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error('Cannot find module \'' + name + '\''); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = cache[name] = new newRequire.Module(name); + + modules[name][0].call(module.exports, localRequire, module, module.exports, this); + } + + return cache[name].exports; + + function localRequire(x){ + return newRequire(localRequire.resolve(x)); + } + + function resolve(x){ + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [function (require, module) { + module.exports = exports; + }, {}]; + }; + + var error; + for (var i = 0; i < entry.length; i++) { + try { + newRequire(entry[i]); + } catch (e) { + // Save first error but execute all entries + if (!error) { + error = e; + } + } + } + + if (entry.length) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(entry[entry.length - 1]); + + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(function () { + return mainExports; + }); + + // <script> + } else if (globalName) { + this[globalName] = mainExports; + } + } + + // Override the current require with this new one + parcelRequire = newRequire; + + if (error) { + // throw error from earlier, _after updating parcelRequire_ + throw error; + } + + return newRequire; +})({"../../../node_modules/parcel-bundler/src/builtins/bundle-url.js":[function(require,module,exports) { +var bundleURL = null; + +function getBundleURLCached() { + if (!bundleURL) { + bundleURL = getBundleURL(); + } + + return bundleURL; +} + +function getBundleURL() { + // Attempt to find the URL of the current script and use that as the base URL + try { + throw new Error(); + } catch (err) { + var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g); + + if (matches) { + return getBaseURL(matches[0]); + } + } + + return '/'; +} + +function getBaseURL(url) { + return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/, '$1') + '/'; +} + +exports.getBundleURL = getBundleURLCached; +exports.getBaseURL = getBaseURL; +},{}],"../../../node_modules/parcel-bundler/src/builtins/css-loader.js":[function(require,module,exports) { +var bundle = require('./bundle-url'); + +function updateLink(link) { + var newLink = link.cloneNode(); + + newLink.onload = function () { + link.remove(); + }; + + newLink.href = link.href.split('?')[0] + '?' + Date.now(); + link.parentNode.insertBefore(newLink, link.nextSibling); +} + +var cssTimeout = null; + +function reloadCSS() { + if (cssTimeout) { + return; + } + + cssTimeout = setTimeout(function () { + var links = document.querySelectorAll('link[rel="stylesheet"]'); + + for (var i = 0; i < links.length; i++) { + if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) { + updateLink(links[i]); + } + } + + cssTimeout = null; + }, 50); +} + +module.exports = reloadCSS; +},{"./bundle-url":"../../../node_modules/parcel-bundler/src/builtins/bundle-url.js"}],"../../../node_modules/ol/ol.css":[function(require,module,exports) { + + var reloadCSS = require('_css_loader'); + module.hot.dispose(reloadCSS); + module.hot.accept(reloadCSS); + +},{"_css_loader":"../../../node_modules/parcel-bundler/src/builtins/css-loader.js"}],"../../../node_modules/ol/util.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.abstract = abstract; +exports.getUid = getUid; +exports.VERSION = void 0; + +/** + * @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.4.3'; +exports.VERSION = VERSION; +},{}],"../../../node_modules/ol/AssertionError.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _util = require("./util.js"); + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/AssertionError + */ + + +/** + * Error object thrown when an assertion failed. This is an ECMA-262 Error, + * extended with a `code` property. + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error. + */ +var AssertionError = +/** @class */ +function (_super) { + __extends(AssertionError, _super); + /** + * @param {number} code Error code. + */ + + + function AssertionError(code) { + var _this = this; + + var path = _util.VERSION === 'latest' ? _util.VERSION : 'v' + _util.VERSION.split('-')[0]; + var message = 'Assertion failed. See https://openlayers.org/en/' + path + '/doc/errors/#' + code + ' for details.'; + _this = _super.call(this, message) || this; + /** + * Error code. The meaning of the code can be found on + * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with + * the version found in the OpenLayers script's header comment if a version + * other than the latest is used). + * @type {number} + * @api + */ + + _this.code = code; + /** + * @type {string} + */ + + _this.name = 'AssertionError'; // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40 + + _this.message = message; + return _this; + } + + return AssertionError; +}(Error); + +var _default = AssertionError; +exports.default = _default; +},{"./util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/events/Event.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.stopPropagation = stopPropagation; +exports.preventDefault = preventDefault; +exports.default = void 0; + +/** + * @module ol/events/Event + */ + +/** + * @classdesc + * Stripped down implementation of the W3C DOM Level 2 Event interface. + * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface. + * + * This implementation only provides `type` and `target` properties, and + * `stopPropagation` and `preventDefault` methods. It is meant as base class + * for higher level events defined in the library, and works with + * {@link module:ol/events/Target~Target}. + */ +var BaseEvent = +/** @class */ +function () { + /** + * @param {string} type Type. + */ + function BaseEvent(type) { + /** + * @type {boolean} + */ + this.propagationStopped; + /** + * The event type. + * @type {string} + * @api + */ + + this.type = type; + /** + * The event target. + * @type {Object} + * @api + */ + + this.target = null; + } + /** + * Stop event propagation. + * @api + */ + + + BaseEvent.prototype.preventDefault = function () { + this.propagationStopped = true; + }; + /** + * Stop event propagation. + * @api + */ + + + BaseEvent.prototype.stopPropagation = function () { + this.propagationStopped = true; + }; + + return BaseEvent; +}(); +/** + * @param {Event|import("./Event.js").default} evt Event + */ + + +function stopPropagation(evt) { + evt.stopPropagation(); +} +/** + * @param {Event|import("./Event.js").default} evt Event + */ + + +function preventDefault(evt) { + evt.preventDefault(); +} + +var _default = BaseEvent; +exports.default = _default; +},{}],"../../../node_modules/ol/ObjectEventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/ObjectEventType + */ + +/** + * @enum {string} + */ +var _default = { + /** + * Triggered when a property is changed. + * @event module:ol/Object.ObjectEvent#propertychange + * @api + */ + PROPERTYCHANGE: 'propertychange' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/Disposable.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/Disposable + */ + +/** + * @classdesc + * Objects that need to clean up after themselves. + */ +var Disposable = +/** @class */ +function () { + function Disposable() { + /** + * The object has already been disposed. + * @type {boolean} + * @protected + */ + this.disposed = false; + } + /** + * Clean up. + */ + + + Disposable.prototype.dispose = function () { + if (!this.disposed) { + this.disposed = true; + this.disposeInternal(); + } + }; + /** + * Extension point for disposable objects. + * @protected + */ + + + Disposable.prototype.disposeInternal = function () {}; + + return Disposable; +}(); + +var _default = Disposable; +exports.default = _default; +},{}],"../../../node_modules/ol/array.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.binarySearch = binarySearch; +exports.numberSafeCompareFunction = numberSafeCompareFunction; +exports.includes = includes; +exports.linearFindNearest = linearFindNearest; +exports.reverseSubArray = reverseSubArray; +exports.extend = extend; +exports.remove = remove; +exports.find = find; +exports.equals = equals; +exports.stableSort = stableSort; +exports.findIndex = findIndex; +exports.isSorted = isSorted; + +/** + * @module ol/array + */ + +/** + * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1. + * https://github.com/darkskyapp/binary-search + * + * @param {Array<*>} haystack Items to search through. + * @param {*} needle The item to look for. + * @param {Function=} opt_comparator Comparator function. + * @return {number} The index of the item if found, -1 if not. + */ +function binarySearch(haystack, needle, opt_comparator) { + var mid, cmp; + var comparator = opt_comparator || numberSafeCompareFunction; + var low = 0; + var high = haystack.length; + var found = false; + + while (low < high) { + /* Note that "(low + high) >>> 1" may overflow, and results in a typecast + * to double (which gives the wrong results). */ + mid = low + (high - low >> 1); + cmp = +comparator(haystack[mid], needle); + + if (cmp < 0.0) { + /* Too low. */ + low = mid + 1; + } else { + /* Key found or too high */ + high = mid; + found = !cmp; + } + } + /* Key not found. */ + + + return found ? low : ~low; +} +/** + * Compare function for array sort that is safe for numbers. + * @param {*} a The first object to be compared. + * @param {*} b The second object to be compared. + * @return {number} A negative number, zero, or a positive number as the first + * argument is less than, equal to, or greater than the second. + */ + + +function numberSafeCompareFunction(a, b) { + return a > b ? 1 : a < b ? -1 : 0; +} +/** + * Whether the array contains the given object. + * @param {Array<*>} arr The array to test for the presence of the element. + * @param {*} obj The object for which to test. + * @return {boolean} The object is in the array. + */ + + +function includes(arr, obj) { + return arr.indexOf(obj) >= 0; +} +/** + * @param {Array<number>} arr Array. + * @param {number} target Target. + * @param {number} direction 0 means return the nearest, > 0 + * means return the largest nearest, < 0 means return the + * smallest nearest. + * @return {number} Index. + */ + + +function linearFindNearest(arr, target, direction) { + var n = arr.length; + + if (arr[0] <= target) { + return 0; + } else if (target <= arr[n - 1]) { + return n - 1; + } else { + var i = void 0; + + if (direction > 0) { + for (i = 1; i < n; ++i) { + if (arr[i] < target) { + return i - 1; + } + } + } else if (direction < 0) { + for (i = 1; i < n; ++i) { + if (arr[i] <= target) { + return i; + } + } + } else { + for (i = 1; i < n; ++i) { + if (arr[i] == target) { + return i; + } else if (arr[i] < target) { + if (arr[i - 1] - target < target - arr[i]) { + return i - 1; + } else { + return i; + } + } + } + } + + return n - 1; + } +} +/** + * @param {Array<*>} arr Array. + * @param {number} begin Begin index. + * @param {number} end End index. + */ + + +function reverseSubArray(arr, begin, end) { + while (begin < end) { + var tmp = arr[begin]; + arr[begin] = arr[end]; + arr[end] = tmp; + ++begin; + --end; + } +} +/** + * @param {Array<VALUE>} arr The array to modify. + * @param {!Array<VALUE>|VALUE} data The elements or arrays of elements to add to arr. + * @template VALUE + */ + + +function extend(arr, data) { + var extension = Array.isArray(data) ? data : [data]; + var length = extension.length; + + for (var i = 0; i < length; i++) { + arr[arr.length] = extension[i]; + } +} +/** + * @param {Array<VALUE>} arr The array to modify. + * @param {VALUE} obj The element to remove. + * @template VALUE + * @return {boolean} If the element was removed. + */ + + +function remove(arr, obj) { + var i = arr.indexOf(obj); + var found = i > -1; + + if (found) { + arr.splice(i, 1); + } + + return found; +} +/** + * @param {Array<VALUE>} arr The array to search in. + * @param {function(VALUE, number, ?) : boolean} func The function to compare. + * @template VALUE + * @return {VALUE|null} The element found or null. + */ + + +function find(arr, func) { + var length = arr.length >>> 0; + var value; + + for (var i = 0; i < length; i++) { + value = arr[i]; + + if (func(value, i, arr)) { + return value; + } + } + + return null; +} +/** + * @param {Array|Uint8ClampedArray} arr1 The first array to compare. + * @param {Array|Uint8ClampedArray} arr2 The second array to compare. + * @return {boolean} Whether the two arrays are equal. + */ + + +function equals(arr1, arr2) { + var len1 = arr1.length; + + if (len1 !== arr2.length) { + return false; + } + + for (var i = 0; i < len1; i++) { + if (arr1[i] !== arr2[i]) { + return false; + } + } + + return true; +} +/** + * Sort the passed array such that the relative order of equal elements is preverved. + * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details. + * @param {Array<*>} arr The array to sort (modifies original). + * @param {!function(*, *): number} compareFnc Comparison function. + * @api + */ + + +function stableSort(arr, compareFnc) { + var length = arr.length; + var tmp = Array(arr.length); + var i; + + for (i = 0; i < length; i++) { + tmp[i] = { + index: i, + value: arr[i] + }; + } + + tmp.sort(function (a, b) { + return compareFnc(a.value, b.value) || a.index - b.index; + }); + + for (i = 0; i < arr.length; i++) { + arr[i] = tmp[i].value; + } +} +/** + * @param {Array<*>} arr The array to search in. + * @param {Function} func Comparison function. + * @return {number} Return index. + */ + + +function findIndex(arr, func) { + var index; + var found = !arr.every(function (el, idx) { + index = idx; + return !func(el, idx, arr); + }); + return found ? index : -1; +} +/** + * @param {Array<*>} arr The array to test. + * @param {Function=} opt_func Comparison function. + * @param {boolean=} opt_strict Strictly sorted (default false). + * @return {boolean} Return index. + */ + + +function isSorted(arr, opt_func, opt_strict) { + var compare = opt_func || numberSafeCompareFunction; + return arr.every(function (currentVal, index) { + if (index === 0) { + return true; + } + + var res = compare(arr[index - 1], currentVal); + return !(res > 0 || opt_strict && res === 0); + }); +} +},{}],"../../../node_modules/ol/functions.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TRUE = TRUE; +exports.FALSE = FALSE; +exports.VOID = VOID; +exports.memoizeOne = memoizeOne; + +var _array = require("./array.js"); + +/** + * @module ol/functions + */ + +/** + * Always returns true. + * @returns {boolean} true. + */ +function TRUE() { + return true; +} +/** + * Always returns false. + * @returns {boolean} false. + */ + + +function FALSE() { + return false; +} +/** + * A reusable function, used e.g. as a default for callbacks. + * + * @return {void} Nothing. + */ + + +function VOID() {} +/** + * Wrap a function in another function that remembers the last return. If the + * returned function is called twice in a row with the same arguments and the same + * this object, it will return the value from the first call in the second call. + * + * @param {function(...any): ReturnType} fn The function to memoize. + * @return {function(...any): ReturnType} The memoized function. + * @template ReturnType + */ + + +function memoizeOne(fn) { + var called = false; + /** @type {ReturnType} */ + + var lastResult; + /** @type {Array<any>} */ + + var lastArgs; + var lastThis; + return function () { + var nextArgs = Array.prototype.slice.call(arguments); + + if (!called || this !== lastThis || !(0, _array.equals)(nextArgs, lastArgs)) { + called = true; + lastThis = this; + lastArgs = nextArgs; + lastResult = fn.apply(this, arguments); + } + + return lastResult; + }; +} +},{"./array.js":"../../../node_modules/ol/array.js"}],"../../../node_modules/ol/obj.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clear = clear; +exports.isEmpty = isEmpty; +exports.getValues = exports.assign = void 0; + +/** + * @module ol/obj + */ + +/** + * Polyfill for Object.assign(). Assigns enumerable and own properties from + * one or more source objects to a target object. + * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign. + * + * @param {!Object} target The target object. + * @param {...Object} var_sources The source object(s). + * @return {!Object} The modified target object. + */ +var assign = typeof Object.assign === 'function' ? Object.assign : function (target, var_sources) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + + for (var i = 1, ii = arguments.length; i < ii; ++i) { + var source = arguments[i]; + + if (source !== undefined && source !== null) { + for (var key in source) { + if (source.hasOwnProperty(key)) { + output[key] = source[key]; + } + } + } + } + + return output; +}; +/** + * Removes all properties from an object. + * @param {Object} object The object to clear. + */ + +exports.assign = assign; + +function clear(object) { + for (var property in object) { + delete object[property]; + } +} +/** + * Polyfill for Object.values(). Get an array of property values from an object. + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values + * + * @param {!Object<K,V>} object The object from which to get the values. + * @return {!Array<V>} The property values. + * @template K,V + */ + + +var getValues = typeof Object.values === 'function' ? Object.values : function (object) { + var values = []; + + for (var property in object) { + values.push(object[property]); + } + + return values; +}; +/** + * Determine if an object has any properties. + * @param {Object} object The object to check. + * @return {boolean} The object is empty. + */ + +exports.getValues = getValues; + +function isEmpty(object) { + var property; + + for (property in object) { + return false; + } + + return !property; +} +},{}],"../../../node_modules/ol/events/Target.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Disposable = _interopRequireDefault(require("../Disposable.js")); + +var _Event = _interopRequireDefault(require("./Event.js")); + +var _functions = require("../functions.js"); + +var _obj = require("../obj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + 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<string, number>} + */ + + _this.pendingRemovals_ = null; + /** + * @private + * @type {Object<string, number>} + */ + + _this.dispatching_ = null; + /** + * @private + * @type {Object<string, Array<import("../events.js").Listener>>} + */ + + _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) { + /** @type {import("./Event.js").default|Event} */ + var evt = typeof event === 'string' ? new _Event.default(event) : event; + var type = evt.type; + + if (!evt.target) { + evt.target = this.eventTarget_ || this; + } + + var listeners = this.listeners_ && this.listeners_[type]; + var propagate; + + if (listeners) { + var dispatching = this.dispatching_ || (this.dispatching_ = {}); + var pendingRemovals = this.pendingRemovals_ || (this.pendingRemovals_ = {}); + + if (!(type in dispatching)) { + dispatching[type] = 0; + pendingRemovals[type] = 0; + } + + ++dispatching[type]; + + 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; + } + } + + --dispatching[type]; + + if (dispatching[type] === 0) { + var pr = pendingRemovals[type]; + delete pendingRemovals[type]; + + while (pr--) { + this.removeEventListener(type, _functions.VOID); + } + + delete dispatching[type]; + } + + return propagate; + } + }; + /** + * Clean up. + */ + + + Target.prototype.disposeInternal = function () { + this.listeners_ && (0, _obj.clear)(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<import("../events.js").Listener>|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.VOID; + ++this.pendingRemovals_[type]; + } else { + listeners.splice(index, 1); + + if (listeners.length === 0) { + delete this.listeners_[type]; + } + } + } + } + }; + + return Target; +}(_Disposable.default); + +var _default = Target; +exports.default = _default; +},{"../Disposable.js":"../../../node_modules/ol/Disposable.js","./Event.js":"../../../node_modules/ol/events/Event.js","../functions.js":"../../../node_modules/ol/functions.js","../obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/events/EventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/events/EventType + */ + +/** + * @enum {string} + * @const + */ +var _default = { + /** + * 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' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/events.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.listen = listen; +exports.listenOnce = listenOnce; +exports.unlistenByKey = unlistenByKey; + +var _obj = require("./obj.js"); + +/** + * @module ol/events + */ + +/** + * Key to use with {@link module:ol/Observable~Observable#unByKey}. + * @typedef {Object} EventsKey + * @property {ListenerFunction} listener + * @property {import("./events/Target.js").EventTargetLike} target + * @property {string} 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 + */ + +/** + * @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); + (0, _obj.clear)(key); + } +} +},{"./obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/Observable.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.unByKey = unByKey; +exports.default = void 0; + +var _Target = _interopRequireDefault(require("./events/Target.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _events = require("./events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Observable + */ + + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * An event target providing convenient methods for listener registration + * and unregistration. A generic `change` event is always available through + * {@link module:ol/Observable~Observable#changed}. + * + * @fires import("./events/Event.js").default + * @api + */ +var Observable = +/** @class */ +function (_super) { + __extends(Observable, _super); + + function Observable() { + var _this = _super.call(this) || this; + /** + * @private + * @type {number} + */ + + + _this.revision_ = 0; + return _this; + } + /** + * Increases the revision counter and dispatches a 'change' event. + * @api + */ + + + Observable.prototype.changed = function () { + ++this.revision_; + this.dispatchEvent(_EventType.default.CHANGE); + }; + /** + * Get the version number for this object. Each time the object is modified, + * its version number will be incremented. + * @return {number} Revision. + * @api + */ + + + Observable.prototype.getRevision = function () { + return this.revision_; + }; + /** + * Listen for a certain type of event. + * @param {string|Array<string>} type The event type or array of event types. + * @param {function(?): ?} listener The listener function. + * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If + * called with an array of event types as the first argument, the return + * will be an array of keys. + * @api + */ + + + Observable.prototype.on = function (type, listener) { + if (Array.isArray(type)) { + var len = type.length; + var keys = new Array(len); + + for (var i = 0; i < len; ++i) { + keys[i] = (0, _events.listen)(this, type[i], listener); + } + + return keys; + } else { + return (0, _events.listen)(this, + /** @type {string} */ + type, listener); + } + }; + /** + * Listen once for a certain type of event. + * @param {string|Array<string>} type The event type or array of event types. + * @param {function(?): ?} listener The listener function. + * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If + * called with an array of event types as the first argument, the return + * will be an array of keys. + * @api + */ + + + Observable.prototype.once = function (type, listener) { + var key; + + if (Array.isArray(type)) { + var len = type.length; + key = new Array(len); + + for (var i = 0; i < len; ++i) { + key[i] = (0, _events.listenOnce)(this, type[i], listener); + } + } else { + key = (0, _events.listenOnce)(this, + /** @type {string} */ + type, listener); + } + /** @type {Object} */ + + + listener.ol_key = key; + return key; + }; + /** + * Unlisten for a certain type of event. + * @param {string|Array<string>} type The event type or array of event types. + * @param {function(?): ?} listener The listener function. + * @api + */ + + + Observable.prototype.un = function (type, listener) { + var key = + /** @type {Object} */ + listener.ol_key; + + if (key) { + unByKey(key); + } else if (Array.isArray(type)) { + for (var i = 0, ii = type.length; i < ii; ++i) { + this.removeEventListener(type[i], listener); + } + } else { + this.removeEventListener(type, listener); + } + }; + + return Observable; +}(_Target.default); +/** + * Removes an event listener using the key returned by `on()` or `once()`. + * @param {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} key The key returned by `on()` + * or `once()` (or an array of keys). + * @api + */ + + +function unByKey(key) { + if (Array.isArray(key)) { + for (var i = 0, ii = key.length; i < ii; ++i) { + (0, _events.unlistenByKey)(key[i]); + } + } else { + (0, _events.unlistenByKey)( + /** @type {import("./events.js").EventsKey} */ + key); + } +} + +var _default = Observable; +exports.default = _default; +},{"./events/Target.js":"../../../node_modules/ol/events/Target.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/Object.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getChangeEventType = getChangeEventType; +exports.default = exports.ObjectEvent = void 0; + +var _Event = _interopRequireDefault(require("./events/Event.js")); + +var _ObjectEventType = _interopRequireDefault(require("./ObjectEventType.js")); + +var _Observable = _interopRequireDefault(require("./Observable.js")); + +var _obj = require("./obj.js"); + +var _util = require("./util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Object + */ + + +/** + * @classdesc + * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type. + */ +var ObjectEvent = +/** @class */ +function (_super) { + __extends(ObjectEvent, _super); + /** + * @param {string} type The event type. + * @param {string} key The property name. + * @param {*} oldValue The old value for `key`. + */ + + + function ObjectEvent(type, key, oldValue) { + var _this = _super.call(this, type) || this; + /** + * The name of the property whose value is changing. + * @type {string} + * @api + */ + + + _this.key = key; + /** + * The old value. To get the new value use `e.target.get(e.key)` where + * `e` is the event object. + * @type {*} + * @api + */ + + _this.oldValue = oldValue; + return _this; + } + + return ObjectEvent; +}(_Event.default); + +exports.ObjectEvent = ObjectEvent; + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Most non-trivial classes inherit from this. + * + * This extends {@link module:ol/Observable} with observable + * properties, where each property is observable as well as the object as a + * whole. + * + * Classes that inherit from this have pre-defined properties, to which you can + * add your owns. The pre-defined properties are listed in this documentation as + * 'Observable Properties', and have their own accessors; for example, + * {@link module:ol/Map~Map} has a `target` property, accessed with + * `getTarget()` and changed with `setTarget()`. Not all properties are however + * settable. There are also general-purpose accessors `get()` and `set()`. For + * example, `get('target')` is equivalent to `getTarget()`. + * + * The `set` accessors trigger a change event, and you can monitor this by + * registering a listener. For example, {@link module:ol/View~View} has a + * `center` property, so `view.on('change:center', function(evt) {...});` would + * call the function whenever the value of the center property changes. Within + * the function, `evt.target` would be the view, so `evt.target.getCenter()` + * would return the new center. + * + * You can add your own observable properties with + * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`. + * You can listen for changes on that property value with + * `object.on('change:prop', listener)`. You can get a list of all + * properties with {@link module:ol/Object~BaseObject#getProperties}. + * + * Note that the observable properties are separate from standard JS properties. + * You can, for example, give your map object a title with + * `map.title='New title'` and with `map.set('title', 'Another title')`. The + * first will be a `hasOwnProperty`; the second will appear in + * `getProperties()`. Only the second is observable. + * + * Properties can be deleted by using the unset method. E.g. + * object.unset('foo'). + * + * @fires ObjectEvent + * @api + */ +var BaseObject = +/** @class */ +function (_super) { + __extends(BaseObject, _super); + /** + * @param {Object<string, *>=} opt_values An object with key-value pairs. + */ + + + function BaseObject(opt_values) { + var _this = _super.call(this) || this; // Call {@link module:ol/util~getUid} to ensure that the order of objects' ids is + // the same as the order in which they were created. This also helps to + // ensure that object properties are always added in the same order, which + // helps many JavaScript engines generate faster code. + + + (0, _util.getUid)(_this); + /** + * @private + * @type {Object<string, *>} + */ + + _this.values_ = null; + + if (opt_values !== undefined) { + _this.setProperties(opt_values); + } + + return _this; + } + /** + * Gets a value. + * @param {string} key Key name. + * @return {*} Value. + * @api + */ + + + BaseObject.prototype.get = function (key) { + var value; + + if (this.values_ && this.values_.hasOwnProperty(key)) { + value = this.values_[key]; + } + + return value; + }; + /** + * Get a list of object property names. + * @return {Array<string>} List of property names. + * @api + */ + + + BaseObject.prototype.getKeys = function () { + return this.values_ && Object.keys(this.values_) || []; + }; + /** + * Get an object of all property names and values. + * @return {Object<string, *>} Object. + * @api + */ + + + BaseObject.prototype.getProperties = function () { + return this.values_ && (0, _obj.assign)({}, this.values_) || {}; + }; + /** + * @return {boolean} The object has properties. + */ + + + BaseObject.prototype.hasProperties = function () { + return !!this.values_; + }; + /** + * @param {string} key Key name. + * @param {*} oldValue Old value. + */ + + + BaseObject.prototype.notify = function (key, oldValue) { + var eventType; + eventType = getChangeEventType(key); + this.dispatchEvent(new ObjectEvent(eventType, key, oldValue)); + eventType = _ObjectEventType.default.PROPERTYCHANGE; + this.dispatchEvent(new ObjectEvent(eventType, key, oldValue)); + }; + /** + * Sets a value. + * @param {string} key Key name. + * @param {*} value Value. + * @param {boolean=} opt_silent Update without triggering an event. + * @api + */ + + + BaseObject.prototype.set = function (key, value, opt_silent) { + var values = this.values_ || (this.values_ = {}); + + if (opt_silent) { + values[key] = value; + } else { + var oldValue = values[key]; + values[key] = value; + + if (oldValue !== value) { + this.notify(key, oldValue); + } + } + }; + /** + * Sets a collection of key-value pairs. Note that this changes any existing + * properties and adds new ones (it does not remove any existing properties). + * @param {Object<string, *>} values Values. + * @param {boolean=} opt_silent Update without triggering an event. + * @api + */ + + + BaseObject.prototype.setProperties = function (values, opt_silent) { + for (var key in values) { + this.set(key, values[key], opt_silent); + } + }; + /** + * Unsets a property. + * @param {string} key Key name. + * @param {boolean=} opt_silent Unset without triggering an event. + * @api + */ + + + BaseObject.prototype.unset = function (key, opt_silent) { + if (this.values_ && key in this.values_) { + var oldValue = this.values_[key]; + delete this.values_[key]; + + if ((0, _obj.isEmpty)(this.values_)) { + this.values_ = null; + } + + if (!opt_silent) { + this.notify(key, oldValue); + } + } + }; + + return BaseObject; +}(_Observable.default); +/** + * @type {Object<string, string>} + */ + + +var changeEventTypeCache = {}; +/** + * @param {string} key Key name. + * @return {string} Change name. + */ + +function getChangeEventType(key) { + return changeEventTypeCache.hasOwnProperty(key) ? changeEventTypeCache[key] : changeEventTypeCache[key] = 'change:' + key; +} + +var _default = BaseObject; +exports.default = _default; +},{"./events/Event.js":"../../../node_modules/ol/events/Event.js","./ObjectEventType.js":"../../../node_modules/ol/ObjectEventType.js","./Observable.js":"../../../node_modules/ol/Observable.js","./obj.js":"../../../node_modules/ol/obj.js","./util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/CollectionEventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/CollectionEventType + */ + +/** + * @enum {string} + */ +var _default = { + /** + * 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' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/Collection.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.CollectionEvent = void 0; + +var _AssertionError = _interopRequireDefault(require("./AssertionError.js")); + +var _Object = _interopRequireDefault(require("./Object.js")); + +var _CollectionEventType = _interopRequireDefault(require("./CollectionEventType.js")); + +var _Event = _interopRequireDefault(require("./events/Event.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Collection + */ + + +/** + * @enum {string} + * @private + */ +var Property = { + LENGTH: 'length' +}; +/** + * @classdesc + * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this + * type. + */ + +var CollectionEvent = +/** @class */ +function (_super) { + __extends(CollectionEvent, _super); + /** + * @param {import("./CollectionEventType.js").default} type Type. + * @param {*=} opt_element Element. + * @param {number=} opt_index The index of the added or removed element. + */ + + + function CollectionEvent(type, opt_element, opt_index) { + var _this = _super.call(this, type) || this; + /** + * The element that is added to or removed from the collection. + * @type {*} + * @api + */ + + + _this.element = opt_element; + /** + * The index of the added or removed element. + * @type {number} + * @api + */ + + _this.index = opt_index; + return _this; + } + + return CollectionEvent; +}(_Event.default); + +exports.CollectionEvent = CollectionEvent; + +/** + * @typedef {Object} Options + * @property {boolean} [unique=false] Disallow the same item from being added to + * the collection twice. + */ + +/** + * @classdesc + * An expanded version of standard JS Array, adding convenience methods for + * manipulation. Add and remove changes to the Collection trigger a Collection + * event. Note that this does not cover changes to the objects _within_ the + * Collection; they trigger events on the appropriate object, not on the + * Collection as a whole. + * + * @fires CollectionEvent + * + * @template T + * @api + */ +var Collection = +/** @class */ +function (_super) { + __extends(Collection, _super); + /** + * @param {Array<T>=} opt_array Array. + * @param {Options=} opt_options Collection options. + */ + + + function Collection(opt_array, opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options || {}; + /** + * @private + * @type {boolean} + */ + + _this.unique_ = !!options.unique; + /** + * @private + * @type {!Array<T>} + */ + + _this.array_ = opt_array ? opt_array : []; + + if (_this.unique_) { + for (var i = 0, ii = _this.array_.length; i < ii; ++i) { + _this.assertUnique_(_this.array_[i], i); + } + } + + _this.updateLength_(); + + return _this; + } + /** + * Remove all elements from the collection. + * @api + */ + + + Collection.prototype.clear = function () { + while (this.getLength() > 0) { + this.pop(); + } + }; + /** + * Add elements to the collection. This pushes each item in the provided array + * to the end of the collection. + * @param {!Array<T>} arr Array. + * @return {Collection<T>} This collection. + * @api + */ + + + Collection.prototype.extend = function (arr) { + for (var i = 0, ii = arr.length; i < ii; ++i) { + this.push(arr[i]); + } + + return this; + }; + /** + * Iterate over each element, calling the provided callback. + * @param {function(T, number, Array<T>): *} f The function to call + * for every element. This function takes 3 arguments (the element, the + * index and the array). The return value is ignored. + * @api + */ + + + Collection.prototype.forEach = function (f) { + var array = this.array_; + + for (var i = 0, ii = array.length; i < ii; ++i) { + f(array[i], i, array); + } + }; + /** + * Get a reference to the underlying Array object. Warning: if the array + * is mutated, no events will be dispatched by the collection, and the + * collection's "length" property won't be in sync with the actual length + * of the array. + * @return {!Array<T>} Array. + * @api + */ + + + Collection.prototype.getArray = function () { + return this.array_; + }; + /** + * Get the element at the provided index. + * @param {number} index Index. + * @return {T} Element. + * @api + */ + + + Collection.prototype.item = function (index) { + return this.array_[index]; + }; + /** + * Get the length of this collection. + * @return {number} The length of the array. + * @observable + * @api + */ + + + Collection.prototype.getLength = function () { + return this.get(Property.LENGTH); + }; + /** + * Insert an element at the provided index. + * @param {number} index Index. + * @param {T} elem Element. + * @api + */ + + + Collection.prototype.insertAt = function (index, elem) { + if (this.unique_) { + this.assertUnique_(elem); + } + + this.array_.splice(index, 0, elem); + this.updateLength_(); + this.dispatchEvent(new CollectionEvent(_CollectionEventType.default.ADD, elem, index)); + }; + /** + * Remove the last element of the collection and return it. + * Return `undefined` if the collection is empty. + * @return {T|undefined} Element. + * @api + */ + + + Collection.prototype.pop = function () { + return this.removeAt(this.getLength() - 1); + }; + /** + * Insert the provided element at the end of the collection. + * @param {T} elem Element. + * @return {number} New length of the collection. + * @api + */ + + + Collection.prototype.push = function (elem) { + if (this.unique_) { + this.assertUnique_(elem); + } + + var n = this.getLength(); + this.insertAt(n, elem); + return this.getLength(); + }; + /** + * Remove the first occurrence of an element from the collection. + * @param {T} elem Element. + * @return {T|undefined} The removed element or undefined if none found. + * @api + */ + + + Collection.prototype.remove = function (elem) { + var arr = this.array_; + + for (var i = 0, ii = arr.length; i < ii; ++i) { + if (arr[i] === elem) { + return this.removeAt(i); + } + } + + return undefined; + }; + /** + * Remove the element at the provided index and return it. + * Return `undefined` if the collection does not contain this index. + * @param {number} index Index. + * @return {T|undefined} Value. + * @api + */ + + + Collection.prototype.removeAt = function (index) { + var prev = this.array_[index]; + this.array_.splice(index, 1); + this.updateLength_(); + this.dispatchEvent(new CollectionEvent(_CollectionEventType.default.REMOVE, prev, index)); + return prev; + }; + /** + * Set the element at the provided index. + * @param {number} index Index. + * @param {T} elem Element. + * @api + */ + + + Collection.prototype.setAt = function (index, elem) { + var n = this.getLength(); + + if (index < n) { + if (this.unique_) { + this.assertUnique_(elem, index); + } + + var prev = this.array_[index]; + this.array_[index] = elem; + this.dispatchEvent(new CollectionEvent(_CollectionEventType.default.REMOVE, prev, index)); + this.dispatchEvent(new CollectionEvent(_CollectionEventType.default.ADD, elem, index)); + } else { + for (var j = n; j < index; ++j) { + this.insertAt(j, undefined); + } + + this.insertAt(index, elem); + } + }; + /** + * @private + */ + + + Collection.prototype.updateLength_ = function () { + this.set(Property.LENGTH, this.array_.length); + }; + /** + * @private + * @param {T} elem Element. + * @param {number=} opt_except Optional index to ignore. + */ + + + Collection.prototype.assertUnique_ = function (elem, opt_except) { + for (var i = 0, ii = this.array_.length; i < ii; ++i) { + if (this.array_[i] === elem && i !== opt_except) { + throw new _AssertionError.default(58); + } + } + }; + + return Collection; +}(_Object.default); + +var _default = Collection; +exports.default = _default; +},{"./AssertionError.js":"../../../node_modules/ol/AssertionError.js","./Object.js":"../../../node_modules/ol/Object.js","./CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","./events/Event.js":"../../../node_modules/ol/events/Event.js"}],"../../../node_modules/ol/asserts.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.assert = assert; + +var _AssertionError = _interopRequireDefault(require("./AssertionError.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/asserts + */ + +/** + * @param {*} assertion Assertion we expected to be truthy. + * @param {number} errorCode Error code. + */ +function assert(assertion, errorCode) { + if (!assertion) { + throw new _AssertionError.default(errorCode); + } +} +},{"./AssertionError.js":"../../../node_modules/ol/AssertionError.js"}],"../../../node_modules/ol/Feature.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createStyleFunction = createStyleFunction; +exports.default = void 0; + +var _Object = _interopRequireWildcard(require("./Object.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _asserts = require("./asserts.js"); + +var _events = require("./events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Feature + */ + + +/** + * @typedef {typeof Feature|typeof import("./render/Feature.js").default} FeatureClass + */ + +/** + * @typedef {Feature|import("./render/Feature.js").default} FeatureLike + */ + +/** + * @classdesc + * A vector object for geographic features with a geometry and other + * attribute properties, similar to the features in vector file formats like + * GeoJSON. + * + * Features can be styled individually with `setStyle`; otherwise they use the + * style of their vector layer. + * + * Note that attribute properties are set as {@link module:ol/Object} properties on + * the feature object, so they are observable, and have get/set accessors. + * + * Typically, a feature has a single geometry property. You can set the + * geometry using the `setGeometry` method and get it with `getGeometry`. + * It is possible to store more than one geometry on a feature using attribute + * properties. By default, the geometry used for rendering is identified by + * the property name `geometry`. If you want to use another geometry property + * for rendering, use the `setGeometryName` method to change the attribute + * property associated with the geometry for the feature. For example: + * + * ```js + * + * import Feature from 'ol/Feature'; + * import Polygon from 'ol/geom/Polygon'; + * import Point from 'ol/geom/Point'; + * + * var feature = new Feature({ + * geometry: new Polygon(polyCoords), + * labelPoint: new Point(labelCoords), + * name: 'My Polygon' + * }); + * + * // get the polygon geometry + * var poly = feature.getGeometry(); + * + * // Render the feature as a point using the coordinates from labelPoint + * feature.setGeometryName('labelPoint'); + * + * // get the point geometry + * var point = feature.getGeometry(); + * ``` + * + * @api + * @template {import("./geom/Geometry.js").default} Geometry + */ +var Feature = +/** @class */ +function (_super) { + __extends(Feature, _super); + /** + * @param {Geometry|Object<string, *>=} opt_geometryOrProperties + * You may pass a Geometry object directly, or an object literal containing + * properties. If you pass an object literal, you may include a Geometry + * associated with a `geometry` key. + */ + + + function Feature(opt_geometryOrProperties) { + var _this = _super.call(this) || this; + /** + * @private + * @type {number|string|undefined} + */ + + + _this.id_ = undefined; + /** + * @type {string} + * @private + */ + + _this.geometryName_ = 'geometry'; + /** + * User provided style. + * @private + * @type {import("./style/Style.js").StyleLike} + */ + + _this.style_ = null; + /** + * @private + * @type {import("./style/Style.js").StyleFunction|undefined} + */ + + _this.styleFunction_ = undefined; + /** + * @private + * @type {?import("./events.js").EventsKey} + */ + + _this.geometryChangeKey_ = null; + + _this.addEventListener((0, _Object.getChangeEventType)(_this.geometryName_), _this.handleGeometryChanged_); + + if (opt_geometryOrProperties) { + if (typeof + /** @type {?} */ + opt_geometryOrProperties.getSimplifiedGeometry === 'function') { + var geometry = + /** @type {Geometry} */ + opt_geometryOrProperties; + + _this.setGeometry(geometry); + } else { + /** @type {Object<string, *>} */ + var properties = opt_geometryOrProperties; + + _this.setProperties(properties); + } + } + + return _this; + } + /** + * Clone this feature. If the original feature has a geometry it + * is also cloned. The feature id is not set in the clone. + * @return {Feature} The clone. + * @api + */ + + + Feature.prototype.clone = function () { + var clone = new Feature(this.hasProperties() ? this.getProperties() : null); + clone.setGeometryName(this.getGeometryName()); + var geometry = this.getGeometry(); + + if (geometry) { + clone.setGeometry(geometry.clone()); + } + + var style = this.getStyle(); + + if (style) { + clone.setStyle(style); + } + + return clone; + }; + /** + * Get the feature's default geometry. A feature may have any number of named + * geometries. The "default" geometry (the one that is rendered by default) is + * set when calling {@link module:ol/Feature~Feature#setGeometry}. + * @return {Geometry|undefined} The default geometry for the feature. + * @api + * @observable + */ + + + Feature.prototype.getGeometry = function () { + return ( + /** @type {Geometry|undefined} */ + this.get(this.geometryName_) + ); + }; + /** + * Get the feature identifier. This is a stable identifier for the feature and + * is either set when reading data from a remote source or set explicitly by + * calling {@link module:ol/Feature~Feature#setId}. + * @return {number|string|undefined} Id. + * @api + */ + + + Feature.prototype.getId = function () { + return this.id_; + }; + /** + * Get the name of the feature's default geometry. By default, the default + * geometry is named `geometry`. + * @return {string} Get the property name associated with the default geometry + * for this feature. + * @api + */ + + + Feature.prototype.getGeometryName = function () { + return this.geometryName_; + }; + /** + * Get the feature's style. Will return what was provided to the + * {@link module:ol/Feature~Feature#setStyle} method. + * @return {import("./style/Style.js").StyleLike|undefined} The feature style. + * @api + */ + + + Feature.prototype.getStyle = function () { + return this.style_; + }; + /** + * Get the feature's style function. + * @return {import("./style/Style.js").StyleFunction|undefined} Return a function + * representing the current style of this feature. + * @api + */ + + + Feature.prototype.getStyleFunction = function () { + return this.styleFunction_; + }; + /** + * @private + */ + + + Feature.prototype.handleGeometryChange_ = function () { + this.changed(); + }; + /** + * @private + */ + + + Feature.prototype.handleGeometryChanged_ = function () { + if (this.geometryChangeKey_) { + (0, _events.unlistenByKey)(this.geometryChangeKey_); + this.geometryChangeKey_ = null; + } + + var geometry = this.getGeometry(); + + if (geometry) { + this.geometryChangeKey_ = (0, _events.listen)(geometry, _EventType.default.CHANGE, this.handleGeometryChange_, this); + } + + this.changed(); + }; + /** + * Set the default geometry for the feature. This will update the property + * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}. + * @param {Geometry|undefined} geometry The new geometry. + * @api + * @observable + */ + + + Feature.prototype.setGeometry = function (geometry) { + this.set(this.geometryName_, geometry); + }; + /** + * Set the style for the feature to override the layer style. This can be a + * single style object, an array of styles, or a function that takes a + * resolution and returns an array of styles. To unset the feature style, call + * `setStyle()` without arguments or a falsey value. + * @param {import("./style/Style.js").StyleLike=} opt_style Style for this feature. + * @api + * @fires module:ol/events/Event~BaseEvent#event:change + */ + + + Feature.prototype.setStyle = function (opt_style) { + this.style_ = opt_style; + this.styleFunction_ = !opt_style ? undefined : createStyleFunction(opt_style); + this.changed(); + }; + /** + * Set the feature id. The feature id is considered stable and may be used when + * requesting features or comparing identifiers returned from a remote source. + * The feature id can be used with the + * {@link module:ol/source/Vector~VectorSource#getFeatureById} method. + * @param {number|string|undefined} id The feature id. + * @api + * @fires module:ol/events/Event~BaseEvent#event:change + */ + + + Feature.prototype.setId = function (id) { + this.id_ = id; + this.changed(); + }; + /** + * Set the property name to be used when getting the feature's default geometry. + * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with + * this name will be returned. + * @param {string} name The property name of the default geometry. + * @api + */ + + + Feature.prototype.setGeometryName = function (name) { + this.removeEventListener((0, _Object.getChangeEventType)(this.geometryName_), this.handleGeometryChanged_); + this.geometryName_ = name; + this.addEventListener((0, _Object.getChangeEventType)(this.geometryName_), this.handleGeometryChanged_); + this.handleGeometryChanged_(); + }; + + return Feature; +}(_Object.default); +/** + * Convert the provided object into a feature style function. Functions passed + * through unchanged. Arrays of Style or single style objects wrapped + * in a new feature style function. + * @param {!import("./style/Style.js").StyleFunction|!Array<import("./style/Style.js").default>|!import("./style/Style.js").default} obj + * A feature style function, a single style, or an array of styles. + * @return {import("./style/Style.js").StyleFunction} A style function. + */ + + +function createStyleFunction(obj) { + if (typeof obj === 'function') { + return obj; + } else { + /** + * @type {Array<import("./style/Style.js").default>} + */ + var styles_1; + + if (Array.isArray(obj)) { + styles_1 = obj; + } else { + (0, _asserts.assert)(typeof + /** @type {?} */ + obj.getZIndex === 'function', 41); // Expected an `import("./style/Style.js").Style` or an array of `import("./style/Style.js").Style` + + var style = + /** @type {import("./style/Style.js").default} */ + obj; + styles_1 = [style]; + } + + return function () { + return styles_1; + }; + } +} + +var _default = Feature; +exports.default = _default; +},{"./Object.js":"../../../node_modules/ol/Object.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./asserts.js":"../../../node_modules/ol/asserts.js","./events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/geom/GeometryLayout.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/geom/GeometryLayout + */ + +/** + * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z') + * or measure ('M') coordinate is available. Supported values are `'XY'`, + * `'XYZ'`, `'XYM'`, `'XYZM'`. + * @enum {string} + */ +var _default = { + XY: 'XY', + XYZ: 'XYZ', + XYM: 'XYM', + XYZM: 'XYZM' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/geom/GeometryType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/geom/GeometryType + */ + +/** + * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`, + * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`, + * `'GeometryCollection'`, `'Circle'`. + * @enum {string} + */ +var _default = { + POINT: 'Point', + LINE_STRING: 'LineString', + LINEAR_RING: 'LinearRing', + POLYGON: 'Polygon', + MULTI_POINT: 'MultiPoint', + MULTI_LINE_STRING: 'MultiLineString', + MULTI_POLYGON: 'MultiPolygon', + GEOMETRY_COLLECTION: 'GeometryCollection', + CIRCLE: 'Circle' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/proj/Units.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.METERS_PER_UNIT = void 0; + +/** + * @module ol/proj/Units + */ + +/** + * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or + * `'us-ft'`. + * @enum {string} + */ +var Units = { + DEGREES: 'degrees', + FEET: 'ft', + METERS: 'm', + PIXELS: 'pixels', + TILE_PIXELS: 'tile-pixels', + USFEET: 'us-ft' +}; +/** + * Meters per unit lookup table. + * @const + * @type {Object<Units, number>} + * @api + */ + +var METERS_PER_UNIT = {}; // use the radius of the Normal sphere + +exports.METERS_PER_UNIT = METERS_PER_UNIT; +METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360; +METERS_PER_UNIT[Units.FEET] = 0.3048; +METERS_PER_UNIT[Units.METERS] = 1; +METERS_PER_UNIT[Units.USFEET] = 1200 / 3937; +var _default = Units; +exports.default = _default; +},{}],"../../../node_modules/ol/transform.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.reset = reset; +exports.multiply = multiply; +exports.set = set; +exports.setFromArray = setFromArray; +exports.apply = apply; +exports.rotate = rotate; +exports.scale = scale; +exports.makeScale = makeScale; +exports.translate = translate; +exports.compose = compose; +exports.composeCssTransform = composeCssTransform; +exports.invert = invert; +exports.makeInverse = makeInverse; +exports.determinant = determinant; +exports.toString = toString; + +var _asserts = require("./asserts.js"); + +/** + * @module ol/transform + */ + +/** + * An array representing an affine 2d transformation for use with + * {@link module:ol/transform} functions. The array has 6 elements. + * @typedef {!Array<number>} Transform + * @api + */ + +/** + * Collection of affine 2d transformation functions. The functions work on an + * array of 6 elements. The element order is compatible with the [SVGMatrix + * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is + * a subset (elements a to f) of a 3×3 matrix: + * ``` + * [ a c e ] + * [ b d f ] + * [ 0 0 1 ] + * ``` + */ + +/** + * @private + * @type {Transform} + */ +var tmp_ = new Array(6); +/** + * Create an identity transform. + * @return {!Transform} Identity transform. + */ + +function create() { + return [1, 0, 0, 1, 0, 0]; +} +/** + * Resets the given transform to an identity transform. + * @param {!Transform} transform Transform. + * @return {!Transform} Transform. + */ + + +function reset(transform) { + return set(transform, 1, 0, 0, 1, 0, 0); +} +/** + * Multiply the underlying matrices of two transforms and return the result in + * the first transform. + * @param {!Transform} transform1 Transform parameters of matrix 1. + * @param {!Transform} transform2 Transform parameters of matrix 2. + * @return {!Transform} transform1 multiplied with transform2. + */ + + +function multiply(transform1, transform2) { + var a1 = transform1[0]; + var b1 = transform1[1]; + var c1 = transform1[2]; + var d1 = transform1[3]; + var e1 = transform1[4]; + var f1 = transform1[5]; + var a2 = transform2[0]; + var b2 = transform2[1]; + var c2 = transform2[2]; + var d2 = transform2[3]; + var e2 = transform2[4]; + var f2 = transform2[5]; + transform1[0] = a1 * a2 + c1 * b2; + transform1[1] = b1 * a2 + d1 * b2; + transform1[2] = a1 * c2 + c1 * d2; + transform1[3] = b1 * c2 + d1 * d2; + transform1[4] = a1 * e2 + c1 * f2 + e1; + transform1[5] = b1 * e2 + d1 * f2 + f1; + return transform1; +} +/** + * Set the transform components a-f on a given transform. + * @param {!Transform} transform Transform. + * @param {number} a The a component of the transform. + * @param {number} b The b component of the transform. + * @param {number} c The c component of the transform. + * @param {number} d The d component of the transform. + * @param {number} e The e component of the transform. + * @param {number} f The f component of the transform. + * @return {!Transform} Matrix with transform applied. + */ + + +function set(transform, a, b, c, d, e, f) { + transform[0] = a; + transform[1] = b; + transform[2] = c; + transform[3] = d; + transform[4] = e; + transform[5] = f; + return transform; +} +/** + * Set transform on one matrix from another matrix. + * @param {!Transform} transform1 Matrix to set transform to. + * @param {!Transform} transform2 Matrix to set transform from. + * @return {!Transform} transform1 with transform from transform2 applied. + */ + + +function setFromArray(transform1, transform2) { + transform1[0] = transform2[0]; + transform1[1] = transform2[1]; + transform1[2] = transform2[2]; + transform1[3] = transform2[3]; + transform1[4] = transform2[4]; + transform1[5] = transform2[5]; + return transform1; +} +/** + * Transforms the given coordinate with the given transform returning the + * resulting, transformed coordinate. The coordinate will be modified in-place. + * + * @param {Transform} transform The transformation. + * @param {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} coordinate The coordinate to transform. + * @return {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} return coordinate so that operations can be + * chained together. + */ + + +function apply(transform, coordinate) { + var x = coordinate[0]; + var y = coordinate[1]; + coordinate[0] = transform[0] * x + transform[2] * y + transform[4]; + coordinate[1] = transform[1] * x + transform[3] * y + transform[5]; + return coordinate; +} +/** + * Applies rotation to the given transform. + * @param {!Transform} transform Transform. + * @param {number} angle Angle in radians. + * @return {!Transform} The rotated transform. + */ + + +function rotate(transform, angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0)); +} +/** + * Applies scale to a given transform. + * @param {!Transform} transform Transform. + * @param {number} x Scale factor x. + * @param {number} y Scale factor y. + * @return {!Transform} The scaled transform. + */ + + +function scale(transform, x, y) { + return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0)); +} +/** + * Creates a scale transform. + * @param {!Transform} target Transform to overwrite. + * @param {number} x Scale factor x. + * @param {number} y Scale factor y. + * @return {!Transform} The scale transform. + */ + + +function makeScale(target, x, y) { + return set(target, x, 0, 0, y, 0, 0); +} +/** + * Applies translation to the given transform. + * @param {!Transform} transform Transform. + * @param {number} dx Translation x. + * @param {number} dy Translation y. + * @return {!Transform} The translated transform. + */ + + +function translate(transform, dx, dy) { + return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy)); +} +/** + * Creates a composite transform given an initial translation, scale, rotation, and + * final translation (in that order only, not commutative). + * @param {!Transform} transform The transform (will be modified in place). + * @param {number} dx1 Initial translation x. + * @param {number} dy1 Initial translation y. + * @param {number} sx Scale factor x. + * @param {number} sy Scale factor y. + * @param {number} angle Rotation (in counter-clockwise radians). + * @param {number} dx2 Final translation x. + * @param {number} dy2 Final translation y. + * @return {!Transform} The composite transform. + */ + + +function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) { + var sin = Math.sin(angle); + var cos = Math.cos(angle); + transform[0] = sx * cos; + transform[1] = sy * sin; + transform[2] = -sx * sin; + transform[3] = sy * cos; + transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1; + transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1; + return transform; +} +/** + * Creates a composite transform given an initial translation, scale, rotation, and + * final translation (in that order only, not commutative). The resulting transform + * string can be applied as `transform` porperty of an HTMLElement's style. + * @param {number} dx1 Initial translation x. + * @param {number} dy1 Initial translation y. + * @param {number} sx Scale factor x. + * @param {number} sy Scale factor y. + * @param {number} angle Rotation (in counter-clockwise radians). + * @param {number} dx2 Final translation x. + * @param {number} dy2 Final translation y. + * @return {string} The composite css transform. + * @api + */ + + +function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) { + return toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2)); +} +/** + * Invert the given transform. + * @param {!Transform} source The source transform to invert. + * @return {!Transform} The inverted (source) transform. + */ + + +function invert(source) { + return makeInverse(source, source); +} +/** + * Invert the given transform. + * @param {!Transform} target Transform to be set as the inverse of + * the source transform. + * @param {!Transform} source The source transform to invert. + * @return {!Transform} The inverted (target) transform. + */ + + +function makeInverse(target, source) { + var det = determinant(source); + (0, _asserts.assert)(det !== 0, 32); // Transformation matrix cannot be inverted + + var a = source[0]; + var b = source[1]; + var c = source[2]; + var d = source[3]; + var e = source[4]; + var f = source[5]; + target[0] = d / det; + target[1] = -b / det; + target[2] = -c / det; + target[3] = a / det; + target[4] = (c * f - d * e) / det; + target[5] = -(a * f - b * e) / det; + return target; +} +/** + * Returns the determinant of the given matrix. + * @param {!Transform} mat Matrix. + * @return {number} Determinant. + */ + + +function determinant(mat) { + return mat[0] * mat[3] - mat[1] * mat[2]; +} +/** + * A string version of the transform. This can be used + * for CSS transforms. + * @param {!Transform} mat Matrix. + * @return {string} The transform as a string. + */ + + +function toString(mat) { + return 'matrix(' + mat.join(', ') + ')'; +} +},{"./asserts.js":"../../../node_modules/ol/asserts.js"}],"../../../node_modules/ol/extent/Corner.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/extent/Corner + */ + +/** + * Extent corner. + * @enum {string} + */ +var _default = { + BOTTOM_LEFT: 'bottom-left', + BOTTOM_RIGHT: 'bottom-right', + TOP_LEFT: 'top-left', + TOP_RIGHT: 'top-right' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/extent/Relationship.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/extent/Relationship + */ + +/** + * Relationship to an extent. + * @enum {number} + */ +var _default = { + UNKNOWN: 0, + INTERSECTING: 1, + ABOVE: 2, + RIGHT: 4, + BELOW: 8, + LEFT: 16 +}; +exports.default = _default; +},{}],"../../../node_modules/ol/extent.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.boundingExtent = boundingExtent; +exports.buffer = buffer; +exports.clone = clone; +exports.closestSquaredDistanceXY = closestSquaredDistanceXY; +exports.containsCoordinate = containsCoordinate; +exports.containsExtent = containsExtent; +exports.containsXY = containsXY; +exports.coordinateRelationship = coordinateRelationship; +exports.createEmpty = createEmpty; +exports.createOrUpdate = createOrUpdate; +exports.createOrUpdateEmpty = createOrUpdateEmpty; +exports.createOrUpdateFromCoordinate = createOrUpdateFromCoordinate; +exports.createOrUpdateFromCoordinates = createOrUpdateFromCoordinates; +exports.createOrUpdateFromFlatCoordinates = createOrUpdateFromFlatCoordinates; +exports.createOrUpdateFromRings = createOrUpdateFromRings; +exports.equals = equals; +exports.approximatelyEquals = approximatelyEquals; +exports.extend = extend; +exports.extendCoordinate = extendCoordinate; +exports.extendCoordinates = extendCoordinates; +exports.extendFlatCoordinates = extendFlatCoordinates; +exports.extendRings = extendRings; +exports.extendXY = extendXY; +exports.forEachCorner = forEachCorner; +exports.getArea = getArea; +exports.getBottomLeft = getBottomLeft; +exports.getBottomRight = getBottomRight; +exports.getCenter = getCenter; +exports.getCorner = getCorner; +exports.getEnlargedArea = getEnlargedArea; +exports.getForViewAndSize = getForViewAndSize; +exports.getHeight = getHeight; +exports.getIntersectionArea = getIntersectionArea; +exports.getIntersection = getIntersection; +exports.getMargin = getMargin; +exports.getSize = getSize; +exports.getTopLeft = getTopLeft; +exports.getTopRight = getTopRight; +exports.getWidth = getWidth; +exports.intersects = intersects; +exports.isEmpty = isEmpty; +exports.returnOrUpdate = returnOrUpdate; +exports.scaleFromCenter = scaleFromCenter; +exports.intersectsSegment = intersectsSegment; +exports.applyTransform = applyTransform; +exports.wrapX = wrapX; + +var _Corner = _interopRequireDefault(require("./extent/Corner.js")); + +var _Relationship = _interopRequireDefault(require("./extent/Relationship.js")); + +var _asserts = require("./asserts.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/extent + */ + +/** + * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. + * @typedef {Array<number>} Extent + * @api + */ + +/** + * Build an extent that includes all given coordinates. + * + * @param {Array<import("./coordinate.js").Coordinate>} 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<number>} xs Xs. + * @param {Array<number>} 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 = _Relationship.default.UNKNOWN; + + if (x < minX) { + relationship = relationship | _Relationship.default.LEFT; + } else if (x > maxX) { + relationship = relationship | _Relationship.default.RIGHT; + } + + if (y < minY) { + relationship = relationship | _Relationship.default.BELOW; + } else if (y > maxY) { + relationship = relationship | _Relationship.default.ABOVE; + } + + if (relationship === _Relationship.default.UNKNOWN) { + relationship = _Relationship.default.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<import("./coordinate.js").Coordinate>} 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<number>} 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<Array<import("./coordinate.js").Coordinate>>} 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<import("./coordinate.js").Coordinate>} 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<number>} 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<Array<import("./coordinate.js").Coordinate>>} 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 {import("./extent/Corner.js").default} corner Corner. + * @return {import("./coordinate.js").Coordinate} Corner coordinate. + */ + + +function getCorner(extent, corner) { + var coordinate; + + if (corner === _Corner.default.BOTTOM_LEFT) { + coordinate = getBottomLeft(extent); + } else if (corner === _Corner.default.BOTTOM_RIGHT) { + coordinate = getBottomRight(extent); + } else if (corner === _Corner.default.TOP_LEFT) { + coordinate = getTopLeft(extent); + } else if (corner === _Corner.default.TOP_RIGHT) { + coordinate = getTopRight(extent); + } else { + (0, _asserts.assert)(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 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]; + var x0 = x - xCos + ySin; + var x1 = x - xCos - ySin; + var x2 = x + xCos - ySin; + var x3 = x + xCos + ySin; + var y0 = y - xSin - yCos; + var y1 = y - xSin + yCos; + var y2 = y + xSin + yCos; + var y3 = y + xSin - yCos; + 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); +} +/** + * 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 === _Relationship.default.INTERSECTING || endRel === _Relationship.default.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 & _Relationship.default.ABOVE) && !(startRel & _Relationship.default.ABOVE)) { + // potentially intersects top + x = endX - (endY - maxY) / slope; + intersects = x >= minX && x <= maxX; + } + + if (!intersects && !!(endRel & _Relationship.default.RIGHT) && !(startRel & _Relationship.default.RIGHT)) { + // potentially intersects right + y = endY - (endX - maxX) * slope; + intersects = y >= minY && y <= maxY; + } + + if (!intersects && !!(endRel & _Relationship.default.BELOW) && !(startRel & _Relationship.default.BELOW)) { + // potentially intersects bottom + x = endX - (endY - minY) / slope; + intersects = x >= minX && x <= maxX; + } + + if (!intersects && !!(endRel & _Relationship.default.LEFT) && !(startRel & _Relationship.default.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; +} +},{"./extent/Corner.js":"../../../node_modules/ol/extent/Corner.js","./extent/Relationship.js":"../../../node_modules/ol/extent/Relationship.js","./asserts.js":"../../../node_modules/ol/asserts.js"}],"../../../node_modules/ol/proj/Projection.js":[function(require,module,exports) { +var global = arguments[3]; +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Units = require("./Units.js"); + +/** + * @module ol/proj/Projection + */ + +/** + * @typedef {Object} Options + * @property {string} code The SRS identifier code, e.g. `EPSG:4326`. + * @property {import("./Units.js").default|string} [units] Units. Required unless a + * proj4 projection is defined for `code`. + * @property {import("../extent.js").Extent} [extent] The validity extent for the SRS. + * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4. + * @property {boolean} [global=false] Whether the projection is valid for the whole globe. + * @property {number} [metersPerUnit] The meters per unit for the SRS. + * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT} + * lookup table. + * @property {import("../extent.js").Extent} [worldExtent] The world extent for the SRS. + * @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution] + * Function to determine resolution at a point. The function is called with a + * `{number}` view resolution and an `{import("../coordinate.js").Coordinate}` as arguments, and returns + * the `{number}` resolution in projection units at the passed coordinate. If this is `undefined`, + * the default {@link module:ol/proj#getPointResolution} function will be used. + */ + +/** + * @classdesc + * Projection definition class. One of these is created for each projection + * supported in the application and stored in the {@link module:ol/proj} namespace. + * You can use these in applications, but this is not required, as API params + * and options use {@link module:ol/proj~ProjectionLike} which means the simple string + * code will suffice. + * + * You can use {@link module:ol/proj~get} to retrieve the object for a particular + * projection. + * + * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together + * with the following aliases: + * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, + * urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84, + * http://www.opengis.net/gml/srs/epsg.xml#4326, + * urn:x-ogc:def:crs:EPSG:4326 + * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913, + * urn:ogc:def:crs:EPSG:6.18:3:3857, + * http://www.opengis.net/gml/srs/epsg.xml#3857 + * + * If you use [proj4js](https://github.com/proj4js/proj4js), aliases can + * be added using `proj4.defs()`. After all required projection definitions are + * added, call the {@link module:ol/proj/proj4~register} function. + * + * @api + */ +var Projection = +/** @class */ +function () { + /** + * @param {Options} options Projection options. + */ + function Projection(options) { + /** + * @private + * @type {string} + */ + this.code_ = options.code; + /** + * Units of projected coordinates. When set to `TILE_PIXELS`, a + * `this.extent_` and `this.worldExtent_` must be configured properly for each + * tile. + * @private + * @type {import("./Units.js").default} + */ + + this.units_ = + /** @type {import("./Units.js").default} */ + options.units; + /** + * Validity extent of the projection in projected coordinates. For projections + * with `TILE_PIXELS` units, this is the extent of the tile in + * tile pixel space. + * @private + * @type {import("../extent.js").Extent} + */ + + this.extent_ = options.extent !== undefined ? options.extent : null; + /** + * Extent of the world in EPSG:4326. For projections with + * `TILE_PIXELS` units, this is the extent of the tile in + * projected coordinate space. + * @private + * @type {import("../extent.js").Extent} + */ + + this.worldExtent_ = options.worldExtent !== undefined ? options.worldExtent : null; + /** + * @private + * @type {string} + */ + + this.axisOrientation_ = options.axisOrientation !== undefined ? options.axisOrientation : 'enu'; + /** + * @private + * @type {boolean} + */ + + this.global_ = options.global !== undefined ? options.global : false; + /** + * @private + * @type {boolean} + */ + + this.canWrapX_ = !!(this.global_ && this.extent_); + /** + * @private + * @type {function(number, import("../coordinate.js").Coordinate):number|undefined} + */ + + this.getPointResolutionFunc_ = options.getPointResolution; + /** + * @private + * @type {import("../tilegrid/TileGrid.js").default} + */ + + this.defaultTileGrid_ = null; + /** + * @private + * @type {number|undefined} + */ + + this.metersPerUnit_ = options.metersPerUnit; + } + /** + * @return {boolean} The projection is suitable for wrapping the x-axis + */ + + + Projection.prototype.canWrapX = function () { + return this.canWrapX_; + }; + /** + * Get the code for this projection, e.g. 'EPSG:4326'. + * @return {string} Code. + * @api + */ + + + Projection.prototype.getCode = function () { + return this.code_; + }; + /** + * Get the validity extent for this projection. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + + + Projection.prototype.getExtent = function () { + return this.extent_; + }; + /** + * Get the units of this projection. + * @return {import("./Units.js").default} Units. + * @api + */ + + + Projection.prototype.getUnits = function () { + return this.units_; + }; + /** + * Get the amount of meters per unit of this projection. If the projection is + * not configured with `metersPerUnit` or a units identifier, the return is + * `undefined`. + * @return {number|undefined} Meters. + * @api + */ + + + Projection.prototype.getMetersPerUnit = function () { + return this.metersPerUnit_ || _Units.METERS_PER_UNIT[this.units_]; + }; + /** + * Get the world extent for this projection. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + + + Projection.prototype.getWorldExtent = function () { + return this.worldExtent_; + }; + /** + * Get the axis orientation of this projection. + * Example values are: + * enu - the default easting, northing, elevation. + * neu - northing, easting, up - useful for "lat/long" geographic coordinates, + * or south orientated transverse mercator. + * wnu - westing, northing, up - some planetary coordinate systems have + * "west positive" coordinate systems + * @return {string} Axis orientation. + * @api + */ + + + Projection.prototype.getAxisOrientation = function () { + return this.axisOrientation_; + }; + /** + * Is this projection a global projection which spans the whole world? + * @return {boolean} Whether the projection is global. + * @api + */ + + + Projection.prototype.isGlobal = function () { + return this.global_; + }; + /** + * Set if the projection is a global projection which spans the whole world + * @param {boolean} global Whether the projection is global. + * @api + */ + + + Projection.prototype.setGlobal = function (global) { + this.global_ = global; + this.canWrapX_ = !!(global && this.extent_); + }; + /** + * @return {import("../tilegrid/TileGrid.js").default} The default tile grid. + */ + + + Projection.prototype.getDefaultTileGrid = function () { + return this.defaultTileGrid_; + }; + /** + * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid. + */ + + + Projection.prototype.setDefaultTileGrid = function (tileGrid) { + this.defaultTileGrid_ = tileGrid; + }; + /** + * Set the validity extent for this projection. + * @param {import("../extent.js").Extent} extent Extent. + * @api + */ + + + Projection.prototype.setExtent = function (extent) { + this.extent_ = extent; + this.canWrapX_ = !!(this.global_ && extent); + }; + /** + * Set the world extent for this projection. + * @param {import("../extent.js").Extent} worldExtent World extent + * [minlon, minlat, maxlon, maxlat]. + * @api + */ + + + Projection.prototype.setWorldExtent = function (worldExtent) { + this.worldExtent_ = worldExtent; + }; + /** + * Set the getPointResolution function (see {@link module:ol/proj~getPointResolution} + * for this projection. + * @param {function(number, import("../coordinate.js").Coordinate):number} func Function + * @api + */ + + + Projection.prototype.setGetPointResolution = function (func) { + this.getPointResolutionFunc_ = func; + }; + /** + * Get the custom point resolution function for this projection (if set). + * @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point + * resolution function (if set). + */ + + + Projection.prototype.getPointResolutionFunc = function () { + return this.getPointResolutionFunc_; + }; + + return Projection; +}(); + +var _default = Projection; +exports.default = _default; +},{"./Units.js":"../../../node_modules/ol/proj/Units.js"}],"../../../node_modules/ol/math.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clamp = clamp; +exports.squaredSegmentDistance = squaredSegmentDistance; +exports.squaredDistance = squaredDistance; +exports.solveLinearSystem = solveLinearSystem; +exports.toDegrees = toDegrees; +exports.toRadians = toRadians; +exports.modulo = modulo; +exports.lerp = lerp; +exports.log2 = exports.cosh = void 0; + +/** + * @module ol/math + */ + +/** + * Takes a number and clamps it to within the provided bounds. + * @param {number} value The input number. + * @param {number} min The minimum value to return. + * @param {number} max The maximum value to return. + * @return {number} The input number if it is within bounds, or the nearest + * number within the bounds. + */ +function clamp(value, min, max) { + return Math.min(Math.max(value, min), max); +} +/** + * Return the hyperbolic cosine of a given number. The method will use the + * native `Math.cosh` function if it is available, otherwise the hyperbolic + * cosine will be calculated via the reference implementation of the Mozilla + * developer network. + * + * @param {number} x X. + * @return {number} Hyperbolic cosine of x. + */ + + +var cosh = function () { + // Wrapped in a iife, to save the overhead of checking for the native + // implementation on every invocation. + var cosh; + + if ('cosh' in Math) { + // The environment supports the native Math.cosh function, use it… + cosh = Math.cosh; + } else { + // … else, use the reference implementation of MDN: + cosh = function (x) { + var y = + /** @type {Math} */ + Math.exp(x); + return (y + 1 / y) / 2; + }; + } + + return cosh; +}(); +/** + * Return the base 2 logarithm of a given number. The method will use the + * native `Math.log2` function if it is available, otherwise the base 2 + * logarithm will be calculated via the reference implementation of the + * Mozilla developer network. + * + * @param {number} x X. + * @return {number} Base 2 logarithm of x. + */ + + +exports.cosh = cosh; + +var log2 = function () { + // Wrapped in a iife, to save the overhead of checking for the native + // implementation on every invocation. + var log2; + + if ('log2' in Math) { + // The environment supports the native Math.log2 function, use it… + log2 = Math.log2; + } else { + // … else, use the reference implementation of MDN: + log2 = function (x) { + return Math.log(x) * Math.LOG2E; + }; + } + + return log2; +}(); +/** + * Returns the square of the closest distance between the point (x, y) and the + * line segment (x1, y1) to (x2, y2). + * @param {number} x X. + * @param {number} y Y. + * @param {number} x1 X1. + * @param {number} y1 Y1. + * @param {number} x2 X2. + * @param {number} y2 Y2. + * @return {number} Squared distance. + */ + + +exports.log2 = log2; + +function squaredSegmentDistance(x, y, x1, y1, x2, y2) { + var dx = x2 - x1; + var dy = y2 - y1; + + if (dx !== 0 || dy !== 0) { + var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy); + + if (t > 1) { + x1 = x2; + y1 = y2; + } else if (t > 0) { + x1 += dx * t; + y1 += dy * t; + } + } + + return squaredDistance(x, y, x1, y1); +} +/** + * Returns the square of the distance between the points (x1, y1) and (x2, y2). + * @param {number} x1 X1. + * @param {number} y1 Y1. + * @param {number} x2 X2. + * @param {number} y2 Y2. + * @return {number} Squared distance. + */ + + +function squaredDistance(x1, y1, x2, y2) { + var dx = x2 - x1; + var dy = y2 - y1; + return dx * dx + dy * dy; +} +/** + * Solves system of linear equations using Gaussian elimination method. + * + * @param {Array<Array<number>>} mat Augmented matrix (n x n + 1 column) + * in row-major order. + * @return {Array<number>} The resulting vector. + */ + + +function solveLinearSystem(mat) { + var n = mat.length; + + for (var i = 0; i < n; i++) { + // Find max in the i-th column (ignoring i - 1 first rows) + var maxRow = i; + var maxEl = Math.abs(mat[i][i]); + + for (var r = i + 1; r < n; r++) { + var absValue = Math.abs(mat[r][i]); + + if (absValue > maxEl) { + maxEl = absValue; + maxRow = r; + } + } + + if (maxEl === 0) { + return null; // matrix is singular + } // Swap max row with i-th (current) row + + + var tmp = mat[maxRow]; + mat[maxRow] = mat[i]; + mat[i] = tmp; // Subtract the i-th row to make all the remaining rows 0 in the i-th column + + for (var j = i + 1; j < n; j++) { + var coef = -mat[j][i] / mat[i][i]; + + for (var k = i; k < n + 1; k++) { + if (i == k) { + mat[j][k] = 0; + } else { + mat[j][k] += coef * mat[i][k]; + } + } + } + } // Solve Ax=b for upper triangular matrix A (mat) + + + var x = new Array(n); + + for (var l = n - 1; l >= 0; l--) { + x[l] = mat[l][n] / mat[l][l]; + + for (var m = l - 1; m >= 0; m--) { + mat[m][n] -= mat[m][l] * x[l]; + } + } + + return x; +} +/** + * Converts radians to to degrees. + * + * @param {number} angleInRadians Angle in radians. + * @return {number} Angle in degrees. + */ + + +function toDegrees(angleInRadians) { + return angleInRadians * 180 / Math.PI; +} +/** + * Converts degrees to radians. + * + * @param {number} angleInDegrees Angle in degrees. + * @return {number} Angle in radians. + */ + + +function toRadians(angleInDegrees) { + return angleInDegrees * Math.PI / 180; +} +/** + * Returns the modulo of a / b, depending on the sign of b. + * + * @param {number} a Dividend. + * @param {number} b Divisor. + * @return {number} Modulo. + */ + + +function modulo(a, b) { + var r = a % b; + return r * b < 0 ? r + b : r; +} +/** + * Calculates the linearly interpolated value of x between a and b. + * + * @param {number} a Number + * @param {number} b Number + * @param {number} x Value to be interpolated. + * @return {number} Interpolated value. + */ + + +function lerp(a, b, x) { + return a + x * (b - a); +} +},{}],"../../../node_modules/ol/proj/epsg3857.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fromEPSG4326 = fromEPSG4326; +exports.toEPSG4326 = toEPSG4326; +exports.PROJECTIONS = exports.WORLD_EXTENT = exports.EXTENT = exports.HALF_SIZE = exports.RADIUS = void 0; + +var _Projection = _interopRequireDefault(require("./Projection.js")); + +var _Units = _interopRequireDefault(require("./Units.js")); + +var _math = require("../math.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + 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} + */ + +exports.RADIUS = RADIUS; +var HALF_SIZE = Math.PI * RADIUS; +/** + * @const + * @type {import("../extent.js").Extent} + */ + +exports.HALF_SIZE = HALF_SIZE; +var EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE]; +/** + * @const + * @type {import("../extent.js").Extent} + */ + +exports.EXTENT = EXTENT; +var WORLD_EXTENT = [-180, -85, 180, 85]; +/** + * @classdesc + * Projection object for web/spherical Mercator (EPSG:3857). + */ + +exports.WORLD_EXTENT = WORLD_EXTENT; + +var EPSG3857Projection = +/** @class */ +function (_super) { + __extends(EPSG3857Projection, _super); + /** + * @param {string} code Code. + */ + + + function EPSG3857Projection(code) { + return _super.call(this, { + code: code, + units: _Units.default.METERS, + extent: EXTENT, + global: true, + worldExtent: WORLD_EXTENT, + getPointResolution: function (resolution, point) { + return resolution / (0, _math.cosh)(point[1] / RADIUS); + } + }) || this; + } + + return EPSG3857Projection; +}(_Projection.default); +/** + * Projections equal to EPSG:3857. + * + * @const + * @type {Array<import("./Projection.js").default>} + */ + + +var PROJECTIONS = [new EPSG3857Projection('EPSG:3857'), new EPSG3857Projection('EPSG:102100'), new EPSG3857Projection('EPSG:102113'), new EPSG3857Projection('EPSG:900913'), new EPSG3857Projection('urn:ogc:def:crs:EPSG:6.18:3:3857'), new EPSG3857Projection('urn:ogc:def:crs:EPSG::3857'), new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857')]; +/** + * Transformation from EPSG:4326 to EPSG:3857. + * + * @param {Array<number>} input Input array of coordinate values. + * @param {Array<number>=} opt_output Output array of coordinate values. + * @param {number=} opt_dimension Dimension (default is `2`). + * @return {Array<number>} Output array of coordinate values. + */ + +exports.PROJECTIONS = PROJECTIONS; + +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); + } + } + + var halfSize = HALF_SIZE; + + for (var i = 0; i < length; i += dimension) { + output[i] = halfSize * input[i] / 180; + var y = RADIUS * Math.log(Math.tan(Math.PI * (+input[i + 1] + 90) / 360)); + + if (y > halfSize) { + y = halfSize; + } else if (y < -halfSize) { + y = -halfSize; + } + + output[i + 1] = y; + } + + return output; +} +/** + * Transformation from EPSG:3857 to EPSG:4326. + * + * @param {Array<number>} input Input array of coordinate values. + * @param {Array<number>=} opt_output Output array of coordinate values. + * @param {number=} opt_dimension Dimension (default is `2`). + * @return {Array<number>} 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; +} +},{"./Projection.js":"../../../node_modules/ol/proj/Projection.js","./Units.js":"../../../node_modules/ol/proj/Units.js","../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/proj/epsg4326.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PROJECTIONS = exports.METERS_PER_UNIT = exports.EXTENT = exports.RADIUS = void 0; + +var _Projection = _interopRequireDefault(require("./Projection.js")); + +var _Units = _interopRequireDefault(require("./Units.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + 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 RADIUS = 6378137; +/** + * Extent of the EPSG:4326 projection which is the whole world. + * + * @const + * @type {import("../extent.js").Extent} + */ + +exports.RADIUS = RADIUS; +var EXTENT = [-180, -90, 180, 90]; +/** + * @const + * @type {number} + */ + +exports.EXTENT = EXTENT; +var METERS_PER_UNIT = Math.PI * 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. + */ + +exports.METERS_PER_UNIT = METERS_PER_UNIT; + +var EPSG4326Projection = +/** @class */ +function (_super) { + __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.default.DEGREES, + extent: EXTENT, + axisOrientation: opt_axisOrientation, + global: true, + metersPerUnit: METERS_PER_UNIT, + worldExtent: EXTENT + }) || this; + } + + return EPSG4326Projection; +}(_Projection.default); +/** + * Projections equal to EPSG:4326. + * + * @const + * @type {Array<import("./Projection.js").default>} + */ + + +var PROJECTIONS = [new EPSG4326Projection('CRS:84'), new EPSG4326Projection('EPSG:4326', 'neu'), new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'), new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'), new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'), new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'), new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'), new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu')]; +exports.PROJECTIONS = PROJECTIONS; +},{"./Projection.js":"../../../node_modules/ol/proj/Projection.js","./Units.js":"../../../node_modules/ol/proj/Units.js"}],"../../../node_modules/ol/proj/projections.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clear = clear; +exports.get = get; +exports.add = add; + +/** + * @module ol/proj/projections + */ + +/** + * @type {Object<string, import("./Projection.js").default>} + */ +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] || 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; +} +},{}],"../../../node_modules/ol/proj/transforms.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clear = clear; +exports.add = add; +exports.remove = remove; +exports.get = get; + +var _obj = require("../obj.js"); + +/** + * @module ol/proj/transforms + */ + +/** + * @private + * @type {!Object<string, Object<string, import("../proj.js").TransformFunction>>} + */ +var transforms = {}; +/** + * Clear the transform cache. + */ + +function 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 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 ((0, _obj.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 get(sourceCode, destinationCode) { + var transform; + + if (sourceCode in transforms && destinationCode in transforms[sourceCode]) { + transform = transforms[sourceCode][destinationCode]; + } + + return transform; +} +},{"../obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/sphere.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getDistance = getDistance; +exports.getLength = getLength; +exports.getArea = getArea; +exports.offset = offset; +exports.DEFAULT_RADIUS = void 0; + +var _GeometryType = _interopRequireDefault(require("./geom/GeometryType.js")); + +var _math = require("./math.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/sphere + */ + +/** + * Object literal with options for the {@link getLength} or {@link getArea} + * functions. + * @typedef {Object} SphereMetricOptions + * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] + * Projection of the geometry. By default, the geometry is assumed to be in + * Web Mercator. + * @property {number} [radius=6371008.8] Sphere radius. By default, the + * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius) + * for the WGS84 ellipsoid is used. + */ + +/** + * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid. + * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius + * @type {number} + */ +var DEFAULT_RADIUS = 6371008.8; +/** + * Get the great circle distance (in meters) between two geographic coordinates. + * @param {Array} c1 Starting coordinate. + * @param {Array} c2 Ending coordinate. + * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's + * mean radius using the WGS84 ellipsoid. + * @return {number} The great circle distance between the points (in meters). + * @api + */ + +exports.DEFAULT_RADIUS = DEFAULT_RADIUS; + +function getDistance(c1, c2, opt_radius) { + var radius = opt_radius || DEFAULT_RADIUS; + var lat1 = (0, _math.toRadians)(c1[1]); + var lat2 = (0, _math.toRadians)(c2[1]); + var deltaLatBy2 = (lat2 - lat1) / 2; + var deltaLonBy2 = (0, _math.toRadians)(c2[0] - c1[0]) / 2; + var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) + Math.sin(deltaLonBy2) * Math.sin(deltaLonBy2) * Math.cos(lat1) * Math.cos(lat2); + return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); +} +/** + * Get the cumulative great circle length of linestring coordinates (geographic). + * @param {Array} coordinates Linestring coordinates. + * @param {number} radius The sphere radius to use. + * @return {number} The length (in meters). + */ + + +function getLengthInternal(coordinates, radius) { + var length = 0; + + for (var i = 0, ii = coordinates.length; i < ii - 1; ++i) { + length += getDistance(coordinates[i], coordinates[i + 1], radius); + } + + return length; +} +/** + * Get the spherical length of a geometry. This length is the sum of the + * great circle distances between coordinates. For polygons, the length is + * the sum of all rings. For points, the length is zero. For multi-part + * geometries, the length is the sum of the length of each part. + * @param {import("./geom/Geometry.js").default} geometry A geometry. + * @param {SphereMetricOptions=} opt_options Options for the + * length calculation. By default, geometries are assumed to be in 'EPSG:3857'. + * You can change this by providing a `projection` option. + * @return {number} The spherical length (in meters). + * @api + */ + + +function getLength(geometry, opt_options) { + var options = opt_options || {}; + var radius = options.radius || DEFAULT_RADIUS; + var projection = options.projection || 'EPSG:3857'; + var type = geometry.getType(); + + if (type !== _GeometryType.default.GEOMETRY_COLLECTION) { + geometry = geometry.clone().transform(projection, 'EPSG:4326'); + } + + var length = 0; + var coordinates, coords, i, ii, j, jj; + + switch (type) { + case _GeometryType.default.POINT: + case _GeometryType.default.MULTI_POINT: + { + break; + } + + case _GeometryType.default.LINE_STRING: + case _GeometryType.default.LINEAR_RING: + { + coordinates = + /** @type {import("./geom/SimpleGeometry.js").default} */ + geometry.getCoordinates(); + length = getLengthInternal(coordinates, radius); + break; + } + + case _GeometryType.default.MULTI_LINE_STRING: + case _GeometryType.default.POLYGON: + { + coordinates = + /** @type {import("./geom/SimpleGeometry.js").default} */ + geometry.getCoordinates(); + + for (i = 0, ii = coordinates.length; i < ii; ++i) { + length += getLengthInternal(coordinates[i], radius); + } + + break; + } + + case _GeometryType.default.MULTI_POLYGON: + { + coordinates = + /** @type {import("./geom/SimpleGeometry.js").default} */ + geometry.getCoordinates(); + + for (i = 0, ii = coordinates.length; i < ii; ++i) { + coords = coordinates[i]; + + for (j = 0, jj = coords.length; j < jj; ++j) { + length += getLengthInternal(coords[j], radius); + } + } + + break; + } + + case _GeometryType.default.GEOMETRY_COLLECTION: + { + var geometries = + /** @type {import("./geom/GeometryCollection.js").default} */ + geometry.getGeometries(); + + for (i = 0, ii = geometries.length; i < ii; ++i) { + length += getLength(geometries[i], opt_options); + } + + break; + } + + default: + { + throw new Error('Unsupported geometry type: ' + type); + } + } + + return length; +} +/** + * Returns the spherical area for a list of coordinates. + * + * [Reference](https://trs-new.jpl.nasa.gov/handle/2014/40409) + * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for + * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion + * Laboratory, Pasadena, CA, June 2007 + * + * @param {Array<import("./coordinate.js").Coordinate>} coordinates List of coordinates of a linear + * ring. If the ring is oriented clockwise, the area will be positive, + * otherwise it will be negative. + * @param {number} radius The sphere radius. + * @return {number} Area (in square meters). + */ + + +function getAreaInternal(coordinates, radius) { + var area = 0; + var len = coordinates.length; + var x1 = coordinates[len - 1][0]; + var y1 = coordinates[len - 1][1]; + + for (var i = 0; i < len; i++) { + var x2 = coordinates[i][0]; + var y2 = coordinates[i][1]; + area += (0, _math.toRadians)(x2 - x1) * (2 + Math.sin((0, _math.toRadians)(y1)) + Math.sin((0, _math.toRadians)(y2))); + x1 = x2; + y1 = y2; + } + + return area * radius * radius / 2.0; +} +/** + * Get the spherical area of a geometry. This is the area (in meters) assuming + * that polygon edges are segments of great circles on a sphere. + * @param {import("./geom/Geometry.js").default} geometry A geometry. + * @param {SphereMetricOptions=} opt_options Options for the area + * calculation. By default, geometries are assumed to be in 'EPSG:3857'. + * You can change this by providing a `projection` option. + * @return {number} The spherical area (in square meters). + * @api + */ + + +function getArea(geometry, opt_options) { + var options = opt_options || {}; + var radius = options.radius || DEFAULT_RADIUS; + var projection = options.projection || 'EPSG:3857'; + var type = geometry.getType(); + + if (type !== _GeometryType.default.GEOMETRY_COLLECTION) { + geometry = geometry.clone().transform(projection, 'EPSG:4326'); + } + + var area = 0; + var coordinates, coords, i, ii, j, jj; + + switch (type) { + case _GeometryType.default.POINT: + case _GeometryType.default.MULTI_POINT: + case _GeometryType.default.LINE_STRING: + case _GeometryType.default.MULTI_LINE_STRING: + case _GeometryType.default.LINEAR_RING: + { + break; + } + + case _GeometryType.default.POLYGON: + { + coordinates = + /** @type {import("./geom/Polygon.js").default} */ + geometry.getCoordinates(); + area = Math.abs(getAreaInternal(coordinates[0], radius)); + + for (i = 1, ii = coordinates.length; i < ii; ++i) { + area -= Math.abs(getAreaInternal(coordinates[i], radius)); + } + + break; + } + + case _GeometryType.default.MULTI_POLYGON: + { + coordinates = + /** @type {import("./geom/SimpleGeometry.js").default} */ + geometry.getCoordinates(); + + for (i = 0, ii = coordinates.length; i < ii; ++i) { + coords = coordinates[i]; + area += Math.abs(getAreaInternal(coords[0], radius)); + + for (j = 1, jj = coords.length; j < jj; ++j) { + area -= Math.abs(getAreaInternal(coords[j], radius)); + } + } + + break; + } + + case _GeometryType.default.GEOMETRY_COLLECTION: + { + var geometries = + /** @type {import("./geom/GeometryCollection.js").default} */ + geometry.getGeometries(); + + for (i = 0, ii = geometries.length; i < ii; ++i) { + area += getArea(geometries[i], opt_options); + } + + break; + } + + default: + { + throw new Error('Unsupported geometry type: ' + type); + } + } + + return area; +} +/** + * Returns the coordinate at the given distance and bearing from `c1`. + * + * @param {import("./coordinate.js").Coordinate} c1 The origin point (`[lon, lat]` in degrees). + * @param {number} distance The great-circle distance between the origin + * point and the target point. + * @param {number} bearing The bearing (in radians). + * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's + * mean radius using the WGS84 ellipsoid. + * @return {import("./coordinate.js").Coordinate} The target point. + */ + + +function offset(c1, distance, bearing, opt_radius) { + var radius = opt_radius || DEFAULT_RADIUS; + var lat1 = (0, _math.toRadians)(c1[1]); + var lon1 = (0, _math.toRadians)(c1[0]); + var dByR = distance / radius; + var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)); + var lon = lon1 + Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)); + return [(0, _math.toDegrees)(lon), (0, _math.toDegrees)(lat)]; +} +},{"./geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/string.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.padNumber = padNumber; +exports.compareVersions = compareVersions; + +/** + * @module ol/string + */ + +/** + * @param {number} number Number to be formatted + * @param {number} width The desired width + * @param {number=} opt_precision Precision of the output string (i.e. number of decimal places) + * @returns {string} Formatted string + */ +function padNumber(number, width, opt_precision) { + var numberString = opt_precision !== undefined ? number.toFixed(opt_precision) : '' + number; + var decimal = numberString.indexOf('.'); + decimal = decimal === -1 ? numberString.length : decimal; + return decimal > width ? numberString : new Array(1 + width - decimal).join('0') + numberString; +} +/** + * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js + * @param {string|number} v1 First version + * @param {string|number} v2 Second version + * @returns {number} Value + */ + + +function compareVersions(v1, v2) { + var s1 = ('' + v1).split('.'); + var s2 = ('' + v2).split('.'); + + for (var i = 0; i < Math.max(s1.length, s2.length); i++) { + var n1 = parseInt(s1[i] || '0', 10); + var n2 = parseInt(s2[i] || '0', 10); + + if (n1 > n2) { + return 1; + } + + if (n2 > n1) { + return -1; + } + } + + return 0; +} +},{}],"../../../node_modules/ol/coordinate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.add = add; +exports.closestOnCircle = closestOnCircle; +exports.closestOnSegment = closestOnSegment; +exports.createStringXY = createStringXY; +exports.degreesToStringHDMS = degreesToStringHDMS; +exports.format = format; +exports.equals = equals; +exports.rotate = rotate; +exports.scale = scale; +exports.squaredDistance = squaredDistance; +exports.distance = distance; +exports.squaredDistanceToSegment = squaredDistanceToSegment; +exports.toStringHDMS = toStringHDMS; +exports.toStringXY = toStringXY; +exports.wrapX = wrapX; +exports.getWorldsAway = getWorldsAway; + +var _extent = require("./extent.js"); + +var _math = require("./math.js"); + +var _string = require("./string.js"); + +/** + * @module ol/coordinate + */ + +/** + * An array of numbers representing an xy coordinate. Example: `[16, 48]`. + * @typedef {Array<number>} Coordinate + * @api + */ + +/** + * A function that takes a {@link module:ol/coordinate~Coordinate} and + * transforms it into a `{string}`. + * + * @typedef {function((Coordinate|undefined)): string} CoordinateFormat + * @api + */ + +/** + * Add `delta` to `coordinate`. `coordinate` is modified in place and returned + * by the function. + * + * Example: + * + * import {add} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * add(coord, [-2, 4]); + * // coord is now [5.85, 51.983333] + * + * @param {Coordinate} coordinate Coordinate. + * @param {Coordinate} delta Delta. + * @return {Coordinate} The input coordinate adjusted by + * the given delta. + * @api + */ +function add(coordinate, delta) { + coordinate[0] += +delta[0]; + coordinate[1] += +delta[1]; + return coordinate; +} +/** + * Calculates the point closest to the passed coordinate on the passed circle. + * + * @param {Coordinate} coordinate The coordinate. + * @param {import("./geom/Circle.js").default} circle The circle. + * @return {Coordinate} Closest point on the circumference. + */ + + +function closestOnCircle(coordinate, circle) { + var r = circle.getRadius(); + var center = circle.getCenter(); + var x0 = center[0]; + var y0 = center[1]; + var x1 = coordinate[0]; + var y1 = coordinate[1]; + var dx = x1 - x0; + var dy = y1 - y0; + + if (dx === 0 && dy === 0) { + dx = 1; + } + + var d = Math.sqrt(dx * dx + dy * dy); + var x = x0 + r * dx / d; + var y = y0 + r * dy / d; + return [x, y]; +} +/** + * Calculates the point closest to the passed coordinate on the passed segment. + * This is the foot of the perpendicular of the coordinate to the segment when + * the foot is on the segment, or the closest segment coordinate when the foot + * is outside the segment. + * + * @param {Coordinate} coordinate The coordinate. + * @param {Array<Coordinate>} segment The two coordinates + * of the segment. + * @return {Coordinate} The foot of the perpendicular of + * the coordinate to the segment. + */ + + +function closestOnSegment(coordinate, segment) { + var x0 = coordinate[0]; + var y0 = coordinate[1]; + var start = segment[0]; + var end = segment[1]; + var x1 = start[0]; + var y1 = start[1]; + var x2 = end[0]; + var y2 = end[1]; + var dx = x2 - x1; + var dy = y2 - y1; + var along = dx === 0 && dy === 0 ? 0 : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0); + var x, y; + + if (along <= 0) { + x = x1; + y = y1; + } else if (along >= 1) { + x = x2; + y = y2; + } else { + x = x1 + along * dx; + y = y1 + along * dy; + } + + return [x, y]; +} +/** + * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be + * used to format + * a {Coordinate} to a string. + * + * Example without specifying the fractional digits: + * + * import {createStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var stringifyFunc = createStringXY(); + * var out = stringifyFunc(coord); + * // out is now '8, 48' + * + * Example with explicitly specifying 2 fractional digits: + * + * import {createStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var stringifyFunc = createStringXY(2); + * var out = stringifyFunc(coord); + * // out is now '7.85, 47.98' + * + * @param {number=} opt_fractionDigits The number of digits to include + * after the decimal point. Default is `0`. + * @return {CoordinateFormat} Coordinate format. + * @api + */ + + +function createStringXY(opt_fractionDigits) { + return ( + /** + * @param {Coordinate} coordinate Coordinate. + * @return {string} String XY. + */ + function (coordinate) { + return toStringXY(coordinate, opt_fractionDigits); + } + ); +} +/** + * @param {string} hemispheres Hemispheres. + * @param {number} degrees Degrees. + * @param {number=} opt_fractionDigits The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} String. + */ + + +function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) { + var normalizedDegrees = (0, _math.modulo)(degrees + 180, 360) - 180; + var x = Math.abs(3600 * normalizedDegrees); + var dflPrecision = opt_fractionDigits || 0; + var precision = Math.pow(10, dflPrecision); + var deg = Math.floor(x / 3600); + var min = Math.floor((x - deg * 3600) / 60); + var sec = x - deg * 3600 - min * 60; + sec = Math.ceil(sec * precision) / precision; + + if (sec >= 60) { + sec = 0; + min += 1; + } + + if (min >= 60) { + min = 0; + deg += 1; + } + + return deg + '\u00b0 ' + (0, _string.padNumber)(min, 2) + '\u2032 ' + (0, _string.padNumber)(sec, 2, dflPrecision) + '\u2033' + (normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0)); +} +/** + * Transforms the given {@link module:ol/coordinate~Coordinate} to a string + * using the given string template. The strings `{x}` and `{y}` in the template + * will be replaced with the first and second coordinate values respectively. + * + * Example without specifying the fractional digits: + * + * import {format} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var template = 'Coordinate is ({x}|{y}).'; + * var out = format(coord, template); + * // out is now 'Coordinate is (8|48).' + * + * Example explicitly specifying the fractional digits: + * + * import {format} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var template = 'Coordinate is ({x}|{y}).'; + * var out = format(coord, template, 2); + * // out is now 'Coordinate is (7.85|47.98).' + * + * @param {Coordinate} coordinate Coordinate. + * @param {string} template A template string with `{x}` and `{y}` placeholders + * that will be replaced by first and second coordinate values. + * @param {number=} opt_fractionDigits The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} Formatted coordinate. + * @api + */ + + +function format(coordinate, template, opt_fractionDigits) { + if (coordinate) { + return template.replace('{x}', coordinate[0].toFixed(opt_fractionDigits)).replace('{y}', coordinate[1].toFixed(opt_fractionDigits)); + } else { + return ''; + } +} +/** + * @param {Coordinate} coordinate1 First coordinate. + * @param {Coordinate} coordinate2 Second coordinate. + * @return {boolean} The two coordinates are equal. + */ + + +function equals(coordinate1, coordinate2) { + var equals = true; + + for (var i = coordinate1.length - 1; i >= 0; --i) { + if (coordinate1[i] != coordinate2[i]) { + equals = false; + break; + } + } + + return equals; +} +/** + * Rotate `coordinate` by `angle`. `coordinate` is modified in place and + * returned by the function. + * + * Example: + * + * import {rotate} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var rotateRadians = Math.PI / 2; // 90 degrees + * rotate(coord, rotateRadians); + * // coord is now [-47.983333, 7.85] + * + * @param {Coordinate} coordinate Coordinate. + * @param {number} angle Angle in radian. + * @return {Coordinate} Coordinate. + * @api + */ + + +function rotate(coordinate, angle) { + var cosAngle = Math.cos(angle); + var sinAngle = Math.sin(angle); + var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle; + var y = coordinate[1] * cosAngle + coordinate[0] * sinAngle; + coordinate[0] = x; + coordinate[1] = y; + return coordinate; +} +/** + * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned + * by the function. + * + * Example: + * + * import {scale as scaleCoordinate} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var scale = 1.2; + * scaleCoordinate(coord, scale); + * // coord is now [9.42, 57.5799996] + * + * @param {Coordinate} coordinate Coordinate. + * @param {number} scale Scale factor. + * @return {Coordinate} Coordinate. + */ + + +function scale(coordinate, scale) { + coordinate[0] *= scale; + coordinate[1] *= scale; + return coordinate; +} +/** + * @param {Coordinate} coord1 First coordinate. + * @param {Coordinate} coord2 Second coordinate. + * @return {number} Squared distance between coord1 and coord2. + */ + + +function squaredDistance(coord1, coord2) { + var dx = coord1[0] - coord2[0]; + var dy = coord1[1] - coord2[1]; + return dx * dx + dy * dy; +} +/** + * @param {Coordinate} coord1 First coordinate. + * @param {Coordinate} coord2 Second coordinate. + * @return {number} Distance between coord1 and coord2. + */ + + +function distance(coord1, coord2) { + return Math.sqrt(squaredDistance(coord1, coord2)); +} +/** + * Calculate the squared distance from a coordinate to a line segment. + * + * @param {Coordinate} coordinate Coordinate of the point. + * @param {Array<Coordinate>} segment Line segment (2 + * coordinates). + * @return {number} Squared distance from the point to the line segment. + */ + + +function squaredDistanceToSegment(coordinate, segment) { + return squaredDistance(coordinate, closestOnSegment(coordinate, segment)); +} +/** + * Format a geographic coordinate with the hemisphere, degrees, minutes, and + * seconds. + * + * Example without specifying fractional digits: + * + * import {toStringHDMS} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringHDMS(coord); + * // out is now '47° 58′ 60″ N 7° 50′ 60″ E' + * + * Example explicitly specifying 1 fractional digit: + * + * import {toStringHDMS} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringHDMS(coord, 1); + * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E' + * + * @param {Coordinate} coordinate Coordinate. + * @param {number=} opt_fractionDigits The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} Hemisphere, degrees, minutes and seconds. + * @api + */ + + +function toStringHDMS(coordinate, opt_fractionDigits) { + if (coordinate) { + return degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' + degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits); + } else { + return ''; + } +} +/** + * Format a coordinate as a comma delimited string. + * + * Example without specifying fractional digits: + * + * import {toStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringXY(coord); + * // out is now '8, 48' + * + * Example explicitly specifying 1 fractional digit: + * + * import {toStringXY} from 'ol/coordinate'; + * + * var coord = [7.85, 47.983333]; + * var out = toStringXY(coord, 1); + * // out is now '7.8, 48.0' + * + * @param {Coordinate} coordinate Coordinate. + * @param {number=} opt_fractionDigits The number of digits to include + * after the decimal point. Default is `0`. + * @return {string} XY. + * @api + */ + + +function toStringXY(coordinate, opt_fractionDigits) { + return format(coordinate, '{x}, {y}', opt_fractionDigits); +} +/** + * Modifies the provided coordinate in-place to be within the real world + * extent. The lower projection extent boundary is inclusive, the upper one + * exclusive. + * + * @param {Coordinate} coordinate Coordinate. + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {Coordinate} The coordinate within the real world extent. + */ + + +function wrapX(coordinate, projection) { + if (projection.canWrapX()) { + var worldWidth = (0, _extent.getWidth)(projection.getExtent()); + var worldsAway = getWorldsAway(coordinate, projection, worldWidth); + + if (worldsAway) { + coordinate[0] -= worldsAway * worldWidth; + } + } + + return coordinate; +} +/** + * @param {Coordinate} coordinate Coordinate. + * @param {import("./proj/Projection.js").default} projection Projection. + * @param {number=} opt_sourceExtentWidth Width of the source extent. + * @return {number} Offset in world widths. + */ + + +function getWorldsAway(coordinate, projection, opt_sourceExtentWidth) { + var projectionExtent = projection.getExtent(); + var worldsAway = 0; + + if (projection.canWrapX() && (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])) { + var sourceExtentWidth = opt_sourceExtentWidth || (0, _extent.getWidth)(projectionExtent); + worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / sourceExtentWidth); + } + + return worldsAway; +} +},{"./extent.js":"../../../node_modules/ol/extent.js","./math.js":"../../../node_modules/ol/math.js","./string.js":"../../../node_modules/ol/string.js"}],"../../../node_modules/ol/proj.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.cloneTransform = cloneTransform; +exports.identityTransform = identityTransform; +exports.addProjection = addProjection; +exports.addProjections = addProjections; +exports.get = get; +exports.getPointResolution = getPointResolution; +exports.addEquivalentProjections = addEquivalentProjections; +exports.addEquivalentTransforms = addEquivalentTransforms; +exports.clearAllProjections = clearAllProjections; +exports.createProjection = createProjection; +exports.createTransformFromCoordinateTransform = createTransformFromCoordinateTransform; +exports.addCoordinateTransforms = addCoordinateTransforms; +exports.fromLonLat = fromLonLat; +exports.toLonLat = toLonLat; +exports.equivalent = equivalent; +exports.getTransformFromProjections = getTransformFromProjections; +exports.getTransform = getTransform; +exports.transform = transform; +exports.transformExtent = transformExtent; +exports.transformWithProjections = transformWithProjections; +exports.setUserProjection = setUserProjection; +exports.clearUserProjection = clearUserProjection; +exports.getUserProjection = getUserProjection; +exports.useGeographic = useGeographic; +exports.toUserCoordinate = toUserCoordinate; +exports.fromUserCoordinate = fromUserCoordinate; +exports.toUserExtent = toUserExtent; +exports.fromUserExtent = fromUserExtent; +exports.createSafeCoordinateTransform = createSafeCoordinateTransform; +exports.addCommon = addCommon; +Object.defineProperty(exports, "Projection", { + enumerable: true, + get: function () { + return _Projection.default; + } +}); +Object.defineProperty(exports, "METERS_PER_UNIT", { + enumerable: true, + get: function () { + return _Units.METERS_PER_UNIT; + } +}); + +var _Projection = _interopRequireDefault(require("./proj/Projection.js")); + +var _Units = _interopRequireWildcard(require("./proj/Units.js")); + +var _epsg = require("./proj/epsg3857.js"); + +var _epsg2 = require("./proj/epsg4326.js"); + +var _projections = require("./proj/projections.js"); + +var _transforms = require("./proj/transforms.js"); + +var _extent = require("./extent.js"); + +var _math = require("./math.js"); + +var _sphere = require("./sphere.js"); + +var _coordinate = require("./coordinate.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/proj + */ + +/** + * The ol/proj module stores: + * * a list of {@link module:ol/proj/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} 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} with + * {@link module:ol/proj~addProjection}. See examples/wms-no-proj for an example of + * this. + */ + +/** + * A projection as {@link module:ol/proj/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<number>, Array<number>=, number=): Array<number>} TransformFunction + * @api + */ + +/** + * @param {Array<number>} input Input coordinate array. + * @param {Array<number>=} opt_output Output array of coordinate values. + * @param {number=} opt_dimension Dimension. + * @return {Array<number>} 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<number>} input Input coordinate array. + * @param {Array<number>=} opt_output Output array of coordinate values. + * @param {number=} opt_dimension Dimension. + * @return {Array<number>} 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) { + (0, _projections.add)(projection.getCode(), projection); + (0, _transforms.add)(projection, projection, cloneTransform); +} +/** + * @param {Array<Projection>} 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} Projection object, or null if not in list. + * @api + */ + + +function get(projectionLike) { + return typeof projectionLike === 'string' ? (0, _projections.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 = 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.METERS_PER_UNIT[opt_units]; + } + } + } else { + var units = projection.getUnits(); + + if (units == _Units.default.DEGREES && !opt_units || opt_units == _Units.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, get('EPSG:4326')); + 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 = (0, _sphere.getDistance)(vertices.slice(0, 2), vertices.slice(2, 4)); + var height = (0, _sphere.getDistance)(vertices.slice(4, 6), vertices.slice(6, 8)); + pointResolution = (width + height) / 2; + var metersPerUnit = opt_units ? _Units.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<Projection>} projections Projections. + * @api + */ + + +function addEquivalentProjections(projections) { + addProjections(projections); + projections.forEach(function (source) { + projections.forEach(function (destination) { + if (source !== destination) { + (0, _transforms.add)(source, destination, cloneTransform); + } + }); + }); +} +/** + * Registers transformation functions to convert coordinates in any projection + * in projection1 to any projection in projection2. + * + * @param {Array<Projection>} projections1 Projections with equal + * meaning. + * @param {Array<Projection>} 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) { + (0, _transforms.add)(projection1, projection2, forwardTransform); + (0, _transforms.add)(projection2, projection1, inverseTransform); + }); + }); +} +/** + * Clear all cached projections and transforms. + */ + + +function clearAllProjections() { + (0, _projections.clear)(); + (0, _transforms.clear)(); +} +/** + * @param {Projection|string|undefined} projection Projection. + * @param {string} defaultCode Default code. + * @return {Projection} Projection. + */ + + +function createProjection(projection, defaultCode) { + if (!projection) { + return get(defaultCode); + } else if (typeof projection === 'string') { + return 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<number>} input Input. + * @param {Array<number>=} opt_output Output. + * @param {number=} opt_dimension Dimension. + * @return {Array<number>} 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[i], input[i + 1]]); + output[i] = point[0]; + output[i + 1] = point[1]; + + for (var j = dimension - 1; j >= 2; --j) { + output[i + j] = input[i + 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}. + * @api + */ + + +function addCoordinateTransforms(source, destination, forward, inverse) { + var sourceProj = get(source); + var destProj = get(destination); + (0, _transforms.add)(sourceProj, destProj, createTransformFromCoordinateTransform(forward)); + (0, _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) { + return 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 = transform(coordinate, opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326'); + var lon = lonLat[0]; + + if (lon < -180 || lon > 180) { + lonLat[0] = (0, _math.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 = (0, _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 = get(source); + var destinationProjection = 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 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 (0, _extent.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} + */ + + +var userProjection = null; +/** + * Set 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. + * @param {ProjectionLike} projection The user projection. + */ + +function setUserProjection(projection) { + userProjection = get(projection); +} +/** + * Clear the user projection if set. 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. + */ + + +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. + * @returns {?Projection} The user projection (or null if not set). + */ + + +function getUserProjection() { + return userProjection; +} +/** + * Use geographic coordinates (WGS-84 datum) in 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. + */ + + +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<number>} coordinate Input coordinate. + * @param {ProjectionLike} sourceProjection The input coordinate projection. + * @returns {Array<number>} The input coordinate in the user projection. + */ + + +function toUserCoordinate(coordinate, sourceProjection) { + if (!userProjection) { + return coordinate; + } + + return 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<number>} coordinate Input coordinate. + * @param {ProjectionLike} destProjection The destination projection. + * @returns {Array<number>} The input coordinate transformed. + */ + + +function fromUserCoordinate(coordinate, destProjection) { + if (!userProjection) { + return coordinate; + } + + return 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. + * @returns {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. + * @returns {import("./extent.js").Extent} The input extent transformed. + */ + + +function fromUserExtent(extent, destProjection) { + if (!userProjection) { + return extent; + } + + return transformExtent(extent, userProjection, destProjection); +} +/** + * 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 sourceX = coord[0]; + var sourceY = coord[1]; + var transformed, worldsAway; + + if (sourceProj.canWrapX()) { + var sourceExtent = sourceProj.getExtent(); + var sourceExtentWidth = (0, _extent.getWidth)(sourceExtent); + worldsAway = (0, _coordinate.getWorldsAway)(coord, sourceProj, sourceExtentWidth); + + if (worldsAway) { + // Move x to the real world + sourceX = sourceX - worldsAway * sourceExtentWidth; + } + + sourceX = (0, _math.clamp)(sourceX, sourceExtent[0], sourceExtent[2]); + sourceY = (0, _math.clamp)(sourceY, sourceExtent[1], sourceExtent[3]); + transformed = transform([sourceX, sourceY]); + } else { + transformed = transform(coord); + } + + if (worldsAway && destProj.canWrapX()) { + // Move transformed coordinate back to the offset world + transformed[0] += worldsAway * (0, _extent.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(_epsg.PROJECTIONS); + addEquivalentProjections(_epsg2.PROJECTIONS); // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like + // coordinates and back. + + addEquivalentTransforms(_epsg2.PROJECTIONS, _epsg.PROJECTIONS, _epsg.fromEPSG4326, _epsg.toEPSG4326); +} + +addCommon(); +},{"./proj/Projection.js":"../../../node_modules/ol/proj/Projection.js","./proj/Units.js":"../../../node_modules/ol/proj/Units.js","./proj/epsg3857.js":"../../../node_modules/ol/proj/epsg3857.js","./proj/epsg4326.js":"../../../node_modules/ol/proj/epsg4326.js","./proj/projections.js":"../../../node_modules/ol/proj/projections.js","./proj/transforms.js":"../../../node_modules/ol/proj/transforms.js","./extent.js":"../../../node_modules/ol/extent.js","./math.js":"../../../node_modules/ol/math.js","./sphere.js":"../../../node_modules/ol/sphere.js","./coordinate.js":"../../../node_modules/ol/coordinate.js"}],"../../../node_modules/ol/geom/flat/transform.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transform2D = transform2D; +exports.rotate = rotate; +exports.scale = scale; +exports.translate = translate; + +/** + * @module ol/geom/flat/transform + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {Array<number>=} opt_dest Destination. + * @return {Array<number>} Transformed coordinates. + */ +function transform2D(flatCoordinates, offset, end, stride, transform, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var i = 0; + + for (var j = offset; j < end; j += stride) { + var x = flatCoordinates[j]; + var y = flatCoordinates[j + 1]; + dest[i++] = transform[0] * x + transform[2] * y + transform[4]; + dest[i++] = transform[1] * x + transform[3] * y + transform[5]; + } + + if (opt_dest && dest.length != i) { + dest.length = i; + } + + return dest; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} angle Angle. + * @param {Array<number>} anchor Rotation anchor point. + * @param {Array<number>=} opt_dest Destination. + * @return {Array<number>} Transformed coordinates. + */ + + +function rotate(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var cos = Math.cos(angle); + var sin = Math.sin(angle); + var anchorX = anchor[0]; + var anchorY = anchor[1]; + var i = 0; + + for (var j = offset; j < end; j += stride) { + var deltaX = flatCoordinates[j] - anchorX; + var deltaY = flatCoordinates[j + 1] - anchorY; + dest[i++] = anchorX + deltaX * cos - deltaY * sin; + dest[i++] = anchorY + deltaX * sin + deltaY * cos; + + for (var k = j + 2; k < j + stride; ++k) { + dest[i++] = flatCoordinates[k]; + } + } + + if (opt_dest && dest.length != i) { + dest.length = i; + } + + return dest; +} +/** + * Scale the coordinates. + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} sx Scale factor in the x-direction. + * @param {number} sy Scale factor in the y-direction. + * @param {Array<number>} anchor Scale anchor point. + * @param {Array<number>=} opt_dest Destination. + * @return {Array<number>} Transformed coordinates. + */ + + +function scale(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var anchorX = anchor[0]; + var anchorY = anchor[1]; + var i = 0; + + for (var j = offset; j < end; j += stride) { + var deltaX = flatCoordinates[j] - anchorX; + var deltaY = flatCoordinates[j + 1] - anchorY; + dest[i++] = anchorX + sx * deltaX; + dest[i++] = anchorY + sy * deltaY; + + for (var k = j + 2; k < j + stride; ++k) { + dest[i++] = flatCoordinates[k]; + } + } + + if (opt_dest && dest.length != i) { + dest.length = i; + } + + return dest; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @param {Array<number>=} opt_dest Destination. + * @return {Array<number>} Transformed coordinates. + */ + + +function translate(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) { + var dest = opt_dest ? opt_dest : []; + var i = 0; + + for (var j = offset; j < end; j += stride) { + dest[i++] = flatCoordinates[j] + deltaX; + dest[i++] = flatCoordinates[j + 1] + deltaY; + + for (var k = j + 2; k < j + stride; ++k) { + dest[i++] = flatCoordinates[k]; + } + } + + if (opt_dest && dest.length != i) { + dest.length = i; + } + + return dest; +} +},{}],"../../../node_modules/ol/geom/Geometry.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Object = _interopRequireDefault(require("../Object.js")); + +var _Units = _interopRequireDefault(require("../proj/Units.js")); + +var _util = require("../util.js"); + +var _transform = require("../transform.js"); + +var _extent = require("../extent.js"); + +var _proj = require("../proj.js"); + +var _functions = require("../functions.js"); + +var _transform2 = require("./flat/transform.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/Geometry + */ + + +/** + * @type {import("../transform.js").Transform} + */ +var tmpTransform = (0, _transform.create)(); +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Base class for vector geometries. + * + * To get notified of changes to the geometry, register a listener for the + * generic `change` event on your geometry instance. + * + * @abstract + * @api + */ + +var Geometry = +/** @class */ +function (_super) { + __extends(Geometry, _super); + + function Geometry() { + var _this = _super.call(this) || this; + /** + * @private + * @type {import("../extent.js").Extent} + */ + + + _this.extent_ = (0, _extent.createEmpty)(); + /** + * @private + * @type {number} + */ + + _this.extentRevision_ = -1; + /** + * @protected + * @type {number} + */ + + _this.simplifiedGeometryMaxMinSquaredTolerance = 0; + /** + * @protected + * @type {number} + */ + + _this.simplifiedGeometryRevision = 0; + /** + * Get a transformed and simplified version of the geometry. + * @abstract + * @param {number} revision The geometry revision. + * @param {number} squaredTolerance Squared tolerance. + * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function. + * @return {Geometry} Simplified geometry. + */ + + _this.simplifyTransformedInternal = (0, _functions.memoizeOne)(function (revision, squaredTolerance, opt_transform) { + if (!opt_transform) { + return this.getSimplifiedGeometry(squaredTolerance); + } + + var clone = this.clone(); + clone.applyTransform(opt_transform); + return clone.getSimplifiedGeometry(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 {Geometry} Simplified geometry. + */ + + + Geometry.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) { + return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform); + }; + /** + * Make a complete copy of the geometry. + * @abstract + * @return {!Geometry} Clone. + */ + + + Geometry.prototype.clone = function () { + return (0, _util.abstract)(); + }; + /** + * @abstract + * @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. + */ + + + Geometry.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + return (0, _util.abstract)(); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + + + Geometry.prototype.containsXY = function (x, y) { + var coord = this.getClosestPoint([x, y]); + return coord[0] === x && coord[1] === y; + }; + /** + * Return the closest point of the geometry to the passed point as + * {@link module:ol/coordinate~Coordinate coordinate}. + * @param {import("../coordinate.js").Coordinate} point Point. + * @param {import("../coordinate.js").Coordinate=} opt_closestPoint Closest point. + * @return {import("../coordinate.js").Coordinate} Closest point. + * @api + */ + + + Geometry.prototype.getClosestPoint = function (point, opt_closestPoint) { + var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN]; + this.closestPointXY(point[0], point[1], closestPoint, Infinity); + return closestPoint; + }; + /** + * Returns true if this geometry includes the specified coordinate. If the + * coordinate is on the boundary of the geometry, returns false. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @return {boolean} Contains coordinate. + * @api + */ + + + Geometry.prototype.intersectsCoordinate = function (coordinate) { + return this.containsXY(coordinate[0], coordinate[1]); + }; + /** + * @abstract + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + + + Geometry.prototype.computeExtent = function (extent) { + return (0, _util.abstract)(); + }; + /** + * Get the extent of the geometry. + * @param {import("../extent.js").Extent=} opt_extent Extent. + * @return {import("../extent.js").Extent} extent Extent. + * @api + */ + + + Geometry.prototype.getExtent = function (opt_extent) { + if (this.extentRevision_ != this.getRevision()) { + var extent = this.computeExtent(this.extent_); + + if (isNaN(extent[0]) || isNaN(extent[1])) { + (0, _extent.createOrUpdateEmpty)(extent); + } + + this.extentRevision_ = this.getRevision(); + } + + return (0, _extent.returnOrUpdate)(this.extent_, opt_extent); + }; + /** + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @abstract + * @param {number} angle Rotation angle in radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. + * @api + */ + + + Geometry.prototype.rotate = function (angle, anchor) { + (0, _util.abstract)(); + }; + /** + * Scale the geometry (with an optional origin). This modifies the geometry + * coordinates in place. + * @abstract + * @param {number} sx The scaling factor in the x-direction. + * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx). + * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center + * of the geometry extent). + * @api + */ + + + Geometry.prototype.scale = function (sx, opt_sy, opt_anchor) { + (0, _util.abstract)(); + }; + /** + * Create a simplified version of this geometry. For linestrings, this uses + * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm) + * algorithm. For polygons, a quantization-based + * simplification is used to preserve topology. + * @param {number} tolerance The tolerance distance for simplification. + * @return {Geometry} A new, simplified version of the original geometry. + * @api + */ + + + Geometry.prototype.simplify = function (tolerance) { + return this.getSimplifiedGeometry(tolerance * tolerance); + }; + /** + * Create a simplified version of this geometry using the Douglas Peucker + * algorithm. + * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm. + * @abstract + * @param {number} squaredTolerance Squared tolerance. + * @return {Geometry} Simplified geometry. + */ + + + Geometry.prototype.getSimplifiedGeometry = function (squaredTolerance) { + return (0, _util.abstract)(); + }; + /** + * Get the type of this geometry. + * @abstract + * @return {import("./GeometryType.js").default} Geometry type. + */ + + + Geometry.prototype.getType = function () { + return (0, _util.abstract)(); + }; + /** + * Apply a transform function to the coordinates of the geometry. + * The geometry is modified in place. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * @abstract + * @param {import("../proj.js").TransformFunction} transformFn Transform function. + * Called with a flat array of geometry coordinates. + */ + + + Geometry.prototype.applyTransform = function (transformFn) { + (0, _util.abstract)(); + }; + /** + * Test if the geometry and the passed extent intersect. + * @abstract + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + */ + + + Geometry.prototype.intersectsExtent = function (extent) { + return (0, _util.abstract)(); + }; + /** + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @abstract + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @api + */ + + + Geometry.prototype.translate = function (deltaX, deltaY) { + (0, _util.abstract)(); + }; + /** + * Transform each coordinate of the geometry from one coordinate reference + * system to another. The geometry is modified in place. + * For example, a line will be transformed to a line and a circle to a circle. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * + * @param {import("../proj.js").ProjectionLike} source The current projection. Can be a + * string identifier or a {@link module:ol/proj/Projection~Projection} object. + * @param {import("../proj.js").ProjectionLike} destination The desired projection. Can be a + * string identifier or a {@link module:ol/proj/Projection~Projection} object. + * @return {Geometry} This geometry. Note that original geometry is + * modified in place. + * @api + */ + + + Geometry.prototype.transform = function (source, destination) { + /** @type {import("../proj/Projection.js").default} */ + var sourceProj = (0, _proj.get)(source); + var transformFn = sourceProj.getUnits() == _Units.default.TILE_PIXELS ? function (inCoordinates, outCoordinates, stride) { + var pixelExtent = sourceProj.getExtent(); + var projectedExtent = sourceProj.getWorldExtent(); + var scale = (0, _extent.getHeight)(projectedExtent) / (0, _extent.getHeight)(pixelExtent); + (0, _transform.compose)(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0); + (0, _transform2.transform2D)(inCoordinates, 0, inCoordinates.length, stride, tmpTransform, outCoordinates); + return (0, _proj.getTransform)(sourceProj, destination)(inCoordinates, outCoordinates, stride); + } : (0, _proj.getTransform)(sourceProj, destination); + this.applyTransform(transformFn); + return this; + }; + + return Geometry; +}(_Object.default); + +var _default = Geometry; +exports.default = _default; +},{"../Object.js":"../../../node_modules/ol/Object.js","../proj/Units.js":"../../../node_modules/ol/proj/Units.js","../util.js":"../../../node_modules/ol/util.js","../transform.js":"../../../node_modules/ol/transform.js","../extent.js":"../../../node_modules/ol/extent.js","../proj.js":"../../../node_modules/ol/proj.js","../functions.js":"../../../node_modules/ol/functions.js","./flat/transform.js":"../../../node_modules/ol/geom/flat/transform.js"}],"../../../node_modules/ol/geom/SimpleGeometry.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getStrideForLayout = getStrideForLayout; +exports.transformGeom2D = transformGeom2D; +exports.default = void 0; + +var _Geometry = _interopRequireDefault(require("./Geometry.js")); + +var _GeometryLayout = _interopRequireDefault(require("./GeometryLayout.js")); + +var _util = require("../util.js"); + +var _extent = require("../extent.js"); + +var _transform = require("./flat/transform.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/SimpleGeometry + */ + + +/** + * @classdesc + * Abstract base class; only used for creating subclasses; do not instantiate + * in apps, as cannot be rendered. + * + * @abstract + * @api + */ +var SimpleGeometry = +/** @class */ +function (_super) { + __extends(SimpleGeometry, _super); + + function SimpleGeometry() { + var _this = _super.call(this) || this; + /** + * @protected + * @type {import("./GeometryLayout.js").default} + */ + + + _this.layout = _GeometryLayout.default.XY; + /** + * @protected + * @type {number} + */ + + _this.stride = 2; + /** + * @protected + * @type {Array<number>} + */ + + _this.flatCoordinates = null; + return _this; + } + /** + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + + + SimpleGeometry.prototype.computeExtent = function (extent) { + return (0, _extent.createOrUpdateFromFlatCoordinates)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent); + }; + /** + * @abstract + * @return {Array<*>} Coordinates. + */ + + + SimpleGeometry.prototype.getCoordinates = function () { + return (0, _util.abstract)(); + }; + /** + * Return the first coordinate of the geometry. + * @return {import("../coordinate.js").Coordinate} First coordinate. + * @api + */ + + + SimpleGeometry.prototype.getFirstCoordinate = function () { + return this.flatCoordinates.slice(0, this.stride); + }; + /** + * @return {Array<number>} Flat coordinates. + */ + + + SimpleGeometry.prototype.getFlatCoordinates = function () { + return this.flatCoordinates; + }; + /** + * Return the last coordinate of the geometry. + * @return {import("../coordinate.js").Coordinate} Last point. + * @api + */ + + + SimpleGeometry.prototype.getLastCoordinate = function () { + return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride); + }; + /** + * Return the {@link module:ol/geom/GeometryLayout layout} of the geometry. + * @return {import("./GeometryLayout.js").default} Layout. + * @api + */ + + + SimpleGeometry.prototype.getLayout = function () { + return this.layout; + }; + /** + * Create a simplified version of this geometry using the Douglas Peucker algorithm. + * @param {number} squaredTolerance Squared tolerance. + * @return {SimpleGeometry} Simplified geometry. + */ + + + SimpleGeometry.prototype.getSimplifiedGeometry = function (squaredTolerance) { + if (this.simplifiedGeometryRevision !== this.getRevision()) { + this.simplifiedGeometryMaxMinSquaredTolerance = 0; + this.simplifiedGeometryRevision = this.getRevision(); + } // If squaredTolerance is negative or if we know that simplification will not + // have any effect then just return this. + + + if (squaredTolerance < 0 || this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance) { + return this; + } + + var simplifiedGeometry = this.getSimplifiedGeometryInternal(squaredTolerance); + var simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates(); + + if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) { + return simplifiedGeometry; + } else { + // Simplification did not actually remove any coordinates. We now know + // that any calls to getSimplifiedGeometry with a squaredTolerance less + // than or equal to the current squaredTolerance will also not have any + // effect. This allows us to short circuit simplification (saving CPU + // cycles) and prevents the cache of simplified geometries from filling + // up with useless identical copies of this geometry (saving memory). + this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance; + return this; + } + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {SimpleGeometry} Simplified geometry. + * @protected + */ + + + SimpleGeometry.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + return this; + }; + /** + * @return {number} Stride. + */ + + + SimpleGeometry.prototype.getStride = function () { + return this.stride; + }; + /** + * @param {import("./GeometryLayout.js").default} layout Layout. + * @param {Array<number>} flatCoordinates Flat coordinates. + */ + + + SimpleGeometry.prototype.setFlatCoordinates = function (layout, flatCoordinates) { + this.stride = getStrideForLayout(layout); + this.layout = layout; + this.flatCoordinates = flatCoordinates; + }; + /** + * @abstract + * @param {!Array<*>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + */ + + + SimpleGeometry.prototype.setCoordinates = function (coordinates, opt_layout) { + (0, _util.abstract)(); + }; + /** + * @param {import("./GeometryLayout.js").default|undefined} layout Layout. + * @param {Array<*>} coordinates Coordinates. + * @param {number} nesting Nesting. + * @protected + */ + + + SimpleGeometry.prototype.setLayout = function (layout, coordinates, nesting) { + /** @type {number} */ + var stride; + + if (layout) { + stride = getStrideForLayout(layout); + } else { + for (var i = 0; i < nesting; ++i) { + if (coordinates.length === 0) { + this.layout = _GeometryLayout.default.XY; + this.stride = 2; + return; + } else { + coordinates = + /** @type {Array} */ + coordinates[0]; + } + } + + stride = coordinates.length; + layout = getLayoutForStride(stride); + } + + this.layout = layout; + this.stride = stride; + }; + /** + * Apply a transform function to the coordinates of the geometry. + * The geometry is modified in place. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * @param {import("../proj.js").TransformFunction} transformFn Transform function. + * Called with a flat array of geometry coordinates. + * @api + */ + + + SimpleGeometry.prototype.applyTransform = function (transformFn) { + if (this.flatCoordinates) { + transformFn(this.flatCoordinates, this.flatCoordinates, this.stride); + this.changed(); + } + }; + /** + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @param {number} angle Rotation angle in radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. + * @api + */ + + + SimpleGeometry.prototype.rotate = function (angle, anchor) { + var flatCoordinates = this.getFlatCoordinates(); + + if (flatCoordinates) { + var stride = this.getStride(); + (0, _transform.rotate)(flatCoordinates, 0, flatCoordinates.length, stride, angle, anchor, flatCoordinates); + this.changed(); + } + }; + /** + * Scale the geometry (with an optional origin). This modifies the geometry + * coordinates in place. + * @param {number} sx The scaling factor in the x-direction. + * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx). + * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center + * of the geometry extent). + * @api + */ + + + SimpleGeometry.prototype.scale = function (sx, opt_sy, opt_anchor) { + var sy = opt_sy; + + if (sy === undefined) { + sy = sx; + } + + var anchor = opt_anchor; + + if (!anchor) { + anchor = (0, _extent.getCenter)(this.getExtent()); + } + + var flatCoordinates = this.getFlatCoordinates(); + + if (flatCoordinates) { + var stride = this.getStride(); + (0, _transform.scale)(flatCoordinates, 0, flatCoordinates.length, stride, sx, sy, anchor, flatCoordinates); + this.changed(); + } + }; + /** + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @api + */ + + + SimpleGeometry.prototype.translate = function (deltaX, deltaY) { + var flatCoordinates = this.getFlatCoordinates(); + + if (flatCoordinates) { + var stride = this.getStride(); + (0, _transform.translate)(flatCoordinates, 0, flatCoordinates.length, stride, deltaX, deltaY, flatCoordinates); + this.changed(); + } + }; + + return SimpleGeometry; +}(_Geometry.default); +/** + * @param {number} stride Stride. + * @return {import("./GeometryLayout.js").default} layout Layout. + */ + + +function getLayoutForStride(stride) { + var layout; + + if (stride == 2) { + layout = _GeometryLayout.default.XY; + } else if (stride == 3) { + layout = _GeometryLayout.default.XYZ; + } else if (stride == 4) { + layout = _GeometryLayout.default.XYZM; + } + + return ( + /** @type {import("./GeometryLayout.js").default} */ + layout + ); +} +/** + * @param {import("./GeometryLayout.js").default} layout Layout. + * @return {number} Stride. + */ + + +function getStrideForLayout(layout) { + var stride; + + if (layout == _GeometryLayout.default.XY) { + stride = 2; + } else if (layout == _GeometryLayout.default.XYZ || layout == _GeometryLayout.default.XYM) { + stride = 3; + } else if (layout == _GeometryLayout.default.XYZM) { + stride = 4; + } + + return ( + /** @type {number} */ + stride + ); +} +/** + * @param {SimpleGeometry} simpleGeometry Simple geometry. + * @param {import("../transform.js").Transform} transform Transform. + * @param {Array<number>=} opt_dest Destination. + * @return {Array<number>} Transformed flat coordinates. + */ + + +function transformGeom2D(simpleGeometry, transform, opt_dest) { + var flatCoordinates = simpleGeometry.getFlatCoordinates(); + + if (!flatCoordinates) { + return null; + } else { + var stride = simpleGeometry.getStride(); + return (0, _transform.transform2D)(flatCoordinates, 0, flatCoordinates.length, stride, transform, opt_dest); + } +} + +var _default = SimpleGeometry; +exports.default = _default; +},{"./Geometry.js":"../../../node_modules/ol/geom/Geometry.js","./GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","../util.js":"../../../node_modules/ol/util.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/transform.js":"../../../node_modules/ol/geom/flat/transform.js"}],"../../../node_modules/ol/geom/flat/closest.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.maxSquaredDelta = maxSquaredDelta; +exports.arrayMaxSquaredDelta = arrayMaxSquaredDelta; +exports.multiArrayMaxSquaredDelta = multiArrayMaxSquaredDelta; +exports.assignClosestPoint = assignClosestPoint; +exports.assignClosestArrayPoint = assignClosestArrayPoint; +exports.assignClosestMultiArrayPoint = assignClosestMultiArrayPoint; + +var _math = require("../../math.js"); + +/** + * @module ol/geom/flat/closest + */ + +/** + * Returns the point on the 2D line segment flatCoordinates[offset1] to + * flatCoordinates[offset2] that is closest to the point (x, y). Extra + * dimensions are linearly interpolated. + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset1 Offset 1. + * @param {number} offset2 Offset 2. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @param {Array<number>} closestPoint Closest point. + */ +function assignClosest(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) { + var x1 = flatCoordinates[offset1]; + var y1 = flatCoordinates[offset1 + 1]; + var dx = flatCoordinates[offset2] - x1; + var dy = flatCoordinates[offset2 + 1] - y1; + var offset; + + if (dx === 0 && dy === 0) { + offset = offset1; + } else { + var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy); + + if (t > 1) { + offset = offset2; + } else if (t > 0) { + for (var i = 0; i < stride; ++i) { + closestPoint[i] = (0, _math.lerp)(flatCoordinates[offset1 + i], flatCoordinates[offset2 + i], t); + } + + closestPoint.length = stride; + return; + } else { + offset = offset1; + } + } + + for (var i = 0; i < stride; ++i) { + closestPoint[i] = flatCoordinates[offset + i]; + } + + closestPoint.length = stride; +} +/** + * Return the squared of the largest distance between any pair of consecutive + * coordinates. + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} max Max squared delta. + * @return {number} Max squared delta. + */ + + +function maxSquaredDelta(flatCoordinates, offset, end, stride, max) { + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + + for (offset += stride; offset < end; offset += stride) { + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + var squaredDelta = (0, _math.squaredDistance)(x1, y1, x2, y2); + + if (squaredDelta > max) { + max = squaredDelta; + } + + x1 = x2; + y1 = y2; + } + + return max; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {number} max Max squared delta. + * @return {number} Max squared delta. + */ + + +function arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + max = maxSquaredDelta(flatCoordinates, offset, end, stride, max); + offset = end; + } + + return max; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {number} max Max squared delta. + * @return {number} Max squared delta. + */ + + +function multiArrayMaxSquaredDelta(flatCoordinates, offset, endss, stride, max) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max); + offset = ends[ends.length - 1]; + } + + return max; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} maxDelta Max delta. + * @param {boolean} isRing Is ring. + * @param {number} x X. + * @param {number} y Y. + * @param {Array<number>} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @param {Array<number>=} opt_tmpPoint Temporary point object. + * @return {number} Minimum squared distance. + */ + + +function assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { + if (offset == end) { + return minSquaredDistance; + } + + var i, squaredDistance; + + if (maxDelta === 0) { + // All points are identical, so just test the first point. + squaredDistance = (0, _math.squaredDistance)(x, y, flatCoordinates[offset], flatCoordinates[offset + 1]); + + if (squaredDistance < minSquaredDistance) { + for (i = 0; i < stride; ++i) { + closestPoint[i] = flatCoordinates[offset + i]; + } + + closestPoint.length = stride; + return squaredDistance; + } else { + return minSquaredDistance; + } + } + + var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; + var index = offset + stride; + + while (index < end) { + assignClosest(flatCoordinates, index - stride, index, stride, x, y, tmpPoint); + squaredDistance = (0, _math.squaredDistance)(x, y, tmpPoint[0], tmpPoint[1]); + + if (squaredDistance < minSquaredDistance) { + minSquaredDistance = squaredDistance; + + for (i = 0; i < stride; ++i) { + closestPoint[i] = tmpPoint[i]; + } + + closestPoint.length = stride; + index += stride; + } else { + // Skip ahead multiple points, because we know that all the skipped + // points cannot be any closer than the closest point we have found so + // far. We know this because we know how close the current point is, how + // close the closest point we have found so far is, and the maximum + // distance between consecutive points. For example, if we're currently + // at distance 10, the best we've found so far is 3, and that the maximum + // distance between consecutive points is 2, then we'll need to skip at + // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of + // finding a closer point. We use Math.max(..., 1) to ensure that we + // always advance at least one point, to avoid an infinite loop. + index += stride * Math.max((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) / maxDelta | 0, 1); + } + } + + if (isRing) { + // Check the closing segment. + assignClosest(flatCoordinates, end - stride, offset, stride, x, y, tmpPoint); + squaredDistance = (0, _math.squaredDistance)(x, y, tmpPoint[0], tmpPoint[1]); + + if (squaredDistance < minSquaredDistance) { + minSquaredDistance = squaredDistance; + + for (i = 0; i < stride; ++i) { + closestPoint[i] = tmpPoint[i]; + } + + closestPoint.length = stride; + } + } + + return minSquaredDistance; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {number} maxDelta Max delta. + * @param {boolean} isRing Is ring. + * @param {number} x X. + * @param {number} y Y. + * @param {Array<number>} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @param {Array<number>=} opt_tmpPoint Temporary point object. + * @return {number} Minimum squared distance. + */ + + +function assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { + var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + minSquaredDistance = assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint); + offset = end; + } + + return minSquaredDistance; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {number} maxDelta Max delta. + * @param {boolean} isRing Is ring. + * @param {number} x X. + * @param {number} y Y. + * @param {Array<number>} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @param {Array<number>=} opt_tmpPoint Temporary point object. + * @return {number} Minimum squared distance. + */ + + +function assignClosestMultiArrayPoint(flatCoordinates, offset, endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { + var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; + + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + minSquaredDistance = assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint); + offset = ends[ends.length - 1]; + } + + return minSquaredDistance; +} +},{"../../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/geom/flat/deflate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.deflateCoordinate = deflateCoordinate; +exports.deflateCoordinates = deflateCoordinates; +exports.deflateCoordinatesArray = deflateCoordinatesArray; +exports.deflateMultiCoordinatesArray = deflateMultiCoordinatesArray; + +/** + * @module ol/geom/flat/deflate + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {number} stride Stride. + * @return {number} offset Offset. + */ +function deflateCoordinate(flatCoordinates, offset, coordinate, stride) { + for (var i = 0, ii = coordinate.length; i < ii; ++i) { + flatCoordinates[offset++] = coordinate[i]; + } + + return offset; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<import("../../coordinate.js").Coordinate>} coordinates Coordinates. + * @param {number} stride Stride. + * @return {number} offset Offset. + */ + + +function deflateCoordinates(flatCoordinates, offset, coordinates, stride) { + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + var coordinate = coordinates[i]; + + for (var j = 0; j < stride; ++j) { + flatCoordinates[offset++] = coordinate[j]; + } + } + + return offset; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<import("../../coordinate.js").Coordinate>>} coordinatess Coordinatess. + * @param {number} stride Stride. + * @param {Array<number>=} opt_ends Ends. + * @return {Array<number>} Ends. + */ + + +function deflateCoordinatesArray(flatCoordinates, offset, coordinatess, stride, opt_ends) { + var ends = opt_ends ? opt_ends : []; + var i = 0; + + for (var j = 0, jj = coordinatess.length; j < jj; ++j) { + var end = deflateCoordinates(flatCoordinates, offset, coordinatess[j], stride); + ends[i++] = end; + offset = end; + } + + ends.length = i; + return ends; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} coordinatesss Coordinatesss. + * @param {number} stride Stride. + * @param {Array<Array<number>>=} opt_endss Endss. + * @return {Array<Array<number>>} Endss. + */ + + +function deflateMultiCoordinatesArray(flatCoordinates, offset, coordinatesss, stride, opt_endss) { + var endss = opt_endss ? opt_endss : []; + var i = 0; + + for (var j = 0, jj = coordinatesss.length; j < jj; ++j) { + var ends = deflateCoordinatesArray(flatCoordinates, offset, coordinatesss[j], stride, endss[i]); + endss[i++] = ends; + offset = ends[ends.length - 1]; + } + + endss.length = i; + return endss; +} +},{}],"../../../node_modules/ol/geom/flat/simplify.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.simplifyLineString = simplifyLineString; +exports.douglasPeucker = douglasPeucker; +exports.douglasPeuckerArray = douglasPeuckerArray; +exports.douglasPeuckerMultiArray = douglasPeuckerMultiArray; +exports.radialDistance = radialDistance; +exports.snap = snap; +exports.quantize = quantize; +exports.quantizeArray = quantizeArray; +exports.quantizeMultiArray = quantizeMultiArray; + +var _math = require("../../math.js"); + +/** + * @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<number>} 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<number>=} opt_simplifiedFlatCoordinates Simplified flat + * coordinates. + * @return {Array<number>} 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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array<number>} 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<number>} */ + + + var markers = new Array(n); + markers[0] = 1; + markers[n - 1] = 1; + /** @type {Array<number>} */ + + 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 = (0, _math.squaredSegmentDistance)(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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array<number>} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array<number>} 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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array<number>} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array<Array<number>>} 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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array<number>} 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 ((0, _math.squaredDistance)(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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array<number>} 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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array<number>} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array<number>} 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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array<number>} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array<Array<number>>} 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; +} +},{"../../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/geom/flat/inflate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.inflateCoordinates = inflateCoordinates; +exports.inflateCoordinatesArray = inflateCoordinatesArray; +exports.inflateMultiCoordinatesArray = inflateMultiCoordinatesArray; + +/** + * @module ol/geom/flat/inflate + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {Array<import("../../coordinate.js").Coordinate>=} opt_coordinates Coordinates. + * @return {Array<import("../../coordinate.js").Coordinate>} Coordinates. + */ +function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) { + var coordinates = opt_coordinates !== undefined ? opt_coordinates : []; + var i = 0; + + for (var j = offset; j < end; j += stride) { + coordinates[i++] = flatCoordinates.slice(j, j + stride); + } + + coordinates.length = i; + return coordinates; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {Array<Array<import("../../coordinate.js").Coordinate>>=} opt_coordinatess Coordinatess. + * @return {Array<Array<import("../../coordinate.js").Coordinate>>} Coordinatess. + */ + + +function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) { + var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : []; + var i = 0; + + for (var j = 0, jj = ends.length; j < jj; ++j) { + var end = ends[j]; + coordinatess[i++] = inflateCoordinates(flatCoordinates, offset, end, stride, coordinatess[i]); + offset = end; + } + + coordinatess.length = i; + return coordinatess; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {Array<Array<Array<import("../../coordinate.js").Coordinate>>>=} opt_coordinatesss + * Coordinatesss. + * @return {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} Coordinatesss. + */ + + +function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) { + var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : []; + var i = 0; + + for (var j = 0, jj = endss.length; j < jj; ++j) { + var ends = endss[j]; + coordinatesss[i++] = inflateCoordinatesArray(flatCoordinates, offset, ends, stride, coordinatesss[i]); + offset = ends[ends.length - 1]; + } + + coordinatesss.length = i; + return coordinatesss; +} +},{}],"../../../node_modules/ol/geom/flat/area.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.linearRing = linearRing; +exports.linearRings = linearRings; +exports.linearRingss = linearRingss; + +/** + * @module ol/geom/flat/area + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {number} Area. + */ +function linearRing(flatCoordinates, offset, end, stride) { + var twiceArea = 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]; + twiceArea += y1 * x2 - x1 * y2; + x1 = x2; + y1 = y2; + } + + return twiceArea / 2; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @return {number} Area. + */ + + +function linearRings(flatCoordinates, offset, ends, stride) { + var area = 0; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + area += linearRing(flatCoordinates, offset, end, stride); + offset = end; + } + + return area; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @return {number} Area. + */ + + +function linearRingss(flatCoordinates, offset, endss, stride) { + var area = 0; + + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + area += linearRings(flatCoordinates, offset, ends, stride); + offset = ends[ends.length - 1]; + } + + return area; +} +},{}],"../../../node_modules/ol/geom/LinearRing.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryLayout = _interopRequireDefault(require("./GeometryLayout.js")); + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _closest = require("./flat/closest.js"); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _simplify = require("./flat/simplify.js"); + +var _inflate = require("./flat/inflate.js"); + +var _area = require("./flat/area.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + 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<import("../coordinate.js").Coordinate>|Array<number>} 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<number>} */ + coordinates); + } else { + _this.setCoordinates( + /** @type {Array<import("../coordinate.js").Coordinate>} */ + 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 < (0, _extent.closestSquaredDistanceXY)(this.getExtent(), x, y)) { + return minSquaredDistance; + } + + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt((0, _closest.maxSquaredDelta)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + + return (0, _closest.assignClosestPoint)(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 (0, _area.linearRing)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the coordinates of the linear ring. + * @return {Array<import("../coordinate.js").Coordinate>} Coordinates. + * @api + */ + + + LinearRing.prototype.getCoordinates = function () { + return (0, _inflate.inflateCoordinates)(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 = (0, _simplify.douglasPeucker)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return new LinearRing(simplifiedFlatCoordinates, _GeometryLayout.default.XY); + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + LinearRing.prototype.getType = function () { + return _GeometryType.default.LINEAR_RING; + }; + /** + * 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<import("../coordinate.js").Coordinate>} 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 = (0, _deflate.deflateCoordinates)(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + + return LinearRing; +}(_SimpleGeometry.default); + +var _default = LinearRing; +exports.default = _default; +},{"./GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","./flat/closest.js":"../../../node_modules/ol/geom/flat/closest.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","./flat/simplify.js":"../../../node_modules/ol/geom/flat/simplify.js","./flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js","./flat/area.js":"../../../node_modules/ol/geom/flat/area.js"}],"../../../node_modules/ol/geom/Point.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _math = require("../math.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/Point + */ + + +/** + * @classdesc + * Point geometry. + * + * @api + */ +var Point = +/** @class */ +function (_super) { + __extends(Point, _super); + /** + * @param {import("../coordinate.js").Coordinate} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + */ + + + function Point(coordinates, opt_layout) { + var _this = _super.call(this) || this; + + _this.setCoordinates(coordinates, opt_layout); + + return _this; + } + /** + * Make a complete copy of the geometry. + * @return {!Point} Clone. + * @api + */ + + + Point.prototype.clone = function () { + var point = new Point(this.flatCoordinates.slice(), this.layout); + return point; + }; + /** + * @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. + */ + + + Point.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + var flatCoordinates = this.flatCoordinates; + var squaredDistance = (0, _math.squaredDistance)(x, y, flatCoordinates[0], flatCoordinates[1]); + + if (squaredDistance < minSquaredDistance) { + var stride = this.stride; + + for (var i = 0; i < stride; ++i) { + closestPoint[i] = flatCoordinates[i]; + } + + closestPoint.length = stride; + return squaredDistance; + } else { + return minSquaredDistance; + } + }; + /** + * Return the coordinate of the point. + * @return {import("../coordinate.js").Coordinate} Coordinates. + * @api + */ + + + Point.prototype.getCoordinates = function () { + return !this.flatCoordinates ? [] : this.flatCoordinates.slice(); + }; + /** + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + + + Point.prototype.computeExtent = function (extent) { + return (0, _extent.createOrUpdateFromCoordinate)(this.flatCoordinates, extent); + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + Point.prototype.getType = function () { + return _GeometryType.default.POINT; + }; + /** + * 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 + */ + + + Point.prototype.intersectsExtent = function (extent) { + return (0, _extent.containsXY)(extent, this.flatCoordinates[0], this.flatCoordinates[1]); + }; + /** + * @param {!Array<*>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @api + */ + + + Point.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 0); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + + this.flatCoordinates.length = (0, _deflate.deflateCoordinate)(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + + return Point; +}(_SimpleGeometry.default); + +var _default = Point; +exports.default = _default; +},{"./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/geom/flat/contains.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.linearRingContainsExtent = linearRingContainsExtent; +exports.linearRingContainsXY = linearRingContainsXY; +exports.linearRingsContainsXY = linearRingsContainsXY; +exports.linearRingssContainsXY = linearRingssContainsXY; + +var _extent = require("../../extent.js"); + +/** + * @module ol/geom/flat/contains + */ + +/** + * @param {Array<number>} 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 = (0, _extent.forEachCorner)(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<number>} 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) { + // http://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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} 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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} 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; +} +},{"../../extent.js":"../../../node_modules/ol/extent.js"}],"../../../node_modules/ol/geom/flat/interiorpoint.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getInteriorPointOfArray = getInteriorPointOfArray; +exports.getInteriorPointsOfMultiArray = getInteriorPointsOfMultiArray; + +var _contains = require("./contains.js"); + +var _array = require("../../array.js"); + +/** + * @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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {Array<number>} flatCenters Flat centers. + * @param {number} flatCentersOffset Flat center offset. + * @param {Array<number>=} opt_dest Destination. + * @return {Array<number>} 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<number>} */ + + 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.numberSafeCompareFunction); + 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 ((0, _contains.linearRingsContainsXY)(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<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {Array<number>} flatCenters Flat centers. + * @return {Array<number>} 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; +} +},{"./contains.js":"../../../node_modules/ol/geom/flat/contains.js","../../array.js":"../../../node_modules/ol/array.js"}],"../../../node_modules/ol/geom/flat/segments.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.forEach = forEach; + +/** + * @module ol/geom/flat/segments + */ + +/** + * This function calls `callback` for each segment of the flat coordinates + * array. If the callback returns a truthy value the function returns that + * value immediately. Otherwise the function returns `false`. + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function + * called for each segment. + * @return {T|boolean} Value. + * @template T + */ +function forEach(flatCoordinates, offset, end, stride, callback) { + var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]]; + var point2 = []; + var ret; + + for (; offset + stride < end; offset += stride) { + point2[0] = flatCoordinates[offset + stride]; + point2[1] = flatCoordinates[offset + stride + 1]; + ret = callback(point1, point2); + + if (ret) { + return ret; + } + + point1[0] = point2[0]; + point1[1] = point2[1]; + } + + return false; +} +},{}],"../../../node_modules/ol/geom/flat/intersectsextent.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.intersectsLineString = intersectsLineString; +exports.intersectsLineStringArray = intersectsLineStringArray; +exports.intersectsLinearRing = intersectsLinearRing; +exports.intersectsLinearRingArray = intersectsLinearRingArray; +exports.intersectsLinearRingMultiArray = intersectsLinearRingMultiArray; + +var _extent = require("../../extent.js"); + +var _segments = require("./segments.js"); + +var _contains = require("./contains.js"); + +/** + * @module ol/geom/flat/intersectsextent + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ +function intersectsLineString(flatCoordinates, offset, end, stride, extent) { + var coordinatesExtent = (0, _extent.extendFlatCoordinates)((0, _extent.createEmpty)(), flatCoordinates, offset, end, stride); + + if (!(0, _extent.intersects)(extent, coordinatesExtent)) { + return false; + } + + if ((0, _extent.containsExtent)(extent, coordinatesExtent)) { + return true; + } + + if (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) { + return true; + } + + if (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3]) { + return true; + } + + return (0, _segments.forEach)(flatCoordinates, offset, end, stride, + /** + * @param {import("../../coordinate.js").Coordinate} point1 Start point. + * @param {import("../../coordinate.js").Coordinate} point2 End point. + * @return {boolean} `true` if the segment and the extent intersect, + * `false` otherwise. + */ + function (point1, point2) { + return (0, _extent.intersectsSegment)(extent, point1, point2); + }); +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ + + +function intersectsLineStringArray(flatCoordinates, offset, ends, stride, extent) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + if (intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)) { + return true; + } + + offset = ends[i]; + } + + return false; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ + + +function intersectsLinearRing(flatCoordinates, offset, end, stride, extent) { + if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) { + return true; + } + + if ((0, _contains.linearRingContainsXY)(flatCoordinates, offset, end, stride, extent[0], extent[1])) { + return true; + } + + if ((0, _contains.linearRingContainsXY)(flatCoordinates, offset, end, stride, extent[0], extent[3])) { + return true; + } + + if ((0, _contains.linearRingContainsXY)(flatCoordinates, offset, end, stride, extent[2], extent[1])) { + return true; + } + + if ((0, _contains.linearRingContainsXY)(flatCoordinates, offset, end, stride, extent[2], extent[3])) { + return true; + } + + return false; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ + + +function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent) { + if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) { + return false; + } + + if (ends.length === 1) { + return true; + } + + for (var i = 1, ii = ends.length; i < ii; ++i) { + if ((0, _contains.linearRingContainsExtent)(flatCoordinates, ends[i - 1], ends[i], stride, extent)) { + if (!intersectsLineString(flatCoordinates, ends[i - 1], ends[i], stride, extent)) { + return false; + } + } + } + + return true; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} True if the geometry and the extent intersect. + */ + + +function intersectsLinearRingMultiArray(flatCoordinates, offset, endss, stride, extent) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + + if (intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)) { + return true; + } + + offset = ends[ends.length - 1]; + } + + return false; +} +},{"../../extent.js":"../../../node_modules/ol/extent.js","./segments.js":"../../../node_modules/ol/geom/flat/segments.js","./contains.js":"../../../node_modules/ol/geom/flat/contains.js"}],"../../../node_modules/ol/geom/flat/reverse.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.coordinates = coordinates; + +/** + * @module ol/geom/flat/reverse + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + */ +function coordinates(flatCoordinates, offset, end, stride) { + while (offset < end - stride) { + for (var i = 0; i < stride; ++i) { + var tmp = flatCoordinates[offset + i]; + flatCoordinates[offset + i] = flatCoordinates[end - stride + i]; + flatCoordinates[end - stride + i] = tmp; + } + + offset += stride; + end -= stride; + } +} +},{}],"../../../node_modules/ol/geom/flat/orient.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.linearRingIsClockwise = linearRingIsClockwise; +exports.linearRingsAreOriented = linearRingsAreOriented; +exports.linearRingssAreOriented = linearRingssAreOriented; +exports.orientLinearRings = orientLinearRings; +exports.orientLinearRingsArray = orientLinearRingsArray; + +var _reverse = require("./reverse.js"); + +/** + * @module ol/geom/flat/orient + */ + +/** + * Is the linear ring oriented clockwise in a coordinate system with a bottom-left + * coordinate origin? For a coordinate system with a top-left coordinate origin, + * the ring's orientation is clockwise when this function returns false. + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {boolean} Is clockwise. + */ +function linearRingIsClockwise(flatCoordinates, offset, end, stride) { + // https://stackoverflow.com/a/1180256/2389327 + // https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon + var firstVertexRepeated = true; + + for (var i = 0; i < stride; ++i) { + if (flatCoordinates[offset + i] !== flatCoordinates[end - stride + i]) { + firstVertexRepeated = false; + break; + } + } + + if (firstVertexRepeated) { + end -= stride; + } + + var iMinVertex = findCornerVertex(flatCoordinates, offset, end, stride); // Orientation matrix: + // [ 1 xa ya ] + // O = | 1 xb yb | + // [ 1 xc yc ] + + var iPreviousVertex = iMinVertex - stride; + + if (iPreviousVertex < offset) { + iPreviousVertex = end - stride; + } + + var iNextVertex = iMinVertex + stride; + + if (iNextVertex >= end) { + iNextVertex = offset; + } + + var aX = flatCoordinates[iPreviousVertex]; + var aY = flatCoordinates[iPreviousVertex + 1]; + var bX = flatCoordinates[iMinVertex]; + var bY = flatCoordinates[iMinVertex + 1]; + var cX = flatCoordinates[iNextVertex]; + var cY = flatCoordinates[iNextVertex + 1]; + var determinant = bX * cY + aX * bY + aY * cX - (aY * bX + bY * cX + aX * cY); + return determinant < 0; +} // Find vertex along one edge of bounding box. +// In this case, we find smallest y; in case of tie also smallest x. + + +function findCornerVertex(flatCoordinates, offset, end, stride) { + var iMinVertex = -1; + var minY = Infinity; + var minXAtMinY = Infinity; + + for (var i = offset; i < end; i += stride) { + var x = flatCoordinates[i]; + var y = flatCoordinates[i + 1]; + + if (y > minY) { + continue; + } + + if (y == minY) { + if (x >= minXAtMinY) { + continue; + } + } // Minimum so far. + + + iMinVertex = i; + minY = y; + minXAtMinY = x; + } + + return iMinVertex; +} +/** + * Determines if linear rings are oriented. By default, left-hand orientation + * is tested (first ring must be clockwise, remaining rings counter-clockwise). + * To test for right-hand orientation, use the `opt_right` argument. + * + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Array of end indexes. + * @param {number} stride Stride. + * @param {boolean=} opt_right Test for right-hand orientation + * (counter-clockwise exterior ring and clockwise interior rings). + * @return {boolean} Rings are correctly oriented. + */ + + +function linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right) { + var right = opt_right !== undefined ? opt_right : false; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride); + + if (i === 0) { + if (right && isClockwise || !right && !isClockwise) { + return false; + } + } else { + if (right && !isClockwise || !right && isClockwise) { + return false; + } + } + + offset = end; + } + + return true; +} +/** + * Determines if linear rings are oriented. By default, left-hand orientation + * is tested (first ring must be clockwise, remaining rings counter-clockwise). + * To test for right-hand orientation, use the `opt_right` argument. + * + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Array of array of end indexes. + * @param {number} stride Stride. + * @param {boolean=} opt_right Test for right-hand orientation + * (counter-clockwise exterior ring and clockwise interior rings). + * @return {boolean} Rings are correctly oriented. + */ + + +function linearRingssAreOriented(flatCoordinates, offset, endss, stride, opt_right) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + + if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right)) { + return false; + } + + if (ends.length) { + offset = ends[ends.length - 1]; + } + } + + return true; +} +/** + * Orient coordinates in a flat array of linear rings. By default, rings + * are oriented following the left-hand rule (clockwise for exterior and + * counter-clockwise for interior rings). To orient according to the + * right-hand rule, use the `opt_right` argument. + * + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {boolean=} opt_right Follow the right-hand rule for orientation. + * @return {number} End. + */ + + +function orientLinearRings(flatCoordinates, offset, ends, stride, opt_right) { + var right = opt_right !== undefined ? opt_right : false; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride); + var reverse = i === 0 ? right && isClockwise || !right && !isClockwise : right && !isClockwise || !right && isClockwise; + + if (reverse) { + (0, _reverse.coordinates)(flatCoordinates, offset, end, stride); + } + + offset = end; + } + + return offset; +} +/** + * Orient coordinates in a flat array of linear rings. By default, rings + * are oriented following the left-hand rule (clockwise for exterior and + * counter-clockwise for interior rings). To orient according to the + * right-hand rule, use the `opt_right` argument. + * + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Array of array of end indexes. + * @param {number} stride Stride. + * @param {boolean=} opt_right Follow the right-hand rule for orientation. + * @return {number} End. + */ + + +function orientLinearRingsArray(flatCoordinates, offset, endss, stride, opt_right) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + offset = orientLinearRings(flatCoordinates, offset, endss[i], stride, opt_right); + } + + return offset; +} +},{"./reverse.js":"../../../node_modules/ol/geom/flat/reverse.js"}],"../../../node_modules/ol/geom/Polygon.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.circular = circular; +exports.fromExtent = fromExtent; +exports.fromCircle = fromCircle; +exports.makeRegular = makeRegular; +exports.default = void 0; + +var _GeometryLayout = _interopRequireDefault(require("./GeometryLayout.js")); + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _LinearRing = _interopRequireDefault(require("./LinearRing.js")); + +var _Point = _interopRequireDefault(require("./Point.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _closest = require("./flat/closest.js"); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _array = require("../array.js"); + +var _interiorpoint = require("./flat/interiorpoint.js"); + +var _inflate = require("./flat/inflate.js"); + +var _intersectsextent = require("./flat/intersectsextent.js"); + +var _orient = require("./flat/orient.js"); + +var _area = require("./flat/area.js"); + +var _contains = require("./flat/contains.js"); + +var _math = require("../math.js"); + +var _simplify = require("./flat/simplify.js"); + +var _sphere = require("../sphere.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/Polygon + */ + + +/** + * @classdesc + * Polygon geometry. + * + * @api + */ +var Polygon = +/** @class */ +function (_super) { + __extends(Polygon, _super); + /** + * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates + * Array of linear rings that define the polygon. The first linear ring of the + * array defines the outer-boundary or surface of the polygon. Each subsequent + * linear ring defines a hole in the surface of the polygon. A linear ring is + * an array of vertices' coordinates where the first coordinate and the last are + * equivalent. (For internal use, flat coordinates in combination with + * `opt_layout` and `opt_ends` are also accepted.) + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @param {Array<number>=} opt_ends Ends (for internal use with flat coordinates). + */ + + + function Polygon(coordinates, opt_layout, opt_ends) { + var _this = _super.call(this) || this; + /** + * @type {Array<number>} + * @private + */ + + + _this.ends_ = []; + /** + * @private + * @type {number} + */ + + _this.flatInteriorPointRevision_ = -1; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + + _this.flatInteriorPoint_ = null; + /** + * @private + * @type {number} + */ + + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + + _this.maxDeltaRevision_ = -1; + /** + * @private + * @type {number} + */ + + _this.orientedRevision_ = -1; + /** + * @private + * @type {Array<number>} + */ + + _this.orientedFlatCoordinates_ = null; + + if (opt_layout !== undefined && opt_ends) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array<number>} */ + coordinates); + + _this.ends_ = opt_ends; + } else { + _this.setCoordinates( + /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ + coordinates, opt_layout); + } + + return _this; + } + /** + * Append the passed linear ring to this polygon. + * @param {LinearRing} linearRing Linear ring. + * @api + */ + + + Polygon.prototype.appendLinearRing = function (linearRing) { + if (!this.flatCoordinates) { + this.flatCoordinates = linearRing.getFlatCoordinates().slice(); + } else { + (0, _array.extend)(this.flatCoordinates, linearRing.getFlatCoordinates()); + } + + this.ends_.push(this.flatCoordinates.length); + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!Polygon} Clone. + * @api + */ + + + Polygon.prototype.clone = function () { + return new Polygon(this.flatCoordinates.slice(), this.layout, this.ends_.slice()); + }; + /** + * @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. + */ + + + Polygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < (0, _extent.closestSquaredDistanceXY)(this.getExtent(), x, y)) { + return minSquaredDistance; + } + + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt((0, _closest.arrayMaxSquaredDelta)(this.flatCoordinates, 0, this.ends_, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + + return (0, _closest.assignClosestArrayPoint)(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + + + Polygon.prototype.containsXY = function (x, y) { + return (0, _contains.linearRingsContainsXY)(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y); + }; + /** + * Return the area of the polygon on projected plane. + * @return {number} Area (on projected plane). + * @api + */ + + + Polygon.prototype.getArea = function () { + return (0, _area.linearRings)(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride); + }; + /** + * Get the coordinate array for this geometry. This array has the structure + * of a GeoJSON coordinate array for polygons. + * + * @param {boolean=} opt_right Orient coordinates according to the right-hand + * rule (counter-clockwise for exterior and clockwise for interior rings). + * If `false`, coordinates will be oriented according to the left-hand rule + * (clockwise for exterior and counter-clockwise for interior rings). + * By default, coordinate orientation will depend on how the geometry was + * constructed. + * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates. + * @api + */ + + + Polygon.prototype.getCoordinates = function (opt_right) { + var flatCoordinates; + + if (opt_right !== undefined) { + flatCoordinates = this.getOrientedFlatCoordinates().slice(); + (0, _orient.orientLinearRings)(flatCoordinates, 0, this.ends_, this.stride, opt_right); + } else { + flatCoordinates = this.flatCoordinates; + } + + return (0, _inflate.inflateCoordinatesArray)(flatCoordinates, 0, this.ends_, this.stride); + }; + /** + * @return {Array<number>} Ends. + */ + + + Polygon.prototype.getEnds = function () { + return this.ends_; + }; + /** + * @return {Array<number>} Interior point. + */ + + + Polygon.prototype.getFlatInteriorPoint = function () { + if (this.flatInteriorPointRevision_ != this.getRevision()) { + var flatCenter = (0, _extent.getCenter)(this.getExtent()); + this.flatInteriorPoint_ = (0, _interiorpoint.getInteriorPointOfArray)(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, flatCenter, 0); + this.flatInteriorPointRevision_ = this.getRevision(); + } + + return this.flatInteriorPoint_; + }; + /** + * Return an interior point of the polygon. + * @return {Point} Interior point as XYM coordinate, where M is the + * length of the horizontal intersection that the point belongs to. + * @api + */ + + + Polygon.prototype.getInteriorPoint = function () { + return new _Point.default(this.getFlatInteriorPoint(), _GeometryLayout.default.XYM); + }; + /** + * Return the number of rings of the polygon, this includes the exterior + * ring and any interior rings. + * + * @return {number} Number of rings. + * @api + */ + + + Polygon.prototype.getLinearRingCount = function () { + return this.ends_.length; + }; + /** + * Return the Nth linear ring of the polygon geometry. Return `null` if the + * given index is out of range. + * The exterior linear ring is available at index `0` and the interior rings + * at index `1` and beyond. + * + * @param {number} index Index. + * @return {LinearRing} Linear ring. + * @api + */ + + + Polygon.prototype.getLinearRing = function (index) { + if (index < 0 || this.ends_.length <= index) { + return null; + } + + return new _LinearRing.default(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout); + }; + /** + * Return the linear rings of the polygon. + * @return {Array<LinearRing>} Linear rings. + * @api + */ + + + Polygon.prototype.getLinearRings = function () { + var layout = this.layout; + var flatCoordinates = this.flatCoordinates; + var ends = this.ends_; + var linearRings = []; + var offset = 0; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var linearRing = new _LinearRing.default(flatCoordinates.slice(offset, end), layout); + linearRings.push(linearRing); + offset = end; + } + + return linearRings; + }; + /** + * @return {Array<number>} Oriented flat coordinates. + */ + + + Polygon.prototype.getOrientedFlatCoordinates = function () { + if (this.orientedRevision_ != this.getRevision()) { + var flatCoordinates = this.flatCoordinates; + + if ((0, _orient.linearRingsAreOriented)(flatCoordinates, 0, this.ends_, this.stride)) { + this.orientedFlatCoordinates_ = flatCoordinates; + } else { + this.orientedFlatCoordinates_ = flatCoordinates.slice(); + this.orientedFlatCoordinates_.length = (0, _orient.orientLinearRings)(this.orientedFlatCoordinates_, 0, this.ends_, this.stride); + } + + this.orientedRevision_ = this.getRevision(); + } + + return this.orientedFlatCoordinates_; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {Polygon} Simplified Polygon. + * @protected + */ + + + Polygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + var simplifiedEnds = []; + simplifiedFlatCoordinates.length = (0, _simplify.quantizeArray)(this.flatCoordinates, 0, this.ends_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEnds); + return new Polygon(simplifiedFlatCoordinates, _GeometryLayout.default.XY, simplifiedEnds); + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + Polygon.prototype.getType = function () { + return _GeometryType.default.POLYGON; + }; + /** + * 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 + */ + + + Polygon.prototype.intersectsExtent = function (extent) { + return (0, _intersectsextent.intersectsLinearRingArray)(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent); + }; + /** + * Set the coordinates of the polygon. + * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @api + */ + + + Polygon.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 2); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + + var ends = (0, _deflate.deflateCoordinatesArray)(this.flatCoordinates, 0, coordinates, this.stride, this.ends_); + this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; + this.changed(); + }; + + return Polygon; +}(_SimpleGeometry.default); + +var _default = Polygon; +/** + * Create an approximation of a circle on the surface of a sphere. + * @param {import("../coordinate.js").Coordinate} center Center (`[lon, lat]` in degrees). + * @param {number} radius The great-circle distance from the center to + * the polygon vertices. + * @param {number=} opt_n Optional number of vertices for the resulting + * polygon. Default is `32`. + * @param {number=} opt_sphereRadius Optional radius for the sphere (defaults to + * the Earth's mean radius using the WGS84 ellipsoid). + * @return {Polygon} The "circular" polygon. + * @api + */ + +exports.default = _default; + +function circular(center, radius, opt_n, opt_sphereRadius) { + var n = opt_n ? opt_n : 32; + /** @type {Array<number>} */ + + var flatCoordinates = []; + + for (var i = 0; i < n; ++i) { + (0, _array.extend)(flatCoordinates, (0, _sphere.offset)(center, radius, 2 * Math.PI * i / n, opt_sphereRadius)); + } + + flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]); + return new Polygon(flatCoordinates, _GeometryLayout.default.XY, [flatCoordinates.length]); +} +/** + * Create a polygon from an extent. The layout used is `XY`. + * @param {import("../extent.js").Extent} extent The extent. + * @return {Polygon} The polygon. + * @api + */ + + +function fromExtent(extent) { + var minX = extent[0]; + var minY = extent[1]; + var maxX = extent[2]; + var maxY = extent[3]; + var flatCoordinates = [minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY]; + return new Polygon(flatCoordinates, _GeometryLayout.default.XY, [flatCoordinates.length]); +} +/** + * Create a regular polygon from a circle. + * @param {import("./Circle.js").default} circle Circle geometry. + * @param {number=} opt_sides Number of sides of the polygon. Default is 32. + * @param {number=} opt_angle Start angle for the first vertex of the polygon in + * radians. Default is 0. + * @return {Polygon} Polygon geometry. + * @api + */ + + +function fromCircle(circle, opt_sides, opt_angle) { + var sides = opt_sides ? opt_sides : 32; + var stride = circle.getStride(); + var layout = circle.getLayout(); + var center = circle.getCenter(); + var arrayLength = stride * (sides + 1); + var flatCoordinates = new Array(arrayLength); + + for (var i = 0; i < arrayLength; i += stride) { + flatCoordinates[i] = 0; + flatCoordinates[i + 1] = 0; + + for (var j = 2; j < stride; j++) { + flatCoordinates[i + j] = center[j]; + } + } + + var ends = [flatCoordinates.length]; + var polygon = new Polygon(flatCoordinates, layout, ends); + makeRegular(polygon, center, circle.getRadius(), opt_angle); + return polygon; +} +/** + * Modify the coordinates of a polygon to make it a regular polygon. + * @param {Polygon} polygon Polygon geometry. + * @param {import("../coordinate.js").Coordinate} center Center of the regular polygon. + * @param {number} radius Radius of the regular polygon. + * @param {number=} opt_angle Start angle for the first vertex of the polygon in + * radians. Default is 0. + */ + + +function makeRegular(polygon, center, radius, opt_angle) { + var flatCoordinates = polygon.getFlatCoordinates(); + var stride = polygon.getStride(); + var sides = flatCoordinates.length / stride - 1; + var startAngle = opt_angle ? opt_angle : 0; + + for (var i = 0; i <= sides; ++i) { + var offset = i * stride; + var angle = startAngle + (0, _math.modulo)(i, sides) * 2 * Math.PI / sides; + flatCoordinates[offset] = center[0] + radius * Math.cos(angle); + flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle); + } + + polygon.changed(); +} +},{"./GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./LinearRing.js":"../../../node_modules/ol/geom/LinearRing.js","./Point.js":"../../../node_modules/ol/geom/Point.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","./flat/closest.js":"../../../node_modules/ol/geom/flat/closest.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","../array.js":"../../../node_modules/ol/array.js","./flat/interiorpoint.js":"../../../node_modules/ol/geom/flat/interiorpoint.js","./flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js","./flat/intersectsextent.js":"../../../node_modules/ol/geom/flat/intersectsextent.js","./flat/orient.js":"../../../node_modules/ol/geom/flat/orient.js","./flat/area.js":"../../../node_modules/ol/geom/flat/area.js","./flat/contains.js":"../../../node_modules/ol/geom/flat/contains.js","../math.js":"../../../node_modules/ol/math.js","./flat/simplify.js":"../../../node_modules/ol/geom/flat/simplify.js","../sphere.js":"../../../node_modules/ol/sphere.js"}],"../../../node_modules/ol/Geolocation.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Event = _interopRequireDefault(require("./events/Event.js")); + +var _Object = _interopRequireWildcard(require("./Object.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _Polygon = require("./geom/Polygon.js"); + +var _proj = require("./proj.js"); + +var _math = require("./math.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Geolocation + */ + + +/** + * @enum {string} + */ +var Property = { + ACCURACY: 'accuracy', + ACCURACY_GEOMETRY: 'accuracyGeometry', + ALTITUDE: 'altitude', + ALTITUDE_ACCURACY: 'altitudeAccuracy', + HEADING: 'heading', + POSITION: 'position', + PROJECTION: 'projection', + SPEED: 'speed', + TRACKING: 'tracking', + TRACKING_OPTIONS: 'trackingOptions' +}; +/** + * @classdesc + * Events emitted on Geolocation error. + */ + +var GeolocationError = +/** @class */ +function (_super) { + __extends(GeolocationError, _super); + /** + * @param {PositionError} error error object. + */ + + + function GeolocationError(error) { + var _this = _super.call(this, _EventType.default.ERROR) || this; + /** + * @type {number} + */ + + + _this.code = error.code; + /** + * @type {string} + */ + + _this.message = error.message; + return _this; + } + + return GeolocationError; +}(_Event.default); +/** + * @typedef {Object} Options + * @property {boolean} [tracking=false] Start Tracking right after + * instantiation. + * @property {PositionOptions} [trackingOptions] Tracking options. + * See http://www.w3.org/TR/geolocation-API/#position_options_interface. + * @property {import("./proj.js").ProjectionLike} [projection] The projection the position + * is reported in. + */ + +/** + * @classdesc + * Helper class for providing HTML5 Geolocation capabilities. + * The [Geolocation API](http://www.w3.org/TR/geolocation-API/) + * is used to locate a user's position. + * + * To get notified of position changes, register a listener for the generic + * `change` event on your instance of {@link module:ol/Geolocation~Geolocation}. + * + * Example: + * + * var geolocation = new Geolocation({ + * // take the projection to use from the map's view + * projection: view.getProjection() + * }); + * // listen to changes in position + * geolocation.on('change', function(evt) { + * window.console.log(geolocation.getPosition()); + * }); + * + * @fires module:ol/events/Event~BaseEvent#event:error + * @api + */ + + +var Geolocation = +/** @class */ +function (_super) { + __extends(Geolocation, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Geolocation(opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options || {}; + /** + * The unprojected (EPSG:4326) device position. + * @private + * @type {?import("./coordinate.js").Coordinate} + */ + + _this.position_ = null; + /** + * @private + * @type {import("./proj.js").TransformFunction} + */ + + _this.transform_ = _proj.identityTransform; + /** + * @private + * @type {number|undefined} + */ + + _this.watchId_ = undefined; + + _this.addEventListener((0, _Object.getChangeEventType)(Property.PROJECTION), _this.handleProjectionChanged_); + + _this.addEventListener((0, _Object.getChangeEventType)(Property.TRACKING), _this.handleTrackingChanged_); + + if (options.projection !== undefined) { + _this.setProjection(options.projection); + } + + if (options.trackingOptions !== undefined) { + _this.setTrackingOptions(options.trackingOptions); + } + + _this.setTracking(options.tracking !== undefined ? options.tracking : false); + + return _this; + } + /** + * Clean up. + */ + + + Geolocation.prototype.disposeInternal = function () { + this.setTracking(false); + + _super.prototype.disposeInternal.call(this); + }; + /** + * @private + */ + + + Geolocation.prototype.handleProjectionChanged_ = function () { + var projection = this.getProjection(); + + if (projection) { + this.transform_ = (0, _proj.getTransformFromProjections)((0, _proj.get)('EPSG:4326'), projection); + + if (this.position_) { + this.set(Property.POSITION, this.transform_(this.position_)); + } + } + }; + /** + * @private + */ + + + Geolocation.prototype.handleTrackingChanged_ = function () { + if ('geolocation' in navigator) { + var tracking = this.getTracking(); + + if (tracking && this.watchId_ === undefined) { + this.watchId_ = navigator.geolocation.watchPosition(this.positionChange_.bind(this), this.positionError_.bind(this), this.getTrackingOptions()); + } else if (!tracking && this.watchId_ !== undefined) { + navigator.geolocation.clearWatch(this.watchId_); + this.watchId_ = undefined; + } + } + }; + /** + * @private + * @param {Position} position position event. + */ + + + Geolocation.prototype.positionChange_ = function (position) { + var coords = position.coords; + this.set(Property.ACCURACY, coords.accuracy); + this.set(Property.ALTITUDE, coords.altitude === null ? undefined : coords.altitude); + this.set(Property.ALTITUDE_ACCURACY, coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy); + this.set(Property.HEADING, coords.heading === null ? undefined : (0, _math.toRadians)(coords.heading)); + + if (!this.position_) { + this.position_ = [coords.longitude, coords.latitude]; + } else { + this.position_[0] = coords.longitude; + this.position_[1] = coords.latitude; + } + + var projectedPosition = this.transform_(this.position_); + this.set(Property.POSITION, projectedPosition); + this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed); + var geometry = (0, _Polygon.circular)(this.position_, coords.accuracy); + geometry.applyTransform(this.transform_); + this.set(Property.ACCURACY_GEOMETRY, geometry); + this.changed(); + }; + /** + * @private + * @param {PositionError} error error object. + */ + + + Geolocation.prototype.positionError_ = function (error) { + this.dispatchEvent(new GeolocationError(error)); + }; + /** + * Get the accuracy of the position in meters. + * @return {number|undefined} The accuracy of the position measurement in + * meters. + * @observable + * @api + */ + + + Geolocation.prototype.getAccuracy = function () { + return ( + /** @type {number|undefined} */ + this.get(Property.ACCURACY) + ); + }; + /** + * Get a geometry of the position accuracy. + * @return {?import("./geom/Polygon.js").default} A geometry of the position accuracy. + * @observable + * @api + */ + + + Geolocation.prototype.getAccuracyGeometry = function () { + return ( + /** @type {?import("./geom/Polygon.js").default} */ + this.get(Property.ACCURACY_GEOMETRY) || null + ); + }; + /** + * Get the altitude associated with the position. + * @return {number|undefined} The altitude of the position in meters above mean + * sea level. + * @observable + * @api + */ + + + Geolocation.prototype.getAltitude = function () { + return ( + /** @type {number|undefined} */ + this.get(Property.ALTITUDE) + ); + }; + /** + * Get the altitude accuracy of the position. + * @return {number|undefined} The accuracy of the altitude measurement in + * meters. + * @observable + * @api + */ + + + Geolocation.prototype.getAltitudeAccuracy = function () { + return ( + /** @type {number|undefined} */ + this.get(Property.ALTITUDE_ACCURACY) + ); + }; + /** + * Get the heading as radians clockwise from North. + * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy` + * is set to `true` in the tracking options. + * @return {number|undefined} The heading of the device in radians from north. + * @observable + * @api + */ + + + Geolocation.prototype.getHeading = function () { + return ( + /** @type {number|undefined} */ + this.get(Property.HEADING) + ); + }; + /** + * Get the position of the device. + * @return {import("./coordinate.js").Coordinate|undefined} The current position of the device reported + * in the current projection. + * @observable + * @api + */ + + + Geolocation.prototype.getPosition = function () { + return ( + /** @type {import("./coordinate.js").Coordinate|undefined} */ + this.get(Property.POSITION) + ); + }; + /** + * Get the projection associated with the position. + * @return {import("./proj/Projection.js").default|undefined} The projection the position is + * reported in. + * @observable + * @api + */ + + + Geolocation.prototype.getProjection = function () { + return ( + /** @type {import("./proj/Projection.js").default|undefined} */ + this.get(Property.PROJECTION) + ); + }; + /** + * Get the speed in meters per second. + * @return {number|undefined} The instantaneous speed of the device in meters + * per second. + * @observable + * @api + */ + + + Geolocation.prototype.getSpeed = function () { + return ( + /** @type {number|undefined} */ + this.get(Property.SPEED) + ); + }; + /** + * Determine if the device location is being tracked. + * @return {boolean} The device location is being tracked. + * @observable + * @api + */ + + + Geolocation.prototype.getTracking = function () { + return ( + /** @type {boolean} */ + this.get(Property.TRACKING) + ); + }; + /** + * Get the tracking options. + * See http://www.w3.org/TR/geolocation-API/#position-options. + * @return {PositionOptions|undefined} PositionOptions as defined by + * the [HTML5 Geolocation spec + * ](http://www.w3.org/TR/geolocation-API/#position_options_interface). + * @observable + * @api + */ + + + Geolocation.prototype.getTrackingOptions = function () { + return ( + /** @type {PositionOptions|undefined} */ + this.get(Property.TRACKING_OPTIONS) + ); + }; + /** + * Set the projection to use for transforming the coordinates. + * @param {import("./proj.js").ProjectionLike} projection The projection the position is + * reported in. + * @observable + * @api + */ + + + Geolocation.prototype.setProjection = function (projection) { + this.set(Property.PROJECTION, (0, _proj.get)(projection)); + }; + /** + * Enable or disable tracking. + * @param {boolean} tracking Enable tracking. + * @observable + * @api + */ + + + Geolocation.prototype.setTracking = function (tracking) { + this.set(Property.TRACKING, tracking); + }; + /** + * Set the tracking options. + * See http://www.w3.org/TR/geolocation-API/#position-options. + * @param {PositionOptions} options PositionOptions as defined by the + * [HTML5 Geolocation spec + * ](http://www.w3.org/TR/geolocation-API/#position_options_interface). + * @observable + * @api + */ + + + Geolocation.prototype.setTrackingOptions = function (options) { + this.set(Property.TRACKING_OPTIONS, options); + }; + + return Geolocation; +}(_Object.default); + +var _default = Geolocation; +exports.default = _default; +},{"./events/Event.js":"../../../node_modules/ol/events/Event.js","./Object.js":"../../../node_modules/ol/Object.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js","./proj.js":"../../../node_modules/ol/proj.js","./math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/render/EventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/render/EventType + */ + +/** + * @enum {string} + */ +var _default = { + /** + * Triggered before a layer is rendered. + * @event module:ol/render/Event~RenderEvent#prerender + * @api + */ + PRERENDER: 'prerender', + + /** + * Triggered after a layer is rendered. + * @event module:ol/render/Event~RenderEvent#postrender + * @api + */ + POSTRENDER: 'postrender', + + /** + * Triggered before layers are rendered. + * The event object will not have a `context` set. + * @event module:ol/render/Event~RenderEvent#precompose + * @api + */ + PRECOMPOSE: 'precompose', + + /** + * Triggered after all layers are rendered. + * The event object will not have a `context` set. + * @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' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/style/Fill.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/style/Fill + */ + +/** + * @typedef {Object} Options + * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color=null] A color, gradient or pattern. + * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. + * Default null; if null, the Canvas/renderer default black will be used. + */ + +/** + * @classdesc + * Set fill style for vector features. + * @api + */ +var Fill = +/** @class */ +function () { + /** + * @param {Options=} opt_options Options. + */ + function Fill(opt_options) { + var options = opt_options || {}; + /** + * @private + * @type {import("../color.js").Color|import("../colorlike.js").ColorLike} + */ + + this.color_ = options.color !== undefined ? options.color : null; + } + /** + * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}. + * @return {Fill} The cloned style. + * @api + */ + + + Fill.prototype.clone = function () { + var color = this.getColor(); + return new Fill({ + color: Array.isArray(color) ? color.slice() : color || undefined + }); + }; + /** + * Get the fill color. + * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color. + * @api + */ + + + Fill.prototype.getColor = function () { + return this.color_; + }; + /** + * Set the color. + * + * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color. + * @api + */ + + + Fill.prototype.setColor = function (color) { + this.color_ = color; + }; + + return Fill; +}(); + +var _default = Fill; +exports.default = _default; +},{}],"../../../node_modules/ol/geom/flat/interpolate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.interpolatePoint = interpolatePoint; +exports.lineStringCoordinateAtM = lineStringCoordinateAtM; +exports.lineStringsCoordinateAtM = lineStringsCoordinateAtM; + +var _array = require("../../array.js"); + +var _math = require("../../math.js"); + +/** + * @module ol/geom/flat/interpolate + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} fraction Fraction. + * @param {Array<number>=} opt_dest Destination. + * @param {number=} opt_dimension Destination dimension (default is `2`) + * @return {Array<number>} Destination. + */ +function interpolatePoint(flatCoordinates, offset, end, stride, fraction, opt_dest, opt_dimension) { + var o, t; + var n = (end - offset) / stride; + + if (n === 1) { + o = offset; + } else if (n === 2) { + o = offset; + t = fraction; + } else if (n !== 0) { + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + var length_1 = 0; + var cumulativeLengths = [0]; + + for (var i = offset + stride; i < end; i += stride) { + var x2 = flatCoordinates[i]; + var y2 = flatCoordinates[i + 1]; + length_1 += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + cumulativeLengths.push(length_1); + x1 = x2; + y1 = y2; + } + + var target = fraction * length_1; + var index = (0, _array.binarySearch)(cumulativeLengths, target); + + if (index < 0) { + t = (target - cumulativeLengths[-index - 2]) / (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]); + o = offset + (-index - 2) * stride; + } else { + o = offset + index * stride; + } + } + + var dimension = opt_dimension > 1 ? opt_dimension : 2; + var dest = opt_dest ? opt_dest : new Array(dimension); + + for (var i = 0; i < dimension; ++i) { + dest[i] = o === undefined ? NaN : t === undefined ? flatCoordinates[o + i] : (0, _math.lerp)(flatCoordinates[o + i], flatCoordinates[o + stride + i], t); + } + + return dest; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} m M. + * @param {boolean} extrapolate Extrapolate. + * @return {import("../../coordinate.js").Coordinate} Coordinate. + */ + + +function lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, extrapolate) { + if (end == offset) { + return null; + } + + var coordinate; + + if (m < flatCoordinates[offset + stride - 1]) { + if (extrapolate) { + coordinate = flatCoordinates.slice(offset, offset + stride); + coordinate[stride - 1] = m; + return coordinate; + } else { + return null; + } + } else if (flatCoordinates[end - 1] < m) { + if (extrapolate) { + coordinate = flatCoordinates.slice(end - stride, end); + coordinate[stride - 1] = m; + return coordinate; + } else { + return null; + } + } // FIXME use O(1) search + + + if (m == flatCoordinates[offset + stride - 1]) { + return flatCoordinates.slice(offset, offset + stride); + } + + var lo = offset / stride; + var hi = end / stride; + + while (lo < hi) { + var mid = lo + hi >> 1; + + if (m < flatCoordinates[(mid + 1) * stride - 1]) { + hi = mid; + } else { + lo = mid + 1; + } + } + + var m0 = flatCoordinates[lo * stride - 1]; + + if (m == m0) { + return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride); + } + + var m1 = flatCoordinates[(lo + 1) * stride - 1]; + var t = (m - m0) / (m1 - m0); + coordinate = []; + + for (var i = 0; i < stride - 1; ++i) { + coordinate.push((0, _math.lerp)(flatCoordinates[(lo - 1) * stride + i], flatCoordinates[lo * stride + i], t)); + } + + coordinate.push(m); + return coordinate; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {number} m M. + * @param {boolean} extrapolate Extrapolate. + * @param {boolean} interpolate Interpolate. + * @return {import("../../coordinate.js").Coordinate} Coordinate. + */ + + +function lineStringsCoordinateAtM(flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) { + if (interpolate) { + return lineStringCoordinateAtM(flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate); + } + + var coordinate; + + if (m < flatCoordinates[stride - 1]) { + if (extrapolate) { + coordinate = flatCoordinates.slice(0, stride); + coordinate[stride - 1] = m; + return coordinate; + } else { + return null; + } + } + + if (flatCoordinates[flatCoordinates.length - 1] < m) { + if (extrapolate) { + coordinate = flatCoordinates.slice(flatCoordinates.length - stride); + coordinate[stride - 1] = m; + return coordinate; + } else { + return null; + } + } + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + + if (offset == end) { + continue; + } + + if (m < flatCoordinates[offset + stride - 1]) { + return null; + } else if (m <= flatCoordinates[end - 1]) { + return lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, false); + } + + offset = end; + } + + return null; +} +},{"../../array.js":"../../../node_modules/ol/array.js","../../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/geom/flat/length.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.lineStringLength = lineStringLength; +exports.linearRingLength = linearRingLength; + +/** + * @module ol/geom/flat/length + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {number} Length. + */ +function lineStringLength(flatCoordinates, offset, end, stride) { + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + var length = 0; + + for (var i = offset + stride; i < end; i += stride) { + var x2 = flatCoordinates[i]; + var y2 = flatCoordinates[i + 1]; + length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + x1 = x2; + y1 = y2; + } + + return length; +} +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {number} Perimeter. + */ + + +function linearRingLength(flatCoordinates, offset, end, stride) { + var perimeter = lineStringLength(flatCoordinates, offset, end, stride); + var dx = flatCoordinates[end - stride] - flatCoordinates[offset]; + var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1]; + perimeter += Math.sqrt(dx * dx + dy * dy); + return perimeter; +} +},{}],"../../../node_modules/ol/geom/LineString.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryLayout = _interopRequireDefault(require("./GeometryLayout.js")); + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _closest = require("./flat/closest.js"); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _simplify = require("./flat/simplify.js"); + +var _array = require("../array.js"); + +var _segments = require("./flat/segments.js"); + +var _inflate = require("./flat/inflate.js"); + +var _interpolate = require("./flat/interpolate.js"); + +var _intersectsextent = require("./flat/intersectsextent.js"); + +var _length = require("./flat/length.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/LineString + */ + + +/** + * @classdesc + * Linestring geometry. + * + * @api + */ +var LineString = +/** @class */ +function (_super) { + __extends(LineString, _super); + /** + * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` are also accepted. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + */ + + + function LineString(coordinates, opt_layout) { + var _this = _super.call(this) || this; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + + + _this.flatMidpoint_ = null; + /** + * @private + * @type {number} + */ + + _this.flatMidpointRevision_ = -1; + /** + * @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<number>} */ + coordinates); + } else { + _this.setCoordinates( + /** @type {Array<import("../coordinate.js").Coordinate>} */ + coordinates, opt_layout); + } + + return _this; + } + /** + * Append the passed coordinate to the coordinates of the linestring. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @api + */ + + + LineString.prototype.appendCoordinate = function (coordinate) { + if (!this.flatCoordinates) { + this.flatCoordinates = coordinate.slice(); + } else { + (0, _array.extend)(this.flatCoordinates, coordinate); + } + + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!LineString} Clone. + * @api + */ + + + LineString.prototype.clone = function () { + return new LineString(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. + */ + + + LineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < (0, _extent.closestSquaredDistanceXY)(this.getExtent(), x, y)) { + return minSquaredDistance; + } + + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt((0, _closest.maxSquaredDelta)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + + return (0, _closest.assignClosestPoint)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance); + }; + /** + * Iterate over each segment, calling the provided callback. + * If the callback returns a truthy value the function returns that + * value immediately. Otherwise the function returns `false`. + * + * @param {function(this: S, import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): T} callback Function + * called for each segment. The function will receive two arguments, the start and end coordinates of the segment. + * @return {T|boolean} Value. + * @template T,S + * @api + */ + + + LineString.prototype.forEachSegment = function (callback) { + return (0, _segments.forEach)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, callback); + }; + /** + * Returns the coordinate at `m` using linear interpolation, or `null` if no + * such coordinate exists. + * + * `opt_extrapolate` controls extrapolation beyond the range of Ms in the + * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first + * M will return the first coordinate and Ms greater than the last M will + * return the last coordinate. + * + * @param {number} m M. + * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`. + * @return {import("../coordinate.js").Coordinate} Coordinate. + * @api + */ + + + LineString.prototype.getCoordinateAtM = function (m, opt_extrapolate) { + if (this.layout != _GeometryLayout.default.XYM && this.layout != _GeometryLayout.default.XYZM) { + return null; + } + + var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false; + return (0, _interpolate.lineStringCoordinateAtM)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, m, extrapolate); + }; + /** + * Return the coordinates of the linestring. + * @return {Array<import("../coordinate.js").Coordinate>} Coordinates. + * @api + */ + + + LineString.prototype.getCoordinates = function () { + return (0, _inflate.inflateCoordinates)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the coordinate at the provided fraction along the linestring. + * The `fraction` is a number between 0 and 1, where 0 is the start of the + * linestring and 1 is the end. + * @param {number} fraction Fraction. + * @param {import("../coordinate.js").Coordinate=} opt_dest Optional coordinate whose values will + * be modified. If not provided, a new coordinate will be returned. + * @return {import("../coordinate.js").Coordinate} Coordinate of the interpolated point. + * @api + */ + + + LineString.prototype.getCoordinateAt = function (fraction, opt_dest) { + return (0, _interpolate.interpolatePoint)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, fraction, opt_dest, this.stride); + }; + /** + * Return the length of the linestring on projected plane. + * @return {number} Length (on projected plane). + * @api + */ + + + LineString.prototype.getLength = function () { + return (0, _length.lineStringLength)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * @return {Array<number>} Flat midpoint. + */ + + + LineString.prototype.getFlatMidpoint = function () { + if (this.flatMidpointRevision_ != this.getRevision()) { + this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_); + this.flatMidpointRevision_ = this.getRevision(); + } + + return this.flatMidpoint_; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {LineString} Simplified LineString. + * @protected + */ + + + LineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + simplifiedFlatCoordinates.length = (0, _simplify.douglasPeucker)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return new LineString(simplifiedFlatCoordinates, _GeometryLayout.default.XY); + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + LineString.prototype.getType = function () { + return _GeometryType.default.LINE_STRING; + }; + /** + * 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 + */ + + + LineString.prototype.intersectsExtent = function (extent) { + return (0, _intersectsextent.intersectsLineString)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent); + }; + /** + * Set the coordinates of the linestring. + * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @api + */ + + + LineString.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 1); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + + this.flatCoordinates.length = (0, _deflate.deflateCoordinates)(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + + return LineString; +}(_SimpleGeometry.default); + +var _default = LineString; +exports.default = _default; +},{"./GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","./flat/closest.js":"../../../node_modules/ol/geom/flat/closest.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","./flat/simplify.js":"../../../node_modules/ol/geom/flat/simplify.js","../array.js":"../../../node_modules/ol/array.js","./flat/segments.js":"../../../node_modules/ol/geom/flat/segments.js","./flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js","./flat/interpolate.js":"../../../node_modules/ol/geom/flat/interpolate.js","./flat/intersectsextent.js":"../../../node_modules/ol/geom/flat/intersectsextent.js","./flat/length.js":"../../../node_modules/ol/geom/flat/length.js"}],"../../../node_modules/ol/style/Stroke.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/style/Stroke + */ + +/** + * @typedef {Object} Options + * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color] A color, gradient or pattern. + * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. + * Default null; if null, the Canvas/renderer default black will be used. + * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`. + * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`. + * @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash). + * Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on + * the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers. + * @property {number} [lineDashOffset=0] Line dash offset. + * @property {number} [miterLimit=10] Miter limit. + * @property {number} [width] Width. + */ + +/** + * @classdesc + * Set stroke style for vector features. + * Note that the defaults given are the Canvas defaults, which will be used if + * option is not defined. The `get` functions return whatever was entered in + * the options; they will not return the default. + * @api + */ +var Stroke = +/** @class */ +function () { + /** + * @param {Options=} opt_options Options. + */ + function Stroke(opt_options) { + var options = opt_options || {}; + /** + * @private + * @type {import("../color.js").Color|import("../colorlike.js").ColorLike} + */ + + this.color_ = options.color !== undefined ? options.color : null; + /** + * @private + * @type {CanvasLineCap|undefined} + */ + + this.lineCap_ = options.lineCap; + /** + * @private + * @type {Array<number>} + */ + + this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null; + /** + * @private + * @type {number|undefined} + */ + + this.lineDashOffset_ = options.lineDashOffset; + /** + * @private + * @type {CanvasLineJoin|undefined} + */ + + this.lineJoin_ = options.lineJoin; + /** + * @private + * @type {number|undefined} + */ + + this.miterLimit_ = options.miterLimit; + /** + * @private + * @type {number|undefined} + */ + + this.width_ = options.width; + } + /** + * Clones the style. + * @return {Stroke} The cloned style. + * @api + */ + + + Stroke.prototype.clone = function () { + var color = this.getColor(); + return new Stroke({ + color: Array.isArray(color) ? color.slice() : color || undefined, + lineCap: this.getLineCap(), + lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined, + lineDashOffset: this.getLineDashOffset(), + lineJoin: this.getLineJoin(), + miterLimit: this.getMiterLimit(), + width: this.getWidth() + }); + }; + /** + * Get the stroke color. + * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color. + * @api + */ + + + Stroke.prototype.getColor = function () { + return this.color_; + }; + /** + * Get the line cap type for the stroke. + * @return {CanvasLineCap|undefined} Line cap. + * @api + */ + + + Stroke.prototype.getLineCap = function () { + return this.lineCap_; + }; + /** + * Get the line dash style for the stroke. + * @return {Array<number>} Line dash. + * @api + */ + + + Stroke.prototype.getLineDash = function () { + return this.lineDash_; + }; + /** + * Get the line dash offset for the stroke. + * @return {number|undefined} Line dash offset. + * @api + */ + + + Stroke.prototype.getLineDashOffset = function () { + return this.lineDashOffset_; + }; + /** + * Get the line join type for the stroke. + * @return {CanvasLineJoin|undefined} Line join. + * @api + */ + + + Stroke.prototype.getLineJoin = function () { + return this.lineJoin_; + }; + /** + * Get the miter limit for the stroke. + * @return {number|undefined} Miter limit. + * @api + */ + + + Stroke.prototype.getMiterLimit = function () { + return this.miterLimit_; + }; + /** + * Get the stroke width. + * @return {number|undefined} Width. + * @api + */ + + + Stroke.prototype.getWidth = function () { + return this.width_; + }; + /** + * Set the color. + * + * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color. + * @api + */ + + + Stroke.prototype.setColor = function (color) { + this.color_ = color; + }; + /** + * Set the line cap. + * + * @param {CanvasLineCap|undefined} lineCap Line cap. + * @api + */ + + + Stroke.prototype.setLineCap = function (lineCap) { + this.lineCap_ = lineCap; + }; + /** + * Set the line dash. + * + * Please note that Internet Explorer 10 and lower [do not support][mdn] the + * `setLineDash` method on the `CanvasRenderingContext2D` and therefore this + * property will have no visual effect in these browsers. + * + * [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility + * + * @param {Array<number>} lineDash Line dash. + * @api + */ + + + Stroke.prototype.setLineDash = function (lineDash) { + this.lineDash_ = lineDash; + }; + /** + * Set the line dash offset. + * + * @param {number|undefined} lineDashOffset Line dash offset. + * @api + */ + + + Stroke.prototype.setLineDashOffset = function (lineDashOffset) { + this.lineDashOffset_ = lineDashOffset; + }; + /** + * Set the line join. + * + * @param {CanvasLineJoin|undefined} lineJoin Line join. + * @api + */ + + + Stroke.prototype.setLineJoin = function (lineJoin) { + this.lineJoin_ = lineJoin; + }; + /** + * Set the miter limit. + * + * @param {number|undefined} miterLimit Miter limit. + * @api + */ + + + Stroke.prototype.setMiterLimit = function (miterLimit) { + this.miterLimit_ = miterLimit; + }; + /** + * Set the width. + * + * @param {number|undefined} width Width. + * @api + */ + + + Stroke.prototype.setWidth = function (width) { + this.width_ = width; + }; + + return Stroke; +}(); + +var _default = Stroke; +exports.default = _default; +},{}],"../../../node_modules/ol/ImageState.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/ImageState + */ + +/** + * @enum {number} + */ +var _default = { + IDLE: 0, + LOADING: 1, + LOADED: 2, + ERROR: 3, + EMPTY: 4 +}; +exports.default = _default; +},{}],"../../../node_modules/ol/size.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.buffer = buffer; +exports.hasArea = hasArea; +exports.scale = scale; +exports.toSize = toSize; + +/** + * @module ol/size + */ + +/** + * An array of numbers representing a size: `[width, height]`. + * @typedef {Array<number>} Size + * @api + */ + +/** + * Returns a buffered size. + * @param {Size} size Size. + * @param {number} num The amount by which to buffer. + * @param {Size=} opt_size Optional reusable size array. + * @return {Size} The buffered size. + */ +function buffer(size, num, opt_size) { + if (opt_size === undefined) { + opt_size = [0, 0]; + } + + opt_size[0] = size[0] + 2 * num; + opt_size[1] = size[1] + 2 * num; + return opt_size; +} +/** + * Determines if a size has a positive area. + * @param {Size} size The size to test. + * @return {boolean} The size has a positive area. + */ + + +function hasArea(size) { + return size[0] > 0 && size[1] > 0; +} +/** + * Returns a size scaled by a ratio. The result will be an array of integers. + * @param {Size} size Size. + * @param {number} ratio Ratio. + * @param {Size=} opt_size Optional reusable size array. + * @return {Size} The scaled size. + */ + + +function scale(size, ratio, opt_size) { + if (opt_size === undefined) { + opt_size = [0, 0]; + } + + opt_size[0] = size[0] * ratio + 0.5 | 0; + opt_size[1] = size[1] * ratio + 0.5 | 0; + return opt_size; +} +/** + * Returns an `Size` array for the passed in number (meaning: square) or + * `Size` array. + * (meaning: non-square), + * @param {number|Size} size Width and height. + * @param {Size=} opt_size Optional reusable size array. + * @return {Size} Size. + * @api + */ + + +function toSize(size, opt_size) { + if (Array.isArray(size)) { + return size; + } else { + if (opt_size === undefined) { + opt_size = [size, size]; + } else { + opt_size[0] = size; + opt_size[1] = size; + } + + return opt_size; + } +} +},{}],"../../../node_modules/ol/style/Image.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _util = require("../util.js"); + +var _size = require("../size.js"); + +/** + * @module ol/style/Image + */ + +/** + * @typedef {Object} Options + * @property {number} opacity + * @property {boolean} rotateWithView + * @property {number} rotation + * @property {number|import("../size.js").Size} scale + * @property {Array<number>} displacement + */ + +/** + * @classdesc + * A base class used for creating subclasses and not instantiated in + * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and + * {@link module:ol/style/RegularShape~RegularShape}. + * @abstract + * @api + */ +var ImageStyle = +/** @class */ +function () { + /** + * @param {Options} options Options. + */ + function ImageStyle(options) { + /** + * @private + * @type {number} + */ + this.opacity_ = options.opacity; + /** + * @private + * @type {boolean} + */ + + this.rotateWithView_ = options.rotateWithView; + /** + * @private + * @type {number} + */ + + this.rotation_ = options.rotation; + /** + * @private + * @type {number|import("../size.js").Size} + */ + + this.scale_ = options.scale; + /** + * @private + * @type {import("../size.js").Size} + */ + + this.scaleArray_ = (0, _size.toSize)(options.scale); + /** + * @private + * @type {Array<number>} + */ + + this.displacement_ = options.displacement; + } + /** + * Clones the style. + * @return {ImageStyle} The cloned style. + * @api + */ + + + ImageStyle.prototype.clone = function () { + var scale = this.getScale(); + return new ImageStyle({ + opacity: this.getOpacity(), + scale: Array.isArray(scale) ? scale.slice() : scale, + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView(), + displacement: this.getDisplacement().slice() + }); + }; + /** + * Get the symbolizer opacity. + * @return {number} Opacity. + * @api + */ + + + ImageStyle.prototype.getOpacity = function () { + return this.opacity_; + }; + /** + * Determine whether the symbolizer rotates with the map. + * @return {boolean} Rotate with map. + * @api + */ + + + ImageStyle.prototype.getRotateWithView = function () { + return this.rotateWithView_; + }; + /** + * Get the symoblizer rotation. + * @return {number} Rotation. + * @api + */ + + + ImageStyle.prototype.getRotation = function () { + return this.rotation_; + }; + /** + * Get the symbolizer scale. + * @return {number|import("../size.js").Size} Scale. + * @api + */ + + + ImageStyle.prototype.getScale = function () { + return this.scale_; + }; + /** + * Get the symbolizer scale array. + * @return {import("../size.js").Size} Scale array. + */ + + + ImageStyle.prototype.getScaleArray = function () { + return this.scaleArray_; + }; + /** + * Get the displacement of the shape + * @return {Array<number>} Shape's center displacement + * @api + */ + + + ImageStyle.prototype.getDisplacement = function () { + return this.displacement_; + }; + /** + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @abstract + * @return {Array<number>} Anchor. + */ + + + ImageStyle.prototype.getAnchor = function () { + return (0, _util.abstract)(); + }; + /** + * Get the image element for the symbolizer. + * @abstract + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element. + */ + + + ImageStyle.prototype.getImage = function (pixelRatio) { + return (0, _util.abstract)(); + }; + /** + * @abstract + * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element. + */ + + + ImageStyle.prototype.getHitDetectionImage = function () { + return (0, _util.abstract)(); + }; + /* + * Get the image pixel ratio. + * @param {number} pixelRatio Pixel ratio. + * */ + + + ImageStyle.prototype.getPixelRatio = function (pixelRatio) { + return 1; + }; + /** + * @abstract + * @return {import("../ImageState.js").default} Image state. + */ + + + ImageStyle.prototype.getImageState = function () { + return (0, _util.abstract)(); + }; + /** + * @abstract + * @return {import("../size.js").Size} Image size. + */ + + + ImageStyle.prototype.getImageSize = function () { + return (0, _util.abstract)(); + }; + /** + * @abstract + * @return {import("../size.js").Size} Size of the hit-detection image. + */ + + + ImageStyle.prototype.getHitDetectionImageSize = function () { + return (0, _util.abstract)(); + }; + /** + * Get the origin of the symbolizer. + * @abstract + * @return {Array<number>} Origin. + */ + + + ImageStyle.prototype.getOrigin = function () { + return (0, _util.abstract)(); + }; + /** + * Get the size of the symbolizer (in pixels). + * @abstract + * @return {import("../size.js").Size} Size. + */ + + + ImageStyle.prototype.getSize = function () { + return (0, _util.abstract)(); + }; + /** + * Set the opacity. + * + * @param {number} opacity Opacity. + * @api + */ + + + ImageStyle.prototype.setOpacity = function (opacity) { + this.opacity_ = opacity; + }; + /** + * Set whether to rotate the style with the view. + * + * @param {boolean} rotateWithView Rotate with map. + * @api + */ + + + ImageStyle.prototype.setRotateWithView = function (rotateWithView) { + this.rotateWithView_ = rotateWithView; + }; + /** + * Set the rotation. + * + * @param {number} rotation Rotation. + * @api + */ + + + ImageStyle.prototype.setRotation = function (rotation) { + this.rotation_ = rotation; + }; + /** + * Set the scale. + * + * @param {number|import("../size.js").Size} scale Scale. + * @api + */ + + + ImageStyle.prototype.setScale = function (scale) { + this.scale_ = scale; + this.scaleArray_ = (0, _size.toSize)(scale); + }; + /** + * @abstract + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + + + ImageStyle.prototype.listenImageChange = function (listener) { + (0, _util.abstract)(); + }; + /** + * Load not yet loaded URI. + * @abstract + */ + + + ImageStyle.prototype.load = function () { + (0, _util.abstract)(); + }; + /** + * @abstract + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + + + ImageStyle.prototype.unlistenImageChange = function (listener) { + (0, _util.abstract)(); + }; + + return ImageStyle; +}(); + +var _default = ImageStyle; +exports.default = _default; +},{"../util.js":"../../../node_modules/ol/util.js","../size.js":"../../../node_modules/ol/size.js"}],"../../../node_modules/ol/color.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.asString = asString; +exports.asArray = asArray; +exports.normalize = normalize; +exports.toString = toString; +exports.isStringColor = isStringColor; +exports.fromString = void 0; + +var _asserts = require("./asserts.js"); + +var _math = require("./math.js"); + +/** + * @module ol/color + */ + +/** + * A color represented as a short array [red, green, blue, alpha]. + * red, green, and blue should be integers in the range 0..255 inclusive. + * alpha should be a float in the range 0..1 inclusive. If no alpha value is + * given then `1` will be used. + * @typedef {Array<number>} Color + * @api + */ + +/** + * This RegExp matches # followed by 3, 4, 6, or 8 hex digits. + * @const + * @type {RegExp} + * @private + */ +var HEX_COLOR_RE_ = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i; +/** + * Regular expression for matching potential named color style strings. + * @const + * @type {RegExp} + * @private + */ + +var NAMED_COLOR_RE_ = /^([a-z]*)$|^hsla?\(.*\)$/i; +/** + * Return the color as an rgba string. + * @param {Color|string} color Color. + * @return {string} Rgba string. + * @api + */ + +function asString(color) { + if (typeof color === 'string') { + return color; + } else { + return toString(color); + } +} +/** + * Return named color as an rgba string. + * @param {string} color Named color. + * @return {string} Rgb string. + */ + + +function fromNamed(color) { + var el = document.createElement('div'); + el.style.color = color; + + if (el.style.color !== '') { + document.body.appendChild(el); + var rgb = getComputedStyle(el).color; + document.body.removeChild(el); + return rgb; + } else { + return ''; + } +} +/** + * @param {string} s String. + * @return {Color} Color. + */ + + +var fromString = function () { + // We maintain a small cache of parsed strings. To provide cheap LRU-like + // semantics, whenever the cache grows too large we simply delete an + // arbitrary 25% of the entries. + + /** + * @const + * @type {number} + */ + var MAX_CACHE_SIZE = 1024; + /** + * @type {Object<string, Color>} + */ + + var cache = {}; + /** + * @type {number} + */ + + var cacheSize = 0; + return ( + /** + * @param {string} s String. + * @return {Color} Color. + */ + function (s) { + var color; + + if (cache.hasOwnProperty(s)) { + color = cache[s]; + } else { + if (cacheSize >= MAX_CACHE_SIZE) { + var i = 0; + + for (var key in cache) { + if ((i++ & 3) === 0) { + delete cache[key]; + --cacheSize; + } + } + } + + color = fromStringInternal_(s); + cache[s] = color; + ++cacheSize; + } + + return color; + } + ); +}(); +/** + * Return the color as an array. This function maintains a cache of calculated + * arrays which means the result should not be modified. + * @param {Color|string} color Color. + * @return {Color} Color. + * @api + */ + + +exports.fromString = fromString; + +function asArray(color) { + if (Array.isArray(color)) { + return color; + } else { + return fromString(color); + } +} +/** + * @param {string} s String. + * @private + * @return {Color} Color. + */ + + +function fromStringInternal_(s) { + var r, g, b, a, color; + + if (NAMED_COLOR_RE_.exec(s)) { + s = fromNamed(s); + } + + if (HEX_COLOR_RE_.exec(s)) { + // hex + var n = s.length - 1; // number of hex digits + + var d = // number of digits per channel + void 0; // number of digits per channel + + if (n <= 4) { + d = 1; + } else { + d = 2; + } + + var hasAlpha = n === 4 || n === 8; + r = parseInt(s.substr(1 + 0 * d, d), 16); + g = parseInt(s.substr(1 + 1 * d, d), 16); + b = parseInt(s.substr(1 + 2 * d, d), 16); + + if (hasAlpha) { + a = parseInt(s.substr(1 + 3 * d, d), 16); + } else { + a = 255; + } + + if (d == 1) { + r = (r << 4) + r; + g = (g << 4) + g; + b = (b << 4) + b; + + if (hasAlpha) { + a = (a << 4) + a; + } + } + + color = [r, g, b, a / 255]; + } else if (s.indexOf('rgba(') == 0) { + // rgba() + color = s.slice(5, -1).split(',').map(Number); + normalize(color); + } else if (s.indexOf('rgb(') == 0) { + // rgb() + color = s.slice(4, -1).split(',').map(Number); + color.push(1); + normalize(color); + } else { + (0, _asserts.assert)(false, 14); // Invalid color + } + + return color; +} +/** + * TODO this function is only used in the test, we probably shouldn't export it + * @param {Color} color Color. + * @return {Color} Clamped color. + */ + + +function normalize(color) { + color[0] = (0, _math.clamp)(color[0] + 0.5 | 0, 0, 255); + color[1] = (0, _math.clamp)(color[1] + 0.5 | 0, 0, 255); + color[2] = (0, _math.clamp)(color[2] + 0.5 | 0, 0, 255); + color[3] = (0, _math.clamp)(color[3], 0, 1); + return color; +} +/** + * @param {Color} color Color. + * @return {string} String. + */ + + +function toString(color) { + var r = color[0]; + + if (r != (r | 0)) { + r = r + 0.5 | 0; + } + + var g = color[1]; + + if (g != (g | 0)) { + g = g + 0.5 | 0; + } + + var b = color[2]; + + if (b != (b | 0)) { + b = b + 0.5 | 0; + } + + var a = color[3] === undefined ? 1 : color[3]; + return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; +} +/** + * @param {string} s String. + * @return {boolean} Whether the string is actually a valid color + */ + + +function isStringColor(s) { + if (NAMED_COLOR_RE_.test(s)) { + s = fromNamed(s); + } + + return HEX_COLOR_RE_.test(s) || s.indexOf('rgba(') === 0 || s.indexOf('rgb(') === 0; +} +},{"./asserts.js":"../../../node_modules/ol/asserts.js","./math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/colorlike.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.asColorLike = asColorLike; + +var _color = require("./color.js"); + +/** + * @module ol/colorlike + */ + +/** + * A type accepted by CanvasRenderingContext2D.fillStyle + * or CanvasRenderingContext2D.strokeStyle. + * Represents a color, pattern, or gradient. The origin for patterns and + * gradients as fill style is an increment of 512 css pixels from map coordinate + * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image + * must be a factor of two (2, 4, 8, ..., 512). + * + * @typedef {string|CanvasPattern|CanvasGradient} ColorLike + * @api + */ + +/** + * @param {import("./color.js").Color|ColorLike} color Color. + * @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}. + * @api + */ +function asColorLike(color) { + if (Array.isArray(color)) { + return (0, _color.toString)(color); + } else { + return color; + } +} +},{"./color.js":"../../../node_modules/ol/color.js"}],"../../../node_modules/ol/has.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PASSIVE_EVENT_LISTENERS = exports.IMAGE_DECODE = exports.WORKER_OFFSCREEN_CANVAS = exports.DEVICE_PIXEL_RATIO = exports.MAC = exports.WEBKIT = exports.SAFARI = exports.FIREFOX = void 0; + +/** + * @module ol/has + */ +var ua = typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined' ? navigator.userAgent.toLowerCase() : ''; +/** + * User agent string says we are dealing with Firefox as browser. + * @type {boolean} + */ + +var FIREFOX = ua.indexOf('firefox') !== -1; +/** + * User agent string says we are dealing with Safari as browser. + * @type {boolean} + */ + +exports.FIREFOX = FIREFOX; +var SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1; +/** + * User agent string says we are dealing with a WebKit engine. + * @type {boolean} + */ + +exports.SAFARI = SAFARI; +var WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1; +/** + * User agent string says we are dealing with a Mac as platform. + * @type {boolean} + */ + +exports.WEBKIT = WEBKIT; +var MAC = ua.indexOf('macintosh') !== -1; +/** + * The ratio between physical pixels and device-independent pixels + * (dips) on the device (`window.devicePixelRatio`). + * @const + * @type {number} + * @api + */ + +exports.MAC = MAC; +var DEVICE_PIXEL_RATIO = typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1; +/** + * The execution context is a worker with OffscreenCanvas available. + * @const + * @type {boolean} + */ + +exports.DEVICE_PIXEL_RATIO = DEVICE_PIXEL_RATIO; +var WORKER_OFFSCREEN_CANVAS = typeof WorkerGlobalScope !== 'undefined' && typeof OffscreenCanvas !== 'undefined' && self instanceof WorkerGlobalScope; //eslint-disable-line + +/** + * Image.prototype.decode() is supported. + * @type {boolean} + */ + +exports.WORKER_OFFSCREEN_CANVAS = WORKER_OFFSCREEN_CANVAS; +var IMAGE_DECODE = typeof Image !== 'undefined' && Image.prototype.decode; +/** + * @type {boolean} + */ + +exports.IMAGE_DECODE = IMAGE_DECODE; + +var PASSIVE_EVENT_LISTENERS = function () { + var passive = false; + + try { + var options = Object.defineProperty({}, 'passive', { + get: function () { + passive = true; + } + }); + window.addEventListener('_', null, options); + window.removeEventListener('_', null, options); + } catch (error) {// passive not supported + } + + return passive; +}(); + +exports.PASSIVE_EVENT_LISTENERS = PASSIVE_EVENT_LISTENERS; +},{}],"../../../node_modules/ol/dom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createCanvasContext2D = createCanvasContext2D; +exports.outerWidth = outerWidth; +exports.outerHeight = outerHeight; +exports.replaceNode = replaceNode; +exports.removeNode = removeNode; +exports.removeChildren = removeChildren; +exports.replaceChildren = replaceChildren; + +var _has = require("./has.js"); + +/** + * @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<HTMLCanvasElement>=} opt_canvasPool Canvas pool to take existing canvas from. + * @return {CanvasRenderingContext2D} The context. + */ +function createCanvasContext2D(opt_width, opt_height, opt_canvasPool) { + var canvas = opt_canvasPool && opt_canvasPool.length ? opt_canvasPool.shift() : _has.WORKER_OFFSCREEN_CANVAS ? new OffscreenCanvas(opt_width || 300, opt_height || 300) : 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') + ); +} +/** + * 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. + * @returns {Node} 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<Node>} 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); + } +} +},{"./has.js":"../../../node_modules/ol/has.js"}],"../../../node_modules/ol/css.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getFontParameters = exports.CLASS_COLLAPSED = exports.CLASS_CONTROL = exports.CLASS_UNSUPPORTED = exports.CLASS_UNSELECTABLE = exports.CLASS_SELECTABLE = exports.CLASS_HIDDEN = void 0; + +/** + * @module ol/css + */ + +/** + * @typedef {Object} FontParameters + * @property {string} style + * @property {string} variant + * @property {string} weight + * @property {string} size + * @property {string} lineHeight + * @property {string} family + * @property {Array<string>} families + */ + +/** + * The CSS class for hidden feature. + * + * @const + * @type {string} + */ +var CLASS_HIDDEN = 'ol-hidden'; +/** + * The CSS class that we'll give the DOM elements to have them selectable. + * + * @const + * @type {string} + */ + +exports.CLASS_HIDDEN = CLASS_HIDDEN; +var CLASS_SELECTABLE = 'ol-selectable'; +/** + * The CSS class that we'll give the DOM elements to have them unselectable. + * + * @const + * @type {string} + */ + +exports.CLASS_SELECTABLE = CLASS_SELECTABLE; +var CLASS_UNSELECTABLE = 'ol-unselectable'; +/** + * The CSS class for unsupported feature. + * + * @const + * @type {string} + */ + +exports.CLASS_UNSELECTABLE = CLASS_UNSELECTABLE; +var CLASS_UNSUPPORTED = 'ol-unsupported'; +/** + * The CSS class for controls. + * + * @const + * @type {string} + */ + +exports.CLASS_UNSUPPORTED = CLASS_UNSUPPORTED; +var CLASS_CONTROL = 'ol-control'; +/** + * The CSS class that we'll give the DOM elements that are collapsed, i.e. + * to those elements which usually can be expanded. + * + * @const + * @type {string} + */ + +exports.CLASS_CONTROL = CLASS_CONTROL; +var CLASS_COLLAPSED = 'ol-collapsed'; +/** + * From http://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font + * @type {RegExp} + */ + +exports.CLASS_COLLAPSED = CLASS_COLLAPSED; +var fontRegEx = new RegExp(['^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)', '(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)', '(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)', '(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?', '(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))', '(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))', '?\\s*([-,\\"\\\'\\sa-z]+?)\\s*$'].join(''), 'i'); +var fontRegExMatchIndex = ['style', 'variant', 'weight', 'size', 'lineHeight', 'family']; +/** + * Get the list of font families from a font spec. Note that this doesn't work + * for font families that have commas in them. + * @param {string} fontSpec The CSS font property. + * @return {FontParameters} The font parameters (or null if the input spec is invalid). + */ + +var getFontParameters = function (fontSpec) { + var match = fontSpec.match(fontRegEx); + + if (!match) { + return null; + } + + var style = + /** @type {FontParameters} */ + { + lineHeight: 'normal', + size: '1.2em', + style: 'normal', + weight: 'normal', + variant: 'normal' + }; + + for (var i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) { + var value = match[i + 1]; + + if (value !== undefined) { + style[fontRegExMatchIndex[i]] = value; + } + } + + style.families = style.family.split(/,\s?/); + return style; +}; + +exports.getFontParameters = getFontParameters; +},{}],"../../../node_modules/ol/render/canvas.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.measureTextWidth = measureTextWidth; +exports.measureAndCacheTextWidth = measureAndCacheTextWidth; +exports.measureTextWidths = measureTextWidths; +exports.rotateAtOffset = rotateAtOffset; +exports.drawImageOrLabel = drawImageOrLabel; +exports.createTransformString = createTransformString; +exports.measureTextHeight = exports.registerFont = exports.textHeights = exports.labelCache = exports.checkedFonts = exports.defaultLineWidth = exports.defaultPadding = exports.defaultTextBaseline = exports.defaultTextAlign = exports.defaultStrokeStyle = exports.defaultMiterLimit = exports.defaultLineJoin = exports.defaultLineDashOffset = exports.defaultLineDash = exports.defaultLineCap = exports.defaultFillStyle = exports.defaultFont = void 0; + +var _Object = _interopRequireDefault(require("../Object.js")); + +var _Target = _interopRequireDefault(require("../events/Target.js")); + +var _has = require("../has.js"); + +var _obj = require("../obj.js"); + +var _dom = require("../dom.js"); + +var _css = require("../css.js"); + +var _transform = require("../transform.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/canvas + */ + +/** + * @typedef {Object} FillState + * @property {import("../colorlike.js").ColorLike} fillStyle + */ + +/** + * @typedef Label + * @property {number} width + * @property {number} height + * @property {Array<string|number>} contextInstructions + */ + +/** + * @typedef {Object} FillStrokeState + * @property {import("../colorlike.js").ColorLike} [currentFillStyle] + * @property {import("../colorlike.js").ColorLike} [currentStrokeStyle] + * @property {CanvasLineCap} [currentLineCap] + * @property {Array<number>} currentLineDash + * @property {number} [currentLineDashOffset] + * @property {CanvasLineJoin} [currentLineJoin] + * @property {number} [currentLineWidth] + * @property {number} [currentMiterLimit] + * @property {number} [lastStroke] + * @property {import("../colorlike.js").ColorLike} [fillStyle] + * @property {import("../colorlike.js").ColorLike} [strokeStyle] + * @property {CanvasLineCap} [lineCap] + * @property {Array<number>} lineDash + * @property {number} [lineDashOffset] + * @property {CanvasLineJoin} [lineJoin] + * @property {number} [lineWidth] + * @property {number} [miterLimit] + */ + +/** + * @typedef {Object} StrokeState + * @property {CanvasLineCap} lineCap + * @property {Array<number>} lineDash + * @property {number} lineDashOffset + * @property {CanvasLineJoin} lineJoin + * @property {number} lineWidth + * @property {number} miterLimit + * @property {import("../colorlike.js").ColorLike} strokeStyle + */ + +/** + * @typedef {Object} TextState + * @property {string} font + * @property {string} [textAlign] + * @property {string} textBaseline + * @property {string} [placement] + * @property {number} [maxAngle] + * @property {boolean} [overflow] + * @property {import("../style/Fill.js").default} [backgroundFill] + * @property {import("../style/Stroke.js").default} [backgroundStroke] + * @property {import("../size.js").Size} [scale] + * @property {Array<number>} [padding] + */ + +/** + * Container for decluttered replay instructions that need to be rendered or + * omitted together, i.e. when styles render both an image and text, or for the + * characters that form text along lines. The basic elements of this array are + * `[minX, minY, maxX, maxY, count]`, where the first four entries are the + * rendered extent of the group in pixel space. `count` is the number of styles + * in the group, i.e. 2 when an image and a text are grouped, or 1 otherwise. + * In addition to these four elements, declutter instruction arrays (i.e. the + * arguments to {@link module:ol/render/canvas~drawImage} are appended to the array. + * @typedef {Array<*>} DeclutterGroup + */ + +/** + * Declutter groups for support of multi geometries. + * @typedef {Array<DeclutterGroup>} DeclutterGroups + */ + +/** + * @const + * @type {string} + */ +var defaultFont = '10px sans-serif'; +/** + * @const + * @type {import("../colorlike.js").ColorLike} + */ + +exports.defaultFont = defaultFont; +var defaultFillStyle = '#000'; +/** + * @const + * @type {CanvasLineCap} + */ + +exports.defaultFillStyle = defaultFillStyle; +var defaultLineCap = 'round'; +/** + * @const + * @type {Array<number>} + */ + +exports.defaultLineCap = defaultLineCap; +var defaultLineDash = []; +/** + * @const + * @type {number} + */ + +exports.defaultLineDash = defaultLineDash; +var defaultLineDashOffset = 0; +/** + * @const + * @type {CanvasLineJoin} + */ + +exports.defaultLineDashOffset = defaultLineDashOffset; +var defaultLineJoin = 'round'; +/** + * @const + * @type {number} + */ + +exports.defaultLineJoin = defaultLineJoin; +var defaultMiterLimit = 10; +/** + * @const + * @type {import("../colorlike.js").ColorLike} + */ + +exports.defaultMiterLimit = defaultMiterLimit; +var defaultStrokeStyle = '#000'; +/** + * @const + * @type {string} + */ + +exports.defaultStrokeStyle = defaultStrokeStyle; +var defaultTextAlign = 'center'; +/** + * @const + * @type {string} + */ + +exports.defaultTextAlign = defaultTextAlign; +var defaultTextBaseline = 'middle'; +/** + * @const + * @type {Array<number>} + */ + +exports.defaultTextBaseline = defaultTextBaseline; +var defaultPadding = [0, 0, 0, 0]; +/** + * @const + * @type {number} + */ + +exports.defaultPadding = defaultPadding; +var defaultLineWidth = 1; +/** + * @type {BaseObject} + */ + +exports.defaultLineWidth = defaultLineWidth; +var checkedFonts = new _Object.default(); +/** + * The label cache for text rendering. To change the default cache size of 2048 + * entries, use {@link module:ol/structs/LRUCache#setSize}. + * Deprecated - there is no label cache any more. + * @type {?} + * @api + * @deprecated + */ + +exports.checkedFonts = checkedFonts; +var labelCache = new _Target.default(); +exports.labelCache = labelCache; + +labelCache.setSize = function () { + console.warn('labelCache is deprecated.'); //eslint-disable-line +}; +/** + * @type {CanvasRenderingContext2D} + */ + + +var measureContext = null; +/** + * @type {string} + */ + +var measureFont; +/** + * @type {!Object<string, number>} + */ + +var textHeights = {}; +/** + * Clears the label cache when a font becomes available. + * @param {string} fontSpec CSS font spec. + */ + +exports.textHeights = textHeights; + +var registerFont = function () { + var retries = 100; + var size = '32px '; + var referenceFonts = ['monospace', 'serif']; + var len = referenceFonts.length; + var text = 'wmytzilWMYTZIL@#/&?$%10\uF013'; + var interval, referenceWidth; + /** + * @param {string} fontStyle Css font-style + * @param {string} fontWeight Css font-weight + * @param {*} fontFamily Css font-family + * @return {boolean} Font with style and weight is available + */ + + function isAvailable(fontStyle, fontWeight, fontFamily) { + var available = true; + + for (var i = 0; i < len; ++i) { + var referenceFont = referenceFonts[i]; + referenceWidth = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + referenceFont, text); + + if (fontFamily != referenceFont) { + var width = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + fontFamily + ',' + referenceFont, text); // If width and referenceWidth are the same, then the fallback was used + // instead of the font we wanted, so the font is not available. + + available = available && width != referenceWidth; + } + } + + if (available) { + return true; + } + + return false; + } + + function check() { + var done = true; + var fonts = checkedFonts.getKeys(); + + for (var i = 0, ii = fonts.length; i < ii; ++i) { + var font = fonts[i]; + + if (checkedFonts.get(font) < retries) { + if (isAvailable.apply(this, font.split('\n'))) { + (0, _obj.clear)(textHeights); // Make sure that loaded fonts are picked up by Safari + + measureContext = null; + measureFont = undefined; + checkedFonts.set(font, retries); + } else { + checkedFonts.set(font, checkedFonts.get(font) + 1, true); + done = false; + } + } + } + + if (done) { + clearInterval(interval); + interval = undefined; + } + } + + return function (fontSpec) { + var font = (0, _css.getFontParameters)(fontSpec); + + if (!font) { + return; + } + + var families = font.families; + + for (var i = 0, ii = families.length; i < ii; ++i) { + var family = families[i]; + var key = font.style + '\n' + font.weight + '\n' + family; + + if (checkedFonts.get(key) === undefined) { + checkedFonts.set(key, retries, true); + + if (!isAvailable(font.style, font.weight, family)) { + checkedFonts.set(key, 0, true); + + if (interval === undefined) { + interval = setInterval(check, 32); + } + } + } + } + }; +}(); +/** + * @param {string} font Font to use for measuring. + * @return {import("../size.js").Size} Measurement. + */ + + +exports.registerFont = registerFont; + +var measureTextHeight = function () { + /** + * @type {HTMLDivElement} + */ + var div; + var heights = textHeights; + return function (fontSpec) { + var height = heights[fontSpec]; + + if (height == undefined) { + if (_has.WORKER_OFFSCREEN_CANVAS) { + var font = (0, _css.getFontParameters)(fontSpec); + var metrics = measureText(fontSpec, 'Žg'); + var lineHeight = isNaN(Number(font.lineHeight)) ? 1.2 : Number(font.lineHeight); + textHeights[fontSpec] = lineHeight * (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent); + } else { + if (!div) { + div = document.createElement('div'); + div.innerHTML = 'M'; + div.style.margin = '0 !important'; + div.style.padding = '0 !important'; + div.style.position = 'absolute !important'; + div.style.left = '-99999px !important'; + } + + div.style.font = fontSpec; + document.body.appendChild(div); + height = div.offsetHeight; + heights[fontSpec] = height; + document.body.removeChild(div); + } + } + + return height; + }; +}(); +/** + * @param {string} font Font. + * @param {string} text Text. + * @return {TextMetrics} Text metrics. + */ + + +exports.measureTextHeight = measureTextHeight; + +function measureText(font, text) { + if (!measureContext) { + measureContext = (0, _dom.createCanvasContext2D)(1, 1); + } + + if (font != measureFont) { + measureContext.font = font; + measureFont = measureContext.font; + } + + return measureContext.measureText(text); +} +/** + * @param {string} font Font. + * @param {string} text Text. + * @return {number} Width. + */ + + +function measureTextWidth(font, text) { + return measureText(font, text).width; +} +/** + * Measure text width using a cache. + * @param {string} font The font. + * @param {string} text The text to measure. + * @param {Object<string, number>} cache A lookup of cached widths by text. + * @returns {number} The text width. + */ + + +function measureAndCacheTextWidth(font, text, cache) { + if (text in cache) { + return cache[text]; + } + + var width = measureTextWidth(font, text); + cache[text] = width; + return width; +} +/** + * @param {string} font Font to use for measuring. + * @param {Array<string>} lines Lines to measure. + * @param {Array<number>} widths Array will be populated with the widths of + * each line. + * @return {number} Width of the whole text. + */ + + +function measureTextWidths(font, lines, widths) { + var numLines = lines.length; + var width = 0; + + for (var i = 0; i < numLines; ++i) { + var currentWidth = measureTextWidth(font, lines[i]); + width = Math.max(width, currentWidth); + widths.push(currentWidth); + } + + return width; +} +/** + * @param {CanvasRenderingContext2D} context Context. + * @param {number} rotation Rotation. + * @param {number} offsetX X offset. + * @param {number} offsetY Y offset. + */ + + +function rotateAtOffset(context, rotation, offsetX, offsetY) { + if (rotation !== 0) { + context.translate(offsetX, offsetY); + context.rotate(rotation); + context.translate(-offsetX, -offsetY); + } +} +/** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../transform.js").Transform|null} transform Transform. + * @param {number} opacity Opacity. + * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label. + * @param {number} originX Origin X. + * @param {number} originY Origin Y. + * @param {number} w Width. + * @param {number} h Height. + * @param {number} x X. + * @param {number} y Y. + * @param {import("../size.js").Size} scale Scale. + */ + + +function drawImageOrLabel(context, transform, opacity, labelOrImage, originX, originY, w, h, x, y, scale) { + context.save(); + + if (opacity !== 1) { + context.globalAlpha *= opacity; + } + + if (transform) { + context.setTransform.apply(context, transform); + } + + if ( + /** @type {*} */ + labelOrImage.contextInstructions) { + // label + context.translate(x, y); + context.scale(scale[0], scale[1]); + executeLabelInstructions( + /** @type {Label} */ + labelOrImage, context); + } else if (scale[0] < 0 || scale[1] < 0) { + // flipped image + context.translate(x, y); + context.scale(scale[0], scale[1]); + context.drawImage( + /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ + labelOrImage, originX, originY, w, h, 0, 0, w, h); + } else { + // if image not flipped translate and scale can be avoided + context.drawImage( + /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ + labelOrImage, originX, originY, w, h, x, y, w * scale[0], h * scale[1]); + } + + context.restore(); +} +/** + * @param {Label} label Label. + * @param {CanvasRenderingContext2D} context Context. + */ + + +function executeLabelInstructions(label, context) { + var contextInstructions = label.contextInstructions; + + for (var i = 0, ii = contextInstructions.length; i < ii; i += 2) { + if (Array.isArray(contextInstructions[i + 1])) { + context[contextInstructions[i]].apply(context, contextInstructions[i + 1]); + } else { + context[contextInstructions[i]] = contextInstructions[i + 1]; + } + } +} +/** + * @type {HTMLCanvasElement} + * @private + */ + + +var createTransformStringCanvas = null; +/** + * @param {import("../transform.js").Transform} transform Transform. + * @return {string} CSS transform. + */ + +function createTransformString(transform) { + if (_has.WORKER_OFFSCREEN_CANVAS) { + return (0, _transform.toString)(transform); + } else { + if (!createTransformStringCanvas) { + createTransformStringCanvas = (0, _dom.createCanvasContext2D)(1, 1).canvas; + } + + createTransformStringCanvas.style.transform = (0, _transform.toString)(transform); + return createTransformStringCanvas.style.transform; + } +} +},{"../Object.js":"../../../node_modules/ol/Object.js","../events/Target.js":"../../../node_modules/ol/events/Target.js","../has.js":"../../../node_modules/ol/has.js","../obj.js":"../../../node_modules/ol/obj.js","../dom.js":"../../../node_modules/ol/dom.js","../css.js":"../../../node_modules/ol/css.js","../transform.js":"../../../node_modules/ol/transform.js"}],"../../../node_modules/ol/style/RegularShape.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _ImageState = _interopRequireDefault(require("../ImageState.js")); + +var _Image = _interopRequireDefault(require("./Image.js")); + +var _color = require("../color.js"); + +var _colorlike = require("../colorlike.js"); + +var _dom = require("../dom.js"); + +var _canvas = require("../render/canvas.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/style/RegularShape + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * Specify radius for regular polygons, or radius1 and radius2 for stars. + * @typedef {Object} Options + * @property {import("./Fill.js").default} [fill] Fill style. + * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points + * is the number of sides. + * @property {number} [radius] Radius of a regular polygon. + * @property {number} [radius1] Outer radius of a star. + * @property {number} [radius2] Inner radius of a star. + * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up. + * @property {Array<number>} [displacement=[0,0]] Displacement of the shape + * @property {import("./Stroke.js").default} [stroke] Stroke style. + * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise). + * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view. + */ + +/** + * @typedef {Object} RenderOptions + * @property {import("../colorlike.js").ColorLike} [strokeStyle] + * @property {number} strokeWidth + * @property {number} size + * @property {CanvasLineCap} lineCap + * @property {Array<number>} lineDash + * @property {number} lineDashOffset + * @property {CanvasLineJoin} lineJoin + * @property {number} miterLimit + */ + +/** + * @classdesc + * Set regular shape style for vector features. The resulting shape will be + * a regular polygon when `radius` is provided, or a star when `radius1` and + * `radius2` are provided. + * @api + */ +var RegularShape = +/** @class */ +function (_super) { + __extends(RegularShape, _super); + /** + * @param {Options} options Options. + */ + + + function RegularShape(options) { + var _this = this; + /** + * @type {boolean} + */ + + + var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false; + _this = _super.call(this, { + opacity: 1, + rotateWithView: rotateWithView, + rotation: options.rotation !== undefined ? options.rotation : 0, + scale: 1, + displacement: options.displacement !== undefined ? options.displacement : [0, 0] + }) || this; + /** + * @private + * @type {Object<number, HTMLCanvasElement>} + */ + + _this.canvas_ = {}; + /** + * @private + * @type {HTMLCanvasElement} + */ + + _this.hitDetectionCanvas_ = null; + /** + * @private + * @type {import("./Fill.js").default} + */ + + _this.fill_ = options.fill !== undefined ? options.fill : null; + /** + * @private + * @type {Array<number>} + */ + + _this.origin_ = [0, 0]; + /** + * @private + * @type {number} + */ + + _this.points_ = options.points; + /** + * @protected + * @type {number} + */ + + _this.radius_ = options.radius !== undefined ? options.radius : options.radius1; + /** + * @private + * @type {number|undefined} + */ + + _this.radius2_ = options.radius2; + /** + * @private + * @type {number} + */ + + _this.angle_ = options.angle !== undefined ? options.angle : 0; + /** + * @private + * @type {import("./Stroke.js").default} + */ + + _this.stroke_ = options.stroke !== undefined ? options.stroke : null; + /** + * @private + * @type {Array<number>} + */ + + _this.anchor_ = null; + /** + * @private + * @type {import("../size.js").Size} + */ + + _this.size_ = null; + /** + * @private + * @type {import("../size.js").Size} + */ + + _this.imageSize_ = null; + /** + * @private + * @type {import("../size.js").Size} + */ + + _this.hitDetectionImageSize_ = null; + + _this.render(); + + return _this; + } + /** + * Clones the style. + * @return {RegularShape} The cloned style. + * @api + */ + + + RegularShape.prototype.clone = function () { + var style = new RegularShape({ + fill: this.getFill() ? this.getFill().clone() : undefined, + points: this.getPoints(), + radius: this.getRadius(), + radius2: this.getRadius2(), + angle: this.getAngle(), + stroke: this.getStroke() ? this.getStroke().clone() : undefined, + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView(), + displacement: this.getDisplacement().slice() + }); + style.setOpacity(this.getOpacity()); + style.setScale(this.getScale()); + return style; + }; + /** + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @return {Array<number>} Anchor. + * @api + */ + + + RegularShape.prototype.getAnchor = function () { + return this.anchor_; + }; + /** + * Get the angle used in generating the shape. + * @return {number} Shape's rotation in radians. + * @api + */ + + + RegularShape.prototype.getAngle = function () { + return this.angle_; + }; + /** + * Get the fill style for the shape. + * @return {import("./Fill.js").default} Fill style. + * @api + */ + + + RegularShape.prototype.getFill = function () { + return this.fill_; + }; + /** + * @return {HTMLCanvasElement} Image element. + */ + + + RegularShape.prototype.getHitDetectionImage = function () { + if (!this.hitDetectionCanvas_) { + var renderOptions = this.createRenderOptions(); + this.createHitDetectionCanvas_(renderOptions); + } + + return this.hitDetectionCanvas_; + }; + /** + * Get the image icon. + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLCanvasElement} Image or Canvas element. + * @api + */ + + + RegularShape.prototype.getImage = function (pixelRatio) { + if (!this.canvas_[pixelRatio || 1]) { + var renderOptions = this.createRenderOptions(); + var context = (0, _dom.createCanvasContext2D)(renderOptions.size * pixelRatio || 1, renderOptions.size * pixelRatio || 1); + this.draw_(renderOptions, context, 0, 0, pixelRatio || 1); + this.canvas_[pixelRatio || 1] = context.canvas; + } + + return this.canvas_[pixelRatio || 1]; + }; + /* + * Get the image pixel ratio. + * @param {number} pixelRatio Pixel ratio. + * */ + + + RegularShape.prototype.getPixelRatio = function (pixelRatio) { + return pixelRatio; + }; + /** + * @return {import("../size.js").Size} Image size. + */ + + + RegularShape.prototype.getImageSize = function () { + return this.imageSize_; + }; + /** + * @return {import("../size.js").Size} Size of the hit-detection image. + */ + + + RegularShape.prototype.getHitDetectionImageSize = function () { + return this.hitDetectionImageSize_; + }; + /** + * @return {import("../ImageState.js").default} Image state. + */ + + + RegularShape.prototype.getImageState = function () { + return _ImageState.default.LOADED; + }; + /** + * Get the origin of the symbolizer. + * @return {Array<number>} Origin. + * @api + */ + + + RegularShape.prototype.getOrigin = function () { + return this.origin_; + }; + /** + * Get the number of points for generating the shape. + * @return {number} Number of points for stars and regular polygons. + * @api + */ + + + RegularShape.prototype.getPoints = function () { + return this.points_; + }; + /** + * Get the (primary) radius for the shape. + * @return {number} Radius. + * @api + */ + + + RegularShape.prototype.getRadius = function () { + return this.radius_; + }; + /** + * Get the secondary radius for the shape. + * @return {number|undefined} Radius2. + * @api + */ + + + RegularShape.prototype.getRadius2 = function () { + return this.radius2_; + }; + /** + * Get the size of the symbolizer (in pixels). + * @return {import("../size.js").Size} Size. + * @api + */ + + + RegularShape.prototype.getSize = function () { + return this.size_; + }; + /** + * Get the stroke style for the shape. + * @return {import("./Stroke.js").default} Stroke style. + * @api + */ + + + RegularShape.prototype.getStroke = function () { + return this.stroke_; + }; + /** + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + + + RegularShape.prototype.listenImageChange = function (listener) {}; + /** + * Load not yet loaded URI. + */ + + + RegularShape.prototype.load = function () {}; + /** + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + + + RegularShape.prototype.unlistenImageChange = function (listener) {}; + /** + * @returns {RenderOptions} The render options + * @protected + */ + + + RegularShape.prototype.createRenderOptions = function () { + var lineCap = _canvas.defaultLineCap; + var lineJoin = _canvas.defaultLineJoin; + var miterLimit = 0; + var lineDash = null; + var lineDashOffset = 0; + var strokeStyle; + var strokeWidth = 0; + + if (this.stroke_) { + strokeStyle = this.stroke_.getColor(); + + if (strokeStyle === null) { + strokeStyle = _canvas.defaultStrokeStyle; + } + + strokeStyle = (0, _colorlike.asColorLike)(strokeStyle); + strokeWidth = this.stroke_.getWidth(); + + if (strokeWidth === undefined) { + strokeWidth = _canvas.defaultLineWidth; + } + + lineDash = this.stroke_.getLineDash(); + lineDashOffset = this.stroke_.getLineDashOffset(); + lineJoin = this.stroke_.getLineJoin(); + + if (lineJoin === undefined) { + lineJoin = _canvas.defaultLineJoin; + } + + lineCap = this.stroke_.getLineCap(); + + if (lineCap === undefined) { + lineCap = _canvas.defaultLineCap; + } + + miterLimit = this.stroke_.getMiterLimit(); + + if (miterLimit === undefined) { + miterLimit = _canvas.defaultMiterLimit; + } + } + + var size = 2 * (this.radius_ + strokeWidth) + 1; + return { + strokeStyle: strokeStyle, + strokeWidth: strokeWidth, + size: size, + lineCap: lineCap, + lineDash: lineDash, + lineDashOffset: lineDashOffset, + lineJoin: lineJoin, + miterLimit: miterLimit + }; + }; + /** + * @protected + */ + + + RegularShape.prototype.render = function () { + var renderOptions = this.createRenderOptions(); + var context = (0, _dom.createCanvasContext2D)(renderOptions.size, renderOptions.size); + this.draw_(renderOptions, context, 0, 0, 1); + this.canvas_[1] = context.canvas; // canvas.width and height are rounded to the closest integer + + var size = context.canvas.width; + var imageSize = size; + var displacement = this.getDisplacement(); + this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size]; + this.createHitDetectionCanvas_(renderOptions); + this.anchor_ = [size / 2 - displacement[0], size / 2 + displacement[1]]; + this.size_ = [size, size]; + this.imageSize_ = [imageSize, imageSize]; + }; + /** + * @private + * @param {RenderOptions} renderOptions Render options. + * @param {CanvasRenderingContext2D} context The rendering context. + * @param {number} x The origin for the symbol (x). + * @param {number} y The origin for the symbol (y). + * @param {number} pixelRatio The pixel ratio. + */ + + + RegularShape.prototype.draw_ = function (renderOptions, context, x, y, pixelRatio) { + var i, angle0, radiusC; // reset transform + + context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); // then move to (x, y) + + context.translate(x, y); + context.beginPath(); + var points = this.points_; + + if (points === Infinity) { + context.arc(renderOptions.size / 2, renderOptions.size / 2, this.radius_, 0, 2 * Math.PI, true); + } else { + var radius2 = this.radius2_ !== undefined ? this.radius2_ : this.radius_; + + if (radius2 !== this.radius_) { + points = 2 * points; + } + + for (i = 0; i <= points; i++) { + angle0 = i * 2 * Math.PI / points - Math.PI / 2 + this.angle_; + radiusC = i % 2 === 0 ? this.radius_ : radius2; + context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0), renderOptions.size / 2 + radiusC * Math.sin(angle0)); + } + } + + if (this.fill_) { + var color = this.fill_.getColor(); + + if (color === null) { + color = _canvas.defaultFillStyle; + } + + context.fillStyle = (0, _colorlike.asColorLike)(color); + context.fill(); + } + + if (this.stroke_) { + context.strokeStyle = renderOptions.strokeStyle; + context.lineWidth = renderOptions.strokeWidth; + + if (context.setLineDash && renderOptions.lineDash) { + context.setLineDash(renderOptions.lineDash); + context.lineDashOffset = renderOptions.lineDashOffset; + } + + context.lineCap = renderOptions.lineCap; + context.lineJoin = renderOptions.lineJoin; + context.miterLimit = renderOptions.miterLimit; + context.stroke(); + } + + context.closePath(); + }; + /** + * @private + * @param {RenderOptions} renderOptions Render options. + */ + + + RegularShape.prototype.createHitDetectionCanvas_ = function (renderOptions) { + this.hitDetectionCanvas_ = this.getImage(1); + + if (this.fill_) { + var color = this.fill_.getColor(); // determine if fill is transparent (or pattern or gradient) + + var opacity = 0; + + if (typeof color === 'string') { + color = (0, _color.asArray)(color); + } + + if (color === null) { + opacity = 1; + } else if (Array.isArray(color)) { + opacity = color.length === 4 ? color[3] : 1; + } + + if (opacity === 0) { + // if a transparent fill style is set, create an extra hit-detection image + // with a default fill style + var context = (0, _dom.createCanvasContext2D)(renderOptions.size, renderOptions.size); + this.hitDetectionCanvas_ = context.canvas; + this.drawHitDetectionCanvas_(renderOptions, context, 0, 0); + } + } + }; + /** + * @private + * @param {RenderOptions} renderOptions Render options. + * @param {CanvasRenderingContext2D} context The context. + * @param {number} x The origin for the symbol (x). + * @param {number} y The origin for the symbol (y). + */ + + + RegularShape.prototype.drawHitDetectionCanvas_ = function (renderOptions, context, x, y) { + // move to (x, y) + context.translate(x, y); + context.beginPath(); + var points = this.points_; + + if (points === Infinity) { + context.arc(renderOptions.size / 2, renderOptions.size / 2, this.radius_, 0, 2 * Math.PI, true); + } else { + var radius2 = this.radius2_ !== undefined ? this.radius2_ : this.radius_; + + if (radius2 !== this.radius_) { + points = 2 * points; + } + + var i = void 0, + radiusC = void 0, + angle0 = void 0; + + for (i = 0; i <= points; i++) { + angle0 = i * 2 * Math.PI / points - Math.PI / 2 + this.angle_; + radiusC = i % 2 === 0 ? this.radius_ : radius2; + context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0), renderOptions.size / 2 + radiusC * Math.sin(angle0)); + } + } + + context.fillStyle = _canvas.defaultFillStyle; + context.fill(); + + if (this.stroke_) { + context.strokeStyle = renderOptions.strokeStyle; + context.lineWidth = renderOptions.strokeWidth; + + if (renderOptions.lineDash) { + context.setLineDash(renderOptions.lineDash); + context.lineDashOffset = renderOptions.lineDashOffset; + } + + context.stroke(); + } + + context.closePath(); + }; + + return RegularShape; +}(_Image.default); + +var _default = RegularShape; +exports.default = _default; +},{"../ImageState.js":"../../../node_modules/ol/ImageState.js","./Image.js":"../../../node_modules/ol/style/Image.js","../color.js":"../../../node_modules/ol/color.js","../colorlike.js":"../../../node_modules/ol/colorlike.js","../dom.js":"../../../node_modules/ol/dom.js","../render/canvas.js":"../../../node_modules/ol/render/canvas.js"}],"../../../node_modules/ol/style/Circle.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _RegularShape = _interopRequireDefault(require("./RegularShape.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/style/Circle + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * @typedef {Object} Options + * @property {import("./Fill.js").default} [fill] Fill style. + * @property {number} radius Circle radius. + * @property {import("./Stroke.js").default} [stroke] Stroke style. + * @property {Array<number>} [displacement=[0,0]] displacement + */ + +/** + * @classdesc + * Set circle style for vector features. + * @api + */ +var CircleStyle = +/** @class */ +function (_super) { + __extends(CircleStyle, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function CircleStyle(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + points: Infinity, + fill: options.fill, + radius: options.radius, + stroke: options.stroke, + displacement: options.displacement !== undefined ? options.displacement : [0, 0] + }) || this; + return _this; + } + /** + * Clones the style. + * @return {CircleStyle} The cloned style. + * @api + */ + + + CircleStyle.prototype.clone = function () { + var style = new CircleStyle({ + fill: this.getFill() ? this.getFill().clone() : undefined, + stroke: this.getStroke() ? this.getStroke().clone() : undefined, + radius: this.getRadius(), + displacement: this.getDisplacement().slice() + }); + style.setOpacity(this.getOpacity()); + style.setScale(this.getScale()); + return style; + }; + /** + * Set the circle radius. + * + * @param {number} radius Circle radius. + * @api + */ + + + CircleStyle.prototype.setRadius = function (radius) { + this.radius_ = radius; + this.render(); + }; + + return CircleStyle; +}(_RegularShape.default); + +var _default = CircleStyle; +exports.default = _default; +},{"./RegularShape.js":"../../../node_modules/ol/style/RegularShape.js"}],"../../../node_modules/ol/style/Style.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.toFunction = toFunction; +exports.createDefaultStyle = createDefaultStyle; +exports.createEditingStyle = createEditingStyle; +exports.default = void 0; + +var _Circle = _interopRequireDefault(require("./Circle.js")); + +var _Fill = _interopRequireDefault(require("./Fill.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _Stroke = _interopRequireDefault(require("./Stroke.js")); + +var _asserts = require("../asserts.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/style/Style + */ + +/** + * A function that takes an {@link module:ol/Feature} and a `{number}` + * representing the view's resolution. The function should return a + * {@link module:ol/style/Style} or an array of them. This way e.g. a + * vector layer can be styled. If the function returns `undefined`, the + * feature will not be rendered. + * + * @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction + */ + +/** + * A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}. + * @typedef {Style|Array<Style>|StyleFunction} StyleLike + */ + +/** + * A function that takes an {@link module:ol/Feature} as argument and returns an + * {@link module:ol/geom/Geometry} that will be rendered and styled for the feature. + * + * @typedef {function(import("../Feature.js").FeatureLike): + * (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction + */ + +/** + * Custom renderer function. Takes two arguments: + * + * 1. The pixel coordinates of the geometry in GeoJSON notation. + * 2. The {@link module:ol/render~State} of the layer renderer. + * + * @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State): void} + * RenderFunction + */ + +/** + * @typedef {Object} Options + * @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry + * or function returning a geometry to render for this style. + * @property {import("./Fill.js").default} [fill] Fill style. + * @property {import("./Image.js").default} [image] Image style. + * @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be + * ignored, and the provided function will be called with each render frame for each geometry. + * @property {import("./Stroke.js").default} [stroke] Stroke style. + * @property {import("./Text.js").default} [text] Text style. + * @property {number} [zIndex] Z index. + */ + +/** + * @classdesc + * Container for vector feature rendering styles. Any changes made to the style + * or its children through `set*()` methods will not take effect until the + * feature or layer that uses the style is re-rendered. + * + * ## Feature styles + * + * If no style is defined, the following default style is used: + * ```js + * import {Fill, Stroke, Circle, Style} from 'ol/style'; + * + * var fill = new Fill({ + * color: 'rgba(255,255,255,0.4)' + * }); + * var stroke = new Stroke({ + * color: '#3399CC', + * width: 1.25 + * }); + * var styles = [ + * new Style({ + * image: new Circle({ + * fill: fill, + * stroke: stroke, + * radius: 5 + * }), + * fill: fill, + * stroke: stroke + * }) + * ]; + * ``` + * + * A separate editing style has the following defaults: + * ```js + * import {Fill, Stroke, Circle, Style} from 'ol/style'; + * import GeometryType from 'ol/geom/GeometryType'; + * + * var white = [255, 255, 255, 1]; + * var blue = [0, 153, 255, 1]; + * var width = 3; + * styles[GeometryType.POLYGON] = [ + * new Style({ + * fill: new Fill({ + * color: [255, 255, 255, 0.5] + * }) + * }) + * ]; + * styles[GeometryType.MULTI_POLYGON] = + * styles[GeometryType.POLYGON]; + * styles[GeometryType.LINE_STRING] = [ + * new Style({ + * stroke: new Stroke({ + * color: white, + * width: width + 2 + * }) + * }), + * new Style({ + * stroke: new Stroke({ + * color: blue, + * width: width + * }) + * }) + * ]; + * styles[GeometryType.MULTI_LINE_STRING] = + * styles[GeometryType.LINE_STRING]; + * styles[GeometryType.POINT] = [ + * new Style({ + * image: new Circle({ + * radius: width * 2, + * fill: new Fill({ + * color: blue + * }), + * stroke: new Stroke({ + * color: white, + * width: width / 2 + * }) + * }), + * zIndex: Infinity + * }) + * ]; + * styles[GeometryType.MULTI_POINT] = + * styles[GeometryType.POINT]; + * styles[GeometryType.GEOMETRY_COLLECTION] = + * styles[GeometryType.POLYGON].concat( + * styles[GeometryType.LINE_STRING], + * styles[GeometryType.POINT] + * ); + * ``` + * + * @api + */ +var Style = +/** @class */ +function () { + /** + * @param {Options=} opt_options Style options. + */ + function Style(opt_options) { + var options = opt_options || {}; + /** + * @private + * @type {string|import("../geom/Geometry.js").default|GeometryFunction} + */ + + this.geometry_ = null; + /** + * @private + * @type {!GeometryFunction} + */ + + this.geometryFunction_ = defaultGeometryFunction; + + if (options.geometry !== undefined) { + this.setGeometry(options.geometry); + } + /** + * @private + * @type {import("./Fill.js").default} + */ + + + this.fill_ = options.fill !== undefined ? options.fill : null; + /** + * @private + * @type {import("./Image.js").default} + */ + + this.image_ = options.image !== undefined ? options.image : null; + /** + * @private + * @type {RenderFunction|null} + */ + + this.renderer_ = options.renderer !== undefined ? options.renderer : null; + /** + * @private + * @type {import("./Stroke.js").default} + */ + + this.stroke_ = options.stroke !== undefined ? options.stroke : null; + /** + * @private + * @type {import("./Text.js").default} + */ + + this.text_ = options.text !== undefined ? options.text : null; + /** + * @private + * @type {number|undefined} + */ + + this.zIndex_ = options.zIndex; + } + /** + * Clones the style. + * @return {Style} The cloned style. + * @api + */ + + + Style.prototype.clone = function () { + var geometry = this.getGeometry(); + + if (geometry && typeof geometry === 'object') { + geometry = + /** @type {import("../geom/Geometry.js").default} */ + geometry.clone(); + } + + return new Style({ + geometry: geometry, + fill: this.getFill() ? this.getFill().clone() : undefined, + image: this.getImage() ? this.getImage().clone() : undefined, + stroke: this.getStroke() ? this.getStroke().clone() : undefined, + text: this.getText() ? this.getText().clone() : undefined, + zIndex: this.getZIndex() + }); + }; + /** + * Get the custom renderer function that was configured with + * {@link #setRenderer} or the `renderer` constructor option. + * @return {RenderFunction|null} Custom renderer function. + * @api + */ + + + Style.prototype.getRenderer = function () { + return this.renderer_; + }; + /** + * Sets a custom renderer function for this style. When set, `fill`, `stroke` + * and `image` options of the style will be ignored. + * @param {RenderFunction|null} renderer Custom renderer function. + * @api + */ + + + Style.prototype.setRenderer = function (renderer) { + this.renderer_ = renderer; + }; + /** + * Get the geometry to be rendered. + * @return {string|import("../geom/Geometry.js").default|GeometryFunction} + * Feature property or geometry or function that returns the geometry that will + * be rendered with this style. + * @api + */ + + + Style.prototype.getGeometry = function () { + return this.geometry_; + }; + /** + * Get the function used to generate a geometry for rendering. + * @return {!GeometryFunction} Function that is called with a feature + * and returns the geometry to render instead of the feature's geometry. + * @api + */ + + + Style.prototype.getGeometryFunction = function () { + return this.geometryFunction_; + }; + /** + * Get the fill style. + * @return {import("./Fill.js").default} Fill style. + * @api + */ + + + Style.prototype.getFill = function () { + return this.fill_; + }; + /** + * Set the fill style. + * @param {import("./Fill.js").default} fill Fill style. + * @api + */ + + + Style.prototype.setFill = function (fill) { + this.fill_ = fill; + }; + /** + * Get the image style. + * @return {import("./Image.js").default} Image style. + * @api + */ + + + Style.prototype.getImage = function () { + return this.image_; + }; + /** + * Set the image style. + * @param {import("./Image.js").default} image Image style. + * @api + */ + + + Style.prototype.setImage = function (image) { + this.image_ = image; + }; + /** + * Get the stroke style. + * @return {import("./Stroke.js").default} Stroke style. + * @api + */ + + + Style.prototype.getStroke = function () { + return this.stroke_; + }; + /** + * Set the stroke style. + * @param {import("./Stroke.js").default} stroke Stroke style. + * @api + */ + + + Style.prototype.setStroke = function (stroke) { + this.stroke_ = stroke; + }; + /** + * Get the text style. + * @return {import("./Text.js").default} Text style. + * @api + */ + + + Style.prototype.getText = function () { + return this.text_; + }; + /** + * Set the text style. + * @param {import("./Text.js").default} text Text style. + * @api + */ + + + Style.prototype.setText = function (text) { + this.text_ = text; + }; + /** + * Get the z-index for the style. + * @return {number|undefined} ZIndex. + * @api + */ + + + Style.prototype.getZIndex = function () { + return this.zIndex_; + }; + /** + * Set a geometry that is rendered instead of the feature's geometry. + * + * @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry + * Feature property or geometry or function returning a geometry to render + * for this style. + * @api + */ + + + Style.prototype.setGeometry = function (geometry) { + if (typeof geometry === 'function') { + this.geometryFunction_ = geometry; + } else if (typeof geometry === 'string') { + this.geometryFunction_ = function (feature) { + return ( + /** @type {import("../geom/Geometry.js").default} */ + feature.get(geometry) + ); + }; + } else if (!geometry) { + this.geometryFunction_ = defaultGeometryFunction; + } else if (geometry !== undefined) { + this.geometryFunction_ = function () { + return ( + /** @type {import("../geom/Geometry.js").default} */ + geometry + ); + }; + } + + this.geometry_ = geometry; + }; + /** + * Set the z-index. + * + * @param {number|undefined} zIndex ZIndex. + * @api + */ + + + Style.prototype.setZIndex = function (zIndex) { + this.zIndex_ = zIndex; + }; + + return Style; +}(); +/** + * Convert the provided object into a style function. Functions passed through + * unchanged. Arrays of Style or single style objects wrapped in a + * new style function. + * @param {StyleFunction|Array<Style>|Style} obj + * A style function, a single style, or an array of styles. + * @return {StyleFunction} A style function. + */ + + +function toFunction(obj) { + var styleFunction; + + if (typeof obj === 'function') { + styleFunction = obj; + } else { + /** + * @type {Array<Style>} + */ + var styles_1; + + if (Array.isArray(obj)) { + styles_1 = obj; + } else { + (0, _asserts.assert)(typeof + /** @type {?} */ + obj.getZIndex === 'function', 41); // Expected an `Style` or an array of `Style` + + var style = + /** @type {Style} */ + obj; + styles_1 = [style]; + } + + styleFunction = function () { + return styles_1; + }; + } + + return styleFunction; +} +/** + * @type {Array<Style>} + */ + + +var defaultStyles = null; +/** + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {number} resolution Resolution. + * @return {Array<Style>} Style. + */ + +function createDefaultStyle(feature, resolution) { + // We don't use an immediately-invoked function + // and a closure so we don't get an error at script evaluation time in + // browsers that do not support Canvas. (import("./Circle.js").CircleStyle does + // canvas.getContext('2d') at construction time, which will cause an.error + // in such browsers.) + if (!defaultStyles) { + var fill = new _Fill.default({ + color: 'rgba(255,255,255,0.4)' + }); + var stroke = new _Stroke.default({ + color: '#3399CC', + width: 1.25 + }); + defaultStyles = [new Style({ + image: new _Circle.default({ + fill: fill, + stroke: stroke, + radius: 5 + }), + fill: fill, + stroke: stroke + })]; + } + + return defaultStyles; +} +/** + * Default styles for editing features. + * @return {Object<import("../geom/GeometryType.js").default, Array<Style>>} Styles + */ + + +function createEditingStyle() { + /** @type {Object<import("../geom/GeometryType.js").default, Array<Style>>} */ + var styles = {}; + var white = [255, 255, 255, 1]; + var blue = [0, 153, 255, 1]; + var width = 3; + styles[_GeometryType.default.POLYGON] = [new Style({ + fill: new _Fill.default({ + color: [255, 255, 255, 0.5] + }) + })]; + styles[_GeometryType.default.MULTI_POLYGON] = styles[_GeometryType.default.POLYGON]; + styles[_GeometryType.default.LINE_STRING] = [new Style({ + stroke: new _Stroke.default({ + color: white, + width: width + 2 + }) + }), new Style({ + stroke: new _Stroke.default({ + color: blue, + width: width + }) + })]; + styles[_GeometryType.default.MULTI_LINE_STRING] = styles[_GeometryType.default.LINE_STRING]; + styles[_GeometryType.default.CIRCLE] = styles[_GeometryType.default.POLYGON].concat(styles[_GeometryType.default.LINE_STRING]); + styles[_GeometryType.default.POINT] = [new Style({ + image: new _Circle.default({ + radius: width * 2, + fill: new _Fill.default({ + color: blue + }), + stroke: new _Stroke.default({ + color: white, + width: width / 2 + }) + }), + zIndex: Infinity + })]; + styles[_GeometryType.default.MULTI_POINT] = styles[_GeometryType.default.POINT]; + styles[_GeometryType.default.GEOMETRY_COLLECTION] = styles[_GeometryType.default.POLYGON].concat(styles[_GeometryType.default.LINE_STRING], styles[_GeometryType.default.POINT]); + return styles; +} +/** + * Function that is called with a feature and returns its default geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature to get the geometry for. + * @return {import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined} Geometry to render. + */ + + +function defaultGeometryFunction(feature) { + return feature.getGeometry(); +} + +var _default = Style; +exports.default = _default; +},{"./Circle.js":"../../../node_modules/ol/style/Circle.js","./Fill.js":"../../../node_modules/ol/style/Fill.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./Stroke.js":"../../../node_modules/ol/style/Stroke.js","../asserts.js":"../../../node_modules/ol/asserts.js"}],"../../../node_modules/ol/style/TextPlacement.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/style/TextPlacement + */ + +/** + * Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that + * `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString}, + * {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or + * {@link module:ol/geom/MultiPolygon~MultiPolygon}. + * @enum {string} + */ +var _default = { + POINT: 'point', + LINE: 'line' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/style/Text.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Fill = _interopRequireDefault(require("./Fill.js")); + +var _TextPlacement = _interopRequireDefault(require("./TextPlacement.js")); + +var _size = require("../size.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/style/Text + */ + +/** + * The default fill color to use if no fill was set at construction time; a + * blackish `#333`. + * + * @const {string} + */ +var DEFAULT_FILL_COLOR = '#333'; +/** + * @typedef {Object} Options + * @property {string} [font] Font style as CSS 'font' value, see: + * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif' + * @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters. + * The expected value is in radians, and the default is 45° (`Math.PI / 4`). + * @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right. + * @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down. + * @property {boolean} [overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed + * the width of the polygon at the label position or the length of the path that it follows. + * @property {import("./TextPlacement.js").default|string} [placement='point'] Text placement. + * @property {number|import("../size.js").Size} [scale] Scale. + * @property {boolean} [rotateWithView=false] Whether to rotate the text with the view. + * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise). + * @property {string} [text] Text content. + * @property {string} [textAlign] Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'. + * Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a + * placement where `maxAngle` is not exceeded. + * @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic', + * 'hanging', 'ideographic'. + * @property {import("./Fill.js").default} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333). + * @property {import("./Stroke.js").default} [stroke] Stroke style. + * @property {import("./Fill.js").default} [backgroundFill] Fill style for the text background when `placement` is + * `'point'`. Default is no fill. + * @property {import("./Stroke.js").default} [backgroundStroke] Stroke style for the text background when `placement` + * is `'point'`. Default is no stroke. + * @property {Array<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of + * values in the array is `[top, right, bottom, left]`. + */ + +/** + * @classdesc + * Set text style for vector features. + * @api + */ + +var Text = +/** @class */ +function () { + /** + * @param {Options=} opt_options Options. + */ + function Text(opt_options) { + var options = opt_options || {}; + /** + * @private + * @type {string|undefined} + */ + + this.font_ = options.font; + /** + * @private + * @type {number|undefined} + */ + + this.rotation_ = options.rotation; + /** + * @private + * @type {boolean|undefined} + */ + + this.rotateWithView_ = options.rotateWithView; + /** + * @private + * @type {number|import("../size.js").Size|undefined} + */ + + this.scale_ = options.scale; + /** + * @private + * @type {import("../size.js").Size} + */ + + this.scaleArray_ = (0, _size.toSize)(options.scale !== undefined ? options.scale : 1); + /** + * @private + * @type {string|undefined} + */ + + this.text_ = options.text; + /** + * @private + * @type {string|undefined} + */ + + this.textAlign_ = options.textAlign; + /** + * @private + * @type {string|undefined} + */ + + this.textBaseline_ = options.textBaseline; + /** + * @private + * @type {import("./Fill.js").default} + */ + + this.fill_ = options.fill !== undefined ? options.fill : new _Fill.default({ + color: DEFAULT_FILL_COLOR + }); + /** + * @private + * @type {number} + */ + + this.maxAngle_ = options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4; + /** + * @private + * @type {import("./TextPlacement.js").default|string} + */ + + this.placement_ = options.placement !== undefined ? options.placement : _TextPlacement.default.POINT; + /** + * @private + * @type {boolean} + */ + + this.overflow_ = !!options.overflow; + /** + * @private + * @type {import("./Stroke.js").default} + */ + + this.stroke_ = options.stroke !== undefined ? options.stroke : null; + /** + * @private + * @type {number} + */ + + this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0; + /** + * @private + * @type {number} + */ + + this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0; + /** + * @private + * @type {import("./Fill.js").default} + */ + + this.backgroundFill_ = options.backgroundFill ? options.backgroundFill : null; + /** + * @private + * @type {import("./Stroke.js").default} + */ + + this.backgroundStroke_ = options.backgroundStroke ? options.backgroundStroke : null; + /** + * @private + * @type {Array<number>} + */ + + this.padding_ = options.padding === undefined ? null : options.padding; + } + /** + * Clones the style. + * @return {Text} The cloned style. + * @api + */ + + + Text.prototype.clone = function () { + var scale = this.getScale(); + return new Text({ + font: this.getFont(), + placement: this.getPlacement(), + maxAngle: this.getMaxAngle(), + overflow: this.getOverflow(), + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView(), + scale: Array.isArray(scale) ? scale.slice() : scale, + text: this.getText(), + textAlign: this.getTextAlign(), + textBaseline: this.getTextBaseline(), + fill: this.getFill() ? this.getFill().clone() : undefined, + stroke: this.getStroke() ? this.getStroke().clone() : undefined, + offsetX: this.getOffsetX(), + offsetY: this.getOffsetY(), + backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined, + backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined, + padding: this.getPadding() + }); + }; + /** + * Get the `overflow` configuration. + * @return {boolean} Let text overflow the length of the path they follow. + * @api + */ + + + Text.prototype.getOverflow = function () { + return this.overflow_; + }; + /** + * Get the font name. + * @return {string|undefined} Font. + * @api + */ + + + Text.prototype.getFont = function () { + return this.font_; + }; + /** + * Get the maximum angle between adjacent characters. + * @return {number} Angle in radians. + * @api + */ + + + Text.prototype.getMaxAngle = function () { + return this.maxAngle_; + }; + /** + * Get the label placement. + * @return {import("./TextPlacement.js").default|string} Text placement. + * @api + */ + + + Text.prototype.getPlacement = function () { + return this.placement_; + }; + /** + * Get the x-offset for the text. + * @return {number} Horizontal text offset. + * @api + */ + + + Text.prototype.getOffsetX = function () { + return this.offsetX_; + }; + /** + * Get the y-offset for the text. + * @return {number} Vertical text offset. + * @api + */ + + + Text.prototype.getOffsetY = function () { + return this.offsetY_; + }; + /** + * Get the fill style for the text. + * @return {import("./Fill.js").default} Fill style. + * @api + */ + + + Text.prototype.getFill = function () { + return this.fill_; + }; + /** + * Determine whether the text rotates with the map. + * @return {boolean|undefined} Rotate with map. + * @api + */ + + + Text.prototype.getRotateWithView = function () { + return this.rotateWithView_; + }; + /** + * Get the text rotation. + * @return {number|undefined} Rotation. + * @api + */ + + + Text.prototype.getRotation = function () { + return this.rotation_; + }; + /** + * Get the text scale. + * @return {number|import("../size.js").Size|undefined} Scale. + * @api + */ + + + Text.prototype.getScale = function () { + return this.scale_; + }; + /** + * Get the symbolizer scale array. + * @return {import("../size.js").Size} Scale array. + */ + + + Text.prototype.getScaleArray = function () { + return this.scaleArray_; + }; + /** + * Get the stroke style for the text. + * @return {import("./Stroke.js").default} Stroke style. + * @api + */ + + + Text.prototype.getStroke = function () { + return this.stroke_; + }; + /** + * Get the text to be rendered. + * @return {string|undefined} Text. + * @api + */ + + + Text.prototype.getText = function () { + return this.text_; + }; + /** + * Get the text alignment. + * @return {string|undefined} Text align. + * @api + */ + + + Text.prototype.getTextAlign = function () { + return this.textAlign_; + }; + /** + * Get the text baseline. + * @return {string|undefined} Text baseline. + * @api + */ + + + Text.prototype.getTextBaseline = function () { + return this.textBaseline_; + }; + /** + * Get the background fill style for the text. + * @return {import("./Fill.js").default} Fill style. + * @api + */ + + + Text.prototype.getBackgroundFill = function () { + return this.backgroundFill_; + }; + /** + * Get the background stroke style for the text. + * @return {import("./Stroke.js").default} Stroke style. + * @api + */ + + + Text.prototype.getBackgroundStroke = function () { + return this.backgroundStroke_; + }; + /** + * Get the padding for the text. + * @return {Array<number>} Padding. + * @api + */ + + + Text.prototype.getPadding = function () { + return this.padding_; + }; + /** + * Set the `overflow` property. + * + * @param {boolean} overflow Let text overflow the path that it follows. + * @api + */ + + + Text.prototype.setOverflow = function (overflow) { + this.overflow_ = overflow; + }; + /** + * Set the font. + * + * @param {string|undefined} font Font. + * @api + */ + + + Text.prototype.setFont = function (font) { + this.font_ = font; + }; + /** + * Set the maximum angle between adjacent characters. + * + * @param {number} maxAngle Angle in radians. + * @api + */ + + + Text.prototype.setMaxAngle = function (maxAngle) { + this.maxAngle_ = maxAngle; + }; + /** + * Set the x offset. + * + * @param {number} offsetX Horizontal text offset. + * @api + */ + + + Text.prototype.setOffsetX = function (offsetX) { + this.offsetX_ = offsetX; + }; + /** + * Set the y offset. + * + * @param {number} offsetY Vertical text offset. + * @api + */ + + + Text.prototype.setOffsetY = function (offsetY) { + this.offsetY_ = offsetY; + }; + /** + * Set the text placement. + * + * @param {import("./TextPlacement.js").default|string} placement Placement. + * @api + */ + + + Text.prototype.setPlacement = function (placement) { + this.placement_ = placement; + }; + /** + * Set whether to rotate the text with the view. + * + * @param {boolean} rotateWithView Rotate with map. + * @api + */ + + + Text.prototype.setRotateWithView = function (rotateWithView) { + this.rotateWithView_ = rotateWithView; + }; + /** + * Set the fill. + * + * @param {import("./Fill.js").default} fill Fill style. + * @api + */ + + + Text.prototype.setFill = function (fill) { + this.fill_ = fill; + }; + /** + * Set the rotation. + * + * @param {number|undefined} rotation Rotation. + * @api + */ + + + Text.prototype.setRotation = function (rotation) { + this.rotation_ = rotation; + }; + /** + * Set the scale. + * + * @param {number|import("../size.js").Size|undefined} scale Scale. + * @api + */ + + + Text.prototype.setScale = function (scale) { + this.scale_ = scale; + this.scaleArray_ = (0, _size.toSize)(scale !== undefined ? scale : 1); + }; + /** + * Set the stroke. + * + * @param {import("./Stroke.js").default} stroke Stroke style. + * @api + */ + + + Text.prototype.setStroke = function (stroke) { + this.stroke_ = stroke; + }; + /** + * Set the text. + * + * @param {string|undefined} text Text. + * @api + */ + + + Text.prototype.setText = function (text) { + this.text_ = text; + }; + /** + * Set the text alignment. + * + * @param {string|undefined} textAlign Text align. + * @api + */ + + + Text.prototype.setTextAlign = function (textAlign) { + this.textAlign_ = textAlign; + }; + /** + * Set the text baseline. + * + * @param {string|undefined} textBaseline Text baseline. + * @api + */ + + + Text.prototype.setTextBaseline = function (textBaseline) { + this.textBaseline_ = textBaseline; + }; + /** + * Set the background fill. + * + * @param {import("./Fill.js").default} fill Fill style. + * @api + */ + + + Text.prototype.setBackgroundFill = function (fill) { + this.backgroundFill_ = fill; + }; + /** + * Set the background stroke. + * + * @param {import("./Stroke.js").default} stroke Stroke style. + * @api + */ + + + Text.prototype.setBackgroundStroke = function (stroke) { + this.backgroundStroke_ = stroke; + }; + /** + * Set the padding (`[top, right, bottom, left]`). + * + * @param {!Array<number>} padding Padding. + * @api + */ + + + Text.prototype.setPadding = function (padding) { + this.padding_ = padding; + }; + + return Text; +}(); + +var _default = Text; +exports.default = _default; +},{"./Fill.js":"../../../node_modules/ol/style/Fill.js","./TextPlacement.js":"../../../node_modules/ol/style/TextPlacement.js","../size.js":"../../../node_modules/ol/size.js"}],"../../../node_modules/ol/layer/Property.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/layer/Property + */ + +/** + * @enum {string} + */ +var _default = { + OPACITY: 'opacity', + VISIBLE: 'visible', + EXTENT: 'extent', + Z_INDEX: 'zIndex', + MAX_RESOLUTION: 'maxResolution', + MIN_RESOLUTION: 'minResolution', + MAX_ZOOM: 'maxZoom', + MIN_ZOOM: 'minZoom', + SOURCE: 'source' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/layer/Base.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Object = _interopRequireDefault(require("../Object.js")); + +var _Property = _interopRequireDefault(require("./Property.js")); + +var _util = require("../util.js"); + +var _asserts = require("../asserts.js"); + +var _obj = require("../obj.js"); + +var _math = require("../math.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/Base + */ + + +/** + * @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. + */ + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in + * the options is set as a {@link module:ol/Object} property on the layer object, so + * is observable, and has get/set accessors. + * + * @api + */ +var BaseLayer = +/** @class */ +function (_super) { + __extends(BaseLayer, _super); + /** + * @param {Options} options Layer options. + */ + + + function BaseLayer(options) { + var _this = _super.call(this) || this; + /** + * @type {Object<string, *>} + */ + + + var properties = (0, _obj.assign)({}, options); + properties[_Property.default.OPACITY] = options.opacity !== undefined ? options.opacity : 1; + (0, _asserts.assert)(typeof properties[_Property.default.OPACITY] === 'number', 64); // Layer opacity must be a number + + properties[_Property.default.VISIBLE] = options.visible !== undefined ? options.visible : true; + properties[_Property.default.Z_INDEX] = options.zIndex; + properties[_Property.default.MAX_RESOLUTION] = options.maxResolution !== undefined ? options.maxResolution : Infinity; + properties[_Property.default.MIN_RESOLUTION] = options.minResolution !== undefined ? options.minResolution : 0; + properties[_Property.default.MIN_ZOOM] = options.minZoom !== undefined ? options.minZoom : -Infinity; + properties[_Property.default.MAX_ZOOM] = options.maxZoom !== undefined ? options.maxZoom : Infinity; + /** + * @type {string} + * @private + */ + + _this.className_ = properties.className !== undefined ? options.className : 'ol-layer'; + delete properties.className; + + _this.setProperties(properties); + /** + * @type {import("./Layer.js").State} + * @private + */ + + + _this.state_ = null; + return _this; + } + /** + * @return {string} CSS class name. + */ + + + BaseLayer.prototype.getClassName = function () { + return this.className_; + }; + /** + * This method is not meant to be called by layers or layer renderers because the state + * is incorrect if the layer is included in a layer group. + * + * @param {boolean=} opt_managed Layer is managed. + * @return {import("./Layer.js").State} Layer state. + */ + + + BaseLayer.prototype.getLayerState = function (opt_managed) { + /** @type {import("./Layer.js").State} */ + var state = this.state_ || + /** @type {?} */ + { + layer: this, + managed: opt_managed === undefined ? true : opt_managed + }; + var zIndex = this.getZIndex(); + state.opacity = (0, _math.clamp)(Math.round(this.getOpacity() * 100) / 100, 0, 1); + state.sourceState = this.getSourceState(); + state.visible = this.getVisible(); + state.extent = this.getExtent(); + state.zIndex = zIndex !== undefined ? zIndex : state.managed === false ? Infinity : 0; + state.maxResolution = this.getMaxResolution(); + state.minResolution = Math.max(this.getMinResolution(), 0); + state.minZoom = this.getMinZoom(); + state.maxZoom = this.getMaxZoom(); + this.state_ = state; + return state; + }; + /** + * @abstract + * @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be + * modified in place). + * @return {Array<import("./Layer.js").default>} Array of layers. + */ + + + BaseLayer.prototype.getLayersArray = function (opt_array) { + return (0, _util.abstract)(); + }; + /** + * @abstract + * @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer + * states (to be modified in place). + * @return {Array<import("./Layer.js").State>} List of layer states. + */ + + + BaseLayer.prototype.getLayerStatesArray = function (opt_states) { + return (0, _util.abstract)(); + }; + /** + * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it + * will be visible regardless of extent. + * @return {import("../extent.js").Extent|undefined} The layer extent. + * @observable + * @api + */ + + + BaseLayer.prototype.getExtent = function () { + return ( + /** @type {import("../extent.js").Extent|undefined} */ + this.get(_Property.default.EXTENT) + ); + }; + /** + * Return the maximum resolution of the layer. + * @return {number} The maximum resolution of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getMaxResolution = function () { + return ( + /** @type {number} */ + this.get(_Property.default.MAX_RESOLUTION) + ); + }; + /** + * Return the minimum resolution of the layer. + * @return {number} The minimum resolution of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getMinResolution = function () { + return ( + /** @type {number} */ + this.get(_Property.default.MIN_RESOLUTION) + ); + }; + /** + * Return the minimum zoom level of the layer. + * @return {number} The minimum zoom level of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getMinZoom = function () { + return ( + /** @type {number} */ + this.get(_Property.default.MIN_ZOOM) + ); + }; + /** + * Return the maximum zoom level of the layer. + * @return {number} The maximum zoom level of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getMaxZoom = function () { + return ( + /** @type {number} */ + this.get(_Property.default.MAX_ZOOM) + ); + }; + /** + * Return the opacity of the layer (between 0 and 1). + * @return {number} The opacity of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getOpacity = function () { + return ( + /** @type {number} */ + this.get(_Property.default.OPACITY) + ); + }; + /** + * @abstract + * @return {import("../source/State.js").default} Source state. + */ + + + BaseLayer.prototype.getSourceState = function () { + return (0, _util.abstract)(); + }; + /** + * Return the visibility of the layer (`true` or `false`). + * @return {boolean} The visibility of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getVisible = function () { + return ( + /** @type {boolean} */ + this.get(_Property.default.VISIBLE) + ); + }; + /** + * Return the Z-index of the layer, which is used to order layers before + * rendering. The default Z-index is 0. + * @return {number} The Z-index of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.getZIndex = function () { + return ( + /** @type {number} */ + this.get(_Property.default.Z_INDEX) + ); + }; + /** + * Set the extent at which the layer is visible. If `undefined`, the layer + * will be visible at all extents. + * @param {import("../extent.js").Extent|undefined} extent The extent of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setExtent = function (extent) { + this.set(_Property.default.EXTENT, extent); + }; + /** + * Set the maximum resolution at which the layer is visible. + * @param {number} maxResolution The maximum resolution of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setMaxResolution = function (maxResolution) { + this.set(_Property.default.MAX_RESOLUTION, maxResolution); + }; + /** + * Set the minimum resolution at which the layer is visible. + * @param {number} minResolution The minimum resolution of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setMinResolution = function (minResolution) { + this.set(_Property.default.MIN_RESOLUTION, minResolution); + }; + /** + * Set the maximum zoom (exclusive) at which the layer is visible. + * Note that the zoom levels for layer visibility are based on the + * view zoom level, which may be different from a tile source zoom level. + * @param {number} maxZoom The maximum zoom of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setMaxZoom = function (maxZoom) { + this.set(_Property.default.MAX_ZOOM, maxZoom); + }; + /** + * Set the minimum zoom (inclusive) at which the layer is visible. + * Note that the zoom levels for layer visibility are based on the + * view zoom level, which may be different from a tile source zoom level. + * @param {number} minZoom The minimum zoom of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setMinZoom = function (minZoom) { + this.set(_Property.default.MIN_ZOOM, minZoom); + }; + /** + * Set the opacity of the layer, allowed values range from 0 to 1. + * @param {number} opacity The opacity of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setOpacity = function (opacity) { + (0, _asserts.assert)(typeof opacity === 'number', 64); // Layer opacity must be a number + + this.set(_Property.default.OPACITY, opacity); + }; + /** + * Set the visibility of the layer (`true` or `false`). + * @param {boolean} visible The visibility of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setVisible = function (visible) { + this.set(_Property.default.VISIBLE, visible); + }; + /** + * Set Z-index of the layer, which is used to order layers before rendering. + * The default Z-index is 0. + * @param {number} zindex The z-index of the layer. + * @observable + * @api + */ + + + BaseLayer.prototype.setZIndex = function (zindex) { + this.set(_Property.default.Z_INDEX, zindex); + }; + /** + * Clean up. + */ + + + BaseLayer.prototype.disposeInternal = function () { + if (this.state_) { + this.state_.layer = null; + this.state_ = null; + } + + _super.prototype.disposeInternal.call(this); + }; + + return BaseLayer; +}(_Object.default); + +var _default = BaseLayer; +exports.default = _default; +},{"../Object.js":"../../../node_modules/ol/Object.js","./Property.js":"../../../node_modules/ol/layer/Property.js","../util.js":"../../../node_modules/ol/util.js","../asserts.js":"../../../node_modules/ol/asserts.js","../obj.js":"../../../node_modules/ol/obj.js","../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/source/State.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/source/State + */ + +/** + * @enum {string} + * State of the source, one of 'undefined', 'loading', 'ready' or 'error'. + */ +var _default = { + UNDEFINED: 'undefined', + LOADING: 'loading', + READY: 'ready', + ERROR: 'error' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/layer/Layer.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.inView = inView; +exports.default = void 0; + +var _Base = _interopRequireDefault(require("./Base.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Property = _interopRequireDefault(require("./Property.js")); + +var _EventType2 = _interopRequireDefault(require("../render/EventType.js")); + +var _State = _interopRequireDefault(require("../source/State.js")); + +var _asserts = require("../asserts.js"); + +var _obj = require("../obj.js"); + +var _Object = require("../Object.js"); + +var _events = require("../events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + 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 + */ + +/** + * @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 {import("../source/Source.js").default} [source] Source for this layer. If not provided to the constructor, + * the source can be set by calling {@link module:ol/layer/Layer#setSource layer.setSource(source)} after + * construction. + * @property {import("../PluggableMap.js").default} [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. + */ + +/** + * @typedef {Object} State + * @property {import("./Layer.js").default} layer + * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point. + * @property {import("../source/State.js").default} sourceState + * @property {boolean} visible + * @property {boolean} managed + * @property {import("../extent.js").Extent} [extent] + * @property {number} zIndex + * @property {number} maxResolution + * @property {number} minResolution + * @property {number} minZoom + * @property {number} maxZoom + */ + +/** + * @classdesc + * Base class from which all layer types are derived. This should only be instantiated + * in the case where a custom layer is be 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 module:ol/Map#addLayer}. Components + * like {@link module:ol/interaction/Select~Select} 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 module:ol/Map~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 + * @api + */ +var Layer = +/** @class */ +function (_super) { + __extends(Layer, _super); + /** + * @param {Options} options Layer options. + */ + + + function Layer(options) { + var _this = this; + + var baseOptions = (0, _obj.assign)({}, options); + delete baseOptions.source; + _this = _super.call(this, baseOptions) || this; + /** + * @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 {import("../renderer/Layer.js").default} + */ + + _this.renderer_ = null; // Overwrite default render method with a custom one + + if (options.render) { + _this.render = options.render; + } + + if (options.map) { + _this.setMap(options.map); + } + + _this.addEventListener((0, _Object.getChangeEventType)(_Property.default.SOURCE), _this.handleSourcePropertyChange_); + + var source = options.source ? + /** @type {SourceType} */ + options.source : null; + + _this.setSource(source); + + return _this; + } + /** + * @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be modified in place). + * @return {Array<import("./Layer.js").default>} Array of layers. + */ + + + Layer.prototype.getLayersArray = function (opt_array) { + var array = opt_array ? opt_array : []; + array.push(this); + return array; + }; + /** + * @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer states (to be modified in place). + * @return {Array<import("./Layer.js").State>} 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} The layer source (or `null` if not yet set). + * @observable + * @api + */ + + + Layer.prototype.getSource = function () { + return ( + /** @type {SourceType} */ + this.get(_Property.default.SOURCE) || null + ); + }; + /** + * @return {import("../source/State.js").default} Source state. + */ + + + Layer.prototype.getSourceState = function () { + var source = this.getSource(); + return !source ? _State.default.UNDEFINED : source.getState(); + }; + /** + * @private + */ + + + Layer.prototype.handleSourceChange_ = function () { + this.changed(); + }; + /** + * @private + */ + + + Layer.prototype.handleSourcePropertyChange_ = function () { + if (this.sourceChangeKey_) { + (0, _events.unlistenByKey)(this.sourceChangeKey_); + this.sourceChangeKey_ = null; + } + + var source = this.getSource(); + + if (source) { + this.sourceChangeKey_ = (0, _events.listen)(source, _EventType.default.CHANGE, this.handleSourceChange_, this); + } + + this.changed(); + }; + /** + * @param {import("../pixel").Pixel} pixel Pixel. + * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with + * an array of features. + */ + + + Layer.prototype.getFeatures = function (pixel) { + return this.renderer_.getFeatures(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)) { + return layerRenderer.renderFrame(frameState, target); + } + }; + /** + * 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#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#addLayer} instead. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + Layer.prototype.setMap = function (map) { + if (this.mapPrecomposeKey_) { + (0, _events.unlistenByKey)(this.mapPrecomposeKey_); + this.mapPrecomposeKey_ = null; + } + + if (!map) { + this.changed(); + } + + if (this.mapRenderKey_) { + (0, _events.unlistenByKey)(this.mapRenderKey_); + this.mapRenderKey_ = null; + } + + if (map) { + this.mapPrecomposeKey_ = (0, _events.listen)(map, _EventType2.default.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. + + (0, _asserts.assert)(!layerStatesArray.some(function (arrayLayerState) { + return arrayLayerState.layer === layerState.layer; + }), 67); + layerStatesArray.push(layerState); + }, this); + this.mapRenderKey_ = (0, _events.listen)(this, _EventType.default.CHANGE, map.render, map); + this.changed(); + } + }; + /** + * Set the layer source. + * @param {SourceType} source The layer source. + * @observable + * @api + */ + + + Layer.prototype.setSource = function (source) { + this.set(_Property.default.SOURCE, source); + }; + /** + * Get the renderer for this layer. + * @return {import("../renderer/Layer.js").default} 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 {import("../renderer/Layer.js").default} A layer renderer. + * @protected + */ + + + Layer.prototype.createRenderer = function () { + return null; + }; + /** + * Clean up. + */ + + + Layer.prototype.disposeInternal = function () { + this.setSource(null); + + _super.prototype.disposeInternal.call(this); + }; + + return Layer; +}(_Base.default); +/** + * 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; +} + +var _default = Layer; +exports.default = _default; +},{"./Base.js":"../../../node_modules/ol/layer/Base.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","./Property.js":"../../../node_modules/ol/layer/Property.js","../render/EventType.js":"../../../node_modules/ol/render/EventType.js","../source/State.js":"../../../node_modules/ol/source/State.js","../asserts.js":"../../../node_modules/ol/asserts.js","../obj.js":"../../../node_modules/ol/obj.js","../Object.js":"../../../node_modules/ol/Object.js","../events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/layer/BaseVector.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Layer = _interopRequireDefault(require("./Layer.js")); + +var _obj = require("../obj.js"); + +var _Style = require("../style/Style.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/BaseVector + */ + + +/** + * @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 {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting + * features before rendering. By default features are drawn in the order that they are created. Use + * `null` to avoid the sort, but get an undefined draw order. + * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the + * renderer when getting features from the vector source for the rendering or hit-detection. + * Recommended value: the size of the largest symbol, line width or label. + * @property {import("../source/Vector.js").default} [source] Source. + * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage + * this layer in its layers collection, and the layer will be rendered on top. This is useful for + * temporary layers. The standard way to add a layer to a map and have it managed by the map is to + * use {@link module:ol/Map#addLayer}. + * @property {boolean} [declutter=false] Declutter images and text. Decluttering is applied to all + * image and text styles of all Vector and VectorTile layers that have set this to `true`. The priority + * is defined by the z-index of the layer, the `zIndex` of the style and the render order of features. + * Higher z-index means higher priority. Within the same z-index, a feature rendered before another has + * higher priority. + * @property {import("../style/Style.js").StyleLike|null} [style] Layer style. When set to `null`, only + * features that have their own style will be rendered. See {@link module:ol/style} for default style + * which will be used if this is not set. + * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will + * be recreated during animations. This means that no vectors will be shown clipped, but the + * setting will have a performance impact for large amounts of vector data. When set to `false`, + * batches will be recreated when no animation is active. + * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will + * be recreated during interactions. See also `updateWhileAnimating`. + */ + +/** + * @enum {string} + * @private + */ +var Property = { + RENDER_ORDER: 'renderOrder' +}; +/** + * @classdesc + * Vector data that is rendered client-side. + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} + * property on the layer object; for example, setting `title: 'My Title'` in the + * options means that `title` is observable, and has get/set accessors. + * + * @template {import("../source/Vector.js").default|import("../source/VectorTile.js").default} VectorSourceType + * @extends {Layer<VectorSourceType>} + * @api + */ + +var BaseVectorLayer = +/** @class */ +function (_super) { + __extends(BaseVectorLayer, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function BaseVectorLayer(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var baseOptions = (0, _obj.assign)({}, options); + delete baseOptions.style; + delete baseOptions.renderBuffer; + delete baseOptions.updateWhileAnimating; + delete baseOptions.updateWhileInteracting; + _this = _super.call(this, baseOptions) || this; + /** + * @private + * @type {boolean} + */ + + _this.declutter_ = options.declutter !== undefined ? options.declutter : false; + /** + * @type {number} + * @private + */ + + _this.renderBuffer_ = options.renderBuffer !== undefined ? options.renderBuffer : 100; + /** + * User provided style. + * @type {import("../style/Style.js").StyleLike} + * @private + */ + + _this.style_ = null; + /** + * Style function for use within the library. + * @type {import("../style/Style.js").StyleFunction|undefined} + * @private + */ + + _this.styleFunction_ = undefined; + + _this.setStyle(options.style); + /** + * @type {boolean} + * @private + */ + + + _this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ? options.updateWhileAnimating : false; + /** + * @type {boolean} + * @private + */ + + _this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ? options.updateWhileInteracting : false; + return _this; + } + /** + * @return {boolean} Declutter. + */ + + + BaseVectorLayer.prototype.getDeclutter = function () { + return this.declutter_; + }; + /** + * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise + * that resolves with an array of features. The array will either contain the topmost feature + * when a hit was detected, or it will be empty. + * + * The hit detection algorithm used for this method is optimized for performance, but is less + * accurate than the one used in {@link import("../PluggableMap.js").default#getFeaturesAtPixel}: Text + * is not considered, and icons are only represented by their bounding box instead of the exact + * image. + * + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with an array of features. + * @api + */ + + + BaseVectorLayer.prototype.getFeatures = function (pixel) { + return _super.prototype.getFeatures.call(this, pixel); + }; + /** + * @return {number|undefined} Render buffer. + */ + + + BaseVectorLayer.prototype.getRenderBuffer = function () { + return this.renderBuffer_; + }; + /** + * @return {function(import("../Feature.js").default, import("../Feature.js").default): number|null|undefined} Render + * order. + */ + + + BaseVectorLayer.prototype.getRenderOrder = function () { + return ( + /** @type {import("../render.js").OrderFunction|null|undefined} */ + this.get(Property.RENDER_ORDER) + ); + }; + /** + * Get the style for features. This returns whatever was passed to the `style` + * option at construction or to the `setStyle` method. + * @return {import("../style/Style.js").StyleLike|null|undefined} Layer style. + * @api + */ + + + BaseVectorLayer.prototype.getStyle = function () { + return this.style_; + }; + /** + * Get the style function. + * @return {import("../style/Style.js").StyleFunction|undefined} Layer style function. + * @api + */ + + + BaseVectorLayer.prototype.getStyleFunction = function () { + return this.styleFunction_; + }; + /** + * @return {boolean} Whether the rendered layer should be updated while + * animating. + */ + + + BaseVectorLayer.prototype.getUpdateWhileAnimating = function () { + return this.updateWhileAnimating_; + }; + /** + * @return {boolean} Whether the rendered layer should be updated while + * interacting. + */ + + + BaseVectorLayer.prototype.getUpdateWhileInteracting = function () { + return this.updateWhileInteracting_; + }; + /** + * @param {import("../render.js").OrderFunction|null|undefined} renderOrder + * Render order. + */ + + + BaseVectorLayer.prototype.setRenderOrder = function (renderOrder) { + this.set(Property.RENDER_ORDER, renderOrder); + }; + /** + * Set the style for features. This can be a single style object, an array + * of styles, or a function that takes a feature and resolution and returns + * an array of styles. If set to `null`, the layer has no style (a `null` style), + * so only features that have their own styles will be rendered in the layer. Call + * `setStyle()` without arguments to reset to the default style. See + * {@link module:ol/style} for information on the default style. + * @param {(import("../style/Style.js").StyleLike|null)=} opt_style Layer style. + * @api + */ + + + BaseVectorLayer.prototype.setStyle = function (opt_style) { + this.style_ = opt_style !== undefined ? opt_style : _Style.createDefaultStyle; + this.styleFunction_ = opt_style === null ? undefined : (0, _Style.toFunction)(this.style_); + this.changed(); + }; + + return BaseVectorLayer; +}(_Layer.default); + +var _default = BaseVectorLayer; +exports.default = _default; +},{"./Layer.js":"../../../node_modules/ol/layer/Layer.js","../obj.js":"../../../node_modules/ol/obj.js","../style/Style.js":"../../../node_modules/ol/style/Style.js"}],"../../../node_modules/ol/render/canvas/Instruction.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.closePathInstruction = exports.beginPathInstruction = exports.strokeInstruction = exports.fillInstruction = void 0; + +/** + * @module ol/render/canvas/Instruction + */ + +/** + * @enum {number} + */ +var Instruction = { + BEGIN_GEOMETRY: 0, + BEGIN_PATH: 1, + CIRCLE: 2, + CLOSE_PATH: 3, + CUSTOM: 4, + DRAW_CHARS: 5, + DRAW_IMAGE: 6, + END_GEOMETRY: 7, + FILL: 8, + MOVE_TO_LINE_TO: 9, + SET_FILL_STYLE: 10, + SET_STROKE_STYLE: 11, + STROKE: 12 +}; +/** + * @type {Array<Instruction>} + */ + +var fillInstruction = [Instruction.FILL]; +/** + * @type {Array<Instruction>} + */ + +exports.fillInstruction = fillInstruction; +var strokeInstruction = [Instruction.STROKE]; +/** + * @type {Array<Instruction>} + */ + +exports.strokeInstruction = strokeInstruction; +var beginPathInstruction = [Instruction.BEGIN_PATH]; +/** + * @type {Array<Instruction>} + */ + +exports.beginPathInstruction = beginPathInstruction; +var closePathInstruction = [Instruction.CLOSE_PATH]; +exports.closePathInstruction = closePathInstruction; +var _default = Instruction; +exports.default = _default; +},{}],"../../../node_modules/ol/render/VectorContext.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/render/VectorContext + */ + +/** + * @classdesc + * Context for drawing geometries. A vector context is available on render + * events and does not need to be constructed directly. + * @api + */ +var VectorContext = +/** @class */ +function () { + function VectorContext() {} + /** + * Render a geometry with a custom renderer. + * + * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {Function} renderer Renderer. + */ + + + VectorContext.prototype.drawCustom = function (geometry, feature, renderer) {}; + /** + * Render a geometry. + * + * @param {import("../geom/Geometry.js").default} geometry The geometry to render. + */ + + + VectorContext.prototype.drawGeometry = function (geometry) {}; + /** + * Set the rendering style. + * + * @param {import("../style/Style.js").default} style The rendering style. + */ + + + VectorContext.prototype.setStyle = function (style) {}; + /** + * @param {import("../geom/Circle.js").default} circleGeometry Circle geometry. + * @param {import("../Feature.js").default} feature Feature. + */ + + + VectorContext.prototype.drawCircle = function (circleGeometry, feature) {}; + /** + * @param {import("../Feature.js").default} feature Feature. + * @param {import("../style/Style.js").default} style Style. + */ + + + VectorContext.prototype.drawFeature = function (feature, style) {}; + /** + * @param {import("../geom/GeometryCollection.js").default} geometryCollectionGeometry Geometry collection. + * @param {import("../Feature.js").default} feature Feature. + */ + + + VectorContext.prototype.drawGeometryCollection = function (geometryCollectionGeometry, feature) {}; + /** + * @param {import("../geom/LineString.js").default|import("./Feature.js").default} lineStringGeometry Line string geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawLineString = function (lineStringGeometry, feature) {}; + /** + * @param {import("../geom/MultiLineString.js").default|import("./Feature.js").default} multiLineStringGeometry MultiLineString geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) {}; + /** + * @param {import("../geom/MultiPoint.js").default|import("./Feature.js").default} multiPointGeometry MultiPoint geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawMultiPoint = function (multiPointGeometry, feature) {}; + /** + * @param {import("../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) {}; + /** + * @param {import("../geom/Point.js").default|import("./Feature.js").default} pointGeometry Point geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawPoint = function (pointGeometry, feature) {}; + /** + * @param {import("../geom/Polygon.js").default|import("./Feature.js").default} polygonGeometry Polygon geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawPolygon = function (polygonGeometry, feature) {}; + /** + * @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + + VectorContext.prototype.drawText = function (geometry, feature) {}; + /** + * @param {import("../style/Fill.js").default} fillStyle Fill style. + * @param {import("../style/Stroke.js").default} strokeStyle Stroke style. + */ + + + VectorContext.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {}; + /** + * @param {import("../style/Image.js").default} imageStyle Image style. + * @param {import("./canvas.js").DeclutterGroup=} opt_declutterGroup Declutter. + */ + + + VectorContext.prototype.setImageStyle = function (imageStyle, opt_declutterGroup) {}; + /** + * @param {import("../style/Text.js").default} textStyle Text style. + * @param {import("./canvas.js").DeclutterGroups=} opt_declutterGroups Declutter. + */ + + + VectorContext.prototype.setTextStyle = function (textStyle, opt_declutterGroups) {}; + + return VectorContext; +}(); + +var _default = VectorContext; +exports.default = _default; +},{}],"../../../node_modules/ol/render/canvas/Builder.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Instruction = _interopRequireDefault(require("./Instruction.js")); + +var _GeometryType = _interopRequireDefault(require("../../geom/GeometryType.js")); + +var _Relationship = _interopRequireDefault(require("../../extent/Relationship.js")); + +var _VectorContext = _interopRequireDefault(require("../VectorContext.js")); + +var _colorlike = require("../../colorlike.js"); + +var _extent = require("../../extent.js"); + +var _canvas = require("../canvas.js"); + +var _array = require("../../array.js"); + +var _inflate = require("../../geom/flat/inflate.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/render/canvas/Builder + */ + + +/** + * @typedef {Object} SerializableInstructions + * @property {Array<*>} instructions The rendering instructions. + * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions. + * @property {Array<number>} coordinates The array of all coordinates. + * @property {!Object<string, import("../canvas.js").TextState>} [textStates] The text states (decluttering). + * @property {!Object<string, import("../canvas.js").FillState>} [fillStates] The fill states (decluttering). + * @property {!Object<string, import("../canvas.js").StrokeState>} [strokeStates] The stroke states (decluttering). + */ +var CanvasBuilder = +/** @class */ +function (_super) { + __extends(CanvasBuilder, _super); + /** + * @param {number} tolerance Tolerance. + * @param {import("../../extent.js").Extent} maxExtent Maximum extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + */ + + + function CanvasBuilder(tolerance, maxExtent, resolution, pixelRatio) { + var _this = _super.call(this) || this; + /** + * @protected + * @type {number} + */ + + + _this.tolerance = tolerance; + /** + * @protected + * @const + * @type {import("../../extent.js").Extent} + */ + + _this.maxExtent = maxExtent; + /** + * @protected + * @type {number} + */ + + _this.pixelRatio = pixelRatio; + /** + * @protected + * @type {number} + */ + + _this.maxLineWidth = 0; + /** + * @protected + * @const + * @type {number} + */ + + _this.resolution = resolution; + /** + * @private + * @type {Array<*>} + */ + + _this.beginGeometryInstruction1_ = null; + /** + * @private + * @type {Array<*>} + */ + + _this.beginGeometryInstruction2_ = null; + /** + * @private + * @type {import("../../extent.js").Extent} + */ + + _this.bufferedMaxExtent_ = null; + /** + * @protected + * @type {Array<*>} + */ + + _this.instructions = []; + /** + * @protected + * @type {Array<number>} + */ + + _this.coordinates = []; + /** + * @private + * @type {import("../../coordinate.js").Coordinate} + */ + + _this.tmpCoordinate_ = []; + /** + * @protected + * @type {Array<*>} + */ + + _this.hitDetectionInstructions = []; + /** + * @protected + * @type {import("../canvas.js").FillStrokeState} + */ + + _this.state = + /** @type {import("../canvas.js").FillStrokeState} */ + {}; + return _this; + } + /** + * @protected + * @param {Array<number>} dashArray Dash array. + * @return {Array<number>} Dash array with pixel ratio applied + */ + + + CanvasBuilder.prototype.applyPixelRatio = function (dashArray) { + var pixelRatio = this.pixelRatio; + return pixelRatio == 1 ? dashArray : dashArray.map(function (dash) { + return dash * pixelRatio; + }); + }; + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {boolean} closed Last input coordinate equals first. + * @param {boolean} skipFirst Skip first coordinate. + * @protected + * @return {number} My end. + */ + + + CanvasBuilder.prototype.appendFlatCoordinates = function (flatCoordinates, offset, end, stride, closed, skipFirst) { + var myEnd = this.coordinates.length; + var extent = this.getBufferedMaxExtent(); + + if (skipFirst) { + offset += stride; + } + + var lastXCoord = flatCoordinates[offset]; + var lastYCoord = flatCoordinates[offset + 1]; + var nextCoord = this.tmpCoordinate_; + var skipped = true; + var i, lastRel, nextRel; + + for (i = offset + stride; i < end; i += stride) { + nextCoord[0] = flatCoordinates[i]; + nextCoord[1] = flatCoordinates[i + 1]; + nextRel = (0, _extent.coordinateRelationship)(extent, nextCoord); + + if (nextRel !== lastRel) { + if (skipped) { + this.coordinates[myEnd++] = lastXCoord; + this.coordinates[myEnd++] = lastYCoord; + } + + this.coordinates[myEnd++] = nextCoord[0]; + this.coordinates[myEnd++] = nextCoord[1]; + skipped = false; + } else if (nextRel === _Relationship.default.INTERSECTING) { + this.coordinates[myEnd++] = nextCoord[0]; + this.coordinates[myEnd++] = nextCoord[1]; + skipped = false; + } else { + skipped = true; + } + + lastXCoord = nextCoord[0]; + lastYCoord = nextCoord[1]; + lastRel = nextRel; + } // Last coordinate equals first or only one point to append: + + + if (closed && skipped || i === offset + stride) { + this.coordinates[myEnd++] = lastXCoord; + this.coordinates[myEnd++] = lastYCoord; + } + + return myEnd; + }; + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @param {Array<number>} builderEnds Builder ends. + * @return {number} Offset. + */ + + + CanvasBuilder.prototype.drawCustomCoordinates_ = function (flatCoordinates, offset, ends, stride, builderEnds) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var builderEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false); + builderEnds.push(builderEnd); + offset = end; + } + + return offset; + }; + /** + * @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + * @param {Function} renderer Renderer. + */ + + + CanvasBuilder.prototype.drawCustom = function (geometry, feature, renderer) { + this.beginGeometry(geometry, feature); + var type = geometry.getType(); + var stride = geometry.getStride(); + var builderBegin = this.coordinates.length; + var flatCoordinates, builderEnd, builderEnds, builderEndss; + var offset; + + if (type == _GeometryType.default.MULTI_POLYGON) { + flatCoordinates = + /** @type {import("../../geom/MultiPolygon.js").default} */ + geometry.getOrientedFlatCoordinates(); + builderEndss = []; + var endss = + /** @type {import("../../geom/MultiPolygon.js").default} */ + geometry.getEndss(); + offset = 0; + + for (var i = 0, ii = endss.length; i < ii; ++i) { + var myEnds = []; + offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds); + builderEndss.push(myEnds); + } + + this.instructions.push([_Instruction.default.CUSTOM, builderBegin, builderEndss, geometry, renderer, _inflate.inflateMultiCoordinatesArray]); + } else if (type == _GeometryType.default.POLYGON || type == _GeometryType.default.MULTI_LINE_STRING) { + builderEnds = []; + flatCoordinates = type == _GeometryType.default.POLYGON ? + /** @type {import("../../geom/Polygon.js").default} */ + geometry.getOrientedFlatCoordinates() : geometry.getFlatCoordinates(); + offset = this.drawCustomCoordinates_(flatCoordinates, 0, + /** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ + geometry.getEnds(), stride, builderEnds); + this.instructions.push([_Instruction.default.CUSTOM, builderBegin, builderEnds, geometry, renderer, _inflate.inflateCoordinatesArray]); + } else if (type == _GeometryType.default.LINE_STRING || type == _GeometryType.default.MULTI_POINT) { + flatCoordinates = geometry.getFlatCoordinates(); + builderEnd = this.appendFlatCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false); + this.instructions.push([_Instruction.default.CUSTOM, builderBegin, builderEnd, geometry, renderer, _inflate.inflateCoordinates]); + } else if (type == _GeometryType.default.POINT) { + flatCoordinates = geometry.getFlatCoordinates(); + this.coordinates.push(flatCoordinates[0], flatCoordinates[1]); + builderEnd = this.coordinates.length; + this.instructions.push([_Instruction.default.CUSTOM, builderBegin, builderEnd, geometry, renderer]); + } + + this.endGeometry(feature); + }; + /** + * @protected + * @param {import("../../geom/Geometry").default|import("../Feature.js").default} geometry The geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasBuilder.prototype.beginGeometry = function (geometry, feature) { + var extent = geometry.getExtent(); + this.beginGeometryInstruction1_ = [_Instruction.default.BEGIN_GEOMETRY, feature, 0, extent]; + this.instructions.push(this.beginGeometryInstruction1_); + this.beginGeometryInstruction2_ = [_Instruction.default.BEGIN_GEOMETRY, feature, 0, extent]; + this.hitDetectionInstructions.push(this.beginGeometryInstruction2_); + }; + /** + * @return {SerializableInstructions} the serializable instructions. + */ + + + CanvasBuilder.prototype.finish = function () { + return { + instructions: this.instructions, + hitDetectionInstructions: this.hitDetectionInstructions, + coordinates: this.coordinates + }; + }; + /** + * Reverse the hit detection instructions. + */ + + + CanvasBuilder.prototype.reverseHitDetectionInstructions = function () { + var hitDetectionInstructions = this.hitDetectionInstructions; // step 1 - reverse array + + hitDetectionInstructions.reverse(); // step 2 - reverse instructions within geometry blocks + + var i; + var n = hitDetectionInstructions.length; + var instruction; + var type; + var begin = -1; + + for (i = 0; i < n; ++i) { + instruction = hitDetectionInstructions[i]; + type = + /** @type {import("./Instruction.js").default} */ + instruction[0]; + + if (type == _Instruction.default.END_GEOMETRY) { + begin = i; + } else if (type == _Instruction.default.BEGIN_GEOMETRY) { + instruction[2] = i; + (0, _array.reverseSubArray)(this.hitDetectionInstructions, begin, i); + begin = -1; + } + } + }; + /** + * @param {import("../../style/Fill.js").default} fillStyle Fill style. + * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style. + */ + + + CanvasBuilder.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) { + var state = this.state; + + if (fillStyle) { + var fillStyleColor = fillStyle.getColor(); + state.fillStyle = (0, _colorlike.asColorLike)(fillStyleColor ? fillStyleColor : _canvas.defaultFillStyle); + } else { + state.fillStyle = undefined; + } + + if (strokeStyle) { + var strokeStyleColor = strokeStyle.getColor(); + state.strokeStyle = (0, _colorlike.asColorLike)(strokeStyleColor ? strokeStyleColor : _canvas.defaultStrokeStyle); + var strokeStyleLineCap = strokeStyle.getLineCap(); + state.lineCap = strokeStyleLineCap !== undefined ? strokeStyleLineCap : _canvas.defaultLineCap; + var strokeStyleLineDash = strokeStyle.getLineDash(); + state.lineDash = strokeStyleLineDash ? strokeStyleLineDash.slice() : _canvas.defaultLineDash; + var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset(); + state.lineDashOffset = strokeStyleLineDashOffset ? strokeStyleLineDashOffset : _canvas.defaultLineDashOffset; + var strokeStyleLineJoin = strokeStyle.getLineJoin(); + state.lineJoin = strokeStyleLineJoin !== undefined ? strokeStyleLineJoin : _canvas.defaultLineJoin; + var strokeStyleWidth = strokeStyle.getWidth(); + state.lineWidth = strokeStyleWidth !== undefined ? strokeStyleWidth : _canvas.defaultLineWidth; + var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); + state.miterLimit = strokeStyleMiterLimit !== undefined ? strokeStyleMiterLimit : _canvas.defaultMiterLimit; + + if (state.lineWidth > this.maxLineWidth) { + this.maxLineWidth = state.lineWidth; // invalidate the buffered max extent cache + + this.bufferedMaxExtent_ = null; + } + } else { + state.strokeStyle = undefined; + state.lineCap = undefined; + state.lineDash = null; + state.lineDashOffset = undefined; + state.lineJoin = undefined; + state.lineWidth = undefined; + state.miterLimit = undefined; + } + }; + /** + * @param {import("../canvas.js").FillStrokeState} state State. + * @return {Array<*>} Fill instruction. + */ + + + CanvasBuilder.prototype.createFill = function (state) { + var fillStyle = state.fillStyle; + /** @type {Array<*>} */ + + var fillInstruction = [_Instruction.default.SET_FILL_STYLE, fillStyle]; + + if (typeof fillStyle !== 'string') { + // Fill is a pattern or gradient - align it! + fillInstruction.push(true); + } + + return fillInstruction; + }; + /** + * @param {import("../canvas.js").FillStrokeState} state State. + */ + + + CanvasBuilder.prototype.applyStroke = function (state) { + this.instructions.push(this.createStroke(state)); + }; + /** + * @param {import("../canvas.js").FillStrokeState} state State. + * @return {Array<*>} Stroke instruction. + */ + + + CanvasBuilder.prototype.createStroke = function (state) { + return [_Instruction.default.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth * this.pixelRatio, state.lineCap, state.lineJoin, state.miterLimit, this.applyPixelRatio(state.lineDash), state.lineDashOffset * this.pixelRatio]; + }; + /** + * @param {import("../canvas.js").FillStrokeState} state State. + * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill. + */ + + + CanvasBuilder.prototype.updateFillStyle = function (state, createFill) { + var fillStyle = state.fillStyle; + + if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) { + if (fillStyle !== undefined) { + this.instructions.push(createFill.call(this, state)); + } + + state.currentFillStyle = fillStyle; + } + }; + /** + * @param {import("../canvas.js").FillStrokeState} state State. + * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState): void} applyStroke Apply stroke. + */ + + + CanvasBuilder.prototype.updateStrokeStyle = function (state, applyStroke) { + var strokeStyle = state.strokeStyle; + var lineCap = state.lineCap; + var lineDash = state.lineDash; + var lineDashOffset = state.lineDashOffset; + var lineJoin = state.lineJoin; + var lineWidth = state.lineWidth; + var miterLimit = state.miterLimit; + + if (state.currentStrokeStyle != strokeStyle || state.currentLineCap != lineCap || lineDash != state.currentLineDash && !(0, _array.equals)(state.currentLineDash, lineDash) || state.currentLineDashOffset != lineDashOffset || state.currentLineJoin != lineJoin || state.currentLineWidth != lineWidth || state.currentMiterLimit != miterLimit) { + if (strokeStyle !== undefined) { + applyStroke.call(this, state); + } + + state.currentStrokeStyle = strokeStyle; + state.currentLineCap = lineCap; + state.currentLineDash = lineDash; + state.currentLineDashOffset = lineDashOffset; + state.currentLineJoin = lineJoin; + state.currentLineWidth = lineWidth; + state.currentMiterLimit = miterLimit; + } + }; + /** + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasBuilder.prototype.endGeometry = function (feature) { + this.beginGeometryInstruction1_[2] = this.instructions.length; + this.beginGeometryInstruction1_ = null; + this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length; + this.beginGeometryInstruction2_ = null; + var endGeometryInstruction = [_Instruction.default.END_GEOMETRY, feature]; + this.instructions.push(endGeometryInstruction); + this.hitDetectionInstructions.push(endGeometryInstruction); + }; + /** + * Get the buffered rendering extent. Rendering will be clipped to the extent + * provided to the constructor. To account for symbolizers that may intersect + * this extent, we calculate a buffered extent (e.g. based on stroke width). + * @return {import("../../extent.js").Extent} The buffered rendering extent. + * @protected + */ + + + CanvasBuilder.prototype.getBufferedMaxExtent = function () { + if (!this.bufferedMaxExtent_) { + this.bufferedMaxExtent_ = (0, _extent.clone)(this.maxExtent); + + if (this.maxLineWidth > 0) { + var width = this.resolution * (this.maxLineWidth + 1) / 2; + (0, _extent.buffer)(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_); + } + } + + return this.bufferedMaxExtent_; + }; + + return CanvasBuilder; +}(_VectorContext.default); + +var _default = CanvasBuilder; +exports.default = _default; +},{"./Instruction.js":"../../../node_modules/ol/render/canvas/Instruction.js","../../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../../extent/Relationship.js":"../../../node_modules/ol/extent/Relationship.js","../VectorContext.js":"../../../node_modules/ol/render/VectorContext.js","../../colorlike.js":"../../../node_modules/ol/colorlike.js","../../extent.js":"../../../node_modules/ol/extent.js","../canvas.js":"../../../node_modules/ol/render/canvas.js","../../array.js":"../../../node_modules/ol/array.js","../../geom/flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js"}],"../../../node_modules/ol/render/canvas/ImageBuilder.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Builder = _interopRequireDefault(require("./Builder.js")); + +var _Instruction = _interopRequireDefault(require("./Instruction.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/render/canvas/ImageBuilder + */ + + +var CanvasImageBuilder = +/** @class */ +function (_super) { + __extends(CanvasImageBuilder, _super); + /** + * @param {number} tolerance Tolerance. + * @param {import("../../extent.js").Extent} maxExtent Maximum extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + */ + + + function CanvasImageBuilder(tolerance, maxExtent, resolution, pixelRatio) { + var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this; + /** + * @private + * @type {import("../canvas.js").DeclutterGroups} + */ + + + _this.declutterGroups_ = null; + /** + * @private + * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} + */ + + _this.hitDetectionImage_ = null; + /** + * @private + * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} + */ + + _this.image_ = null; + /** + * @private + * @type {number|undefined} + */ + + _this.imagePixelRatio_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.anchorX_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.anchorY_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.height_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.opacity_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.originX_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.originY_ = undefined; + /** + * @private + * @type {boolean|undefined} + */ + + _this.rotateWithView_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.rotation_ = undefined; + /** + * @private + * @type {import("../../size.js").Size|undefined} + */ + + _this.scale_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.width_ = undefined; + return _this; + } + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @private + * @return {number} My end. + */ + + + CanvasImageBuilder.prototype.drawCoordinates_ = function (flatCoordinates, offset, end, stride) { + return this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false); + }; + /** + * @param {import("../../geom/Point.js").default|import("../Feature.js").default} pointGeometry Point geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasImageBuilder.prototype.drawPoint = function (pointGeometry, feature) { + if (!this.image_) { + return; + } + + this.beginGeometry(pointGeometry, feature); + var flatCoordinates = pointGeometry.getFlatCoordinates(); + var stride = pointGeometry.getStride(); + var myBegin = this.coordinates.length; + var myEnd = this.drawCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride); + this.instructions.push([_Instruction.default.DRAW_IMAGE, myBegin, myEnd, this.image_, // Remaining arguments to DRAW_IMAGE are in alphabetical order + this.anchorX_ * this.imagePixelRatio_, this.anchorY_ * this.imagePixelRatio_, this.declutterGroups_, Math.ceil(this.height_ * this.imagePixelRatio_), this.opacity_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_, [this.scale_[0] * this.pixelRatio / this.imagePixelRatio_, this.scale_[1] * this.pixelRatio / this.imagePixelRatio_], Math.ceil(this.width_ * this.imagePixelRatio_)]); + this.hitDetectionInstructions.push([_Instruction.default.DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_, // Remaining arguments to DRAW_IMAGE are in alphabetical order + this.anchorX_, this.anchorY_, this.declutterGroups_, this.height_, this.opacity_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.scale_, this.width_]); + this.endGeometry(feature); + }; + /** + * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} multiPointGeometry MultiPoint geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasImageBuilder.prototype.drawMultiPoint = function (multiPointGeometry, feature) { + if (!this.image_) { + return; + } + + this.beginGeometry(multiPointGeometry, feature); + var flatCoordinates = multiPointGeometry.getFlatCoordinates(); + var stride = multiPointGeometry.getStride(); + var myBegin = this.coordinates.length; + var myEnd = this.drawCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride); + this.instructions.push([_Instruction.default.DRAW_IMAGE, myBegin, myEnd, this.image_, // Remaining arguments to DRAW_IMAGE are in alphabetical order + this.anchorX_ * this.imagePixelRatio_, this.anchorY_ * this.imagePixelRatio_, this.declutterGroups_, Math.ceil(this.height_ * this.imagePixelRatio_), this.opacity_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_, [this.scale_[0] * this.pixelRatio / this.imagePixelRatio_, this.scale_[1] * this.pixelRatio / this.imagePixelRatio_], Math.ceil(this.width_ * this.imagePixelRatio_)]); + this.hitDetectionInstructions.push([_Instruction.default.DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_, // Remaining arguments to DRAW_IMAGE are in alphabetical order + this.anchorX_, this.anchorY_, this.declutterGroups_, this.height_, this.opacity_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.scale_, this.width_]); + this.endGeometry(feature); + }; + /** + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. + */ + + + CanvasImageBuilder.prototype.finish = function () { + this.reverseHitDetectionInstructions(); // FIXME this doesn't really protect us against further calls to draw*Geometry + + this.anchorX_ = undefined; + this.anchorY_ = undefined; + this.hitDetectionImage_ = null; + this.image_ = null; + this.imagePixelRatio_ = undefined; + this.height_ = undefined; + this.scale_ = undefined; + this.opacity_ = undefined; + this.originX_ = undefined; + this.originY_ = undefined; + this.rotateWithView_ = undefined; + this.rotation_ = undefined; + this.width_ = undefined; + return _super.prototype.finish.call(this); + }; + /** + * @param {import("../../style/Image.js").default} imageStyle Image style. + * @param {import("../canvas.js").DeclutterGroup} declutterGroups Declutter. + */ + + + CanvasImageBuilder.prototype.setImageStyle = function (imageStyle, declutterGroups) { + var anchor = imageStyle.getAnchor(); + var size = imageStyle.getSize(); + var hitDetectionImage = imageStyle.getHitDetectionImage(); + var image = imageStyle.getImage(this.pixelRatio); + var origin = imageStyle.getOrigin(); + this.imagePixelRatio_ = imageStyle.getPixelRatio(this.pixelRatio); + this.anchorX_ = anchor[0]; + this.anchorY_ = anchor[1]; + this.declutterGroups_ = declutterGroups; + this.hitDetectionImage_ = hitDetectionImage; + this.image_ = image; + this.height_ = size[1]; + this.opacity_ = imageStyle.getOpacity(); + this.originX_ = origin[0]; + this.originY_ = origin[1]; + this.rotateWithView_ = imageStyle.getRotateWithView(); + this.rotation_ = imageStyle.getRotation(); + this.scale_ = imageStyle.getScaleArray(); + this.width_ = size[0]; + }; + + return CanvasImageBuilder; +}(_Builder.default); + +var _default = CanvasImageBuilder; +exports.default = _default; +},{"./Builder.js":"../../../node_modules/ol/render/canvas/Builder.js","./Instruction.js":"../../../node_modules/ol/render/canvas/Instruction.js"}],"../../../node_modules/ol/render/canvas/LineStringBuilder.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Builder = _interopRequireDefault(require("./Builder.js")); + +var _Instruction = _interopRequireWildcard(require("./Instruction.js")); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/render/canvas/LineStringBuilder + */ + + +var CanvasLineStringBuilder = +/** @class */ +function (_super) { + __extends(CanvasLineStringBuilder, _super); + /** + * @param {number} tolerance Tolerance. + * @param {import("../../extent.js").Extent} maxExtent Maximum extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + */ + + + function CanvasLineStringBuilder(tolerance, maxExtent, resolution, pixelRatio) { + return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this; + } + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @private + * @return {number} end. + */ + + + CanvasLineStringBuilder.prototype.drawFlatCoordinates_ = function (flatCoordinates, offset, end, stride) { + var myBegin = this.coordinates.length; + var myEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false); + var moveToLineToInstruction = [_Instruction.default.MOVE_TO_LINE_TO, myBegin, myEnd]; + this.instructions.push(moveToLineToInstruction); + this.hitDetectionInstructions.push(moveToLineToInstruction); + return end; + }; + /** + * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} lineStringGeometry Line string geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasLineStringBuilder.prototype.drawLineString = function (lineStringGeometry, feature) { + var state = this.state; + var strokeStyle = state.strokeStyle; + var lineWidth = state.lineWidth; + + if (strokeStyle === undefined || lineWidth === undefined) { + return; + } + + this.updateStrokeStyle(state, this.applyStroke); + this.beginGeometry(lineStringGeometry, feature); + this.hitDetectionInstructions.push([_Instruction.default.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset], _Instruction.beginPathInstruction); + var flatCoordinates = lineStringGeometry.getFlatCoordinates(); + var stride = lineStringGeometry.getStride(); + this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride); + this.hitDetectionInstructions.push(_Instruction.strokeInstruction); + this.endGeometry(feature); + }; + /** + * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} multiLineStringGeometry MultiLineString geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasLineStringBuilder.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) { + var state = this.state; + var strokeStyle = state.strokeStyle; + var lineWidth = state.lineWidth; + + if (strokeStyle === undefined || lineWidth === undefined) { + return; + } + + this.updateStrokeStyle(state, this.applyStroke); + this.beginGeometry(multiLineStringGeometry, feature); + this.hitDetectionInstructions.push([_Instruction.default.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset], _Instruction.beginPathInstruction); + var ends = multiLineStringGeometry.getEnds(); + var flatCoordinates = multiLineStringGeometry.getFlatCoordinates(); + var stride = multiLineStringGeometry.getStride(); + var offset = 0; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + offset = this.drawFlatCoordinates_(flatCoordinates, offset, + /** @type {number} */ + ends[i], stride); + } + + this.hitDetectionInstructions.push(_Instruction.strokeInstruction); + this.endGeometry(feature); + }; + /** + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. + */ + + + CanvasLineStringBuilder.prototype.finish = function () { + var state = this.state; + + if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { + this.instructions.push(_Instruction.strokeInstruction); + } + + this.reverseHitDetectionInstructions(); + this.state = null; + return _super.prototype.finish.call(this); + }; + /** + * @param {import("../canvas.js").FillStrokeState} state State. + */ + + + CanvasLineStringBuilder.prototype.applyStroke = function (state) { + if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { + this.instructions.push(_Instruction.strokeInstruction); + state.lastStroke = this.coordinates.length; + } + + state.lastStroke = 0; + + _super.prototype.applyStroke.call(this, state); + + this.instructions.push(_Instruction.beginPathInstruction); + }; + + return CanvasLineStringBuilder; +}(_Builder.default); + +var _default = CanvasLineStringBuilder; +exports.default = _default; +},{"./Builder.js":"../../../node_modules/ol/render/canvas/Builder.js","./Instruction.js":"../../../node_modules/ol/render/canvas/Instruction.js"}],"../../../node_modules/ol/render/canvas/PolygonBuilder.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Builder = _interopRequireDefault(require("./Builder.js")); + +var _Instruction = _interopRequireWildcard(require("./Instruction.js")); + +var _canvas = require("../canvas.js"); + +var _simplify = require("../../geom/flat/simplify.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/render/canvas/PolygonBuilder + */ + + +var CanvasPolygonBuilder = +/** @class */ +function (_super) { + __extends(CanvasPolygonBuilder, _super); + /** + * @param {number} tolerance Tolerance. + * @param {import("../../extent.js").Extent} maxExtent Maximum extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + */ + + + function CanvasPolygonBuilder(tolerance, maxExtent, resolution, pixelRatio) { + return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this; + } + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @private + * @return {number} End. + */ + + + CanvasPolygonBuilder.prototype.drawFlatCoordinatess_ = function (flatCoordinates, offset, ends, stride) { + var state = this.state; + var fill = state.fillStyle !== undefined; + var stroke = state.strokeStyle !== undefined; + var numEnds = ends.length; + this.instructions.push(_Instruction.beginPathInstruction); + this.hitDetectionInstructions.push(_Instruction.beginPathInstruction); + + for (var i = 0; i < numEnds; ++i) { + var end = ends[i]; + var myBegin = this.coordinates.length; + var myEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, true, !stroke); + var moveToLineToInstruction = [_Instruction.default.MOVE_TO_LINE_TO, myBegin, myEnd]; + this.instructions.push(moveToLineToInstruction); + this.hitDetectionInstructions.push(moveToLineToInstruction); + + if (stroke) { + // Performance optimization: only call closePath() when we have a stroke. + // Otherwise the ring is closed already (see appendFlatCoordinates above). + this.instructions.push(_Instruction.closePathInstruction); + this.hitDetectionInstructions.push(_Instruction.closePathInstruction); + } + + offset = end; + } + + if (fill) { + this.instructions.push(_Instruction.fillInstruction); + this.hitDetectionInstructions.push(_Instruction.fillInstruction); + } + + if (stroke) { + this.instructions.push(_Instruction.strokeInstruction); + this.hitDetectionInstructions.push(_Instruction.strokeInstruction); + } + + return offset; + }; + /** + * @param {import("../../geom/Circle.js").default} circleGeometry Circle geometry. + * @param {import("../../Feature.js").default} feature Feature. + */ + + + CanvasPolygonBuilder.prototype.drawCircle = function (circleGeometry, feature) { + var state = this.state; + var fillStyle = state.fillStyle; + var strokeStyle = state.strokeStyle; + + if (fillStyle === undefined && strokeStyle === undefined) { + return; + } + + this.setFillStrokeStyles_(); + this.beginGeometry(circleGeometry, feature); + + if (state.fillStyle !== undefined) { + this.hitDetectionInstructions.push([_Instruction.default.SET_FILL_STYLE, _canvas.defaultFillStyle]); + } + + if (state.strokeStyle !== undefined) { + this.hitDetectionInstructions.push([_Instruction.default.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset]); + } + + var flatCoordinates = circleGeometry.getFlatCoordinates(); + var stride = circleGeometry.getStride(); + var myBegin = this.coordinates.length; + this.appendFlatCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false); + var circleInstruction = [_Instruction.default.CIRCLE, myBegin]; + this.instructions.push(_Instruction.beginPathInstruction, circleInstruction); + this.hitDetectionInstructions.push(_Instruction.beginPathInstruction, circleInstruction); + + if (state.fillStyle !== undefined) { + this.instructions.push(_Instruction.fillInstruction); + this.hitDetectionInstructions.push(_Instruction.fillInstruction); + } + + if (state.strokeStyle !== undefined) { + this.instructions.push(_Instruction.strokeInstruction); + this.hitDetectionInstructions.push(_Instruction.strokeInstruction); + } + + this.endGeometry(feature); + }; + /** + * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} polygonGeometry Polygon geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasPolygonBuilder.prototype.drawPolygon = function (polygonGeometry, feature) { + var state = this.state; + var fillStyle = state.fillStyle; + var strokeStyle = state.strokeStyle; + + if (fillStyle === undefined && strokeStyle === undefined) { + return; + } + + this.setFillStrokeStyles_(); + this.beginGeometry(polygonGeometry, feature); + + if (state.fillStyle !== undefined) { + this.hitDetectionInstructions.push([_Instruction.default.SET_FILL_STYLE, _canvas.defaultFillStyle]); + } + + if (state.strokeStyle !== undefined) { + this.hitDetectionInstructions.push([_Instruction.default.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset]); + } + + var ends = polygonGeometry.getEnds(); + var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates(); + var stride = polygonGeometry.getStride(); + this.drawFlatCoordinatess_(flatCoordinates, 0, + /** @type {Array<number>} */ + ends, stride); + this.endGeometry(feature); + }; + /** + * @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasPolygonBuilder.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) { + var state = this.state; + var fillStyle = state.fillStyle; + var strokeStyle = state.strokeStyle; + + if (fillStyle === undefined && strokeStyle === undefined) { + return; + } + + this.setFillStrokeStyles_(); + this.beginGeometry(multiPolygonGeometry, feature); + + if (state.fillStyle !== undefined) { + this.hitDetectionInstructions.push([_Instruction.default.SET_FILL_STYLE, _canvas.defaultFillStyle]); + } + + if (state.strokeStyle !== undefined) { + this.hitDetectionInstructions.push([_Instruction.default.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset]); + } + + var endss = multiPolygonGeometry.getEndss(); + var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates(); + var stride = multiPolygonGeometry.getStride(); + var offset = 0; + + for (var i = 0, ii = endss.length; i < ii; ++i) { + offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride); + } + + this.endGeometry(feature); + }; + /** + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. + */ + + + CanvasPolygonBuilder.prototype.finish = function () { + this.reverseHitDetectionInstructions(); + this.state = null; // We want to preserve topology when drawing polygons. Polygons are + // simplified using quantization and point elimination. However, we might + // have received a mix of quantized and non-quantized geometries, so ensure + // that all are quantized by quantizing all coordinates in the batch. + + var tolerance = this.tolerance; + + if (tolerance !== 0) { + var coordinates = this.coordinates; + + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + coordinates[i] = (0, _simplify.snap)(coordinates[i], tolerance); + } + } + + return _super.prototype.finish.call(this); + }; + /** + * @private + */ + + + CanvasPolygonBuilder.prototype.setFillStrokeStyles_ = function () { + var state = this.state; + var fillStyle = state.fillStyle; + + if (fillStyle !== undefined) { + this.updateFillStyle(state, this.createFill); + } + + if (state.strokeStyle !== undefined) { + this.updateStrokeStyle(state, this.applyStroke); + } + }; + + return CanvasPolygonBuilder; +}(_Builder.default); + +var _default = CanvasPolygonBuilder; +exports.default = _default; +},{"./Builder.js":"../../../node_modules/ol/render/canvas/Builder.js","./Instruction.js":"../../../node_modules/ol/render/canvas/Instruction.js","../canvas.js":"../../../node_modules/ol/render/canvas.js","../../geom/flat/simplify.js":"../../../node_modules/ol/geom/flat/simplify.js"}],"../../../node_modules/ol/geom/flat/straightchunk.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.matchingChunk = matchingChunk; + +/** + * @module ol/geom/flat/straightchunk + */ + +/** + * @param {number} maxAngle Maximum acceptable angle delta between segments. + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {Array<number>} Start and end of the first suitable chunk of the + * given `flatCoordinates`. + */ +function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) { + var chunkStart = offset; + var chunkEnd = offset; + var chunkM = 0; + var m = 0; + var start = offset; + var acos, i, m12, m23, x1, y1, x12, y12, x23, y23; + + for (i = offset; i < end; i += stride) { + var x2 = flatCoordinates[i]; + var y2 = flatCoordinates[i + 1]; + + if (x1 !== undefined) { + x23 = x2 - x1; + y23 = y2 - y1; + m23 = Math.sqrt(x23 * x23 + y23 * y23); + + if (x12 !== undefined) { + m += m12; + acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23)); + + if (acos > maxAngle) { + if (m > chunkM) { + chunkM = m; + chunkStart = start; + chunkEnd = i; + } + + m = 0; + start = i - stride; + } + } + + m12 = m23; + x12 = x23; + y12 = y23; + } + + x1 = x2; + y1 = y2; + } + + m += m23; + return m > chunkM ? [start, i] : [chunkStart, chunkEnd]; +} +},{}],"../../../node_modules/ol/render/canvas/TextBuilder.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.TEXT_ALIGN = void 0; + +var _Builder = _interopRequireDefault(require("./Builder.js")); + +var _Instruction = _interopRequireDefault(require("./Instruction.js")); + +var _GeometryType = _interopRequireDefault(require("../../geom/GeometryType.js")); + +var _TextPlacement = _interopRequireDefault(require("../../style/TextPlacement.js")); + +var _colorlike = require("../../colorlike.js"); + +var _canvas = require("../canvas.js"); + +var _util = require("../../util.js"); + +var _extent = require("../../extent.js"); + +var _straightchunk = require("../../geom/flat/straightchunk.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/render/canvas/TextBuilder + */ + + +/** + * @const + * @enum {number} + */ +var TEXT_ALIGN = { + 'left': 0, + 'end': 0, + 'center': 0.5, + 'right': 1, + 'start': 1, + 'top': 0, + 'middle': 0.5, + 'hanging': 0.2, + 'alphabetic': 0.8, + 'ideographic': 0.8, + 'bottom': 1 +}; +exports.TEXT_ALIGN = TEXT_ALIGN; + +var CanvasTextBuilder = +/** @class */ +function (_super) { + __extends(CanvasTextBuilder, _super); + /** + * @param {number} tolerance Tolerance. + * @param {import("../../extent.js").Extent} maxExtent Maximum extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + */ + + + function CanvasTextBuilder(tolerance, maxExtent, resolution, pixelRatio) { + var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this; + /** + * @private + * @type {import("../canvas.js").DeclutterGroups} + */ + + + _this.declutterGroups_; + /** + * @private + * @type {Array<HTMLCanvasElement>} + */ + + _this.labels_ = null; + /** + * @private + * @type {string} + */ + + _this.text_ = ''; + /** + * @private + * @type {number} + */ + + _this.textOffsetX_ = 0; + /** + * @private + * @type {number} + */ + + _this.textOffsetY_ = 0; + /** + * @private + * @type {boolean|undefined} + */ + + _this.textRotateWithView_ = undefined; + /** + * @private + * @type {number} + */ + + _this.textRotation_ = 0; + /** + * @private + * @type {?import("../canvas.js").FillState} + */ + + _this.textFillState_ = null; + /** + * @type {!Object<string, import("../canvas.js").FillState>} + */ + + _this.fillStates = {}; + /** + * @private + * @type {?import("../canvas.js").StrokeState} + */ + + _this.textStrokeState_ = null; + /** + * @type {!Object<string, import("../canvas.js").StrokeState>} + */ + + _this.strokeStates = {}; + /** + * @private + * @type {import("../canvas.js").TextState} + */ + + _this.textState_ = + /** @type {import("../canvas.js").TextState} */ + {}; + /** + * @type {!Object<string, import("../canvas.js").TextState>} + */ + + _this.textStates = {}; + /** + * @private + * @type {string} + */ + + _this.textKey_ = ''; + /** + * @private + * @type {string} + */ + + _this.fillKey_ = ''; + /** + * @private + * @type {string} + */ + + _this.strokeKey_ = ''; + return _this; + } + /** + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. + */ + + + CanvasTextBuilder.prototype.finish = function () { + var instructions = _super.prototype.finish.call(this); + + instructions.textStates = this.textStates; + instructions.fillStates = this.fillStates; + instructions.strokeStates = this.strokeStates; + return instructions; + }; + /** + * @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + */ + + + CanvasTextBuilder.prototype.drawText = function (geometry, feature) { + var fillState = this.textFillState_; + var strokeState = this.textStrokeState_; + var textState = this.textState_; + + if (this.text_ === '' || !textState || !fillState && !strokeState) { + return; + } + + var begin = this.coordinates.length; + var geometryType = geometry.getType(); + var flatCoordinates = null; + var end = 2; + var stride = geometry.getStride(); + var i, ii; + + if (textState.placement === _TextPlacement.default.LINE) { + if (!(0, _extent.intersects)(this.getBufferedMaxExtent(), geometry.getExtent())) { + return; + } + + var ends = void 0; + flatCoordinates = geometry.getFlatCoordinates(); + + if (geometryType == _GeometryType.default.LINE_STRING) { + ends = [flatCoordinates.length]; + } else if (geometryType == _GeometryType.default.MULTI_LINE_STRING) { + ends = + /** @type {import("../../geom/MultiLineString.js").default} */ + geometry.getEnds(); + } else if (geometryType == _GeometryType.default.POLYGON) { + ends = + /** @type {import("../../geom/Polygon.js").default} */ + geometry.getEnds().slice(0, 1); + } else if (geometryType == _GeometryType.default.MULTI_POLYGON) { + var endss = + /** @type {import("../../geom/MultiPolygon.js").default} */ + geometry.getEndss(); + ends = []; + + for (i = 0, ii = endss.length; i < ii; ++i) { + ends.push(endss[i][0]); + } + } + + this.beginGeometry(geometry, feature); + var textAlign = textState.textAlign; + var flatOffset = 0; + var flatEnd = void 0; + + for (var o = 0, oo = ends.length; o < oo; ++o) { + if (textAlign == undefined) { + var range = (0, _straightchunk.matchingChunk)(textState.maxAngle, flatCoordinates, flatOffset, ends[o], stride); + flatOffset = range[0]; + flatEnd = range[1]; + } else { + flatEnd = ends[o]; + } + + for (i = flatOffset; i < flatEnd; i += stride) { + this.coordinates.push(flatCoordinates[i], flatCoordinates[i + 1]); + } + + end = this.coordinates.length; + flatOffset = ends[o]; + var declutterGroup = this.declutterGroups_ ? o === 0 ? this.declutterGroups_[0] : [].concat(this.declutterGroups_[0]) : null; + this.drawChars_(begin, end, declutterGroup); + begin = end; + } + + this.endGeometry(feature); + } else { + var geometryWidths = null; + + if (!textState.overflow) { + geometryWidths = []; + } + + switch (geometryType) { + case _GeometryType.default.POINT: + case _GeometryType.default.MULTI_POINT: + flatCoordinates = + /** @type {import("../../geom/MultiPoint.js").default} */ + geometry.getFlatCoordinates(); + end = flatCoordinates.length; + break; + + case _GeometryType.default.LINE_STRING: + flatCoordinates = + /** @type {import("../../geom/LineString.js").default} */ + geometry.getFlatMidpoint(); + break; + + case _GeometryType.default.CIRCLE: + flatCoordinates = + /** @type {import("../../geom/Circle.js").default} */ + geometry.getCenter(); + break; + + case _GeometryType.default.MULTI_LINE_STRING: + flatCoordinates = + /** @type {import("../../geom/MultiLineString.js").default} */ + geometry.getFlatMidpoints(); + stride = 2; + end = flatCoordinates.length; + break; + + case _GeometryType.default.POLYGON: + flatCoordinates = + /** @type {import("../../geom/Polygon.js").default} */ + geometry.getFlatInteriorPoint(); + + if (!textState.overflow) { + geometryWidths.push(flatCoordinates[2] / this.resolution); + } + + stride = 3; + break; + + case _GeometryType.default.MULTI_POLYGON: + var interiorPoints = + /** @type {import("../../geom/MultiPolygon.js").default} */ + geometry.getFlatInteriorPoints(); + flatCoordinates = []; + + for (i = 0, ii = interiorPoints.length; i < ii; i += 3) { + if (!textState.overflow) { + geometryWidths.push(interiorPoints[i + 2] / this.resolution); + } + + flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]); + } + + stride = 2; + end = flatCoordinates.length; + + if (end == 0) { + return; + } + + break; + + default: + } + + end = this.appendFlatCoordinates(flatCoordinates, 0, end, stride, false, false); + this.saveTextStates_(); + + if (textState.backgroundFill || textState.backgroundStroke) { + this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke); + + if (textState.backgroundFill) { + this.updateFillStyle(this.state, this.createFill); + this.hitDetectionInstructions.push(this.createFill(this.state)); + } + + if (textState.backgroundStroke) { + this.updateStrokeStyle(this.state, this.applyStroke); + this.hitDetectionInstructions.push(this.createStroke(this.state)); + } + } + + this.beginGeometry(geometry, feature); // adjust padding for negative scale + + var padding = textState.padding; + + if (padding != _canvas.defaultPadding && (textState.scale[0] < 0 || textState.scale[1] < 0)) { + var p0 = textState.padding[0]; + var p1 = textState.padding[1]; + var p2 = textState.padding[2]; + var p3 = textState.padding[3]; + + if (textState.scale[0] < 0) { + p1 = -p1; + p3 = -p3; + } + + if (textState.scale[1] < 0) { + p0 = -p0; + p2 = -p2; + } + + padding = [p0, p1, p2, p3]; + } // The image is unknown at this stage so we pass null; it will be computed at render time. + // For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at + // render time. + + + var pixelRatio_1 = this.pixelRatio; + this.instructions.push([_Instruction.default.DRAW_IMAGE, begin, end, null, NaN, NaN, this.declutterGroups_, NaN, 1, 0, 0, this.textRotateWithView_, this.textRotation_, [1, 1], NaN, padding == _canvas.defaultPadding ? _canvas.defaultPadding : padding.map(function (p) { + return p * pixelRatio_1; + }), !!textState.backgroundFill, !!textState.backgroundStroke, this.text_, this.textKey_, this.strokeKey_, this.fillKey_, this.textOffsetX_, this.textOffsetY_, geometryWidths]); + var scale = 1 / pixelRatio_1; + this.hitDetectionInstructions.push([_Instruction.default.DRAW_IMAGE, begin, end, null, NaN, NaN, this.declutterGroups_, NaN, 1, 0, 0, this.textRotateWithView_, this.textRotation_, [scale, scale], NaN, padding, !!textState.backgroundFill, !!textState.backgroundStroke, this.text_, this.textKey_, this.strokeKey_, this.fillKey_, this.textOffsetX_, this.textOffsetY_, geometryWidths]); + this.endGeometry(feature); + } + }; + /** + * @private + */ + + + CanvasTextBuilder.prototype.saveTextStates_ = function () { + var strokeState = this.textStrokeState_; + var textState = this.textState_; + var fillState = this.textFillState_; + var strokeKey = this.strokeKey_; + + if (strokeState) { + if (!(strokeKey in this.strokeStates)) { + this.strokeStates[strokeKey] = { + strokeStyle: strokeState.strokeStyle, + lineCap: strokeState.lineCap, + lineDashOffset: strokeState.lineDashOffset, + lineWidth: strokeState.lineWidth, + lineJoin: strokeState.lineJoin, + miterLimit: strokeState.miterLimit, + lineDash: strokeState.lineDash + }; + } + } + + var textKey = this.textKey_; + + if (!(textKey in this.textStates)) { + this.textStates[textKey] = { + font: textState.font, + textAlign: textState.textAlign || _canvas.defaultTextAlign, + textBaseline: textState.textBaseline || _canvas.defaultTextBaseline, + scale: textState.scale + }; + } + + var fillKey = this.fillKey_; + + if (fillState) { + if (!(fillKey in this.fillStates)) { + this.fillStates[fillKey] = { + fillStyle: fillState.fillStyle + }; + } + } + }; + /** + * @private + * @param {number} begin Begin. + * @param {number} end End. + * @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group. + */ + + + CanvasTextBuilder.prototype.drawChars_ = function (begin, end, declutterGroup) { + var strokeState = this.textStrokeState_; + var textState = this.textState_; + var strokeKey = this.strokeKey_; + var textKey = this.textKey_; + var fillKey = this.fillKey_; + this.saveTextStates_(); + var pixelRatio = this.pixelRatio; + var baseline = TEXT_ALIGN[textState.textBaseline]; + var offsetY = this.textOffsetY_ * pixelRatio; + var text = this.text_; + var strokeWidth = strokeState ? strokeState.lineWidth * Math.abs(textState.scale[0]) / 2 : 0; + this.instructions.push([_Instruction.default.DRAW_CHARS, begin, end, baseline, declutterGroup, textState.overflow, fillKey, textState.maxAngle, pixelRatio, offsetY, strokeKey, strokeWidth * pixelRatio, text, textKey, 1]); + this.hitDetectionInstructions.push([_Instruction.default.DRAW_CHARS, begin, end, baseline, declutterGroup, textState.overflow, fillKey, textState.maxAngle, 1, offsetY, strokeKey, strokeWidth, text, textKey, 1 / pixelRatio]); + }; + /** + * @param {import("../../style/Text.js").default} textStyle Text style. + * @param {import("../canvas.js").DeclutterGroups} declutterGroups Declutter. + */ + + + CanvasTextBuilder.prototype.setTextStyle = function (textStyle, declutterGroups) { + var textState, fillState, strokeState; + + if (!textStyle) { + this.text_ = ''; + } else { + this.declutterGroups_ = declutterGroups; + var textFillStyle = textStyle.getFill(); + + if (!textFillStyle) { + fillState = null; + this.textFillState_ = fillState; + } else { + fillState = this.textFillState_; + + if (!fillState) { + fillState = + /** @type {import("../canvas.js").FillState} */ + {}; + this.textFillState_ = fillState; + } + + fillState.fillStyle = (0, _colorlike.asColorLike)(textFillStyle.getColor() || _canvas.defaultFillStyle); + } + + var textStrokeStyle = textStyle.getStroke(); + + if (!textStrokeStyle) { + strokeState = null; + this.textStrokeState_ = strokeState; + } else { + strokeState = this.textStrokeState_; + + if (!strokeState) { + strokeState = + /** @type {import("../canvas.js").StrokeState} */ + {}; + this.textStrokeState_ = strokeState; + } + + var lineDash = textStrokeStyle.getLineDash(); + var lineDashOffset = textStrokeStyle.getLineDashOffset(); + var lineWidth = textStrokeStyle.getWidth(); + var miterLimit = textStrokeStyle.getMiterLimit(); + strokeState.lineCap = textStrokeStyle.getLineCap() || _canvas.defaultLineCap; + strokeState.lineDash = lineDash ? lineDash.slice() : _canvas.defaultLineDash; + strokeState.lineDashOffset = lineDashOffset === undefined ? _canvas.defaultLineDashOffset : lineDashOffset; + strokeState.lineJoin = textStrokeStyle.getLineJoin() || _canvas.defaultLineJoin; + strokeState.lineWidth = lineWidth === undefined ? _canvas.defaultLineWidth : lineWidth; + strokeState.miterLimit = miterLimit === undefined ? _canvas.defaultMiterLimit : miterLimit; + strokeState.strokeStyle = (0, _colorlike.asColorLike)(textStrokeStyle.getColor() || _canvas.defaultStrokeStyle); + } + + textState = this.textState_; + + var font = textStyle.getFont() || _canvas.defaultFont; + + (0, _canvas.registerFont)(font); + var textScale = textStyle.getScaleArray(); + textState.overflow = textStyle.getOverflow(); + textState.font = font; + textState.maxAngle = textStyle.getMaxAngle(); + textState.placement = textStyle.getPlacement(); + textState.textAlign = textStyle.getTextAlign(); + textState.textBaseline = textStyle.getTextBaseline() || _canvas.defaultTextBaseline; + textState.backgroundFill = textStyle.getBackgroundFill(); + textState.backgroundStroke = textStyle.getBackgroundStroke(); + textState.padding = textStyle.getPadding() || _canvas.defaultPadding; + textState.scale = textScale === undefined ? [1, 1] : textScale; + var textOffsetX = textStyle.getOffsetX(); + var textOffsetY = textStyle.getOffsetY(); + var textRotateWithView = textStyle.getRotateWithView(); + var textRotation = textStyle.getRotation(); + this.text_ = textStyle.getText() || ''; + this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX; + this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY; + this.textRotateWithView_ = textRotateWithView === undefined ? false : textRotateWithView; + this.textRotation_ = textRotation === undefined ? 0 : textRotation; + this.strokeKey_ = strokeState ? (typeof strokeState.strokeStyle == 'string' ? strokeState.strokeStyle : (0, _util.getUid)(strokeState.strokeStyle)) + strokeState.lineCap + strokeState.lineDashOffset + '|' + strokeState.lineWidth + strokeState.lineJoin + strokeState.miterLimit + '[' + strokeState.lineDash.join() + ']' : ''; + this.textKey_ = textState.font + textState.scale + (textState.textAlign || '?') + (textState.textBaseline || '?'); + this.fillKey_ = fillState ? typeof fillState.fillStyle == 'string' ? fillState.fillStyle : '|' + (0, _util.getUid)(fillState.fillStyle) : ''; + } + }; + + return CanvasTextBuilder; +}(_Builder.default); + +var _default = CanvasTextBuilder; +exports.default = _default; +},{"./Builder.js":"../../../node_modules/ol/render/canvas/Builder.js","./Instruction.js":"../../../node_modules/ol/render/canvas/Instruction.js","../../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../../style/TextPlacement.js":"../../../node_modules/ol/style/TextPlacement.js","../../colorlike.js":"../../../node_modules/ol/colorlike.js","../canvas.js":"../../../node_modules/ol/render/canvas.js","../../util.js":"../../../node_modules/ol/util.js","../../extent.js":"../../../node_modules/ol/extent.js","../../geom/flat/straightchunk.js":"../../../node_modules/ol/geom/flat/straightchunk.js"}],"../../../node_modules/ol/render/canvas/BuilderGroup.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Builder = _interopRequireDefault(require("./Builder.js")); + +var _ImageBuilder = _interopRequireDefault(require("./ImageBuilder.js")); + +var _LineStringBuilder = _interopRequireDefault(require("./LineStringBuilder.js")); + +var _PolygonBuilder = _interopRequireDefault(require("./PolygonBuilder.js")); + +var _TextBuilder = _interopRequireDefault(require("./TextBuilder.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/canvas/BuilderGroup + */ + +/** + * @type {Object<import("./BuilderType").default, typeof Builder>} + */ +var BATCH_CONSTRUCTORS = { + 'Circle': _PolygonBuilder.default, + 'Default': _Builder.default, + 'Image': _ImageBuilder.default, + 'LineString': _LineStringBuilder.default, + 'Polygon': _PolygonBuilder.default, + 'Text': _TextBuilder.default +}; + +var BuilderGroup = +/** @class */ +function () { + /** + * @param {number} tolerance Tolerance. + * @param {import("../../extent.js").Extent} maxExtent Max extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {boolean} declutter Decluttering enabled. + */ + function BuilderGroup(tolerance, maxExtent, resolution, pixelRatio, declutter) { + /** + * @type {boolean} + * @private + */ + this.declutter_ = declutter; + /** + * @type {import("../canvas.js").DeclutterGroups} + * @private + */ + + this.declutterGroups_ = null; + /** + * @private + * @type {number} + */ + + this.tolerance_ = tolerance; + /** + * @private + * @type {import("../../extent.js").Extent} + */ + + this.maxExtent_ = maxExtent; + /** + * @private + * @type {number} + */ + + this.pixelRatio_ = pixelRatio; + /** + * @private + * @type {number} + */ + + this.resolution_ = resolution; + /** + * @private + * @type {!Object<string, !Object<import("./BuilderType").default, Builder>>} + */ + + this.buildersByZIndex_ = {}; + } + /** + * @param {boolean} group Group with previous builder. + * @return {import("../canvas").DeclutterGroups} The resulting instruction groups. + */ + + + BuilderGroup.prototype.addDeclutter = function (group) { + /** @type {Array<*>} */ + var declutter = null; + + if (this.declutter_) { + if (group) { + declutter = this.declutterGroups_; + /** @type {number} */ + + declutter[0][0]++; + } else { + declutter = [[1]]; + this.declutterGroups_ = declutter; + } + } + + return declutter; + }; + /** + * @return {!Object<string, !Object<import("./BuilderType").default, import("./Builder.js").SerializableInstructions>>} The serializable instructions + */ + + + BuilderGroup.prototype.finish = function () { + var builderInstructions = {}; + + for (var zKey in this.buildersByZIndex_) { + builderInstructions[zKey] = builderInstructions[zKey] || {}; + var builders = this.buildersByZIndex_[zKey]; + + for (var builderKey in builders) { + var builderInstruction = builders[builderKey].finish(); + builderInstructions[zKey][builderKey] = builderInstruction; + } + } + + return builderInstructions; + }; + /** + * @param {number|undefined} zIndex Z index. + * @param {import("./BuilderType.js").default} builderType Replay type. + * @return {import("../VectorContext.js").default} Replay. + */ + + + BuilderGroup.prototype.getBuilder = function (zIndex, builderType) { + var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0'; + var replays = this.buildersByZIndex_[zIndexKey]; + + if (replays === undefined) { + replays = {}; + this.buildersByZIndex_[zIndexKey] = replays; + } + + var replay = replays[builderType]; + + if (replay === undefined) { + var Constructor = BATCH_CONSTRUCTORS[builderType]; + replay = new Constructor(this.tolerance_, this.maxExtent_, this.resolution_, this.pixelRatio_); + replays[builderType] = replay; + } + + return replay; + }; + + return BuilderGroup; +}(); + +var _default = BuilderGroup; +exports.default = _default; +},{"./Builder.js":"../../../node_modules/ol/render/canvas/Builder.js","./ImageBuilder.js":"../../../node_modules/ol/render/canvas/ImageBuilder.js","./LineStringBuilder.js":"../../../node_modules/ol/render/canvas/LineStringBuilder.js","./PolygonBuilder.js":"../../../node_modules/ol/render/canvas/PolygonBuilder.js","./TextBuilder.js":"../../../node_modules/ol/render/canvas/TextBuilder.js"}],"../../../node_modules/ol/renderer/Layer.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _ImageState = _interopRequireDefault(require("../ImageState.js")); + +var _Observable = _interopRequireDefault(require("../Observable.js")); + +var _State = _interopRequireDefault(require("../source/State.js")); + +var _util = require("../util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/renderer/Layer + */ + + +/** + * @template {import("../layer/Layer.js").default} LayerType + */ +var LayerRenderer = +/** @class */ +function (_super) { + __extends(LayerRenderer, _super); + /** + * @param {LayerType} layer Layer. + */ + + + function LayerRenderer(layer) { + var _this = _super.call(this) || this; + /** @private */ + + + _this.boundHandleImageChange_ = _this.handleImageChange_.bind(_this); + /** + * @protected + * @type {LayerType} + */ + + _this.layer_ = layer; + return _this; + } + /** + * Asynchronous layer level hit detection. + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with + * an array of features. + */ + + + LayerRenderer.prototype.getFeatures = function (pixel) { + return (0, _util.abstract)(); + }; + /** + * Determine whether render should be called. + * @abstract + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. + */ + + + LayerRenderer.prototype.prepareFrame = function (frameState) { + return (0, _util.abstract)(); + }; + /** + * Render the layer. + * @abstract + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. + */ + + + LayerRenderer.prototype.renderFrame = function (frameState, target) { + return (0, _util.abstract)(); + }; + /** + * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level. + * @param {number} zoom Zoom level. + * @param {import("../Tile.js").default} tile Tile. + * @return {boolean|void} If `false`, the tile will not be considered loaded. + */ + + + LayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) { + if (!tiles[zoom]) { + tiles[zoom] = {}; + } + + tiles[zoom][tile.tileCoord.toString()] = tile; + return undefined; + }; + /** + * Create a function that adds loaded tiles to the tile lookup. + * @param {import("../source/Tile.js").default} source Tile source. + * @param {import("../proj/Projection.js").default} projection Projection of the tiles. + * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level. + * @return {function(number, import("../TileRange.js").default):boolean} A function that can be + * called with a zoom level and a tile range to add loaded tiles to the lookup. + * @protected + */ + + + LayerRenderer.prototype.createLoadedTileFinder = function (source, projection, tiles) { + return ( + /** + * @param {number} zoom Zoom level. + * @param {import("../TileRange.js").default} tileRange Tile range. + * @return {boolean} The tile range is fully loaded. + * @this {LayerRenderer} + */ + function (zoom, tileRange) { + var callback = this.loadedTileCallback.bind(this, tiles, zoom); + return source.forEachLoadedTile(projection, zoom, tileRange, callback); + }.bind(this) + ); + }; + /** + * @abstract + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default): T} callback Feature callback. + * @param {Array<import("../Feature.js").FeatureLike>} declutteredFeatures Decluttered features. + * @return {T|void} Callback result. + * @template T + */ + + + LayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) {}; + /** + * @abstract + * @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. + */ + + + LayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) { + return (0, _util.abstract)(); + }; + /** + * @return {LayerType} Layer. + */ + + + LayerRenderer.prototype.getLayer = function () { + return this.layer_; + }; + /** + * Perform action necessary to get the layer rendered after new fonts have loaded + * @abstract + */ + + + LayerRenderer.prototype.handleFontsChanged = function () {}; + /** + * Handle changes in image state. + * @param {import("../events/Event.js").default} event Image change event. + * @private + */ + + + LayerRenderer.prototype.handleImageChange_ = function (event) { + var image = + /** @type {import("../Image.js").default} */ + event.target; + + if (image.getState() === _ImageState.default.LOADED) { + this.renderIfReadyAndVisible(); + } + }; + /** + * Load the image if not already loaded, and register the image change + * listener if needed. + * @param {import("../ImageBase.js").default} image Image. + * @return {boolean} `true` if the image is already loaded, `false` otherwise. + * @protected + */ + + + LayerRenderer.prototype.loadImage = function (image) { + var imageState = image.getState(); + + if (imageState != _ImageState.default.LOADED && imageState != _ImageState.default.ERROR) { + image.addEventListener(_EventType.default.CHANGE, this.boundHandleImageChange_); + } + + if (imageState == _ImageState.default.IDLE) { + image.load(); + imageState = image.getState(); + } + + return imageState == _ImageState.default.LOADED; + }; + /** + * @protected + */ + + + LayerRenderer.prototype.renderIfReadyAndVisible = function () { + var layer = this.getLayer(); + + if (layer.getVisible() && layer.getSourceState() == _State.default.READY) { + layer.changed(); + } + }; + + return LayerRenderer; +}(_Observable.default); + +var _default = LayerRenderer; +exports.default = _default; +},{"../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../ImageState.js":"../../../node_modules/ol/ImageState.js","../Observable.js":"../../../node_modules/ol/Observable.js","../source/State.js":"../../../node_modules/ol/source/State.js","../util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/render/Event.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/Event + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +var RenderEvent = +/** @class */ +function (_super) { + __extends(RenderEvent, _super); + /** + * @param {import("./EventType.js").default} type Type. + * @param {import("../transform.js").Transform=} opt_inversePixelTransform Transform for + * CSS pixels to rendered pixels. + * @param {import("../PluggableMap.js").FrameState=} opt_frameState Frame state. + * @param {?CanvasRenderingContext2D=} opt_context Context. + */ + + + function RenderEvent(type, opt_inversePixelTransform, opt_frameState, opt_context) { + var _this = _super.call(this, type) || this; + /** + * Transform from CSS pixels (relative to the top-left corner of the map viewport) + * to rendered pixels on this event's `context`. + * @type {import("../transform.js").Transform|undefined} + * @api + */ + + + _this.inversePixelTransform = opt_inversePixelTransform; + /** + * An object representing the current render frame state. + * @type {import("../PluggableMap.js").FrameState|undefined} + * @api + */ + + _this.frameState = opt_frameState; + /** + * Canvas context. Not available when the event is dispatched by the map. Only available + * when a Canvas renderer is used, null otherwise. + * @type {CanvasRenderingContext2D|null|undefined} + * @api + */ + + _this.context = opt_context; + return _this; + } + + return RenderEvent; +}(_Event.default); + +var _default = RenderEvent; +exports.default = _default; +},{"../events/Event.js":"../../../node_modules/ol/events/Event.js"}],"../../../node_modules/ol/renderer/canvas/Layer.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Layer = _interopRequireDefault(require("../Layer.js")); + +var _Event = _interopRequireDefault(require("../../render/Event.js")); + +var _EventType = _interopRequireDefault(require("../../render/EventType.js")); + +var _transform = require("../../transform.js"); + +var _dom = require("../../dom.js"); + +var _extent = require("../../extent.js"); + +var _canvas = require("../../render/canvas.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/renderer/canvas/Layer + */ + + +/** + * @abstract + * @template {import("../../layer/Layer.js").default} LayerType + */ +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 = (0, _transform.create)(); + /** + * 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 = (0, _transform.create)(); + /** + * 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 = (0, _transform.create)(); + /** + * @type {CanvasRenderingContext2D} + */ + + _this.context = null; + /** + * @type {boolean} + */ + + _this.containerReused = false; + return _this; + } + /** + * Get a rendering container from an existing target, if compatible. + * @param {HTMLElement} target Potential render target. + * @param {string} transform CSS Transform. + * @param {number} opacity Opacity. + */ + + + CanvasLayerRenderer.prototype.useContainer = function (target, transform, opacity) { + var layerClassName = this.getLayer().getClassName(); + var container, context; + + if (target && target.style.opacity === '' && target.className === layerClassName) { + var canvas = target.firstElementChild; + + if (canvas instanceof HTMLCanvasElement) { + context = canvas.getContext('2d'); + } + } + + if (context && (context.canvas.width === 0 || 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 = (0, _dom.createCanvasContext2D)(); + 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; + } + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../extent.js").Extent} extent Clip extent. + * @protected + */ + + + CanvasLayerRenderer.prototype.clip = function (context, frameState, extent) { + var pixelRatio = frameState.pixelRatio; + var halfWidth = frameState.size[0] * pixelRatio / 2; + var halfHeight = frameState.size[1] * pixelRatio / 2; + var rotation = frameState.viewState.rotation; + var topLeft = (0, _extent.getTopLeft)(extent); + var topRight = (0, _extent.getTopRight)(extent); + var bottomRight = (0, _extent.getBottomRight)(extent); + var bottomLeft = (0, _extent.getBottomLeft)(extent); + (0, _transform.apply)(frameState.coordinateToPixelTransform, topLeft); + (0, _transform.apply)(frameState.coordinateToPixelTransform, topRight); + (0, _transform.apply)(frameState.coordinateToPixelTransform, bottomRight); + (0, _transform.apply)(frameState.coordinateToPixelTransform, bottomLeft); + context.save(); + (0, _canvas.rotateAtOffset)(context, -rotation, halfWidth, halfHeight); + context.beginPath(); + context.moveTo(topLeft[0] * pixelRatio, topLeft[1] * pixelRatio); + context.lineTo(topRight[0] * pixelRatio, topRight[1] * pixelRatio); + context.lineTo(bottomRight[0] * pixelRatio, bottomRight[1] * pixelRatio); + context.lineTo(bottomLeft[0] * pixelRatio, bottomLeft[1] * pixelRatio); + context.clip(); + (0, _canvas.rotateAtOffset)(context, rotation, halfWidth, halfHeight); + }; + /** + * @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 = (0, _extent.getTopLeft)(extent); + var topRight = (0, _extent.getTopRight)(extent); + var bottomRight = (0, _extent.getBottomRight)(extent); + var bottomLeft = (0, _extent.getBottomLeft)(extent); + (0, _transform.apply)(frameState.coordinateToPixelTransform, topLeft); + (0, _transform.apply)(frameState.coordinateToPixelTransform, topRight); + (0, _transform.apply)(frameState.coordinateToPixelTransform, bottomRight); + (0, _transform.apply)(frameState.coordinateToPixelTransform, bottomLeft); + var inverted = this.inversePixelTransform; + (0, _transform.apply)(inverted, topLeft); + (0, _transform.apply)(inverted, topRight); + (0, _transform.apply)(inverted, bottomRight); + (0, _transform.apply)(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 _Event.default(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.dispatchRenderEvent_(_EventType.default.PRERENDER, context, frameState); + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @protected + */ + + + CanvasLayerRenderer.prototype.postRender = function (context, frameState) { + this.dispatchRenderEvent_(_EventType.default.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 (0, _transform.compose)(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 = (0, _transform.apply)(this.inversePixelTransform, pixel.slice()); + var context = this.context; + var data; + + try { + var x = Math.round(renderPixel[0]); + var y = Math.round(renderPixel[1]); + var newCanvas = document.createElement('canvas'); + var newContext = newCanvas.getContext('2d'); + newCanvas.width = 1; + newCanvas.height = 1; + newContext.clearRect(0, 0, 1, 1); + newContext.drawImage(context.canvas, x, y, 1, 1, 0, 0, 1, 1); + data = newContext.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) + return new Uint8Array(); + } + + return data; + } + + if (data[3] === 0) { + return null; + } + + return data; + }; + + return CanvasLayerRenderer; +}(_Layer.default); + +var _default = CanvasLayerRenderer; +exports.default = _default; +},{"../Layer.js":"../../../node_modules/ol/renderer/Layer.js","../../render/Event.js":"../../../node_modules/ol/render/Event.js","../../render/EventType.js":"../../../node_modules/ol/render/EventType.js","../../transform.js":"../../../node_modules/ol/transform.js","../../dom.js":"../../../node_modules/ol/dom.js","../../extent.js":"../../../node_modules/ol/extent.js","../../render/canvas.js":"../../../node_modules/ol/render/canvas.js"}],"../../../node_modules/ol/render/canvas/BuilderType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/render/canvas/BuilderType + */ + +/** + * @enum {string} + */ +var _default = { + CIRCLE: 'Circle', + DEFAULT: 'Default', + IMAGE: 'Image', + LINE_STRING: 'LineString', + POLYGON: 'Polygon', + TEXT: 'Text' +}; +exports.default = _default; +},{}],"../../../node_modules/rbush/rbush.js":[function(require,module,exports) { +var define; +var global = arguments[3]; +(function (global, factory) { +typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : +typeof define === 'function' && define.amd ? define(factory) : +(global = global || self, global.RBush = factory()); +}(this, function () { 'use strict'; + +function quickselect(arr, k, left, right, compare) { + quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare); +} + +function quickselectStep(arr, k, left, right, compare) { + + while (right > left) { + if (right - left > 600) { + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + quickselectStep(arr, k, newLeft, newRight, compare); + } + + var t = arr[k]; + var i = left; + var j = right; + + swap(arr, left, k); + if (compare(arr[right], t) > 0) { swap(arr, left, right); } + + while (i < j) { + swap(arr, i, j); + i++; + j--; + while (compare(arr[i], t) < 0) { i++; } + while (compare(arr[j], t) > 0) { j--; } + } + + if (compare(arr[left], t) === 0) { swap(arr, left, j); } + else { + j++; + swap(arr, j, right); + } + + if (j <= k) { left = j + 1; } + if (k <= j) { right = j - 1; } + } +} + +function swap(arr, i, j) { + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +function defaultCompare(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +var RBush = function RBush(maxEntries) { + if ( maxEntries === void 0 ) maxEntries = 9; + + // max entries in a node is 9 by default; min node fill is 40% for best performance + this._maxEntries = Math.max(4, maxEntries); + this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); + this.clear(); +}; + +RBush.prototype.all = function all () { + return this._all(this.data, []); +}; + +RBush.prototype.search = function search (bbox) { + var node = this.data; + var result = []; + + if (!intersects(bbox, node)) { return result; } + + var toBBox = this.toBBox; + var nodesToSearch = []; + + while (node) { + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + var childBBox = node.leaf ? toBBox(child) : child; + + if (intersects(bbox, childBBox)) { + if (node.leaf) { result.push(child); } + else if (contains(bbox, childBBox)) { this._all(child, result); } + else { nodesToSearch.push(child); } + } + } + node = nodesToSearch.pop(); + } + + return result; +}; + +RBush.prototype.collides = function collides (bbox) { + var node = this.data; + + if (!intersects(bbox, node)) { return false; } + + var nodesToSearch = []; + while (node) { + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + var childBBox = node.leaf ? this.toBBox(child) : child; + + if (intersects(bbox, childBBox)) { + if (node.leaf || contains(bbox, childBBox)) { return true; } + nodesToSearch.push(child); + } + } + node = nodesToSearch.pop(); + } + + return false; +}; + +RBush.prototype.load = function load (data) { + if (!(data && data.length)) { return this; } + + if (data.length < this._minEntries) { + for (var i = 0; i < data.length; i++) { + this.insert(data[i]); + } + return this; + } + + // recursively build the tree with the given data from scratch using OMT algorithm + var node = this._build(data.slice(), 0, data.length - 1, 0); + + if (!this.data.children.length) { + // save as is if tree is empty + this.data = node; + + } else if (this.data.height === node.height) { + // split root if trees have the same height + this._splitRoot(this.data, node); + + } else { + if (this.data.height < node.height) { + // swap trees if inserted one is bigger + var tmpNode = this.data; + this.data = node; + node = tmpNode; + } + + // insert the small tree into the large tree at appropriate level + this._insert(node, this.data.height - node.height - 1, true); + } + + return this; +}; + +RBush.prototype.insert = function insert (item) { + if (item) { this._insert(item, this.data.height - 1); } + return this; +}; + +RBush.prototype.clear = function clear () { + this.data = createNode([]); + return this; +}; + +RBush.prototype.remove = function remove (item, equalsFn) { + if (!item) { return this; } + + var node = this.data; + var bbox = this.toBBox(item); + var path = []; + var indexes = []; + var i, parent, goingUp; + + // depth-first iterative tree traversal + while (node || path.length) { + + if (!node) { // go up + node = path.pop(); + parent = path[path.length - 1]; + i = indexes.pop(); + goingUp = true; + } + + if (node.leaf) { // check current node + var index = findItem(item, node.children, equalsFn); + + if (index !== -1) { + // item found, remove the item and condense tree upwards + node.children.splice(index, 1); + path.push(node); + this._condense(path); + return this; + } + } + + if (!goingUp && !node.leaf && contains(node, bbox)) { // go down + path.push(node); + indexes.push(i); + i = 0; + parent = node; + node = node.children[0]; + + } else if (parent) { // go right + i++; + node = parent.children[i]; + goingUp = false; + + } else { node = null; } // nothing found + } + + return this; +}; + +RBush.prototype.toBBox = function toBBox (item) { return item; }; + +RBush.prototype.compareMinX = function compareMinX (a, b) { return a.minX - b.minX; }; +RBush.prototype.compareMinY = function compareMinY (a, b) { return a.minY - b.minY; }; + +RBush.prototype.toJSON = function toJSON () { return this.data; }; + +RBush.prototype.fromJSON = function fromJSON (data) { + this.data = data; + return this; +}; + +RBush.prototype._all = function _all (node, result) { + var nodesToSearch = []; + while (node) { + if (node.leaf) { result.push.apply(result, node.children); } + else { nodesToSearch.push.apply(nodesToSearch, node.children); } + + node = nodesToSearch.pop(); + } + return result; +}; + +RBush.prototype._build = function _build (items, left, right, height) { + + var N = right - left + 1; + var M = this._maxEntries; + var node; + + if (N <= M) { + // reached leaf level; return leaf + node = createNode(items.slice(left, right + 1)); + calcBBox(node, this.toBBox); + return node; + } + + if (!height) { + // target height of the bulk-loaded tree + height = Math.ceil(Math.log(N) / Math.log(M)); + + // target number of root entries to maximize storage utilization + M = Math.ceil(N / Math.pow(M, height - 1)); + } + + node = createNode([]); + node.leaf = false; + node.height = height; + + // split the items into M mostly square tiles + + var N2 = Math.ceil(N / M); + var N1 = N2 * Math.ceil(Math.sqrt(M)); + + multiSelect(items, left, right, N1, this.compareMinX); + + for (var i = left; i <= right; i += N1) { + + var right2 = Math.min(i + N1 - 1, right); + + multiSelect(items, i, right2, N2, this.compareMinY); + + for (var j = i; j <= right2; j += N2) { + + var right3 = Math.min(j + N2 - 1, right2); + + // pack each entry recursively + node.children.push(this._build(items, j, right3, height - 1)); + } + } + + calcBBox(node, this.toBBox); + + return node; +}; + +RBush.prototype._chooseSubtree = function _chooseSubtree (bbox, node, level, path) { + while (true) { + path.push(node); + + if (node.leaf || path.length - 1 === level) { break; } + + var minArea = Infinity; + var minEnlargement = Infinity; + var targetNode = (void 0); + + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + var area = bboxArea(child); + var enlargement = enlargedArea(bbox, child) - area; + + // choose entry with the least area enlargement + if (enlargement < minEnlargement) { + minEnlargement = enlargement; + minArea = area < minArea ? area : minArea; + targetNode = child; + + } else if (enlargement === minEnlargement) { + // otherwise choose one with the smallest area + if (area < minArea) { + minArea = area; + targetNode = child; + } + } + } + + node = targetNode || node.children[0]; + } + + return node; +}; + +RBush.prototype._insert = function _insert (item, level, isNode) { + var bbox = isNode ? item : this.toBBox(item); + var insertPath = []; + + // find the best node for accommodating the item, saving all nodes along the path too + var node = this._chooseSubtree(bbox, this.data, level, insertPath); + + // put the item into the node + node.children.push(item); + extend(node, bbox); + + // split on node overflow; propagate upwards if necessary + while (level >= 0) { + if (insertPath[level].children.length > this._maxEntries) { + this._split(insertPath, level); + level--; + } else { break; } + } + + // adjust bboxes along the insertion path + this._adjustParentBBoxes(bbox, insertPath, level); +}; + +// split overflowed node into two +RBush.prototype._split = function _split (insertPath, level) { + var node = insertPath[level]; + var M = node.children.length; + var m = this._minEntries; + + this._chooseSplitAxis(node, m, M); + + var splitIndex = this._chooseSplitIndex(node, m, M); + + var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); + newNode.height = node.height; + newNode.leaf = node.leaf; + + calcBBox(node, this.toBBox); + calcBBox(newNode, this.toBBox); + + if (level) { insertPath[level - 1].children.push(newNode); } + else { this._splitRoot(node, newNode); } +}; + +RBush.prototype._splitRoot = function _splitRoot (node, newNode) { + // split root node + this.data = createNode([node, newNode]); + this.data.height = node.height + 1; + this.data.leaf = false; + calcBBox(this.data, this.toBBox); +}; + +RBush.prototype._chooseSplitIndex = function _chooseSplitIndex (node, m, M) { + var index; + var minOverlap = Infinity; + var minArea = Infinity; + + for (var i = m; i <= M - m; i++) { + var bbox1 = distBBox(node, 0, i, this.toBBox); + var bbox2 = distBBox(node, i, M, this.toBBox); + + var overlap = intersectionArea(bbox1, bbox2); + var area = bboxArea(bbox1) + bboxArea(bbox2); + + // choose distribution with minimum overlap + if (overlap < minOverlap) { + minOverlap = overlap; + index = i; + + minArea = area < minArea ? area : minArea; + + } else if (overlap === minOverlap) { + // otherwise choose distribution with minimum area + if (area < minArea) { + minArea = area; + index = i; + } + } + } + + return index || M - m; +}; + +// sorts node children by the best axis for split +RBush.prototype._chooseSplitAxis = function _chooseSplitAxis (node, m, M) { + var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX; + var compareMinY = node.leaf ? this.compareMinY : compareNodeMinY; + var xMargin = this._allDistMargin(node, m, M, compareMinX); + var yMargin = this._allDistMargin(node, m, M, compareMinY); + + // if total distributions margin value is minimal for x, sort by minX, + // otherwise it's already sorted by minY + if (xMargin < yMargin) { node.children.sort(compareMinX); } +}; + +// total margin of all possible split distributions where each node is at least m full +RBush.prototype._allDistMargin = function _allDistMargin (node, m, M, compare) { + node.children.sort(compare); + + var toBBox = this.toBBox; + var leftBBox = distBBox(node, 0, m, toBBox); + var rightBBox = distBBox(node, M - m, M, toBBox); + var margin = bboxMargin(leftBBox) + bboxMargin(rightBBox); + + for (var i = m; i < M - m; i++) { + var child = node.children[i]; + extend(leftBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(leftBBox); + } + + for (var i$1 = M - m - 1; i$1 >= m; i$1--) { + var child$1 = node.children[i$1]; + extend(rightBBox, node.leaf ? toBBox(child$1) : child$1); + margin += bboxMargin(rightBBox); + } + + return margin; +}; + +RBush.prototype._adjustParentBBoxes = function _adjustParentBBoxes (bbox, path, level) { + // adjust bboxes along the given tree path + for (var i = level; i >= 0; i--) { + extend(path[i], bbox); + } +}; + +RBush.prototype._condense = function _condense (path) { + // go through the path, removing empty nodes and updating bboxes + for (var i = path.length - 1, siblings = (void 0); i >= 0; i--) { + if (path[i].children.length === 0) { + if (i > 0) { + siblings = path[i - 1].children; + siblings.splice(siblings.indexOf(path[i]), 1); + + } else { this.clear(); } + + } else { calcBBox(path[i], this.toBBox); } + } +}; + +function findItem(item, items, equalsFn) { + if (!equalsFn) { return items.indexOf(item); } + + for (var i = 0; i < items.length; i++) { + if (equalsFn(item, items[i])) { return i; } + } + return -1; +} + +// calculate node's bbox from bboxes of its children +function calcBBox(node, toBBox) { + distBBox(node, 0, node.children.length, toBBox, node); +} + +// min bounding rectangle of node children from k to p-1 +function distBBox(node, k, p, toBBox, destNode) { + if (!destNode) { destNode = createNode(null); } + destNode.minX = Infinity; + destNode.minY = Infinity; + destNode.maxX = -Infinity; + destNode.maxY = -Infinity; + + for (var i = k; i < p; i++) { + var child = node.children[i]; + extend(destNode, node.leaf ? toBBox(child) : child); + } + + return destNode; +} + +function extend(a, b) { + a.minX = Math.min(a.minX, b.minX); + a.minY = Math.min(a.minY, b.minY); + a.maxX = Math.max(a.maxX, b.maxX); + a.maxY = Math.max(a.maxY, b.maxY); + return a; +} + +function compareNodeMinX(a, b) { return a.minX - b.minX; } +function compareNodeMinY(a, b) { return a.minY - b.minY; } + +function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); } +function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); } + +function enlargedArea(a, b) { + return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * + (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY)); +} + +function intersectionArea(a, b) { + var minX = Math.max(a.minX, b.minX); + var minY = Math.max(a.minY, b.minY); + var maxX = Math.min(a.maxX, b.maxX); + var maxY = Math.min(a.maxY, b.maxY); + + return Math.max(0, maxX - minX) * + Math.max(0, maxY - minY); +} + +function contains(a, b) { + return a.minX <= b.minX && + a.minY <= b.minY && + b.maxX <= a.maxX && + b.maxY <= a.maxY; +} + +function intersects(a, b) { + return b.minX <= a.maxX && + b.minY <= a.maxY && + b.maxX >= a.minX && + b.maxY >= a.minY; +} + +function createNode(children) { + return { + children: children, + height: 1, + leaf: true, + minX: Infinity, + minY: Infinity, + maxX: -Infinity, + maxY: -Infinity + }; +} + +// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; +// combines selection algorithm with binary divide & conquer approach + +function multiSelect(arr, left, right, n, compare) { + var stack = [left, right]; + + while (stack.length) { + right = stack.pop(); + left = stack.pop(); + + if (right - left <= n) { continue; } + + var mid = left + Math.ceil((right - left) / n / 2) * n; + quickselect(arr, mid, left, right, compare); + + stack.push(left, mid, mid, right); + } +} + +return RBush; + +})); + +},{}],"../../../node_modules/ol/geom/flat/textpath.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.drawTextOnPath = drawTextOnPath; + +var _math = require("../../math.js"); + +var _transform = require("./transform.js"); + +/** + * @module ol/geom/flat/textpath + */ + +/** + * @param {Array<number>} flatCoordinates Path to put text on. + * @param {number} offset Start offset of the `flatCoordinates`. + * @param {number} end End offset of the `flatCoordinates`. + * @param {number} stride Stride. + * @param {string} text Text to place on the path. + * @param {number} startM m along the path where the text starts. + * @param {number} maxAngle Max angle between adjacent chars in radians. + * @param {number} scale The product of the text scale and the device pixel ratio. + * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width. + * @param {string} font The font. + * @param {Object<string, number>} cache A cache of measured widths. + * @param {number} rotation Rotation to apply to the flatCoordinates to determine whether text needs to be reversed. + * @return {Array<Array<*>>} The result array (or null if `maxAngle` was + * exceeded). Entries of the array are x, y, anchorX, angle, chunk. + */ +function drawTextOnPath(flatCoordinates, offset, end, stride, text, startM, maxAngle, scale, measureAndCacheTextWidth, font, cache, rotation) { + var result = []; // Keep text upright + + var reverse; + + if (rotation) { + var rotatedCoordinates = (0, _transform.rotate)(flatCoordinates, offset, end, stride, rotation, [flatCoordinates[offset], flatCoordinates[offset + 1]]); + reverse = rotatedCoordinates[0] > rotatedCoordinates[rotatedCoordinates.length - stride]; + } else { + reverse = flatCoordinates[offset] > flatCoordinates[end - stride]; + } + + var numChars = text.length; + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + offset += stride; + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + var segmentM = 0; + var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); + var angleChanged = false; + var index, previousAngle; + + for (var i = 0; i < numChars; ++i) { + index = reverse ? numChars - i - 1 : i; + var char = text[index]; + var charLength = scale * measureAndCacheTextWidth(font, char, cache); + var charM = startM + charLength / 2; + + while (offset < end - stride && segmentM + segmentLength < charM) { + x1 = x2; + y1 = y2; + offset += stride; + x2 = flatCoordinates[offset]; + y2 = flatCoordinates[offset + 1]; + segmentM += segmentLength; + segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); + } + + var segmentPos = charM - segmentM; + var angle = Math.atan2(y2 - y1, x2 - x1); + + if (reverse) { + angle += angle > 0 ? -Math.PI : Math.PI; + } + + if (previousAngle !== undefined) { + var delta = angle - previousAngle; + angleChanged = angleChanged || delta !== 0; + delta += delta > Math.PI ? -2 * Math.PI : delta < -Math.PI ? 2 * Math.PI : 0; + + if (Math.abs(delta) > maxAngle) { + return null; + } + } + + previousAngle = angle; + var interpolate = segmentPos / segmentLength; + var x = (0, _math.lerp)(x1, x2, interpolate); + var y = (0, _math.lerp)(y1, y2, interpolate); + result[index] = [x, y, charLength / 2, angle, char]; + startM += charLength; + } + + return angleChanged ? result : [[result[0][0], result[0][1], result[0][2], result[0][3], text]]; +} +},{"../../math.js":"../../../node_modules/ol/math.js","./transform.js":"../../../node_modules/ol/geom/flat/transform.js"}],"../../../node_modules/ol/render/canvas/Executor.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Instruction = _interopRequireDefault(require("./Instruction.js")); + +var _rbush = _interopRequireDefault(require("rbush/rbush.js")); + +var _TextBuilder = require("./TextBuilder.js"); + +var _has = require("../../has.js"); + +var _transform = require("../../transform.js"); + +var _extent = require("../../extent.js"); + +var _canvas = require("../canvas.js"); + +var _textpath = require("../../geom/flat/textpath.js"); + +var _array = require("../../array.js"); + +var _length = require("../../geom/flat/length.js"); + +var _transform2 = require("../../geom/flat/transform.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/canvas/Executor + */ + +/** + * @typedef {Object} SerializableInstructions + * @property {Array<*>} instructions The rendering instructions. + * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions. + * @property {Array<number>} coordinates The array of all coordinates. + * @property {!Object<string, import("../canvas.js").TextState>} textStates The text states (decluttering). + * @property {!Object<string, import("../canvas.js").FillState>} fillStates The fill states (decluttering). + * @property {!Object<string, import("../canvas.js").StrokeState>} strokeStates The stroke states (decluttering). + */ + +/** + * @type {import("../../extent.js").Extent} + */ +var tmpExtent = (0, _extent.createEmpty)(); +/** + * @type {!import("../../transform.js").Transform} + */ + +var tmpTransform = (0, _transform.create)(); +/** @type {import("../../coordinate.js").Coordinate} */ + +var p1 = []; +/** @type {import("../../coordinate.js").Coordinate} */ + +var p2 = []; +/** @type {import("../../coordinate.js").Coordinate} */ + +var p3 = []; +/** @type {import("../../coordinate.js").Coordinate} */ + +var p4 = []; + +var Executor = +/** @class */ +function () { + /** + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {boolean} overlaps The replay can have overlapping geometries. + * @param {SerializableInstructions} instructions The serializable instructions + * @param {import("../../size.js").Size} renderBuffer Render buffer (width/height) in pixels. + */ + function Executor(resolution, pixelRatio, overlaps, instructions, renderBuffer) { + /** + * @protected + * @type {boolean} + */ + this.overlaps = overlaps; + /** + * @protected + * @type {number} + */ + + this.pixelRatio = pixelRatio; + /** + * @protected + * @const + * @type {number} + */ + + this.resolution = resolution; + /** + * @private + * @type {boolean} + */ + + this.alignFill_; + /** + * @type {Array<*>} + */ + + this.declutterItems = []; + /** + * @protected + * @type {Array<*>} + */ + + this.instructions = instructions.instructions; + /** + * @protected + * @type {Array<number>} + */ + + this.coordinates = instructions.coordinates; + /** + * @private + * @type {!Object<number,import("../../coordinate.js").Coordinate|Array<import("../../coordinate.js").Coordinate>|Array<Array<import("../../coordinate.js").Coordinate>>>} + */ + + this.coordinateCache_ = {}; + /** + * @private + * @type {import("../../size.js").Size} + */ + + this.renderBuffer_ = renderBuffer; + /** + * @private + * @type {!import("../../transform.js").Transform} + */ + + this.renderedTransform_ = (0, _transform.create)(); + /** + * @protected + * @type {Array<*>} + */ + + this.hitDetectionInstructions = instructions.hitDetectionInstructions; + /** + * @private + * @type {Array<number>} + */ + + this.pixelCoordinates_ = null; + /** + * @private + * @type {number} + */ + + this.viewRotation_ = 0; + /** + * @type {!Object<string, import("../canvas.js").FillState>} + */ + + this.fillStates = instructions.fillStates || {}; + /** + * @type {!Object<string, import("../canvas.js").StrokeState>} + */ + + this.strokeStates = instructions.strokeStates || {}; + /** + * @type {!Object<string, import("../canvas.js").TextState>} + */ + + this.textStates = instructions.textStates || {}; + /** + * @private + * @type {Object<string, Object<string, number>>} + */ + + this.widths_ = {}; + /** + * @private + * @type {Object<string, import("../canvas.js").Label>} + */ + + this.labels_ = {}; + } + /** + * @param {string} text Text. + * @param {string} textKey Text style key. + * @param {string} fillKey Fill style key. + * @param {string} strokeKey Stroke style key. + * @return {import("../canvas.js").Label} Label. + */ + + + Executor.prototype.createLabel = function (text, textKey, fillKey, strokeKey) { + var key = text + textKey + fillKey + strokeKey; + + if (this.labels_[key]) { + return this.labels_[key]; + } + + var strokeState = strokeKey ? this.strokeStates[strokeKey] : null; + var fillState = fillKey ? this.fillStates[fillKey] : null; + var textState = this.textStates[textKey]; + var pixelRatio = this.pixelRatio; + var scale = [textState.scale[0] * pixelRatio, textState.scale[1] * pixelRatio]; + var align = _TextBuilder.TEXT_ALIGN[textState.textAlign || _canvas.defaultTextAlign]; + var strokeWidth = strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0; + var lines = text.split('\n'); + var numLines = lines.length; + var widths = []; + var width = (0, _canvas.measureTextWidths)(textState.font, lines, widths); + var lineHeight = (0, _canvas.measureTextHeight)(textState.font); + var height = lineHeight * numLines; + var renderWidth = width + strokeWidth; + var contextInstructions = []; // make canvas 2 pixels wider to account for italic text width measurement errors + + var w = (renderWidth + 2) * scale[0]; + var h = (height + strokeWidth) * scale[1]; + /** @type {import("../canvas.js").Label} */ + + var label = { + width: w < 0 ? Math.floor(w) : Math.ceil(w), + height: h < 0 ? Math.floor(h) : Math.ceil(h), + contextInstructions: contextInstructions + }; + + if (scale[0] != 1 || scale[1] != 1) { + contextInstructions.push('scale', scale); + } + + contextInstructions.push('font', textState.font); + + if (strokeKey) { + contextInstructions.push('strokeStyle', strokeState.strokeStyle); + contextInstructions.push('lineWidth', strokeWidth); + contextInstructions.push('lineCap', strokeState.lineCap); + contextInstructions.push('lineJoin', strokeState.lineJoin); + contextInstructions.push('miterLimit', strokeState.miterLimit); // eslint-disable-next-line + + var Context = _has.WORKER_OFFSCREEN_CANVAS ? OffscreenCanvasRenderingContext2D : CanvasRenderingContext2D; + + if (Context.prototype.setLineDash) { + contextInstructions.push('setLineDash', [strokeState.lineDash]); + contextInstructions.push('lineDashOffset', strokeState.lineDashOffset); + } + } + + if (fillKey) { + contextInstructions.push('fillStyle', fillState.fillStyle); + } + + contextInstructions.push('textBaseline', 'middle'); + contextInstructions.push('textAlign', 'center'); + var leftRight = 0.5 - align; + var x = align * renderWidth + leftRight * strokeWidth; + var i; + + if (strokeKey) { + for (i = 0; i < numLines; ++i) { + contextInstructions.push('strokeText', [lines[i], x + leftRight * widths[i], 0.5 * (strokeWidth + lineHeight) + i * lineHeight]); + } + } + + if (fillKey) { + for (i = 0; i < numLines; ++i) { + contextInstructions.push('fillText', [lines[i], x + leftRight * widths[i], 0.5 * (strokeWidth + lineHeight) + i * lineHeight]); + } + } + + this.labels_[key] = label; + return label; + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../coordinate.js").Coordinate} p1 1st point of the background box. + * @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box. + * @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box. + * @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box. + * @param {Array<*>} fillInstruction Fill instruction. + * @param {Array<*>} strokeInstruction Stroke instruction. + * @param {boolean} declutter Declutter. + */ + + + Executor.prototype.replayTextBackground_ = function (context, p1, p2, p3, p4, fillInstruction, strokeInstruction, declutter) { + context.beginPath(); + context.moveTo.apply(context, p1); + context.lineTo.apply(context, p2); + context.lineTo.apply(context, p3); + context.lineTo.apply(context, p4); + context.lineTo.apply(context, p1); + + if (fillInstruction) { + this.alignFill_ = + /** @type {boolean} */ + fillInstruction[2]; + + if (declutter) { + context.fillStyle = + /** @type {import("../../colorlike.js").ColorLike} */ + fillInstruction[1]; + } + + this.fill_(context); + } + + if (strokeInstruction) { + this.setStrokeStyle_(context, + /** @type {Array<*>} */ + strokeInstruction); + context.stroke(); + } + }; + /** + * @private + * @param {CanvasRenderingContext2D} context Context. + * @param {number} contextScale Scale of the context. + * @param {number} x X. + * @param {number} y Y. + * @param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image. + * @param {number} anchorX Anchor X. + * @param {number} anchorY Anchor Y. + * @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group. + * @param {number} height Height. + * @param {number} opacity Opacity. + * @param {number} originX Origin X. + * @param {number} originY Origin Y. + * @param {number} rotation Rotation. + * @param {import("../../size.js").Size} scale Scale. + * @param {boolean} snapToPixel Snap to pixel. + * @param {number} width Width. + * @param {Array<number>} padding Padding. + * @param {Array<*>} fillInstruction Fill instruction. + * @param {Array<*>} strokeInstruction Stroke instruction. + * @return {boolean} The image or label was rendered. + */ + + + Executor.prototype.replayImageOrLabel_ = function (context, contextScale, x, y, imageOrLabel, anchorX, anchorY, declutterGroup, height, opacity, originX, originY, rotation, scale, snapToPixel, width, padding, fillInstruction, strokeInstruction) { + var fillStroke = fillInstruction || strokeInstruction; + anchorX *= scale[0]; + anchorY *= scale[1]; + x -= anchorX; + y -= anchorY; + var w = width + originX > imageOrLabel.width ? imageOrLabel.width - originX : width; + var h = height + originY > imageOrLabel.height ? imageOrLabel.height - originY : height; + var boxW = padding[3] + w * scale[0] + padding[1]; + var boxH = padding[0] + h * scale[1] + padding[2]; + var boxX = x - padding[3]; + var boxY = y - padding[0]; + + if (fillStroke || rotation !== 0) { + p1[0] = boxX; + p4[0] = boxX; + p1[1] = boxY; + p2[1] = boxY; + p2[0] = boxX + boxW; + p3[0] = p2[0]; + p3[1] = boxY + boxH; + p4[1] = p3[1]; + } + + var transform = null; + + if (rotation !== 0) { + var centerX = x + anchorX; + var centerY = y + anchorY; + transform = (0, _transform.compose)(tmpTransform, centerX, centerY, 1, 1, rotation, -centerX, -centerY); + (0, _transform.apply)(tmpTransform, p1); + (0, _transform.apply)(tmpTransform, p2); + (0, _transform.apply)(tmpTransform, p3); + (0, _transform.apply)(tmpTransform, p4); + (0, _extent.createOrUpdate)(Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1]), tmpExtent); + } else { + (0, _extent.createOrUpdate)(boxX, boxY, boxX + boxW, boxY + boxH, tmpExtent); + } + + var renderBufferX = 0; + var renderBufferY = 0; + + if (declutterGroup) { + var renderBuffer = this.renderBuffer_; + renderBuffer[0] = Math.max(renderBuffer[0], (0, _extent.getWidth)(tmpExtent)); + renderBufferX = renderBuffer[0]; + renderBuffer[1] = Math.max(renderBuffer[1], (0, _extent.getHeight)(tmpExtent)); + renderBufferY = renderBuffer[1]; + } + + var canvas = context.canvas; + var strokePadding = strokeInstruction ? strokeInstruction[2] * scale[0] / 2 : 0; + var intersects = tmpExtent[0] - strokePadding <= (canvas.width + renderBufferX) / contextScale && tmpExtent[2] + strokePadding >= -renderBufferX / contextScale && tmpExtent[1] - strokePadding <= (canvas.height + renderBufferY) / contextScale && tmpExtent[3] + strokePadding >= -renderBufferY / contextScale; + + if (snapToPixel) { + x = Math.round(x); + y = Math.round(y); + } + + if (declutterGroup) { + if (!intersects && declutterGroup[0] == 1) { + return false; + } + + var declutterArgs = intersects ? [context, transform ? transform.slice(0) : null, opacity, imageOrLabel, originX, originY, w, h, x, y, scale, tmpExtent.slice()] : null; + + if (declutterArgs) { + if (fillStroke) { + declutterArgs.push(fillInstruction, strokeInstruction, p1.slice(0), p2.slice(0), p3.slice(0), p4.slice(0)); + } + + declutterGroup.push(declutterArgs); + } + } else if (intersects) { + if (fillStroke) { + this.replayTextBackground_(context, p1, p2, p3, p4, + /** @type {Array<*>} */ + fillInstruction, + /** @type {Array<*>} */ + strokeInstruction, false); + } + + (0, _canvas.drawImageOrLabel)(context, transform, opacity, imageOrLabel, originX, originY, w, h, x, y, scale); + } + + return true; + }; + /** + * @private + * @param {CanvasRenderingContext2D} context Context. + */ + + + Executor.prototype.fill_ = function (context) { + if (this.alignFill_) { + var origin_1 = (0, _transform.apply)(this.renderedTransform_, [0, 0]); + var repeatSize = 512 * this.pixelRatio; + context.save(); + context.translate(origin_1[0] % repeatSize, origin_1[1] % repeatSize); + context.rotate(this.viewRotation_); + } + + context.fill(); + + if (this.alignFill_) { + context.restore(); + } + }; + /** + * @private + * @param {CanvasRenderingContext2D} context Context. + * @param {Array<*>} instruction Instruction. + */ + + + Executor.prototype.setStrokeStyle_ = function (context, instruction) { + context.strokeStyle = + /** @type {import("../../colorlike.js").ColorLike} */ + instruction[1]; + context.lineWidth = + /** @type {number} */ + instruction[2]; + context.lineCap = + /** @type {CanvasLineCap} */ + instruction[3]; + context.lineJoin = + /** @type {CanvasLineJoin} */ + instruction[4]; + context.miterLimit = + /** @type {number} */ + instruction[5]; + + if (context.setLineDash) { + context.lineDashOffset = + /** @type {number} */ + instruction[7]; + context.setLineDash( + /** @type {Array<number>} */ + instruction[6]); + } + }; + /** + * @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + * @param {number} opacity Layer opacity. + * @param {?} declutterTree Declutter tree. + * @return {?} Declutter tree. + */ + + + Executor.prototype.renderDeclutter = function (declutterGroup, feature, opacity, declutterTree) { + /** @type {Array<import("../../structs/RBush.js").Entry>} */ + var boxes = []; + + for (var i = 1, ii = declutterGroup.length; i < ii; ++i) { + var declutterData = declutterGroup[i]; + var box = declutterData[11]; + boxes.push({ + minX: box[0], + minY: box[1], + maxX: box[2], + maxY: box[3], + value: feature + }); + } + + if (!declutterTree) { + declutterTree = new _rbush.default(9); + } + + var collides = false; + + for (var i = 0, ii = boxes.length; i < ii; ++i) { + if (declutterTree.collides(boxes[i])) { + collides = true; + break; + } + } + + if (!collides) { + declutterTree.load(boxes); + + for (var j = 1, jj = declutterGroup.length; j < jj; ++j) { + var declutterData = + /** @type {Array} */ + declutterGroup[j]; + var context = declutterData[0]; + var currentAlpha = context.globalAlpha; + + if (currentAlpha !== opacity) { + context.globalAlpha = opacity; + } + + if (declutterData.length > 12) { + this.replayTextBackground_(declutterData[0], declutterData[14], declutterData[15], declutterData[16], declutterData[17], declutterData[12], declutterData[13], true); + } + + _canvas.drawImageOrLabel.apply(undefined, declutterData); + + if (currentAlpha !== opacity) { + context.globalAlpha = currentAlpha; + } + } + } + + declutterGroup.length = 1; + return declutterTree; + }; + /** + * @private + * @param {string} text The text to draw. + * @param {string} textKey The key of the text state. + * @param {string} strokeKey The key for the stroke state. + * @param {string} fillKey The key for the fill state. + * @return {{label: import("../canvas.js").Label, anchorX: number, anchorY: number}} The text image and its anchor. + */ + + + Executor.prototype.drawLabelWithPointPlacement_ = function (text, textKey, strokeKey, fillKey) { + var textState = this.textStates[textKey]; + var label = this.createLabel(text, textKey, fillKey, strokeKey); + var strokeState = this.strokeStates[strokeKey]; + var pixelRatio = this.pixelRatio; + var align = _TextBuilder.TEXT_ALIGN[textState.textAlign || _canvas.defaultTextAlign]; + var baseline = _TextBuilder.TEXT_ALIGN[textState.textBaseline || _canvas.defaultTextBaseline]; + var strokeWidth = strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0; // Remove the 2 pixels we added in createLabel() for the anchor + + var width = label.width / pixelRatio - 2 * textState.scale[0]; + var anchorX = align * width + 2 * (0.5 - align) * strokeWidth; + var anchorY = baseline * label.height / pixelRatio + 2 * (0.5 - baseline) * strokeWidth; + return { + label: label, + anchorX: anchorX, + anchorY: anchorY + }; + }; + /** + * @private + * @param {CanvasRenderingContext2D} context Context. + * @param {number} contextScale Scale of the context. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {Array<*>} instructions Instructions array. + * @param {boolean} snapToPixel Snap point symbols and text to integer pixels. + * @param {function(import("../../Feature.js").FeatureLike): T|undefined} featureCallback Feature callback. + * @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this + * extent. + * @return {T|undefined} Callback result. + * @template T + */ + + + Executor.prototype.execute_ = function (context, contextScale, transform, instructions, snapToPixel, featureCallback, opt_hitExtent) { + this.declutterItems.length = 0; + /** @type {Array<number>} */ + + var pixelCoordinates; + + if (this.pixelCoordinates_ && (0, _array.equals)(transform, this.renderedTransform_)) { + pixelCoordinates = this.pixelCoordinates_; + } else { + if (!this.pixelCoordinates_) { + this.pixelCoordinates_ = []; + } + + pixelCoordinates = (0, _transform2.transform2D)(this.coordinates, 0, this.coordinates.length, 2, transform, this.pixelCoordinates_); + (0, _transform.setFromArray)(this.renderedTransform_, transform); + } + + var i = 0; // instruction index + + var ii = instructions.length; // end of instructions + + var d = 0; // data index + + var dd; // end of per-instruction data + + var anchorX, anchorY, prevX, prevY, roundX, roundY, declutterGroup, declutterGroups, image, text, textKey; + var strokeKey, fillKey; + var pendingFill = 0; + var pendingStroke = 0; + var lastFillInstruction = null; + var lastStrokeInstruction = null; + var coordinateCache = this.coordinateCache_; + var viewRotation = this.viewRotation_; + var viewRotationFromTransform = Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12; + var state = + /** @type {import("../../render.js").State} */ + { + context: context, + pixelRatio: this.pixelRatio, + resolution: this.resolution, + rotation: viewRotation + }; // When the batch size gets too big, performance decreases. 200 is a good + // balance between batch size and number of fill/stroke instructions. + + var batchSize = this.instructions != instructions || this.overlaps ? 0 : 200; + var + /** @type {import("../../Feature.js").FeatureLike} */ + feature; + var x, y; + + while (i < ii) { + var instruction = instructions[i]; + var type = + /** @type {import("./Instruction.js").default} */ + instruction[0]; + + switch (type) { + case _Instruction.default.BEGIN_GEOMETRY: + feature = + /** @type {import("../../Feature.js").FeatureLike} */ + instruction[1]; + + if (!feature.getGeometry()) { + i = + /** @type {number} */ + instruction[2]; + } else if (opt_hitExtent !== undefined && !(0, _extent.intersects)(opt_hitExtent, instruction[3])) { + i = + /** @type {number} */ + instruction[2] + 1; + } else { + ++i; + } + + break; + + case _Instruction.default.BEGIN_PATH: + if (pendingFill > batchSize) { + this.fill_(context); + pendingFill = 0; + } + + if (pendingStroke > batchSize) { + context.stroke(); + pendingStroke = 0; + } + + if (!pendingFill && !pendingStroke) { + context.beginPath(); + prevX = NaN; + prevY = NaN; + } + + ++i; + break; + + case _Instruction.default.CIRCLE: + d = + /** @type {number} */ + instruction[1]; + var x1 = pixelCoordinates[d]; + var y1 = pixelCoordinates[d + 1]; + var x2 = pixelCoordinates[d + 2]; + var y2 = pixelCoordinates[d + 3]; + var dx = x2 - x1; + var dy = y2 - y1; + var r = Math.sqrt(dx * dx + dy * dy); + context.moveTo(x1 + r, y1); + context.arc(x1, y1, r, 0, 2 * Math.PI, true); + ++i; + break; + + case _Instruction.default.CLOSE_PATH: + context.closePath(); + ++i; + break; + + case _Instruction.default.CUSTOM: + d = + /** @type {number} */ + instruction[1]; + dd = instruction[2]; + var geometry = + /** @type {import("../../geom/SimpleGeometry.js").default} */ + instruction[3]; + var renderer = instruction[4]; + var fn = instruction.length == 6 ? instruction[5] : undefined; + state.geometry = geometry; + state.feature = feature; + + if (!(i in coordinateCache)) { + coordinateCache[i] = []; + } + + var coords = coordinateCache[i]; + + if (fn) { + fn(pixelCoordinates, d, dd, 2, coords); + } else { + coords[0] = pixelCoordinates[d]; + coords[1] = pixelCoordinates[d + 1]; + coords.length = 2; + } + + renderer(coords, state); + ++i; + break; + + case _Instruction.default.DRAW_IMAGE: + d = + /** @type {number} */ + instruction[1]; + dd = + /** @type {number} */ + instruction[2]; + image = + /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ + instruction[3]; // Remaining arguments in DRAW_IMAGE are in alphabetical order + + anchorX = + /** @type {number} */ + instruction[4]; + anchorY = + /** @type {number} */ + instruction[5]; + declutterGroups = featureCallback ? null : instruction[6]; + var height = + /** @type {number} */ + instruction[7]; + var opacity = + /** @type {number} */ + instruction[8]; + var originX = + /** @type {number} */ + instruction[9]; + var originY = + /** @type {number} */ + instruction[10]; + var rotateWithView = + /** @type {boolean} */ + instruction[11]; + var rotation = + /** @type {number} */ + instruction[12]; + var scale = + /** @type {import("../../size.js").Size} */ + instruction[13]; + var width = + /** @type {number} */ + instruction[14]; + + if (!image && instruction.length >= 19) { + // create label images + text = + /** @type {string} */ + instruction[18]; + textKey = + /** @type {string} */ + instruction[19]; + strokeKey = + /** @type {string} */ + instruction[20]; + fillKey = + /** @type {string} */ + instruction[21]; + var labelWithAnchor = this.drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey); + image = labelWithAnchor.label; + instruction[3] = image; + var textOffsetX = + /** @type {number} */ + instruction[22]; + anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio; + instruction[4] = anchorX; + var textOffsetY = + /** @type {number} */ + instruction[23]; + anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio; + instruction[5] = anchorY; + height = image.height; + instruction[7] = height; + width = image.width; + instruction[14] = width; + } + + var geometryWidths = void 0; + + if (instruction.length > 24) { + geometryWidths = + /** @type {number} */ + instruction[24]; + } + + var padding = void 0, + backgroundFill = void 0, + backgroundStroke = void 0; + + if (instruction.length > 16) { + padding = + /** @type {Array<number>} */ + instruction[15]; + backgroundFill = + /** @type {boolean} */ + instruction[16]; + backgroundStroke = + /** @type {boolean} */ + instruction[17]; + } else { + padding = _canvas.defaultPadding; + backgroundFill = false; + backgroundStroke = false; + } + + if (rotateWithView && viewRotationFromTransform) { + // Canvas is expected to be rotated to reverse view rotation. + rotation += viewRotation; + } else if (!rotateWithView && !viewRotationFromTransform) { + // Canvas is not rotated, images need to be rotated back to be north-up. + rotation -= viewRotation; + } + + var widthIndex = 0; + var declutterGroupIndex = 0; + + for (; d < dd; d += 2) { + if (geometryWidths && geometryWidths[widthIndex++] < width / this.pixelRatio) { + continue; + } + + if (declutterGroups) { + var index = Math.floor(declutterGroupIndex); + declutterGroup = declutterGroups.length < index + 1 ? [declutterGroups[0][0]] : declutterGroups[index]; + } + + var rendered = this.replayImageOrLabel_(context, contextScale, pixelCoordinates[d], pixelCoordinates[d + 1], image, anchorX, anchorY, declutterGroup, height, opacity, originX, originY, rotation, scale, snapToPixel, width, padding, backgroundFill ? + /** @type {Array<*>} */ + lastFillInstruction : null, backgroundStroke ? + /** @type {Array<*>} */ + lastStrokeInstruction : null); + + if (rendered && declutterGroup && declutterGroups[declutterGroups.length - 1] !== declutterGroup) { + declutterGroups.push(declutterGroup); + } + + if (declutterGroup) { + if (declutterGroup.length - 1 === declutterGroup[0]) { + this.declutterItems.push(this, declutterGroup, feature); + } + + declutterGroupIndex += 1 / declutterGroup[0]; + } + } + + ++i; + break; + + case _Instruction.default.DRAW_CHARS: + var begin = + /** @type {number} */ + instruction[1]; + var end = + /** @type {number} */ + instruction[2]; + var baseline = + /** @type {number} */ + instruction[3]; + declutterGroup = featureCallback ? null : instruction[4]; + var overflow = + /** @type {number} */ + instruction[5]; + fillKey = + /** @type {string} */ + instruction[6]; + var maxAngle = + /** @type {number} */ + instruction[7]; + var measurePixelRatio = + /** @type {number} */ + instruction[8]; + var offsetY = + /** @type {number} */ + instruction[9]; + strokeKey = + /** @type {string} */ + instruction[10]; + var strokeWidth = + /** @type {number} */ + instruction[11]; + text = + /** @type {string} */ + instruction[12]; + textKey = + /** @type {string} */ + instruction[13]; + var pixelRatioScale = [ + /** @type {number} */ + instruction[14], + /** @type {number} */ + instruction[14]]; + var textState = this.textStates[textKey]; + var font = textState.font; + var textScale = [textState.scale[0] * measurePixelRatio, textState.scale[1] * measurePixelRatio]; + var cachedWidths = void 0; + + if (font in this.widths_) { + cachedWidths = this.widths_[font]; + } else { + cachedWidths = {}; + this.widths_[font] = cachedWidths; + } + + var pathLength = (0, _length.lineStringLength)(pixelCoordinates, begin, end, 2); + var textLength = Math.abs(textScale[0]) * (0, _canvas.measureAndCacheTextWidth)(font, text, cachedWidths); + + if (overflow || textLength <= pathLength) { + var textAlign = this.textStates[textKey].textAlign; + var startM = (pathLength - textLength) * _TextBuilder.TEXT_ALIGN[textAlign]; + var parts = (0, _textpath.drawTextOnPath)(pixelCoordinates, begin, end, 2, text, startM, maxAngle, Math.abs(textScale[0]), _canvas.measureAndCacheTextWidth, font, cachedWidths, viewRotationFromTransform ? 0 : this.viewRotation_); + + if (parts) { + var rendered = false; + var c = void 0, + cc = void 0, + chars = void 0, + label = void 0, + part = void 0; + + if (strokeKey) { + for (c = 0, cc = parts.length; c < cc; ++c) { + part = parts[c]; // x, y, anchorX, rotation, chunk + + chars = + /** @type {string} */ + part[4]; + label = this.createLabel(chars, textKey, '', strokeKey); + anchorX = + /** @type {number} */ + part[2] + strokeWidth; + anchorY = baseline * label.height + (0.5 - baseline) * 2 * strokeWidth * textScale[1] / textScale[0] - offsetY; + rendered = this.replayImageOrLabel_(context, contextScale, + /** @type {number} */ + part[0], + /** @type {number} */ + part[1], label, anchorX, anchorY, declutterGroup, label.height, 1, 0, 0, + /** @type {number} */ + part[3], pixelRatioScale, false, label.width, _canvas.defaultPadding, null, null) || rendered; + } + } + + if (fillKey) { + for (c = 0, cc = parts.length; c < cc; ++c) { + part = parts[c]; // x, y, anchorX, rotation, chunk + + chars = + /** @type {string} */ + part[4]; + label = this.createLabel(chars, textKey, fillKey, ''); + anchorX = + /** @type {number} */ + part[2]; + anchorY = baseline * label.height - offsetY; + rendered = this.replayImageOrLabel_(context, contextScale, + /** @type {number} */ + part[0], + /** @type {number} */ + part[1], label, anchorX, anchorY, declutterGroup, label.height, 1, 0, 0, + /** @type {number} */ + part[3], pixelRatioScale, false, label.width, _canvas.defaultPadding, null, null) || rendered; + } + } + + if (rendered) { + this.declutterItems.push(this, declutterGroup, feature); + } + } + } + + ++i; + break; + + case _Instruction.default.END_GEOMETRY: + if (featureCallback !== undefined) { + feature = + /** @type {import("../../Feature.js").FeatureLike} */ + instruction[1]; + var result = featureCallback(feature); + + if (result) { + return result; + } + } + + ++i; + break; + + case _Instruction.default.FILL: + if (batchSize) { + pendingFill++; + } else { + this.fill_(context); + } + + ++i; + break; + + case _Instruction.default.MOVE_TO_LINE_TO: + d = + /** @type {number} */ + instruction[1]; + dd = + /** @type {number} */ + instruction[2]; + x = pixelCoordinates[d]; + y = pixelCoordinates[d + 1]; + roundX = x + 0.5 | 0; + roundY = y + 0.5 | 0; + + if (roundX !== prevX || roundY !== prevY) { + context.moveTo(x, y); + prevX = roundX; + prevY = roundY; + } + + for (d += 2; d < dd; d += 2) { + x = pixelCoordinates[d]; + y = pixelCoordinates[d + 1]; + roundX = x + 0.5 | 0; + roundY = y + 0.5 | 0; + + if (d == dd - 2 || roundX !== prevX || roundY !== prevY) { + context.lineTo(x, y); + prevX = roundX; + prevY = roundY; + } + } + + ++i; + break; + + case _Instruction.default.SET_FILL_STYLE: + lastFillInstruction = instruction; + this.alignFill_ = instruction[2]; + + if (pendingFill) { + this.fill_(context); + pendingFill = 0; + + if (pendingStroke) { + context.stroke(); + pendingStroke = 0; + } + } + + context.fillStyle = + /** @type {import("../../colorlike.js").ColorLike} */ + instruction[1]; + ++i; + break; + + case _Instruction.default.SET_STROKE_STYLE: + lastStrokeInstruction = instruction; + + if (pendingStroke) { + context.stroke(); + pendingStroke = 0; + } + + this.setStrokeStyle_(context, + /** @type {Array<*>} */ + instruction); + ++i; + break; + + case _Instruction.default.STROKE: + if (batchSize) { + pendingStroke++; + } else { + context.stroke(); + } + + ++i; + break; + + default: + ++i; // consume the instruction anyway, to avoid an infinite loop + + break; + } + } + + if (pendingFill) { + this.fill_(context); + } + + if (pendingStroke) { + context.stroke(); + } + + return undefined; + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {number} contextScale Scale of the context. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {number} viewRotation View rotation. + * @param {boolean} snapToPixel Snap point symbols and text to integer pixels. + */ + + + Executor.prototype.execute = function (context, contextScale, transform, viewRotation, snapToPixel) { + this.viewRotation_ = viewRotation; + this.execute_(context, contextScale, transform, this.instructions, snapToPixel, undefined, undefined); + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {number} viewRotation View rotation. + * @param {function(import("../../Feature.js").FeatureLike): T=} opt_featureCallback + * Feature callback. + * @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this + * extent. + * @return {T|undefined} Callback result. + * @template T + */ + + + Executor.prototype.executeHitDetection = function (context, transform, viewRotation, opt_featureCallback, opt_hitExtent) { + this.viewRotation_ = viewRotation; + return this.execute_(context, 1, transform, this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent); + }; + + return Executor; +}(); + +var _default = Executor; +exports.default = _default; +},{"./Instruction.js":"../../../node_modules/ol/render/canvas/Instruction.js","rbush/rbush.js":"../../../node_modules/rbush/rbush.js","./TextBuilder.js":"../../../node_modules/ol/render/canvas/TextBuilder.js","../../has.js":"../../../node_modules/ol/has.js","../../transform.js":"../../../node_modules/ol/transform.js","../../extent.js":"../../../node_modules/ol/extent.js","../canvas.js":"../../../node_modules/ol/render/canvas.js","../../geom/flat/textpath.js":"../../../node_modules/ol/geom/flat/textpath.js","../../array.js":"../../../node_modules/ol/array.js","../../geom/flat/length.js":"../../../node_modules/ol/geom/flat/length.js","../../geom/flat/transform.js":"../../../node_modules/ol/geom/flat/transform.js"}],"../../../node_modules/ol/render/canvas/ExecutorGroup.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getCircleArray = getCircleArray; +exports.replayDeclutter = replayDeclutter; +exports.default = void 0; + +var _BuilderType = _interopRequireDefault(require("./BuilderType.js")); + +var _Executor = _interopRequireDefault(require("./Executor.js")); + +var _extent = require("../../extent.js"); + +var _transform = require("../../transform.js"); + +var _dom = require("../../dom.js"); + +var _obj = require("../../obj.js"); + +var _array = require("../../array.js"); + +var _transform2 = require("../../geom/flat/transform.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/canvas/ExecutorGroup + */ + +/** + * @const + * @type {Array<import("./BuilderType.js").default>} + */ +var ORDER = [_BuilderType.default.POLYGON, _BuilderType.default.CIRCLE, _BuilderType.default.LINE_STRING, _BuilderType.default.IMAGE, _BuilderType.default.TEXT, _BuilderType.default.DEFAULT]; + +var ExecutorGroup = +/** @class */ +function () { + /** + * @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a + * `maxExtent` was set on the Buillder for this executor group, the same `maxExtent` + * should be set here, unless the target context does not exceet that extent (which + * can be the case when rendering to tiles). + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {boolean} overlaps The executor group can have overlapping geometries. + * @param {!Object<string, !Object<import("./BuilderType.js").default, import("./Builder.js").SerializableInstructions>>} allInstructions + * The serializable instructions. + * @param {number=} opt_renderBuffer Optional rendering buffer. + */ + function ExecutorGroup(maxExtent, resolution, pixelRatio, overlaps, allInstructions, opt_renderBuffer) { + /** + * @private + * @type {import("../../extent.js").Extent} + */ + this.maxExtent_ = maxExtent; + /** + * @private + * @type {boolean} + */ + + this.overlaps_ = overlaps; + /** + * @private + * @type {number} + */ + + this.pixelRatio_ = pixelRatio; + /** + * @private + * @type {number} + */ + + this.resolution_ = resolution; + /** + * @private + * @type {number|undefined} + */ + + this.renderBuffer_ = opt_renderBuffer; + /** + * @private + * @type {!Object<string, !Object<import("./BuilderType.js").default, import("./Executor").default>>} + */ + + this.executorsByZIndex_ = {}; + /** + * @private + * @type {CanvasRenderingContext2D} + */ + + this.hitDetectionContext_ = null; + /** + * @private + * @type {import("../../transform.js").Transform} + */ + + this.hitDetectionTransform_ = (0, _transform.create)(); + this.createExecutors_(allInstructions); + } + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../transform.js").Transform} transform Transform. + */ + + + ExecutorGroup.prototype.clip = function (context, transform) { + var flatClipCoords = this.getClipCoords(transform); + context.beginPath(); + context.moveTo(flatClipCoords[0], flatClipCoords[1]); + context.lineTo(flatClipCoords[2], flatClipCoords[3]); + context.lineTo(flatClipCoords[4], flatClipCoords[5]); + context.lineTo(flatClipCoords[6], flatClipCoords[7]); + context.clip(); + }; + /** + * Create executors and populate them using the provided instructions. + * @private + * @param {!Object<string, !Object<import("./BuilderType.js").default, import("./Builder.js").SerializableInstructions>>} allInstructions The serializable instructions + */ + + + ExecutorGroup.prototype.createExecutors_ = function (allInstructions) { + for (var zIndex in allInstructions) { + var executors = this.executorsByZIndex_[zIndex]; + + if (executors === undefined) { + executors = {}; + this.executorsByZIndex_[zIndex] = executors; + } + + var instructionByZindex = allInstructions[zIndex]; + var renderBuffer = [this.renderBuffer_ || 0, this.renderBuffer_ || 0]; + + for (var builderType in instructionByZindex) { + var instructions = instructionByZindex[builderType]; + executors[builderType] = new _Executor.default(this.resolution_, this.pixelRatio_, this.overlaps_, instructions, renderBuffer); + } + } + }; + /** + * @param {Array<import("./BuilderType.js").default>} executors Executors. + * @return {boolean} Has executors of the provided types. + */ + + + ExecutorGroup.prototype.hasExecutors = function (executors) { + for (var zIndex in this.executorsByZIndex_) { + var candidates = this.executorsByZIndex_[zIndex]; + + for (var i = 0, ii = executors.length; i < ii; ++i) { + if (executors[i] in candidates) { + return true; + } + } + } + + return false; + }; + /** + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../../Feature.js").FeatureLike): T} callback Feature callback. + * @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features. + * @return {T|undefined} Callback result. + * @template T + */ + + + ExecutorGroup.prototype.forEachFeatureAtCoordinate = function (coordinate, resolution, rotation, hitTolerance, callback, declutteredFeatures) { + hitTolerance = Math.round(hitTolerance); + var contextSize = hitTolerance * 2 + 1; + var transform = (0, _transform.compose)(this.hitDetectionTransform_, hitTolerance + 0.5, hitTolerance + 0.5, 1 / resolution, -1 / resolution, -rotation, -coordinate[0], -coordinate[1]); + + if (!this.hitDetectionContext_) { + this.hitDetectionContext_ = (0, _dom.createCanvasContext2D)(contextSize, contextSize); + } + + var context = this.hitDetectionContext_; + + if (context.canvas.width !== contextSize || context.canvas.height !== contextSize) { + context.canvas.width = contextSize; + context.canvas.height = contextSize; + } else { + context.clearRect(0, 0, contextSize, contextSize); + } + /** + * @type {import("../../extent.js").Extent} + */ + + + var hitExtent; + + if (this.renderBuffer_ !== undefined) { + hitExtent = (0, _extent.createEmpty)(); + (0, _extent.extendCoordinate)(hitExtent, coordinate); + (0, _extent.buffer)(hitExtent, resolution * (this.renderBuffer_ + hitTolerance), hitExtent); + } + + var mask = getCircleArray(hitTolerance); + var builderType; + /** + * @param {import("../../Feature.js").FeatureLike} feature Feature. + * @return {?} Callback result. + */ + + function featureCallback(feature) { + var imageData = context.getImageData(0, 0, contextSize, contextSize).data; + + for (var i_1 = 0; i_1 < contextSize; i_1++) { + for (var j_1 = 0; j_1 < contextSize; j_1++) { + if (mask[i_1][j_1]) { + if (imageData[(j_1 * contextSize + i_1) * 4 + 3] > 0) { + var result_1 = void 0; + + if (!(declutteredFeatures && (builderType == _BuilderType.default.IMAGE || builderType == _BuilderType.default.TEXT)) || declutteredFeatures.indexOf(feature) !== -1) { + result_1 = callback(feature); + } + + if (result_1) { + return result_1; + } else { + context.clearRect(0, 0, contextSize, contextSize); + return undefined; + } + } + } + } + } + } + /** @type {Array<number>} */ + + + var zs = Object.keys(this.executorsByZIndex_).map(Number); + zs.sort(_array.numberSafeCompareFunction); + var i, j, executors, executor, result; + + for (i = zs.length - 1; i >= 0; --i) { + var zIndexKey = zs[i].toString(); + executors = this.executorsByZIndex_[zIndexKey]; + + for (j = ORDER.length - 1; j >= 0; --j) { + builderType = ORDER[j]; + executor = executors[builderType]; + + if (executor !== undefined) { + result = executor.executeHitDetection(context, transform, rotation, featureCallback, hitExtent); + + if (result) { + return result; + } + } + } + } + + return undefined; + }; + /** + * @param {import("../../transform.js").Transform} transform Transform. + * @return {Array<number>} Clip coordinates. + */ + + + ExecutorGroup.prototype.getClipCoords = function (transform) { + var maxExtent = this.maxExtent_; + + if (!maxExtent) { + return null; + } + + var minX = maxExtent[0]; + var minY = maxExtent[1]; + var maxX = maxExtent[2]; + var maxY = maxExtent[3]; + var flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY]; + (0, _transform2.transform2D)(flatClipCoords, 0, 8, 2, transform, flatClipCoords); + return flatClipCoords; + }; + /** + * @return {boolean} Is empty. + */ + + + ExecutorGroup.prototype.isEmpty = function () { + return (0, _obj.isEmpty)(this.executorsByZIndex_); + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {number} contextScale Scale of the context. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {number} viewRotation View rotation. + * @param {boolean} snapToPixel Snap point symbols and test to integer pixel. + * @param {Array<import("./BuilderType.js").default>=} opt_builderTypes Ordered replay types to replay. + * Default is {@link module:ol/render/replay~ORDER} + * @param {Object<string, import("../canvas.js").DeclutterGroup>=} opt_declutterReplays Declutter replays. + */ + + + ExecutorGroup.prototype.execute = function (context, contextScale, transform, viewRotation, snapToPixel, opt_builderTypes, opt_declutterReplays) { + /** @type {Array<number>} */ + var zs = Object.keys(this.executorsByZIndex_).map(Number); + zs.sort(_array.numberSafeCompareFunction); // setup clipping so that the parts of over-simplified geometries are not + // visible outside the current extent when panning + + if (this.maxExtent_) { + context.save(); + this.clip(context, transform); + } + + var builderTypes = opt_builderTypes ? opt_builderTypes : ORDER; + var i, ii, j, jj, replays, replay; + + for (i = 0, ii = zs.length; i < ii; ++i) { + var zIndexKey = zs[i].toString(); + replays = this.executorsByZIndex_[zIndexKey]; + + for (j = 0, jj = builderTypes.length; j < jj; ++j) { + var builderType = builderTypes[j]; + replay = replays[builderType]; + + if (replay !== undefined) { + if (opt_declutterReplays && (builderType == _BuilderType.default.IMAGE || builderType == _BuilderType.default.TEXT)) { + var declutter = opt_declutterReplays[zIndexKey]; + + if (!declutter) { + opt_declutterReplays[zIndexKey] = [replay, transform.slice(0)]; + } else { + declutter.push(replay, transform.slice(0)); + } + } else { + replay.execute(context, contextScale, transform, viewRotation, snapToPixel); + } + } + } + } + + if (this.maxExtent_) { + context.restore(); + } + }; + + return ExecutorGroup; +}(); +/** + * This cache is used for storing calculated pixel circles for increasing performance. + * It is a static property to allow each Replaygroup to access it. + * @type {Object<number, Array<Array<(boolean|undefined)>>>} + */ + + +var circleArrayCache = { + 0: [[true]] +}; +/** + * This method fills a row in the array from the given coordinate to the + * middle with `true`. + * @param {Array<Array<(boolean|undefined)>>} array The array that will be altered. + * @param {number} x X coordinate. + * @param {number} y Y coordinate. + */ + +function fillCircleArrayRowToMiddle(array, x, y) { + var i; + var radius = Math.floor(array.length / 2); + + if (x >= radius) { + for (i = radius; i < x; i++) { + array[i][y] = true; + } + } else if (x < radius) { + for (i = x + 1; i < radius; i++) { + array[i][y] = true; + } + } +} +/** + * This methods creates a circle inside a fitting array. Points inside the + * circle are marked by true, points on the outside are undefined. + * It uses the midpoint circle algorithm. + * A cache is used to increase performance. + * @param {number} radius Radius. + * @returns {Array<Array<(boolean|undefined)>>} An array with marked circle points. + */ + + +function getCircleArray(radius) { + if (circleArrayCache[radius] !== undefined) { + return circleArrayCache[radius]; + } + + var arraySize = radius * 2 + 1; + var arr = new Array(arraySize); + + for (var i = 0; i < arraySize; i++) { + arr[i] = new Array(arraySize); + } + + var x = radius; + var y = 0; + var error = 0; + + while (x >= y) { + fillCircleArrayRowToMiddle(arr, radius + x, radius + y); + fillCircleArrayRowToMiddle(arr, radius + y, radius + x); + fillCircleArrayRowToMiddle(arr, radius - y, radius + x); + fillCircleArrayRowToMiddle(arr, radius - x, radius + y); + fillCircleArrayRowToMiddle(arr, radius - x, radius - y); + fillCircleArrayRowToMiddle(arr, radius - y, radius - x); + fillCircleArrayRowToMiddle(arr, radius + y, radius - x); + fillCircleArrayRowToMiddle(arr, radius + x, radius - y); + y++; + error += 1 + 2 * y; + + if (2 * (error - x) + 1 > 0) { + x -= 1; + error += 1 - 2 * x; + } + } + + circleArrayCache[radius] = arr; + return arr; +} +/** + * @param {!Object<string, Array<*>>} declutterReplays Declutter replays. + * @param {CanvasRenderingContext2D} context Context. + * @param {number} rotation Rotation. + * @param {number} opacity Opacity. + * @param {boolean} snapToPixel Snap point symbols and text to integer pixels. + * @param {Array<import("../../PluggableMap.js").DeclutterItems>} declutterItems Declutter items. + */ + + +function replayDeclutter(declutterReplays, context, rotation, opacity, snapToPixel, declutterItems) { + var zs = Object.keys(declutterReplays).map(Number).sort(_array.numberSafeCompareFunction); + + for (var z = 0, zz = zs.length; z < zz; ++z) { + var executorData = declutterReplays[zs[z].toString()]; + var currentExecutor = void 0; + + for (var i = 0, ii = executorData.length; i < ii;) { + var executor = executorData[i++]; + var transform = executorData[i++]; + executor.execute(context, 1, transform, rotation, snapToPixel); + + if (executor !== currentExecutor && executor.declutterItems.length > 0) { + currentExecutor = executor; + declutterItems.push({ + items: executor.declutterItems, + opacity: opacity + }); + } + } + } +} + +var _default = ExecutorGroup; +exports.default = _default; +},{"./BuilderType.js":"../../../node_modules/ol/render/canvas/BuilderType.js","./Executor.js":"../../../node_modules/ol/render/canvas/Executor.js","../../extent.js":"../../../node_modules/ol/extent.js","../../transform.js":"../../../node_modules/ol/transform.js","../../dom.js":"../../../node_modules/ol/dom.js","../../obj.js":"../../../node_modules/ol/obj.js","../../array.js":"../../../node_modules/ol/array.js","../../geom/flat/transform.js":"../../../node_modules/ol/geom/flat/transform.js"}],"../../../node_modules/ol/ViewHint.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/ViewHint + */ + +/** + * @enum {number} + */ +var _default = { + ANIMATING: 0, + INTERACTING: 1 +}; +exports.default = _default; +},{}],"../../../node_modules/ol/render/canvas/Immediate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryType = _interopRequireDefault(require("../../geom/GeometryType.js")); + +var _VectorContext = _interopRequireDefault(require("../VectorContext.js")); + +var _colorlike = require("../../colorlike.js"); + +var _transform = require("../../transform.js"); + +var _canvas = require("../canvas.js"); + +var _array = require("../../array.js"); + +var _extent = require("../../extent.js"); + +var _transform2 = require("../../geom/flat/transform.js"); + +var _SimpleGeometry = require("../../geom/SimpleGeometry.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/canvas/Immediate + */ +// FIXME test, especially polygons with holes and multipolygons +// FIXME need to handle large thick features (where pixel size matters) +// FIXME add offset and end to ol/geom/flat/transform~transform2D? +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * @classdesc + * A concrete subclass of {@link module:ol/render/VectorContext} that implements + * direct rendering of features and geometries to an HTML5 Canvas context. + * Instances of this class are created internally by the library and + * provided to application code as vectorContext member of the + * {@link module:ol/render/Event~RenderEvent} object associated with postcompose, precompose and + * render events emitted by layers and maps. + */ +var CanvasImmediateRenderer = +/** @class */ +function (_super) { + __extends(CanvasImmediateRenderer, _super); + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../../extent.js").Extent} extent Extent. + * @param {import("../../transform.js").Transform} transform Transform. + * @param {number} viewRotation View rotation. + * @param {number=} opt_squaredTolerance Optional squared tolerance for simplification. + * @param {import("../../proj.js").TransformFunction=} opt_userTransform Transform from user to view projection. + */ + + + function CanvasImmediateRenderer(context, pixelRatio, extent, transform, viewRotation, opt_squaredTolerance, opt_userTransform) { + var _this = _super.call(this) || this; + /** + * @private + * @type {CanvasRenderingContext2D} + */ + + + _this.context_ = context; + /** + * @private + * @type {number} + */ + + _this.pixelRatio_ = pixelRatio; + /** + * @private + * @type {import("../../extent.js").Extent} + */ + + _this.extent_ = extent; + /** + * @private + * @type {import("../../transform.js").Transform} + */ + + _this.transform_ = transform; + /** + * @private + * @type {number} + */ + + _this.viewRotation_ = viewRotation; + /** + * @private + * @type {number} + */ + + _this.squaredTolerance_ = opt_squaredTolerance; + /** + * @private + * @type {import("../../proj.js").TransformFunction} + */ + + _this.userTransform_ = opt_userTransform; + /** + * @private + * @type {?import("../canvas.js").FillState} + */ + + _this.contextFillState_ = null; + /** + * @private + * @type {?import("../canvas.js").StrokeState} + */ + + _this.contextStrokeState_ = null; + /** + * @private + * @type {?import("../canvas.js").TextState} + */ + + _this.contextTextState_ = null; + /** + * @private + * @type {?import("../canvas.js").FillState} + */ + + _this.fillState_ = null; + /** + * @private + * @type {?import("../canvas.js").StrokeState} + */ + + _this.strokeState_ = null; + /** + * @private + * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} + */ + + _this.image_ = null; + /** + * @private + * @type {number} + */ + + _this.imageAnchorX_ = 0; + /** + * @private + * @type {number} + */ + + _this.imageAnchorY_ = 0; + /** + * @private + * @type {number} + */ + + _this.imageHeight_ = 0; + /** + * @private + * @type {number} + */ + + _this.imageOpacity_ = 0; + /** + * @private + * @type {number} + */ + + _this.imageOriginX_ = 0; + /** + * @private + * @type {number} + */ + + _this.imageOriginY_ = 0; + /** + * @private + * @type {boolean} + */ + + _this.imageRotateWithView_ = false; + /** + * @private + * @type {number} + */ + + _this.imageRotation_ = 0; + /** + * @private + * @type {import("../../size.js").Size} + */ + + _this.imageScale_ = [0, 0]; + /** + * @private + * @type {number} + */ + + _this.imageWidth_ = 0; + /** + * @private + * @type {string} + */ + + _this.text_ = ''; + /** + * @private + * @type {number} + */ + + _this.textOffsetX_ = 0; + /** + * @private + * @type {number} + */ + + _this.textOffsetY_ = 0; + /** + * @private + * @type {boolean} + */ + + _this.textRotateWithView_ = false; + /** + * @private + * @type {number} + */ + + _this.textRotation_ = 0; + /** + * @private + * @type {import("../../size.js").Size} + */ + + _this.textScale_ = [0, 0]; + /** + * @private + * @type {?import("../canvas.js").FillState} + */ + + _this.textFillState_ = null; + /** + * @private + * @type {?import("../canvas.js").StrokeState} + */ + + _this.textStrokeState_ = null; + /** + * @private + * @type {?import("../canvas.js").TextState} + */ + + _this.textState_ = null; + /** + * @private + * @type {Array<number>} + */ + + _this.pixelCoordinates_ = []; + /** + * @private + * @type {import("../../transform.js").Transform} + */ + + _this.tmpLocalTransform_ = (0, _transform.create)(); + return _this; + } + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @private + */ + + + CanvasImmediateRenderer.prototype.drawImages_ = function (flatCoordinates, offset, end, stride) { + if (!this.image_) { + return; + } + + var pixelCoordinates = (0, _transform2.transform2D)(flatCoordinates, offset, end, 2, this.transform_, this.pixelCoordinates_); + var context = this.context_; + var localTransform = this.tmpLocalTransform_; + var alpha = context.globalAlpha; + + if (this.imageOpacity_ != 1) { + context.globalAlpha = alpha * this.imageOpacity_; + } + + var rotation = this.imageRotation_; + + if (this.imageRotateWithView_) { + rotation += this.viewRotation_; + } + + for (var i = 0, ii = pixelCoordinates.length; i < ii; i += 2) { + var x = pixelCoordinates[i] - this.imageAnchorX_; + var y = pixelCoordinates[i + 1] - this.imageAnchorY_; + + if (rotation !== 0 || this.imageScale_[0] != 1 || this.imageScale_[1] != 1) { + var centerX = x + this.imageAnchorX_; + var centerY = y + this.imageAnchorY_; + (0, _transform.compose)(localTransform, centerX, centerY, 1, 1, rotation, -centerX, -centerY); + context.setTransform.apply(context, localTransform); + context.translate(centerX, centerY); + context.scale(this.imageScale_[0], this.imageScale_[1]); + context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, -this.imageAnchorX_, -this.imageAnchorY_, this.imageWidth_, this.imageHeight_); + context.setTransform(1, 0, 0, 1, 0, 0); + } else { + context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, x, y, this.imageWidth_, this.imageHeight_); + } + } + + if (this.imageOpacity_ != 1) { + context.globalAlpha = alpha; + } + }; + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @private + */ + + + CanvasImmediateRenderer.prototype.drawText_ = function (flatCoordinates, offset, end, stride) { + if (!this.textState_ || this.text_ === '') { + return; + } + + if (this.textFillState_) { + this.setContextFillState_(this.textFillState_); + } + + if (this.textStrokeState_) { + this.setContextStrokeState_(this.textStrokeState_); + } + + this.setContextTextState_(this.textState_); + var pixelCoordinates = (0, _transform2.transform2D)(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_); + var context = this.context_; + var rotation = this.textRotation_; + + if (this.textRotateWithView_) { + rotation += this.viewRotation_; + } + + for (; offset < end; offset += stride) { + var x = pixelCoordinates[offset] + this.textOffsetX_; + var y = pixelCoordinates[offset + 1] + this.textOffsetY_; + + if (rotation !== 0 || this.textScale_[0] != 1 || this.textScale_[1] != 1) { + var localTransform = (0, _transform.compose)(this.tmpLocalTransform_, x, y, 1, 1, rotation, -x, -y); + context.setTransform.apply(context, localTransform); + context.translate(x, y); + context.scale(this.textScale_[0], this.textScale_[1]); + + if (this.textStrokeState_) { + context.strokeText(this.text_, 0, 0); + } + + if (this.textFillState_) { + context.fillText(this.text_, 0, 0); + } + + context.setTransform(1, 0, 0, 1, 0, 0); + } else { + if (this.textStrokeState_) { + context.strokeText(this.text_, x, y); + } + + if (this.textFillState_) { + context.fillText(this.text_, x, y); + } + } + } + }; + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {boolean} close Close. + * @private + * @return {number} end End. + */ + + + CanvasImmediateRenderer.prototype.moveToLineTo_ = function (flatCoordinates, offset, end, stride, close) { + var context = this.context_; + var pixelCoordinates = (0, _transform2.transform2D)(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_); + context.moveTo(pixelCoordinates[0], pixelCoordinates[1]); + var length = pixelCoordinates.length; + + if (close) { + length -= 2; + } + + for (var i = 2; i < length; i += 2) { + context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]); + } + + if (close) { + context.closePath(); + } + + return end; + }; + /** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<number>} ends Ends. + * @param {number} stride Stride. + * @private + * @return {number} End. + */ + + + CanvasImmediateRenderer.prototype.drawRings_ = function (flatCoordinates, offset, ends, stride) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, true); + } + + return offset; + }; + /** + * Render a circle geometry into the canvas. Rendering is immediate and uses + * the current fill and stroke styles. + * + * @param {import("../../geom/Circle.js").default} geometry Circle geometry. + * @api + */ + + + CanvasImmediateRenderer.prototype.drawCircle = function (geometry) { + if (!(0, _extent.intersects)(this.extent_, geometry.getExtent())) { + return; + } + + if (this.fillState_ || this.strokeState_) { + if (this.fillState_) { + this.setContextFillState_(this.fillState_); + } + + if (this.strokeState_) { + this.setContextStrokeState_(this.strokeState_); + } + + var pixelCoordinates = (0, _SimpleGeometry.transformGeom2D)(geometry, this.transform_, this.pixelCoordinates_); + var dx = pixelCoordinates[2] - pixelCoordinates[0]; + var dy = pixelCoordinates[3] - pixelCoordinates[1]; + var radius = Math.sqrt(dx * dx + dy * dy); + var context = this.context_; + context.beginPath(); + context.arc(pixelCoordinates[0], pixelCoordinates[1], radius, 0, 2 * Math.PI); + + if (this.fillState_) { + context.fill(); + } + + if (this.strokeState_) { + context.stroke(); + } + } + + if (this.text_ !== '') { + this.drawText_(geometry.getCenter(), 0, 2, 2); + } + }; + /** + * Set the rendering style. Note that since this is an immediate rendering API, + * any `zIndex` on the provided style will be ignored. + * + * @param {import("../../style/Style.js").default} style The rendering style. + * @api + */ + + + CanvasImmediateRenderer.prototype.setStyle = function (style) { + this.setFillStrokeStyle(style.getFill(), style.getStroke()); + this.setImageStyle(style.getImage()); + this.setTextStyle(style.getText()); + }; + /** + * @param {import("../../transform.js").Transform} transform Transform. + */ + + + CanvasImmediateRenderer.prototype.setTransform = function (transform) { + this.transform_ = transform; + }; + /** + * Render a geometry into the canvas. Call + * {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style. + * + * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render. + * @api + */ + + + CanvasImmediateRenderer.prototype.drawGeometry = function (geometry) { + var type = geometry.getType(); + + switch (type) { + case _GeometryType.default.POINT: + this.drawPoint( + /** @type {import("../../geom/Point.js").default} */ + geometry); + break; + + case _GeometryType.default.LINE_STRING: + this.drawLineString( + /** @type {import("../../geom/LineString.js").default} */ + geometry); + break; + + case _GeometryType.default.POLYGON: + this.drawPolygon( + /** @type {import("../../geom/Polygon.js").default} */ + geometry); + break; + + case _GeometryType.default.MULTI_POINT: + this.drawMultiPoint( + /** @type {import("../../geom/MultiPoint.js").default} */ + geometry); + break; + + case _GeometryType.default.MULTI_LINE_STRING: + this.drawMultiLineString( + /** @type {import("../../geom/MultiLineString.js").default} */ + geometry); + break; + + case _GeometryType.default.MULTI_POLYGON: + this.drawMultiPolygon( + /** @type {import("../../geom/MultiPolygon.js").default} */ + geometry); + break; + + case _GeometryType.default.GEOMETRY_COLLECTION: + this.drawGeometryCollection( + /** @type {import("../../geom/GeometryCollection.js").default} */ + geometry); + break; + + case _GeometryType.default.CIRCLE: + this.drawCircle( + /** @type {import("../../geom/Circle.js").default} */ + geometry); + break; + + default: + } + }; + /** + * Render a feature into the canvas. Note that any `zIndex` on the provided + * style will be ignored - features are rendered immediately in the order that + * this method is called. If you need `zIndex` support, you should be using an + * {@link module:ol/layer/Vector~VectorLayer} instead. + * + * @param {import("../../Feature.js").default} feature Feature. + * @param {import("../../style/Style.js").default} style Style. + * @api + */ + + + CanvasImmediateRenderer.prototype.drawFeature = function (feature, style) { + var geometry = style.getGeometryFunction()(feature); + + if (!geometry || !(0, _extent.intersects)(this.extent_, geometry.getExtent())) { + return; + } + + this.setStyle(style); + this.drawGeometry(geometry); + }; + /** + * Render a GeometryCollection to the canvas. Rendering is immediate and + * uses the current styles appropriate for each geometry in the collection. + * + * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection. + */ + + + CanvasImmediateRenderer.prototype.drawGeometryCollection = function (geometry) { + var geometries = geometry.getGeometriesArray(); + + for (var i = 0, ii = geometries.length; i < ii; ++i) { + this.drawGeometry(geometries[i]); + } + }; + /** + * Render a Point geometry into the canvas. Rendering is immediate and uses + * the current style. + * + * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry. + */ + + + CanvasImmediateRenderer.prototype.drawPoint = function (geometry) { + if (this.squaredTolerance_) { + geometry = + /** @type {import("../../geom/Point.js").default} */ + geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_); + } + + var flatCoordinates = geometry.getFlatCoordinates(); + var stride = geometry.getStride(); + + if (this.image_) { + this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride); + } + + if (this.text_ !== '') { + this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride); + } + }; + /** + * Render a MultiPoint geometry into the canvas. Rendering is immediate and + * uses the current style. + * + * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry. + */ + + + CanvasImmediateRenderer.prototype.drawMultiPoint = function (geometry) { + if (this.squaredTolerance_) { + geometry = + /** @type {import("../../geom/MultiPoint.js").default} */ + geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_); + } + + var flatCoordinates = geometry.getFlatCoordinates(); + var stride = geometry.getStride(); + + if (this.image_) { + this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride); + } + + if (this.text_ !== '') { + this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride); + } + }; + /** + * Render a LineString into the canvas. Rendering is immediate and uses + * the current style. + * + * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry. + */ + + + CanvasImmediateRenderer.prototype.drawLineString = function (geometry) { + if (this.squaredTolerance_) { + geometry = + /** @type {import("../../geom/LineString.js").default} */ + geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_); + } + + if (!(0, _extent.intersects)(this.extent_, geometry.getExtent())) { + return; + } + + if (this.strokeState_) { + this.setContextStrokeState_(this.strokeState_); + var context = this.context_; + var flatCoordinates = geometry.getFlatCoordinates(); + context.beginPath(); + this.moveToLineTo_(flatCoordinates, 0, flatCoordinates.length, geometry.getStride(), false); + context.stroke(); + } + + if (this.text_ !== '') { + var flatMidpoint = geometry.getFlatMidpoint(); + this.drawText_(flatMidpoint, 0, 2, 2); + } + }; + /** + * Render a MultiLineString geometry into the canvas. Rendering is immediate + * and uses the current style. + * + * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry. + */ + + + CanvasImmediateRenderer.prototype.drawMultiLineString = function (geometry) { + if (this.squaredTolerance_) { + geometry = + /** @type {import("../../geom/MultiLineString.js").default} */ + geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_); + } + + var geometryExtent = geometry.getExtent(); + + if (!(0, _extent.intersects)(this.extent_, geometryExtent)) { + return; + } + + if (this.strokeState_) { + this.setContextStrokeState_(this.strokeState_); + var context = this.context_; + var flatCoordinates = geometry.getFlatCoordinates(); + var offset = 0; + var ends = + /** @type {Array<number>} */ + geometry.getEnds(); + var stride = geometry.getStride(); + context.beginPath(); + + for (var i = 0, ii = ends.length; i < ii; ++i) { + offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, false); + } + + context.stroke(); + } + + if (this.text_ !== '') { + var flatMidpoints = geometry.getFlatMidpoints(); + this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2); + } + }; + /** + * Render a Polygon geometry into the canvas. Rendering is immediate and uses + * the current style. + * + * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry. + */ + + + CanvasImmediateRenderer.prototype.drawPolygon = function (geometry) { + if (this.squaredTolerance_) { + geometry = + /** @type {import("../../geom/Polygon.js").default} */ + geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_); + } + + if (!(0, _extent.intersects)(this.extent_, geometry.getExtent())) { + return; + } + + if (this.strokeState_ || this.fillState_) { + if (this.fillState_) { + this.setContextFillState_(this.fillState_); + } + + if (this.strokeState_) { + this.setContextStrokeState_(this.strokeState_); + } + + var context = this.context_; + context.beginPath(); + this.drawRings_(geometry.getOrientedFlatCoordinates(), 0, + /** @type {Array<number>} */ + geometry.getEnds(), geometry.getStride()); + + if (this.fillState_) { + context.fill(); + } + + if (this.strokeState_) { + context.stroke(); + } + } + + if (this.text_ !== '') { + var flatInteriorPoint = geometry.getFlatInteriorPoint(); + this.drawText_(flatInteriorPoint, 0, 2, 2); + } + }; + /** + * Render MultiPolygon geometry into the canvas. Rendering is immediate and + * uses the current style. + * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry. + */ + + + CanvasImmediateRenderer.prototype.drawMultiPolygon = function (geometry) { + if (this.squaredTolerance_) { + geometry = + /** @type {import("../../geom/MultiPolygon.js").default} */ + geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_); + } + + if (!(0, _extent.intersects)(this.extent_, geometry.getExtent())) { + return; + } + + if (this.strokeState_ || this.fillState_) { + if (this.fillState_) { + this.setContextFillState_(this.fillState_); + } + + if (this.strokeState_) { + this.setContextStrokeState_(this.strokeState_); + } + + var context = this.context_; + var flatCoordinates = geometry.getOrientedFlatCoordinates(); + var offset = 0; + var endss = geometry.getEndss(); + var stride = geometry.getStride(); + context.beginPath(); + + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + offset = this.drawRings_(flatCoordinates, offset, ends, stride); + } + + if (this.fillState_) { + context.fill(); + } + + if (this.strokeState_) { + context.stroke(); + } + } + + if (this.text_ !== '') { + var flatInteriorPoints = geometry.getFlatInteriorPoints(); + this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2); + } + }; + /** + * @param {import("../canvas.js").FillState} fillState Fill state. + * @private + */ + + + CanvasImmediateRenderer.prototype.setContextFillState_ = function (fillState) { + var context = this.context_; + var contextFillState = this.contextFillState_; + + if (!contextFillState) { + context.fillStyle = fillState.fillStyle; + this.contextFillState_ = { + fillStyle: fillState.fillStyle + }; + } else { + if (contextFillState.fillStyle != fillState.fillStyle) { + contextFillState.fillStyle = fillState.fillStyle; + context.fillStyle = fillState.fillStyle; + } + } + }; + /** + * @param {import("../canvas.js").StrokeState} strokeState Stroke state. + * @private + */ + + + CanvasImmediateRenderer.prototype.setContextStrokeState_ = function (strokeState) { + var context = this.context_; + var contextStrokeState = this.contextStrokeState_; + + if (!contextStrokeState) { + context.lineCap = strokeState.lineCap; + + if (context.setLineDash) { + context.setLineDash(strokeState.lineDash); + context.lineDashOffset = strokeState.lineDashOffset; + } + + context.lineJoin = strokeState.lineJoin; + context.lineWidth = strokeState.lineWidth; + context.miterLimit = strokeState.miterLimit; + context.strokeStyle = strokeState.strokeStyle; + this.contextStrokeState_ = { + lineCap: strokeState.lineCap, + lineDash: strokeState.lineDash, + lineDashOffset: strokeState.lineDashOffset, + lineJoin: strokeState.lineJoin, + lineWidth: strokeState.lineWidth, + miterLimit: strokeState.miterLimit, + strokeStyle: strokeState.strokeStyle + }; + } else { + if (contextStrokeState.lineCap != strokeState.lineCap) { + contextStrokeState.lineCap = strokeState.lineCap; + context.lineCap = strokeState.lineCap; + } + + if (context.setLineDash) { + if (!(0, _array.equals)(contextStrokeState.lineDash, strokeState.lineDash)) { + context.setLineDash(contextStrokeState.lineDash = strokeState.lineDash); + } + + if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) { + contextStrokeState.lineDashOffset = strokeState.lineDashOffset; + context.lineDashOffset = strokeState.lineDashOffset; + } + } + + if (contextStrokeState.lineJoin != strokeState.lineJoin) { + contextStrokeState.lineJoin = strokeState.lineJoin; + context.lineJoin = strokeState.lineJoin; + } + + if (contextStrokeState.lineWidth != strokeState.lineWidth) { + contextStrokeState.lineWidth = strokeState.lineWidth; + context.lineWidth = strokeState.lineWidth; + } + + if (contextStrokeState.miterLimit != strokeState.miterLimit) { + contextStrokeState.miterLimit = strokeState.miterLimit; + context.miterLimit = strokeState.miterLimit; + } + + if (contextStrokeState.strokeStyle != strokeState.strokeStyle) { + contextStrokeState.strokeStyle = strokeState.strokeStyle; + context.strokeStyle = strokeState.strokeStyle; + } + } + }; + /** + * @param {import("../canvas.js").TextState} textState Text state. + * @private + */ + + + CanvasImmediateRenderer.prototype.setContextTextState_ = function (textState) { + var context = this.context_; + var contextTextState = this.contextTextState_; + var textAlign = textState.textAlign ? textState.textAlign : _canvas.defaultTextAlign; + + if (!contextTextState) { + context.font = textState.font; + context.textAlign = + /** @type {CanvasTextAlign} */ + textAlign; + context.textBaseline = + /** @type {CanvasTextBaseline} */ + textState.textBaseline; + this.contextTextState_ = { + font: textState.font, + textAlign: textAlign, + textBaseline: textState.textBaseline + }; + } else { + if (contextTextState.font != textState.font) { + contextTextState.font = textState.font; + context.font = textState.font; + } + + if (contextTextState.textAlign != textAlign) { + contextTextState.textAlign = + /** @type {CanvasTextAlign} */ + textAlign; + context.textAlign = + /** @type {CanvasTextAlign} */ + textAlign; + } + + if (contextTextState.textBaseline != textState.textBaseline) { + contextTextState.textBaseline = + /** @type {CanvasTextBaseline} */ + textState.textBaseline; + context.textBaseline = + /** @type {CanvasTextBaseline} */ + textState.textBaseline; + } + } + }; + /** + * Set the fill and stroke style for subsequent draw operations. To clear + * either fill or stroke styles, pass null for the appropriate parameter. + * + * @param {import("../../style/Fill.js").default} fillStyle Fill style. + * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style. + */ + + + CanvasImmediateRenderer.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) { + if (!fillStyle) { + this.fillState_ = null; + } else { + var fillStyleColor = fillStyle.getColor(); + this.fillState_ = { + fillStyle: (0, _colorlike.asColorLike)(fillStyleColor ? fillStyleColor : _canvas.defaultFillStyle) + }; + } + + if (!strokeStyle) { + this.strokeState_ = null; + } else { + var strokeStyleColor = strokeStyle.getColor(); + var strokeStyleLineCap = strokeStyle.getLineCap(); + var strokeStyleLineDash = strokeStyle.getLineDash(); + var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset(); + var strokeStyleLineJoin = strokeStyle.getLineJoin(); + var strokeStyleWidth = strokeStyle.getWidth(); + var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); + this.strokeState_ = { + lineCap: strokeStyleLineCap !== undefined ? strokeStyleLineCap : _canvas.defaultLineCap, + lineDash: strokeStyleLineDash ? strokeStyleLineDash : _canvas.defaultLineDash, + lineDashOffset: strokeStyleLineDashOffset ? strokeStyleLineDashOffset : _canvas.defaultLineDashOffset, + lineJoin: strokeStyleLineJoin !== undefined ? strokeStyleLineJoin : _canvas.defaultLineJoin, + lineWidth: this.pixelRatio_ * (strokeStyleWidth !== undefined ? strokeStyleWidth : _canvas.defaultLineWidth), + miterLimit: strokeStyleMiterLimit !== undefined ? strokeStyleMiterLimit : _canvas.defaultMiterLimit, + strokeStyle: (0, _colorlike.asColorLike)(strokeStyleColor ? strokeStyleColor : _canvas.defaultStrokeStyle) + }; + } + }; + /** + * Set the image style for subsequent draw operations. Pass null to remove + * the image style. + * + * @param {import("../../style/Image.js").default} imageStyle Image style. + */ + + + CanvasImmediateRenderer.prototype.setImageStyle = function (imageStyle) { + if (!imageStyle) { + this.image_ = null; + } else { + var imageSize = imageStyle.getSize(); + + if (!imageSize) { + this.image_ = null; + } else { + var imageAnchor = imageStyle.getAnchor(); // FIXME pixel ratio + + var imageImage = imageStyle.getImage(1); + var imageOrigin = imageStyle.getOrigin(); + var imageScale = imageStyle.getScaleArray(); + this.imageAnchorX_ = imageAnchor[0]; + this.imageAnchorY_ = imageAnchor[1]; + this.imageHeight_ = imageSize[1]; + this.image_ = imageImage; + this.imageOpacity_ = imageStyle.getOpacity(); + this.imageOriginX_ = imageOrigin[0]; + this.imageOriginY_ = imageOrigin[1]; + this.imageRotateWithView_ = imageStyle.getRotateWithView(); + this.imageRotation_ = imageStyle.getRotation(); + this.imageScale_ = [this.pixelRatio_ * imageScale[0], this.pixelRatio_ * imageScale[1]]; + this.imageWidth_ = imageSize[0]; + } + } + }; + /** + * Set the text style for subsequent draw operations. Pass null to + * remove the text style. + * + * @param {import("../../style/Text.js").default} textStyle Text style. + */ + + + CanvasImmediateRenderer.prototype.setTextStyle = function (textStyle) { + if (!textStyle) { + this.text_ = ''; + } else { + var textFillStyle = textStyle.getFill(); + + if (!textFillStyle) { + this.textFillState_ = null; + } else { + var textFillStyleColor = textFillStyle.getColor(); + this.textFillState_ = { + fillStyle: (0, _colorlike.asColorLike)(textFillStyleColor ? textFillStyleColor : _canvas.defaultFillStyle) + }; + } + + var textStrokeStyle = textStyle.getStroke(); + + if (!textStrokeStyle) { + this.textStrokeState_ = null; + } else { + var textStrokeStyleColor = textStrokeStyle.getColor(); + var textStrokeStyleLineCap = textStrokeStyle.getLineCap(); + var textStrokeStyleLineDash = textStrokeStyle.getLineDash(); + var textStrokeStyleLineDashOffset = textStrokeStyle.getLineDashOffset(); + var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin(); + var textStrokeStyleWidth = textStrokeStyle.getWidth(); + var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit(); + this.textStrokeState_ = { + lineCap: textStrokeStyleLineCap !== undefined ? textStrokeStyleLineCap : _canvas.defaultLineCap, + lineDash: textStrokeStyleLineDash ? textStrokeStyleLineDash : _canvas.defaultLineDash, + lineDashOffset: textStrokeStyleLineDashOffset ? textStrokeStyleLineDashOffset : _canvas.defaultLineDashOffset, + lineJoin: textStrokeStyleLineJoin !== undefined ? textStrokeStyleLineJoin : _canvas.defaultLineJoin, + lineWidth: textStrokeStyleWidth !== undefined ? textStrokeStyleWidth : _canvas.defaultLineWidth, + miterLimit: textStrokeStyleMiterLimit !== undefined ? textStrokeStyleMiterLimit : _canvas.defaultMiterLimit, + strokeStyle: (0, _colorlike.asColorLike)(textStrokeStyleColor ? textStrokeStyleColor : _canvas.defaultStrokeStyle) + }; + } + + var textFont = textStyle.getFont(); + var textOffsetX = textStyle.getOffsetX(); + var textOffsetY = textStyle.getOffsetY(); + var textRotateWithView = textStyle.getRotateWithView(); + var textRotation = textStyle.getRotation(); + var textScale = textStyle.getScaleArray(); + var textText = textStyle.getText(); + var textTextAlign = textStyle.getTextAlign(); + var textTextBaseline = textStyle.getTextBaseline(); + this.textState_ = { + font: textFont !== undefined ? textFont : _canvas.defaultFont, + textAlign: textTextAlign !== undefined ? textTextAlign : _canvas.defaultTextAlign, + textBaseline: textTextBaseline !== undefined ? textTextBaseline : _canvas.defaultTextBaseline + }; + this.text_ = textText !== undefined ? textText : ''; + this.textOffsetX_ = textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0; + this.textOffsetY_ = textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0; + this.textRotateWithView_ = textRotateWithView !== undefined ? textRotateWithView : false; + this.textRotation_ = textRotation !== undefined ? textRotation : 0; + this.textScale_ = [this.pixelRatio_ * textScale[0], this.pixelRatio_ * textScale[1]]; + } + }; + + return CanvasImmediateRenderer; +}(_VectorContext.default); + +var _default = CanvasImmediateRenderer; +exports.default = _default; +},{"../../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../VectorContext.js":"../../../node_modules/ol/render/VectorContext.js","../../colorlike.js":"../../../node_modules/ol/colorlike.js","../../transform.js":"../../../node_modules/ol/transform.js","../canvas.js":"../../../node_modules/ol/render/canvas.js","../../array.js":"../../../node_modules/ol/array.js","../../extent.js":"../../../node_modules/ol/extent.js","../../geom/flat/transform.js":"../../../node_modules/ol/geom/flat/transform.js","../../geom/SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js"}],"../../../node_modules/ol/style/IconAnchorUnits.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/style/IconAnchorUnits + */ + +/** + * Icon anchor units. One of 'fraction', 'pixels'. + * @enum {string} + */ +var _default = { + /** + * Anchor is a fraction + * @api + */ + FRACTION: 'fraction', + + /** + * Anchor is in pixels + * @api + */ + PIXELS: 'pixels' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/style/IconOrigin.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/style/IconOrigin + */ + +/** + * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'. + * @enum {string} + */ +var _default = { + /** + * Origin is at bottom left + * @api + */ + BOTTOM_LEFT: 'bottom-left', + + /** + * Origin is at bottom right + * @api + */ + BOTTOM_RIGHT: 'bottom-right', + + /** + * Origin is at top left + * @api + */ + TOP_LEFT: 'top-left', + + /** + * Origin is at top right + * @api + */ + TOP_RIGHT: 'top-right' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/style/IconImageCache.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.shared = exports.default = void 0; + +var _color = require("../color.js"); + +/** + * @module ol/style/IconImageCache + */ + +/** + * @classdesc + * Singleton class. Available through {@link module:ol/style/IconImageCache~shared}. + */ +var IconImageCache = +/** @class */ +function () { + function IconImageCache() { + /** + * @type {!Object<string, import("./IconImage.js").default>} + * @private + */ + this.cache_ = {}; + /** + * @type {number} + * @private + */ + + this.cacheSize_ = 0; + /** + * @type {number} + * @private + */ + + this.maxCacheSize_ = 32; + } + /** + * FIXME empty description for jsdoc + */ + + + IconImageCache.prototype.clear = function () { + this.cache_ = {}; + this.cacheSize_ = 0; + }; + /** + * @return {boolean} Can expire cache. + */ + + + IconImageCache.prototype.canExpireCache = function () { + return this.cacheSize_ > this.maxCacheSize_; + }; + /** + * FIXME empty description for jsdoc + */ + + + IconImageCache.prototype.expire = function () { + if (this.canExpireCache()) { + var i = 0; + + for (var key in this.cache_) { + var iconImage = this.cache_[key]; + + if ((i++ & 3) === 0 && !iconImage.hasListener()) { + delete this.cache_[key]; + --this.cacheSize_; + } + } + } + }; + /** + * @param {string} src Src. + * @param {?string} crossOrigin Cross origin. + * @param {import("../color.js").Color} color Color. + * @return {import("./IconImage.js").default} Icon image. + */ + + + IconImageCache.prototype.get = function (src, crossOrigin, color) { + var key = getKey(src, crossOrigin, color); + return key in this.cache_ ? this.cache_[key] : null; + }; + /** + * @param {string} src Src. + * @param {?string} crossOrigin Cross origin. + * @param {import("../color.js").Color} color Color. + * @param {import("./IconImage.js").default} iconImage Icon image. + */ + + + IconImageCache.prototype.set = function (src, crossOrigin, color, iconImage) { + var key = getKey(src, crossOrigin, color); + this.cache_[key] = iconImage; + ++this.cacheSize_; + }; + /** + * Set the cache size of the icon cache. Default is `32`. Change this value when + * your map uses more than 32 different icon images and you are not caching icon + * styles on the application level. + * @param {number} maxCacheSize Cache max size. + * @api + */ + + + IconImageCache.prototype.setSize = function (maxCacheSize) { + this.maxCacheSize_ = maxCacheSize; + this.expire(); + }; + + return IconImageCache; +}(); +/** + * @param {string} src Src. + * @param {?string} crossOrigin Cross origin. + * @param {import("../color.js").Color} color Color. + * @return {string} Cache key. + */ + + +function getKey(src, crossOrigin, color) { + var colorString = color ? (0, _color.asString)(color) : 'null'; + return crossOrigin + ':' + src + ':' + colorString; +} + +var _default = IconImageCache; +/** + * The {@link module:ol/style/IconImageCache~IconImageCache} for + * {@link module:ol/style/Icon~Icon} images. + * @api + */ + +exports.default = _default; +var shared = new IconImageCache(); +exports.shared = shared; +},{"../color.js":"../../../node_modules/ol/color.js"}],"../../../node_modules/ol/ImageBase.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Target = _interopRequireDefault(require("./events/Target.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _util = require("./util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/ImageBase + */ + + +/** + * @abstract + */ +var ImageBase = +/** @class */ +function (_super) { + __extends(ImageBase, _super); + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number|undefined} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("./ImageState.js").default} state State. + */ + + + function ImageBase(extent, resolution, pixelRatio, state) { + var _this = _super.call(this) || this; + /** + * @protected + * @type {import("./extent.js").Extent} + */ + + + _this.extent = extent; + /** + * @private + * @type {number} + */ + + _this.pixelRatio_ = pixelRatio; + /** + * @protected + * @type {number|undefined} + */ + + _this.resolution = resolution; + /** + * @protected + * @type {import("./ImageState.js").default} + */ + + _this.state = state; + return _this; + } + /** + * @protected + */ + + + ImageBase.prototype.changed = function () { + this.dispatchEvent(_EventType.default.CHANGE); + }; + /** + * @return {import("./extent.js").Extent} Extent. + */ + + + ImageBase.prototype.getExtent = function () { + return this.extent; + }; + /** + * @abstract + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + */ + + + ImageBase.prototype.getImage = function () { + return (0, _util.abstract)(); + }; + /** + * @return {number} PixelRatio. + */ + + + ImageBase.prototype.getPixelRatio = function () { + return this.pixelRatio_; + }; + /** + * @return {number} Resolution. + */ + + + ImageBase.prototype.getResolution = function () { + return ( + /** @type {number} */ + this.resolution + ); + }; + /** + * @return {import("./ImageState.js").default} State. + */ + + + ImageBase.prototype.getState = function () { + return this.state; + }; + /** + * Load not yet loaded URI. + * @abstract + */ + + + ImageBase.prototype.load = function () { + (0, _util.abstract)(); + }; + + return ImageBase; +}(_Target.default); + +var _default = ImageBase; +exports.default = _default; +},{"./events/Target.js":"../../../node_modules/ol/events/Target.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/Image.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.listenImage = listenImage; +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _ImageBase = _interopRequireDefault(require("./ImageBase.js")); + +var _ImageState = _interopRequireDefault(require("./ImageState.js")); + +var _has = require("./has.js"); + +var _extent = require("./extent.js"); + +var _events = require("./events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Image + */ + + +/** + * A function that takes an {@link module:ol/Image~Image} for the image and a + * `{string}` for the src as arguments. It is supposed to make it so the + * underlying image {@link module:ol/Image~Image#getImage} is assigned the + * content specified by the src. If not specified, the default is + * + * function(image, src) { + * image.getImage().src = src; + * } + * + * Providing a custom `imageLoadFunction` can be useful to load images with + * post requests or - in general - through XHR requests, where the src of the + * image element would be set to a data URI when the content is loaded. + * + * @typedef {function(ImageWrapper, string): void} LoadFunction + * @api + */ +var ImageWrapper = +/** @class */ +function (_super) { + __extends(ImageWrapper, _super); + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number|undefined} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {string} src Image source URI. + * @param {?string} crossOrigin Cross origin. + * @param {LoadFunction} imageLoadFunction Image load function. + */ + + + function ImageWrapper(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) { + var _this = _super.call(this, extent, resolution, pixelRatio, _ImageState.default.IDLE) || this; + /** + * @private + * @type {string} + */ + + + _this.src_ = src; + /** + * @private + * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} + */ + + _this.image_ = new Image(); + + if (crossOrigin !== null) { + _this.image_.crossOrigin = crossOrigin; + } + /** + * @private + * @type {?function():void} + */ + + + _this.unlisten_ = null; + /** + * @protected + * @type {import("./ImageState.js").default} + */ + + _this.state = _ImageState.default.IDLE; + /** + * @private + * @type {LoadFunction} + */ + + _this.imageLoadFunction_ = imageLoadFunction; + return _this; + } + /** + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + * @api + */ + + + ImageWrapper.prototype.getImage = function () { + return this.image_; + }; + /** + * Tracks loading or read errors. + * + * @private + */ + + + ImageWrapper.prototype.handleImageError_ = function () { + this.state = _ImageState.default.ERROR; + this.unlistenImage_(); + this.changed(); + }; + /** + * Tracks successful image load. + * + * @private + */ + + + ImageWrapper.prototype.handleImageLoad_ = function () { + if (this.resolution === undefined) { + this.resolution = (0, _extent.getHeight)(this.extent) / this.image_.height; + } + + this.state = _ImageState.default.LOADED; + this.unlistenImage_(); + this.changed(); + }; + /** + * Load the image or retry if loading previously failed. + * Loading is taken care of by the tile queue, and calling this method is + * only needed for preloading or for reloading in case of an error. + * @api + */ + + + ImageWrapper.prototype.load = function () { + if (this.state == _ImageState.default.IDLE || this.state == _ImageState.default.ERROR) { + this.state = _ImageState.default.LOADING; + this.changed(); + this.imageLoadFunction_(this, this.src_); + this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this)); + } + }; + /** + * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image. + */ + + + ImageWrapper.prototype.setImage = function (image) { + this.image_ = image; + }; + /** + * Discards event handlers which listen for load completion or errors. + * + * @private + */ + + + ImageWrapper.prototype.unlistenImage_ = function () { + if (this.unlisten_) { + this.unlisten_(); + this.unlisten_ = null; + } + }; + + return ImageWrapper; +}(_ImageBase.default); +/** + * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image element. + * @param {function():any} loadHandler Load callback function. + * @param {function():any} errorHandler Error callback function. + * @return {function():void} Callback to stop listening. + */ + + +function listenImage(image, loadHandler, errorHandler) { + var img = + /** @type {HTMLImageElement} */ + image; + + if (img.src && _has.IMAGE_DECODE) { + var promise = img.decode(); + var listening_1 = true; + + var unlisten = function () { + listening_1 = false; + }; + + promise.then(function () { + if (listening_1) { + loadHandler(); + } + }).catch(function (error) { + if (listening_1) { + // FIXME: Unconditionally call errorHandler() when this bug is fixed upstream: + // https://bugs.webkit.org/show_bug.cgi?id=198527 + if (error.name === 'EncodingError' && error.message === 'Invalid image type.') { + loadHandler(); + } else { + errorHandler(); + } + } + }); + return unlisten; + } + + var listenerKeys = [(0, _events.listenOnce)(img, _EventType.default.LOAD, loadHandler), (0, _events.listenOnce)(img, _EventType.default.ERROR, errorHandler)]; + return function unlisten() { + listenerKeys.forEach(_events.unlistenByKey); + }; +} + +var _default = ImageWrapper; +exports.default = _default; +},{"./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./ImageBase.js":"../../../node_modules/ol/ImageBase.js","./ImageState.js":"../../../node_modules/ol/ImageState.js","./has.js":"../../../node_modules/ol/has.js","./extent.js":"../../../node_modules/ol/extent.js","./events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/style/IconImage.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.get = get; +exports.default = void 0; + +var _Target = _interopRequireDefault(require("../events/Target.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _ImageState = _interopRequireDefault(require("../ImageState.js")); + +var _dom = require("../dom.js"); + +var _IconImageCache = require("./IconImageCache.js"); + +var _Image = require("../Image.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/style/IconImage + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * @type {CanvasRenderingContext2D} + */ +var taintedTestContext = null; + +var IconImage = +/** @class */ +function (_super) { + __extends(IconImage, _super); + /** + * @param {HTMLImageElement|HTMLCanvasElement} image Image. + * @param {string|undefined} src Src. + * @param {import("../size.js").Size} size Size. + * @param {?string} crossOrigin Cross origin. + * @param {import("../ImageState.js").default} imageState Image state. + * @param {import("../color.js").Color} color Color. + */ + + + function IconImage(image, src, size, crossOrigin, imageState, color) { + var _this = _super.call(this) || this; + /** + * @private + * @type {HTMLImageElement|HTMLCanvasElement} + */ + + + _this.hitDetectionImage_ = null; + /** + * @private + * @type {HTMLImageElement|HTMLCanvasElement} + */ + + _this.image_ = !image ? new Image() : image; + + if (crossOrigin !== null) { + /** @type {HTMLImageElement} */ + _this.image_.crossOrigin = crossOrigin; + } + /** + * @private + * @type {Object<number, HTMLCanvasElement>} + */ + + + _this.canvas_ = {}; + /** + * @private + * @type {import("../color.js").Color} + */ + + _this.color_ = color; + /** + * @private + * @type {?function():void} + */ + + _this.unlisten_ = null; + /** + * @private + * @type {import("../ImageState.js").default} + */ + + _this.imageState_ = imageState; + /** + * @private + * @type {import("../size.js").Size} + */ + + _this.size_ = size; + /** + * @private + * @type {string|undefined} + */ + + _this.src_ = src; + /** + * @private + */ + + _this.tainted_; + return _this; + } + /** + * @private + * @return {boolean} The image canvas is tainted. + */ + + + IconImage.prototype.isTainted_ = function () { + if (this.tainted_ === undefined && this.imageState_ === _ImageState.default.LOADED) { + if (!taintedTestContext) { + taintedTestContext = (0, _dom.createCanvasContext2D)(1, 1); + } + + taintedTestContext.drawImage(this.image_, 0, 0); + + try { + taintedTestContext.getImageData(0, 0, 1, 1); + this.tainted_ = false; + } catch (e) { + taintedTestContext = null; + this.tainted_ = true; + } + } + + return this.tainted_ === true; + }; + /** + * @private + */ + + + IconImage.prototype.dispatchChangeEvent_ = function () { + this.dispatchEvent(_EventType.default.CHANGE); + }; + /** + * @private + */ + + + IconImage.prototype.handleImageError_ = function () { + this.imageState_ = _ImageState.default.ERROR; + this.unlistenImage_(); + this.dispatchChangeEvent_(); + }; + /** + * @private + */ + + + IconImage.prototype.handleImageLoad_ = function () { + this.imageState_ = _ImageState.default.LOADED; + + if (this.size_) { + this.image_.width = this.size_[0]; + this.image_.height = this.size_[1]; + } else { + this.size_ = [this.image_.width, this.image_.height]; + } + + this.unlistenImage_(); + this.dispatchChangeEvent_(); + }; + /** + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element. + */ + + + IconImage.prototype.getImage = function (pixelRatio) { + this.replaceColor_(pixelRatio); + return this.canvas_[pixelRatio] ? this.canvas_[pixelRatio] : this.image_; + }; + /** + * @param {number} pixelRatio Pixel ratio. + * @return {number} Image or Canvas element. + */ + + + IconImage.prototype.getPixelRatio = function (pixelRatio) { + this.replaceColor_(pixelRatio); + return this.canvas_[pixelRatio] ? pixelRatio : 1; + }; + /** + * @return {import("../ImageState.js").default} Image state. + */ + + + IconImage.prototype.getImageState = function () { + return this.imageState_; + }; + /** + * @return {HTMLImageElement|HTMLCanvasElement} Image element. + */ + + + IconImage.prototype.getHitDetectionImage = function () { + if (!this.hitDetectionImage_) { + if (this.isTainted_()) { + var width = this.size_[0]; + var height = this.size_[1]; + var context = (0, _dom.createCanvasContext2D)(width, height); + context.fillRect(0, 0, width, height); + this.hitDetectionImage_ = context.canvas; + } else { + this.hitDetectionImage_ = this.image_; + } + } + + return this.hitDetectionImage_; + }; + /** + * Get the size of the icon (in pixels). + * @return {import("../size.js").Size} Image size. + */ + + + IconImage.prototype.getSize = function () { + return this.size_; + }; + /** + * @return {string|undefined} Image src. + */ + + + IconImage.prototype.getSrc = function () { + return this.src_; + }; + /** + * Load not yet loaded URI. + */ + + + IconImage.prototype.load = function () { + if (this.imageState_ == _ImageState.default.IDLE) { + this.imageState_ = _ImageState.default.LOADING; + + try { + /** @type {HTMLImageElement} */ + this.image_.src = this.src_; + } catch (e) { + this.handleImageError_(); + } + + this.unlisten_ = (0, _Image.listenImage)(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this)); + } + }; + /** + * @param {number} pixelRatio Pixel ratio. + * @private + */ + + + IconImage.prototype.replaceColor_ = function (pixelRatio) { + if (!this.color_ || this.canvas_[pixelRatio]) { + return; + } + + var canvas = document.createElement('canvas'); + this.canvas_[pixelRatio] = canvas; + canvas.width = Math.ceil(this.image_.width * pixelRatio); + canvas.height = Math.ceil(this.image_.height * pixelRatio); + var ctx = canvas.getContext('2d'); + ctx.scale(pixelRatio, pixelRatio); + ctx.drawImage(this.image_, 0, 0); + + if (this.isTainted_()) { + // If reading from the canvas throws a SecurityError the same effect can be + // achieved with globalCompositeOperation. + // This could be used as the default, but it is not fully supported by all + // browsers. E. g. Internet Explorer 11 does not support the multiply + // operation and the resulting image shape will be completelly filled with + // the provided color. + // So this is only used as a fallback. It is still better than having no icon + // at all. + var c = this.color_; + ctx.globalCompositeOperation = 'multiply'; + ctx.fillStyle = 'rgb(' + c[0] + ',' + c[1] + ',' + c[2] + ')'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.globalCompositeOperation = 'destination-in'; + ctx.drawImage(this.image_, 0, 0); + return; + } + + var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height); + var data = imgData.data; + var r = this.color_[0] / 255.0; + var g = this.color_[1] / 255.0; + var b = this.color_[2] / 255.0; + + for (var i = 0, ii = data.length; i < ii; i += 4) { + data[i] *= r; + data[i + 1] *= g; + data[i + 2] *= b; + } + + ctx.putImageData(imgData, 0, 0); + }; + /** + * Discards event handlers which listen for load completion or errors. + * + * @private + */ + + + IconImage.prototype.unlistenImage_ = function () { + if (this.unlisten_) { + this.unlisten_(); + this.unlisten_ = null; + } + }; + + return IconImage; +}(_Target.default); +/** + * @param {HTMLImageElement|HTMLCanvasElement} image Image. + * @param {string} src Src. + * @param {import("../size.js").Size} size Size. + * @param {?string} crossOrigin Cross origin. + * @param {import("../ImageState.js").default} imageState Image state. + * @param {import("../color.js").Color} color Color. + * @return {IconImage} Icon image. + */ + + +function get(image, src, size, crossOrigin, imageState, color) { + var iconImage = _IconImageCache.shared.get(src, crossOrigin, color); + + if (!iconImage) { + iconImage = new IconImage(image, src, size, crossOrigin, imageState, color); + + _IconImageCache.shared.set(src, crossOrigin, color, iconImage); + } + + return iconImage; +} + +var _default = IconImage; +exports.default = _default; +},{"../events/Target.js":"../../../node_modules/ol/events/Target.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../ImageState.js":"../../../node_modules/ol/ImageState.js","../dom.js":"../../../node_modules/ol/dom.js","./IconImageCache.js":"../../../node_modules/ol/style/IconImageCache.js","../Image.js":"../../../node_modules/ol/Image.js"}],"../../../node_modules/ol/style/Icon.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _IconAnchorUnits = _interopRequireDefault(require("./IconAnchorUnits.js")); + +var _IconOrigin = _interopRequireDefault(require("./IconOrigin.js")); + +var _ImageState = _interopRequireDefault(require("../ImageState.js")); + +var _Image = _interopRequireDefault(require("./Image.js")); + +var _color = require("../color.js"); + +var _asserts = require("../asserts.js"); + +var _IconImage = require("./IconImage.js"); + +var _util = require("../util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/style/Icon + */ + + +/** + * @typedef {Object} Options + * @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center. + * @property {import("./IconOrigin.js").default} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`, + * `top-left` or `top-right`. + * @property {import("./IconAnchorUnits.js").default} [anchorXUnits='fraction'] Units in which the anchor x value is + * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates + * the x value in pixels. + * @property {import("./IconAnchorUnits.js").default} [anchorYUnits='fraction'] Units in which the anchor y value is + * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates + * the y value in pixels. + * @property {import("../color.js").Color|string} [color] Color to tint the icon. If not specified, + * the icon will be left as is. + * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a + * `crossOrigin` value if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. + * @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the + * provided image must already be loaded. And in that case, it is required + * to provide the size of the image, with the `imgSize` option. + * @property {Array<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the + * sub-rectangle to use from the original icon image. + * @property {Array<number>} [displacement=[0,0]] Displacement the icon + * @property {import("./IconOrigin.js").default} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`, + * `top-left` or `top-right`. + * @property {number} [opacity=1] Opacity of the icon. + * @property {number|import("../size.js").Size} [scale=1] Scale. + * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view. + * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise). + * @property {import("../size.js").Size} [size] Icon size in pixel. Can be used together with `offset` to define the + * sub-rectangle to use from the origin (sprite) icon image. + * @property {import("../size.js").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not, and + * for SVG images in Internet Explorer 11. The provided `imgSize` needs to match the actual size of the image. + * @property {string} [src] Image source URI. + */ + +/** + * @classdesc + * Set icon style for vector features. + * @api + */ +var Icon = +/** @class */ +function (_super) { + __extends(Icon, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Icon(opt_options) { + var _this = this; + + var options = opt_options || {}; + /** + * @type {number} + */ + + var opacity = options.opacity !== undefined ? options.opacity : 1; + /** + * @type {number} + */ + + var rotation = options.rotation !== undefined ? options.rotation : 0; + /** + * @type {number|import("../size.js").Size} + */ + + var scale = options.scale !== undefined ? options.scale : 1; + /** + * @type {boolean} + */ + + var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false; + _this = _super.call(this, { + opacity: opacity, + rotation: rotation, + scale: scale, + displacement: options.displacement !== undefined ? options.displacement : [0, 0], + rotateWithView: rotateWithView + }) || this; + /** + * @private + * @type {Array<number>} + */ + + _this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5]; + /** + * @private + * @type {Array<number>} + */ + + _this.normalizedAnchor_ = null; + /** + * @private + * @type {import("./IconOrigin.js").default} + */ + + _this.anchorOrigin_ = options.anchorOrigin !== undefined ? options.anchorOrigin : _IconOrigin.default.TOP_LEFT; + /** + * @private + * @type {import("./IconAnchorUnits.js").default} + */ + + _this.anchorXUnits_ = options.anchorXUnits !== undefined ? options.anchorXUnits : _IconAnchorUnits.default.FRACTION; + /** + * @private + * @type {import("./IconAnchorUnits.js").default} + */ + + _this.anchorYUnits_ = options.anchorYUnits !== undefined ? options.anchorYUnits : _IconAnchorUnits.default.FRACTION; + /** + * @private + * @type {?string} + */ + + _this.crossOrigin_ = options.crossOrigin !== undefined ? options.crossOrigin : null; + /** + * @type {HTMLImageElement|HTMLCanvasElement} + */ + + var image = options.img !== undefined ? options.img : null; + /** + * @type {import("../size.js").Size} + */ + + var imgSize = options.imgSize !== undefined ? options.imgSize : null; + /** + * @type {string|undefined} + */ + + var src = options.src; + (0, _asserts.assert)(!(src !== undefined && image), 4); // `image` and `src` cannot be provided at the same time + + (0, _asserts.assert)(!image || image && imgSize, 5); // `imgSize` must be set when `image` is provided + + if ((src === undefined || src.length === 0) && image) { + src = + /** @type {HTMLImageElement} */ + image.src || (0, _util.getUid)(image); + } + + (0, _asserts.assert)(src !== undefined && src.length > 0, 6); // A defined and non-empty `src` or `image` must be provided + + /** + * @type {import("../ImageState.js").default} + */ + + var imageState = options.src !== undefined ? _ImageState.default.IDLE : _ImageState.default.LOADED; + /** + * @private + * @type {import("../color.js").Color} + */ + + _this.color_ = options.color !== undefined ? (0, _color.asArray)(options.color) : null; + /** + * @private + * @type {import("./IconImage.js").default} + */ + + _this.iconImage_ = (0, _IconImage.get)(image, + /** @type {string} */ + src, imgSize, _this.crossOrigin_, imageState, _this.color_); + /** + * @private + * @type {Array<number>} + */ + + _this.offset_ = options.offset !== undefined ? options.offset : [0, 0]; + /** + * @private + * @type {import("./IconOrigin.js").default} + */ + + _this.offsetOrigin_ = options.offsetOrigin !== undefined ? options.offsetOrigin : _IconOrigin.default.TOP_LEFT; + /** + * @private + * @type {Array<number>} + */ + + _this.origin_ = null; + /** + * @private + * @type {import("../size.js").Size} + */ + + _this.size_ = options.size !== undefined ? options.size : null; + return _this; + } + /** + * Clones the style. The underlying Image/HTMLCanvasElement is not cloned. + * @return {Icon} The cloned style. + * @api + */ + + + Icon.prototype.clone = function () { + var scale = this.getScale(); + return new Icon({ + anchor: this.anchor_.slice(), + anchorOrigin: this.anchorOrigin_, + anchorXUnits: this.anchorXUnits_, + anchorYUnits: this.anchorYUnits_, + crossOrigin: this.crossOrigin_, + color: this.color_ && this.color_.slice ? this.color_.slice() : this.color_ || undefined, + src: this.getSrc(), + offset: this.offset_.slice(), + offsetOrigin: this.offsetOrigin_, + size: this.size_ !== null ? this.size_.slice() : undefined, + opacity: this.getOpacity(), + scale: Array.isArray(scale) ? scale.slice() : scale, + rotation: this.getRotation(), + rotateWithView: this.getRotateWithView() + }); + }; + /** + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @return {Array<number>} Anchor. + * @api + */ + + + Icon.prototype.getAnchor = function () { + if (this.normalizedAnchor_) { + return this.normalizedAnchor_; + } + + var anchor = this.anchor_; + var size = this.getSize(); + + if (this.anchorXUnits_ == _IconAnchorUnits.default.FRACTION || this.anchorYUnits_ == _IconAnchorUnits.default.FRACTION) { + if (!size) { + return null; + } + + anchor = this.anchor_.slice(); + + if (this.anchorXUnits_ == _IconAnchorUnits.default.FRACTION) { + anchor[0] *= size[0]; + } + + if (this.anchorYUnits_ == _IconAnchorUnits.default.FRACTION) { + anchor[1] *= size[1]; + } + } + + if (this.anchorOrigin_ != _IconOrigin.default.TOP_LEFT) { + if (!size) { + return null; + } + + if (anchor === this.anchor_) { + anchor = this.anchor_.slice(); + } + + if (this.anchorOrigin_ == _IconOrigin.default.TOP_RIGHT || this.anchorOrigin_ == _IconOrigin.default.BOTTOM_RIGHT) { + anchor[0] = -anchor[0] + size[0]; + } + + if (this.anchorOrigin_ == _IconOrigin.default.BOTTOM_LEFT || this.anchorOrigin_ == _IconOrigin.default.BOTTOM_RIGHT) { + anchor[1] = -anchor[1] + size[1]; + } + } + + this.normalizedAnchor_ = anchor; + return this.normalizedAnchor_; + }; + /** + * Set the anchor point. The anchor determines the center point for the + * symbolizer. + * + * @param {Array<number>} anchor Anchor. + * @api + */ + + + Icon.prototype.setAnchor = function (anchor) { + this.anchor_ = anchor; + this.normalizedAnchor_ = null; + }; + /** + * Get the icon color. + * @return {import("../color.js").Color} Color. + * @api + */ + + + Icon.prototype.getColor = function () { + return this.color_; + }; + /** + * Get the image icon. + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element. + * @api + */ + + + Icon.prototype.getImage = function (pixelRatio) { + return this.iconImage_.getImage(pixelRatio); + }; + /** + * Get the pixel ratio. + * @param {number} pixelRatio Pixel ratio. + * @return {number} The pixel ration of the image. + * @api + */ + + + Icon.prototype.getPixelRatio = function (pixelRatio) { + return this.iconImage_.getPixelRatio(pixelRatio); + }; + /** + * @return {import("../size.js").Size} Image size. + */ + + + Icon.prototype.getImageSize = function () { + return this.iconImage_.getSize(); + }; + /** + * @return {import("../size.js").Size} Size of the hit-detection image. + */ + + + Icon.prototype.getHitDetectionImageSize = function () { + return this.getImageSize(); + }; + /** + * @return {import("../ImageState.js").default} Image state. + */ + + + Icon.prototype.getImageState = function () { + return this.iconImage_.getImageState(); + }; + /** + * @return {HTMLImageElement|HTMLCanvasElement} Image element. + */ + + + Icon.prototype.getHitDetectionImage = function () { + return this.iconImage_.getHitDetectionImage(); + }; + /** + * Get the origin of the symbolizer. + * @return {Array<number>} Origin. + * @api + */ + + + Icon.prototype.getOrigin = function () { + if (this.origin_) { + return this.origin_; + } + + var offset = this.offset_; + var displacement = this.getDisplacement(); + + if (this.offsetOrigin_ != _IconOrigin.default.TOP_LEFT) { + var size = this.getSize(); + var iconImageSize = this.iconImage_.getSize(); + + if (!size || !iconImageSize) { + return null; + } + + offset = offset.slice(); + + if (this.offsetOrigin_ == _IconOrigin.default.TOP_RIGHT || this.offsetOrigin_ == _IconOrigin.default.BOTTOM_RIGHT) { + offset[0] = iconImageSize[0] - size[0] - offset[0]; + } + + if (this.offsetOrigin_ == _IconOrigin.default.BOTTOM_LEFT || this.offsetOrigin_ == _IconOrigin.default.BOTTOM_RIGHT) { + offset[1] = iconImageSize[1] - size[1] - offset[1]; + } + } + + offset[0] += displacement[0]; + offset[1] += displacement[1]; + this.origin_ = offset; + return this.origin_; + }; + /** + * Get the image URL. + * @return {string|undefined} Image src. + * @api + */ + + + Icon.prototype.getSrc = function () { + return this.iconImage_.getSrc(); + }; + /** + * Get the size of the icon (in pixels). + * @return {import("../size.js").Size} Image size. + * @api + */ + + + Icon.prototype.getSize = function () { + return !this.size_ ? this.iconImage_.getSize() : this.size_; + }; + /** + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + + + Icon.prototype.listenImageChange = function (listener) { + this.iconImage_.addEventListener(_EventType.default.CHANGE, listener); + }; + /** + * Load not yet loaded URI. + * When rendering a feature with an icon style, the vector renderer will + * automatically call this method. However, you might want to call this + * method yourself for preloading or other purposes. + * @api + */ + + + Icon.prototype.load = function () { + this.iconImage_.load(); + }; + /** + * @param {function(import("../events/Event.js").default): void} listener Listener function. + */ + + + Icon.prototype.unlistenImageChange = function (listener) { + this.iconImage_.removeEventListener(_EventType.default.CHANGE, listener); + }; + + return Icon; +}(_Image.default); + +var _default = Icon; +exports.default = _default; +},{"../events/EventType.js":"../../../node_modules/ol/events/EventType.js","./IconAnchorUnits.js":"../../../node_modules/ol/style/IconAnchorUnits.js","./IconOrigin.js":"../../../node_modules/ol/style/IconOrigin.js","../ImageState.js":"../../../node_modules/ol/ImageState.js","./Image.js":"../../../node_modules/ol/style/Image.js","../color.js":"../../../node_modules/ol/color.js","../asserts.js":"../../../node_modules/ol/asserts.js","./IconImage.js":"../../../node_modules/ol/style/IconImage.js","../util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/style.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Circle", { + enumerable: true, + get: function () { + return _Circle.default; + } +}); +Object.defineProperty(exports, "Fill", { + enumerable: true, + get: function () { + return _Fill.default; + } +}); +Object.defineProperty(exports, "Icon", { + enumerable: true, + get: function () { + return _Icon.default; + } +}); +Object.defineProperty(exports, "IconImage", { + enumerable: true, + get: function () { + return _IconImage.default; + } +}); +Object.defineProperty(exports, "Image", { + enumerable: true, + get: function () { + return _Image.default; + } +}); +Object.defineProperty(exports, "RegularShape", { + enumerable: true, + get: function () { + return _RegularShape.default; + } +}); +Object.defineProperty(exports, "Stroke", { + enumerable: true, + get: function () { + return _Stroke.default; + } +}); +Object.defineProperty(exports, "Style", { + enumerable: true, + get: function () { + return _Style.default; + } +}); +Object.defineProperty(exports, "Text", { + enumerable: true, + get: function () { + return _Text.default; + } +}); + +var _Circle = _interopRequireDefault(require("./style/Circle.js")); + +var _Fill = _interopRequireDefault(require("./style/Fill.js")); + +var _Icon = _interopRequireDefault(require("./style/Icon.js")); + +var _IconImage = _interopRequireDefault(require("./style/IconImage.js")); + +var _Image = _interopRequireDefault(require("./style/Image.js")); + +var _RegularShape = _interopRequireDefault(require("./style/RegularShape.js")); + +var _Stroke = _interopRequireDefault(require("./style/Stroke.js")); + +var _Style = _interopRequireDefault(require("./style/Style.js")); + +var _Text = _interopRequireDefault(require("./style/Text.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +},{"./style/Circle.js":"../../../node_modules/ol/style/Circle.js","./style/Fill.js":"../../../node_modules/ol/style/Fill.js","./style/Icon.js":"../../../node_modules/ol/style/Icon.js","./style/IconImage.js":"../../../node_modules/ol/style/IconImage.js","./style/Image.js":"../../../node_modules/ol/style/Image.js","./style/RegularShape.js":"../../../node_modules/ol/style/RegularShape.js","./style/Stroke.js":"../../../node_modules/ol/style/Stroke.js","./style/Style.js":"../../../node_modules/ol/style/Style.js","./style/Text.js":"../../../node_modules/ol/style/Text.js"}],"../../../node_modules/ol/render/canvas/hitdetect.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createHitDetectionImageData = createHitDetectionImageData; +exports.hitDetect = hitDetect; + +var _Immediate = _interopRequireDefault(require("./Immediate.js")); + +var _GeometryType = _interopRequireDefault(require("../../geom/GeometryType.js")); + +var _IconAnchorUnits = _interopRequireDefault(require("../../style/IconAnchorUnits.js")); + +var _style = require("../../style.js"); + +var _dom = require("../../dom.js"); + +var _extent = require("../../extent.js"); + +var _array = require("../../array.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/canvas/hitdetet + */ + +/** + * @param {import("../../size.js").Size} size Canvas size in css pixels. + * @param {Array<import("../../transform.js").Transform>} transforms Transforms + * for rendering features to all worlds of the viewport, from coordinates to css + * pixels. + * @param {Array<import("../../Feature.js").FeatureLike>} features + * Features to consider for hit detection. + * @param {import("../../style/Style.js").StyleFunction|undefined} styleFunction + * Layer style function. + * @param {import("../../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @return {ImageData} Hit detection image data. + */ +function createHitDetectionImageData(size, transforms, features, styleFunction, extent, resolution, rotation) { + var width = size[0] / 2; + var height = size[1] / 2; + var context = (0, _dom.createCanvasContext2D)(width, height); + context.imageSmoothingEnabled = false; + var canvas = context.canvas; + var renderer = new _Immediate.default(context, 0.5, extent, null, rotation); + var featureCount = features.length; // Stretch hit detection index to use the whole available color range + + var indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount); + var featuresByZIndex = {}; + + for (var i = 1; i <= featureCount; ++i) { + var feature = features[i - 1]; + var featureStyleFunction = feature.getStyleFunction() || styleFunction; + + if (!styleFunction) { + continue; + } + + var styles = featureStyleFunction(feature, resolution); + + if (!styles) { + continue; + } + + if (!Array.isArray(styles)) { + styles = [styles]; + } + + var index = i * indexFactor; + var color = '#' + ('000000' + index.toString(16)).slice(-6); + + for (var j = 0, jj = styles.length; j < jj; ++j) { + var originalStyle = styles[j]; + var style = originalStyle.clone(); + var fill = style.getFill(); + + if (fill) { + fill.setColor(color); + } + + var stroke = style.getStroke(); + + if (stroke) { + stroke.setColor(color); + } + + style.setText(undefined); + var image = originalStyle.getImage(); + + if (image) { + var imgSize = image.getImageSize(); + + if (!imgSize) { + continue; + } + + var canvas_1 = document.createElement('canvas'); + canvas_1.width = imgSize[0]; + canvas_1.height = imgSize[1]; + var imgContext = canvas_1.getContext('2d', { + alpha: false + }); + imgContext.fillStyle = color; + var img = imgContext.canvas; + imgContext.fillRect(0, 0, img.width, img.height); + var width_1 = imgSize ? imgSize[0] : img.width; + var height_1 = imgSize ? imgSize[1] : img.height; + var iconContext = (0, _dom.createCanvasContext2D)(width_1, height_1); + iconContext.drawImage(img, 0, 0); + style.setImage(new _style.Icon({ + img: img, + imgSize: imgSize, + anchor: image.getAnchor(), + anchorXUnits: _IconAnchorUnits.default.PIXELS, + anchorYUnits: _IconAnchorUnits.default.PIXELS, + offset: image.getOrigin(), + size: image.getSize(), + opacity: image.getOpacity(), + scale: image.getScale(), + rotation: image.getRotation(), + rotateWithView: image.getRotateWithView() + })); + } + + var zIndex = Number(style.getZIndex()); + var byGeometryType = featuresByZIndex[zIndex]; + + if (!byGeometryType) { + byGeometryType = {}; + featuresByZIndex[zIndex] = byGeometryType; + byGeometryType[_GeometryType.default.POLYGON] = []; + byGeometryType[_GeometryType.default.CIRCLE] = []; + byGeometryType[_GeometryType.default.LINE_STRING] = []; + byGeometryType[_GeometryType.default.POINT] = []; + } + + var geometry = style.getGeometryFunction()(feature); + + if (geometry && (0, _extent.intersects)(extent, geometry.getExtent())) { + byGeometryType[geometry.getType().replace('Multi', '')].push(geometry, style); + } + } + } + + var zIndexKeys = Object.keys(featuresByZIndex).map(Number).sort(_array.numberSafeCompareFunction); + + for (var i = 0, ii = zIndexKeys.length; i < ii; ++i) { + var byGeometryType = featuresByZIndex[zIndexKeys[i]]; + + for (var type in byGeometryType) { + var geomAndStyle = byGeometryType[type]; + + for (var j = 0, jj = geomAndStyle.length; j < jj; j += 2) { + renderer.setStyle(geomAndStyle[j + 1]); + + for (var k = 0, kk = transforms.length; k < kk; ++k) { + renderer.setTransform(transforms[k]); + renderer.drawGeometry(geomAndStyle[j]); + } + } + } + } + + return context.getImageData(0, 0, canvas.width, canvas.height); +} +/** + * @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit + * detection canvas in css pixels. + * @param {Array<import("../../Feature").FeatureLike>} features Features. Has to + * match the `features` array that was passed to `createHitDetectionImageData()`. + * @param {ImageData} imageData Hit detection image data generated by + * `createHitDetectionImageData()`. + * @return {Array<import("../../Feature").FeatureLike>} features Features. + */ + + +function hitDetect(pixel, features, imageData) { + var resultFeatures = []; + + if (imageData) { + var index = (Math.round(pixel[0] / 2) + Math.round(pixel[1] / 2) * imageData.width) * 4; + var r = imageData.data[index]; + var g = imageData.data[index + 1]; + var b = imageData.data[index + 2]; + var i = b + 256 * (g + 256 * r); + var indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length); + + if (i && i % indexFactor === 0) { + resultFeatures.push(features[i / indexFactor - 1]); + } + } + + return resultFeatures; +} +},{"./Immediate.js":"../../../node_modules/ol/render/canvas/Immediate.js","../../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../../style/IconAnchorUnits.js":"../../../node_modules/ol/style/IconAnchorUnits.js","../../style.js":"../../../node_modules/ol/style.js","../../dom.js":"../../../node_modules/ol/dom.js","../../extent.js":"../../../node_modules/ol/extent.js","../../array.js":"../../../node_modules/ol/array.js"}],"../../../node_modules/ol/renderer/vector.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.defaultOrder = defaultOrder; +exports.getSquaredTolerance = getSquaredTolerance; +exports.getTolerance = getTolerance; +exports.renderFeature = renderFeature; + +var _BuilderType = _interopRequireDefault(require("../render/canvas/BuilderType.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _ImageState = _interopRequireDefault(require("../ImageState.js")); + +var _util = require("../util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/renderer/vector + */ + +/** + * Tolerance for geometry simplification in device pixels. + * @type {number} + */ +var SIMPLIFY_TOLERANCE = 0.5; +/** + * @const + * @type {Object<import("../geom/GeometryType.js").default, + * function(import("../render/canvas/BuilderGroup.js").default, import("../geom/Geometry.js").default, + * import("../style/Style.js").default, Object): void>} + */ + +var GEOMETRY_RENDERERS = { + 'Point': renderPointGeometry, + 'LineString': renderLineStringGeometry, + 'Polygon': renderPolygonGeometry, + 'MultiPoint': renderMultiPointGeometry, + 'MultiLineString': renderMultiLineStringGeometry, + 'MultiPolygon': renderMultiPolygonGeometry, + 'GeometryCollection': renderGeometryCollectionGeometry, + 'Circle': renderCircleGeometry +}; +/** + * @param {import("../Feature.js").FeatureLike} feature1 Feature 1. + * @param {import("../Feature.js").FeatureLike} feature2 Feature 2. + * @return {number} Order. + */ + +function defaultOrder(feature1, feature2) { + return parseInt((0, _util.getUid)(feature1), 10) - parseInt((0, _util.getUid)(feature2), 10); +} +/** + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Squared pixel tolerance. + */ + + +function getSquaredTolerance(resolution, pixelRatio) { + var tolerance = getTolerance(resolution, pixelRatio); + return tolerance * tolerance; +} +/** + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Pixel tolerance. + */ + + +function getTolerance(resolution, pixelRatio) { + return SIMPLIFY_TOLERANCE * resolution / pixelRatio; +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Builder group. + * @param {import("../geom/Circle.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").default} feature Feature. + */ + + +function renderCircleGeometry(builderGroup, geometry, style, feature) { + var fillStyle = style.getFill(); + var strokeStyle = style.getStroke(); + + if (fillStyle || strokeStyle) { + var circleReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.CIRCLE); + circleReplay.setFillStrokeStyle(fillStyle, strokeStyle); + circleReplay.drawCircle(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false)); + textReplay.drawText(geometry, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group. + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {import("../style/Style.js").default} style Style. + * @param {number} squaredTolerance Squared tolerance. + * @param {function(import("../events/Event.js").default): void} listener Listener function. + * @param {import("../proj.js").TransformFunction} [opt_transform] Transform from user to view projection. + * @return {boolean} `true` if style is loading. + * @template T + */ + + +function renderFeature(replayGroup, feature, style, squaredTolerance, listener, opt_transform) { + var loading = false; + var imageStyle = style.getImage(); + + if (imageStyle) { + var imageState = imageStyle.getImageState(); + + if (imageState == _ImageState.default.LOADED || imageState == _ImageState.default.ERROR) { + imageStyle.unlistenImageChange(listener); + } else { + if (imageState == _ImageState.default.IDLE) { + imageStyle.load(); + } + + imageState = imageStyle.getImageState(); + imageStyle.listenImageChange(listener); + loading = true; + } + } + + renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform); + return loading; +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group. + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {import("../style/Style.js").default} style Style. + * @param {number} squaredTolerance Squared tolerance. + * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function. + */ + + +function renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform) { + var geometry = style.getGeometryFunction()(feature); + + if (!geometry) { + return; + } + + var simplifiedGeometry = geometry.simplifyTransformed(squaredTolerance, opt_transform); + var renderer = style.getRenderer(); + + if (renderer) { + renderGeometry(replayGroup, simplifiedGeometry, style, feature); + } else { + var geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()]; + geometryRenderer(replayGroup, simplifiedGeometry, style, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group. + * @param {import("../geom/Geometry.js").default|import("../render/Feature.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + +function renderGeometry(replayGroup, geometry, style, feature) { + if (geometry.getType() == _GeometryType.default.GEOMETRY_COLLECTION) { + var geometries = + /** @type {import("../geom/GeometryCollection.js").default} */ + geometry.getGeometries(); + + for (var i = 0, ii = geometries.length; i < ii; ++i) { + renderGeometry(replayGroup, geometries[i], style, feature); + } + + return; + } + + var replay = replayGroup.getBuilder(style.getZIndex(), _BuilderType.default.DEFAULT); + replay.drawCustom( + /** @type {import("../geom/SimpleGeometry.js").default} */ + geometry, feature, style.getRenderer()); +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group. + * @param {import("../geom/GeometryCollection.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").default} feature Feature. + */ + + +function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature) { + var geometries = geometry.getGeometriesArray(); + var i, ii; + + for (i = 0, ii = geometries.length; i < ii; ++i) { + var geometryRenderer = GEOMETRY_RENDERERS[geometries[i].getType()]; + geometryRenderer(replayGroup, geometries[i], style, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group. + * @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + +function renderLineStringGeometry(builderGroup, geometry, style, feature) { + var strokeStyle = style.getStroke(); + + if (strokeStyle) { + var lineStringReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.LINE_STRING); + lineStringReplay.setFillStrokeStyle(null, strokeStyle); + lineStringReplay.drawLineString(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false)); + textReplay.drawText(geometry, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group. + * @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + +function renderMultiLineStringGeometry(builderGroup, geometry, style, feature) { + var strokeStyle = style.getStroke(); + + if (strokeStyle) { + var lineStringReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.LINE_STRING); + lineStringReplay.setFillStrokeStyle(null, strokeStyle); + lineStringReplay.drawMultiLineString(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false)); + textReplay.drawText(geometry, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group. + * @param {import("../geom/MultiPolygon.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").default} feature Feature. + */ + + +function renderMultiPolygonGeometry(builderGroup, geometry, style, feature) { + var fillStyle = style.getFill(); + var strokeStyle = style.getStroke(); + + if (strokeStyle || fillStyle) { + var polygonReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.POLYGON); + polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle); + polygonReplay.drawMultiPolygon(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false)); + textReplay.drawText(geometry, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group. + * @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + +function renderPointGeometry(builderGroup, geometry, style, feature) { + var imageStyle = style.getImage(); + + if (imageStyle) { + if (imageStyle.getImageState() != _ImageState.default.LOADED) { + return; + } + + var imageReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.IMAGE); + imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false)); + imageReplay.drawPoint(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle)); + textReplay.drawText(geometry, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group. + * @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + +function renderMultiPointGeometry(builderGroup, geometry, style, feature) { + var imageStyle = style.getImage(); + + if (imageStyle) { + if (imageStyle.getImageState() != _ImageState.default.LOADED) { + return; + } + + var imageReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.IMAGE); + imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false)); + imageReplay.drawMultiPoint(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle)); + textReplay.drawText(geometry, feature); + } +} +/** + * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group. + * @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry. + * @param {import("../style/Style.js").default} style Style. + * @param {import("../Feature.js").FeatureLike} feature Feature. + */ + + +function renderPolygonGeometry(builderGroup, geometry, style, feature) { + var fillStyle = style.getFill(); + var strokeStyle = style.getStroke(); + + if (fillStyle || strokeStyle) { + var polygonReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.POLYGON); + polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle); + polygonReplay.drawPolygon(geometry, feature); + } + + var textStyle = style.getText(); + + if (textStyle) { + var textReplay = builderGroup.getBuilder(style.getZIndex(), _BuilderType.default.TEXT); + textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false)); + textReplay.drawText(geometry, feature); + } +} +},{"../render/canvas/BuilderType.js":"../../../node_modules/ol/render/canvas/BuilderType.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../ImageState.js":"../../../node_modules/ol/ImageState.js","../util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/renderer/canvas/VectorLayer.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _BuilderGroup = _interopRequireDefault(require("../../render/canvas/BuilderGroup.js")); + +var _Layer = _interopRequireDefault(require("./Layer.js")); + +var _ExecutorGroup = _interopRequireWildcard(require("../../render/canvas/ExecutorGroup.js")); + +var _ViewHint = _interopRequireDefault(require("../../ViewHint.js")); + +var _transform = require("../../transform.js"); + +var _extent = require("../../extent.js"); + +var _hitdetect = require("../../render/canvas/hitdetect.js"); + +var _vector = require("../vector.js"); + +var _proj = require("../../proj.js"); + +var _util = require("../../util.js"); + +var _coordinate = require("../../coordinate.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/renderer/canvas/VectorLayer + */ + + +/** + * @classdesc + * Canvas renderer for vector layers. + * @api + */ +var CanvasVectorLayerRenderer = +/** @class */ +function (_super) { + __extends(CanvasVectorLayerRenderer, _super); + /** + * @param {import("../../layer/Vector.js").default} vectorLayer Vector layer. + */ + + + function CanvasVectorLayerRenderer(vectorLayer) { + var _this = _super.call(this, vectorLayer) || this; + /** @private */ + + + _this.boundHandleStyleImageChange_ = _this.handleStyleImageChange_.bind(_this); + /** + * @type {boolean} + */ + + _this.animatingOrInteracting_; + /** + * @private + * @type {boolean} + */ + + _this.dirty_ = false; + /** + * @type {ImageData} + */ + + _this.hitDetectionImageData_ = null; + /** + * @type {Array<import("../../Feature.js").default>} + */ + + _this.renderedFeatures_ = null; + /** + * @private + * @type {number} + */ + + _this.renderedRevision_ = -1; + /** + * @private + * @type {number} + */ + + _this.renderedResolution_ = NaN; + /** + * @private + * @type {import("../../extent.js").Extent} + */ + + _this.renderedExtent_ = (0, _extent.createEmpty)(); + /** + * @private + * @type {number} + */ + + _this.renderedRotation_; + /** + * @private + * @type {import("../../coordinate").Coordinate} + */ + + _this.renderedCenter_ = null; + /** + * @private + * @type {import("../../proj/Projection").default} + */ + + _this.renderedProjection_ = null; + /** + * @private + * @type {function(import("../../Feature.js").default, import("../../Feature.js").default): number|null} + */ + + _this.renderedRenderOrder_ = null; + /** + * @private + * @type {import("../../render/canvas/ExecutorGroup").default} + */ + + _this.replayGroup_ = null; + /** + * A new replay group had to be created by `prepareFrame()` + * @type {boolean} + */ + + _this.replayGroupChanged = true; + /** + * Clipping to be performed by `renderFrame()` + * @type {boolean} + */ + + _this.clipping = true; + return _this; + } + /** + * Get a rendering container from an existing target, if compatible. + * @param {HTMLElement} target Potential render target. + * @param {string} transform CSS Transform. + * @param {number} opacity Opacity. + */ + + + CanvasVectorLayerRenderer.prototype.useContainer = function (target, transform, opacity) { + if (opacity < 1) { + target = null; + } + + _super.prototype.useContainer.call(this, target, transform, opacity); + }; + /** + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. + */ + + + CanvasVectorLayerRenderer.prototype.renderFrame = function (frameState, target) { + var pixelRatio = frameState.pixelRatio; + var layerState = frameState.layerStatesArray[frameState.layerIndex]; // set forward and inverse pixel transforms + + (0, _transform.makeScale)(this.pixelTransform, 1 / pixelRatio, 1 / pixelRatio); + (0, _transform.makeInverse)(this.inversePixelTransform, this.pixelTransform); + var canvasTransform = (0, _transform.toString)(this.pixelTransform); + this.useContainer(target, canvasTransform, layerState.opacity); + var context = this.context; + var canvas = context.canvas; + var replayGroup = this.replayGroup_; + + if (!replayGroup || replayGroup.isEmpty()) { + if (!this.containerReused && canvas.width > 0) { + canvas.width = 0; + } + + return this.container; + } // resize and clear + + + var width = Math.round(frameState.size[0] * pixelRatio); + var height = Math.round(frameState.size[1] * pixelRatio); + + if (canvas.width != width || canvas.height != height) { + canvas.width = width; + canvas.height = height; + + if (canvas.style.transform !== canvasTransform) { + canvas.style.transform = canvasTransform; + } + } else if (!this.containerReused) { + context.clearRect(0, 0, width, height); + } + + this.preRender(context, frameState); + var extent = frameState.extent; + var viewState = frameState.viewState; + var center = viewState.center; + var resolution = viewState.resolution; + var projection = viewState.projection; + var rotation = viewState.rotation; + var projectionExtent = projection.getExtent(); + var vectorSource = this.getLayer().getSource(); // clipped rendering if layer extent is set + + var clipped = false; + + if (layerState.extent && this.clipping) { + var layerExtent = (0, _proj.fromUserExtent)(layerState.extent, projection); + clipped = !(0, _extent.containsExtent)(layerExtent, frameState.extent) && (0, _extent.intersects)(layerExtent, frameState.extent); + + if (clipped) { + this.clipUnrotated(context, frameState, layerExtent); + } + } + + var viewHints = frameState.viewHints; + var snapToPixel = !(viewHints[_ViewHint.default.ANIMATING] || viewHints[_ViewHint.default.INTERACTING]); + var transform = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, 0); + var declutterReplays = this.getLayer().getDeclutter() ? {} : null; + replayGroup.execute(context, 1, transform, rotation, snapToPixel, undefined, declutterReplays); + + if (vectorSource.getWrapX() && projection.canWrapX() && !(0, _extent.containsExtent)(projectionExtent, extent)) { + var startX = extent[0]; + var worldWidth = (0, _extent.getWidth)(projectionExtent); + var world = 0; + var offsetX = void 0; + + while (startX < projectionExtent[0]) { + --world; + offsetX = worldWidth * world; + var transform_1 = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, offsetX); + replayGroup.execute(context, 1, transform_1, rotation, snapToPixel, undefined, declutterReplays); + startX += worldWidth; + } + + world = 0; + startX = extent[2]; + + while (startX > projectionExtent[2]) { + ++world; + offsetX = worldWidth * world; + var transform_2 = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, offsetX); + replayGroup.execute(context, 1, transform_2, rotation, snapToPixel, undefined, declutterReplays); + startX -= worldWidth; + } + } + + if (declutterReplays) { + var viewHints_1 = frameState.viewHints; + var hifi = !(viewHints_1[_ViewHint.default.ANIMATING] || viewHints_1[_ViewHint.default.INTERACTING]); + (0, _ExecutorGroup.replayDeclutter)(declutterReplays, context, rotation, 1, hifi, frameState.declutterItems); + } + + if (clipped) { + context.restore(); + } + + this.postRender(context, frameState); + var opacity = layerState.opacity; + var container = this.container; + + if (opacity !== parseFloat(container.style.opacity)) { + container.style.opacity = opacity === 1 ? '' : String(opacity); + } + + if (this.renderedRotation_ !== viewState.rotation) { + this.renderedRotation_ = viewState.rotation; + this.hitDetectionImageData_ = null; + } + + return this.container; + }; + /** + * Asynchronous layer level hit detection. + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features. + */ + + + CanvasVectorLayerRenderer.prototype.getFeatures = function (pixel) { + return new Promise(function (resolve, reject) { + if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) { + var size = [this.context.canvas.width, this.context.canvas.height]; + (0, _transform.apply)(this.pixelTransform, size); + var center = this.renderedCenter_; + var resolution = this.renderedResolution_; + var rotation = this.renderedRotation_; + var projection = this.renderedProjection_; + var extent = this.renderedExtent_; + var layer = this.getLayer(); + var transforms = []; + var width = size[0] / 2; + var height = size[1] / 2; + transforms.push(this.getRenderTransform(center, resolution, rotation, 0.5, width, height, 0).slice()); + var source = layer.getSource(); + var projectionExtent = projection.getExtent(); + + if (source.getWrapX() && projection.canWrapX() && !(0, _extent.containsExtent)(projectionExtent, extent)) { + var startX = extent[0]; + var worldWidth = (0, _extent.getWidth)(projectionExtent); + var world = 0; + var offsetX = void 0; + + while (startX < projectionExtent[0]) { + --world; + offsetX = worldWidth * world; + transforms.push(this.getRenderTransform(center, resolution, rotation, 0.5, width, height, offsetX).slice()); + startX += worldWidth; + } + + world = 0; + startX = extent[2]; + + while (startX > projectionExtent[2]) { + ++world; + offsetX = worldWidth * world; + transforms.push(this.getRenderTransform(center, resolution, rotation, 0.5, width, height, offsetX).slice()); + startX -= worldWidth; + } + } + + this.hitDetectionImageData_ = (0, _hitdetect.createHitDetectionImageData)(size, transforms, this.renderedFeatures_, layer.getStyleFunction(), extent, resolution, rotation); + } + + resolve((0, _hitdetect.hitDetect)(pixel, this.renderedFeatures_, this.hitDetectionImageData_)); + }.bind(this)); + }; + /** + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback. + * @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features. + * @return {T|void} Callback result. + * @template T + */ + + + CanvasVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) { + if (!this.replayGroup_) { + return undefined; + } else { + var resolution = frameState.viewState.resolution; + var rotation = frameState.viewState.rotation; + var layer_1 = this.getLayer(); + /** @type {!Object<string, boolean>} */ + + var features_1 = {}; + var result = this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, + /** + * @param {import("../../Feature.js").FeatureLike} feature Feature. + * @return {?} Callback result. + */ + function (feature) { + var key = (0, _util.getUid)(feature); + + if (!(key in features_1)) { + features_1[key] = true; + return callback(feature, layer_1); + } + }, layer_1.getDeclutter() ? declutteredFeatures : null); + return result; + } + }; + /** + * Perform action necessary to get the layer rendered after new fonts have loaded + */ + + + CanvasVectorLayerRenderer.prototype.handleFontsChanged = function () { + var layer = this.getLayer(); + + if (layer.getVisible() && this.replayGroup_) { + layer.changed(); + } + }; + /** + * Handle changes in image style state. + * @param {import("../../events/Event.js").default} event Image style change event. + * @private + */ + + + CanvasVectorLayerRenderer.prototype.handleStyleImageChange_ = function (event) { + this.renderIfReadyAndVisible(); + }; + /** + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. + */ + + + CanvasVectorLayerRenderer.prototype.prepareFrame = function (frameState) { + var vectorLayer = this.getLayer(); + var vectorSource = vectorLayer.getSource(); + + if (!vectorSource) { + return false; + } + + var animating = frameState.viewHints[_ViewHint.default.ANIMATING]; + var interacting = frameState.viewHints[_ViewHint.default.INTERACTING]; + var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating(); + var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting(); + + if (!this.dirty_ && !updateWhileAnimating && animating || !updateWhileInteracting && interacting) { + this.animatingOrInteracting_ = true; + return true; + } + + this.animatingOrInteracting_ = false; + var frameStateExtent = frameState.extent; + var viewState = frameState.viewState; + var projection = viewState.projection; + var resolution = viewState.resolution; + var pixelRatio = frameState.pixelRatio; + var vectorLayerRevision = vectorLayer.getRevision(); + var vectorLayerRenderBuffer = vectorLayer.getRenderBuffer(); + var vectorLayerRenderOrder = vectorLayer.getRenderOrder(); + + if (vectorLayerRenderOrder === undefined) { + vectorLayerRenderOrder = _vector.defaultOrder; + } + + var center = viewState.center.slice(); + var extent = (0, _extent.buffer)(frameStateExtent, vectorLayerRenderBuffer * resolution); + var loadExtents = [extent.slice()]; + var projectionExtent = projection.getExtent(); + + if (vectorSource.getWrapX() && projection.canWrapX() && !(0, _extent.containsExtent)(projectionExtent, frameState.extent)) { + // For the replay group, we need an extent that intersects the real world + // (-180° to +180°). To support geometries in a coordinate range from -540° + // to +540°, we add at least 1 world width on each side of the projection + // extent. If the viewport is wider than the world, we need to add half of + // the viewport width to make sure we cover the whole viewport. + var worldWidth = (0, _extent.getWidth)(projectionExtent); + var gutter = Math.max((0, _extent.getWidth)(extent) / 2, worldWidth); + extent[0] = projectionExtent[0] - gutter; + extent[2] = projectionExtent[2] + gutter; + (0, _coordinate.wrapX)(center, projection); + var loadExtent = (0, _extent.wrapX)(loadExtents[0], projection); // If the extent crosses the date line, we load data for both edges of the worlds + + if (loadExtent[0] < projectionExtent[0] && loadExtent[2] < projectionExtent[2]) { + loadExtents.push([loadExtent[0] + worldWidth, loadExtent[1], loadExtent[2] + worldWidth, loadExtent[3]]); + } else if (loadExtent[0] > projectionExtent[0] && loadExtent[2] > projectionExtent[2]) { + loadExtents.push([loadExtent[0] - worldWidth, loadExtent[1], loadExtent[2] - worldWidth, loadExtent[3]]); + } + } + + if (!this.dirty_ && this.renderedResolution_ == resolution && this.renderedRevision_ == vectorLayerRevision && this.renderedRenderOrder_ == vectorLayerRenderOrder && (0, _extent.containsExtent)(this.renderedExtent_, extent)) { + this.replayGroupChanged = false; + return true; + } + + this.replayGroup_ = null; + this.dirty_ = false; + var replayGroup = new _BuilderGroup.default((0, _vector.getTolerance)(resolution, pixelRatio), extent, resolution, pixelRatio, vectorLayer.getDeclutter()); + var userProjection = (0, _proj.getUserProjection)(); + var userTransform; + + if (userProjection) { + for (var i = 0, ii = loadExtents.length; i < ii; ++i) { + vectorSource.loadFeatures((0, _proj.toUserExtent)(loadExtents[i], projection), resolution, userProjection); + } + + userTransform = (0, _proj.getTransformFromProjections)(userProjection, projection); + } else { + for (var i = 0, ii = loadExtents.length; i < ii; ++i) { + vectorSource.loadFeatures(loadExtents[i], resolution, projection); + } + } + + var squaredTolerance = (0, _vector.getSquaredTolerance)(resolution, pixelRatio); + /** + * @param {import("../../Feature.js").default} feature Feature. + * @this {CanvasVectorLayerRenderer} + */ + + var render = function (feature) { + var styles; + var styleFunction = feature.getStyleFunction() || vectorLayer.getStyleFunction(); + + if (styleFunction) { + styles = styleFunction(feature, resolution); + } + + if (styles) { + var dirty = this.renderFeature(feature, squaredTolerance, styles, replayGroup, userTransform); + this.dirty_ = this.dirty_ || dirty; + } + }.bind(this); + + var userExtent = (0, _proj.toUserExtent)(extent, projection); + /** @type {Array<import("../../Feature.js").default>} */ + + var features = vectorSource.getFeaturesInExtent(userExtent); + + if (vectorLayerRenderOrder) { + features.sort(vectorLayerRenderOrder); + } + + for (var i = 0, ii = features.length; i < ii; ++i) { + render(features[i]); + } + + this.renderedFeatures_ = features; + var replayGroupInstructions = replayGroup.finish(); + var executorGroup = new _ExecutorGroup.default(extent, resolution, pixelRatio, vectorSource.getOverlaps(), replayGroupInstructions, vectorLayer.getRenderBuffer()); + this.renderedResolution_ = resolution; + this.renderedRevision_ = vectorLayerRevision; + this.renderedRenderOrder_ = vectorLayerRenderOrder; + this.renderedExtent_ = extent; + this.renderedCenter_ = center; + this.renderedProjection_ = projection; + this.replayGroup_ = executorGroup; + this.hitDetectionImageData_ = null; + this.replayGroupChanged = true; + return true; + }; + /** + * @param {import("../../Feature.js").default} feature Feature. + * @param {number} squaredTolerance Squared render tolerance. + * @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles. + * @param {import("../../render/canvas/BuilderGroup.js").default} builderGroup Builder group. + * @param {import("../../proj.js").TransformFunction=} opt_transform Transform from user to view projection. + * @return {boolean} `true` if an image is loading. + */ + + + CanvasVectorLayerRenderer.prototype.renderFeature = function (feature, squaredTolerance, styles, builderGroup, opt_transform) { + if (!styles) { + return false; + } + + var loading = false; + + if (Array.isArray(styles)) { + for (var i = 0, ii = styles.length; i < ii; ++i) { + loading = (0, _vector.renderFeature)(builderGroup, feature, styles[i], squaredTolerance, this.boundHandleStyleImageChange_, opt_transform) || loading; + } + } else { + loading = (0, _vector.renderFeature)(builderGroup, feature, styles, squaredTolerance, this.boundHandleStyleImageChange_, opt_transform); + } + + return loading; + }; + + return CanvasVectorLayerRenderer; +}(_Layer.default); + +var _default = CanvasVectorLayerRenderer; +exports.default = _default; +},{"../../render/canvas/BuilderGroup.js":"../../../node_modules/ol/render/canvas/BuilderGroup.js","./Layer.js":"../../../node_modules/ol/renderer/canvas/Layer.js","../../render/canvas/ExecutorGroup.js":"../../../node_modules/ol/render/canvas/ExecutorGroup.js","../../ViewHint.js":"../../../node_modules/ol/ViewHint.js","../../transform.js":"../../../node_modules/ol/transform.js","../../extent.js":"../../../node_modules/ol/extent.js","../../render/canvas/hitdetect.js":"../../../node_modules/ol/render/canvas/hitdetect.js","../vector.js":"../../../node_modules/ol/renderer/vector.js","../../proj.js":"../../../node_modules/ol/proj.js","../../util.js":"../../../node_modules/ol/util.js","../../coordinate.js":"../../../node_modules/ol/coordinate.js"}],"../../../node_modules/ol/layer/Vector.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _BaseVector = _interopRequireDefault(require("./BaseVector.js")); + +var _VectorLayer = _interopRequireDefault(require("../renderer/canvas/VectorLayer.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/Vector + */ + + +/** + * @classdesc + * Vector data that is rendered client-side. + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} + * property on the layer object; for example, setting `title: 'My Title'` in the + * options means that `title` is observable, and has get/set accessors. + * + * @extends {BaseVectorLayer<import("../source/Vector.js").default>} + * @api + */ +var VectorLayer = +/** @class */ +function (_super) { + __extends(VectorLayer, _super); + /** + * @param {import("./BaseVector.js").Options=} opt_options Options. + */ + + + function VectorLayer(opt_options) { + return _super.call(this, opt_options) || this; + } + /** + * Create a renderer for this layer. + * @return {import("../renderer/Layer.js").default} A layer renderer. + */ + + + VectorLayer.prototype.createRenderer = function () { + return new _VectorLayer.default(this); + }; + + return VectorLayer; +}(_BaseVector.default); + +var _default = VectorLayer; +exports.default = _default; +},{"./BaseVector.js":"../../../node_modules/ol/layer/BaseVector.js","../renderer/canvas/VectorLayer.js":"../../../node_modules/ol/renderer/canvas/VectorLayer.js"}],"../../../node_modules/ol/structs/RBush.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _rbush = _interopRequireDefault(require("rbush/rbush.js")); + +var _extent = require("../extent.js"); + +var _util = require("../util.js"); + +var _obj = require("../obj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/structs/RBush + */ + +/** + * @typedef {Object} Entry + * @property {number} minX + * @property {number} minY + * @property {number} maxX + * @property {number} maxY + * @property {Object} [value] + */ + +/** + * @classdesc + * Wrapper around the RBush by Vladimir Agafonkin. + * See https://github.com/mourner/rbush. + * + * @template T + */ +var RBush = +/** @class */ +function () { + /** + * @param {number=} opt_maxEntries Max entries. + */ + function RBush(opt_maxEntries) { + /** + * @private + */ + this.rbush_ = new _rbush.default(opt_maxEntries); + /** + * A mapping between the objects added to this rbush wrapper + * and the objects that are actually added to the internal rbush. + * @private + * @type {Object<string, Entry>} + */ + + this.items_ = {}; + } + /** + * Insert a value into the RBush. + * @param {import("../extent.js").Extent} extent Extent. + * @param {T} value Value. + */ + + + RBush.prototype.insert = function (extent, value) { + /** @type {Entry} */ + var item = { + minX: extent[0], + minY: extent[1], + maxX: extent[2], + maxY: extent[3], + value: value + }; + this.rbush_.insert(item); + this.items_[(0, _util.getUid)(value)] = item; + }; + /** + * Bulk-insert values into the RBush. + * @param {Array<import("../extent.js").Extent>} extents Extents. + * @param {Array<T>} values Values. + */ + + + RBush.prototype.load = function (extents, values) { + var items = new Array(values.length); + + for (var i = 0, l = values.length; i < l; i++) { + var extent = extents[i]; + var value = values[i]; + /** @type {Entry} */ + + var item = { + minX: extent[0], + minY: extent[1], + maxX: extent[2], + maxY: extent[3], + value: value + }; + items[i] = item; + this.items_[(0, _util.getUid)(value)] = item; + } + + this.rbush_.load(items); + }; + /** + * Remove a value from the RBush. + * @param {T} value Value. + * @return {boolean} Removed. + */ + + + RBush.prototype.remove = function (value) { + var uid = (0, _util.getUid)(value); // get the object in which the value was wrapped when adding to the + // internal rbush. then use that object to do the removal. + + var item = this.items_[uid]; + delete this.items_[uid]; + return this.rbush_.remove(item) !== null; + }; + /** + * Update the extent of a value in the RBush. + * @param {import("../extent.js").Extent} extent Extent. + * @param {T} value Value. + */ + + + RBush.prototype.update = function (extent, value) { + var item = this.items_[(0, _util.getUid)(value)]; + var bbox = [item.minX, item.minY, item.maxX, item.maxY]; + + if (!(0, _extent.equals)(bbox, extent)) { + this.remove(value); + this.insert(extent, value); + } + }; + /** + * Return all values in the RBush. + * @return {Array<T>} All. + */ + + + RBush.prototype.getAll = function () { + var items = this.rbush_.all(); + return items.map(function (item) { + return item.value; + }); + }; + /** + * Return all values in the given extent. + * @param {import("../extent.js").Extent} extent Extent. + * @return {Array<T>} All in extent. + */ + + + RBush.prototype.getInExtent = function (extent) { + /** @type {Entry} */ + var bbox = { + minX: extent[0], + minY: extent[1], + maxX: extent[2], + maxY: extent[3] + }; + var items = this.rbush_.search(bbox); + return items.map(function (item) { + return item.value; + }); + }; + /** + * Calls a callback function with each value in the tree. + * If the callback returns a truthy value, this value is returned without + * checking the rest of the tree. + * @param {function(T): *} callback Callback. + * @return {*} Callback return value. + */ + + + RBush.prototype.forEach = function (callback) { + return this.forEach_(this.getAll(), callback); + }; + /** + * Calls a callback function with each value in the provided extent. + * @param {import("../extent.js").Extent} extent Extent. + * @param {function(T): *} callback Callback. + * @return {*} Callback return value. + */ + + + RBush.prototype.forEachInExtent = function (extent, callback) { + return this.forEach_(this.getInExtent(extent), callback); + }; + /** + * @param {Array<T>} values Values. + * @param {function(T): *} callback Callback. + * @private + * @return {*} Callback return value. + */ + + + RBush.prototype.forEach_ = function (values, callback) { + var result; + + for (var i = 0, l = values.length; i < l; i++) { + result = callback(values[i]); + + if (result) { + return result; + } + } + + return result; + }; + /** + * @return {boolean} Is empty. + */ + + + RBush.prototype.isEmpty = function () { + return (0, _obj.isEmpty)(this.items_); + }; + /** + * Remove all values from the RBush. + */ + + + RBush.prototype.clear = function () { + this.rbush_.clear(); + this.items_ = {}; + }; + /** + * @param {import("../extent.js").Extent=} opt_extent Extent. + * @return {import("../extent.js").Extent} Extent. + */ + + + RBush.prototype.getExtent = function (opt_extent) { + var data = this.rbush_.toJSON(); + return (0, _extent.createOrUpdate)(data.minX, data.minY, data.maxX, data.maxY, opt_extent); + }; + /** + * @param {RBush} rbush R-Tree. + */ + + + RBush.prototype.concat = function (rbush) { + this.rbush_.load(rbush.rbush_.all()); + + for (var i in rbush.items_) { + this.items_[i] = rbush.items_[i]; + } + }; + + return RBush; +}(); + +var _default = RBush; +exports.default = _default; +},{"rbush/rbush.js":"../../../node_modules/rbush/rbush.js","../extent.js":"../../../node_modules/ol/extent.js","../util.js":"../../../node_modules/ol/util.js","../obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/source/Source.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Object = _interopRequireDefault(require("../Object.js")); + +var _State = _interopRequireDefault(require("./State.js")); + +var _util = require("../util.js"); + +var _proj = require("../proj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/source/Source + */ + + +/** + * A function that returns a string or an array of strings representing source + * attributions. + * + * @typedef {function(import("../PluggableMap.js").FrameState): (string|Array<string>)} Attribution + */ + +/** + * A type that can be used to provide attribution information for data sources. + * + * It represents either + * * a simple string (e.g. `'© Acme Inc.'`) + * * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`) + * * a function that returns a string or array of strings ({@link module:ol/source/Source~Attribution}) + * + * @typedef {string|Array<string>|Attribution} AttributionLike + */ + +/** + * @typedef {Object} Options + * @property {AttributionLike} [attributions] + * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible. + * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. + * @property {import("./State.js").default} [state='ready'] + * @property {boolean} [wrapX=false] + */ + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Base class for {@link module:ol/layer/Layer~Layer} sources. + * + * A generic `change` event is triggered when the state of the source changes. + * @abstract + * @api + */ +var Source = +/** @class */ +function (_super) { + __extends(Source, _super); + /** + * @param {Options} options Source options. + */ + + + function Source(options) { + var _this = _super.call(this) || this; + /** + * @private + * @type {import("../proj/Projection.js").default} + */ + + + _this.projection_ = (0, _proj.get)(options.projection); + /** + * @private + * @type {?Attribution} + */ + + _this.attributions_ = adaptAttributions(options.attributions); + /** + * @private + * @type {boolean} + */ + + _this.attributionsCollapsible_ = options.attributionsCollapsible !== undefined ? options.attributionsCollapsible : true; + /** + * This source is currently loading data. Sources that defer loading to the + * map's tile queue never set this to `true`. + * @type {boolean} + */ + + _this.loading = false; + /** + * @private + * @type {import("./State.js").default} + */ + + _this.state_ = options.state !== undefined ? options.state : _State.default.READY; + /** + * @private + * @type {boolean} + */ + + _this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false; + return _this; + } + /** + * Get the attribution function for the source. + * @return {?Attribution} Attribution function. + */ + + + Source.prototype.getAttributions = function () { + return this.attributions_; + }; + /** + * @return {boolean} Attributions are collapsible. + */ + + + Source.prototype.getAttributionsCollapsible = function () { + return this.attributionsCollapsible_; + }; + /** + * Get the projection of the source. + * @return {import("../proj/Projection.js").default} Projection. + * @api + */ + + + Source.prototype.getProjection = function () { + return this.projection_; + }; + /** + * @abstract + * @return {Array<number>|undefined} Resolutions. + */ + + + Source.prototype.getResolutions = function () { + return (0, _util.abstract)(); + }; + /** + * Get the state of the source, see {@link module:ol/source/State~State} for possible states. + * @return {import("./State.js").default} State. + * @api + */ + + + Source.prototype.getState = function () { + return this.state_; + }; + /** + * @return {boolean|undefined} Wrap X. + */ + + + Source.prototype.getWrapX = function () { + return this.wrapX_; + }; + /** + * @return {Object|undefined} Context options. + */ + + + Source.prototype.getContextOptions = function () { + return undefined; + }; + /** + * Refreshes the source. The source will be cleared, and data from the server will be reloaded. + * @api + */ + + + Source.prototype.refresh = function () { + this.changed(); + }; + /** + * Set the attributions of the source. + * @param {AttributionLike|undefined} attributions Attributions. + * Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution}, + * or `undefined`. + * @api + */ + + + Source.prototype.setAttributions = function (attributions) { + this.attributions_ = adaptAttributions(attributions); + this.changed(); + }; + /** + * Set the state of the source. + * @param {import("./State.js").default} state State. + */ + + + Source.prototype.setState = function (state) { + this.state_ = state; + this.changed(); + }; + + return Source; +}(_Object.default); +/** + * Turns the attributions option into an attributions function. + * @param {AttributionLike|undefined} attributionLike The attribution option. + * @return {?Attribution} An attribution function (or null). + */ + + +function adaptAttributions(attributionLike) { + if (!attributionLike) { + return null; + } + + if (Array.isArray(attributionLike)) { + return function (frameState) { + return attributionLike; + }; + } + + if (typeof attributionLike === 'function') { + return attributionLike; + } + + return function (frameState) { + return [attributionLike]; + }; +} + +var _default = Source; +exports.default = _default; +},{"../Object.js":"../../../node_modules/ol/Object.js","./State.js":"../../../node_modules/ol/source/State.js","../util.js":"../../../node_modules/ol/util.js","../proj.js":"../../../node_modules/ol/proj.js"}],"../../../node_modules/ol/source/VectorEventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/source/VectorEventType + */ + +/** + * @enum {string} + */ +var _default = { + /** + * Triggered when a feature is added to the source. + * @event module:ol/source/Vector.VectorSourceEvent#addfeature + * @api + */ + ADDFEATURE: 'addfeature', + + /** + * Triggered when a feature is updated. + * @event module:ol/source/Vector.VectorSourceEvent#changefeature + * @api + */ + CHANGEFEATURE: 'changefeature', + + /** + * Triggered when the clear method is called on the source. + * @event module:ol/source/Vector.VectorSourceEvent#clear + * @api + */ + CLEAR: 'clear', + + /** + * Triggered when a feature is removed from the source. + * See {@link module:ol/source/Vector#clear source.clear()} for exceptions. + * @event module:ol/source/Vector.VectorSourceEvent#removefeature + * @api + */ + REMOVEFEATURE: 'removefeature' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/loadingstrategy.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.all = all; +exports.bbox = bbox; +exports.tile = tile; + +/** + * @module ol/loadingstrategy + */ + +/** + * Strategy function for loading all features with a single request. + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @return {Array<import("./extent.js").Extent>} Extents. + * @api + */ +function all(extent, resolution) { + return [[-Infinity, -Infinity, Infinity, Infinity]]; +} +/** + * Strategy function for loading features based on the view's extent and + * resolution. + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @return {Array<import("./extent.js").Extent>} Extents. + * @api + */ + + +function bbox(extent, resolution) { + return [extent]; +} +/** + * Creates a strategy function for loading features based on a tile grid. + * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid. + * @return {function(import("./extent.js").Extent, number): Array<import("./extent.js").Extent>} Loading strategy. + * @api + */ + + +function tile(tileGrid) { + return ( + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @return {Array<import("./extent.js").Extent>} Extents. + */ + function (extent, resolution) { + var z = tileGrid.getZForResolution(resolution); + var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); + /** @type {Array<import("./extent.js").Extent>} */ + + var extents = []; + /** @type {import("./tilecoord.js").TileCoord} */ + + var tileCoord = [z, 0, 0]; + + for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; ++tileCoord[1]) { + for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; ++tileCoord[2]) { + extents.push(tileGrid.getTileCoordExtent(tileCoord)); + } + } + + return extents; + } + ); +} +},{}],"../../../node_modules/ol/format/FormatType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/format/FormatType + */ + +/** + * @enum {string} + */ +var _default = { + ARRAY_BUFFER: 'arraybuffer', + JSON: 'json', + TEXT: 'text', + XML: 'xml' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/featureloader.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.loadFeaturesXhr = loadFeaturesXhr; +exports.xhr = xhr; +exports.setWithCredentials = setWithCredentials; + +var _FormatType = _interopRequireDefault(require("./format/FormatType.js")); + +var _functions = require("./functions.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/featureloader + */ + +/** + * + * @type {boolean} + * @private + */ +var withCredentials = false; +/** + * {@link module:ol/source/Vector} sources use a function of this type to + * load features. + * + * This function takes an {@link module:ol/extent~Extent} representing the area to be loaded, + * a `{number}` representing the resolution (map units per pixel) and an + * {@link module:ol/proj/Projection} for the projection as + * arguments. `this` within the function is bound to the + * {@link module:ol/source/Vector} it's called from. + * + * The function is responsible for loading the features and adding them to the + * source. + * @typedef {function(this:(import("./source/Vector").default|import("./VectorTile.js").default), import("./extent.js").Extent, number, + * import("./proj/Projection.js").default): void} FeatureLoader + * @api + */ + +/** + * {@link module:ol/source/Vector} sources use a function of this type to + * get the url to load features from. + * + * This function takes an {@link module:ol/extent~Extent} representing the area + * to be loaded, a `{number}` representing the resolution (map units per pixel) + * and an {@link module:ol/proj/Projection} for the projection as + * arguments and returns a `{string}` representing the URL. + * @typedef {function(import("./extent.js").Extent, number, import("./proj/Projection.js").default): string} FeatureUrlFunction + * @api + */ + +/** + * @param {string|FeatureUrlFunction} url Feature URL service. + * @param {import("./format/Feature.js").default} format Feature format. + * @param {function(this:import("./VectorTile.js").default, Array<import("./Feature.js").default>, import("./proj/Projection.js").default, import("./extent.js").Extent): void|function(this:import("./source/Vector").default, Array<import("./Feature.js").default>): void} success + * Function called with the loaded features and optionally with the data + * projection. Called with the vector tile or source as `this`. + * @param {function(this:import("./VectorTile.js").default): void|function(this:import("./source/Vector").default): void} failure + * Function called when loading failed. Called with the vector tile or + * source as `this`. + * @return {FeatureLoader} The feature loader. + */ + +function loadFeaturesXhr(url, format, success, failure) { + return ( + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {import("./proj/Projection.js").default} projection Projection. + * @this {import("./source/Vector").default|import("./VectorTile.js").default} + */ + function (extent, resolution, projection) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', typeof url === 'function' ? url(extent, resolution, projection) : url, true); + + if (format.getType() == _FormatType.default.ARRAY_BUFFER) { + xhr.responseType = 'arraybuffer'; + } + + xhr.withCredentials = withCredentials; + /** + * @param {Event} event Event. + * @private + */ + + xhr.onload = function (event) { + // status will be 0 for file:// urls + if (!xhr.status || xhr.status >= 200 && xhr.status < 300) { + var type = format.getType(); + /** @type {Document|Node|Object|string|undefined} */ + + var source = void 0; + + if (type == _FormatType.default.JSON || type == _FormatType.default.TEXT) { + source = xhr.responseText; + } else if (type == _FormatType.default.XML) { + source = xhr.responseXML; + + if (!source) { + source = new DOMParser().parseFromString(xhr.responseText, 'application/xml'); + } + } else if (type == _FormatType.default.ARRAY_BUFFER) { + source = + /** @type {ArrayBuffer} */ + xhr.response; + } + + if (source) { + success.call(this, format.readFeatures(source, { + extent: extent, + featureProjection: projection + }), format.readProjection(source)); + } else { + failure.call(this); + } + } else { + failure.call(this); + } + }.bind(this); + /** + * @private + */ + + + xhr.onerror = function () { + failure.call(this); + }.bind(this); + + xhr.send(); + } + ); +} +/** + * Create an XHR feature loader for a `url` and `format`. The feature loader + * loads features (with XHR), parses the features, and adds them to the + * vector source. + * @param {string|FeatureUrlFunction} url Feature URL service. + * @param {import("./format/Feature.js").default} format Feature format. + * @return {FeatureLoader} The feature loader. + * @api + */ + + +function xhr(url, format) { + return loadFeaturesXhr(url, format, + /** + * @param {Array<import("./Feature.js").default>} features The loaded features. + * @param {import("./proj/Projection.js").default} dataProjection Data + * projection. + * @this {import("./source/Vector").default|import("./VectorTile.js").default} + */ + function (features, dataProjection) { + var sourceOrTile = + /** @type {?} */ + this; + + if (typeof sourceOrTile.addFeatures === 'function') { + /** @type {import("./source/Vector").default} */ + sourceOrTile.addFeatures(features); + } + }, + /* FIXME handle error */ + _functions.VOID); +} +/** + * Setter for the withCredentials configuration for the XHR. + * + * @param {boolean} xhrWithCredentials The value of withCredentials to set. + * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/ + * @api + */ + + +function setWithCredentials(xhrWithCredentials) { + withCredentials = xhrWithCredentials; +} +},{"./format/FormatType.js":"../../../node_modules/ol/format/FormatType.js","./functions.js":"../../../node_modules/ol/functions.js"}],"../../../node_modules/ol/source/Vector.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.VectorSourceEvent = void 0; + +var _Collection = _interopRequireDefault(require("../Collection.js")); + +var _CollectionEventType = _interopRequireDefault(require("../CollectionEventType.js")); + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _ObjectEventType = _interopRequireDefault(require("../ObjectEventType.js")); + +var _RBush = _interopRequireDefault(require("../structs/RBush.js")); + +var _Source = _interopRequireDefault(require("./Source.js")); + +var _State = _interopRequireDefault(require("./State.js")); + +var _VectorEventType = _interopRequireDefault(require("./VectorEventType.js")); + +var _functions = require("../functions.js"); + +var _loadingstrategy = require("../loadingstrategy.js"); + +var _asserts = require("../asserts.js"); + +var _extent = require("../extent.js"); + +var _array = require("../array.js"); + +var _util = require("../util.js"); + +var _obj = require("../obj.js"); + +var _events = require("../events.js"); + +var _featureloader = require("../featureloader.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/source/Vector + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and + * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this + * is one of the standard {@link module:ol/loadingstrategy} strategies. + * + * @typedef {function(import("../extent.js").Extent, number): Array<import("../extent.js").Extent>} LoadingStrategy + * @api + */ + +/** + * @classdesc + * Events emitted by {@link module:ol/source/Vector} instances are instances of this + * type. + * @template {import("../geom/Geometry.js").default} Geometry + */ +var VectorSourceEvent = +/** @class */ +function (_super) { + __extends(VectorSourceEvent, _super); + /** + * @param {string} type Type. + * @param {import("../Feature.js").default<Geometry>=} opt_feature Feature. + */ + + + function VectorSourceEvent(type, opt_feature) { + var _this = _super.call(this, type) || this; + /** + * The feature being added or removed. + * @type {import("../Feature.js").default<Geometry>|undefined} + * @api + */ + + + _this.feature = opt_feature; + return _this; + } + + return VectorSourceEvent; +}(_Event.default); + +exports.VectorSourceEvent = VectorSourceEvent; + +/** + * @typedef {Object} Options + * @property {import("./Source.js").AttributionLike} [attributions] Attributions. + * @property {Array<import("../Feature.js").default>|Collection<import("../Feature.js").default>} [features] + * Features. If provided as {@link module:ol/Collection}, the features in the source + * and the collection will stay in sync. + * @property {import("../format/Feature.js").default} [format] The feature format used by the XHR + * feature loader when `url` is set. Required if `url` is set, otherwise ignored. + * @property {import("../featureloader.js").FeatureLoader} [loader] + * The loader function used to load features, from a remote source for example. + * If this is not set and `url` is set, the source will create and use an XHR + * feature loader. + * + * Example: + * + * ```js + * import {Vector} from 'ol/source'; + * import {GeoJSON} from 'ol/format'; + * import {bbox} from 'ol/loadingstrategy'; + * + * var vectorSource = new Vector({ + * format: new GeoJSON(), + * loader: function(extent, resolution, projection) { + * var proj = projection.getCode(); + * var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' + + * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + + * 'outputFormat=application/json&srsname=' + proj + '&' + + * 'bbox=' + extent.join(',') + ',' + proj; + * var xhr = new XMLHttpRequest(); + * xhr.open('GET', url); + * var onError = function() { + * vectorSource.removeLoadedExtent(extent); + * } + * xhr.onerror = onError; + * xhr.onload = function() { + * if (xhr.status == 200) { + * vectorSource.addFeatures( + * vectorSource.getFormat().readFeatures(xhr.responseText)); + * } else { + * onError(); + * } + * } + * xhr.send(); + * }, + * strategy: bbox + * }); + * ``` + * @property {boolean} [overlaps=true] This source may have overlapping geometries. + * Setting this to `false` (e.g. for sources with polygons that represent administrative + * boundaries or TopoJSON sources) allows the renderer to optimise fill and + * stroke operations. + * @property {LoadingStrategy} [strategy] The loading strategy to use. + * By default an {@link module:ol/loadingstrategy~all} + * strategy is used, a one-off strategy which loads all features at once. + * @property {string|import("../featureloader.js").FeatureUrlFunction} [url] + * Setting this option instructs the source to load features using an XHR loader + * (see {@link module:ol/featureloader~xhr}). Use a `string` and an + * {@link module:ol/loadingstrategy~all} for a one-off download of all features from + * the given URL. Use a {@link module:ol/featureloader~FeatureUrlFunction} to generate the url with + * other loading strategies. + * Requires `format` to be set as well. + * When default XHR feature loader is provided, the features will + * be transformed from the data projection to the view projection + * during parsing. If your remote data source does not advertise its projection + * properly, this transformation will be incorrect. For some formats, the + * default projection (usually EPSG:4326) can be overridden by setting the + * dataProjection constructor option on the format. + * Note that if a source contains non-feature data, such as a GeoJSON geometry + * or a KML NetworkLink, these will be ignored. Use a custom loader to load these. + * @property {boolean} [useSpatialIndex=true] + * By default, an RTree is used as spatial index. When features are removed and + * added frequently, and the total number of features is low, setting this to + * `false` may improve performance. + * + * Note that + * {@link module:ol/source/Vector~VectorSource#getFeaturesInExtent}, + * {@link module:ol/source/Vector~VectorSource#getClosestFeatureToCoordinate} and + * {@link module:ol/source/Vector~VectorSource#getExtent} cannot be used when `useSpatialIndex` is + * set to `false`, and {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent} will loop + * through all features. + * + * When set to `false`, the features will be maintained in an + * {@link module:ol/Collection}, which can be retrieved through + * {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}. + * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the + * -180° and 180° meridians to work properly, this should be set to `false`. The + * resulting geometry coordinates will then exceed the world bounds. + */ + +/** + * @classdesc + * Provides a source of features for vector layers. Vector features provided + * by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for + * vector data that is optimized for rendering. + * + * @fires VectorSourceEvent + * @api + * @template {import("../geom/Geometry.js").default} Geometry + */ +var VectorSource = +/** @class */ +function (_super) { + __extends(VectorSource, _super); + /** + * @param {Options=} opt_options Vector source options. + */ + + + function VectorSource(opt_options) { + var _this = this; + + var options = opt_options || {}; + _this = _super.call(this, { + attributions: options.attributions, + projection: undefined, + state: _State.default.READY, + wrapX: options.wrapX !== undefined ? options.wrapX : true + }) || this; + /** + * @private + * @type {import("../featureloader.js").FeatureLoader} + */ + + _this.loader_ = _functions.VOID; + /** + * @private + * @type {import("../format/Feature.js").default|undefined} + */ + + _this.format_ = options.format; + /** + * @private + * @type {boolean} + */ + + _this.overlaps_ = options.overlaps === undefined ? true : options.overlaps; + /** + * @private + * @type {string|import("../featureloader.js").FeatureUrlFunction|undefined} + */ + + _this.url_ = options.url; + + if (options.loader !== undefined) { + _this.loader_ = options.loader; + } else if (_this.url_ !== undefined) { + (0, _asserts.assert)(_this.format_, 7); // `format` must be set when `url` is set + // create a XHR feature loader for "url" and "format" + + _this.loader_ = (0, _featureloader.xhr)(_this.url_, + /** @type {import("../format/Feature.js").default} */ + _this.format_); + } + /** + * @private + * @type {LoadingStrategy} + */ + + + _this.strategy_ = options.strategy !== undefined ? options.strategy : _loadingstrategy.all; + var useSpatialIndex = options.useSpatialIndex !== undefined ? options.useSpatialIndex : true; + /** + * @private + * @type {RBush<import("../Feature.js").default<Geometry>>} + */ + + _this.featuresRtree_ = useSpatialIndex ? new _RBush.default() : null; + /** + * @private + * @type {RBush<{extent: import("../extent.js").Extent}>} + */ + + _this.loadedExtentsRtree_ = new _RBush.default(); + /** + * @private + * @type {!Object<string, import("../Feature.js").default<Geometry>>} + */ + + _this.nullGeometryFeatures_ = {}; + /** + * A lookup of features by id (the return from feature.getId()). + * @private + * @type {!Object<string, import("../Feature.js").default<Geometry>>} + */ + + _this.idIndex_ = {}; + /** + * A lookup of features by uid (using getUid(feature)). + * @private + * @type {!Object<string, import("../Feature.js").default<Geometry>>} + */ + + _this.uidIndex_ = {}; + /** + * @private + * @type {Object<string, Array<import("../events.js").EventsKey>>} + */ + + _this.featureChangeKeys_ = {}; + /** + * @private + * @type {Collection<import("../Feature.js").default<Geometry>>} + */ + + _this.featuresCollection_ = null; + var collection, features; + + if (Array.isArray(options.features)) { + features = options.features; + } else if (options.features) { + collection = options.features; + features = collection.getArray(); + } + + if (!useSpatialIndex && collection === undefined) { + collection = new _Collection.default(features); + } + + if (features !== undefined) { + _this.addFeaturesInternal(features); + } + + if (collection !== undefined) { + _this.bindFeaturesCollection_(collection); + } + + return _this; + } + /** + * Add a single feature to the source. If you want to add a batch of features + * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()} + * instead. A feature will not be added to the source if feature with + * the same id is already there. The reason for this behavior is to avoid + * feature duplication when using bbox or tile loading strategies. + * Note: this also applies if an {@link module:ol/Collection} is used for features, + * meaning that if a feature with a duplicate id is added in the collection, it will + * be removed from it right away. + * @param {import("../Feature.js").default<Geometry>} feature Feature to add. + * @api + */ + + + VectorSource.prototype.addFeature = function (feature) { + this.addFeatureInternal(feature); + this.changed(); + }; + /** + * Add a feature without firing a `change` event. + * @param {import("../Feature.js").default<Geometry>} feature Feature. + * @protected + */ + + + VectorSource.prototype.addFeatureInternal = function (feature) { + var featureKey = (0, _util.getUid)(feature); + + if (!this.addToIndex_(featureKey, feature)) { + if (this.featuresCollection_) { + this.featuresCollection_.remove(feature); + } + + return; + } + + this.setupChangeEvents_(featureKey, feature); + var geometry = feature.getGeometry(); + + if (geometry) { + var extent = geometry.getExtent(); + + if (this.featuresRtree_) { + this.featuresRtree_.insert(extent, feature); + } + } else { + this.nullGeometryFeatures_[featureKey] = feature; + } + + this.dispatchEvent(new VectorSourceEvent(_VectorEventType.default.ADDFEATURE, feature)); + }; + /** + * @param {string} featureKey Unique identifier for the feature. + * @param {import("../Feature.js").default<Geometry>} feature The feature. + * @private + */ + + + VectorSource.prototype.setupChangeEvents_ = function (featureKey, feature) { + this.featureChangeKeys_[featureKey] = [(0, _events.listen)(feature, _EventType.default.CHANGE, this.handleFeatureChange_, this), (0, _events.listen)(feature, _ObjectEventType.default.PROPERTYCHANGE, this.handleFeatureChange_, this)]; + }; + /** + * @param {string} featureKey Unique identifier for the feature. + * @param {import("../Feature.js").default<Geometry>} feature The feature. + * @return {boolean} The feature is "valid", in the sense that it is also a + * candidate for insertion into the Rtree. + * @private + */ + + + VectorSource.prototype.addToIndex_ = function (featureKey, feature) { + var valid = true; + var id = feature.getId(); + + if (id !== undefined) { + if (!(id.toString() in this.idIndex_)) { + this.idIndex_[id.toString()] = feature; + } else { + valid = false; + } + } + + if (valid) { + (0, _asserts.assert)(!(featureKey in this.uidIndex_), 30); // The passed `feature` was already added to the source + + this.uidIndex_[featureKey] = feature; + } + + return valid; + }; + /** + * Add a batch of features to the source. + * @param {Array<import("../Feature.js").default<Geometry>>} features Features to add. + * @api + */ + + + VectorSource.prototype.addFeatures = function (features) { + this.addFeaturesInternal(features); + this.changed(); + }; + /** + * Add features without firing a `change` event. + * @param {Array<import("../Feature.js").default<Geometry>>} features Features. + * @protected + */ + + + VectorSource.prototype.addFeaturesInternal = function (features) { + var extents = []; + var newFeatures = []; + var geometryFeatures = []; + + for (var i = 0, length_1 = features.length; i < length_1; i++) { + var feature = features[i]; + var featureKey = (0, _util.getUid)(feature); + + if (this.addToIndex_(featureKey, feature)) { + newFeatures.push(feature); + } + } + + for (var i = 0, length_2 = newFeatures.length; i < length_2; i++) { + var feature = newFeatures[i]; + var featureKey = (0, _util.getUid)(feature); + this.setupChangeEvents_(featureKey, feature); + var geometry = feature.getGeometry(); + + if (geometry) { + var extent = geometry.getExtent(); + extents.push(extent); + geometryFeatures.push(feature); + } else { + this.nullGeometryFeatures_[featureKey] = feature; + } + } + + if (this.featuresRtree_) { + this.featuresRtree_.load(extents, geometryFeatures); + } + + for (var i = 0, length_3 = newFeatures.length; i < length_3; i++) { + this.dispatchEvent(new VectorSourceEvent(_VectorEventType.default.ADDFEATURE, newFeatures[i])); + } + }; + /** + * @param {!Collection<import("../Feature.js").default<Geometry>>} collection Collection. + * @private + */ + + + VectorSource.prototype.bindFeaturesCollection_ = function (collection) { + var modifyingCollection = false; + this.addEventListener(_VectorEventType.default.ADDFEATURE, + /** + * @param {VectorSourceEvent<Geometry>} evt The vector source event + */ + function (evt) { + if (!modifyingCollection) { + modifyingCollection = true; + collection.push(evt.feature); + modifyingCollection = false; + } + }); + this.addEventListener(_VectorEventType.default.REMOVEFEATURE, + /** + * @param {VectorSourceEvent<Geometry>} evt The vector source event + */ + function (evt) { + if (!modifyingCollection) { + modifyingCollection = true; + collection.remove(evt.feature); + modifyingCollection = false; + } + }); + collection.addEventListener(_CollectionEventType.default.ADD, + /** + * @param {import("../Collection.js").CollectionEvent} evt The collection event + */ + function (evt) { + if (!modifyingCollection) { + modifyingCollection = true; + this.addFeature( + /** @type {import("../Feature.js").default<Geometry>} */ + evt.element); + modifyingCollection = false; + } + }.bind(this)); + collection.addEventListener(_CollectionEventType.default.REMOVE, + /** + * @param {import("../Collection.js").CollectionEvent} evt The collection event + */ + function (evt) { + if (!modifyingCollection) { + modifyingCollection = true; + this.removeFeature( + /** @type {import("../Feature.js").default<Geometry>} */ + evt.element); + modifyingCollection = false; + } + }.bind(this)); + this.featuresCollection_ = collection; + }; + /** + * Remove all features from the source. + * @param {boolean=} opt_fast Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#removefeature} events. + * @api + */ + + + VectorSource.prototype.clear = function (opt_fast) { + if (opt_fast) { + for (var featureId in this.featureChangeKeys_) { + var keys = this.featureChangeKeys_[featureId]; + keys.forEach(_events.unlistenByKey); + } + + if (!this.featuresCollection_) { + this.featureChangeKeys_ = {}; + this.idIndex_ = {}; + this.uidIndex_ = {}; + } + } else { + if (this.featuresRtree_) { + this.featuresRtree_.forEach(this.removeFeatureInternal.bind(this)); + + for (var id in this.nullGeometryFeatures_) { + this.removeFeatureInternal(this.nullGeometryFeatures_[id]); + } + } + } + + if (this.featuresCollection_) { + this.featuresCollection_.clear(); + } + + if (this.featuresRtree_) { + this.featuresRtree_.clear(); + } + + this.nullGeometryFeatures_ = {}; + var clearEvent = new VectorSourceEvent(_VectorEventType.default.CLEAR); + this.dispatchEvent(clearEvent); + this.changed(); + }; + /** + * Iterate through all features on the source, calling the provided callback + * with each one. If the callback returns any "truthy" value, iteration will + * stop and the function will return the same value. + * Note: this function only iterate through the feature that have a defined geometry. + * + * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature + * on the source. Return a truthy value to stop iteration. + * @return {T|undefined} The return value from the last call to the callback. + * @template T + * @api + */ + + + VectorSource.prototype.forEachFeature = function (callback) { + if (this.featuresRtree_) { + return this.featuresRtree_.forEach(callback); + } else if (this.featuresCollection_) { + this.featuresCollection_.forEach(callback); + } + }; + /** + * Iterate through all features whose geometries contain the provided + * coordinate, calling the callback with each feature. If the callback returns + * a "truthy" value, iteration will stop and the function will return the same + * value. + * + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature + * whose goemetry contains the provided coordinate. + * @return {T|undefined} The return value from the last call to the callback. + * @template T + */ + + + VectorSource.prototype.forEachFeatureAtCoordinateDirect = function (coordinate, callback) { + var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]]; + return this.forEachFeatureInExtent(extent, function (feature) { + var geometry = feature.getGeometry(); + + if (geometry.intersectsCoordinate(coordinate)) { + return callback(feature); + } else { + return undefined; + } + }); + }; + /** + * Iterate through all features whose bounding box intersects the provided + * extent (note that the feature's geometry may not intersect the extent), + * calling the callback with each feature. If the callback returns a "truthy" + * value, iteration will stop and the function will return the same value. + * + * If you are interested in features whose geometry intersects an extent, call + * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead. + * + * When `useSpatialIndex` is set to false, this method will loop through all + * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}. + * + * @param {import("../extent.js").Extent} extent Extent. + * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature + * whose bounding box intersects the provided extent. + * @return {T|undefined} The return value from the last call to the callback. + * @template T + * @api + */ + + + VectorSource.prototype.forEachFeatureInExtent = function (extent, callback) { + if (this.featuresRtree_) { + return this.featuresRtree_.forEachInExtent(extent, callback); + } else if (this.featuresCollection_) { + this.featuresCollection_.forEach(callback); + } + }; + /** + * Iterate through all features whose geometry intersects the provided extent, + * calling the callback with each feature. If the callback returns a "truthy" + * value, iteration will stop and the function will return the same value. + * + * If you only want to test for bounding box intersection, call the + * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead. + * + * @param {import("../extent.js").Extent} extent Extent. + * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature + * whose geometry intersects the provided extent. + * @return {T|undefined} The return value from the last call to the callback. + * @template T + * @api + */ + + + VectorSource.prototype.forEachFeatureIntersectingExtent = function (extent, callback) { + return this.forEachFeatureInExtent(extent, + /** + * @param {import("../Feature.js").default<Geometry>} feature Feature. + * @return {T|undefined} The return value from the last call to the callback. + */ + function (feature) { + var geometry = feature.getGeometry(); + + if (geometry.intersectsExtent(extent)) { + var result = callback(feature); + + if (result) { + return result; + } + } + }); + }; + /** + * Get the features collection associated with this source. Will be `null` + * unless the source was configured with `useSpatialIndex` set to `false`, or + * with an {@link module:ol/Collection} as `features`. + * @return {Collection<import("../Feature.js").default<Geometry>>} The collection of features. + * @api + */ + + + VectorSource.prototype.getFeaturesCollection = function () { + return this.featuresCollection_; + }; + /** + * Get all features on the source in random order. + * @return {Array<import("../Feature.js").default<Geometry>>} Features. + * @api + */ + + + VectorSource.prototype.getFeatures = function () { + var features; + + if (this.featuresCollection_) { + features = this.featuresCollection_.getArray(); + } else if (this.featuresRtree_) { + features = this.featuresRtree_.getAll(); + + if (!(0, _obj.isEmpty)(this.nullGeometryFeatures_)) { + (0, _array.extend)(features, (0, _obj.getValues)(this.nullGeometryFeatures_)); + } + } + + return ( + /** @type {Array<import("../Feature.js").default<Geometry>>} */ + features + ); + }; + /** + * Get all features whose geometry intersects the provided coordinate. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @return {Array<import("../Feature.js").default<Geometry>>} Features. + * @api + */ + + + VectorSource.prototype.getFeaturesAtCoordinate = function (coordinate) { + var features = []; + this.forEachFeatureAtCoordinateDirect(coordinate, function (feature) { + features.push(feature); + }); + return features; + }; + /** + * Get all features whose bounding box intersects the provided extent. Note that this returns an array of + * all features intersecting the given extent in random order (so it may include + * features whose geometries do not intersect the extent). + * + * When `useSpatialIndex` is set to false, this method will return all + * features. + * + * @param {import("../extent.js").Extent} extent Extent. + * @return {Array<import("../Feature.js").default<Geometry>>} Features. + * @api + */ + + + VectorSource.prototype.getFeaturesInExtent = function (extent) { + if (this.featuresRtree_) { + return this.featuresRtree_.getInExtent(extent); + } else if (this.featuresCollection_) { + return this.featuresCollection_.getArray(); + } else { + return []; + } + }; + /** + * Get the closest feature to the provided coordinate. + * + * This method is not available when the source is configured with + * `useSpatialIndex` set to `false`. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {function(import("../Feature.js").default<Geometry>):boolean=} opt_filter Feature filter function. + * The filter function will receive one argument, the {@link module:ol/Feature feature} + * and it should return a boolean value. By default, no filtering is made. + * @return {import("../Feature.js").default<Geometry>} Closest feature. + * @api + */ + + + VectorSource.prototype.getClosestFeatureToCoordinate = function (coordinate, opt_filter) { + // Find the closest feature using branch and bound. We start searching an + // infinite extent, and find the distance from the first feature found. This + // becomes the closest feature. We then compute a smaller extent which any + // closer feature must intersect. We continue searching with this smaller + // extent, trying to find a closer feature. Every time we find a closer + // feature, we update the extent being searched so that any even closer + // feature must intersect it. We continue until we run out of features. + var x = coordinate[0]; + var y = coordinate[1]; + var closestFeature = null; + var closestPoint = [NaN, NaN]; + var minSquaredDistance = Infinity; + var extent = [-Infinity, -Infinity, Infinity, Infinity]; + var filter = opt_filter ? opt_filter : _functions.TRUE; + this.featuresRtree_.forEachInExtent(extent, + /** + * @param {import("../Feature.js").default<Geometry>} feature Feature. + */ + function (feature) { + if (filter(feature)) { + var geometry = feature.getGeometry(); + var previousMinSquaredDistance = minSquaredDistance; + minSquaredDistance = geometry.closestPointXY(x, y, closestPoint, minSquaredDistance); + + if (minSquaredDistance < previousMinSquaredDistance) { + closestFeature = feature; // This is sneaky. Reduce the extent that it is currently being + // searched while the R-Tree traversal using this same extent object + // is still in progress. This is safe because the new extent is + // strictly contained by the old extent. + + var minDistance = Math.sqrt(minSquaredDistance); + extent[0] = x - minDistance; + extent[1] = y - minDistance; + extent[2] = x + minDistance; + extent[3] = y + minDistance; + } + } + }); + return closestFeature; + }; + /** + * Get the extent of the features currently in the source. + * + * This method is not available when the source is configured with + * `useSpatialIndex` set to `false`. + * @param {import("../extent.js").Extent=} opt_extent Destination extent. If provided, no new extent + * will be created. Instead, that extent's coordinates will be overwritten. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + + + VectorSource.prototype.getExtent = function (opt_extent) { + return this.featuresRtree_.getExtent(opt_extent); + }; + /** + * Get a feature by its identifier (the value returned by feature.getId()). + * Note that the index treats string and numeric identifiers as the same. So + * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`. + * + * @param {string|number} id Feature identifier. + * @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found). + * @api + */ + + + VectorSource.prototype.getFeatureById = function (id) { + var feature = this.idIndex_[id.toString()]; + return feature !== undefined ? feature : null; + }; + /** + * Get a feature by its internal unique identifier (using `getUid`). + * + * @param {string} uid Feature identifier. + * @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found). + */ + + + VectorSource.prototype.getFeatureByUid = function (uid) { + var feature = this.uidIndex_[uid]; + return feature !== undefined ? feature : null; + }; + /** + * Get the format associated with this source. + * + * @return {import("../format/Feature.js").default|undefined} The feature format. + * @api + */ + + + VectorSource.prototype.getFormat = function () { + return this.format_; + }; + /** + * @return {boolean} The source can have overlapping geometries. + */ + + + VectorSource.prototype.getOverlaps = function () { + return this.overlaps_; + }; + /** + * Get the url associated with this source. + * + * @return {string|import("../featureloader.js").FeatureUrlFunction|undefined} The url. + * @api + */ + + + VectorSource.prototype.getUrl = function () { + return this.url_; + }; + /** + * @param {Event} event Event. + * @private + */ + + + VectorSource.prototype.handleFeatureChange_ = function (event) { + var feature = + /** @type {import("../Feature.js").default<Geometry>} */ + event.target; + var featureKey = (0, _util.getUid)(feature); + var geometry = feature.getGeometry(); + + if (!geometry) { + if (!(featureKey in this.nullGeometryFeatures_)) { + if (this.featuresRtree_) { + this.featuresRtree_.remove(feature); + } + + this.nullGeometryFeatures_[featureKey] = feature; + } + } else { + var extent = geometry.getExtent(); + + if (featureKey in this.nullGeometryFeatures_) { + delete this.nullGeometryFeatures_[featureKey]; + + if (this.featuresRtree_) { + this.featuresRtree_.insert(extent, feature); + } + } else { + if (this.featuresRtree_) { + this.featuresRtree_.update(extent, feature); + } + } + } + + var id = feature.getId(); + + if (id !== undefined) { + var sid = id.toString(); + + if (this.idIndex_[sid] !== feature) { + this.removeFromIdIndex_(feature); + this.idIndex_[sid] = feature; + } + } else { + this.removeFromIdIndex_(feature); + this.uidIndex_[featureKey] = feature; + } + + this.changed(); + this.dispatchEvent(new VectorSourceEvent(_VectorEventType.default.CHANGEFEATURE, feature)); + }; + /** + * Returns true if the feature is contained within the source. + * @param {import("../Feature.js").default<Geometry>} feature Feature. + * @return {boolean} Has feature. + * @api + */ + + + VectorSource.prototype.hasFeature = function (feature) { + var id = feature.getId(); + + if (id !== undefined) { + return id in this.idIndex_; + } else { + return (0, _util.getUid)(feature) in this.uidIndex_; + } + }; + /** + * @return {boolean} Is empty. + */ + + + VectorSource.prototype.isEmpty = function () { + return this.featuresRtree_.isEmpty() && (0, _obj.isEmpty)(this.nullGeometryFeatures_); + }; + /** + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {import("../proj/Projection.js").default} projection Projection. + */ + + + VectorSource.prototype.loadFeatures = function (extent, resolution, projection) { + var loadedExtentsRtree = this.loadedExtentsRtree_; + var extentsToLoad = this.strategy_(extent, resolution); + this.loading = false; + + var _loop_1 = function (i, ii) { + var extentToLoad = extentsToLoad[i]; + var alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad, + /** + * @param {{extent: import("../extent.js").Extent}} object Object. + * @return {boolean} Contains. + */ + function (object) { + return (0, _extent.containsExtent)(object.extent, extentToLoad); + }); + + if (!alreadyLoaded) { + this_1.loader_.call(this_1, extentToLoad, resolution, projection); + loadedExtentsRtree.insert(extentToLoad, { + extent: extentToLoad.slice() + }); + this_1.loading = this_1.loader_ !== _functions.VOID; + } + }; + + var this_1 = this; + + for (var i = 0, ii = extentsToLoad.length; i < ii; ++i) { + _loop_1(i, ii); + } + }; + + VectorSource.prototype.refresh = function () { + this.clear(true); + this.loadedExtentsRtree_.clear(); + + _super.prototype.refresh.call(this); + }; + /** + * Remove an extent from the list of loaded extents. + * @param {import("../extent.js").Extent} extent Extent. + * @api + */ + + + VectorSource.prototype.removeLoadedExtent = function (extent) { + var loadedExtentsRtree = this.loadedExtentsRtree_; + var obj; + loadedExtentsRtree.forEachInExtent(extent, function (object) { + if ((0, _extent.equals)(object.extent, extent)) { + obj = object; + return true; + } + }); + + if (obj) { + loadedExtentsRtree.remove(obj); + } + }; + /** + * Remove a single feature from the source. If you want to remove all features + * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method + * instead. + * @param {import("../Feature.js").default<Geometry>} feature Feature to remove. + * @api + */ + + + VectorSource.prototype.removeFeature = function (feature) { + var featureKey = (0, _util.getUid)(feature); + + if (featureKey in this.nullGeometryFeatures_) { + delete this.nullGeometryFeatures_[featureKey]; + } else { + if (this.featuresRtree_) { + this.featuresRtree_.remove(feature); + } + } + + this.removeFeatureInternal(feature); + this.changed(); + }; + /** + * Remove feature without firing a `change` event. + * @param {import("../Feature.js").default<Geometry>} feature Feature. + * @protected + */ + + + VectorSource.prototype.removeFeatureInternal = function (feature) { + var featureKey = (0, _util.getUid)(feature); + this.featureChangeKeys_[featureKey].forEach(_events.unlistenByKey); + delete this.featureChangeKeys_[featureKey]; + var id = feature.getId(); + + if (id !== undefined) { + delete this.idIndex_[id.toString()]; + } + + delete this.uidIndex_[featureKey]; + this.dispatchEvent(new VectorSourceEvent(_VectorEventType.default.REMOVEFEATURE, feature)); + }; + /** + * Remove a feature from the id index. Called internally when the feature id + * may have changed. + * @param {import("../Feature.js").default<Geometry>} feature The feature. + * @return {boolean} Removed the feature from the index. + * @private + */ + + + VectorSource.prototype.removeFromIdIndex_ = function (feature) { + var removed = false; + + for (var id in this.idIndex_) { + if (this.idIndex_[id] === feature) { + delete this.idIndex_[id]; + removed = true; + break; + } + } + + return removed; + }; + /** + * Set the new loader of the source. The next render cycle will use the + * new loader. + * @param {import("../featureloader.js").FeatureLoader} loader The loader to set. + * @api + */ + + + VectorSource.prototype.setLoader = function (loader) { + this.loader_ = loader; + }; + /** + * Points the source to a new url. The next render cycle will use the new url. + * @param {string|import("../featureloader.js").FeatureUrlFunction} url Url. + * @api + */ + + + VectorSource.prototype.setUrl = function (url) { + (0, _asserts.assert)(this.format_, 7); // `format` must be set when `url` is set + + this.setLoader((0, _featureloader.xhr)(url, this.format_)); + }; + + return VectorSource; +}(_Source.default); + +var _default = VectorSource; +exports.default = _default; +},{"../Collection.js":"../../../node_modules/ol/Collection.js","../CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","../events/Event.js":"../../../node_modules/ol/events/Event.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../ObjectEventType.js":"../../../node_modules/ol/ObjectEventType.js","../structs/RBush.js":"../../../node_modules/ol/structs/RBush.js","./Source.js":"../../../node_modules/ol/source/Source.js","./State.js":"../../../node_modules/ol/source/State.js","./VectorEventType.js":"../../../node_modules/ol/source/VectorEventType.js","../functions.js":"../../../node_modules/ol/functions.js","../loadingstrategy.js":"../../../node_modules/ol/loadingstrategy.js","../asserts.js":"../../../node_modules/ol/asserts.js","../extent.js":"../../../node_modules/ol/extent.js","../array.js":"../../../node_modules/ol/array.js","../util.js":"../../../node_modules/ol/util.js","../obj.js":"../../../node_modules/ol/obj.js","../events.js":"../../../node_modules/ol/events.js","../featureloader.js":"../../../node_modules/ol/featureloader.js"}],"../../../node_modules/ol/render.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.toContext = toContext; +exports.getVectorContext = getVectorContext; +exports.getRenderPixel = getRenderPixel; +exports.renderDeclutterItems = renderDeclutterItems; + +var _Immediate = _interopRequireDefault(require("./render/canvas/Immediate.js")); + +var _has = require("./has.js"); + +var _transform = require("./transform.js"); + +var _vector = require("./renderer/vector.js"); + +var _proj = require("./proj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render + */ + +/** + * @typedef {Object} State + * @property {CanvasRenderingContext2D} context Canvas context that the layer is being rendered to. + * @property {import("./Feature.js").FeatureLike} feature + * @property {import("./geom/SimpleGeometry.js").default} geometry + * @property {number} pixelRatio Pixel ratio used by the layer renderer. + * @property {number} resolution Resolution that the render batch was created and optimized for. + * This is not the view's resolution that is being rendered. + * @property {number} rotation Rotation of the rendered layer in radians. + */ + +/** + * A function to be used when sorting features before rendering. + * It takes two instances of {@link module:ol/Feature} or + * {@link module:ol/render/Feature} and returns a `{number}`. + * + * @typedef {function(import("./Feature.js").FeatureLike, import("./Feature.js").FeatureLike):number} OrderFunction + */ + +/** + * @typedef {Object} ToContextOptions + * @property {import("./size.js").Size} [size] Desired size of the canvas in css + * pixels. When provided, both canvas and css size will be set according to the + * `pixelRatio`. If not provided, the current canvas and css sizes will not be + * altered. + * @property {number} [pixelRatio=window.devicePixelRatio] Pixel ratio (canvas + * pixel to css pixel ratio) for the canvas. + */ + +/** + * Binds a Canvas Immediate API to a canvas context, to allow drawing geometries + * to the context's canvas. + * + * The units for geometry coordinates are css pixels relative to the top left + * corner of the canvas element. + * ```js + * import {toContext} from 'ol/render'; + * import Fill from 'ol/style/Fill'; + * import Polygon from 'ol/geom/Polygon'; + * + * var canvas = document.createElement('canvas'); + * var render = toContext(canvas.getContext('2d'), + * { size: [100, 100] }); + * render.setFillStrokeStyle(new Fill({ color: blue })); + * render.drawPolygon( + * new Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]])); + * ``` + * + * @param {CanvasRenderingContext2D} context Canvas context. + * @param {ToContextOptions=} opt_options Options. + * @return {CanvasImmediateRenderer} Canvas Immediate. + * @api + */ +function toContext(context, opt_options) { + var canvas = context.canvas; + var options = opt_options ? opt_options : {}; + var pixelRatio = options.pixelRatio || _has.DEVICE_PIXEL_RATIO; + var size = options.size; + + if (size) { + canvas.width = size[0] * pixelRatio; + canvas.height = size[1] * pixelRatio; + canvas.style.width = size[0] + 'px'; + canvas.style.height = size[1] + 'px'; + } + + var extent = [0, 0, canvas.width, canvas.height]; + var transform = (0, _transform.scale)((0, _transform.create)(), pixelRatio, pixelRatio); + return new _Immediate.default(context, pixelRatio, extent, transform, 0); +} +/** + * Gets a vector context for drawing to the event's canvas. + * @param {import("./render/Event.js").default} event Render event. + * @returns {CanvasImmediateRenderer} Vector context. + * @api + */ + + +function getVectorContext(event) { + var frameState = event.frameState; + var transform = (0, _transform.multiply)(event.inversePixelTransform.slice(), frameState.coordinateToPixelTransform); + var squaredTolerance = (0, _vector.getSquaredTolerance)(frameState.viewState.resolution, frameState.pixelRatio); + var userTransform; + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + userTransform = (0, _proj.getTransformFromProjections)(userProjection, frameState.viewState.projection); + } + + return new _Immediate.default(event.context, frameState.pixelRatio, frameState.extent, transform, frameState.viewState.rotation, squaredTolerance, userTransform); +} +/** + * Gets the pixel of the event's canvas context from the map viewport's CSS pixel. + * @param {import("./render/Event.js").default} event Render event. + * @param {import("./pixel.js").Pixel} pixel CSS pixel relative to the top-left + * corner of the map viewport. + * @returns {import("./pixel.js").Pixel} Pixel on the event's canvas context. + * @api + */ + + +function getRenderPixel(event, pixel) { + var result = pixel.slice(0); + (0, _transform.apply)(event.inversePixelTransform.slice(), result); + return result; +} +/** + * @param {import("./PluggableMap.js").FrameState} frameState Frame state. + * @param {?} declutterTree Declutter tree. + * @returns {?} Declutter tree. + */ + + +function renderDeclutterItems(frameState, declutterTree) { + if (declutterTree) { + declutterTree.clear(); + } + + var items = frameState.declutterItems; + + for (var z = items.length - 1; z >= 0; --z) { + var item = items[z]; + var zIndexItems = item.items; + + for (var i = 0, ii = zIndexItems.length; i < ii; i += 3) { + declutterTree = zIndexItems[i].renderDeclutter(zIndexItems[i + 1], zIndexItems[i + 2], item.opacity, declutterTree); + } + } + + items.length = 0; + return declutterTree; +} +},{"./render/canvas/Immediate.js":"../../../node_modules/ol/render/canvas/Immediate.js","./has.js":"../../../node_modules/ol/has.js","./transform.js":"../../../node_modules/ol/transform.js","./renderer/vector.js":"../../../node_modules/ol/renderer/vector.js","./proj.js":"../../../node_modules/ol/proj.js"}],"../../../node_modules/ol/geom/flat/geodesic.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.greatCircleArc = greatCircleArc; +exports.meridian = meridian; +exports.parallel = parallel; + +var _proj = require("../../proj.js"); + +var _math = require("../../math.js"); + +/** + * @module ol/geom/flat/geodesic + */ + +/** + * @param {function(number): import("../../coordinate.js").Coordinate} interpolate Interpolate function. + * @param {import("../../proj.js").TransformFunction} transform Transform from longitude/latitude to + * projected coordinates. + * @param {number} squaredTolerance Squared tolerance. + * @return {Array<number>} Flat coordinates. + */ +function line(interpolate, transform, squaredTolerance) { + // FIXME reduce garbage generation + // FIXME optimize stack operations + + /** @type {Array<number>} */ + var flatCoordinates = []; + var geoA = interpolate(0); + var geoB = interpolate(1); + var a = transform(geoA); + var b = transform(geoB); + /** @type {Array<import("../../coordinate.js").Coordinate>} */ + + var geoStack = [geoB, geoA]; + /** @type {Array<import("../../coordinate.js").Coordinate>} */ + + var stack = [b, a]; + /** @type {Array<number>} */ + + var fractionStack = [1, 0]; + /** @type {!Object<string, boolean>} */ + + var fractions = {}; + var maxIterations = 1e5; + var geoM, m, fracA, fracB, fracM, key; + + while (--maxIterations > 0 && fractionStack.length > 0) { + // Pop the a coordinate off the stack + fracA = fractionStack.pop(); + geoA = geoStack.pop(); + a = stack.pop(); // Add the a coordinate if it has not been added yet + + key = fracA.toString(); + + if (!(key in fractions)) { + flatCoordinates.push(a[0], a[1]); + fractions[key] = true; + } // Pop the b coordinate off the stack + + + fracB = fractionStack.pop(); + geoB = geoStack.pop(); + b = stack.pop(); // Find the m point between the a and b coordinates + + fracM = (fracA + fracB) / 2; + geoM = interpolate(fracM); + m = transform(geoM); + + if ((0, _math.squaredSegmentDistance)(m[0], m[1], a[0], a[1], b[0], b[1]) < squaredTolerance) { + // If the m point is sufficiently close to the straight line, then we + // discard it. Just use the b coordinate and move on to the next line + // segment. + flatCoordinates.push(b[0], b[1]); + key = fracB.toString(); + fractions[key] = true; + } else { + // Otherwise, we need to subdivide the current line segment. Split it + // into two and push the two line segments onto the stack. + fractionStack.push(fracB, fracM, fracM, fracA); + stack.push(b, m, m, a); + geoStack.push(geoB, geoM, geoM, geoA); + } + } + + return flatCoordinates; +} +/** + * Generate a great-circle arcs between two lat/lon points. + * @param {number} lon1 Longitude 1 in degrees. + * @param {number} lat1 Latitude 1 in degrees. + * @param {number} lon2 Longitude 2 in degrees. + * @param {number} lat2 Latitude 2 in degrees. + * @param {import("../../proj/Projection.js").default} projection Projection. + * @param {number} squaredTolerance Squared tolerance. + * @return {Array<number>} Flat coordinates. + */ + + +function greatCircleArc(lon1, lat1, lon2, lat2, projection, squaredTolerance) { + var geoProjection = (0, _proj.get)('EPSG:4326'); + var cosLat1 = Math.cos((0, _math.toRadians)(lat1)); + var sinLat1 = Math.sin((0, _math.toRadians)(lat1)); + var cosLat2 = Math.cos((0, _math.toRadians)(lat2)); + var sinLat2 = Math.sin((0, _math.toRadians)(lat2)); + var cosDeltaLon = Math.cos((0, _math.toRadians)(lon2 - lon1)); + var sinDeltaLon = Math.sin((0, _math.toRadians)(lon2 - lon1)); + var d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon; + return line( + /** + * @param {number} frac Fraction. + * @return {import("../../coordinate.js").Coordinate} Coordinate. + */ + function (frac) { + if (1 <= d) { + return [lon2, lat2]; + } + + var D = frac * Math.acos(d); + var cosD = Math.cos(D); + var sinD = Math.sin(D); + var y = sinDeltaLon * cosLat2; + var x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon; + var theta = Math.atan2(y, x); + var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta)); + var lon = (0, _math.toRadians)(lon1) + Math.atan2(Math.sin(theta) * sinD * cosLat1, cosD - sinLat1 * Math.sin(lat)); + return [(0, _math.toDegrees)(lon), (0, _math.toDegrees)(lat)]; + }, (0, _proj.getTransform)(geoProjection, projection), squaredTolerance); +} +/** + * Generate a meridian (line at constant longitude). + * @param {number} lon Longitude. + * @param {number} lat1 Latitude 1. + * @param {number} lat2 Latitude 2. + * @param {import("../../proj/Projection.js").default} projection Projection. + * @param {number} squaredTolerance Squared tolerance. + * @return {Array<number>} Flat coordinates. + */ + + +function meridian(lon, lat1, lat2, projection, squaredTolerance) { + var epsg4326Projection = (0, _proj.get)('EPSG:4326'); + return line( + /** + * @param {number} frac Fraction. + * @return {import("../../coordinate.js").Coordinate} Coordinate. + */ + function (frac) { + return [lon, lat1 + (lat2 - lat1) * frac]; + }, (0, _proj.getTransform)(epsg4326Projection, projection), squaredTolerance); +} +/** + * Generate a parallel (line at constant latitude). + * @param {number} lat Latitude. + * @param {number} lon1 Longitude 1. + * @param {number} lon2 Longitude 2. + * @param {import("../../proj/Projection.js").default} projection Projection. + * @param {number} squaredTolerance Squared tolerance. + * @return {Array<number>} Flat coordinates. + */ + + +function parallel(lat, lon1, lon2, projection, squaredTolerance) { + var epsg4326Projection = (0, _proj.get)('EPSG:4326'); + return line( + /** + * @param {number} frac Fraction. + * @return {import("../../coordinate.js").Coordinate} Coordinate. + */ + function (frac) { + return [lon1 + (lon2 - lon1) * frac, lat]; + }, (0, _proj.getTransform)(epsg4326Projection, projection), squaredTolerance); +} +},{"../../proj.js":"../../../node_modules/ol/proj.js","../../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/layer/Graticule.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Collection = _interopRequireDefault(require("../Collection.js")); + +var _EventType = _interopRequireDefault(require("../render/EventType.js")); + +var _Feature = _interopRequireDefault(require("../Feature.js")); + +var _Fill = _interopRequireDefault(require("../style/Fill.js")); + +var _GeometryLayout = _interopRequireDefault(require("../geom/GeometryLayout.js")); + +var _LineString = _interopRequireDefault(require("../geom/LineString.js")); + +var _Point = _interopRequireDefault(require("../geom/Point.js")); + +var _Stroke = _interopRequireDefault(require("../style/Stroke.js")); + +var _Style = _interopRequireDefault(require("../style/Style.js")); + +var _Text = _interopRequireDefault(require("../style/Text.js")); + +var _Vector = _interopRequireDefault(require("./Vector.js")); + +var _Vector2 = _interopRequireDefault(require("../source/Vector.js")); + +var _extent = require("../extent.js"); + +var _obj = require("../obj.js"); + +var _math = require("../math.js"); + +var _coordinate = require("../coordinate.js"); + +var _proj = require("../proj.js"); + +var _render = require("../render.js"); + +var _geodesic = require("../geom/flat/geodesic.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/Graticule + */ + + +/** + * @type {Stroke} + * @private + * @const + */ +var DEFAULT_STROKE_STYLE = new _Stroke.default({ + color: 'rgba(0,0,0,0.2)' +}); +/** + * @type {Array<number>} + * @private + */ + +var INTERVALS = [90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001]; +/** + * @typedef {Object} GraticuleLabelDataType + * @property {Point} geom + * @property {string} text + */ + +/** + * @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 {number} [maxLines=100] The maximum number of meridians and + * parallels from the center of the map. The default value of 100 means that at + * most 200 meridians and 200 parallels will be displayed. The default value is + * appropriate for conformal projections like Spherical Mercator. If you + * increase the value, more lines will be drawn and the drawing performance will + * decrease. + * @property {Stroke} [strokeStyle='rgba(0,0,0,0.2)'] The + * stroke style to use for drawing the graticule. If not provided, a not fully + * opaque black will be used. + * @property {number} [targetSize=100] The target size of the graticule cells, + * in pixels. + * @property {boolean} [showLabels=false] Render a label with the respective + * latitude/longitude for each graticule line. + * @property {function(number):string} [lonLabelFormatter] Label formatter for + * longitudes. This function is called with the longitude as argument, and + * should return a formatted string representing the longitude. By default, + * labels are formatted as degrees, minutes, seconds and hemisphere. + * @property {function(number):string} [latLabelFormatter] Label formatter for + * latitudes. This function is called with the latitude as argument, and + * should return a formatted string representing the latitude. By default, + * labels are formatted as degrees, minutes, seconds and hemisphere. + * @property {number} [lonLabelPosition=0] Longitude label position in fractions + * (0..1) of view extent. 0 means at the bottom of the viewport, 1 means at the + * top. + * @property {number} [latLabelPosition=1] Latitude label position in fractions + * (0..1) of view extent. 0 means at the left of the viewport, 1 means at the + * right. + * @property {Text} [lonLabelStyle] Longitude label text + * style. If not provided, the following style will be used: + * ```js + * new Text({ + * font: '12px Calibri,sans-serif', + * textBaseline: 'bottom', + * fill: new Fill({ + * color: 'rgba(0,0,0,1)' + * }), + * stroke: new Stroke({ + * color: 'rgba(255,255,255,1)', + * width: 3 + * }) + * }); + * ``` + * Note that the default's `textBaseline` configuration will not work well for + * `lonLabelPosition` configurations that position labels close to the top of + * the viewport. + * @property {Text} [latLabelStyle] Latitude label text style. + * If not provided, the following style will be used: + * ```js + * new Text({ + * font: '12px Calibri,sans-serif', + * textAlign: 'end', + * fill: new Fill({ + * color: 'rgba(0,0,0,1)' + * }), + * stroke: Stroke({ + * color: 'rgba(255,255,255,1)', + * width: 3 + * }) + * }); + * ``` + * Note that the default's `textAlign` configuration will not work well for + * `latLabelPosition` configurations that position labels close to the left of + * the viewport. + * @property {Array<number>} [intervals=[90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001]] + * Intervals (in degrees) for the graticule. Example to limit graticules to 30 and 10 degrees intervals: + * ```js + * [30, 10] + * ``` + * @property {boolean} [wrapX=true] Whether to repeat the graticule horizontally. + */ + +/** + * @classdesc + * Layer that renders a grid for a coordinate system (currently only EPSG:4326 is supported). + * Note that the view projection must define both extent and worldExtent. + * + * @fires import("../render/Event.js").RenderEvent + * @api + */ + +var Graticule = +/** @class */ +function (_super) { + __extends(Graticule, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Graticule(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var baseOptions = (0, _obj.assign)({ + updateWhileAnimating: true, + updateWhileInteracting: true, + renderBuffer: 0 + }, options); + delete baseOptions.maxLines; + delete baseOptions.strokeStyle; + delete baseOptions.targetSize; + delete baseOptions.showLabels; + delete baseOptions.lonLabelFormatter; + delete baseOptions.latLabelFormatter; + delete baseOptions.lonLabelPosition; + delete baseOptions.latLabelPosition; + delete baseOptions.lonLabelStyle; + delete baseOptions.latLabelStyle; + delete baseOptions.intervals; + _this = _super.call(this, baseOptions) || this; + /** + * @type {import("../proj/Projection.js").default} + */ + + _this.projection_ = null; + /** + * @type {number} + * @private + */ + + _this.maxLat_ = Infinity; + /** + * @type {number} + * @private + */ + + _this.maxLon_ = Infinity; + /** + * @type {number} + * @private + */ + + _this.minLat_ = -Infinity; + /** + * @type {number} + * @private + */ + + _this.minLon_ = -Infinity; + /** + * @type {number} + * @private + */ + + _this.maxX_ = Infinity; + /** + * @type {number} + * @private + */ + + _this.maxY_ = Infinity; + /** + * @type {number} + * @private + */ + + _this.minX_ = -Infinity; + /** + * @type {number} + * @private + */ + + _this.minY_ = -Infinity; + /** + * @type {number} + * @private + */ + + _this.targetSize_ = options.targetSize !== undefined ? options.targetSize : 100; + /** + * @type {number} + * @private + */ + + _this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100; + /** + * @type {Array<LineString>} + * @private + */ + + _this.meridians_ = []; + /** + * @type {Array<LineString>} + * @private + */ + + _this.parallels_ = []; + /** + * @type {Stroke} + * @private + */ + + _this.strokeStyle_ = options.strokeStyle !== undefined ? options.strokeStyle : DEFAULT_STROKE_STYLE; + /** + * @type {import("../proj.js").TransformFunction|undefined} + * @private + */ + + _this.fromLonLatTransform_ = undefined; + /** + * @type {import("../proj.js").TransformFunction|undefined} + * @private + */ + + _this.toLonLatTransform_ = undefined; + /** + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.projectionCenterLonLat_ = null; + /** + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.bottomLeft_ = null; + /** + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.bottomRight_ = null; + /** + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.topLeft_ = null; + /** + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.topRight_ = null; + /** + * @type {Array<GraticuleLabelDataType>} + * @private + */ + + _this.meridiansLabels_ = null; + /** + * @type {Array<GraticuleLabelDataType>} + * @private + */ + + _this.parallelsLabels_ = null; + + if (options.showLabels) { + /** + * @type {null|function(number):string} + * @private + */ + _this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ? _coordinate.degreesToStringHDMS.bind(_this, 'EW') : options.lonLabelFormatter; + /** + * @type {function(number):string} + * @private + */ + + _this.latLabelFormatter_ = options.latLabelFormatter == undefined ? _coordinate.degreesToStringHDMS.bind(_this, 'NS') : options.latLabelFormatter; + /** + * Longitude label position in fractions (0..1) of view extent. 0 means + * bottom, 1 means top. + * @type {number} + * @private + */ + + _this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 : options.lonLabelPosition; + /** + * Latitude Label position in fractions (0..1) of view extent. 0 means left, 1 + * means right. + * @type {number} + * @private + */ + + _this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 : options.latLabelPosition; + /** + * @type {Style} + * @private + */ + + _this.lonLabelStyleBase_ = new _Style.default({ + text: options.lonLabelStyle !== undefined ? options.lonLabelStyle.clone() : new _Text.default({ + font: '12px Calibri,sans-serif', + textBaseline: 'bottom', + fill: new _Fill.default({ + color: 'rgba(0,0,0,1)' + }), + stroke: new _Stroke.default({ + color: 'rgba(255,255,255,1)', + width: 3 + }) + }) + }); + /** + * @private + * @param {import("../Feature").default} feature Feature + * @return {Style} style + */ + + _this.lonLabelStyle_ = function (feature) { + var label = feature.get('graticule_label'); + this.lonLabelStyleBase_.getText().setText(label); + return this.lonLabelStyleBase_; + }.bind(_this); + /** + * @type {Style} + * @private + */ + + + _this.latLabelStyleBase_ = new _Style.default({ + text: options.latLabelStyle !== undefined ? options.latLabelStyle.clone() : new _Text.default({ + font: '12px Calibri,sans-serif', + textAlign: 'right', + fill: new _Fill.default({ + color: 'rgba(0,0,0,1)' + }), + stroke: new _Stroke.default({ + color: 'rgba(255,255,255,1)', + width: 3 + }) + }) + }); + /** + * @private + * @param {import("../Feature").default} feature Feature + * @return {Style} style + */ + + _this.latLabelStyle_ = function (feature) { + var label = feature.get('graticule_label'); + this.latLabelStyleBase_.getText().setText(label); + return this.latLabelStyleBase_; + }.bind(_this); + + _this.meridiansLabels_ = []; + _this.parallelsLabels_ = []; + + _this.addEventListener(_EventType.default.POSTRENDER, _this.drawLabels_.bind(_this)); + } + /** + * @type {Array<number>} + * @private + */ + + + _this.intervals_ = options.intervals !== undefined ? options.intervals : INTERVALS; // use a source with a custom loader for lines & text + + _this.setSource(new _Vector2.default({ + loader: _this.loaderFunction.bind(_this), + strategy: _this.strategyFunction.bind(_this), + features: new _Collection.default(), + overlaps: false, + useSpatialIndex: false, + wrapX: options.wrapX + })); + /** + * feature pool to use when updating graticule + * @type {Array<Feature>} + * @private + */ + + + _this.featurePool_ = []; + /** + * @type {Style} + * @private + */ + + _this.lineStyle_ = new _Style.default({ + stroke: _this.strokeStyle_ + }); + /** + * @type {?import("../extent.js").Extent} + * @private + */ + + _this.loadedExtent_ = null; + /** + * @type {?import("../extent.js").Extent} + */ + + _this.renderedExtent_ = null; + + _this.setRenderOrder(null); + + return _this; + } + /** + * Strategy function for loading features based on the view's extent and + * resolution. + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @return {Array<import("../extent.js").Extent>} Extents. + */ + + + Graticule.prototype.strategyFunction = function (extent, resolution) { + // extents may be passed in different worlds, to avoid endless loop we use only one + var realWorldExtent = extent.slice(); + + if (this.projection_ && this.getSource().getWrapX()) { + (0, _extent.wrapX)(realWorldExtent, this.projection_); + } + + if (this.loadedExtent_) { + if ((0, _extent.approximatelyEquals)(this.loadedExtent_, realWorldExtent, resolution)) { + // make sure result is exactly equal to previous extent + realWorldExtent = this.loadedExtent_.slice(); + } else { + // we should not keep track of loaded extents + this.getSource().removeLoadedExtent(this.loadedExtent_); + } + } + + return [realWorldExtent]; + }; + /** + * Update geometries in the source based on current view + * @param {import("../extent").Extent} extent Extent + * @param {number} resolution Resolution + * @param {import("../proj/Projection.js").default} projection Projection + */ + + + Graticule.prototype.loaderFunction = function (extent, resolution, projection) { + this.loadedExtent_ = extent; + var source = this.getSource(); // only consider the intersection between our own extent & the requested one + + var layerExtent = this.getExtent() || [-Infinity, -Infinity, Infinity, Infinity]; + var renderExtent = (0, _extent.getIntersection)(layerExtent, extent); + + if (this.renderedExtent_ && (0, _extent.equals)(this.renderedExtent_, renderExtent)) { + return; + } + + this.renderedExtent_ = renderExtent; // bail out if nothing to render + + if ((0, _extent.isEmpty)(renderExtent)) { + return; + } // update projection info + + + var center = (0, _extent.getCenter)(renderExtent); + var squaredTolerance = resolution * resolution / 4; + var updateProjectionInfo = !this.projection_ || !(0, _proj.equivalent)(this.projection_, projection); + + if (updateProjectionInfo) { + this.updateProjectionInfo_(projection); + } + + this.createGraticule_(renderExtent, center, resolution, squaredTolerance); // first make sure we have enough features in the pool + + var featureCount = this.meridians_.length + this.parallels_.length; + + if (this.meridiansLabels_) { + featureCount += this.meridians_.length; + } + + if (this.parallelsLabels_) { + featureCount += this.parallels_.length; + } + + var feature; + + while (featureCount > this.featurePool_.length) { + feature = new _Feature.default(); + this.featurePool_.push(feature); + } + + var featuresColl = source.getFeaturesCollection(); + featuresColl.clear(); + var poolIndex = 0; // add features for the lines & labels + + var i, l; + + for (i = 0, l = this.meridians_.length; i < l; ++i) { + feature = this.featurePool_[poolIndex++]; + feature.setGeometry(this.meridians_[i]); + feature.setStyle(this.lineStyle_); + featuresColl.push(feature); + } + + for (i = 0, l = this.parallels_.length; i < l; ++i) { + feature = this.featurePool_[poolIndex++]; + feature.setGeometry(this.parallels_[i]); + feature.setStyle(this.lineStyle_); + featuresColl.push(feature); + } + }; + /** + * @param {number} lon Longitude. + * @param {number} minLat Minimal latitude. + * @param {number} maxLat Maximal latitude. + * @param {number} squaredTolerance Squared tolerance. + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} index Index. + * @return {number} Index. + * @private + */ + + + Graticule.prototype.addMeridian_ = function (lon, minLat, maxLat, squaredTolerance, extent, index) { + var lineString = this.getMeridian_(lon, minLat, maxLat, squaredTolerance, index); + + if ((0, _extent.intersects)(lineString.getExtent(), extent)) { + if (this.meridiansLabels_) { + var text = this.lonLabelFormatter_(lon); + + if (index in this.meridiansLabels_) { + this.meridiansLabels_[index].text = text; + } else { + this.meridiansLabels_[index] = { + geom: new _Point.default([]), + text: text + }; + } + } + + this.meridians_[index++] = lineString; + } + + return index; + }; + /** + * @param {number} lat Latitude. + * @param {number} minLon Minimal longitude. + * @param {number} maxLon Maximal longitude. + * @param {number} squaredTolerance Squared tolerance. + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} index Index. + * @return {number} Index. + * @private + */ + + + Graticule.prototype.addParallel_ = function (lat, minLon, maxLon, squaredTolerance, extent, index) { + var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance, index); + + if ((0, _extent.intersects)(lineString.getExtent(), extent)) { + if (this.parallelsLabels_) { + var text = this.latLabelFormatter_(lat); + + if (index in this.parallelsLabels_) { + this.parallelsLabels_[index].text = text; + } else { + this.parallelsLabels_[index] = { + geom: new _Point.default([]), + text: text + }; + } + } + + this.parallels_[index++] = lineString; + } + + return index; + }; + /** + * @param {import("../render/Event.js").default} event Render event. + * @private + */ + + + Graticule.prototype.drawLabels_ = function (event) { + var rotation = event.frameState.viewState.rotation; + var extent = event.frameState.extent; + var rotationCenter = (0, _extent.getCenter)(extent); + var rotationExtent = extent; + + if (rotation) { + var width = (0, _extent.getWidth)(extent); + var height = (0, _extent.getHeight)(extent); + var cr = Math.abs(Math.cos(rotation)); + var sr = Math.abs(Math.sin(rotation)); + var unrotatedWidth = (sr * height - cr * width) / (sr * sr - cr * cr); + var unrotatedHeight = (sr * width - cr * height) / (sr * sr - cr * cr); + rotationExtent = [rotationCenter[0] - unrotatedWidth / 2, rotationCenter[1] - unrotatedHeight / 2, rotationCenter[0] + unrotatedWidth / 2, rotationCenter[1] + unrotatedHeight / 2]; + } + + var startWorld = 0; + var endWorld = 0; + var labelsAtStart = this.latLabelPosition_ < 0.5; + var projectionExtent = this.projection_.getExtent(); + var worldWidth = (0, _extent.getWidth)(projectionExtent); + + if (this.getSource().getWrapX() && this.projection_.canWrapX() && !(0, _extent.containsExtent)(projectionExtent, extent)) { + startWorld = Math.floor((extent[0] - projectionExtent[0]) / worldWidth); + endWorld = Math.ceil((extent[2] - projectionExtent[2]) / worldWidth); + var inverted = Math.abs(rotation) > Math.PI / 2; + labelsAtStart = labelsAtStart !== inverted; + } + + var vectorContext = (0, _render.getVectorContext)(event); + + for (var world = startWorld; world <= endWorld; ++world) { + var poolIndex = this.meridians_.length + this.parallels_.length; + var feature = void 0, + index = void 0, + l = void 0, + textPoint = void 0; + + if (this.meridiansLabels_) { + for (index = 0, l = this.meridiansLabels_.length; index < l; ++index) { + var lineString = this.meridians_[index]; + + if (!rotation && world === 0) { + textPoint = this.getMeridianPoint_(lineString, extent, index); + } else { + var clone = lineString.clone(); + clone.translate(world * worldWidth, 0); + clone.rotate(-rotation, rotationCenter); + textPoint = this.getMeridianPoint_(clone, rotationExtent, index); + textPoint.rotate(rotation, rotationCenter); + } + + feature = this.featurePool_[poolIndex++]; + feature.setGeometry(textPoint); + feature.set('graticule_label', this.meridiansLabels_[index].text); + vectorContext.drawFeature(feature, this.lonLabelStyle_(feature)); + } + } + + if (this.parallelsLabels_) { + if (world === startWorld && labelsAtStart || world === endWorld && !labelsAtStart) { + for (index = 0, l = this.parallels_.length; index < l; ++index) { + var lineString = this.parallels_[index]; + + if (!rotation && world === 0) { + textPoint = this.getParallelPoint_(lineString, extent, index); + } else { + var clone = lineString.clone(); + clone.translate(world * worldWidth, 0); + clone.rotate(-rotation, rotationCenter); + textPoint = this.getParallelPoint_(clone, rotationExtent, index); + textPoint.rotate(rotation, rotationCenter); + } + + feature = this.featurePool_[poolIndex++]; + feature.setGeometry(textPoint); + feature.set('graticule_label', this.parallelsLabels_[index].text); + vectorContext.drawFeature(feature, this.latLabelStyle_(feature)); + } + } + } + } + }; + /** + * @param {import("../extent.js").Extent} extent Extent. + * @param {import("../coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} squaredTolerance Squared tolerance. + * @private + */ + + + Graticule.prototype.createGraticule_ = function (extent, center, resolution, squaredTolerance) { + var interval = this.getInterval_(resolution); + + if (interval == -1) { + this.meridians_.length = 0; + this.parallels_.length = 0; + + if (this.meridiansLabels_) { + this.meridiansLabels_.length = 0; + } + + if (this.parallelsLabels_) { + this.parallelsLabels_.length = 0; + } + + return; + } + + var wrapX = false; + var projectionExtent = this.projection_.getExtent(); + var worldWidth = (0, _extent.getWidth)(projectionExtent); + + if (this.getSource().getWrapX() && this.projection_.canWrapX() && !(0, _extent.containsExtent)(projectionExtent, extent)) { + if ((0, _extent.getWidth)(extent) >= worldWidth) { + extent[0] = projectionExtent[0]; + extent[2] = projectionExtent[2]; + } else { + wrapX = true; + } + } // Constrain the center to fit into the extent available to the graticule + + + var validCenterP = [(0, _math.clamp)(center[0], this.minX_, this.maxX_), (0, _math.clamp)(center[1], this.minY_, this.maxY_)]; // Transform the center to lon lat + // Some projections may have a void area at the poles + // so replace any NaN latitudes with the min or max value closest to a pole + + var centerLonLat = this.toLonLatTransform_(validCenterP); + + if (isNaN(centerLonLat[1])) { + centerLonLat[1] = Math.abs(this.maxLat_) >= Math.abs(this.minLat_) ? this.maxLat_ : this.minLat_; + } + + var centerLon = (0, _math.clamp)(centerLonLat[0], this.minLon_, this.maxLon_); + var centerLat = (0, _math.clamp)(centerLonLat[1], this.minLat_, this.maxLat_); + var maxLines = this.maxLines_; + var cnt, idx, lat, lon; // Limit the extent to fit into the extent available to the graticule + + var validExtentP = extent; + + if (!wrapX) { + validExtentP = [(0, _math.clamp)(extent[0], this.minX_, this.maxX_), (0, _math.clamp)(extent[1], this.minY_, this.maxY_), (0, _math.clamp)(extent[2], this.minX_, this.maxX_), (0, _math.clamp)(extent[3], this.minY_, this.maxY_)]; + } // Transform the extent to get the lon lat ranges for the edges of the extent + + + var validExtent = (0, _extent.applyTransform)(validExtentP, this.toLonLatTransform_, undefined, 8); + var maxLat = validExtent[3]; + var maxLon = validExtent[2]; + var minLat = validExtent[1]; + var minLon = validExtent[0]; + + if (!wrapX) { + // Check if extremities of the world extent lie inside the extent + // (for example the pole in a polar projection) + // and extend the extent as appropriate + if ((0, _extent.containsCoordinate)(validExtentP, this.bottomLeft_)) { + minLon = this.minLon_; + minLat = this.minLat_; + } + + if ((0, _extent.containsCoordinate)(validExtentP, this.bottomRight_)) { + maxLon = this.maxLon_; + minLat = this.minLat_; + } + + if ((0, _extent.containsCoordinate)(validExtentP, this.topLeft_)) { + minLon = this.minLon_; + maxLat = this.maxLat_; + } + + if ((0, _extent.containsCoordinate)(validExtentP, this.topRight_)) { + maxLon = this.maxLon_; + maxLat = this.maxLat_; + } // The transformed center may also extend the lon lat ranges used for rendering + + + maxLat = (0, _math.clamp)(maxLat, centerLat, this.maxLat_); + maxLon = (0, _math.clamp)(maxLon, centerLon, this.maxLon_); + minLat = (0, _math.clamp)(minLat, this.minLat_, centerLat); + minLon = (0, _math.clamp)(minLon, this.minLon_, centerLon); + } // Create meridians + + + centerLon = Math.floor(centerLon / interval) * interval; + lon = (0, _math.clamp)(centerLon, this.minLon_, this.maxLon_); + idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, 0); + cnt = 0; + + if (wrapX) { + while ((lon -= interval) >= minLon && cnt++ < maxLines) { + idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx); + } + } else { + while (lon != this.minLon_ && cnt++ < maxLines) { + lon = Math.max(lon - interval, this.minLon_); + idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx); + } + } + + lon = (0, _math.clamp)(centerLon, this.minLon_, this.maxLon_); + cnt = 0; + + if (wrapX) { + while ((lon += interval) <= maxLon && cnt++ < maxLines) { + idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx); + } + } else { + while (lon != this.maxLon_ && cnt++ < maxLines) { + lon = Math.min(lon + interval, this.maxLon_); + idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx); + } + } + + this.meridians_.length = idx; + + if (this.meridiansLabels_) { + this.meridiansLabels_.length = idx; + } // Create parallels + + + centerLat = Math.floor(centerLat / interval) * interval; + lat = (0, _math.clamp)(centerLat, this.minLat_, this.maxLat_); + idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, 0); + cnt = 0; + + while (lat != this.minLat_ && cnt++ < maxLines) { + lat = Math.max(lat - interval, this.minLat_); + idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx); + } + + lat = (0, _math.clamp)(centerLat, this.minLat_, this.maxLat_); + cnt = 0; + + while (lat != this.maxLat_ && cnt++ < maxLines) { + lat = Math.min(lat + interval, this.maxLat_); + idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx); + } + + this.parallels_.length = idx; + + if (this.parallelsLabels_) { + this.parallelsLabels_.length = idx; + } + }; + /** + * @param {number} resolution Resolution. + * @return {number} The interval in degrees. + * @private + */ + + + Graticule.prototype.getInterval_ = function (resolution) { + var centerLon = this.projectionCenterLonLat_[0]; + var centerLat = this.projectionCenterLonLat_[1]; + var interval = -1; + var target = Math.pow(this.targetSize_ * resolution, 2); + /** @type {Array<number>} **/ + + var p1 = []; + /** @type {Array<number>} **/ + + var p2 = []; + + for (var i = 0, ii = this.intervals_.length; i < ii; ++i) { + var delta = (0, _math.clamp)(this.intervals_[i] / 2, 0, 90); // Don't attempt to transform latitudes beyond the poles! + + var clampedLat = (0, _math.clamp)(centerLat, -90 + delta, 90 - delta); + p1[0] = centerLon - delta; + p1[1] = clampedLat - delta; + p2[0] = centerLon + delta; + p2[1] = clampedLat + delta; + this.fromLonLatTransform_(p1, p1); + this.fromLonLatTransform_(p2, p2); + var dist = Math.pow(p2[0] - p1[0], 2) + Math.pow(p2[1] - p1[1], 2); + + if (dist <= target) { + break; + } + + interval = this.intervals_[i]; + } + + return interval; + }; + /** + * @param {number} lon Longitude. + * @param {number} minLat Minimal latitude. + * @param {number} maxLat Maximal latitude. + * @param {number} squaredTolerance Squared tolerance. + * @return {LineString} The meridian line string. + * @param {number} index Index. + * @private + */ + + + Graticule.prototype.getMeridian_ = function (lon, minLat, maxLat, squaredTolerance, index) { + var flatCoordinates = (0, _geodesic.meridian)(lon, minLat, maxLat, this.projection_, squaredTolerance); + var lineString = this.meridians_[index]; + + if (!lineString) { + lineString = new _LineString.default(flatCoordinates, _GeometryLayout.default.XY); + this.meridians_[index] = lineString; + } else { + lineString.setFlatCoordinates(_GeometryLayout.default.XY, flatCoordinates); + lineString.changed(); + } + + return lineString; + }; + /** + * @param {LineString} lineString Meridian + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} index Index. + * @return {Point} Meridian point. + * @private + */ + + + Graticule.prototype.getMeridianPoint_ = function (lineString, extent, index) { + var flatCoordinates = lineString.getFlatCoordinates(); + var bottom = 1; + var top = flatCoordinates.length - 1; + + if (flatCoordinates[bottom] > flatCoordinates[top]) { + bottom = top; + top = 1; + } + + var clampedBottom = Math.max(extent[1], flatCoordinates[bottom]); + var clampedTop = Math.min(extent[3], flatCoordinates[top]); + var lat = (0, _math.clamp)(extent[1] + Math.abs(extent[1] - extent[3]) * this.lonLabelPosition_, clampedBottom, clampedTop); + var coordinate0 = flatCoordinates[bottom - 1] + (flatCoordinates[top - 1] - flatCoordinates[bottom - 1]) * (lat - flatCoordinates[bottom]) / (flatCoordinates[top] - flatCoordinates[bottom]); + var coordinate = [coordinate0, lat]; + var point = this.meridiansLabels_[index].geom; + point.setCoordinates(coordinate); + return point; + }; + /** + * Get the list of meridians. Meridians are lines of equal longitude. + * @return {Array<LineString>} The meridians. + * @api + */ + + + Graticule.prototype.getMeridians = function () { + return this.meridians_; + }; + /** + * @param {number} lat Latitude. + * @param {number} minLon Minimal longitude. + * @param {number} maxLon Maximal longitude. + * @param {number} squaredTolerance Squared tolerance. + * @return {LineString} The parallel line string. + * @param {number} index Index. + * @private + */ + + + Graticule.prototype.getParallel_ = function (lat, minLon, maxLon, squaredTolerance, index) { + var flatCoordinates = (0, _geodesic.parallel)(lat, minLon, maxLon, this.projection_, squaredTolerance); + var lineString = this.parallels_[index]; + + if (!lineString) { + lineString = new _LineString.default(flatCoordinates, _GeometryLayout.default.XY); + } else { + lineString.setFlatCoordinates(_GeometryLayout.default.XY, flatCoordinates); + lineString.changed(); + } + + return lineString; + }; + /** + * @param {LineString} lineString Parallels. + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} index Index. + * @return {Point} Parallel point. + * @private + */ + + + Graticule.prototype.getParallelPoint_ = function (lineString, extent, index) { + var flatCoordinates = lineString.getFlatCoordinates(); + var left = 0; + var right = flatCoordinates.length - 2; + + if (flatCoordinates[left] > flatCoordinates[right]) { + left = right; + right = 0; + } + + var clampedLeft = Math.max(extent[0], flatCoordinates[left]); + var clampedRight = Math.min(extent[2], flatCoordinates[right]); + var lon = (0, _math.clamp)(extent[0] + Math.abs(extent[0] - extent[2]) * this.latLabelPosition_, clampedLeft, clampedRight); + var coordinate1 = flatCoordinates[left + 1] + (flatCoordinates[right + 1] - flatCoordinates[left + 1]) * (lon - flatCoordinates[left]) / (flatCoordinates[right] - flatCoordinates[left]); + var coordinate = [lon, coordinate1]; + var point = this.parallelsLabels_[index].geom; + point.setCoordinates(coordinate); + return point; + }; + /** + * Get the list of parallels. Parallels are lines of equal latitude. + * @return {Array<LineString>} The parallels. + * @api + */ + + + Graticule.prototype.getParallels = function () { + return this.parallels_; + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @private + */ + + + Graticule.prototype.updateProjectionInfo_ = function (projection) { + var epsg4326Projection = (0, _proj.get)('EPSG:4326'); + var worldExtent = projection.getWorldExtent(); + this.maxLat_ = worldExtent[3]; + this.maxLon_ = worldExtent[2]; + this.minLat_ = worldExtent[1]; + this.minLon_ = worldExtent[0]; // If the world extent crosses the dateline define a custom transform to + // return longitudes which wrap the dateline + + var toLonLatTransform = (0, _proj.getTransform)(projection, epsg4326Projection); + + if (this.minLon_ < this.maxLon_) { + this.toLonLatTransform_ = toLonLatTransform; + } else { + var split_1 = this.minLon_ + this.maxLon_ / 2; + this.maxLon_ += 360; + + this.toLonLatTransform_ = function (coordinates, opt_output, opt_dimension) { + var dimension = opt_dimension || 2; + var lonLatCoordinates = toLonLatTransform(coordinates, opt_output, dimension); + + for (var i = 0, l = lonLatCoordinates.length; i < l; i += dimension) { + if (lonLatCoordinates[i] < split_1) { + lonLatCoordinates[i] += 360; + } + } + + return lonLatCoordinates; + }; + } // Transform the extent to get the limits of the view projection extent + // which should be available to the graticule + + + this.fromLonLatTransform_ = (0, _proj.getTransform)(epsg4326Projection, projection); + var worldExtentP = (0, _extent.applyTransform)([this.minLon_, this.minLat_, this.maxLon_, this.maxLat_], this.fromLonLatTransform_, undefined, 8); + this.minX_ = worldExtentP[0]; + this.maxX_ = worldExtentP[2]; + this.minY_ = worldExtentP[1]; + this.maxY_ = worldExtentP[3]; // Determine the view projection coordinates of the extremities of the world extent + // as these may lie inside a view extent (for example the pole in a polar projection) + + this.bottomLeft_ = this.fromLonLatTransform_([this.minLon_, this.minLat_]); + this.bottomRight_ = this.fromLonLatTransform_([this.maxLon_, this.minLat_]); + this.topLeft_ = this.fromLonLatTransform_([this.minLon_, this.maxLat_]); + this.topRight_ = this.fromLonLatTransform_([this.maxLon_, this.maxLat_]); // Transform the projection center to lon lat + // Some projections may have a void area at the poles + // so replace any NaN latitudes with the min or max value closest to a pole + + this.projectionCenterLonLat_ = this.toLonLatTransform_((0, _extent.getCenter)(projection.getExtent())); + + if (isNaN(this.projectionCenterLonLat_[1])) { + this.projectionCenterLonLat_[1] = Math.abs(this.maxLat_) >= Math.abs(this.minLat_) ? this.maxLat_ : this.minLat_; + } + + this.projection_ = projection; + }; + + return Graticule; +}(_Vector.default); + +var _default = Graticule; +exports.default = _default; +},{"../Collection.js":"../../../node_modules/ol/Collection.js","../render/EventType.js":"../../../node_modules/ol/render/EventType.js","../Feature.js":"../../../node_modules/ol/Feature.js","../style/Fill.js":"../../../node_modules/ol/style/Fill.js","../geom/GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","../geom/LineString.js":"../../../node_modules/ol/geom/LineString.js","../geom/Point.js":"../../../node_modules/ol/geom/Point.js","../style/Stroke.js":"../../../node_modules/ol/style/Stroke.js","../style/Style.js":"../../../node_modules/ol/style/Style.js","../style/Text.js":"../../../node_modules/ol/style/Text.js","./Vector.js":"../../../node_modules/ol/layer/Vector.js","../source/Vector.js":"../../../node_modules/ol/source/Vector.js","../extent.js":"../../../node_modules/ol/extent.js","../obj.js":"../../../node_modules/ol/obj.js","../math.js":"../../../node_modules/ol/math.js","../coordinate.js":"../../../node_modules/ol/coordinate.js","../proj.js":"../../../node_modules/ol/proj.js","../render.js":"../../../node_modules/ol/render.js","../geom/flat/geodesic.js":"../../../node_modules/ol/geom/flat/geodesic.js"}],"../../../node_modules/ol/ImageCanvas.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _ImageBase = _interopRequireDefault(require("./ImageBase.js")); + +var _ImageState = _interopRequireDefault(require("./ImageState.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/ImageCanvas + */ + + +/** + * A function that is called to trigger asynchronous canvas drawing. It is + * called with a "done" callback that should be called when drawing is done. + * If any error occurs during drawing, the "done" callback should be called with + * that error. + * + * @typedef {function(function(Error=): void): void} Loader + */ +var ImageCanvas = +/** @class */ +function (_super) { + __extends(ImageCanvas, _super); + /** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {HTMLCanvasElement} canvas Canvas. + * @param {Loader=} opt_loader Optional loader function to + * support asynchronous canvas drawing. + */ + + + function ImageCanvas(extent, resolution, pixelRatio, canvas, opt_loader) { + var _this = this; + + var state = opt_loader !== undefined ? _ImageState.default.IDLE : _ImageState.default.LOADED; + _this = _super.call(this, extent, resolution, pixelRatio, state) || this; + /** + * Optional canvas loader function. + * @type {?Loader} + * @private + */ + + _this.loader_ = opt_loader !== undefined ? opt_loader : null; + /** + * @private + * @type {HTMLCanvasElement} + */ + + _this.canvas_ = canvas; + /** + * @private + * @type {?Error} + */ + + _this.error_ = null; + return _this; + } + /** + * Get any error associated with asynchronous rendering. + * @return {?Error} Any error that occurred during rendering. + */ + + + ImageCanvas.prototype.getError = function () { + return this.error_; + }; + /** + * Handle async drawing complete. + * @param {Error=} err Any error during drawing. + * @private + */ + + + ImageCanvas.prototype.handleLoad_ = function (err) { + if (err) { + this.error_ = err; + this.state = _ImageState.default.ERROR; + } else { + this.state = _ImageState.default.LOADED; + } + + this.changed(); + }; + /** + * Load not yet loaded URI. + */ + + + ImageCanvas.prototype.load = function () { + if (this.state == _ImageState.default.IDLE) { + this.state = _ImageState.default.LOADING; + this.changed(); + this.loader_(this.handleLoad_.bind(this)); + } + }; + /** + * @return {HTMLCanvasElement} Canvas element. + */ + + + ImageCanvas.prototype.getImage = function () { + return this.canvas_; + }; + + return ImageCanvas; +}(_ImageBase.default); + +var _default = ImageCanvas; +exports.default = _default; +},{"./ImageBase.js":"../../../node_modules/ol/ImageBase.js","./ImageState.js":"../../../node_modules/ol/ImageState.js"}],"../../../node_modules/ol/TileState.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/TileState + */ + +/** + * @enum {number} + */ +var _default = { + IDLE: 0, + LOADING: 1, + LOADED: 2, + + /** + * Indicates that tile loading failed + * @type {number} + */ + ERROR: 3, + EMPTY: 4 +}; +exports.default = _default; +},{}],"../../../node_modules/ol/easing.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.easeIn = easeIn; +exports.easeOut = easeOut; +exports.inAndOut = inAndOut; +exports.linear = linear; +exports.upAndDown = upAndDown; + +/** + * @module ol/easing + */ + +/** + * Start slow and speed up. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ +function easeIn(t) { + return Math.pow(t, 3); +} +/** + * Start fast and slow down. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ + + +function easeOut(t) { + return 1 - easeIn(1 - t); +} +/** + * Start slow, speed up, and then slow down again. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ + + +function inAndOut(t) { + return 3 * t * t - 2 * t * t * t; +} +/** + * Maintain a constant speed over time. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ + + +function linear(t) { + return t; +} +/** + * Start slow, speed up, and at the very end slow down again. This has the + * same general behavior as {@link module:ol/easing~inAndOut}, but the final + * slowdown is delayed. + * @param {number} t Input between 0 and 1. + * @return {number} Output between 0 and 1. + * @api + */ + + +function upAndDown(t) { + if (t < 0.5) { + return inAndOut(2 * t); + } else { + return 1 - inAndOut(2 * (t - 0.5)); + } +} +},{}],"../../../node_modules/ol/Tile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Target = _interopRequireDefault(require("./events/Target.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _TileState = _interopRequireDefault(require("./TileState.js")); + +var _util = require("./util.js"); + +var _easing = require("./easing.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Tile + */ + + +/** + * A function that takes an {@link module:ol/Tile} for the tile and a + * `{string}` for the url as arguments. The default is + * ```js + * source.setTileLoadFunction(function(tile, src) { + * tile.getImage().src = src; + * }); + * ``` + * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve + * error handling: + * + * ```js + * import TileState from 'ol/TileState'; + * + * source.setTileLoadFunction(function(tile, src) { + * var xhr = new XMLHttpRequest(); + * xhr.responseType = 'blob'; + * xhr.addEventListener('loadend', function (evt) { + * var data = this.response; + * if (data !== undefined) { + * tile.getImage().src = URL.createObjectURL(data); + * } else { + * tile.setState(TileState.ERROR); + * } + * }); + * xhr.addEventListener('error', function () { + * tile.setState(TileState.ERROR); + * }); + * xhr.open('GET', src); + * xhr.send(); + * }); + * ``` + * + * @typedef {function(Tile, string): void} LoadFunction + * @api + */ + +/** + * {@link module:ol/source/Tile~Tile} sources use a function of this type to get + * the url that provides a tile for a given tile coordinate. + * + * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile + * coordinate, a `{number}` representing the pixel ratio and a + * {@link module:ol/proj/Projection} for the projection as arguments + * and returns a `{string}` representing the tile URL, or undefined if no tile + * should be requested for the passed tile coordinate. + * + * @typedef {function(import("./tilecoord.js").TileCoord, number, + * import("./proj/Projection.js").default): (string|undefined)} UrlFunction + * @api + */ + +/** + * @typedef {Object} Options + * @property {number} [transition=250] A duration for tile opacity + * transitions in milliseconds. A duration of 0 disables the opacity transition. + * @api + */ + +/** + * @classdesc + * Base class for tiles. + * + * @abstract + */ +var Tile = +/** @class */ +function (_super) { + __extends(Tile, _super); + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./TileState.js").default} state State. + * @param {Options=} opt_options Tile options. + */ + + + function Tile(tileCoord, state, opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options ? opt_options : {}; + /** + * @type {import("./tilecoord.js").TileCoord} + */ + + _this.tileCoord = tileCoord; + /** + * @protected + * @type {import("./TileState.js").default} + */ + + _this.state = state; + /** + * An "interim" tile for this tile. The interim tile may be used while this + * one is loading, for "smooth" transitions when changing params/dimensions + * on the source. + * @type {Tile} + */ + + _this.interimTile = null; + /** + * The tile is available at the highest possible resolution. Subclasses can + * set this to `false` initially. Tile load listeners will not be + * unregistered before this is set to `true` and a `#changed()` is called. + * @type {boolean} + */ + + _this.hifi = true; + /** + * A key assigned to the tile. This is used by the tile source to determine + * if this tile can effectively be used, or if a new tile should be created + * and this one be used as an interim tile for this new tile. + * @type {string} + */ + + _this.key = ''; + /** + * The duration for the opacity transition. + * @type {number} + */ + + _this.transition_ = options.transition === undefined ? 250 : options.transition; + /** + * Lookup of start times for rendering transitions. If the start time is + * equal to -1, the transition is complete. + * @type {Object<string, number>} + */ + + _this.transitionStarts_ = {}; + return _this; + } + /** + * @protected + */ + + + Tile.prototype.changed = function () { + this.dispatchEvent(_EventType.default.CHANGE); + }; + /** + * Called by the tile cache when the tile is removed from the cache due to expiry + */ + + + Tile.prototype.release = function () {}; + /** + * @return {string} Key. + */ + + + Tile.prototype.getKey = function () { + return this.key + '/' + this.tileCoord; + }; + /** + * Get the interim tile most suitable for rendering using the chain of interim + * tiles. This corresponds to the most recent tile that has been loaded, if no + * such tile exists, the original tile is returned. + * @return {!Tile} Best tile for rendering. + */ + + + Tile.prototype.getInterimTile = function () { + if (!this.interimTile) { + //empty chain + return this; + } + + var tile = this.interimTile; // find the first loaded tile and return it. Since the chain is sorted in + // decreasing order of creation time, there is no need to search the remainder + // of the list (all those tiles correspond to older requests and will be + // cleaned up by refreshInterimChain) + + do { + if (tile.getState() == _TileState.default.LOADED) { + // Show tile immediately instead of fading it in after loading, because + // the interim tile is in place already + this.transition_ = 0; + return tile; + } + + tile = tile.interimTile; + } while (tile); // we can not find a better tile + + + return this; + }; + /** + * Goes through the chain of interim tiles and discards sections of the chain + * that are no longer relevant. + */ + + + Tile.prototype.refreshInterimChain = function () { + if (!this.interimTile) { + return; + } + + var tile = this.interimTile; + var prev = + /** @type {Tile} */ + this; + + do { + if (tile.getState() == _TileState.default.LOADED) { + //we have a loaded tile, we can discard the rest of the list + //we would could abort any LOADING tile request + //older than this tile (i.e. any LOADING tile following this entry in the chain) + tile.interimTile = null; + break; + } else if (tile.getState() == _TileState.default.LOADING) { + //keep this LOADING tile any loaded tiles later in the chain are + //older than this tile, so we're still interested in the request + prev = tile; + } else if (tile.getState() == _TileState.default.IDLE) { + //the head of the list is the most current tile, we don't need + //to start any other requests for this chain + prev.interimTile = tile.interimTile; + } else { + prev = tile; + } + + tile = prev.interimTile; + } while (tile); + }; + /** + * Get the tile coordinate for this tile. + * @return {import("./tilecoord.js").TileCoord} The tile coordinate. + * @api + */ + + + Tile.prototype.getTileCoord = function () { + return this.tileCoord; + }; + /** + * @return {import("./TileState.js").default} State. + */ + + + Tile.prototype.getState = function () { + return this.state; + }; + /** + * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} , + * it is important to set the state correctly to {@link module:ol/TileState~ERROR} + * when the tile cannot be loaded. Otherwise the tile cannot be removed from + * the tile queue and will block other requests. + * @param {import("./TileState.js").default} state State. + * @api + */ + + + Tile.prototype.setState = function (state) { + if (this.state !== _TileState.default.ERROR && this.state > state) { + throw new Error('Tile load sequence violation'); + } + + this.state = state; + this.changed(); + }; + /** + * Load the image or retry if loading previously failed. + * Loading is taken care of by the tile queue, and calling this method is + * only needed for preloading or for reloading in case of an error. + * @abstract + * @api + */ + + + Tile.prototype.load = function () { + (0, _util.abstract)(); + }; + /** + * Get the alpha value for rendering. + * @param {string} id An id for the renderer. + * @param {number} time The render frame time. + * @return {number} A number between 0 and 1. + */ + + + Tile.prototype.getAlpha = function (id, time) { + if (!this.transition_) { + return 1; + } + + var start = this.transitionStarts_[id]; + + if (!start) { + start = time; + this.transitionStarts_[id] = start; + } else if (start === -1) { + return 1; + } + + var delta = time - start + 1000 / 60; // avoid rendering at 0 + + if (delta >= this.transition_) { + return 1; + } + + return (0, _easing.easeIn)(delta / this.transition_); + }; + /** + * Determine if a tile is in an alpha transition. A tile is considered in + * transition if tile.getAlpha() has not yet been called or has been called + * and returned 1. + * @param {string} id An id for the renderer. + * @return {boolean} The tile is in transition. + */ + + + Tile.prototype.inTransition = function (id) { + if (!this.transition_) { + return false; + } + + return this.transitionStarts_[id] !== -1; + }; + /** + * Mark a transition as complete. + * @param {string} id An id for the renderer. + */ + + + Tile.prototype.endTransition = function (id) { + if (this.transition_) { + this.transitionStarts_[id] = -1; + } + }; + + return Tile; +}(_Target.default); + +var _default = Tile; +exports.default = _default; +},{"./events/Target.js":"../../../node_modules/ol/events/Target.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./TileState.js":"../../../node_modules/ol/TileState.js","./util.js":"../../../node_modules/ol/util.js","./easing.js":"../../../node_modules/ol/easing.js"}],"../../../node_modules/ol/ImageTile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Tile = _interopRequireDefault(require("./Tile.js")); + +var _TileState = _interopRequireDefault(require("./TileState.js")); + +var _dom = require("./dom.js"); + +var _Image = require("./Image.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/ImageTile + */ + + +var ImageTile = +/** @class */ +function (_super) { + __extends(ImageTile, _super); + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./TileState.js").default} state State. + * @param {string} src Image source URI. + * @param {?string} crossOrigin Cross origin. + * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function. + * @param {import("./Tile.js").Options=} opt_options Tile options. + */ + + + function ImageTile(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { + var _this = _super.call(this, tileCoord, state, opt_options) || this; + /** + * @private + * @type {?string} + */ + + + _this.crossOrigin_ = crossOrigin; + /** + * Image URI + * + * @private + * @type {string} + */ + + _this.src_ = src; + /** + * @private + * @type {HTMLImageElement|HTMLCanvasElement} + */ + + _this.image_ = new Image(); + + if (crossOrigin !== null) { + _this.image_.crossOrigin = crossOrigin; + } + /** + * @private + * @type {?function():void} + */ + + + _this.unlisten_ = null; + /** + * @private + * @type {import("./Tile.js").LoadFunction} + */ + + _this.tileLoadFunction_ = tileLoadFunction; + return _this; + } + /** + * Get the HTML image element for this tile (may be a Canvas, Image, or Video). + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + * @api + */ + + + ImageTile.prototype.getImage = function () { + return this.image_; + }; + /** + * @return {string} Key. + */ + + + ImageTile.prototype.getKey = function () { + return this.src_; + }; + /** + * Tracks loading or read errors. + * + * @private + */ + + + ImageTile.prototype.handleImageError_ = function () { + this.state = _TileState.default.ERROR; + this.unlistenImage_(); + this.image_ = getBlankImage(); + this.changed(); + }; + /** + * Tracks successful image load. + * + * @private + */ + + + ImageTile.prototype.handleImageLoad_ = function () { + var image = + /** @type {HTMLImageElement} */ + this.image_; + + if (image.naturalWidth && image.naturalHeight) { + this.state = _TileState.default.LOADED; + } else { + this.state = _TileState.default.EMPTY; + } + + this.unlistenImage_(); + this.changed(); + }; + /** + * Load not yet loaded URI. + * @api + */ + + + ImageTile.prototype.load = function () { + if (this.state == _TileState.default.ERROR) { + this.state = _TileState.default.IDLE; + this.image_ = new Image(); + + if (this.crossOrigin_ !== null) { + this.image_.crossOrigin = this.crossOrigin_; + } + } + + if (this.state == _TileState.default.IDLE) { + this.state = _TileState.default.LOADING; + this.changed(); + this.tileLoadFunction_(this, this.src_); + this.unlisten_ = (0, _Image.listenImage)(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this)); + } + }; + /** + * Discards event handlers which listen for load completion or errors. + * + * @private + */ + + + ImageTile.prototype.unlistenImage_ = function () { + if (this.unlisten_) { + this.unlisten_(); + this.unlisten_ = null; + } + }; + + return ImageTile; +}(_Tile.default); +/** + * Get a 1-pixel blank image. + * @return {HTMLCanvasElement} Blank image. + */ + + +function getBlankImage() { + var ctx = (0, _dom.createCanvasContext2D)(1, 1); + ctx.fillStyle = 'rgba(0,0,0,0)'; + ctx.fillRect(0, 0, 1, 1); + return ctx.canvas; +} + +var _default = ImageTile; +exports.default = _default; +},{"./Tile.js":"../../../node_modules/ol/Tile.js","./TileState.js":"../../../node_modules/ol/TileState.js","./dom.js":"../../../node_modules/ol/dom.js","./Image.js":"../../../node_modules/ol/Image.js"}],"../../../node_modules/ol/Kinetic.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/Kinetic + */ + +/** + * @classdesc + * Implementation of inertial deceleration for map movement. + * + * @api + */ +var Kinetic = +/** @class */ +function () { + /** + * @param {number} decay Rate of decay (must be negative). + * @param {number} minVelocity Minimum velocity (pixels/millisecond). + * @param {number} delay Delay to consider to calculate the kinetic + * initial values (milliseconds). + */ + function Kinetic(decay, minVelocity, delay) { + /** + * @private + * @type {number} + */ + this.decay_ = decay; + /** + * @private + * @type {number} + */ + + this.minVelocity_ = minVelocity; + /** + * @private + * @type {number} + */ + + this.delay_ = delay; + /** + * @private + * @type {Array<number>} + */ + + this.points_ = []; + /** + * @private + * @type {number} + */ + + this.angle_ = 0; + /** + * @private + * @type {number} + */ + + this.initialVelocity_ = 0; + } + /** + * FIXME empty description for jsdoc + */ + + + Kinetic.prototype.begin = function () { + this.points_.length = 0; + this.angle_ = 0; + this.initialVelocity_ = 0; + }; + /** + * @param {number} x X. + * @param {number} y Y. + */ + + + Kinetic.prototype.update = function (x, y) { + this.points_.push(x, y, Date.now()); + }; + /** + * @return {boolean} Whether we should do kinetic animation. + */ + + + Kinetic.prototype.end = function () { + if (this.points_.length < 6) { + // at least 2 points are required (i.e. there must be at least 6 elements + // in the array) + return false; + } + + var delay = Date.now() - this.delay_; + var lastIndex = this.points_.length - 3; + + if (this.points_[lastIndex + 2] < delay) { + // the last tracked point is too old, which means that the user stopped + // panning before releasing the map + return false; + } // get the first point which still falls into the delay time + + + var firstIndex = lastIndex - 3; + + while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) { + firstIndex -= 3; + } + + var duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2]; // we don't want a duration of 0 (divide by zero) + // we also make sure the user panned for a duration of at least one frame + // (1/60s) to compute sane displacement values + + if (duration < 1000 / 60) { + return false; + } + + var dx = this.points_[lastIndex] - this.points_[firstIndex]; + var dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1]; + this.angle_ = Math.atan2(dy, dx); + this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration; + return this.initialVelocity_ > this.minVelocity_; + }; + /** + * @return {number} Total distance travelled (pixels). + */ + + + Kinetic.prototype.getDistance = function () { + return (this.minVelocity_ - this.initialVelocity_) / this.decay_; + }; + /** + * @return {number} Angle of the kinetic panning animation (radians). + */ + + + Kinetic.prototype.getAngle = function () { + return this.angle_; + }; + + return Kinetic; +}(); + +var _default = Kinetic; +exports.default = _default; +},{}],"../../../node_modules/ol/renderer/Map.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Disposable = _interopRequireDefault(require("../Disposable.js")); + +var _functions = require("../functions.js"); + +var _util = require("../util.js"); + +var _transform = require("../transform.js"); + +var _extent = require("../extent.js"); + +var _IconImageCache = require("../style/IconImageCache.js"); + +var _Layer = require("../layer/Layer.js"); + +var _render = require("../render.js"); + +var _coordinate = require("../coordinate.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/renderer/Map + */ + + +/** + * @abstract + */ +var MapRenderer = +/** @class */ +function (_super) { + __extends(MapRenderer, _super); + /** + * @param {import("../PluggableMap.js").default} map Map. + */ + + + function MapRenderer(map) { + var _this = _super.call(this) || this; + /** + * @private + * @type {import("../PluggableMap.js").default} + */ + + + _this.map_ = map; + /** + * @private + */ + + _this.declutterTree_ = null; + return _this; + } + /** + * @abstract + * @param {import("../render/EventType.js").default} type Event type. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + */ + + + MapRenderer.prototype.dispatchRenderEvent = function (type, frameState) { + (0, _util.abstract)(); + }; + /** + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @protected + */ + + + MapRenderer.prototype.calculateMatrices2D = function (frameState) { + var viewState = frameState.viewState; + var coordinateToPixelTransform = frameState.coordinateToPixelTransform; + var pixelToCoordinateTransform = frameState.pixelToCoordinateTransform; + (0, _transform.compose)(coordinateToPixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / viewState.resolution, -1 / viewState.resolution, -viewState.rotation, -viewState.center[0], -viewState.center[1]); + (0, _transform.makeInverse)(pixelToCoordinateTransform, coordinateToPixelTransform); + }; + /** + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {boolean} checkWrapped Check for wrapped geometries. + * @param {function(this: S, import("../Feature.js").FeatureLike, + * import("../layer/Layer.js").default): T} callback Feature callback. + * @param {S} thisArg Value to use as `this` when executing `callback`. + * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter + * function, only layers which are visible and for which this function + * returns `true` will be tested for features. By default, all visible + * layers will be tested. + * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`. + * @return {T|undefined} Callback result. + * @template S,T,U + */ + + + MapRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, checkWrapped, callback, thisArg, layerFilter, thisArg2) { + var result; + var viewState = frameState.viewState; + /** + * @param {boolean} managed Managed layer. + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {import("../layer/Layer.js").default} layer Layer. + * @return {?} Callback result. + */ + + function forEachFeatureAtCoordinate(managed, feature, layer) { + return callback.call(thisArg, feature, managed ? layer : null); + } + + var projection = viewState.projection; + var translatedCoordinate = (0, _coordinate.wrapX)(coordinate.slice(), projection); + var offsets = [[0, 0]]; + + if (projection.canWrapX() && checkWrapped) { + var projectionExtent = projection.getExtent(); + var worldWidth = (0, _extent.getWidth)(projectionExtent); + offsets.push([-worldWidth, 0], [worldWidth, 0]); + } + + var layerStates = frameState.layerStatesArray; + var numLayers = layerStates.length; + var declutteredFeatures; + + if (this.declutterTree_) { + declutteredFeatures = this.declutterTree_.all().map(function (entry) { + return entry.value; + }); + } + + var tmpCoord = []; + + for (var i = 0; i < offsets.length; i++) { + for (var j = numLayers - 1; j >= 0; --j) { + var layerState = layerStates[j]; + var layer = + /** @type {import("../layer/Layer.js").default} */ + layerState.layer; + + if (layer.hasRenderer() && (0, _Layer.inView)(layerState, viewState) && layerFilter.call(thisArg2, layer)) { + var layerRenderer = layer.getRenderer(); + var source = layer.getSource(); + + if (layerRenderer && source) { + var coordinates = source.getWrapX() ? translatedCoordinate : coordinate; + var callback_1 = forEachFeatureAtCoordinate.bind(null, layerState.managed); + tmpCoord[0] = coordinates[0] + offsets[i][0]; + tmpCoord[1] = coordinates[1] + offsets[i][1]; + result = layerRenderer.forEachFeatureAtCoordinate(tmpCoord, frameState, hitTolerance, callback_1, declutteredFeatures); + } + + if (result) { + return result; + } + } + } + } + + return undefined; + }; + /** + * @abstract + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer + * callback. + * @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter + * function, only layers which are visible and for which this function + * returns `true` will be tested for features. By default, all visible + * layers will be tested. + * @return {T|undefined} Callback result. + * @template T + */ + + + MapRenderer.prototype.forEachLayerAtPixel = function (pixel, frameState, hitTolerance, callback, layerFilter) { + return (0, _util.abstract)(); + }; + /** + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {boolean} checkWrapped Check for wrapped geometries. + * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter + * function, only layers which are visible and for which this function + * returns `true` will be tested for features. By default, all visible + * layers will be tested. + * @param {U} thisArg Value to use as `this` when executing `layerFilter`. + * @return {boolean} Is there a feature at the given coordinate? + * @template U + */ + + + MapRenderer.prototype.hasFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, checkWrapped, layerFilter, thisArg) { + var hasFeature = this.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, checkWrapped, _functions.TRUE, this, layerFilter, thisArg); + return hasFeature !== undefined; + }; + /** + * @return {import("../PluggableMap.js").default} Map. + */ + + + MapRenderer.prototype.getMap = function () { + return this.map_; + }; + /** + * Render. + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. + */ + + + MapRenderer.prototype.renderFrame = function (frameState) { + this.declutterTree_ = (0, _render.renderDeclutterItems)(frameState, this.declutterTree_); + }; + /** + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @protected + */ + + + MapRenderer.prototype.scheduleExpireIconCache = function (frameState) { + if (_IconImageCache.shared.canExpireCache()) { + frameState.postRenderFunctions.push(expireIconCache); + } + }; + + return MapRenderer; +}(_Disposable.default); +/** + * @param {import("../PluggableMap.js").default} map Map. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + */ + + +function expireIconCache(map, frameState) { + _IconImageCache.shared.expire(); +} + +var _default = MapRenderer; +exports.default = _default; +},{"../Disposable.js":"../../../node_modules/ol/Disposable.js","../functions.js":"../../../node_modules/ol/functions.js","../util.js":"../../../node_modules/ol/util.js","../transform.js":"../../../node_modules/ol/transform.js","../extent.js":"../../../node_modules/ol/extent.js","../style/IconImageCache.js":"../../../node_modules/ol/style/IconImageCache.js","../layer/Layer.js":"../../../node_modules/ol/layer/Layer.js","../render.js":"../../../node_modules/ol/render.js","../coordinate.js":"../../../node_modules/ol/coordinate.js"}],"../../../node_modules/ol/renderer/Composite.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Map = _interopRequireDefault(require("./Map.js")); + +var _ObjectEventType = _interopRequireDefault(require("../ObjectEventType.js")); + +var _Event = _interopRequireDefault(require("../render/Event.js")); + +var _EventType = _interopRequireDefault(require("../render/EventType.js")); + +var _State = _interopRequireDefault(require("../source/State.js")); + +var _css = require("../css.js"); + +var _canvas = require("../render/canvas.js"); + +var _Layer = require("../layer/Layer.js"); + +var _events = require("../events.js"); + +var _dom = require("../dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/renderer/Composite + */ + + +/** + * @classdesc + * Canvas map renderer. + * @api + */ +var CompositeMapRenderer = +/** @class */ +function (_super) { + __extends(CompositeMapRenderer, _super); + /** + * @param {import("../PluggableMap.js").default} map Map. + */ + + + function CompositeMapRenderer(map) { + var _this = _super.call(this, map) || this; + /** + * @type {import("../events.js").EventsKey} + */ + + + _this.fontChangeListenerKey_ = (0, _events.listen)(_canvas.checkedFonts, _ObjectEventType.default.PROPERTYCHANGE, map.redrawText.bind(map)); + /** + * @private + * @type {HTMLDivElement} + */ + + _this.element_ = document.createElement('div'); + var style = _this.element_.style; + style.position = 'absolute'; + style.width = '100%'; + style.height = '100%'; + style.zIndex = '0'; + _this.element_.className = _css.CLASS_UNSELECTABLE + ' ol-layers'; + var container = map.getViewport(); + container.insertBefore(_this.element_, container.firstChild || null); + /** + * @private + * @type {Array<HTMLElement>} + */ + + _this.children_ = []; + /** + * @private + * @type {boolean} + */ + + _this.renderedVisible_ = true; + return _this; + } + /** + * @param {import("../render/EventType.js").default} type Event type. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + */ + + + CompositeMapRenderer.prototype.dispatchRenderEvent = function (type, frameState) { + var map = this.getMap(); + + if (map.hasListener(type)) { + var event_1 = new _Event.default(type, undefined, frameState); + map.dispatchEvent(event_1); + } + }; + + CompositeMapRenderer.prototype.disposeInternal = function () { + (0, _events.unlistenByKey)(this.fontChangeListenerKey_); + this.element_.parentNode.removeChild(this.element_); + + _super.prototype.disposeInternal.call(this); + }; + /** + * Render. + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. + */ + + + CompositeMapRenderer.prototype.renderFrame = function (frameState) { + if (!frameState) { + if (this.renderedVisible_) { + this.element_.style.display = 'none'; + this.renderedVisible_ = false; + } + + return; + } + + this.calculateMatrices2D(frameState); + this.dispatchRenderEvent(_EventType.default.PRECOMPOSE, frameState); + var layerStatesArray = frameState.layerStatesArray.sort(function (a, b) { + return a.zIndex - b.zIndex; + }); + var viewState = frameState.viewState; + this.children_.length = 0; + var previousElement = null; + + for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { + var layerState = layerStatesArray[i]; + frameState.layerIndex = i; + + if (!(0, _Layer.inView)(layerState, viewState) || layerState.sourceState != _State.default.READY && layerState.sourceState != _State.default.UNDEFINED) { + continue; + } + + var layer = layerState.layer; + var element = layer.render(frameState, previousElement); + + if (!element) { + continue; + } + + if (element !== previousElement) { + this.children_.push(element); + previousElement = element; + } + } + + _super.prototype.renderFrame.call(this, frameState); + + (0, _dom.replaceChildren)(this.element_, this.children_); + this.dispatchRenderEvent(_EventType.default.POSTCOMPOSE, frameState); + + if (!this.renderedVisible_) { + this.element_.style.display = ''; + this.renderedVisible_ = true; + } + + this.scheduleExpireIconCache(frameState); + }; + /** + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer + * callback. + * @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter + * function, only layers which are visible and for which this function + * returns `true` will be tested for features. By default, all visible + * layers will be tested. + * @return {T|undefined} Callback result. + * @template T + */ + + + CompositeMapRenderer.prototype.forEachLayerAtPixel = function (pixel, frameState, hitTolerance, callback, layerFilter) { + var viewState = frameState.viewState; + var layerStates = frameState.layerStatesArray; + var numLayers = layerStates.length; + + for (var i = numLayers - 1; i >= 0; --i) { + var layerState = layerStates[i]; + var layer = layerState.layer; + + if (layer.hasRenderer() && (0, _Layer.inView)(layerState, viewState) && layerFilter(layer)) { + var layerRenderer = layer.getRenderer(); + var data = layerRenderer.getDataAtPixel(pixel, frameState, hitTolerance); + + if (data) { + var result = callback(layer, data); + + if (result) { + return result; + } + } + } + } + + return undefined; + }; + + return CompositeMapRenderer; +}(_Map.default); + +var _default = CompositeMapRenderer; +exports.default = _default; +},{"./Map.js":"../../../node_modules/ol/renderer/Map.js","../ObjectEventType.js":"../../../node_modules/ol/ObjectEventType.js","../render/Event.js":"../../../node_modules/ol/render/Event.js","../render/EventType.js":"../../../node_modules/ol/render/EventType.js","../source/State.js":"../../../node_modules/ol/source/State.js","../css.js":"../../../node_modules/ol/css.js","../render/canvas.js":"../../../node_modules/ol/render/canvas.js","../layer/Layer.js":"../../../node_modules/ol/layer/Layer.js","../events.js":"../../../node_modules/ol/events.js","../dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/layer/Group.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Base = _interopRequireDefault(require("./Base.js")); + +var _Collection = _interopRequireDefault(require("../Collection.js")); + +var _CollectionEventType = _interopRequireDefault(require("../CollectionEventType.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _ObjectEventType = _interopRequireDefault(require("../ObjectEventType.js")); + +var _State = _interopRequireDefault(require("../source/State.js")); + +var _asserts = require("../asserts.js"); + +var _obj = require("../obj.js"); + +var _Object = require("../Object.js"); + +var _extent = require("../extent.js"); + +var _util = require("../util.js"); + +var _events = require("../events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/Group + */ + + +/** + * @typedef {Object} Options + * @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 {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 {Array<import("./Base.js").default>|import("../Collection.js").default<import("./Base.js").default>} [layers] Child layers. + */ + +/** + * @enum {string} + * @private + */ +var Property = { + LAYERS: 'layers' +}; +/** + * @classdesc + * A {@link module:ol/Collection~Collection} of layers that are handled together. + * + * A generic `change` event is triggered when the group/Collection changes. + * + * @api + */ + +var LayerGroup = +/** @class */ +function (_super) { + __extends(LayerGroup, _super); + /** + * @param {Options=} opt_options Layer options. + */ + + + function LayerGroup(opt_options) { + var _this = this; + + var options = opt_options || {}; + var baseOptions = + /** @type {Options} */ + (0, _obj.assign)({}, options); + delete baseOptions.layers; + var layers = options.layers; + _this = _super.call(this, baseOptions) || this; + /** + * @private + * @type {Array<import("../events.js").EventsKey>} + */ + + _this.layersListenerKeys_ = []; + /** + * @private + * @type {Object<string, Array<import("../events.js").EventsKey>>} + */ + + _this.listenerKeys_ = {}; + + _this.addEventListener((0, _Object.getChangeEventType)(Property.LAYERS), _this.handleLayersChanged_); + + if (layers) { + if (Array.isArray(layers)) { + layers = new _Collection.default(layers.slice(), { + unique: true + }); + } else { + (0, _asserts.assert)(typeof + /** @type {?} */ + layers.getArray === 'function', 43); // Expected `layers` to be an array or a `Collection` + } + } else { + layers = new _Collection.default(undefined, { + unique: true + }); + } + + _this.setLayers(layers); + + return _this; + } + /** + * @private + */ + + + LayerGroup.prototype.handleLayerChange_ = function () { + this.changed(); + }; + /** + * @private + */ + + + LayerGroup.prototype.handleLayersChanged_ = function () { + this.layersListenerKeys_.forEach(_events.unlistenByKey); + this.layersListenerKeys_.length = 0; + var layers = this.getLayers(); + this.layersListenerKeys_.push((0, _events.listen)(layers, _CollectionEventType.default.ADD, this.handleLayersAdd_, this), (0, _events.listen)(layers, _CollectionEventType.default.REMOVE, this.handleLayersRemove_, this)); + + for (var id in this.listenerKeys_) { + this.listenerKeys_[id].forEach(_events.unlistenByKey); + } + + (0, _obj.clear)(this.listenerKeys_); + var layersArray = layers.getArray(); + + for (var i = 0, ii = layersArray.length; i < ii; i++) { + var layer = layersArray[i]; + this.listenerKeys_[(0, _util.getUid)(layer)] = [(0, _events.listen)(layer, _ObjectEventType.default.PROPERTYCHANGE, this.handleLayerChange_, this), (0, _events.listen)(layer, _EventType.default.CHANGE, this.handleLayerChange_, this)]; + } + + this.changed(); + }; + /** + * @param {import("../Collection.js").CollectionEvent} collectionEvent CollectionEvent. + * @private + */ + + + LayerGroup.prototype.handleLayersAdd_ = function (collectionEvent) { + var layer = + /** @type {import("./Base.js").default} */ + collectionEvent.element; + this.listenerKeys_[(0, _util.getUid)(layer)] = [(0, _events.listen)(layer, _ObjectEventType.default.PROPERTYCHANGE, this.handleLayerChange_, this), (0, _events.listen)(layer, _EventType.default.CHANGE, this.handleLayerChange_, this)]; + this.changed(); + }; + /** + * @param {import("../Collection.js").CollectionEvent} collectionEvent CollectionEvent. + * @private + */ + + + LayerGroup.prototype.handleLayersRemove_ = function (collectionEvent) { + var layer = + /** @type {import("./Base.js").default} */ + collectionEvent.element; + var key = (0, _util.getUid)(layer); + this.listenerKeys_[key].forEach(_events.unlistenByKey); + delete this.listenerKeys_[key]; + this.changed(); + }; + /** + * Returns the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers} + * in this group. + * @return {!import("../Collection.js").default<import("./Base.js").default>} Collection of + * {@link module:ol/layer/Base layers} that are part of this group. + * @observable + * @api + */ + + + LayerGroup.prototype.getLayers = function () { + return ( + /** @type {!import("../Collection.js").default<import("./Base.js").default>} */ + this.get(Property.LAYERS) + ); + }; + /** + * Set the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers} + * in this group. + * @param {!import("../Collection.js").default<import("./Base.js").default>} layers Collection of + * {@link module:ol/layer/Base layers} that are part of this group. + * @observable + * @api + */ + + + LayerGroup.prototype.setLayers = function (layers) { + this.set(Property.LAYERS, layers); + }; + /** + * @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be modified in place). + * @return {Array<import("./Layer.js").default>} Array of layers. + */ + + + LayerGroup.prototype.getLayersArray = function (opt_array) { + var array = opt_array !== undefined ? opt_array : []; + this.getLayers().forEach(function (layer) { + layer.getLayersArray(array); + }); + return array; + }; + /** + * @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer states (to be modified in place). + * @return {Array<import("./Layer.js").State>} List of layer states. + */ + + + LayerGroup.prototype.getLayerStatesArray = function (opt_states) { + var states = opt_states !== undefined ? opt_states : []; + var pos = states.length; + this.getLayers().forEach(function (layer) { + layer.getLayerStatesArray(states); + }); + var ownLayerState = this.getLayerState(); + + for (var i = pos, ii = states.length; i < ii; i++) { + var layerState = states[i]; + layerState.opacity *= ownLayerState.opacity; + layerState.visible = layerState.visible && ownLayerState.visible; + layerState.maxResolution = Math.min(layerState.maxResolution, ownLayerState.maxResolution); + layerState.minResolution = Math.max(layerState.minResolution, ownLayerState.minResolution); + layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom); + layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom); + + if (ownLayerState.extent !== undefined) { + if (layerState.extent !== undefined) { + layerState.extent = (0, _extent.getIntersection)(layerState.extent, ownLayerState.extent); + } else { + layerState.extent = ownLayerState.extent; + } + } + } + + return states; + }; + /** + * @return {import("../source/State.js").default} Source state. + */ + + + LayerGroup.prototype.getSourceState = function () { + return _State.default.READY; + }; + + return LayerGroup; +}(_Base.default); + +var _default = LayerGroup; +exports.default = _default; +},{"./Base.js":"../../../node_modules/ol/layer/Base.js","../Collection.js":"../../../node_modules/ol/Collection.js","../CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../ObjectEventType.js":"../../../node_modules/ol/ObjectEventType.js","../source/State.js":"../../../node_modules/ol/source/State.js","../asserts.js":"../../../node_modules/ol/asserts.js","../obj.js":"../../../node_modules/ol/obj.js","../Object.js":"../../../node_modules/ol/Object.js","../extent.js":"../../../node_modules/ol/extent.js","../util.js":"../../../node_modules/ol/util.js","../events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/MapEvent.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Event = _interopRequireDefault(require("./events/Event.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/MapEvent + */ + + +/** + * @classdesc + * Events emitted as map events are instances of this type. + * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event. + */ +var MapEvent = +/** @class */ +function (_super) { + __extends(MapEvent, _super); + /** + * @param {string} type Event type. + * @param {import("./PluggableMap.js").default} map Map. + * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state. + */ + + + function MapEvent(type, map, opt_frameState) { + var _this = _super.call(this, type) || this; + /** + * The map where the event occurred. + * @type {import("./PluggableMap.js").default} + * @api + */ + + + _this.map = map; + /** + * The frame state at the time of the event. + * @type {?import("./PluggableMap.js").FrameState} + * @api + */ + + _this.frameState = opt_frameState !== undefined ? opt_frameState : null; + return _this; + } + + return MapEvent; +}(_Event.default); + +var _default = MapEvent; +exports.default = _default; +},{"./events/Event.js":"../../../node_modules/ol/events/Event.js"}],"../../../node_modules/ol/MapBrowserEvent.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _MapEvent = _interopRequireDefault(require("./MapEvent.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/MapBrowserEvent + */ + + +/** + * @classdesc + * Events emitted as map browser events are instances of this type. + * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event. + * @template {UIEvent} EVENT + */ +var MapBrowserEvent = +/** @class */ +function (_super) { + __extends(MapBrowserEvent, _super); + /** + * @param {string} type Event type. + * @param {import("./PluggableMap.js").default} map Map. + * @param {EVENT} originalEvent Original event. + * @param {boolean=} opt_dragging Is the map currently being dragged? + * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state. + */ + + + function MapBrowserEvent(type, map, originalEvent, opt_dragging, opt_frameState) { + var _this = _super.call(this, type, map, opt_frameState) || this; + /** + * The original browser event. + * @const + * @type {EVENT} + * @api + */ + + + _this.originalEvent = originalEvent; + /** + * The map pixel relative to the viewport corresponding to the original browser event. + * @type {?import("./pixel.js").Pixel} + */ + + _this.pixel_ = null; + /** + * The coordinate in the user projection corresponding to the original browser event. + * @type {?import("./coordinate.js").Coordinate} + */ + + _this.coordinate_ = null; + /** + * Indicates if the map is currently being dragged. Only set for + * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`. + * + * @type {boolean} + * @api + */ + + _this.dragging = opt_dragging !== undefined ? opt_dragging : false; + return _this; + } + + Object.defineProperty(MapBrowserEvent.prototype, "pixel", { + /** + * The map pixel relative to the viewport corresponding to the original event. + * @type {import("./pixel.js").Pixel} + * @api + */ + get: function () { + if (!this.pixel_) { + this.pixel_ = this.map.getEventPixel(this.originalEvent); + } + + return this.pixel_; + }, + set: function (pixel) { + this.pixel_ = pixel; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MapBrowserEvent.prototype, "coordinate", { + /** + * The coordinate corresponding to the original browser event. This will be in the user + * projection if one is set. Otherwise it will be in the view projection. + * @type {import("./coordinate.js").Coordinate} + * @api + */ + get: function () { + if (!this.coordinate_) { + this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel); + } + + return this.coordinate_; + }, + set: function (coordinate) { + this.coordinate_ = coordinate; + }, + enumerable: false, + configurable: true + }); + /** + * Prevents the default browser action. + * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault. + * @api + */ + + MapBrowserEvent.prototype.preventDefault = function () { + _super.prototype.preventDefault.call(this); + + this.originalEvent.preventDefault(); + }; + /** + * Prevents further propagation of the current event. + * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation. + * @api + */ + + + MapBrowserEvent.prototype.stopPropagation = function () { + _super.prototype.stopPropagation.call(this); + + this.originalEvent.stopPropagation(); + }; + + return MapBrowserEvent; +}(_MapEvent.default); + +var _default = MapBrowserEvent; +exports.default = _default; +},{"./MapEvent.js":"../../../node_modules/ol/MapEvent.js"}],"../../../node_modules/ol/MapBrowserEventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/MapBrowserEventType + */ + +/** + * Constants for event names. + * @enum {string} + */ +var _default = { + /** + * 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: _EventType.default.CLICK, + + /** + * A true double click, with no dragging. + * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick + * @api + */ + DBLCLICK: _EventType.default.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' +}; +exports.default = _default; +},{"./events/EventType.js":"../../../node_modules/ol/events/EventType.js"}],"../../../node_modules/ol/pointer/EventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/pointer/EventType + */ + +/** + * Constants for event names. + * @enum {string} + */ +var _default = { + POINTERMOVE: 'pointermove', + POINTERDOWN: 'pointerdown', + POINTERUP: 'pointerup', + POINTEROVER: 'pointerover', + POINTEROUT: 'pointerout', + POINTERENTER: 'pointerenter', + POINTERLEAVE: 'pointerleave', + POINTERCANCEL: 'pointercancel' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/MapBrowserEventHandler.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Target = _interopRequireDefault(require("./events/Target.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _MapBrowserEvent = _interopRequireDefault(require("./MapBrowserEvent.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("./MapBrowserEventType.js")); + +var _EventType2 = _interopRequireDefault(require("./pointer/EventType.js")); + +var _has = require("./has.js"); + +var _events = require("./events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/MapBrowserEventHandler + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +var MapBrowserEventHandler = +/** @class */ +function (_super) { + __extends(MapBrowserEventHandler, _super); + /** + * @param {import("./PluggableMap.js").default} map The map with the viewport to listen to events on. + * @param {number=} moveTolerance The minimal distance the pointer must travel to trigger a move. + */ + + + function MapBrowserEventHandler(map, moveTolerance) { + var _this = _super.call(this, map) || this; + /** + * This is the element that we will listen to the real events on. + * @type {import("./PluggableMap.js").default} + * @private + */ + + + _this.map_ = map; + /** + * @type {any} + * @private + */ + + _this.clickTimeoutId_; + /** + * @type {boolean} + * @private + */ + + _this.dragging_ = false; + /** + * @type {!Array<import("./events.js").EventsKey>} + * @private + */ + + _this.dragListenerKeys_ = []; + /** + * @type {number} + * @private + */ + + _this.moveTolerance_ = moveTolerance ? moveTolerance * _has.DEVICE_PIXEL_RATIO : _has.DEVICE_PIXEL_RATIO; + /** + * The most recent "down" type event (or null if none have occurred). + * Set on pointerdown. + * @type {PointerEvent} + * @private + */ + + _this.down_ = null; + + var element = _this.map_.getViewport(); + /** + * @type {number} + * @private + */ + + + _this.activePointers_ = 0; + /** + * @type {!Object<number, boolean>} + * @private + */ + + _this.trackedTouches_ = {}; + _this.element_ = element; + /** + * @type {?import("./events.js").EventsKey} + * @private + */ + + _this.pointerdownListenerKey_ = (0, _events.listen)(element, _EventType2.default.POINTERDOWN, _this.handlePointerDown_, _this); + /** + * @type {PointerEvent} + * @private + */ + + _this.originalPointerMoveEvent_; + /** + * @type {?import("./events.js").EventsKey} + * @private + */ + + _this.relayedListenerKey_ = (0, _events.listen)(element, _EventType2.default.POINTERMOVE, _this.relayEvent_, _this); + /** + * @private + */ + + _this.boundHandleTouchMove_ = _this.handleTouchMove_.bind(_this); + + _this.element_.addEventListener(_EventType.default.TOUCHMOVE, _this.boundHandleTouchMove_, _has.PASSIVE_EVENT_LISTENERS ? { + passive: false + } : false); + + return _this; + } + /** + * @param {PointerEvent} pointerEvent Pointer + * event. + * @private + */ + + + MapBrowserEventHandler.prototype.emulateClick_ = function (pointerEvent) { + var newEvent = new _MapBrowserEvent.default(_MapBrowserEventType.default.CLICK, this.map_, pointerEvent); + this.dispatchEvent(newEvent); + + if (this.clickTimeoutId_ !== undefined) { + // double-click + clearTimeout(this.clickTimeoutId_); + this.clickTimeoutId_ = undefined; + newEvent = new _MapBrowserEvent.default(_MapBrowserEventType.default.DBLCLICK, this.map_, pointerEvent); + this.dispatchEvent(newEvent); + } else { + // click + this.clickTimeoutId_ = setTimeout(function () { + this.clickTimeoutId_ = undefined; + var newEvent = new _MapBrowserEvent.default(_MapBrowserEventType.default.SINGLECLICK, this.map_, pointerEvent); + this.dispatchEvent(newEvent); + }.bind(this), 250); + } + }; + /** + * Keeps track on how many pointers are currently active. + * + * @param {PointerEvent} pointerEvent Pointer + * event. + * @private + */ + + + MapBrowserEventHandler.prototype.updateActivePointers_ = function (pointerEvent) { + var event = pointerEvent; + + if (event.type == _MapBrowserEventType.default.POINTERUP || event.type == _MapBrowserEventType.default.POINTERCANCEL) { + delete this.trackedTouches_[event.pointerId]; + } else if (event.type == _MapBrowserEventType.default.POINTERDOWN) { + this.trackedTouches_[event.pointerId] = true; + } + + this.activePointers_ = Object.keys(this.trackedTouches_).length; + }; + /** + * @param {PointerEvent} pointerEvent Pointer + * event. + * @private + */ + + + MapBrowserEventHandler.prototype.handlePointerUp_ = function (pointerEvent) { + this.updateActivePointers_(pointerEvent); + var newEvent = new _MapBrowserEvent.default(_MapBrowserEventType.default.POINTERUP, this.map_, pointerEvent); + this.dispatchEvent(newEvent); // We emulate click events on left mouse button click, touch contact, and pen + // contact. isMouseActionButton returns true in these cases (evt.button is set + // to 0). + // See http://www.w3.org/TR/pointerevents/#button-states + // We only fire click, singleclick, and doubleclick if nobody has called + // event.stopPropagation() or event.preventDefault(). + + if (!newEvent.propagationStopped && !this.dragging_ && this.isMouseActionButton_(pointerEvent)) { + this.emulateClick_(this.down_); + } + + if (this.activePointers_ === 0) { + this.dragListenerKeys_.forEach(_events.unlistenByKey); + this.dragListenerKeys_.length = 0; + this.dragging_ = false; + this.down_ = null; + } + }; + /** + * @param {PointerEvent} pointerEvent Pointer + * event. + * @return {boolean} If the left mouse button was pressed. + * @private + */ + + + MapBrowserEventHandler.prototype.isMouseActionButton_ = function (pointerEvent) { + return pointerEvent.button === 0; + }; + /** + * @param {PointerEvent} pointerEvent Pointer + * event. + * @private + */ + + + MapBrowserEventHandler.prototype.handlePointerDown_ = function (pointerEvent) { + this.updateActivePointers_(pointerEvent); + var newEvent = new _MapBrowserEvent.default(_MapBrowserEventType.default.POINTERDOWN, this.map_, pointerEvent); + this.dispatchEvent(newEvent); + this.down_ = pointerEvent; + + if (this.dragListenerKeys_.length === 0) { + this.dragListenerKeys_.push((0, _events.listen)(document, _MapBrowserEventType.default.POINTERMOVE, this.handlePointerMove_, this), (0, _events.listen)(document, _MapBrowserEventType.default.POINTERUP, this.handlePointerUp_, this), + /* Note that the listener for `pointercancel is set up on + * `pointerEventHandler_` and not `documentPointerEventHandler_` like + * the `pointerup` and `pointermove` listeners. + * + * The reason for this is the following: `TouchSource.vacuumTouches_()` + * issues `pointercancel` events, when there was no `touchend` for a + * `touchstart`. Now, let's say a first `touchstart` is registered on + * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up. + * But `documentPointerEventHandler_` doesn't know about the first + * `touchstart`. If there is no `touchend` for the `touchstart`, we can + * only receive a `touchcancel` from `pointerEventHandler_`, because it is + * only registered there. + */ + (0, _events.listen)(this.element_, _MapBrowserEventType.default.POINTERCANCEL, this.handlePointerUp_, this)); + + if (this.element_.getRootNode && this.element_.getRootNode() !== document) { + this.dragListenerKeys_.push((0, _events.listen)(this.element_.getRootNode(), _MapBrowserEventType.default.POINTERUP, this.handlePointerUp_, this)); + } + } + }; + /** + * @param {PointerEvent} pointerEvent Pointer + * event. + * @private + */ + + + MapBrowserEventHandler.prototype.handlePointerMove_ = function (pointerEvent) { + // Between pointerdown and pointerup, pointermove events are triggered. + // To avoid a 'false' touchmove event to be dispatched, we test if the pointer + // moved a significant distance. + if (this.isMoving_(pointerEvent)) { + this.dragging_ = true; + var newEvent = new _MapBrowserEvent.default(_MapBrowserEventType.default.POINTERDRAG, this.map_, pointerEvent, this.dragging_); + this.dispatchEvent(newEvent); + } + }; + /** + * Wrap and relay a pointer event. Note that this requires that the type + * string for the MapBrowserEvent matches the PointerEvent type. + * @param {PointerEvent} pointerEvent Pointer + * event. + * @private + */ + + + MapBrowserEventHandler.prototype.relayEvent_ = function (pointerEvent) { + this.originalPointerMoveEvent_ = pointerEvent; + var dragging = !!(this.down_ && this.isMoving_(pointerEvent)); + this.dispatchEvent(new _MapBrowserEvent.default(pointerEvent.type, this.map_, pointerEvent, dragging)); + }; + /** + * Flexible handling of a `touch-action: none` css equivalent: because calling + * `preventDefault()` on a `pointermove` event does not stop native page scrolling + * and zooming, we also listen for `touchmove` and call `preventDefault()` on it + * when an interaction (currently `DragPan` handles the event. + * @param {TouchEvent} event Event. + * @private + */ + + + MapBrowserEventHandler.prototype.handleTouchMove_ = function (event) { + // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_` + // may not be initialized yet when we get here on a platform without native pointer events. + if (!this.originalPointerMoveEvent_ || this.originalPointerMoveEvent_.defaultPrevented) { + event.preventDefault(); + } + }; + /** + * @param {PointerEvent} pointerEvent Pointer + * event. + * @return {boolean} Is moving. + * @private + */ + + + MapBrowserEventHandler.prototype.isMoving_ = function (pointerEvent) { + return this.dragging_ || Math.abs(pointerEvent.clientX - this.down_.clientX) > this.moveTolerance_ || Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_; + }; + /** + * Clean up. + */ + + + MapBrowserEventHandler.prototype.disposeInternal = function () { + if (this.relayedListenerKey_) { + (0, _events.unlistenByKey)(this.relayedListenerKey_); + this.relayedListenerKey_ = null; + } + + this.element_.removeEventListener(_EventType.default.TOUCHMOVE, this.boundHandleTouchMove_); + + if (this.pointerdownListenerKey_) { + (0, _events.unlistenByKey)(this.pointerdownListenerKey_); + this.pointerdownListenerKey_ = null; + } + + this.dragListenerKeys_.forEach(_events.unlistenByKey); + this.dragListenerKeys_.length = 0; + this.element_ = null; + + _super.prototype.disposeInternal.call(this); + }; + + return MapBrowserEventHandler; +}(_Target.default); + +var _default = MapBrowserEventHandler; +exports.default = _default; +},{"./events/Target.js":"../../../node_modules/ol/events/Target.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./MapBrowserEvent.js":"../../../node_modules/ol/MapBrowserEvent.js","./MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","./pointer/EventType.js":"../../../node_modules/ol/pointer/EventType.js","./has.js":"../../../node_modules/ol/has.js","./events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/MapEventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/MapEventType + */ + +/** + * @enum {string} + */ +var _default = { + /** + * Triggered after a map frame is rendered. + * @event module:ol/MapEvent~MapEvent#postrender + * @api + */ + POSTRENDER: 'postrender', + + /** + * Triggered when the map starts moving. + * @event module:ol/MapEvent~MapEvent#movestart + * @api + */ + MOVESTART: 'movestart', + + /** + * Triggered after the map is moved. + * @event module:ol/MapEvent~MapEvent#moveend + * @api + */ + MOVEEND: 'moveend' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/MapProperty.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/MapProperty + */ + +/** + * @enum {string} + */ +var _default = { + LAYERGROUP: 'layergroup', + SIZE: 'size', + TARGET: 'target', + VIEW: 'view' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/structs/PriorityQueue.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.DROP = void 0; + +var _asserts = require("../asserts.js"); + +var _obj = require("../obj.js"); + +/** + * @module ol/structs/PriorityQueue + */ + +/** + * @type {number} + */ +var DROP = Infinity; +/** + * @classdesc + * Priority queue. + * + * The implementation is inspired from the Closure Library's Heap class and + * Python's heapq module. + * + * See http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html + * and http://hg.python.org/cpython/file/2.7/Lib/heapq.py. + * + * @template T + */ + +exports.DROP = DROP; + +var PriorityQueue = +/** @class */ +function () { + /** + * @param {function(T): number} priorityFunction Priority function. + * @param {function(T): string} keyFunction Key function. + */ + function PriorityQueue(priorityFunction, keyFunction) { + /** + * @type {function(T): number} + * @private + */ + this.priorityFunction_ = priorityFunction; + /** + * @type {function(T): string} + * @private + */ + + this.keyFunction_ = keyFunction; + /** + * @type {Array<T>} + * @private + */ + + this.elements_ = []; + /** + * @type {Array<number>} + * @private + */ + + this.priorities_ = []; + /** + * @type {!Object<string, boolean>} + * @private + */ + + this.queuedElements_ = {}; + } + /** + * FIXME empty description for jsdoc + */ + + + PriorityQueue.prototype.clear = function () { + this.elements_.length = 0; + this.priorities_.length = 0; + (0, _obj.clear)(this.queuedElements_); + }; + /** + * Remove and return the highest-priority element. O(log N). + * @return {T} Element. + */ + + + PriorityQueue.prototype.dequeue = function () { + var elements = this.elements_; + var priorities = this.priorities_; + var element = elements[0]; + + if (elements.length == 1) { + elements.length = 0; + priorities.length = 0; + } else { + elements[0] = elements.pop(); + priorities[0] = priorities.pop(); + this.siftUp_(0); + } + + var elementKey = this.keyFunction_(element); + delete this.queuedElements_[elementKey]; + return element; + }; + /** + * Enqueue an element. O(log N). + * @param {T} element Element. + * @return {boolean} The element was added to the queue. + */ + + + PriorityQueue.prototype.enqueue = function (element) { + (0, _asserts.assert)(!(this.keyFunction_(element) in this.queuedElements_), 31); // Tried to enqueue an `element` that was already added to the queue + + var priority = this.priorityFunction_(element); + + if (priority != DROP) { + this.elements_.push(element); + this.priorities_.push(priority); + this.queuedElements_[this.keyFunction_(element)] = true; + this.siftDown_(0, this.elements_.length - 1); + return true; + } + + return false; + }; + /** + * @return {number} Count. + */ + + + PriorityQueue.prototype.getCount = function () { + return this.elements_.length; + }; + /** + * Gets the index of the left child of the node at the given index. + * @param {number} index The index of the node to get the left child for. + * @return {number} The index of the left child. + * @private + */ + + + PriorityQueue.prototype.getLeftChildIndex_ = function (index) { + return index * 2 + 1; + }; + /** + * Gets the index of the right child of the node at the given index. + * @param {number} index The index of the node to get the right child for. + * @return {number} The index of the right child. + * @private + */ + + + PriorityQueue.prototype.getRightChildIndex_ = function (index) { + return index * 2 + 2; + }; + /** + * Gets the index of the parent of the node at the given index. + * @param {number} index The index of the node to get the parent for. + * @return {number} The index of the parent. + * @private + */ + + + PriorityQueue.prototype.getParentIndex_ = function (index) { + return index - 1 >> 1; + }; + /** + * Make this a heap. O(N). + * @private + */ + + + PriorityQueue.prototype.heapify_ = function () { + var i; + + for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) { + this.siftUp_(i); + } + }; + /** + * @return {boolean} Is empty. + */ + + + PriorityQueue.prototype.isEmpty = function () { + return this.elements_.length === 0; + }; + /** + * @param {string} key Key. + * @return {boolean} Is key queued. + */ + + + PriorityQueue.prototype.isKeyQueued = function (key) { + return key in this.queuedElements_; + }; + /** + * @param {T} element Element. + * @return {boolean} Is queued. + */ + + + PriorityQueue.prototype.isQueued = function (element) { + return this.isKeyQueued(this.keyFunction_(element)); + }; + /** + * @param {number} index The index of the node to move down. + * @private + */ + + + PriorityQueue.prototype.siftUp_ = function (index) { + var elements = this.elements_; + var priorities = this.priorities_; + var count = elements.length; + var element = elements[index]; + var priority = priorities[index]; + var startIndex = index; + + while (index < count >> 1) { + var lIndex = this.getLeftChildIndex_(index); + var rIndex = this.getRightChildIndex_(index); + var smallerChildIndex = rIndex < count && priorities[rIndex] < priorities[lIndex] ? rIndex : lIndex; + elements[index] = elements[smallerChildIndex]; + priorities[index] = priorities[smallerChildIndex]; + index = smallerChildIndex; + } + + elements[index] = element; + priorities[index] = priority; + this.siftDown_(startIndex, index); + }; + /** + * @param {number} startIndex The index of the root. + * @param {number} index The index of the node to move up. + * @private + */ + + + PriorityQueue.prototype.siftDown_ = function (startIndex, index) { + var elements = this.elements_; + var priorities = this.priorities_; + var element = elements[index]; + var priority = priorities[index]; + + while (index > startIndex) { + var parentIndex = this.getParentIndex_(index); + + if (priorities[parentIndex] > priority) { + elements[index] = elements[parentIndex]; + priorities[index] = priorities[parentIndex]; + index = parentIndex; + } else { + break; + } + } + + elements[index] = element; + priorities[index] = priority; + }; + /** + * FIXME empty description for jsdoc + */ + + + PriorityQueue.prototype.reprioritize = function () { + var priorityFunction = this.priorityFunction_; + var elements = this.elements_; + var priorities = this.priorities_; + var index = 0; + var n = elements.length; + var element, i, priority; + + for (i = 0; i < n; ++i) { + element = elements[i]; + priority = priorityFunction(element); + + if (priority == DROP) { + delete this.queuedElements_[this.keyFunction_(element)]; + } else { + priorities[index] = priority; + elements[index++] = element; + } + } + + elements.length = index; + priorities.length = index; + this.heapify_(); + }; + + return PriorityQueue; +}(); + +var _default = PriorityQueue; +exports.default = _default; +},{"../asserts.js":"../../../node_modules/ol/asserts.js","../obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/TileQueue.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getTilePriority = getTilePriority; +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _PriorityQueue = _interopRequireWildcard(require("./structs/PriorityQueue.js")); + +var _TileState = _interopRequireDefault(require("./TileState.js")); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/TileQueue + */ + + +/** + * @typedef {function(import("./Tile.js").default, string, import("./coordinate.js").Coordinate, number): number} PriorityFunction + */ +var TileQueue = +/** @class */ +function (_super) { + __extends(TileQueue, _super); + /** + * @param {PriorityFunction} tilePriorityFunction Tile priority function. + * @param {function(): ?} tileChangeCallback Function called on each tile change event. + */ + + + function TileQueue(tilePriorityFunction, tileChangeCallback) { + var _this = _super.call(this, + /** + * @param {Array} element Element. + * @return {number} Priority. + */ + function (element) { + return tilePriorityFunction.apply(null, element); + }, + /** + * @param {Array} element Element. + * @return {string} Key. + */ + function (element) { + return ( + /** @type {import("./Tile.js").default} */ + element[0].getKey() + ); + }) || this; + /** @private */ + + + _this.boundHandleTileChange_ = _this.handleTileChange.bind(_this); + /** + * @private + * @type {function(): ?} + */ + + _this.tileChangeCallback_ = tileChangeCallback; + /** + * @private + * @type {number} + */ + + _this.tilesLoading_ = 0; + /** + * @private + * @type {!Object<string,boolean>} + */ + + _this.tilesLoadingKeys_ = {}; + return _this; + } + /** + * @param {Array} element Element. + * @return {boolean} The element was added to the queue. + */ + + + TileQueue.prototype.enqueue = function (element) { + var added = _super.prototype.enqueue.call(this, element); + + if (added) { + var tile = element[0]; + tile.addEventListener(_EventType.default.CHANGE, this.boundHandleTileChange_); + } + + return added; + }; + /** + * @return {number} Number of tiles loading. + */ + + + TileQueue.prototype.getTilesLoading = function () { + return this.tilesLoading_; + }; + /** + * @param {import("./events/Event.js").default} event Event. + * @protected + */ + + + TileQueue.prototype.handleTileChange = function (event) { + var tile = + /** @type {import("./Tile.js").default} */ + event.target; + var state = tile.getState(); + + if (tile.hifi && state === _TileState.default.LOADED || state === _TileState.default.ERROR || state === _TileState.default.EMPTY) { + tile.removeEventListener(_EventType.default.CHANGE, this.boundHandleTileChange_); + var tileKey = tile.getKey(); + + if (tileKey in this.tilesLoadingKeys_) { + delete this.tilesLoadingKeys_[tileKey]; + --this.tilesLoading_; + } + + this.tileChangeCallback_(); + } + }; + /** + * @param {number} maxTotalLoading Maximum number tiles to load simultaneously. + * @param {number} maxNewLoads Maximum number of new tiles to load. + */ + + + TileQueue.prototype.loadMoreTiles = function (maxTotalLoading, maxNewLoads) { + var newLoads = 0; + var state, tile, tileKey; + + while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads && this.getCount() > 0) { + tile = + /** @type {import("./Tile.js").default} */ + this.dequeue()[0]; + tileKey = tile.getKey(); + state = tile.getState(); + + if (state === _TileState.default.IDLE && !(tileKey in this.tilesLoadingKeys_)) { + this.tilesLoadingKeys_[tileKey] = true; + ++this.tilesLoading_; + ++newLoads; + tile.load(); + } + } + }; + + return TileQueue; +}(_PriorityQueue.default); + +var _default = TileQueue; +/** + * @param {import('./PluggableMap.js').FrameState} frameState Frame state. + * @param {import("./Tile.js").default} tile Tile. + * @param {string} tileSourceKey Tile source key. + * @param {import("./coordinate.js").Coordinate} tileCenter Tile center. + * @param {number} tileResolution Tile resolution. + * @return {number} Tile priority. + */ + +exports.default = _default; + +function getTilePriority(frameState, tile, tileSourceKey, tileCenter, tileResolution) { + // Filter out tiles at higher zoom levels than the current zoom level, or that + // are outside the visible extent. + if (!frameState || !(tileSourceKey in frameState.wantedTiles)) { + return _PriorityQueue.DROP; + } + + if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) { + return _PriorityQueue.DROP; + } // Prioritize the highest zoom level tiles closest to the focus. + // Tiles at higher zoom levels are prioritized using Math.log(tileResolution). + // Within a zoom level, tiles are prioritized by the distance in pixels between + // the center of the tile and the center of the viewport. The factor of 65536 + // means that the prioritization should behave as desired for tiles up to + // 65536 * Math.log(2) = 45426 pixels from the focus. + + + var center = frameState.viewState.center; + var deltaX = tileCenter[0] - center[0]; + var deltaY = tileCenter[1] - center[1]; + return 65536 * Math.log(tileResolution) + Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution; +} +},{"./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./structs/PriorityQueue.js":"../../../node_modules/ol/structs/PriorityQueue.js","./TileState.js":"../../../node_modules/ol/TileState.js"}],"../../../node_modules/ol/ViewProperty.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/ViewProperty + */ + +/** + * @enum {string} + */ +var _default = { + CENTER: 'center', + RESOLUTION: 'resolution', + ROTATION: 'rotation' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/tilegrid/common.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DEFAULT_TILE_SIZE = exports.DEFAULT_MAX_ZOOM = void 0; + +/** + * @module ol/tilegrid/common + */ + +/** + * Default maximum zoom for default tile grids. + * @type {number} + */ +var DEFAULT_MAX_ZOOM = 42; +/** + * Default tile size. + * @type {number} + */ + +exports.DEFAULT_MAX_ZOOM = DEFAULT_MAX_ZOOM; +var DEFAULT_TILE_SIZE = 256; +exports.DEFAULT_TILE_SIZE = DEFAULT_TILE_SIZE; +},{}],"../../../node_modules/ol/centerconstraint.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createExtent = createExtent; +exports.none = none; + +var _math = require("./math.js"); + +/** + * @module ol/centerconstraint + */ + +/** + * @typedef {function((import("./coordinate.js").Coordinate|undefined), number, import("./size.js").Size, boolean=): (import("./coordinate.js").Coordinate|undefined)} Type + */ + +/** + * @param {import("./extent.js").Extent} extent Extent. + * @param {boolean} onlyCenter If true, the constraint will only apply to the view center. + * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent + * (only during interaction and animation). + * @return {Type} The constraint. + */ +function createExtent(extent, onlyCenter, smooth) { + return ( + /** + * @param {import("./coordinate.js").Coordinate|undefined} center Center. + * @param {number} resolution Resolution. + * @param {import("./size.js").Size} size Viewport size; unused if `onlyCenter` was specified. + * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. + * @return {import("./coordinate.js").Coordinate|undefined} Center. + */ + function (center, resolution, size, opt_isMoving) { + if (center) { + var viewWidth = onlyCenter ? 0 : size[0] * resolution; + var viewHeight = onlyCenter ? 0 : size[1] * resolution; + var minX = extent[0] + viewWidth / 2; + var maxX = extent[2] - viewWidth / 2; + var minY = extent[1] + viewHeight / 2; + var maxY = extent[3] - viewHeight / 2; // note: when zooming out of bounds, min and max values for x and y may + // end up inverted (min > max); this has to be accounted for + + if (minX > maxX) { + minX = (maxX + minX) / 2; + maxX = minX; + } + + if (minY > maxY) { + minY = (maxY + minY) / 2; + maxY = minY; + } + + var x = (0, _math.clamp)(center[0], minX, maxX); + var y = (0, _math.clamp)(center[1], minY, maxY); + var ratio = 30 * resolution; // during an interaction, allow some overscroll + + if (opt_isMoving && smooth) { + x += -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) + ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio); + y += -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) + ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio); + } + + return [x, y]; + } else { + return undefined; + } + } + ); +} +/** + * @param {import("./coordinate.js").Coordinate=} center Center. + * @return {import("./coordinate.js").Coordinate|undefined} Center. + */ + + +function none(center) { + return center; +} +},{"./math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/resolutionconstraint.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createSnapToResolutions = createSnapToResolutions; +exports.createSnapToPower = createSnapToPower; +exports.createMinMaxResolution = createMinMaxResolution; + +var _math = require("./math.js"); + +var _extent = require("./extent.js"); + +var _array = require("./array.js"); + +/** + * @module ol/resolutionconstraint + */ + +/** + * @typedef {function((number|undefined), number, import("./size.js").Size, boolean=): (number|undefined)} Type + */ + +/** + * Returns a modified resolution taking into account the viewport size and maximum + * allowed extent. + * @param {number} resolution Resolution + * @param {import("./extent.js").Extent=} maxExtent Maximum allowed extent. + * @param {import("./size.js").Size} viewportSize Viewport size. + * @param {boolean} showFullExtent Whether to show the full extent. + * @return {number} Capped resolution. + */ +function getViewportClampedResolution(resolution, maxExtent, viewportSize, showFullExtent) { + var xResolution = (0, _extent.getWidth)(maxExtent) / viewportSize[0]; + var yResolution = (0, _extent.getHeight)(maxExtent) / viewportSize[1]; + + if (showFullExtent) { + return Math.min(resolution, Math.max(xResolution, yResolution)); + } + + return Math.min(resolution, Math.min(xResolution, yResolution)); +} +/** + * Returns a modified resolution to be between maxResolution and minResolution while + * still allowing the value to be slightly out of bounds. + * Note: the computation is based on the logarithm function (ln): + * - at 1, ln(x) is 0 + * - above 1, ln(x) keeps increasing but at a much slower pace than x + * The final result is clamped to prevent getting too far away from bounds. + * @param {number} resolution Resolution. + * @param {number} maxResolution Max resolution. + * @param {number} minResolution Min resolution. + * @return {number} Smoothed resolution. + */ + + +function getSmoothClampedResolution(resolution, maxResolution, minResolution) { + var result = Math.min(resolution, maxResolution); + var ratio = 50; + result *= Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio + 1; + + if (minResolution) { + result = Math.max(result, minResolution); + result /= Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) / ratio + 1; + } + + return (0, _math.clamp)(result, minResolution / 2, maxResolution * 2); +} +/** + * @param {Array<number>} resolutions Resolutions. + * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true. + * @param {import("./extent.js").Extent=} opt_maxExtent Maximum allowed extent. + * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false. + * @return {Type} Zoom function. + */ + + +function createSnapToResolutions(resolutions, opt_smooth, opt_maxExtent, opt_showFullExtent) { + return ( + /** + * @param {number|undefined} resolution Resolution. + * @param {number} direction Direction. + * @param {import("./size.js").Size} size Viewport size. + * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. + * @return {number|undefined} Resolution. + */ + function (resolution, direction, size, opt_isMoving) { + if (resolution !== undefined) { + var maxResolution = resolutions[0]; + var minResolution = resolutions[resolutions.length - 1]; + var cappedMaxRes = opt_maxExtent ? getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent) : maxResolution; // during interacting or animating, allow intermediary values + + if (opt_isMoving) { + var smooth = opt_smooth !== undefined ? opt_smooth : true; + + if (!smooth) { + return (0, _math.clamp)(resolution, minResolution, cappedMaxRes); + } + + return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution); + } + + var capped = Math.min(cappedMaxRes, resolution); + var z = Math.floor((0, _array.linearFindNearest)(resolutions, capped, direction)); + + if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) { + return resolutions[z + 1]; + } + + return resolutions[z]; + } else { + return undefined; + } + } + ); +} +/** + * @param {number} power Power. + * @param {number} maxResolution Maximum resolution. + * @param {number=} opt_minResolution Minimum resolution. + * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true. + * @param {import("./extent.js").Extent=} opt_maxExtent Maximum allowed extent. + * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false. + * @return {Type} Zoom function. + */ + + +function createSnapToPower(power, maxResolution, opt_minResolution, opt_smooth, opt_maxExtent, opt_showFullExtent) { + return ( + /** + * @param {number|undefined} resolution Resolution. + * @param {number} direction Direction. + * @param {import("./size.js").Size} size Viewport size. + * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. + * @return {number|undefined} Resolution. + */ + function (resolution, direction, size, opt_isMoving) { + if (resolution !== undefined) { + var cappedMaxRes = opt_maxExtent ? getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent) : maxResolution; + var minResolution = opt_minResolution !== undefined ? opt_minResolution : 0; // during interacting or animating, allow intermediary values + + if (opt_isMoving) { + var smooth = opt_smooth !== undefined ? opt_smooth : true; + + if (!smooth) { + return (0, _math.clamp)(resolution, minResolution, cappedMaxRes); + } + + return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution); + } + + var tolerance = 1e-9; + var minZoomLevel = Math.ceil(Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance); + var offset = -direction * (0.5 - tolerance) + 0.5; + var capped = Math.min(cappedMaxRes, resolution); + var cappedZoomLevel = Math.floor(Math.log(maxResolution / capped) / Math.log(power) + offset); + var zoomLevel = Math.max(minZoomLevel, cappedZoomLevel); + var newResolution = maxResolution / Math.pow(power, zoomLevel); + return (0, _math.clamp)(newResolution, minResolution, cappedMaxRes); + } else { + return undefined; + } + } + ); +} +/** + * @param {number} maxResolution Max resolution. + * @param {number} minResolution Min resolution. + * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true. + * @param {import("./extent.js").Extent=} opt_maxExtent Maximum allowed extent. + * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false. + * @return {Type} Zoom function. + */ + + +function createMinMaxResolution(maxResolution, minResolution, opt_smooth, opt_maxExtent, opt_showFullExtent) { + return ( + /** + * @param {number|undefined} resolution Resolution. + * @param {number} direction Direction. + * @param {import("./size.js").Size} size Viewport size. + * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. + * @return {number|undefined} Resolution. + */ + function (resolution, direction, size, opt_isMoving) { + if (resolution !== undefined) { + var cappedMaxRes = opt_maxExtent ? getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent) : maxResolution; + var smooth = opt_smooth !== undefined ? opt_smooth : true; + + if (!smooth || !opt_isMoving) { + return (0, _math.clamp)(resolution, minResolution, cappedMaxRes); + } + + return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution); + } else { + return undefined; + } + } + ); +} +},{"./math.js":"../../../node_modules/ol/math.js","./extent.js":"../../../node_modules/ol/extent.js","./array.js":"../../../node_modules/ol/array.js"}],"../../../node_modules/ol/rotationconstraint.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.disable = disable; +exports.none = none; +exports.createSnapToN = createSnapToN; +exports.createSnapToZero = createSnapToZero; + +var _math = require("./math.js"); + +/** + * @module ol/rotationconstraint + */ + +/** + * @typedef {function((number|undefined), boolean=): (number|undefined)} Type + */ + +/** + * @param {number|undefined} rotation Rotation. + * @return {number|undefined} Rotation. + */ +function disable(rotation) { + if (rotation !== undefined) { + return 0; + } else { + return undefined; + } +} +/** + * @param {number|undefined} rotation Rotation. + * @return {number|undefined} Rotation. + */ + + +function none(rotation) { + if (rotation !== undefined) { + return rotation; + } else { + return undefined; + } +} +/** + * @param {number} n N. + * @return {Type} Rotation constraint. + */ + + +function createSnapToN(n) { + var theta = 2 * Math.PI / n; + return ( + /** + * @param {number|undefined} rotation Rotation. + * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. + * @return {number|undefined} Rotation. + */ + function (rotation, opt_isMoving) { + if (opt_isMoving) { + return rotation; + } + + if (rotation !== undefined) { + rotation = Math.floor(rotation / theta + 0.5) * theta; + return rotation; + } else { + return undefined; + } + } + ); +} +/** + * @param {number=} opt_tolerance Tolerance. + * @return {Type} Rotation constraint. + */ + + +function createSnapToZero(opt_tolerance) { + var tolerance = opt_tolerance || (0, _math.toRadians)(5); + return ( + /** + * @param {number|undefined} rotation Rotation. + * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. + * @return {number|undefined} Rotation. + */ + function (rotation, opt_isMoving) { + if (opt_isMoving) { + return rotation; + } + + if (rotation !== undefined) { + if (Math.abs(rotation) <= tolerance) { + return 0; + } else { + return rotation; + } + } else { + return undefined; + } + } + ); +} +},{"./math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/View.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createCenterConstraint = createCenterConstraint; +exports.createResolutionConstraint = createResolutionConstraint; +exports.createRotationConstraint = createRotationConstraint; +exports.isNoopAnimation = isNoopAnimation; +exports.default = void 0; + +var _Object = _interopRequireDefault(require("./Object.js")); + +var _GeometryType = _interopRequireDefault(require("./geom/GeometryType.js")); + +var _Units = _interopRequireDefault(require("./proj/Units.js")); + +var _ViewHint = _interopRequireDefault(require("./ViewHint.js")); + +var _ViewProperty = _interopRequireDefault(require("./ViewProperty.js")); + +var _common = require("./tilegrid/common.js"); + +var _proj = require("./proj.js"); + +var _functions = require("./functions.js"); + +var _coordinate = require("./coordinate.js"); + +var _asserts = require("./asserts.js"); + +var _obj = require("./obj.js"); + +var _centerconstraint = require("./centerconstraint.js"); + +var _math = require("./math.js"); + +var _resolutionconstraint = require("./resolutionconstraint.js"); + +var _rotationconstraint = require("./rotationconstraint.js"); + +var _easing = require("./easing.js"); + +var _extent = require("./extent.js"); + +var _array = require("./array.js"); + +var _Polygon = require("./geom/Polygon.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/View + */ + + +/** + * An animation configuration + * + * @typedef {Object} Animation + * @property {import("./coordinate.js").Coordinate} [sourceCenter] + * @property {import("./coordinate.js").Coordinate} [targetCenter] + * @property {number} [sourceResolution] + * @property {number} [targetResolution] + * @property {number} [sourceRotation] + * @property {number} [targetRotation] + * @property {import("./coordinate.js").Coordinate} [anchor] + * @property {number} start + * @property {number} duration + * @property {boolean} complete + * @property {function(number):number} easing + * @property {function(boolean):void} callback + */ + +/** + * @typedef {Object} Constraints + * @property {import("./centerconstraint.js").Type} center + * @property {import("./resolutionconstraint.js").Type} resolution + * @property {import("./rotationconstraint.js").Type} rotation + */ + +/** + * @typedef {Object} FitOptions + * @property {import("./size.js").Size} [size] The size in pixels of the box to fit + * the extent into. Default is the current size of the first map in the DOM that + * uses this view, or `[100, 100]` if no such map is found. + * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be + * cleared inside the view. Values in the array are top, right, bottom and left + * padding. + * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`, + * get the nearest extent instead of the closest that actually fits the view. + * @property {number} [minResolution=0] Minimum resolution that we zoom to. + * @property {number} [maxZoom] Maximum zoom level that we zoom to. If + * `minResolution` is given, this property is ignored. + * @property {number} [duration] The duration of the animation in milliseconds. + * By default, there is no animation to the target extent. + * @property {function(number):number} [easing] The easing function used during + * the animation (defaults to {@link module:ol/easing~inAndOut}). + * The function will be called for each frame with a number representing a + * fraction of the animation's duration. The function should return a number + * between 0 and 1 representing the progress toward the destination state. + * @property {function(boolean):void} [callback] Function called when the view is in + * its final position. The callback will be called with `true` if the animation + * series completed on its own or `false` if it was cancelled. + */ + +/** + * @typedef {Object} ViewOptions + * @property {import("./coordinate.js").Coordinate} [center] The initial center for + * the view. If a user projection is not set, the coordinate system for the center is + * specified with the `projection` option. Layer sources will not be fetched if this + * is not set, but the center can be set later with {@link #setCenter}. + * @property {boolean|number} [constrainRotation=true] Rotation constraint. + * `false` means no constraint. `true` means no constraint, but snap to zero + * near zero. A number constrains the rotation to that number of values. For + * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees. + * @property {boolean} [enableRotation=true] Enable rotation. + * If `false`, a rotation constraint that always sets the rotation to zero is + * used. The `constrainRotation` option has no effect if `enableRotation` is + * `false`. + * @property {import("./extent.js").Extent} [extent] The extent that constrains the + * view, in other words, nothing outside of this extent can be visible on the map. + * @property {boolean} [constrainOnlyCenter=false] If true, the extent + * constraint will only apply to the view center and not the whole extent. + * @property {boolean} [smoothExtentConstraint=true] If true, the extent + * constraint will be applied smoothly, i.e. allow the view to go slightly outside + * of the given `extent`. + * @property {number} [maxResolution] The maximum resolution used to determine + * the resolution constraint. It is used together with `minResolution` (or + * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way + * that the projection's validity extent fits in a 256x256 px tile. If the + * projection is Spherical Mercator (the default) then `maxResolution` defaults + * to `40075016.68557849 / 256 = 156543.03392804097`. + * @property {number} [minResolution] The minimum resolution used to determine + * the resolution constraint. It is used together with `maxResolution` (or + * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29 + * zoom levels (with a factor of 2). If the projection is Spherical Mercator + * (the default) then `minResolution` defaults to + * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`. + * @property {number} [maxZoom=28] The maximum zoom level used to determine the + * resolution constraint. It is used together with `minZoom` (or + * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also + * provided, it is given precedence over `maxZoom`. + * @property {number} [minZoom=0] The minimum zoom level used to determine the + * resolution constraint. It is used together with `maxZoom` (or + * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also + * provided, it is given precedence over `minZoom`. + * @property {boolean} [multiWorld=false] If `false` the view is constrained so + * only one world is visible, and you cannot pan off the edge. If `true` the map + * may show multiple worlds at low zoom levels. Only used if the `projection` is + * global. Note that if `extent` is also provided it is given precedence. + * @property {boolean} [constrainResolution=false] If true, the view will always + * animate to the closest zoom level after an interaction; false means + * intermediary zoom levels are allowed. + * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution + * min/max values will be applied smoothly, i. e. allow the view to exceed slightly + * the given resolution or zoom bounds. + * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to + * show the full configured extent. By default, when a view is configured with an + * extent, users will not be able to zoom out so the viewport exceeds the extent in + * either dimension. This means the full extent may not be visible if the viewport + * is taller or wider than the aspect ratio of the configured extent. If + * showFullExtent is true, the user will be able to zoom out so that the viewport + * exceeds the height or width of the configured extent, but not both, allowing the + * full extent to be shown. + * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The + * projection. The default is Spherical Mercator. + * @property {number} [resolution] The initial resolution for the view. The + * units are `projection` units per pixel (e.g. meters per pixel). An + * alternative to setting this is to set `zoom`. Layer sources will not be + * fetched if neither this nor `zoom` are defined, but they can be set later + * with {@link #setZoom} or {@link #setResolution}. + * @property {Array<number>} [resolutions] Resolutions to determine the + * resolution constraint. If set the `maxResolution`, `minResolution`, + * `minZoom`, `maxZoom`, and `zoomFactor` options are ignored. + * @property {number} [rotation=0] The initial rotation for the view in radians + * (positive rotation clockwise, 0 means North). + * @property {number} [zoom] Only used if `resolution` is not defined. Zoom + * level used to calculate the initial resolution for the view. + * @property {number} [zoomFactor=2] The zoom factor used to compute the + * corresponding resolution. + */ + +/** + * @typedef {Object} AnimationOptions + * @property {import("./coordinate.js").Coordinate} [center] The center of the view at the end of + * the animation. + * @property {number} [zoom] The zoom level of the view at the end of the + * animation. This takes precedence over `resolution`. + * @property {number} [resolution] The resolution of the view at the end + * of the animation. If `zoom` is also provided, this option will be ignored. + * @property {number} [rotation] The rotation of the view at the end of + * the animation. + * @property {import("./coordinate.js").Coordinate} [anchor] Optional anchor to remain fixed + * during a rotation or resolution animation. + * @property {number} [duration=1000] The duration of the animation in milliseconds. + * @property {function(number):number} [easing] The easing function used + * during the animation (defaults to {@link module:ol/easing~inAndOut}). + * The function will be called for each frame with a number representing a + * fraction of the animation's duration. The function should return a number + * between 0 and 1 representing the progress toward the destination state. + */ + +/** + * @typedef {Object} State + * @property {import("./coordinate.js").Coordinate} center + * @property {import("./proj/Projection.js").default} projection + * @property {number} resolution + * @property {number} rotation + * @property {number} zoom + */ + +/** + * Default min zoom level for the map view. + * @type {number} + */ +var DEFAULT_MIN_ZOOM = 0; +/** + * @classdesc + * A View object represents a simple 2D view of the map. + * + * This is the object to act upon to change the center, resolution, + * and rotation of the map. + * + * A View has a `projection`. The projection determines the + * coordinate system of the center, and its units determine the units of the + * resolution (projection units per pixel). The default projection is + * Spherical Mercator (EPSG:3857). + * + * ### The view states + * + * A View is determined by three states: `center`, `resolution`, + * and `rotation`. Each state has a corresponding getter and setter, e.g. + * `getCenter` and `setCenter` for the `center` state. + * + * The `zoom` state is actually not saved on the view: all computations + * internally use the `resolution` state. Still, the `setZoom` and `getZoom` + * methods are available, as well as `getResolutionForZoom` and + * `getZoomForResolution` to switch from one system to the other. + * + * ### The constraints + * + * `setCenter`, `setResolution` and `setRotation` can be used to change the + * states of the view, but any constraint defined in the constructor will + * be applied along the way. + * + * A View object can have a *resolution constraint*, a *rotation constraint* + * and a *center constraint*. + * + * The *resolution constraint* typically restricts min/max values and + * snaps to specific resolutions. It is determined by the following + * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`. + * If `resolutions` is set, the other three options are ignored. See + * documentation for each option for more information. By default, the view + * only has a min/max restriction and allow intermediary zoom levels when + * pinch-zooming for example. + * + * The *rotation constraint* snaps to specific angles. It is determined + * by the following options: `enableRotation` and `constrainRotation`. + * By default rotation is allowed and its value is snapped to zero when approaching the + * horizontal. + * + * The *center constraint* is determined by the `extent` option. By + * default the view center is not constrained at all. + * + * ### Changing the view state + * + * It is important to note that `setZoom`, `setResolution`, `setCenter` and + * `setRotation` are subject to the above mentioned constraints. As such, it + * may sometimes not be possible to know in advance the resulting state of the + * View. For example, calling `setResolution(10)` does not guarantee that + * `getResolution()` will return `10`. + * + * A consequence of this is that, when applying a delta on the view state, one + * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution` + * rather than the corresponding setters. This will let view do its internal + * computations. Besides, the `adjust*` methods also take an `opt_anchor` + * argument which allows specifying an origin for the transformation. + * + * ### Interacting with the view + * + * View constraints are usually only applied when the view is *at rest*, meaning that + * no interaction or animation is ongoing. As such, if the user puts the view in a + * state that is not equivalent to a constrained one (e.g. rotating the view when + * the snap angle is 0), an animation will be triggered at the interaction end to + * put back the view to a stable state; + * + * @api + */ + +var View = +/** @class */ +function (_super) { + __extends(View, _super); + /** + * @param {ViewOptions=} opt_options View options. + */ + + + function View(opt_options) { + var _this = _super.call(this) || this; + + var options = (0, _obj.assign)({}, opt_options); + /** + * @private + * @type {Array<number>} + */ + + _this.hints_ = [0, 0]; + /** + * @private + * @type {Array<Array<Animation>>} + */ + + _this.animations_ = []; + /** + * @private + * @type {number|undefined} + */ + + _this.updateAnimationKey_; + /** + * @private + * @const + * @type {import("./proj/Projection.js").default} + */ + + _this.projection_ = (0, _proj.createProjection)(options.projection, 'EPSG:3857'); + /** + * @private + * @type {import("./size.js").Size} + */ + + _this.viewportSize_ = [100, 100]; + /** + * @private + * @type {import("./coordinate.js").Coordinate|undefined} + */ + + _this.targetCenter_ = null; + /** + * @private + * @type {number|undefined} + */ + + _this.targetResolution_; + /** + * @private + * @type {number|undefined} + */ + + _this.targetRotation_; + /** + * @private + * @type {import("./coordinate.js").Coordinate|undefined} + */ + + _this.cancelAnchor_ = undefined; + + if (options.center) { + options.center = (0, _proj.fromUserCoordinate)(options.center, _this.projection_); + } + + if (options.extent) { + options.extent = (0, _proj.fromUserExtent)(options.extent, _this.projection_); + } + + _this.applyOptions_(options); + + return _this; + } + /** + * Set up the view with the given options. + * @param {ViewOptions} options View options. + */ + + + View.prototype.applyOptions_ = function (options) { + /** + * @type {Object<string, *>} + */ + var properties = {}; + var resolutionConstraintInfo = createResolutionConstraint(options); + /** + * @private + * @type {number} + */ + + this.maxResolution_ = resolutionConstraintInfo.maxResolution; + /** + * @private + * @type {number} + */ + + this.minResolution_ = resolutionConstraintInfo.minResolution; + /** + * @private + * @type {number} + */ + + this.zoomFactor_ = resolutionConstraintInfo.zoomFactor; + /** + * @private + * @type {Array<number>|undefined} + */ + + this.resolutions_ = options.resolutions; + /** + * @private + * @type {number} + */ + + this.minZoom_ = resolutionConstraintInfo.minZoom; + var centerConstraint = createCenterConstraint(options); + var resolutionConstraint = resolutionConstraintInfo.constraint; + var rotationConstraint = createRotationConstraint(options); + /** + * @private + * @type {Constraints} + */ + + this.constraints_ = { + center: centerConstraint, + resolution: resolutionConstraint, + rotation: rotationConstraint + }; + this.setRotation(options.rotation !== undefined ? options.rotation : 0); + this.setCenterInternal(options.center !== undefined ? options.center : null); + + if (options.resolution !== undefined) { + this.setResolution(options.resolution); + } else if (options.zoom !== undefined) { + this.setZoom(options.zoom); + } + + this.setProperties(properties); + /** + * @private + * @type {ViewOptions} + */ + + this.options_ = options; + }; + /** + * Get an updated version of the view options used to construct the view. The + * current resolution (or zoom), center, and rotation are applied to any stored + * options. The provided options can be used to apply new min/max zoom or + * resolution limits. + * @param {ViewOptions} newOptions New options to be applied. + * @return {ViewOptions} New options updated with the current view state. + */ + + + View.prototype.getUpdatedOptions_ = function (newOptions) { + var options = (0, _obj.assign)({}, this.options_); // preserve resolution (or zoom) + + if (options.resolution !== undefined) { + options.resolution = this.getResolution(); + } else { + options.zoom = this.getZoom(); + } // preserve center + + + options.center = this.getCenterInternal(); // preserve rotation + + options.rotation = this.getRotation(); + return (0, _obj.assign)({}, options, newOptions); + }; + /** + * Animate the view. The view's center, zoom (or resolution), and rotation + * can be animated for smooth transitions between view states. For example, + * to animate the view to a new zoom level: + * + * view.animate({zoom: view.getZoom() + 1}); + * + * By default, the animation lasts one second and uses in-and-out easing. You + * can customize this behavior by including `duration` (in milliseconds) and + * `easing` options (see {@link module:ol/easing}). + * + * To chain together multiple animations, call the method with multiple + * animation objects. For example, to first zoom and then pan: + * + * view.animate({zoom: 10}, {center: [0, 0]}); + * + * If you provide a function as the last argument to the animate method, it + * will get called at the end of an animation series. The callback will be + * called with `true` if the animation series completed on its own or `false` + * if it was cancelled. + * + * Animations are cancelled by user interactions (e.g. dragging the map) or by + * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()` + * (or another method that calls one of these). + * + * @param {...(AnimationOptions|function(boolean): void)} var_args Animation + * options. Multiple animations can be run in series by passing multiple + * options objects. To run multiple animations in parallel, call the method + * multiple times. An optional callback can be provided as a final + * argument. The callback will be called with a boolean indicating whether + * the animation completed without being cancelled. + * @api + */ + + + View.prototype.animate = function (var_args) { + if (this.isDef() && !this.getAnimating()) { + this.resolveConstraints(0); + } + + var args = new Array(arguments.length); + + for (var i = 0; i < args.length; ++i) { + var options = arguments[i]; + + if (options.center) { + options = (0, _obj.assign)({}, options); + options.center = (0, _proj.fromUserCoordinate)(options.center, this.getProjection()); + } + + if (options.anchor) { + options = (0, _obj.assign)({}, options); + options.anchor = (0, _proj.fromUserCoordinate)(options.anchor, this.getProjection()); + } + + args[i] = options; + } + + this.animateInternal.apply(this, args); + }; + /** + * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options. + */ + + + View.prototype.animateInternal = function (var_args) { + var animationCount = arguments.length; + var callback; + + if (animationCount > 1 && typeof arguments[animationCount - 1] === 'function') { + callback = arguments[animationCount - 1]; + --animationCount; + } + + if (!this.isDef()) { + // if view properties are not yet set, shortcut to the final state + var state = arguments[animationCount - 1]; + + if (state.center) { + this.setCenterInternal(state.center); + } + + if (state.zoom !== undefined) { + this.setZoom(state.zoom); + } + + if (state.rotation !== undefined) { + this.setRotation(state.rotation); + } + + if (callback) { + animationCallback(callback, true); + } + + return; + } + + var start = Date.now(); + var center = this.targetCenter_.slice(); + var resolution = this.targetResolution_; + var rotation = this.targetRotation_; + var series = []; + + for (var i = 0; i < animationCount; ++i) { + var options = + /** @type {AnimationOptions} */ + arguments[i]; + var animation = { + start: start, + complete: false, + anchor: options.anchor, + duration: options.duration !== undefined ? options.duration : 1000, + easing: options.easing || _easing.inAndOut, + callback: callback + }; + + if (options.center) { + animation.sourceCenter = center; + animation.targetCenter = options.center.slice(); + center = animation.targetCenter; + } + + if (options.zoom !== undefined) { + animation.sourceResolution = resolution; + animation.targetResolution = this.getResolutionForZoom(options.zoom); + resolution = animation.targetResolution; + } else if (options.resolution) { + animation.sourceResolution = resolution; + animation.targetResolution = options.resolution; + resolution = animation.targetResolution; + } + + if (options.rotation !== undefined) { + animation.sourceRotation = rotation; + var delta = (0, _math.modulo)(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI; + animation.targetRotation = rotation + delta; + rotation = animation.targetRotation; + } // check if animation is a no-op + + + if (isNoopAnimation(animation)) { + animation.complete = true; // we still push it onto the series for callback handling + } else { + start += animation.duration; + } + + series.push(animation); + } + + this.animations_.push(series); + this.setHint(_ViewHint.default.ANIMATING, 1); + this.updateAnimations_(); + }; + /** + * Determine if the view is being animated. + * @return {boolean} The view is being animated. + * @api + */ + + + View.prototype.getAnimating = function () { + return this.hints_[_ViewHint.default.ANIMATING] > 0; + }; + /** + * Determine if the user is interacting with the view, such as panning or zooming. + * @return {boolean} The view is being interacted with. + * @api + */ + + + View.prototype.getInteracting = function () { + return this.hints_[_ViewHint.default.INTERACTING] > 0; + }; + /** + * Cancel any ongoing animations. + * @api + */ + + + View.prototype.cancelAnimations = function () { + this.setHint(_ViewHint.default.ANIMATING, -this.hints_[_ViewHint.default.ANIMATING]); + var anchor; + + for (var i = 0, ii = this.animations_.length; i < ii; ++i) { + var series = this.animations_[i]; + + if (series[0].callback) { + animationCallback(series[0].callback, false); + } + + if (!anchor) { + for (var j = 0, jj = series.length; j < jj; ++j) { + var animation = series[j]; + + if (!animation.complete) { + anchor = animation.anchor; + break; + } + } + } + } + + this.animations_.length = 0; + this.cancelAnchor_ = anchor; + }; + /** + * Update all animations. + */ + + + View.prototype.updateAnimations_ = function () { + if (this.updateAnimationKey_ !== undefined) { + cancelAnimationFrame(this.updateAnimationKey_); + this.updateAnimationKey_ = undefined; + } + + if (!this.getAnimating()) { + return; + } + + var now = Date.now(); + var more = false; + + for (var i = this.animations_.length - 1; i >= 0; --i) { + var series = this.animations_[i]; + var seriesComplete = true; + + for (var j = 0, jj = series.length; j < jj; ++j) { + var animation = series[j]; + + if (animation.complete) { + continue; + } + + var elapsed = now - animation.start; + var fraction = animation.duration > 0 ? elapsed / animation.duration : 1; + + if (fraction >= 1) { + animation.complete = true; + fraction = 1; + } else { + seriesComplete = false; + } + + var progress = animation.easing(fraction); + + if (animation.sourceCenter) { + var x0 = animation.sourceCenter[0]; + var y0 = animation.sourceCenter[1]; + var x1 = animation.targetCenter[0]; + var y1 = animation.targetCenter[1]; + var x = x0 + progress * (x1 - x0); + var y = y0 + progress * (y1 - y0); + this.targetCenter_ = [x, y]; + } + + if (animation.sourceResolution && animation.targetResolution) { + var resolution = progress === 1 ? animation.targetResolution : animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution); + + if (animation.anchor) { + var size = this.getViewportSize_(this.getRotation()); + var constrainedResolution = this.constraints_.resolution(resolution, 0, size, true); + this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor); + } + + this.targetResolution_ = resolution; + this.applyTargetState_(true); + } + + if (animation.sourceRotation !== undefined && animation.targetRotation !== undefined) { + var rotation = progress === 1 ? (0, _math.modulo)(animation.targetRotation + Math.PI, 2 * Math.PI) - Math.PI : animation.sourceRotation + progress * (animation.targetRotation - animation.sourceRotation); + + if (animation.anchor) { + var constrainedRotation = this.constraints_.rotation(rotation, true); + this.targetCenter_ = this.calculateCenterRotate(constrainedRotation, animation.anchor); + } + + this.targetRotation_ = rotation; + } + + this.applyTargetState_(true); + more = true; + + if (!animation.complete) { + break; + } + } + + if (seriesComplete) { + this.animations_[i] = null; + this.setHint(_ViewHint.default.ANIMATING, -1); + var callback = series[0].callback; + + if (callback) { + animationCallback(callback, true); + } + } + } // prune completed series + + + this.animations_ = this.animations_.filter(Boolean); + + if (more && this.updateAnimationKey_ === undefined) { + this.updateAnimationKey_ = requestAnimationFrame(this.updateAnimations_.bind(this)); + } + }; + /** + * @param {number} rotation Target rotation. + * @param {import("./coordinate.js").Coordinate} anchor Rotation anchor. + * @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor. + */ + + + View.prototype.calculateCenterRotate = function (rotation, anchor) { + var center; + var currentCenter = this.getCenterInternal(); + + if (currentCenter !== undefined) { + center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]]; + (0, _coordinate.rotate)(center, rotation - this.getRotation()); + (0, _coordinate.add)(center, anchor); + } + + return center; + }; + /** + * @param {number} resolution Target resolution. + * @param {import("./coordinate.js").Coordinate} anchor Zoom anchor. + * @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor. + */ + + + View.prototype.calculateCenterZoom = function (resolution, anchor) { + var center; + var currentCenter = this.getCenterInternal(); + var currentResolution = this.getResolution(); + + if (currentCenter !== undefined && currentResolution !== undefined) { + var x = anchor[0] - resolution * (anchor[0] - currentCenter[0]) / currentResolution; + var y = anchor[1] - resolution * (anchor[1] - currentCenter[1]) / currentResolution; + center = [x, y]; + } + + return center; + }; + /** + * Returns the current viewport size. + * @private + * @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size + * @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found. + */ + + + View.prototype.getViewportSize_ = function (opt_rotation) { + var size = this.viewportSize_; + + if (opt_rotation) { + var w = size[0]; + var h = size[1]; + return [Math.abs(w * Math.cos(opt_rotation)) + Math.abs(h * Math.sin(opt_rotation)), Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation))]; + } else { + return size; + } + }; + /** + * Stores the viewport size on the view. The viewport size is not read every time from the DOM + * to avoid performance hit and layout reflow. + * This should be done on map size change. + * Note: the constraints are not resolved during an animation to avoid stopping it + * @param {import("./size.js").Size=} opt_size Viewport size; if undefined, [100, 100] is assumed + */ + + + View.prototype.setViewportSize = function (opt_size) { + this.viewportSize_ = Array.isArray(opt_size) ? opt_size.slice() : [100, 100]; + + if (!this.getAnimating()) { + this.resolveConstraints(0); + } + }; + /** + * Get the view center. + * @return {import("./coordinate.js").Coordinate|undefined} The center of the view. + * @observable + * @api + */ + + + View.prototype.getCenter = function () { + var center = this.getCenterInternal(); + + if (!center) { + return center; + } + + return (0, _proj.toUserCoordinate)(center, this.getProjection()); + }; + /** + * Get the view center without transforming to user projection. + * @return {import("./coordinate.js").Coordinate|undefined} The center of the view. + */ + + + View.prototype.getCenterInternal = function () { + return ( + /** @type {import("./coordinate.js").Coordinate|undefined} */ + this.get(_ViewProperty.default.CENTER) + ); + }; + /** + * @return {Constraints} Constraints. + */ + + + View.prototype.getConstraints = function () { + return this.constraints_; + }; + /** + * @return {boolean} Resolution constraint is set + */ + + + View.prototype.getConstrainResolution = function () { + return this.options_.constrainResolution; + }; + /** + * @param {Array<number>=} opt_hints Destination array. + * @return {Array<number>} Hint. + */ + + + View.prototype.getHints = function (opt_hints) { + if (opt_hints !== undefined) { + opt_hints[0] = this.hints_[0]; + opt_hints[1] = this.hints_[1]; + return opt_hints; + } else { + return this.hints_.slice(); + } + }; + /** + * Calculate the extent for the current view state and the passed size. + * The size is the pixel dimensions of the box into which the calculated extent + * should fit. In most cases you want to get the extent of the entire map, + * that is `map.getSize()`. + * @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size + * of the map that uses this view will be used. + * @return {import("./extent.js").Extent} Extent. + * @api + */ + + + View.prototype.calculateExtent = function (opt_size) { + var extent = this.calculateExtentInternal(opt_size); + return (0, _proj.toUserExtent)(extent, this.getProjection()); + }; + /** + * @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size of the + * first map that uses this view will be used. + * @return {import("./extent.js").Extent} Extent. + */ + + + View.prototype.calculateExtentInternal = function (opt_size) { + var size = opt_size || this.getViewportSize_(); + var center = + /** @type {!import("./coordinate.js").Coordinate} */ + this.getCenterInternal(); + (0, _asserts.assert)(center, 1); // The view center is not defined + + var resolution = + /** @type {!number} */ + this.getResolution(); + (0, _asserts.assert)(resolution !== undefined, 2); // The view resolution is not defined + + var rotation = + /** @type {!number} */ + this.getRotation(); + (0, _asserts.assert)(rotation !== undefined, 3); // The view rotation is not defined + + return (0, _extent.getForViewAndSize)(center, resolution, rotation, size); + }; + /** + * Get the maximum resolution of the view. + * @return {number} The maximum resolution of the view. + * @api + */ + + + View.prototype.getMaxResolution = function () { + return this.maxResolution_; + }; + /** + * Get the minimum resolution of the view. + * @return {number} The minimum resolution of the view. + * @api + */ + + + View.prototype.getMinResolution = function () { + return this.minResolution_; + }; + /** + * Get the maximum zoom level for the view. + * @return {number} The maximum zoom level. + * @api + */ + + + View.prototype.getMaxZoom = function () { + return ( + /** @type {number} */ + this.getZoomForResolution(this.minResolution_) + ); + }; + /** + * Set a new maximum zoom level for the view. + * @param {number} zoom The maximum zoom level. + * @api + */ + + + View.prototype.setMaxZoom = function (zoom) { + this.applyOptions_(this.getUpdatedOptions_({ + maxZoom: zoom + })); + }; + /** + * Get the minimum zoom level for the view. + * @return {number} The minimum zoom level. + * @api + */ + + + View.prototype.getMinZoom = function () { + return ( + /** @type {number} */ + this.getZoomForResolution(this.maxResolution_) + ); + }; + /** + * Set a new minimum zoom level for the view. + * @param {number} zoom The minimum zoom level. + * @api + */ + + + View.prototype.setMinZoom = function (zoom) { + this.applyOptions_(this.getUpdatedOptions_({ + minZoom: zoom + })); + }; + /** + * Set whether the view shoud allow intermediary zoom levels. + * @param {boolean} enabled Whether the resolution is constrained. + * @api + */ + + + View.prototype.setConstrainResolution = function (enabled) { + this.applyOptions_(this.getUpdatedOptions_({ + constrainResolution: enabled + })); + }; + /** + * Get the view projection. + * @return {import("./proj/Projection.js").default} The projection of the view. + * @api + */ + + + View.prototype.getProjection = function () { + return this.projection_; + }; + /** + * Get the view resolution. + * @return {number|undefined} The resolution of the view. + * @observable + * @api + */ + + + View.prototype.getResolution = function () { + return ( + /** @type {number|undefined} */ + this.get(_ViewProperty.default.RESOLUTION) + ); + }; + /** + * Get the resolutions for the view. This returns the array of resolutions + * passed to the constructor of the View, or undefined if none were given. + * @return {Array<number>|undefined} The resolutions of the view. + * @api + */ + + + View.prototype.getResolutions = function () { + return this.resolutions_; + }; + /** + * Get the resolution for a provided extent (in map units) and size (in pixels). + * @param {import("./extent.js").Extent} extent Extent. + * @param {import("./size.js").Size=} opt_size Box pixel size. + * @return {number} The resolution at which the provided extent will render at + * the given size. + * @api + */ + + + View.prototype.getResolutionForExtent = function (extent, opt_size) { + return this.getResolutionForExtentInternal((0, _proj.fromUserExtent)(extent, this.getProjection()), opt_size); + }; + /** + * Get the resolution for a provided extent (in map units) and size (in pixels). + * @param {import("./extent.js").Extent} extent Extent. + * @param {import("./size.js").Size=} opt_size Box pixel size. + * @return {number} The resolution at which the provided extent will render at + * the given size. + */ + + + View.prototype.getResolutionForExtentInternal = function (extent, opt_size) { + var size = opt_size || this.getViewportSize_(); + var xResolution = (0, _extent.getWidth)(extent) / size[0]; + var yResolution = (0, _extent.getHeight)(extent) / size[1]; + return Math.max(xResolution, yResolution); + }; + /** + * Return a function that returns a value between 0 and 1 for a + * resolution. Exponential scaling is assumed. + * @param {number=} opt_power Power. + * @return {function(number): number} Resolution for value function. + */ + + + View.prototype.getResolutionForValueFunction = function (opt_power) { + var power = opt_power || 2; + var maxResolution = this.getConstrainedResolution(this.maxResolution_); + var minResolution = this.minResolution_; + var max = Math.log(maxResolution / minResolution) / Math.log(power); + return ( + /** + * @param {number} value Value. + * @return {number} Resolution. + */ + function (value) { + var resolution = maxResolution / Math.pow(power, value * max); + return resolution; + } + ); + }; + /** + * Get the view rotation. + * @return {number} The rotation of the view in radians. + * @observable + * @api + */ + + + View.prototype.getRotation = function () { + return ( + /** @type {number} */ + this.get(_ViewProperty.default.ROTATION) + ); + }; + /** + * Return a function that returns a resolution for a value between + * 0 and 1. Exponential scaling is assumed. + * @param {number=} opt_power Power. + * @return {function(number): number} Value for resolution function. + */ + + + View.prototype.getValueForResolutionFunction = function (opt_power) { + var logPower = Math.log(opt_power || 2); + var maxResolution = this.getConstrainedResolution(this.maxResolution_); + var minResolution = this.minResolution_; + var max = Math.log(maxResolution / minResolution) / logPower; + return ( + /** + * @param {number} resolution Resolution. + * @return {number} Value. + */ + function (resolution) { + var value = Math.log(maxResolution / resolution) / logPower / max; + return value; + } + ); + }; + /** + * @return {State} View state. + */ + + + View.prototype.getState = function () { + var center = + /** @type {import("./coordinate.js").Coordinate} */ + this.getCenterInternal(); + var projection = this.getProjection(); + var resolution = + /** @type {number} */ + this.getResolution(); + var rotation = this.getRotation(); + return { + center: center.slice(0), + projection: projection !== undefined ? projection : null, + resolution: resolution, + rotation: rotation, + zoom: this.getZoom() + }; + }; + /** + * Get the current zoom level. This method may return non-integer zoom levels + * if the view does not constrain the resolution, or if an interaction or + * animation is underway. + * @return {number|undefined} Zoom. + * @api + */ + + + View.prototype.getZoom = function () { + var zoom; + var resolution = this.getResolution(); + + if (resolution !== undefined) { + zoom = this.getZoomForResolution(resolution); + } + + return zoom; + }; + /** + * Get the zoom level for a resolution. + * @param {number} resolution The resolution. + * @return {number|undefined} The zoom level for the provided resolution. + * @api + */ + + + View.prototype.getZoomForResolution = function (resolution) { + var offset = this.minZoom_ || 0; + var max, zoomFactor; + + if (this.resolutions_) { + var nearest = (0, _array.linearFindNearest)(this.resolutions_, resolution, 1); + offset = nearest; + max = this.resolutions_[nearest]; + + if (nearest == this.resolutions_.length - 1) { + zoomFactor = 2; + } else { + zoomFactor = max / this.resolutions_[nearest + 1]; + } + } else { + max = this.maxResolution_; + zoomFactor = this.zoomFactor_; + } + + return offset + Math.log(max / resolution) / Math.log(zoomFactor); + }; + /** + * Get the resolution for a zoom level. + * @param {number} zoom Zoom level. + * @return {number} The view resolution for the provided zoom level. + * @api + */ + + + View.prototype.getResolutionForZoom = function (zoom) { + if (this.resolutions_) { + if (this.resolutions_.length <= 1) { + return 0; + } + + var baseLevel = (0, _math.clamp)(Math.floor(zoom), 0, this.resolutions_.length - 2); + var zoomFactor = this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1]; + return this.resolutions_[baseLevel] / Math.pow(zoomFactor, (0, _math.clamp)(zoom - baseLevel, 0, 1)); + } else { + return this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_); + } + }; + /** + * Fit the given geometry or extent based on the given map size and border. + * The size is pixel dimensions of the box to fit the extent into. + * In most cases you will want to use the map size, that is `map.getSize()`. + * Takes care of the map angle. + * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or + * extent to fit the view to. + * @param {FitOptions=} opt_options Options. + * @api + */ + + + View.prototype.fit = function (geometryOrExtent, opt_options) { + var options = (0, _obj.assign)({ + size: this.getViewportSize_() + }, opt_options || {}); + /** @type {import("./geom/SimpleGeometry.js").default} */ + + var geometry; + (0, _asserts.assert)(Array.isArray(geometryOrExtent) || typeof + /** @type {?} */ + geometryOrExtent.getSimplifiedGeometry === 'function', 24); // Invalid extent or geometry provided as `geometry` + + if (Array.isArray(geometryOrExtent)) { + (0, _asserts.assert)(!(0, _extent.isEmpty)(geometryOrExtent), 25); // Cannot fit empty extent provided as `geometry` + + var extent = (0, _proj.fromUserExtent)(geometryOrExtent, this.getProjection()); + geometry = (0, _Polygon.fromExtent)(extent); + } else if (geometryOrExtent.getType() === _GeometryType.default.CIRCLE) { + var extent = (0, _proj.fromUserExtent)(geometryOrExtent.getExtent(), this.getProjection()); + geometry = (0, _Polygon.fromExtent)(extent); + geometry.rotate(this.getRotation(), (0, _extent.getCenter)(extent)); + } else { + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + geometry = + /** @type {import("./geom/SimpleGeometry.js").default} */ + geometryOrExtent.clone().transform(userProjection, this.getProjection()); + } else { + geometry = geometryOrExtent; + } + } + + this.fitInternal(geometry, options); + }; + /** + * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry. + * @param {FitOptions=} opt_options Options. + */ + + + View.prototype.fitInternal = function (geometry, opt_options) { + var options = opt_options || {}; + var size = options.size; + + if (!size) { + size = this.getViewportSize_(); + } + + var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0]; + var nearest = options.nearest !== undefined ? options.nearest : false; + var minResolution; + + if (options.minResolution !== undefined) { + minResolution = options.minResolution; + } else if (options.maxZoom !== undefined) { + minResolution = this.getResolutionForZoom(options.maxZoom); + } else { + minResolution = 0; + } + + var coords = geometry.getFlatCoordinates(); // calculate rotated extent + + var rotation = this.getRotation(); + var cosAngle = Math.cos(-rotation); + var sinAngle = Math.sin(-rotation); + var minRotX = +Infinity; + var minRotY = +Infinity; + var maxRotX = -Infinity; + var maxRotY = -Infinity; + var stride = geometry.getStride(); + + for (var i = 0, ii = coords.length; i < ii; i += stride) { + var rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle; + var rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle; + minRotX = Math.min(minRotX, rotX); + minRotY = Math.min(minRotY, rotY); + maxRotX = Math.max(maxRotX, rotX); + maxRotY = Math.max(maxRotY, rotY); + } // calculate resolution + + + var resolution = this.getResolutionForExtentInternal([minRotX, minRotY, maxRotX, maxRotY], [size[0] - padding[1] - padding[3], size[1] - padding[0] - padding[2]]); + resolution = isNaN(resolution) ? minResolution : Math.max(resolution, minResolution); + resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1); // calculate center + + sinAngle = -sinAngle; // go back to original rotation + + var centerRotX = (minRotX + maxRotX) / 2; + var centerRotY = (minRotY + maxRotY) / 2; + centerRotX += (padding[1] - padding[3]) / 2 * resolution; + centerRotY += (padding[0] - padding[2]) / 2 * resolution; + var centerX = centerRotX * cosAngle - centerRotY * sinAngle; + var centerY = centerRotY * cosAngle + centerRotX * sinAngle; + var center = [centerX, centerY]; + var callback = options.callback ? options.callback : _functions.VOID; + + if (options.duration !== undefined) { + this.animateInternal({ + resolution: resolution, + center: this.getConstrainedCenter(center, resolution), + duration: options.duration, + easing: options.easing + }, callback); + } else { + this.targetResolution_ = resolution; + this.targetCenter_ = center; + this.applyTargetState_(false, true); + animationCallback(callback, true); + } + }; + /** + * Center on coordinate and view position. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("./size.js").Size} size Box pixel size. + * @param {import("./pixel.js").Pixel} position Position on the view to center on. + * @api + */ + + + View.prototype.centerOn = function (coordinate, size, position) { + this.centerOnInternal((0, _proj.fromUserCoordinate)(coordinate, this.getProjection()), size, position); + }; + /** + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("./size.js").Size} size Box pixel size. + * @param {import("./pixel.js").Pixel} position Position on the view to center on. + */ + + + View.prototype.centerOnInternal = function (coordinate, size, position) { + // calculate rotated position + var rotation = this.getRotation(); + var cosAngle = Math.cos(-rotation); + var sinAngle = Math.sin(-rotation); + var rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle; + var rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle; + var resolution = this.getResolution(); + rotX += (size[0] / 2 - position[0]) * resolution; + rotY += (position[1] - size[1] / 2) * resolution; // go back to original angle + + sinAngle = -sinAngle; // go back to original rotation + + var centerX = rotX * cosAngle - rotY * sinAngle; + var centerY = rotY * cosAngle + rotX * sinAngle; + this.setCenterInternal([centerX, centerY]); + }; + /** + * @return {boolean} Is defined. + */ + + + View.prototype.isDef = function () { + return !!this.getCenterInternal() && this.getResolution() !== undefined; + }; + /** + * Adds relative coordinates to the center of the view. Any extent constraint will apply. + * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add. + * @api + */ + + + View.prototype.adjustCenter = function (deltaCoordinates) { + var center = (0, _proj.toUserCoordinate)(this.targetCenter_, this.getProjection()); + this.setCenter([center[0] + deltaCoordinates[0], center[1] + deltaCoordinates[1]]); + }; + /** + * Adds relative coordinates to the center of the view. Any extent constraint will apply. + * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add. + */ + + + View.prototype.adjustCenterInternal = function (deltaCoordinates) { + var center = this.targetCenter_; + this.setCenterInternal([center[0] + deltaCoordinates[0], center[1] + deltaCoordinates[1]]); + }; + /** + * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution + * constraint will apply. + * @param {number} ratio The ratio to apply on the view resolution. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. + * @api + */ + + + View.prototype.adjustResolution = function (ratio, opt_anchor) { + var anchor = opt_anchor && (0, _proj.fromUserCoordinate)(opt_anchor, this.getProjection()); + this.adjustResolutionInternal(ratio, anchor); + }; + /** + * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution + * constraint will apply. + * @param {number} ratio The ratio to apply on the view resolution. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. + */ + + + View.prototype.adjustResolutionInternal = function (ratio, opt_anchor) { + var isMoving = this.getAnimating() || this.getInteracting(); + var size = this.getViewportSize_(this.getRotation()); + var newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving); + + if (opt_anchor) { + this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor); + } + + this.targetResolution_ *= ratio; + this.applyTargetState_(); + }; + /** + * Adds a value to the view zoom level, optionally using an anchor. Any resolution + * constraint will apply. + * @param {number} delta Relative value to add to the zoom level. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. + * @api + */ + + + View.prototype.adjustZoom = function (delta, opt_anchor) { + this.adjustResolution(Math.pow(this.zoomFactor_, -delta), opt_anchor); + }; + /** + * Adds a value to the view rotation, optionally using an anchor. Any rotation + * constraint will apply. + * @param {number} delta Relative value to add to the zoom rotation, in radians. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center. + * @api + */ + + + View.prototype.adjustRotation = function (delta, opt_anchor) { + if (opt_anchor) { + opt_anchor = (0, _proj.fromUserCoordinate)(opt_anchor, this.getProjection()); + } + + this.adjustRotationInternal(delta, opt_anchor); + }; + /** + * @param {number} delta Relative value to add to the zoom rotation, in radians. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center. + */ + + + View.prototype.adjustRotationInternal = function (delta, opt_anchor) { + var isMoving = this.getAnimating() || this.getInteracting(); + var newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving); + + if (opt_anchor) { + this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor); + } + + this.targetRotation_ += delta; + this.applyTargetState_(); + }; + /** + * Set the center of the current view. Any extent constraint will apply. + * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view. + * @observable + * @api + */ + + + View.prototype.setCenter = function (center) { + this.setCenterInternal((0, _proj.fromUserCoordinate)(center, this.getProjection())); + }; + /** + * Set the center using the view projection (not the user projection). + * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view. + */ + + + View.prototype.setCenterInternal = function (center) { + this.targetCenter_ = center; + this.applyTargetState_(); + }; + /** + * @param {import("./ViewHint.js").default} hint Hint. + * @param {number} delta Delta. + * @return {number} New value. + */ + + + View.prototype.setHint = function (hint, delta) { + this.hints_[hint] += delta; + this.changed(); + return this.hints_[hint]; + }; + /** + * Set the resolution for this view. Any resolution constraint will apply. + * @param {number|undefined} resolution The resolution of the view. + * @observable + * @api + */ + + + View.prototype.setResolution = function (resolution) { + this.targetResolution_ = resolution; + this.applyTargetState_(); + }; + /** + * Set the rotation for this view. Any rotation constraint will apply. + * @param {number} rotation The rotation of the view in radians. + * @observable + * @api + */ + + + View.prototype.setRotation = function (rotation) { + this.targetRotation_ = rotation; + this.applyTargetState_(); + }; + /** + * Zoom to a specific zoom level. Any resolution constrain will apply. + * @param {number} zoom Zoom level. + * @api + */ + + + View.prototype.setZoom = function (zoom) { + this.setResolution(this.getResolutionForZoom(zoom)); + }; + /** + * Recompute rotation/resolution/center based on target values. + * Note: we have to compute rotation first, then resolution and center considering that + * parameters can influence one another in case a view extent constraint is present. + * @param {boolean=} opt_doNotCancelAnims Do not cancel animations. + * @param {boolean=} opt_forceMoving Apply constraints as if the view is moving. + * @private + */ + + + View.prototype.applyTargetState_ = function (opt_doNotCancelAnims, opt_forceMoving) { + var isMoving = this.getAnimating() || this.getInteracting() || opt_forceMoving; // compute rotation + + var newRotation = this.constraints_.rotation(this.targetRotation_, isMoving); + var size = this.getViewportSize_(newRotation); + var newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving); + var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving); + + if (this.get(_ViewProperty.default.ROTATION) !== newRotation) { + this.set(_ViewProperty.default.ROTATION, newRotation); + } + + if (this.get(_ViewProperty.default.RESOLUTION) !== newResolution) { + this.set(_ViewProperty.default.RESOLUTION, newResolution); + } + + if (!this.get(_ViewProperty.default.CENTER) || !(0, _coordinate.equals)(this.get(_ViewProperty.default.CENTER), newCenter)) { + this.set(_ViewProperty.default.CENTER, newCenter); + } + + if (this.getAnimating() && !opt_doNotCancelAnims) { + this.cancelAnimations(); + } + + this.cancelAnchor_ = undefined; + }; + /** + * If any constraints need to be applied, an animation will be triggered. + * This is typically done on interaction end. + * Note: calling this with a duration of 0 will apply the constrained values straight away, + * without animation. + * @param {number=} opt_duration The animation duration in ms. + * @param {number=} opt_resolutionDirection Which direction to zoom. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. + */ + + + View.prototype.resolveConstraints = function (opt_duration, opt_resolutionDirection, opt_anchor) { + var duration = opt_duration !== undefined ? opt_duration : 200; + var direction = opt_resolutionDirection || 0; + var newRotation = this.constraints_.rotation(this.targetRotation_); + var size = this.getViewportSize_(newRotation); + var newResolution = this.constraints_.resolution(this.targetResolution_, direction, size); + var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size); + + if (duration === 0 && !this.cancelAnchor_) { + this.targetResolution_ = newResolution; + this.targetRotation_ = newRotation; + this.targetCenter_ = newCenter; + this.applyTargetState_(); + return; + } + + var anchor = opt_anchor || (duration === 0 ? this.cancelAnchor_ : undefined); + this.cancelAnchor_ = undefined; + + if (this.getResolution() !== newResolution || this.getRotation() !== newRotation || !this.getCenterInternal() || !(0, _coordinate.equals)(this.getCenterInternal(), newCenter)) { + if (this.getAnimating()) { + this.cancelAnimations(); + } + + this.animateInternal({ + rotation: newRotation, + center: newCenter, + resolution: newResolution, + duration: duration, + easing: _easing.easeOut, + anchor: anchor + }); + } + }; + /** + * Notify the View that an interaction has started. + * The view state will be resolved to a stable one if needed + * (depending on its constraints). + * @api + */ + + + View.prototype.beginInteraction = function () { + this.resolveConstraints(0); + this.setHint(_ViewHint.default.INTERACTING, 1); + }; + /** + * Notify the View that an interaction has ended. The view state will be resolved + * to a stable one if needed (depending on its constraints). + * @param {number=} opt_duration Animation duration in ms. + * @param {number=} opt_resolutionDirection Which direction to zoom. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. + * @api + */ + + + View.prototype.endInteraction = function (opt_duration, opt_resolutionDirection, opt_anchor) { + var anchor = opt_anchor && (0, _proj.fromUserCoordinate)(opt_anchor, this.getProjection()); + this.endInteractionInternal(opt_duration, opt_resolutionDirection, anchor); + }; + /** + * Notify the View that an interaction has ended. The view state will be resolved + * to a stable one if needed (depending on its constraints). + * @param {number=} opt_duration Animation duration in ms. + * @param {number=} opt_resolutionDirection Which direction to zoom. + * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation. + */ + + + View.prototype.endInteractionInternal = function (opt_duration, opt_resolutionDirection, opt_anchor) { + this.setHint(_ViewHint.default.INTERACTING, -1); + this.resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor); + }; + /** + * Get a valid position for the view center according to the current constraints. + * @param {import("./coordinate.js").Coordinate|undefined} targetCenter Target center position. + * @param {number=} opt_targetResolution Target resolution. If not supplied, the current one will be used. + * This is useful to guess a valid center position at a different zoom level. + * @return {import("./coordinate.js").Coordinate|undefined} Valid center position. + */ + + + View.prototype.getConstrainedCenter = function (targetCenter, opt_targetResolution) { + var size = this.getViewportSize_(this.getRotation()); + return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size); + }; + /** + * Get a valid zoom level according to the current view constraints. + * @param {number|undefined} targetZoom Target zoom. + * @param {number=} [opt_direction=0] Indicate which resolution should be used + * by a renderer if the view resolution does not match any resolution of the tile source. + * If 0, the nearest resolution will be used. If 1, the nearest lower resolution + * will be used. If -1, the nearest higher resolution will be used. + * @return {number|undefined} Valid zoom level. + */ + + + View.prototype.getConstrainedZoom = function (targetZoom, opt_direction) { + var targetRes = this.getResolutionForZoom(targetZoom); + return this.getZoomForResolution(this.getConstrainedResolution(targetRes, opt_direction)); + }; + /** + * Get a valid resolution according to the current view constraints. + * @param {number|undefined} targetResolution Target resolution. + * @param {number=} [opt_direction=0] Indicate which resolution should be used + * by a renderer if the view resolution does not match any resolution of the tile source. + * If 0, the nearest resolution will be used. If 1, the nearest lower resolution + * will be used. If -1, the nearest higher resolution will be used. + * @return {number|undefined} Valid resolution. + */ + + + View.prototype.getConstrainedResolution = function (targetResolution, opt_direction) { + var direction = opt_direction || 0; + var size = this.getViewportSize_(this.getRotation()); + return this.constraints_.resolution(targetResolution, direction, size); + }; + + return View; +}(_Object.default); +/** + * @param {Function} callback Callback. + * @param {*} returnValue Return value. + */ + + +function animationCallback(callback, returnValue) { + setTimeout(function () { + callback(returnValue); + }, 0); +} +/** + * @param {ViewOptions} options View options. + * @return {import("./centerconstraint.js").Type} The constraint. + */ + + +function createCenterConstraint(options) { + if (options.extent !== undefined) { + var smooth = options.smoothExtentConstraint !== undefined ? options.smoothExtentConstraint : true; + return (0, _centerconstraint.createExtent)(options.extent, options.constrainOnlyCenter, smooth); + } + + var projection = (0, _proj.createProjection)(options.projection, 'EPSG:3857'); + + if (options.multiWorld !== true && projection.isGlobal()) { + var extent = projection.getExtent().slice(); + extent[0] = -Infinity; + extent[2] = Infinity; + return (0, _centerconstraint.createExtent)(extent, false, false); + } + + return _centerconstraint.none; +} +/** + * @param {ViewOptions} options View options. + * @return {{constraint: import("./resolutionconstraint.js").Type, maxResolution: number, + * minResolution: number, minZoom: number, zoomFactor: number}} The constraint. + */ + + +function createResolutionConstraint(options) { + var resolutionConstraint; + var maxResolution; + var minResolution; // TODO: move these to be ol constants + // see https://github.com/openlayers/openlayers/issues/2076 + + var defaultMaxZoom = 28; + var defaultZoomFactor = 2; + var minZoom = options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM; + var maxZoom = options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom; + var zoomFactor = options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor; + var multiWorld = options.multiWorld !== undefined ? options.multiWorld : false; + var smooth = options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true; + var showFullExtent = options.showFullExtent !== undefined ? options.showFullExtent : false; + var projection = (0, _proj.createProjection)(options.projection, 'EPSG:3857'); + var projExtent = projection.getExtent(); + var constrainOnlyCenter = options.constrainOnlyCenter; + var extent = options.extent; + + if (!multiWorld && !extent && projection.isGlobal()) { + constrainOnlyCenter = false; + extent = projExtent; + } + + if (options.resolutions !== undefined) { + var resolutions = options.resolutions; + maxResolution = resolutions[minZoom]; + minResolution = resolutions[maxZoom] !== undefined ? resolutions[maxZoom] : resolutions[resolutions.length - 1]; + + if (options.constrainResolution) { + resolutionConstraint = (0, _resolutionconstraint.createSnapToResolutions)(resolutions, smooth, !constrainOnlyCenter && extent, showFullExtent); + } else { + resolutionConstraint = (0, _resolutionconstraint.createMinMaxResolution)(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent); + } + } else { + // calculate the default min and max resolution + var size = !projExtent ? // use an extent that can fit the whole world if need be + 360 * _proj.METERS_PER_UNIT[_Units.default.DEGREES] / projection.getMetersPerUnit() : Math.max((0, _extent.getWidth)(projExtent), (0, _extent.getHeight)(projExtent)); + var defaultMaxResolution = size / _common.DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM); + var defaultMinResolution = defaultMaxResolution / Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM); // user provided maxResolution takes precedence + + maxResolution = options.maxResolution; + + if (maxResolution !== undefined) { + minZoom = 0; + } else { + maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom); + } // user provided minResolution takes precedence + + + minResolution = options.minResolution; + + if (minResolution === undefined) { + if (options.maxZoom !== undefined) { + if (options.maxResolution !== undefined) { + minResolution = maxResolution / Math.pow(zoomFactor, maxZoom); + } else { + minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom); + } + } else { + minResolution = defaultMinResolution; + } + } // given discrete zoom levels, minResolution may be different than provided + + + maxZoom = minZoom + Math.floor(Math.log(maxResolution / minResolution) / Math.log(zoomFactor)); + minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom); + + if (options.constrainResolution) { + resolutionConstraint = (0, _resolutionconstraint.createSnapToPower)(zoomFactor, maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent); + } else { + resolutionConstraint = (0, _resolutionconstraint.createMinMaxResolution)(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent); + } + } + + return { + constraint: resolutionConstraint, + maxResolution: maxResolution, + minResolution: minResolution, + minZoom: minZoom, + zoomFactor: zoomFactor + }; +} +/** + * @param {ViewOptions} options View options. + * @return {import("./rotationconstraint.js").Type} Rotation constraint. + */ + + +function createRotationConstraint(options) { + var enableRotation = options.enableRotation !== undefined ? options.enableRotation : true; + + if (enableRotation) { + var constrainRotation = options.constrainRotation; + + if (constrainRotation === undefined || constrainRotation === true) { + return (0, _rotationconstraint.createSnapToZero)(); + } else if (constrainRotation === false) { + return _rotationconstraint.none; + } else if (typeof constrainRotation === 'number') { + return (0, _rotationconstraint.createSnapToN)(constrainRotation); + } else { + return _rotationconstraint.none; + } + } else { + return _rotationconstraint.disable; + } +} +/** + * Determine if an animation involves no view change. + * @param {Animation} animation The animation. + * @return {boolean} The animation involves no view change. + */ + + +function isNoopAnimation(animation) { + if (animation.sourceCenter && animation.targetCenter) { + if (!(0, _coordinate.equals)(animation.sourceCenter, animation.targetCenter)) { + return false; + } + } + + if (animation.sourceResolution !== animation.targetResolution) { + return false; + } + + if (animation.sourceRotation !== animation.targetRotation) { + return false; + } + + return true; +} + +var _default = View; +exports.default = _default; +},{"./Object.js":"../../../node_modules/ol/Object.js","./geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./proj/Units.js":"../../../node_modules/ol/proj/Units.js","./ViewHint.js":"../../../node_modules/ol/ViewHint.js","./ViewProperty.js":"../../../node_modules/ol/ViewProperty.js","./tilegrid/common.js":"../../../node_modules/ol/tilegrid/common.js","./proj.js":"../../../node_modules/ol/proj.js","./functions.js":"../../../node_modules/ol/functions.js","./coordinate.js":"../../../node_modules/ol/coordinate.js","./asserts.js":"../../../node_modules/ol/asserts.js","./obj.js":"../../../node_modules/ol/obj.js","./centerconstraint.js":"../../../node_modules/ol/centerconstraint.js","./math.js":"../../../node_modules/ol/math.js","./resolutionconstraint.js":"../../../node_modules/ol/resolutionconstraint.js","./rotationconstraint.js":"../../../node_modules/ol/rotationconstraint.js","./easing.js":"../../../node_modules/ol/easing.js","./extent.js":"../../../node_modules/ol/extent.js","./array.js":"../../../node_modules/ol/array.js","./geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js"}],"../../../node_modules/ol/PluggableMap.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Object = _interopRequireWildcard(require("./Object.js")); + +var _Collection = _interopRequireDefault(require("./Collection.js")); + +var _CollectionEventType = _interopRequireDefault(require("./CollectionEventType.js")); + +var _EventType = _interopRequireDefault(require("./events/EventType.js")); + +var _Group = _interopRequireDefault(require("./layer/Group.js")); + +var _MapBrowserEvent = _interopRequireDefault(require("./MapBrowserEvent.js")); + +var _MapBrowserEventHandler = _interopRequireDefault(require("./MapBrowserEventHandler.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("./MapBrowserEventType.js")); + +var _MapEvent = _interopRequireDefault(require("./MapEvent.js")); + +var _MapEventType = _interopRequireDefault(require("./MapEventType.js")); + +var _MapProperty = _interopRequireDefault(require("./MapProperty.js")); + +var _ObjectEventType = _interopRequireDefault(require("./ObjectEventType.js")); + +var _EventType2 = _interopRequireDefault(require("./pointer/EventType.js")); + +var _EventType3 = _interopRequireDefault(require("./render/EventType.js")); + +var _TileQueue = _interopRequireWildcard(require("./TileQueue.js")); + +var _View = _interopRequireDefault(require("./View.js")); + +var _ViewHint = _interopRequireDefault(require("./ViewHint.js")); + +var _has = require("./has.js"); + +var _functions = require("./functions.js"); + +var _transform = require("./transform.js"); + +var _asserts = require("./asserts.js"); + +var _extent = require("./extent.js"); + +var _proj = require("./proj.js"); + +var _size = require("./size.js"); + +var _events = require("./events.js"); + +var _dom = require("./dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/PluggableMap + */ + + +/** + * State of the current frame. Only `pixelRatio`, `time` and `viewState` should + * be used in applications. + * @typedef {Object} FrameState + * @property {number} pixelRatio The pixel ratio of the frame. + * @property {number} time The time when rendering of the frame was requested. + * @property {import("./View.js").State} viewState The state of the current view. + * @property {boolean} animate + * @property {import("./transform.js").Transform} coordinateToPixelTransform + * @property {null|import("./extent.js").Extent} extent + * @property {Array<DeclutterItems>} declutterItems + * @property {number} index + * @property {Array<import("./layer/Layer.js").State>} layerStatesArray + * @property {number} layerIndex + * @property {import("./transform.js").Transform} pixelToCoordinateTransform + * @property {Array<PostRenderFunction>} postRenderFunctions + * @property {import("./size.js").Size} size + * @property {TileQueue} tileQueue + * @property {!Object<string, Object<string, boolean>>} usedTiles + * @property {Array<number>} viewHints + * @property {!Object<string, Object<string, boolean>>} wantedTiles + */ + +/** + * @typedef {Object} DeclutterItems + * @property {Array<*>} items Declutter items of an executor. + * @property {number} opacity Layer opacity. + */ + +/** + * @typedef {function(PluggableMap, ?FrameState): any} PostRenderFunction + */ + +/** + * @typedef {Object} AtPixelOptions + * @property {undefined|function(import("./layer/Layer.js").default): boolean} [layerFilter] Layer filter + * function. The filter function will receive one argument, the + * {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value. + * Only layers which are visible and for which this function returns `true` + * will be tested for features. By default, all visible layers will be tested. + * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels + * inside the radius around the given position will be checked for features. + * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for for wrapped geometries inside the range of + * +/- 1 world width. Works only if a projection is used that can be wrapped. + */ + +/** + * @typedef {Object} MapOptionsInternal + * @property {Collection<import("./control/Control.js").default>} [controls] + * @property {Collection<import("./interaction/Interaction.js").default>} [interactions] + * @property {HTMLElement|Document} keyboardEventTarget + * @property {Collection<import("./Overlay.js").default>} overlays + * @property {Object<string, *>} values + */ + +/** + * Object literal with config options for the map. + * @typedef {Object} MapOptions + * @property {Collection<import("./control/Control.js").default>|Array<import("./control/Control.js").default>} [controls] + * Controls initially added to the map. If not specified, + * {@link module:ol/control~defaults} is used. + * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between + * physical pixels and device-independent pixels (dips) on the device. + * @property {Collection<import("./interaction/Interaction.js").default>|Array<import("./interaction/Interaction.js").default>} [interactions] + * Interactions that are initially added to the map. If not specified, + * {@link module:ol/interaction~defaults} is used. + * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to + * listen to keyboard events on. This determines when the `KeyboardPan` and + * `KeyboardZoom` interactions trigger. For example, if this option is set to + * `document` the keyboard interactions will always trigger. If this option is + * not specified, the element the library listens to keyboard events on is the + * map target (i.e. the user-provided div for the map). If this is not + * `document`, the target element needs to be focused for key events to be + * emitted, requiring that the target element has a `tabindex` attribute. + * @property {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>|LayerGroup} [layers] + * Layers. If this is not defined, a map with no layers will be rendered. Note + * that layers are rendered in the order supplied, so if you want, for example, + * a vector layer to appear on top of a tile layer, it must come after the tile + * layer. + * @property {number} [maxTilesLoading=16] Maximum number tiles to load + * simultaneously. + * @property {number} [moveTolerance=1] The minimum distance in pixels the + * cursor must move to be detected as a map move event instead of a click. + * Increasing this value can make it easier to click on the map. + * @property {Collection<import("./Overlay.js").default>|Array<import("./Overlay.js").default>} [overlays] + * Overlays initially added to the map. By default, no overlays are added. + * @property {HTMLElement|string} [target] The container for the map, either the + * element itself or the `id` of the element. If not specified at construction + * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be + * rendered. + * @property {View} [view] The map's view. No layer sources will be + * fetched unless this is specified at construction time or through + * {@link module:ol/Map~Map#setView}. + */ + +/** + * @fires import("./MapBrowserEvent.js").MapBrowserEvent + * @fires import("./MapEvent.js").MapEvent + * @fires import("./render/Event.js").default#precompose + * @fires import("./render/Event.js").default#postcompose + * @fires import("./render/Event.js").default#rendercomplete + * @api + */ +var PluggableMap = +/** @class */ +function (_super) { + __extends(PluggableMap, _super); + /** + * @param {MapOptions} options Map options. + */ + + + function PluggableMap(options) { + var _this = _super.call(this) || this; + + var optionsInternal = createOptionsInternal(options); + /** @private */ + + _this.boundHandleBrowserEvent_ = _this.handleBrowserEvent.bind(_this); + /** + * @type {number} + * @private + */ + + _this.maxTilesLoading_ = options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16; + /** + * @private + * @type {number} + */ + + _this.pixelRatio_ = options.pixelRatio !== undefined ? options.pixelRatio : _has.DEVICE_PIXEL_RATIO; + /** + * @private + * @type {*} + */ + + _this.postRenderTimeoutHandle_; + /** + * @private + * @type {number|undefined} + */ + + _this.animationDelayKey_; + /** + * @private + */ + + _this.animationDelay_ = function () { + this.animationDelayKey_ = undefined; + this.renderFrame_(Date.now()); + }.bind(_this); + /** + * @private + * @type {import("./transform.js").Transform} + */ + + + _this.coordinateToPixelTransform_ = (0, _transform.create)(); + /** + * @private + * @type {import("./transform.js").Transform} + */ + + _this.pixelToCoordinateTransform_ = (0, _transform.create)(); + /** + * @private + * @type {number} + */ + + _this.frameIndex_ = 0; + /** + * @private + * @type {?FrameState} + */ + + _this.frameState_ = null; + /** + * The extent at the previous 'moveend' event. + * @private + * @type {import("./extent.js").Extent} + */ + + _this.previousExtent_ = null; + /** + * @private + * @type {?import("./events.js").EventsKey} + */ + + _this.viewPropertyListenerKey_ = null; + /** + * @private + * @type {?import("./events.js").EventsKey} + */ + + _this.viewChangeListenerKey_ = null; + /** + * @private + * @type {?Array<import("./events.js").EventsKey>} + */ + + _this.layerGroupPropertyListenerKeys_ = null; + /** + * @private + * @type {!HTMLElement} + */ + + _this.viewport_ = document.createElement('div'); + _this.viewport_.className = 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : ''); + _this.viewport_.style.position = 'relative'; + _this.viewport_.style.overflow = 'hidden'; + _this.viewport_.style.width = '100%'; + _this.viewport_.style.height = '100%'; + /** + * @private + * @type {!HTMLElement} + */ + + _this.overlayContainer_ = document.createElement('div'); + _this.overlayContainer_.style.position = 'absolute'; + _this.overlayContainer_.style.zIndex = '0'; + _this.overlayContainer_.style.width = '100%'; + _this.overlayContainer_.style.height = '100%'; + _this.overlayContainer_.style.pointerEvents = 'none'; + _this.overlayContainer_.className = 'ol-overlaycontainer'; + + _this.viewport_.appendChild(_this.overlayContainer_); + /** + * @private + * @type {!HTMLElement} + */ + + + _this.overlayContainerStopEvent_ = document.createElement('div'); + _this.overlayContainerStopEvent_.style.position = 'absolute'; + _this.overlayContainerStopEvent_.style.zIndex = '0'; + _this.overlayContainerStopEvent_.style.width = '100%'; + _this.overlayContainerStopEvent_.style.height = '100%'; + _this.overlayContainerStopEvent_.style.pointerEvents = 'none'; + _this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent'; + + _this.viewport_.appendChild(_this.overlayContainerStopEvent_); + /** + * @private + * @type {MapBrowserEventHandler} + */ + + + _this.mapBrowserEventHandler_ = null; + /** + * @private + * @type {number} + */ + + _this.moveTolerance_ = options.moveTolerance; + /** + * @private + * @type {HTMLElement|Document} + */ + + _this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget; + /** + * @private + * @type {?Array<import("./events.js").EventsKey>} + */ + + _this.keyHandlerKeys_ = null; + /** + * @type {Collection<import("./control/Control.js").default>} + * @protected + */ + + _this.controls = optionsInternal.controls || new _Collection.default(); + /** + * @type {Collection<import("./interaction/Interaction.js").default>} + * @protected + */ + + _this.interactions = optionsInternal.interactions || new _Collection.default(); + /** + * @type {Collection<import("./Overlay.js").default>} + * @private + */ + + _this.overlays_ = optionsInternal.overlays; + /** + * A lookup of overlays by id. + * @private + * @type {Object<string, import("./Overlay.js").default>} + */ + + _this.overlayIdIndex_ = {}; + /** + * @type {import("./renderer/Map.js").default} + * @private + */ + + _this.renderer_ = null; + /** + * @type {undefined|function(Event): void} + * @private + */ + + _this.handleResize_; + /** + * @private + * @type {!Array<PostRenderFunction>} + */ + + _this.postRenderFunctions_ = []; + /** + * @private + * @type {TileQueue} + */ + + _this.tileQueue_ = new _TileQueue.default(_this.getTilePriority.bind(_this), _this.handleTileChange_.bind(_this)); + + _this.addEventListener((0, _Object.getChangeEventType)(_MapProperty.default.LAYERGROUP), _this.handleLayerGroupChanged_); + + _this.addEventListener((0, _Object.getChangeEventType)(_MapProperty.default.VIEW), _this.handleViewChanged_); + + _this.addEventListener((0, _Object.getChangeEventType)(_MapProperty.default.SIZE), _this.handleSizeChanged_); + + _this.addEventListener((0, _Object.getChangeEventType)(_MapProperty.default.TARGET), _this.handleTargetChanged_); // setProperties will trigger the rendering of the map if the map + // is "defined" already. + + + _this.setProperties(optionsInternal.values); + + _this.controls.forEach( + /** + * @param {import("./control/Control.js").default} control Control. + * @this {PluggableMap} + */ + function (control) { + control.setMap(this); + }.bind(_this)); + + _this.controls.addEventListener(_CollectionEventType.default.ADD, + /** + * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. + */ + function (event) { + event.element.setMap(this); + }.bind(_this)); + + _this.controls.addEventListener(_CollectionEventType.default.REMOVE, + /** + * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. + */ + function (event) { + event.element.setMap(null); + }.bind(_this)); + + _this.interactions.forEach( + /** + * @param {import("./interaction/Interaction.js").default} interaction Interaction. + * @this {PluggableMap} + */ + function (interaction) { + interaction.setMap(this); + }.bind(_this)); + + _this.interactions.addEventListener(_CollectionEventType.default.ADD, + /** + * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. + */ + function (event) { + event.element.setMap(this); + }.bind(_this)); + + _this.interactions.addEventListener(_CollectionEventType.default.REMOVE, + /** + * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. + */ + function (event) { + event.element.setMap(null); + }.bind(_this)); + + _this.overlays_.forEach(_this.addOverlayInternal_.bind(_this)); + + _this.overlays_.addEventListener(_CollectionEventType.default.ADD, + /** + * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. + */ + function (event) { + this.addOverlayInternal_( + /** @type {import("./Overlay.js").default} */ + event.element); + }.bind(_this)); + + _this.overlays_.addEventListener(_CollectionEventType.default.REMOVE, + /** + * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. + */ + function (event) { + var overlay = + /** @type {import("./Overlay.js").default} */ + event.element; + var id = overlay.getId(); + + if (id !== undefined) { + delete this.overlayIdIndex_[id.toString()]; + } + + event.element.setMap(null); + }.bind(_this)); + + return _this; + } + /** + * @abstract + * @return {import("./renderer/Map.js").default} The map renderer + */ + + + PluggableMap.prototype.createRenderer = function () { + throw new Error('Use a map type that has a createRenderer method'); + }; + /** + * Add the given control to the map. + * @param {import("./control/Control.js").default} control Control. + * @api + */ + + + PluggableMap.prototype.addControl = function (control) { + this.getControls().push(control); + }; + /** + * Add the given interaction to the map. If you want to add an interaction + * at another point of the collection use `getInteraction()` and the methods + * available on {@link module:ol/Collection~Collection}. This can be used to + * stop the event propagation from the handleEvent function. The interactions + * get to handle the events in the reverse order of this collection. + * @param {import("./interaction/Interaction.js").default} interaction Interaction to add. + * @api + */ + + + PluggableMap.prototype.addInteraction = function (interaction) { + this.getInteractions().push(interaction); + }; + /** + * Adds the given layer to the top of this map. If you want to add a layer + * elsewhere in the stack, use `getLayers()` and the methods available on + * {@link module:ol/Collection~Collection}. + * @param {import("./layer/Base.js").default} layer Layer. + * @api + */ + + + PluggableMap.prototype.addLayer = function (layer) { + var layers = this.getLayerGroup().getLayers(); + layers.push(layer); + }; + /** + * Add the given overlay to the map. + * @param {import("./Overlay.js").default} overlay Overlay. + * @api + */ + + + PluggableMap.prototype.addOverlay = function (overlay) { + this.getOverlays().push(overlay); + }; + /** + * This deals with map's overlay collection changes. + * @param {import("./Overlay.js").default} overlay Overlay. + * @private + */ + + + PluggableMap.prototype.addOverlayInternal_ = function (overlay) { + var id = overlay.getId(); + + if (id !== undefined) { + this.overlayIdIndex_[id.toString()] = overlay; + } + + overlay.setMap(this); + }; + /** + * + * Clean up. + */ + + + PluggableMap.prototype.disposeInternal = function () { + this.setTarget(null); + + _super.prototype.disposeInternal.call(this); + }; + /** + * Detect features that intersect a pixel on the viewport, and execute a + * callback with each intersecting feature. Layers included in the detection can + * be configured through the `layerFilter` option in `opt_options`. + * @param {import("./pixel.js").Pixel} pixel Pixel. + * @param {function(this: S, import("./Feature.js").FeatureLike, + * import("./layer/Layer.js").default): T} callback Feature callback. The callback will be + * called with two arguments. The first argument is one + * {@link module:ol/Feature feature} or + * {@link module:ol/render/Feature render feature} at the pixel, the second is + * the {@link module:ol/layer/Layer layer} of the feature and will be null for + * unmanaged layers. To stop detection, callback functions can return a + * truthy value. + * @param {AtPixelOptions=} opt_options Optional options. + * @return {T|undefined} Callback result, i.e. the return value of last + * callback execution, or the first truthy callback return value. + * @template S,T + * @api + */ + + + PluggableMap.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options) { + if (!this.frameState_) { + return; + } + + var coordinate = this.getCoordinateFromPixelInternal(pixel); + opt_options = opt_options !== undefined ? opt_options : {}; + var hitTolerance = opt_options.hitTolerance !== undefined ? opt_options.hitTolerance * this.frameState_.pixelRatio : 0; + var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : _functions.TRUE; + var checkWrapped = opt_options.checkWrapped !== false; + return this.renderer_.forEachFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, callback, null, layerFilter, null); + }; + /** + * Get all features that intersect a pixel on the viewport. + * @param {import("./pixel.js").Pixel} pixel Pixel. + * @param {AtPixelOptions=} opt_options Optional options. + * @return {Array<import("./Feature.js").FeatureLike>} The detected features or + * an empty array if none were found. + * @api + */ + + + PluggableMap.prototype.getFeaturesAtPixel = function (pixel, opt_options) { + var features = []; + this.forEachFeatureAtPixel(pixel, function (feature) { + features.push(feature); + }, opt_options); + return features; + }; + /** + * Detect layers that have a color value at a pixel on the viewport, and + * execute a callback with each matching layer. Layers included in the + * detection can be configured through `opt_layerFilter`. + * + * Note: this may give false positives unless the map layers have had different `className` + * properties assigned to them. + * + * @param {import("./pixel.js").Pixel} pixel Pixel. + * @param {function(this: S, import("./layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback + * Layer callback. This callback will receive two arguments: first is the + * {@link module:ol/layer/Layer layer}, second argument is an array representing + * [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types + * that do not currently support this argument. To stop detection, callback + * functions can return a truthy value. + * @param {AtPixelOptions=} opt_options Configuration options. + * @return {T|undefined} Callback result, i.e. the return value of last + * callback execution, or the first truthy callback return value. + * @template S,T + * @api + */ + + + PluggableMap.prototype.forEachLayerAtPixel = function (pixel, callback, opt_options) { + if (!this.frameState_) { + return; + } + + var options = opt_options || {}; + var hitTolerance = options.hitTolerance !== undefined ? options.hitTolerance * this.frameState_.pixelRatio : 0; + var layerFilter = options.layerFilter || _functions.TRUE; + return this.renderer_.forEachLayerAtPixel(pixel, this.frameState_, hitTolerance, callback, layerFilter); + }; + /** + * Detect if features intersect a pixel on the viewport. Layers included in the + * detection can be configured through `opt_layerFilter`. + * @param {import("./pixel.js").Pixel} pixel Pixel. + * @param {AtPixelOptions=} opt_options Optional options. + * @return {boolean} Is there a feature at the given pixel? + * @api + */ + + + PluggableMap.prototype.hasFeatureAtPixel = function (pixel, opt_options) { + if (!this.frameState_) { + return false; + } + + var coordinate = this.getCoordinateFromPixelInternal(pixel); + opt_options = opt_options !== undefined ? opt_options : {}; + var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : _functions.TRUE; + var hitTolerance = opt_options.hitTolerance !== undefined ? opt_options.hitTolerance * this.frameState_.pixelRatio : 0; + var checkWrapped = opt_options.checkWrapped !== false; + return this.renderer_.hasFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, layerFilter, null); + }; + /** + * Returns the coordinate in user projection for a browser event. + * @param {MouseEvent} event Event. + * @return {import("./coordinate.js").Coordinate} Coordinate. + * @api + */ + + + PluggableMap.prototype.getEventCoordinate = function (event) { + return this.getCoordinateFromPixel(this.getEventPixel(event)); + }; + /** + * Returns the coordinate in view projection for a browser event. + * @param {MouseEvent} event Event. + * @return {import("./coordinate.js").Coordinate} Coordinate. + */ + + + PluggableMap.prototype.getEventCoordinateInternal = function (event) { + return this.getCoordinateFromPixelInternal(this.getEventPixel(event)); + }; + /** + * Returns the map pixel position for a browser event relative to the viewport. + * @param {UIEvent} event Event. + * @return {import("./pixel.js").Pixel} Pixel. + * @api + */ + + + PluggableMap.prototype.getEventPixel = function (event) { + var viewportPosition = this.viewport_.getBoundingClientRect(); + var eventPosition = //FIXME Are we really calling this with a TouchEvent anywhere? + 'changedTouches' in event ? + /** @type {TouchEvent} */ + event.changedTouches[0] : + /** @type {MouseEvent} */ + event; + return [eventPosition.clientX - viewportPosition.left, eventPosition.clientY - viewportPosition.top]; + }; + /** + * Get the target in which this map is rendered. + * Note that this returns what is entered as an option or in setTarget: + * if that was an element, it returns an element; if a string, it returns that. + * @return {HTMLElement|string|undefined} The Element or id of the Element that the + * map is rendered in. + * @observable + * @api + */ + + + PluggableMap.prototype.getTarget = function () { + return ( + /** @type {HTMLElement|string|undefined} */ + this.get(_MapProperty.default.TARGET) + ); + }; + /** + * Get the DOM element into which this map is rendered. In contrast to + * `getTarget` this method always return an `Element`, or `null` if the + * map has no target. + * @return {HTMLElement} The element that the map is rendered in. + * @api + */ + + + PluggableMap.prototype.getTargetElement = function () { + var target = this.getTarget(); + + if (target !== undefined) { + return typeof target === 'string' ? document.getElementById(target) : target; + } else { + return null; + } + }; + /** + * Get the coordinate for a given pixel. This returns a coordinate in the + * user projection. + * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport. + * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position. + * @api + */ + + + PluggableMap.prototype.getCoordinateFromPixel = function (pixel) { + return (0, _proj.toUserCoordinate)(this.getCoordinateFromPixelInternal(pixel), this.getView().getProjection()); + }; + /** + * Get the coordinate for a given pixel. This returns a coordinate in the + * map view projection. + * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport. + * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position. + */ + + + PluggableMap.prototype.getCoordinateFromPixelInternal = function (pixel) { + var frameState = this.frameState_; + + if (!frameState) { + return null; + } else { + return (0, _transform.apply)(frameState.pixelToCoordinateTransform, pixel.slice()); + } + }; + /** + * Get the map controls. Modifying this collection changes the controls + * associated with the map. + * @return {Collection<import("./control/Control.js").default>} Controls. + * @api + */ + + + PluggableMap.prototype.getControls = function () { + return this.controls; + }; + /** + * Get the map overlays. Modifying this collection changes the overlays + * associated with the map. + * @return {Collection<import("./Overlay.js").default>} Overlays. + * @api + */ + + + PluggableMap.prototype.getOverlays = function () { + return this.overlays_; + }; + /** + * Get an overlay by its identifier (the value returned by overlay.getId()). + * Note that the index treats string and numeric identifiers as the same. So + * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`. + * @param {string|number} id Overlay identifier. + * @return {import("./Overlay.js").default} Overlay. + * @api + */ + + + PluggableMap.prototype.getOverlayById = function (id) { + var overlay = this.overlayIdIndex_[id.toString()]; + return overlay !== undefined ? overlay : null; + }; + /** + * Get the map interactions. Modifying this collection changes the interactions + * associated with the map. + * + * Interactions are used for e.g. pan, zoom and rotate. + * @return {Collection<import("./interaction/Interaction.js").default>} Interactions. + * @api + */ + + + PluggableMap.prototype.getInteractions = function () { + return this.interactions; + }; + /** + * Get the layergroup associated with this map. + * @return {LayerGroup} A layer group containing the layers in this map. + * @observable + * @api + */ + + + PluggableMap.prototype.getLayerGroup = function () { + return ( + /** @type {LayerGroup} */ + this.get(_MapProperty.default.LAYERGROUP) + ); + }; + /** + * Get the collection of layers associated with this map. + * @return {!Collection<import("./layer/Base.js").default>} Layers. + * @api + */ + + + PluggableMap.prototype.getLayers = function () { + var layers = this.getLayerGroup().getLayers(); + return layers; + }; + /** + * @return {boolean} Layers have sources that are still loading. + */ + + + PluggableMap.prototype.getLoading = function () { + var layerStatesArray = this.getLayerGroup().getLayerStatesArray(); + + for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { + var layer = layerStatesArray[i].layer; + var source = + /** @type {import("./layer/Layer.js").default} */ + layer.getSource(); + + if (source && source.loading) { + return true; + } + } + + return false; + }; + /** + * Get the pixel for a coordinate. This takes a coordinate in the user + * projection and returns the corresponding pixel. + * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate. + * @return {import("./pixel.js").Pixel} A pixel position in the map viewport. + * @api + */ + + + PluggableMap.prototype.getPixelFromCoordinate = function (coordinate) { + var viewCoordinate = (0, _proj.fromUserCoordinate)(coordinate, this.getView().getProjection()); + return this.getPixelFromCoordinateInternal(viewCoordinate); + }; + /** + * Get the pixel for a coordinate. This takes a coordinate in the map view + * projection and returns the corresponding pixel. + * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate. + * @return {import("./pixel.js").Pixel} A pixel position in the map viewport. + */ + + + PluggableMap.prototype.getPixelFromCoordinateInternal = function (coordinate) { + var frameState = this.frameState_; + + if (!frameState) { + return null; + } else { + return (0, _transform.apply)(frameState.coordinateToPixelTransform, coordinate.slice(0, 2)); + } + }; + /** + * Get the map renderer. + * @return {import("./renderer/Map.js").default} Renderer + */ + + + PluggableMap.prototype.getRenderer = function () { + return this.renderer_; + }; + /** + * Get the size of this map. + * @return {import("./size.js").Size|undefined} The size in pixels of the map in the DOM. + * @observable + * @api + */ + + + PluggableMap.prototype.getSize = function () { + return ( + /** @type {import("./size.js").Size|undefined} */ + this.get(_MapProperty.default.SIZE) + ); + }; + /** + * Get the view associated with this map. A view manages properties such as + * center and resolution. + * @return {View} The view that controls this map. + * @observable + * @api + */ + + + PluggableMap.prototype.getView = function () { + return ( + /** @type {View} */ + this.get(_MapProperty.default.VIEW) + ); + }; + /** + * Get the element that serves as the map viewport. + * @return {HTMLElement} Viewport. + * @api + */ + + + PluggableMap.prototype.getViewport = function () { + return this.viewport_; + }; + /** + * Get the element that serves as the container for overlays. Elements added to + * this container will let mousedown and touchstart events through to the map, + * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent} + * events. + * @return {!HTMLElement} The map's overlay container. + */ + + + PluggableMap.prototype.getOverlayContainer = function () { + return this.overlayContainer_; + }; + /** + * Get the element that serves as a container for overlays that don't allow + * event propagation. Elements added to this container won't let mousedown and + * touchstart events through to the map, so clicks and gestures on an overlay + * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}. + * @return {!HTMLElement} The map's overlay container that stops events. + */ + + + PluggableMap.prototype.getOverlayContainerStopEvent = function () { + return this.overlayContainerStopEvent_; + }; + /** + * @param {import("./Tile.js").default} tile Tile. + * @param {string} tileSourceKey Tile source key. + * @param {import("./coordinate.js").Coordinate} tileCenter Tile center. + * @param {number} tileResolution Tile resolution. + * @return {number} Tile priority. + */ + + + PluggableMap.prototype.getTilePriority = function (tile, tileSourceKey, tileCenter, tileResolution) { + return (0, _TileQueue.getTilePriority)(this.frameState_, tile, tileSourceKey, tileCenter, tileResolution); + }; + /** + * @param {UIEvent} browserEvent Browser event. + * @param {string=} opt_type Type. + */ + + + PluggableMap.prototype.handleBrowserEvent = function (browserEvent, opt_type) { + var type = opt_type || browserEvent.type; + var mapBrowserEvent = new _MapBrowserEvent.default(type, this, browserEvent); + this.handleMapBrowserEvent(mapBrowserEvent); + }; + /** + * @param {MapBrowserEvent} mapBrowserEvent The event to handle. + */ + + + PluggableMap.prototype.handleMapBrowserEvent = function (mapBrowserEvent) { + if (!this.frameState_) { + // With no view defined, we cannot translate pixels into geographical + // coordinates so interactions cannot be used. + return; + } + + var originalEvent = + /** @type {PointerEvent} */ + mapBrowserEvent.originalEvent; + var eventType = originalEvent.type; + + if (eventType === _EventType2.default.POINTERDOWN || eventType === _EventType.default.WHEEL || eventType === _EventType.default.KEYDOWN) { + var rootNode = this.viewport_.getRootNode ? this.viewport_.getRootNode() : document; + var target = rootNode === document ? + /** @type {Node} */ + originalEvent.target : + /** @type {ShadowRoot} */ + rootNode.elementFromPoint(originalEvent.clientX, originalEvent.clientY); + + if ( // Abort if the target is a child of the container for elements whose events are not meant + // to be handled by map interactions. + this.overlayContainerStopEvent_.contains(target) || // Abort if the event target is a child of the container that is no longer in the page. + // It's possible for the target to no longer be in the page if it has been removed in an + // event listener, this might happen in a Control that recreates it's content based on + // user interaction either manually or via a render in something like https://reactjs.org/ + !(rootNode === document ? document.documentElement : rootNode).contains(target)) { + return; + } + } + + mapBrowserEvent.frameState = this.frameState_; + var interactionsArray = this.getInteractions().getArray(); + + if (this.dispatchEvent(mapBrowserEvent) !== false) { + for (var i = interactionsArray.length - 1; i >= 0; i--) { + var interaction = interactionsArray[i]; + + if (!interaction.getActive()) { + continue; + } + + var cont = interaction.handleEvent(mapBrowserEvent); + + if (!cont) { + break; + } + } + } + }; + /** + * @protected + */ + + + PluggableMap.prototype.handlePostRender = function () { + var frameState = this.frameState_; // Manage the tile queue + // Image loads are expensive and a limited resource, so try to use them + // efficiently: + // * When the view is static we allow a large number of parallel tile loads + // to complete the frame as quickly as possible. + // * When animating or interacting, image loads can cause janks, so we reduce + // the maximum number of loads per frame and limit the number of parallel + // tile loads to remain reactive to view changes and to reduce the chance of + // loading tiles that will quickly disappear from view. + + var tileQueue = this.tileQueue_; + + if (!tileQueue.isEmpty()) { + var maxTotalLoading = this.maxTilesLoading_; + var maxNewLoads = maxTotalLoading; + + if (frameState) { + var hints = frameState.viewHints; + + if (hints[_ViewHint.default.ANIMATING] || hints[_ViewHint.default.INTERACTING]) { + var lowOnFrameBudget = !_has.IMAGE_DECODE && Date.now() - frameState.time > 8; + maxTotalLoading = lowOnFrameBudget ? 0 : 8; + maxNewLoads = lowOnFrameBudget ? 0 : 2; + } + } + + if (tileQueue.getTilesLoading() < maxTotalLoading) { + tileQueue.reprioritize(); // FIXME only call if view has changed + + tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads); + } + } + + if (frameState && this.hasListener(_EventType3.default.RENDERCOMPLETE) && !frameState.animate && !this.tileQueue_.getTilesLoading() && !this.getLoading()) { + this.renderer_.dispatchRenderEvent(_EventType3.default.RENDERCOMPLETE, frameState); + } + + var postRenderFunctions = this.postRenderFunctions_; + + for (var i = 0, ii = postRenderFunctions.length; i < ii; ++i) { + postRenderFunctions[i](this, frameState); + } + + postRenderFunctions.length = 0; + }; + /** + * @private + */ + + + PluggableMap.prototype.handleSizeChanged_ = function () { + if (this.getView() && !this.getView().getAnimating()) { + this.getView().resolveConstraints(0); + } + + this.render(); + }; + /** + * @private + */ + + + PluggableMap.prototype.handleTargetChanged_ = function () { + // target may be undefined, null, a string or an Element. + // If it's a string we convert it to an Element before proceeding. + // If it's not now an Element we remove the viewport from the DOM. + // If it's an Element we append the viewport element to it. + var targetElement; + + if (this.getTarget()) { + targetElement = this.getTargetElement(); + } + + if (this.mapBrowserEventHandler_) { + for (var i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) { + (0, _events.unlistenByKey)(this.keyHandlerKeys_[i]); + } + + this.keyHandlerKeys_ = null; + this.viewport_.removeEventListener(_EventType.default.CONTEXTMENU, this.boundHandleBrowserEvent_); + this.viewport_.removeEventListener(_EventType.default.WHEEL, this.boundHandleBrowserEvent_); + + if (this.handleResize_ !== undefined) { + removeEventListener(_EventType.default.RESIZE, this.handleResize_, false); + this.handleResize_ = undefined; + } + + this.mapBrowserEventHandler_.dispose(); + this.mapBrowserEventHandler_ = null; + (0, _dom.removeNode)(this.viewport_); + } + + if (!targetElement) { + if (this.renderer_) { + clearTimeout(this.postRenderTimeoutHandle_); + this.postRenderFunctions_.length = 0; + this.renderer_.dispose(); + this.renderer_ = null; + } + + if (this.animationDelayKey_) { + cancelAnimationFrame(this.animationDelayKey_); + this.animationDelayKey_ = undefined; + } + } else { + targetElement.appendChild(this.viewport_); + + if (!this.renderer_) { + this.renderer_ = this.createRenderer(); + } + + this.mapBrowserEventHandler_ = new _MapBrowserEventHandler.default(this, this.moveTolerance_); + + for (var key in _MapBrowserEventType.default) { + this.mapBrowserEventHandler_.addEventListener(_MapBrowserEventType.default[key], this.handleMapBrowserEvent.bind(this)); + } + + this.viewport_.addEventListener(_EventType.default.CONTEXTMENU, this.boundHandleBrowserEvent_, false); + this.viewport_.addEventListener(_EventType.default.WHEEL, this.boundHandleBrowserEvent_, _has.PASSIVE_EVENT_LISTENERS ? { + passive: false + } : false); + var keyboardEventTarget = !this.keyboardEventTarget_ ? targetElement : this.keyboardEventTarget_; + this.keyHandlerKeys_ = [(0, _events.listen)(keyboardEventTarget, _EventType.default.KEYDOWN, this.handleBrowserEvent, this), (0, _events.listen)(keyboardEventTarget, _EventType.default.KEYPRESS, this.handleBrowserEvent, this)]; + + if (!this.handleResize_) { + this.handleResize_ = this.updateSize.bind(this); + window.addEventListener(_EventType.default.RESIZE, this.handleResize_, false); + } + } + + this.updateSize(); // updateSize calls setSize, so no need to call this.render + // ourselves here. + }; + /** + * @private + */ + + + PluggableMap.prototype.handleTileChange_ = function () { + this.render(); + }; + /** + * @private + */ + + + PluggableMap.prototype.handleViewPropertyChanged_ = function () { + this.render(); + }; + /** + * @private + */ + + + PluggableMap.prototype.handleViewChanged_ = function () { + if (this.viewPropertyListenerKey_) { + (0, _events.unlistenByKey)(this.viewPropertyListenerKey_); + this.viewPropertyListenerKey_ = null; + } + + if (this.viewChangeListenerKey_) { + (0, _events.unlistenByKey)(this.viewChangeListenerKey_); + this.viewChangeListenerKey_ = null; + } + + var view = this.getView(); + + if (view) { + this.updateViewportSize_(); + this.viewPropertyListenerKey_ = (0, _events.listen)(view, _ObjectEventType.default.PROPERTYCHANGE, this.handleViewPropertyChanged_, this); + this.viewChangeListenerKey_ = (0, _events.listen)(view, _EventType.default.CHANGE, this.handleViewPropertyChanged_, this); + view.resolveConstraints(0); + } + + this.render(); + }; + /** + * @private + */ + + + PluggableMap.prototype.handleLayerGroupChanged_ = function () { + if (this.layerGroupPropertyListenerKeys_) { + this.layerGroupPropertyListenerKeys_.forEach(_events.unlistenByKey); + this.layerGroupPropertyListenerKeys_ = null; + } + + var layerGroup = this.getLayerGroup(); + + if (layerGroup) { + this.layerGroupPropertyListenerKeys_ = [(0, _events.listen)(layerGroup, _ObjectEventType.default.PROPERTYCHANGE, this.render, this), (0, _events.listen)(layerGroup, _EventType.default.CHANGE, this.render, this)]; + } + + this.render(); + }; + /** + * @return {boolean} Is rendered. + */ + + + PluggableMap.prototype.isRendered = function () { + return !!this.frameState_; + }; + /** + * Requests an immediate render in a synchronous manner. + * @api + */ + + + PluggableMap.prototype.renderSync = function () { + if (this.animationDelayKey_) { + cancelAnimationFrame(this.animationDelayKey_); + } + + this.animationDelay_(); + }; + /** + * Redraws all text after new fonts have loaded + */ + + + PluggableMap.prototype.redrawText = function () { + var layerStates = this.getLayerGroup().getLayerStatesArray(); + + for (var i = 0, ii = layerStates.length; i < ii; ++i) { + var layer = layerStates[i].layer; + + if (layer.hasRenderer()) { + layer.getRenderer().handleFontsChanged(); + } + } + }; + /** + * Request a map rendering (at the next animation frame). + * @api + */ + + + PluggableMap.prototype.render = function () { + if (this.renderer_ && this.animationDelayKey_ === undefined) { + this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_); + } + }; + /** + * Remove the given control from the map. + * @param {import("./control/Control.js").default} control Control. + * @return {import("./control/Control.js").default|undefined} The removed control (or undefined + * if the control was not found). + * @api + */ + + + PluggableMap.prototype.removeControl = function (control) { + return this.getControls().remove(control); + }; + /** + * Remove the given interaction from the map. + * @param {import("./interaction/Interaction.js").default} interaction Interaction to remove. + * @return {import("./interaction/Interaction.js").default|undefined} The removed interaction (or + * undefined if the interaction was not found). + * @api + */ + + + PluggableMap.prototype.removeInteraction = function (interaction) { + return this.getInteractions().remove(interaction); + }; + /** + * Removes the given layer from the map. + * @param {import("./layer/Base.js").default} layer Layer. + * @return {import("./layer/Base.js").default|undefined} The removed layer (or undefined if the + * layer was not found). + * @api + */ + + + PluggableMap.prototype.removeLayer = function (layer) { + var layers = this.getLayerGroup().getLayers(); + return layers.remove(layer); + }; + /** + * Remove the given overlay from the map. + * @param {import("./Overlay.js").default} overlay Overlay. + * @return {import("./Overlay.js").default|undefined} The removed overlay (or undefined + * if the overlay was not found). + * @api + */ + + + PluggableMap.prototype.removeOverlay = function (overlay) { + return this.getOverlays().remove(overlay); + }; + /** + * @param {number} time Time. + * @private + */ + + + PluggableMap.prototype.renderFrame_ = function (time) { + var size = this.getSize(); + var view = this.getView(); + var previousFrameState = this.frameState_; + /** @type {?FrameState} */ + + var frameState = null; + + if (size !== undefined && (0, _size.hasArea)(size) && view && view.isDef()) { + var viewHints = view.getHints(this.frameState_ ? this.frameState_.viewHints : undefined); + var viewState = view.getState(); + frameState = { + animate: false, + coordinateToPixelTransform: this.coordinateToPixelTransform_, + declutterItems: previousFrameState ? previousFrameState.declutterItems : [], + extent: (0, _extent.getForViewAndSize)(viewState.center, viewState.resolution, viewState.rotation, size), + index: this.frameIndex_++, + layerIndex: 0, + layerStatesArray: this.getLayerGroup().getLayerStatesArray(), + pixelRatio: this.pixelRatio_, + pixelToCoordinateTransform: this.pixelToCoordinateTransform_, + postRenderFunctions: [], + size: size, + tileQueue: this.tileQueue_, + time: time, + usedTiles: {}, + viewState: viewState, + viewHints: viewHints, + wantedTiles: {} + }; + } + + this.frameState_ = frameState; + this.renderer_.renderFrame(frameState); + + if (frameState) { + if (frameState.animate) { + this.render(); + } + + Array.prototype.push.apply(this.postRenderFunctions_, frameState.postRenderFunctions); + + if (previousFrameState) { + var moveStart = !this.previousExtent_ || !(0, _extent.isEmpty)(this.previousExtent_) && !(0, _extent.equals)(frameState.extent, this.previousExtent_); + + if (moveStart) { + this.dispatchEvent(new _MapEvent.default(_MapEventType.default.MOVESTART, this, previousFrameState)); + this.previousExtent_ = (0, _extent.createOrUpdateEmpty)(this.previousExtent_); + } + } + + var idle = this.previousExtent_ && !frameState.viewHints[_ViewHint.default.ANIMATING] && !frameState.viewHints[_ViewHint.default.INTERACTING] && !(0, _extent.equals)(frameState.extent, this.previousExtent_); + + if (idle) { + this.dispatchEvent(new _MapEvent.default(_MapEventType.default.MOVEEND, this, frameState)); + (0, _extent.clone)(frameState.extent, this.previousExtent_); + } + } + + this.dispatchEvent(new _MapEvent.default(_MapEventType.default.POSTRENDER, this, frameState)); + this.postRenderTimeoutHandle_ = setTimeout(this.handlePostRender.bind(this), 0); + }; + /** + * Sets the layergroup of this map. + * @param {LayerGroup} layerGroup A layer group containing the layers in this map. + * @observable + * @api + */ + + + PluggableMap.prototype.setLayerGroup = function (layerGroup) { + this.set(_MapProperty.default.LAYERGROUP, layerGroup); + }; + /** + * Set the size of this map. + * @param {import("./size.js").Size|undefined} size The size in pixels of the map in the DOM. + * @observable + * @api + */ + + + PluggableMap.prototype.setSize = function (size) { + this.set(_MapProperty.default.SIZE, size); + }; + /** + * Set the target element to render this map into. + * @param {HTMLElement|string|undefined} target The Element or id of the Element + * that the map is rendered in. + * @observable + * @api + */ + + + PluggableMap.prototype.setTarget = function (target) { + this.set(_MapProperty.default.TARGET, target); + }; + /** + * Set the view for this map. + * @param {View} view The view that controls this map. + * @observable + * @api + */ + + + PluggableMap.prototype.setView = function (view) { + this.set(_MapProperty.default.VIEW, view); + }; + /** + * Force a recalculation of the map viewport size. This should be called when + * third-party code changes the size of the map viewport. + * @api + */ + + + PluggableMap.prototype.updateSize = function () { + var targetElement = this.getTargetElement(); + + if (!targetElement) { + this.setSize(undefined); + } else { + var computedStyle = getComputedStyle(targetElement); + this.setSize([targetElement.offsetWidth - parseFloat(computedStyle['borderLeftWidth']) - parseFloat(computedStyle['paddingLeft']) - parseFloat(computedStyle['paddingRight']) - parseFloat(computedStyle['borderRightWidth']), targetElement.offsetHeight - parseFloat(computedStyle['borderTopWidth']) - parseFloat(computedStyle['paddingTop']) - parseFloat(computedStyle['paddingBottom']) - parseFloat(computedStyle['borderBottomWidth'])]); + } + + this.updateViewportSize_(); + }; + /** + * Recomputes the viewport size and save it on the view object (if any) + * @private + */ + + + PluggableMap.prototype.updateViewportSize_ = function () { + var view = this.getView(); + + if (view) { + var size = undefined; + var computedStyle = getComputedStyle(this.viewport_); + + if (computedStyle.width && computedStyle.height) { + size = [parseInt(computedStyle.width, 10), parseInt(computedStyle.height, 10)]; + } + + view.setViewportSize(size); + } + }; + + return PluggableMap; +}(_Object.default); +/** + * @param {MapOptions} options Map options. + * @return {MapOptionsInternal} Internal map options. + */ + + +function createOptionsInternal(options) { + /** + * @type {HTMLElement|Document} + */ + var keyboardEventTarget = null; + + if (options.keyboardEventTarget !== undefined) { + keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ? document.getElementById(options.keyboardEventTarget) : options.keyboardEventTarget; + } + /** + * @type {Object<string, *>} + */ + + + var values = {}; + var layerGroup = options.layers && typeof + /** @type {?} */ + options.layers.getLayers === 'function' ? + /** @type {LayerGroup} */ + options.layers : new _Group.default({ + layers: + /** @type {Collection} */ + options.layers + }); + values[_MapProperty.default.LAYERGROUP] = layerGroup; + values[_MapProperty.default.TARGET] = options.target; + values[_MapProperty.default.VIEW] = options.view !== undefined ? options.view : new _View.default(); + var controls; + + if (options.controls !== undefined) { + if (Array.isArray(options.controls)) { + controls = new _Collection.default(options.controls.slice()); + } else { + (0, _asserts.assert)(typeof + /** @type {?} */ + options.controls.getArray === 'function', 47); // Expected `controls` to be an array or an `import("./Collection.js").Collection` + + controls = + /** @type {Collection} */ + options.controls; + } + } + + var interactions; + + if (options.interactions !== undefined) { + if (Array.isArray(options.interactions)) { + interactions = new _Collection.default(options.interactions.slice()); + } else { + (0, _asserts.assert)(typeof + /** @type {?} */ + options.interactions.getArray === 'function', 48); // Expected `interactions` to be an array or an `import("./Collection.js").Collection` + + interactions = + /** @type {Collection} */ + options.interactions; + } + } + + var overlays; + + if (options.overlays !== undefined) { + if (Array.isArray(options.overlays)) { + overlays = new _Collection.default(options.overlays.slice()); + } else { + (0, _asserts.assert)(typeof + /** @type {?} */ + options.overlays.getArray === 'function', 49); // Expected `overlays` to be an array or an `import("./Collection.js").Collection` + + overlays = options.overlays; + } + } else { + overlays = new _Collection.default(); + } + + return { + controls: controls, + interactions: interactions, + keyboardEventTarget: keyboardEventTarget, + overlays: overlays, + values: values + }; +} + +var _default = PluggableMap; +exports.default = _default; +},{"./Object.js":"../../../node_modules/ol/Object.js","./Collection.js":"../../../node_modules/ol/Collection.js","./CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","./events/EventType.js":"../../../node_modules/ol/events/EventType.js","./layer/Group.js":"../../../node_modules/ol/layer/Group.js","./MapBrowserEvent.js":"../../../node_modules/ol/MapBrowserEvent.js","./MapBrowserEventHandler.js":"../../../node_modules/ol/MapBrowserEventHandler.js","./MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","./MapEvent.js":"../../../node_modules/ol/MapEvent.js","./MapEventType.js":"../../../node_modules/ol/MapEventType.js","./MapProperty.js":"../../../node_modules/ol/MapProperty.js","./ObjectEventType.js":"../../../node_modules/ol/ObjectEventType.js","./pointer/EventType.js":"../../../node_modules/ol/pointer/EventType.js","./render/EventType.js":"../../../node_modules/ol/render/EventType.js","./TileQueue.js":"../../../node_modules/ol/TileQueue.js","./View.js":"../../../node_modules/ol/View.js","./ViewHint.js":"../../../node_modules/ol/ViewHint.js","./has.js":"../../../node_modules/ol/has.js","./functions.js":"../../../node_modules/ol/functions.js","./transform.js":"../../../node_modules/ol/transform.js","./asserts.js":"../../../node_modules/ol/asserts.js","./extent.js":"../../../node_modules/ol/extent.js","./proj.js":"../../../node_modules/ol/proj.js","./size.js":"../../../node_modules/ol/size.js","./events.js":"../../../node_modules/ol/events.js","./dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/control/Control.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Object = _interopRequireDefault(require("../Object.js")); + +var _MapEventType = _interopRequireDefault(require("../MapEventType.js")); + +var _functions = require("../functions.js"); + +var _events = require("../events.js"); + +var _dom = require("../dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/Control + */ + + +/** + * @typedef {Object} Options + * @property {HTMLElement} [element] The element is the control's + * container element. This only needs to be specified if you're developing + * a custom control. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when + * the control should be re-rendered. This is called in a `requestAnimationFrame` + * callback. + * @property {HTMLElement|string} [target] Specify a target if you want + * the control to be rendered outside of the map's viewport. + */ + +/** + * @classdesc + * A control is a visible widget with a DOM element in a fixed position on the + * screen. They can involve user input (buttons), or be informational only; + * the position is determined using CSS. By default these are placed in the + * container with CSS class name `ol-overlaycontainer-stopevent`, but can use + * any outside DOM element. + * + * This is the base class for controls. You can use it for simple custom + * controls by creating the element with listeners, creating an instance: + * ```js + * var myControl = new Control({element: myElement}); + * ``` + * and then adding this to the map. + * + * The main advantage of having this as a control rather than a simple separate + * DOM element is that preventing propagation is handled for you. Controls + * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods. + * + * You can also extend this base for your own control class. See + * examples/custom-controls for an example of how to do this. + * + * @api + */ +var Control = +/** @class */ +function (_super) { + __extends(Control, _super); + /** + * @param {Options} options Control options. + */ + + + function Control(options) { + var _this = _super.call(this) || this; + + var element = options.element; + + if (element && !options.target && !element.style.pointerEvents) { + element.style.pointerEvents = 'auto'; + } + /** + * @protected + * @type {HTMLElement} + */ + + + _this.element = element ? element : null; + /** + * @private + * @type {HTMLElement} + */ + + _this.target_ = null; + /** + * @private + * @type {import("../PluggableMap.js").default} + */ + + _this.map_ = null; + /** + * @protected + * @type {!Array<import("../events.js").EventsKey>} + */ + + _this.listenerKeys = []; + + if (options.render) { + _this.render = options.render; + } + + if (options.target) { + _this.setTarget(options.target); + } + + return _this; + } + /** + * Clean up. + */ + + + Control.prototype.disposeInternal = function () { + (0, _dom.removeNode)(this.element); + + _super.prototype.disposeInternal.call(this); + }; + /** + * Get the map associated with this control. + * @return {import("../PluggableMap.js").default} Map. + * @api + */ + + + Control.prototype.getMap = function () { + return this.map_; + }; + /** + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + Control.prototype.setMap = function (map) { + if (this.map_) { + (0, _dom.removeNode)(this.element); + } + + for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) { + (0, _events.unlistenByKey)(this.listenerKeys[i]); + } + + this.listenerKeys.length = 0; + this.map_ = map; + + if (this.map_) { + var target = this.target_ ? this.target_ : map.getOverlayContainerStopEvent(); + target.appendChild(this.element); + + if (this.render !== _functions.VOID) { + this.listenerKeys.push((0, _events.listen)(map, _MapEventType.default.POSTRENDER, this.render, this)); + } + + map.render(); + } + }; + /** + * Renders the control. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @api + */ + + + Control.prototype.render = function (mapEvent) {}; + /** + * This function is used to set a target element for the control. It has no + * effect if it is called after the control has been added to the map (i.e. + * after `setMap` is called on the control). If no `target` is set in the + * options passed to the control constructor and if `setTarget` is not called + * then the control is added to the map's overlay container. + * @param {HTMLElement|string} target Target. + * @api + */ + + + Control.prototype.setTarget = function (target) { + this.target_ = typeof target === 'string' ? document.getElementById(target) : target; + }; + + return Control; +}(_Object.default); + +var _default = Control; +exports.default = _default; +},{"../Object.js":"../../../node_modules/ol/Object.js","../MapEventType.js":"../../../node_modules/ol/MapEventType.js","../functions.js":"../../../node_modules/ol/functions.js","../events.js":"../../../node_modules/ol/events.js","../dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/control/Attribution.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _css = require("../css.js"); + +var _array = require("../array.js"); + +var _Layer = require("../layer/Layer.js"); + +var _dom = require("../dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/Attribution + */ + + +/** + * @typedef {Object} Options + * @property {string} [className='ol-attribution'] CSS class name. + * @property {HTMLElement|string} [target] Specify a target if you + * want the control to be rendered outside of the map's + * viewport. + * @property {boolean} [collapsible] Specify if attributions can + * be collapsed. If not specified, sources control this behavior with their + * `attributionsCollapsible` setting. + * @property {boolean} [collapsed=true] Specify if attributions should + * be collapsed at startup. + * @property {string} [tipLabel='Attributions'] Text label to use for the button tip. + * @property {string} [label='i'] Text label to use for the + * collapsed attributions button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string|HTMLElement} [collapseLabel='»'] Text label to use + * for the expanded attributions button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when + * the control should be re-rendered. This is called in a `requestAnimationFrame` + * callback. + */ + +/** + * @classdesc + * Control to show all the attributions associated with the layer sources + * in the map. This control is one of the default controls included in maps. + * By default it will show in the bottom right portion of the map, but this can + * be changed by using a css selector for `.ol-attribution`. + * + * @api + */ +var Attribution = +/** @class */ +function (_super) { + __extends(Attribution, _super); + /** + * @param {Options=} opt_options Attribution options. + */ + + + function Attribution(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + render: options.render, + target: options.target + }) || this; + /** + * @private + * @type {HTMLElement} + */ + + _this.ulElement_ = document.createElement('ul'); + /** + * @private + * @type {boolean} + */ + + _this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true; + /** + * @private + * @type {boolean} + */ + + _this.overrideCollapsible_ = options.collapsible !== undefined; + /** + * @private + * @type {boolean} + */ + + _this.collapsible_ = options.collapsible !== undefined ? options.collapsible : true; + + if (!_this.collapsible_) { + _this.collapsed_ = false; + } + + var className = options.className !== undefined ? options.className : 'ol-attribution'; + var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions'; + var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00BB'; + + if (typeof collapseLabel === 'string') { + /** + * @private + * @type {HTMLElement} + */ + _this.collapseLabel_ = document.createElement('span'); + _this.collapseLabel_.textContent = collapseLabel; + } else { + _this.collapseLabel_ = collapseLabel; + } + + var label = options.label !== undefined ? options.label : 'i'; + + if (typeof label === 'string') { + /** + * @private + * @type {HTMLElement} + */ + _this.label_ = document.createElement('span'); + _this.label_.textContent = label; + } else { + _this.label_ = label; + } + + var activeLabel = _this.collapsible_ && !_this.collapsed_ ? _this.collapseLabel_ : _this.label_; + var button = document.createElement('button'); + button.setAttribute('type', 'button'); + button.title = tipLabel; + button.appendChild(activeLabel); + button.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this), false); + var cssClasses = className + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL + (_this.collapsed_ && _this.collapsible_ ? ' ' + _css.CLASS_COLLAPSED : '') + (_this.collapsible_ ? '' : ' ol-uncollapsible'); + var element = _this.element; + element.className = cssClasses; + element.appendChild(_this.ulElement_); + element.appendChild(button); + /** + * A list of currently rendered resolutions. + * @type {Array<string>} + * @private + */ + + _this.renderedAttributions_ = []; + /** + * @private + * @type {boolean} + */ + + _this.renderedVisible_ = true; + return _this; + } + /** + * Collect a list of visible attributions and set the collapsible state. + * @param {import("../PluggableMap.js").FrameState} frameState Frame state. + * @return {Array<string>} Attributions. + * @private + */ + + + Attribution.prototype.collectSourceAttributions_ = function (frameState) { + /** + * Used to determine if an attribution already exists. + * @type {!Object<string, boolean>} + */ + var lookup = {}; + /** + * A list of visible attributions. + * @type {Array<string>} + */ + + var visibleAttributions = []; + var layerStatesArray = frameState.layerStatesArray; + + for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { + var layerState = layerStatesArray[i]; + + if (!(0, _Layer.inView)(layerState, frameState.viewState)) { + continue; + } + + var source = + /** @type {import("../layer/Layer.js").default} */ + layerState.layer.getSource(); + + if (!source) { + continue; + } + + var attributionGetter = source.getAttributions(); + + if (!attributionGetter) { + continue; + } + + var attributions = attributionGetter(frameState); + + if (!attributions) { + continue; + } + + if (!this.overrideCollapsible_ && source.getAttributionsCollapsible() === false) { + this.setCollapsible(false); + } + + if (Array.isArray(attributions)) { + for (var j = 0, jj = attributions.length; j < jj; ++j) { + if (!(attributions[j] in lookup)) { + visibleAttributions.push(attributions[j]); + lookup[attributions[j]] = true; + } + } + } else { + if (!(attributions in lookup)) { + visibleAttributions.push(attributions); + lookup[attributions] = true; + } + } + } + + return visibleAttributions; + }; + /** + * @private + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. + */ + + + Attribution.prototype.updateElement_ = function (frameState) { + if (!frameState) { + if (this.renderedVisible_) { + this.element.style.display = 'none'; + this.renderedVisible_ = false; + } + + return; + } + + var attributions = this.collectSourceAttributions_(frameState); + var visible = attributions.length > 0; + + if (this.renderedVisible_ != visible) { + this.element.style.display = visible ? '' : 'none'; + this.renderedVisible_ = visible; + } + + if ((0, _array.equals)(attributions, this.renderedAttributions_)) { + return; + } + + (0, _dom.removeChildren)(this.ulElement_); // append the attributions + + for (var i = 0, ii = attributions.length; i < ii; ++i) { + var element = document.createElement('li'); + element.innerHTML = attributions[i]; + this.ulElement_.appendChild(element); + } + + this.renderedAttributions_ = attributions; + }; + /** + * @param {MouseEvent} event The event to handle + * @private + */ + + + Attribution.prototype.handleClick_ = function (event) { + event.preventDefault(); + this.handleToggle_(); + }; + /** + * @private + */ + + + Attribution.prototype.handleToggle_ = function () { + this.element.classList.toggle(_css.CLASS_COLLAPSED); + + if (this.collapsed_) { + (0, _dom.replaceNode)(this.collapseLabel_, this.label_); + } else { + (0, _dom.replaceNode)(this.label_, this.collapseLabel_); + } + + this.collapsed_ = !this.collapsed_; + }; + /** + * Return `true` if the attribution is collapsible, `false` otherwise. + * @return {boolean} True if the widget is collapsible. + * @api + */ + + + Attribution.prototype.getCollapsible = function () { + return this.collapsible_; + }; + /** + * Set whether the attribution should be collapsible. + * @param {boolean} collapsible True if the widget is collapsible. + * @api + */ + + + Attribution.prototype.setCollapsible = function (collapsible) { + if (this.collapsible_ === collapsible) { + return; + } + + this.collapsible_ = collapsible; + this.element.classList.toggle('ol-uncollapsible'); + + if (!collapsible && this.collapsed_) { + this.handleToggle_(); + } + }; + /** + * Collapse or expand the attribution according to the passed parameter. Will + * not do anything if the attribution isn't collapsible or if the current + * collapsed state is already the one requested. + * @param {boolean} collapsed True if the widget is collapsed. + * @api + */ + + + Attribution.prototype.setCollapsed = function (collapsed) { + if (!this.collapsible_ || this.collapsed_ === collapsed) { + return; + } + + this.handleToggle_(); + }; + /** + * Return `true` when the attribution is currently collapsed or `false` + * otherwise. + * @return {boolean} True if the widget is collapsed. + * @api + */ + + + Attribution.prototype.getCollapsed = function () { + return this.collapsed_; + }; + /** + * Update the attribution element. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + + + Attribution.prototype.render = function (mapEvent) { + this.updateElement_(mapEvent.frameState); + }; + + return Attribution; +}(_Control.default); + +var _default = Attribution; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../css.js":"../../../node_modules/ol/css.js","../array.js":"../../../node_modules/ol/array.js","../layer/Layer.js":"../../../node_modules/ol/layer/Layer.js","../dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/control/Rotate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _css = require("../css.js"); + +var _easing = require("../easing.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/Rotate + */ + + +/** + * @typedef {Object} Options + * @property {string} [className='ol-rotate'] CSS class name. + * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip. + * @property {number} [duration=250] Animation duration in milliseconds. + * @property {boolean} [autoHide=true] Hide the control when rotation is 0. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when the control should + * be re-rendered. This is called in a `requestAnimationFrame` callback. + * @property {function():void} [resetNorth] Function called when the control is clicked. + * This will override the default `resetNorth`. + * @property {HTMLElement|string} [target] Specify a target if you want the control to be + * rendered outside of the map's viewport. + */ + +/** + * @classdesc + * A button control to reset rotation to 0. + * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css + * selector is added to the button when the rotation is 0. + * + * @api + */ +var Rotate = +/** @class */ +function (_super) { + __extends(Rotate, _super); + /** + * @param {Options=} opt_options Rotate options. + */ + + + function Rotate(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + render: options.render, + target: options.target + }) || this; + var className = options.className !== undefined ? options.className : 'ol-rotate'; + var label = options.label !== undefined ? options.label : '\u21E7'; + /** + * @type {HTMLElement} + * @private + */ + + _this.label_ = null; + + if (typeof label === 'string') { + _this.label_ = document.createElement('span'); + _this.label_.className = 'ol-compass'; + _this.label_.textContent = label; + } else { + _this.label_ = label; + + _this.label_.classList.add('ol-compass'); + } + + var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation'; + var button = document.createElement('button'); + button.className = className + '-reset'; + button.setAttribute('type', 'button'); + button.title = tipLabel; + button.appendChild(_this.label_); + button.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this), false); + var cssClasses = className + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL; + var element = _this.element; + element.className = cssClasses; + element.appendChild(button); + _this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined; + /** + * @type {number} + * @private + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 250; + /** + * @type {boolean} + * @private + */ + + _this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true; + /** + * @private + * @type {number|undefined} + */ + + _this.rotation_ = undefined; + + if (_this.autoHide_) { + _this.element.classList.add(_css.CLASS_HIDDEN); + } + + return _this; + } + /** + * @param {MouseEvent} event The event to handle + * @private + */ + + + Rotate.prototype.handleClick_ = function (event) { + event.preventDefault(); + + if (this.callResetNorth_ !== undefined) { + this.callResetNorth_(); + } else { + this.resetNorth_(); + } + }; + /** + * @private + */ + + + Rotate.prototype.resetNorth_ = function () { + var map = this.getMap(); + var view = map.getView(); + + if (!view) { + // the map does not have a view, so we can't act + // upon it + return; + } + + var rotation = view.getRotation(); + + if (rotation !== undefined) { + if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) { + view.animate({ + rotation: 0, + duration: this.duration_, + easing: _easing.easeOut + }); + } else { + view.setRotation(0); + } + } + }; + /** + * Update the rotate control element. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + + + Rotate.prototype.render = function (mapEvent) { + var frameState = mapEvent.frameState; + + if (!frameState) { + return; + } + + var rotation = frameState.viewState.rotation; + + if (rotation != this.rotation_) { + var transform = 'rotate(' + rotation + 'rad)'; + + if (this.autoHide_) { + var contains = this.element.classList.contains(_css.CLASS_HIDDEN); + + if (!contains && rotation === 0) { + this.element.classList.add(_css.CLASS_HIDDEN); + } else if (contains && rotation !== 0) { + this.element.classList.remove(_css.CLASS_HIDDEN); + } + } + + this.label_.style.transform = transform; + } + + this.rotation_ = rotation; + }; + + return Rotate; +}(_Control.default); + +var _default = Rotate; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../css.js":"../../../node_modules/ol/css.js","../easing.js":"../../../node_modules/ol/easing.js"}],"../../../node_modules/ol/control/Zoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _css = require("../css.js"); + +var _easing = require("../easing.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/Zoom + */ + + +/** + * @typedef {Object} Options + * @property {number} [duration=250] Animation duration in milliseconds. + * @property {string} [className='ol-zoom'] CSS class name. + * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in + * button. Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string|HTMLElement} [zoomOutLabel='-'] Text label to use for the zoom-out button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip. + * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip. + * @property {number} [delta=1] The zoom delta applied on each click. + * @property {HTMLElement|string} [target] Specify a target if you want the control to be + * rendered outside of the map's viewport. + */ + +/** + * @classdesc + * A control with 2 buttons, one for zoom in and one for zoom out. + * This control is one of the default controls of a map. To style this control + * use css selectors `.ol-zoom-in` and `.ol-zoom-out`. + * + * @api + */ +var Zoom = +/** @class */ +function (_super) { + __extends(Zoom, _super); + /** + * @param {Options=} opt_options Zoom options. + */ + + + function Zoom(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + target: options.target + }) || this; + var className = options.className !== undefined ? options.className : 'ol-zoom'; + var delta = options.delta !== undefined ? options.delta : 1; + var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+'; + var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212'; + var zoomInTipLabel = options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in'; + var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ? options.zoomOutTipLabel : 'Zoom out'; + var inElement = document.createElement('button'); + inElement.className = className + '-in'; + inElement.setAttribute('type', 'button'); + inElement.title = zoomInTipLabel; + inElement.appendChild(typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel); + inElement.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this, delta), false); + var outElement = document.createElement('button'); + outElement.className = className + '-out'; + outElement.setAttribute('type', 'button'); + outElement.title = zoomOutTipLabel; + outElement.appendChild(typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel); + outElement.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this, -delta), false); + var cssClasses = className + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL; + var element = _this.element; + element.className = cssClasses; + element.appendChild(inElement); + element.appendChild(outElement); + /** + * @type {number} + * @private + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 250; + return _this; + } + /** + * @param {number} delta Zoom delta. + * @param {MouseEvent} event The event to handle + * @private + */ + + + Zoom.prototype.handleClick_ = function (delta, event) { + event.preventDefault(); + this.zoomByDelta_(delta); + }; + /** + * @param {number} delta Zoom delta. + * @private + */ + + + Zoom.prototype.zoomByDelta_ = function (delta) { + var map = this.getMap(); + var view = map.getView(); + + if (!view) { + // the map does not have a view, so we can't act + // upon it + return; + } + + var currentZoom = view.getZoom(); + + if (currentZoom !== undefined) { + var newZoom = view.getConstrainedZoom(currentZoom + delta); + + if (this.duration_ > 0) { + if (view.getAnimating()) { + view.cancelAnimations(); + } + + view.animate({ + zoom: newZoom, + duration: this.duration_, + easing: _easing.easeOut + }); + } else { + view.setZoom(newZoom); + } + } + }; + + return Zoom; +}(_Control.default); + +var _default = Zoom; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../css.js":"../../../node_modules/ol/css.js","../easing.js":"../../../node_modules/ol/easing.js"}],"../../../node_modules/ol/control/FullScreen.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _css = require("../css.js"); + +var _events = require("../events.js"); + +var _dom = require("../dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/FullScreen + */ + + +var events = ['fullscreenchange', 'webkitfullscreenchange', 'MSFullscreenChange']; +/** + * @enum {string} + */ + +var FullScreenEventType = { + /** + * Triggered after the map entered fullscreen. + * @event FullScreenEventType#enterfullscreen + * @api + */ + ENTERFULLSCREEN: 'enterfullscreen', + + /** + * Triggered after the map leave fullscreen. + * @event FullScreenEventType#leavefullscreen + * @api + */ + LEAVEFULLSCREEN: 'leavefullscreen' +}; +/** + * @typedef {Object} Options + * @property {string} [className='ol-full-screen'] CSS class name. + * @property {string|Text} [label='\u2922'] Text label to use for the button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string|Text} [labelActive='\u00d7'] Text label to use for the + * button when full-screen is active. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip. + * @property {boolean} [keys=false] Full keyboard access. + * @property {HTMLElement|string} [target] Specify a target if you want the + * control to be rendered outside of the map's viewport. + * @property {HTMLElement|string} [source] The element to be displayed + * fullscreen. When not provided, the element containing the map viewport will + * be displayed fullscreen. + */ + +/** + * @classdesc + * Provides a button that when clicked fills up the full screen with the map. + * The full screen source element is by default the element containing the map viewport unless + * overridden by providing the `source` option. In which case, the dom + * element introduced using this parameter will be displayed in full screen. + * + * When in full screen mode, a close button is shown to exit full screen mode. + * The [Fullscreen API](http://www.w3.org/TR/fullscreen/) is used to + * toggle the map in full screen mode. + * + * @fires FullScreenEventType#enterfullscreen + * @fires FullScreenEventType#leavefullscreen + * @api + */ + +var FullScreen = +/** @class */ +function (_super) { + __extends(FullScreen, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function FullScreen(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + target: options.target + }) || this; + /** + * @private + * @type {string} + */ + + _this.cssClassName_ = options.className !== undefined ? options.className : 'ol-full-screen'; + var label = options.label !== undefined ? options.label : '\u2922'; + /** + * @private + * @type {Text} + */ + + _this.labelNode_ = typeof label === 'string' ? document.createTextNode(label) : label; + var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7'; + /** + * @private + * @type {Text} + */ + + _this.labelActiveNode_ = typeof labelActive === 'string' ? document.createTextNode(labelActive) : labelActive; + /** + * @private + * @type {HTMLElement} + */ + + _this.button_ = document.createElement('button'); + var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen'; + + _this.setClassName_(_this.button_, isFullScreen()); + + _this.button_.setAttribute('type', 'button'); + + _this.button_.title = tipLabel; + + _this.button_.appendChild(_this.labelNode_); + + _this.button_.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this), false); + + var cssClasses = _this.cssClassName_ + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL + ' ' + (!isFullScreenSupported() ? _css.CLASS_UNSUPPORTED : ''); + var element = _this.element; + element.className = cssClasses; + element.appendChild(_this.button_); + /** + * @private + * @type {boolean} + */ + + _this.keys_ = options.keys !== undefined ? options.keys : false; + /** + * @private + * @type {HTMLElement|string|undefined} + */ + + _this.source_ = options.source; + return _this; + } + /** + * @param {MouseEvent} event The event to handle + * @private + */ + + + FullScreen.prototype.handleClick_ = function (event) { + event.preventDefault(); + this.handleFullScreen_(); + }; + /** + * @private + */ + + + FullScreen.prototype.handleFullScreen_ = function () { + if (!isFullScreenSupported()) { + return; + } + + var map = this.getMap(); + + if (!map) { + return; + } + + if (isFullScreen()) { + exitFullScreen(); + } else { + var element = void 0; + + if (this.source_) { + element = typeof this.source_ === 'string' ? document.getElementById(this.source_) : this.source_; + } else { + element = map.getTargetElement(); + } + + if (this.keys_) { + requestFullScreenWithKeys(element); + } else { + requestFullScreen(element); + } + } + }; + /** + * @private + */ + + + FullScreen.prototype.handleFullScreenChange_ = function () { + var map = this.getMap(); + + if (isFullScreen()) { + this.setClassName_(this.button_, true); + (0, _dom.replaceNode)(this.labelActiveNode_, this.labelNode_); + this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN); + } else { + this.setClassName_(this.button_, false); + (0, _dom.replaceNode)(this.labelNode_, this.labelActiveNode_); + this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN); + } + + if (map) { + map.updateSize(); + } + }; + /** + * @param {HTMLElement} element Target element + * @param {boolean} fullscreen True if fullscreen class name should be active + * @private + */ + + + FullScreen.prototype.setClassName_ = function (element, fullscreen) { + var activeClassName = this.cssClassName_ + '-true'; + var inactiveClassName = this.cssClassName_ + '-false'; + var nextClassName = fullscreen ? activeClassName : inactiveClassName; + element.classList.remove(activeClassName); + element.classList.remove(inactiveClassName); + element.classList.add(nextClassName); + }; + /** + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + FullScreen.prototype.setMap = function (map) { + _super.prototype.setMap.call(this, map); + + if (map) { + for (var i = 0, ii = events.length; i < ii; ++i) { + this.listenerKeys.push((0, _events.listen)(document, events[i], this.handleFullScreenChange_, this)); + } + } + }; + + return FullScreen; +}(_Control.default); +/** + * @return {boolean} Fullscreen is supported by the current platform. + */ + + +function isFullScreenSupported() { + var body = document.body; + return !!(body['webkitRequestFullscreen'] || body['msRequestFullscreen'] && document['msFullscreenEnabled'] || body.requestFullscreen && document.fullscreenEnabled); +} +/** + * @return {boolean} Element is currently in fullscreen. + */ + + +function isFullScreen() { + return !!(document['webkitIsFullScreen'] || document['msFullscreenElement'] || document.fullscreenElement); +} +/** + * Request to fullscreen an element. + * @param {HTMLElement} element Element to request fullscreen + */ + + +function requestFullScreen(element) { + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element['msRequestFullscreen']) { + element['msRequestFullscreen'](); + } else if (element['webkitRequestFullscreen']) { + element['webkitRequestFullscreen'](); + } +} +/** + * Request to fullscreen an element with keyboard input. + * @param {HTMLElement} element Element to request fullscreen + */ + + +function requestFullScreenWithKeys(element) { + if (element['webkitRequestFullscreen']) { + element['webkitRequestFullscreen'](); + } else { + requestFullScreen(element); + } +} +/** + * Exit fullscreen. + */ + + +function exitFullScreen() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document['msExitFullscreen']) { + document['msExitFullscreen'](); + } else if (document['webkitExitFullscreen']) { + document['webkitExitFullscreen'](); + } +} + +var _default = FullScreen; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../css.js":"../../../node_modules/ol/css.js","../events.js":"../../../node_modules/ol/events.js","../dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/control/MousePosition.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../pointer/EventType.js")); + +var _Object = require("../Object.js"); + +var _proj = require("../proj.js"); + +var _events = require("../events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/control/MousePosition + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * @type {string} + */ +var PROJECTION = 'projection'; +/** + * @type {string} + */ + +var COORDINATE_FORMAT = 'coordinateFormat'; +/** + * @typedef {Object} Options + * @property {string} [className='ol-mouse-position'] CSS class name. + * @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format. + * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when the + * control should be re-rendered. This is called in a `requestAnimationFrame` + * callback. + * @property {HTMLElement|string} [target] Specify a target if you want the + * control to be rendered outside of the map's viewport. + * @property {string} [undefinedHTML=' '] Markup to show when coordinates are not + * available (e.g. when the pointer leaves the map viewport). By default, the last position + * will be replaced with `' '` (` `) when the pointer leaves the viewport. To + * retain the last rendered position, set this option to something falsey (like an empty + * string `''`). + */ + +/** + * @classdesc + * A control to show the 2D coordinates of the mouse cursor. By default, these + * are in the view projection, but can be in any supported projection. + * By default the control is shown in the top right corner of the map, but this + * can be changed by using the css selector `.ol-mouse-position`. + * + * On touch devices, which usually do not have a mouse cursor, the coordinates + * of the currently touched position are shown. + * + * @api + */ + +var MousePosition = +/** @class */ +function (_super) { + __extends(MousePosition, _super); + /** + * @param {Options=} opt_options Mouse position options. + */ + + + function MousePosition(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var element = document.createElement('div'); + element.className = options.className !== undefined ? options.className : 'ol-mouse-position'; + _this = _super.call(this, { + element: element, + render: options.render, + target: options.target + }) || this; + + _this.addEventListener((0, _Object.getChangeEventType)(PROJECTION), _this.handleProjectionChanged_); + + if (options.coordinateFormat) { + _this.setCoordinateFormat(options.coordinateFormat); + } + + if (options.projection) { + _this.setProjection(options.projection); + } + /** + * @private + * @type {string} + */ + + + _this.undefinedHTML_ = options.undefinedHTML !== undefined ? options.undefinedHTML : ' '; + /** + * @private + * @type {boolean} + */ + + _this.renderOnMouseOut_ = !!_this.undefinedHTML_; + /** + * @private + * @type {string} + */ + + _this.renderedHTML_ = element.innerHTML; + /** + * @private + * @type {?import("../proj/Projection.js").default} + */ + + _this.mapProjection_ = null; + /** + * @private + * @type {?import("../proj.js").TransformFunction} + */ + + _this.transform_ = null; + return _this; + } + /** + * @private + */ + + + MousePosition.prototype.handleProjectionChanged_ = function () { + this.transform_ = null; + }; + /** + * Return the coordinate format type used to render the current position or + * undefined. + * @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current + * position in. + * @observable + * @api + */ + + + MousePosition.prototype.getCoordinateFormat = function () { + return ( + /** @type {import("../coordinate.js").CoordinateFormat|undefined} */ + this.get(COORDINATE_FORMAT) + ); + }; + /** + * Return the projection that is used to report the mouse position. + * @return {import("../proj/Projection.js").default|undefined} The projection to report mouse + * position in. + * @observable + * @api + */ + + + MousePosition.prototype.getProjection = function () { + return ( + /** @type {import("../proj/Projection.js").default|undefined} */ + this.get(PROJECTION) + ); + }; + /** + * @param {MouseEvent} event Browser event. + * @protected + */ + + + MousePosition.prototype.handleMouseMove = function (event) { + var map = this.getMap(); + this.updateHTML_(map.getEventPixel(event)); + }; + /** + * @param {Event} event Browser event. + * @protected + */ + + + MousePosition.prototype.handleMouseOut = function (event) { + this.updateHTML_(null); + }; + /** + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + MousePosition.prototype.setMap = function (map) { + _super.prototype.setMap.call(this, map); + + if (map) { + var viewport = map.getViewport(); + this.listenerKeys.push((0, _events.listen)(viewport, _EventType.default.POINTERMOVE, this.handleMouseMove, this)); + + if (this.renderOnMouseOut_) { + this.listenerKeys.push((0, _events.listen)(viewport, _EventType.default.POINTEROUT, this.handleMouseOut, this)); + } + } + }; + /** + * Set the coordinate format type used to render the current position. + * @param {import("../coordinate.js").CoordinateFormat} format The format to render the current + * position in. + * @observable + * @api + */ + + + MousePosition.prototype.setCoordinateFormat = function (format) { + this.set(COORDINATE_FORMAT, format); + }; + /** + * Set the projection that is used to report the mouse position. + * @param {import("../proj.js").ProjectionLike} projection The projection to report mouse + * position in. + * @observable + * @api + */ + + + MousePosition.prototype.setProjection = function (projection) { + this.set(PROJECTION, (0, _proj.get)(projection)); + }; + /** + * @param {?import("../pixel.js").Pixel} pixel Pixel. + * @private + */ + + + MousePosition.prototype.updateHTML_ = function (pixel) { + var html = this.undefinedHTML_; + + if (pixel && this.mapProjection_) { + if (!this.transform_) { + var projection = this.getProjection(); + + if (projection) { + this.transform_ = (0, _proj.getTransformFromProjections)(this.mapProjection_, projection); + } else { + this.transform_ = _proj.identityTransform; + } + } + + var map = this.getMap(); + var coordinate = map.getCoordinateFromPixelInternal(pixel); + + if (coordinate) { + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + this.transform_ = (0, _proj.getTransformFromProjections)(this.mapProjection_, userProjection); + } + + this.transform_(coordinate, coordinate); + var coordinateFormat = this.getCoordinateFormat(); + + if (coordinateFormat) { + html = coordinateFormat(coordinate); + } else { + html = coordinate.toString(); + } + } + } + + if (!this.renderedHTML_ || html !== this.renderedHTML_) { + this.element.innerHTML = html; + this.renderedHTML_ = html; + } + }; + /** + * Update the projection. Rendering of the coordinates is done in + * `handleMouseMove` and `handleMouseUp`. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + + + MousePosition.prototype.render = function (mapEvent) { + var frameState = mapEvent.frameState; + + if (!frameState) { + this.mapProjection_ = null; + } else { + if (this.mapProjection_ != frameState.viewState.projection) { + this.mapProjection_ = frameState.viewState.projection; + this.transform_ = null; + } + } + }; + + return MousePosition; +}(_Control.default); + +var _default = MousePosition; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../pointer/EventType.js":"../../../node_modules/ol/pointer/EventType.js","../Object.js":"../../../node_modules/ol/Object.js","../proj.js":"../../../node_modules/ol/proj.js","../events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/OverlayPositioning.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/OverlayPositioning + */ + +/** + * Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`, + * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`, + * `'top-center'`, `'top-right'` + * @enum {string} + */ +var _default = { + BOTTOM_LEFT: 'bottom-left', + BOTTOM_CENTER: 'bottom-center', + BOTTOM_RIGHT: 'bottom-right', + CENTER_LEFT: 'center-left', + CENTER_CENTER: 'center-center', + CENTER_RIGHT: 'center-right', + TOP_LEFT: 'top-left', + TOP_CENTER: 'top-center', + TOP_RIGHT: 'top-right' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/Overlay.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Object = _interopRequireWildcard(require("./Object.js")); + +var _MapEventType = _interopRequireDefault(require("./MapEventType.js")); + +var _OverlayPositioning = _interopRequireDefault(require("./OverlayPositioning.js")); + +var _css = require("./css.js"); + +var _extent = require("./extent.js"); + +var _events = require("./events.js"); + +var _dom = require("./dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Overlay + */ + + +/** + * @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<number>} [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 {import("./OverlayPositioning.js").default} [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' +}; +/** + * @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; + /** + * @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.CLASS_SELECTABLE; + _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.addEventListener((0, _Object.getChangeEventType)(Property.ELEMENT), _this.handleElementChanged); + + _this.addEventListener((0, _Object.getChangeEventType)(Property.MAP), _this.handleMapChanged); + + _this.addEventListener((0, _Object.getChangeEventType)(Property.OFFSET), _this.handleOffsetChanged); + + _this.addEventListener((0, _Object.getChangeEventType)(Property.POSITION), _this.handlePositionChanged); + + _this.addEventListener((0, _Object.getChangeEventType)(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 !== undefined ? + /** @type {import("./OverlayPositioning.js").default} */ + options.positioning : _OverlayPositioning.default.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|undefined} The map that the + * overlay is part of. + * @observable + * @api + */ + + + Overlay.prototype.getMap = function () { + return ( + /** @type {import("./PluggableMap.js").default|undefined} */ + this.get(Property.MAP) + ); + }; + /** + * Get the offset of this overlay. + * @return {Array<number>} The offset. + * @observable + * @api + */ + + + Overlay.prototype.getOffset = function () { + return ( + /** @type {Array<number>} */ + 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 {import("./OverlayPositioning.js").default} How the overlay is positioned + * relative to its point on the map. + * @observable + * @api + */ + + + Overlay.prototype.getPositioning = function () { + return ( + /** @type {import("./OverlayPositioning.js").default} */ + this.get(Property.POSITIONING) + ); + }; + /** + * @protected + */ + + + Overlay.prototype.handleElementChanged = function () { + (0, _dom.removeChildren)(this.element); + var element = this.getElement(); + + if (element) { + this.element.appendChild(element); + } + }; + /** + * @protected + */ + + + Overlay.prototype.handleMapChanged = function () { + if (this.mapPostrenderListenerKey) { + (0, _dom.removeNode)(this.element); + (0, _events.unlistenByKey)(this.mapPostrenderListenerKey); + this.mapPostrenderListenerKey = null; + } + + var map = this.getMap(); + + if (map) { + this.mapPostrenderListenerKey = (0, _events.listen)(map, _MapEventType.default.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|undefined} map The map that the + * overlay is part of. + * @observable + * @api + */ + + + Overlay.prototype.setMap = function (map) { + this.set(Property.MAP, map); + }; + /** + * Set the offset for this overlay. + * @param {Array<number>} 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 visisble 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, [(0, _dom.outerWidth)(element), (0, _dom.outerHeight)(element)]); + var panIntoViewOptions = opt_panIntoViewOptions || {}; + var myMargin = panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin; + + if (!(0, _extent.containsExtent)(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); + 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 {import("./OverlayPositioning.js").default} 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 == _OverlayPositioning.default.BOTTOM_RIGHT || positioning == _OverlayPositioning.default.CENTER_RIGHT || positioning == _OverlayPositioning.default.TOP_RIGHT) { + posX = '-100%'; + } else if (positioning == _OverlayPositioning.default.BOTTOM_CENTER || positioning == _OverlayPositioning.default.CENTER_CENTER || positioning == _OverlayPositioning.default.TOP_CENTER) { + posX = '-50%'; + } + + if (positioning == _OverlayPositioning.default.BOTTOM_LEFT || positioning == _OverlayPositioning.default.BOTTOM_CENTER || positioning == _OverlayPositioning.default.BOTTOM_RIGHT) { + posY = '-100%'; + } else if (positioning == _OverlayPositioning.default.CENTER_LEFT || positioning == _OverlayPositioning.default.CENTER_CENTER || positioning == _OverlayPositioning.default.CENTER_RIGHT) { + posY = '-50%'; + } + + var transform = "translate(" + posX + ", " + posY + ") translate(" + x + ", " + 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.default); + +var _default = Overlay; +exports.default = _default; +},{"./Object.js":"../../../node_modules/ol/Object.js","./MapEventType.js":"../../../node_modules/ol/MapEventType.js","./OverlayPositioning.js":"../../../node_modules/ol/OverlayPositioning.js","./css.js":"../../../node_modules/ol/css.js","./extent.js":"../../../node_modules/ol/extent.js","./events.js":"../../../node_modules/ol/events.js","./dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/control/OverviewMap.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Composite = _interopRequireDefault(require("../renderer/Composite.js")); + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _MapEventType = _interopRequireDefault(require("../MapEventType.js")); + +var _MapProperty = _interopRequireDefault(require("../MapProperty.js")); + +var _ObjectEventType = _interopRequireDefault(require("../ObjectEventType.js")); + +var _Overlay = _interopRequireDefault(require("../Overlay.js")); + +var _OverlayPositioning = _interopRequireDefault(require("../OverlayPositioning.js")); + +var _PluggableMap = _interopRequireDefault(require("../PluggableMap.js")); + +var _View = _interopRequireDefault(require("../View.js")); + +var _ViewProperty = _interopRequireDefault(require("../ViewProperty.js")); + +var _css = require("../css.js"); + +var _extent = require("../extent.js"); + +var _Object = require("../Object.js"); + +var _events = require("../events.js"); + +var _Polygon = require("../geom/Polygon.js"); + +var _dom = require("../dom.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/OverviewMap + */ + + +/** + * Maximum width and/or height extent ratio that determines when the overview + * map should be zoomed out. + * @type {number} + */ +var MAX_RATIO = 0.75; +/** + * Minimum width and/or height extent ratio that determines when the overview + * map should be zoomed in. + * @type {number} + */ + +var MIN_RATIO = 0.1; + +var ControlledMap = +/** @class */ +function (_super) { + __extends(ControlledMap, _super); + + function ControlledMap() { + return _super !== null && _super.apply(this, arguments) || this; + } + + ControlledMap.prototype.createRenderer = function () { + return new _Composite.default(this); + }; + + return ControlledMap; +}(_PluggableMap.default); +/** + * @typedef {Object} Options + * @property {string} [className='ol-overviewmap'] CSS class name. + * @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded). + * @property {string|HTMLElement} [collapseLabel='«'] Text label to use for the + * expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used. + * @property {boolean} [collapsible=true] Whether the control can be collapsed or not. + * @property {string|HTMLElement} [label='»'] Text label to use for the collapsed + * overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used. + * @property {Array<import("../layer/Layer.js").default>|import("../Collection.js").default<import("../layer/Layer.js").default>} [layers] + * Layers for the overview map. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when the control + * should be re-rendered. This is called in a `requestAnimationFrame` callback. + * @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view. + * @property {HTMLElement|string} [target] Specify a target if you want the control + * to be rendered outside of the map's viewport. + * @property {string} [tipLabel='Overview map'] Text label to use for the button tip. + * @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided, + * a default view with the same projection as the main map will be used. + */ + +/** + * Create a new control with a map acting as an overview map for another + * defined map. + * + * @api + */ + + +var OverviewMap = +/** @class */ +function (_super) { + __extends(OverviewMap, _super); + /** + * @param {Options=} opt_options OverviewMap options. + */ + + + function OverviewMap(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + render: options.render, + target: options.target + }) || this; + /** + * @private + */ + + _this.boundHandleRotationChanged_ = _this.handleRotationChanged_.bind(_this); + /** + * @type {boolean} + * @private + */ + + _this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true; + /** + * @private + * @type {boolean} + */ + + _this.collapsible_ = options.collapsible !== undefined ? options.collapsible : true; + + if (!_this.collapsible_) { + _this.collapsed_ = false; + } + /** + * @private + * @type {boolean} + */ + + + _this.rotateWithView_ = options.rotateWithView !== undefined ? options.rotateWithView : false; + /** + * @private + * @type {import("../extent.js").Extent|undefined} + */ + + _this.viewExtent_ = undefined; + var className = options.className !== undefined ? options.className : 'ol-overviewmap'; + var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Overview map'; + var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00AB'; + + if (typeof collapseLabel === 'string') { + /** + * @private + * @type {HTMLElement} + */ + _this.collapseLabel_ = document.createElement('span'); + _this.collapseLabel_.textContent = collapseLabel; + } else { + _this.collapseLabel_ = collapseLabel; + } + + var label = options.label !== undefined ? options.label : '\u00BB'; + + if (typeof label === 'string') { + /** + * @private + * @type {HTMLElement} + */ + _this.label_ = document.createElement('span'); + _this.label_.textContent = label; + } else { + _this.label_ = label; + } + + var activeLabel = _this.collapsible_ && !_this.collapsed_ ? _this.collapseLabel_ : _this.label_; + var button = document.createElement('button'); + button.setAttribute('type', 'button'); + button.title = tipLabel; + button.appendChild(activeLabel); + button.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this), false); + /** + * @type {HTMLElement} + * @private + */ + + _this.ovmapDiv_ = document.createElement('div'); + _this.ovmapDiv_.className = 'ol-overviewmap-map'; + /** + * Explicitly given view to be used instead of a view derived from the main map. + * @type {View} + * @private + */ + + _this.view_ = options.view; + /** + * @type {ControlledMap} + * @private + */ + + _this.ovmap_ = new ControlledMap({ + view: options.view + }); + var ovmap = _this.ovmap_; + + if (options.layers) { + options.layers.forEach(function (layer) { + ovmap.addLayer(layer); + }); + } + + var box = document.createElement('div'); + box.className = 'ol-overviewmap-box'; + box.style.boxSizing = 'border-box'; + /** + * @type {import("../Overlay.js").default} + * @private + */ + + _this.boxOverlay_ = new _Overlay.default({ + position: [0, 0], + positioning: _OverlayPositioning.default.CENTER_CENTER, + element: box + }); + + _this.ovmap_.addOverlay(_this.boxOverlay_); + + var cssClasses = className + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL + (_this.collapsed_ && _this.collapsible_ ? ' ' + _css.CLASS_COLLAPSED : '') + (_this.collapsible_ ? '' : ' ol-uncollapsible'); + var element = _this.element; + element.className = cssClasses; + element.appendChild(_this.ovmapDiv_); + element.appendChild(button); + /* Interactive map */ + + var scope = _this; + var overlay = _this.boxOverlay_; + + var overlayBox = _this.boxOverlay_.getElement(); + /* Functions definition */ + + + var computeDesiredMousePosition = function (mousePosition) { + return { + clientX: mousePosition.clientX, + clientY: mousePosition.clientY + }; + }; + + var move = function (event) { + var position = + /** @type {?} */ + computeDesiredMousePosition(event); + var coordinates = ovmap.getEventCoordinateInternal( + /** @type {MouseEvent} */ + position); + overlay.setPosition(coordinates); + }; + + var endMoving = function (event) { + var coordinates = ovmap.getEventCoordinateInternal(event); + scope.getMap().getView().setCenterInternal(coordinates); + window.removeEventListener('mousemove', move); + window.removeEventListener('mouseup', endMoving); + }; + /* Binding */ + + + overlayBox.addEventListener('mousedown', function () { + window.addEventListener('mousemove', move); + window.addEventListener('mouseup', endMoving); + }); + return _this; + } + /** + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + OverviewMap.prototype.setMap = function (map) { + var oldMap = this.getMap(); + + if (map === oldMap) { + return; + } + + if (oldMap) { + var oldView = oldMap.getView(); + + if (oldView) { + this.unbindView_(oldView); + } + + this.ovmap_.setTarget(null); + } + + _super.prototype.setMap.call(this, map); + + if (map) { + this.ovmap_.setTarget(this.ovmapDiv_); + this.listenerKeys.push((0, _events.listen)(map, _ObjectEventType.default.PROPERTYCHANGE, this.handleMapPropertyChange_, this)); + var view = map.getView(); + + if (view) { + this.bindView_(view); + + if (view.isDef()) { + this.ovmap_.updateSize(); + this.resetExtent_(); + } + } + } + }; + /** + * Handle map property changes. This only deals with changes to the map's view. + * @param {import("../Object.js").ObjectEvent} event The propertychange event. + * @private + */ + + + OverviewMap.prototype.handleMapPropertyChange_ = function (event) { + if (event.key === _MapProperty.default.VIEW) { + var oldView = + /** @type {import("../View.js").default} */ + event.oldValue; + + if (oldView) { + this.unbindView_(oldView); + } + + var newView = this.getMap().getView(); + this.bindView_(newView); + } + }; + /** + * Register listeners for view property changes. + * @param {import("../View.js").default} view The view. + * @private + */ + + + OverviewMap.prototype.bindView_ = function (view) { + if (!this.view_) { + // Unless an explicit view definition was given, derive default from whatever main map uses. + var newView = new _View.default({ + projection: view.getProjection() + }); + this.ovmap_.setView(newView); + } + + view.addEventListener((0, _Object.getChangeEventType)(_ViewProperty.default.ROTATION), this.boundHandleRotationChanged_); // Sync once with the new view + + this.handleRotationChanged_(); + }; + /** + * Unregister listeners for view property changes. + * @param {import("../View.js").default} view The view. + * @private + */ + + + OverviewMap.prototype.unbindView_ = function (view) { + view.removeEventListener((0, _Object.getChangeEventType)(_ViewProperty.default.ROTATION), this.boundHandleRotationChanged_); + }; + /** + * Handle rotation changes to the main map. + * @private + */ + + + OverviewMap.prototype.handleRotationChanged_ = function () { + if (this.rotateWithView_) { + this.ovmap_.getView().setRotation(this.getMap().getView().getRotation()); + } + }; + /** + * Reset the overview map extent if the box size (width or + * height) is less than the size of the overview map size times minRatio + * or is greater than the size of the overview size times maxRatio. + * + * If the map extent was not reset, the box size can fits in the defined + * ratio sizes. This method then checks if is contained inside the overview + * map current extent. If not, recenter the overview map to the current + * main map center location. + * @private + */ + + + OverviewMap.prototype.validateExtent_ = function () { + var map = this.getMap(); + var ovmap = this.ovmap_; + + if (!map.isRendered() || !ovmap.isRendered()) { + return; + } + + var mapSize = + /** @type {import("../size.js").Size} */ + map.getSize(); + var view = map.getView(); + var extent = view.calculateExtentInternal(mapSize); + + if (this.viewExtent_ && (0, _extent.equals)(extent, this.viewExtent_)) { + // repeats of the same extent may indicate constraint conflicts leading to an endless cycle + return; + } + + this.viewExtent_ = extent; + var ovmapSize = + /** @type {import("../size.js").Size} */ + ovmap.getSize(); + var ovview = ovmap.getView(); + var ovextent = ovview.calculateExtentInternal(ovmapSize); + var topLeftPixel = ovmap.getPixelFromCoordinateInternal((0, _extent.getTopLeft)(extent)); + var bottomRightPixel = ovmap.getPixelFromCoordinateInternal((0, _extent.getBottomRight)(extent)); + var boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]); + var boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]); + var ovmapWidth = ovmapSize[0]; + var ovmapHeight = ovmapSize[1]; + + if (boxWidth < ovmapWidth * MIN_RATIO || boxHeight < ovmapHeight * MIN_RATIO || boxWidth > ovmapWidth * MAX_RATIO || boxHeight > ovmapHeight * MAX_RATIO) { + this.resetExtent_(); + } else if (!(0, _extent.containsExtent)(ovextent, extent)) { + this.recenter_(); + } + }; + /** + * Reset the overview map extent to half calculated min and max ratio times + * the extent of the main map. + * @private + */ + + + OverviewMap.prototype.resetExtent_ = function () { + if (MAX_RATIO === 0 || MIN_RATIO === 0) { + return; + } + + var map = this.getMap(); + var ovmap = this.ovmap_; + var mapSize = + /** @type {import("../size.js").Size} */ + map.getSize(); + var view = map.getView(); + var extent = view.calculateExtentInternal(mapSize); + var ovview = ovmap.getView(); // get how many times the current map overview could hold different + // box sizes using the min and max ratio, pick the step in the middle used + // to calculate the extent from the main map to set it to the overview map, + + var steps = Math.log(MAX_RATIO / MIN_RATIO) / Math.LN2; + var ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO); + (0, _extent.scaleFromCenter)(extent, ratio); + ovview.fitInternal((0, _Polygon.fromExtent)(extent)); + }; + /** + * Set the center of the overview map to the map center without changing its + * resolution. + * @private + */ + + + OverviewMap.prototype.recenter_ = function () { + var map = this.getMap(); + var ovmap = this.ovmap_; + var view = map.getView(); + var ovview = ovmap.getView(); + ovview.setCenterInternal(view.getCenterInternal()); + }; + /** + * Update the box using the main map extent + * @private + */ + + + OverviewMap.prototype.updateBox_ = function () { + var map = this.getMap(); + var ovmap = this.ovmap_; + + if (!map.isRendered() || !ovmap.isRendered()) { + return; + } + + var mapSize = + /** @type {import("../size.js").Size} */ + map.getSize(); + var view = map.getView(); + var ovview = ovmap.getView(); + var rotation = this.rotateWithView_ ? 0 : -view.getRotation(); + var overlay = this.boxOverlay_; + var box = this.boxOverlay_.getElement(); + var center = view.getCenterInternal(); + var resolution = view.getResolution(); + var ovresolution = ovview.getResolution(); + var width = mapSize[0] * resolution / ovresolution; + var height = mapSize[1] * resolution / ovresolution; // set position using center coordinates + + overlay.setPosition(center); // set box size calculated from map extent size and overview map resolution + + if (box) { + box.style.width = width + 'px'; + box.style.height = height + 'px'; + var transform = 'rotate(' + rotation + 'rad)'; + box.style.transform = transform; + } + }; + /** + * @param {MouseEvent} event The event to handle + * @private + */ + + + OverviewMap.prototype.handleClick_ = function (event) { + event.preventDefault(); + this.handleToggle_(); + }; + /** + * @private + */ + + + OverviewMap.prototype.handleToggle_ = function () { + this.element.classList.toggle(_css.CLASS_COLLAPSED); + + if (this.collapsed_) { + (0, _dom.replaceNode)(this.collapseLabel_, this.label_); + } else { + (0, _dom.replaceNode)(this.label_, this.collapseLabel_); + } + + this.collapsed_ = !this.collapsed_; // manage overview map if it had not been rendered before and control + // is expanded + + var ovmap = this.ovmap_; + + if (!this.collapsed_) { + if (ovmap.isRendered()) { + this.viewExtent_ = undefined; + ovmap.render(); + return; + } + + ovmap.updateSize(); + this.resetExtent_(); + (0, _events.listenOnce)(ovmap, _MapEventType.default.POSTRENDER, function (event) { + this.updateBox_(); + }, this); + } + }; + /** + * Return `true` if the overview map is collapsible, `false` otherwise. + * @return {boolean} True if the widget is collapsible. + * @api + */ + + + OverviewMap.prototype.getCollapsible = function () { + return this.collapsible_; + }; + /** + * Set whether the overview map should be collapsible. + * @param {boolean} collapsible True if the widget is collapsible. + * @api + */ + + + OverviewMap.prototype.setCollapsible = function (collapsible) { + if (this.collapsible_ === collapsible) { + return; + } + + this.collapsible_ = collapsible; + this.element.classList.toggle('ol-uncollapsible'); + + if (!collapsible && this.collapsed_) { + this.handleToggle_(); + } + }; + /** + * Collapse or expand the overview map according to the passed parameter. Will + * not do anything if the overview map isn't collapsible or if the current + * collapsed state is already the one requested. + * @param {boolean} collapsed True if the widget is collapsed. + * @api + */ + + + OverviewMap.prototype.setCollapsed = function (collapsed) { + if (!this.collapsible_ || this.collapsed_ === collapsed) { + return; + } + + this.handleToggle_(); + }; + /** + * Determine if the overview map is collapsed. + * @return {boolean} The overview map is collapsed. + * @api + */ + + + OverviewMap.prototype.getCollapsed = function () { + return this.collapsed_; + }; + /** + * Return `true` if the overview map view can rotate, `false` otherwise. + * @return {boolean} True if the control view can rotate. + * @api + */ + + + OverviewMap.prototype.getRotateWithView = function () { + return this.rotateWithView_; + }; + /** + * Set whether the overview map view should rotate with the main map view. + * @param {boolean} rotateWithView True if the control view should rotate. + * @api + */ + + + OverviewMap.prototype.setRotateWithView = function (rotateWithView) { + if (this.rotateWithView_ === rotateWithView) { + return; + } + + this.rotateWithView_ = rotateWithView; + + if (this.getMap().getView().getRotation() !== 0) { + if (this.rotateWithView_) { + this.handleRotationChanged_(); + } else { + this.ovmap_.getView().setRotation(0); + } + + this.viewExtent_ = undefined; + this.validateExtent_(); + this.updateBox_(); + } + }; + /** + * Return the overview map. + * @return {import("../PluggableMap.js").default} Overview map. + * @api + */ + + + OverviewMap.prototype.getOverviewMap = function () { + return this.ovmap_; + }; + /** + * Update the overview map element. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + + + OverviewMap.prototype.render = function (mapEvent) { + this.validateExtent_(); + this.updateBox_(); + }; + + return OverviewMap; +}(_Control.default); + +var _default = OverviewMap; +exports.default = _default; +},{"../renderer/Composite.js":"../../../node_modules/ol/renderer/Composite.js","./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../MapEventType.js":"../../../node_modules/ol/MapEventType.js","../MapProperty.js":"../../../node_modules/ol/MapProperty.js","../ObjectEventType.js":"../../../node_modules/ol/ObjectEventType.js","../Overlay.js":"../../../node_modules/ol/Overlay.js","../OverlayPositioning.js":"../../../node_modules/ol/OverlayPositioning.js","../PluggableMap.js":"../../../node_modules/ol/PluggableMap.js","../View.js":"../../../node_modules/ol/View.js","../ViewProperty.js":"../../../node_modules/ol/ViewProperty.js","../css.js":"../../../node_modules/ol/css.js","../extent.js":"../../../node_modules/ol/extent.js","../Object.js":"../../../node_modules/ol/Object.js","../events.js":"../../../node_modules/ol/events.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js","../dom.js":"../../../node_modules/ol/dom.js"}],"../../../node_modules/ol/control/ScaleLine.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.Units = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _Units = _interopRequireDefault(require("../proj/Units.js")); + +var _css = require("../css.js"); + +var _proj = require("../proj.js"); + +var _asserts = require("../asserts.js"); + +var _Object = require("../Object.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/ScaleLine + */ + + +/** + * @type {string} + */ +var UNITS_PROP = 'units'; +/** + * Units for the scale line. Supported values are `'degrees'`, `'imperial'`, + * `'nautical'`, `'metric'`, `'us'`. + * @enum {string} + */ + +var Units = { + DEGREES: 'degrees', + IMPERIAL: 'imperial', + NAUTICAL: 'nautical', + METRIC: 'metric', + US: 'us' +}; +/** + * @const + * @type {Array<number>} + */ + +exports.Units = Units; +var LEADING_DIGITS = [1, 2, 5]; +/** + * @const + * @type {number} + */ + +var DEFAULT_DPI = 25.4 / 0.28; +/** + * @typedef {Object} Options + * @property {string} [className='ol-scale-line'] CSS Class name. + * @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be + * adjusted to match the dpi used. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when the control + * should be re-rendered. This is called in a `requestAnimationFrame` callback. + * @property {HTMLElement|string} [target] Specify a target if you want the control + * to be rendered outside of the map's viewport. + * @property {import("./ScaleLine.js").Units|string} [units='metric'] Units. + * @property {boolean} [bar=false] Render scalebars instead of a line. + * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers + * for best results. Only applies when `bar` is `true`. + * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies + * when `bar` is `true`. + * @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies + * when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed. + */ + +/** + * @classdesc + * A control displaying rough y-axis distances, calculated for the center of the + * viewport. For conformal projections (e.g. EPSG:3857, the default view + * projection in OpenLayers), the scale is valid for all directions. + * No scale line will be shown when the y-axis distance of a pixel at the + * viewport center cannot be calculated in the view projection. + * By default the scale line will show in the bottom left portion of the map, + * but this can be changed by using the css selector `.ol-scale-line`. + * When specifying `bar` as `true`, a scalebar will be rendered instead + * of a scaleline. + * + * @api + */ + +var ScaleLine = +/** @class */ +function (_super) { + __extends(ScaleLine, _super); + /** + * @param {Options=} opt_options Scale line options. + */ + + + function ScaleLine(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var className = options.className !== undefined ? options.className : options.bar ? 'ol-scale-bar' : 'ol-scale-line'; + _this = _super.call(this, { + element: document.createElement('div'), + render: options.render, + target: options.target + }) || this; + /** + * @private + * @type {HTMLElement} + */ + + _this.innerElement_ = document.createElement('div'); + _this.innerElement_.className = className + '-inner'; + _this.element.className = className + ' ' + _css.CLASS_UNSELECTABLE; + + _this.element.appendChild(_this.innerElement_); + /** + * @private + * @type {?import("../View.js").State} + */ + + + _this.viewState_ = null; + /** + * @private + * @type {number} + */ + + _this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64; + /** + * @private + * @type {boolean} + */ + + _this.renderedVisible_ = false; + /** + * @private + * @type {number|undefined} + */ + + _this.renderedWidth_ = undefined; + /** + * @private + * @type {string} + */ + + _this.renderedHTML_ = ''; + + _this.addEventListener((0, _Object.getChangeEventType)(UNITS_PROP), _this.handleUnitsChanged_); + + _this.setUnits(options.units || Units.METRIC); + /** + * @private + * @type {boolean} + */ + + + _this.scaleBar_ = options.bar || false; + /** + * @private + * @type {number} + */ + + _this.scaleBarSteps_ = options.steps || 4; + /** + * @private + * @type {boolean} + */ + + _this.scaleBarText_ = options.text || false; + /** + * @private + * @type {number|undefined} + */ + + _this.dpi_ = options.dpi || undefined; + return _this; + } + /** + * Return the units to use in the scale line. + * @return {import("./ScaleLine.js").Units} The units + * to use in the scale line. + * @observable + * @api + */ + + + ScaleLine.prototype.getUnits = function () { + return this.get(UNITS_PROP); + }; + /** + * @private + */ + + + ScaleLine.prototype.handleUnitsChanged_ = function () { + this.updateElement_(); + }; + /** + * Set the units to use in the scale line. + * @param {import("./ScaleLine.js").Units} units The units to use in the scale line. + * @observable + * @api + */ + + + ScaleLine.prototype.setUnits = function (units) { + this.set(UNITS_PROP, units); + }; + /** + * Specify the dpi of output device such as printer. + * @param {number|undefined} dpi The dpi of output device. + * @api + */ + + + ScaleLine.prototype.setDpi = function (dpi) { + this.dpi_ = dpi; + }; + /** + * @private + */ + + + ScaleLine.prototype.updateElement_ = function () { + var viewState = this.viewState_; + + if (!viewState) { + if (this.renderedVisible_) { + this.element.style.display = 'none'; + this.renderedVisible_ = false; + } + + return; + } + + var center = viewState.center; + var projection = viewState.projection; + var units = this.getUnits(); + var pointResolutionUnits = units == Units.DEGREES ? _Units.default.DEGREES : _Units.default.METERS; + var pointResolution = (0, _proj.getPointResolution)(projection, viewState.resolution, center, pointResolutionUnits); + var minWidth = this.minWidth_ * (this.dpi_ || DEFAULT_DPI) / DEFAULT_DPI; + var nominalCount = minWidth * pointResolution; + var suffix = ''; + + if (units == Units.DEGREES) { + var metersPerDegree = _proj.METERS_PER_UNIT[_Units.default.DEGREES]; + nominalCount *= metersPerDegree; + + if (nominalCount < metersPerDegree / 60) { + suffix = '\u2033'; // seconds + + pointResolution *= 3600; + } else if (nominalCount < metersPerDegree) { + suffix = '\u2032'; // minutes + + pointResolution *= 60; + } else { + suffix = '\u00b0'; // degrees + } + } else if (units == Units.IMPERIAL) { + if (nominalCount < 0.9144) { + suffix = 'in'; + pointResolution /= 0.0254; + } else if (nominalCount < 1609.344) { + suffix = 'ft'; + pointResolution /= 0.3048; + } else { + suffix = 'mi'; + pointResolution /= 1609.344; + } + } else if (units == Units.NAUTICAL) { + pointResolution /= 1852; + suffix = 'nm'; + } else if (units == Units.METRIC) { + if (nominalCount < 0.001) { + suffix = 'μm'; + pointResolution *= 1000000; + } else if (nominalCount < 1) { + suffix = 'mm'; + pointResolution *= 1000; + } else if (nominalCount < 1000) { + suffix = 'm'; + } else { + suffix = 'km'; + pointResolution /= 1000; + } + } else if (units == Units.US) { + if (nominalCount < 0.9144) { + suffix = 'in'; + pointResolution *= 39.37; + } else if (nominalCount < 1609.344) { + suffix = 'ft'; + pointResolution /= 0.30480061; + } else { + suffix = 'mi'; + pointResolution /= 1609.3472; + } + } else { + (0, _asserts.assert)(false, 33); // Invalid units + } + + var i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10)); + var count, width, decimalCount; + + while (true) { + decimalCount = Math.floor(i / 3); + var decimal = Math.pow(10, decimalCount); + count = LEADING_DIGITS[(i % 3 + 3) % 3] * decimal; + width = Math.round(count / pointResolution); + + if (isNaN(width)) { + this.element.style.display = 'none'; + this.renderedVisible_ = false; + return; + } else if (width >= minWidth) { + break; + } + + ++i; + } + + var html; + + if (this.scaleBar_) { + html = this.createScaleBar(width, count, suffix); + } else { + html = count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix; + } + + if (this.renderedHTML_ != html) { + this.innerElement_.innerHTML = html; + this.renderedHTML_ = html; + } + + if (this.renderedWidth_ != width) { + this.innerElement_.style.width = width + 'px'; + this.renderedWidth_ = width; + } + + if (!this.renderedVisible_) { + this.element.style.display = ''; + this.renderedVisible_ = true; + } + }; + /** + * @private + * @param {number} width The current width of the scalebar. + * @param {number} scale The current scale. + * @param {string} suffix The suffix to append to the scale text. + * @returns {string} The stringified HTML of the scalebar. + */ + + + ScaleLine.prototype.createScaleBar = function (width, scale, suffix) { + var mapScale = '1 : ' + Math.round(this.getScaleForResolution()).toLocaleString(); + var scaleSteps = []; + var stepWidth = width / this.scaleBarSteps_; + var backgroundColor = '#ffffff'; + + for (var i = 0; i < this.scaleBarSteps_; i++) { + if (i === 0) { + // create the first marker at position 0 + scaleSteps.push(this.createMarker('absolute', i)); + } + + scaleSteps.push('<div>' + '<div ' + 'class="ol-scale-singlebar" ' + 'style=' + '"width: ' + stepWidth + 'px;' + 'background-color: ' + backgroundColor + ';"' + '>' + '</div>' + this.createMarker('relative', i) + ( + /*render text every second step, except when only 2 steps */ + i % 2 === 0 || this.scaleBarSteps_ === 2 ? this.createStepText(i, width, false, scale, suffix) : '') + '</div>'); + + if (i === this.scaleBarSteps_ - 1) { + { + /*render text at the end */ + } + scaleSteps.push(this.createStepText(i + 1, width, true, scale, suffix)); + } // switch colors of steps between black and white + + + if (backgroundColor === '#ffffff') { + backgroundColor = '#000000'; + } else { + backgroundColor = '#ffffff'; + } + } + + var scaleBarText; + + if (this.scaleBarText_) { + scaleBarText = '<div ' + 'class="ol-scale-text" ' + 'style="width: ' + width + 'px;">' + mapScale + '</div>'; + } else { + scaleBarText = ''; + } + + var container = '<div ' + 'style="display: flex;">' + scaleBarText + scaleSteps.join('') + '</div>'; + return container; + }; + /** + * Creates a marker at given position + * @param {string} position - The position, absolute or relative + * @param {number} i - The iterator + * @returns {string} The stringified div containing the marker + */ + + + ScaleLine.prototype.createMarker = function (position, i) { + var top = position === 'absolute' ? 3 : -10; + return '<div ' + 'class="ol-scale-step-marker" ' + 'style="position: ' + position + ';' + 'top: ' + top + 'px;"' + '></div>'; + }; + /** + * Creates the label for a marker marker at given position + * @param {number} i - The iterator + * @param {number} width - The width the scalebar will currently use + * @param {boolean} isLast - Flag indicating if we add the last step text + * @param {number} scale - The current scale for the whole scalebar + * @param {string} suffix - The suffix for the scale + * @returns {string} The stringified div containing the step text + */ + + + ScaleLine.prototype.createStepText = function (i, width, isLast, scale, suffix) { + var length = i === 0 ? 0 : Math.round(scale / this.scaleBarSteps_ * i * 100) / 100; + var lengthString = length + (i === 0 ? '' : ' ' + suffix); + var margin = i === 0 ? -3 : width / this.scaleBarSteps_ * -1; + var minWidth = i === 0 ? 0 : width / this.scaleBarSteps_ * 2; + return '<div ' + 'class="ol-scale-step-text" ' + 'style="' + 'margin-left: ' + margin + 'px;' + 'text-align: ' + (i === 0 ? 'left' : 'center') + '; ' + 'min-width: ' + minWidth + 'px;' + 'left: ' + (isLast ? width + 'px' : 'unset') + ';"' + '>' + lengthString + '</div>'; + }; + /** + * Returns the appropriate scale for the given resolution and units. + * @return {number} The appropriate scale. + */ + + + ScaleLine.prototype.getScaleForResolution = function () { + var resolution = (0, _proj.getPointResolution)(this.viewState_.projection, this.viewState_.resolution, this.viewState_.center); + var dpi = this.dpi_ || DEFAULT_DPI; + var mpu = this.viewState_.projection.getMetersPerUnit(); + var inchesPerMeter = 39.37; + return parseFloat(resolution.toString()) * mpu * inchesPerMeter * dpi; + }; + /** + * Update the scale line element. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + + + ScaleLine.prototype.render = function (mapEvent) { + var frameState = mapEvent.frameState; + + if (!frameState) { + this.viewState_ = null; + } else { + this.viewState_ = frameState.viewState; + } + + this.updateElement_(); + }; + + return ScaleLine; +}(_Control.default); + +var _default = ScaleLine; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../proj/Units.js":"../../../node_modules/ol/proj/Units.js","../css.js":"../../../node_modules/ol/css.js","../proj.js":"../../../node_modules/ol/proj.js","../asserts.js":"../../../node_modules/ol/asserts.js","../Object.js":"../../../node_modules/ol/Object.js"}],"../../../node_modules/ol/control/ZoomSlider.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _EventType2 = _interopRequireDefault(require("../pointer/EventType.js")); + +var _css = require("../css.js"); + +var _math = require("../math.js"); + +var _easing = require("../easing.js"); + +var _events = require("../events.js"); + +var _Event = require("../events/Event.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/control/ZoomSlider + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * The enum for available directions. + * + * @enum {number} + */ +var Direction = { + VERTICAL: 0, + HORIZONTAL: 1 +}; +/** + * @typedef {Object} Options + * @property {string} [className='ol-zoomslider'] CSS class name. + * @property {number} [duration=200] Animation duration in milliseconds. + * @property {function(import("../MapEvent.js").default):void} [render] Function called when the control + * should be re-rendered. This is called in a `requestAnimationFrame` callback. + */ + +/** + * @classdesc + * A slider type of control for zooming. + * + * Example: + * + * map.addControl(new ZoomSlider()); + * + * @api + */ + +var ZoomSlider = +/** @class */ +function (_super) { + __extends(ZoomSlider, _super); + /** + * @param {Options=} opt_options Zoom slider options. + */ + + + function ZoomSlider(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + render: options.render + }) || this; + /** + * @type {!Array.<import("../events.js").EventsKey>} + * @private + */ + + _this.dragListenerKeys_ = []; + /** + * Will hold the current resolution of the view. + * + * @type {number|undefined} + * @private + */ + + _this.currentResolution_ = undefined; + /** + * The direction of the slider. Will be determined from actual display of the + * container and defaults to Direction.VERTICAL. + * + * @type {Direction} + * @private + */ + + _this.direction_ = Direction.VERTICAL; + /** + * @type {boolean} + * @private + */ + + _this.dragging_; + /** + * @type {number} + * @private + */ + + _this.heightLimit_ = 0; + /** + * @type {number} + * @private + */ + + _this.widthLimit_ = 0; + /** + * @type {number|undefined} + * @private + */ + + _this.startX_; + /** + * @type {number|undefined} + * @private + */ + + _this.startY_; + /** + * The calculated thumb size (border box plus margins). Set when initSlider_ + * is called. + * @type {import("../size.js").Size} + * @private + */ + + _this.thumbSize_ = null; + /** + * Whether the slider is initialized. + * @type {boolean} + * @private + */ + + _this.sliderInitialized_ = false; + /** + * @type {number} + * @private + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 200; + var className = options.className !== undefined ? options.className : 'ol-zoomslider'; + var thumbElement = document.createElement('button'); + thumbElement.setAttribute('type', 'button'); + thumbElement.className = className + '-thumb ' + _css.CLASS_UNSELECTABLE; + var containerElement = _this.element; + containerElement.className = className + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL; + containerElement.appendChild(thumbElement); + containerElement.addEventListener(_EventType2.default.POINTERDOWN, _this.handleDraggerStart_.bind(_this), false); + containerElement.addEventListener(_EventType2.default.POINTERMOVE, _this.handleDraggerDrag_.bind(_this), false); + containerElement.addEventListener(_EventType2.default.POINTERUP, _this.handleDraggerEnd_.bind(_this), false); + containerElement.addEventListener(_EventType.default.CLICK, _this.handleContainerClick_.bind(_this), false); + thumbElement.addEventListener(_EventType.default.CLICK, _Event.stopPropagation, false); + return _this; + } + /** + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + ZoomSlider.prototype.setMap = function (map) { + _super.prototype.setMap.call(this, map); + + if (map) { + map.render(); + } + }; + /** + * Initializes the slider element. This will determine and set this controls + * direction_ and also constrain the dragging of the thumb to always be within + * the bounds of the container. + * + * @return {boolean} Initialization successful + * @private + */ + + + ZoomSlider.prototype.initSlider_ = function () { + var container = this.element; + var containerWidth = container.offsetWidth; + var containerHeight = container.offsetHeight; + + if (containerWidth === 0 && containerHeight === 0) { + return this.sliderInitialized_ = false; + } + + var thumb = + /** @type {HTMLElement} */ + container.firstElementChild; + var computedStyle = getComputedStyle(thumb); + var thumbWidth = thumb.offsetWidth + parseFloat(computedStyle['marginRight']) + parseFloat(computedStyle['marginLeft']); + var thumbHeight = thumb.offsetHeight + parseFloat(computedStyle['marginTop']) + parseFloat(computedStyle['marginBottom']); + this.thumbSize_ = [thumbWidth, thumbHeight]; + + if (containerWidth > containerHeight) { + this.direction_ = Direction.HORIZONTAL; + this.widthLimit_ = containerWidth - thumbWidth; + } else { + this.direction_ = Direction.VERTICAL; + this.heightLimit_ = containerHeight - thumbHeight; + } + + return this.sliderInitialized_ = true; + }; + /** + * @param {PointerEvent} event The browser event to handle. + * @private + */ + + + ZoomSlider.prototype.handleContainerClick_ = function (event) { + var view = this.getMap().getView(); + var relativePosition = this.getRelativePosition_(event.offsetX - this.thumbSize_[0] / 2, event.offsetY - this.thumbSize_[1] / 2); + var resolution = this.getResolutionForPosition_(relativePosition); + var zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution)); + view.animateInternal({ + zoom: zoom, + duration: this.duration_, + easing: _easing.easeOut + }); + }; + /** + * Handle dragger start events. + * @param {PointerEvent} event The drag event. + * @private + */ + + + ZoomSlider.prototype.handleDraggerStart_ = function (event) { + if (!this.dragging_ && event.target === this.element.firstElementChild) { + var element = + /** @type {HTMLElement} */ + this.element.firstElementChild; + this.getMap().getView().beginInteraction(); + this.startX_ = event.clientX - parseFloat(element.style.left); + this.startY_ = event.clientY - parseFloat(element.style.top); + this.dragging_ = true; + + if (this.dragListenerKeys_.length === 0) { + var drag = this.handleDraggerDrag_; + var end = this.handleDraggerEnd_; + this.dragListenerKeys_.push((0, _events.listen)(document, _EventType2.default.POINTERMOVE, drag, this), (0, _events.listen)(document, _EventType2.default.POINTERUP, end, this)); + } + } + }; + /** + * Handle dragger drag events. + * + * @param {PointerEvent} event The drag event. + * @private + */ + + + ZoomSlider.prototype.handleDraggerDrag_ = function (event) { + if (this.dragging_) { + var deltaX = event.clientX - this.startX_; + var deltaY = event.clientY - this.startY_; + var relativePosition = this.getRelativePosition_(deltaX, deltaY); + this.currentResolution_ = this.getResolutionForPosition_(relativePosition); + this.getMap().getView().setResolution(this.currentResolution_); + } + }; + /** + * Handle dragger end events. + * @param {PointerEvent} event The drag event. + * @private + */ + + + ZoomSlider.prototype.handleDraggerEnd_ = function (event) { + if (this.dragging_) { + var view = this.getMap().getView(); + view.endInteraction(); + this.dragging_ = false; + this.startX_ = undefined; + this.startY_ = undefined; + this.dragListenerKeys_.forEach(_events.unlistenByKey); + this.dragListenerKeys_.length = 0; + } + }; + /** + * Positions the thumb inside its container according to the given resolution. + * + * @param {number} res The res. + * @private + */ + + + ZoomSlider.prototype.setThumbPosition_ = function (res) { + var position = this.getPositionForResolution_(res); + var thumb = + /** @type {HTMLElement} */ + this.element.firstElementChild; + + if (this.direction_ == Direction.HORIZONTAL) { + thumb.style.left = this.widthLimit_ * position + 'px'; + } else { + thumb.style.top = this.heightLimit_ * position + 'px'; + } + }; + /** + * Calculates the relative position of the thumb given x and y offsets. The + * relative position scales from 0 to 1. The x and y offsets are assumed to be + * in pixel units within the dragger limits. + * + * @param {number} x Pixel position relative to the left of the slider. + * @param {number} y Pixel position relative to the top of the slider. + * @return {number} The relative position of the thumb. + * @private + */ + + + ZoomSlider.prototype.getRelativePosition_ = function (x, y) { + var amount; + + if (this.direction_ === Direction.HORIZONTAL) { + amount = x / this.widthLimit_; + } else { + amount = y / this.heightLimit_; + } + + return (0, _math.clamp)(amount, 0, 1); + }; + /** + * Calculates the corresponding resolution of the thumb given its relative + * position (where 0 is the minimum and 1 is the maximum). + * + * @param {number} position The relative position of the thumb. + * @return {number} The corresponding resolution. + * @private + */ + + + ZoomSlider.prototype.getResolutionForPosition_ = function (position) { + var fn = this.getMap().getView().getResolutionForValueFunction(); + return fn(1 - position); + }; + /** + * Determines the relative position of the slider for the given resolution. A + * relative position of 0 corresponds to the minimum view resolution. A + * relative position of 1 corresponds to the maximum view resolution. + * + * @param {number} res The resolution. + * @return {number} The relative position value (between 0 and 1). + * @private + */ + + + ZoomSlider.prototype.getPositionForResolution_ = function (res) { + var fn = this.getMap().getView().getValueForResolutionFunction(); + return (0, _math.clamp)(1 - fn(res), 0, 1); + }; + /** + * Update the zoomslider element. + * @param {import("../MapEvent.js").default} mapEvent Map event. + * @override + */ + + + ZoomSlider.prototype.render = function (mapEvent) { + if (!mapEvent.frameState) { + return; + } + + if (!this.sliderInitialized_ && !this.initSlider_()) { + return; + } + + var res = mapEvent.frameState.viewState.resolution; + this.currentResolution_ = res; + this.setThumbPosition_(res); + }; + + return ZoomSlider; +}(_Control.default); + +var _default = ZoomSlider; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../pointer/EventType.js":"../../../node_modules/ol/pointer/EventType.js","../css.js":"../../../node_modules/ol/css.js","../math.js":"../../../node_modules/ol/math.js","../easing.js":"../../../node_modules/ol/easing.js","../events.js":"../../../node_modules/ol/events.js","../events/Event.js":"../../../node_modules/ol/events/Event.js"}],"../../../node_modules/ol/control/ZoomToExtent.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Control = _interopRequireDefault(require("./Control.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _css = require("../css.js"); + +var _Polygon = require("../geom/Polygon.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/control/ZoomToExtent + */ + + +/** + * @typedef {Object} Options + * @property {string} [className='ol-zoom-extent'] Class name. + * @property {HTMLElement|string} [target] Specify a target if you want the control + * to be rendered outside of the map's viewport. + * @property {string|HTMLElement} [label='E'] Text label to use for the button. + * Instead of text, also an element (e.g. a `span` element) can be used. + * @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip. + * @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity + * extent of the view projection is used. + */ + +/** + * @classdesc + * A button control which, when pressed, changes the map view to a specific + * extent. To style this control use the css selector `.ol-zoom-extent`. + * + * @api + */ +var ZoomToExtent = +/** @class */ +function (_super) { + __extends(ZoomToExtent, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function ZoomToExtent(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + element: document.createElement('div'), + target: options.target + }) || this; + /** + * @type {?import("../extent.js").Extent} + * @protected + */ + + _this.extent = options.extent ? options.extent : null; + var className = options.className !== undefined ? options.className : 'ol-zoom-extent'; + var label = options.label !== undefined ? options.label : 'E'; + var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent'; + var button = document.createElement('button'); + button.setAttribute('type', 'button'); + button.title = tipLabel; + button.appendChild(typeof label === 'string' ? document.createTextNode(label) : label); + button.addEventListener(_EventType.default.CLICK, _this.handleClick_.bind(_this), false); + var cssClasses = className + ' ' + _css.CLASS_UNSELECTABLE + ' ' + _css.CLASS_CONTROL; + var element = _this.element; + element.className = cssClasses; + element.appendChild(button); + return _this; + } + /** + * @param {MouseEvent} event The event to handle + * @private + */ + + + ZoomToExtent.prototype.handleClick_ = function (event) { + event.preventDefault(); + this.handleZoomToExtent(); + }; + /** + * @protected + */ + + + ZoomToExtent.prototype.handleZoomToExtent = function () { + var map = this.getMap(); + var view = map.getView(); + var extent = !this.extent ? view.getProjection().getExtent() : this.extent; + view.fitInternal((0, _Polygon.fromExtent)(extent)); + }; + + return ZoomToExtent; +}(_Control.default); + +var _default = ZoomToExtent; +exports.default = _default; +},{"./Control.js":"../../../node_modules/ol/control/Control.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../css.js":"../../../node_modules/ol/css.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js"}],"../../../node_modules/ol/control.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.defaults = defaults; +Object.defineProperty(exports, "Attribution", { + enumerable: true, + get: function () { + return _Attribution.default; + } +}); +Object.defineProperty(exports, "Rotate", { + enumerable: true, + get: function () { + return _Rotate.default; + } +}); +Object.defineProperty(exports, "Zoom", { + enumerable: true, + get: function () { + return _Zoom.default; + } +}); +Object.defineProperty(exports, "Control", { + enumerable: true, + get: function () { + return _Control.default; + } +}); +Object.defineProperty(exports, "FullScreen", { + enumerable: true, + get: function () { + return _FullScreen.default; + } +}); +Object.defineProperty(exports, "MousePosition", { + enumerable: true, + get: function () { + return _MousePosition.default; + } +}); +Object.defineProperty(exports, "OverviewMap", { + enumerable: true, + get: function () { + return _OverviewMap.default; + } +}); +Object.defineProperty(exports, "ScaleLine", { + enumerable: true, + get: function () { + return _ScaleLine.default; + } +}); +Object.defineProperty(exports, "ZoomSlider", { + enumerable: true, + get: function () { + return _ZoomSlider.default; + } +}); +Object.defineProperty(exports, "ZoomToExtent", { + enumerable: true, + get: function () { + return _ZoomToExtent.default; + } +}); + +var _Attribution = _interopRequireDefault(require("./control/Attribution.js")); + +var _Collection = _interopRequireDefault(require("./Collection.js")); + +var _Rotate = _interopRequireDefault(require("./control/Rotate.js")); + +var _Zoom = _interopRequireDefault(require("./control/Zoom.js")); + +var _Control = _interopRequireDefault(require("./control/Control.js")); + +var _FullScreen = _interopRequireDefault(require("./control/FullScreen.js")); + +var _MousePosition = _interopRequireDefault(require("./control/MousePosition.js")); + +var _OverviewMap = _interopRequireDefault(require("./control/OverviewMap.js")); + +var _ScaleLine = _interopRequireDefault(require("./control/ScaleLine.js")); + +var _ZoomSlider = _interopRequireDefault(require("./control/ZoomSlider.js")); + +var _ZoomToExtent = _interopRequireDefault(require("./control/ZoomToExtent.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/control + */ + +/** + * @typedef {Object} DefaultsOptions + * @property {boolean} [attribution=true] Include + * {@link module:ol/control/Attribution~Attribution}. + * @property {import("./control/Attribution.js").Options} [attributionOptions] + * Options for {@link module:ol/control/Attribution~Attribution}. + * @property {boolean} [rotate=true] Include + * {@link module:ol/control/Rotate~Rotate}. + * @property {import("./control/Rotate.js").Options} [rotateOptions] Options + * for {@link module:ol/control/Rotate~Rotate}. + * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}. + * @property {import("./control/Zoom.js").Options} [zoomOptions] Options for + * {@link module:ol/control/Zoom~Zoom}. + * @api + */ + +/** + * Set of controls included in maps by default. Unless configured otherwise, + * this returns a collection containing an instance of each of the following + * controls: + * * {@link module:ol/control/Zoom~Zoom} + * * {@link module:ol/control/Rotate~Rotate} + * * {@link module:ol/control/Attribution~Attribution} + * + * @param {DefaultsOptions=} opt_options + * Defaults options. + * @return {Collection<import("./control/Control.js").default>} + * Controls. + * @api + */ +function defaults(opt_options) { + var options = opt_options ? opt_options : {}; + var controls = new _Collection.default(); + var zoomControl = options.zoom !== undefined ? options.zoom : true; + + if (zoomControl) { + controls.push(new _Zoom.default(options.zoomOptions)); + } + + var rotateControl = options.rotate !== undefined ? options.rotate : true; + + if (rotateControl) { + controls.push(new _Rotate.default(options.rotateOptions)); + } + + var attributionControl = options.attribution !== undefined ? options.attribution : true; + + if (attributionControl) { + controls.push(new _Attribution.default(options.attributionOptions)); + } + + return controls; +} +},{"./control/Attribution.js":"../../../node_modules/ol/control/Attribution.js","./Collection.js":"../../../node_modules/ol/Collection.js","./control/Rotate.js":"../../../node_modules/ol/control/Rotate.js","./control/Zoom.js":"../../../node_modules/ol/control/Zoom.js","./control/Control.js":"../../../node_modules/ol/control/Control.js","./control/FullScreen.js":"../../../node_modules/ol/control/FullScreen.js","./control/MousePosition.js":"../../../node_modules/ol/control/MousePosition.js","./control/OverviewMap.js":"../../../node_modules/ol/control/OverviewMap.js","./control/ScaleLine.js":"../../../node_modules/ol/control/ScaleLine.js","./control/ZoomSlider.js":"../../../node_modules/ol/control/ZoomSlider.js","./control/ZoomToExtent.js":"../../../node_modules/ol/control/ZoomToExtent.js"}],"../../../node_modules/ol/interaction/Property.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/interaction/Property + */ + +/** + * @enum {string} + */ +var _default = { + ACTIVE: 'active' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/interaction/Interaction.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.pan = pan; +exports.zoomByDelta = zoomByDelta; +exports.default = void 0; + +var _Object = _interopRequireDefault(require("../Object.js")); + +var _Property = _interopRequireDefault(require("./Property.js")); + +var _easing = require("../easing.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Interaction + */ + + +/** + * Object literal with config options for interactions. + * @typedef {Object} InteractionOptions + * @property {function(import("../MapBrowserEvent.js").default):boolean} handleEvent + * Method called by the map to notify the interaction that a browser event was + * dispatched to the map. If the function returns a falsy value, propagation of + * the event to other interactions in the map's interactions chain will be + * prevented (this includes functions with no explicit return). The interactions + * are traversed in reverse order of the interactions collection of the map. + */ + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * User actions that change the state of the map. Some are similar to controls, + * but are not associated with a DOM element. + * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is + * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered + * by a keyboard event not a button element event. + * Although interactions do not have a DOM element, some of them do render + * vectors and so are visible on the screen. + * @api + */ +var Interaction = +/** @class */ +function (_super) { + __extends(Interaction, _super); + /** + * @param {InteractionOptions=} opt_options Options. + */ + + + function Interaction(opt_options) { + var _this = _super.call(this) || this; + + if (opt_options && opt_options.handleEvent) { + _this.handleEvent = opt_options.handleEvent; + } + /** + * @private + * @type {import("../PluggableMap.js").default} + */ + + + _this.map_ = null; + + _this.setActive(true); + + return _this; + } + /** + * Return whether the interaction is currently active. + * @return {boolean} `true` if the interaction is active, `false` otherwise. + * @observable + * @api + */ + + + Interaction.prototype.getActive = function () { + return ( + /** @type {boolean} */ + this.get(_Property.default.ACTIVE) + ); + }; + /** + * Get the map associated with this interaction. + * @return {import("../PluggableMap.js").default} Map. + * @api + */ + + + Interaction.prototype.getMap = function () { + return this.map_; + }; + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event}. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + * @api + */ + + + Interaction.prototype.handleEvent = function (mapBrowserEvent) { + return true; + }; + /** + * Activate or deactivate the interaction. + * @param {boolean} active Active. + * @observable + * @api + */ + + + Interaction.prototype.setActive = function (active) { + this.set(_Property.default.ACTIVE, active); + }; + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + Interaction.prototype.setMap = function (map) { + this.map_ = map; + }; + + return Interaction; +}(_Object.default); +/** + * @param {import("../View.js").default} view View. + * @param {import("../coordinate.js").Coordinate} delta Delta. + * @param {number=} opt_duration Duration. + */ + + +function pan(view, delta, opt_duration) { + var currentCenter = view.getCenterInternal(); + + if (currentCenter) { + var center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]]; + view.animateInternal({ + duration: opt_duration !== undefined ? opt_duration : 250, + easing: _easing.linear, + center: view.getConstrainedCenter(center) + }); + } +} +/** + * @param {import("../View.js").default} view View. + * @param {number} delta Delta from previous zoom level. + * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate in the user projection. + * @param {number=} opt_duration Duration. + */ + + +function zoomByDelta(view, delta, opt_anchor, opt_duration) { + var currentZoom = view.getZoom(); + + if (currentZoom === undefined) { + return; + } + + var newZoom = view.getConstrainedZoom(currentZoom + delta); + var newResolution = view.getResolutionForZoom(newZoom); + + if (view.getAnimating()) { + view.cancelAnimations(); + } + + view.animate({ + resolution: newResolution, + anchor: opt_anchor, + duration: opt_duration !== undefined ? opt_duration : 250, + easing: _easing.easeOut + }); +} + +var _default = Interaction; +exports.default = _default; +},{"../Object.js":"../../../node_modules/ol/Object.js","./Property.js":"../../../node_modules/ol/interaction/Property.js","../easing.js":"../../../node_modules/ol/easing.js"}],"../../../node_modules/ol/interaction/DoubleClickZoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Interaction = _interopRequireWildcard(require("./Interaction.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("../MapBrowserEventType.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/DoubleClickZoom + */ + + +/** + * @typedef {Object} Options + * @property {number} [duration=250] Animation duration in milliseconds. + * @property {number} [delta=1] The zoom delta applied on each double click. + */ + +/** + * @classdesc + * Allows the user to zoom by double-clicking on the map. + * @api + */ +var DoubleClickZoom = +/** @class */ +function (_super) { + __extends(DoubleClickZoom, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DoubleClickZoom(opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options ? opt_options : {}; + /** + * @private + * @type {number} + */ + + _this.delta_ = options.delta ? options.delta : 1; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 250; + return _this; + } + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a + * doubleclick) and eventually zooms the map. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + */ + + + DoubleClickZoom.prototype.handleEvent = function (mapBrowserEvent) { + var stopEvent = false; + + if (mapBrowserEvent.type == _MapBrowserEventType.default.DBLCLICK) { + var browserEvent = + /** @type {MouseEvent} */ + mapBrowserEvent.originalEvent; + var map = mapBrowserEvent.map; + var anchor = mapBrowserEvent.coordinate; + var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; + var view = map.getView(); + (0, _Interaction.zoomByDelta)(view, delta, anchor, this.duration_); + mapBrowserEvent.preventDefault(); + stopEvent = true; + } + + return !stopEvent; + }; + + return DoubleClickZoom; +}(_Interaction.default); + +var _default = DoubleClickZoom; +exports.default = _default; +},{"./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js"}],"../../../node_modules/ol/interaction/Pointer.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.centroid = centroid; +exports.default = void 0; + +var _Interaction = _interopRequireDefault(require("./Interaction.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("../MapBrowserEventType.js")); + +var _obj = require("../obj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Pointer + */ + + +/** + * @typedef {Object} Options + * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleDownEvent] + * Function handling "down" events. If the function returns `true` then a drag + * sequence is started. + * @property {function(import("../MapBrowserEvent.js").default):void} [handleDragEvent] + * Function handling "drag" events. This function is called on "move" events + * during a drag sequence. + * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent] + * Method called by the map to notify the interaction that a browser event was + * dispatched to the map. The function may return `false` to prevent the + * propagation of the event to other interactions in the map's interactions + * chain. + * @property {function(import("../MapBrowserEvent.js").default):void} [handleMoveEvent] + * Function handling "move" events. This function is called on "move" events. + * This functions is also called during a drag sequence, so during a drag + * sequence both the `handleDragEvent` function and this function are called. + * If `handleDownEvent` is defined and it returns true this function will not + * be called during a drag sequence. + * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleUpEvent] + * Function handling "up" events. If the function returns `false` then the + * current drag sequence is stopped. + * @property {function(boolean):boolean} [stopDown] + * Should the down event be propagated to other interactions, or should be + * stopped? + */ + +/** + * @classdesc + * Base class that calls user-defined functions on `down`, `move` and `up` + * events. This class also manages "drag sequences". + * + * When the `handleDownEvent` user function returns `true` a drag sequence is + * started. During a drag sequence the `handleDragEvent` user function is + * called on `move` events. The drag sequence ends when the `handleUpEvent` + * user function is called and returns `false`. + * @api + */ +var PointerInteraction = +/** @class */ +function (_super) { + __extends(PointerInteraction, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function PointerInteraction(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, + /** @type {import("./Interaction.js").InteractionOptions} */ + options) || this; + + if (options.handleDownEvent) { + _this.handleDownEvent = options.handleDownEvent; + } + + if (options.handleDragEvent) { + _this.handleDragEvent = options.handleDragEvent; + } + + if (options.handleMoveEvent) { + _this.handleMoveEvent = options.handleMoveEvent; + } + + if (options.handleUpEvent) { + _this.handleUpEvent = options.handleUpEvent; + } + + if (options.stopDown) { + _this.stopDown = options.stopDown; + } + /** + * @type {boolean} + * @protected + */ + + + _this.handlingDownUpSequence = false; + /** + * @type {!Object<string, PointerEvent>} + * @private + */ + + _this.trackedPointers_ = {}; + /** + * @type {Array<PointerEvent>} + * @protected + */ + + _this.targetPointers = []; + return _this; + } + /** + * Returns the current number of pointers involved in the interaction, + * e.g. `2` when two fingers are used. + * @return {number} The number of pointers. + * @api + */ + + + PointerInteraction.prototype.getPointerCount = function () { + return this.targetPointers.length; + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + * @protected + */ + + + PointerInteraction.prototype.handleDownEvent = function (mapBrowserEvent) { + return false; + }; + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @protected + */ + + + PointerInteraction.prototype.handleDragEvent = function (mapBrowserEvent) {}; + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into + * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are + * detected. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + * @api + */ + + + PointerInteraction.prototype.handleEvent = function (mapBrowserEvent) { + if (!mapBrowserEvent.originalEvent) { + return true; + } + + var stopEvent = false; + this.updateTrackedPointers_(mapBrowserEvent); + + if (this.handlingDownUpSequence) { + if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERDRAG) { + this.handleDragEvent(mapBrowserEvent); // prevent page scrolling during dragging + + mapBrowserEvent.preventDefault(); + } else if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERUP) { + var handledUp = this.handleUpEvent(mapBrowserEvent); + this.handlingDownUpSequence = handledUp && this.targetPointers.length > 0; + } + } else { + if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERDOWN) { + var handled = this.handleDownEvent(mapBrowserEvent); + this.handlingDownUpSequence = handled; + stopEvent = this.stopDown(handled); + } else if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERMOVE) { + this.handleMoveEvent(mapBrowserEvent); + } + } + + return !stopEvent; + }; + /** + * Handle pointer move events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @protected + */ + + + PointerInteraction.prototype.handleMoveEvent = function (mapBrowserEvent) {}; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + * @protected + */ + + + PointerInteraction.prototype.handleUpEvent = function (mapBrowserEvent) { + return false; + }; + /** + * This function is used to determine if "down" events should be propagated + * to other interactions or should be stopped. + * @param {boolean} handled Was the event handled by the interaction? + * @return {boolean} Should the `down` event be stopped? + */ + + + PointerInteraction.prototype.stopDown = function (handled) { + return handled; + }; + /** + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @private + */ + + + PointerInteraction.prototype.updateTrackedPointers_ = function (mapBrowserEvent) { + if (isPointerDraggingEvent(mapBrowserEvent)) { + var event_1 = mapBrowserEvent.originalEvent; + var id = event_1.pointerId.toString(); + + if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERUP) { + delete this.trackedPointers_[id]; + } else if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERDOWN) { + this.trackedPointers_[id] = event_1; + } else if (id in this.trackedPointers_) { + // update only when there was a pointerdown event for this pointer + this.trackedPointers_[id] = event_1; + } + + this.targetPointers = (0, _obj.getValues)(this.trackedPointers_); + } + }; + + return PointerInteraction; +}(_Interaction.default); +/** + * @param {Array<PointerEvent>} pointerEvents List of events. + * @return {import("../pixel.js").Pixel} Centroid pixel. + */ + + +function centroid(pointerEvents) { + var length = pointerEvents.length; + var clientX = 0; + var clientY = 0; + + for (var i = 0; i < length; i++) { + clientX += pointerEvents[i].clientX; + clientY += pointerEvents[i].clientY; + } + + return [clientX / length, clientY / length]; +} +/** + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} Whether the event is a pointerdown, pointerdrag + * or pointerup event. + */ + + +function isPointerDraggingEvent(mapBrowserEvent) { + var type = mapBrowserEvent.type; + return type === _MapBrowserEventType.default.POINTERDOWN || type === _MapBrowserEventType.default.POINTERDRAG || type === _MapBrowserEventType.default.POINTERUP; +} + +var _default = PointerInteraction; +exports.default = _default; +},{"./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","../obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/events/condition.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.all = all; +exports.primaryAction = exports.penOnly = exports.touchOnly = exports.mouseOnly = exports.targetNotEditable = exports.shiftKeyOnly = exports.platformModifierKeyOnly = exports.noModifierKeys = exports.doubleClick = exports.singleClick = exports.pointerMove = exports.never = exports.mouseActionButton = exports.click = exports.always = exports.focusWithTabindex = exports.focus = exports.altShiftKeysOnly = exports.altKeyOnly = void 0; + +var _MapBrowserEventType = _interopRequireDefault(require("../MapBrowserEventType.js")); + +var _functions = require("../functions.js"); + +var _has = require("../has.js"); + +var _asserts = require("../asserts.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/events/condition + */ + +/** + * A function that takes an {@link module:ol/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 + */ + + +exports.altKeyOnly = altKeyOnly; + +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. `<div id="map" tabindex="1">`. + * + * @param {import("../MapBrowserEvent.js").default} event Map browser event. + * @return {boolean} The map has the focus. + * @api + */ + + +exports.altShiftKeysOnly = altShiftKeysOnly; + +var focus = function (event) { + return event.target.getTargetElement().contains(document.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. + */ + + +exports.focus = focus; + +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 + */ + + +exports.focusWithTabindex = focusWithTabindex; +var always = _functions.TRUE; +/** + * 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 + */ + +exports.always = always; + +var click = function (mapBrowserEvent) { + return mapBrowserEvent.type == _MapBrowserEventType.default.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. + */ + + +exports.click = click; + +var mouseActionButton = function (mapBrowserEvent) { + var originalEvent = + /** @type {MouseEvent} */ + mapBrowserEvent.originalEvent; + return originalEvent.button == 0 && !(_has.WEBKIT && _has.MAC && originalEvent.ctrlKey); +}; +/** + * Return always false. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} False. + * @api + */ + + +exports.mouseActionButton = mouseActionButton; +var never = _functions.FALSE; +/** + * 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 + */ + +exports.never = never; + +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 + */ + + +exports.pointerMove = pointerMove; + +var singleClick = function (mapBrowserEvent) { + return mapBrowserEvent.type == _MapBrowserEventType.default.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 + */ + + +exports.singleClick = singleClick; + +var doubleClick = function (mapBrowserEvent) { + return mapBrowserEvent.type == _MapBrowserEventType.default.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 + */ + + +exports.doubleClick = doubleClick; + +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 + */ + + +exports.noModifierKeys = noModifierKeys; + +var platformModifierKeyOnly = function (mapBrowserEvent) { + var originalEvent = + /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ + mapBrowserEvent.originalEvent; + return !originalEvent.altKey && (_has.MAC ? 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 + */ + + +exports.platformModifierKeyOnly = platformModifierKeyOnly; + +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 a `<input>`-, + * `<select>`- or `<textarea>`-element, `false` otherwise. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True only if the target element is not editable. + * @api + */ + + +exports.shiftKeyOnly = shiftKeyOnly; + +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'; +}; +/** + * 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 + */ + + +exports.targetNotEditable = targetNotEditable; + +var mouseOnly = function (mapBrowserEvent) { + var pointerEvent = + /** @type {import("../MapBrowserEvent").default} */ + mapBrowserEvent.originalEvent; + (0, _asserts.assert)(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event + // see http://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 + */ + + +exports.mouseOnly = mouseOnly; + +var touchOnly = function (mapBrowserEvent) { + var pointerEvt = + /** @type {import("../MapBrowserEvent").default} */ + mapBrowserEvent.originalEvent; + (0, _asserts.assert)(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event + // see http://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 + */ + + +exports.touchOnly = touchOnly; + +var penOnly = function (mapBrowserEvent) { + var pointerEvt = + /** @type {import("../MapBrowserEvent").default} */ + mapBrowserEvent.originalEvent; + (0, _asserts.assert)(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event + // see http://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 http://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 + */ + + +exports.penOnly = penOnly; + +var primaryAction = function (mapBrowserEvent) { + var pointerEvent = + /** @type {import("../MapBrowserEvent").default} */ + mapBrowserEvent.originalEvent; + (0, _asserts.assert)(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event + + return pointerEvent.isPrimary && pointerEvent.button === 0; +}; + +exports.primaryAction = primaryAction; +},{"../MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","../functions.js":"../../../node_modules/ol/functions.js","../has.js":"../../../node_modules/ol/has.js","../asserts.js":"../../../node_modules/ol/asserts.js"}],"../../../node_modules/ol/interaction/DragPan.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Pointer = _interopRequireWildcard(require("./Pointer.js")); + +var _functions = require("../functions.js"); + +var _condition = require("../events/condition.js"); + +var _easing = require("../easing.js"); + +var _coordinate = require("../coordinate.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/DragPan + */ + + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean + * to indicate whether that event should be handled. + * Default is {@link module:ol/events/condition~noModifierKeys} and {@link module:ol/events/condition~primaryAction}. + * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set, + * the interaction will only handle events when the map has the focus. + * @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan. + */ + +/** + * @classdesc + * Allows the user to pan the map by dragging the map. + * @api + */ +var DragPan = +/** @class */ +function (_super) { + __extends(DragPan, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DragPan(opt_options) { + var _this = _super.call(this, { + stopDown: _functions.FALSE + }) || this; + + var options = opt_options ? opt_options : {}; + /** + * @private + * @type {import("../Kinetic.js").default|undefined} + */ + + _this.kinetic_ = options.kinetic; + /** + * @type {import("../pixel.js").Pixel} + */ + + _this.lastCentroid = null; + /** + * @type {number} + */ + + _this.lastPointersCount_; + /** + * @type {boolean} + */ + + _this.panning_ = false; + var condition = options.condition ? options.condition : (0, _condition.all)(_condition.noModifierKeys, _condition.primaryAction); + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.onFocusOnly ? (0, _condition.all)(_condition.focusWithTabindex, condition) : condition; + /** + * @private + * @type {boolean} + */ + + _this.noKinetic_ = false; + return _this; + } + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + DragPan.prototype.handleDragEvent = function (mapBrowserEvent) { + if (!this.panning_) { + this.panning_ = true; + this.getMap().getView().beginInteraction(); + } + + var targetPointers = this.targetPointers; + var centroid = (0, _Pointer.centroid)(targetPointers); + + if (targetPointers.length == this.lastPointersCount_) { + if (this.kinetic_) { + this.kinetic_.update(centroid[0], centroid[1]); + } + + if (this.lastCentroid) { + var delta = [this.lastCentroid[0] - centroid[0], centroid[1] - this.lastCentroid[1]]; + var map = mapBrowserEvent.map; + var view = map.getView(); + (0, _coordinate.scale)(delta, view.getResolution()); + (0, _coordinate.rotate)(delta, view.getRotation()); + view.adjustCenterInternal(delta); + } + } else if (this.kinetic_) { + // reset so we don't overestimate the kinetic energy after + // after one finger down, tiny drag, second finger down + this.kinetic_.begin(); + } + + this.lastCentroid = centroid; + this.lastPointersCount_ = targetPointers.length; + mapBrowserEvent.originalEvent.preventDefault(); + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragPan.prototype.handleUpEvent = function (mapBrowserEvent) { + var map = mapBrowserEvent.map; + var view = map.getView(); + + if (this.targetPointers.length === 0) { + if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) { + var distance = this.kinetic_.getDistance(); + var angle = this.kinetic_.getAngle(); + var center = view.getCenterInternal(); + var centerpx = map.getPixelFromCoordinateInternal(center); + var dest = map.getCoordinateFromPixelInternal([centerpx[0] - distance * Math.cos(angle), centerpx[1] - distance * Math.sin(angle)]); + view.animateInternal({ + center: view.getConstrainedCenter(dest), + duration: 500, + easing: _easing.easeOut + }); + } + + if (this.panning_) { + this.panning_ = false; + view.endInteraction(); + } + + return false; + } else { + if (this.kinetic_) { + // reset so we don't overestimate the kinetic energy after + // after one finger up, tiny drag, second finger up + this.kinetic_.begin(); + } + + this.lastCentroid = null; + return true; + } + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragPan.prototype.handleDownEvent = function (mapBrowserEvent) { + if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) { + var map = mapBrowserEvent.map; + var view = map.getView(); + this.lastCentroid = null; // stop any current animation + + if (view.getAnimating()) { + view.cancelAnimations(); + } + + if (this.kinetic_) { + this.kinetic_.begin(); + } // No kinetic as soon as more than one pointer on the screen is + // detected. This is to prevent nasty pans after pinch. + + + this.noKinetic_ = this.targetPointers.length > 1; + return true; + } else { + return false; + } + }; + + return DragPan; +}(_Pointer.default); + +var _default = DragPan; +exports.default = _default; +},{"./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../functions.js":"../../../node_modules/ol/functions.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../easing.js":"../../../node_modules/ol/easing.js","../coordinate.js":"../../../node_modules/ol/coordinate.js"}],"../../../node_modules/ol/interaction/DragRotate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _functions = require("../functions.js"); + +var _condition = require("../events/condition.js"); + +var _rotationconstraint = require("../rotationconstraint.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/DragRotate + */ + + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that takes an + * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean + * to indicate whether that event should be handled. + * Default is {@link module:ol/events/condition~altShiftKeysOnly}. + * @property {number} [duration=250] Animation duration in milliseconds. + */ + +/** + * @classdesc + * Allows the user to rotate the map by clicking and dragging on the map, + * normally combined with an {@link module:ol/events/condition} that limits + * it to when the alt and shift keys are held down. + * + * This interaction is only supported for mouse devices. + * @api + */ +var DragRotate = +/** @class */ +function (_super) { + __extends(DragRotate, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DragRotate(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + stopDown: _functions.FALSE + }) || this; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.altShiftKeysOnly; + /** + * @private + * @type {number|undefined} + */ + + _this.lastAngle_ = undefined; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 250; + return _this; + } + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + DragRotate.prototype.handleDragEvent = function (mapBrowserEvent) { + if (!(0, _condition.mouseOnly)(mapBrowserEvent)) { + return; + } + + var map = mapBrowserEvent.map; + var view = map.getView(); + + if (view.getConstraints().rotation === _rotationconstraint.disable) { + return; + } + + var size = map.getSize(); + var offset = mapBrowserEvent.pixel; + var theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2); + + if (this.lastAngle_ !== undefined) { + var delta = theta - this.lastAngle_; + view.adjustRotationInternal(-delta); + } + + this.lastAngle_ = theta; + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragRotate.prototype.handleUpEvent = function (mapBrowserEvent) { + if (!(0, _condition.mouseOnly)(mapBrowserEvent)) { + return true; + } + + var map = mapBrowserEvent.map; + var view = map.getView(); + view.endInteraction(this.duration_); + return false; + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragRotate.prototype.handleDownEvent = function (mapBrowserEvent) { + if (!(0, _condition.mouseOnly)(mapBrowserEvent)) { + return false; + } + + if ((0, _condition.mouseActionButton)(mapBrowserEvent) && this.condition_(mapBrowserEvent)) { + var map = mapBrowserEvent.map; + map.getView().beginInteraction(); + this.lastAngle_ = undefined; + return true; + } else { + return false; + } + }; + + return DragRotate; +}(_Pointer.default); + +var _default = DragRotate; +exports.default = _default; +},{"./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../functions.js":"../../../node_modules/ol/functions.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../rotationconstraint.js":"../../../node_modules/ol/rotationconstraint.js"}],"../../../node_modules/ol/render/Box.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Disposable = _interopRequireDefault(require("../Disposable.js")); + +var _Polygon = _interopRequireDefault(require("../geom/Polygon.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/render/Box + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +var RenderBox = +/** @class */ +function (_super) { + __extends(RenderBox, _super); + /** + * @param {string} className CSS class name. + */ + + + function RenderBox(className) { + var _this = _super.call(this) || this; + /** + * @type {import("../geom/Polygon.js").default} + * @private + */ + + + _this.geometry_ = null; + /** + * @type {HTMLDivElement} + * @private + */ + + _this.element_ = document.createElement('div'); + _this.element_.style.position = 'absolute'; + _this.element_.style.pointerEvents = 'auto'; + _this.element_.className = 'ol-box ' + className; + /** + * @private + * @type {import("../PluggableMap.js").default} + */ + + _this.map_ = null; + /** + * @private + * @type {import("../pixel.js").Pixel} + */ + + _this.startPixel_ = null; + /** + * @private + * @type {import("../pixel.js").Pixel} + */ + + _this.endPixel_ = null; + return _this; + } + /** + * Clean up. + */ + + + RenderBox.prototype.disposeInternal = function () { + this.setMap(null); + }; + /** + * @private + */ + + + RenderBox.prototype.render_ = function () { + var startPixel = this.startPixel_; + var endPixel = this.endPixel_; + var px = 'px'; + var style = this.element_.style; + style.left = Math.min(startPixel[0], endPixel[0]) + px; + style.top = Math.min(startPixel[1], endPixel[1]) + px; + style.width = Math.abs(endPixel[0] - startPixel[0]) + px; + style.height = Math.abs(endPixel[1] - startPixel[1]) + px; + }; + /** + * @param {import("../PluggableMap.js").default} map Map. + */ + + + RenderBox.prototype.setMap = function (map) { + if (this.map_) { + this.map_.getOverlayContainer().removeChild(this.element_); + var style = this.element_.style; + style.left = 'inherit'; + style.top = 'inherit'; + style.width = 'inherit'; + style.height = 'inherit'; + } + + this.map_ = map; + + if (this.map_) { + this.map_.getOverlayContainer().appendChild(this.element_); + } + }; + /** + * @param {import("../pixel.js").Pixel} startPixel Start pixel. + * @param {import("../pixel.js").Pixel} endPixel End pixel. + */ + + + RenderBox.prototype.setPixels = function (startPixel, endPixel) { + this.startPixel_ = startPixel; + this.endPixel_ = endPixel; + this.createOrUpdateGeometry(); + this.render_(); + }; + /** + * Creates or updates the cached geometry. + */ + + + RenderBox.prototype.createOrUpdateGeometry = function () { + var startPixel = this.startPixel_; + var endPixel = this.endPixel_; + var pixels = [startPixel, [startPixel[0], endPixel[1]], endPixel, [endPixel[0], startPixel[1]]]; + var coordinates = pixels.map(this.map_.getCoordinateFromPixelInternal, this.map_); // close the polygon + + coordinates[4] = coordinates[0].slice(); + + if (!this.geometry_) { + this.geometry_ = new _Polygon.default([coordinates]); + } else { + this.geometry_.setCoordinates([coordinates]); + } + }; + /** + * @return {import("../geom/Polygon.js").default} Geometry. + */ + + + RenderBox.prototype.getGeometry = function () { + return this.geometry_; + }; + + return RenderBox; +}(_Disposable.default); + +var _default = RenderBox; +exports.default = _default; +},{"../Disposable.js":"../../../node_modules/ol/Disposable.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js"}],"../../../node_modules/ol/interaction/DragBox.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _Box = _interopRequireDefault(require("../render/Box.js")); + +var _condition = require("../events/condition.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/DragBox + */ +// FIXME draw drag box + + +/** + * A function that takes a {@link module:ol/MapBrowserEvent} and two + * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met, + * true should be returned. + * @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition + */ + +/** + * @typedef {Object} Options + * @property {string} [className='ol-dragbox'] CSS class name for styling the box. + * @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean + * to indicate whether that event should be handled. + * Default is {@link ol/events/condition~mouseActionButton}. + * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default + * `boxEndCondition` function. + * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two + * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired. + * Default is `true` if the area of the box is bigger than the `minArea` option. + * @property {function(this:DragBox, import("../MapBrowserEvent.js").default):void} [onBoxEnd] Code to execute just + * before `boxend` is fired. + */ + +/** + * @enum {string} + */ +var DragBoxEventType = { + /** + * Triggered upon drag box start. + * @event DragBoxEvent#boxstart + * @api + */ + BOXSTART: 'boxstart', + + /** + * Triggered on drag when box is active. + * @event DragBoxEvent#boxdrag + * @api + */ + BOXDRAG: 'boxdrag', + + /** + * Triggered upon drag box end. + * @event DragBoxEvent#boxend + * @api + */ + BOXEND: 'boxend' +}; +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of + * this type. + */ + +var DragBoxEvent = +/** @class */ +function (_super) { + __extends(DragBoxEvent, _super); + /** + * @param {string} type The event type. + * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event. + */ + + + function DragBoxEvent(type, coordinate, mapBrowserEvent) { + var _this = _super.call(this, type) || this; + /** + * The coordinate of the drag event. + * @const + * @type {import("../coordinate.js").Coordinate} + * @api + */ + + + _this.coordinate = coordinate; + /** + * @const + * @type {import("../MapBrowserEvent.js").default} + * @api + */ + + _this.mapBrowserEvent = mapBrowserEvent; + return _this; + } + + return DragBoxEvent; +}(_Event.default); +/** + * @classdesc + * Allows the user to draw a vector box by clicking and dragging on the map, + * normally combined with an {@link module:ol/events/condition} that limits + * it to when the shift or other key is held down. This is used, for example, + * for zooming to a specific area of the map + * (see {@link module:ol/interaction/DragZoom~DragZoom} and + * {@link module:ol/interaction/DragRotateAndZoom}). + * + * @fires DragBoxEvent + * @api + */ + + +var DragBox = +/** @class */ +function (_super) { + __extends(DragBox, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DragBox(opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options ? opt_options : {}; + /** + * @type {import("../render/Box.js").default} + * @private + */ + + _this.box_ = new _Box.default(options.className || 'ol-dragbox'); + /** + * @type {number} + * @private + */ + + _this.minArea_ = options.minArea !== undefined ? options.minArea : 64; + + if (options.onBoxEnd) { + _this.onBoxEnd = options.onBoxEnd; + } + /** + * @type {import("../pixel.js").Pixel} + * @private + */ + + + _this.startPixel_ = null; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.mouseActionButton; + /** + * @private + * @type {EndCondition} + */ + + _this.boxEndCondition_ = options.boxEndCondition ? options.boxEndCondition : _this.defaultBoxEndCondition; + return _this; + } + /** + * The default condition for determining whether the boxend event + * should fire. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent + * leading to the box end. + * @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box. + * @param {import("../pixel.js").Pixel} endPixel The end pixel of the box. + * @return {boolean} Whether or not the boxend condition should be fired. + */ + + + DragBox.prototype.defaultBoxEndCondition = function (mapBrowserEvent, startPixel, endPixel) { + var width = endPixel[0] - startPixel[0]; + var height = endPixel[1] - startPixel[1]; + return width * width + height * height >= this.minArea_; + }; + /** + * Returns geometry of last drawn box. + * @return {import("../geom/Polygon.js").default} Geometry. + * @api + */ + + + DragBox.prototype.getGeometry = function () { + return this.box_.getGeometry(); + }; + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + DragBox.prototype.handleDragEvent = function (mapBrowserEvent) { + this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); + this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXDRAG, mapBrowserEvent.coordinate, mapBrowserEvent)); + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragBox.prototype.handleUpEvent = function (mapBrowserEvent) { + this.box_.setMap(null); + + if (this.boxEndCondition_(mapBrowserEvent, this.startPixel_, mapBrowserEvent.pixel)) { + this.onBoxEnd(mapBrowserEvent); + this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXEND, mapBrowserEvent.coordinate, mapBrowserEvent)); + } + + return false; + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragBox.prototype.handleDownEvent = function (mapBrowserEvent) { + if (this.condition_(mapBrowserEvent)) { + this.startPixel_ = mapBrowserEvent.pixel; + this.box_.setMap(mapBrowserEvent.map); + this.box_.setPixels(this.startPixel_, this.startPixel_); + this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXSTART, mapBrowserEvent.coordinate, mapBrowserEvent)); + return true; + } else { + return false; + } + }; + /** + * Function to execute just before `onboxend` is fired + * @param {import("../MapBrowserEvent.js").default} event Event. + */ + + + DragBox.prototype.onBoxEnd = function (event) {}; + + return DragBox; +}(_Pointer.default); + +var _default = DragBox; +exports.default = _default; +},{"../events/Event.js":"../../../node_modules/ol/events/Event.js","./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../render/Box.js":"../../../node_modules/ol/render/Box.js","../events/condition.js":"../../../node_modules/ol/events/condition.js"}],"../../../node_modules/ol/interaction/DragZoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _DragBox = _interopRequireDefault(require("./DragBox.js")); + +var _extent = require("../extent.js"); + +var _easing = require("../easing.js"); + +var _condition = require("../events/condition.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/DragZoom + */ + + +/** + * @typedef {Object} Options + * @property {string} [className='ol-dragzoom'] CSS class name for styling the + * box. + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. + * Default is {@link module:ol/events/condition~shiftKeyOnly}. + * @property {number} [duration=200] Animation duration in milliseconds. + * @property {boolean} [out=false] Use interaction for zooming out. + * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default + * `boxEndCondition` function. + */ + +/** + * @classdesc + * Allows the user to zoom the map by clicking and dragging on the map, + * normally combined with an {@link module:ol/events/condition} that limits + * it to when a key, shift by default, is held down. + * + * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or + * your custom one configured with `className`. + * @api + */ +var DragZoom = +/** @class */ +function (_super) { + __extends(DragZoom, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DragZoom(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var condition = options.condition ? options.condition : _condition.shiftKeyOnly; + _this = _super.call(this, { + condition: condition, + className: options.className || 'ol-dragzoom', + minArea: options.minArea + }) || this; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 200; + /** + * @private + * @type {boolean} + */ + + _this.out_ = options.out !== undefined ? options.out : false; + return _this; + } + /** + * Function to execute just before `onboxend` is fired + * @param {import("../MapBrowserEvent.js").default} event Event. + */ + + + DragZoom.prototype.onBoxEnd = function (event) { + var map = this.getMap(); + var view = + /** @type {!import("../View.js").default} */ + map.getView(); + var size = + /** @type {!import("../size.js").Size} */ + map.getSize(); + var extent = this.getGeometry().getExtent(); + + if (this.out_) { + var mapExtent = view.calculateExtentInternal(size); + var boxPixelExtent = (0, _extent.createOrUpdateFromCoordinates)([map.getPixelFromCoordinateInternal((0, _extent.getBottomLeft)(extent)), map.getPixelFromCoordinateInternal((0, _extent.getTopRight)(extent))]); + var factor = view.getResolutionForExtentInternal(boxPixelExtent, size); + (0, _extent.scaleFromCenter)(mapExtent, 1 / factor); + extent = mapExtent; + } + + var resolution = view.getConstrainedResolution(view.getResolutionForExtentInternal(extent, size)); + var center = view.getConstrainedCenter((0, _extent.getCenter)(extent), resolution); + view.animateInternal({ + resolution: resolution, + center: center, + duration: this.duration_, + easing: _easing.easeOut + }); + }; + + return DragZoom; +}(_DragBox.default); + +var _default = DragZoom; +exports.default = _default; +},{"./DragBox.js":"../../../node_modules/ol/interaction/DragBox.js","../extent.js":"../../../node_modules/ol/extent.js","../easing.js":"../../../node_modules/ol/easing.js","../events/condition.js":"../../../node_modules/ol/events/condition.js"}],"../../../node_modules/ol/events/KeyCode.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/events/KeyCode + */ + +/** + * @enum {number} + * @const + */ +var _default = { + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40 +}; +exports.default = _default; +},{}],"../../../node_modules/ol/interaction/KeyboardPan.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Interaction = _interopRequireWildcard(require("./Interaction.js")); + +var _KeyCode = _interopRequireDefault(require("../events/KeyCode.js")); + +var _condition = require("../events/condition.js"); + +var _coordinate = require("../coordinate.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/KeyboardPan + */ + + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. Default is + * {@link module:ol/events/condition~noModifierKeys} and + * {@link module:ol/events/condition~targetNotEditable}. + * @property {number} [duration=100] Animation duration in milliseconds. + * @property {number} [pixelDelta=128] The amount of pixels to pan on each key + * press. + */ + +/** + * @classdesc + * Allows the user to pan the map using keyboard arrows. + * Note that, although this interaction is by default included in maps, + * the keys can only be used when browser focus is on the element to which + * the keyboard events are attached. By default, this is the map div, + * though you can change this with the `keyboardEventTarget` in + * {@link module:ol/Map~Map}. `document` never loses focus but, for any other + * element, focus will have to be on, and returned to, this element if the keys + * are to function. + * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}. + * @api + */ +var KeyboardPan = +/** @class */ +function (_super) { + __extends(KeyboardPan, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function KeyboardPan(opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options || {}; + /** + * @private + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event. + * @return {boolean} Combined condition result. + */ + + _this.defaultCondition_ = function (mapBrowserEvent) { + return (0, _condition.noModifierKeys)(mapBrowserEvent) && (0, _condition.targetNotEditable)(mapBrowserEvent); + }; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + + _this.condition_ = options.condition !== undefined ? options.condition : _this.defaultCondition_; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 100; + /** + * @private + * @type {number} + */ + + _this.pixelDelta_ = options.pixelDelta !== undefined ? options.pixelDelta : 128; + return _this; + } + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a + * `KeyEvent`, and decides the direction to pan to (if an arrow key was + * pressed). + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + * @this {KeyboardPan} + */ + + + KeyboardPan.prototype.handleEvent = function (mapBrowserEvent) { + var stopEvent = false; + + if (mapBrowserEvent.type == _EventType.default.KEYDOWN) { + var keyEvent = + /** @type {KeyboardEvent} */ + mapBrowserEvent.originalEvent; + var keyCode = keyEvent.keyCode; + + if (this.condition_(mapBrowserEvent) && (keyCode == _KeyCode.default.DOWN || keyCode == _KeyCode.default.LEFT || keyCode == _KeyCode.default.RIGHT || keyCode == _KeyCode.default.UP)) { + var map = mapBrowserEvent.map; + var view = map.getView(); + var mapUnitsDelta = view.getResolution() * this.pixelDelta_; + var deltaX = 0, + deltaY = 0; + + if (keyCode == _KeyCode.default.DOWN) { + deltaY = -mapUnitsDelta; + } else if (keyCode == _KeyCode.default.LEFT) { + deltaX = -mapUnitsDelta; + } else if (keyCode == _KeyCode.default.RIGHT) { + deltaX = mapUnitsDelta; + } else { + deltaY = mapUnitsDelta; + } + + var delta = [deltaX, deltaY]; + (0, _coordinate.rotate)(delta, view.getRotation()); + (0, _Interaction.pan)(view, delta, this.duration_); + mapBrowserEvent.preventDefault(); + stopEvent = true; + } + } + + return !stopEvent; + }; + + return KeyboardPan; +}(_Interaction.default); + +var _default = KeyboardPan; +exports.default = _default; +},{"../events/EventType.js":"../../../node_modules/ol/events/EventType.js","./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../events/KeyCode.js":"../../../node_modules/ol/events/KeyCode.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../coordinate.js":"../../../node_modules/ol/coordinate.js"}],"../../../node_modules/ol/interaction/KeyboardZoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Interaction = _interopRequireWildcard(require("./Interaction.js")); + +var _condition = require("../events/condition.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/KeyboardZoom + */ + + +/** + * @typedef {Object} Options + * @property {number} [duration=100] Animation duration in milliseconds. + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. Default is + * {@link module:ol/events/condition~targetNotEditable}. + * @property {number} [delta=1] The zoom level delta on each key press. + */ + +/** + * @classdesc + * Allows the user to zoom the map using keyboard + and -. + * Note that, although this interaction is by default included in maps, + * the keys can only be used when browser focus is on the element to which + * the keyboard events are attached. By default, this is the map div, + * though you can change this with the `keyboardEventTarget` in + * {@link module:ol/Map~Map}. `document` never loses focus but, for any other + * element, focus will have to be on, and returned to, this element if the keys + * are to function. + * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}. + * @api + */ +var KeyboardZoom = +/** @class */ +function (_super) { + __extends(KeyboardZoom, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function KeyboardZoom(opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options ? opt_options : {}; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.targetNotEditable; + /** + * @private + * @type {number} + */ + + _this.delta_ = options.delta ? options.delta : 1; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 100; + return _this; + } + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a + * `KeyEvent`, and decides whether to zoom in or out (depending on whether the + * key pressed was '+' or '-'). + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + * @this {KeyboardZoom} + */ + + + KeyboardZoom.prototype.handleEvent = function (mapBrowserEvent) { + var stopEvent = false; + + if (mapBrowserEvent.type == _EventType.default.KEYDOWN || mapBrowserEvent.type == _EventType.default.KEYPRESS) { + var keyEvent = + /** @type {KeyboardEvent} */ + mapBrowserEvent.originalEvent; + var charCode = keyEvent.charCode; + + if (this.condition_(mapBrowserEvent) && (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) { + var map = mapBrowserEvent.map; + var delta = charCode == '+'.charCodeAt(0) ? this.delta_ : -this.delta_; + var view = map.getView(); + (0, _Interaction.zoomByDelta)(view, delta, undefined, this.duration_); + mapBrowserEvent.preventDefault(); + stopEvent = true; + } + } + + return !stopEvent; + }; + + return KeyboardZoom; +}(_Interaction.default); + +var _default = KeyboardZoom; +exports.default = _default; +},{"../events/EventType.js":"../../../node_modules/ol/events/EventType.js","./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../events/condition.js":"../../../node_modules/ol/events/condition.js"}],"../../../node_modules/ol/interaction/MouseWheelZoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.Mode = void 0; + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Interaction = _interopRequireWildcard(require("./Interaction.js")); + +var _has = require("../has.js"); + +var _condition = require("../events/condition.js"); + +var _math = require("../math.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/MouseWheelZoom + */ + + +/** + * @enum {string} + */ +var Mode = { + TRACKPAD: 'trackpad', + WHEEL: 'wheel' +}; +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. Default is + * {@link module:ol/events/condition~always}. + * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set, + * the interaction will only handle events when the map has the focus. + * @property {number} [maxDelta=1] Maximum mouse wheel delta. + * @property {number} [duration=250] Animation duration in milliseconds. + * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds. + * @property {boolean} [useAnchor=true] Enable zooming using the mouse's + * location as the anchor. When set to `false`, zooming in and out will zoom to + * the center of the screen instead of zooming on the mouse's location. + * @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom + * event will always animate to the closest zoom level after an interaction; + * false means intermediary zoom levels are allowed. + */ + +/** + * @classdesc + * Allows the user to zoom the map by scrolling the mouse wheel. + * @api + */ + +exports.Mode = Mode; + +var MouseWheelZoom = +/** @class */ +function (_super) { + __extends(MouseWheelZoom, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function MouseWheelZoom(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, + /** @type {import("./Interaction.js").InteractionOptions} */ + options) || this; + /** + * @private + * @type {number} + */ + + _this.totalDelta_ = 0; + /** + * @private + * @type {number} + */ + + _this.lastDelta_ = 0; + /** + * @private + * @type {number} + */ + + _this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 250; + /** + * @private + * @type {number} + */ + + _this.timeout_ = options.timeout !== undefined ? options.timeout : 80; + /** + * @private + * @type {boolean} + */ + + _this.useAnchor_ = options.useAnchor !== undefined ? options.useAnchor : true; + /** + * @private + * @type {boolean} + */ + + _this.constrainResolution_ = options.constrainResolution !== undefined ? options.constrainResolution : false; + var condition = options.condition ? options.condition : _condition.always; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.onFocusOnly ? (0, _condition.all)(_condition.focusWithTabindex, condition) : condition; + /** + * @private + * @type {?import("../coordinate.js").Coordinate} + */ + + _this.lastAnchor_ = null; + /** + * @private + * @type {number|undefined} + */ + + _this.startTime_ = undefined; + /** + * @private + * @type {?} + */ + + _this.timeoutId_; + /** + * @private + * @type {Mode|undefined} + */ + + _this.mode_ = undefined; + /** + * Trackpad events separated by this delay will be considered separate + * interactions. + * @type {number} + */ + + _this.trackpadEventGap_ = 400; + /** + * @type {?} + */ + + _this.trackpadTimeoutId_; + /** + * The number of delta values per zoom level + * @private + * @type {number} + */ + + _this.deltaPerZoom_ = 300; + return _this; + } + /** + * @private + */ + + + MouseWheelZoom.prototype.endInteraction_ = function () { + this.trackpadTimeoutId_ = undefined; + var view = this.getMap().getView(); + view.endInteraction(undefined, this.lastDelta_ ? this.lastDelta_ > 0 ? 1 : -1 : 0, this.lastAnchor_); + }; + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually + * zooms the map. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + */ + + + MouseWheelZoom.prototype.handleEvent = function (mapBrowserEvent) { + if (!this.condition_(mapBrowserEvent)) { + return true; + } + + var type = mapBrowserEvent.type; + + if (type !== _EventType.default.WHEEL) { + return true; + } + + mapBrowserEvent.preventDefault(); + var map = mapBrowserEvent.map; + var wheelEvent = + /** @type {WheelEvent} */ + mapBrowserEvent.originalEvent; + + if (this.useAnchor_) { + this.lastAnchor_ = mapBrowserEvent.coordinate; + } // Delta normalisation inspired by + // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js + + + var delta; + + if (mapBrowserEvent.type == _EventType.default.WHEEL) { + delta = wheelEvent.deltaY; + + if (_has.FIREFOX && wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL) { + delta /= _has.DEVICE_PIXEL_RATIO; + } + + if (wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE) { + delta *= 40; + } + } + + if (delta === 0) { + return false; + } else { + this.lastDelta_ = delta; + } + + var now = Date.now(); + + if (this.startTime_ === undefined) { + this.startTime_ = now; + } + + if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) { + this.mode_ = Math.abs(delta) < 4 ? Mode.TRACKPAD : Mode.WHEEL; + } + + var view = map.getView(); + + if (this.mode_ === Mode.TRACKPAD && !(view.getConstrainResolution() || this.constrainResolution_)) { + if (this.trackpadTimeoutId_) { + clearTimeout(this.trackpadTimeoutId_); + } else { + if (view.getAnimating()) { + view.cancelAnimations(); + } + + view.beginInteraction(); + } + + this.trackpadTimeoutId_ = setTimeout(this.endInteraction_.bind(this), this.timeout_); + view.adjustZoom(-delta / this.deltaPerZoom_, this.lastAnchor_); + this.startTime_ = now; + return false; + } + + this.totalDelta_ += delta; + var timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0); + clearTimeout(this.timeoutId_); + this.timeoutId_ = setTimeout(this.handleWheelZoom_.bind(this, map), timeLeft); + return false; + }; + /** + * @private + * @param {import("../PluggableMap.js").default} map Map. + */ + + + MouseWheelZoom.prototype.handleWheelZoom_ = function (map) { + var view = map.getView(); + + if (view.getAnimating()) { + view.cancelAnimations(); + } + + var delta = -(0, _math.clamp)(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) / this.deltaPerZoom_; + + if (view.getConstrainResolution() || this.constrainResolution_) { + // view has a zoom constraint, zoom by 1 + delta = delta ? delta > 0 ? 1 : -1 : 0; + } + + (0, _Interaction.zoomByDelta)(view, delta, this.lastAnchor_, this.duration_); + this.mode_ = undefined; + this.totalDelta_ = 0; + this.lastAnchor_ = null; + this.startTime_ = undefined; + this.timeoutId_ = undefined; + }; + /** + * Enable or disable using the mouse's location as an anchor when zooming + * @param {boolean} useAnchor true to zoom to the mouse's location, false + * to zoom to the center of the map + * @api + */ + + + MouseWheelZoom.prototype.setMouseAnchor = function (useAnchor) { + this.useAnchor_ = useAnchor; + + if (!useAnchor) { + this.lastAnchor_ = null; + } + }; + + return MouseWheelZoom; +}(_Interaction.default); + +var _default = MouseWheelZoom; +exports.default = _default; +},{"../events/EventType.js":"../../../node_modules/ol/events/EventType.js","./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../has.js":"../../../node_modules/ol/has.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/interaction/PinchRotate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Pointer = _interopRequireWildcard(require("./Pointer.js")); + +var _functions = require("../functions.js"); + +var _rotationconstraint = require("../rotationconstraint.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/PinchRotate + */ + + +/** + * @typedef {Object} Options + * @property {number} [duration=250] The duration of the animation in + * milliseconds. + * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation. + */ + +/** + * @classdesc + * Allows the user to rotate the map by twisting with two fingers + * on a touch screen. + * @api + */ +var PinchRotate = +/** @class */ +function (_super) { + __extends(PinchRotate, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function PinchRotate(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var pointerOptions = + /** @type {import("./Pointer.js").Options} */ + options; + + if (!pointerOptions.stopDown) { + pointerOptions.stopDown = _functions.FALSE; + } + + _this = _super.call(this, pointerOptions) || this; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + + _this.anchor_ = null; + /** + * @private + * @type {number|undefined} + */ + + _this.lastAngle_ = undefined; + /** + * @private + * @type {boolean} + */ + + _this.rotating_ = false; + /** + * @private + * @type {number} + */ + + _this.rotationDelta_ = 0.0; + /** + * @private + * @type {number} + */ + + _this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 250; + return _this; + } + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + PinchRotate.prototype.handleDragEvent = function (mapBrowserEvent) { + var rotationDelta = 0.0; + var touch0 = this.targetPointers[0]; + var touch1 = this.targetPointers[1]; // angle between touches + + var angle = Math.atan2(touch1.clientY - touch0.clientY, touch1.clientX - touch0.clientX); + + if (this.lastAngle_ !== undefined) { + var delta = angle - this.lastAngle_; + this.rotationDelta_ += delta; + + if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) { + this.rotating_ = true; + } + + rotationDelta = delta; + } + + this.lastAngle_ = angle; + var map = mapBrowserEvent.map; + var view = map.getView(); + + if (view.getConstraints().rotation === _rotationconstraint.disable) { + return; + } // rotate anchor point. + // FIXME: should be the intersection point between the lines: + // touch0,touch1 and previousTouch0,previousTouch1 + + + var viewportPosition = map.getViewport().getBoundingClientRect(); + var centroid = (0, _Pointer.centroid)(this.targetPointers); + centroid[0] -= viewportPosition.left; + centroid[1] -= viewportPosition.top; + this.anchor_ = map.getCoordinateFromPixelInternal(centroid); // rotate + + if (this.rotating_) { + map.render(); + view.adjustRotationInternal(rotationDelta, this.anchor_); + } + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + PinchRotate.prototype.handleUpEvent = function (mapBrowserEvent) { + if (this.targetPointers.length < 2) { + var map = mapBrowserEvent.map; + var view = map.getView(); + view.endInteraction(this.duration_); + return false; + } else { + return true; + } + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + PinchRotate.prototype.handleDownEvent = function (mapBrowserEvent) { + if (this.targetPointers.length >= 2) { + var map = mapBrowserEvent.map; + this.anchor_ = null; + this.lastAngle_ = undefined; + this.rotating_ = false; + this.rotationDelta_ = 0.0; + + if (!this.handlingDownUpSequence) { + map.getView().beginInteraction(); + } + + return true; + } else { + return false; + } + }; + + return PinchRotate; +}(_Pointer.default); + +var _default = PinchRotate; +exports.default = _default; +},{"./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../functions.js":"../../../node_modules/ol/functions.js","../rotationconstraint.js":"../../../node_modules/ol/rotationconstraint.js"}],"../../../node_modules/ol/interaction/PinchZoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Pointer = _interopRequireWildcard(require("./Pointer.js")); + +var _functions = require("../functions.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/PinchZoom + */ + + +/** + * @typedef {Object} Options + * @property {number} [duration=400] Animation duration in milliseconds. + */ + +/** + * @classdesc + * Allows the user to zoom the map by pinching with two fingers + * on a touch screen. + * @api + */ +var PinchZoom = +/** @class */ +function (_super) { + __extends(PinchZoom, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function PinchZoom(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var pointerOptions = + /** @type {import("./Pointer.js").Options} */ + options; + + if (!pointerOptions.stopDown) { + pointerOptions.stopDown = _functions.FALSE; + } + + _this = _super.call(this, pointerOptions) || this; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + + _this.anchor_ = null; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 400; + /** + * @private + * @type {number|undefined} + */ + + _this.lastDistance_ = undefined; + /** + * @private + * @type {number} + */ + + _this.lastScaleDelta_ = 1; + return _this; + } + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + PinchZoom.prototype.handleDragEvent = function (mapBrowserEvent) { + var scaleDelta = 1.0; + var touch0 = this.targetPointers[0]; + var touch1 = this.targetPointers[1]; + var dx = touch0.clientX - touch1.clientX; + var dy = touch0.clientY - touch1.clientY; // distance between touches + + var distance = Math.sqrt(dx * dx + dy * dy); + + if (this.lastDistance_ !== undefined) { + scaleDelta = this.lastDistance_ / distance; + } + + this.lastDistance_ = distance; + var map = mapBrowserEvent.map; + var view = map.getView(); + + if (scaleDelta != 1.0) { + this.lastScaleDelta_ = scaleDelta; + } // scale anchor point. + + + var viewportPosition = map.getViewport().getBoundingClientRect(); + var centroid = (0, _Pointer.centroid)(this.targetPointers); + centroid[0] -= viewportPosition.left; + centroid[1] -= viewportPosition.top; + this.anchor_ = map.getCoordinateFromPixelInternal(centroid); // scale, bypass the resolution constraint + + map.render(); + view.adjustResolutionInternal(scaleDelta, this.anchor_); + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + PinchZoom.prototype.handleUpEvent = function (mapBrowserEvent) { + if (this.targetPointers.length < 2) { + var map = mapBrowserEvent.map; + var view = map.getView(); + var direction = this.lastScaleDelta_ > 1 ? 1 : -1; + view.endInteraction(this.duration_, direction); + return false; + } else { + return true; + } + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + PinchZoom.prototype.handleDownEvent = function (mapBrowserEvent) { + if (this.targetPointers.length >= 2) { + var map = mapBrowserEvent.map; + this.anchor_ = null; + this.lastDistance_ = undefined; + this.lastScaleDelta_ = 1; + + if (!this.handlingDownUpSequence) { + map.getView().beginInteraction(); + } + + return true; + } else { + return false; + } + }; + + return PinchZoom; +}(_Pointer.default); + +var _default = PinchZoom; +exports.default = _default; +},{"./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../functions.js":"../../../node_modules/ol/functions.js"}],"../../../node_modules/ol/interaction/DragAndDrop.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Interaction = _interopRequireDefault(require("./Interaction.js")); + +var _functions = require("../functions.js"); + +var _proj = require("../proj.js"); + +var _events = require("../events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/interaction/DragAndDrop + */ +// FIXME should handle all geo-referenced data, not just vector data +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * @typedef {Object} Options + * @property {Array<typeof import("../format/Feature.js").default>} [formatConstructors] Format constructors. + * @property {import("../source/Vector.js").default} [source] Optional vector source where features will be added. If a source is provided + * all existing features will be removed and new features will be added when + * they are dropped on the target. If you want to add features to a vector + * source without removing the existing features (append only), instead of + * providing the source option listen for the "addfeatures" event. + * @property {import("../proj.js").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used. + * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element. + */ + +/** + * @enum {string} + */ +var DragAndDropEventType = { + /** + * Triggered when features are added + * @event DragAndDropEvent#addfeatures + * @api + */ + ADD_FEATURES: 'addfeatures' +}; +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances + * of this type. + */ + +var DragAndDropEvent = +/** @class */ +function (_super) { + __extends(DragAndDropEvent, _super); + /** + * @param {DragAndDropEventType} type Type. + * @param {File} file File. + * @param {Array<import("../Feature.js").default>=} opt_features Features. + * @param {import("../proj/Projection.js").default=} opt_projection Projection. + */ + + + function DragAndDropEvent(type, file, opt_features, opt_projection) { + var _this = _super.call(this, type) || this; + /** + * The features parsed from dropped data. + * @type {Array<import("../Feature.js").FeatureLike>|undefined} + * @api + */ + + + _this.features = opt_features; + /** + * The dropped file. + * @type {File} + * @api + */ + + _this.file = file; + /** + * The feature projection. + * @type {import("../proj/Projection.js").default|undefined} + * @api + */ + + _this.projection = opt_projection; + return _this; + } + + return DragAndDropEvent; +}(_Event.default); +/** + * @classdesc + * Handles input of vector data by drag and drop. + * @api + * + * @fires DragAndDropEvent + */ + + +var DragAndDrop = +/** @class */ +function (_super) { + __extends(DragAndDrop, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DragAndDrop(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, { + handleEvent: _functions.TRUE + }) || this; + /** + * @private + * @type {Array<typeof import("../format/Feature.js").default>} + */ + + _this.formatConstructors_ = options.formatConstructors ? options.formatConstructors : []; + /** + * @private + * @type {import("../proj/Projection.js").default} + */ + + _this.projection_ = options.projection ? (0, _proj.get)(options.projection) : null; + /** + * @private + * @type {?Array<import("../events.js").EventsKey>} + */ + + _this.dropListenKeys_ = null; + /** + * @private + * @type {import("../source/Vector.js").default} + */ + + _this.source_ = options.source || null; + /** + * @private + * @type {HTMLElement} + */ + + _this.target = options.target ? options.target : null; + return _this; + } + /** + * @param {File} file File. + * @param {Event} event Load event. + * @private + */ + + + DragAndDrop.prototype.handleResult_ = function (file, event) { + var result = event.target.result; + var map = this.getMap(); + var projection = this.projection_; + + if (!projection) { + var view = map.getView(); + projection = view.getProjection(); + } + + var formatConstructors = this.formatConstructors_; + + for (var i = 0, ii = formatConstructors.length; i < ii; ++i) { + var format = new formatConstructors[i](); + var features = this.tryReadFeatures_(format, result, { + featureProjection: projection + }); + + if (features && features.length > 0) { + if (this.source_) { + this.source_.clear(); + this.source_.addFeatures(features); + } + + this.dispatchEvent(new DragAndDropEvent(DragAndDropEventType.ADD_FEATURES, file, features, projection)); + break; + } + } + }; + /** + * @private + */ + + + DragAndDrop.prototype.registerListeners_ = function () { + var map = this.getMap(); + + if (map) { + var dropArea = this.target ? this.target : map.getViewport(); + this.dropListenKeys_ = [(0, _events.listen)(dropArea, _EventType.default.DROP, this.handleDrop, this), (0, _events.listen)(dropArea, _EventType.default.DRAGENTER, this.handleStop, this), (0, _events.listen)(dropArea, _EventType.default.DRAGOVER, this.handleStop, this), (0, _events.listen)(dropArea, _EventType.default.DROP, this.handleStop, this)]; + } + }; + /** + * Activate or deactivate the interaction. + * @param {boolean} active Active. + * @observable + * @api + */ + + + DragAndDrop.prototype.setActive = function (active) { + if (!this.getActive() && active) { + this.registerListeners_(); + } + + if (this.getActive() && !active) { + this.unregisterListeners_(); + } + + _super.prototype.setActive.call(this, active); + }; + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + DragAndDrop.prototype.setMap = function (map) { + this.unregisterListeners_(); + + _super.prototype.setMap.call(this, map); + + if (this.getActive()) { + this.registerListeners_(); + } + }; + /** + * @param {import("../format/Feature.js").default} format Format. + * @param {string} text Text. + * @param {import("../format/Feature.js").ReadOptions} options Read options. + * @private + * @return {Array<import("../Feature.js").default>} Features. + */ + + + DragAndDrop.prototype.tryReadFeatures_ = function (format, text, options) { + try { + return ( + /** @type {Array<import("../Feature.js").default>} */ + format.readFeatures(text, options) + ); + } catch (e) { + return null; + } + }; + /** + * @private + */ + + + DragAndDrop.prototype.unregisterListeners_ = function () { + if (this.dropListenKeys_) { + this.dropListenKeys_.forEach(_events.unlistenByKey); + this.dropListenKeys_ = null; + } + }; + /** + * @param {DragEvent} event Event. + */ + + + DragAndDrop.prototype.handleDrop = function (event) { + var files = event.dataTransfer.files; + + for (var i = 0, ii = files.length; i < ii; ++i) { + var file = files.item(i); + var reader = new FileReader(); + reader.addEventListener(_EventType.default.LOAD, this.handleResult_.bind(this, file)); + reader.readAsText(file); + } + }; + /** + * @param {DragEvent} event Event. + */ + + + DragAndDrop.prototype.handleStop = function (event) { + event.stopPropagation(); + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + }; + + return DragAndDrop; +}(_Interaction.default); + +var _default = DragAndDrop; +exports.default = _default; +},{"../events/Event.js":"../../../node_modules/ol/events/Event.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../functions.js":"../../../node_modules/ol/functions.js","../proj.js":"../../../node_modules/ol/proj.js","../events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/interaction/DragRotateAndZoom.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _condition = require("../events/condition.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/DragRotateAndZoom + */ + + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. + * Default is {@link module:ol/events/condition~shiftKeyOnly}. + * @property {number} [duration=400] Animation duration in milliseconds. + */ + +/** + * @classdesc + * Allows the user to zoom and rotate the map by clicking and dragging + * on the map. By default, this interaction is limited to when the shift + * key is held down. + * + * This interaction is only supported for mouse devices. + * + * And this interaction is not included in the default interactions. + * @api + */ +var DragRotateAndZoom = +/** @class */ +function (_super) { + __extends(DragRotateAndZoom, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function DragRotateAndZoom(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, + /** @type {import("./Pointer.js").Options} */ + options) || this; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.shiftKeyOnly; + /** + * @private + * @type {number|undefined} + */ + + _this.lastAngle_ = undefined; + /** + * @private + * @type {number|undefined} + */ + + _this.lastMagnitude_ = undefined; + /** + * @private + * @type {number} + */ + + _this.lastScaleDelta_ = 0; + /** + * @private + * @type {number} + */ + + _this.duration_ = options.duration !== undefined ? options.duration : 400; + return _this; + } + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + DragRotateAndZoom.prototype.handleDragEvent = function (mapBrowserEvent) { + if (!(0, _condition.mouseOnly)(mapBrowserEvent)) { + return; + } + + var map = mapBrowserEvent.map; + var size = map.getSize(); + var offset = mapBrowserEvent.pixel; + var deltaX = offset[0] - size[0] / 2; + var deltaY = size[1] / 2 - offset[1]; + var theta = Math.atan2(deltaY, deltaX); + var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY); + var view = map.getView(); + + if (this.lastAngle_ !== undefined) { + var angleDelta = this.lastAngle_ - theta; + view.adjustRotationInternal(angleDelta); + } + + this.lastAngle_ = theta; + + if (this.lastMagnitude_ !== undefined) { + view.adjustResolutionInternal(this.lastMagnitude_ / magnitude); + } + + if (this.lastMagnitude_ !== undefined) { + this.lastScaleDelta_ = this.lastMagnitude_ / magnitude; + } + + this.lastMagnitude_ = magnitude; + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragRotateAndZoom.prototype.handleUpEvent = function (mapBrowserEvent) { + if (!(0, _condition.mouseOnly)(mapBrowserEvent)) { + return true; + } + + var map = mapBrowserEvent.map; + var view = map.getView(); + var direction = this.lastScaleDelta_ > 1 ? 1 : -1; + view.endInteraction(this.duration_, direction); + this.lastScaleDelta_ = 0; + return false; + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + DragRotateAndZoom.prototype.handleDownEvent = function (mapBrowserEvent) { + if (!(0, _condition.mouseOnly)(mapBrowserEvent)) { + return false; + } + + if (this.condition_(mapBrowserEvent)) { + mapBrowserEvent.map.getView().beginInteraction(); + this.lastAngle_ = undefined; + this.lastMagnitude_ = undefined; + return true; + } else { + return false; + } + }; + + return DragRotateAndZoom; +}(_Pointer.default); + +var _default = DragRotateAndZoom; +exports.default = _default; +},{"./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../events/condition.js":"../../../node_modules/ol/events/condition.js"}],"../../../node_modules/ol/geom/Circle.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _transform = require("./flat/transform.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/Circle + */ + + +/** + * @classdesc + * Circle geometry. + * + * @api + */ +var Circle = +/** @class */ +function (_super) { + __extends(Circle, _super); + /** + * @param {!import("../coordinate.js").Coordinate} center Center. + * For internal use, flat coordinates in combination with `opt_layout` and no + * `opt_radius` are also accepted. + * @param {number=} opt_radius Radius. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + */ + + + function Circle(center, opt_radius, opt_layout) { + var _this = _super.call(this) || this; + + if (opt_layout !== undefined && opt_radius === undefined) { + _this.setFlatCoordinates(opt_layout, center); + } else { + var radius = opt_radius ? opt_radius : 0; + + _this.setCenterAndRadius(center, radius, opt_layout); + } + + return _this; + } + /** + * Make a complete copy of the geometry. + * @return {!Circle} Clone. + * @api + */ + + + Circle.prototype.clone = function () { + return new Circle(this.flatCoordinates.slice(), undefined, 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. + */ + + + Circle.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + var flatCoordinates = this.flatCoordinates; + var dx = x - flatCoordinates[0]; + var dy = y - flatCoordinates[1]; + var squaredDistance = dx * dx + dy * dy; + + if (squaredDistance < minSquaredDistance) { + if (squaredDistance === 0) { + for (var i = 0; i < this.stride; ++i) { + closestPoint[i] = flatCoordinates[i]; + } + } else { + var delta = this.getRadius() / Math.sqrt(squaredDistance); + closestPoint[0] = flatCoordinates[0] + delta * dx; + closestPoint[1] = flatCoordinates[1] + delta * dy; + + for (var i = 2; i < this.stride; ++i) { + closestPoint[i] = flatCoordinates[i]; + } + } + + closestPoint.length = this.stride; + return squaredDistance; + } else { + return minSquaredDistance; + } + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + + + Circle.prototype.containsXY = function (x, y) { + var flatCoordinates = this.flatCoordinates; + var dx = x - flatCoordinates[0]; + var dy = y - flatCoordinates[1]; + return dx * dx + dy * dy <= this.getRadiusSquared_(); + }; + /** + * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}. + * @return {import("../coordinate.js").Coordinate} Center. + * @api + */ + + + Circle.prototype.getCenter = function () { + return this.flatCoordinates.slice(0, this.stride); + }; + /** + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. + */ + + + Circle.prototype.computeExtent = function (extent) { + var flatCoordinates = this.flatCoordinates; + var radius = flatCoordinates[this.stride] - flatCoordinates[0]; + return (0, _extent.createOrUpdate)(flatCoordinates[0] - radius, flatCoordinates[1] - radius, flatCoordinates[0] + radius, flatCoordinates[1] + radius, extent); + }; + /** + * Return the radius of the circle. + * @return {number} Radius. + * @api + */ + + + Circle.prototype.getRadius = function () { + return Math.sqrt(this.getRadiusSquared_()); + }; + /** + * @private + * @return {number} Radius squared. + */ + + + Circle.prototype.getRadiusSquared_ = function () { + var dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0]; + var dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1]; + return dx * dx + dy * dy; + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + Circle.prototype.getType = function () { + return _GeometryType.default.CIRCLE; + }; + /** + * 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 + */ + + + Circle.prototype.intersectsExtent = function (extent) { + var circleExtent = this.getExtent(); + + if ((0, _extent.intersects)(extent, circleExtent)) { + var center = this.getCenter(); + + if (extent[0] <= center[0] && extent[2] >= center[0]) { + return true; + } + + if (extent[1] <= center[1] && extent[3] >= center[1]) { + return true; + } + + return (0, _extent.forEachCorner)(extent, this.intersectsCoordinate.bind(this)); + } + + return false; + }; + /** + * Set the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}. + * @param {import("../coordinate.js").Coordinate} center Center. + * @api + */ + + + Circle.prototype.setCenter = function (center) { + var stride = this.stride; + var radius = this.flatCoordinates[stride] - this.flatCoordinates[0]; + var flatCoordinates = center.slice(); + flatCoordinates[stride] = flatCoordinates[0] + radius; + + for (var i = 1; i < stride; ++i) { + flatCoordinates[stride + i] = center[i]; + } + + this.setFlatCoordinates(this.layout, flatCoordinates); + this.changed(); + }; + /** + * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as + * number) of the circle. + * @param {!import("../coordinate.js").Coordinate} center Center. + * @param {number} radius Radius. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @api + */ + + + Circle.prototype.setCenterAndRadius = function (center, radius, opt_layout) { + this.setLayout(opt_layout, center, 0); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + /** @type {Array<number>} */ + + + var flatCoordinates = this.flatCoordinates; + var offset = (0, _deflate.deflateCoordinate)(flatCoordinates, 0, center, this.stride); + flatCoordinates[offset++] = flatCoordinates[0] + radius; + + for (var i = 1, ii = this.stride; i < ii; ++i) { + flatCoordinates[offset++] = flatCoordinates[i]; + } + + flatCoordinates.length = offset; + this.changed(); + }; + + Circle.prototype.getCoordinates = function () { + return null; + }; + + Circle.prototype.setCoordinates = function (coordinates, opt_layout) {}; + /** + * Set the radius of the circle. The radius is in the units of the projection. + * @param {number} radius Radius. + * @api + */ + + + Circle.prototype.setRadius = function (radius) { + this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius; + this.changed(); + }; + /** + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @param {number} angle Rotation angle in radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. + * @api + */ + + + Circle.prototype.rotate = function (angle, anchor) { + var center = this.getCenter(); + var stride = this.getStride(); + this.setCenter((0, _transform.rotate)(center, 0, center.length, stride, angle, anchor, center)); + this.changed(); + }; + /** + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. + * @api + */ + + + Circle.prototype.translate = function (deltaX, deltaY) { + var center = this.getCenter(); + var stride = this.getStride(); + this.setCenter((0, _transform.translate)(center, 0, center.length, stride, deltaX, deltaY, center)); + this.changed(); + }; + + return Circle; +}(_SimpleGeometry.default); +/** + * Transform each coordinate of the circle from one coordinate reference system + * to another. The geometry is modified in place. + * If you do not want the geometry modified in place, first clone() it and + * then use this function on the clone. + * + * Internally a circle is currently represented by two points: the center of + * the circle `[cx, cy]`, and the point to the right of the circle + * `[cx + r, cy]`. This `transform` function just transforms these two points. + * So the resulting geometry is also a circle, and that circle does not + * correspond to the shape that would be obtained by transforming every point + * of the original circle. + * + * @param {import("../proj.js").ProjectionLike} source The current projection. Can be a + * string identifier or a {@link module:ol/proj/Projection~Projection} object. + * @param {import("../proj.js").ProjectionLike} destination The desired projection. Can be a + * string identifier or a {@link module:ol/proj/Projection~Projection} object. + * @return {Circle} This geometry. Note that original geometry is + * modified in place. + * @function + * @api + */ + + +Circle.prototype.transform; +var _default = Circle; +exports.default = _default; +},{"./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","./flat/transform.js":"../../../node_modules/ol/geom/flat/transform.js"}],"../../../node_modules/ol/geom/MultiLineString.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryLayout = _interopRequireDefault(require("./GeometryLayout.js")); + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _LineString = _interopRequireDefault(require("./LineString.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _closest = require("./flat/closest.js"); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _simplify = require("./flat/simplify.js"); + +var _array = require("../array.js"); + +var _inflate = require("./flat/inflate.js"); + +var _interpolate = require("./flat/interpolate.js"); + +var _intersectsextent = require("./flat/intersectsextent.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/MultiLineString + */ + + +/** + * @classdesc + * Multi-linestring geometry. + * + * @api + */ +var MultiLineString = +/** @class */ +function (_super) { + __extends(MultiLineString, _super); + /** + * @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates + * Coordinates or LineString geometries. (For internal use, flat coordinates in + * combination with `opt_layout` and `opt_ends` are also accepted.) + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @param {Array<number>=} opt_ends Flat coordinate ends for internal use. + */ + + + function MultiLineString(coordinates, opt_layout, opt_ends) { + var _this = _super.call(this) || this; + /** + * @type {Array<number>} + * @private + */ + + + _this.ends_ = []; + /** + * @private + * @type {number} + */ + + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + + _this.maxDeltaRevision_ = -1; + + if (Array.isArray(coordinates[0])) { + _this.setCoordinates( + /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ + coordinates, opt_layout); + } else if (opt_layout !== undefined && opt_ends) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array<number>} */ + coordinates); + + _this.ends_ = opt_ends; + } else { + var layout = _this.getLayout(); + + var lineStrings = + /** @type {Array<LineString>} */ + coordinates; + var flatCoordinates = []; + var ends = []; + + for (var i = 0, ii = lineStrings.length; i < ii; ++i) { + var lineString = lineStrings[i]; + + if (i === 0) { + layout = lineString.getLayout(); + } + + (0, _array.extend)(flatCoordinates, lineString.getFlatCoordinates()); + ends.push(flatCoordinates.length); + } + + _this.setFlatCoordinates(layout, flatCoordinates); + + _this.ends_ = ends; + } + + return _this; + } + /** + * Append the passed linestring to the multilinestring. + * @param {LineString} lineString LineString. + * @api + */ + + + MultiLineString.prototype.appendLineString = function (lineString) { + if (!this.flatCoordinates) { + this.flatCoordinates = lineString.getFlatCoordinates().slice(); + } else { + (0, _array.extend)(this.flatCoordinates, lineString.getFlatCoordinates().slice()); + } + + this.ends_.push(this.flatCoordinates.length); + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!MultiLineString} Clone. + * @api + */ + + + MultiLineString.prototype.clone = function () { + return new MultiLineString(this.flatCoordinates.slice(), this.layout, this.ends_.slice()); + }; + /** + * @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. + */ + + + MultiLineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < (0, _extent.closestSquaredDistanceXY)(this.getExtent(), x, y)) { + return minSquaredDistance; + } + + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt((0, _closest.arrayMaxSquaredDelta)(this.flatCoordinates, 0, this.ends_, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + + return (0, _closest.assignClosestArrayPoint)(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance); + }; + /** + * Returns the coordinate at `m` using linear interpolation, or `null` if no + * such coordinate exists. + * + * `opt_extrapolate` controls extrapolation beyond the range of Ms in the + * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first + * M will return the first coordinate and Ms greater than the last M will + * return the last coordinate. + * + * `opt_interpolate` controls interpolation between consecutive LineStrings + * within the MultiLineString. If `opt_interpolate` is `true` the coordinates + * will be linearly interpolated between the last coordinate of one LineString + * and the first coordinate of the next LineString. If `opt_interpolate` is + * `false` then the function will return `null` for Ms falling between + * LineStrings. + * + * @param {number} m M. + * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`. + * @param {boolean=} opt_interpolate Interpolate. Default is `false`. + * @return {import("../coordinate.js").Coordinate} Coordinate. + * @api + */ + + + MultiLineString.prototype.getCoordinateAtM = function (m, opt_extrapolate, opt_interpolate) { + if (this.layout != _GeometryLayout.default.XYM && this.layout != _GeometryLayout.default.XYZM || this.flatCoordinates.length === 0) { + return null; + } + + var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false; + var interpolate = opt_interpolate !== undefined ? opt_interpolate : false; + return (0, _interpolate.lineStringsCoordinateAtM)(this.flatCoordinates, 0, this.ends_, this.stride, m, extrapolate, interpolate); + }; + /** + * Return the coordinates of the multilinestring. + * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates. + * @api + */ + + + MultiLineString.prototype.getCoordinates = function () { + return (0, _inflate.inflateCoordinatesArray)(this.flatCoordinates, 0, this.ends_, this.stride); + }; + /** + * @return {Array<number>} Ends. + */ + + + MultiLineString.prototype.getEnds = function () { + return this.ends_; + }; + /** + * Return the linestring at the specified index. + * @param {number} index Index. + * @return {LineString} LineString. + * @api + */ + + + MultiLineString.prototype.getLineString = function (index) { + if (index < 0 || this.ends_.length <= index) { + return null; + } + + return new _LineString.default(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout); + }; + /** + * Return the linestrings of this multilinestring. + * @return {Array<LineString>} LineStrings. + * @api + */ + + + MultiLineString.prototype.getLineStrings = function () { + var flatCoordinates = this.flatCoordinates; + var ends = this.ends_; + var layout = this.layout; + /** @type {Array<LineString>} */ + + var lineStrings = []; + var offset = 0; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var lineString = new _LineString.default(flatCoordinates.slice(offset, end), layout); + lineStrings.push(lineString); + offset = end; + } + + return lineStrings; + }; + /** + * @return {Array<number>} Flat midpoints. + */ + + + MultiLineString.prototype.getFlatMidpoints = function () { + var midpoints = []; + var flatCoordinates = this.flatCoordinates; + var offset = 0; + var ends = this.ends_; + var stride = this.stride; + + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var midpoint = (0, _interpolate.interpolatePoint)(flatCoordinates, offset, end, stride, 0.5); + (0, _array.extend)(midpoints, midpoint); + offset = end; + } + + return midpoints; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {MultiLineString} Simplified MultiLineString. + * @protected + */ + + + MultiLineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + var simplifiedEnds = []; + simplifiedFlatCoordinates.length = (0, _simplify.douglasPeuckerArray)(this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0, simplifiedEnds); + return new MultiLineString(simplifiedFlatCoordinates, _GeometryLayout.default.XY, simplifiedEnds); + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + MultiLineString.prototype.getType = function () { + return _GeometryType.default.MULTI_LINE_STRING; + }; + /** + * 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 + */ + + + MultiLineString.prototype.intersectsExtent = function (extent) { + return (0, _intersectsextent.intersectsLineStringArray)(this.flatCoordinates, 0, this.ends_, this.stride, extent); + }; + /** + * Set the coordinates of the multilinestring. + * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates. + * @param {GeometryLayout=} opt_layout Layout. + * @api + */ + + + MultiLineString.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 2); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + + var ends = (0, _deflate.deflateCoordinatesArray)(this.flatCoordinates, 0, coordinates, this.stride, this.ends_); + this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; + this.changed(); + }; + + return MultiLineString; +}(_SimpleGeometry.default); + +var _default = MultiLineString; +exports.default = _default; +},{"./GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./LineString.js":"../../../node_modules/ol/geom/LineString.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","./flat/closest.js":"../../../node_modules/ol/geom/flat/closest.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","./flat/simplify.js":"../../../node_modules/ol/geom/flat/simplify.js","../array.js":"../../../node_modules/ol/array.js","./flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js","./flat/interpolate.js":"../../../node_modules/ol/geom/flat/interpolate.js","./flat/intersectsextent.js":"../../../node_modules/ol/geom/flat/intersectsextent.js"}],"../../../node_modules/ol/geom/MultiPoint.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _Point = _interopRequireDefault(require("./Point.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _array = require("../array.js"); + +var _inflate = require("./flat/inflate.js"); + +var _math = require("../math.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/MultiPoint + */ + + +/** + * @classdesc + * Multi-point geometry. + * + * @api + */ +var MultiPoint = +/** @class */ +function (_super) { + __extends(MultiPoint, _super); + /** + * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` are also accepted. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + */ + + + function MultiPoint(coordinates, opt_layout) { + var _this = _super.call(this) || this; + + if (opt_layout && !Array.isArray(coordinates[0])) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array<number>} */ + coordinates); + } else { + _this.setCoordinates( + /** @type {Array<import("../coordinate.js").Coordinate>} */ + coordinates, opt_layout); + } + + return _this; + } + /** + * Append the passed point to this multipoint. + * @param {Point} point Point. + * @api + */ + + + MultiPoint.prototype.appendPoint = function (point) { + if (!this.flatCoordinates) { + this.flatCoordinates = point.getFlatCoordinates().slice(); + } else { + (0, _array.extend)(this.flatCoordinates, point.getFlatCoordinates()); + } + + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!MultiPoint} Clone. + * @api + */ + + + MultiPoint.prototype.clone = function () { + var multiPoint = new MultiPoint(this.flatCoordinates.slice(), this.layout); + return multiPoint; + }; + /** + * @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. + */ + + + MultiPoint.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < (0, _extent.closestSquaredDistanceXY)(this.getExtent(), x, y)) { + return minSquaredDistance; + } + + var flatCoordinates = this.flatCoordinates; + var stride = this.stride; + + for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + var squaredDistance = (0, _math.squaredDistance)(x, y, flatCoordinates[i], flatCoordinates[i + 1]); + + if (squaredDistance < minSquaredDistance) { + minSquaredDistance = squaredDistance; + + for (var j = 0; j < stride; ++j) { + closestPoint[j] = flatCoordinates[i + j]; + } + + closestPoint.length = stride; + } + } + + return minSquaredDistance; + }; + /** + * Return the coordinates of the multipoint. + * @return {Array<import("../coordinate.js").Coordinate>} Coordinates. + * @api + */ + + + MultiPoint.prototype.getCoordinates = function () { + return (0, _inflate.inflateCoordinates)(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the point at the specified index. + * @param {number} index Index. + * @return {Point} Point. + * @api + */ + + + MultiPoint.prototype.getPoint = function (index) { + var n = !this.flatCoordinates ? 0 : this.flatCoordinates.length / this.stride; + + if (index < 0 || n <= index) { + return null; + } + + return new _Point.default(this.flatCoordinates.slice(index * this.stride, (index + 1) * this.stride), this.layout); + }; + /** + * Return the points of this multipoint. + * @return {Array<Point>} Points. + * @api + */ + + + MultiPoint.prototype.getPoints = function () { + var flatCoordinates = this.flatCoordinates; + var layout = this.layout; + var stride = this.stride; + /** @type {Array<Point>} */ + + var points = []; + + for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + var point = new _Point.default(flatCoordinates.slice(i, i + stride), layout); + points.push(point); + } + + return points; + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + MultiPoint.prototype.getType = function () { + return _GeometryType.default.MULTI_POINT; + }; + /** + * 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 + */ + + + MultiPoint.prototype.intersectsExtent = function (extent) { + var flatCoordinates = this.flatCoordinates; + var stride = this.stride; + + for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + var x = flatCoordinates[i]; + var y = flatCoordinates[i + 1]; + + if ((0, _extent.containsXY)(extent, x, y)) { + return true; + } + } + + return false; + }; + /** + * Set the coordinates of the multipoint. + * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @api + */ + + + MultiPoint.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 1); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + + this.flatCoordinates.length = (0, _deflate.deflateCoordinates)(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + + return MultiPoint; +}(_SimpleGeometry.default); + +var _default = MultiPoint; +exports.default = _default; +},{"./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./Point.js":"../../../node_modules/ol/geom/Point.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","../array.js":"../../../node_modules/ol/array.js","./flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js","../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/geom/flat/center.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.linearRingss = linearRingss; + +var _extent = require("../../extent.js"); + +/** + * @module ol/geom/flat/center + */ + +/** + * @param {Array<number>} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array<Array<number>>} endss Endss. + * @param {number} stride Stride. + * @return {Array<number>} Flat centers. + */ +function linearRingss(flatCoordinates, offset, endss, stride) { + var flatCenters = []; + var extent = (0, _extent.createEmpty)(); + + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + extent = (0, _extent.createOrUpdateFromFlatCoordinates)(flatCoordinates, offset, ends[0], stride); + flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2); + offset = ends[ends.length - 1]; + } + + return flatCenters; +} +},{"../../extent.js":"../../../node_modules/ol/extent.js"}],"../../../node_modules/ol/geom/MultiPolygon.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _GeometryLayout = _interopRequireDefault(require("./GeometryLayout.js")); + +var _GeometryType = _interopRequireDefault(require("./GeometryType.js")); + +var _MultiPoint = _interopRequireDefault(require("./MultiPoint.js")); + +var _Polygon = _interopRequireDefault(require("./Polygon.js")); + +var _SimpleGeometry = _interopRequireDefault(require("./SimpleGeometry.js")); + +var _closest = require("./flat/closest.js"); + +var _extent = require("../extent.js"); + +var _deflate = require("./flat/deflate.js"); + +var _array = require("../array.js"); + +var _interiorpoint = require("./flat/interiorpoint.js"); + +var _inflate = require("./flat/inflate.js"); + +var _intersectsextent = require("./flat/intersectsextent.js"); + +var _orient = require("./flat/orient.js"); + +var _area = require("./flat/area.js"); + +var _center = require("./flat/center.js"); + +var _contains = require("./flat/contains.js"); + +var _simplify = require("./flat/simplify.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/geom/MultiPolygon + */ + + +/** + * @classdesc + * Multi-polygon geometry. + * + * @api + */ +var MultiPolygon = +/** @class */ +function (_super) { + __extends(MultiPolygon, _super); + /** + * @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` and `opt_endss` are also accepted. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @param {Array<Array<number>>=} opt_endss Array of ends for internal use with flat coordinates. + */ + + + function MultiPolygon(coordinates, opt_layout, opt_endss) { + var _this = _super.call(this) || this; + /** + * @type {Array<Array<number>>} + * @private + */ + + + _this.endss_ = []; + /** + * @private + * @type {number} + */ + + _this.flatInteriorPointsRevision_ = -1; + /** + * @private + * @type {Array<number>} + */ + + _this.flatInteriorPoints_ = null; + /** + * @private + * @type {number} + */ + + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + + _this.maxDeltaRevision_ = -1; + /** + * @private + * @type {number} + */ + + _this.orientedRevision_ = -1; + /** + * @private + * @type {Array<number>} + */ + + _this.orientedFlatCoordinates_ = null; + + if (!opt_endss && !Array.isArray(coordinates[0])) { + var layout = _this.getLayout(); + + var polygons = + /** @type {Array<Polygon>} */ + coordinates; + var flatCoordinates = []; + var endss = []; + + for (var i = 0, ii = polygons.length; i < ii; ++i) { + var polygon = polygons[i]; + + if (i === 0) { + layout = polygon.getLayout(); + } + + var offset = flatCoordinates.length; + var ends = polygon.getEnds(); + + for (var j = 0, jj = ends.length; j < jj; ++j) { + ends[j] += offset; + } + + (0, _array.extend)(flatCoordinates, polygon.getFlatCoordinates()); + endss.push(ends); + } + + opt_layout = layout; + coordinates = flatCoordinates; + opt_endss = endss; + } + + if (opt_layout !== undefined && opt_endss) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array<number>} */ + coordinates); + + _this.endss_ = opt_endss; + } else { + _this.setCoordinates( + /** @type {Array<Array<Array<import("../coordinate.js").Coordinate>>>} */ + coordinates, opt_layout); + } + + return _this; + } + /** + * Append the passed polygon to this multipolygon. + * @param {Polygon} polygon Polygon. + * @api + */ + + + MultiPolygon.prototype.appendPolygon = function (polygon) { + /** @type {Array<number>} */ + var ends; + + if (!this.flatCoordinates) { + this.flatCoordinates = polygon.getFlatCoordinates().slice(); + ends = polygon.getEnds().slice(); + this.endss_.push(); + } else { + var offset = this.flatCoordinates.length; + (0, _array.extend)(this.flatCoordinates, polygon.getFlatCoordinates()); + ends = polygon.getEnds().slice(); + + for (var i = 0, ii = ends.length; i < ii; ++i) { + ends[i] += offset; + } + } + + this.endss_.push(ends); + this.changed(); + }; + /** + * Make a complete copy of the geometry. + * @return {!MultiPolygon} Clone. + * @api + */ + + + MultiPolygon.prototype.clone = function () { + var len = this.endss_.length; + var newEndss = new Array(len); + + for (var i = 0; i < len; ++i) { + newEndss[i] = this.endss_[i].slice(); + } + + return new MultiPolygon(this.flatCoordinates.slice(), this.layout, newEndss); + }; + /** + * @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. + */ + + + MultiPolygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < (0, _extent.closestSquaredDistanceXY)(this.getExtent(), x, y)) { + return minSquaredDistance; + } + + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt((0, _closest.multiArrayMaxSquaredDelta)(this.flatCoordinates, 0, this.endss_, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + + return (0, _closest.assignClosestMultiArrayPoint)(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ + + + MultiPolygon.prototype.containsXY = function (x, y) { + return (0, _contains.linearRingssContainsXY)(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y); + }; + /** + * Return the area of the multipolygon on projected plane. + * @return {number} Area (on projected plane). + * @api + */ + + + MultiPolygon.prototype.getArea = function () { + return (0, _area.linearRingss)(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride); + }; + /** + * Get the coordinate array for this geometry. This array has the structure + * of a GeoJSON coordinate array for multi-polygons. + * + * @param {boolean=} opt_right Orient coordinates according to the right-hand + * rule (counter-clockwise for exterior and clockwise for interior rings). + * If `false`, coordinates will be oriented according to the left-hand rule + * (clockwise for exterior and counter-clockwise for interior rings). + * By default, coordinate orientation will depend on how the geometry was + * constructed. + * @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates. + * @api + */ + + + MultiPolygon.prototype.getCoordinates = function (opt_right) { + var flatCoordinates; + + if (opt_right !== undefined) { + flatCoordinates = this.getOrientedFlatCoordinates().slice(); + (0, _orient.orientLinearRingsArray)(flatCoordinates, 0, this.endss_, this.stride, opt_right); + } else { + flatCoordinates = this.flatCoordinates; + } + + return (0, _inflate.inflateMultiCoordinatesArray)(flatCoordinates, 0, this.endss_, this.stride); + }; + /** + * @return {Array<Array<number>>} Endss. + */ + + + MultiPolygon.prototype.getEndss = function () { + return this.endss_; + }; + /** + * @return {Array<number>} Flat interior points. + */ + + + MultiPolygon.prototype.getFlatInteriorPoints = function () { + if (this.flatInteriorPointsRevision_ != this.getRevision()) { + var flatCenters = (0, _center.linearRingss)(this.flatCoordinates, 0, this.endss_, this.stride); + this.flatInteriorPoints_ = (0, _interiorpoint.getInteriorPointsOfMultiArray)(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, flatCenters); + this.flatInteriorPointsRevision_ = this.getRevision(); + } + + return this.flatInteriorPoints_; + }; + /** + * Return the interior points as {@link module:ol/geom/MultiPoint multipoint}. + * @return {MultiPoint} Interior points as XYM coordinates, where M is + * the length of the horizontal intersection that the point belongs to. + * @api + */ + + + MultiPolygon.prototype.getInteriorPoints = function () { + return new _MultiPoint.default(this.getFlatInteriorPoints().slice(), _GeometryLayout.default.XYM); + }; + /** + * @return {Array<number>} Oriented flat coordinates. + */ + + + MultiPolygon.prototype.getOrientedFlatCoordinates = function () { + if (this.orientedRevision_ != this.getRevision()) { + var flatCoordinates = this.flatCoordinates; + + if ((0, _orient.linearRingssAreOriented)(flatCoordinates, 0, this.endss_, this.stride)) { + this.orientedFlatCoordinates_ = flatCoordinates; + } else { + this.orientedFlatCoordinates_ = flatCoordinates.slice(); + this.orientedFlatCoordinates_.length = (0, _orient.orientLinearRingsArray)(this.orientedFlatCoordinates_, 0, this.endss_, this.stride); + } + + this.orientedRevision_ = this.getRevision(); + } + + return this.orientedFlatCoordinates_; + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {MultiPolygon} Simplified MultiPolygon. + * @protected + */ + + + MultiPolygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + var simplifiedEndss = []; + simplifiedFlatCoordinates.length = (0, _simplify.quantizeMultiArray)(this.flatCoordinates, 0, this.endss_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEndss); + return new MultiPolygon(simplifiedFlatCoordinates, _GeometryLayout.default.XY, simplifiedEndss); + }; + /** + * Return the polygon at the specified index. + * @param {number} index Index. + * @return {Polygon} Polygon. + * @api + */ + + + MultiPolygon.prototype.getPolygon = function (index) { + if (index < 0 || this.endss_.length <= index) { + return null; + } + + var offset; + + if (index === 0) { + offset = 0; + } else { + var prevEnds = this.endss_[index - 1]; + offset = prevEnds[prevEnds.length - 1]; + } + + var ends = this.endss_[index].slice(); + var end = ends[ends.length - 1]; + + if (offset !== 0) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + ends[i] -= offset; + } + } + + return new _Polygon.default(this.flatCoordinates.slice(offset, end), this.layout, ends); + }; + /** + * Return the polygons of this multipolygon. + * @return {Array<Polygon>} Polygons. + * @api + */ + + + MultiPolygon.prototype.getPolygons = function () { + var layout = this.layout; + var flatCoordinates = this.flatCoordinates; + var endss = this.endss_; + var polygons = []; + var offset = 0; + + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i].slice(); + var end = ends[ends.length - 1]; + + if (offset !== 0) { + for (var j = 0, jj = ends.length; j < jj; ++j) { + ends[j] -= offset; + } + } + + var polygon = new _Polygon.default(flatCoordinates.slice(offset, end), layout, ends); + polygons.push(polygon); + offset = end; + } + + return polygons; + }; + /** + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. + * @api + */ + + + MultiPolygon.prototype.getType = function () { + return _GeometryType.default.MULTI_POLYGON; + }; + /** + * 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 + */ + + + MultiPolygon.prototype.intersectsExtent = function (extent) { + return (0, _intersectsextent.intersectsLinearRingMultiArray)(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, extent); + }; + /** + * Set the coordinates of the multipolygon. + * @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. + * @api + */ + + + MultiPolygon.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 3); + + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + + var endss = (0, _deflate.deflateMultiCoordinatesArray)(this.flatCoordinates, 0, coordinates, this.stride, this.endss_); + + if (endss.length === 0) { + this.flatCoordinates.length = 0; + } else { + var lastEnds = endss[endss.length - 1]; + this.flatCoordinates.length = lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1]; + } + + this.changed(); + }; + + return MultiPolygon; +}(_SimpleGeometry.default); + +var _default = MultiPolygon; +exports.default = _default; +},{"./GeometryLayout.js":"../../../node_modules/ol/geom/GeometryLayout.js","./GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./MultiPoint.js":"../../../node_modules/ol/geom/MultiPoint.js","./Polygon.js":"../../../node_modules/ol/geom/Polygon.js","./SimpleGeometry.js":"../../../node_modules/ol/geom/SimpleGeometry.js","./flat/closest.js":"../../../node_modules/ol/geom/flat/closest.js","../extent.js":"../../../node_modules/ol/extent.js","./flat/deflate.js":"../../../node_modules/ol/geom/flat/deflate.js","../array.js":"../../../node_modules/ol/array.js","./flat/interiorpoint.js":"../../../node_modules/ol/geom/flat/interiorpoint.js","./flat/inflate.js":"../../../node_modules/ol/geom/flat/inflate.js","./flat/intersectsextent.js":"../../../node_modules/ol/geom/flat/intersectsextent.js","./flat/orient.js":"../../../node_modules/ol/geom/flat/orient.js","./flat/area.js":"../../../node_modules/ol/geom/flat/area.js","./flat/center.js":"../../../node_modules/ol/geom/flat/center.js","./flat/contains.js":"../../../node_modules/ol/geom/flat/contains.js","./flat/simplify.js":"../../../node_modules/ol/geom/flat/simplify.js"}],"../../../node_modules/ol/interaction/Draw.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createRegularPolygon = createRegularPolygon; +exports.createBox = createBox; +exports.default = void 0; + +var _Circle = _interopRequireDefault(require("../geom/Circle.js")); + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Feature = _interopRequireDefault(require("../Feature.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _Property = _interopRequireDefault(require("./Property.js")); + +var _LineString = _interopRequireDefault(require("../geom/LineString.js")); + +var _MapBrowserEvent = _interopRequireDefault(require("../MapBrowserEvent.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("../MapBrowserEventType.js")); + +var _MultiLineString = _interopRequireDefault(require("../geom/MultiLineString.js")); + +var _MultiPoint = _interopRequireDefault(require("../geom/MultiPoint.js")); + +var _MultiPolygon = _interopRequireDefault(require("../geom/MultiPolygon.js")); + +var _Point = _interopRequireDefault(require("../geom/Point.js")); + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _Polygon = _interopRequireWildcard(require("../geom/Polygon.js")); + +var _Vector = _interopRequireDefault(require("../layer/Vector.js")); + +var _Vector2 = _interopRequireDefault(require("../source/Vector.js")); + +var _functions = require("../functions.js"); + +var _condition = require("../events/condition.js"); + +var _extent = require("../extent.js"); + +var _Style = require("../style/Style.js"); + +var _proj = require("../proj.js"); + +var _Object = require("../Object.js"); + +var _coordinate = require("../coordinate.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Draw + */ + + +/** + * @typedef {Object} Options + * @property {import("../geom/GeometryType.js").default} type Geometry type of + * the geometries being drawn with this instance. + * @property {number} [clickTolerance=6] The maximum distance in pixels between + * "down" and "up" for a "up" event to be considered a "click" event and + * actually add a point/vertex to the geometry being drawn. The default of `6` + * was chosen for the draw interaction to behave correctly on mouse as well as + * on touch devices. + * @property {import("../Collection.js").default<Feature>} [features] + * Destination collection for the drawn features. + * @property {VectorSource} [source] Destination source for + * the drawn features. + * @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown + * before the current vertex can be dragged to its exact position. + * @property {number} [snapTolerance=12] Pixel distance for snapping to the + * drawing finish. + * @property {boolean} [stopClick=false] Stop click, singleclick, and + * doubleclick events from firing during drawing. + * @property {number} [maxPoints] The number of points that can be drawn before + * a polygon ring or line string is finished. By default there is no + * restriction. + * @property {number} [minPoints] The number of points that must be drawn + * before a polygon ring or line string can be finished. Default is `3` for + * polygon rings and `2` for line strings. + * @property {import("../events/condition.js").Condition} [finishCondition] A function + * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether the drawing can be finished. + * @property {import("../style/Style.js").StyleLike} [style] + * Style for sketch features. + * @property {GeometryFunction} [geometryFunction] + * Function that is called when a geometry's coordinates are updated. + * @property {string} [geometryName] Geometry name to use for features created + * by the draw interaction. + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. + * By default {@link module:ol/events/condition~noModifierKeys}, i.e. a click, + * adds a vertex or deactivates freehand drawing. + * @property {boolean} [freehand=false] Operate in freehand mode for lines, + * polygons, and circles. This makes the interaction always operate in freehand + * mode and takes precedence over any `freehandCondition` option. + * @property {import("../events/condition.js").Condition} [freehandCondition] + * Condition that activates freehand drawing for lines and polygons. This + * function takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and + * returns a boolean to indicate whether that event should be handled. The + * default is {@link module:ol/events/condition~shiftKeyOnly}, meaning that the + * Shift key activates freehand drawing. + * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch + * overlay. + */ + +/** + * Coordinate type when drawing points. + * @typedef {import("../coordinate.js").Coordinate} PointCoordType + */ + +/** + * Coordinate type when drawing lines. + * @typedef {Array<import("../coordinate.js").Coordinate>} LineCoordType + */ + +/** + * Coordinate type when drawing polygons. + * @typedef {Array<Array<import("../coordinate.js").Coordinate>>} PolyCoordType + */ + +/** + * Types used for drawing coordinates. + * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType + */ + +/** + * Function that takes an array of coordinates and an optional existing geometry + * and a projection as arguments, and returns a geometry. The optional existing + * geometry is the geometry that is returned when the function is called without + * a second argument. + * @typedef {function(!SketchCoordType, import("../geom/SimpleGeometry.js").default=, + * import("../proj/Projection.js").default=): + * import("../geom/SimpleGeometry.js").default} GeometryFunction + */ + +/** + * Draw mode. This collapses multi-part geometry types with their single-part + * cousins. + * @enum {string} + */ +var Mode = { + POINT: 'Point', + LINE_STRING: 'LineString', + POLYGON: 'Polygon', + CIRCLE: 'Circle' +}; +/** + * @enum {string} + */ + +var DrawEventType = { + /** + * Triggered upon feature draw start + * @event DrawEvent#drawstart + * @api + */ + DRAWSTART: 'drawstart', + + /** + * Triggered upon feature draw end + * @event DrawEvent#drawend + * @api + */ + DRAWEND: 'drawend', + + /** + * Triggered upon feature draw abortion + * @event DrawEvent#drawabort + * @api + */ + DRAWABORT: 'drawabort' +}; +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/Draw~Draw} instances are + * instances of this type. + */ + +var DrawEvent = +/** @class */ +function (_super) { + __extends(DrawEvent, _super); + /** + * @param {DrawEventType} type Type. + * @param {Feature} feature The feature drawn. + */ + + + function DrawEvent(type, feature) { + var _this = _super.call(this, type) || this; + /** + * The feature being drawn. + * @type {Feature} + * @api + */ + + + _this.feature = feature; + return _this; + } + + return DrawEvent; +}(_Event.default); +/** + * @classdesc + * Interaction for drawing feature geometries. + * + * @fires DrawEvent + * @api + */ + + +var Draw = +/** @class */ +function (_super) { + __extends(Draw, _super); + /** + * @param {Options} options Options. + */ + + + function Draw(options) { + var _this = this; + + var pointerOptions = + /** @type {import("./Pointer.js").Options} */ + options; + + if (!pointerOptions.stopDown) { + pointerOptions.stopDown = _functions.FALSE; + } + + _this = _super.call(this, pointerOptions) || this; + /** + * @type {boolean} + * @private + */ + + _this.shouldHandle_ = false; + /** + * @type {import("../pixel.js").Pixel} + * @private + */ + + _this.downPx_ = null; + /** + * @type {?} + * @private + */ + + _this.downTimeout_; + /** + * @type {number|undefined} + * @private + */ + + _this.lastDragTime_; + /** + * @type {boolean} + * @private + */ + + _this.freehand_ = false; + /** + * Target source for drawn features. + * @type {VectorSource} + * @private + */ + + _this.source_ = options.source ? options.source : null; + /** + * Target collection for drawn features. + * @type {import("../Collection.js").default<Feature>} + * @private + */ + + _this.features_ = options.features ? options.features : null; + /** + * Pixel distance for snapping. + * @type {number} + * @private + */ + + _this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12; + /** + * Geometry type. + * @type {import("../geom/GeometryType.js").default} + * @private + */ + + _this.type_ = + /** @type {import("../geom/GeometryType.js").default} */ + options.type; + /** + * Drawing mode (derived from geometry type. + * @type {Mode} + * @private + */ + + _this.mode_ = getMode(_this.type_); + /** + * Stop click, singleclick, and doubleclick events from firing during drawing. + * Default is `false`. + * @type {boolean} + * @private + */ + + _this.stopClick_ = !!options.stopClick; + /** + * The number of points that must be drawn before a polygon ring or line + * string can be finished. The default is 3 for polygon rings and 2 for + * line strings. + * @type {number} + * @private + */ + + _this.minPoints_ = options.minPoints ? options.minPoints : _this.mode_ === Mode.POLYGON ? 3 : 2; + /** + * The number of points that can be drawn before a polygon ring or line string + * is finished. The default is no restriction. + * @type {number} + * @private + */ + + _this.maxPoints_ = options.maxPoints ? options.maxPoints : Infinity; + /** + * A function to decide if a potential finish coordinate is permissible + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.finishCondition_ = options.finishCondition ? options.finishCondition : _functions.TRUE; + var geometryFunction = options.geometryFunction; + + if (!geometryFunction) { + if (_this.type_ === _GeometryType.default.CIRCLE) { + /** + * @param {!LineCoordType} coordinates The coordinates. + * @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry. + * @param {import("../proj/Projection.js").default} projection The view projection. + * @return {import("../geom/SimpleGeometry.js").default} A geometry. + */ + geometryFunction = function (coordinates, opt_geometry, projection) { + var circle = opt_geometry ? + /** @type {Circle} */ + opt_geometry : new _Circle.default([NaN, NaN]); + var center = (0, _proj.fromUserCoordinate)(coordinates[0], projection); + var squaredLength = (0, _coordinate.squaredDistance)(center, (0, _proj.fromUserCoordinate)(coordinates[1], projection)); + circle.setCenterAndRadius(center, Math.sqrt(squaredLength)); + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + circle.transform(projection, userProjection); + } + + return circle; + }; + } else { + var Constructor_1; + var mode_1 = _this.mode_; + + if (mode_1 === Mode.POINT) { + Constructor_1 = _Point.default; + } else if (mode_1 === Mode.LINE_STRING) { + Constructor_1 = _LineString.default; + } else if (mode_1 === Mode.POLYGON) { + Constructor_1 = _Polygon.default; + } + /** + * @param {!LineCoordType} coordinates The coordinates. + * @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry. + * @param {import("../proj/Projection.js").default} projection The view projection. + * @return {import("../geom/SimpleGeometry.js").default} A geometry. + */ + + + geometryFunction = function (coordinates, opt_geometry, projection) { + var geometry = opt_geometry; + + if (geometry) { + if (mode_1 === Mode.POLYGON) { + if (coordinates[0].length) { + // Add a closing coordinate to match the first + geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]); + } else { + geometry.setCoordinates([]); + } + } else { + geometry.setCoordinates(coordinates); + } + } else { + geometry = new Constructor_1(coordinates); + } + + return geometry; + }; + } + } + /** + * @type {GeometryFunction} + * @private + */ + + + _this.geometryFunction_ = geometryFunction; + /** + * @type {number} + * @private + */ + + _this.dragVertexDelay_ = options.dragVertexDelay !== undefined ? options.dragVertexDelay : 500; + /** + * Finish coordinate for the feature (first point for polygons, last point for + * linestrings). + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.finishCoordinate_ = null; + /** + * Sketch feature. + * @type {Feature} + * @private + */ + + _this.sketchFeature_ = null; + /** + * Sketch point. + * @type {Feature<Point>} + * @private + */ + + _this.sketchPoint_ = null; + /** + * Sketch coordinates. Used when drawing a line or polygon. + * @type {SketchCoordType} + * @private + */ + + _this.sketchCoords_ = null; + /** + * Sketch line. Used when drawing polygon. + * @type {Feature<LineString>} + * @private + */ + + _this.sketchLine_ = null; + /** + * Sketch line coordinates. Used when drawing a polygon or circle. + * @type {LineCoordType} + * @private + */ + + _this.sketchLineCoords_ = null; + /** + * Squared tolerance for handling up events. If the squared distance + * between a down and up event is greater than this tolerance, up events + * will not be handled. + * @type {number} + * @private + */ + + _this.squaredClickTolerance_ = options.clickTolerance ? options.clickTolerance * options.clickTolerance : 36; + /** + * Draw overlay where our sketch features are drawn. + * @type {VectorLayer} + * @private + */ + + _this.overlay_ = new _Vector.default({ + source: new _Vector2.default({ + useSpatialIndex: false, + wrapX: options.wrapX ? options.wrapX : false + }), + style: options.style ? options.style : getDefaultStyleFunction(), + updateWhileInteracting: true + }); + /** + * Name of the geometry attribute for newly created features. + * @type {string|undefined} + * @private + */ + + _this.geometryName_ = options.geometryName; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.noModifierKeys; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.freehandCondition_; + + if (options.freehand) { + _this.freehandCondition_ = _condition.always; + } else { + _this.freehandCondition_ = options.freehandCondition ? options.freehandCondition : _condition.shiftKeyOnly; + } + + _this.addEventListener((0, _Object.getChangeEventType)(_Property.default.ACTIVE), _this.updateState_); + + return _this; + } + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + Draw.prototype.setMap = function (map) { + _super.prototype.setMap.call(this, map); + + this.updateState_(); + }; + /** + * Get the overlay layer that this interaction renders sketch features to. + * @return {VectorLayer} Overlay layer. + * @api + */ + + + Draw.prototype.getOverlay = function () { + return this.overlay_; + }; + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing. + * @param {import("../MapBrowserEvent.js").default} event Map browser event. + * @return {boolean} `false` to stop event propagation. + * @api + */ + + + Draw.prototype.handleEvent = function (event) { + if (event.originalEvent.type === _EventType.default.CONTEXTMENU) { + // Avoid context menu for long taps when drawing on mobile + event.preventDefault(); + } + + this.freehand_ = this.mode_ !== Mode.POINT && this.freehandCondition_(event); + var move = event.type === _MapBrowserEventType.default.POINTERMOVE; + var pass = true; + + if (!this.freehand_ && this.lastDragTime_ && event.type === _MapBrowserEventType.default.POINTERDRAG) { + var now = Date.now(); + + if (now - this.lastDragTime_ >= this.dragVertexDelay_) { + this.downPx_ = event.pixel; + this.shouldHandle_ = !this.freehand_; + move = true; + } else { + this.lastDragTime_ = undefined; + } + + if (this.shouldHandle_ && this.downTimeout_ !== undefined) { + clearTimeout(this.downTimeout_); + this.downTimeout_ = undefined; + } + } + + if (this.freehand_ && event.type === _MapBrowserEventType.default.POINTERDRAG && this.sketchFeature_ !== null) { + this.addToDrawing_(event.coordinate); + pass = false; + } else if (this.freehand_ && event.type === _MapBrowserEventType.default.POINTERDOWN) { + pass = false; + } else if (move) { + pass = event.type === _MapBrowserEventType.default.POINTERMOVE; + + if (pass && this.freehand_) { + this.handlePointerMove_(event); + + if (this.shouldHandle_) { + // Avoid page scrolling when freehand drawing on mobile + event.preventDefault(); + } + } else if (event.originalEvent.pointerType == 'mouse' || event.type === _MapBrowserEventType.default.POINTERDRAG && this.downTimeout_ === undefined) { + this.handlePointerMove_(event); + } + } else if (event.type === _MapBrowserEventType.default.DBLCLICK) { + pass = false; + } + + return _super.prototype.handleEvent.call(this, event) && pass; + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @return {boolean} If the event was consumed. + */ + + + Draw.prototype.handleDownEvent = function (event) { + this.shouldHandle_ = !this.freehand_; + + if (this.freehand_) { + this.downPx_ = event.pixel; + + if (!this.finishCoordinate_) { + this.startDrawing_(event); + } + + return true; + } else if (this.condition_(event)) { + this.lastDragTime_ = Date.now(); + this.downTimeout_ = setTimeout(function () { + this.handlePointerMove_(new _MapBrowserEvent.default(_MapBrowserEventType.default.POINTERMOVE, event.map, event.originalEvent, false, event.frameState)); + }.bind(this), this.dragVertexDelay_); + this.downPx_ = event.pixel; + return true; + } else { + this.lastDragTime_ = undefined; + return false; + } + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @return {boolean} If the event was consumed. + */ + + + Draw.prototype.handleUpEvent = function (event) { + var pass = true; + + if (this.downTimeout_) { + clearTimeout(this.downTimeout_); + this.downTimeout_ = undefined; + } + + this.handlePointerMove_(event); + var circleMode = this.mode_ === Mode.CIRCLE; + + if (this.shouldHandle_) { + if (!this.finishCoordinate_) { + this.startDrawing_(event); + + if (this.mode_ === Mode.POINT) { + this.finishDrawing(); + } + } else if (this.freehand_ || circleMode) { + this.finishDrawing(); + } else if (this.atFinish_(event)) { + if (this.finishCondition_(event)) { + this.finishDrawing(); + } + } else { + this.addToDrawing_(event.coordinate); + } + + pass = false; + } else if (this.freehand_) { + this.abortDrawing(); + } + + if (!pass && this.stopClick_) { + event.stopPropagation(); + } + + return pass; + }; + /** + * Handle move events. + * @param {import("../MapBrowserEvent.js").default} event A move event. + * @private + */ + + + Draw.prototype.handlePointerMove_ = function (event) { + if (this.downPx_ && (!this.freehand_ && this.shouldHandle_ || this.freehand_ && !this.shouldHandle_)) { + var downPx = this.downPx_; + var clickPx = event.pixel; + var dx = downPx[0] - clickPx[0]; + var dy = downPx[1] - clickPx[1]; + var squaredDistance = dx * dx + dy * dy; + this.shouldHandle_ = this.freehand_ ? squaredDistance > this.squaredClickTolerance_ : squaredDistance <= this.squaredClickTolerance_; + + if (!this.shouldHandle_) { + return; + } + } + + if (this.finishCoordinate_) { + this.modifyDrawing_(event); + } else { + this.createOrUpdateSketchPoint_(event); + } + }; + /** + * Determine if an event is within the snapping tolerance of the start coord. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @return {boolean} The event is within the snapping tolerance of the start. + * @private + */ + + + Draw.prototype.atFinish_ = function (event) { + var at = false; + + if (this.sketchFeature_) { + var potentiallyDone = false; + var potentiallyFinishCoordinates = [this.finishCoordinate_]; + + if (this.mode_ === Mode.LINE_STRING) { + potentiallyDone = this.sketchCoords_.length > this.minPoints_; + } else if (this.mode_ === Mode.POLYGON) { + var sketchCoords = + /** @type {PolyCoordType} */ + this.sketchCoords_; + potentiallyDone = sketchCoords[0].length > this.minPoints_; + potentiallyFinishCoordinates = [sketchCoords[0][0], sketchCoords[0][sketchCoords[0].length - 2]]; + } + + if (potentiallyDone) { + var map = event.map; + + for (var i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) { + var finishCoordinate = potentiallyFinishCoordinates[i]; + var finishPixel = map.getPixelFromCoordinate(finishCoordinate); + var pixel = event.pixel; + var dx = pixel[0] - finishPixel[0]; + var dy = pixel[1] - finishPixel[1]; + var snapTolerance = this.freehand_ ? 1 : this.snapTolerance_; + at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance; + + if (at) { + this.finishCoordinate_ = finishCoordinate; + break; + } + } + } + } + + return at; + }; + /** + * @param {import("../MapBrowserEvent.js").default} event Event. + * @private + */ + + + Draw.prototype.createOrUpdateSketchPoint_ = function (event) { + var coordinates = event.coordinate.slice(); + + if (!this.sketchPoint_) { + this.sketchPoint_ = new _Feature.default(new _Point.default(coordinates)); + this.updateSketchFeatures_(); + } else { + var sketchPointGeom = this.sketchPoint_.getGeometry(); + sketchPointGeom.setCoordinates(coordinates); + } + }; + /** + * Start the drawing. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @private + */ + + + Draw.prototype.startDrawing_ = function (event) { + var start = event.coordinate; + var projection = event.map.getView().getProjection(); + this.finishCoordinate_ = start; + + if (this.mode_ === Mode.POINT) { + this.sketchCoords_ = start.slice(); + } else if (this.mode_ === Mode.POLYGON) { + this.sketchCoords_ = [[start.slice(), start.slice()]]; + this.sketchLineCoords_ = this.sketchCoords_[0]; + } else { + this.sketchCoords_ = [start.slice(), start.slice()]; + } + + if (this.sketchLineCoords_) { + this.sketchLine_ = new _Feature.default(new _LineString.default(this.sketchLineCoords_)); + } + + var geometry = this.geometryFunction_(this.sketchCoords_, undefined, projection); + this.sketchFeature_ = new _Feature.default(); + + if (this.geometryName_) { + this.sketchFeature_.setGeometryName(this.geometryName_); + } + + this.sketchFeature_.setGeometry(geometry); + this.updateSketchFeatures_(); + this.dispatchEvent(new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_)); + }; + /** + * Modify the drawing. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @private + */ + + + Draw.prototype.modifyDrawing_ = function (event) { + var coordinate = event.coordinate; + var geometry = this.sketchFeature_.getGeometry(); + var projection = event.map.getView().getProjection(); + var coordinates, last; + + if (this.mode_ === Mode.POINT) { + last = this.sketchCoords_; + } else if (this.mode_ === Mode.POLYGON) { + coordinates = + /** @type {PolyCoordType} */ + this.sketchCoords_[0]; + last = coordinates[coordinates.length - 1]; + + if (this.atFinish_(event)) { + // snap to finish + coordinate = this.finishCoordinate_.slice(); + } + } else { + coordinates = this.sketchCoords_; + last = coordinates[coordinates.length - 1]; + } + + last[0] = coordinate[0]; + last[1] = coordinate[1]; + this.geometryFunction_( + /** @type {!LineCoordType} */ + this.sketchCoords_, geometry, projection); + + if (this.sketchPoint_) { + var sketchPointGeom = this.sketchPoint_.getGeometry(); + sketchPointGeom.setCoordinates(coordinate); + } + /** @type {LineString} */ + + + var sketchLineGeom; + + if (geometry.getType() == _GeometryType.default.POLYGON && this.mode_ !== Mode.POLYGON) { + if (!this.sketchLine_) { + this.sketchLine_ = new _Feature.default(); + } + + var ring = geometry.getLinearRing(0); + sketchLineGeom = this.sketchLine_.getGeometry(); + + if (!sketchLineGeom) { + sketchLineGeom = new _LineString.default(ring.getFlatCoordinates(), ring.getLayout()); + this.sketchLine_.setGeometry(sketchLineGeom); + } else { + sketchLineGeom.setFlatCoordinates(ring.getLayout(), ring.getFlatCoordinates()); + sketchLineGeom.changed(); + } + } else if (this.sketchLineCoords_) { + sketchLineGeom = this.sketchLine_.getGeometry(); + sketchLineGeom.setCoordinates(this.sketchLineCoords_); + } + + this.updateSketchFeatures_(); + }; + /** + * Add a new coordinate to the drawing. + * @param {!PointCoordType} coordinate Coordinate + * @private + */ + + + Draw.prototype.addToDrawing_ = function (coordinate) { + var geometry = this.sketchFeature_.getGeometry(); + var projection = this.getMap().getView().getProjection(); + var done; + var coordinates; + + if (this.mode_ === Mode.LINE_STRING) { + this.finishCoordinate_ = coordinate.slice(); + coordinates = + /** @type {LineCoordType} */ + this.sketchCoords_; + + if (coordinates.length >= this.maxPoints_) { + if (this.freehand_) { + coordinates.pop(); + } else { + done = true; + } + } + + coordinates.push(coordinate.slice()); + this.geometryFunction_(coordinates, geometry, projection); + } else if (this.mode_ === Mode.POLYGON) { + coordinates = + /** @type {PolyCoordType} */ + this.sketchCoords_[0]; + + if (coordinates.length >= this.maxPoints_) { + if (this.freehand_) { + coordinates.pop(); + } else { + done = true; + } + } + + coordinates.push(coordinate.slice()); + + if (done) { + this.finishCoordinate_ = coordinates[0]; + } + + this.geometryFunction_(this.sketchCoords_, geometry, projection); + } + + this.updateSketchFeatures_(); + + if (done) { + this.finishDrawing(); + } + }; + /** + * Remove last point of the feature currently being drawn. + * @api + */ + + + Draw.prototype.removeLastPoint = function () { + if (!this.sketchFeature_) { + return; + } + + var geometry = this.sketchFeature_.getGeometry(); + var projection = this.getMap().getView().getProjection(); + var coordinates; + /** @type {LineString} */ + + var sketchLineGeom; + + if (this.mode_ === Mode.LINE_STRING) { + coordinates = + /** @type {LineCoordType} */ + this.sketchCoords_; + coordinates.splice(-2, 1); + this.geometryFunction_(coordinates, geometry, projection); + + if (coordinates.length >= 2) { + this.finishCoordinate_ = coordinates[coordinates.length - 2].slice(); + } + } else if (this.mode_ === Mode.POLYGON) { + coordinates = + /** @type {PolyCoordType} */ + this.sketchCoords_[0]; + coordinates.splice(-2, 1); + sketchLineGeom = this.sketchLine_.getGeometry(); + sketchLineGeom.setCoordinates(coordinates); + this.geometryFunction_(this.sketchCoords_, geometry, projection); + } + + if (coordinates.length === 0) { + this.abortDrawing(); + } + + this.updateSketchFeatures_(); + }; + /** + * Stop drawing and add the sketch feature to the target layer. + * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is + * dispatched before inserting the feature. + * @api + */ + + + Draw.prototype.finishDrawing = function () { + var sketchFeature = this.abortDrawing_(); + + if (!sketchFeature) { + return; + } + + var coordinates = this.sketchCoords_; + var geometry = sketchFeature.getGeometry(); + var projection = this.getMap().getView().getProjection(); + + if (this.mode_ === Mode.LINE_STRING) { + // remove the redundant last point + coordinates.pop(); + this.geometryFunction_(coordinates, geometry, projection); + } else if (this.mode_ === Mode.POLYGON) { + // remove the redundant last point in ring + + /** @type {PolyCoordType} */ + coordinates[0].pop(); + this.geometryFunction_(coordinates, geometry, projection); + coordinates = geometry.getCoordinates(); + } // cast multi-part geometries + + + if (this.type_ === _GeometryType.default.MULTI_POINT) { + sketchFeature.setGeometry(new _MultiPoint.default([ + /** @type {PointCoordType} */ + coordinates])); + } else if (this.type_ === _GeometryType.default.MULTI_LINE_STRING) { + sketchFeature.setGeometry(new _MultiLineString.default([ + /** @type {LineCoordType} */ + coordinates])); + } else if (this.type_ === _GeometryType.default.MULTI_POLYGON) { + sketchFeature.setGeometry(new _MultiPolygon.default([ + /** @type {PolyCoordType} */ + coordinates])); + } // First dispatch event to allow full set up of feature + + + this.dispatchEvent(new DrawEvent(DrawEventType.DRAWEND, sketchFeature)); // Then insert feature + + if (this.features_) { + this.features_.push(sketchFeature); + } + + if (this.source_) { + this.source_.addFeature(sketchFeature); + } + }; + /** + * Stop drawing without adding the sketch feature to the target layer. + * @return {Feature} The sketch feature (or null if none). + * @private + */ + + + Draw.prototype.abortDrawing_ = function () { + this.finishCoordinate_ = null; + var sketchFeature = this.sketchFeature_; + this.sketchFeature_ = null; + this.sketchPoint_ = null; + this.sketchLine_ = null; + this.overlay_.getSource().clear(true); + return sketchFeature; + }; + /** + * Stop drawing without adding the sketch feature to the target layer. + * @api + */ + + + Draw.prototype.abortDrawing = function () { + var sketchFeature = this.abortDrawing_(); + + if (sketchFeature) { + this.dispatchEvent(new DrawEvent(DrawEventType.DRAWABORT, sketchFeature)); + } + }; + /** + * Append coordinates to the end of the geometry that is currently being drawn. + * This can be used when drawing LineStrings or Polygons. Coordinates will + * either be appended to the current LineString or the outer ring of the current + * Polygon. + * @param {!LineCoordType} coordinates Linear coordinates to be appended into + * the coordinate array. + * @api + */ + + + Draw.prototype.appendCoordinates = function (coordinates) { + var mode = this.mode_; + var sketchCoords = []; + + if (mode === Mode.LINE_STRING) { + sketchCoords = + /** @type {LineCoordType} */ + this.sketchCoords_; + } else if (mode === Mode.POLYGON) { + sketchCoords = this.sketchCoords_ && this.sketchCoords_.length ? + /** @type {PolyCoordType} */ + this.sketchCoords_[0] : []; + } // Remove last coordinate from sketch drawing (this coordinate follows cursor position) + + + var ending = sketchCoords.pop(); // Append coordinate list + + for (var i = 0; i < coordinates.length; i++) { + this.addToDrawing_(coordinates[i]); + } // Duplicate last coordinate for sketch drawing + + + this.addToDrawing_(ending); + }; + /** + * Initiate draw mode by starting from an existing geometry which will + * receive new additional points. This only works on features with + * `LineString` geometries, where the interaction will extend lines by adding + * points to the end of the coordinates array. + * This will change the original feature, instead of drawing a copy. + * + * The function will dispatch a `drawstart` event. + * + * @param {!Feature<LineString>} feature Feature to be extended. + * @api + */ + + + Draw.prototype.extend = function (feature) { + var geometry = feature.getGeometry(); + var lineString = geometry; + this.sketchFeature_ = feature; + this.sketchCoords_ = lineString.getCoordinates(); + var last = this.sketchCoords_[this.sketchCoords_.length - 1]; + this.finishCoordinate_ = last.slice(); + this.sketchCoords_.push(last.slice()); + this.updateSketchFeatures_(); + this.dispatchEvent(new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_)); + }; + /** + * Redraw the sketch features. + * @private + */ + + + Draw.prototype.updateSketchFeatures_ = function () { + var sketchFeatures = []; + + if (this.sketchFeature_) { + sketchFeatures.push(this.sketchFeature_); + } + + if (this.sketchLine_) { + sketchFeatures.push(this.sketchLine_); + } + + if (this.sketchPoint_) { + sketchFeatures.push(this.sketchPoint_); + } + + var overlaySource = this.overlay_.getSource(); + overlaySource.clear(true); + overlaySource.addFeatures(sketchFeatures); + }; + /** + * @private + */ + + + Draw.prototype.updateState_ = function () { + var map = this.getMap(); + var active = this.getActive(); + + if (!map || !active) { + this.abortDrawing(); + } + + this.overlay_.setMap(active ? map : null); + }; + + return Draw; +}(_Pointer.default); +/** + * @return {import("../style/Style.js").StyleFunction} Styles. + */ + + +function getDefaultStyleFunction() { + var styles = (0, _Style.createEditingStyle)(); + return function (feature, resolution) { + return styles[feature.getGeometry().getType()]; + }; +} +/** + * Create a `geometryFunction` for `type: 'Circle'` that will create a regular + * polygon with a user specified number of sides and start angle instead of an + * `import("../geom/Circle.js").Circle` geometry. + * @param {number=} opt_sides Number of sides of the regular polygon. Default is + * 32. + * @param {number=} opt_angle Angle of the first point in radians. 0 means East. + * Default is the angle defined by the heading from the center of the + * regular polygon to the current pointer position. + * @return {GeometryFunction} Function that draws a + * polygon. + * @api + */ + + +function createRegularPolygon(opt_sides, opt_angle) { + return function (coordinates, opt_geometry, projection) { + var center = (0, _proj.fromUserCoordinate)( + /** @type {LineCoordType} */ + coordinates[0], projection); + var end = (0, _proj.fromUserCoordinate)( + /** @type {LineCoordType} */ + coordinates[1], projection); + var radius = Math.sqrt((0, _coordinate.squaredDistance)(center, end)); + var geometry = opt_geometry ? + /** @type {Polygon} */ + opt_geometry : (0, _Polygon.fromCircle)(new _Circle.default(center), opt_sides); + var angle = opt_angle; + + if (!opt_angle) { + var x = end[0] - center[0]; + var y = end[1] - center[1]; + angle = Math.atan(y / x) - (x < 0 ? Math.PI : 0); + } + + (0, _Polygon.makeRegular)(geometry, center, radius, angle); + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + geometry.transform(projection, userProjection); + } + + return geometry; + }; +} +/** + * Create a `geometryFunction` that will create a box-shaped polygon (aligned + * with the coordinate system axes). Use this with the draw interaction and + * `type: 'Circle'` to return a box instead of a circle geometry. + * @return {GeometryFunction} Function that draws a box-shaped polygon. + * @api + */ + + +function createBox() { + return function (coordinates, opt_geometry, projection) { + var extent = (0, _extent.boundingExtent)( + /** @type {LineCoordType} */ + coordinates.map(function (coordinate) { + return (0, _proj.fromUserCoordinate)(coordinate, projection); + })); + var boxCoordinates = [[(0, _extent.getBottomLeft)(extent), (0, _extent.getBottomRight)(extent), (0, _extent.getTopRight)(extent), (0, _extent.getTopLeft)(extent), (0, _extent.getBottomLeft)(extent)]]; + var geometry = opt_geometry; + + if (geometry) { + geometry.setCoordinates(boxCoordinates); + } else { + geometry = new _Polygon.default(boxCoordinates); + } + + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + geometry.transform(projection, userProjection); + } + + return geometry; + }; +} +/** + * Get the drawing mode. The mode for mult-part geometries is the same as for + * their single-part cousins. + * @param {import("../geom/GeometryType.js").default} type Geometry type. + * @return {Mode} Drawing mode. + */ + + +function getMode(type) { + var mode; + + if (type === _GeometryType.default.POINT || type === _GeometryType.default.MULTI_POINT) { + mode = Mode.POINT; + } else if (type === _GeometryType.default.LINE_STRING || type === _GeometryType.default.MULTI_LINE_STRING) { + mode = Mode.LINE_STRING; + } else if (type === _GeometryType.default.POLYGON || type === _GeometryType.default.MULTI_POLYGON) { + mode = Mode.POLYGON; + } else if (type === _GeometryType.default.CIRCLE) { + mode = Mode.CIRCLE; + } + + return ( + /** @type {!Mode} */ + mode + ); +} + +var _default = Draw; +exports.default = _default; +},{"../geom/Circle.js":"../../../node_modules/ol/geom/Circle.js","../events/Event.js":"../../../node_modules/ol/events/Event.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../Feature.js":"../../../node_modules/ol/Feature.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./Property.js":"../../../node_modules/ol/interaction/Property.js","../geom/LineString.js":"../../../node_modules/ol/geom/LineString.js","../MapBrowserEvent.js":"../../../node_modules/ol/MapBrowserEvent.js","../MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","../geom/MultiLineString.js":"../../../node_modules/ol/geom/MultiLineString.js","../geom/MultiPoint.js":"../../../node_modules/ol/geom/MultiPoint.js","../geom/MultiPolygon.js":"../../../node_modules/ol/geom/MultiPolygon.js","../geom/Point.js":"../../../node_modules/ol/geom/Point.js","./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js","../layer/Vector.js":"../../../node_modules/ol/layer/Vector.js","../source/Vector.js":"../../../node_modules/ol/source/Vector.js","../functions.js":"../../../node_modules/ol/functions.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../extent.js":"../../../node_modules/ol/extent.js","../style/Style.js":"../../../node_modules/ol/style/Style.js","../proj.js":"../../../node_modules/ol/proj.js","../Object.js":"../../../node_modules/ol/Object.js","../coordinate.js":"../../../node_modules/ol/coordinate.js"}],"../../../node_modules/ol/interaction/Extent.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _Feature = _interopRequireDefault(require("../Feature.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("../MapBrowserEventType.js")); + +var _Point = _interopRequireDefault(require("../geom/Point.js")); + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _Vector = _interopRequireDefault(require("../layer/Vector.js")); + +var _Vector2 = _interopRequireDefault(require("../source/Vector.js")); + +var _condition = require("../events/condition.js"); + +var _extent = require("../extent.js"); + +var _coordinate = require("../coordinate.js"); + +var _Style = require("../style/Style.js"); + +var _Polygon = require("../geom/Polygon.js"); + +var _proj = require("../proj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Extent + */ + + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. + * Default is {@link module:ol/events/condition~always}. + * @property {import("../extent.js").Extent} [extent] Initial extent. Defaults to no + * initial extent. + * @property {import("../style/Style.js").StyleLike} [boxStyle] + * Style for the drawn extent box. Defaults to + * {@link module:ol/style/Style~createEditing()['Polygon']} + * @property {number} [pixelTolerance=10] Pixel tolerance for considering the + * pointer close enough to a segment or vertex for editing. + * @property {import("../style/Style.js").StyleLike} [pointerStyle] + * Style for the cursor used to draw the extent. Defaults to + * {@link module:ol/style/Style~createEditing()['Point']} + * @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps + * in the X direction? Only affects visuals, not functionality. + */ + +/** + * @enum {string} + */ +var ExtentEventType = { + /** + * Triggered after the extent is changed + * @event ExtentEvent#extentchanged + * @api + */ + EXTENTCHANGED: 'extentchanged' +}; +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/Extent~Extent} instances are + * instances of this type. + */ + +var ExtentEvent = +/** @class */ +function (_super) { + __extends(ExtentEvent, _super); + /** + * @param {import("../extent.js").Extent} extent the new extent + */ + + + function ExtentEvent(extent) { + var _this = _super.call(this, ExtentEventType.EXTENTCHANGED) || this; + /** + * The current extent. + * @type {import("../extent.js").Extent} + * @api + */ + + + _this.extent = extent; + return _this; + } + + return ExtentEvent; +}(_Event.default); +/** + * @classdesc + * Allows the user to draw a vector box by clicking and dragging on the map. + * Once drawn, the vector box can be modified by dragging its vertices or edges. + * This interaction is only supported for mouse devices. + * + * @fires ExtentEvent + * @api + */ + + +var Extent = +/** @class */ +function (_super) { + __extends(Extent, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Extent(opt_options) { + var _this = this; + + var options = opt_options || {}; + _this = _super.call(this, + /** @type {import("./Pointer.js").Options} */ + options) || this; + /** + * Condition + * @type {import("../events/condition.js").Condition} + * @private + */ + + _this.condition_ = options.condition ? options.condition : _condition.always; + /** + * Extent of the drawn box + * @type {import("../extent.js").Extent} + * @private + */ + + _this.extent_ = null; + /** + * Handler for pointer move events + * @type {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null} + * @private + */ + + _this.pointerHandler_ = null; + /** + * Pixel threshold to snap to extent + * @type {number} + * @private + */ + + _this.pixelTolerance_ = options.pixelTolerance !== undefined ? options.pixelTolerance : 10; + /** + * Is the pointer snapped to an extent vertex + * @type {boolean} + * @private + */ + + _this.snappedToVertex_ = false; + /** + * Feature for displaying the visible extent + * @type {Feature} + * @private + */ + + _this.extentFeature_ = null; + /** + * Feature for displaying the visible pointer + * @type {Feature<Point>} + * @private + */ + + _this.vertexFeature_ = null; + + if (!opt_options) { + opt_options = {}; + } + /** + * Layer for the extentFeature + * @type {VectorLayer} + * @private + */ + + + _this.extentOverlay_ = new _Vector.default({ + source: new _Vector2.default({ + useSpatialIndex: false, + wrapX: !!opt_options.wrapX + }), + style: opt_options.boxStyle ? opt_options.boxStyle : getDefaultExtentStyleFunction(), + updateWhileAnimating: true, + updateWhileInteracting: true + }); + /** + * Layer for the vertexFeature + * @type {VectorLayer} + * @private + */ + + _this.vertexOverlay_ = new _Vector.default({ + source: new _Vector2.default({ + useSpatialIndex: false, + wrapX: !!opt_options.wrapX + }), + style: opt_options.pointerStyle ? opt_options.pointerStyle : getDefaultPointerStyleFunction(), + updateWhileAnimating: true, + updateWhileInteracting: true + }); + + if (opt_options.extent) { + _this.setExtent(opt_options.extent); + } + + return _this; + } + /** + * @param {import("../pixel.js").Pixel} pixel cursor location + * @param {import("../PluggableMap.js").default} map map + * @returns {import("../coordinate.js").Coordinate|null} snapped vertex on extent + * @private + */ + + + Extent.prototype.snapToVertex_ = function (pixel, map) { + var pixelCoordinate = map.getCoordinateFromPixelInternal(pixel); + + var sortByDistance = function (a, b) { + return (0, _coordinate.squaredDistanceToSegment)(pixelCoordinate, a) - (0, _coordinate.squaredDistanceToSegment)(pixelCoordinate, b); + }; + + var extent = this.getExtentInternal(); + + if (extent) { + //convert extents to line segments and find the segment closest to pixelCoordinate + var segments = getSegments(extent); + segments.sort(sortByDistance); + var closestSegment = segments[0]; + var vertex = (0, _coordinate.closestOnSegment)(pixelCoordinate, closestSegment); + var vertexPixel = map.getPixelFromCoordinateInternal(vertex); //if the distance is within tolerance, snap to the segment + + if ((0, _coordinate.distance)(pixel, vertexPixel) <= this.pixelTolerance_) { + //test if we should further snap to a vertex + var pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]); + var pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]); + var squaredDist1 = (0, _coordinate.squaredDistance)(vertexPixel, pixel1); + var squaredDist2 = (0, _coordinate.squaredDistance)(vertexPixel, pixel2); + var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2)); + this.snappedToVertex_ = dist <= this.pixelTolerance_; + + if (this.snappedToVertex_) { + vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0]; + } + + return vertex; + } + } + + return null; + }; + /** + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent pointer move event + * @private + */ + + + Extent.prototype.handlePointerMove_ = function (mapBrowserEvent) { + var pixel = mapBrowserEvent.pixel; + var map = mapBrowserEvent.map; + var vertex = this.snapToVertex_(pixel, map); + + if (!vertex) { + vertex = map.getCoordinateFromPixelInternal(pixel); + } + + this.createOrUpdatePointerFeature_(vertex); + }; + /** + * @param {import("../extent.js").Extent} extent extent + * @returns {Feature} extent as featrue + * @private + */ + + + Extent.prototype.createOrUpdateExtentFeature_ = function (extent) { + var extentFeature = this.extentFeature_; + + if (!extentFeature) { + if (!extent) { + extentFeature = new _Feature.default({}); + } else { + extentFeature = new _Feature.default((0, _Polygon.fromExtent)(extent)); + } + + this.extentFeature_ = extentFeature; + this.extentOverlay_.getSource().addFeature(extentFeature); + } else { + if (!extent) { + extentFeature.setGeometry(undefined); + } else { + extentFeature.setGeometry((0, _Polygon.fromExtent)(extent)); + } + } + + return extentFeature; + }; + /** + * @param {import("../coordinate.js").Coordinate} vertex location of feature + * @returns {Feature} vertex as feature + * @private + */ + + + Extent.prototype.createOrUpdatePointerFeature_ = function (vertex) { + var vertexFeature = this.vertexFeature_; + + if (!vertexFeature) { + vertexFeature = new _Feature.default(new _Point.default(vertex)); + this.vertexFeature_ = vertexFeature; + this.vertexOverlay_.getSource().addFeature(vertexFeature); + } else { + var geometry = vertexFeature.getGeometry(); + geometry.setCoordinates(vertex); + } + + return vertexFeature; + }; + /** + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + */ + + + Extent.prototype.handleEvent = function (mapBrowserEvent) { + if (!mapBrowserEvent.originalEvent || !this.condition_(mapBrowserEvent)) { + return true; + } //display pointer (if not dragging) + + + if (mapBrowserEvent.type == _MapBrowserEventType.default.POINTERMOVE && !this.handlingDownUpSequence) { + this.handlePointerMove_(mapBrowserEvent); + } //call pointer to determine up/down/drag + + + _super.prototype.handleEvent.call(this, mapBrowserEvent); //return false to stop propagation + + + return false; + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + Extent.prototype.handleDownEvent = function (mapBrowserEvent) { + var pixel = mapBrowserEvent.pixel; + var map = mapBrowserEvent.map; + var extent = this.getExtentInternal(); + var vertex = this.snapToVertex_(pixel, map); //find the extent corner opposite the passed corner + + var getOpposingPoint = function (point) { + var x_ = null; + var y_ = null; + + if (point[0] == extent[0]) { + x_ = extent[2]; + } else if (point[0] == extent[2]) { + x_ = extent[0]; + } + + if (point[1] == extent[1]) { + y_ = extent[3]; + } else if (point[1] == extent[3]) { + y_ = extent[1]; + } + + if (x_ !== null && y_ !== null) { + return [x_, y_]; + } + + return null; + }; + + if (vertex && extent) { + var x = vertex[0] == extent[0] || vertex[0] == extent[2] ? vertex[0] : null; + var y = vertex[1] == extent[1] || vertex[1] == extent[3] ? vertex[1] : null; //snap to point + + if (x !== null && y !== null) { + this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex)); //snap to edge + } else if (x !== null) { + this.pointerHandler_ = getEdgeHandler(getOpposingPoint([x, extent[1]]), getOpposingPoint([x, extent[3]])); + } else if (y !== null) { + this.pointerHandler_ = getEdgeHandler(getOpposingPoint([extent[0], y]), getOpposingPoint([extent[2], y])); + } //no snap - new bbox + + } else { + vertex = map.getCoordinateFromPixelInternal(pixel); + this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]); + this.pointerHandler_ = getPointHandler(vertex); + } + + return true; //event handled; start downup sequence + }; + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + */ + + + Extent.prototype.handleDragEvent = function (mapBrowserEvent) { + if (this.pointerHandler_) { + var pixelCoordinate = mapBrowserEvent.coordinate; + this.setExtent(this.pointerHandler_(pixelCoordinate)); + this.createOrUpdatePointerFeature_(pixelCoordinate); + } + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. + */ + + + Extent.prototype.handleUpEvent = function (mapBrowserEvent) { + this.pointerHandler_ = null; //If bbox is zero area, set to null; + + var extent = this.getExtentInternal(); + + if (!extent || (0, _extent.getArea)(extent) === 0) { + this.setExtent(null); + } + + return false; //Stop handling downup sequence + }; + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + Extent.prototype.setMap = function (map) { + this.extentOverlay_.setMap(map); + this.vertexOverlay_.setMap(map); + + _super.prototype.setMap.call(this, map); + }; + /** + * Returns the current drawn extent in the view projection (or user projection if set) + * + * @return {import("../extent.js").Extent} Drawn extent in the view projection. + * @api + */ + + + Extent.prototype.getExtent = function () { + return (0, _proj.toUserExtent)(this.getExtentInternal(), this.getMap().getView().getProjection()); + }; + /** + * Returns the current drawn extent in the view projection + * + * @return {import("../extent.js").Extent} Drawn extent in the view projection. + * @api + */ + + + Extent.prototype.getExtentInternal = function () { + return this.extent_; + }; + /** + * Manually sets the drawn extent, using the view projection. + * + * @param {import("../extent.js").Extent} extent Extent + * @api + */ + + + Extent.prototype.setExtent = function (extent) { + //Null extent means no bbox + this.extent_ = extent ? extent : null; + this.createOrUpdateExtentFeature_(extent); + this.dispatchEvent(new ExtentEvent(this.extent_)); + }; + + return Extent; +}(_Pointer.default); +/** + * Returns the default style for the drawn bbox + * + * @return {import("../style/Style.js").StyleFunction} Default Extent style + */ + + +function getDefaultExtentStyleFunction() { + var style = (0, _Style.createEditingStyle)(); + return function (feature, resolution) { + return style[_GeometryType.default.POLYGON]; + }; +} +/** + * Returns the default style for the pointer + * + * @return {import("../style/Style.js").StyleFunction} Default pointer style + */ + + +function getDefaultPointerStyleFunction() { + var style = (0, _Style.createEditingStyle)(); + return function (feature, resolution) { + return style[_GeometryType.default.POINT]; + }; +} +/** + * @param {import("../coordinate.js").Coordinate} fixedPoint corner that will be unchanged in the new extent + * @returns {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent} event handler + */ + + +function getPointHandler(fixedPoint) { + return function (point) { + return (0, _extent.boundingExtent)([fixedPoint, point]); + }; +} +/** + * @param {import("../coordinate.js").Coordinate} fixedP1 first corner that will be unchanged in the new extent + * @param {import("../coordinate.js").Coordinate} fixedP2 second corner that will be unchanged in the new extent + * @returns {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null} event handler + */ + + +function getEdgeHandler(fixedP1, fixedP2) { + if (fixedP1[0] == fixedP2[0]) { + return function (point) { + return (0, _extent.boundingExtent)([fixedP1, [point[0], fixedP2[1]]]); + }; + } else if (fixedP1[1] == fixedP2[1]) { + return function (point) { + return (0, _extent.boundingExtent)([fixedP1, [fixedP2[0], point[1]]]); + }; + } else { + return null; + } +} +/** + * @param {import("../extent.js").Extent} extent extent + * @returns {Array<Array<import("../coordinate.js").Coordinate>>} extent line segments + */ + + +function getSegments(extent) { + return [[[extent[0], extent[1]], [extent[0], extent[3]]], [[extent[0], extent[3]], [extent[2], extent[3]]], [[extent[2], extent[3]], [extent[2], extent[1]]], [[extent[2], extent[1]], [extent[0], extent[1]]]]; +} + +var _default = Extent; +exports.default = _default; +},{"../events/Event.js":"../../../node_modules/ol/events/Event.js","../Feature.js":"../../../node_modules/ol/Feature.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","../geom/Point.js":"../../../node_modules/ol/geom/Point.js","./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../layer/Vector.js":"../../../node_modules/ol/layer/Vector.js","../source/Vector.js":"../../../node_modules/ol/source/Vector.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../extent.js":"../../../node_modules/ol/extent.js","../coordinate.js":"../../../node_modules/ol/coordinate.js","../style/Style.js":"../../../node_modules/ol/style/Style.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js","../proj.js":"../../../node_modules/ol/proj.js"}],"../../../node_modules/ol/interaction/Modify.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.ModifyEvent = void 0; + +var _Collection = _interopRequireDefault(require("../Collection.js")); + +var _CollectionEventType = _interopRequireDefault(require("../CollectionEventType.js")); + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Feature = _interopRequireDefault(require("../Feature.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _MapBrowserEventType = _interopRequireDefault(require("../MapBrowserEventType.js")); + +var _Point = _interopRequireDefault(require("../geom/Point.js")); + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _RBush = _interopRequireDefault(require("../structs/RBush.js")); + +var _VectorEventType = _interopRequireDefault(require("../source/VectorEventType.js")); + +var _Vector = _interopRequireDefault(require("../layer/Vector.js")); + +var _Vector2 = _interopRequireDefault(require("../source/Vector.js")); + +var _condition = require("../events/condition.js"); + +var _extent = require("../extent.js"); + +var _coordinate = require("../coordinate.js"); + +var _Style = require("../style/Style.js"); + +var _array = require("../array.js"); + +var _Polygon = require("../geom/Polygon.js"); + +var _proj = require("../proj.js"); + +var _util = require("../util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Modify + */ + + +/** + * The segment index assigned to a circle's center when + * breaking up a circle into ModifySegmentDataType segments. + * @type {number} + */ +var CIRCLE_CENTER_INDEX = 0; +/** + * The segment index assigned to a circle's circumference when + * breaking up a circle into ModifySegmentDataType segments. + * @type {number} + */ + +var CIRCLE_CIRCUMFERENCE_INDEX = 1; +var tempExtent = [0, 0, 0, 0]; +var tempSegment = []; +/** + * @enum {string} + */ + +var ModifyEventType = { + /** + * Triggered upon feature modification start + * @event ModifyEvent#modifystart + * @api + */ + MODIFYSTART: 'modifystart', + + /** + * Triggered upon feature modification end + * @event ModifyEvent#modifyend + * @api + */ + MODIFYEND: 'modifyend' +}; +/** + * @typedef {Object} SegmentData + * @property {Array<number>} [depth] + * @property {Feature} feature + * @property {import("../geom/SimpleGeometry.js").default} geometry + * @property {number} [index] + * @property {Array<import("../extent.js").Extent>} segment + * @property {Array<SegmentData>} [featureSegments] + */ + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event will be considered to add or move a + * vertex to the sketch. Default is + * {@link module:ol/events/condition~primaryAction}. + * @property {import("../events/condition.js").Condition} [deleteCondition] A function + * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. By default, + * {@link module:ol/events/condition~singleClick} with + * {@link module:ol/events/condition~altKeyOnly} results in a vertex deletion. + * @property {import("../events/condition.js").Condition} [insertVertexCondition] A + * function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and + * returns a boolean to indicate whether a new vertex should be added to the sketch + * features. Default is {@link module:ol/events/condition~always}. + * @property {number} [pixelTolerance=10] Pixel tolerance for considering the + * pointer close enough to a segment or vertex for editing. + * @property {import("../style/Style.js").StyleLike} [style] + * Style used for the features being modified. By default the default edit + * style is used (see {@link module:ol/style}). + * @property {VectorSource} [source] The vector source with + * features to modify. If a vector source is not provided, a feature collection + * must be provided with the features option. + * @property {Collection<Feature>} [features] + * The features the interaction works on. If a feature collection is not + * provided, a vector source must be provided with the source option. + * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch + * overlay. + */ + +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/Modify~Modify} instances are + * instances of this type. + */ + +var ModifyEvent = +/** @class */ +function (_super) { + __extends(ModifyEvent, _super); + /** + * @param {ModifyEventType} type Type. + * @param {Collection<Feature>} features + * The features modified. + * @param {import("../MapBrowserEvent.js").default} MapBrowserEvent + * Associated {@link module:ol/MapBrowserEvent}. + */ + + + function ModifyEvent(type, features, MapBrowserEvent) { + var _this = _super.call(this, type) || this; + /** + * The features being modified. + * @type {Collection<Feature>} + * @api + */ + + + _this.features = features; + /** + * Associated {@link module:ol/MapBrowserEvent}. + * @type {import("../MapBrowserEvent.js").default} + * @api + */ + + _this.mapBrowserEvent = MapBrowserEvent; + return _this; + } + + return ModifyEvent; +}(_Event.default); + +exports.ModifyEvent = ModifyEvent; + +/** + * @classdesc + * Interaction for modifying feature geometries. To modify features that have + * been added to an existing source, construct the modify interaction with the + * `source` option. If you want to modify features in a collection (for example, + * the collection used by a select interaction), construct the interaction with + * the `features` option. The interaction must be constructed with either a + * `source` or `features` option. + * + * By default, the interaction will allow deletion of vertices when the `alt` + * key is pressed. To configure the interaction with a different condition + * for deletion, use the `deleteCondition` option. + * @fires ModifyEvent + * @api + */ +var Modify = +/** @class */ +function (_super) { + __extends(Modify, _super); + /** + * @param {Options} options Options. + */ + + + function Modify(options) { + var _this = _super.call(this, + /** @type {import("./Pointer.js").Options} */ + options) || this; + /** @private */ + + + _this.boundHandleFeatureChange_ = _this.handleFeatureChange_.bind(_this); + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.primaryAction; + /** + * @private + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event. + * @return {boolean} Combined condition result. + */ + + _this.defaultDeleteCondition_ = function (mapBrowserEvent) { + return (0, _condition.altKeyOnly)(mapBrowserEvent) && (0, _condition.singleClick)(mapBrowserEvent); + }; + /** + * @type {import("../events/condition.js").Condition} + * @private + */ + + + _this.deleteCondition_ = options.deleteCondition ? options.deleteCondition : _this.defaultDeleteCondition_; + /** + * @type {import("../events/condition.js").Condition} + * @private + */ + + _this.insertVertexCondition_ = options.insertVertexCondition ? options.insertVertexCondition : _condition.always; + /** + * Editing vertex. + * @type {Feature} + * @private + */ + + _this.vertexFeature_ = null; + /** + * Segments intersecting {@link this.vertexFeature_} by segment uid. + * @type {Object<string, boolean>} + * @private + */ + + _this.vertexSegments_ = null; + /** + * @type {import("../pixel.js").Pixel} + * @private + */ + + _this.lastPixel_ = [0, 0]; + /** + * Tracks if the next `singleclick` event should be ignored to prevent + * accidental deletion right after vertex creation. + * @type {boolean} + * @private + */ + + _this.ignoreNextSingleClick_ = false; + /** + * @type {boolean} + * @private + */ + + _this.modified_ = false; + /** + * Segment RTree for each layer + * @type {RBush<SegmentData>} + * @private + */ + + _this.rBush_ = new _RBush.default(); + /** + * @type {number} + * @private + */ + + _this.pixelTolerance_ = options.pixelTolerance !== undefined ? options.pixelTolerance : 10; + /** + * @type {boolean} + * @private + */ + + _this.snappedToVertex_ = false; + /** + * Indicate whether the interaction is currently changing a feature's + * coordinates. + * @type {boolean} + * @private + */ + + _this.changingFeature_ = false; + /** + * @type {Array} + * @private + */ + + _this.dragSegments_ = []; + /** + * Draw overlay where sketch features are drawn. + * @type {VectorLayer} + * @private + */ + + _this.overlay_ = new _Vector.default({ + source: new _Vector2.default({ + useSpatialIndex: false, + wrapX: !!options.wrapX + }), + style: options.style ? options.style : getDefaultStyleFunction(), + updateWhileAnimating: true, + updateWhileInteracting: true + }); + /** + * @const + * @private + * @type {!Object<string, function(Feature, import("../geom/Geometry.js").default): void>} + */ + + _this.SEGMENT_WRITERS_ = { + 'Point': _this.writePointGeometry_.bind(_this), + 'LineString': _this.writeLineStringGeometry_.bind(_this), + 'LinearRing': _this.writeLineStringGeometry_.bind(_this), + 'Polygon': _this.writePolygonGeometry_.bind(_this), + 'MultiPoint': _this.writeMultiPointGeometry_.bind(_this), + 'MultiLineString': _this.writeMultiLineStringGeometry_.bind(_this), + 'MultiPolygon': _this.writeMultiPolygonGeometry_.bind(_this), + 'Circle': _this.writeCircleGeometry_.bind(_this), + 'GeometryCollection': _this.writeGeometryCollectionGeometry_.bind(_this) + }; + /** + * @type {VectorSource} + * @private + */ + + _this.source_ = null; + var features; + + if (options.source) { + _this.source_ = options.source; + features = new _Collection.default(_this.source_.getFeatures()); + + _this.source_.addEventListener(_VectorEventType.default.ADDFEATURE, _this.handleSourceAdd_.bind(_this)); + + _this.source_.addEventListener(_VectorEventType.default.REMOVEFEATURE, _this.handleSourceRemove_.bind(_this)); + } else { + features = options.features; + } + + if (!features) { + throw new Error('The modify interaction requires features or a source'); + } + /** + * @type {Collection<Feature>} + * @private + */ + + + _this.features_ = features; + + _this.features_.forEach(_this.addFeature_.bind(_this)); + + _this.features_.addEventListener(_CollectionEventType.default.ADD, _this.handleFeatureAdd_.bind(_this)); + + _this.features_.addEventListener(_CollectionEventType.default.REMOVE, _this.handleFeatureRemove_.bind(_this)); + /** + * @type {import("../MapBrowserEvent.js").default} + * @private + */ + + + _this.lastPointerEvent_ = null; + return _this; + } + /** + * @param {Feature} feature Feature. + * @private + */ + + + Modify.prototype.addFeature_ = function (feature) { + var geometry = feature.getGeometry(); + + if (geometry) { + var writer = this.SEGMENT_WRITERS_[geometry.getType()]; + + if (writer) { + writer(feature, geometry); + } + } + + var map = this.getMap(); + + if (map && map.isRendered() && this.getActive()) { + this.handlePointerAtPixel_(this.lastPixel_, map); + } + + feature.addEventListener(_EventType.default.CHANGE, this.boundHandleFeatureChange_); + }; + /** + * @param {import("../MapBrowserEvent.js").default} evt Map browser event + * @private + */ + + + Modify.prototype.willModifyFeatures_ = function (evt) { + if (!this.modified_) { + this.modified_ = true; + this.dispatchEvent(new ModifyEvent(ModifyEventType.MODIFYSTART, this.features_, evt)); + } + }; + /** + * @param {Feature} feature Feature. + * @private + */ + + + Modify.prototype.removeFeature_ = function (feature) { + this.removeFeatureSegmentData_(feature); // Remove the vertex feature if the collection of canditate features is empty. + + if (this.vertexFeature_ && this.features_.getLength() === 0) { + this.overlay_.getSource().removeFeature(this.vertexFeature_); + this.vertexFeature_ = null; + } + + feature.removeEventListener(_EventType.default.CHANGE, this.boundHandleFeatureChange_); + }; + /** + * @param {Feature} feature Feature. + * @private + */ + + + Modify.prototype.removeFeatureSegmentData_ = function (feature) { + var rBush = this.rBush_; + /** @type {Array<SegmentData>} */ + + var nodesToRemove = []; + rBush.forEach( + /** + * @param {SegmentData} node RTree node. + */ + function (node) { + if (feature === node.feature) { + nodesToRemove.push(node); + } + }); + + for (var i = nodesToRemove.length - 1; i >= 0; --i) { + var nodeToRemove = nodesToRemove[i]; + + for (var j = this.dragSegments_.length - 1; j >= 0; --j) { + if (this.dragSegments_[j][0] === nodeToRemove) { + this.dragSegments_.splice(j, 1); + } + } + + rBush.remove(nodeToRemove); + } + }; + /** + * Activate or deactivate the interaction. + * @param {boolean} active Active. + * @observable + * @api + */ + + + Modify.prototype.setActive = function (active) { + if (this.vertexFeature_ && !active) { + this.overlay_.getSource().removeFeature(this.vertexFeature_); + this.vertexFeature_ = null; + } + + _super.prototype.setActive.call(this, active); + }; + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + Modify.prototype.setMap = function (map) { + this.overlay_.setMap(map); + + _super.prototype.setMap.call(this, map); + }; + /** + * Get the overlay layer that this interaction renders sketch features to. + * @return {VectorLayer} Overlay layer. + * @api + */ + + + Modify.prototype.getOverlay = function () { + return this.overlay_; + }; + /** + * @param {import("../source/Vector.js").VectorSourceEvent} event Event. + * @private + */ + + + Modify.prototype.handleSourceAdd_ = function (event) { + if (event.feature) { + this.features_.push(event.feature); + } + }; + /** + * @param {import("../source/Vector.js").VectorSourceEvent} event Event. + * @private + */ + + + Modify.prototype.handleSourceRemove_ = function (event) { + if (event.feature) { + this.features_.remove(event.feature); + } + }; + /** + * @param {import("../Collection.js").CollectionEvent} evt Event. + * @private + */ + + + Modify.prototype.handleFeatureAdd_ = function (evt) { + this.addFeature_( + /** @type {Feature} */ + evt.element); + }; + /** + * @param {import("../events/Event.js").default} evt Event. + * @private + */ + + + Modify.prototype.handleFeatureChange_ = function (evt) { + if (!this.changingFeature_) { + var feature = + /** @type {Feature} */ + evt.target; + this.removeFeature_(feature); + this.addFeature_(feature); + } + }; + /** + * @param {import("../Collection.js").CollectionEvent} evt Event. + * @private + */ + + + Modify.prototype.handleFeatureRemove_ = function (evt) { + var feature = + /** @type {Feature} */ + evt.element; + this.removeFeature_(feature); + }; + /** + * @param {Feature} feature Feature + * @param {Point} geometry Geometry. + * @private + */ + + + Modify.prototype.writePointGeometry_ = function (feature, geometry) { + var coordinates = geometry.getCoordinates(); + /** @type {SegmentData} */ + + var segmentData = { + feature: feature, + geometry: geometry, + segment: [coordinates, coordinates] + }; + this.rBush_.insert(geometry.getExtent(), segmentData); + }; + /** + * @param {Feature} feature Feature + * @param {import("../geom/MultiPoint.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writeMultiPointGeometry_ = function (feature, geometry) { + var points = geometry.getCoordinates(); + + for (var i = 0, ii = points.length; i < ii; ++i) { + var coordinates = points[i]; + /** @type {SegmentData} */ + + var segmentData = { + feature: feature, + geometry: geometry, + depth: [i], + index: i, + segment: [coordinates, coordinates] + }; + this.rBush_.insert(geometry.getExtent(), segmentData); + } + }; + /** + * @param {Feature} feature Feature + * @param {import("../geom/LineString.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writeLineStringGeometry_ = function (feature, geometry) { + var coordinates = geometry.getCoordinates(); + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + /** @type {SegmentData} */ + + var segmentData = { + feature: feature, + geometry: geometry, + index: i, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + }; + /** + * @param {Feature} feature Feature + * @param {import("../geom/MultiLineString.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writeMultiLineStringGeometry_ = function (feature, geometry) { + var lines = geometry.getCoordinates(); + + for (var j = 0, jj = lines.length; j < jj; ++j) { + var coordinates = lines[j]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + /** @type {SegmentData} */ + + var segmentData = { + feature: feature, + geometry: geometry, + depth: [j], + index: i, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + } + }; + /** + * @param {Feature} feature Feature + * @param {import("../geom/Polygon.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writePolygonGeometry_ = function (feature, geometry) { + var rings = geometry.getCoordinates(); + + for (var j = 0, jj = rings.length; j < jj; ++j) { + var coordinates = rings[j]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + /** @type {SegmentData} */ + + var segmentData = { + feature: feature, + geometry: geometry, + depth: [j], + index: i, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + } + }; + /** + * @param {Feature} feature Feature + * @param {import("../geom/MultiPolygon.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writeMultiPolygonGeometry_ = function (feature, geometry) { + var polygons = geometry.getCoordinates(); + + for (var k = 0, kk = polygons.length; k < kk; ++k) { + var rings = polygons[k]; + + for (var j = 0, jj = rings.length; j < jj; ++j) { + var coordinates = rings[j]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + /** @type {SegmentData} */ + + var segmentData = { + feature: feature, + geometry: geometry, + depth: [j, k], + index: i, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + } + } + }; + /** + * We convert a circle into two segments. The segment at index + * {@link CIRCLE_CENTER_INDEX} is the + * circle's center (a point). The segment at index + * {@link CIRCLE_CIRCUMFERENCE_INDEX} is + * the circumference, and is not a line segment. + * + * @param {Feature} feature Feature. + * @param {import("../geom/Circle.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writeCircleGeometry_ = function (feature, geometry) { + var coordinates = geometry.getCenter(); + /** @type {SegmentData} */ + + var centerSegmentData = { + feature: feature, + geometry: geometry, + index: CIRCLE_CENTER_INDEX, + segment: [coordinates, coordinates] + }; + /** @type {SegmentData} */ + + var circumferenceSegmentData = { + feature: feature, + geometry: geometry, + index: CIRCLE_CIRCUMFERENCE_INDEX, + segment: [coordinates, coordinates] + }; + var featureSegments = [centerSegmentData, circumferenceSegmentData]; + centerSegmentData.featureSegments = featureSegments; + circumferenceSegmentData.featureSegments = featureSegments; + this.rBush_.insert((0, _extent.createOrUpdateFromCoordinate)(coordinates), centerSegmentData); + var circleGeometry = + /** @type {import("../geom/Geometry.js").default} */ + geometry; + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection && this.getMap()) { + var projection = this.getMap().getView().getProjection(); + circleGeometry = circleGeometry.clone().transform(userProjection, projection); + circleGeometry = (0, _Polygon.fromCircle)( + /** @type {import("../geom/Circle.js").default} */ + circleGeometry).transform(projection, userProjection); + } + + this.rBush_.insert(circleGeometry.getExtent(), circumferenceSegmentData); + }; + /** + * @param {Feature} feature Feature + * @param {import("../geom/GeometryCollection.js").default} geometry Geometry. + * @private + */ + + + Modify.prototype.writeGeometryCollectionGeometry_ = function (feature, geometry) { + var geometries = geometry.getGeometriesArray(); + + for (var i = 0; i < geometries.length; ++i) { + var geometry_1 = geometries[i]; + var writer = this.SEGMENT_WRITERS_[geometry_1.getType()]; + writer(feature, geometry_1); + } + }; + /** + * @param {import("../coordinate.js").Coordinate} coordinates Coordinates. + * @return {Feature} Vertex feature. + * @private + */ + + + Modify.prototype.createOrUpdateVertexFeature_ = function (coordinates) { + var vertexFeature = this.vertexFeature_; + + if (!vertexFeature) { + vertexFeature = new _Feature.default(new _Point.default(coordinates)); + this.vertexFeature_ = vertexFeature; + this.overlay_.getSource().addFeature(vertexFeature); + } else { + var geometry = vertexFeature.getGeometry(); + geometry.setCoordinates(coordinates); + } + + return vertexFeature; + }; + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + */ + + + Modify.prototype.handleEvent = function (mapBrowserEvent) { + if (!mapBrowserEvent.originalEvent) { + return true; + } + + this.lastPointerEvent_ = mapBrowserEvent; + var handled; + + if (!mapBrowserEvent.map.getView().getInteracting() && mapBrowserEvent.type == _MapBrowserEventType.default.POINTERMOVE && !this.handlingDownUpSequence) { + this.handlePointerMove_(mapBrowserEvent); + } + + if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) { + if (mapBrowserEvent.type != _MapBrowserEventType.default.SINGLECLICK || !this.ignoreNextSingleClick_) { + handled = this.removePoint(); + } else { + handled = true; + } + } + + if (mapBrowserEvent.type == _MapBrowserEventType.default.SINGLECLICK) { + this.ignoreNextSingleClick_ = false; + } + + return _super.prototype.handleEvent.call(this, mapBrowserEvent) && !handled; + }; + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} evt Event. + */ + + + Modify.prototype.handleDragEvent = function (evt) { + this.ignoreNextSingleClick_ = false; + this.willModifyFeatures_(evt); + var vertex = evt.coordinate; + + for (var i = 0, ii = this.dragSegments_.length; i < ii; ++i) { + var dragSegment = this.dragSegments_[i]; + var segmentData = dragSegment[0]; + var depth = segmentData.depth; + var geometry = segmentData.geometry; + var coordinates = void 0; + var segment = segmentData.segment; + var index = dragSegment[1]; + + while (vertex.length < geometry.getStride()) { + vertex.push(segment[index][vertex.length]); + } + + switch (geometry.getType()) { + case _GeometryType.default.POINT: + coordinates = vertex; + segment[0] = vertex; + segment[1] = vertex; + break; + + case _GeometryType.default.MULTI_POINT: + coordinates = geometry.getCoordinates(); + coordinates[segmentData.index] = vertex; + segment[0] = vertex; + segment[1] = vertex; + break; + + case _GeometryType.default.LINE_STRING: + coordinates = geometry.getCoordinates(); + coordinates[segmentData.index + index] = vertex; + segment[index] = vertex; + break; + + case _GeometryType.default.MULTI_LINE_STRING: + coordinates = geometry.getCoordinates(); + coordinates[depth[0]][segmentData.index + index] = vertex; + segment[index] = vertex; + break; + + case _GeometryType.default.POLYGON: + coordinates = geometry.getCoordinates(); + coordinates[depth[0]][segmentData.index + index] = vertex; + segment[index] = vertex; + break; + + case _GeometryType.default.MULTI_POLYGON: + coordinates = geometry.getCoordinates(); + coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex; + segment[index] = vertex; + break; + + case _GeometryType.default.CIRCLE: + segment[0] = vertex; + segment[1] = vertex; + + if (segmentData.index === CIRCLE_CENTER_INDEX) { + this.changingFeature_ = true; + geometry.setCenter(vertex); + this.changingFeature_ = false; + } else { + // We're dragging the circle's circumference: + this.changingFeature_ = true; + var projection = evt.map.getView().getProjection(); + var radius = (0, _coordinate.distance)((0, _proj.fromUserCoordinate)(geometry.getCenter(), projection), (0, _proj.fromUserCoordinate)(vertex, projection)); + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + var circleGeometry = geometry.clone().transform(userProjection, projection); + circleGeometry.setRadius(radius); + radius = circleGeometry.transform(projection, userProjection).getRadius(); + } + + geometry.setRadius(radius); + this.changingFeature_ = false; + } + + break; + + default: // pass + + } + + if (coordinates) { + this.setGeometryCoordinates_(geometry, coordinates); + } + } + + this.createOrUpdateVertexFeature_(vertex); + }; + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} evt Event. + * @return {boolean} If the event was consumed. + */ + + + Modify.prototype.handleDownEvent = function (evt) { + if (!this.condition_(evt)) { + return false; + } + + var pixelCoordinate = evt.coordinate; + this.handlePointerAtPixel_(evt.pixel, evt.map, pixelCoordinate); + this.dragSegments_.length = 0; + this.modified_ = false; + var vertexFeature = this.vertexFeature_; + + if (vertexFeature) { + var projection = evt.map.getView().getProjection(); + var insertVertices = []; + var vertex = vertexFeature.getGeometry().getCoordinates(); + var vertexExtent = (0, _extent.boundingExtent)([vertex]); + var segmentDataMatches = this.rBush_.getInExtent(vertexExtent); + var componentSegments = {}; + segmentDataMatches.sort(compareIndexes); + + for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) { + var segmentDataMatch = segmentDataMatches[i]; + var segment = segmentDataMatch.segment; + var uid = (0, _util.getUid)(segmentDataMatch.geometry); + var depth = segmentDataMatch.depth; + + if (depth) { + uid += '-' + depth.join('-'); // separate feature components + } + + if (!componentSegments[uid]) { + componentSegments[uid] = new Array(2); + } + + if (segmentDataMatch.geometry.getType() === _GeometryType.default.CIRCLE && segmentDataMatch.index === CIRCLE_CIRCUMFERENCE_INDEX) { + var closestVertex = closestOnSegmentData(pixelCoordinate, segmentDataMatch, projection); + + if ((0, _coordinate.equals)(closestVertex, vertex) && !componentSegments[uid][0]) { + this.dragSegments_.push([segmentDataMatch, 0]); + componentSegments[uid][0] = segmentDataMatch; + } + + continue; + } + + if ((0, _coordinate.equals)(segment[0], vertex) && !componentSegments[uid][0]) { + this.dragSegments_.push([segmentDataMatch, 0]); + componentSegments[uid][0] = segmentDataMatch; + continue; + } + + if ((0, _coordinate.equals)(segment[1], vertex) && !componentSegments[uid][1]) { + // prevent dragging closed linestrings by the connecting node + if ((segmentDataMatch.geometry.getType() === _GeometryType.default.LINE_STRING || segmentDataMatch.geometry.getType() === _GeometryType.default.MULTI_LINE_STRING) && componentSegments[uid][0] && componentSegments[uid][0].index === 0) { + continue; + } + + this.dragSegments_.push([segmentDataMatch, 1]); + componentSegments[uid][1] = segmentDataMatch; + continue; + } + + if ((0, _util.getUid)(segment) in this.vertexSegments_ && !componentSegments[uid][0] && !componentSegments[uid][1] && this.insertVertexCondition_(evt)) { + insertVertices.push([segmentDataMatch, vertex]); + } + } + + if (insertVertices.length) { + this.willModifyFeatures_(evt); + } + + for (var j = insertVertices.length - 1; j >= 0; --j) { + this.insertVertex_.apply(this, insertVertices[j]); + } + } + + return !!this.vertexFeature_; + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} evt Event. + * @return {boolean} If the event was consumed. + */ + + + Modify.prototype.handleUpEvent = function (evt) { + for (var i = this.dragSegments_.length - 1; i >= 0; --i) { + var segmentData = this.dragSegments_[i][0]; + var geometry = segmentData.geometry; + + if (geometry.getType() === _GeometryType.default.CIRCLE) { + // Update a circle object in the R* bush: + var coordinates = geometry.getCenter(); + var centerSegmentData = segmentData.featureSegments[0]; + var circumferenceSegmentData = segmentData.featureSegments[1]; + centerSegmentData.segment[0] = coordinates; + centerSegmentData.segment[1] = coordinates; + circumferenceSegmentData.segment[0] = coordinates; + circumferenceSegmentData.segment[1] = coordinates; + this.rBush_.update((0, _extent.createOrUpdateFromCoordinate)(coordinates), centerSegmentData); + var circleGeometry = geometry; + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + var projection = evt.map.getView().getProjection(); + circleGeometry = circleGeometry.clone().transform(userProjection, projection); + circleGeometry = (0, _Polygon.fromCircle)(circleGeometry).transform(projection, userProjection); + } + + this.rBush_.update(circleGeometry.getExtent(), circumferenceSegmentData); + } else { + this.rBush_.update((0, _extent.boundingExtent)(segmentData.segment), segmentData); + } + } + + if (this.modified_) { + this.dispatchEvent(new ModifyEvent(ModifyEventType.MODIFYEND, this.features_, evt)); + this.modified_ = false; + } + + return false; + }; + /** + * @param {import("../MapBrowserEvent.js").default} evt Event. + * @private + */ + + + Modify.prototype.handlePointerMove_ = function (evt) { + this.lastPixel_ = evt.pixel; + this.handlePointerAtPixel_(evt.pixel, evt.map, evt.coordinate); + }; + /** + * @param {import("../pixel.js").Pixel} pixel Pixel + * @param {import("../PluggableMap.js").default} map Map. + * @param {import("../coordinate.js").Coordinate=} opt_coordinate The pixel Coordinate. + * @private + */ + + + Modify.prototype.handlePointerAtPixel_ = function (pixel, map, opt_coordinate) { + var pixelCoordinate = opt_coordinate || map.getCoordinateFromPixel(pixel); + var projection = map.getView().getProjection(); + + var sortByDistance = function (a, b) { + return projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) - projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection); + }; + + var viewExtent = (0, _proj.fromUserExtent)((0, _extent.createOrUpdateFromCoordinate)(pixelCoordinate, tempExtent), projection); + var buffer = map.getView().getResolution() * this.pixelTolerance_; + var box = (0, _proj.toUserExtent)((0, _extent.buffer)(viewExtent, buffer, tempExtent), projection); + var rBush = this.rBush_; + var nodes = rBush.getInExtent(box); + + if (nodes.length > 0) { + nodes.sort(sortByDistance); + var node = nodes[0]; + var closestSegment = node.segment; + var vertex = closestOnSegmentData(pixelCoordinate, node, projection); + var vertexPixel = map.getPixelFromCoordinate(vertex); + var dist = (0, _coordinate.distance)(pixel, vertexPixel); + + if (dist <= this.pixelTolerance_) { + /** @type {Object<string, boolean>} */ + var vertexSegments = {}; + + if (node.geometry.getType() === _GeometryType.default.CIRCLE && node.index === CIRCLE_CIRCUMFERENCE_INDEX) { + this.snappedToVertex_ = true; + this.createOrUpdateVertexFeature_(vertex); + } else { + var pixel1 = map.getPixelFromCoordinate(closestSegment[0]); + var pixel2 = map.getPixelFromCoordinate(closestSegment[1]); + var squaredDist1 = (0, _coordinate.squaredDistance)(vertexPixel, pixel1); + var squaredDist2 = (0, _coordinate.squaredDistance)(vertexPixel, pixel2); + dist = Math.sqrt(Math.min(squaredDist1, squaredDist2)); + this.snappedToVertex_ = dist <= this.pixelTolerance_; + + if (this.snappedToVertex_) { + vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0]; + } + + this.createOrUpdateVertexFeature_(vertex); + + for (var i = 1, ii = nodes.length; i < ii; ++i) { + var segment = nodes[i].segment; + + if ((0, _coordinate.equals)(closestSegment[0], segment[0]) && (0, _coordinate.equals)(closestSegment[1], segment[1]) || (0, _coordinate.equals)(closestSegment[0], segment[1]) && (0, _coordinate.equals)(closestSegment[1], segment[0])) { + vertexSegments[(0, _util.getUid)(segment)] = true; + } else { + break; + } + } + } + + vertexSegments[(0, _util.getUid)(closestSegment)] = true; + this.vertexSegments_ = vertexSegments; + return; + } + } + + if (this.vertexFeature_) { + this.overlay_.getSource().removeFeature(this.vertexFeature_); + this.vertexFeature_ = null; + } + }; + /** + * @param {SegmentData} segmentData Segment data. + * @param {import("../coordinate.js").Coordinate} vertex Vertex. + * @private + */ + + + Modify.prototype.insertVertex_ = function (segmentData, vertex) { + var segment = segmentData.segment; + var feature = segmentData.feature; + var geometry = segmentData.geometry; + var depth = segmentData.depth; + var index = segmentData.index; + var coordinates; + + while (vertex.length < geometry.getStride()) { + vertex.push(0); + } + + switch (geometry.getType()) { + case _GeometryType.default.MULTI_LINE_STRING: + coordinates = geometry.getCoordinates(); + coordinates[depth[0]].splice(index + 1, 0, vertex); + break; + + case _GeometryType.default.POLYGON: + coordinates = geometry.getCoordinates(); + coordinates[depth[0]].splice(index + 1, 0, vertex); + break; + + case _GeometryType.default.MULTI_POLYGON: + coordinates = geometry.getCoordinates(); + coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex); + break; + + case _GeometryType.default.LINE_STRING: + coordinates = geometry.getCoordinates(); + coordinates.splice(index + 1, 0, vertex); + break; + + default: + return; + } + + this.setGeometryCoordinates_(geometry, coordinates); + var rTree = this.rBush_; + rTree.remove(segmentData); + this.updateSegmentIndices_(geometry, index, depth, 1); + /** @type {SegmentData} */ + + var newSegmentData = { + segment: [segment[0], vertex], + feature: feature, + geometry: geometry, + depth: depth, + index: index + }; + rTree.insert((0, _extent.boundingExtent)(newSegmentData.segment), newSegmentData); + this.dragSegments_.push([newSegmentData, 1]); + /** @type {SegmentData} */ + + var newSegmentData2 = { + segment: [vertex, segment[1]], + feature: feature, + geometry: geometry, + depth: depth, + index: index + 1 + }; + rTree.insert((0, _extent.boundingExtent)(newSegmentData2.segment), newSegmentData2); + this.dragSegments_.push([newSegmentData2, 0]); + this.ignoreNextSingleClick_ = true; + }; + /** + * Removes the vertex currently being pointed. + * @return {boolean} True when a vertex was removed. + * @api + */ + + + Modify.prototype.removePoint = function () { + if (this.lastPointerEvent_ && this.lastPointerEvent_.type != _MapBrowserEventType.default.POINTERDRAG) { + var evt = this.lastPointerEvent_; + this.willModifyFeatures_(evt); + var removed = this.removeVertex_(); + this.dispatchEvent(new ModifyEvent(ModifyEventType.MODIFYEND, this.features_, evt)); + this.modified_ = false; + return removed; + } + + return false; + }; + /** + * Removes a vertex from all matching features. + * @return {boolean} True when a vertex was removed. + * @private + */ + + + Modify.prototype.removeVertex_ = function () { + var dragSegments = this.dragSegments_; + var segmentsByFeature = {}; + var deleted = false; + var component, coordinates, dragSegment, geometry, i, index, left; + var newIndex, right, segmentData, uid; + + for (i = dragSegments.length - 1; i >= 0; --i) { + dragSegment = dragSegments[i]; + segmentData = dragSegment[0]; + uid = (0, _util.getUid)(segmentData.feature); + + if (segmentData.depth) { + // separate feature components + uid += '-' + segmentData.depth.join('-'); + } + + if (!(uid in segmentsByFeature)) { + segmentsByFeature[uid] = {}; + } + + if (dragSegment[1] === 0) { + segmentsByFeature[uid].right = segmentData; + segmentsByFeature[uid].index = segmentData.index; + } else if (dragSegment[1] == 1) { + segmentsByFeature[uid].left = segmentData; + segmentsByFeature[uid].index = segmentData.index + 1; + } + } + + for (uid in segmentsByFeature) { + right = segmentsByFeature[uid].right; + left = segmentsByFeature[uid].left; + index = segmentsByFeature[uid].index; + newIndex = index - 1; + + if (left !== undefined) { + segmentData = left; + } else { + segmentData = right; + } + + if (newIndex < 0) { + newIndex = 0; + } + + geometry = segmentData.geometry; + coordinates = geometry.getCoordinates(); + component = coordinates; + deleted = false; + + switch (geometry.getType()) { + case _GeometryType.default.MULTI_LINE_STRING: + if (coordinates[segmentData.depth[0]].length > 2) { + coordinates[segmentData.depth[0]].splice(index, 1); + deleted = true; + } + + break; + + case _GeometryType.default.LINE_STRING: + if (coordinates.length > 2) { + coordinates.splice(index, 1); + deleted = true; + } + + break; + + case _GeometryType.default.MULTI_POLYGON: + component = component[segmentData.depth[1]]; + + /* falls through */ + + case _GeometryType.default.POLYGON: + component = component[segmentData.depth[0]]; + + if (component.length > 4) { + if (index == component.length - 1) { + index = 0; + } + + component.splice(index, 1); + deleted = true; + + if (index === 0) { + // close the ring again + component.pop(); + component.push(component[0]); + newIndex = component.length - 1; + } + } + + break; + + default: // pass + + } + + if (deleted) { + this.setGeometryCoordinates_(geometry, coordinates); + var segments = []; + + if (left !== undefined) { + this.rBush_.remove(left); + segments.push(left.segment[0]); + } + + if (right !== undefined) { + this.rBush_.remove(right); + segments.push(right.segment[1]); + } + + if (left !== undefined && right !== undefined) { + /** @type {SegmentData} */ + var newSegmentData = { + depth: segmentData.depth, + feature: segmentData.feature, + geometry: segmentData.geometry, + index: newIndex, + segment: segments + }; + this.rBush_.insert((0, _extent.boundingExtent)(newSegmentData.segment), newSegmentData); + } + + this.updateSegmentIndices_(geometry, index, segmentData.depth, -1); + + if (this.vertexFeature_) { + this.overlay_.getSource().removeFeature(this.vertexFeature_); + this.vertexFeature_ = null; + } + + dragSegments.length = 0; + } + } + + return deleted; + }; + /** + * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry. + * @param {Array} coordinates Coordinates. + * @private + */ + + + Modify.prototype.setGeometryCoordinates_ = function (geometry, coordinates) { + this.changingFeature_ = true; + geometry.setCoordinates(coordinates); + this.changingFeature_ = false; + }; + /** + * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry. + * @param {number} index Index. + * @param {Array<number>|undefined} depth Depth. + * @param {number} delta Delta (1 or -1). + * @private + */ + + + Modify.prototype.updateSegmentIndices_ = function (geometry, index, depth, delta) { + this.rBush_.forEachInExtent(geometry.getExtent(), function (segmentDataMatch) { + if (segmentDataMatch.geometry === geometry && (depth === undefined || segmentDataMatch.depth === undefined || (0, _array.equals)(segmentDataMatch.depth, depth)) && segmentDataMatch.index > index) { + segmentDataMatch.index += delta; + } + }); + }; + + return Modify; +}(_Pointer.default); +/** + * @param {SegmentData} a The first segment data. + * @param {SegmentData} b The second segment data. + * @return {number} The difference in indexes. + */ + + +function compareIndexes(a, b) { + return a.index - b.index; +} +/** + * Returns the distance from a point to a line segment. + * + * @param {import("../coordinate.js").Coordinate} pointCoordinates The coordinates of the point from + * which to calculate the distance. + * @param {SegmentData} segmentData The object describing the line + * segment we are calculating the distance to. + * @param {import("../proj/Projection.js").default} projection The view projection. + * @return {number} The square of the distance between a point and a line segment. + */ + + +function projectedDistanceToSegmentDataSquared(pointCoordinates, segmentData, projection) { + var geometry = segmentData.geometry; + + if (geometry.getType() === _GeometryType.default.CIRCLE) { + var circleGeometry = + /** @type {import("../geom/Circle.js").default} */ + geometry; + + if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) { + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + circleGeometry = + /** @type {import("../geom/Circle.js").default} */ + circleGeometry.clone().transform(userProjection, projection); + } + + var distanceToCenterSquared = (0, _coordinate.squaredDistance)(circleGeometry.getCenter(), (0, _proj.fromUserCoordinate)(pointCoordinates, projection)); + var distanceToCircumference = Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius(); + return distanceToCircumference * distanceToCircumference; + } + } + + var coordinate = (0, _proj.fromUserCoordinate)(pointCoordinates, projection); + tempSegment[0] = (0, _proj.fromUserCoordinate)(segmentData.segment[0], projection); + tempSegment[1] = (0, _proj.fromUserCoordinate)(segmentData.segment[1], projection); + return (0, _coordinate.squaredDistanceToSegment)(coordinate, tempSegment); +} +/** + * Returns the point closest to a given line segment. + * + * @param {import("../coordinate.js").Coordinate} pointCoordinates The point to which a closest point + * should be found. + * @param {SegmentData} segmentData The object describing the line + * segment which should contain the closest point. + * @param {import("../proj/Projection.js").default} projection The view projection. + * @return {import("../coordinate.js").Coordinate} The point closest to the specified line segment. + */ + + +function closestOnSegmentData(pointCoordinates, segmentData, projection) { + var geometry = segmentData.geometry; + + if (geometry.getType() === _GeometryType.default.CIRCLE && segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) { + var circleGeometry = + /** @type {import("../geom/Circle.js").default} */ + geometry; + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + circleGeometry = + /** @type {import("../geom/Circle.js").default} */ + circleGeometry.clone().transform(userProjection, projection); + } + + return (0, _proj.toUserCoordinate)(circleGeometry.getClosestPoint((0, _proj.fromUserCoordinate)(pointCoordinates, projection)), projection); + } + + var coordinate = (0, _proj.fromUserCoordinate)(pointCoordinates, projection); + tempSegment[0] = (0, _proj.fromUserCoordinate)(segmentData.segment[0], projection); + tempSegment[1] = (0, _proj.fromUserCoordinate)(segmentData.segment[1], projection); + return (0, _proj.toUserCoordinate)((0, _coordinate.closestOnSegment)(coordinate, tempSegment), projection); +} +/** + * @return {import("../style/Style.js").StyleFunction} Styles. + */ + + +function getDefaultStyleFunction() { + var style = (0, _Style.createEditingStyle)(); + return function (feature, resolution) { + return style[_GeometryType.default.POINT]; + }; +} + +var _default = Modify; +exports.default = _default; +},{"../Collection.js":"../../../node_modules/ol/Collection.js","../CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","../events/Event.js":"../../../node_modules/ol/events/Event.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../Feature.js":"../../../node_modules/ol/Feature.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","../MapBrowserEventType.js":"../../../node_modules/ol/MapBrowserEventType.js","../geom/Point.js":"../../../node_modules/ol/geom/Point.js","./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../structs/RBush.js":"../../../node_modules/ol/structs/RBush.js","../source/VectorEventType.js":"../../../node_modules/ol/source/VectorEventType.js","../layer/Vector.js":"../../../node_modules/ol/layer/Vector.js","../source/Vector.js":"../../../node_modules/ol/source/Vector.js","../events/condition.js":"../../../node_modules/ol/events/condition.js","../extent.js":"../../../node_modules/ol/extent.js","../coordinate.js":"../../../node_modules/ol/coordinate.js","../style/Style.js":"../../../node_modules/ol/style/Style.js","../array.js":"../../../node_modules/ol/array.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js","../proj.js":"../../../node_modules/ol/proj.js","../util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/interaction/Select.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Collection = _interopRequireDefault(require("../Collection.js")); + +var _CollectionEventType = _interopRequireDefault(require("../CollectionEventType.js")); + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _Interaction = _interopRequireDefault(require("./Interaction.js")); + +var _functions = require("../functions.js"); + +var _obj = require("../obj.js"); + +var _Style = require("../style/Style.js"); + +var _array = require("../array.js"); + +var _util = require("../util.js"); + +var _condition = require("../events/condition.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Select + */ + + +/** + * @enum {string} + */ +var SelectEventType = { + /** + * Triggered when feature(s) has been (de)selected. + * @event SelectEvent#select + * @api + */ + SELECT: 'select' +}; +/** + * A function that takes an {@link module:ol/Feature} or + * {@link module:ol/render/Feature} and an + * {@link module:ol/layer/Layer} and returns `true` if the feature may be + * selected or `false` otherwise. + * @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction + */ + +/** + * @typedef {Object} Options + * @property {import("../events/condition.js").Condition} [addCondition] A function + * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. + * By default, this is {@link module:ol/events/condition~never}. Use this if you + * want to use different events for add and remove instead of `toggle`. + * @property {import("../events/condition.js").Condition} [condition] A function that + * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. This is the event + * for the selected features as a whole. By default, this is + * {@link module:ol/events/condition~singleClick}. Clicking on a feature selects that + * feature and removes any that were in the selection. Clicking outside any + * feature removes all from the selection. + * See `toggle`, `add`, `remove` options for adding/removing extra features to/ + * from the selection. + * @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers] + * A list of layers from which features should be selected. Alternatively, a + * filter function can be provided. The function will be called for each layer + * in the map and should return `true` for layers that you want to be + * selectable. If the option is absent, all visible layers will be considered + * selectable. + * @property {import("../style/Style.js").StyleLike|null} [style] + * Style for the selected features. By default the default edit style is used + * (see {@link module:ol/style}). Set to `null` if this interaction should not apply + * any style changes for selected features. + * If set to a falsey value, the selected feature's style will not change. + * @property {import("../events/condition.js").Condition} [removeCondition] A function + * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. + * By default, this is {@link module:ol/events/condition~never}. Use this if you + * want to use different events for add and remove instead of `toggle`. + * @property {import("../events/condition.js").Condition} [toggleCondition] A function + * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * boolean to indicate whether that event should be handled. This is in addition + * to the `condition` event. By default, + * {@link module:ol/events/condition~shiftKeyOnly}, i.e. pressing `shift` as + * well as the `condition` event, adds that feature to the current selection if + * it is not currently selected, and removes it if it is. See `add` and `remove` + * if you want to use different events instead of a toggle. + * @property {boolean} [multi=false] A boolean that determines if the default + * behaviour should select only single features or all (overlapping) features at + * the clicked map position. The default of `false` means single select. + * @property {import("../Collection.js").default<import("../Feature.js").default>} [features] + * Collection where the interaction will place selected features. Optional. If + * not set the interaction will create a collection. In any case the collection + * used by the interaction is returned by + * {@link module:ol/interaction/Select~Select#getFeatures}. + * @property {FilterFunction} [filter] A function + * that takes an {@link module:ol/Feature} and an + * {@link module:ol/layer/Layer} and returns `true` if the feature may be + * selected or `false` otherwise. + * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside + * the radius around the given position will be checked for features. + */ + +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/Select~Select} instances are instances of + * this type. + */ + +var SelectEvent = +/** @class */ +function (_super) { + __extends(SelectEvent, _super); + /** + * @param {SelectEventType} type The event type. + * @param {Array<import("../Feature.js").default>} selected Selected features. + * @param {Array<import("../Feature.js").default>} deselected Deselected features. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Associated + * {@link module:ol/MapBrowserEvent}. + */ + + + function SelectEvent(type, selected, deselected, mapBrowserEvent) { + var _this = _super.call(this, type) || this; + /** + * Selected features array. + * @type {Array<import("../Feature.js").default>} + * @api + */ + + + _this.selected = selected; + /** + * Deselected features array. + * @type {Array<import("../Feature.js").default>} + * @api + */ + + _this.deselected = deselected; + /** + * Associated {@link module:ol/MapBrowserEvent}. + * @type {import("../MapBrowserEvent.js").default} + * @api + */ + + _this.mapBrowserEvent = mapBrowserEvent; + return _this; + } + + return SelectEvent; +}(_Event.default); +/** + * Original feature styles to reset to when features are no longer selected. + * @type {Object.<number, import("../style/Style.js").default|Array.<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction>} + */ + + +var originalFeatureStyles = {}; +/** + * @classdesc + * Interaction for selecting vector features. By default, selected features are + * styled differently, so this interaction can be used for visual highlighting, + * as well as selecting features for other actions, such as modification or + * output. There are three ways of controlling which features are selected: + * using the browser event as defined by the `condition` and optionally the + * `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a + * further feature filter using the `filter` option. + * + * Selected features are added to an internal unmanaged layer. + * + * @fires SelectEvent + * @api + */ + +var Select = +/** @class */ +function (_super) { + __extends(Select, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Select(opt_options) { + var _this = _super.call(this) || this; + + var options = opt_options ? opt_options : {}; + /** + * @private + */ + + _this.boundAddFeature_ = _this.addFeature_.bind(_this); + /** + * @private + */ + + _this.boundRemoveFeature_ = _this.removeFeature_.bind(_this); + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.condition_ = options.condition ? options.condition : _condition.singleClick; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.addCondition_ = options.addCondition ? options.addCondition : _condition.never; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.removeCondition_ = options.removeCondition ? options.removeCondition : _condition.never; + /** + * @private + * @type {import("../events/condition.js").Condition} + */ + + _this.toggleCondition_ = options.toggleCondition ? options.toggleCondition : _condition.shiftKeyOnly; + /** + * @private + * @type {boolean} + */ + + _this.multi_ = options.multi ? options.multi : false; + /** + * @private + * @type {FilterFunction} + */ + + _this.filter_ = options.filter ? options.filter : _functions.TRUE; + /** + * @private + * @type {number} + */ + + _this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0; + /** + * @private + * @type {import("../style/Style.js").default|Array.<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction|null} + */ + + _this.style_ = options.style !== undefined ? options.style : getDefaultStyleFunction(); + /** + * @private + * @type {import("../Collection.js").default} + */ + + _this.features_ = options.features || new _Collection.default(); + /** @type {function(import("../layer/Layer.js").default): boolean} */ + + var layerFilter; + + if (options.layers) { + if (typeof options.layers === 'function') { + layerFilter = options.layers; + } else { + var layers_1 = options.layers; + + layerFilter = function (layer) { + return (0, _array.includes)(layers_1, layer); + }; + } + } else { + layerFilter = _functions.TRUE; + } + /** + * @private + * @type {function(import("../layer/Layer.js").default): boolean} + */ + + + _this.layerFilter_ = layerFilter; + /** + * An association between selected feature (key) + * and layer (value) + * @private + * @type {Object<string, import("../layer/Layer.js").default>} + */ + + _this.featureLayerAssociation_ = {}; + return _this; + } + /** + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {import("../layer/Layer.js").default} layer Layer. + * @private + */ + + + Select.prototype.addFeatureLayerAssociation_ = function (feature, layer) { + this.featureLayerAssociation_[(0, _util.getUid)(feature)] = layer; + }; + /** + * Get the selected features. + * @return {import("../Collection.js").default<import("../Feature.js").default>} Features collection. + * @api + */ + + + Select.prototype.getFeatures = function () { + return this.features_; + }; + /** + * Returns the Hit-detection tolerance. + * @returns {number} Hit tolerance in pixels. + * @api + */ + + + Select.prototype.getHitTolerance = function () { + return this.hitTolerance_; + }; + /** + * Returns the associated {@link module:ol/layer/Vector~Vector vectorlayer} of + * the (last) selected feature. Note that this will not work with any + * programmatic method like pushing features to + * {@link module:ol/interaction/Select~Select#getFeatures collection}. + * @param {import("../Feature.js").FeatureLike} feature Feature + * @return {import('../layer/Vector.js').default} Layer. + * @api + */ + + + Select.prototype.getLayer = function (feature) { + return ( + /** @type {import('../layer/Vector.js').default} */ + this.featureLayerAssociation_[(0, _util.getUid)(feature)] + ); + }; + /** + * Hit-detection tolerance. Pixels inside the radius around the given position + * will be checked for features. + * @param {number} hitTolerance Hit tolerance in pixels. + * @api + */ + + + Select.prototype.setHitTolerance = function (hitTolerance) { + this.hitTolerance_ = hitTolerance; + }; + /** + * Remove the interaction from its current map, if any, and attach it to a new + * map, if any. Pass `null` to just remove the interaction from the current map. + * @param {import("../PluggableMap.js").default} map Map. + * @api + */ + + + Select.prototype.setMap = function (map) { + var currentMap = this.getMap(); + + if (currentMap && this.style_) { + this.features_.forEach(this.restorePreviousStyle_.bind(this)); + } + + _super.prototype.setMap.call(this, map); + + if (map) { + this.features_.addEventListener(_CollectionEventType.default.ADD, this.boundAddFeature_); + this.features_.addEventListener(_CollectionEventType.default.REMOVE, this.boundRemoveFeature_); + + if (this.style_) { + this.features_.forEach(this.applySelectedStyle_.bind(this)); + } + } else { + this.features_.removeEventListener(_CollectionEventType.default.ADD, this.boundAddFeature_); + this.features_.removeEventListener(_CollectionEventType.default.REMOVE, this.boundRemoveFeature_); + } + }; + /** + * @param {import("../Collection.js").CollectionEvent} evt Event. + * @private + */ + + + Select.prototype.addFeature_ = function (evt) { + var feature = evt.element; + + if (this.style_) { + this.applySelectedStyle_(feature); + } + }; + /** + * @param {import("../Collection.js").CollectionEvent} evt Event. + * @private + */ + + + Select.prototype.removeFeature_ = function (evt) { + var feature = evt.element; + + if (this.style_) { + this.restorePreviousStyle_(feature); + } + }; + /** + * @return {import("../style/Style.js").StyleLike|null} Select style. + */ + + + Select.prototype.getStyle = function () { + return this.style_; + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @private + */ + + + Select.prototype.applySelectedStyle_ = function (feature) { + var key = (0, _util.getUid)(feature); + + if (!(key in originalFeatureStyles)) { + originalFeatureStyles[key] = feature.getStyle(); + } + + feature.setStyle(this.style_); + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @private + */ + + + Select.prototype.restorePreviousStyle_ = function (feature) { + var key = (0, _util.getUid)(feature); + var selectInteractions = + /** @type {Array<Select>} */ + this.getMap().getInteractions().getArray().filter(function (interaction) { + return interaction instanceof Select && interaction.getStyle() && interaction.getFeatures().getArray().indexOf(feature) !== -1; + }); + + if (selectInteractions.length > 0) { + feature.setStyle(selectInteractions[selectInteractions.length - 1].getStyle()); + } else { + feature.setStyle(originalFeatureStyles[key]); + delete originalFeatureStyles[key]; + } + }; + /** + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @private + */ + + + Select.prototype.removeFeatureLayerAssociation_ = function (feature) { + delete this.featureLayerAssociation_[(0, _util.getUid)(feature)]; + }; + /** + * Handles the {@link module:ol/MapBrowserEvent map browser event} and may change the + * selected state of features. + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. + * @this {Select} + */ + + + Select.prototype.handleEvent = function (mapBrowserEvent) { + if (!this.condition_(mapBrowserEvent)) { + return true; + } + + var add = this.addCondition_(mapBrowserEvent); + var remove = this.removeCondition_(mapBrowserEvent); + var toggle = this.toggleCondition_(mapBrowserEvent); + var set = !add && !remove && !toggle; + var map = mapBrowserEvent.map; + var features = this.getFeatures(); + var deselected = []; + var selected = []; + + if (set) { + // Replace the currently selected feature(s) with the feature(s) at the + // pixel, or clear the selected feature(s) if there is no feature at + // the pixel. + (0, _obj.clear)(this.featureLayerAssociation_); + map.forEachFeatureAtPixel(mapBrowserEvent.pixel, + /** + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {import("../layer/Layer.js").default} layer Layer. + * @return {boolean|undefined} Continue to iterate over the features. + */ + function (feature, layer) { + if (this.filter_(feature, layer)) { + selected.push(feature); + this.addFeatureLayerAssociation_(feature, layer); + return !this.multi_; + } + }.bind(this), { + layerFilter: this.layerFilter_, + hitTolerance: this.hitTolerance_ + }); + + for (var i = features.getLength() - 1; i >= 0; --i) { + var feature = features.item(i); + var index = selected.indexOf(feature); + + if (index > -1) { + // feature is already selected + selected.splice(index, 1); + } else { + features.remove(feature); + deselected.push(feature); + } + } + + if (selected.length !== 0) { + features.extend(selected); + } + } else { + // Modify the currently selected feature(s). + map.forEachFeatureAtPixel(mapBrowserEvent.pixel, + /** + * @param {import("../Feature.js").FeatureLike} feature Feature. + * @param {import("../layer/Layer.js").default} layer Layer. + * @return {boolean|undefined} Continue to iterate over the features. + */ + function (feature, layer) { + if (this.filter_(feature, layer)) { + if ((add || toggle) && !(0, _array.includes)(features.getArray(), feature)) { + selected.push(feature); + this.addFeatureLayerAssociation_(feature, layer); + } else if ((remove || toggle) && (0, _array.includes)(features.getArray(), feature)) { + deselected.push(feature); + this.removeFeatureLayerAssociation_(feature); + } + + return !this.multi_; + } + }.bind(this), { + layerFilter: this.layerFilter_, + hitTolerance: this.hitTolerance_ + }); + + for (var j = deselected.length - 1; j >= 0; --j) { + features.remove(deselected[j]); + } + + features.extend(selected); + } + + if (selected.length > 0 || deselected.length > 0) { + this.dispatchEvent(new SelectEvent(SelectEventType.SELECT, selected, deselected, mapBrowserEvent)); + } + + return true; + }; + + return Select; +}(_Interaction.default); +/** + * @return {import("../style/Style.js").StyleFunction} Styles. + */ + + +function getDefaultStyleFunction() { + var styles = (0, _Style.createEditingStyle)(); + (0, _array.extend)(styles[_GeometryType.default.POLYGON], styles[_GeometryType.default.LINE_STRING]); + (0, _array.extend)(styles[_GeometryType.default.GEOMETRY_COLLECTION], styles[_GeometryType.default.LINE_STRING]); + return function (feature) { + if (!feature.getGeometry()) { + return null; + } + + return styles[feature.getGeometry().getType()]; + }; +} + +var _default = Select; +exports.default = _default; +},{"../Collection.js":"../../../node_modules/ol/Collection.js","../CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","../events/Event.js":"../../../node_modules/ol/events/Event.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","../functions.js":"../../../node_modules/ol/functions.js","../obj.js":"../../../node_modules/ol/obj.js","../style/Style.js":"../../../node_modules/ol/style/Style.js","../array.js":"../../../node_modules/ol/array.js","../util.js":"../../../node_modules/ol/util.js","../events/condition.js":"../../../node_modules/ol/events/condition.js"}],"../../../node_modules/ol/interaction/Snap.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _CollectionEventType = _interopRequireDefault(require("../CollectionEventType.js")); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _GeometryType = _interopRequireDefault(require("../geom/GeometryType.js")); + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _RBush = _interopRequireDefault(require("../structs/RBush.js")); + +var _VectorEventType = _interopRequireDefault(require("../source/VectorEventType.js")); + +var _functions = require("../functions.js"); + +var _extent = require("../extent.js"); + +var _coordinate = require("../coordinate.js"); + +var _Polygon = require("../geom/Polygon.js"); + +var _proj = require("../proj.js"); + +var _util = require("../util.js"); + +var _obj = require("../obj.js"); + +var _events = require("../events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Snap + */ + + +/** + * @typedef {Object} Result + * @property {boolean} snapped + * @property {import("../coordinate.js").Coordinate|null} vertex + * @property {import("../pixel.js").Pixel|null} vertexPixel + */ + +/** + * @typedef {Object} SegmentData + * @property {import("../Feature.js").default} feature + * @property {Array<import("../coordinate.js").Coordinate>} segment + */ + +/** + * @typedef {Object} Options + * @property {import("../Collection.js").default<import("../Feature.js").default>} [features] Snap to these features. Either this option or source should be provided. + * @property {boolean} [edge=true] Snap to edges. + * @property {boolean} [vertex=true] Snap to vertices. + * @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or + * vertex for snapping. + * @property {import("../source/Vector.js").default} [source] Snap to features from this source. Either this option or features should be provided + */ + +/** + * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event. + * @return {import("../Feature.js").default} Feature. + */ +function getFeatureFromEvent(evt) { + if ( + /** @type {import("../source/Vector.js").VectorSourceEvent} */ + evt.feature) { + return ( + /** @type {import("../source/Vector.js").VectorSourceEvent} */ + evt.feature + ); + } else if ( + /** @type {import("../Collection.js").CollectionEvent} */ + evt.element) { + return ( + /** @type {import("../Feature.js").default} */ + + /** @type {import("../Collection.js").CollectionEvent} */ + evt.element + ); + } +} + +var tempSegment = []; +/** + * @classdesc + * Handles snapping of vector features while modifying or drawing them. The + * features can come from a {@link module:ol/source/Vector} or {@link module:ol/Collection~Collection} + * Any interaction object that allows the user to interact + * with the features using the mouse can benefit from the snapping, as long + * as it is added before. + * + * The snap interaction modifies map browser event `coordinate` and `pixel` + * properties to force the snap to occur to any interaction that them. + * + * Example: + * + * import Snap from 'ol/interaction/Snap'; + * + * const snap = new Snap({ + * source: source + * }); + * + * map.addInteraction(snap); + * + * @api + */ + +var Snap = +/** @class */ +function (_super) { + __extends(Snap, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Snap(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var pointerOptions = + /** @type {import("./Pointer.js").Options} */ + options; + + if (!pointerOptions.handleDownEvent) { + pointerOptions.handleDownEvent = _functions.TRUE; + } + + if (!pointerOptions.stopDown) { + pointerOptions.stopDown = _functions.FALSE; + } + + _this = _super.call(this, pointerOptions) || this; + /** + * @type {import("../source/Vector.js").default} + * @private + */ + + _this.source_ = options.source ? options.source : null; + /** + * @private + * @type {boolean} + */ + + _this.vertex_ = options.vertex !== undefined ? options.vertex : true; + /** + * @private + * @type {boolean} + */ + + _this.edge_ = options.edge !== undefined ? options.edge : true; + /** + * @type {import("../Collection.js").default<import("../Feature.js").default>} + * @private + */ + + _this.features_ = options.features ? options.features : null; + /** + * @type {Array<import("../events.js").EventsKey>} + * @private + */ + + _this.featuresListenerKeys_ = []; + /** + * @type {Object<string, import("../events.js").EventsKey>} + * @private + */ + + _this.featureChangeListenerKeys_ = {}; + /** + * Extents are preserved so indexed segment can be quickly removed + * when its feature geometry changes + * @type {Object<string, import("../extent.js").Extent>} + * @private + */ + + _this.indexedFeaturesExtents_ = {}; + /** + * If a feature geometry changes while a pointer drag|move event occurs, the + * feature doesn't get updated right away. It will be at the next 'pointerup' + * event fired. + * @type {!Object<string, import("../Feature.js").default>} + * @private + */ + + _this.pendingFeatures_ = {}; + /** + * @type {number} + * @private + */ + + _this.pixelTolerance_ = options.pixelTolerance !== undefined ? options.pixelTolerance : 10; + /** + * Segment RTree for each layer + * @type {import("../structs/RBush.js").default<SegmentData>} + * @private + */ + + _this.rBush_ = new _RBush.default(); + /** + * @const + * @private + * @type {Object<string, function(import("../Feature.js").default, import("../geom/Geometry.js").default): void>} + */ + + _this.SEGMENT_WRITERS_ = { + 'Point': _this.writePointGeometry_.bind(_this), + 'LineString': _this.writeLineStringGeometry_.bind(_this), + 'LinearRing': _this.writeLineStringGeometry_.bind(_this), + 'Polygon': _this.writePolygonGeometry_.bind(_this), + 'MultiPoint': _this.writeMultiPointGeometry_.bind(_this), + 'MultiLineString': _this.writeMultiLineStringGeometry_.bind(_this), + 'MultiPolygon': _this.writeMultiPolygonGeometry_.bind(_this), + 'GeometryCollection': _this.writeGeometryCollectionGeometry_.bind(_this), + 'Circle': _this.writeCircleGeometry_.bind(_this) + }; + return _this; + } + /** + * Add a feature to the collection of features that we may snap to. + * @param {import("../Feature.js").default} feature Feature. + * @param {boolean=} opt_listen Whether to listen to the feature change or not + * Defaults to `true`. + * @api + */ + + + Snap.prototype.addFeature = function (feature, opt_listen) { + var register = opt_listen !== undefined ? opt_listen : true; + var feature_uid = (0, _util.getUid)(feature); + var geometry = feature.getGeometry(); + + if (geometry) { + var segmentWriter = this.SEGMENT_WRITERS_[geometry.getType()]; + + if (segmentWriter) { + this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent((0, _extent.createEmpty)()); + segmentWriter(feature, geometry); + } + } + + if (register) { + this.featureChangeListenerKeys_[feature_uid] = (0, _events.listen)(feature, _EventType.default.CHANGE, this.handleFeatureChange_, this); + } + }; + /** + * @param {import("../Feature.js").default} feature Feature. + * @private + */ + + + Snap.prototype.forEachFeatureAdd_ = function (feature) { + this.addFeature(feature); + }; + /** + * @param {import("../Feature.js").default} feature Feature. + * @private + */ + + + Snap.prototype.forEachFeatureRemove_ = function (feature) { + this.removeFeature(feature); + }; + /** + * @return {import("../Collection.js").default<import("../Feature.js").default>|Array<import("../Feature.js").default>} Features. + * @private + */ + + + Snap.prototype.getFeatures_ = function () { + var features; + + if (this.features_) { + features = this.features_; + } else if (this.source_) { + features = this.source_.getFeatures(); + } + + return features; + }; + /** + * @param {import("../MapBrowserEvent.js").default} evt Map browser event. + * @return {boolean} `false` to stop event propagation. + */ + + + Snap.prototype.handleEvent = function (evt) { + var result = this.snapTo(evt.pixel, evt.coordinate, evt.map); + + if (result.snapped) { + evt.coordinate = result.vertex.slice(0, 2); + evt.pixel = result.vertexPixel; + } + + return _super.prototype.handleEvent.call(this, evt); + }; + /** + * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event. + * @private + */ + + + Snap.prototype.handleFeatureAdd_ = function (evt) { + var feature = getFeatureFromEvent(evt); + this.addFeature(feature); + }; + /** + * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event. + * @private + */ + + + Snap.prototype.handleFeatureRemove_ = function (evt) { + var feature = getFeatureFromEvent(evt); + this.removeFeature(feature); + }; + /** + * @param {import("../events/Event.js").default} evt Event. + * @private + */ + + + Snap.prototype.handleFeatureChange_ = function (evt) { + var feature = + /** @type {import("../Feature.js").default} */ + evt.target; + + if (this.handlingDownUpSequence) { + var uid = (0, _util.getUid)(feature); + + if (!(uid in this.pendingFeatures_)) { + this.pendingFeatures_[uid] = feature; + } + } else { + this.updateFeature_(feature); + } + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} evt Event. + * @return {boolean} If the event was consumed. + */ + + + Snap.prototype.handleUpEvent = function (evt) { + var featuresToUpdate = (0, _obj.getValues)(this.pendingFeatures_); + + if (featuresToUpdate.length) { + featuresToUpdate.forEach(this.updateFeature_.bind(this)); + this.pendingFeatures_ = {}; + } + + return false; + }; + /** + * Remove a feature from the collection of features that we may snap to. + * @param {import("../Feature.js").default} feature Feature + * @param {boolean=} opt_unlisten Whether to unlisten to the feature change + * or not. Defaults to `true`. + * @api + */ + + + Snap.prototype.removeFeature = function (feature, opt_unlisten) { + var unregister = opt_unlisten !== undefined ? opt_unlisten : true; + var feature_uid = (0, _util.getUid)(feature); + var extent = this.indexedFeaturesExtents_[feature_uid]; + + if (extent) { + var rBush = this.rBush_; + var nodesToRemove_1 = []; + rBush.forEachInExtent(extent, function (node) { + if (feature === node.feature) { + nodesToRemove_1.push(node); + } + }); + + for (var i = nodesToRemove_1.length - 1; i >= 0; --i) { + rBush.remove(nodesToRemove_1[i]); + } + } + + if (unregister) { + (0, _events.unlistenByKey)(this.featureChangeListenerKeys_[feature_uid]); + delete this.featureChangeListenerKeys_[feature_uid]; + } + }; + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + Snap.prototype.setMap = function (map) { + var currentMap = this.getMap(); + var keys = this.featuresListenerKeys_; + var features = + /** @type {Array<import("../Feature.js").default>} */ + this.getFeatures_(); + + if (currentMap) { + keys.forEach(_events.unlistenByKey); + keys.length = 0; + features.forEach(this.forEachFeatureRemove_.bind(this)); + } + + _super.prototype.setMap.call(this, map); + + if (map) { + if (this.features_) { + keys.push((0, _events.listen)(this.features_, _CollectionEventType.default.ADD, this.handleFeatureAdd_, this), (0, _events.listen)(this.features_, _CollectionEventType.default.REMOVE, this.handleFeatureRemove_, this)); + } else if (this.source_) { + keys.push((0, _events.listen)(this.source_, _VectorEventType.default.ADDFEATURE, this.handleFeatureAdd_, this), (0, _events.listen)(this.source_, _VectorEventType.default.REMOVEFEATURE, this.handleFeatureRemove_, this)); + } + + features.forEach(this.forEachFeatureAdd_.bind(this)); + } + }; + /** + * @param {import("../pixel.js").Pixel} pixel Pixel + * @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate + * @param {import("../PluggableMap.js").default} map Map. + * @return {Result} Snap result + */ + + + Snap.prototype.snapTo = function (pixel, pixelCoordinate, map) { + var lowerLeft = map.getCoordinateFromPixel([pixel[0] - this.pixelTolerance_, pixel[1] + this.pixelTolerance_]); + var upperRight = map.getCoordinateFromPixel([pixel[0] + this.pixelTolerance_, pixel[1] - this.pixelTolerance_]); + var box = (0, _extent.boundingExtent)([lowerLeft, upperRight]); + var segments = this.rBush_.getInExtent(box); // If snapping on vertices only, don't consider circles + + if (this.vertex_ && !this.edge_) { + segments = segments.filter(function (segment) { + return segment.feature.getGeometry().getType() !== _GeometryType.default.CIRCLE; + }); + } + + var snapped = false; + var vertex = null; + var vertexPixel = null; + + if (segments.length === 0) { + return { + snapped: snapped, + vertex: vertex, + vertexPixel: vertexPixel + }; + } + + var projection = map.getView().getProjection(); + var projectedCoordinate = (0, _proj.fromUserCoordinate)(pixelCoordinate, projection); + var closestSegmentData; + var minSquaredDistance = Infinity; + + for (var i = 0; i < segments.length; ++i) { + var segmentData = segments[i]; + tempSegment[0] = (0, _proj.fromUserCoordinate)(segmentData.segment[0], projection); + tempSegment[1] = (0, _proj.fromUserCoordinate)(segmentData.segment[1], projection); + var delta = (0, _coordinate.squaredDistanceToSegment)(projectedCoordinate, tempSegment); + + if (delta < minSquaredDistance) { + closestSegmentData = segmentData; + minSquaredDistance = delta; + } + } + + var closestSegment = closestSegmentData.segment; + + if (this.vertex_ && !this.edge_) { + var pixel1 = map.getPixelFromCoordinate(closestSegment[0]); + var pixel2 = map.getPixelFromCoordinate(closestSegment[1]); + var squaredDist1 = (0, _coordinate.squaredDistance)(pixel, pixel1); + var squaredDist2 = (0, _coordinate.squaredDistance)(pixel, pixel2); + var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2)); + + if (dist <= this.pixelTolerance_) { + snapped = true; + vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0]; + vertexPixel = map.getPixelFromCoordinate(vertex); + } + } else if (this.edge_) { + var isCircle = closestSegmentData.feature.getGeometry().getType() === _GeometryType.default.CIRCLE; + + if (isCircle) { + var circleGeometry = closestSegmentData.feature.getGeometry(); + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + circleGeometry = circleGeometry.clone().transform(userProjection, projection); + } + + vertex = (0, _proj.toUserCoordinate)((0, _coordinate.closestOnCircle)(projectedCoordinate, + /** @type {import("../geom/Circle.js").default} */ + circleGeometry), projection); + } else { + tempSegment[0] = (0, _proj.fromUserCoordinate)(closestSegment[0], projection); + tempSegment[1] = (0, _proj.fromUserCoordinate)(closestSegment[1], projection); + vertex = (0, _proj.toUserCoordinate)((0, _coordinate.closestOnSegment)(projectedCoordinate, tempSegment), projection); + } + + vertexPixel = map.getPixelFromCoordinate(vertex); + + if ((0, _coordinate.distance)(pixel, vertexPixel) <= this.pixelTolerance_) { + snapped = true; + + if (this.vertex_ && !isCircle) { + var pixel1 = map.getPixelFromCoordinate(closestSegment[0]); + var pixel2 = map.getPixelFromCoordinate(closestSegment[1]); + var squaredDist1 = (0, _coordinate.squaredDistance)(vertexPixel, pixel1); + var squaredDist2 = (0, _coordinate.squaredDistance)(vertexPixel, pixel2); + var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2)); + + if (dist <= this.pixelTolerance_) { + vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0]; + vertexPixel = map.getPixelFromCoordinate(vertex); + } + } + } + } + + if (snapped) { + vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])]; + } + + return { + snapped: snapped, + vertex: vertex, + vertexPixel: vertexPixel + }; + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @private + */ + + + Snap.prototype.updateFeature_ = function (feature) { + this.removeFeature(feature, false); + this.addFeature(feature, false); + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/Circle.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writeCircleGeometry_ = function (feature, geometry) { + var projection = this.getMap().getView().getProjection(); + var circleGeometry = geometry; + var userProjection = (0, _proj.getUserProjection)(); + + if (userProjection) { + circleGeometry = + /** @type {import("../geom/Circle.js").default} */ + circleGeometry.clone().transform(userProjection, projection); + } + + var polygon = (0, _Polygon.fromCircle)(circleGeometry); + + if (userProjection) { + polygon.transform(projection, userProjection); + } + + var coordinates = polygon.getCoordinates()[0]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + var segmentData = { + feature: feature, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/GeometryCollection.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writeGeometryCollectionGeometry_ = function (feature, geometry) { + var geometries = geometry.getGeometriesArray(); + + for (var i = 0; i < geometries.length; ++i) { + var segmentWriter = this.SEGMENT_WRITERS_[geometries[i].getType()]; + + if (segmentWriter) { + segmentWriter(feature, geometries[i]); + } + } + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/LineString.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writeLineStringGeometry_ = function (feature, geometry) { + var coordinates = geometry.getCoordinates(); + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + var segmentData = { + feature: feature, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/MultiLineString.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writeMultiLineStringGeometry_ = function (feature, geometry) { + var lines = geometry.getCoordinates(); + + for (var j = 0, jj = lines.length; j < jj; ++j) { + var coordinates = lines[j]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + var segmentData = { + feature: feature, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + } + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/MultiPoint.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writeMultiPointGeometry_ = function (feature, geometry) { + var points = geometry.getCoordinates(); + + for (var i = 0, ii = points.length; i < ii; ++i) { + var coordinates = points[i]; + var segmentData = { + feature: feature, + segment: [coordinates, coordinates] + }; + this.rBush_.insert(geometry.getExtent(), segmentData); + } + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/MultiPolygon.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writeMultiPolygonGeometry_ = function (feature, geometry) { + var polygons = geometry.getCoordinates(); + + for (var k = 0, kk = polygons.length; k < kk; ++k) { + var rings = polygons[k]; + + for (var j = 0, jj = rings.length; j < jj; ++j) { + var coordinates = rings[j]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + var segmentData = { + feature: feature, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + } + } + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/Point.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writePointGeometry_ = function (feature, geometry) { + var coordinates = geometry.getCoordinates(); + var segmentData = { + feature: feature, + segment: [coordinates, coordinates] + }; + this.rBush_.insert(geometry.getExtent(), segmentData); + }; + /** + * @param {import("../Feature.js").default} feature Feature + * @param {import("../geom/Polygon.js").default} geometry Geometry. + * @private + */ + + + Snap.prototype.writePolygonGeometry_ = function (feature, geometry) { + var rings = geometry.getCoordinates(); + + for (var j = 0, jj = rings.length; j < jj; ++j) { + var coordinates = rings[j]; + + for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) { + var segment = coordinates.slice(i, i + 2); + var segmentData = { + feature: feature, + segment: segment + }; + this.rBush_.insert((0, _extent.boundingExtent)(segment), segmentData); + } + } + }; + + return Snap; +}(_Pointer.default); + +var _default = Snap; +exports.default = _default; +},{"../CollectionEventType.js":"../../../node_modules/ol/CollectionEventType.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../geom/GeometryType.js":"../../../node_modules/ol/geom/GeometryType.js","./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../structs/RBush.js":"../../../node_modules/ol/structs/RBush.js","../source/VectorEventType.js":"../../../node_modules/ol/source/VectorEventType.js","../functions.js":"../../../node_modules/ol/functions.js","../extent.js":"../../../node_modules/ol/extent.js","../coordinate.js":"../../../node_modules/ol/coordinate.js","../geom/Polygon.js":"../../../node_modules/ol/geom/Polygon.js","../proj.js":"../../../node_modules/ol/proj.js","../util.js":"../../../node_modules/ol/util.js","../obj.js":"../../../node_modules/ol/obj.js","../events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/interaction/Translate.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.TranslateEvent = void 0; + +var _Collection = _interopRequireDefault(require("../Collection.js")); + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _Property = _interopRequireDefault(require("./Property.js")); + +var _Pointer = _interopRequireDefault(require("./Pointer.js")); + +var _functions = require("../functions.js"); + +var _Object = require("../Object.js"); + +var _array = require("../array.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/interaction/Translate + */ + + +/** + * @enum {string} + */ +var TranslateEventType = { + /** + * Triggered upon feature translation start. + * @event TranslateEvent#translatestart + * @api + */ + TRANSLATESTART: 'translatestart', + + /** + * Triggered upon feature translation. + * @event TranslateEvent#translating + * @api + */ + TRANSLATING: 'translating', + + /** + * Triggered upon feature translation end. + * @event TranslateEvent#translateend + * @api + */ + TRANSLATEEND: 'translateend' +}; +/** + * A function that takes an {@link module:ol/Feature} or + * {@link module:ol/render/Feature} and an + * {@link module:ol/layer/Layer} and returns `true` if the feature may be + * translated or `false` otherwise. + * @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction + */ + +/** + * @typedef {Object} Options + * @property {Collection<import("../Feature.js").default>} [features] Only features contained in this collection will be able to be translated. If + * not specified, all features on the map will be able to be translated. + * @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers] A list of layers from which features should be + * translated. Alternatively, a filter function can be provided. The + * function will be called for each layer in the map and should return + * `true` for layers that you want to be translatable. If the option is + * absent, all visible layers will be considered translatable. + * @property {FilterFunction} [filter] A function + * that takes an {@link module:ol/Feature} and an + * {@link module:ol/layer/Layer} and returns `true` if the feature may be + * translated or `false` otherwise. + * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position + * will be checked for features. + */ + +/** + * @classdesc + * Events emitted by {@link module:ol/interaction/Translate~Translate} instances + * are instances of this type. + */ + +var TranslateEvent = +/** @class */ +function (_super) { + __extends(TranslateEvent, _super); + /** + * @param {TranslateEventType} type Type. + * @param {Collection<import("../Feature.js").default>} features The features translated. + * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate. + * @param {import("../coordinate.js").Coordinate} startCoordinate The original coordinates before.translation started + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + */ + + + function TranslateEvent(type, features, coordinate, startCoordinate, mapBrowserEvent) { + var _this = _super.call(this, type) || this; + /** + * The features being translated. + * @type {Collection<import("../Feature.js").default>} + * @api + */ + + + _this.features = features; + /** + * The coordinate of the drag event. + * @const + * @type {import("../coordinate.js").Coordinate} + * @api + */ + + _this.coordinate = coordinate; + /** + * The coordinate of the start position before translation started. + * @const + * @type {import("../coordinate.js").Coordinate} + * @api + */ + + _this.startCoordinate = startCoordinate; + /** + * Associated {@link module:ol/MapBrowserEvent}. + * @type {import("../MapBrowserEvent.js").default} + * @api + */ + + _this.mapBrowserEvent = mapBrowserEvent; + return _this; + } + + return TranslateEvent; +}(_Event.default); + +exports.TranslateEvent = TranslateEvent; + +/** + * @classdesc + * Interaction for translating (moving) features. + * + * @fires TranslateEvent + * @api + */ +var Translate = +/** @class */ +function (_super) { + __extends(Translate, _super); + /** + * @param {Options=} opt_options Options. + */ + + + function Translate(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + _this = _super.call(this, + /** @type {import("./Pointer.js").Options} */ + options) || this; + /** + * The last position we translated to. + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.lastCoordinate_ = null; + /** + * The start position before translation started. + * @type {import("../coordinate.js").Coordinate} + * @private + */ + + _this.startCoordinate_ = null; + /** + * @type {Collection<import("../Feature.js").default>} + * @private + */ + + _this.features_ = options.features !== undefined ? options.features : null; + /** @type {function(import("../layer/Layer.js").default): boolean} */ + + var layerFilter; + + if (options.layers) { + if (typeof options.layers === 'function') { + layerFilter = options.layers; + } else { + var layers_1 = options.layers; + + layerFilter = function (layer) { + return (0, _array.includes)(layers_1, layer); + }; + } + } else { + layerFilter = _functions.TRUE; + } + /** + * @private + * @type {function(import("../layer/Layer.js").default): boolean} + */ + + + _this.layerFilter_ = layerFilter; + /** + * @private + * @type {FilterFunction} + */ + + _this.filter_ = options.filter ? options.filter : _functions.TRUE; + /** + * @private + * @type {number} + */ + + _this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0; + /** + * @type {import("../Feature.js").default} + * @private + */ + + _this.lastFeature_ = null; + + _this.addEventListener((0, _Object.getChangeEventType)(_Property.default.ACTIVE), _this.handleActiveChanged_); + + return _this; + } + /** + * Handle pointer down events. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @return {boolean} If the event was consumed. + */ + + + Translate.prototype.handleDownEvent = function (event) { + this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map); + + if (!this.lastCoordinate_ && this.lastFeature_) { + this.startCoordinate_ = event.coordinate; + this.lastCoordinate_ = event.coordinate; + this.handleMoveEvent(event); + var features = this.features_ || new _Collection.default([this.lastFeature_]); + this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATESTART, features, event.coordinate, this.startCoordinate_, event)); + return true; + } + + return false; + }; + /** + * Handle pointer up events. + * @param {import("../MapBrowserEvent.js").default} event Event. + * @return {boolean} If the event was consumed. + */ + + + Translate.prototype.handleUpEvent = function (event) { + if (this.lastCoordinate_) { + this.lastCoordinate_ = null; + this.handleMoveEvent(event); + var features = this.features_ || new _Collection.default([this.lastFeature_]); + this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATEEND, features, event.coordinate, this.startCoordinate_, event)); // cleanup + + this.startCoordinate_ = null; + return true; + } + + return false; + }; + /** + * Handle pointer drag events. + * @param {import("../MapBrowserEvent.js").default} event Event. + */ + + + Translate.prototype.handleDragEvent = function (event) { + if (this.lastCoordinate_) { + var newCoordinate = event.coordinate; + var deltaX_1 = newCoordinate[0] - this.lastCoordinate_[0]; + var deltaY_1 = newCoordinate[1] - this.lastCoordinate_[1]; + var features = this.features_ || new _Collection.default([this.lastFeature_]); + features.forEach(function (feature) { + var geom = feature.getGeometry(); + geom.translate(deltaX_1, deltaY_1); + feature.setGeometry(geom); + }); + this.lastCoordinate_ = newCoordinate; + this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATING, features, newCoordinate, this.startCoordinate_, event)); + } + }; + /** + * Handle pointer move events. + * @param {import("../MapBrowserEvent.js").default} event Event. + */ + + + Translate.prototype.handleMoveEvent = function (event) { + var elem = event.map.getViewport(); // Change the cursor to grab/grabbing if hovering any of the features managed + // by the interaction + + if (this.featuresAtPixel_(event.pixel, event.map)) { + elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing'); + elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab'); + } else { + elem.classList.remove('ol-grab', 'ol-grabbing'); + } + }; + /** + * Tests to see if the given coordinates intersects any of our selected + * features. + * @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection. + * @param {import("../PluggableMap.js").default} map Map to test the intersection on. + * @return {import("../Feature.js").default} Returns the feature found at the specified pixel + * coordinates. + * @private + */ + + + Translate.prototype.featuresAtPixel_ = function (pixel, map) { + return map.forEachFeatureAtPixel(pixel, function (feature, layer) { + if (this.filter_(feature, layer)) { + if (!this.features_ || (0, _array.includes)(this.features_.getArray(), feature)) { + return feature; + } + } + }.bind(this), { + layerFilter: this.layerFilter_, + hitTolerance: this.hitTolerance_ + }); + }; + /** + * Returns the Hit-detection tolerance. + * @returns {number} Hit tolerance in pixels. + * @api + */ + + + Translate.prototype.getHitTolerance = function () { + return this.hitTolerance_; + }; + /** + * Hit-detection tolerance. Pixels inside the radius around the given position + * will be checked for features. + * @param {number} hitTolerance Hit tolerance in pixels. + * @api + */ + + + Translate.prototype.setHitTolerance = function (hitTolerance) { + this.hitTolerance_ = hitTolerance; + }; + /** + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + */ + + + Translate.prototype.setMap = function (map) { + var oldMap = this.getMap(); + + _super.prototype.setMap.call(this, map); + + this.updateState_(oldMap); + }; + /** + * @private + */ + + + Translate.prototype.handleActiveChanged_ = function () { + this.updateState_(null); + }; + /** + * @param {import("../PluggableMap.js").default} oldMap Old map. + * @private + */ + + + Translate.prototype.updateState_ = function (oldMap) { + var map = this.getMap(); + var active = this.getActive(); + + if (!map || !active) { + map = map || oldMap; + + if (map) { + var elem = map.getViewport(); + elem.classList.remove('ol-grab', 'ol-grabbing'); + } + } + }; + + return Translate; +}(_Pointer.default); + +var _default = Translate; +exports.default = _default; +},{"../Collection.js":"../../../node_modules/ol/Collection.js","../events/Event.js":"../../../node_modules/ol/events/Event.js","./Property.js":"../../../node_modules/ol/interaction/Property.js","./Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","../functions.js":"../../../node_modules/ol/functions.js","../Object.js":"../../../node_modules/ol/Object.js","../array.js":"../../../node_modules/ol/array.js"}],"../../../node_modules/ol/interaction.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.defaults = defaults; +Object.defineProperty(exports, "DoubleClickZoom", { + enumerable: true, + get: function () { + return _DoubleClickZoom.default; + } +}); +Object.defineProperty(exports, "DragPan", { + enumerable: true, + get: function () { + return _DragPan.default; + } +}); +Object.defineProperty(exports, "DragRotate", { + enumerable: true, + get: function () { + return _DragRotate.default; + } +}); +Object.defineProperty(exports, "DragZoom", { + enumerable: true, + get: function () { + return _DragZoom.default; + } +}); +Object.defineProperty(exports, "KeyboardPan", { + enumerable: true, + get: function () { + return _KeyboardPan.default; + } +}); +Object.defineProperty(exports, "KeyboardZoom", { + enumerable: true, + get: function () { + return _KeyboardZoom.default; + } +}); +Object.defineProperty(exports, "MouseWheelZoom", { + enumerable: true, + get: function () { + return _MouseWheelZoom.default; + } +}); +Object.defineProperty(exports, "PinchRotate", { + enumerable: true, + get: function () { + return _PinchRotate.default; + } +}); +Object.defineProperty(exports, "PinchZoom", { + enumerable: true, + get: function () { + return _PinchZoom.default; + } +}); +Object.defineProperty(exports, "DragAndDrop", { + enumerable: true, + get: function () { + return _DragAndDrop.default; + } +}); +Object.defineProperty(exports, "DragBox", { + enumerable: true, + get: function () { + return _DragBox.default; + } +}); +Object.defineProperty(exports, "DragRotateAndZoom", { + enumerable: true, + get: function () { + return _DragRotateAndZoom.default; + } +}); +Object.defineProperty(exports, "Draw", { + enumerable: true, + get: function () { + return _Draw.default; + } +}); +Object.defineProperty(exports, "Extent", { + enumerable: true, + get: function () { + return _Extent.default; + } +}); +Object.defineProperty(exports, "Interaction", { + enumerable: true, + get: function () { + return _Interaction.default; + } +}); +Object.defineProperty(exports, "Modify", { + enumerable: true, + get: function () { + return _Modify.default; + } +}); +Object.defineProperty(exports, "Pointer", { + enumerable: true, + get: function () { + return _Pointer.default; + } +}); +Object.defineProperty(exports, "Select", { + enumerable: true, + get: function () { + return _Select.default; + } +}); +Object.defineProperty(exports, "Snap", { + enumerable: true, + get: function () { + return _Snap.default; + } +}); +Object.defineProperty(exports, "Translate", { + enumerable: true, + get: function () { + return _Translate.default; + } +}); + +var _Collection = _interopRequireDefault(require("./Collection.js")); + +var _DoubleClickZoom = _interopRequireDefault(require("./interaction/DoubleClickZoom.js")); + +var _DragPan = _interopRequireDefault(require("./interaction/DragPan.js")); + +var _DragRotate = _interopRequireDefault(require("./interaction/DragRotate.js")); + +var _DragZoom = _interopRequireDefault(require("./interaction/DragZoom.js")); + +var _KeyboardPan = _interopRequireDefault(require("./interaction/KeyboardPan.js")); + +var _KeyboardZoom = _interopRequireDefault(require("./interaction/KeyboardZoom.js")); + +var _Kinetic = _interopRequireDefault(require("./Kinetic.js")); + +var _MouseWheelZoom = _interopRequireDefault(require("./interaction/MouseWheelZoom.js")); + +var _PinchRotate = _interopRequireDefault(require("./interaction/PinchRotate.js")); + +var _PinchZoom = _interopRequireDefault(require("./interaction/PinchZoom.js")); + +var _DragAndDrop = _interopRequireDefault(require("./interaction/DragAndDrop.js")); + +var _DragBox = _interopRequireDefault(require("./interaction/DragBox.js")); + +var _DragRotateAndZoom = _interopRequireDefault(require("./interaction/DragRotateAndZoom.js")); + +var _Draw = _interopRequireDefault(require("./interaction/Draw.js")); + +var _Extent = _interopRequireDefault(require("./interaction/Extent.js")); + +var _Interaction = _interopRequireDefault(require("./interaction/Interaction.js")); + +var _Modify = _interopRequireDefault(require("./interaction/Modify.js")); + +var _Pointer = _interopRequireDefault(require("./interaction/Pointer.js")); + +var _Select = _interopRequireDefault(require("./interaction/Select.js")); + +var _Snap = _interopRequireDefault(require("./interaction/Snap.js")); + +var _Translate = _interopRequireDefault(require("./interaction/Translate.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/interaction + */ + +/** + * @typedef {Object} DefaultsOptions + * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is + * desired. + * @property {boolean} [onFocusOnly=false] Interact only when the map has the + * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is + * useful when page scroll is desired for maps that do not have the browser's + * focus. + * @property {boolean} [doubleClickZoom=true] Whether double click zoom is + * desired. + * @property {boolean} [keyboard=true] Whether keyboard interaction is desired. + * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired. + * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired. + * @property {boolean} [dragPan=true] Whether drag pan is desired. + * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired. + * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired. + * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom. + * @property {number} [zoomDuration] Duration of the zoom animation in + * milliseconds. + */ + +/** + * Set of interactions included in maps by default. Specific interactions can be + * excluded by setting the appropriate option to false in the constructor + * options, but the order of the interactions is fixed. If you want to specify + * a different order for interactions, you will need to create your own + * {@link module:ol/interaction/Interaction} instances and insert + * them into a {@link module:ol/Collection} in the order you want + * before creating your {@link module:ol/Map~Map} instance. Changing the order can + * be of interest if the event propagation needs to be stopped at a point. + * The default set of interactions, in sequence, is: + * * {@link module:ol/interaction/DragRotate~DragRotate} + * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom} + * * {@link module:ol/interaction/DragPan~DragPan} + * * {@link module:ol/interaction/PinchRotate~PinchRotate} + * * {@link module:ol/interaction/PinchZoom~PinchZoom} + * * {@link module:ol/interaction/KeyboardPan~KeyboardPan} + * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} + * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom} + * * {@link module:ol/interaction/DragZoom~DragZoom} + * + * @param {DefaultsOptions=} opt_options Defaults options. + * @return {import("./Collection.js").default<import("./interaction/Interaction.js").default>} + * A collection of interactions to be used with the {@link module:ol/Map~Map} + * constructor's `interactions` option. + * @api + */ +function defaults(opt_options) { + var options = opt_options ? opt_options : {}; + var interactions = new _Collection.default(); + var kinetic = new _Kinetic.default(-0.005, 0.05, 100); + var altShiftDragRotate = options.altShiftDragRotate !== undefined ? options.altShiftDragRotate : true; + + if (altShiftDragRotate) { + interactions.push(new _DragRotate.default()); + } + + var doubleClickZoom = options.doubleClickZoom !== undefined ? options.doubleClickZoom : true; + + if (doubleClickZoom) { + interactions.push(new _DoubleClickZoom.default({ + delta: options.zoomDelta, + duration: options.zoomDuration + })); + } + + var dragPan = options.dragPan !== undefined ? options.dragPan : true; + + if (dragPan) { + interactions.push(new _DragPan.default({ + onFocusOnly: options.onFocusOnly, + kinetic: kinetic + })); + } + + var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate : true; + + if (pinchRotate) { + interactions.push(new _PinchRotate.default()); + } + + var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true; + + if (pinchZoom) { + interactions.push(new _PinchZoom.default({ + duration: options.zoomDuration + })); + } + + var keyboard = options.keyboard !== undefined ? options.keyboard : true; + + if (keyboard) { + interactions.push(new _KeyboardPan.default()); + interactions.push(new _KeyboardZoom.default({ + delta: options.zoomDelta, + duration: options.zoomDuration + })); + } + + var mouseWheelZoom = options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true; + + if (mouseWheelZoom) { + interactions.push(new _MouseWheelZoom.default({ + onFocusOnly: options.onFocusOnly, + duration: options.zoomDuration + })); + } + + var shiftDragZoom = options.shiftDragZoom !== undefined ? options.shiftDragZoom : true; + + if (shiftDragZoom) { + interactions.push(new _DragZoom.default({ + duration: options.zoomDuration + })); + } + + return interactions; +} +},{"./Collection.js":"../../../node_modules/ol/Collection.js","./interaction/DoubleClickZoom.js":"../../../node_modules/ol/interaction/DoubleClickZoom.js","./interaction/DragPan.js":"../../../node_modules/ol/interaction/DragPan.js","./interaction/DragRotate.js":"../../../node_modules/ol/interaction/DragRotate.js","./interaction/DragZoom.js":"../../../node_modules/ol/interaction/DragZoom.js","./interaction/KeyboardPan.js":"../../../node_modules/ol/interaction/KeyboardPan.js","./interaction/KeyboardZoom.js":"../../../node_modules/ol/interaction/KeyboardZoom.js","./Kinetic.js":"../../../node_modules/ol/Kinetic.js","./interaction/MouseWheelZoom.js":"../../../node_modules/ol/interaction/MouseWheelZoom.js","./interaction/PinchRotate.js":"../../../node_modules/ol/interaction/PinchRotate.js","./interaction/PinchZoom.js":"../../../node_modules/ol/interaction/PinchZoom.js","./interaction/DragAndDrop.js":"../../../node_modules/ol/interaction/DragAndDrop.js","./interaction/DragBox.js":"../../../node_modules/ol/interaction/DragBox.js","./interaction/DragRotateAndZoom.js":"../../../node_modules/ol/interaction/DragRotateAndZoom.js","./interaction/Draw.js":"../../../node_modules/ol/interaction/Draw.js","./interaction/Extent.js":"../../../node_modules/ol/interaction/Extent.js","./interaction/Interaction.js":"../../../node_modules/ol/interaction/Interaction.js","./interaction/Modify.js":"../../../node_modules/ol/interaction/Modify.js","./interaction/Pointer.js":"../../../node_modules/ol/interaction/Pointer.js","./interaction/Select.js":"../../../node_modules/ol/interaction/Select.js","./interaction/Snap.js":"../../../node_modules/ol/interaction/Snap.js","./interaction/Translate.js":"../../../node_modules/ol/interaction/Translate.js"}],"../../../node_modules/ol/Map.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Composite = _interopRequireDefault(require("./renderer/Composite.js")); + +var _PluggableMap = _interopRequireDefault(require("./PluggableMap.js")); + +var _obj = require("./obj.js"); + +var _control = require("./control.js"); + +var _interaction = require("./interaction.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/Map + */ + + +/** + * @classdesc + * The map is the core component of OpenLayers. For a map to render, a view, + * one or more layers, and a target container are needed: + * + * import Map from 'ol/Map'; + * import View from 'ol/View'; + * import TileLayer from 'ol/layer/Tile'; + * import OSM from 'ol/source/OSM'; + * + * var map = new Map({ + * view: new View({ + * center: [0, 0], + * zoom: 1 + * }), + * layers: [ + * new TileLayer({ + * source: new OSM() + * }) + * ], + * target: 'map' + * }); + * + * The above snippet creates a map using a {@link module:ol/layer/Tile} to + * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM + * element with the id `map`. + * + * The constructor places a viewport container (with CSS class name + * `ol-viewport`) in the target element (see `getViewport()`), and then two + * further elements within the viewport: one with CSS class name + * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with + * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent` + * option of {@link module:ol/Overlay~Overlay} for the difference). The map + * itself is placed in a further element within the viewport. + * + * Layers are stored as a {@link module:ol/Collection~Collection} in + * layerGroups. A top-level group is provided by the library. This is what is + * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the + * options are added to this group, and `addLayer` and `removeLayer` change the + * layer collection in the group. `getLayers` is a convenience function for + * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~Group} + * is a subclass of {@link module:ol/layer/Base}, so layers entered in the + * options or added with `addLayer` can be groups, which can contain further + * groups, and so on. + * + * @api + */ +var Map = +/** @class */ +function (_super) { + __extends(Map, _super); + /** + * @param {import("./PluggableMap.js").MapOptions} options Map options. + */ + + + function Map(options) { + var _this = this; + + options = (0, _obj.assign)({}, options); + + if (!options.controls) { + options.controls = (0, _control.defaults)(); + } + + if (!options.interactions) { + options.interactions = (0, _interaction.defaults)({ + onFocusOnly: true + }); + } + + _this = _super.call(this, options) || this; + return _this; + } + + Map.prototype.createRenderer = function () { + return new _Composite.default(this); + }; + + return Map; +}(_PluggableMap.default); + +var _default = Map; +exports.default = _default; +},{"./renderer/Composite.js":"../../../node_modules/ol/renderer/Composite.js","./PluggableMap.js":"../../../node_modules/ol/PluggableMap.js","./obj.js":"../../../node_modules/ol/obj.js","./control.js":"../../../node_modules/ol/control.js","./interaction.js":"../../../node_modules/ol/interaction.js"}],"../../../node_modules/ol/structs/LRUCache.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _asserts = require("../asserts.js"); + +/** + * @module ol/structs/LRUCache + */ + +/** + * @typedef {Object} Entry + * @property {string} key_ + * @property {Object} newer + * @property {Object} older + * @property {*} value_ + */ + +/** + * @classdesc + * Implements a Least-Recently-Used cache where the keys do not conflict with + * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring + * items from the cache is the responsibility of the user. + * + * @fires import("../events/Event.js").default + * @template T + */ +var LRUCache = +/** @class */ +function () { + /** + * @param {number=} opt_highWaterMark High water mark. + */ + function LRUCache(opt_highWaterMark) { + /** + * Desired max cache size after expireCache(). If set to 0, no cache entries + * will be pruned at all. + * @type {number} + */ + this.highWaterMark = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048; + /** + * @private + * @type {number} + */ + + this.count_ = 0; + /** + * @private + * @type {!Object<string, Entry>} + */ + + this.entries_ = {}; + /** + * @private + * @type {?Entry} + */ + + this.oldest_ = null; + /** + * @private + * @type {?Entry} + */ + + this.newest_ = null; + } + /** + * @return {boolean} Can expire cache. + */ + + + LRUCache.prototype.canExpireCache = function () { + return this.highWaterMark > 0 && this.getCount() > this.highWaterMark; + }; + /** + * FIXME empty description for jsdoc + */ + + + LRUCache.prototype.clear = function () { + this.count_ = 0; + this.entries_ = {}; + this.oldest_ = null; + this.newest_ = null; + }; + /** + * @param {string} key Key. + * @return {boolean} Contains key. + */ + + + LRUCache.prototype.containsKey = function (key) { + return this.entries_.hasOwnProperty(key); + }; + /** + * @param {function(T, string, LRUCache<T>): ?} f The function + * to call for every entry from the oldest to the newer. This function takes + * 3 arguments (the entry value, the entry key and the LRUCache object). + * The return value is ignored. + */ + + + LRUCache.prototype.forEach = function (f) { + var entry = this.oldest_; + + while (entry) { + f(entry.value_, entry.key_, this); + entry = entry.newer; + } + }; + /** + * @param {string} key Key. + * @param {*=} opt_options Options (reserverd for subclasses). + * @return {T} Value. + */ + + + LRUCache.prototype.get = function (key, opt_options) { + var entry = this.entries_[key]; + (0, _asserts.assert)(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache + + if (entry === this.newest_) { + return entry.value_; + } else if (entry === this.oldest_) { + this.oldest_ = + /** @type {Entry} */ + this.oldest_.newer; + this.oldest_.older = null; + } else { + entry.newer.older = entry.older; + entry.older.newer = entry.newer; + } + + entry.newer = null; + entry.older = this.newest_; + this.newest_.newer = entry; + this.newest_ = entry; + return entry.value_; + }; + /** + * Remove an entry from the cache. + * @param {string} key The entry key. + * @return {T} The removed entry. + */ + + + LRUCache.prototype.remove = function (key) { + var entry = this.entries_[key]; + (0, _asserts.assert)(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache + + if (entry === this.newest_) { + this.newest_ = + /** @type {Entry} */ + entry.older; + + if (this.newest_) { + this.newest_.newer = null; + } + } else if (entry === this.oldest_) { + this.oldest_ = + /** @type {Entry} */ + entry.newer; + + if (this.oldest_) { + this.oldest_.older = null; + } + } else { + entry.newer.older = entry.older; + entry.older.newer = entry.newer; + } + + delete this.entries_[key]; + --this.count_; + return entry.value_; + }; + /** + * @return {number} Count. + */ + + + LRUCache.prototype.getCount = function () { + return this.count_; + }; + /** + * @return {Array<string>} Keys. + */ + + + LRUCache.prototype.getKeys = function () { + var keys = new Array(this.count_); + var i = 0; + var entry; + + for (entry = this.newest_; entry; entry = entry.older) { + keys[i++] = entry.key_; + } + + return keys; + }; + /** + * @return {Array<T>} Values. + */ + + + LRUCache.prototype.getValues = function () { + var values = new Array(this.count_); + var i = 0; + var entry; + + for (entry = this.newest_; entry; entry = entry.older) { + values[i++] = entry.value_; + } + + return values; + }; + /** + * @return {T} Last value. + */ + + + LRUCache.prototype.peekLast = function () { + return this.oldest_.value_; + }; + /** + * @return {string} Last key. + */ + + + LRUCache.prototype.peekLastKey = function () { + return this.oldest_.key_; + }; + /** + * Get the key of the newest item in the cache. Throws if the cache is empty. + * @return {string} The newest key. + */ + + + LRUCache.prototype.peekFirstKey = function () { + return this.newest_.key_; + }; + /** + * @return {T} value Value. + */ + + + LRUCache.prototype.pop = function () { + var entry = this.oldest_; + delete this.entries_[entry.key_]; + + if (entry.newer) { + entry.newer.older = null; + } + + this.oldest_ = + /** @type {Entry} */ + entry.newer; + + if (!this.oldest_) { + this.newest_ = null; + } + + --this.count_; + return entry.value_; + }; + /** + * @param {string} key Key. + * @param {T} value Value. + */ + + + LRUCache.prototype.replace = function (key, value) { + this.get(key); // update `newest_` + + this.entries_[key].value_ = value; + }; + /** + * @param {string} key Key. + * @param {T} value Value. + */ + + + LRUCache.prototype.set = function (key, value) { + (0, _asserts.assert)(!(key in this.entries_), 16); // Tried to set a value for a key that is used already + + var entry = { + key_: key, + newer: null, + older: this.newest_, + value_: value + }; + + if (!this.newest_) { + this.oldest_ = entry; + } else { + this.newest_.newer = entry; + } + + this.newest_ = entry; + this.entries_[key] = entry; + ++this.count_; + }; + /** + * Set a maximum number of entries for the cache. + * @param {number} size Cache size. + * @api + */ + + + LRUCache.prototype.setSize = function (size) { + this.highWaterMark = size; + }; + + return LRUCache; +}(); + +var _default = LRUCache; +exports.default = _default; +},{"../asserts.js":"../../../node_modules/ol/asserts.js"}],"../../../node_modules/ol/tilecoord.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createOrUpdate = createOrUpdate; +exports.getKeyZXY = getKeyZXY; +exports.getKey = getKey; +exports.fromKey = fromKey; +exports.hash = hash; +exports.withinExtentAndZ = withinExtentAndZ; + +/** + * @module ol/tilecoord + */ + +/** + * An array of three numbers representing the location of a tile in a tile + * grid. The order is `z` (zoom level), `x` (column), and `y` (row). + * @typedef {Array<number>} TileCoord + * @api + */ + +/** + * @param {number} z Z. + * @param {number} x X. + * @param {number} y Y. + * @param {TileCoord=} opt_tileCoord Tile coordinate. + * @return {TileCoord} Tile coordinate. + */ +function createOrUpdate(z, x, y, opt_tileCoord) { + if (opt_tileCoord !== undefined) { + opt_tileCoord[0] = z; + opt_tileCoord[1] = x; + opt_tileCoord[2] = y; + return opt_tileCoord; + } else { + return [z, x, y]; + } +} +/** + * @param {number} z Z. + * @param {number} x X. + * @param {number} y Y. + * @return {string} Key. + */ + + +function getKeyZXY(z, x, y) { + return z + '/' + x + '/' + y; +} +/** + * Get the key for a tile coord. + * @param {TileCoord} tileCoord The tile coord. + * @return {string} Key. + */ + + +function getKey(tileCoord) { + return getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]); +} +/** + * Get a tile coord given a key. + * @param {string} key The tile coord key. + * @return {TileCoord} The tile coord. + */ + + +function fromKey(key) { + return key.split('/').map(Number); +} +/** + * @param {TileCoord} tileCoord Tile coord. + * @return {number} Hash. + */ + + +function hash(tileCoord) { + return (tileCoord[1] << tileCoord[0]) + tileCoord[2]; +} +/** + * @param {TileCoord} tileCoord Tile coordinate. + * @param {!import("./tilegrid/TileGrid.js").default} tileGrid Tile grid. + * @return {boolean} Tile coordinate is within extent and zoom level range. + */ + + +function withinExtentAndZ(tileCoord, tileGrid) { + var z = tileCoord[0]; + var x = tileCoord[1]; + var y = tileCoord[2]; + + if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) { + return false; + } + + var extent = tileGrid.getExtent(); + var tileRange; + + if (!extent) { + tileRange = tileGrid.getFullTileRange(z); + } else { + tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); + } + + if (!tileRange) { + return true; + } else { + return tileRange.containsXY(x, y); + } +} +},{}],"../../../node_modules/ol/TileCache.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _LRUCache = _interopRequireDefault(require("./structs/LRUCache.js")); + +var _tilecoord = require("./tilecoord.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/TileCache + */ + + +var TileCache = +/** @class */ +function (_super) { + __extends(TileCache, _super); + + function TileCache() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * @param {!Object<string, boolean>} usedTiles Used tiles. + */ + + + TileCache.prototype.expireCache = function (usedTiles) { + while (this.canExpireCache()) { + var tile = this.peekLast(); + + if (tile.getKey() in usedTiles) { + break; + } else { + this.pop().release(); + } + } + }; + /** + * Prune all tiles from the cache that don't have the same z as the newest tile. + */ + + + TileCache.prototype.pruneExceptNewestZ = function () { + if (this.getCount() === 0) { + return; + } + + var key = this.peekFirstKey(); + var tileCoord = (0, _tilecoord.fromKey)(key); + var z = tileCoord[0]; + this.forEach(function (tile) { + if (tile.tileCoord[0] !== z) { + this.remove((0, _tilecoord.getKey)(tile.tileCoord)); + tile.release(); + } + }.bind(this)); + }; + + return TileCache; +}(_LRUCache.default); + +var _default = TileCache; +exports.default = _default; +},{"./structs/LRUCache.js":"../../../node_modules/ol/structs/LRUCache.js","./tilecoord.js":"../../../node_modules/ol/tilecoord.js"}],"../../../node_modules/ol/TileRange.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createOrUpdate = createOrUpdate; +exports.default = void 0; + +/** + * @module ol/TileRange + */ + +/** + * A representation of a contiguous block of tiles. A tile range is specified + * by its min/max tile coordinates and is inclusive of coordinates. + */ +var TileRange = +/** @class */ +function () { + /** + * @param {number} minX Minimum X. + * @param {number} maxX Maximum X. + * @param {number} minY Minimum Y. + * @param {number} maxY Maximum Y. + */ + function TileRange(minX, maxX, minY, maxY) { + /** + * @type {number} + */ + this.minX = minX; + /** + * @type {number} + */ + + this.maxX = maxX; + /** + * @type {number} + */ + + this.minY = minY; + /** + * @type {number} + */ + + this.maxY = maxY; + } + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @return {boolean} Contains tile coordinate. + */ + + + TileRange.prototype.contains = function (tileCoord) { + return this.containsXY(tileCoord[1], tileCoord[2]); + }; + /** + * @param {TileRange} tileRange Tile range. + * @return {boolean} Contains. + */ + + + TileRange.prototype.containsTileRange = function (tileRange) { + return this.minX <= tileRange.minX && tileRange.maxX <= this.maxX && this.minY <= tileRange.minY && tileRange.maxY <= this.maxY; + }; + /** + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @return {boolean} Contains coordinate. + */ + + + TileRange.prototype.containsXY = function (x, y) { + return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY; + }; + /** + * @param {TileRange} tileRange Tile range. + * @return {boolean} Equals. + */ + + + TileRange.prototype.equals = function (tileRange) { + return this.minX == tileRange.minX && this.minY == tileRange.minY && this.maxX == tileRange.maxX && this.maxY == tileRange.maxY; + }; + /** + * @param {TileRange} tileRange Tile range. + */ + + + TileRange.prototype.extend = function (tileRange) { + if (tileRange.minX < this.minX) { + this.minX = tileRange.minX; + } + + if (tileRange.maxX > this.maxX) { + this.maxX = tileRange.maxX; + } + + if (tileRange.minY < this.minY) { + this.minY = tileRange.minY; + } + + if (tileRange.maxY > this.maxY) { + this.maxY = tileRange.maxY; + } + }; + /** + * @return {number} Height. + */ + + + TileRange.prototype.getHeight = function () { + return this.maxY - this.minY + 1; + }; + /** + * @return {import("./size.js").Size} Size. + */ + + + TileRange.prototype.getSize = function () { + return [this.getWidth(), this.getHeight()]; + }; + /** + * @return {number} Width. + */ + + + TileRange.prototype.getWidth = function () { + return this.maxX - this.minX + 1; + }; + /** + * @param {TileRange} tileRange Tile range. + * @return {boolean} Intersects. + */ + + + TileRange.prototype.intersects = function (tileRange) { + return this.minX <= tileRange.maxX && this.maxX >= tileRange.minX && this.minY <= tileRange.maxY && this.maxY >= tileRange.minY; + }; + + return TileRange; +}(); +/** + * @param {number} minX Minimum X. + * @param {number} maxX Maximum X. + * @param {number} minY Minimum Y. + * @param {number} maxY Maximum Y. + * @param {TileRange=} tileRange TileRange. + * @return {TileRange} Tile range. + */ + + +function createOrUpdate(minX, maxX, minY, maxY, tileRange) { + if (tileRange !== undefined) { + tileRange.minX = minX; + tileRange.maxX = maxX; + tileRange.minY = minY; + tileRange.maxY = maxY; + return tileRange; + } else { + return new TileRange(minX, maxX, minY, maxY); + } +} + +var _default = TileRange; +exports.default = _default; +},{}],"../../../node_modules/ol/VectorRenderTile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Tile = _interopRequireDefault(require("./Tile.js")); + +var _dom = require("./dom.js"); + +var _util = require("./util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/VectorRenderTile + */ + + +/** + * @typedef {Object} ReplayState + * @property {boolean} dirty + * @property {null|import("./render.js").OrderFunction} renderedRenderOrder + * @property {number} renderedTileRevision + * @property {number} renderedResolution + * @property {number} renderedRevision + * @property {number} renderedZ + * @property {number} renderedTileResolution + * @property {number} renderedTileZ + */ + +/** + * @type {Array<HTMLCanvasElement>} + */ +var canvasPool = []; + +var VectorRenderTile = +/** @class */ +function (_super) { + __extends(VectorRenderTile, _super); + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./TileState.js").default} state State. + * @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls. + * @param {function(VectorRenderTile):Array<import("./VectorTile").default>} getSourceTiles Function + * to get source tiles for this tile. + */ + + + function VectorRenderTile(tileCoord, state, urlTileCoord, getSourceTiles) { + var _this = _super.call(this, tileCoord, state, { + transition: 0 + }) || this; + /** + * @private + * @type {!Object<string, CanvasRenderingContext2D>} + */ + + + _this.context_ = {}; + /** + * Executor groups by layer uid. Entries are read/written by the renderer. + * @type {Object<string, Array<import("./render/canvas/ExecutorGroup.js").default>>} + */ + + _this.executorGroups = {}; + /** + * Number of loading source tiles. Read/written by the source. + * @type {number} + */ + + _this.loadingSourceTiles = 0; + /** + * Tile keys of error source tiles. Read/written by the source. + * @type {Object<string, boolean>} + */ + + _this.errorSourceTileKeys = {}; + /** + * @type {Object<number, ImageData>} + */ + + _this.hitDetectionImageData = {}; + /** + * @private + * @type {!Object<string, ReplayState>} + */ + + _this.replayState_ = {}; + /** + * @type {Array<import("./VectorTile.js").default>} + */ + + _this.sourceTiles = null; + /** + * @type {number} + */ + + _this.wantedResolution; + /** + * @type {!function():Array<import("./VectorTile.js").default>} + */ + + _this.getSourceTiles = getSourceTiles.bind(undefined, _this); + /** + * z of the source tiles of the last getSourceTiles call. + * @type {number} + */ + + _this.sourceZ = -1; + /** + * True when all tiles for this tile's nominal resolution are available. + * @type {boolean} + */ + + _this.hifi = false; + /** + * @type {import("./tilecoord.js").TileCoord} + */ + + _this.wrappedTileCoord = urlTileCoord; + return _this; + } + /** + * @param {import("./layer/Layer.js").default} layer Layer. + * @return {CanvasRenderingContext2D} The rendering context. + */ + + + VectorRenderTile.prototype.getContext = function (layer) { + var key = (0, _util.getUid)(layer); + + if (!(key in this.context_)) { + this.context_[key] = (0, _dom.createCanvasContext2D)(1, 1, canvasPool); + } + + return this.context_[key]; + }; + /** + * @param {import("./layer/Layer.js").default} layer Layer. + * @return {boolean} Tile has a rendering context for the given layer. + */ + + + VectorRenderTile.prototype.hasContext = function (layer) { + return (0, _util.getUid)(layer) in this.context_; + }; + /** + * Get the Canvas for this tile. + * @param {import("./layer/Layer.js").default} layer Layer. + * @return {HTMLCanvasElement} Canvas. + */ + + + VectorRenderTile.prototype.getImage = function (layer) { + return this.hasContext(layer) ? this.getContext(layer).canvas : null; + }; + /** + * @param {import("./layer/Layer.js").default} layer Layer. + * @return {ReplayState} The replay state. + */ + + + VectorRenderTile.prototype.getReplayState = function (layer) { + var key = (0, _util.getUid)(layer); + + if (!(key in this.replayState_)) { + this.replayState_[key] = { + dirty: false, + renderedRenderOrder: null, + renderedResolution: NaN, + renderedRevision: -1, + renderedTileResolution: NaN, + renderedTileRevision: -1, + renderedZ: -1, + renderedTileZ: -1 + }; + } + + return this.replayState_[key]; + }; + /** + * Load the tile. + */ + + + VectorRenderTile.prototype.load = function () { + this.getSourceTiles(); + }; + /** + * Remove from the cache due to expiry + */ + + + VectorRenderTile.prototype.release = function () { + for (var key in this.context_) { + canvasPool.push(this.context_[key].canvas); + } + + _super.prototype.release.call(this); + }; + + return VectorRenderTile; +}(_Tile.default); + +var _default = VectorRenderTile; +exports.default = _default; +},{"./Tile.js":"../../../node_modules/ol/Tile.js","./dom.js":"../../../node_modules/ol/dom.js","./util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/VectorTile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Tile = _interopRequireDefault(require("./Tile.js")); + +var _TileState = _interopRequireDefault(require("./TileState.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/VectorTile + */ + + +var VectorTile = +/** @class */ +function (_super) { + __extends(VectorTile, _super); + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./TileState.js").default} state State. + * @param {string} src Data source url. + * @param {import("./format/Feature.js").default} format Feature format. + * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function. + * @param {import("./Tile.js").Options=} opt_options Tile options. + */ + + + function VectorTile(tileCoord, state, src, format, tileLoadFunction, opt_options) { + var _this = _super.call(this, tileCoord, state, opt_options) || this; + /** + * Extent of this tile; set by the source. + * @type {import("./extent.js").Extent} + */ + + + _this.extent = null; + /** + * @private + * @type {import("./format/Feature.js").default} + */ + + _this.format_ = format; + /** + * @private + * @type {Array<import("./Feature.js").default>} + */ + + _this.features_ = null; + /** + * @private + * @type {import("./featureloader.js").FeatureLoader} + */ + + _this.loader_; + /** + * Feature projection of this tile; set by the source. + * @type {import("./proj/Projection.js").default} + */ + + _this.projection = null; + /** + * Resolution of this tile; set by the source. + * @type {number} + */ + + _this.resolution; + /** + * @private + * @type {import("./Tile.js").LoadFunction} + */ + + _this.tileLoadFunction_ = tileLoadFunction; + /** + * @private + * @type {string} + */ + + _this.url_ = src; + return _this; + } + /** + * Get the feature format assigned for reading this tile's features. + * @return {import("./format/Feature.js").default} Feature format. + * @api + */ + + + VectorTile.prototype.getFormat = function () { + return this.format_; + }; + /** + * Get the features for this tile. Geometries will be in the view projection. + * @return {Array<import("./Feature.js").FeatureLike>} Features. + * @api + */ + + + VectorTile.prototype.getFeatures = function () { + return this.features_; + }; + /** + * @return {string} Key. + */ + + + VectorTile.prototype.getKey = function () { + return this.url_; + }; + /** + * Load not yet loaded URI. + */ + + + VectorTile.prototype.load = function () { + if (this.state == _TileState.default.IDLE) { + this.setState(_TileState.default.LOADING); + this.tileLoadFunction_(this, this.url_); + + if (this.loader_) { + this.loader_(this.extent, this.resolution, this.projection); + } + } + }; + /** + * Handler for successful tile load. + * @param {Array<import("./Feature.js").default>} features The loaded features. + * @param {import("./proj/Projection.js").default} dataProjection Data projection. + */ + + + VectorTile.prototype.onLoad = function (features, dataProjection) { + this.setFeatures(features); + }; + /** + * Handler for tile load errors. + */ + + + VectorTile.prototype.onError = function () { + this.setState(_TileState.default.ERROR); + }; + /** + * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`. + * Sets the features for the tile. + * @param {Array<import("./Feature.js").default>} features Features. + * @api + */ + + + VectorTile.prototype.setFeatures = function (features) { + this.features_ = features; + this.setState(_TileState.default.LOADED); + }; + /** + * Set the feature loader for reading this tile's features. + * @param {import("./featureloader.js").FeatureLoader} loader Feature loader. + * @api + */ + + + VectorTile.prototype.setLoader = function (loader) { + this.loader_ = loader; + }; + + return VectorTile; +}(_Tile.default); + +var _default = VectorTile; +exports.default = _default; +},{"./Tile.js":"../../../node_modules/ol/Tile.js","./TileState.js":"../../../node_modules/ol/TileState.js"}],"../../../node_modules/ol/index.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "AssertionError", { + enumerable: true, + get: function () { + return _AssertionError.default; + } +}); +Object.defineProperty(exports, "Collection", { + enumerable: true, + get: function () { + return _Collection.default; + } +}); +Object.defineProperty(exports, "Disposable", { + enumerable: true, + get: function () { + return _Disposable.default; + } +}); +Object.defineProperty(exports, "Feature", { + enumerable: true, + get: function () { + return _Feature.default; + } +}); +Object.defineProperty(exports, "Geolocation", { + enumerable: true, + get: function () { + return _Geolocation.default; + } +}); +Object.defineProperty(exports, "Graticule", { + enumerable: true, + get: function () { + return _Graticule.default; + } +}); +Object.defineProperty(exports, "Image", { + enumerable: true, + get: function () { + return _Image.default; + } +}); +Object.defineProperty(exports, "ImageBase", { + enumerable: true, + get: function () { + return _ImageBase.default; + } +}); +Object.defineProperty(exports, "ImageCanvas", { + enumerable: true, + get: function () { + return _ImageCanvas.default; + } +}); +Object.defineProperty(exports, "ImageTile", { + enumerable: true, + get: function () { + return _ImageTile.default; + } +}); +Object.defineProperty(exports, "Kinetic", { + enumerable: true, + get: function () { + return _Kinetic.default; + } +}); +Object.defineProperty(exports, "Map", { + enumerable: true, + get: function () { + return _Map.default; + } +}); +Object.defineProperty(exports, "MapBrowserEvent", { + enumerable: true, + get: function () { + return _MapBrowserEvent.default; + } +}); +Object.defineProperty(exports, "MapBrowserEventHandler", { + enumerable: true, + get: function () { + return _MapBrowserEventHandler.default; + } +}); +Object.defineProperty(exports, "MapEvent", { + enumerable: true, + get: function () { + return _MapEvent.default; + } +}); +Object.defineProperty(exports, "Object", { + enumerable: true, + get: function () { + return _Object.default; + } +}); +Object.defineProperty(exports, "Observable", { + enumerable: true, + get: function () { + return _Observable.default; + } +}); +Object.defineProperty(exports, "Overlay", { + enumerable: true, + get: function () { + return _Overlay.default; + } +}); +Object.defineProperty(exports, "PluggableMap", { + enumerable: true, + get: function () { + return _PluggableMap.default; + } +}); +Object.defineProperty(exports, "Tile", { + enumerable: true, + get: function () { + return _Tile.default; + } +}); +Object.defineProperty(exports, "TileCache", { + enumerable: true, + get: function () { + return _TileCache.default; + } +}); +Object.defineProperty(exports, "TileQueue", { + enumerable: true, + get: function () { + return _TileQueue.default; + } +}); +Object.defineProperty(exports, "TileRange", { + enumerable: true, + get: function () { + return _TileRange.default; + } +}); +Object.defineProperty(exports, "VectorRenderTile", { + enumerable: true, + get: function () { + return _VectorRenderTile.default; + } +}); +Object.defineProperty(exports, "VectorTile", { + enumerable: true, + get: function () { + return _VectorTile.default; + } +}); +Object.defineProperty(exports, "View", { + enumerable: true, + get: function () { + return _View.default; + } +}); +Object.defineProperty(exports, "getUid", { + enumerable: true, + get: function () { + return _util.getUid; + } +}); +Object.defineProperty(exports, "VERSION", { + enumerable: true, + get: function () { + return _util.VERSION; + } +}); + +var _AssertionError = _interopRequireDefault(require("./AssertionError.js")); + +var _Collection = _interopRequireDefault(require("./Collection.js")); + +var _Disposable = _interopRequireDefault(require("./Disposable.js")); + +var _Feature = _interopRequireDefault(require("./Feature.js")); + +var _Geolocation = _interopRequireDefault(require("./Geolocation.js")); + +var _Graticule = _interopRequireDefault(require("./layer/Graticule.js")); + +var _Image = _interopRequireDefault(require("./Image.js")); + +var _ImageBase = _interopRequireDefault(require("./ImageBase.js")); + +var _ImageCanvas = _interopRequireDefault(require("./ImageCanvas.js")); + +var _ImageTile = _interopRequireDefault(require("./ImageTile.js")); + +var _Kinetic = _interopRequireDefault(require("./Kinetic.js")); + +var _Map = _interopRequireDefault(require("./Map.js")); + +var _MapBrowserEvent = _interopRequireDefault(require("./MapBrowserEvent.js")); + +var _MapBrowserEventHandler = _interopRequireDefault(require("./MapBrowserEventHandler.js")); + +var _MapEvent = _interopRequireDefault(require("./MapEvent.js")); + +var _Object = _interopRequireDefault(require("./Object.js")); + +var _Observable = _interopRequireDefault(require("./Observable.js")); + +var _Overlay = _interopRequireDefault(require("./Overlay.js")); + +var _PluggableMap = _interopRequireDefault(require("./PluggableMap.js")); + +var _Tile = _interopRequireDefault(require("./Tile.js")); + +var _TileCache = _interopRequireDefault(require("./TileCache.js")); + +var _TileQueue = _interopRequireDefault(require("./TileQueue.js")); + +var _TileRange = _interopRequireDefault(require("./TileRange.js")); + +var _VectorRenderTile = _interopRequireDefault(require("./VectorRenderTile.js")); + +var _VectorTile = _interopRequireDefault(require("./VectorTile.js")); + +var _View = _interopRequireDefault(require("./View.js")); + +var _util = require("./util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +},{"./AssertionError.js":"../../../node_modules/ol/AssertionError.js","./Collection.js":"../../../node_modules/ol/Collection.js","./Disposable.js":"../../../node_modules/ol/Disposable.js","./Feature.js":"../../../node_modules/ol/Feature.js","./Geolocation.js":"../../../node_modules/ol/Geolocation.js","./layer/Graticule.js":"../../../node_modules/ol/layer/Graticule.js","./Image.js":"../../../node_modules/ol/Image.js","./ImageBase.js":"../../../node_modules/ol/ImageBase.js","./ImageCanvas.js":"../../../node_modules/ol/ImageCanvas.js","./ImageTile.js":"../../../node_modules/ol/ImageTile.js","./Kinetic.js":"../../../node_modules/ol/Kinetic.js","./Map.js":"../../../node_modules/ol/Map.js","./MapBrowserEvent.js":"../../../node_modules/ol/MapBrowserEvent.js","./MapBrowserEventHandler.js":"../../../node_modules/ol/MapBrowserEventHandler.js","./MapEvent.js":"../../../node_modules/ol/MapEvent.js","./Object.js":"../../../node_modules/ol/Object.js","./Observable.js":"../../../node_modules/ol/Observable.js","./Overlay.js":"../../../node_modules/ol/Overlay.js","./PluggableMap.js":"../../../node_modules/ol/PluggableMap.js","./Tile.js":"../../../node_modules/ol/Tile.js","./TileCache.js":"../../../node_modules/ol/TileCache.js","./TileQueue.js":"../../../node_modules/ol/TileQueue.js","./TileRange.js":"../../../node_modules/ol/TileRange.js","./VectorRenderTile.js":"../../../node_modules/ol/VectorRenderTile.js","./VectorTile.js":"../../../node_modules/ol/VectorTile.js","./View.js":"../../../node_modules/ol/View.js","./util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/layer/TileProperty.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/layer/TileProperty + */ + +/** + * @enum {string} + */ +var _default = { + PRELOAD: 'preload', + USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/layer/BaseTile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Layer = _interopRequireDefault(require("./Layer.js")); + +var _TileProperty = _interopRequireDefault(require("./TileProperty.js")); + +var _obj = require("../obj.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/BaseTile + */ + + +/** + * @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 {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0` + * means no preloading. + * @property {import("../source/Tile.js").default} [source] Source for this layer. + * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage + * this layer in its layers collection, and the layer will be rendered on top. This is useful for + * temporary layers. The standard way to add a layer to a map and have it managed by the map is to + * use {@link module:ol/Map#addLayer}. + * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error. + */ + +/** + * @classdesc + * For layer sources that provide pre-rendered, tiled images in grids that are + * organized by zoom levels for specific resolutions. + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} + * property on the layer object; for example, setting `title: 'My Title'` in the + * options means that `title` is observable, and has get/set accessors. + * + * @extends {Layer<import("../source/Tile.js").default>} + * @api + */ +var BaseTileLayer = +/** @class */ +function (_super) { + __extends(BaseTileLayer, _super); + /** + * @param {Options=} opt_options Tile layer options. + */ + + + function BaseTileLayer(opt_options) { + var _this = this; + + var options = opt_options ? opt_options : {}; + var baseOptions = (0, _obj.assign)({}, options); + delete baseOptions.preload; + delete baseOptions.useInterimTilesOnError; + _this = _super.call(this, baseOptions) || this; + + _this.setPreload(options.preload !== undefined ? options.preload : 0); + + _this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ? options.useInterimTilesOnError : true); + + return _this; + } + /** + * Return the level as number to which we will preload tiles up to. + * @return {number} The level to preload tiles up to. + * @observable + * @api + */ + + + BaseTileLayer.prototype.getPreload = function () { + return ( + /** @type {number} */ + this.get(_TileProperty.default.PRELOAD) + ); + }; + /** + * Set the level as number to which we will preload tiles up to. + * @param {number} preload The level to preload tiles up to. + * @observable + * @api + */ + + + BaseTileLayer.prototype.setPreload = function (preload) { + this.set(_TileProperty.default.PRELOAD, preload); + }; + /** + * Whether we use interim tiles on error. + * @return {boolean} Use interim tiles on error. + * @observable + * @api + */ + + + BaseTileLayer.prototype.getUseInterimTilesOnError = function () { + return ( + /** @type {boolean} */ + this.get(_TileProperty.default.USE_INTERIM_TILES_ON_ERROR) + ); + }; + /** + * Set whether we use interim tiles on error. + * @param {boolean} useInterimTilesOnError Use interim tiles on error. + * @observable + * @api + */ + + + BaseTileLayer.prototype.setUseInterimTilesOnError = function (useInterimTilesOnError) { + this.set(_TileProperty.default.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); + }; + + return BaseTileLayer; +}(_Layer.default); + +var _default = BaseTileLayer; +exports.default = _default; +},{"./Layer.js":"../../../node_modules/ol/layer/Layer.js","./TileProperty.js":"../../../node_modules/ol/layer/TileProperty.js","../obj.js":"../../../node_modules/ol/obj.js"}],"../../../node_modules/ol/renderer/canvas/TileLayer.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _Layer = _interopRequireDefault(require("./Layer.js")); + +var _TileRange = _interopRequireDefault(require("../../TileRange.js")); + +var _TileState = _interopRequireDefault(require("../../TileState.js")); + +var _transform = require("../../transform.js"); + +var _obj = require("../../obj.js"); + +var _extent = require("../../extent.js"); + +var _canvas = require("../../render/canvas.js"); + +var _proj = require("../../proj.js"); + +var _util = require("../../util.js"); + +var _array = require("../../array.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/renderer/canvas/TileLayer + */ + + +/** + * @classdesc + * Canvas renderer for tile layers. + * @api + */ +var CanvasTileLayerRenderer = +/** @class */ +function (_super) { + __extends(CanvasTileLayerRenderer, _super); + /** + * @param {import("../../layer/Tile.js").default|import("../../layer/VectorTile.js").default} tileLayer Tile layer. + */ + + + function CanvasTileLayerRenderer(tileLayer) { + var _this = _super.call(this, tileLayer) || this; + /** + * Rendered extent has changed since the previous `renderFrame()` call + * @type {boolean} + */ + + + _this.extentChanged = true; + /** + * @private + * @type {?import("../../extent.js").Extent} + */ + + _this.renderedExtent_ = null; + /** + * @protected + * @type {number} + */ + + _this.renderedPixelRatio; + /** + * @protected + * @type {import("../../proj/Projection.js").default} + */ + + _this.renderedProjection = null; + /** + * @protected + * @type {number} + */ + + _this.renderedRevision; + /** + * @protected + * @type {!Array<import("../../Tile.js").default>} + */ + + _this.renderedTiles = []; + /** + * @private + * @type {boolean} + */ + + _this.newTiles_ = false; + /** + * @protected + * @type {import("../../extent.js").Extent} + */ + + _this.tmpExtent = (0, _extent.createEmpty)(); + /** + * @private + * @type {import("../../TileRange.js").default} + */ + + _this.tmpTileRange_ = new _TileRange.default(0, 0, 0, 0); + return _this; + } + /** + * @protected + * @param {import("../../Tile.js").default} tile Tile. + * @return {boolean} Tile is drawable. + */ + + + CanvasTileLayerRenderer.prototype.isDrawableTile = function (tile) { + var tileLayer = this.getLayer(); + var tileState = tile.getState(); + var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError(); + return tileState == _TileState.default.LOADED || tileState == _TileState.default.EMPTY || tileState == _TileState.default.ERROR && !useInterimTilesOnError; + }; + /** + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {!import("../../Tile.js").default} Tile. + */ + + + CanvasTileLayerRenderer.prototype.getTile = function (z, x, y, frameState) { + var pixelRatio = frameState.pixelRatio; + var projection = frameState.viewState.projection; + var tileLayer = this.getLayer(); + var tileSource = tileLayer.getSource(); + var tile = tileSource.getTile(z, x, y, pixelRatio, projection); + + if (tile.getState() == _TileState.default.ERROR) { + if (!tileLayer.getUseInterimTilesOnError()) { + // When useInterimTilesOnError is false, we consider the error tile as loaded. + tile.setState(_TileState.default.LOADED); + } else if (tileLayer.getPreload() > 0) { + // Preloaded tiles for lower resolutions might have finished loading. + this.newTiles_ = true; + } + } + + if (!this.isDrawableTile(tile)) { + tile = tile.getInterimTile(); + } + + return tile; + }; + /** + * @param {Object<number, Object<string, import("../../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level. + * @param {number} zoom Zoom level. + * @param {import("../../Tile.js").default} tile Tile. + * @return {boolean|void} If `false`, the tile will not be considered loaded. + */ + + + CanvasTileLayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) { + if (this.isDrawableTile(tile)) { + return _super.prototype.loadedTileCallback.call(this, tiles, zoom, tile); + } + + return false; + }; + /** + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. + */ + + + CanvasTileLayerRenderer.prototype.prepareFrame = function (frameState) { + return !!this.getLayer().getSource(); + }; + /** + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. + */ + + + CanvasTileLayerRenderer.prototype.renderFrame = function (frameState, target) { + var layerState = frameState.layerStatesArray[frameState.layerIndex]; + var viewState = frameState.viewState; + var projection = viewState.projection; + var viewResolution = viewState.resolution; + var viewCenter = viewState.center; + var rotation = viewState.rotation; + var pixelRatio = frameState.pixelRatio; + var tileLayer = this.getLayer(); + var tileSource = tileLayer.getSource(); + var sourceRevision = tileSource.getRevision(); + var tileGrid = tileSource.getTileGridForProjection(projection); + var z = tileGrid.getZForResolution(viewResolution, tileSource.zDirection); + var tileResolution = tileGrid.getResolution(z); + var extent = frameState.extent; + var layerExtent = layerState.extent && (0, _proj.fromUserExtent)(layerState.extent, projection); + + if (layerExtent) { + extent = (0, _extent.getIntersection)(extent, (0, _proj.fromUserExtent)(layerState.extent, projection)); + } + + var tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio); // desired dimensions of the canvas in pixels + + var width = Math.round(frameState.size[0] * tilePixelRatio); + var height = Math.round(frameState.size[1] * tilePixelRatio); + + if (rotation) { + var size = Math.round(Math.sqrt(width * width + height * height)); + width = size; + height = size; + } + + var dx = tileResolution * width / 2 / tilePixelRatio; + var dy = tileResolution * height / 2 / tilePixelRatio; + var canvasExtent = [viewCenter[0] - dx, viewCenter[1] - dy, viewCenter[0] + dx, viewCenter[1] + dy]; + var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); + /** + * @type {Object<number, Object<string, import("../../Tile.js").default>>} + */ + + var tilesToDrawByZ = {}; + tilesToDrawByZ[z] = {}; + var findLoadedTiles = this.createLoadedTileFinder(tileSource, projection, tilesToDrawByZ); + var tmpExtent = this.tmpExtent; + var tmpTileRange = this.tmpTileRange_; + this.newTiles_ = false; + + for (var x = tileRange.minX; x <= tileRange.maxX; ++x) { + for (var y = tileRange.minY; y <= tileRange.maxY; ++y) { + var tile = this.getTile(z, x, y, frameState); + + if (this.isDrawableTile(tile)) { + var uid = (0, _util.getUid)(this); + + if (tile.getState() == _TileState.default.LOADED) { + tilesToDrawByZ[z][tile.tileCoord.toString()] = tile; + var inTransition = tile.inTransition(uid); + + if (!this.newTiles_ && (inTransition || this.renderedTiles.indexOf(tile) === -1)) { + this.newTiles_ = true; + } + } + + if (tile.getAlpha(uid, frameState.time) === 1) { + // don't look for alt tiles if alpha is 1 + continue; + } + } + + var childTileRange = tileGrid.getTileCoordChildTileRange(tile.tileCoord, tmpTileRange, tmpExtent); + var covered = false; + + if (childTileRange) { + covered = findLoadedTiles(z + 1, childTileRange); + } + + if (!covered) { + tileGrid.forEachTileCoordParentTileRange(tile.tileCoord, findLoadedTiles, tmpTileRange, tmpExtent); + } + } + } + + var canvasScale = tileResolution / viewResolution; // set forward and inverse pixel transforms + + (0, _transform.compose)(this.pixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / tilePixelRatio, 1 / tilePixelRatio, rotation, -width / 2, -height / 2); + var canvasTransform = (0, _canvas.createTransformString)(this.pixelTransform); + this.useContainer(target, canvasTransform, layerState.opacity); + var context = this.context; + var canvas = context.canvas; + (0, _transform.makeInverse)(this.inversePixelTransform, this.pixelTransform); // set scale transform for calculating tile positions on the canvas + + (0, _transform.compose)(this.tempTransform, width / 2, height / 2, canvasScale, canvasScale, 0, -width / 2, -height / 2); + + if (canvas.width != width || canvas.height != height) { + canvas.width = width; + canvas.height = height; + } else if (!this.containerReused) { + context.clearRect(0, 0, width, height); + } + + if (layerExtent) { + this.clipUnrotated(context, frameState, layerExtent); + } + + (0, _obj.assign)(context, tileSource.getContextOptions()); + this.preRender(context, frameState); + this.renderedTiles.length = 0; + /** @type {Array<number>} */ + + var zs = Object.keys(tilesToDrawByZ).map(Number); + zs.sort(_array.numberSafeCompareFunction); + var clips, clipZs, currentClip; + + if (layerState.opacity === 1 && (!this.containerReused || tileSource.getOpaque(frameState.viewState.projection))) { + zs = zs.reverse(); + } else { + clips = []; + clipZs = []; + } + + for (var i = zs.length - 1; i >= 0; --i) { + var currentZ = zs[i]; + var currentTilePixelSize = tileSource.getTilePixelSize(currentZ, pixelRatio, projection); + var currentResolution = tileGrid.getResolution(currentZ); + var currentScale = currentResolution / tileResolution; + var dx_1 = currentTilePixelSize[0] * currentScale * canvasScale; + var dy_1 = currentTilePixelSize[1] * currentScale * canvasScale; + var originTileCoord = tileGrid.getTileCoordForCoordAndZ((0, _extent.getTopLeft)(canvasExtent), currentZ); + var originTileExtent = tileGrid.getTileCoordExtent(originTileCoord); + var origin_1 = (0, _transform.apply)(this.tempTransform, [tilePixelRatio * (originTileExtent[0] - canvasExtent[0]) / tileResolution, tilePixelRatio * (canvasExtent[3] - originTileExtent[3]) / tileResolution]); + var tileGutter = tilePixelRatio * tileSource.getGutterForProjection(projection); + var tilesToDraw = tilesToDrawByZ[currentZ]; + + for (var tileCoordKey in tilesToDraw) { + var tile = + /** @type {import("../../ImageTile.js").default} */ + tilesToDraw[tileCoordKey]; + var tileCoord = tile.tileCoord; // Calculate integer positions and sizes so that tiles align + + var floatX = origin_1[0] - (originTileCoord[1] - tileCoord[1]) * dx_1; + var nextX = Math.round(floatX + dx_1); + var floatY = origin_1[1] - (originTileCoord[2] - tileCoord[2]) * dy_1; + var nextY = Math.round(floatY + dy_1); + var x = Math.round(floatX); + var y = Math.round(floatY); + var w = nextX - x; + var h = nextY - y; + var transition = z === currentZ; + var inTransition = transition && tile.getAlpha((0, _util.getUid)(this), frameState.time) !== 1; + + if (!inTransition) { + if (clips) { + // Clip mask for regions in this tile that already filled by a higher z tile + context.save(); + currentClip = [x, y, x + w, y, x + w, y + h, x, y + h]; + + for (var i_1 = 0, ii = clips.length; i_1 < ii; ++i_1) { + if (z !== currentZ && currentZ < clipZs[i_1]) { + var clip = clips[i_1]; + context.beginPath(); // counter-clockwise (outer ring) for current tile + + context.moveTo(currentClip[0], currentClip[1]); + context.lineTo(currentClip[2], currentClip[3]); + context.lineTo(currentClip[4], currentClip[5]); + context.lineTo(currentClip[6], currentClip[7]); // clockwise (inner ring) for higher z tile + + context.moveTo(clip[6], clip[7]); + context.lineTo(clip[4], clip[5]); + context.lineTo(clip[2], clip[3]); + context.lineTo(clip[0], clip[1]); + context.clip(); + } + } + + clips.push(currentClip); + clipZs.push(currentZ); + } else { + context.clearRect(x, y, w, h); + } + } + + this.drawTileImage(tile, frameState, x, y, w, h, tileGutter, transition, layerState.opacity); + + if (clips && !inTransition) { + context.restore(); + } + + this.renderedTiles.push(tile); + this.updateUsedTiles(frameState.usedTiles, tileSource, tile); + } + } + + this.renderedRevision = sourceRevision; + this.renderedResolution = tileResolution; + this.extentChanged = !this.renderedExtent_ || !(0, _extent.equals)(this.renderedExtent_, canvasExtent); + this.renderedExtent_ = canvasExtent; + this.renderedPixelRatio = pixelRatio; + this.renderedProjection = projection; + this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio, projection, extent, z, tileLayer.getPreload()); + this.scheduleExpireCache(frameState, tileSource); + this.postRender(context, frameState); + + if (layerState.extent) { + context.restore(); + } + + if (canvasTransform !== canvas.style.transform) { + canvas.style.transform = canvasTransform; + } + + return this.container; + }; + /** + * @param {import("../../ImageTile.js").default} tile Tile. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} x Left of the tile. + * @param {number} y Top of the tile. + * @param {number} w Width of the tile. + * @param {number} h Height of the tile. + * @param {number} gutter Tile gutter. + * @param {boolean} transition Apply an alpha transition. + * @param {number} opacity Opacity. + */ + + + CanvasTileLayerRenderer.prototype.drawTileImage = function (tile, frameState, x, y, w, h, gutter, transition, opacity) { + var image = this.getTileImage(tile); + + if (!image) { + return; + } + + var uid = (0, _util.getUid)(this); + var tileAlpha = transition ? tile.getAlpha(uid, frameState.time) : 1; + var alpha = opacity * tileAlpha; + var alphaChanged = alpha !== this.context.globalAlpha; + + if (alphaChanged) { + this.context.save(); + this.context.globalAlpha = alpha; + } + + this.context.drawImage(image, gutter, gutter, image.width - 2 * gutter, image.height - 2 * gutter, x, y, w, h); + + if (alphaChanged) { + this.context.restore(); + } + + if (tileAlpha !== 1) { + frameState.animate = true; + } else if (transition) { + tile.endTransition(uid); + } + }; + /** + * @return {HTMLCanvasElement} Image + */ + + + CanvasTileLayerRenderer.prototype.getImage = function () { + var context = this.context; + return context ? context.canvas : null; + }; + /** + * Get the image from a tile. + * @param {import("../../ImageTile.js").default} tile Tile. + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. + * @protected + */ + + + CanvasTileLayerRenderer.prototype.getTileImage = function (tile) { + return tile.getImage(); + }; + /** + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @protected + */ + + + CanvasTileLayerRenderer.prototype.scheduleExpireCache = function (frameState, tileSource) { + if (tileSource.canExpireCache()) { + /** + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @param {import("../../PluggableMap.js").default} map Map. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + */ + var postRenderFunction = function (tileSource, map, frameState) { + var tileSourceKey = (0, _util.getUid)(tileSource); + + if (tileSourceKey in frameState.usedTiles) { + tileSource.expireCache(frameState.viewState.projection, frameState.usedTiles[tileSourceKey]); + } + }.bind(null, tileSource); + + frameState.postRenderFunctions.push( + /** @type {import("../../PluggableMap.js").PostRenderFunction} */ + postRenderFunction); + } + }; + /** + * @param {!Object<string, !Object<string, boolean>>} usedTiles Used tiles. + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @param {import('../../Tile.js').default} tile Tile. + * @protected + */ + + + CanvasTileLayerRenderer.prototype.updateUsedTiles = function (usedTiles, tileSource, tile) { + // FIXME should we use tilesToDrawByZ instead? + var tileSourceKey = (0, _util.getUid)(tileSource); + + if (!(tileSourceKey in usedTiles)) { + usedTiles[tileSourceKey] = {}; + } + + usedTiles[tileSourceKey][tile.getKey()] = true; + }; + /** + * Manage tile pyramid. + * This function performs a number of functions related to the tiles at the + * current zoom and lower zoom levels: + * - registers idle tiles in frameState.wantedTiles so that they are not + * discarded by the tile queue + * - enqueues missing tiles + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../source/Tile.js").default} tileSource Tile source. + * @param {import("../../tilegrid/TileGrid.js").default} tileGrid Tile grid. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../../proj/Projection.js").default} projection Projection. + * @param {import("../../extent.js").Extent} extent Extent. + * @param {number} currentZ Current Z. + * @param {number} preload Load low resolution tiles up to 'preload' levels. + * @param {function(import("../../Tile.js").default)=} opt_tileCallback Tile callback. + * @protected + */ + + + CanvasTileLayerRenderer.prototype.manageTilePyramid = function (frameState, tileSource, tileGrid, pixelRatio, projection, extent, currentZ, preload, opt_tileCallback) { + var tileSourceKey = (0, _util.getUid)(tileSource); + + if (!(tileSourceKey in frameState.wantedTiles)) { + frameState.wantedTiles[tileSourceKey] = {}; + } + + var wantedTiles = frameState.wantedTiles[tileSourceKey]; + var tileQueue = frameState.tileQueue; + var minZoom = tileGrid.getMinZoom(); + var tileCount = 0; + var tile, tileRange, tileResolution, x, y, z; + + for (z = minZoom; z <= currentZ; ++z) { + tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z, tileRange); + tileResolution = tileGrid.getResolution(z); + + for (x = tileRange.minX; x <= tileRange.maxX; ++x) { + for (y = tileRange.minY; y <= tileRange.maxY; ++y) { + if (currentZ - z <= preload) { + ++tileCount; + tile = tileSource.getTile(z, x, y, pixelRatio, projection); + + if (tile.getState() == _TileState.default.IDLE) { + wantedTiles[tile.getKey()] = true; + + if (!tileQueue.isKeyQueued(tile.getKey())) { + tileQueue.enqueue([tile, tileSourceKey, tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]); + } + } + + if (opt_tileCallback !== undefined) { + opt_tileCallback(tile); + } + } else { + tileSource.useTile(z, x, y, projection); + } + } + } + } + + tileSource.updateCacheSize(tileCount, projection); + }; + + return CanvasTileLayerRenderer; +}(_Layer.default); +/** + * @function + * @return {import("../../layer/Tile.js").default|import("../../layer/VectorTile.js").default} + */ + + +CanvasTileLayerRenderer.prototype.getLayer; +var _default = CanvasTileLayerRenderer; +exports.default = _default; +},{"./Layer.js":"../../../node_modules/ol/renderer/canvas/Layer.js","../../TileRange.js":"../../../node_modules/ol/TileRange.js","../../TileState.js":"../../../node_modules/ol/TileState.js","../../transform.js":"../../../node_modules/ol/transform.js","../../obj.js":"../../../node_modules/ol/obj.js","../../extent.js":"../../../node_modules/ol/extent.js","../../render/canvas.js":"../../../node_modules/ol/render/canvas.js","../../proj.js":"../../../node_modules/ol/proj.js","../../util.js":"../../../node_modules/ol/util.js","../../array.js":"../../../node_modules/ol/array.js"}],"../../../node_modules/ol/layer/Tile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _BaseTile = _interopRequireDefault(require("./BaseTile.js")); + +var _TileLayer = _interopRequireDefault(require("../renderer/canvas/TileLayer.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/layer/Tile + */ + + +/** + * @classdesc + * For layer sources that provide pre-rendered, tiled images in grids that are + * organized by zoom levels for specific resolutions. + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} + * property on the layer object; for example, setting `title: 'My Title'` in the + * options means that `title` is observable, and has get/set accessors. + * + * @api + */ +var TileLayer = +/** @class */ +function (_super) { + __extends(TileLayer, _super); + /** + * @param {import("./BaseTile.js").Options=} opt_options Tile layer options. + */ + + + function TileLayer(opt_options) { + return _super.call(this, opt_options) || this; + } + /** + * Create a renderer for this layer. + * @return {import("../renderer/Layer.js").default} A layer renderer. + * @protected + */ + + + TileLayer.prototype.createRenderer = function () { + return new _TileLayer.default(this); + }; + + return TileLayer; +}(_BaseTile.default); + +var _default = TileLayer; +exports.default = _default; +},{"./BaseTile.js":"../../../node_modules/ol/layer/BaseTile.js","../renderer/canvas/TileLayer.js":"../../../node_modules/ol/renderer/canvas/TileLayer.js"}],"../../../node_modules/ol/reproj/common.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ENABLE_RASTER_REPROJECTION = exports.ERROR_THRESHOLD = void 0; + +/** + * @module ol/reproj/common + */ + +/** + * Default maximum allowed threshold (in pixels) for reprojection + * triangulation. + * @type {number} + */ +var ERROR_THRESHOLD = 0.5; +/** + * Enable automatic reprojection of raster sources. Default is `true`. + * TODO: decide if we want to expose this as a build flag or remove it + * @type {boolean} + */ + +exports.ERROR_THRESHOLD = ERROR_THRESHOLD; +var ENABLE_RASTER_REPROJECTION = true; +exports.ENABLE_RASTER_REPROJECTION = ENABLE_RASTER_REPROJECTION; +},{}],"../../../node_modules/ol/reproj/Triangulation.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _extent = require("../extent.js"); + +var _proj = require("../proj.js"); + +var _math = require("../math.js"); + +/** + * @module ol/reproj/Triangulation + */ + +/** + * Single triangle; consists of 3 source points and 3 target points. + * @typedef {Object} Triangle + * @property {Array<import("../coordinate.js").Coordinate>} source + * @property {Array<import("../coordinate.js").Coordinate>} target + */ + +/** + * Maximum number of subdivision steps during raster reprojection triangulation. + * Prevents high memory usage and large number of proj4 calls (for certain + * transformations and areas). At most `2*(2^this)` triangles are created for + * each triangulated extent (tile/image). + * @type {number} + */ +var MAX_SUBDIVISION = 10; +/** + * Maximum allowed size of triangle relative to world width. When transforming + * corners of world extent between certain projections, the resulting + * triangulation seems to have zero error and no subdivision is performed. If + * the triangle width is more than this (relative to world width; 0-1), + * subdivison is forced (up to `MAX_SUBDIVISION`). Default is `0.25`. + * @type {number} + */ + +var MAX_TRIANGLE_WIDTH = 0.25; +/** + * @classdesc + * Class containing triangulation of the given target extent. + * Used for determining source data and the reprojection itself. + */ + +var Triangulation = +/** @class */ +function () { + /** + * @param {import("../proj/Projection.js").default} sourceProj Source projection. + * @param {import("../proj/Projection.js").default} targetProj Target projection. + * @param {import("../extent.js").Extent} targetExtent Target extent to triangulate. + * @param {import("../extent.js").Extent} maxSourceExtent Maximal source extent that can be used. + * @param {number} errorThreshold Acceptable error (in source units). + * @param {?number} opt_destinationResolution The (optional) resolution of the destination. + */ + function Triangulation(sourceProj, targetProj, targetExtent, maxSourceExtent, errorThreshold, opt_destinationResolution) { + /** + * @type {import("../proj/Projection.js").default} + * @private + */ + this.sourceProj_ = sourceProj; + /** + * @type {import("../proj/Projection.js").default} + * @private + */ + + this.targetProj_ = targetProj; + /** @type {!Object<string, import("../coordinate.js").Coordinate>} */ + + var transformInvCache = {}; + var transformInv = (0, _proj.getTransform)(this.targetProj_, this.sourceProj_); + /** + * @param {import("../coordinate.js").Coordinate} c A coordinate. + * @return {import("../coordinate.js").Coordinate} Transformed coordinate. + * @private + */ + + this.transformInv_ = function (c) { + var key = c[0] + '/' + c[1]; + + if (!transformInvCache[key]) { + transformInvCache[key] = transformInv(c); + } + + return transformInvCache[key]; + }; + /** + * @type {import("../extent.js").Extent} + * @private + */ + + + this.maxSourceExtent_ = maxSourceExtent; + /** + * @type {number} + * @private + */ + + this.errorThresholdSquared_ = errorThreshold * errorThreshold; + /** + * @type {Array<Triangle>} + * @private + */ + + this.triangles_ = []; + /** + * Indicates that the triangulation crosses edge of the source projection. + * @type {boolean} + * @private + */ + + this.wrapsXInSource_ = false; + /** + * @type {boolean} + * @private + */ + + this.canWrapXInSource_ = this.sourceProj_.canWrapX() && !!maxSourceExtent && !!this.sourceProj_.getExtent() && (0, _extent.getWidth)(maxSourceExtent) == (0, _extent.getWidth)(this.sourceProj_.getExtent()); + /** + * @type {?number} + * @private + */ + + this.sourceWorldWidth_ = this.sourceProj_.getExtent() ? (0, _extent.getWidth)(this.sourceProj_.getExtent()) : null; + /** + * @type {?number} + * @private + */ + + this.targetWorldWidth_ = this.targetProj_.getExtent() ? (0, _extent.getWidth)(this.targetProj_.getExtent()) : null; + var destinationTopLeft = (0, _extent.getTopLeft)(targetExtent); + var destinationTopRight = (0, _extent.getTopRight)(targetExtent); + var destinationBottomRight = (0, _extent.getBottomRight)(targetExtent); + var destinationBottomLeft = (0, _extent.getBottomLeft)(targetExtent); + var sourceTopLeft = this.transformInv_(destinationTopLeft); + var sourceTopRight = this.transformInv_(destinationTopRight); + var sourceBottomRight = this.transformInv_(destinationBottomRight); + var sourceBottomLeft = this.transformInv_(destinationBottomLeft); + /* + * The maxSubdivision controls how many splittings of the target area can + * be done. The idea here is to do a linear mapping of the target areas + * but the actual overal reprojection (can be) extremely non-linear. The + * default value of MAX_SUBDIVISION was chosen based on mapping a 256x256 + * tile size. However this function is also called to remap canvas rendered + * layers which can be much larger. This calculation increases the maxSubdivision + * value by the right factor so that each 256x256 pixel area has + * MAX_SUBDIVISION divisions. + */ + + var maxSubdivision = MAX_SUBDIVISION + (opt_destinationResolution ? Math.max(0, Math.ceil((0, _math.log2)((0, _extent.getArea)(targetExtent) / (opt_destinationResolution * opt_destinationResolution * 256 * 256)))) : 0); + this.addQuad_(destinationTopLeft, destinationTopRight, destinationBottomRight, destinationBottomLeft, sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft, maxSubdivision); + + if (this.wrapsXInSource_) { + var leftBound_1 = Infinity; + this.triangles_.forEach(function (triangle, i, arr) { + leftBound_1 = Math.min(leftBound_1, triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]); + }); // Shift triangles to be as close to `leftBound` as possible + // (if the distance is more than `worldWidth / 2` it can be closer. + + this.triangles_.forEach(function (triangle) { + if (Math.max(triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]) - leftBound_1 > this.sourceWorldWidth_ / 2) { + var newTriangle = [[triangle.source[0][0], triangle.source[0][1]], [triangle.source[1][0], triangle.source[1][1]], [triangle.source[2][0], triangle.source[2][1]]]; + + if (newTriangle[0][0] - leftBound_1 > this.sourceWorldWidth_ / 2) { + newTriangle[0][0] -= this.sourceWorldWidth_; + } + + if (newTriangle[1][0] - leftBound_1 > this.sourceWorldWidth_ / 2) { + newTriangle[1][0] -= this.sourceWorldWidth_; + } + + if (newTriangle[2][0] - leftBound_1 > this.sourceWorldWidth_ / 2) { + newTriangle[2][0] -= this.sourceWorldWidth_; + } // Rarely (if the extent contains both the dateline and prime meridian) + // the shift can in turn break some triangles. + // Detect this here and don't shift in such cases. + + + var minX = Math.min(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]); + var maxX = Math.max(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]); + + if (maxX - minX < this.sourceWorldWidth_ / 2) { + triangle.source = newTriangle; + } + } + }.bind(this)); + } + + transformInvCache = {}; + } + /** + * Adds triangle to the triangulation. + * @param {import("../coordinate.js").Coordinate} a The target a coordinate. + * @param {import("../coordinate.js").Coordinate} b The target b coordinate. + * @param {import("../coordinate.js").Coordinate} c The target c coordinate. + * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate. + * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate. + * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate. + * @private + */ + + + Triangulation.prototype.addTriangle_ = function (a, b, c, aSrc, bSrc, cSrc) { + this.triangles_.push({ + source: [aSrc, bSrc, cSrc], + target: [a, b, c] + }); + }; + /** + * Adds quad (points in clock-wise order) to the triangulation + * (and reprojects the vertices) if valid. + * Performs quad subdivision if needed to increase precision. + * + * @param {import("../coordinate.js").Coordinate} a The target a coordinate. + * @param {import("../coordinate.js").Coordinate} b The target b coordinate. + * @param {import("../coordinate.js").Coordinate} c The target c coordinate. + * @param {import("../coordinate.js").Coordinate} d The target d coordinate. + * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate. + * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate. + * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate. + * @param {import("../coordinate.js").Coordinate} dSrc The source d coordinate. + * @param {number} maxSubdivision Maximal allowed subdivision of the quad. + * @private + */ + + + Triangulation.prototype.addQuad_ = function (a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) { + var sourceQuadExtent = (0, _extent.boundingExtent)([aSrc, bSrc, cSrc, dSrc]); + var sourceCoverageX = this.sourceWorldWidth_ ? (0, _extent.getWidth)(sourceQuadExtent) / this.sourceWorldWidth_ : null; + var sourceWorldWidth = + /** @type {number} */ + this.sourceWorldWidth_; // when the quad is wrapped in the source projection + // it covers most of the projection extent, but not fully + + var wrapsX = this.sourceProj_.canWrapX() && sourceCoverageX > 0.5 && sourceCoverageX < 1; + var needsSubdivision = false; + + if (maxSubdivision > 0) { + if (this.targetProj_.isGlobal() && this.targetWorldWidth_) { + var targetQuadExtent = (0, _extent.boundingExtent)([a, b, c, d]); + var targetCoverageX = (0, _extent.getWidth)(targetQuadExtent) / this.targetWorldWidth_; + needsSubdivision = targetCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision; + } + + if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) { + needsSubdivision = sourceCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision; + } + } + + if (!needsSubdivision && this.maxSourceExtent_) { + if (isFinite(sourceQuadExtent[0]) && isFinite(sourceQuadExtent[1]) && isFinite(sourceQuadExtent[2]) && isFinite(sourceQuadExtent[3])) { + if (!(0, _extent.intersects)(sourceQuadExtent, this.maxSourceExtent_)) { + // whole quad outside source projection extent -> ignore + return; + } + } + } + + var isNotFinite = 0; + + if (!needsSubdivision) { + if (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) || !isFinite(bSrc[0]) || !isFinite(bSrc[1]) || !isFinite(cSrc[0]) || !isFinite(cSrc[1]) || !isFinite(dSrc[0]) || !isFinite(dSrc[1])) { + if (maxSubdivision > 0) { + needsSubdivision = true; + } else { + // It might be the case that only 1 of the points is infinite. In this case + // we can draw a single triangle with the other three points + isNotFinite = (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) ? 8 : 0) + (!isFinite(bSrc[0]) || !isFinite(bSrc[1]) ? 4 : 0) + (!isFinite(cSrc[0]) || !isFinite(cSrc[1]) ? 2 : 0) + (!isFinite(dSrc[0]) || !isFinite(dSrc[1]) ? 1 : 0); + + if (isNotFinite != 1 && isNotFinite != 2 && isNotFinite != 4 && isNotFinite != 8) { + return; + } + } + } + } + + if (maxSubdivision > 0) { + if (!needsSubdivision) { + var center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2]; + var centerSrc = this.transformInv_(center); + var dx = void 0; + + if (wrapsX) { + var centerSrcEstimX = ((0, _math.modulo)(aSrc[0], sourceWorldWidth) + (0, _math.modulo)(cSrc[0], sourceWorldWidth)) / 2; + dx = centerSrcEstimX - (0, _math.modulo)(centerSrc[0], sourceWorldWidth); + } else { + dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0]; + } + + var dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1]; + var centerSrcErrorSquared = dx * dx + dy * dy; + needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_; + } + + if (needsSubdivision) { + if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) { + // split horizontally (top & bottom) + var bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2]; + var bcSrc = this.transformInv_(bc); + var da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2]; + var daSrc = this.transformInv_(da); + this.addQuad_(a, b, bc, da, aSrc, bSrc, bcSrc, daSrc, maxSubdivision - 1); + this.addQuad_(da, bc, c, d, daSrc, bcSrc, cSrc, dSrc, maxSubdivision - 1); + } else { + // split vertically (left & right) + var ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2]; + var abSrc = this.transformInv_(ab); + var cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2]; + var cdSrc = this.transformInv_(cd); + this.addQuad_(a, ab, cd, d, aSrc, abSrc, cdSrc, dSrc, maxSubdivision - 1); + this.addQuad_(ab, b, c, cd, abSrc, bSrc, cSrc, cdSrc, maxSubdivision - 1); + } + + return; + } + } + + if (wrapsX) { + if (!this.canWrapXInSource_) { + return; + } + + this.wrapsXInSource_ = true; + } // Exactly zero or one of *Src is not finite + // The triangles must have the diagonal line as the first side + // This is to allow easy code in reproj.s to make it straight for broken + // browsers that can't handle diagonal clipping + + + if ((isNotFinite & 0xb) == 0) { + this.addTriangle_(a, c, d, aSrc, cSrc, dSrc); + } + + if ((isNotFinite & 0xe) == 0) { + this.addTriangle_(a, c, b, aSrc, cSrc, bSrc); + } + + if (isNotFinite) { + // Try the other two triangles + if ((isNotFinite & 0xd) == 0) { + this.addTriangle_(b, d, a, bSrc, dSrc, aSrc); + } + + if ((isNotFinite & 0x7) == 0) { + this.addTriangle_(b, d, c, bSrc, dSrc, cSrc); + } + } + }; + /** + * Calculates extent of the 'source' coordinates from all the triangles. + * + * @return {import("../extent.js").Extent} Calculated extent. + */ + + + Triangulation.prototype.calculateSourceExtent = function () { + var extent = (0, _extent.createEmpty)(); + this.triangles_.forEach(function (triangle, i, arr) { + var src = triangle.source; + (0, _extent.extendCoordinate)(extent, src[0]); + (0, _extent.extendCoordinate)(extent, src[1]); + (0, _extent.extendCoordinate)(extent, src[2]); + }); + return extent; + }; + /** + * @return {Array<Triangle>} Array of the calculated triangles. + */ + + + Triangulation.prototype.getTriangles = function () { + return this.triangles_; + }; + + return Triangulation; +}(); + +var _default = Triangulation; +exports.default = _default; +},{"../extent.js":"../../../node_modules/ol/extent.js","../proj.js":"../../../node_modules/ol/proj.js","../math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/source/common.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.IMAGE_SMOOTHING_DISABLED = exports.DEFAULT_WMS_VERSION = void 0; + +/** + * @module ol/source/common + */ + +/** + * Default WMS version. + * @type {string} + */ +var DEFAULT_WMS_VERSION = '1.3.0'; +/** + * Context options to disable image smoothing. + * @type {Object} + */ + +exports.DEFAULT_WMS_VERSION = DEFAULT_WMS_VERSION; +var IMAGE_SMOOTHING_DISABLED = { + imageSmoothingEnabled: false, + msImageSmoothingEnabled: false +}; +exports.IMAGE_SMOOTHING_DISABLED = IMAGE_SMOOTHING_DISABLED; +},{}],"../../../node_modules/ol/reproj.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.calculateSourceResolution = calculateSourceResolution; +exports.calculateSourceExtentResolution = calculateSourceExtentResolution; +exports.render = render; + +var _common = require("./source/common.js"); + +var _obj = require("./obj.js"); + +var _extent = require("./extent.js"); + +var _dom = require("./dom.js"); + +var _proj = require("./proj.js"); + +var _math = require("./math.js"); + +/** + * @module ol/reproj + */ +var brokenDiagonalRendering_; +/** + * This draws a small triangle into a canvas by setting the triangle as the clip region + * and then drawing a (too large) rectangle + * + * @param {CanvasRenderingContext2D} ctx The context in which to draw the triangle + * @param {number} u1 The x-coordinate of the second point. The first point is 0,0. + * @param {number} v1 The y-coordinate of the second point. + * @param {number} u2 The x-coordinate of the third point. + * @param {number} v2 The y-coordinate of the third point. + */ + +function drawTestTriangle(ctx, u1, v1, u2, v2) { + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(u1, v1); + ctx.lineTo(u2, v2); + ctx.closePath(); + ctx.save(); + ctx.clip(); + ctx.fillRect(0, 0, Math.max(u1, u2) + 1, Math.max(v1, v2)); + ctx.restore(); +} +/** + * Given the data from getImageData, see if the right values appear at the provided offset. + * Returns true if either the color or transparency is off + * + * @param {Uint8ClampedArray} data The data returned from getImageData + * @param {number} offset The pixel offset from the start of data. + * @return {boolean} true if the diagonal rendering is broken + */ + + +function verifyBrokenDiagonalRendering(data, offset) { + // the values ought to be close to the rgba(210, 0, 0, 0.75) + return Math.abs(data[offset * 4] - 210) > 2 || Math.abs(data[offset * 4 + 3] - 0.75 * 255) > 2; +} +/** + * Determines if the current browser configuration can render triangular clip regions correctly. + * This value is cached so the function is only expensive the first time called. + * Firefox on Windows (as of now) does not if HWA is enabled. See https://bugzilla.mozilla.org/show_bug.cgi?id=1606976 + * IE also doesn't. Chrome works, and everything seems to work on OSX and Android. This function caches the + * result. I suppose that it is conceivably possible that a browser might flip modes while the app is + * running, but lets hope not. + * + * @return {boolean} true if the Diagonal Rendering is broken. + */ + + +function isBrokenDiagonalRendering() { + if (brokenDiagonalRendering_ === undefined) { + var ctx = document.createElement('canvas').getContext('2d'); + ctx.globalCompositeOperation = 'lighter'; + ctx.fillStyle = 'rgba(210, 0, 0, 0.75)'; + drawTestTriangle(ctx, 4, 5, 4, 0); + drawTestTriangle(ctx, 4, 5, 0, 5); + var data = ctx.getImageData(0, 0, 3, 3).data; + brokenDiagonalRendering_ = verifyBrokenDiagonalRendering(data, 0) || verifyBrokenDiagonalRendering(data, 4) || verifyBrokenDiagonalRendering(data, 8); + } + + return brokenDiagonalRendering_; +} +/** + * Calculates ideal resolution to use from the source in order to achieve + * pixel mapping as close as possible to 1:1 during reprojection. + * The resolution is calculated regardless of what resolutions + * are actually available in the dataset (TileGrid, Image, ...). + * + * @param {import("./proj/Projection.js").default} sourceProj Source projection. + * @param {import("./proj/Projection.js").default} targetProj Target projection. + * @param {import("./coordinate.js").Coordinate} targetCenter Target center. + * @param {number} targetResolution Target resolution. + * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0. + */ + + +function calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution) { + var sourceCenter = (0, _proj.transform)(targetCenter, targetProj, sourceProj); // calculate the ideal resolution of the source data + + var sourceResolution = (0, _proj.getPointResolution)(targetProj, targetResolution, targetCenter); + var targetMetersPerUnit = targetProj.getMetersPerUnit(); + + if (targetMetersPerUnit !== undefined) { + sourceResolution *= targetMetersPerUnit; + } + + var sourceMetersPerUnit = sourceProj.getMetersPerUnit(); + + if (sourceMetersPerUnit !== undefined) { + sourceResolution /= sourceMetersPerUnit; + } // Based on the projection properties, the point resolution at the specified + // coordinates may be slightly different. We need to reverse-compensate this + // in order to achieve optimal results. + + + var sourceExtent = sourceProj.getExtent(); + + if (!sourceExtent || (0, _extent.containsCoordinate)(sourceExtent, sourceCenter)) { + var compensationFactor = (0, _proj.getPointResolution)(sourceProj, sourceResolution, sourceCenter) / sourceResolution; + + if (isFinite(compensationFactor) && compensationFactor > 0) { + sourceResolution /= compensationFactor; + } + } + + return sourceResolution; +} +/** + * Calculates ideal resolution to use from the source in order to achieve + * pixel mapping as close as possible to 1:1 during reprojection. + * The resolution is calculated regardless of what resolutions + * are actually available in the dataset (TileGrid, Image, ...). + * + * @param {import("./proj/Projection.js").default} sourceProj Source projection. + * @param {import("./proj/Projection.js").default} targetProj Target projection. + * @param {import("./extent.js").Extent} targetExtent Target extent + * @param {number} targetResolution Target resolution. + * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0. + */ + + +function calculateSourceExtentResolution(sourceProj, targetProj, targetExtent, targetResolution) { + var targetCenter = (0, _extent.getCenter)(targetExtent); + var sourceResolution = calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution); + + if (!isFinite(sourceResolution) || sourceResolution <= 0) { + (0, _extent.forEachCorner)(targetExtent, function (corner) { + sourceResolution = calculateSourceResolution(sourceProj, targetProj, corner, targetResolution); + return isFinite(sourceResolution) && sourceResolution > 0; + }); + } + + return sourceResolution; +} +/** + * Renders the source data into new canvas based on the triangulation. + * + * @param {number} width Width of the canvas. + * @param {number} height Height of the canvas. + * @param {number} pixelRatio Pixel ratio. + * @param {number} sourceResolution Source resolution. + * @param {import("./extent.js").Extent} sourceExtent Extent of the data source. + * @param {number} targetResolution Target resolution. + * @param {import("./extent.js").Extent} targetExtent Target extent. + * @param {import("./reproj/Triangulation.js").default} triangulation + * Calculated triangulation. + * @param {Array<{extent: import("./extent.js").Extent, + * image: (HTMLCanvasElement|HTMLImageElement|HTMLVideoElement)}>} sources + * Array of sources. + * @param {number} gutter Gutter of the sources. + * @param {boolean=} opt_renderEdges Render reprojection edges. + * @param {object=} opt_contextOptions Properties to set on the canvas context. + * @return {HTMLCanvasElement} Canvas with reprojected data. + */ + + +function render(width, height, pixelRatio, sourceResolution, sourceExtent, targetResolution, targetExtent, triangulation, sources, gutter, opt_renderEdges, opt_contextOptions) { + var context = (0, _dom.createCanvasContext2D)(Math.round(pixelRatio * width), Math.round(pixelRatio * height)); + (0, _obj.assign)(context, opt_contextOptions); + + if (sources.length === 0) { + return context.canvas; + } + + context.scale(pixelRatio, pixelRatio); + + function pixelRound(value) { + return Math.round(value * pixelRatio) / pixelRatio; + } + + context.globalCompositeOperation = 'lighter'; + var sourceDataExtent = (0, _extent.createEmpty)(); + sources.forEach(function (src, i, arr) { + (0, _extent.extend)(sourceDataExtent, src.extent); + }); + var canvasWidthInUnits = (0, _extent.getWidth)(sourceDataExtent); + var canvasHeightInUnits = (0, _extent.getHeight)(sourceDataExtent); + var stitchContext = (0, _dom.createCanvasContext2D)(Math.round(pixelRatio * canvasWidthInUnits / sourceResolution), Math.round(pixelRatio * canvasHeightInUnits / sourceResolution)); + (0, _obj.assign)(stitchContext, opt_contextOptions); + var stitchScale = pixelRatio / sourceResolution; + sources.forEach(function (src, i, arr) { + var xPos = src.extent[0] - sourceDataExtent[0]; + var yPos = -(src.extent[3] - sourceDataExtent[3]); + var srcWidth = (0, _extent.getWidth)(src.extent); + var srcHeight = (0, _extent.getHeight)(src.extent); // This test should never fail -- but it does. Need to find a fix the upstream condition + + if (src.image.width > 0 && src.image.height > 0) { + stitchContext.drawImage(src.image, gutter, gutter, src.image.width - 2 * gutter, src.image.height - 2 * gutter, xPos * stitchScale, yPos * stitchScale, srcWidth * stitchScale, srcHeight * stitchScale); + } + }); + var targetTopLeft = (0, _extent.getTopLeft)(targetExtent); + triangulation.getTriangles().forEach(function (triangle, i, arr) { + /* Calculate affine transform (src -> dst) + * Resulting matrix can be used to transform coordinate + * from `sourceProjection` to destination pixels. + * + * To optimize number of context calls and increase numerical stability, + * we also do the following operations: + * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1) + * here before solving the linear system so [ui, vi] are pixel coordinates. + * + * Src points: xi, yi + * Dst points: ui, vi + * Affine coefficients: aij + * + * | x0 y0 1 0 0 0 | |a00| |u0| + * | x1 y1 1 0 0 0 | |a01| |u1| + * | x2 y2 1 0 0 0 | x |a02| = |u2| + * | 0 0 0 x0 y0 1 | |a10| |v0| + * | 0 0 0 x1 y1 1 | |a11| |v1| + * | 0 0 0 x2 y2 1 | |a12| |v2| + */ + var source = triangle.source; + var target = triangle.target; + var x0 = source[0][0], + y0 = source[0][1]; + var x1 = source[1][0], + y1 = source[1][1]; + var x2 = source[2][0], + y2 = source[2][1]; // Make sure that everything is on pixel boundaries + + var u0 = pixelRound((target[0][0] - targetTopLeft[0]) / targetResolution); + var v0 = pixelRound(-(target[0][1] - targetTopLeft[1]) / targetResolution); + var u1 = pixelRound((target[1][0] - targetTopLeft[0]) / targetResolution); + var v1 = pixelRound(-(target[1][1] - targetTopLeft[1]) / targetResolution); + var u2 = pixelRound((target[2][0] - targetTopLeft[0]) / targetResolution); + var v2 = pixelRound(-(target[2][1] - targetTopLeft[1]) / targetResolution); // Shift all the source points to improve numerical stability + // of all the subsequent calculations. The [x0, y0] is used here. + // This is also used to simplify the linear system. + + var sourceNumericalShiftX = x0; + var sourceNumericalShiftY = y0; + x0 = 0; + y0 = 0; + x1 -= sourceNumericalShiftX; + y1 -= sourceNumericalShiftY; + x2 -= sourceNumericalShiftX; + y2 -= sourceNumericalShiftY; + var augmentedMatrix = [[x1, y1, 0, 0, u1 - u0], [x2, y2, 0, 0, u2 - u0], [0, 0, x1, y1, v1 - v0], [0, 0, x2, y2, v2 - v0]]; + var affineCoefs = (0, _math.solveLinearSystem)(augmentedMatrix); + + if (!affineCoefs) { + return; + } + + context.save(); + context.beginPath(); + + if (isBrokenDiagonalRendering() || opt_contextOptions === _common.IMAGE_SMOOTHING_DISABLED) { + // Make sure that all lines are horizontal or vertical + context.moveTo(u1, v1); // This is the diagonal line. Do it in 4 steps + + var steps = 4; + var ud = u0 - u1; + var vd = v0 - v1; + + for (var step = 0; step < steps; step++) { + // Go horizontally + context.lineTo(u1 + pixelRound((step + 1) * ud / steps), v1 + pixelRound(step * vd / (steps - 1))); // Go vertically + + if (step != steps - 1) { + context.lineTo(u1 + pixelRound((step + 1) * ud / steps), v1 + pixelRound((step + 1) * vd / (steps - 1))); + } + } // We are almost at u0r, v0r + + + context.lineTo(u2, v2); + } else { + context.moveTo(u1, v1); + context.lineTo(u0, v0); + context.lineTo(u2, v2); + } + + context.clip(); + context.transform(affineCoefs[0], affineCoefs[2], affineCoefs[1], affineCoefs[3], u0, v0); + context.translate(sourceDataExtent[0] - sourceNumericalShiftX, sourceDataExtent[3] - sourceNumericalShiftY); + context.scale(sourceResolution / pixelRatio, -sourceResolution / pixelRatio); + context.drawImage(stitchContext.canvas, 0, 0); + context.restore(); + }); + + if (opt_renderEdges) { + context.save(); + context.globalCompositeOperation = 'source-over'; + context.strokeStyle = 'black'; + context.lineWidth = 1; + triangulation.getTriangles().forEach(function (triangle, i, arr) { + var target = triangle.target; + var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution; + var v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution; + var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution; + var v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution; + var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution; + var v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution; + context.beginPath(); + context.moveTo(u1, v1); + context.lineTo(u0, v0); + context.lineTo(u2, v2); + context.closePath(); + context.stroke(); + }); + context.restore(); + } + + return context.canvas; +} +},{"./source/common.js":"../../../node_modules/ol/source/common.js","./obj.js":"../../../node_modules/ol/obj.js","./extent.js":"../../../node_modules/ol/extent.js","./dom.js":"../../../node_modules/ol/dom.js","./proj.js":"../../../node_modules/ol/proj.js","./math.js":"../../../node_modules/ol/math.js"}],"../../../node_modules/ol/reproj/Tile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _common = require("./common.js"); + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _Tile = _interopRequireDefault(require("../Tile.js")); + +var _TileState = _interopRequireDefault(require("../TileState.js")); + +var _Triangulation = _interopRequireDefault(require("./Triangulation.js")); + +var _reproj = require("../reproj.js"); + +var _math = require("../math.js"); + +var _extent = require("../extent.js"); + +var _events = require("../events.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/reproj/Tile + */ + + +/** + * @typedef {function(number, number, number, number) : import("../Tile.js").default} FunctionType + */ + +/** + * @classdesc + * Class encapsulating single reprojected tile. + * See {@link module:ol/source/TileImage~TileImage}. + * + */ +var ReprojTile = +/** @class */ +function (_super) { + __extends(ReprojTile, _super); + /** + * @param {import("../proj/Projection.js").default} sourceProj Source projection. + * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid. + * @param {import("../proj/Projection.js").default} targetProj Target projection. + * @param {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid. + * @param {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile. + * @param {import("../tilecoord.js").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X. + * @param {number} pixelRatio Pixel ratio. + * @param {number} gutter Gutter of the source tiles. + * @param {FunctionType} getTileFunction + * Function returning source tiles (z, x, y, pixelRatio). + * @param {number=} opt_errorThreshold Acceptable reprojection error (in px). + * @param {boolean=} opt_renderEdges Render reprojection edges. + * @param {object=} opt_contextOptions Properties to set on the canvas context. + */ + + + function ReprojTile(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges, opt_contextOptions) { + var _this = _super.call(this, tileCoord, _TileState.default.IDLE) || this; + /** + * @private + * @type {boolean} + */ + + + _this.renderEdges_ = opt_renderEdges !== undefined ? opt_renderEdges : false; + /** + * @private + * @type {object} + */ + + _this.contextOptions_ = opt_contextOptions; + /** + * @private + * @type {number} + */ + + _this.pixelRatio_ = pixelRatio; + /** + * @private + * @type {number} + */ + + _this.gutter_ = gutter; + /** + * @private + * @type {HTMLCanvasElement} + */ + + _this.canvas_ = null; + /** + * @private + * @type {import("../tilegrid/TileGrid.js").default} + */ + + _this.sourceTileGrid_ = sourceTileGrid; + /** + * @private + * @type {import("../tilegrid/TileGrid.js").default} + */ + + _this.targetTileGrid_ = targetTileGrid; + /** + * @private + * @type {import("../tilecoord.js").TileCoord} + */ + + _this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord; + /** + * @private + * @type {!Array<import("../Tile.js").default>} + */ + + _this.sourceTiles_ = []; + /** + * @private + * @type {?Array<import("../events.js").EventsKey>} + */ + + _this.sourcesListenerKeys_ = null; + /** + * @private + * @type {number} + */ + + _this.sourceZ_ = 0; + var targetExtent = targetTileGrid.getTileCoordExtent(_this.wrappedTileCoord_); + + var maxTargetExtent = _this.targetTileGrid_.getExtent(); + + var maxSourceExtent = _this.sourceTileGrid_.getExtent(); + + var limitedTargetExtent = maxTargetExtent ? (0, _extent.getIntersection)(targetExtent, maxTargetExtent) : targetExtent; + + if ((0, _extent.getArea)(limitedTargetExtent) === 0) { + // Tile is completely outside range -> EMPTY + // TODO: is it actually correct that the source even creates the tile ? + _this.state = _TileState.default.EMPTY; + return _this; + } + + var sourceProjExtent = sourceProj.getExtent(); + + if (sourceProjExtent) { + if (!maxSourceExtent) { + maxSourceExtent = sourceProjExtent; + } else { + maxSourceExtent = (0, _extent.getIntersection)(maxSourceExtent, sourceProjExtent); + } + } + + var targetResolution = targetTileGrid.getResolution(_this.wrappedTileCoord_[0]); + var sourceResolution = (0, _reproj.calculateSourceExtentResolution)(sourceProj, targetProj, limitedTargetExtent, targetResolution); + + if (!isFinite(sourceResolution) || sourceResolution <= 0) { + // invalid sourceResolution -> EMPTY + // probably edges of the projections when no extent is defined + _this.state = _TileState.default.EMPTY; + return _this; + } + + var errorThresholdInPixels = opt_errorThreshold !== undefined ? opt_errorThreshold : _common.ERROR_THRESHOLD; + /** + * @private + * @type {!import("./Triangulation.js").default} + */ + + _this.triangulation_ = new _Triangulation.default(sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels, targetResolution); + + if (_this.triangulation_.getTriangles().length === 0) { + // no valid triangles -> EMPTY + _this.state = _TileState.default.EMPTY; + return _this; + } + + _this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution); + + var sourceExtent = _this.triangulation_.calculateSourceExtent(); + + if (maxSourceExtent) { + if (sourceProj.canWrapX()) { + sourceExtent[1] = (0, _math.clamp)(sourceExtent[1], maxSourceExtent[1], maxSourceExtent[3]); + sourceExtent[3] = (0, _math.clamp)(sourceExtent[3], maxSourceExtent[1], maxSourceExtent[3]); + } else { + sourceExtent = (0, _extent.getIntersection)(sourceExtent, maxSourceExtent); + } + } + + if (!(0, _extent.getArea)(sourceExtent)) { + _this.state = _TileState.default.EMPTY; + } else { + var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(sourceExtent, _this.sourceZ_); + + for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) { + for (var srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) { + var tile = getTileFunction(_this.sourceZ_, srcX, srcY, pixelRatio); + + if (tile) { + _this.sourceTiles_.push(tile); + } + } + } + + if (_this.sourceTiles_.length === 0) { + _this.state = _TileState.default.EMPTY; + } + } + + return _this; + } + /** + * Get the HTML Canvas element for this tile. + * @return {HTMLCanvasElement} Canvas. + */ + + + ReprojTile.prototype.getImage = function () { + return this.canvas_; + }; + /** + * @private + */ + + + ReprojTile.prototype.reproject_ = function () { + var sources = []; + this.sourceTiles_.forEach(function (tile, i, arr) { + if (tile && tile.getState() == _TileState.default.LOADED) { + sources.push({ + extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord), + image: tile.getImage() + }); + } + }.bind(this)); + this.sourceTiles_.length = 0; + + if (sources.length === 0) { + this.state = _TileState.default.ERROR; + } else { + var z = this.wrappedTileCoord_[0]; + var size = this.targetTileGrid_.getTileSize(z); + var width = typeof size === 'number' ? size : size[0]; + var height = typeof size === 'number' ? size : size[1]; + var targetResolution = this.targetTileGrid_.getResolution(z); + var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_); + var targetExtent = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_); + this.canvas_ = (0, _reproj.render)(width, height, this.pixelRatio_, sourceResolution, this.sourceTileGrid_.getExtent(), targetResolution, targetExtent, this.triangulation_, sources, this.gutter_, this.renderEdges_, this.contextOptions_); + this.state = _TileState.default.LOADED; + } + + this.changed(); + }; + /** + * Load not yet loaded URI. + */ + + + ReprojTile.prototype.load = function () { + if (this.state == _TileState.default.IDLE) { + this.state = _TileState.default.LOADING; + this.changed(); + var leftToLoad_1 = 0; + this.sourcesListenerKeys_ = []; + this.sourceTiles_.forEach(function (tile, i, arr) { + var state = tile.getState(); + + if (state == _TileState.default.IDLE || state == _TileState.default.LOADING) { + leftToLoad_1++; + var sourceListenKey_1 = (0, _events.listen)(tile, _EventType.default.CHANGE, function (e) { + var state = tile.getState(); + + if (state == _TileState.default.LOADED || state == _TileState.default.ERROR || state == _TileState.default.EMPTY) { + (0, _events.unlistenByKey)(sourceListenKey_1); + leftToLoad_1--; + + if (leftToLoad_1 === 0) { + this.unlistenSources_(); + this.reproject_(); + } + } + }, this); + this.sourcesListenerKeys_.push(sourceListenKey_1); + } + }.bind(this)); + this.sourceTiles_.forEach(function (tile, i, arr) { + var state = tile.getState(); + + if (state == _TileState.default.IDLE) { + tile.load(); + } + }); + + if (leftToLoad_1 === 0) { + setTimeout(this.reproject_.bind(this), 0); + } + } + }; + /** + * @private + */ + + + ReprojTile.prototype.unlistenSources_ = function () { + this.sourcesListenerKeys_.forEach(_events.unlistenByKey); + this.sourcesListenerKeys_ = null; + }; + + return ReprojTile; +}(_Tile.default); + +var _default = ReprojTile; +exports.default = _default; +},{"./common.js":"../../../node_modules/ol/reproj/common.js","../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../Tile.js":"../../../node_modules/ol/Tile.js","../TileState.js":"../../../node_modules/ol/TileState.js","./Triangulation.js":"../../../node_modules/ol/reproj/Triangulation.js","../reproj.js":"../../../node_modules/ol/reproj.js","../math.js":"../../../node_modules/ol/math.js","../extent.js":"../../../node_modules/ol/extent.js","../events.js":"../../../node_modules/ol/events.js"}],"../../../node_modules/ol/source/TileEventType.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +/** + * @module ol/source/TileEventType + */ + +/** + * @enum {string} + */ +var _default = { + /** + * Triggered when a tile starts loading. + * @event module:ol/source/Tile.TileSourceEvent#tileloadstart + * @api + */ + TILELOADSTART: 'tileloadstart', + + /** + * Triggered when a tile finishes loading, either when its data is loaded, + * or when loading was aborted because the tile is no longer needed. + * @event module:ol/source/Tile.TileSourceEvent#tileloadend + * @api + */ + TILELOADEND: 'tileloadend', + + /** + * Triggered if tile loading results in an error. + * @event module:ol/source/Tile.TileSourceEvent#tileloaderror + * @api + */ + TILELOADERROR: 'tileloaderror' +}; +exports.default = _default; +},{}],"../../../node_modules/ol/tilegrid/TileGrid.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _TileRange = _interopRequireWildcard(require("../TileRange.js")); + +var _common = require("./common.js"); + +var _asserts = require("../asserts.js"); + +var _math = require("../math.js"); + +var _extent = require("../extent.js"); + +var _tilecoord = require("../tilecoord.js"); + +var _array = require("../array.js"); + +var _size = require("../size.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +/** + * @module ol/tilegrid/TileGrid + */ + +/** + * @private + * @type {import("../tilecoord.js").TileCoord} + */ +var tmpTileCoord = [0, 0, 0]; +/** + * @typedef {Object} Options + * @property {import("../extent.js").Extent} [extent] Extent for the tile grid. No tiles outside this + * extent will be requested by {@link module:ol/source/Tile} sources. When no `origin` or + * `origins` are configured, the `origin` will be set to the top-left corner of the extent. + * @property {number} [minZoom=0] Minimum zoom. + * @property {import("../coordinate.js").Coordinate} [origin] The tile grid origin, i.e. where the `x` + * and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left to right and downwards. If not + * specified, `extent` or `origins` must be provided. + * @property {Array<import("../coordinate.js").Coordinate>} [origins] Tile grid origins, i.e. where + * the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If given, the array length + * should match the length of the `resolutions` array, i.e. each resolution can have a different + * origin. Tile coordinates increase left to right and downwards. If not specified, `extent` or + * `origin` must be provided. + * @property {!Array<number>} resolutions Resolutions. The array index of each resolution needs + * to match the zoom level. This means that even if a `minZoom` is configured, the resolutions + * array will have a length of `maxZoom + 1`. + * @property {Array<import("../size.js").Size>} [sizes] Number of tile rows and columns + * of the grid for each zoom level. If specified the values + * define each zoom level's extent together with the `origin` or `origins`. + * A grid `extent` can be configured in addition, and will further limit the extent + * for which tile requests are made by sources. If the bottom-left corner of + * an extent is used as `origin` or `origins`, then the `y` value must be + * negative because OpenLayers tile coordinates use the top left as the origin. + * @property {number|import("../size.js").Size} [tileSize] Tile size. + * Default is `[256, 256]`. + * @property {Array<import("../size.js").Size>} [tileSizes] Tile sizes. If given, the array length + * should match the length of the `resolutions` array, i.e. each resolution can have a different + * tile size. + */ + +/** + * @classdesc + * Base class for setting the grid pattern for sources accessing tiled-image + * servers. + * @api + */ + +var TileGrid = +/** @class */ +function () { + /** + * @param {Options} options Tile grid options. + */ + function TileGrid(options) { + /** + * @protected + * @type {number} + */ + this.minZoom = options.minZoom !== undefined ? options.minZoom : 0; + /** + * @private + * @type {!Array<number>} + */ + + this.resolutions_ = options.resolutions; + (0, _asserts.assert)((0, _array.isSorted)(this.resolutions_, function (a, b) { + return b - a; + }, true), 17); // `resolutions` must be sorted in descending order + // check if we've got a consistent zoom factor and origin + + var zoomFactor; + + if (!options.origins) { + for (var i = 0, ii = this.resolutions_.length - 1; i < ii; ++i) { + if (!zoomFactor) { + zoomFactor = this.resolutions_[i] / this.resolutions_[i + 1]; + } else { + if (this.resolutions_[i] / this.resolutions_[i + 1] !== zoomFactor) { + zoomFactor = undefined; + break; + } + } + } + } + /** + * @private + * @type {number|undefined} + */ + + + this.zoomFactor_ = zoomFactor; + /** + * @protected + * @type {number} + */ + + this.maxZoom = this.resolutions_.length - 1; + /** + * @private + * @type {import("../coordinate.js").Coordinate} + */ + + this.origin_ = options.origin !== undefined ? options.origin : null; + /** + * @private + * @type {Array<import("../coordinate.js").Coordinate>} + */ + + this.origins_ = null; + + if (options.origins !== undefined) { + this.origins_ = options.origins; + (0, _asserts.assert)(this.origins_.length == this.resolutions_.length, 20); // Number of `origins` and `resolutions` must be equal + } + + var extent = options.extent; + + if (extent !== undefined && !this.origin_ && !this.origins_) { + this.origin_ = (0, _extent.getTopLeft)(extent); + } + + (0, _asserts.assert)(!this.origin_ && this.origins_ || this.origin_ && !this.origins_, 18); // Either `origin` or `origins` must be configured, never both + + /** + * @private + * @type {Array<number|import("../size.js").Size>} + */ + + this.tileSizes_ = null; + + if (options.tileSizes !== undefined) { + this.tileSizes_ = options.tileSizes; + (0, _asserts.assert)(this.tileSizes_.length == this.resolutions_.length, 19); // Number of `tileSizes` and `resolutions` must be equal + } + /** + * @private + * @type {number|import("../size.js").Size} + */ + + + this.tileSize_ = options.tileSize !== undefined ? options.tileSize : !this.tileSizes_ ? _common.DEFAULT_TILE_SIZE : null; + (0, _asserts.assert)(!this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_, 22); // Either `tileSize` or `tileSizes` must be configured, never both + + /** + * @private + * @type {import("../extent.js").Extent} + */ + + this.extent_ = extent !== undefined ? extent : null; + /** + * @private + * @type {Array<import("../TileRange.js").default>} + */ + + this.fullTileRanges_ = null; + /** + * @private + * @type {import("../size.js").Size} + */ + + this.tmpSize_ = [0, 0]; + + if (options.sizes !== undefined) { + this.fullTileRanges_ = options.sizes.map(function (size, z) { + var tileRange = new _TileRange.default(Math.min(0, size[0]), Math.max(size[0] - 1, -1), Math.min(0, size[1]), Math.max(size[1] - 1, -1)); + return tileRange; + }, this); + } else if (extent) { + this.calculateTileRanges_(extent); + } + } + /** + * Call a function with each tile coordinate for a given extent and zoom level. + * + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} zoom Integer zoom level. + * @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate. + * @api + */ + + + TileGrid.prototype.forEachTileCoord = function (extent, zoom, callback) { + var tileRange = this.getTileRangeForExtentAndZ(extent, zoom); + + for (var i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) { + for (var j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) { + callback([zoom, i, j]); + } + } + }; + /** + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {function(number, import("../TileRange.js").default): boolean} callback Callback. + * @param {import("../TileRange.js").default=} opt_tileRange Temporary import("../TileRange.js").default object. + * @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object. + * @return {boolean} Callback succeeded. + */ + + + TileGrid.prototype.forEachTileCoordParentTileRange = function (tileCoord, callback, opt_tileRange, opt_extent) { + var tileRange, x, y; + var tileCoordExtent = null; + var z = tileCoord[0] - 1; + + if (this.zoomFactor_ === 2) { + x = tileCoord[1]; + y = tileCoord[2]; + } else { + tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent); + } + + while (z >= this.minZoom) { + if (this.zoomFactor_ === 2) { + x = Math.floor(x / 2); + y = Math.floor(y / 2); + tileRange = (0, _TileRange.createOrUpdate)(x, x, y, y, opt_tileRange); + } else { + tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange); + } + + if (callback(z, tileRange)) { + return true; + } + + --z; + } + + return false; + }; + /** + * Get the extent for this tile grid, if it was configured. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + + + TileGrid.prototype.getExtent = function () { + return this.extent_; + }; + /** + * Get the maximum zoom level for the grid. + * @return {number} Max zoom. + * @api + */ + + + TileGrid.prototype.getMaxZoom = function () { + return this.maxZoom; + }; + /** + * Get the minimum zoom level for the grid. + * @return {number} Min zoom. + * @api + */ + + + TileGrid.prototype.getMinZoom = function () { + return this.minZoom; + }; + /** + * Get the origin for the grid at the given zoom level. + * @param {number} z Integer zoom level. + * @return {import("../coordinate.js").Coordinate} Origin. + * @api + */ + + + TileGrid.prototype.getOrigin = function (z) { + if (this.origin_) { + return this.origin_; + } else { + return this.origins_[z]; + } + }; + /** + * Get the resolution for the given zoom level. + * @param {number} z Integer zoom level. + * @return {number} Resolution. + * @api + */ + + + TileGrid.prototype.getResolution = function (z) { + return this.resolutions_[z]; + }; + /** + * Get the list of resolutions for the tile grid. + * @return {Array<number>} Resolutions. + * @api + */ + + + TileGrid.prototype.getResolutions = function () { + return this.resolutions_; + }; + /** + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("../TileRange.js").default=} opt_tileRange Temporary import("../TileRange.js").default object. + * @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object. + * @return {import("../TileRange.js").default} Tile range. + */ + + + TileGrid.prototype.getTileCoordChildTileRange = function (tileCoord, opt_tileRange, opt_extent) { + if (tileCoord[0] < this.maxZoom) { + if (this.zoomFactor_ === 2) { + var minX = tileCoord[1] * 2; + var minY = tileCoord[2] * 2; + return (0, _TileRange.createOrUpdate)(minX, minX + 1, minY, minY + 1, opt_tileRange); + } + + var tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent); + return this.getTileRangeForExtentAndZ(tileCoordExtent, tileCoord[0] + 1, opt_tileRange); + } + + return null; + }; + /** + * Get the extent for a tile range. + * @param {number} z Integer zoom level. + * @param {import("../TileRange.js").default} tileRange Tile range. + * @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object. + * @return {import("../extent.js").Extent} Extent. + */ + + + TileGrid.prototype.getTileRangeExtent = function (z, tileRange, opt_extent) { + var origin = this.getOrigin(z); + var resolution = this.getResolution(z); + var tileSize = (0, _size.toSize)(this.getTileSize(z), this.tmpSize_); + var minX = origin[0] + tileRange.minX * tileSize[0] * resolution; + var maxX = origin[0] + (tileRange.maxX + 1) * tileSize[0] * resolution; + var minY = origin[1] + tileRange.minY * tileSize[1] * resolution; + var maxY = origin[1] + (tileRange.maxY + 1) * tileSize[1] * resolution; + return (0, _extent.createOrUpdate)(minX, minY, maxX, maxY, opt_extent); + }; + /** + * Get a tile range for the given extent and integer zoom level. + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} z Integer zoom level. + * @param {import("../TileRange.js").default=} opt_tileRange Temporary tile range object. + * @return {import("../TileRange.js").default} Tile range. + */ + + + TileGrid.prototype.getTileRangeForExtentAndZ = function (extent, z, opt_tileRange) { + var tileCoord = tmpTileCoord; + this.getTileCoordForXYAndZ_(extent[0], extent[3], z, false, tileCoord); + var minX = tileCoord[1]; + var minY = tileCoord[2]; + this.getTileCoordForXYAndZ_(extent[2], extent[1], z, true, tileCoord); + return (0, _TileRange.createOrUpdate)(minX, tileCoord[1], minY, tileCoord[2], opt_tileRange); + }; + /** + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @return {import("../coordinate.js").Coordinate} Tile center. + */ + + + TileGrid.prototype.getTileCoordCenter = function (tileCoord) { + var origin = this.getOrigin(tileCoord[0]); + var resolution = this.getResolution(tileCoord[0]); + var tileSize = (0, _size.toSize)(this.getTileSize(tileCoord[0]), this.tmpSize_); + return [origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution, origin[1] - (tileCoord[2] + 0.5) * tileSize[1] * resolution]; + }; + /** + * Get the extent of a tile coordinate. + * + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("../extent.js").Extent=} opt_extent Temporary extent object. + * @return {import("../extent.js").Extent} Extent. + * @api + */ + + + TileGrid.prototype.getTileCoordExtent = function (tileCoord, opt_extent) { + var origin = this.getOrigin(tileCoord[0]); + var resolution = this.getResolution(tileCoord[0]); + var tileSize = (0, _size.toSize)(this.getTileSize(tileCoord[0]), this.tmpSize_); + var minX = origin[0] + tileCoord[1] * tileSize[0] * resolution; + var minY = origin[1] - (tileCoord[2] + 1) * tileSize[1] * resolution; + var maxX = minX + tileSize[0] * resolution; + var maxY = minY + tileSize[1] * resolution; + return (0, _extent.createOrUpdate)(minX, minY, maxX, maxY, opt_extent); + }; + /** + * Get the tile coordinate for the given map coordinate and resolution. This + * method considers that coordinates that intersect tile boundaries should be + * assigned the higher tile coordinate. + * + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {number} resolution Resolution. + * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Destination import("../tilecoord.js").TileCoord object. + * @return {import("../tilecoord.js").TileCoord} Tile coordinate. + * @api + */ + + + TileGrid.prototype.getTileCoordForCoordAndResolution = function (coordinate, resolution, opt_tileCoord) { + return this.getTileCoordForXYAndResolution_(coordinate[0], coordinate[1], resolution, false, opt_tileCoord); + }; + /** + * Note that this method should not be called for resolutions that correspond + * to an integer zoom level. Instead call the `getTileCoordForXYAndZ_` method. + * @param {number} x X. + * @param {number} y Y. + * @param {number} resolution Resolution (for a non-integer zoom level). + * @param {boolean} reverseIntersectionPolicy Instead of letting edge + * intersections go to the higher tile coordinate, let edge intersections + * go to the lower tile coordinate. + * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Temporary import("../tilecoord.js").TileCoord object. + * @return {import("../tilecoord.js").TileCoord} Tile coordinate. + * @private + */ + + + TileGrid.prototype.getTileCoordForXYAndResolution_ = function (x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) { + var z = this.getZForResolution(resolution); + var scale = resolution / this.getResolution(z); + var origin = this.getOrigin(z); + var tileSize = (0, _size.toSize)(this.getTileSize(z), this.tmpSize_); + var adjustX = reverseIntersectionPolicy ? 0.5 : 0; + var adjustY = reverseIntersectionPolicy ? 0.5 : 0; + var xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX); + var yFromOrigin = Math.floor((origin[1] - y) / resolution + adjustY); + var tileCoordX = scale * xFromOrigin / tileSize[0]; + var tileCoordY = scale * yFromOrigin / tileSize[1]; + + if (reverseIntersectionPolicy) { + tileCoordX = Math.ceil(tileCoordX) - 1; + tileCoordY = Math.ceil(tileCoordY) - 1; + } else { + tileCoordX = Math.floor(tileCoordX); + tileCoordY = Math.floor(tileCoordY); + } + + return (0, _tilecoord.createOrUpdate)(z, tileCoordX, tileCoordY, opt_tileCoord); + }; + /** + * Although there is repetition between this method and `getTileCoordForXYAndResolution_`, + * they should have separate implementations. This method is for integer zoom + * levels. The other method should only be called for resolutions corresponding + * to non-integer zoom levels. + * @param {number} x Map x coordinate. + * @param {number} y Map y coordinate. + * @param {number} z Integer zoom level. + * @param {boolean} reverseIntersectionPolicy Instead of letting edge + * intersections go to the higher tile coordinate, let edge intersections + * go to the lower tile coordinate. + * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Temporary import("../tilecoord.js").TileCoord object. + * @return {import("../tilecoord.js").TileCoord} Tile coordinate. + * @private + */ + + + TileGrid.prototype.getTileCoordForXYAndZ_ = function (x, y, z, reverseIntersectionPolicy, opt_tileCoord) { + var origin = this.getOrigin(z); + var resolution = this.getResolution(z); + var tileSize = (0, _size.toSize)(this.getTileSize(z), this.tmpSize_); + var adjustX = reverseIntersectionPolicy ? 0.5 : 0; + var adjustY = reverseIntersectionPolicy ? 0.5 : 0; + var xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX); + var yFromOrigin = Math.floor((origin[1] - y) / resolution + adjustY); + var tileCoordX = xFromOrigin / tileSize[0]; + var tileCoordY = yFromOrigin / tileSize[1]; + + if (reverseIntersectionPolicy) { + tileCoordX = Math.ceil(tileCoordX) - 1; + tileCoordY = Math.ceil(tileCoordY) - 1; + } else { + tileCoordX = Math.floor(tileCoordX); + tileCoordY = Math.floor(tileCoordY); + } + + return (0, _tilecoord.createOrUpdate)(z, tileCoordX, tileCoordY, opt_tileCoord); + }; + /** + * Get a tile coordinate given a map coordinate and zoom level. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {number} z Zoom level. + * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Destination import("../tilecoord.js").TileCoord object. + * @return {import("../tilecoord.js").TileCoord} Tile coordinate. + * @api + */ + + + TileGrid.prototype.getTileCoordForCoordAndZ = function (coordinate, z, opt_tileCoord) { + return this.getTileCoordForXYAndZ_(coordinate[0], coordinate[1], z, false, opt_tileCoord); + }; + /** + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @return {number} Tile resolution. + */ + + + TileGrid.prototype.getTileCoordResolution = function (tileCoord) { + return this.resolutions_[tileCoord[0]]; + }; + /** + * Get the tile size for a zoom level. The type of the return value matches the + * `tileSize` or `tileSizes` that the tile grid was configured with. To always + * get an `import("../size.js").Size`, run the result through `import("../size.js").Size.toSize()`. + * @param {number} z Z. + * @return {number|import("../size.js").Size} Tile size. + * @api + */ + + + TileGrid.prototype.getTileSize = function (z) { + if (this.tileSize_) { + return this.tileSize_; + } else { + return this.tileSizes_[z]; + } + }; + /** + * @param {number} z Zoom level. + * @return {import("../TileRange.js").default} Extent tile range for the specified zoom level. + */ + + + TileGrid.prototype.getFullTileRange = function (z) { + if (!this.fullTileRanges_) { + return null; + } else { + return this.fullTileRanges_[z]; + } + }; + /** + * @param {number} resolution Resolution. + * @param {number=} opt_direction If 0, the nearest resolution will be used. + * If 1, the nearest lower resolution will be used. If -1, the nearest + * higher resolution will be used. Default is 0. + * @return {number} Z. + * @api + */ + + + TileGrid.prototype.getZForResolution = function (resolution, opt_direction) { + var z = (0, _array.linearFindNearest)(this.resolutions_, resolution, opt_direction || 0); + return (0, _math.clamp)(z, this.minZoom, this.maxZoom); + }; + /** + * @param {!import("../extent.js").Extent} extent Extent for this tile grid. + * @private + */ + + + TileGrid.prototype.calculateTileRanges_ = function (extent) { + var length = this.resolutions_.length; + var fullTileRanges = new Array(length); + + for (var z = this.minZoom; z < length; ++z) { + fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z); + } + + this.fullTileRanges_ = fullTileRanges; + }; + + return TileGrid; +}(); + +var _default = TileGrid; +exports.default = _default; +},{"../TileRange.js":"../../../node_modules/ol/TileRange.js","./common.js":"../../../node_modules/ol/tilegrid/common.js","../asserts.js":"../../../node_modules/ol/asserts.js","../math.js":"../../../node_modules/ol/math.js","../extent.js":"../../../node_modules/ol/extent.js","../tilecoord.js":"../../../node_modules/ol/tilecoord.js","../array.js":"../../../node_modules/ol/array.js","../size.js":"../../../node_modules/ol/size.js"}],"../../../node_modules/ol/tilegrid.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getForProjection = getForProjection; +exports.wrapX = wrapX; +exports.createForExtent = createForExtent; +exports.createXYZ = createXYZ; +exports.createForProjection = createForProjection; +exports.extentFromProjection = extentFromProjection; + +var _Corner = _interopRequireDefault(require("./extent/Corner.js")); + +var _TileGrid = _interopRequireDefault(require("./tilegrid/TileGrid.js")); + +var _Units = _interopRequireDefault(require("./proj/Units.js")); + +var _common = require("./tilegrid/common.js"); + +var _proj = require("./proj.js"); + +var _extent = require("./extent.js"); + +var _size = require("./size.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @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 (!(0, _extent.containsCoordinate)(projectionExtent, center)) { + var worldWidth = (0, _extent.getWidth)(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/Corner.js").default=} 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 : _Corner.default.TOP_LEFT; + var resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize); + return new _TileGrid.default({ + extent: extent, + origin: (0, _extent.getCorner)(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 || (0, _proj.get)('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.default(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<number>} Resolutions array. + */ + + +function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize, opt_maxResolution) { + var maxZoom = opt_maxZoom !== undefined ? opt_maxZoom : _common.DEFAULT_MAX_ZOOM; + var height = (0, _extent.getHeight)(extent); + var width = (0, _extent.getWidth)(extent); + var tileSize = (0, _size.toSize)(opt_tileSize !== undefined ? opt_tileSize : _common.DEFAULT_TILE_SIZE); + 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/Corner.js").default=} 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 = (0, _proj.get)(projection); + var extent = projection.getExtent(); + + if (!extent) { + var half = 180 * _proj.METERS_PER_UNIT[_Units.default.DEGREES] / projection.getMetersPerUnit(); + extent = (0, _extent.createOrUpdate)(-half, -half, half, half); + } + + return extent; +} +},{"./extent/Corner.js":"../../../node_modules/ol/extent/Corner.js","./tilegrid/TileGrid.js":"../../../node_modules/ol/tilegrid/TileGrid.js","./proj/Units.js":"../../../node_modules/ol/proj/Units.js","./tilegrid/common.js":"../../../node_modules/ol/tilegrid/common.js","./proj.js":"../../../node_modules/ol/proj.js","./extent.js":"../../../node_modules/ol/extent.js","./size.js":"../../../node_modules/ol/size.js"}],"../../../node_modules/ol/source/Tile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.TileSourceEvent = void 0; + +var _Event = _interopRequireDefault(require("../events/Event.js")); + +var _Source = _interopRequireDefault(require("./Source.js")); + +var _TileCache = _interopRequireDefault(require("../TileCache.js")); + +var _TileState = _interopRequireDefault(require("../TileState.js")); + +var _util = require("../util.js"); + +var _proj = require("../proj.js"); + +var _tilecoord = require("../tilecoord.js"); + +var _tilegrid = require("../tilegrid.js"); + +var _size = require("../size.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/source/Tile + */ + + +/** + * @typedef {Object} Options + * @property {import("./Source.js").AttributionLike} [attributions] + * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible. + * @property {number} [cacheSize] + * @property {boolean} [opaque=false] Whether the layer is opaque. + * @property {number} [tilePixelRatio] + * @property {import("../proj.js").ProjectionLike} [projection] + * @property {import("./State.js").default} [state] + * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] + * @property {boolean} [wrapX=true] + * @property {number} [transition] + * @property {string} [key] + * @property {number} [zDirection=0] + */ + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Base class for sources providing images divided into a tile grid. + * @abstract + * @api + */ +var TileSource = +/** @class */ +function (_super) { + __extends(TileSource, _super); + /** + * @param {Options} options SourceTile source options. + */ + + + function TileSource(options) { + var _this = _super.call(this, { + attributions: options.attributions, + attributionsCollapsible: options.attributionsCollapsible, + projection: options.projection, + state: options.state, + wrapX: options.wrapX + }) || this; + /** + * @private + * @type {boolean} + */ + + + _this.opaque_ = options.opaque !== undefined ? options.opaque : false; + /** + * @private + * @type {number} + */ + + _this.tilePixelRatio_ = options.tilePixelRatio !== undefined ? options.tilePixelRatio : 1; + /** + * @protected + * @type {import("../tilegrid/TileGrid.js").default} + */ + + _this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null; + var tileSize = [256, 256]; + var tileGrid = options.tileGrid; + + if (tileGrid) { + (0, _size.toSize)(tileGrid.getTileSize(tileGrid.getMinZoom()), tileSize); + } + /** + * @protected + * @type {import("../TileCache.js").default} + */ + + + _this.tileCache = new _TileCache.default(options.cacheSize || 0); + /** + * @protected + * @type {import("../size.js").Size} + */ + + _this.tmpSize = [0, 0]; + /** + * @private + * @type {string} + */ + + _this.key_ = options.key || ''; + /** + * @protected + * @type {import("../Tile.js").Options} + */ + + _this.tileOptions = { + transition: options.transition + }; + /** + * zDirection hint, read by the renderer. Indicates which resolution should be used + * by a renderer if the views resolution does not match any resolution of the tile source. + * If 0, the nearest resolution will be used. If 1, the nearest lower resolution + * will be used. If -1, the nearest higher resolution will be used. + * @type {number} + */ + + _this.zDirection = options.zDirection ? options.zDirection : 0; + return _this; + } + /** + * @return {boolean} Can expire cache. + */ + + + TileSource.prototype.canExpireCache = function () { + return this.tileCache.canExpireCache(); + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @param {!Object<string, boolean>} usedTiles Used tiles. + */ + + + TileSource.prototype.expireCache = function (projection, usedTiles) { + var tileCache = this.getTileCacheForProjection(projection); + + if (tileCache) { + tileCache.expireCache(usedTiles); + } + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @param {number} z Zoom level. + * @param {import("../TileRange.js").default} tileRange Tile range. + * @param {function(import("../Tile.js").default):(boolean|void)} callback Called with each + * loaded tile. If the callback returns `false`, the tile will not be + * considered loaded. + * @return {boolean} The tile range is fully covered with loaded tiles. + */ + + + TileSource.prototype.forEachLoadedTile = function (projection, z, tileRange, callback) { + var tileCache = this.getTileCacheForProjection(projection); + + if (!tileCache) { + return false; + } + + var covered = true; + var tile, tileCoordKey, loaded; + + for (var x = tileRange.minX; x <= tileRange.maxX; ++x) { + for (var y = tileRange.minY; y <= tileRange.maxY; ++y) { + tileCoordKey = (0, _tilecoord.getKeyZXY)(z, x, y); + loaded = false; + + if (tileCache.containsKey(tileCoordKey)) { + tile = + /** @type {!import("../Tile.js").default} */ + tileCache.get(tileCoordKey); + loaded = tile.getState() === _TileState.default.LOADED; + + if (loaded) { + loaded = callback(tile) !== false; + } + } + + if (!loaded) { + covered = false; + } + } + } + + return covered; + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {number} Gutter. + */ + + + TileSource.prototype.getGutterForProjection = function (projection) { + return 0; + }; + /** + * Return the key to be used for all tiles in the source. + * @return {string} The key for all tiles. + * @protected + */ + + + TileSource.prototype.getKey = function () { + return this.key_; + }; + /** + * Set the value to be used as the key for all tiles in the source. + * @param {string} key The key for tiles. + * @protected + */ + + + TileSource.prototype.setKey = function (key) { + if (this.key_ !== key) { + this.key_ = key; + this.changed(); + } + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {boolean} Opaque. + */ + + + TileSource.prototype.getOpaque = function (projection) { + return this.opaque_; + }; + /** + * @return {Array<number>} Resolutions. + */ + + + TileSource.prototype.getResolutions = function () { + return this.tileGrid.getResolutions(); + }; + /** + * @abstract + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../Tile.js").default} Tile. + */ + + + TileSource.prototype.getTile = function (z, x, y, pixelRatio, projection) { + return (0, _util.abstract)(); + }; + /** + * Return the tile grid of the tile source. + * @return {import("../tilegrid/TileGrid.js").default} Tile grid. + * @api + */ + + + TileSource.prototype.getTileGrid = function () { + return this.tileGrid; + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../tilegrid/TileGrid.js").default} Tile grid. + */ + + + TileSource.prototype.getTileGridForProjection = function (projection) { + if (!this.tileGrid) { + return (0, _tilegrid.getForProjection)(projection); + } else { + return this.tileGrid; + } + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../TileCache.js").default} Tile cache. + * @protected + */ + + + TileSource.prototype.getTileCacheForProjection = function (projection) { + var thisProj = this.getProjection(); + + if (thisProj && !(0, _proj.equivalent)(thisProj, projection)) { + return null; + } else { + return this.tileCache; + } + }; + /** + * Get the tile pixel ratio for this source. Subclasses may override this + * method, which is meant to return a supported pixel ratio that matches the + * provided `pixelRatio` as close as possible. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Tile pixel ratio. + */ + + + TileSource.prototype.getTilePixelRatio = function (pixelRatio) { + return this.tilePixelRatio_; + }; + /** + * @param {number} z Z. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../size.js").Size} Tile size. + */ + + + TileSource.prototype.getTilePixelSize = function (z, pixelRatio, projection) { + var tileGrid = this.getTileGridForProjection(projection); + var tilePixelRatio = this.getTilePixelRatio(pixelRatio); + var tileSize = (0, _size.toSize)(tileGrid.getTileSize(z), this.tmpSize); + + if (tilePixelRatio == 1) { + return tileSize; + } else { + return (0, _size.scale)(tileSize, tilePixelRatio, this.tmpSize); + } + }; + /** + * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate + * is outside the resolution and extent range of the tile grid, `null` will be + * returned. + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("../proj/Projection.js").default=} opt_projection Projection. + * @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or + * null if no tile URL should be created for the passed `tileCoord`. + */ + + + TileSource.prototype.getTileCoordForTileUrlFunction = function (tileCoord, opt_projection) { + var projection = opt_projection !== undefined ? opt_projection : this.getProjection(); + var tileGrid = this.getTileGridForProjection(projection); + + if (this.getWrapX() && projection.isGlobal()) { + tileCoord = (0, _tilegrid.wrapX)(tileGrid, tileCoord, projection); + } + + return (0, _tilecoord.withinExtentAndZ)(tileCoord, tileGrid) ? tileCoord : null; + }; + /** + * Remove all cached tiles from the source. The next render cycle will fetch new tiles. + * @api + */ + + + TileSource.prototype.clear = function () { + this.tileCache.clear(); + }; + + TileSource.prototype.refresh = function () { + this.clear(); + + _super.prototype.refresh.call(this); + }; + /** + * Increases the cache size if needed + * @param {number} tileCount Minimum number of tiles needed. + * @param {import("../proj/Projection.js").default} projection Projection. + */ + + + TileSource.prototype.updateCacheSize = function (tileCount, projection) { + var tileCache = this.getTileCacheForProjection(projection); + + if (tileCount > tileCache.highWaterMark) { + tileCache.highWaterMark = tileCount; + } + }; + /** + * Marks a tile coord as being used, without triggering a load. + * @abstract + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {import("../proj/Projection.js").default} projection Projection. + */ + + + TileSource.prototype.useTile = function (z, x, y, projection) {}; + + return TileSource; +}(_Source.default); +/** + * @classdesc + * Events emitted by {@link module:ol/source/Tile~TileSource} instances are instances of this + * type. + */ + + +var TileSourceEvent = +/** @class */ +function (_super) { + __extends(TileSourceEvent, _super); + /** + * @param {string} type Type. + * @param {import("../Tile.js").default} tile The tile. + */ + + + function TileSourceEvent(type, tile) { + var _this = _super.call(this, type) || this; + /** + * The tile related to the event. + * @type {import("../Tile.js").default} + * @api + */ + + + _this.tile = tile; + return _this; + } + + return TileSourceEvent; +}(_Event.default); + +exports.TileSourceEvent = TileSourceEvent; +var _default = TileSource; +exports.default = _default; +},{"../events/Event.js":"../../../node_modules/ol/events/Event.js","./Source.js":"../../../node_modules/ol/source/Source.js","../TileCache.js":"../../../node_modules/ol/TileCache.js","../TileState.js":"../../../node_modules/ol/TileState.js","../util.js":"../../../node_modules/ol/util.js","../proj.js":"../../../node_modules/ol/proj.js","../tilecoord.js":"../../../node_modules/ol/tilecoord.js","../tilegrid.js":"../../../node_modules/ol/tilegrid.js","../size.js":"../../../node_modules/ol/size.js"}],"../../../node_modules/ol/tileurlfunction.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createFromTemplate = createFromTemplate; +exports.createFromTemplates = createFromTemplates; +exports.createFromTileUrlFunctions = createFromTileUrlFunctions; +exports.nullTileUrlFunction = nullTileUrlFunction; +exports.expandUrl = expandUrl; + +var _asserts = require("./asserts.js"); + +var _math = require("./math.js"); + +var _tilecoord = require("./tilecoord.js"); + +/** + * @module ol/tileurlfunction + */ + +/** + * @param {string} template Template. + * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid. + * @return {import("./Tile.js").UrlFunction} Tile URL function. + */ +function createFromTemplate(template, tileGrid) { + var zRegEx = /\{z\}/g; + var xRegEx = /\{x\}/g; + var yRegEx = /\{y\}/g; + var dashYRegEx = /\{-y\}/g; + return ( + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate. + * @param {number} pixelRatio Pixel ratio. + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {string|undefined} Tile URL. + */ + function (tileCoord, pixelRatio, projection) { + if (!tileCoord) { + return undefined; + } else { + return template.replace(zRegEx, tileCoord[0].toString()).replace(xRegEx, tileCoord[1].toString()).replace(yRegEx, tileCoord[2].toString()).replace(dashYRegEx, function () { + var z = tileCoord[0]; + var range = tileGrid.getFullTileRange(z); + (0, _asserts.assert)(range, 55); // The {-y} placeholder requires a tile grid with extent + + var y = range.getHeight() - tileCoord[2] - 1; + return y.toString(); + }); + } + } + ); +} +/** + * @param {Array<string>} templates Templates. + * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid. + * @return {import("./Tile.js").UrlFunction} Tile URL function. + */ + + +function createFromTemplates(templates, tileGrid) { + var len = templates.length; + var tileUrlFunctions = new Array(len); + + for (var i = 0; i < len; ++i) { + tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid); + } + + return createFromTileUrlFunctions(tileUrlFunctions); +} +/** + * @param {Array<import("./Tile.js").UrlFunction>} tileUrlFunctions Tile URL Functions. + * @return {import("./Tile.js").UrlFunction} Tile URL function. + */ + + +function createFromTileUrlFunctions(tileUrlFunctions) { + if (tileUrlFunctions.length === 1) { + return tileUrlFunctions[0]; + } + + return ( + /** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate. + * @param {number} pixelRatio Pixel ratio. + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {string|undefined} Tile URL. + */ + function (tileCoord, pixelRatio, projection) { + if (!tileCoord) { + return undefined; + } else { + var h = (0, _tilecoord.hash)(tileCoord); + var index = (0, _math.modulo)(h, tileUrlFunctions.length); + return tileUrlFunctions[index](tileCoord, pixelRatio, projection); + } + } + ); +} +/** + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {number} pixelRatio Pixel ratio. + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {string|undefined} Tile URL. + */ + + +function nullTileUrlFunction(tileCoord, pixelRatio, projection) { + return undefined; +} +/** + * @param {string} url URL. + * @return {Array<string>} Array of urls. + */ + + +function expandUrl(url) { + var urls = []; + var match = /\{([a-z])-([a-z])\}/.exec(url); + + if (match) { + // char range + var startCharCode = match[1].charCodeAt(0); + var stopCharCode = match[2].charCodeAt(0); + var charCode = void 0; + + for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) { + urls.push(url.replace(match[0], String.fromCharCode(charCode))); + } + + return urls; + } + + match = /\{(\d+)-(\d+)\}/.exec(url); + + if (match) { + // number range + var stop_1 = parseInt(match[2], 10); + + for (var i = parseInt(match[1], 10); i <= stop_1; i++) { + urls.push(url.replace(match[0], i.toString())); + } + + return urls; + } + + urls.push(url); + return urls; +} +},{"./asserts.js":"../../../node_modules/ol/asserts.js","./math.js":"../../../node_modules/ol/math.js","./tilecoord.js":"../../../node_modules/ol/tilecoord.js"}],"../../../node_modules/ol/source/UrlTile.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _TileEventType = _interopRequireDefault(require("./TileEventType.js")); + +var _Tile = _interopRequireWildcard(require("./Tile.js")); + +var _TileState = _interopRequireDefault(require("../TileState.js")); + +var _tileurlfunction = require("../tileurlfunction.js"); + +var _tilecoord = require("../tilecoord.js"); + +var _util = require("../util.js"); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/source/UrlTile + */ + + +/** + * @typedef {Object} Options + * @property {import("./Source.js").AttributionLike} [attributions] + * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible. + * @property {number} [cacheSize] + * @property {boolean} [opaque=false] Whether the layer is opaque. + * @property {import("../proj.js").ProjectionLike} [projection] + * @property {import("./State.js").default} [state] + * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] + * @property {import("../Tile.js").LoadFunction} tileLoadFunction + * @property {number} [tilePixelRatio] + * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] + * @property {string} [url] + * @property {Array<string>} [urls] + * @property {boolean} [wrapX=true] + * @property {number} [transition] + * @property {string} [key] + * @property {number} [zDirection=0] + */ + +/** + * @classdesc + * Base class for sources providing tiles divided into a tile grid over http. + * + * @fires import("./Tile.js").TileSourceEvent + */ +var UrlTile = +/** @class */ +function (_super) { + __extends(UrlTile, _super); + /** + * @param {Options} options Image tile options. + */ + + + function UrlTile(options) { + var _this = _super.call(this, { + attributions: options.attributions, + cacheSize: options.cacheSize, + opaque: options.opaque, + projection: options.projection, + state: options.state, + tileGrid: options.tileGrid, + tilePixelRatio: options.tilePixelRatio, + wrapX: options.wrapX, + transition: options.transition, + key: options.key, + attributionsCollapsible: options.attributionsCollapsible, + zDirection: options.zDirection + }) || this; + /** + * @private + * @type {boolean} + */ + + + _this.generateTileUrlFunction_ = _this.tileUrlFunction === UrlTile.prototype.tileUrlFunction; + /** + * @protected + * @type {import("../Tile.js").LoadFunction} + */ + + _this.tileLoadFunction = options.tileLoadFunction; + + if (options.tileUrlFunction) { + _this.tileUrlFunction = options.tileUrlFunction.bind(_this); + } + /** + * @protected + * @type {!Array<string>|null} + */ + + + _this.urls = null; + + if (options.urls) { + _this.setUrls(options.urls); + } else if (options.url) { + _this.setUrl(options.url); + } + /** + * @private + * @type {!Object<string, boolean>} + */ + + + _this.tileLoadingKeys_ = {}; + return _this; + } + /** + * Return the tile load function of the source. + * @return {import("../Tile.js").LoadFunction} TileLoadFunction + * @api + */ + + + UrlTile.prototype.getTileLoadFunction = function () { + return this.tileLoadFunction; + }; + /** + * Return the tile URL function of the source. + * @return {import("../Tile.js").UrlFunction} TileUrlFunction + * @api + */ + + + UrlTile.prototype.getTileUrlFunction = function () { + return this.tileUrlFunction; + }; + /** + * Return the URLs used for this source. + * When a tileUrlFunction is used instead of url or urls, + * null will be returned. + * @return {!Array<string>|null} URLs. + * @api + */ + + + UrlTile.prototype.getUrls = function () { + return this.urls; + }; + /** + * Handle tile change events. + * @param {import("../events/Event.js").default} event Event. + * @protected + */ + + + UrlTile.prototype.handleTileChange = function (event) { + var tile = + /** @type {import("../Tile.js").default} */ + event.target; + var uid = (0, _util.getUid)(tile); + var tileState = tile.getState(); + var type; + + if (tileState == _TileState.default.LOADING) { + this.tileLoadingKeys_[uid] = true; + type = _TileEventType.default.TILELOADSTART; + } else if (uid in this.tileLoadingKeys_) { + delete this.tileLoadingKeys_[uid]; + type = tileState == _TileState.default.ERROR ? _TileEventType.default.TILELOADERROR : tileState == _TileState.default.LOADED ? _TileEventType.default.TILELOADEND : undefined; + } + + if (type != undefined) { + this.dispatchEvent(new _Tile.TileSourceEvent(type, tile)); + } + }; + /** + * Set the tile load function of the source. + * @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function. + * @api + */ + + + UrlTile.prototype.setTileLoadFunction = function (tileLoadFunction) { + this.tileCache.clear(); + this.tileLoadFunction = tileLoadFunction; + this.changed(); + }; + /** + * Set the tile URL function of the source. + * @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function. + * @param {string=} key Optional new tile key for the source. + * @api + */ + + + UrlTile.prototype.setTileUrlFunction = function (tileUrlFunction, key) { + this.tileUrlFunction = tileUrlFunction; + this.tileCache.pruneExceptNewestZ(); + + if (typeof key !== 'undefined') { + this.setKey(key); + } else { + this.changed(); + } + }; + /** + * Set the URL to use for requests. + * @param {string} url URL. + * @api + */ + + + UrlTile.prototype.setUrl = function (url) { + var urls = (0, _tileurlfunction.expandUrl)(url); + this.urls = urls; + this.setUrls(urls); + }; + /** + * Set the URLs to use for requests. + * @param {Array<string>} urls URLs. + * @api + */ + + + UrlTile.prototype.setUrls = function (urls) { + this.urls = urls; + var key = urls.join('\n'); + + if (this.generateTileUrlFunction_) { + this.setTileUrlFunction((0, _tileurlfunction.createFromTemplates)(urls, this.tileGrid), key); + } else { + this.setKey(key); + } + }; + /** + * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {string|undefined} Tile URL. + */ + + + UrlTile.prototype.tileUrlFunction = function (tileCoord, pixelRatio, projection) { + return undefined; + }; + /** + * Marks a tile coord as being used, without triggering a load. + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + */ + + + UrlTile.prototype.useTile = function (z, x, y) { + var tileCoordKey = (0, _tilecoord.getKeyZXY)(z, x, y); + + if (this.tileCache.containsKey(tileCoordKey)) { + this.tileCache.get(tileCoordKey); + } + }; + + return UrlTile; +}(_Tile.default); + +var _default = UrlTile; +exports.default = _default; +},{"./TileEventType.js":"../../../node_modules/ol/source/TileEventType.js","./Tile.js":"../../../node_modules/ol/source/Tile.js","../TileState.js":"../../../node_modules/ol/TileState.js","../tileurlfunction.js":"../../../node_modules/ol/tileurlfunction.js","../tilecoord.js":"../../../node_modules/ol/tilecoord.js","../util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/source/TileImage.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _EventType = _interopRequireDefault(require("../events/EventType.js")); + +var _ImageTile = _interopRequireDefault(require("../ImageTile.js")); + +var _Tile = _interopRequireDefault(require("../reproj/Tile.js")); + +var _TileCache = _interopRequireDefault(require("../TileCache.js")); + +var _TileState = _interopRequireDefault(require("../TileState.js")); + +var _UrlTile = _interopRequireDefault(require("./UrlTile.js")); + +var _common = require("../reproj/common.js"); + +var _common2 = require("./common.js"); + +var _proj = require("../proj.js"); + +var _tilecoord = require("../tilecoord.js"); + +var _tilegrid = require("../tilegrid.js"); + +var _util = require("../util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +/** + * @module ol/source/TileImage + */ + + +/** + * @typedef {Object} Options + * @property {import("./Source.js").AttributionLike} [attributions] Attributions. + * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible. + * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport. + * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that + * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. + * @property {boolean} [imageSmoothing=true] Enable image smoothing. + * @property {boolean} [opaque=false] Whether the layer is opaque. + * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. + * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {import("./State.js").default} [state] Source state. + * @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles. + * Default is {@link module:ol/ImageTile~ImageTile}. + * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. + * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile + * service advertizes 256px by 256px tiles but actually sends 512px + * by 512px images (for retina/hidpi devices) then `tilePixelRatio` + * should be set to `2`. + * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection. + * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. + * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be + * used instead of defining each one separately in the `urls` option. + * @property {Array<string>} [urls] An array of URL templates. + * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to + * request out-of-bounds tiles from the server. When set to `false`, only one + * world will be rendered. When set to `true`, tiles will be requested for one + * world only, but they will be wrapped horizontally to render multiple worlds. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + * @property {string} [key] Optional tile key for proper cache fetching + * @property {number} [zDirection=0] Indicate which resolution should be used + * by a renderer if the view resolution does not match any resolution of the tile source. + * If 0, the nearest resolution will be used. If 1, the nearest lower resolution + * will be used. If -1, the nearest higher resolution will be used. + */ + +/** + * @classdesc + * Base class for sources providing images divided into a tile grid. + * + * @fires import("./Tile.js").TileSourceEvent + * @api + */ +var TileImage = +/** @class */ +function (_super) { + __extends(TileImage, _super); + /** + * @param {!Options} options Image tile options. + */ + + + function TileImage(options) { + var _this = _super.call(this, { + attributions: options.attributions, + cacheSize: options.cacheSize, + opaque: options.opaque, + projection: options.projection, + state: options.state, + tileGrid: options.tileGrid, + tileLoadFunction: options.tileLoadFunction ? options.tileLoadFunction : defaultTileLoadFunction, + tilePixelRatio: options.tilePixelRatio, + tileUrlFunction: options.tileUrlFunction, + url: options.url, + urls: options.urls, + wrapX: options.wrapX, + transition: options.transition, + key: options.key, + attributionsCollapsible: options.attributionsCollapsible, + zDirection: options.zDirection + }) || this; + /** + * @protected + * @type {?string} + */ + + + _this.crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : null; + /** + * @protected + * @type {typeof ImageTile} + */ + + _this.tileClass = options.tileClass !== undefined ? options.tileClass : _ImageTile.default; + /** + * @protected + * @type {!Object<string, TileCache>} + */ + + _this.tileCacheForProjection = {}; + /** + * @protected + * @type {!Object<string, import("../tilegrid/TileGrid.js").default>} + */ + + _this.tileGridForProjection = {}; + /** + * @private + * @type {number|undefined} + */ + + _this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold; + /** + * @private + * @type {object|undefined} + */ + + _this.contextOptions_ = options.imageSmoothing === false ? _common2.IMAGE_SMOOTHING_DISABLED : undefined; + /** + * @private + * @type {boolean} + */ + + _this.renderReprojectionEdges_ = false; + return _this; + } + /** + * @return {boolean} Can expire cache. + */ + + + TileImage.prototype.canExpireCache = function () { + if (!_common.ENABLE_RASTER_REPROJECTION) { + return _super.prototype.canExpireCache.call(this); + } + + if (this.tileCache.canExpireCache()) { + return true; + } else { + for (var key in this.tileCacheForProjection) { + if (this.tileCacheForProjection[key].canExpireCache()) { + return true; + } + } + } + + return false; + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @param {!Object<string, boolean>} usedTiles Used tiles. + */ + + + TileImage.prototype.expireCache = function (projection, usedTiles) { + if (!_common.ENABLE_RASTER_REPROJECTION) { + _super.prototype.expireCache.call(this, projection, usedTiles); + + return; + } + + var usedTileCache = this.getTileCacheForProjection(projection); + this.tileCache.expireCache(this.tileCache == usedTileCache ? usedTiles : {}); + + for (var id in this.tileCacheForProjection) { + var tileCache = this.tileCacheForProjection[id]; + tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {}); + } + }; + /** + * @return {Object|undefined} Context options. + */ + + + TileImage.prototype.getContextOptions = function () { + return this.contextOptions_; + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {number} Gutter. + */ + + + TileImage.prototype.getGutterForProjection = function (projection) { + if (_common.ENABLE_RASTER_REPROJECTION && this.getProjection() && projection && !(0, _proj.equivalent)(this.getProjection(), projection)) { + return 0; + } else { + return this.getGutter(); + } + }; + /** + * @return {number} Gutter. + */ + + + TileImage.prototype.getGutter = function () { + return 0; + }; + /** + * Return the key to be used for all tiles in the source. + * @return {string} The key for all tiles. + * @protected + */ + + + TileImage.prototype.getKey = function () { + return _super.prototype.getKey.call(this) + (this.contextOptions_ ? '\n' + JSON.stringify(this.contextOptions_) : ''); + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {boolean} Opaque. + */ + + + TileImage.prototype.getOpaque = function (projection) { + if (_common.ENABLE_RASTER_REPROJECTION && this.getProjection() && projection && !(0, _proj.equivalent)(this.getProjection(), projection)) { + return false; + } else { + return _super.prototype.getOpaque.call(this, projection); + } + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../tilegrid/TileGrid.js").default} Tile grid. + */ + + + TileImage.prototype.getTileGridForProjection = function (projection) { + if (!_common.ENABLE_RASTER_REPROJECTION) { + return _super.prototype.getTileGridForProjection.call(this, projection); + } + + var thisProj = this.getProjection(); + + if (this.tileGrid && (!thisProj || (0, _proj.equivalent)(thisProj, projection))) { + return this.tileGrid; + } else { + var projKey = (0, _util.getUid)(projection); + + if (!(projKey in this.tileGridForProjection)) { + this.tileGridForProjection[projKey] = (0, _tilegrid.getForProjection)(projection); + } + + return this.tileGridForProjection[projKey]; + } + }; + /** + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../TileCache.js").default} Tile cache. + */ + + + TileImage.prototype.getTileCacheForProjection = function (projection) { + if (!_common.ENABLE_RASTER_REPROJECTION) { + return _super.prototype.getTileCacheForProjection.call(this, projection); + } + + var thisProj = this.getProjection(); + + if (!thisProj || (0, _proj.equivalent)(thisProj, projection)) { + return this.tileCache; + } else { + var projKey = (0, _util.getUid)(projection); + + if (!(projKey in this.tileCacheForProjection)) { + this.tileCacheForProjection[projKey] = new _TileCache.default(this.tileCache.highWaterMark); + } + + return this.tileCacheForProjection[projKey]; + } + }; + /** + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @param {string} key The key set on the tile. + * @return {!import("../Tile.js").default} Tile. + * @private + */ + + + TileImage.prototype.createTile_ = function (z, x, y, pixelRatio, projection, key) { + var tileCoord = [z, x, y]; + var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); + var tileUrl = urlTileCoord ? this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined; + var tile = new this.tileClass(tileCoord, tileUrl !== undefined ? _TileState.default.IDLE : _TileState.default.EMPTY, tileUrl !== undefined ? tileUrl : '', this.crossOrigin, this.tileLoadFunction, this.tileOptions); + tile.key = key; + tile.addEventListener(_EventType.default.CHANGE, this.handleTileChange.bind(this)); + return tile; + }; + /** + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../Tile.js").default} Tile. + */ + + + TileImage.prototype.getTile = function (z, x, y, pixelRatio, projection) { + var sourceProjection = this.getProjection(); + + if (!_common.ENABLE_RASTER_REPROJECTION || !sourceProjection || !projection || (0, _proj.equivalent)(sourceProjection, projection)) { + return this.getTileInternal(z, x, y, pixelRatio, sourceProjection || projection); + } else { + var cache = this.getTileCacheForProjection(projection); + var tileCoord = [z, x, y]; + var tile = void 0; + var tileCoordKey = (0, _tilecoord.getKey)(tileCoord); + + if (cache.containsKey(tileCoordKey)) { + tile = cache.get(tileCoordKey); + } + + var key = this.getKey(); + + if (tile && tile.key == key) { + return tile; + } else { + var sourceTileGrid = this.getTileGridForProjection(sourceProjection); + var targetTileGrid = this.getTileGridForProjection(projection); + var wrappedTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); + var newTile = new _Tile.default(sourceProjection, sourceTileGrid, projection, targetTileGrid, tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio), this.getGutter(), function (z, x, y, pixelRatio) { + return this.getTileInternal(z, x, y, pixelRatio, sourceProjection); + }.bind(this), this.reprojectionErrorThreshold_, this.renderReprojectionEdges_, this.contextOptions_); + newTile.key = key; + + if (tile) { + newTile.interimTile = tile; + newTile.refreshInterimChain(); + cache.replace(tileCoordKey, newTile); + } else { + cache.set(tileCoordKey, newTile); + } + + return newTile; + } + } + }; + /** + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {!import("../proj/Projection.js").default} projection Projection. + * @return {!import("../Tile.js").default} Tile. + * @protected + */ + + + TileImage.prototype.getTileInternal = function (z, x, y, pixelRatio, projection) { + var tile = null; + var tileCoordKey = (0, _tilecoord.getKeyZXY)(z, x, y); + var key = this.getKey(); + + if (!this.tileCache.containsKey(tileCoordKey)) { + tile = this.createTile_(z, x, y, pixelRatio, projection, key); + this.tileCache.set(tileCoordKey, tile); + } else { + tile = this.tileCache.get(tileCoordKey); + + if (tile.key != key) { + // The source's params changed. If the tile has an interim tile and if we + // can use it then we use it. Otherwise we create a new tile. In both + // cases we attempt to assign an interim tile to the new tile. + var interimTile = tile; + tile = this.createTile_(z, x, y, pixelRatio, projection, key); //make the new tile the head of the list, + + if (interimTile.getState() == _TileState.default.IDLE) { + //the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it + tile.interimTile = interimTile.interimTile; + } else { + tile.interimTile = interimTile; + } + + tile.refreshInterimChain(); + this.tileCache.replace(tileCoordKey, tile); + } + } + + return tile; + }; + /** + * Sets whether to render reprojection edges or not (usually for debugging). + * @param {boolean} render Render the edges. + * @api + */ + + + TileImage.prototype.setRenderReprojectionEdges = function (render) { + if (!_common.ENABLE_RASTER_REPROJECTION || this.renderReprojectionEdges_ == render) { + return; + } + + this.renderReprojectionEdges_ = render; + + for (var id in this.tileCacheForProjection) { + this.tileCacheForProjection[id].clear(); + } + + this.changed(); + }; + /** + * Sets the tile grid to use when reprojecting the tiles to the given + * projection instead of the default tile grid for the projection. + * + * This can be useful when the default tile grid cannot be created + * (e.g. projection has no extent defined) or + * for optimization reasons (custom tile size, resolutions, ...). + * + * @param {import("../proj.js").ProjectionLike} projection Projection. + * @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection. + * @api + */ + + + TileImage.prototype.setTileGridForProjection = function (projection, tilegrid) { + if (_common.ENABLE_RASTER_REPROJECTION) { + var proj = (0, _proj.get)(projection); + + if (proj) { + var projKey = (0, _util.getUid)(proj); + + if (!(projKey in this.tileGridForProjection)) { + this.tileGridForProjection[projKey] = tilegrid; + } + } + } + }; + + return TileImage; +}(_UrlTile.default); +/** + * @param {ImageTile} imageTile Image tile. + * @param {string} src Source. + */ + + +function defaultTileLoadFunction(imageTile, src) { + /** @type {HTMLImageElement|HTMLVideoElement} */ + imageTile.getImage().src = src; +} + +var _default = TileImage; +exports.default = _default; +},{"../events/EventType.js":"../../../node_modules/ol/events/EventType.js","../ImageTile.js":"../../../node_modules/ol/ImageTile.js","../reproj/Tile.js":"../../../node_modules/ol/reproj/Tile.js","../TileCache.js":"../../../node_modules/ol/TileCache.js","../TileState.js":"../../../node_modules/ol/TileState.js","./UrlTile.js":"../../../node_modules/ol/source/UrlTile.js","../reproj/common.js":"../../../node_modules/ol/reproj/common.js","./common.js":"../../../node_modules/ol/source/common.js","../proj.js":"../../../node_modules/ol/proj.js","../tilecoord.js":"../../../node_modules/ol/tilecoord.js","../tilegrid.js":"../../../node_modules/ol/tilegrid.js","../util.js":"../../../node_modules/ol/util.js"}],"../../../node_modules/ol/source/XYZ.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _TileImage = _interopRequireDefault(require("./TileImage.js")); + +var _tilegrid = require("../tilegrid.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/source/XYZ + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * @typedef {Object} Options + * @property {import("./Source.js").AttributionLike} [attributions] Attributions. + * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible. + * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport. + * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that + * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. + * @property {boolean} [imageSmoothing=true] Enable image smoothing. + * @property {boolean} [opaque=false] Whether the layer is opaque. + * @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection. + * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided. + * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided. + * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided. + * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. + * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. + * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px + * by 512px images (for retina/hidpi devices) then `tilePixelRatio` + * should be set to `2`. + * @property {number|import("../size.js").Size} [tileSize=[256, 256]] The tile size used by the tile service. + * Not used if `tileGrid` is provided. + * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get + * tile URL given a tile coordinate and the projection. + * Required if `url` or `urls` are not provided. + * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, + * and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, + * may be used instead of defining each one separately in the `urls` option. + * @property {Array<string>} [urls] An array of URL templates. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + * @property {number} [zDirection=0] Indicate which resolution should be used + * by a renderer if the view resolution does not match any resolution of the tile source. + * If 0, the nearest resolution will be used. If 1, the nearest lower resolution + * will be used. If -1, the nearest higher resolution will be used. + */ + +/** + * @classdesc + * Layer source for tile data with URLs in a set XYZ format that are + * defined in a URL template. By default, this follows the widely-used + * Google grid where `x` 0 and `y` 0 are in the top left. Grids like + * TMS where `x` 0 and `y` 0 are in the bottom left can be used by + * using the `{-y}` placeholder in the URL template, so long as the + * source does not have a custom tile grid. In this case, + * {@link module:ol/source/TileImage} can be used with a `tileUrlFunction` + * such as: + * + * tileUrlFunction: function(coordinate) { + * return 'http://mapserver.com/' + coordinate[0] + '/' + + * coordinate[1] + '/' + coordinate[2] + '.png'; + * } + * + * @api + */ +var XYZ = +/** @class */ +function (_super) { + __extends(XYZ, _super); + /** + * @param {Options=} opt_options XYZ options. + */ + + + function XYZ(opt_options) { + var _this = this; + + var options = opt_options || {}; + var projection = options.projection !== undefined ? options.projection : 'EPSG:3857'; + var tileGrid = options.tileGrid !== undefined ? options.tileGrid : (0, _tilegrid.createXYZ)({ + extent: (0, _tilegrid.extentFromProjection)(projection), + maxResolution: options.maxResolution, + maxZoom: options.maxZoom, + minZoom: options.minZoom, + tileSize: options.tileSize + }); + _this = _super.call(this, { + attributions: options.attributions, + cacheSize: options.cacheSize, + crossOrigin: options.crossOrigin, + imageSmoothing: options.imageSmoothing, + opaque: options.opaque, + projection: projection, + reprojectionErrorThreshold: options.reprojectionErrorThreshold, + tileGrid: tileGrid, + tileLoadFunction: options.tileLoadFunction, + tilePixelRatio: options.tilePixelRatio, + tileUrlFunction: options.tileUrlFunction, + url: options.url, + urls: options.urls, + wrapX: options.wrapX !== undefined ? options.wrapX : true, + transition: options.transition, + attributionsCollapsible: options.attributionsCollapsible, + zDirection: options.zDirection + }) || this; + return _this; + } + + return XYZ; +}(_TileImage.default); + +var _default = XYZ; +exports.default = _default; +},{"./TileImage.js":"../../../node_modules/ol/source/TileImage.js","../tilegrid.js":"../../../node_modules/ol/tilegrid.js"}],"../../../node_modules/ol/source/OSM.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.ATTRIBUTION = void 0; + +var _XYZ = _interopRequireDefault(require("./XYZ.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * @module ol/source/OSM + */ +var __extends = void 0 && (void 0).__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 (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + return function (d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); + +/** + * The attribution containing a link to the OpenStreetMap Copyright and License + * page. + * @const + * @type {string} + * @api + */ +var ATTRIBUTION = '© ' + '<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> ' + 'contributors.'; +/** + * @typedef {Object} Options + * @property {import("./Source.js").AttributionLike} [attributions] Attributions. + * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport. + * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images. Note that + * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. + * @property {boolean} [imageSmoothing=true] Enable image smoothing. + * @property {number} [maxZoom=19] Max zoom. + * @property {boolean} [opaque=true] Whether the layer is opaque. + * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template. + * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + */ + +/** + * @classdesc + * Layer source for the OpenStreetMap tile server. + * @api + */ + +exports.ATTRIBUTION = ATTRIBUTION; + +var OSM = +/** @class */ +function (_super) { + __extends(OSM, _super); + /** + * @param {Options=} [opt_options] Open Street Map options. + */ + + + function OSM(opt_options) { + var _this = this; + + var options = opt_options || {}; + var attributions; + + if (options.attributions !== undefined) { + attributions = options.attributions; + } else { + attributions = [ATTRIBUTION]; + } + + var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous'; + var url = options.url !== undefined ? options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + _this = _super.call(this, { + attributions: attributions, + cacheSize: options.cacheSize, + crossOrigin: crossOrigin, + imageSmoothing: options.imageSmoothing, + opaque: options.opaque !== undefined ? options.opaque : true, + maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19, + reprojectionErrorThreshold: options.reprojectionErrorThreshold, + tileLoadFunction: options.tileLoadFunction, + url: url, + wrapX: options.wrapX, + attributionsCollapsible: false + }) || this; + return _this; + } + + return OSM; +}(_XYZ.default); + +var _default = OSM; +exports.default = _default; +},{"./XYZ.js":"../../../node_modules/ol/source/XYZ.js"}],"map.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.viewMap = viewMap; + +require("ol/ol.css"); + +var _ol2 = require("ol"); + +var _Feature = _interopRequireDefault(require("ol/Feature")); + +var _Point = _interopRequireDefault(require("ol/geom/Point")); + +var _style = require("ol/style"); + +var _Tile = _interopRequireDefault(require("ol/layer/Tile")); + +var _OSM = _interopRequireDefault(require("ol/source/OSM")); + +var _proj = require("ol/proj"); + +var _Vector = _interopRequireDefault(require("ol/layer/Vector")); + +var _Vector2 = _interopRequireDefault(require("ol/source/Vector")); + +var _Layer = _interopRequireDefault(require("ol/layer/Layer")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* When the user clicks on the button, +toggle between hiding and showing the dropdown content */ +$('.ui.dropdown').dropdown(); + +function viewMap(center, users) { + var longLat = [center.long, center.lat]; + var WebMercator = (0, _proj.fromLonLat)(longLat); + var features = users.map(function (_ref) { + var location = _ref.location; + + if (!location) { + return; + } + + var longitude = location.longitude, + latitude = location.latitude; + + if (!longitude || !latitude) { + return; + } + + var marker = new _Feature.default({ + geometry: new _Point.default((0, _proj.fromLonLat)([longitude, latitude])), + name: "[".concat(longitude, ",").concat(latitude, "]") + }); + marker.setStyle(new _style.Style({ + image: new _style.Circle({ + fill: new _style.Fill({ + color: '#ff0000' + }), + stroke: new _style.Stroke({ + color: '#000000', + width: 1 + }), + radius: 5 + }) + })); + return marker; + }); + var tileLayer = new _Tile.default({ + source: new _OSM.default() + }); + var vectorLayer = new _Vector.default({ + source: new _Vector2.default({ + features: features.filter(function (f) { + return f; + }) + }) + }); + var map = new _ol2.Map({ + target: 'map', + layers: [tileLayer, vectorLayer], + view: new _ol2.View({ + center: WebMercator, + zoom: 13 + }) + }); +} +},{"ol/ol.css":"../../../node_modules/ol/ol.css","ol":"../../../node_modules/ol/index.js","ol/Feature":"../../../node_modules/ol/Feature.js","ol/geom/Point":"../../../node_modules/ol/geom/Point.js","ol/style":"../../../node_modules/ol/style.js","ol/layer/Tile":"../../../node_modules/ol/layer/Tile.js","ol/source/OSM":"../../../node_modules/ol/source/OSM.js","ol/proj":"../../../node_modules/ol/proj.js","ol/layer/Vector":"../../../node_modules/ol/layer/Vector.js","ol/source/Vector":"../../../node_modules/ol/source/Vector.js","ol/layer/Layer":"../../../node_modules/ol/layer/Layer.js"}],"../../../node_modules/parcel-bundler/src/builtins/hmr-runtime.js":[function(require,module,exports) { +var global = arguments[3]; +var OVERLAY_ID = '__parcel__error__overlay__'; +var OldModule = module.bundle.Module; + +function Module(moduleName) { + OldModule.call(this, moduleName); + this.hot = { + data: module.bundle.hotData, + _acceptCallbacks: [], + _disposeCallbacks: [], + accept: function (fn) { + this._acceptCallbacks.push(fn || function () {}); + }, + dispose: function (fn) { + this._disposeCallbacks.push(fn); + } + }; + module.bundle.hotData = null; +} + +module.bundle.Module = Module; +var checkedAssets, assetsToAccept; +var parent = module.bundle.parent; + +if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { + var hostname = "" || location.hostname; + var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; + var ws = new WebSocket(protocol + '://' + hostname + ':' + "37695" + '/'); + + ws.onmessage = function (event) { + checkedAssets = {}; + assetsToAccept = []; + var data = JSON.parse(event.data); + + if (data.type === 'update') { + var handled = false; + data.assets.forEach(function (asset) { + if (!asset.isNew) { + var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id); + + if (didAccept) { + handled = true; + } + } + }); // Enable HMR for CSS by default. + + handled = handled || data.assets.every(function (asset) { + return asset.type === 'css' && asset.generated.js; + }); + + if (handled) { + console.clear(); + data.assets.forEach(function (asset) { + hmrApply(global.parcelRequire, asset); + }); + assetsToAccept.forEach(function (v) { + hmrAcceptRun(v[0], v[1]); + }); + } else if (location.reload) { + // `location` global exists in a web worker context but lacks `.reload()` function. + location.reload(); + } + } + + if (data.type === 'reload') { + ws.close(); + + ws.onclose = function () { + location.reload(); + }; + } + + if (data.type === 'error-resolved') { + console.log('[parcel] ✨ Error resolved'); + removeErrorOverlay(); + } + + if (data.type === 'error') { + console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack); + removeErrorOverlay(); + var overlay = createErrorOverlay(data); + document.body.appendChild(overlay); + } + }; +} + +function removeErrorOverlay() { + var overlay = document.getElementById(OVERLAY_ID); + + if (overlay) { + overlay.remove(); + } +} + +function createErrorOverlay(data) { + var overlay = document.createElement('div'); + overlay.id = OVERLAY_ID; // html encode message and stack trace + + var message = document.createElement('div'); + var stackTrace = document.createElement('pre'); + message.innerText = data.error.message; + stackTrace.innerText = data.error.stack; + overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>'; + return overlay; +} + +function getParents(bundle, id) { + var modules = bundle.modules; + + if (!modules) { + return []; + } + + var parents = []; + var k, d, dep; + + for (k in modules) { + for (d in modules[k][1]) { + dep = modules[k][1][d]; + + if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) { + parents.push(k); + } + } + } + + if (bundle.parent) { + parents = parents.concat(getParents(bundle.parent, id)); + } + + return parents; +} + +function hmrApply(bundle, asset) { + var modules = bundle.modules; + + if (!modules) { + return; + } + + if (modules[asset.id] || !bundle.parent) { + var fn = new Function('require', 'module', 'exports', asset.generated.js); + asset.isNew = !modules[asset.id]; + modules[asset.id] = [fn, asset.deps]; + } else if (bundle.parent) { + hmrApply(bundle.parent, asset); + } +} + +function hmrAcceptCheck(bundle, id) { + var modules = bundle.modules; + + if (!modules) { + return; + } + + if (!modules[id] && bundle.parent) { + return hmrAcceptCheck(bundle.parent, id); + } + + if (checkedAssets[id]) { + return; + } + + checkedAssets[id] = true; + var cached = bundle.cache[id]; + assetsToAccept.push([bundle, id]); + + if (cached && cached.hot && cached.hot._acceptCallbacks.length) { + return true; + } + + return getParents(global.parcelRequire, id).some(function (id) { + return hmrAcceptCheck(global.parcelRequire, id); + }); +} + +function hmrAcceptRun(bundle, id) { + var cached = bundle.cache[id]; + bundle.hotData = {}; + + if (cached) { + cached.hot.data = bundle.hotData; + } + + if (cached && cached.hot && cached.hot._disposeCallbacks.length) { + cached.hot._disposeCallbacks.forEach(function (cb) { + cb(bundle.hotData); + }); + } + + delete bundle.cache[id]; + bundle(id); + cached = bundle.cache[id]; + + if (cached && cached.hot && cached.hot._acceptCallbacks.length) { + cached.hot._acceptCallbacks.forEach(function (cb) { + cb(); + }); + + return true; + } +} +},{}]},{},["../../../node_modules/parcel-bundler/src/builtins/hmr-runtime.js","map.js"], null) +//# sourceMappingURL=/map.js.map \ No newline at end of file diff --git a/public/assets/dist/map.js.map b/public/assets/dist/map.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5c9194425cdbf5494d6393c7f8a5d35dbc91841f --- /dev/null +++ b/public/assets/dist/map.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["src/util.js","src/AssertionError.js","../src/events/Event.js","src/ObjectEventType.js","src/Disposable.js","src/array.js","src/functions.js","src/obj.js","../src/events/Target.js","../src/events/EventType.js","src/events.js","src/Observable.js","src/Object.js","src/CollectionEventType.js","src/Collection.js","src/asserts.js","src/Feature.js","../src/geom/GeometryLayout.js","../src/geom/GeometryType.js","../src/proj/Units.js","src/transform.js","../src/extent/Corner.js","../src/extent/Relationship.js","src/extent.js","../src/proj/Projection.js","src/math.js","../src/proj/epsg3857.js","../src/proj/epsg4326.js","../src/proj/projections.js","../src/proj/transforms.js","src/sphere.js","src/string.js","src/coordinate.js","src/proj.js","../../src/geom/flat/transform.js","../src/geom/Geometry.js","../src/geom/SimpleGeometry.js","../../src/geom/flat/closest.js","../../src/geom/flat/deflate.js","../../src/geom/flat/simplify.js","../../src/geom/flat/inflate.js","../../src/geom/flat/area.js","../src/geom/LinearRing.js","../src/geom/Point.js","../../src/geom/flat/contains.js","../../src/geom/flat/interiorpoint.js","../../src/geom/flat/segments.js","../../src/geom/flat/intersectsextent.js","../../src/geom/flat/reverse.js","../../src/geom/flat/orient.js","../src/geom/Polygon.js","src/Geolocation.js","../src/render/EventType.js","../src/style/Fill.js","../../src/geom/flat/interpolate.js","../../src/geom/flat/length.js","../src/geom/LineString.js","../src/style/Stroke.js","src/ImageState.js","src/size.js","../src/style/Image.js","src/color.js","src/colorlike.js","src/has.js","src/dom.js","src/css.js","../src/render/canvas.js","../src/style/RegularShape.js","../src/style/Circle.js","../src/style/Style.js","../src/style/TextPlacement.js","../src/style/Text.js","../src/layer/Property.js","../src/layer/Base.js","../src/source/State.js","../src/layer/Layer.js","../src/layer/BaseVector.js","../../src/render/canvas/Instruction.js","../src/render/VectorContext.js","../../src/render/canvas/Builder.js","../../src/render/canvas/ImageBuilder.js","../../src/render/canvas/LineStringBuilder.js","../../src/render/canvas/PolygonBuilder.js","../../src/geom/flat/straightchunk.js","../../src/render/canvas/TextBuilder.js","../../src/render/canvas/BuilderGroup.js","../src/renderer/Layer.js","../src/render/Event.js","../../src/renderer/canvas/Layer.js","../../src/render/canvas/BuilderType.js","../../../node_modules/rbush/rbush.js","../../src/geom/flat/textpath.js","../../src/render/canvas/Executor.js","../../src/render/canvas/ExecutorGroup.js","src/ViewHint.js","../../src/render/canvas/Immediate.js","../src/style/IconAnchorUnits.js","../src/style/IconOrigin.js","../src/style/IconImageCache.js","src/ImageBase.js","src/Image.js","../src/style/IconImage.js","../src/style/Icon.js","src/style.js","../../src/render/canvas/hitdetect.js","../src/renderer/vector.js","../../src/renderer/canvas/VectorLayer.js","../src/layer/Vector.js","../src/structs/RBush.js","../src/source/Source.js","../src/source/VectorEventType.js","src/loadingstrategy.js","../src/format/FormatType.js","src/featureloader.js","../src/source/Vector.js","src/render.js","../../src/geom/flat/geodesic.js","../src/layer/Graticule.js","src/ImageCanvas.js","src/TileState.js","src/easing.js","src/Tile.js","src/ImageTile.js","src/Kinetic.js","../src/renderer/Map.js","../src/renderer/Composite.js","../src/layer/Group.js","src/MapEvent.js","src/MapBrowserEvent.js","src/MapBrowserEventType.js","../src/pointer/EventType.js","src/MapBrowserEventHandler.js","src/MapEventType.js","src/MapProperty.js","../src/structs/PriorityQueue.js","src/TileQueue.js","src/ViewProperty.js","../src/tilegrid/common.js","src/centerconstraint.js","src/resolutionconstraint.js","src/rotationconstraint.js","src/View.js","src/PluggableMap.js","../src/control/Control.js","../src/control/Attribution.js","../src/control/Rotate.js","../src/control/Zoom.js","../src/control/FullScreen.js","../src/control/MousePosition.js","src/OverlayPositioning.js","src/Overlay.js","../src/control/OverviewMap.js","../src/control/ScaleLine.js","../src/control/ZoomSlider.js","../src/control/ZoomToExtent.js","src/control.js","../src/interaction/Property.js","../src/interaction/Interaction.js","../src/interaction/DoubleClickZoom.js","../src/interaction/Pointer.js","../src/events/condition.js","../src/interaction/DragPan.js","../src/interaction/DragRotate.js","../src/render/Box.js","../src/interaction/DragBox.js","../src/interaction/DragZoom.js","../src/events/KeyCode.js","../src/interaction/KeyboardPan.js","../src/interaction/KeyboardZoom.js","../src/interaction/MouseWheelZoom.js","../src/interaction/PinchRotate.js","../src/interaction/PinchZoom.js","../src/interaction/DragAndDrop.js","../src/interaction/DragRotateAndZoom.js","../src/geom/Circle.js","../src/geom/MultiLineString.js","../src/geom/MultiPoint.js","../../src/geom/flat/center.js","../src/geom/MultiPolygon.js","../src/interaction/Draw.js","../src/interaction/Extent.js","../src/interaction/Modify.js","../src/interaction/Select.js","../src/interaction/Snap.js","../src/interaction/Translate.js","src/interaction.js","src/Map.js","../src/structs/LRUCache.js","src/tilecoord.js","src/TileCache.js","src/TileRange.js","src/VectorRenderTile.js","src/VectorTile.js","src/index.js","../src/layer/TileProperty.js","../src/layer/BaseTile.js","../../src/renderer/canvas/TileLayer.js","../src/layer/Tile.js","../src/reproj/common.js","../src/reproj/Triangulation.js","../src/source/common.js","src/reproj.js","../src/reproj/Tile.js","../src/source/TileEventType.js","../src/tilegrid/TileGrid.js","src/tilegrid.js","../src/source/Tile.js","src/tileurlfunction.js","../src/source/UrlTile.js","../src/source/TileImage.js","../src/source/XYZ.js","../src/source/OSM.js","map.js","../../../node_modules/parcel-bundler/src/builtins/bundle-url.js","../../../node_modules/parcel-bundler/src/builtins/css-loader.js","../../../node_modules/parcel-bundler/src/builtins/hmr-runtime.js"],"names":["$","dropdown","viewMap","center","users","longLat","long","lat","WebMercator","features","map","location","longitude","latitude","marker","Feature","geometry","Point","name","setStyle","Style","image","Circle","fill","Fill","color","stroke","Stroke","width","radius","tileLayer","TileLayer","source","OSM","vectorLayer","VectorLayer","VectorSource","filter","f","Map","target","layers","view","View","zoom","bundleURL","getBundleURLCached","getBundleURL","Error","err","matches","stack","match","getBaseURL","url","replace","exports","bundle","require","updateLink","link","newLink","cloneNode","onload","remove","href","split","Date","now","parentNode","insertBefore","nextSibling","cssTimeout","reloadCSS","setTimeout","links","document","querySelectorAll","i","length","module","OVERLAY_ID","OldModule","Module","moduleName","call","hot","data","hotData","_acceptCallbacks","_disposeCallbacks","accept","fn","push","dispose","checkedAssets","assetsToAccept","parent","isParcelRequire","WebSocket","hostname","protocol","ws","onmessage","event","JSON","parse","type","handled","assets","forEach","asset","isNew","didAccept","hmrAcceptCheck","global","parcelRequire","id","every","generated","js","console","clear","hmrApply","v","hmrAcceptRun","reload","close","onclose","log","removeErrorOverlay","error","message","overlay","createErrorOverlay","body","appendChild","getElementById","createElement","stackTrace","innerText","innerHTML","getParents","modules","parents","k","d","dep","Array","isArray","concat","Function","deps","cached","cache","some","cb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AqNAA,IAAI6C,SAAS,GAAG,IAAhB;;AACA,SAASC,kBAAT,GAA8B;AAC5B,MAAI,CAACD,SAAL,EAAgB;AACdA,IAAAA,SAAS,GAAGE,YAAY,EAAxB;AACD;;AAED,SAAOF,SAAP;AACD;;AAED,SAASE,YAAT,GAAwB;AACtB;AACA,MAAI;AACF,UAAM,IAAIC,KAAJ,EAAN;AACD,GAFD,CAEE,OAAOC,GAAP,EAAY;AACZ,QAAIC,OAAO,GAAG,CAAC,KAAKD,GAAG,CAACE,KAAV,EAAiBC,KAAjB,CAAuB,+DAAvB,CAAd;;AACA,QAAIF,OAAJ,EAAa;AACX,aAAOG,UAAU,CAACH,OAAO,CAAC,CAAD,CAAR,CAAjB;AACD;AAC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;AANO;;;;;ACPf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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C4D,EAAD,CAAN;AAEAoC,EAAAA,MAAM,GAAGhG,MAAM,CAACiG,KAAP,CAAarC,EAAb,CAAT;;AACA,MAAIoC,MAAM,IAAIA,MAAM,CAACnE,GAAjB,IAAwBmE,MAAM,CAACnE,GAAP,CAAWG,gBAAX,CAA4BV,MAAxD,EAAgE;AAC9D0E,IAAAA,MAAM,CAACnE,GAAP,CAAWG,gBAAX,CAA4BqB,OAA5B,CAAoC,UAAU8C,EAAV,EAAc;AAChDA,MAAAA,EAAE;AACH,KAFD;;AAGA,WAAO,IAAP;AACD;AACF","file":"map.js","sourceRoot":"../js","sourcesContent":["/**\n * @module ol/util\n */\n\n/**\n * @return {?} Any return.\n */\nexport function abstract() {\n return /** @type {?} */ ((function () {\n throw new Error('Unimplemented abstract method.');\n })());\n}\n\n/**\n * Counter for getUid.\n * @type {number}\n * @private\n */\nlet uidCounter_ = 0;\n\n/**\n * Gets a unique ID for an object. This mutates the object so that further calls\n * with the same object as a parameter returns the same value. Unique IDs are generated\n * as a strictly increasing sequence. Adapted from goog.getUid.\n *\n * @param {Object} obj The object to get the unique ID for.\n * @return {string} The unique ID for the object.\n * @api\n */\nexport function getUid(obj) {\n return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));\n}\n\n/**\n * OpenLayers version.\n * @type {string}\n */\nexport const VERSION = 'latest';\n","/**\n * @module ol/AssertionError\n */\nimport {VERSION} from './util.js';\n\n/**\n * Error object thrown when an assertion failed. This is an ECMA-262 Error,\n * extended with a `code` property.\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error.\n */\nclass AssertionError extends Error {\n /**\n * @param {number} code Error code.\n */\n constructor(code) {\n const path = VERSION === 'latest' ? VERSION : 'v' + VERSION.split('-')[0];\n const message =\n 'Assertion failed. See https://openlayers.org/en/' +\n path +\n '/doc/errors/#' +\n code +\n ' for details.';\n\n super(message);\n\n /**\n * Error code. The meaning of the code can be found on\n * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with\n * the version found in the OpenLayers script's header comment if a version\n * other than the latest is used).\n * @type {number}\n * @api\n */\n this.code = code;\n\n /**\n * @type {string}\n */\n this.name = 'AssertionError';\n\n // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40\n this.message = message;\n }\n}\n\nexport default AssertionError;\n","/**\n * @module ol/events/Event\n */\n\n/**\n * @classdesc\n * Stripped down implementation of the W3C DOM Level 2 Event interface.\n * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.\n *\n * This implementation only provides `type` and `target` properties, and\n * `stopPropagation` and `preventDefault` methods. It is meant as base class\n * for higher level events defined in the library, and works with\n * {@link module:ol/events/Target~Target}.\n */\nclass BaseEvent {\n /**\n * @param {string} type Type.\n */\n constructor(type) {\n /**\n * @type {boolean}\n */\n this.propagationStopped;\n\n /**\n * The event type.\n * @type {string}\n * @api\n */\n this.type = type;\n\n /**\n * The event target.\n * @type {Object}\n * @api\n */\n this.target = null;\n }\n\n /**\n * Stop event propagation.\n * @api\n */\n preventDefault() {\n this.propagationStopped = true;\n }\n\n /**\n * Stop event propagation.\n * @api\n */\n stopPropagation() {\n this.propagationStopped = true;\n }\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function stopPropagation(evt) {\n evt.stopPropagation();\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function preventDefault(evt) {\n evt.preventDefault();\n}\n\nexport default BaseEvent;\n","/**\n * @module ol/ObjectEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a property is changed.\n * @event module:ol/Object.ObjectEvent#propertychange\n * @api\n */\n PROPERTYCHANGE: 'propertychange',\n};\n","/**\n * @module ol/Disposable\n */\n\n/**\n * @classdesc\n * Objects that need to clean up after themselves.\n */\nclass Disposable {\n constructor() {\n /**\n * The object has already been disposed.\n * @type {boolean}\n * @protected\n */\n this.disposed = false;\n }\n\n /**\n * Clean up.\n */\n dispose() {\n if (!this.disposed) {\n this.disposed = true;\n this.disposeInternal();\n }\n }\n\n /**\n * Extension point for disposable objects.\n * @protected\n */\n disposeInternal() {}\n}\n\nexport default Disposable;\n","/**\n * @module ol/array\n */\n\n/**\n * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.\n * https://github.com/darkskyapp/binary-search\n *\n * @param {Array<*>} haystack Items to search through.\n * @param {*} needle The item to look for.\n * @param {Function=} opt_comparator Comparator function.\n * @return {number} The index of the item if found, -1 if not.\n */\nexport function binarySearch(haystack, needle, opt_comparator) {\n let mid, cmp;\n const comparator = opt_comparator || numberSafeCompareFunction;\n let low = 0;\n let high = haystack.length;\n let found = false;\n\n while (low < high) {\n /* Note that \"(low + high) >>> 1\" may overflow, and results in a typecast\n * to double (which gives the wrong results). */\n mid = low + ((high - low) >> 1);\n cmp = +comparator(haystack[mid], needle);\n\n if (cmp < 0.0) {\n /* Too low. */\n low = mid + 1;\n } else {\n /* Key found or too high */\n high = mid;\n found = !cmp;\n }\n }\n\n /* Key not found. */\n return found ? low : ~low;\n}\n\n/**\n * Compare function for array sort that is safe for numbers.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nexport function numberSafeCompareFunction(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\n/**\n * Whether the array contains the given object.\n * @param {Array<*>} arr The array to test for the presence of the element.\n * @param {*} obj The object for which to test.\n * @return {boolean} The object is in the array.\n */\nexport function includes(arr, obj) {\n return arr.indexOf(obj) >= 0;\n}\n\n/**\n * @param {Array<number>} arr Array.\n * @param {number} target Target.\n * @param {number} direction 0 means return the nearest, > 0\n * means return the largest nearest, < 0 means return the\n * smallest nearest.\n * @return {number} Index.\n */\nexport function linearFindNearest(arr, target, direction) {\n const n = arr.length;\n if (arr[0] <= target) {\n return 0;\n } else if (target <= arr[n - 1]) {\n return n - 1;\n } else {\n let i;\n if (direction > 0) {\n for (i = 1; i < n; ++i) {\n if (arr[i] < target) {\n return i - 1;\n }\n }\n } else if (direction < 0) {\n for (i = 1; i < n; ++i) {\n if (arr[i] <= target) {\n return i;\n }\n }\n } else {\n for (i = 1; i < n; ++i) {\n if (arr[i] == target) {\n return i;\n } else if (arr[i] < target) {\n if (arr[i - 1] - target < target - arr[i]) {\n return i - 1;\n } else {\n return i;\n }\n }\n }\n }\n return n - 1;\n }\n}\n\n/**\n * @param {Array<*>} arr Array.\n * @param {number} begin Begin index.\n * @param {number} end End index.\n */\nexport function reverseSubArray(arr, begin, end) {\n while (begin < end) {\n const tmp = arr[begin];\n arr[begin] = arr[end];\n arr[end] = tmp;\n ++begin;\n --end;\n }\n}\n\n/**\n * @param {Array<VALUE>} arr The array to modify.\n * @param {!Array<VALUE>|VALUE} data The elements or arrays of elements to add to arr.\n * @template VALUE\n */\nexport function extend(arr, data) {\n const extension = Array.isArray(data) ? data : [data];\n const length = extension.length;\n for (let i = 0; i < length; i++) {\n arr[arr.length] = extension[i];\n }\n}\n\n/**\n * @param {Array<VALUE>} arr The array to modify.\n * @param {VALUE} obj The element to remove.\n * @template VALUE\n * @return {boolean} If the element was removed.\n */\nexport function remove(arr, obj) {\n const i = arr.indexOf(obj);\n const found = i > -1;\n if (found) {\n arr.splice(i, 1);\n }\n return found;\n}\n\n/**\n * @param {Array<VALUE>} arr The array to search in.\n * @param {function(VALUE, number, ?) : boolean} func The function to compare.\n * @template VALUE\n * @return {VALUE|null} The element found or null.\n */\nexport function find(arr, func) {\n const length = arr.length >>> 0;\n let value;\n\n for (let i = 0; i < length; i++) {\n value = arr[i];\n if (func(value, i, arr)) {\n return value;\n }\n }\n return null;\n}\n\n/**\n * @param {Array|Uint8ClampedArray} arr1 The first array to compare.\n * @param {Array|Uint8ClampedArray} arr2 The second array to compare.\n * @return {boolean} Whether the two arrays are equal.\n */\nexport function equals(arr1, arr2) {\n const len1 = arr1.length;\n if (len1 !== arr2.length) {\n return false;\n }\n for (let i = 0; i < len1; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Sort the passed array such that the relative order of equal elements is preverved.\n * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.\n * @param {Array<*>} arr The array to sort (modifies original).\n * @param {!function(*, *): number} compareFnc Comparison function.\n * @api\n */\nexport function stableSort(arr, compareFnc) {\n const length = arr.length;\n const tmp = Array(arr.length);\n let i;\n for (i = 0; i < length; i++) {\n tmp[i] = {index: i, value: arr[i]};\n }\n tmp.sort(function (a, b) {\n return compareFnc(a.value, b.value) || a.index - b.index;\n });\n for (i = 0; i < arr.length; i++) {\n arr[i] = tmp[i].value;\n }\n}\n\n/**\n * @param {Array<*>} arr The array to search in.\n * @param {Function} func Comparison function.\n * @return {number} Return index.\n */\nexport function findIndex(arr, func) {\n let index;\n const found = !arr.every(function (el, idx) {\n index = idx;\n return !func(el, idx, arr);\n });\n return found ? index : -1;\n}\n\n/**\n * @param {Array<*>} arr The array to test.\n * @param {Function=} opt_func Comparison function.\n * @param {boolean=} opt_strict Strictly sorted (default false).\n * @return {boolean} Return index.\n */\nexport function isSorted(arr, opt_func, opt_strict) {\n const compare = opt_func || numberSafeCompareFunction;\n return arr.every(function (currentVal, index) {\n if (index === 0) {\n return true;\n }\n const res = compare(arr[index - 1], currentVal);\n return !(res > 0 || (opt_strict && res === 0));\n });\n}\n","/**\n * @module ol/functions\n */\n\nimport {equals as arrayEquals} from './array.js';\n\n/**\n * Always returns true.\n * @returns {boolean} true.\n */\nexport function TRUE() {\n return true;\n}\n\n/**\n * Always returns false.\n * @returns {boolean} false.\n */\nexport function FALSE() {\n return false;\n}\n\n/**\n * A reusable function, used e.g. as a default for callbacks.\n *\n * @return {void} Nothing.\n */\nexport function VOID() {}\n\n/**\n * Wrap a function in another function that remembers the last return. If the\n * returned function is called twice in a row with the same arguments and the same\n * this object, it will return the value from the first call in the second call.\n *\n * @param {function(...any): ReturnType} fn The function to memoize.\n * @return {function(...any): ReturnType} The memoized function.\n * @template ReturnType\n */\nexport function memoizeOne(fn) {\n let called = false;\n\n /** @type {ReturnType} */\n let lastResult;\n\n /** @type {Array<any>} */\n let lastArgs;\n\n let lastThis;\n\n return function () {\n const nextArgs = Array.prototype.slice.call(arguments);\n if (!called || this !== lastThis || !arrayEquals(nextArgs, lastArgs)) {\n called = true;\n lastThis = this;\n lastArgs = nextArgs;\n lastResult = fn.apply(this, arguments);\n }\n return lastResult;\n };\n}\n","/**\n * @module ol/obj\n */\n\n/**\n * Polyfill for Object.assign(). Assigns enumerable and own properties from\n * one or more source objects to a target object.\n * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign.\n *\n * @param {!Object} target The target object.\n * @param {...Object} var_sources The source object(s).\n * @return {!Object} The modified target object.\n */\nexport const assign =\n typeof Object.assign === 'function'\n ? Object.assign\n : function (target, var_sources) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n const output = Object(target);\n for (let i = 1, ii = arguments.length; i < ii; ++i) {\n const source = arguments[i];\n if (source !== undefined && source !== null) {\n for (const key in source) {\n if (source.hasOwnProperty(key)) {\n output[key] = source[key];\n }\n }\n }\n }\n return output;\n };\n\n/**\n * Removes all properties from an object.\n * @param {Object} object The object to clear.\n */\nexport function clear(object) {\n for (const property in object) {\n delete object[property];\n }\n}\n\n/**\n * Polyfill for Object.values(). Get an array of property values from an object.\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values\n *\n * @param {!Object<K,V>} object The object from which to get the values.\n * @return {!Array<V>} The property values.\n * @template K,V\n */\nexport const getValues =\n typeof Object.values === 'function'\n ? Object.values\n : function (object) {\n const values = [];\n for (const property in object) {\n values.push(object[property]);\n }\n return values;\n };\n\n/**\n * Determine if an object has any properties.\n * @param {Object} object The object to check.\n * @return {boolean} The object is empty.\n */\nexport function isEmpty(object) {\n let property;\n for (property in object) {\n return false;\n }\n return !property;\n}\n","/**\n * @module ol/events/Target\n */\nimport Disposable from '../Disposable.js';\nimport Event from './Event.js';\nimport {VOID} from '../functions.js';\nimport {clear} from '../obj.js';\n\n/**\n * @typedef {EventTarget|Target} EventTargetLike\n */\n\n/**\n * @classdesc\n * A simplified implementation of the W3C DOM Level 2 EventTarget interface.\n * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.\n *\n * There are two important simplifications compared to the specification:\n *\n * 1. The handling of `useCapture` in `addEventListener` and\n * `removeEventListener`. There is no real capture model.\n * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.\n * There is no event target hierarchy. When a listener calls\n * `stopPropagation` or `preventDefault` on an event object, it means that no\n * more listeners after this one will be called. Same as when the listener\n * returns false.\n */\nclass Target extends Disposable {\n /**\n * @param {*=} opt_target Default event target for dispatched events.\n */\n constructor(opt_target) {\n super();\n\n /**\n * @private\n * @type {*}\n */\n this.eventTarget_ = opt_target;\n\n /**\n * @private\n * @type {Object<string, number>}\n */\n this.pendingRemovals_ = null;\n\n /**\n * @private\n * @type {Object<string, number>}\n */\n this.dispatching_ = null;\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").Listener>>}\n */\n this.listeners_ = null;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n addEventListener(type, listener) {\n if (!type || !listener) {\n return;\n }\n const listeners = this.listeners_ || (this.listeners_ = {});\n const listenersForType = listeners[type] || (listeners[type] = []);\n if (listenersForType.indexOf(listener) === -1) {\n listenersForType.push(listener);\n }\n }\n\n /**\n * Dispatches an event and calls all listeners listening for events\n * of this type. The event parameter can either be a string or an\n * Object with a `type` property.\n *\n * @param {import(\"./Event.js\").default|string} event Event object.\n * @return {boolean|undefined} `false` if anyone called preventDefault on the\n * event object or if any of the listeners returned false.\n * @api\n */\n dispatchEvent(event) {\n /** @type {import(\"./Event.js\").default|Event} */\n const evt = typeof event === 'string' ? new Event(event) : event;\n const type = evt.type;\n if (!evt.target) {\n evt.target = this.eventTarget_ || this;\n }\n const listeners = this.listeners_ && this.listeners_[type];\n let propagate;\n if (listeners) {\n const dispatching = this.dispatching_ || (this.dispatching_ = {});\n const pendingRemovals =\n this.pendingRemovals_ || (this.pendingRemovals_ = {});\n if (!(type in dispatching)) {\n dispatching[type] = 0;\n pendingRemovals[type] = 0;\n }\n ++dispatching[type];\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n if ('handleEvent' in listeners[i]) {\n propagate = /** @type {import(\"../events.js\").ListenerObject} */ (listeners[\n i\n ]).handleEvent(evt);\n } else {\n propagate = /** @type {import(\"../events.js\").ListenerFunction} */ (listeners[\n i\n ]).call(this, evt);\n }\n if (propagate === false || evt.propagationStopped) {\n propagate = false;\n break;\n }\n }\n --dispatching[type];\n if (dispatching[type] === 0) {\n let pr = pendingRemovals[type];\n delete pendingRemovals[type];\n while (pr--) {\n this.removeEventListener(type, VOID);\n }\n delete dispatching[type];\n }\n return propagate;\n }\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.listeners_ && clear(this.listeners_);\n }\n\n /**\n * Get the listeners for a specified event type. Listeners are returned in the\n * order that they will be called in.\n *\n * @param {string} type Type.\n * @return {Array<import(\"../events.js\").Listener>|undefined} Listeners.\n */\n getListeners(type) {\n return (this.listeners_ && this.listeners_[type]) || undefined;\n }\n\n /**\n * @param {string=} opt_type Type. If not provided,\n * `true` will be returned if this event target has any listeners.\n * @return {boolean} Has listeners.\n */\n hasListener(opt_type) {\n if (!this.listeners_) {\n return false;\n }\n return opt_type\n ? opt_type in this.listeners_\n : Object.keys(this.listeners_).length > 0;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n removeEventListener(type, listener) {\n const listeners = this.listeners_ && this.listeners_[type];\n if (listeners) {\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n if (this.pendingRemovals_ && type in this.pendingRemovals_) {\n // make listener a no-op, and remove later in #dispatchEvent()\n listeners[index] = VOID;\n ++this.pendingRemovals_[type];\n } else {\n listeners.splice(index, 1);\n if (listeners.length === 0) {\n delete this.listeners_[type];\n }\n }\n }\n }\n }\n}\n\nexport default Target;\n","/**\n * @module ol/events/EventType\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n /**\n * Generic change event. Triggered when the revision counter is increased.\n * @event module:ol/events/Event~BaseEvent#change\n * @api\n */\n CHANGE: 'change',\n\n /**\n * Generic error event. Triggered when an error occurs.\n * @event module:ol/events/Event~BaseEvent#error\n * @api\n */\n ERROR: 'error',\n\n BLUR: 'blur',\n CLEAR: 'clear',\n CONTEXTMENU: 'contextmenu',\n CLICK: 'click',\n DBLCLICK: 'dblclick',\n DRAGENTER: 'dragenter',\n DRAGOVER: 'dragover',\n DROP: 'drop',\n FOCUS: 'focus',\n KEYDOWN: 'keydown',\n KEYPRESS: 'keypress',\n LOAD: 'load',\n RESIZE: 'resize',\n TOUCHMOVE: 'touchmove',\n WHEEL: 'wheel',\n};\n","/**\n * @module ol/events\n */\nimport {clear} from './obj.js';\n\n/**\n * Key to use with {@link module:ol/Observable~Observable#unByKey}.\n * @typedef {Object} EventsKey\n * @property {ListenerFunction} listener\n * @property {import(\"./events/Target.js\").EventTargetLike} target\n * @property {string} type\n * @api\n */\n\n/**\n * Listener function. This function is called with an event object as argument.\n * When the function returns `false`, event propagation will stop.\n *\n * @typedef {function((Event|import(\"./events/Event.js\").default)): (void|boolean)} ListenerFunction\n * @api\n */\n\n/**\n * @typedef {Object} ListenerObject\n * @property {ListenerFunction} handleEvent\n */\n\n/**\n * @typedef {ListenerFunction|ListenerObject} Listener\n */\n\n/**\n * Registers an event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` to a `this` object, and returns\n * a key for use with {@link module:ol/events~unlistenByKey}.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object=} opt_this Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @param {boolean=} opt_once If true, add the listener as one-off listener.\n * @return {EventsKey} Unique key for the listener.\n */\nexport function listen(target, type, listener, opt_this, opt_once) {\n if (opt_this && opt_this !== target) {\n listener = listener.bind(opt_this);\n }\n if (opt_once) {\n const originalListener = listener;\n listener = function () {\n target.removeEventListener(type, listener);\n originalListener.apply(this, arguments);\n };\n }\n const eventsKey = {\n target: target,\n type: type,\n listener: listener,\n };\n target.addEventListener(type, listener);\n return eventsKey;\n}\n\n/**\n * Registers a one-off event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` as self-unregistering listener\n * to a `this` object, and returns a key for use with\n * {@link module:ol/events~unlistenByKey} in case the listener needs to be\n * unregistered before it is called.\n *\n * When {@link module:ol/events~listen} is called with the same arguments after this\n * function, the self-unregistering listener will be turned into a permanent\n * listener.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object=} opt_this Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @return {EventsKey} Key for unlistenByKey.\n */\nexport function listenOnce(target, type, listener, opt_this) {\n return listen(target, type, listener, opt_this, true);\n}\n\n/**\n * Unregisters event listeners on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * The argument passed to this function is the key returned from\n * {@link module:ol/events~listen} or {@link module:ol/events~listenOnce}.\n *\n * @param {EventsKey} key The key.\n */\nexport function unlistenByKey(key) {\n if (key && key.target) {\n key.target.removeEventListener(key.type, key.listener);\n clear(key);\n }\n}\n","/**\n * @module ol/Observable\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport {listen, listenOnce, unlistenByKey} from './events.js';\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * An event target providing convenient methods for listener registration\n * and unregistration. A generic `change` event is always available through\n * {@link module:ol/Observable~Observable#changed}.\n *\n * @fires import(\"./events/Event.js\").default\n * @api\n */\nclass Observable extends EventTarget {\n constructor() {\n super();\n\n /**\n * @private\n * @type {number}\n */\n this.revision_ = 0;\n }\n\n /**\n * Increases the revision counter and dispatches a 'change' event.\n * @api\n */\n changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Get the version number for this object. Each time the object is modified,\n * its version number will be incremented.\n * @return {number} Revision.\n * @api\n */\n getRevision() {\n return this.revision_;\n }\n\n /**\n * Listen for a certain type of event.\n * @param {string|Array<string>} type The event type or array of event types.\n * @param {function(?): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\n on(type, listener) {\n if (Array.isArray(type)) {\n const len = type.length;\n const keys = new Array(len);\n for (let i = 0; i < len; ++i) {\n keys[i] = listen(this, type[i], listener);\n }\n return keys;\n } else {\n return listen(this, /** @type {string} */ (type), listener);\n }\n }\n\n /**\n * Listen once for a certain type of event.\n * @param {string|Array<string>} type The event type or array of event types.\n * @param {function(?): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\n once(type, listener) {\n let key;\n if (Array.isArray(type)) {\n const len = type.length;\n key = new Array(len);\n for (let i = 0; i < len; ++i) {\n key[i] = listenOnce(this, type[i], listener);\n }\n } else {\n key = listenOnce(this, /** @type {string} */ (type), listener);\n }\n /** @type {Object} */ (listener).ol_key = key;\n return key;\n }\n\n /**\n * Unlisten for a certain type of event.\n * @param {string|Array<string>} type The event type or array of event types.\n * @param {function(?): ?} listener The listener function.\n * @api\n */\n un(type, listener) {\n const key = /** @type {Object} */ (listener).ol_key;\n if (key) {\n unByKey(key);\n } else if (Array.isArray(type)) {\n for (let i = 0, ii = type.length; i < ii; ++i) {\n this.removeEventListener(type[i], listener);\n }\n } else {\n this.removeEventListener(type, listener);\n }\n }\n}\n\n/**\n * Removes an event listener using the key returned by `on()` or `once()`.\n * @param {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} key The key returned by `on()`\n * or `once()` (or an array of keys).\n * @api\n */\nexport function unByKey(key) {\n if (Array.isArray(key)) {\n for (let i = 0, ii = key.length; i < ii; ++i) {\n unlistenByKey(key[i]);\n }\n } else {\n unlistenByKey(/** @type {import(\"./events.js\").EventsKey} */ (key));\n }\n}\n\nexport default Observable;\n","/**\n * @module ol/Object\n */\nimport Event from './events/Event.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport Observable from './Observable.js';\nimport {assign, isEmpty} from './obj.js';\nimport {getUid} from './util.js';\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.\n */\nexport class ObjectEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {string} key The property name.\n * @param {*} oldValue The old value for `key`.\n */\n constructor(type, key, oldValue) {\n super(type);\n\n /**\n * The name of the property whose value is changing.\n * @type {string}\n * @api\n */\n this.key = key;\n\n /**\n * The old value. To get the new value use `e.target.get(e.key)` where\n * `e` is the event object.\n * @type {*}\n * @api\n */\n this.oldValue = oldValue;\n }\n}\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Most non-trivial classes inherit from this.\n *\n * This extends {@link module:ol/Observable} with observable\n * properties, where each property is observable as well as the object as a\n * whole.\n *\n * Classes that inherit from this have pre-defined properties, to which you can\n * add your owns. The pre-defined properties are listed in this documentation as\n * 'Observable Properties', and have their own accessors; for example,\n * {@link module:ol/Map~Map} has a `target` property, accessed with\n * `getTarget()` and changed with `setTarget()`. Not all properties are however\n * settable. There are also general-purpose accessors `get()` and `set()`. For\n * example, `get('target')` is equivalent to `getTarget()`.\n *\n * The `set` accessors trigger a change event, and you can monitor this by\n * registering a listener. For example, {@link module:ol/View~View} has a\n * `center` property, so `view.on('change:center', function(evt) {...});` would\n * call the function whenever the value of the center property changes. Within\n * the function, `evt.target` would be the view, so `evt.target.getCenter()`\n * would return the new center.\n *\n * You can add your own observable properties with\n * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.\n * You can listen for changes on that property value with\n * `object.on('change:prop', listener)`. You can get a list of all\n * properties with {@link module:ol/Object~BaseObject#getProperties}.\n *\n * Note that the observable properties are separate from standard JS properties.\n * You can, for example, give your map object a title with\n * `map.title='New title'` and with `map.set('title', 'Another title')`. The\n * first will be a `hasOwnProperty`; the second will appear in\n * `getProperties()`. Only the second is observable.\n *\n * Properties can be deleted by using the unset method. E.g.\n * object.unset('foo').\n *\n * @fires ObjectEvent\n * @api\n */\nclass BaseObject extends Observable {\n /**\n * @param {Object<string, *>=} opt_values An object with key-value pairs.\n */\n constructor(opt_values) {\n super();\n\n // Call {@link module:ol/util~getUid} to ensure that the order of objects' ids is\n // the same as the order in which they were created. This also helps to\n // ensure that object properties are always added in the same order, which\n // helps many JavaScript engines generate faster code.\n getUid(this);\n\n /**\n * @private\n * @type {Object<string, *>}\n */\n this.values_ = null;\n\n if (opt_values !== undefined) {\n this.setProperties(opt_values);\n }\n }\n\n /**\n * Gets a value.\n * @param {string} key Key name.\n * @return {*} Value.\n * @api\n */\n get(key) {\n let value;\n if (this.values_ && this.values_.hasOwnProperty(key)) {\n value = this.values_[key];\n }\n return value;\n }\n\n /**\n * Get a list of object property names.\n * @return {Array<string>} List of property names.\n * @api\n */\n getKeys() {\n return (this.values_ && Object.keys(this.values_)) || [];\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object<string, *>} Object.\n * @api\n */\n getProperties() {\n return (this.values_ && assign({}, this.values_)) || {};\n }\n\n /**\n * @return {boolean} The object has properties.\n */\n hasProperties() {\n return !!this.values_;\n }\n\n /**\n * @param {string} key Key name.\n * @param {*} oldValue Old value.\n */\n notify(key, oldValue) {\n let eventType;\n eventType = getChangeEventType(key);\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n eventType = ObjectEventType.PROPERTYCHANGE;\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n\n /**\n * Sets a value.\n * @param {string} key Key name.\n * @param {*} value Value.\n * @param {boolean=} opt_silent Update without triggering an event.\n * @api\n */\n set(key, value, opt_silent) {\n const values = this.values_ || (this.values_ = {});\n if (opt_silent) {\n values[key] = value;\n } else {\n const oldValue = values[key];\n values[key] = value;\n if (oldValue !== value) {\n this.notify(key, oldValue);\n }\n }\n }\n\n /**\n * Sets a collection of key-value pairs. Note that this changes any existing\n * properties and adds new ones (it does not remove any existing properties).\n * @param {Object<string, *>} values Values.\n * @param {boolean=} opt_silent Update without triggering an event.\n * @api\n */\n setProperties(values, opt_silent) {\n for (const key in values) {\n this.set(key, values[key], opt_silent);\n }\n }\n\n /**\n * Unsets a property.\n * @param {string} key Key name.\n * @param {boolean=} opt_silent Unset without triggering an event.\n * @api\n */\n unset(key, opt_silent) {\n if (this.values_ && key in this.values_) {\n const oldValue = this.values_[key];\n delete this.values_[key];\n if (isEmpty(this.values_)) {\n this.values_ = null;\n }\n if (!opt_silent) {\n this.notify(key, oldValue);\n }\n }\n }\n}\n\n/**\n * @type {Object<string, string>}\n */\nconst changeEventTypeCache = {};\n\n/**\n * @param {string} key Key name.\n * @return {string} Change name.\n */\nexport function getChangeEventType(key) {\n return changeEventTypeCache.hasOwnProperty(key)\n ? changeEventTypeCache[key]\n : (changeEventTypeCache[key] = 'change:' + key);\n}\n\nexport default BaseObject;\n","/**\n * @module ol/CollectionEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when an item is added to the collection.\n * @event module:ol/Collection.CollectionEvent#add\n * @api\n */\n ADD: 'add',\n /**\n * Triggered when an item is removed from the collection.\n * @event module:ol/Collection.CollectionEvent#remove\n * @api\n */\n REMOVE: 'remove',\n};\n","/**\n * @module ol/Collection\n */\nimport AssertionError from './AssertionError.js';\nimport BaseObject from './Object.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport Event from './events/Event.js';\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LENGTH: 'length',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this\n * type.\n */\nexport class CollectionEvent extends Event {\n /**\n * @param {import(\"./CollectionEventType.js\").default} type Type.\n * @param {*=} opt_element Element.\n * @param {number=} opt_index The index of the added or removed element.\n */\n constructor(type, opt_element, opt_index) {\n super(type);\n\n /**\n * The element that is added to or removed from the collection.\n * @type {*}\n * @api\n */\n this.element = opt_element;\n\n /**\n * The index of the added or removed element.\n * @type {number}\n * @api\n */\n this.index = opt_index;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [unique=false] Disallow the same item from being added to\n * the collection twice.\n */\n\n/**\n * @classdesc\n * An expanded version of standard JS Array, adding convenience methods for\n * manipulation. Add and remove changes to the Collection trigger a Collection\n * event. Note that this does not cover changes to the objects _within_ the\n * Collection; they trigger events on the appropriate object, not on the\n * Collection as a whole.\n *\n * @fires CollectionEvent\n *\n * @template T\n * @api\n */\nclass Collection extends BaseObject {\n /**\n * @param {Array<T>=} opt_array Array.\n * @param {Options=} opt_options Collection options.\n */\n constructor(opt_array, opt_options) {\n super();\n\n const options = opt_options || {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.unique_ = !!options.unique;\n\n /**\n * @private\n * @type {!Array<T>}\n */\n this.array_ = opt_array ? opt_array : [];\n\n if (this.unique_) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n this.assertUnique_(this.array_[i], i);\n }\n }\n\n this.updateLength_();\n }\n\n /**\n * Remove all elements from the collection.\n * @api\n */\n clear() {\n while (this.getLength() > 0) {\n this.pop();\n }\n }\n\n /**\n * Add elements to the collection. This pushes each item in the provided array\n * to the end of the collection.\n * @param {!Array<T>} arr Array.\n * @return {Collection<T>} This collection.\n * @api\n */\n extend(arr) {\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n this.push(arr[i]);\n }\n return this;\n }\n\n /**\n * Iterate over each element, calling the provided callback.\n * @param {function(T, number, Array<T>): *} f The function to call\n * for every element. This function takes 3 arguments (the element, the\n * index and the array). The return value is ignored.\n * @api\n */\n forEach(f) {\n const array = this.array_;\n for (let i = 0, ii = array.length; i < ii; ++i) {\n f(array[i], i, array);\n }\n }\n\n /**\n * Get a reference to the underlying Array object. Warning: if the array\n * is mutated, no events will be dispatched by the collection, and the\n * collection's \"length\" property won't be in sync with the actual length\n * of the array.\n * @return {!Array<T>} Array.\n * @api\n */\n getArray() {\n return this.array_;\n }\n\n /**\n * Get the element at the provided index.\n * @param {number} index Index.\n * @return {T} Element.\n * @api\n */\n item(index) {\n return this.array_[index];\n }\n\n /**\n * Get the length of this collection.\n * @return {number} The length of the array.\n * @observable\n * @api\n */\n getLength() {\n return this.get(Property.LENGTH);\n }\n\n /**\n * Insert an element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n insertAt(index, elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n this.array_.splice(index, 0, elem);\n this.updateLength_();\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n );\n }\n\n /**\n * Remove the last element of the collection and return it.\n * Return `undefined` if the collection is empty.\n * @return {T|undefined} Element.\n * @api\n */\n pop() {\n return this.removeAt(this.getLength() - 1);\n }\n\n /**\n * Insert the provided element at the end of the collection.\n * @param {T} elem Element.\n * @return {number} New length of the collection.\n * @api\n */\n push(elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n const n = this.getLength();\n this.insertAt(n, elem);\n return this.getLength();\n }\n\n /**\n * Remove the first occurrence of an element from the collection.\n * @param {T} elem Element.\n * @return {T|undefined} The removed element or undefined if none found.\n * @api\n */\n remove(elem) {\n const arr = this.array_;\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n if (arr[i] === elem) {\n return this.removeAt(i);\n }\n }\n return undefined;\n }\n\n /**\n * Remove the element at the provided index and return it.\n * Return `undefined` if the collection does not contain this index.\n * @param {number} index Index.\n * @return {T|undefined} Value.\n * @api\n */\n removeAt(index) {\n const prev = this.array_[index];\n this.array_.splice(index, 1);\n this.updateLength_();\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n );\n return prev;\n }\n\n /**\n * Set the element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n setAt(index, elem) {\n const n = this.getLength();\n if (index < n) {\n if (this.unique_) {\n this.assertUnique_(elem, index);\n }\n const prev = this.array_[index];\n this.array_[index] = elem;\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n );\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n );\n } else {\n for (let j = n; j < index; ++j) {\n this.insertAt(j, undefined);\n }\n this.insertAt(index, elem);\n }\n }\n\n /**\n * @private\n */\n updateLength_() {\n this.set(Property.LENGTH, this.array_.length);\n }\n\n /**\n * @private\n * @param {T} elem Element.\n * @param {number=} opt_except Optional index to ignore.\n */\n assertUnique_(elem, opt_except) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n if (this.array_[i] === elem && i !== opt_except) {\n throw new AssertionError(58);\n }\n }\n }\n}\n\nexport default Collection;\n","/**\n * @module ol/asserts\n */\nimport AssertionError from './AssertionError.js';\n\n/**\n * @param {*} assertion Assertion we expected to be truthy.\n * @param {number} errorCode Error code.\n */\nexport function assert(assertion, errorCode) {\n if (!assertion) {\n throw new AssertionError(errorCode);\n }\n}\n","/**\n * @module ol/Feature\n */\nimport BaseObject, {getChangeEventType} from './Object.js';\nimport EventType from './events/EventType.js';\nimport {assert} from './asserts.js';\nimport {listen, unlistenByKey} from './events.js';\n\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature';\n * import Polygon from 'ol/geom/Polygon';\n * import Point from 'ol/geom/Point';\n *\n * var feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon'\n * });\n *\n * // get the polygon geometry\n * var poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * var point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} Geometry\n */\nclass Feature extends BaseObject {\n /**\n * @param {Geometry|Object<string, *>=} opt_geometryOrProperties\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n constructor(opt_geometryOrProperties) {\n super();\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = undefined;\n\n /**\n * @type {string}\n * @private\n */\n this.geometryName_ = 'geometry';\n\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n this.style_ = null;\n\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction_ = undefined;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.geometryChangeKey_ = null;\n\n this.addEventListener(\n getChangeEventType(this.geometryName_),\n this.handleGeometryChanged_\n );\n\n if (opt_geometryOrProperties) {\n if (\n typeof (\n /** @type {?} */ (opt_geometryOrProperties).getSimplifiedGeometry\n ) === 'function'\n ) {\n const geometry = /** @type {Geometry} */ (opt_geometryOrProperties);\n this.setGeometry(geometry);\n } else {\n /** @type {Object<string, *>} */\n const properties = opt_geometryOrProperties;\n this.setProperties(properties);\n }\n }\n }\n\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature} The clone.\n * @api\n */\n clone() {\n const clone = new Feature(\n this.hasProperties() ? this.getProperties() : null\n );\n clone.setGeometryName(this.getGeometryName());\n const geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(geometry.clone());\n }\n const style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n }\n\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n getGeometry() {\n return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n getGeometryName() {\n return this.geometryName_;\n }\n\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike|undefined} The feature style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @private\n */\n handleGeometryChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleGeometryChanged_() {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n const geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(\n geometry,\n EventType.CHANGE,\n this.handleGeometryChange_,\n this\n );\n }\n this.changed();\n }\n\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n setGeometry(geometry) {\n this.set(this.geometryName_, geometry);\n }\n\n /**\n * Set the style for the feature to override the layer style. This can be a\n * single style object, an array of styles, or a function that takes a\n * resolution and returns an array of styles. To unset the feature style, call\n * `setStyle()` without arguments or a falsey value.\n * @param {import(\"./style/Style.js\").StyleLike=} opt_style Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setStyle(opt_style) {\n this.style_ = opt_style;\n this.styleFunction_ = !opt_style\n ? undefined\n : createStyleFunction(opt_style);\n this.changed();\n }\n\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setId(id) {\n this.id_ = id;\n this.changed();\n }\n\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n setGeometryName(name) {\n this.removeEventListener(\n getChangeEventType(this.geometryName_),\n this.handleGeometryChanged_\n );\n this.geometryName_ = name;\n this.addEventListener(\n getChangeEventType(this.geometryName_),\n this.handleGeometryChanged_\n );\n this.handleGeometryChanged_();\n }\n}\n\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array<import(\"./style/Style.js\").default>|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n } else {\n /**\n * @type {Array<import(\"./style/Style.js\").default>}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(typeof (/** @type {?} */ (obj).getZIndex) === 'function', 41); // Expected an `import(\"./style/Style.js\").Style` or an array of `import(\"./style/Style.js\").Style`\n const style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles = [style];\n }\n return function () {\n return styles;\n };\n }\n}\nexport default Feature;\n","/**\n * @module ol/geom/GeometryLayout\n */\n\n/**\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available. Supported values are `'XY'`,\n * `'XYZ'`, `'XYM'`, `'XYZM'`.\n * @enum {string}\n */\nexport default {\n XY: 'XY',\n XYZ: 'XYZ',\n XYM: 'XYM',\n XYZM: 'XYZM',\n};\n","/**\n * @module ol/geom/GeometryType\n */\n\n/**\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, `'Circle'`.\n * @enum {string}\n */\nexport default {\n POINT: 'Point',\n LINE_STRING: 'LineString',\n LINEAR_RING: 'LinearRing',\n POLYGON: 'Polygon',\n MULTI_POINT: 'MultiPoint',\n MULTI_LINE_STRING: 'MultiLineString',\n MULTI_POLYGON: 'MultiPolygon',\n GEOMETRY_COLLECTION: 'GeometryCollection',\n CIRCLE: 'Circle',\n};\n","/**\n * @module ol/proj/Units\n */\n\n/**\n * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or\n * `'us-ft'`.\n * @enum {string}\n */\nconst Units = {\n DEGREES: 'degrees',\n FEET: 'ft',\n METERS: 'm',\n PIXELS: 'pixels',\n TILE_PIXELS: 'tile-pixels',\n USFEET: 'us-ft',\n};\n\n/**\n * Meters per unit lookup table.\n * @const\n * @type {Object<Units, number>}\n * @api\n */\nexport const METERS_PER_UNIT = {};\n// use the radius of the Normal sphere\nMETERS_PER_UNIT[Units.DEGREES] = (2 * Math.PI * 6370997) / 360;\nMETERS_PER_UNIT[Units.FEET] = 0.3048;\nMETERS_PER_UNIT[Units.METERS] = 1;\nMETERS_PER_UNIT[Units.USFEET] = 1200 / 3937;\n\nexport default Units;\n","/**\n * @module ol/transform\n */\nimport {assert} from './asserts.js';\n\n/**\n * An array representing an affine 2d transformation for use with\n * {@link module:ol/transform} functions. The array has 6 elements.\n * @typedef {!Array<number>} Transform\n * @api\n */\n\n/**\n * Collection of affine 2d transformation functions. The functions work on an\n * array of 6 elements. The element order is compatible with the [SVGMatrix\n * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is\n * a subset (elements a to f) of a 3×3 matrix:\n * ```\n * [ a c e ]\n * [ b d f ]\n * [ 0 0 1 ]\n * ```\n */\n\n/**\n * @private\n * @type {Transform}\n */\nconst tmp_ = new Array(6);\n\n/**\n * Create an identity transform.\n * @return {!Transform} Identity transform.\n */\nexport function create() {\n return [1, 0, 0, 1, 0, 0];\n}\n\n/**\n * Resets the given transform to an identity transform.\n * @param {!Transform} transform Transform.\n * @return {!Transform} Transform.\n */\nexport function reset(transform) {\n return set(transform, 1, 0, 0, 1, 0, 0);\n}\n\n/**\n * Multiply the underlying matrices of two transforms and return the result in\n * the first transform.\n * @param {!Transform} transform1 Transform parameters of matrix 1.\n * @param {!Transform} transform2 Transform parameters of matrix 2.\n * @return {!Transform} transform1 multiplied with transform2.\n */\nexport function multiply(transform1, transform2) {\n const a1 = transform1[0];\n const b1 = transform1[1];\n const c1 = transform1[2];\n const d1 = transform1[3];\n const e1 = transform1[4];\n const f1 = transform1[5];\n const a2 = transform2[0];\n const b2 = transform2[1];\n const c2 = transform2[2];\n const d2 = transform2[3];\n const e2 = transform2[4];\n const f2 = transform2[5];\n\n transform1[0] = a1 * a2 + c1 * b2;\n transform1[1] = b1 * a2 + d1 * b2;\n transform1[2] = a1 * c2 + c1 * d2;\n transform1[3] = b1 * c2 + d1 * d2;\n transform1[4] = a1 * e2 + c1 * f2 + e1;\n transform1[5] = b1 * e2 + d1 * f2 + f1;\n\n return transform1;\n}\n\n/**\n * Set the transform components a-f on a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} a The a component of the transform.\n * @param {number} b The b component of the transform.\n * @param {number} c The c component of the transform.\n * @param {number} d The d component of the transform.\n * @param {number} e The e component of the transform.\n * @param {number} f The f component of the transform.\n * @return {!Transform} Matrix with transform applied.\n */\nexport function set(transform, a, b, c, d, e, f) {\n transform[0] = a;\n transform[1] = b;\n transform[2] = c;\n transform[3] = d;\n transform[4] = e;\n transform[5] = f;\n return transform;\n}\n\n/**\n * Set transform on one matrix from another matrix.\n * @param {!Transform} transform1 Matrix to set transform to.\n * @param {!Transform} transform2 Matrix to set transform from.\n * @return {!Transform} transform1 with transform from transform2 applied.\n */\nexport function setFromArray(transform1, transform2) {\n transform1[0] = transform2[0];\n transform1[1] = transform2[1];\n transform1[2] = transform2[2];\n transform1[3] = transform2[3];\n transform1[4] = transform2[4];\n transform1[5] = transform2[5];\n return transform1;\n}\n\n/**\n * Transforms the given coordinate with the given transform returning the\n * resulting, transformed coordinate. The coordinate will be modified in-place.\n *\n * @param {Transform} transform The transformation.\n * @param {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} coordinate The coordinate to transform.\n * @return {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} return coordinate so that operations can be\n * chained together.\n */\nexport function apply(transform, coordinate) {\n const x = coordinate[0];\n const y = coordinate[1];\n coordinate[0] = transform[0] * x + transform[2] * y + transform[4];\n coordinate[1] = transform[1] * x + transform[3] * y + transform[5];\n return coordinate;\n}\n\n/**\n * Applies rotation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} angle Angle in radians.\n * @return {!Transform} The rotated transform.\n */\nexport function rotate(transform, angle) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));\n}\n\n/**\n * Applies scale to a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scaled transform.\n */\nexport function scale(transform, x, y) {\n return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));\n}\n\n/**\n * Creates a scale transform.\n * @param {!Transform} target Transform to overwrite.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scale transform.\n */\nexport function makeScale(target, x, y) {\n return set(target, x, 0, 0, y, 0, 0);\n}\n\n/**\n * Applies translation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} dx Translation x.\n * @param {number} dy Translation y.\n * @return {!Transform} The translated transform.\n */\nexport function translate(transform, dx, dy) {\n return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));\n}\n\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative).\n * @param {!Transform} transform The transform (will be modified in place).\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {!Transform} The composite transform.\n */\nexport function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {\n const sin = Math.sin(angle);\n const cos = Math.cos(angle);\n transform[0] = sx * cos;\n transform[1] = sy * sin;\n transform[2] = -sx * sin;\n transform[3] = sy * cos;\n transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;\n transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;\n return transform;\n}\n\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative). The resulting transform\n * string can be applied as `transform` porperty of an HTMLElement's style.\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {string} The composite css transform.\n * @api\n */\nexport function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) {\n return toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2));\n}\n\n/**\n * Invert the given transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (source) transform.\n */\nexport function invert(source) {\n return makeInverse(source, source);\n}\n\n/**\n * Invert the given transform.\n * @param {!Transform} target Transform to be set as the inverse of\n * the source transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (target) transform.\n */\nexport function makeInverse(target, source) {\n const det = determinant(source);\n assert(det !== 0, 32); // Transformation matrix cannot be inverted\n\n const a = source[0];\n const b = source[1];\n const c = source[2];\n const d = source[3];\n const e = source[4];\n const f = source[5];\n\n target[0] = d / det;\n target[1] = -b / det;\n target[2] = -c / det;\n target[3] = a / det;\n target[4] = (c * f - d * e) / det;\n target[5] = -(a * f - b * e) / det;\n\n return target;\n}\n\n/**\n * Returns the determinant of the given matrix.\n * @param {!Transform} mat Matrix.\n * @return {number} Determinant.\n */\nexport function determinant(mat) {\n return mat[0] * mat[3] - mat[1] * mat[2];\n}\n\n/**\n * A string version of the transform. This can be used\n * for CSS transforms.\n * @param {!Transform} mat Matrix.\n * @return {string} The transform as a string.\n */\nexport function toString(mat) {\n return 'matrix(' + mat.join(', ') + ')';\n}\n","/**\n * @module ol/extent/Corner\n */\n\n/**\n * Extent corner.\n * @enum {string}\n */\nexport default {\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right',\n};\n","/**\n * @module ol/extent/Relationship\n */\n\n/**\n * Relationship to an extent.\n * @enum {number}\n */\nexport default {\n UNKNOWN: 0,\n INTERSECTING: 1,\n ABOVE: 2,\n RIGHT: 4,\n BELOW: 8,\n LEFT: 16,\n};\n","/**\n * @module ol/extent\n */\nimport Corner from './extent/Corner.js';\nimport Relationship from './extent/Relationship.js';\nimport {assert} from './asserts.js';\n\n/**\n * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.\n * @typedef {Array<number>} Extent\n * @api\n */\n\n/**\n * Build an extent that includes all given coordinates.\n *\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates Coordinates.\n * @return {Extent} Bounding extent.\n * @api\n */\nexport function boundingExtent(coordinates) {\n const extent = createEmpty();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Array<number>} xs Xs.\n * @param {Array<number>} ys Ys.\n * @param {Extent=} opt_extent Destination extent.\n * @private\n * @return {Extent} Extent.\n */\nfunction _boundingExtentXYs(xs, ys, opt_extent) {\n const minX = Math.min.apply(null, xs);\n const minY = Math.min.apply(null, ys);\n const maxX = Math.max.apply(null, xs);\n const maxY = Math.max.apply(null, ys);\n return createOrUpdate(minX, minY, maxX, maxY, opt_extent);\n}\n\n/**\n * Return extent increased by the provided value.\n * @param {Extent} extent Extent.\n * @param {number} value The amount by which the extent should be buffered.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function buffer(extent, value, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = extent[0] - value;\n opt_extent[1] = extent[1] - value;\n opt_extent[2] = extent[2] + value;\n opt_extent[3] = extent[3] + value;\n return opt_extent;\n } else {\n return [\n extent[0] - value,\n extent[1] - value,\n extent[2] + value,\n extent[3] + value,\n ];\n }\n}\n\n/**\n * Creates a clone of an extent.\n *\n * @param {Extent} extent Extent to clone.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} The clone.\n */\nexport function clone(extent, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = extent[0];\n opt_extent[1] = extent[1];\n opt_extent[2] = extent[2];\n opt_extent[3] = extent[3];\n return opt_extent;\n } else {\n return extent.slice();\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {number} Closest squared distance.\n */\nexport function closestSquaredDistanceXY(extent, x, y) {\n let dx, dy;\n if (x < extent[0]) {\n dx = extent[0] - x;\n } else if (extent[2] < x) {\n dx = x - extent[2];\n } else {\n dx = 0;\n }\n if (y < extent[1]) {\n dy = extent[1] - y;\n } else if (extent[3] < y) {\n dy = y - extent[3];\n } else {\n dy = 0;\n }\n return dx * dx + dy * dy;\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} The coordinate is contained in the extent.\n * @api\n */\nexport function containsCoordinate(extent, coordinate) {\n return containsXY(extent, coordinate[0], coordinate[1]);\n}\n\n/**\n * Check if one extent contains another.\n *\n * An extent is deemed contained if it lies completely within the other extent,\n * including if they share one or more edges.\n *\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The second extent is contained by or on the edge of the\n * first.\n * @api\n */\nexport function containsExtent(extent1, extent2) {\n return (\n extent1[0] <= extent2[0] &&\n extent2[2] <= extent1[2] &&\n extent1[1] <= extent2[1] &&\n extent2[3] <= extent1[3]\n );\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n * @return {boolean} The x, y values are contained in the extent.\n * @api\n */\nexport function containsXY(extent, x, y) {\n return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];\n}\n\n/**\n * Get the relationship between a coordinate and extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {import(\"./extent/Relationship.js\").default} The relationship (bitwise compare with\n * import(\"./extent/Relationship.js\").Relationship).\n */\nexport function coordinateRelationship(extent, coordinate) {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const x = coordinate[0];\n const y = coordinate[1];\n let relationship = Relationship.UNKNOWN;\n if (x < minX) {\n relationship = relationship | Relationship.LEFT;\n } else if (x > maxX) {\n relationship = relationship | Relationship.RIGHT;\n }\n if (y < minY) {\n relationship = relationship | Relationship.BELOW;\n } else if (y > maxY) {\n relationship = relationship | Relationship.ABOVE;\n }\n if (relationship === Relationship.UNKNOWN) {\n relationship = Relationship.INTERSECTING;\n }\n return relationship;\n}\n\n/**\n * Create an empty extent.\n * @return {Extent} Empty extent.\n * @api\n */\nexport function createEmpty() {\n return [Infinity, Infinity, -Infinity, -Infinity];\n}\n\n/**\n * Create a new extent or update the provided extent.\n * @param {number} minX Minimum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxX Maximum X.\n * @param {number} maxY Maximum Y.\n * @param {Extent=} opt_extent Destination extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdate(minX, minY, maxX, maxY, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = minX;\n opt_extent[1] = minY;\n opt_extent[2] = maxX;\n opt_extent[3] = maxY;\n return opt_extent;\n } else {\n return [minX, minY, maxX, maxY];\n }\n}\n\n/**\n * Create a new empty extent or make the provided one empty.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateEmpty(opt_extent) {\n return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinate(coordinate, opt_extent) {\n const x = coordinate[0];\n const y = coordinate[1];\n return createOrUpdate(x, y, x, y, opt_extent);\n}\n\n/**\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinates(coordinates, opt_extent) {\n const extent = createOrUpdateEmpty(opt_extent);\n return extendCoordinates(extent, coordinates);\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n opt_extent\n) {\n const extent = createOrUpdateEmpty(opt_extent);\n return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);\n}\n\n/**\n * @param {Array<Array<import(\"./coordinate.js\").Coordinate>>} rings Rings.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromRings(rings, opt_extent) {\n const extent = createOrUpdateEmpty(opt_extent);\n return extendRings(extent, rings);\n}\n\n/**\n * Determine if two extents are equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The two extents are equivalent.\n * @api\n */\nexport function equals(extent1, extent2) {\n return (\n extent1[0] == extent2[0] &&\n extent1[2] == extent2[2] &&\n extent1[1] == extent2[1] &&\n extent1[3] == extent2[3]\n );\n}\n\n/**\n * Determine if two extents are approximately equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {number} tolerance Tolerance in extent coordinate units.\n * @return {boolean} The two extents differ by less than the tolerance.\n */\nexport function approximatelyEquals(extent1, extent2, tolerance) {\n return (\n Math.abs(extent1[0] - extent2[0]) < tolerance &&\n Math.abs(extent1[2] - extent2[2]) < tolerance &&\n Math.abs(extent1[1] - extent2[1]) < tolerance &&\n Math.abs(extent1[3] - extent2[3]) < tolerance\n );\n}\n\n/**\n * Modify an extent to include another extent.\n * @param {Extent} extent1 The extent to be modified.\n * @param {Extent} extent2 The extent that will be included in the first.\n * @return {Extent} A reference to the first (extended) extent.\n * @api\n */\nexport function extend(extent1, extent2) {\n if (extent2[0] < extent1[0]) {\n extent1[0] = extent2[0];\n }\n if (extent2[2] > extent1[2]) {\n extent1[2] = extent2[2];\n }\n if (extent2[1] < extent1[1]) {\n extent1[1] = extent2[1];\n }\n if (extent2[3] > extent1[3]) {\n extent1[3] = extent2[3];\n }\n return extent1;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n */\nexport function extendCoordinate(extent, coordinate) {\n if (coordinate[0] < extent[0]) {\n extent[0] = coordinate[0];\n }\n if (coordinate[0] > extent[2]) {\n extent[2] = coordinate[0];\n }\n if (coordinate[1] < extent[1]) {\n extent[1] = coordinate[1];\n }\n if (coordinate[1] > extent[3]) {\n extent[3] = coordinate[1];\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates Coordinates.\n * @return {Extent} Extent.\n */\nexport function extendCoordinates(extent, coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Extent} Extent.\n */\nexport function extendFlatCoordinates(\n extent,\n flatCoordinates,\n offset,\n end,\n stride\n) {\n for (; offset < end; offset += stride) {\n extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array<Array<import(\"./coordinate.js\").Coordinate>>} rings Rings.\n * @return {Extent} Extent.\n */\nexport function extendRings(extent, rings) {\n for (let i = 0, ii = rings.length; i < ii; ++i) {\n extendCoordinates(extent, rings[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n */\nexport function extendXY(extent, x, y) {\n extent[0] = Math.min(extent[0], x);\n extent[1] = Math.min(extent[1], y);\n extent[2] = Math.max(extent[2], x);\n extent[3] = Math.max(extent[3], y);\n}\n\n/**\n * This function calls `callback` for each corner of the extent. If the\n * callback returns a truthy value the function returns that value\n * immediately. Otherwise the function returns `false`.\n * @param {Extent} extent Extent.\n * @param {function(import(\"./coordinate.js\").Coordinate): S} callback Callback.\n * @return {S|boolean} Value.\n * @template S\n */\nexport function forEachCorner(extent, callback) {\n let val;\n val = callback(getBottomLeft(extent));\n if (val) {\n return val;\n }\n val = callback(getBottomRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopLeft(extent));\n if (val) {\n return val;\n }\n return false;\n}\n\n/**\n * Get the size of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Area.\n * @api\n */\nexport function getArea(extent) {\n let area = 0;\n if (!isEmpty(extent)) {\n area = getWidth(extent) * getHeight(extent);\n }\n return area;\n}\n\n/**\n * Get the bottom left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom left coordinate.\n * @api\n */\nexport function getBottomLeft(extent) {\n return [extent[0], extent[1]];\n}\n\n/**\n * Get the bottom right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom right coordinate.\n * @api\n */\nexport function getBottomRight(extent) {\n return [extent[2], extent[1]];\n}\n\n/**\n * Get the center coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Center.\n * @api\n */\nexport function getCenter(extent) {\n return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];\n}\n\n/**\n * Get a corner coordinate of an extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./extent/Corner.js\").default} corner Corner.\n * @return {import(\"./coordinate.js\").Coordinate} Corner coordinate.\n */\nexport function getCorner(extent, corner) {\n let coordinate;\n if (corner === Corner.BOTTOM_LEFT) {\n coordinate = getBottomLeft(extent);\n } else if (corner === Corner.BOTTOM_RIGHT) {\n coordinate = getBottomRight(extent);\n } else if (corner === Corner.TOP_LEFT) {\n coordinate = getTopLeft(extent);\n } else if (corner === Corner.TOP_RIGHT) {\n coordinate = getTopRight(extent);\n } else {\n assert(false, 13); // Invalid corner\n }\n return coordinate;\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Enlarged area.\n */\nexport function getEnlargedArea(extent1, extent2) {\n const minX = Math.min(extent1[0], extent2[0]);\n const minY = Math.min(extent1[1], extent2[1]);\n const maxX = Math.max(extent1[2], extent2[2]);\n const maxY = Math.max(extent1[3], extent2[3]);\n return (maxX - minX) * (maxY - minY);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @param {Extent=} opt_extent Destination extent.\n * @return {Extent} Extent.\n */\nexport function getForViewAndSize(\n center,\n resolution,\n rotation,\n size,\n opt_extent\n) {\n const dx = (resolution * size[0]) / 2;\n const dy = (resolution * size[1]) / 2;\n const cosRotation = Math.cos(rotation);\n const sinRotation = Math.sin(rotation);\n const xCos = dx * cosRotation;\n const xSin = dx * sinRotation;\n const yCos = dy * cosRotation;\n const ySin = dy * sinRotation;\n const x = center[0];\n const y = center[1];\n const x0 = x - xCos + ySin;\n const x1 = x - xCos - ySin;\n const x2 = x + xCos - ySin;\n const x3 = x + xCos + ySin;\n const y0 = y - xSin - yCos;\n const y1 = y - xSin + yCos;\n const y2 = y + xSin + yCos;\n const y3 = y + xSin - yCos;\n return createOrUpdate(\n Math.min(x0, x1, x2, x3),\n Math.min(y0, y1, y2, y3),\n Math.max(x0, x1, x2, x3),\n Math.max(y0, y1, y2, y3),\n opt_extent\n );\n}\n\n/**\n * Get the height of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Height.\n * @api\n */\nexport function getHeight(extent) {\n return extent[3] - extent[1];\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Intersection area.\n */\nexport function getIntersectionArea(extent1, extent2) {\n const intersection = getIntersection(extent1, extent2);\n return getArea(intersection);\n}\n\n/**\n * Get the intersection of two extents.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {Extent=} opt_extent Optional extent to populate with intersection.\n * @return {Extent} Intersecting extent.\n * @api\n */\nexport function getIntersection(extent1, extent2, opt_extent) {\n const intersection = opt_extent ? opt_extent : createEmpty();\n if (intersects(extent1, extent2)) {\n if (extent1[0] > extent2[0]) {\n intersection[0] = extent1[0];\n } else {\n intersection[0] = extent2[0];\n }\n if (extent1[1] > extent2[1]) {\n intersection[1] = extent1[1];\n } else {\n intersection[1] = extent2[1];\n }\n if (extent1[2] < extent2[2]) {\n intersection[2] = extent1[2];\n } else {\n intersection[2] = extent2[2];\n }\n if (extent1[3] < extent2[3]) {\n intersection[3] = extent1[3];\n } else {\n intersection[3] = extent2[3];\n }\n } else {\n createOrUpdateEmpty(intersection);\n }\n return intersection;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @return {number} Margin.\n */\nexport function getMargin(extent) {\n return getWidth(extent) + getHeight(extent);\n}\n\n/**\n * Get the size (width, height) of an extent.\n * @param {Extent} extent The extent.\n * @return {import(\"./size.js\").Size} The extent size.\n * @api\n */\nexport function getSize(extent) {\n return [extent[2] - extent[0], extent[3] - extent[1]];\n}\n\n/**\n * Get the top left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top left coordinate.\n * @api\n */\nexport function getTopLeft(extent) {\n return [extent[0], extent[3]];\n}\n\n/**\n * Get the top right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top right coordinate.\n * @api\n */\nexport function getTopRight(extent) {\n return [extent[2], extent[3]];\n}\n\n/**\n * Get the width of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Width.\n * @api\n */\nexport function getWidth(extent) {\n return extent[2] - extent[0];\n}\n\n/**\n * Determine if one extent intersects another.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent.\n * @return {boolean} The two extents intersect.\n * @api\n */\nexport function intersects(extent1, extent2) {\n return (\n extent1[0] <= extent2[2] &&\n extent1[2] >= extent2[0] &&\n extent1[1] <= extent2[3] &&\n extent1[3] >= extent2[1]\n );\n}\n\n/**\n * Determine if an extent is empty.\n * @param {Extent} extent Extent.\n * @return {boolean} Is empty.\n * @api\n */\nexport function isEmpty(extent) {\n return extent[2] < extent[0] || extent[3] < extent[1];\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Extent=} opt_extent Extent.\n * @return {Extent} Extent.\n */\nexport function returnOrUpdate(extent, opt_extent) {\n if (opt_extent) {\n opt_extent[0] = extent[0];\n opt_extent[1] = extent[1];\n opt_extent[2] = extent[2];\n opt_extent[3] = extent[3];\n return opt_extent;\n } else {\n return extent;\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} value Value.\n */\nexport function scaleFromCenter(extent, value) {\n const deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);\n const deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);\n extent[0] -= deltaX;\n extent[2] += deltaX;\n extent[1] -= deltaY;\n extent[3] += deltaY;\n}\n\n/**\n * Determine if the segment between two coordinates intersects (crosses,\n * touches, or is contained by) the provided extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} start Segment start coordinate.\n * @param {import(\"./coordinate.js\").Coordinate} end Segment end coordinate.\n * @return {boolean} The segment intersects the extent.\n */\nexport function intersectsSegment(extent, start, end) {\n let intersects = false;\n const startRel = coordinateRelationship(extent, start);\n const endRel = coordinateRelationship(extent, end);\n if (\n startRel === Relationship.INTERSECTING ||\n endRel === Relationship.INTERSECTING\n ) {\n intersects = true;\n } else {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const startX = start[0];\n const startY = start[1];\n const endX = end[0];\n const endY = end[1];\n const slope = (endY - startY) / (endX - startX);\n let x, y;\n if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) {\n // potentially intersects top\n x = endX - (endY - maxY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.RIGHT) &&\n !(startRel & Relationship.RIGHT)\n ) {\n // potentially intersects right\n y = endY - (endX - maxX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.BELOW) &&\n !(startRel & Relationship.BELOW)\n ) {\n // potentially intersects bottom\n x = endX - (endY - minY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.LEFT) &&\n !(startRel & Relationship.LEFT)\n ) {\n // potentially intersects left\n y = endY - (endX - minX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n }\n return intersects;\n}\n\n/**\n * Apply a transform function to the extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./proj.js\").TransformFunction} transformFn Transform function.\n * Called with `[minX, minY, maxX, maxY]` extent coordinates.\n * @param {Extent=} opt_extent Destination extent.\n * @param {number=} opt_stops Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {Extent} Extent.\n * @api\n */\nexport function applyTransform(extent, transformFn, opt_extent, opt_stops) {\n let coordinates = [];\n if (opt_stops > 1) {\n const width = extent[2] - extent[0];\n const height = extent[3] - extent[1];\n for (let i = 0; i < opt_stops; ++i) {\n coordinates.push(\n extent[0] + (width * i) / opt_stops,\n extent[1],\n extent[2],\n extent[1] + (height * i) / opt_stops,\n extent[2] - (width * i) / opt_stops,\n extent[3],\n extent[0],\n extent[3] - (height * i) / opt_stops\n );\n }\n } else {\n coordinates = [\n extent[0],\n extent[1],\n extent[2],\n extent[1],\n extent[2],\n extent[3],\n extent[0],\n extent[3],\n ];\n }\n transformFn(coordinates, coordinates, 2);\n const xs = [];\n const ys = [];\n for (let i = 0, l = coordinates.length; i < l; i += 2) {\n xs.push(coordinates[i]);\n ys.push(coordinates[i + 1]);\n }\n return _boundingExtentXYs(xs, ys, opt_extent);\n}\n\n/**\n * Modifies the provided extent in-place to be within the real world\n * extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @return {Extent} The extent within the real world extent.\n */\nexport function wrapX(extent, projection) {\n const projectionExtent = projection.getExtent();\n const center = getCenter(extent);\n if (\n projection.canWrapX() &&\n (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])\n ) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.floor(\n (center[0] - projectionExtent[0]) / worldWidth\n );\n const offset = worldsAway * worldWidth;\n extent[0] -= offset;\n extent[2] -= offset;\n }\n return extent;\n}\n","/**\n * @module ol/proj/Projection\n */\nimport {METERS_PER_UNIT} from './Units.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.\n * @property {import(\"./Units.js\").default|string} [units] Units. Required unless a\n * proj4 projection is defined for `code`.\n * @property {import(\"../extent.js\").Extent} [extent] The validity extent for the SRS.\n * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.\n * @property {boolean} [global=false] Whether the projection is valid for the whole globe.\n * @property {number} [metersPerUnit] The meters per unit for the SRS.\n * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT}\n * lookup table.\n * @property {import(\"../extent.js\").Extent} [worldExtent] The world extent for the SRS.\n * @property {function(number, import(\"../coordinate.js\").Coordinate):number} [getPointResolution]\n * Function to determine resolution at a point. The function is called with a\n * `{number}` view resolution and an `{import(\"../coordinate.js\").Coordinate}` as arguments, and returns\n * the `{number}` resolution in projection units at the passed coordinate. If this is `undefined`,\n * the default {@link module:ol/proj#getPointResolution} function will be used.\n */\n\n/**\n * @classdesc\n * Projection definition class. One of these is created for each projection\n * supported in the application and stored in the {@link module:ol/proj} namespace.\n * You can use these in applications, but this is not required, as API params\n * and options use {@link module:ol/proj~ProjectionLike} which means the simple string\n * code will suffice.\n *\n * You can use {@link module:ol/proj~get} to retrieve the object for a particular\n * projection.\n *\n * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together\n * with the following aliases:\n * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326,\n * urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84,\n * http://www.opengis.net/gml/srs/epsg.xml#4326,\n * urn:x-ogc:def:crs:EPSG:4326\n * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913,\n * urn:ogc:def:crs:EPSG:6.18:3:3857,\n * http://www.opengis.net/gml/srs/epsg.xml#3857\n *\n * If you use [proj4js](https://github.com/proj4js/proj4js), aliases can\n * be added using `proj4.defs()`. After all required projection definitions are\n * added, call the {@link module:ol/proj/proj4~register} function.\n *\n * @api\n */\nclass Projection {\n /**\n * @param {Options} options Projection options.\n */\n constructor(options) {\n /**\n * @private\n * @type {string}\n */\n this.code_ = options.code;\n\n /**\n * Units of projected coordinates. When set to `TILE_PIXELS`, a\n * `this.extent_` and `this.worldExtent_` must be configured properly for each\n * tile.\n * @private\n * @type {import(\"./Units.js\").default}\n */\n this.units_ = /** @type {import(\"./Units.js\").default} */ (options.units);\n\n /**\n * Validity extent of the projection in projected coordinates. For projections\n * with `TILE_PIXELS` units, this is the extent of the tile in\n * tile pixel space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = options.extent !== undefined ? options.extent : null;\n\n /**\n * Extent of the world in EPSG:4326. For projections with\n * `TILE_PIXELS` units, this is the extent of the tile in\n * projected coordinate space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.worldExtent_ =\n options.worldExtent !== undefined ? options.worldExtent : null;\n\n /**\n * @private\n * @type {string}\n */\n this.axisOrientation_ =\n options.axisOrientation !== undefined ? options.axisOrientation : 'enu';\n\n /**\n * @private\n * @type {boolean}\n */\n this.global_ = options.global !== undefined ? options.global : false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.canWrapX_ = !!(this.global_ && this.extent_);\n\n /**\n * @private\n * @type {function(number, import(\"../coordinate.js\").Coordinate):number|undefined}\n */\n this.getPointResolutionFunc_ = options.getPointResolution;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.defaultTileGrid_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.metersPerUnit_ = options.metersPerUnit;\n }\n\n /**\n * @return {boolean} The projection is suitable for wrapping the x-axis\n */\n canWrapX() {\n return this.canWrapX_;\n }\n\n /**\n * Get the code for this projection, e.g. 'EPSG:4326'.\n * @return {string} Code.\n * @api\n */\n getCode() {\n return this.code_;\n }\n\n /**\n * Get the validity extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n return this.extent_;\n }\n\n /**\n * Get the units of this projection.\n * @return {import(\"./Units.js\").default} Units.\n * @api\n */\n getUnits() {\n return this.units_;\n }\n\n /**\n * Get the amount of meters per unit of this projection. If the projection is\n * not configured with `metersPerUnit` or a units identifier, the return is\n * `undefined`.\n * @return {number|undefined} Meters.\n * @api\n */\n getMetersPerUnit() {\n return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];\n }\n\n /**\n * Get the world extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getWorldExtent() {\n return this.worldExtent_;\n }\n\n /**\n * Get the axis orientation of this projection.\n * Example values are:\n * enu - the default easting, northing, elevation.\n * neu - northing, easting, up - useful for \"lat/long\" geographic coordinates,\n * or south orientated transverse mercator.\n * wnu - westing, northing, up - some planetary coordinate systems have\n * \"west positive\" coordinate systems\n * @return {string} Axis orientation.\n * @api\n */\n getAxisOrientation() {\n return this.axisOrientation_;\n }\n\n /**\n * Is this projection a global projection which spans the whole world?\n * @return {boolean} Whether the projection is global.\n * @api\n */\n isGlobal() {\n return this.global_;\n }\n\n /**\n * Set if the projection is a global projection which spans the whole world\n * @param {boolean} global Whether the projection is global.\n * @api\n */\n setGlobal(global) {\n this.global_ = global;\n this.canWrapX_ = !!(global && this.extent_);\n }\n\n /**\n * @return {import(\"../tilegrid/TileGrid.js\").default} The default tile grid.\n */\n getDefaultTileGrid() {\n return this.defaultTileGrid_;\n }\n\n /**\n * @param {import(\"../tilegrid/TileGrid.js\").default} tileGrid The default tile grid.\n */\n setDefaultTileGrid(tileGrid) {\n this.defaultTileGrid_ = tileGrid;\n }\n\n /**\n * Set the validity extent for this projection.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n setExtent(extent) {\n this.extent_ = extent;\n this.canWrapX_ = !!(this.global_ && extent);\n }\n\n /**\n * Set the world extent for this projection.\n * @param {import(\"../extent.js\").Extent} worldExtent World extent\n * [minlon, minlat, maxlon, maxlat].\n * @api\n */\n setWorldExtent(worldExtent) {\n this.worldExtent_ = worldExtent;\n }\n\n /**\n * Set the getPointResolution function (see {@link module:ol/proj~getPointResolution}\n * for this projection.\n * @param {function(number, import(\"../coordinate.js\").Coordinate):number} func Function\n * @api\n */\n setGetPointResolution(func) {\n this.getPointResolutionFunc_ = func;\n }\n\n /**\n * Get the custom point resolution function for this projection (if set).\n * @return {function(number, import(\"../coordinate.js\").Coordinate):number|undefined} The custom point\n * resolution function (if set).\n */\n getPointResolutionFunc() {\n return this.getPointResolutionFunc_;\n }\n}\n\nexport default Projection;\n","/**\n * @module ol/math\n */\n\n/**\n * Takes a number and clamps it to within the provided bounds.\n * @param {number} value The input number.\n * @param {number} min The minimum value to return.\n * @param {number} max The maximum value to return.\n * @return {number} The input number if it is within bounds, or the nearest\n * number within the bounds.\n */\nexport function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Return the hyperbolic cosine of a given number. The method will use the\n * native `Math.cosh` function if it is available, otherwise the hyperbolic\n * cosine will be calculated via the reference implementation of the Mozilla\n * developer network.\n *\n * @param {number} x X.\n * @return {number} Hyperbolic cosine of x.\n */\nexport const cosh = (function () {\n // Wrapped in a iife, to save the overhead of checking for the native\n // implementation on every invocation.\n let cosh;\n if ('cosh' in Math) {\n // The environment supports the native Math.cosh function, use it…\n cosh = Math.cosh;\n } else {\n // … else, use the reference implementation of MDN:\n cosh = function (x) {\n const y = /** @type {Math} */ (Math).exp(x);\n return (y + 1 / y) / 2;\n };\n }\n return cosh;\n})();\n\n/**\n * Return the base 2 logarithm of a given number. The method will use the\n * native `Math.log2` function if it is available, otherwise the base 2\n * logarithm will be calculated via the reference implementation of the\n * Mozilla developer network.\n *\n * @param {number} x X.\n * @return {number} Base 2 logarithm of x.\n */\nexport const log2 = (function () {\n // Wrapped in a iife, to save the overhead of checking for the native\n // implementation on every invocation.\n let log2;\n if ('log2' in Math) {\n // The environment supports the native Math.log2 function, use it…\n log2 = Math.log2;\n } else {\n // … else, use the reference implementation of MDN:\n log2 = function (x) {\n return Math.log(x) * Math.LOG2E;\n };\n }\n return log2;\n})();\n\n/**\n * Returns the square of the closest distance between the point (x, y) and the\n * line segment (x1, y1) to (x2, y2).\n * @param {number} x X.\n * @param {number} y Y.\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredSegmentDistance(x, y, x1, y1, x2, y2) {\n const dx = x2 - x1;\n const dy = y2 - y1;\n if (dx !== 0 || dy !== 0) {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x1 = x2;\n y1 = y2;\n } else if (t > 0) {\n x1 += dx * t;\n y1 += dy * t;\n }\n }\n return squaredDistance(x, y, x1, y1);\n}\n\n/**\n * Returns the square of the distance between the points (x1, y1) and (x2, y2).\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredDistance(x1, y1, x2, y2) {\n const dx = x2 - x1;\n const dy = y2 - y1;\n return dx * dx + dy * dy;\n}\n\n/**\n * Solves system of linear equations using Gaussian elimination method.\n *\n * @param {Array<Array<number>>} mat Augmented matrix (n x n + 1 column)\n * in row-major order.\n * @return {Array<number>} The resulting vector.\n */\nexport function solveLinearSystem(mat) {\n const n = mat.length;\n\n for (let i = 0; i < n; i++) {\n // Find max in the i-th column (ignoring i - 1 first rows)\n let maxRow = i;\n let maxEl = Math.abs(mat[i][i]);\n for (let r = i + 1; r < n; r++) {\n const absValue = Math.abs(mat[r][i]);\n if (absValue > maxEl) {\n maxEl = absValue;\n maxRow = r;\n }\n }\n\n if (maxEl === 0) {\n return null; // matrix is singular\n }\n\n // Swap max row with i-th (current) row\n const tmp = mat[maxRow];\n mat[maxRow] = mat[i];\n mat[i] = tmp;\n\n // Subtract the i-th row to make all the remaining rows 0 in the i-th column\n for (let j = i + 1; j < n; j++) {\n const coef = -mat[j][i] / mat[i][i];\n for (let k = i; k < n + 1; k++) {\n if (i == k) {\n mat[j][k] = 0;\n } else {\n mat[j][k] += coef * mat[i][k];\n }\n }\n }\n }\n\n // Solve Ax=b for upper triangular matrix A (mat)\n const x = new Array(n);\n for (let l = n - 1; l >= 0; l--) {\n x[l] = mat[l][n] / mat[l][l];\n for (let m = l - 1; m >= 0; m--) {\n mat[m][n] -= mat[m][l] * x[l];\n }\n }\n return x;\n}\n\n/**\n * Converts radians to to degrees.\n *\n * @param {number} angleInRadians Angle in radians.\n * @return {number} Angle in degrees.\n */\nexport function toDegrees(angleInRadians) {\n return (angleInRadians * 180) / Math.PI;\n}\n\n/**\n * Converts degrees to radians.\n *\n * @param {number} angleInDegrees Angle in degrees.\n * @return {number} Angle in radians.\n */\nexport function toRadians(angleInDegrees) {\n return (angleInDegrees * Math.PI) / 180;\n}\n\n/**\n * Returns the modulo of a / b, depending on the sign of b.\n *\n * @param {number} a Dividend.\n * @param {number} b Divisor.\n * @return {number} Modulo.\n */\nexport function modulo(a, b) {\n const r = a % b;\n return r * b < 0 ? r + b : r;\n}\n\n/**\n * Calculates the linearly interpolated value of x between a and b.\n *\n * @param {number} a Number\n * @param {number} b Number\n * @param {number} x Value to be interpolated.\n * @return {number} Interpolated value.\n */\nexport function lerp(a, b, x) {\n return a + x * (b - a);\n}\n","/**\n * @module ol/proj/epsg3857\n */\nimport Projection from './Projection.js';\nimport Units from './Units.js';\nimport {cosh} from '../math.js';\n\n/**\n * Radius of WGS84 sphere\n *\n * @const\n * @type {number}\n */\nexport const RADIUS = 6378137;\n\n/**\n * @const\n * @type {number}\n */\nexport const HALF_SIZE = Math.PI * RADIUS;\n\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE];\n\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const WORLD_EXTENT = [-180, -85, 180, 85];\n\n/**\n * @classdesc\n * Projection object for web/spherical Mercator (EPSG:3857).\n */\nclass EPSG3857Projection extends Projection {\n /**\n * @param {string} code Code.\n */\n constructor(code) {\n super({\n code: code,\n units: Units.METERS,\n extent: EXTENT,\n global: true,\n worldExtent: WORLD_EXTENT,\n getPointResolution: function (resolution, point) {\n return resolution / cosh(point[1] / RADIUS);\n },\n });\n }\n}\n\n/**\n * Projections equal to EPSG:3857.\n *\n * @const\n * @type {Array<import(\"./Projection.js\").default>}\n */\nexport const PROJECTIONS = [\n new EPSG3857Projection('EPSG:3857'),\n new EPSG3857Projection('EPSG:102100'),\n new EPSG3857Projection('EPSG:102113'),\n new EPSG3857Projection('EPSG:900913'),\n new EPSG3857Projection('urn:ogc:def:crs:EPSG:6.18:3:3857'),\n new EPSG3857Projection('urn:ogc:def:crs:EPSG::3857'),\n new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'),\n];\n\n/**\n * Transformation from EPSG:4326 to EPSG:3857.\n *\n * @param {Array<number>} input Input array of coordinate values.\n * @param {Array<number>=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension (default is `2`).\n * @return {Array<number>} Output array of coordinate values.\n */\nexport function fromEPSG4326(input, opt_output, opt_dimension) {\n const length = input.length;\n const dimension = opt_dimension > 1 ? opt_dimension : 2;\n let output = opt_output;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n const halfSize = HALF_SIZE;\n for (let i = 0; i < length; i += dimension) {\n output[i] = (halfSize * input[i]) / 180;\n let y = RADIUS * Math.log(Math.tan((Math.PI * (+input[i + 1] + 90)) / 360));\n if (y > halfSize) {\n y = halfSize;\n } else if (y < -halfSize) {\n y = -halfSize;\n }\n output[i + 1] = y;\n }\n return output;\n}\n\n/**\n * Transformation from EPSG:3857 to EPSG:4326.\n *\n * @param {Array<number>} input Input array of coordinate values.\n * @param {Array<number>=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension (default is `2`).\n * @return {Array<number>} Output array of coordinate values.\n */\nexport function toEPSG4326(input, opt_output, opt_dimension) {\n const length = input.length;\n const dimension = opt_dimension > 1 ? opt_dimension : 2;\n let output = opt_output;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += dimension) {\n output[i] = (180 * input[i]) / HALF_SIZE;\n output[i + 1] =\n (360 * Math.atan(Math.exp(input[i + 1] / RADIUS))) / Math.PI - 90;\n }\n return output;\n}\n","/**\n * @module ol/proj/epsg4326\n */\nimport Projection from './Projection.js';\nimport Units from './Units.js';\n\n/**\n * Semi-major radius of the WGS84 ellipsoid.\n *\n * @const\n * @type {number}\n */\nexport const RADIUS = 6378137;\n\n/**\n * Extent of the EPSG:4326 projection which is the whole world.\n *\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const EXTENT = [-180, -90, 180, 90];\n\n/**\n * @const\n * @type {number}\n */\nexport const METERS_PER_UNIT = (Math.PI * RADIUS) / 180;\n\n/**\n * @classdesc\n * Projection object for WGS84 geographic coordinates (EPSG:4326).\n *\n * Note that OpenLayers does not strictly comply with the EPSG definition.\n * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).\n * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.\n */\nclass EPSG4326Projection extends Projection {\n /**\n * @param {string} code Code.\n * @param {string=} opt_axisOrientation Axis orientation.\n */\n constructor(code, opt_axisOrientation) {\n super({\n code: code,\n units: Units.DEGREES,\n extent: EXTENT,\n axisOrientation: opt_axisOrientation,\n global: true,\n metersPerUnit: METERS_PER_UNIT,\n worldExtent: EXTENT,\n });\n }\n}\n\n/**\n * Projections equal to EPSG:4326.\n *\n * @const\n * @type {Array<import(\"./Projection.js\").default>}\n */\nexport const PROJECTIONS = [\n new EPSG4326Projection('CRS:84'),\n new EPSG4326Projection('EPSG:4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),\n new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),\n new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu'),\n];\n","/**\n * @module ol/proj/projections\n */\n\n/**\n * @type {Object<string, import(\"./Projection.js\").default>}\n */\nlet cache = {};\n\n/**\n * Clear the projections cache.\n */\nexport function clear() {\n cache = {};\n}\n\n/**\n * Get a cached projection by code.\n * @param {string} code The code for the projection.\n * @return {import(\"./Projection.js\").default} The projection (if cached).\n */\nexport function get(code) {\n return cache[code] || null;\n}\n\n/**\n * Add a projection to the cache.\n * @param {string} code The projection code.\n * @param {import(\"./Projection.js\").default} projection The projection to cache.\n */\nexport function add(code, projection) {\n cache[code] = projection;\n}\n","/**\n * @module ol/proj/transforms\n */\nimport {isEmpty} from '../obj.js';\n\n/**\n * @private\n * @type {!Object<string, Object<string, import(\"../proj.js\").TransformFunction>>}\n */\nlet transforms = {};\n\n/**\n * Clear the transform cache.\n */\nexport function clear() {\n transforms = {};\n}\n\n/**\n * Registers a conversion function to convert coordinates from the source\n * projection to the destination projection.\n *\n * @param {import(\"./Projection.js\").default} source Source.\n * @param {import(\"./Projection.js\").default} destination Destination.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform.\n */\nexport function add(source, destination, transformFn) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n if (!(sourceCode in transforms)) {\n transforms[sourceCode] = {};\n }\n transforms[sourceCode][destinationCode] = transformFn;\n}\n\n/**\n * Unregisters the conversion function to convert coordinates from the source\n * projection to the destination projection. This method is used to clean up\n * cached transforms during testing.\n *\n * @param {import(\"./Projection.js\").default} source Source projection.\n * @param {import(\"./Projection.js\").default} destination Destination projection.\n * @return {import(\"../proj.js\").TransformFunction} transformFn The unregistered transform.\n */\nexport function remove(source, destination) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n const transform = transforms[sourceCode][destinationCode];\n delete transforms[sourceCode][destinationCode];\n if (isEmpty(transforms[sourceCode])) {\n delete transforms[sourceCode];\n }\n return transform;\n}\n\n/**\n * Get a transform given a source code and a destination code.\n * @param {string} sourceCode The code for the source projection.\n * @param {string} destinationCode The code for the destination projection.\n * @return {import(\"../proj.js\").TransformFunction|undefined} The transform function (if found).\n */\nexport function get(sourceCode, destinationCode) {\n let transform;\n if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {\n transform = transforms[sourceCode][destinationCode];\n }\n return transform;\n}\n","/**\n * @module ol/sphere\n */\nimport GeometryType from './geom/GeometryType.js';\nimport {toDegrees, toRadians} from './math.js';\n\n/**\n * Object literal with options for the {@link getLength} or {@link getArea}\n * functions.\n * @typedef {Object} SphereMetricOptions\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857']\n * Projection of the geometry. By default, the geometry is assumed to be in\n * Web Mercator.\n * @property {number} [radius=6371008.8] Sphere radius. By default, the\n * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)\n * for the WGS84 ellipsoid is used.\n */\n\n/**\n * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid.\n * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius\n * @type {number}\n */\nexport const DEFAULT_RADIUS = 6371008.8;\n\n/**\n * Get the great circle distance (in meters) between two geographic coordinates.\n * @param {Array} c1 Starting coordinate.\n * @param {Array} c2 Ending coordinate.\n * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {number} The great circle distance between the points (in meters).\n * @api\n */\nexport function getDistance(c1, c2, opt_radius) {\n const radius = opt_radius || DEFAULT_RADIUS;\n const lat1 = toRadians(c1[1]);\n const lat2 = toRadians(c2[1]);\n const deltaLatBy2 = (lat2 - lat1) / 2;\n const deltaLonBy2 = toRadians(c2[0] - c1[0]) / 2;\n const a =\n Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +\n Math.sin(deltaLonBy2) *\n Math.sin(deltaLonBy2) *\n Math.cos(lat1) *\n Math.cos(lat2);\n return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n}\n\n/**\n * Get the cumulative great circle length of linestring coordinates (geographic).\n * @param {Array} coordinates Linestring coordinates.\n * @param {number} radius The sphere radius to use.\n * @return {number} The length (in meters).\n */\nfunction getLengthInternal(coordinates, radius) {\n let length = 0;\n for (let i = 0, ii = coordinates.length; i < ii - 1; ++i) {\n length += getDistance(coordinates[i], coordinates[i + 1], radius);\n }\n return length;\n}\n\n/**\n * Get the spherical length of a geometry. This length is the sum of the\n * great circle distances between coordinates. For polygons, the length is\n * the sum of all rings. For points, the length is zero. For multi-part\n * geometries, the length is the sum of the length of each part.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions=} opt_options Options for the\n * length calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical length (in meters).\n * @api\n */\nexport function getLength(geometry, opt_options) {\n const options = opt_options || {};\n const radius = options.radius || DEFAULT_RADIUS;\n const projection = options.projection || 'EPSG:3857';\n const type = geometry.getType();\n if (type !== GeometryType.GEOMETRY_COLLECTION) {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n let length = 0;\n let coordinates, coords, i, ii, j, jj;\n switch (type) {\n case GeometryType.POINT:\n case GeometryType.MULTI_POINT: {\n break;\n }\n case GeometryType.LINE_STRING:\n case GeometryType.LINEAR_RING: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n length = getLengthInternal(coordinates, radius);\n break;\n }\n case GeometryType.MULTI_LINE_STRING:\n case GeometryType.POLYGON: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n length += getLengthInternal(coordinates[i], radius);\n }\n break;\n }\n case GeometryType.MULTI_POLYGON: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n for (j = 0, jj = coords.length; j < jj; ++j) {\n length += getLengthInternal(coords[j], radius);\n }\n }\n break;\n }\n case GeometryType.GEOMETRY_COLLECTION: {\n const geometries = /** @type {import(\"./geom/GeometryCollection.js\").default} */ (geometry).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n length += getLength(geometries[i], opt_options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return length;\n}\n\n/**\n * Returns the spherical area for a list of coordinates.\n *\n * [Reference](https://trs-new.jpl.nasa.gov/handle/2014/40409)\n * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n * Laboratory, Pasadena, CA, June 2007\n *\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates List of coordinates of a linear\n * ring. If the ring is oriented clockwise, the area will be positive,\n * otherwise it will be negative.\n * @param {number} radius The sphere radius.\n * @return {number} Area (in square meters).\n */\nfunction getAreaInternal(coordinates, radius) {\n let area = 0;\n const len = coordinates.length;\n let x1 = coordinates[len - 1][0];\n let y1 = coordinates[len - 1][1];\n for (let i = 0; i < len; i++) {\n const x2 = coordinates[i][0];\n const y2 = coordinates[i][1];\n area +=\n toRadians(x2 - x1) *\n (2 + Math.sin(toRadians(y1)) + Math.sin(toRadians(y2)));\n x1 = x2;\n y1 = y2;\n }\n return (area * radius * radius) / 2.0;\n}\n\n/**\n * Get the spherical area of a geometry. This is the area (in meters) assuming\n * that polygon edges are segments of great circles on a sphere.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions=} opt_options Options for the area\n * calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical area (in square meters).\n * @api\n */\nexport function getArea(geometry, opt_options) {\n const options = opt_options || {};\n const radius = options.radius || DEFAULT_RADIUS;\n const projection = options.projection || 'EPSG:3857';\n const type = geometry.getType();\n if (type !== GeometryType.GEOMETRY_COLLECTION) {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n let area = 0;\n let coordinates, coords, i, ii, j, jj;\n switch (type) {\n case GeometryType.POINT:\n case GeometryType.MULTI_POINT:\n case GeometryType.LINE_STRING:\n case GeometryType.MULTI_LINE_STRING:\n case GeometryType.LINEAR_RING: {\n break;\n }\n case GeometryType.POLYGON: {\n coordinates = /** @type {import(\"./geom/Polygon.js\").default} */ (geometry).getCoordinates();\n area = Math.abs(getAreaInternal(coordinates[0], radius));\n for (i = 1, ii = coordinates.length; i < ii; ++i) {\n area -= Math.abs(getAreaInternal(coordinates[i], radius));\n }\n break;\n }\n case GeometryType.MULTI_POLYGON: {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometry).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n area += Math.abs(getAreaInternal(coords[0], radius));\n for (j = 1, jj = coords.length; j < jj; ++j) {\n area -= Math.abs(getAreaInternal(coords[j], radius));\n }\n }\n break;\n }\n case GeometryType.GEOMETRY_COLLECTION: {\n const geometries = /** @type {import(\"./geom/GeometryCollection.js\").default} */ (geometry).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n area += getArea(geometries[i], opt_options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return area;\n}\n\n/**\n * Returns the coordinate at the given distance and bearing from `c1`.\n *\n * @param {import(\"./coordinate.js\").Coordinate} c1 The origin point (`[lon, lat]` in degrees).\n * @param {number} distance The great-circle distance between the origin\n * point and the target point.\n * @param {number} bearing The bearing (in radians).\n * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {import(\"./coordinate.js\").Coordinate} The target point.\n */\nexport function offset(c1, distance, bearing, opt_radius) {\n const radius = opt_radius || DEFAULT_RADIUS;\n const lat1 = toRadians(c1[1]);\n const lon1 = toRadians(c1[0]);\n const dByR = distance / radius;\n const lat = Math.asin(\n Math.sin(lat1) * Math.cos(dByR) +\n Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)\n );\n const lon =\n lon1 +\n Math.atan2(\n Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),\n Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)\n );\n return [toDegrees(lon), toDegrees(lat)];\n}\n","/**\n * @module ol/string\n */\n\n/**\n * @param {number} number Number to be formatted\n * @param {number} width The desired width\n * @param {number=} opt_precision Precision of the output string (i.e. number of decimal places)\n * @returns {string} Formatted string\n */\nexport function padNumber(number, width, opt_precision) {\n const numberString =\n opt_precision !== undefined ? number.toFixed(opt_precision) : '' + number;\n let decimal = numberString.indexOf('.');\n decimal = decimal === -1 ? numberString.length : decimal;\n return decimal > width\n ? numberString\n : new Array(1 + width - decimal).join('0') + numberString;\n}\n\n/**\n * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js\n * @param {string|number} v1 First version\n * @param {string|number} v2 Second version\n * @returns {number} Value\n */\nexport function compareVersions(v1, v2) {\n const s1 = ('' + v1).split('.');\n const s2 = ('' + v2).split('.');\n\n for (let i = 0; i < Math.max(s1.length, s2.length); i++) {\n const n1 = parseInt(s1[i] || '0', 10);\n const n2 = parseInt(s2[i] || '0', 10);\n\n if (n1 > n2) {\n return 1;\n }\n if (n2 > n1) {\n return -1;\n }\n }\n\n return 0;\n}\n","/**\n * @module ol/coordinate\n */\nimport {getWidth} from './extent.js';\nimport {modulo} from './math.js';\nimport {padNumber} from './string.js';\n\n/**\n * An array of numbers representing an xy coordinate. Example: `[16, 48]`.\n * @typedef {Array<number>} Coordinate\n * @api\n */\n\n/**\n * A function that takes a {@link module:ol/coordinate~Coordinate} and\n * transforms it into a `{string}`.\n *\n * @typedef {function((Coordinate|undefined)): string} CoordinateFormat\n * @api\n */\n\n/**\n * Add `delta` to `coordinate`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {add} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * add(coord, [-2, 4]);\n * // coord is now [5.85, 51.983333]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {Coordinate} delta Delta.\n * @return {Coordinate} The input coordinate adjusted by\n * the given delta.\n * @api\n */\nexport function add(coordinate, delta) {\n coordinate[0] += +delta[0];\n coordinate[1] += +delta[1];\n return coordinate;\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed circle.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {import(\"./geom/Circle.js\").default} circle The circle.\n * @return {Coordinate} Closest point on the circumference.\n */\nexport function closestOnCircle(coordinate, circle) {\n const r = circle.getRadius();\n const center = circle.getCenter();\n const x0 = center[0];\n const y0 = center[1];\n const x1 = coordinate[0];\n const y1 = coordinate[1];\n\n let dx = x1 - x0;\n const dy = y1 - y0;\n if (dx === 0 && dy === 0) {\n dx = 1;\n }\n const d = Math.sqrt(dx * dx + dy * dy);\n\n const x = x0 + (r * dx) / d;\n const y = y0 + (r * dy) / d;\n\n return [x, y];\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed segment.\n * This is the foot of the perpendicular of the coordinate to the segment when\n * the foot is on the segment, or the closest segment coordinate when the foot\n * is outside the segment.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {Array<Coordinate>} segment The two coordinates\n * of the segment.\n * @return {Coordinate} The foot of the perpendicular of\n * the coordinate to the segment.\n */\nexport function closestOnSegment(coordinate, segment) {\n const x0 = coordinate[0];\n const y0 = coordinate[1];\n const start = segment[0];\n const end = segment[1];\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const along =\n dx === 0 && dy === 0\n ? 0\n : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);\n let x, y;\n if (along <= 0) {\n x = x1;\n y = y1;\n } else if (along >= 1) {\n x = x2;\n y = y2;\n } else {\n x = x1 + along * dx;\n y = y1 + along * dy;\n }\n return [x, y];\n}\n\n/**\n * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be\n * used to format\n * a {Coordinate} to a string.\n *\n * Example without specifying the fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var stringifyFunc = createStringXY();\n * var out = stringifyFunc(coord);\n * // out is now '8, 48'\n *\n * Example with explicitly specifying 2 fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var stringifyFunc = createStringXY(2);\n * var out = stringifyFunc(coord);\n * // out is now '7.85, 47.98'\n *\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {CoordinateFormat} Coordinate format.\n * @api\n */\nexport function createStringXY(opt_fractionDigits) {\n return (\n /**\n * @param {Coordinate} coordinate Coordinate.\n * @return {string} String XY.\n */\n function (coordinate) {\n return toStringXY(coordinate, opt_fractionDigits);\n }\n );\n}\n\n/**\n * @param {string} hemispheres Hemispheres.\n * @param {number} degrees Degrees.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} String.\n */\nexport function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) {\n const normalizedDegrees = modulo(degrees + 180, 360) - 180;\n const x = Math.abs(3600 * normalizedDegrees);\n const dflPrecision = opt_fractionDigits || 0;\n const precision = Math.pow(10, dflPrecision);\n\n let deg = Math.floor(x / 3600);\n let min = Math.floor((x - deg * 3600) / 60);\n let sec = x - deg * 3600 - min * 60;\n sec = Math.ceil(sec * precision) / precision;\n\n if (sec >= 60) {\n sec = 0;\n min += 1;\n }\n\n if (min >= 60) {\n min = 0;\n deg += 1;\n }\n\n return (\n deg +\n '\\u00b0 ' +\n padNumber(min, 2) +\n '\\u2032 ' +\n padNumber(sec, 2, dflPrecision) +\n '\\u2033' +\n (normalizedDegrees == 0\n ? ''\n : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0))\n );\n}\n\n/**\n * Transforms the given {@link module:ol/coordinate~Coordinate} to a string\n * using the given string template. The strings `{x}` and `{y}` in the template\n * will be replaced with the first and second coordinate values respectively.\n *\n * Example without specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var template = 'Coordinate is ({x}|{y}).';\n * var out = format(coord, template);\n * // out is now 'Coordinate is (8|48).'\n *\n * Example explicitly specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var template = 'Coordinate is ({x}|{y}).';\n * var out = format(coord, template, 2);\n * // out is now 'Coordinate is (7.85|47.98).'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {string} template A template string with `{x}` and `{y}` placeholders\n * that will be replaced by first and second coordinate values.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Formatted coordinate.\n * @api\n */\nexport function format(coordinate, template, opt_fractionDigits) {\n if (coordinate) {\n return template\n .replace('{x}', coordinate[0].toFixed(opt_fractionDigits))\n .replace('{y}', coordinate[1].toFixed(opt_fractionDigits));\n } else {\n return '';\n }\n}\n\n/**\n * @param {Coordinate} coordinate1 First coordinate.\n * @param {Coordinate} coordinate2 Second coordinate.\n * @return {boolean} The two coordinates are equal.\n */\nexport function equals(coordinate1, coordinate2) {\n let equals = true;\n for (let i = coordinate1.length - 1; i >= 0; --i) {\n if (coordinate1[i] != coordinate2[i]) {\n equals = false;\n break;\n }\n }\n return equals;\n}\n\n/**\n * Rotate `coordinate` by `angle`. `coordinate` is modified in place and\n * returned by the function.\n *\n * Example:\n *\n * import {rotate} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var rotateRadians = Math.PI / 2; // 90 degrees\n * rotate(coord, rotateRadians);\n * // coord is now [-47.983333, 7.85]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} angle Angle in radian.\n * @return {Coordinate} Coordinate.\n * @api\n */\nexport function rotate(coordinate, angle) {\n const cosAngle = Math.cos(angle);\n const sinAngle = Math.sin(angle);\n const x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n const y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n coordinate[0] = x;\n coordinate[1] = y;\n return coordinate;\n}\n\n/**\n * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {scale as scaleCoordinate} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var scale = 1.2;\n * scaleCoordinate(coord, scale);\n * // coord is now [9.42, 57.5799996]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} scale Scale factor.\n * @return {Coordinate} Coordinate.\n */\nexport function scale(coordinate, scale) {\n coordinate[0] *= scale;\n coordinate[1] *= scale;\n return coordinate;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Squared distance between coord1 and coord2.\n */\nexport function squaredDistance(coord1, coord2) {\n const dx = coord1[0] - coord2[0];\n const dy = coord1[1] - coord2[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Distance between coord1 and coord2.\n */\nexport function distance(coord1, coord2) {\n return Math.sqrt(squaredDistance(coord1, coord2));\n}\n\n/**\n * Calculate the squared distance from a coordinate to a line segment.\n *\n * @param {Coordinate} coordinate Coordinate of the point.\n * @param {Array<Coordinate>} segment Line segment (2\n * coordinates).\n * @return {number} Squared distance from the point to the line segment.\n */\nexport function squaredDistanceToSegment(coordinate, segment) {\n return squaredDistance(coordinate, closestOnSegment(coordinate, segment));\n}\n\n/**\n * Format a geographic coordinate with the hemisphere, degrees, minutes, and\n * seconds.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringHDMS} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringHDMS(coord);\n * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringHDMS} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringHDMS(coord, 1);\n * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Hemisphere, degrees, minutes and seconds.\n * @api\n */\nexport function toStringHDMS(coordinate, opt_fractionDigits) {\n if (coordinate) {\n return (\n degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) +\n ' ' +\n degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits)\n );\n } else {\n return '';\n }\n}\n\n/**\n * Format a coordinate as a comma delimited string.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringXY(coord);\n * // out is now '8, 48'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringXY} from 'ol/coordinate';\n *\n * var coord = [7.85, 47.983333];\n * var out = toStringXY(coord, 1);\n * // out is now '7.8, 48.0'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number=} opt_fractionDigits The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} XY.\n * @api\n */\nexport function toStringXY(coordinate, opt_fractionDigits) {\n return format(coordinate, '{x}, {y}', opt_fractionDigits);\n}\n\n/**\n * Modifies the provided coordinate in-place to be within the real world\n * extent. The lower projection extent boundary is inclusive, the upper one\n * exclusive.\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {Coordinate} The coordinate within the real world extent.\n */\nexport function wrapX(coordinate, projection) {\n if (projection.canWrapX()) {\n const worldWidth = getWidth(projection.getExtent());\n const worldsAway = getWorldsAway(coordinate, projection, worldWidth);\n if (worldsAway) {\n coordinate[0] -= worldsAway * worldWidth;\n }\n }\n return coordinate;\n}\n/**\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {number=} opt_sourceExtentWidth Width of the source extent.\n * @return {number} Offset in world widths.\n */\nexport function getWorldsAway(coordinate, projection, opt_sourceExtentWidth) {\n const projectionExtent = projection.getExtent();\n let worldsAway = 0;\n if (\n projection.canWrapX() &&\n (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])\n ) {\n const sourceExtentWidth =\n opt_sourceExtentWidth || getWidth(projectionExtent);\n worldsAway = Math.floor(\n (coordinate[0] - projectionExtent[0]) / sourceExtentWidth\n );\n }\n return worldsAway;\n}\n","/**\n * @module ol/proj\n */\n\n/**\n * The ol/proj module stores:\n * * a list of {@link module:ol/proj/Projection}\n * objects, one for each projection supported by the application\n * * a list of transform functions needed to convert coordinates in one projection\n * into another.\n *\n * The static functions are the methods used to maintain these.\n * Each transform function can handle not only simple coordinate pairs, but also\n * large arrays of coordinates such as vector geometries.\n *\n * When loaded, the library adds projection objects for EPSG:4326 (WGS84\n * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used\n * for example by Bing Maps or OpenStreetMap), together with the relevant\n * transform functions.\n *\n * Additional transforms may be added by using the http://proj4js.org/\n * library (version 2.2 or later). You can use the full build supplied by\n * Proj4js, or create a custom build to support those projections you need; see\n * the Proj4js website for how to do this. You also need the Proj4js definitions\n * for the required projections. These definitions can be obtained from\n * https://epsg.io/, and are a JS function, so can be loaded in a script\n * tag (as in the examples) or pasted into your application.\n *\n * After all required projection definitions are added to proj4's registry (by\n * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`\n * package. Existing transforms are not changed by this function. See\n * examples/wms-image-custom-proj for an example of this.\n *\n * Additional projection definitions can be registered with `proj4.defs()` any\n * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't\n * know in advance what projections are needed, you can initially load minimal\n * support and then load whichever are requested.\n *\n * Note that Proj4js does not support projection extents. If you want to add\n * one for creating default tile grids, you can add it after the Projection\n * object has been created with `setExtent`, for example,\n * `get('EPSG:1234').setExtent(extent)`.\n *\n * In addition to Proj4js support, any transform functions can be added with\n * {@link module:ol/proj~addCoordinateTransforms}. To use this, you must first create\n * a {@link module:ol/proj/Projection} object for the new projection and add it with\n * {@link module:ol/proj~addProjection}. You can then add the forward and inverse\n * functions with {@link module:ol/proj~addCoordinateTransforms}. See\n * examples/wms-custom-proj for an example of this.\n *\n * Note that if no transforms are needed and you only need to define the\n * projection, just add a {@link module:ol/proj/Projection} with\n * {@link module:ol/proj~addProjection}. See examples/wms-no-proj for an example of\n * this.\n */\nimport Projection from './proj/Projection.js';\nimport Units, {METERS_PER_UNIT} from './proj/Units.js';\nimport {\n PROJECTIONS as EPSG3857_PROJECTIONS,\n fromEPSG4326,\n toEPSG4326,\n} from './proj/epsg3857.js';\nimport {PROJECTIONS as EPSG4326_PROJECTIONS} from './proj/epsg4326.js';\nimport {\n add as addProj,\n clear as clearProj,\n get as getProj,\n} from './proj/projections.js';\nimport {\n add as addTransformFunc,\n clear as clearTransformFuncs,\n get as getTransformFunc,\n} from './proj/transforms.js';\nimport {applyTransform, getWidth} from './extent.js';\nimport {clamp, modulo} from './math.js';\nimport {getDistance} from './sphere.js';\nimport {getWorldsAway} from './coordinate.js';\n\n/**\n * A projection as {@link module:ol/proj/Projection}, SRS identifier\n * string or undefined.\n * @typedef {Projection|string|undefined} ProjectionLike\n * @api\n */\n\n/**\n * A transform function accepts an array of input coordinate values, an optional\n * output array, and an optional dimension (default should be 2). The function\n * transforms the input coordinate values, populates the output array, and\n * returns the output array.\n *\n * @typedef {function(Array<number>, Array<number>=, number=): Array<number>} TransformFunction\n * @api\n */\n\nexport {METERS_PER_UNIT};\n\nexport {Projection};\n\n/**\n * @param {Array<number>} input Input coordinate array.\n * @param {Array<number>=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension.\n * @return {Array<number>} Output coordinate array (new array, same coordinate\n * values).\n */\nexport function cloneTransform(input, opt_output, opt_dimension) {\n let output;\n if (opt_output !== undefined) {\n for (let i = 0, ii = input.length; i < ii; ++i) {\n opt_output[i] = input[i];\n }\n output = opt_output;\n } else {\n output = input.slice();\n }\n return output;\n}\n\n/**\n * @param {Array<number>} input Input coordinate array.\n * @param {Array<number>=} opt_output Output array of coordinate values.\n * @param {number=} opt_dimension Dimension.\n * @return {Array<number>} Input coordinate array (same array as input).\n */\nexport function identityTransform(input, opt_output, opt_dimension) {\n if (opt_output !== undefined && input !== opt_output) {\n for (let i = 0, ii = input.length; i < ii; ++i) {\n opt_output[i] = input[i];\n }\n input = opt_output;\n }\n return input;\n}\n\n/**\n * Add a Projection object to the list of supported projections that can be\n * looked up by their code.\n *\n * @param {Projection} projection Projection instance.\n * @api\n */\nexport function addProjection(projection) {\n addProj(projection.getCode(), projection);\n addTransformFunc(projection, projection, cloneTransform);\n}\n\n/**\n * @param {Array<Projection>} projections Projections.\n */\nexport function addProjections(projections) {\n projections.forEach(addProjection);\n}\n\n/**\n * Fetches a Projection object for the code specified.\n *\n * @param {ProjectionLike} projectionLike Either a code string which is\n * a combination of authority and identifier such as \"EPSG:4326\", or an\n * existing projection object, or undefined.\n * @return {Projection} Projection object, or null if not in list.\n * @api\n */\nexport function get(projectionLike) {\n return typeof projectionLike === 'string'\n ? getProj(/** @type {string} */ (projectionLike))\n : /** @type {Projection} */ (projectionLike) || null;\n}\n\n/**\n * Get the resolution of the point in degrees or distance units.\n * For projections with degrees as the unit this will simply return the\n * provided resolution. For other projections the point resolution is\n * by default estimated by transforming the 'point' pixel to EPSG:4326,\n * measuring its width and height on the normal sphere,\n * and taking the average of the width and height.\n * A custom function can be provided for a specific projection, either\n * by setting the `getPointResolution` option in the\n * {@link module:ol/proj/Projection~Projection} constructor or by using\n * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing\n * projection object.\n * @param {ProjectionLike} projection The projection.\n * @param {number} resolution Nominal resolution in projection units.\n * @param {import(\"./coordinate.js\").Coordinate} point Point to find adjusted resolution at.\n * @param {import(\"./proj/Units.js\").default=} opt_units Units to get the point resolution in.\n * Default is the projection's units.\n * @return {number} Point resolution.\n * @api\n */\nexport function getPointResolution(projection, resolution, point, opt_units) {\n projection = get(projection);\n let pointResolution;\n const getter = projection.getPointResolutionFunc();\n if (getter) {\n pointResolution = getter(resolution, point);\n if (opt_units && opt_units !== projection.getUnits()) {\n const metersPerUnit = projection.getMetersPerUnit();\n if (metersPerUnit) {\n pointResolution =\n (pointResolution * metersPerUnit) / METERS_PER_UNIT[opt_units];\n }\n }\n } else {\n const units = projection.getUnits();\n if ((units == Units.DEGREES && !opt_units) || opt_units == Units.DEGREES) {\n pointResolution = resolution;\n } else {\n // Estimate point resolution by transforming the center pixel to EPSG:4326,\n // measuring its width and height on the normal sphere, and taking the\n // average of the width and height.\n const toEPSG4326 = getTransformFromProjections(\n projection,\n get('EPSG:4326')\n );\n let vertices = [\n point[0] - resolution / 2,\n point[1],\n point[0] + resolution / 2,\n point[1],\n point[0],\n point[1] - resolution / 2,\n point[0],\n point[1] + resolution / 2,\n ];\n vertices = toEPSG4326(vertices, vertices, 2);\n const width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));\n const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));\n pointResolution = (width + height) / 2;\n const metersPerUnit = opt_units\n ? METERS_PER_UNIT[opt_units]\n : projection.getMetersPerUnit();\n if (metersPerUnit !== undefined) {\n pointResolution /= metersPerUnit;\n }\n }\n }\n return pointResolution;\n}\n\n/**\n * Registers transformation functions that don't alter coordinates. Those allow\n * to transform between projections with equal meaning.\n *\n * @param {Array<Projection>} projections Projections.\n * @api\n */\nexport function addEquivalentProjections(projections) {\n addProjections(projections);\n projections.forEach(function (source) {\n projections.forEach(function (destination) {\n if (source !== destination) {\n addTransformFunc(source, destination, cloneTransform);\n }\n });\n });\n}\n\n/**\n * Registers transformation functions to convert coordinates in any projection\n * in projection1 to any projection in projection2.\n *\n * @param {Array<Projection>} projections1 Projections with equal\n * meaning.\n * @param {Array<Projection>} projections2 Projections with equal\n * meaning.\n * @param {TransformFunction} forwardTransform Transformation from any\n * projection in projection1 to any projection in projection2.\n * @param {TransformFunction} inverseTransform Transform from any projection\n * in projection2 to any projection in projection1..\n */\nexport function addEquivalentTransforms(\n projections1,\n projections2,\n forwardTransform,\n inverseTransform\n) {\n projections1.forEach(function (projection1) {\n projections2.forEach(function (projection2) {\n addTransformFunc(projection1, projection2, forwardTransform);\n addTransformFunc(projection2, projection1, inverseTransform);\n });\n });\n}\n\n/**\n * Clear all cached projections and transforms.\n */\nexport function clearAllProjections() {\n clearProj();\n clearTransformFuncs();\n}\n\n/**\n * @param {Projection|string|undefined} projection Projection.\n * @param {string} defaultCode Default code.\n * @return {Projection} Projection.\n */\nexport function createProjection(projection, defaultCode) {\n if (!projection) {\n return get(defaultCode);\n } else if (typeof projection === 'string') {\n return get(projection);\n } else {\n return /** @type {Projection} */ (projection);\n }\n}\n\n/**\n * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform\n * function.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} coordTransform Coordinate\n * transform.\n * @return {TransformFunction} Transform function.\n */\nexport function createTransformFromCoordinateTransform(coordTransform) {\n return (\n /**\n * @param {Array<number>} input Input.\n * @param {Array<number>=} opt_output Output.\n * @param {number=} opt_dimension Dimension.\n * @return {Array<number>} Output.\n */\n function (input, opt_output, opt_dimension) {\n const length = input.length;\n const dimension = opt_dimension !== undefined ? opt_dimension : 2;\n const output = opt_output !== undefined ? opt_output : new Array(length);\n for (let i = 0; i < length; i += dimension) {\n const point = coordTransform([input[i], input[i + 1]]);\n output[i] = point[0];\n output[i + 1] = point[1];\n for (let j = dimension - 1; j >= 2; --j) {\n output[i + j] = input[i + j];\n }\n }\n return output;\n }\n );\n}\n\n/**\n * Registers coordinate transform functions to convert coordinates between the\n * source projection and the destination projection.\n * The forward and inverse functions convert coordinate pairs; this function\n * converts these into the functions used internally which also handle\n * extents and coordinate arrays.\n *\n * @param {ProjectionLike} source Source projection.\n * @param {ProjectionLike} destination Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} forward The forward transform\n * function (that is, from the source projection to the destination\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} inverse The inverse transform\n * function (that is, from the destination projection to the source\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}.\n * @api\n */\nexport function addCoordinateTransforms(source, destination, forward, inverse) {\n const sourceProj = get(source);\n const destProj = get(destination);\n addTransformFunc(\n sourceProj,\n destProj,\n createTransformFromCoordinateTransform(forward)\n );\n addTransformFunc(\n destProj,\n sourceProj,\n createTransformFromCoordinateTransform(inverse)\n );\n}\n\n/**\n * Transforms a coordinate from longitude/latitude to a different projection.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate as longitude and latitude, i.e.\n * an array with longitude as 1st and latitude as 2nd element.\n * @param {ProjectionLike=} opt_projection Target projection. The\n * default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate projected to the target projection.\n * @api\n */\nexport function fromLonLat(coordinate, opt_projection) {\n return transform(\n coordinate,\n 'EPSG:4326',\n opt_projection !== undefined ? opt_projection : 'EPSG:3857'\n );\n}\n\n/**\n * Transforms a coordinate to longitude/latitude.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Projected coordinate.\n * @param {ProjectionLike=} opt_projection Projection of the coordinate.\n * The default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate as longitude and latitude, i.e. an array\n * with longitude as 1st and latitude as 2nd element.\n * @api\n */\nexport function toLonLat(coordinate, opt_projection) {\n const lonLat = transform(\n coordinate,\n opt_projection !== undefined ? opt_projection : 'EPSG:3857',\n 'EPSG:4326'\n );\n const lon = lonLat[0];\n if (lon < -180 || lon > 180) {\n lonLat[0] = modulo(lon + 180, 360) - 180;\n }\n return lonLat;\n}\n\n/**\n * Checks if two projections are the same, that is every coordinate in one\n * projection does represent the same geographic point as the same coordinate in\n * the other projection.\n *\n * @param {Projection} projection1 Projection 1.\n * @param {Projection} projection2 Projection 2.\n * @return {boolean} Equivalent.\n * @api\n */\nexport function equivalent(projection1, projection2) {\n if (projection1 === projection2) {\n return true;\n }\n const equalUnits = projection1.getUnits() === projection2.getUnits();\n if (projection1.getCode() === projection2.getCode()) {\n return equalUnits;\n } else {\n const transformFunc = getTransformFromProjections(projection1, projection2);\n return transformFunc === cloneTransform && equalUnits;\n }\n}\n\n/**\n * Searches in the list of transform functions for the function for converting\n * coordinates from the source projection to the destination projection.\n *\n * @param {Projection} sourceProjection Source Projection object.\n * @param {Projection} destinationProjection Destination Projection\n * object.\n * @return {TransformFunction} Transform function.\n */\nexport function getTransformFromProjections(\n sourceProjection,\n destinationProjection\n) {\n const sourceCode = sourceProjection.getCode();\n const destinationCode = destinationProjection.getCode();\n let transformFunc = getTransformFunc(sourceCode, destinationCode);\n if (!transformFunc) {\n transformFunc = identityTransform;\n }\n return transformFunc;\n}\n\n/**\n * Given the projection-like objects, searches for a transformation\n * function to convert a coordinates array from the source projection to the\n * destination projection.\n *\n * @param {ProjectionLike} source Source.\n * @param {ProjectionLike} destination Destination.\n * @return {TransformFunction} Transform function.\n * @api\n */\nexport function getTransform(source, destination) {\n const sourceProjection = get(source);\n const destinationProjection = get(destination);\n return getTransformFromProjections(sourceProjection, destinationProjection);\n}\n\n/**\n * Transforms a coordinate from source projection to destination projection.\n * This returns a new coordinate (and does not modify the original).\n *\n * See {@link module:ol/proj~transformExtent} for extent transformation.\n * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its\n * subclasses for geometry transforms.\n *\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\nexport function transform(coordinate, source, destination) {\n const transformFunc = getTransform(source, destination);\n return transformFunc(coordinate, undefined, coordinate.length);\n}\n\n/**\n * Transforms an extent from source projection to destination projection. This\n * returns a new extent (and does not modify the original).\n *\n * @param {import(\"./extent.js\").Extent} extent The extent to transform.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @param {number=} opt_stops Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {import(\"./extent.js\").Extent} The transformed extent.\n * @api\n */\nexport function transformExtent(extent, source, destination, opt_stops) {\n const transformFunc = getTransform(source, destination);\n return applyTransform(extent, transformFunc, undefined, opt_stops);\n}\n\n/**\n * Transforms the given point to the destination projection.\n *\n * @param {import(\"./coordinate.js\").Coordinate} point Point.\n * @param {Projection} sourceProjection Source projection.\n * @param {Projection} destinationProjection Destination projection.\n * @return {import(\"./coordinate.js\").Coordinate} Point.\n */\nexport function transformWithProjections(\n point,\n sourceProjection,\n destinationProjection\n) {\n const transformFunc = getTransformFromProjections(\n sourceProjection,\n destinationProjection\n );\n return transformFunc(point);\n}\n\n/**\n * @type {?Projection}\n */\nlet userProjection = null;\n\n/**\n * Set the projection for coordinates supplied from and returned by API methods.\n * Note that this method is not yet a part of the stable API. Support for user\n * projections is not yet complete and should be considered experimental.\n * @param {ProjectionLike} projection The user projection.\n */\nexport function setUserProjection(projection) {\n userProjection = get(projection);\n}\n\n/**\n * Clear the user projection if set. Note that this method is not yet a part of\n * the stable API. Support for user projections is not yet complete and should\n * be considered experimental.\n */\nexport function clearUserProjection() {\n userProjection = null;\n}\n\n/**\n * Get the projection for coordinates supplied from and returned by API methods.\n * Note that this method is not yet a part of the stable API. Support for user\n * projections is not yet complete and should be considered experimental.\n * @returns {?Projection} The user projection (or null if not set).\n */\nexport function getUserProjection() {\n return userProjection;\n}\n\n/**\n * Use geographic coordinates (WGS-84 datum) in API methods. Note that this\n * method is not yet a part of the stable API. Support for user projections is\n * not yet complete and should be considered experimental.\n */\nexport function useGeographic() {\n setUserProjection('EPSG:4326');\n}\n\n/**\n * Return a coordinate transformed into the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array<number>} coordinate Input coordinate.\n * @param {ProjectionLike} sourceProjection The input coordinate projection.\n * @returns {Array<number>} The input coordinate in the user projection.\n */\nexport function toUserCoordinate(coordinate, sourceProjection) {\n if (!userProjection) {\n return coordinate;\n }\n return transform(coordinate, sourceProjection, userProjection);\n}\n\n/**\n * Return a coordinate transformed from the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array<number>} coordinate Input coordinate.\n * @param {ProjectionLike} destProjection The destination projection.\n * @returns {Array<number>} The input coordinate transformed.\n */\nexport function fromUserCoordinate(coordinate, destProjection) {\n if (!userProjection) {\n return coordinate;\n }\n return transform(coordinate, userProjection, destProjection);\n}\n\n/**\n * Return an extent transformed into the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} sourceProjection The input extent projection.\n * @returns {import(\"./extent.js\").Extent} The input extent in the user projection.\n */\nexport function toUserExtent(extent, sourceProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, sourceProjection, userProjection);\n}\n\n/**\n * Return an extent transformed from the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} destProjection The destination projection.\n * @returns {import(\"./extent.js\").Extent} The input extent transformed.\n */\nexport function fromUserExtent(extent, destProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, userProjection, destProjection);\n}\n\n/**\n * Creates a safe coordinate transform function from a coordinate transform function.\n * \"Safe\" means that it can handle wrapping of x-coordinates for global projections,\n * and that coordinates exceeding the source projection validity extent's range will be\n * clamped to the validity range.\n * @param {Projection} sourceProj Source projection.\n * @param {Projection} destProj Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} transform Transform function (source to destiation).\n * @return {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} Safe transform function (source to destiation).\n */\nexport function createSafeCoordinateTransform(sourceProj, destProj, transform) {\n return function (coord) {\n let sourceX = coord[0];\n let sourceY = coord[1];\n let transformed, worldsAway;\n if (sourceProj.canWrapX()) {\n const sourceExtent = sourceProj.getExtent();\n const sourceExtentWidth = getWidth(sourceExtent);\n worldsAway = getWorldsAway(coord, sourceProj, sourceExtentWidth);\n if (worldsAway) {\n // Move x to the real world\n sourceX = sourceX - worldsAway * sourceExtentWidth;\n }\n sourceX = clamp(sourceX, sourceExtent[0], sourceExtent[2]);\n sourceY = clamp(sourceY, sourceExtent[1], sourceExtent[3]);\n transformed = transform([sourceX, sourceY]);\n } else {\n transformed = transform(coord);\n }\n if (worldsAway && destProj.canWrapX()) {\n // Move transformed coordinate back to the offset world\n transformed[0] += worldsAway * getWidth(destProj.getExtent());\n }\n return transformed;\n };\n}\n\n/**\n * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called\n * by when this module is executed and should only need to be called again after\n * `clearAllProjections()` is called (e.g. in tests).\n */\nexport function addCommon() {\n // Add transformations that don't alter coordinates to convert within set of\n // projections with equal meaning.\n addEquivalentProjections(EPSG3857_PROJECTIONS);\n addEquivalentProjections(EPSG4326_PROJECTIONS);\n // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like\n // coordinates and back.\n addEquivalentTransforms(\n EPSG4326_PROJECTIONS,\n EPSG3857_PROJECTIONS,\n fromEPSG4326,\n toEPSG4326\n );\n}\n\naddCommon();\n","/**\n * @module ol/geom/flat/transform\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array<number>=} opt_dest Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n transform,\n opt_dest\n) {\n const dest = opt_dest ? opt_dest : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const x = flatCoordinates[j];\n const y = flatCoordinates[j + 1];\n dest[i++] = transform[0] * x + transform[2] * y + transform[4];\n dest[i++] = transform[1] * x + transform[3] * y + transform[5];\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} angle Angle.\n * @param {Array<number>} anchor Rotation anchor point.\n * @param {Array<number>=} opt_dest Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function rotate(\n flatCoordinates,\n offset,\n end,\n stride,\n angle,\n anchor,\n opt_dest\n) {\n const dest = opt_dest ? opt_dest : [];\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + deltaX * cos - deltaY * sin;\n dest[i++] = anchorY + deltaX * sin + deltaY * cos;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * Scale the coordinates.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} sx Scale factor in the x-direction.\n * @param {number} sy Scale factor in the y-direction.\n * @param {Array<number>} anchor Scale anchor point.\n * @param {Array<number>=} opt_dest Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function scale(\n flatCoordinates,\n offset,\n end,\n stride,\n sx,\n sy,\n anchor,\n opt_dest\n) {\n const dest = opt_dest ? opt_dest : [];\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + sx * deltaX;\n dest[i++] = anchorY + sy * deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @param {Array<number>=} opt_dest Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function translate(\n flatCoordinates,\n offset,\n end,\n stride,\n deltaX,\n deltaY,\n opt_dest\n) {\n const dest = opt_dest ? opt_dest : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n dest[i++] = flatCoordinates[j] + deltaX;\n dest[i++] = flatCoordinates[j + 1] + deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (opt_dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n","/**\n * @module ol/geom/Geometry\n */\nimport BaseObject from '../Object.js';\nimport Units from '../proj/Units.js';\nimport {abstract} from '../util.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\nimport {\n createEmpty,\n createOrUpdateEmpty,\n getHeight,\n returnOrUpdate,\n} from '../extent.js';\nimport {get as getProjection, getTransform} from '../proj.js';\nimport {memoizeOne} from '../functions.js';\nimport {transform2D} from './flat/transform.js';\n\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for vector geometries.\n *\n * To get notified of changes to the geometry, register a listener for the\n * generic `change` event on your geometry instance.\n *\n * @abstract\n * @api\n */\nclass Geometry extends BaseObject {\n constructor() {\n super();\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.extentRevision_ = -1;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryRevision = 0;\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} revision The geometry revision.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [opt_transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n this.simplifyTransformedInternal = memoizeOne(function (\n revision,\n squaredTolerance,\n opt_transform\n ) {\n if (!opt_transform) {\n return this.getSimplifiedGeometry(squaredTolerance);\n }\n const clone = this.clone();\n clone.applyTransform(opt_transform);\n return clone.getSimplifiedGeometry(squaredTolerance);\n });\n }\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [opt_transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n simplifyTransformed(squaredTolerance, opt_transform) {\n return this.simplifyTransformedInternal(\n this.getRevision(),\n squaredTolerance,\n opt_transform\n );\n }\n\n /**\n * Make a complete copy of the geometry.\n * @abstract\n * @return {!Geometry} Clone.\n */\n clone() {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n return abstract();\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n const coord = this.getClosestPoint([x, y]);\n return coord[0] === x && coord[1] === y;\n }\n\n /**\n * Return the closest point of the geometry to the passed point as\n * {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} point Point.\n * @param {import(\"../coordinate.js\").Coordinate=} opt_closestPoint Closest point.\n * @return {import(\"../coordinate.js\").Coordinate} Closest point.\n * @api\n */\n getClosestPoint(point, opt_closestPoint) {\n const closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];\n this.closestPointXY(point[0], point[1], closestPoint, Infinity);\n return closestPoint;\n }\n\n /**\n * Returns true if this geometry includes the specified coordinate. If the\n * coordinate is on the boundary of the geometry, returns false.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains coordinate.\n * @api\n */\n intersectsCoordinate(coordinate) {\n return this.containsXY(coordinate[0], coordinate[1]);\n }\n\n /**\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return abstract();\n }\n\n /**\n * Get the extent of the geometry.\n * @param {import(\"../extent.js\").Extent=} opt_extent Extent.\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n getExtent(opt_extent) {\n if (this.extentRevision_ != this.getRevision()) {\n const extent = this.computeExtent(this.extent_);\n if (isNaN(extent[0]) || isNaN(extent[1])) {\n createOrUpdateEmpty(extent);\n }\n this.extentRevision_ = this.getRevision();\n }\n return returnOrUpdate(this.extent_, opt_extent);\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n abstract();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate=} opt_anchor The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, opt_sy, opt_anchor) {\n abstract();\n }\n\n /**\n * Create a simplified version of this geometry. For linestrings, this uses\n * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)\n * algorithm. For polygons, a quantization-based\n * simplification is used to preserve topology.\n * @param {number} tolerance The tolerance distance for simplification.\n * @return {Geometry} A new, simplified version of the original geometry.\n * @api\n */\n simplify(tolerance) {\n return this.getSimplifiedGeometry(tolerance * tolerance);\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker\n * algorithm.\n * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Geometry} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n return abstract();\n }\n\n /**\n * Get the type of this geometry.\n * @abstract\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @abstract\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n */\n applyTransform(transformFn) {\n abstract();\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n */\n intersectsExtent(extent) {\n return abstract();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @abstract\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n abstract();\n }\n\n /**\n * Transform each coordinate of the geometry from one coordinate reference\n * system to another. The geometry is modified in place.\n * For example, a line will be transformed to a line and a circle to a circle.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {Geometry} This geometry. Note that original geometry is\n * modified in place.\n * @api\n */\n transform(source, destination) {\n /** @type {import(\"../proj/Projection.js\").default} */\n const sourceProj = getProjection(source);\n const transformFn =\n sourceProj.getUnits() == Units.TILE_PIXELS\n ? function (inCoordinates, outCoordinates, stride) {\n const pixelExtent = sourceProj.getExtent();\n const projectedExtent = sourceProj.getWorldExtent();\n const scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(\n tmpTransform,\n projectedExtent[0],\n projectedExtent[3],\n scale,\n -scale,\n 0,\n 0,\n 0\n );\n transform2D(\n inCoordinates,\n 0,\n inCoordinates.length,\n stride,\n tmpTransform,\n outCoordinates\n );\n return getTransform(sourceProj, destination)(\n inCoordinates,\n outCoordinates,\n stride\n );\n }\n : getTransform(sourceProj, destination);\n this.applyTransform(transformFn);\n return this;\n }\n}\n\nexport default Geometry;\n","/**\n * @module ol/geom/SimpleGeometry\n */\nimport Geometry from './Geometry.js';\nimport GeometryLayout from './GeometryLayout.js';\nimport {abstract} from '../util.js';\nimport {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';\nimport {rotate, scale, transform2D, translate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Abstract base class; only used for creating subclasses; do not instantiate\n * in apps, as cannot be rendered.\n *\n * @abstract\n * @api\n */\nclass SimpleGeometry extends Geometry {\n constructor() {\n super();\n\n /**\n * @protected\n * @type {import(\"./GeometryLayout.js\").default}\n */\n this.layout = GeometryLayout.XY;\n\n /**\n * @protected\n * @type {number}\n */\n this.stride = 2;\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.flatCoordinates = null;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return createOrUpdateFromFlatCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent\n );\n }\n\n /**\n * @abstract\n * @return {Array<*>} Coordinates.\n */\n getCoordinates() {\n return abstract();\n }\n\n /**\n * Return the first coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} First coordinate.\n * @api\n */\n getFirstCoordinate() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @return {Array<number>} Flat coordinates.\n */\n getFlatCoordinates() {\n return this.flatCoordinates;\n }\n\n /**\n * Return the last coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} Last point.\n * @api\n */\n getLastCoordinate() {\n return this.flatCoordinates.slice(\n this.flatCoordinates.length - this.stride\n );\n }\n\n /**\n * Return the {@link module:ol/geom/GeometryLayout layout} of the geometry.\n * @return {import(\"./GeometryLayout.js\").default} Layout.\n * @api\n */\n getLayout() {\n return this.layout;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n // If squaredTolerance is negative or if we know that simplification will not\n // have any effect then just return this.\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometry = this.getSimplifiedGeometryInternal(\n squaredTolerance\n );\n const simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();\n if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {\n return simplifiedGeometry;\n } else {\n // Simplification did not actually remove any coordinates. We now know\n // that any calls to getSimplifiedGeometry with a squaredTolerance less\n // than or equal to the current squaredTolerance will also not have any\n // effect. This allows us to short circuit simplification (saving CPU\n // cycles) and prevents the cache of simplified geometries from filling\n // up with useless identical copies of this geometry (saving memory).\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n return this;\n }\n\n /**\n * @return {number} Stride.\n */\n getStride() {\n return this.stride;\n }\n\n /**\n * @param {import(\"./GeometryLayout.js\").default} layout Layout.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n */\n setFlatCoordinates(layout, flatCoordinates) {\n this.stride = getStrideForLayout(layout);\n this.layout = layout;\n this.flatCoordinates = flatCoordinates;\n }\n\n /**\n * @abstract\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n setCoordinates(coordinates, opt_layout) {\n abstract();\n }\n\n /**\n * @param {import(\"./GeometryLayout.js\").default|undefined} layout Layout.\n * @param {Array<*>} coordinates Coordinates.\n * @param {number} nesting Nesting.\n * @protected\n */\n setLayout(layout, coordinates, nesting) {\n /** @type {number} */\n let stride;\n if (layout) {\n stride = getStrideForLayout(layout);\n } else {\n for (let i = 0; i < nesting; ++i) {\n if (coordinates.length === 0) {\n this.layout = GeometryLayout.XY;\n this.stride = 2;\n return;\n } else {\n coordinates = /** @type {Array} */ (coordinates[0]);\n }\n }\n stride = coordinates.length;\n layout = getLayoutForStride(stride);\n }\n this.layout = layout;\n this.stride = stride;\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n */\n applyTransform(transformFn) {\n if (this.flatCoordinates) {\n transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);\n this.changed();\n }\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n rotate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n angle,\n anchor,\n flatCoordinates\n );\n this.changed();\n }\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate=} opt_anchor The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, opt_sy, opt_anchor) {\n let sy = opt_sy;\n if (sy === undefined) {\n sy = sx;\n }\n let anchor = opt_anchor;\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n scale(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n sx,\n sy,\n anchor,\n flatCoordinates\n );\n this.changed();\n }\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n translate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n deltaX,\n deltaY,\n flatCoordinates\n );\n this.changed();\n }\n }\n}\n\n/**\n * @param {number} stride Stride.\n * @return {import(\"./GeometryLayout.js\").default} layout Layout.\n */\nfunction getLayoutForStride(stride) {\n let layout;\n if (stride == 2) {\n layout = GeometryLayout.XY;\n } else if (stride == 3) {\n layout = GeometryLayout.XYZ;\n } else if (stride == 4) {\n layout = GeometryLayout.XYZM;\n }\n return /** @type {import(\"./GeometryLayout.js\").default} */ (layout);\n}\n\n/**\n * @param {import(\"./GeometryLayout.js\").default} layout Layout.\n * @return {number} Stride.\n */\nexport function getStrideForLayout(layout) {\n let stride;\n if (layout == GeometryLayout.XY) {\n stride = 2;\n } else if (layout == GeometryLayout.XYZ || layout == GeometryLayout.XYM) {\n stride = 3;\n } else if (layout == GeometryLayout.XYZM) {\n stride = 4;\n }\n return /** @type {number} */ (stride);\n}\n\n/**\n * @param {SimpleGeometry} simpleGeometry Simple geometry.\n * @param {import(\"../transform.js\").Transform} transform Transform.\n * @param {Array<number>=} opt_dest Destination.\n * @return {Array<number>} Transformed flat coordinates.\n */\nexport function transformGeom2D(simpleGeometry, transform, opt_dest) {\n const flatCoordinates = simpleGeometry.getFlatCoordinates();\n if (!flatCoordinates) {\n return null;\n } else {\n const stride = simpleGeometry.getStride();\n return transform2D(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n transform,\n opt_dest\n );\n }\n}\n\nexport default SimpleGeometry;\n","/**\n * @module ol/geom/flat/closest\n */\nimport {lerp, squaredDistance as squaredDx} from '../../math.js';\n\n/**\n * Returns the point on the 2D line segment flatCoordinates[offset1] to\n * flatCoordinates[offset2] that is closest to the point (x, y). Extra\n * dimensions are linearly interpolated.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset1 Offset 1.\n * @param {number} offset2 Offset 2.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n */\nfunction assignClosest(\n flatCoordinates,\n offset1,\n offset2,\n stride,\n x,\n y,\n closestPoint\n) {\n const x1 = flatCoordinates[offset1];\n const y1 = flatCoordinates[offset1 + 1];\n const dx = flatCoordinates[offset2] - x1;\n const dy = flatCoordinates[offset2 + 1] - y1;\n let offset;\n if (dx === 0 && dy === 0) {\n offset = offset1;\n } else {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n offset = offset2;\n } else if (t > 0) {\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = lerp(\n flatCoordinates[offset1 + i],\n flatCoordinates[offset2 + i],\n t\n );\n }\n closestPoint.length = stride;\n return;\n } else {\n offset = offset1;\n }\n }\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n}\n\n/**\n * Return the squared of the largest distance between any pair of consecutive\n * coordinates.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n for (offset += stride; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n const squaredDelta = squaredDx(x1, y1, x2, y2);\n if (squaredDelta > max) {\n max = squaredDelta;\n }\n x1 = x2;\n y1 = y2;\n }\n return max;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function arrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n ends,\n stride,\n max\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);\n offset = end;\n }\n return max;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function multiArrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n endss,\n stride,\n max\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);\n offset = ends[ends.length - 1];\n }\n return max;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array<number>=} opt_tmpPoint Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n opt_tmpPoint\n) {\n if (offset == end) {\n return minSquaredDistance;\n }\n let i, squaredDistance;\n if (maxDelta === 0) {\n // All points are identical, so just test the first point.\n squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[offset],\n flatCoordinates[offset + 1]\n );\n if (squaredDistance < minSquaredDistance) {\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n } else {\n return minSquaredDistance;\n }\n }\n const tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];\n let index = offset + stride;\n while (index < end) {\n assignClosest(\n flatCoordinates,\n index - stride,\n index,\n stride,\n x,\n y,\n tmpPoint\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n index += stride;\n } else {\n // Skip ahead multiple points, because we know that all the skipped\n // points cannot be any closer than the closest point we have found so\n // far. We know this because we know how close the current point is, how\n // close the closest point we have found so far is, and the maximum\n // distance between consecutive points. For example, if we're currently\n // at distance 10, the best we've found so far is 3, and that the maximum\n // distance between consecutive points is 2, then we'll need to skip at\n // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of\n // finding a closer point. We use Math.max(..., 1) to ensure that we\n // always advance at least one point, to avoid an infinite loop.\n index +=\n stride *\n Math.max(\n ((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) /\n maxDelta) |\n 0,\n 1\n );\n }\n }\n if (isRing) {\n // Check the closing segment.\n assignClosest(\n flatCoordinates,\n end - stride,\n offset,\n stride,\n x,\n y,\n tmpPoint\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array<number>=} opt_tmpPoint Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n opt_tmpPoint\n) {\n const tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n minSquaredDistance = assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint\n );\n offset = end;\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array<number>=} opt_tmpPoint Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestMultiArrayPoint(\n flatCoordinates,\n offset,\n endss,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n opt_tmpPoint\n) {\n const tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n minSquaredDistance = assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint\n );\n offset = ends[ends.length - 1];\n }\n return minSquaredDistance;\n}\n","/**\n * @module ol/geom/flat/deflate\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {\n for (let i = 0, ii = coordinate.length; i < ii; ++i) {\n flatCoordinates[offset++] = coordinate[i];\n }\n return offset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<import(\"../../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinates(\n flatCoordinates,\n offset,\n coordinates,\n stride\n) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n const coordinate = coordinates[i];\n for (let j = 0; j < stride; ++j) {\n flatCoordinates[offset++] = coordinate[j];\n }\n }\n return offset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<import(\"../../coordinate.js\").Coordinate>>} coordinatess Coordinatess.\n * @param {number} stride Stride.\n * @param {Array<number>=} opt_ends Ends.\n * @return {Array<number>} Ends.\n */\nexport function deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatess,\n stride,\n opt_ends\n) {\n const ends = opt_ends ? opt_ends : [];\n let i = 0;\n for (let j = 0, jj = coordinatess.length; j < jj; ++j) {\n const end = deflateCoordinates(\n flatCoordinates,\n offset,\n coordinatess[j],\n stride\n );\n ends[i++] = end;\n offset = end;\n }\n ends.length = i;\n return ends;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<Array<import(\"../../coordinate.js\").Coordinate>>>} coordinatesss Coordinatesss.\n * @param {number} stride Stride.\n * @param {Array<Array<number>>=} opt_endss Endss.\n * @return {Array<Array<number>>} Endss.\n */\nexport function deflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss,\n stride,\n opt_endss\n) {\n const endss = opt_endss ? opt_endss : [];\n let i = 0;\n for (let j = 0, jj = coordinatesss.length; j < jj; ++j) {\n const ends = deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss[j],\n stride,\n endss[i]\n );\n endss[i++] = ends;\n offset = ends[ends.length - 1];\n }\n endss.length = i;\n return endss;\n}\n","/**\n * @module ol/geom/flat/simplify\n */\n// Based on simplify-js https://github.com/mourner/simplify-js\n// Copyright (c) 2012, Vladimir Agafonkin\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n//\n// 1. Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n//\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n\nimport {squaredDistance, squaredSegmentDistance} from '../../math.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {boolean} highQuality Highest quality.\n * @param {Array<number>=} opt_simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @return {Array<number>} Simplified line string.\n */\nexport function simplifyLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n highQuality,\n opt_simplifiedFlatCoordinates\n) {\n const simplifiedFlatCoordinates =\n opt_simplifiedFlatCoordinates !== undefined\n ? opt_simplifiedFlatCoordinates\n : [];\n if (!highQuality) {\n end = radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0\n );\n flatCoordinates = simplifiedFlatCoordinates;\n offset = 0;\n stride = 2;\n }\n simplifiedFlatCoordinates.length = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0\n );\n return simplifiedFlatCoordinates;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset\n) {\n const n = (end - offset) / stride;\n if (n < 3) {\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n /** @type {Array<number>} */\n const markers = new Array(n);\n markers[0] = 1;\n markers[n - 1] = 1;\n /** @type {Array<number>} */\n const stack = [offset, end - stride];\n let index = 0;\n while (stack.length > 0) {\n const last = stack.pop();\n const first = stack.pop();\n let maxSquaredDistance = 0;\n const x1 = flatCoordinates[first];\n const y1 = flatCoordinates[first + 1];\n const x2 = flatCoordinates[last];\n const y2 = flatCoordinates[last + 1];\n for (let i = first + stride; i < last; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n const squaredDistance = squaredSegmentDistance(x, y, x1, y1, x2, y2);\n if (squaredDistance > maxSquaredDistance) {\n index = i;\n maxSquaredDistance = squaredDistance;\n }\n }\n if (maxSquaredDistance > squaredTolerance) {\n markers[(index - offset) / stride] = 1;\n if (first + stride < index) {\n stack.push(first, index);\n }\n if (index + stride < last) {\n stack.push(index, last);\n }\n }\n }\n for (let i = 0; i < n; ++i) {\n if (markers[i]) {\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride + 1];\n }\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<number>} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<Array<number>>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n const simplifiedEnds = [];\n simplifiedOffset = douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset\n) {\n if (end <= offset + stride) {\n // zero or one point, no simplification possible, so copy and return\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n // copy first point\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n let x2 = x1;\n let y2 = y1;\n for (offset += stride; offset < end; offset += stride) {\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {\n // copy point at offset\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n }\n }\n if (x2 != x1 || y2 != y1) {\n // copy last point\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {number} value Value.\n * @param {number} tolerance Tolerance.\n * @return {number} Rounded value.\n */\nexport function snap(value, tolerance) {\n return tolerance * Math.round(value / tolerance);\n}\n\n/**\n * Simplifies a line string using an algorithm designed by Tim Schaub.\n * Coordinates are snapped to the nearest value in a virtual grid and\n * consecutive duplicate coordinates are discarded. This effectively preserves\n * topology as the simplification of any subsection of a line string is\n * independent of the rest of the line string. This means that, for examples,\n * the common edge between two polygons will be simplified to the same line\n * string independently in both polygons. This implementation uses a single\n * pass over the coordinates and eliminates intermediate collinear points.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset\n) {\n // do nothing if the line is empty\n if (offset == end) {\n return simplifiedOffset;\n }\n // snap the first coordinate (P1)\n let x1 = snap(flatCoordinates[offset], tolerance);\n let y1 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // add the first coordinate to the output\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n // find the next coordinate that does not snap to the same value as the first\n // coordinate (P2)\n let x2, y2;\n do {\n x2 = snap(flatCoordinates[offset], tolerance);\n y2 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n if (offset == end) {\n // all coordinates snap to the same value, the line collapses to a point\n // push the last snapped value anyway to ensure that the output contains\n // at least two points\n // FIXME should we really return at least two points anyway?\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n }\n } while (x2 == x1 && y2 == y1);\n while (offset < end) {\n // snap the next coordinate (P3)\n const x3 = snap(flatCoordinates[offset], tolerance);\n const y3 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // skip P3 if it is equal to P2\n if (x3 == x2 && y3 == y2) {\n continue;\n }\n // calculate the delta between P1 and P2\n const dx1 = x2 - x1;\n const dy1 = y2 - y1;\n // calculate the delta between P3 and P1\n const dx2 = x3 - x1;\n const dy2 = y3 - y1;\n // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from\n // P1 in the same direction then P2 is on the straight line between P1 and\n // P3\n if (\n dx1 * dy2 == dy1 * dx2 &&\n ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&\n ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))\n ) {\n // discard P2 and set P2 = P3\n x2 = x3;\n y2 = y3;\n continue;\n }\n // either P1, P2, and P3 are not colinear, or they are colinear but P3 is\n // between P3 and P1 or on the opposite half of the line to P2. add P2,\n // and continue with P1 = P2 and P2 = P3\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n x2 = x3;\n y2 = y3;\n }\n // add the last point (P2)\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<number>} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<Array<number>>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function quantizeMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n const simplifiedEnds = [];\n simplifiedOffset = quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n","/**\n * @module ol/geom/flat/inflate\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Array<import(\"../../coordinate.js\").Coordinate>=} opt_coordinates Coordinates.\n * @return {Array<import(\"../../coordinate.js\").Coordinate>} Coordinates.\n */\nexport function inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n opt_coordinates\n) {\n const coordinates = opt_coordinates !== undefined ? opt_coordinates : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n coordinates[i++] = flatCoordinates.slice(j, j + stride);\n }\n coordinates.length = i;\n return coordinates;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<Array<import(\"../../coordinate.js\").Coordinate>>=} opt_coordinatess Coordinatess.\n * @return {Array<Array<import(\"../../coordinate.js\").Coordinate>>} Coordinatess.\n */\nexport function inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n opt_coordinatess\n) {\n const coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];\n let i = 0;\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n const end = ends[j];\n coordinatess[i++] = inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinatess[i]\n );\n offset = end;\n }\n coordinatess.length = i;\n return coordinatess;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array<Array<Array<import(\"../../coordinate.js\").Coordinate>>>=} opt_coordinatesss\n * Coordinatesss.\n * @return {Array<Array<Array<import(\"../../coordinate.js\").Coordinate>>>} Coordinatesss.\n */\nexport function inflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n opt_coordinatesss\n) {\n const coordinatesss =\n opt_coordinatesss !== undefined ? opt_coordinatesss : [];\n let i = 0;\n for (let j = 0, jj = endss.length; j < jj; ++j) {\n const ends = endss[j];\n coordinatesss[i++] = inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatesss[i]\n );\n offset = ends[ends.length - 1];\n }\n coordinatesss.length = i;\n return coordinatesss;\n}\n","/**\n * @module ol/geom/flat/area\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRing(flatCoordinates, offset, end, stride) {\n let twiceArea = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n twiceArea += y1 * x2 - x1 * y2;\n x1 = x2;\n y1 = y2;\n }\n return twiceArea / 2;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRings(flatCoordinates, offset, ends, stride) {\n let area = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n area += linearRing(flatCoordinates, offset, end, stride);\n offset = end;\n }\n return area;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n let area = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n area += linearRings(flatCoordinates, offset, ends, stride);\n offset = ends[ends.length - 1];\n }\n return area;\n}\n","/**\n * @module ol/geom/LinearRing\n */\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {douglasPeucker} from './flat/simplify.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {linearRing as linearRingArea} from './flat/area.js';\n\n/**\n * @classdesc\n * Linear ring geometry. Only used as part of polygon; cannot be rendered\n * on its own.\n *\n * @api\n */\nclass LinearRing extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `opt_layout` are also accepted.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n constructor(coordinates, opt_layout) {\n super();\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n opt_layout,\n /** @type {Array<number>} */ (coordinates)\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (coordinates),\n opt_layout\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LinearRing} Clone.\n * @api\n */\n clone() {\n return new LinearRing(this.flatCoordinates.slice(), this.layout);\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0\n )\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance\n );\n }\n\n /**\n * Return the area of the linear ring on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingArea(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride\n );\n }\n\n /**\n * Return the coordinates of the linear ring.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride\n );\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LinearRing} Simplified LinearRing.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0\n );\n return new LinearRing(simplifiedFlatCoordinates, GeometryLayout.XY);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.LINEAR_RING;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return false;\n }\n\n /**\n * Set the coordinates of the linear ring.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride\n );\n this.changed();\n }\n}\n\nexport default LinearRing;\n","/**\n * @module ol/geom/Point\n */\nimport GeometryType from './GeometryType.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {containsXY, createOrUpdateFromCoordinate} from '../extent.js';\nimport {deflateCoordinate} from './flat/deflate.js';\nimport {squaredDistance as squaredDx} from '../math.js';\n\n/**\n * @classdesc\n * Point geometry.\n *\n * @api\n */\nclass Point extends SimpleGeometry {\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n constructor(coordinates, opt_layout) {\n super();\n this.setCoordinates(coordinates, opt_layout);\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Point} Clone.\n * @api\n */\n clone() {\n const point = new Point(this.flatCoordinates.slice(), this.layout);\n return point;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[0],\n flatCoordinates[1]\n );\n if (squaredDistance < minSquaredDistance) {\n const stride = this.stride;\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n } else {\n return minSquaredDistance;\n }\n }\n\n /**\n * Return the coordinate of the point.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinates.\n * @api\n */\n getCoordinates() {\n return !this.flatCoordinates ? [] : this.flatCoordinates.slice();\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return createOrUpdateFromCoordinate(this.flatCoordinates, extent);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.POINT;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);\n }\n\n /**\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinate(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride\n );\n this.changed();\n }\n}\n\nexport default Point;\n","/**\n * @module ol/geom/flat/contains\n */\nimport {forEachCorner} from '../../extent.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} Contains extent.\n */\nexport function linearRingContainsExtent(\n flatCoordinates,\n offset,\n end,\n stride,\n extent\n) {\n const outside = forEachCorner(\n extent,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains (x, y).\n */\n function (coordinate) {\n return !linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinate[0],\n coordinate[1]\n );\n }\n );\n return !outside;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n x,\n y\n) {\n // http://geomalgorithms.com/a03-_inclusion.html\n // Copyright 2000 softSurfer, 2012 Dan Sunday\n // This code may be freely used and modified for any purpose\n // providing that this copyright notice is included with it.\n // SoftSurfer makes no warranty for this code, and cannot be held\n // liable for any real or imagined damage resulting from its use.\n // Users of this code must verify correctness for their application.\n let wn = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n if (y1 <= y) {\n if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) {\n wn++;\n }\n } else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) {\n wn--;\n }\n x1 = x2;\n y1 = y2;\n }\n return wn !== 0;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingsContainsXY(\n flatCoordinates,\n offset,\n ends,\n stride,\n x,\n y\n) {\n if (ends.length === 0) {\n return false;\n }\n if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {\n return false;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)\n ) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingssContainsXY(\n flatCoordinates,\n offset,\n endss,\n stride,\n x,\n y\n) {\n if (endss.length === 0) {\n return false;\n }\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/interiorpoint\n */\nimport {linearRingsContainsXY} from './contains.js';\nimport {numberSafeCompareFunction} from '../../array.js';\n\n/**\n * Calculates a point that is likely to lie in the interior of the linear rings.\n * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<number>} flatCenters Flat centers.\n * @param {number} flatCentersOffset Flat center offset.\n * @param {Array<number>=} opt_dest Destination.\n * @return {Array<number>} Destination point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n flatCentersOffset,\n opt_dest\n) {\n let i, ii, x, x1, x2, y1, y2;\n const y = flatCenters[flatCentersOffset + 1];\n /** @type {Array<number>} */\n const intersections = [];\n // Calculate intersections with the horizontal line\n for (let r = 0, rr = ends.length; r < rr; ++r) {\n const end = ends[r];\n x1 = flatCoordinates[end - stride];\n y1 = flatCoordinates[end - stride + 1];\n for (i = offset; i < end; i += stride) {\n x2 = flatCoordinates[i];\n y2 = flatCoordinates[i + 1];\n if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {\n x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1;\n intersections.push(x);\n }\n x1 = x2;\n y1 = y2;\n }\n }\n // Find the longest segment of the horizontal line that has its center point\n // inside the linear ring.\n let pointX = NaN;\n let maxSegmentLength = -Infinity;\n intersections.sort(numberSafeCompareFunction);\n x1 = intersections[0];\n for (i = 1, ii = intersections.length; i < ii; ++i) {\n x2 = intersections[i];\n const segmentLength = Math.abs(x2 - x1);\n if (segmentLength > maxSegmentLength) {\n x = (x1 + x2) / 2;\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n pointX = x;\n maxSegmentLength = segmentLength;\n }\n }\n x1 = x2;\n }\n if (isNaN(pointX)) {\n // There is no horizontal line that has its center point inside the linear\n // ring. Use the center of the the linear ring's extent.\n pointX = flatCenters[flatCentersOffset];\n }\n if (opt_dest) {\n opt_dest.push(pointX, y, maxSegmentLength);\n return opt_dest;\n } else {\n return [pointX, y, maxSegmentLength];\n }\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array<number>} flatCenters Flat centers.\n * @return {Array<number>} Interior points as XYM coordinates, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointsOfMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n flatCenters\n) {\n let interiorPoints = [];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n interiorPoints = getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n 2 * i,\n interiorPoints\n );\n offset = ends[ends.length - 1];\n }\n return interiorPoints;\n}\n","/**\n * @module ol/geom/flat/segments\n */\n\n/**\n * This function calls `callback` for each segment of the flat coordinates\n * array. If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {function(import(\"../../coordinate.js\").Coordinate, import(\"../../coordinate.js\").Coordinate): T} callback Function\n * called for each segment.\n * @return {T|boolean} Value.\n * @template T\n */\nexport function forEach(flatCoordinates, offset, end, stride, callback) {\n const point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];\n const point2 = [];\n let ret;\n for (; offset + stride < end; offset += stride) {\n point2[0] = flatCoordinates[offset + stride];\n point2[1] = flatCoordinates[offset + stride + 1];\n ret = callback(point1, point2);\n if (ret) {\n return ret;\n }\n point1[0] = point2[0];\n point1[1] = point2[1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/intersectsextent\n */\nimport {\n containsExtent,\n createEmpty,\n extendFlatCoordinates,\n intersects,\n intersectsSegment,\n} from '../../extent.js';\nimport {forEach as forEachSegment} from './segments.js';\nimport {linearRingContainsExtent, linearRingContainsXY} from './contains.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n extent\n) {\n const coordinatesExtent = extendFlatCoordinates(\n createEmpty(),\n flatCoordinates,\n offset,\n end,\n stride\n );\n if (!intersects(extent, coordinatesExtent)) {\n return false;\n }\n if (containsExtent(extent, coordinatesExtent)) {\n return true;\n }\n if (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) {\n return true;\n }\n if (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3]) {\n return true;\n }\n return forEachSegment(\n flatCoordinates,\n offset,\n end,\n stride,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} point1 Start point.\n * @param {import(\"../../coordinate.js\").Coordinate} point2 End point.\n * @return {boolean} `true` if the segment and the extent intersect,\n * `false` otherwise.\n */\n function (point1, point2) {\n return intersectsSegment(extent, point1, point2);\n }\n );\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineStringArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n if (\n intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)\n ) {\n return true;\n }\n offset = ends[i];\n }\n return false;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRing(\n flatCoordinates,\n offset,\n end,\n stride,\n extent\n) {\n if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[1]\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[3]\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[1]\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[3]\n )\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent\n) {\n if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {\n return false;\n }\n if (ends.length === 1) {\n return true;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsExtent(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent\n )\n ) {\n if (\n !intersectsLineString(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n extent\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (\n intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)\n ) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/reverse\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n */\nexport function coordinates(flatCoordinates, offset, end, stride) {\n while (offset < end - stride) {\n for (let i = 0; i < stride; ++i) {\n const tmp = flatCoordinates[offset + i];\n flatCoordinates[offset + i] = flatCoordinates[end - stride + i];\n flatCoordinates[end - stride + i] = tmp;\n }\n offset += stride;\n end -= stride;\n }\n}\n","/**\n * @module ol/geom/flat/orient\n */\nimport {coordinates as reverseCoordinates} from './reverse.js';\n\n/**\n * Is the linear ring oriented clockwise in a coordinate system with a bottom-left\n * coordinate origin? For a coordinate system with a top-left coordinate origin,\n * the ring's orientation is clockwise when this function returns false.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {boolean} Is clockwise.\n */\nexport function linearRingIsClockwise(flatCoordinates, offset, end, stride) {\n // https://stackoverflow.com/a/1180256/2389327\n // https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon\n\n let firstVertexRepeated = true;\n for (let i = 0; i < stride; ++i) {\n if (flatCoordinates[offset + i] !== flatCoordinates[end - stride + i]) {\n firstVertexRepeated = false;\n break;\n }\n }\n if (firstVertexRepeated) {\n end -= stride;\n }\n const iMinVertex = findCornerVertex(flatCoordinates, offset, end, stride);\n // Orientation matrix:\n // [ 1 xa ya ]\n // O = | 1 xb yb |\n // [ 1 xc yc ]\n let iPreviousVertex = iMinVertex - stride;\n if (iPreviousVertex < offset) {\n iPreviousVertex = end - stride;\n }\n let iNextVertex = iMinVertex + stride;\n if (iNextVertex >= end) {\n iNextVertex = offset;\n }\n const aX = flatCoordinates[iPreviousVertex];\n const aY = flatCoordinates[iPreviousVertex + 1];\n const bX = flatCoordinates[iMinVertex];\n const bY = flatCoordinates[iMinVertex + 1];\n const cX = flatCoordinates[iNextVertex];\n const cY = flatCoordinates[iNextVertex + 1];\n const determinant =\n bX * cY + aX * bY + aY * cX - (aY * bX + bY * cX + aX * cY);\n\n return determinant < 0;\n}\n\n// Find vertex along one edge of bounding box.\n// In this case, we find smallest y; in case of tie also smallest x.\nfunction findCornerVertex(flatCoordinates, offset, end, stride) {\n let iMinVertex = -1;\n let minY = Infinity;\n let minXAtMinY = Infinity;\n for (let i = offset; i < end; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n if (y > minY) {\n continue;\n }\n if (y == minY) {\n if (x >= minXAtMinY) {\n continue;\n }\n }\n\n // Minimum so far.\n iMinVertex = i;\n minY = y;\n minXAtMinY = x;\n }\n\n return iMinVertex;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `opt_right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingsAreOriented(\n flatCoordinates,\n offset,\n ends,\n stride,\n opt_right\n) {\n const right = opt_right !== undefined ? opt_right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride\n );\n if (i === 0) {\n if ((right && isClockwise) || (!right && !isClockwise)) {\n return false;\n }\n } else {\n if ((right && !isClockwise) || (!right && isClockwise)) {\n return false;\n }\n }\n offset = end;\n }\n return true;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `opt_right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingssAreOriented(\n flatCoordinates,\n offset,\n endss,\n stride,\n opt_right\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (\n !linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right)\n ) {\n return false;\n }\n if (ends.length) {\n offset = ends[ends.length - 1];\n }\n }\n return true;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `opt_right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRings(\n flatCoordinates,\n offset,\n ends,\n stride,\n opt_right\n) {\n const right = opt_right !== undefined ? opt_right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride\n );\n const reverse =\n i === 0\n ? (right && isClockwise) || (!right && !isClockwise)\n : (right && !isClockwise) || (!right && isClockwise);\n if (reverse) {\n reverseCoordinates(flatCoordinates, offset, end, stride);\n }\n offset = end;\n }\n return offset;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `opt_right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean=} opt_right Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRingsArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n opt_right\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = orientLinearRings(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n opt_right\n );\n }\n return offset;\n}\n","/**\n * @module ol/geom/Polygon\n */\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport LinearRing from './LinearRing.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {closestSquaredDistanceXY, getCenter} from '../extent.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {extend} from '../array.js';\nimport {getInteriorPointOfArray} from './flat/interiorpoint.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {intersectsLinearRingArray} from './flat/intersectsextent.js';\nimport {linearRingsAreOriented, orientLinearRings} from './flat/orient.js';\nimport {linearRings as linearRingsArea} from './flat/area.js';\nimport {linearRingsContainsXY} from './flat/contains.js';\nimport {modulo} from '../math.js';\nimport {quantizeArray} from './flat/simplify.js';\nimport {offset as sphereOffset} from '../sphere.js';\n\n/**\n * @classdesc\n * Polygon geometry.\n *\n * @api\n */\nclass Polygon extends SimpleGeometry {\n /**\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>|!Array<number>} coordinates\n * Array of linear rings that define the polygon. The first linear ring of the\n * array defines the outer-boundary or surface of the polygon. Each subsequent\n * linear ring defines a hole in the surface of the polygon. A linear ring is\n * an array of vertices' coordinates where the first coordinate and the last are\n * equivalent. (For internal use, flat coordinates in combination with\n * `opt_layout` and `opt_ends` are also accepted.)\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @param {Array<number>=} opt_ends Ends (for internal use with flat coordinates).\n */\n constructor(coordinates, opt_layout, opt_ends) {\n super();\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointRevision_ = -1;\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.flatInteriorPoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (opt_layout !== undefined && opt_ends) {\n this.setFlatCoordinates(\n opt_layout,\n /** @type {Array<number>} */ (coordinates)\n );\n this.ends_ = opt_ends;\n } else {\n this.setCoordinates(\n /** @type {Array<Array<import(\"../coordinate.js\").Coordinate>>} */ (coordinates),\n opt_layout\n );\n }\n }\n\n /**\n * Append the passed linear ring to this polygon.\n * @param {LinearRing} linearRing Linear ring.\n * @api\n */\n appendLinearRing(linearRing) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = linearRing.getFlatCoordinates().slice();\n } else {\n extend(this.flatCoordinates, linearRing.getFlatCoordinates());\n }\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Polygon} Clone.\n * @api\n */\n clone() {\n return new Polygon(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice()\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0\n )\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n return linearRingsContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n x,\n y\n );\n }\n\n /**\n * Return the area of the polygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingsArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for polygons.\n *\n * @param {boolean=} opt_right Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} Coordinates.\n * @api\n */\n getCoordinates(opt_right) {\n let flatCoordinates;\n if (opt_right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, opt_right);\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride);\n }\n\n /**\n * @return {Array<number>} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * @return {Array<number>} Interior point.\n */\n getFlatInteriorPoint() {\n if (this.flatInteriorPointRevision_ != this.getRevision()) {\n const flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoint_ = getInteriorPointOfArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n flatCenter,\n 0\n );\n this.flatInteriorPointRevision_ = this.getRevision();\n }\n return this.flatInteriorPoint_;\n }\n\n /**\n * Return an interior point of the polygon.\n * @return {Point} Interior point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoint() {\n return new Point(this.getFlatInteriorPoint(), GeometryLayout.XYM);\n }\n\n /**\n * Return the number of rings of the polygon, this includes the exterior\n * ring and any interior rings.\n *\n * @return {number} Number of rings.\n * @api\n */\n getLinearRingCount() {\n return this.ends_.length;\n }\n\n /**\n * Return the Nth linear ring of the polygon geometry. Return `null` if the\n * given index is out of range.\n * The exterior linear ring is available at index `0` and the interior rings\n * at index `1` and beyond.\n *\n * @param {number} index Index.\n * @return {LinearRing} Linear ring.\n * @api\n */\n getLinearRing(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LinearRing(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index]\n ),\n this.layout\n );\n }\n\n /**\n * Return the linear rings of the polygon.\n * @return {Array<LinearRing>} Linear rings.\n * @api\n */\n getLinearRings() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const linearRings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const linearRing = new LinearRing(\n flatCoordinates.slice(offset, end),\n layout\n );\n linearRings.push(linearRing);\n offset = end;\n }\n return linearRings;\n }\n\n /**\n * @return {Array<number>} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRings(\n this.orientedFlatCoordinates_,\n 0,\n this.ends_,\n this.stride\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return this.orientedFlatCoordinates_;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Polygon} Simplified Polygon.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n const simplifiedFlatCoordinates = [];\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds\n );\n return new Polygon(\n simplifiedFlatCoordinates,\n GeometryLayout.XY,\n simplifiedEnds\n );\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.POLYGON;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLinearRingArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n extent\n );\n }\n\n /**\n * Set the coordinates of the polygon.\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default Polygon;\n\n/**\n * Create an approximation of a circle on the surface of a sphere.\n * @param {import(\"../coordinate.js\").Coordinate} center Center (`[lon, lat]` in degrees).\n * @param {number} radius The great-circle distance from the center to\n * the polygon vertices.\n * @param {number=} opt_n Optional number of vertices for the resulting\n * polygon. Default is `32`.\n * @param {number=} opt_sphereRadius Optional radius for the sphere (defaults to\n * the Earth's mean radius using the WGS84 ellipsoid).\n * @return {Polygon} The \"circular\" polygon.\n * @api\n */\nexport function circular(center, radius, opt_n, opt_sphereRadius) {\n const n = opt_n ? opt_n : 32;\n /** @type {Array<number>} */\n const flatCoordinates = [];\n for (let i = 0; i < n; ++i) {\n extend(\n flatCoordinates,\n sphereOffset(center, radius, (2 * Math.PI * i) / n, opt_sphereRadius)\n );\n }\n flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);\n return new Polygon(flatCoordinates, GeometryLayout.XY, [\n flatCoordinates.length,\n ]);\n}\n\n/**\n * Create a polygon from an extent. The layout used is `XY`.\n * @param {import(\"../extent.js\").Extent} extent The extent.\n * @return {Polygon} The polygon.\n * @api\n */\nexport function fromExtent(extent) {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const flatCoordinates = [\n minX,\n minY,\n minX,\n maxY,\n maxX,\n maxY,\n maxX,\n minY,\n minX,\n minY,\n ];\n return new Polygon(flatCoordinates, GeometryLayout.XY, [\n flatCoordinates.length,\n ]);\n}\n\n/**\n * Create a regular polygon from a circle.\n * @param {import(\"./Circle.js\").default} circle Circle geometry.\n * @param {number=} opt_sides Number of sides of the polygon. Default is 32.\n * @param {number=} opt_angle Start angle for the first vertex of the polygon in\n * radians. Default is 0.\n * @return {Polygon} Polygon geometry.\n * @api\n */\nexport function fromCircle(circle, opt_sides, opt_angle) {\n const sides = opt_sides ? opt_sides : 32;\n const stride = circle.getStride();\n const layout = circle.getLayout();\n const center = circle.getCenter();\n const arrayLength = stride * (sides + 1);\n const flatCoordinates = new Array(arrayLength);\n for (let i = 0; i < arrayLength; i += stride) {\n flatCoordinates[i] = 0;\n flatCoordinates[i + 1] = 0;\n for (let j = 2; j < stride; j++) {\n flatCoordinates[i + j] = center[j];\n }\n }\n const ends = [flatCoordinates.length];\n const polygon = new Polygon(flatCoordinates, layout, ends);\n makeRegular(polygon, center, circle.getRadius(), opt_angle);\n return polygon;\n}\n\n/**\n * Modify the coordinates of a polygon to make it a regular polygon.\n * @param {Polygon} polygon Polygon geometry.\n * @param {import(\"../coordinate.js\").Coordinate} center Center of the regular polygon.\n * @param {number} radius Radius of the regular polygon.\n * @param {number=} opt_angle Start angle for the first vertex of the polygon in\n * radians. Default is 0.\n */\nexport function makeRegular(polygon, center, radius, opt_angle) {\n const flatCoordinates = polygon.getFlatCoordinates();\n const stride = polygon.getStride();\n const sides = flatCoordinates.length / stride - 1;\n const startAngle = opt_angle ? opt_angle : 0;\n for (let i = 0; i <= sides; ++i) {\n const offset = i * stride;\n const angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides;\n flatCoordinates[offset] = center[0] + radius * Math.cos(angle);\n flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle);\n }\n polygon.changed();\n}\n","/**\n * @module ol/Geolocation\n */\nimport BaseEvent from './events/Event.js';\nimport BaseObject, {getChangeEventType} from './Object.js';\nimport EventType from './events/EventType.js';\nimport {circular as circularPolygon} from './geom/Polygon.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n identityTransform,\n} from './proj.js';\nimport {toRadians} from './math.js';\n\n/**\n * @enum {string}\n */\nconst Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions',\n};\n\n/**\n * @classdesc\n * Events emitted on Geolocation error.\n */\nclass GeolocationError extends BaseEvent {\n /**\n * @param {PositionError} error error object.\n */\n constructor(error) {\n super(EventType.ERROR);\n\n /**\n * @type {number}\n */\n this.code = error.code;\n\n /**\n * @type {string}\n */\n this.message = error.message;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](http://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes, register a listener for the generic\n * `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * var geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * window.console.log(geolocation.getPosition());\n * });\n *\n * @fires module:ol/events/Event~BaseEvent#event:error\n * @api\n */\nclass Geolocation extends BaseObject {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n const options = opt_options || {};\n\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.position_ = null;\n\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n this.transform_ = identityTransform;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.watchId_ = undefined;\n\n this.addEventListener(\n getChangeEventType(Property.PROJECTION),\n this.handleProjectionChanged_\n );\n this.addEventListener(\n getChangeEventType(Property.TRACKING),\n this.handleTrackingChanged_\n );\n\n if (options.projection !== undefined) {\n this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n this.setTrackingOptions(options.trackingOptions);\n }\n\n this.setTracking(options.tracking !== undefined ? options.tracking : false);\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.setTracking(false);\n super.disposeInternal();\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n getProjection('EPSG:4326'),\n projection\n );\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n }\n\n /**\n * @private\n */\n handleTrackingChanged_() {\n if ('geolocation' in navigator) {\n const tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(\n this.positionChange_.bind(this),\n this.positionError_.bind(this),\n this.getTrackingOptions()\n );\n } else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n }\n\n /**\n * @private\n * @param {Position} position position event.\n */\n positionChange_(position) {\n const coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(\n Property.ALTITUDE,\n coords.altitude === null ? undefined : coords.altitude\n );\n this.set(\n Property.ALTITUDE_ACCURACY,\n coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy\n );\n this.set(\n Property.HEADING,\n coords.heading === null ? undefined : toRadians(coords.heading)\n );\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n } else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n const projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition);\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n const geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n }\n\n /**\n * @private\n * @param {PositionError} error error object.\n */\n positionError_(error) {\n this.dispatchEvent(new GeolocationError(error));\n }\n\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n getAccuracy() {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n }\n\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n getAccuracyGeometry() {\n return /** @type {?import(\"./geom/Polygon.js\").default} */ (this.get(\n Property.ACCURACY_GEOMETRY\n ) || null);\n }\n\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n getAltitude() {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n }\n\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n getAltitudeAccuracy() {\n return /** @type {number|undefined} */ (this.get(\n Property.ALTITUDE_ACCURACY\n ));\n }\n\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n getHeading() {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n }\n\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (this.get(\n Property.POSITION\n ));\n }\n\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"./proj/Projection.js\").default|undefined} */ (this.get(\n Property.PROJECTION\n ));\n }\n\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n getSpeed() {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n }\n\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n getTracking() {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n }\n\n /**\n * Get the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n getTrackingOptions() {\n return /** @type {PositionOptions|undefined} */ (this.get(\n Property.TRACKING_OPTIONS\n ));\n }\n\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n }\n\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n setTracking(tracking) {\n this.set(Property.TRACKING, tracking);\n }\n\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n setTrackingOptions(options) {\n this.set(Property.TRACKING_OPTIONS, options);\n }\n}\n\nexport default Geolocation;\n","/**\n * @module ol/render/EventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered before a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#prerender\n * @api\n */\n PRERENDER: 'prerender',\n\n /**\n * Triggered after a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered before layers are rendered.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#precompose\n * @api\n */\n PRECOMPOSE: 'precompose',\n\n /**\n * Triggered after all layers are rendered.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#postcompose\n * @api\n */\n POSTCOMPOSE: 'postcompose',\n\n /**\n * Triggered when rendering is complete, i.e. all sources and tiles have\n * finished loading for the current viewport, and all tiles are faded in.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#rendercomplete\n * @api\n */\n RENDERCOMPLETE: 'rendercomplete',\n};\n","/**\n * @module ol/style/Fill\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} [color=null] A color, gradient or pattern.\n * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.\n * Default null; if null, the Canvas/renderer default black will be used.\n */\n\n/**\n * @classdesc\n * Set fill style for vector features.\n * @api\n */\nclass Fill {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike}\n */\n this.color_ = options.color !== undefined ? options.color : null;\n }\n\n /**\n * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.\n * @return {Fill} The cloned style.\n * @api\n */\n clone() {\n const color = this.getColor();\n return new Fill({\n color: Array.isArray(color) ? color.slice() : color || undefined,\n });\n }\n\n /**\n * Get the fill color.\n * @return {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Set the color.\n *\n * @param {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} color Color.\n * @api\n */\n setColor(color) {\n this.color_ = color;\n }\n}\n\nexport default Fill;\n","/**\n * @module ol/geom/flat/interpolate\n */\nimport {binarySearch} from '../../array.js';\nimport {lerp} from '../../math.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} fraction Fraction.\n * @param {Array<number>=} opt_dest Destination.\n * @param {number=} opt_dimension Destination dimension (default is `2`)\n * @return {Array<number>} Destination.\n */\nexport function interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n fraction,\n opt_dest,\n opt_dimension\n) {\n let o, t;\n const n = (end - offset) / stride;\n if (n === 1) {\n o = offset;\n } else if (n === 2) {\n o = offset;\n t = fraction;\n } else if (n !== 0) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n const cumulativeLengths = [0];\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n cumulativeLengths.push(length);\n x1 = x2;\n y1 = y2;\n }\n const target = fraction * length;\n const index = binarySearch(cumulativeLengths, target);\n if (index < 0) {\n t =\n (target - cumulativeLengths[-index - 2]) /\n (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);\n o = offset + (-index - 2) * stride;\n } else {\n o = offset + index * stride;\n }\n }\n const dimension = opt_dimension > 1 ? opt_dimension : 2;\n const dest = opt_dest ? opt_dest : new Array(dimension);\n for (let i = 0; i < dimension; ++i) {\n dest[i] =\n o === undefined\n ? NaN\n : t === undefined\n ? flatCoordinates[o + i]\n : lerp(flatCoordinates[o + i], flatCoordinates[o + stride + i], t);\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\nexport function lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n extrapolate\n) {\n if (end == offset) {\n return null;\n }\n let coordinate;\n if (m < flatCoordinates[offset + stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(offset, offset + stride);\n coordinate[stride - 1] = m;\n return coordinate;\n } else {\n return null;\n }\n } else if (flatCoordinates[end - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(end - stride, end);\n coordinate[stride - 1] = m;\n return coordinate;\n } else {\n return null;\n }\n }\n // FIXME use O(1) search\n if (m == flatCoordinates[offset + stride - 1]) {\n return flatCoordinates.slice(offset, offset + stride);\n }\n let lo = offset / stride;\n let hi = end / stride;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m < flatCoordinates[(mid + 1) * stride - 1]) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n const m0 = flatCoordinates[lo * stride - 1];\n if (m == m0) {\n return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);\n }\n const m1 = flatCoordinates[(lo + 1) * stride - 1];\n const t = (m - m0) / (m1 - m0);\n coordinate = [];\n for (let i = 0; i < stride - 1; ++i) {\n coordinate.push(\n lerp(\n flatCoordinates[(lo - 1) * stride + i],\n flatCoordinates[lo * stride + i],\n t\n )\n );\n }\n coordinate.push(m);\n return coordinate;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @param {boolean} interpolate Interpolate.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\nexport function lineStringsCoordinateAtM(\n flatCoordinates,\n offset,\n ends,\n stride,\n m,\n extrapolate,\n interpolate\n) {\n if (interpolate) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n ends[ends.length - 1],\n stride,\n m,\n extrapolate\n );\n }\n let coordinate;\n if (m < flatCoordinates[stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(0, stride);\n coordinate[stride - 1] = m;\n return coordinate;\n } else {\n return null;\n }\n }\n if (flatCoordinates[flatCoordinates.length - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(flatCoordinates.length - stride);\n coordinate[stride - 1] = m;\n return coordinate;\n } else {\n return null;\n }\n }\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n if (offset == end) {\n continue;\n }\n if (m < flatCoordinates[offset + stride - 1]) {\n return null;\n } else if (m <= flatCoordinates[end - 1]) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n false\n );\n }\n offset = end;\n }\n return null;\n}\n","/**\n * @module ol/geom/flat/length\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Length.\n */\nexport function lineStringLength(flatCoordinates, offset, end, stride) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n x1 = x2;\n y1 = y2;\n }\n return length;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Perimeter.\n */\nexport function linearRingLength(flatCoordinates, offset, end, stride) {\n let perimeter = lineStringLength(flatCoordinates, offset, end, stride);\n const dx = flatCoordinates[end - stride] - flatCoordinates[offset];\n const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];\n perimeter += Math.sqrt(dx * dx + dy * dy);\n return perimeter;\n}\n","/**\n * @module ol/geom/LineString\n */\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {douglasPeucker} from './flat/simplify.js';\nimport {extend} from '../array.js';\nimport {forEach as forEachSegment} from './flat/segments.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {interpolatePoint, lineStringCoordinateAtM} from './flat/interpolate.js';\nimport {intersectsLineString} from './flat/intersectsextent.js';\nimport {lineStringLength} from './flat/length.js';\n\n/**\n * @classdesc\n * Linestring geometry.\n *\n * @api\n */\nclass LineString extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `opt_layout` are also accepted.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n constructor(coordinates, opt_layout) {\n super();\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.flatMidpoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.flatMidpointRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n opt_layout,\n /** @type {Array<number>} */ (coordinates)\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (coordinates),\n opt_layout\n );\n }\n }\n\n /**\n * Append the passed coordinate to the coordinates of the linestring.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @api\n */\n appendCoordinate(coordinate) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = coordinate.slice();\n } else {\n extend(this.flatCoordinates, coordinate);\n }\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LineString} Clone.\n * @api\n */\n clone() {\n return new LineString(this.flatCoordinates.slice(), this.layout);\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0\n )\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance\n );\n }\n\n /**\n * Iterate over each segment, calling the provided callback.\n * If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n *\n * @param {function(this: S, import(\"../coordinate.js\").Coordinate, import(\"../coordinate.js\").Coordinate): T} callback Function\n * called for each segment. The function will receive two arguments, the start and end coordinates of the segment.\n * @return {T|boolean} Value.\n * @template T,S\n * @api\n */\n forEachSegment(callback) {\n return forEachSegment(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n callback\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `opt_extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * @param {number} m M.\n * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n getCoordinateAtM(m, opt_extrapolate) {\n if (\n this.layout != GeometryLayout.XYM &&\n this.layout != GeometryLayout.XYZM\n ) {\n return null;\n }\n const extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;\n return lineStringCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n m,\n extrapolate\n );\n }\n\n /**\n * Return the coordinates of the linestring.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride\n );\n }\n\n /**\n * Return the coordinate at the provided fraction along the linestring.\n * The `fraction` is a number between 0 and 1, where 0 is the start of the\n * linestring and 1 is the end.\n * @param {number} fraction Fraction.\n * @param {import(\"../coordinate.js\").Coordinate=} opt_dest Optional coordinate whose values will\n * be modified. If not provided, a new coordinate will be returned.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinate of the interpolated point.\n * @api\n */\n getCoordinateAt(fraction, opt_dest) {\n return interpolatePoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n fraction,\n opt_dest,\n this.stride\n );\n }\n\n /**\n * Return the length of the linestring on projected plane.\n * @return {number} Length (on projected plane).\n * @api\n */\n getLength() {\n return lineStringLength(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride\n );\n }\n\n /**\n * @return {Array<number>} Flat midpoint.\n */\n getFlatMidpoint() {\n if (this.flatMidpointRevision_ != this.getRevision()) {\n this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_);\n this.flatMidpointRevision_ = this.getRevision();\n }\n return this.flatMidpoint_;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} Simplified LineString.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0\n );\n return new LineString(simplifiedFlatCoordinates, GeometryLayout.XY);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.LINE_STRING;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLineString(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent\n );\n }\n\n /**\n * Set the coordinates of the linestring.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride\n );\n this.changed();\n }\n}\n\nexport default LineString;\n","/**\n * @module ol/style/Stroke\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} [color] A color, gradient or pattern.\n * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.\n * Default null; if null, the Canvas/renderer default black will be used.\n * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.\n * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.\n * @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).\n * Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on\n * the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers.\n * @property {number} [lineDashOffset=0] Line dash offset.\n * @property {number} [miterLimit=10] Miter limit.\n * @property {number} [width] Width.\n */\n\n/**\n * @classdesc\n * Set stroke style for vector features.\n * Note that the defaults given are the Canvas defaults, which will be used if\n * option is not defined. The `get` functions return whatever was entered in\n * the options; they will not return the default.\n * @api\n */\nclass Stroke {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike}\n */\n this.color_ = options.color !== undefined ? options.color : null;\n\n /**\n * @private\n * @type {CanvasLineCap|undefined}\n */\n this.lineCap_ = options.lineCap;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lineDashOffset_ = options.lineDashOffset;\n\n /**\n * @private\n * @type {CanvasLineJoin|undefined}\n */\n this.lineJoin_ = options.lineJoin;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.miterLimit_ = options.miterLimit;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.width_ = options.width;\n }\n\n /**\n * Clones the style.\n * @return {Stroke} The cloned style.\n * @api\n */\n clone() {\n const color = this.getColor();\n return new Stroke({\n color: Array.isArray(color) ? color.slice() : color || undefined,\n lineCap: this.getLineCap(),\n lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,\n lineDashOffset: this.getLineDashOffset(),\n lineJoin: this.getLineJoin(),\n miterLimit: this.getMiterLimit(),\n width: this.getWidth(),\n });\n }\n\n /**\n * Get the stroke color.\n * @return {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Get the line cap type for the stroke.\n * @return {CanvasLineCap|undefined} Line cap.\n * @api\n */\n getLineCap() {\n return this.lineCap_;\n }\n\n /**\n * Get the line dash style for the stroke.\n * @return {Array<number>} Line dash.\n * @api\n */\n getLineDash() {\n return this.lineDash_;\n }\n\n /**\n * Get the line dash offset for the stroke.\n * @return {number|undefined} Line dash offset.\n * @api\n */\n getLineDashOffset() {\n return this.lineDashOffset_;\n }\n\n /**\n * Get the line join type for the stroke.\n * @return {CanvasLineJoin|undefined} Line join.\n * @api\n */\n getLineJoin() {\n return this.lineJoin_;\n }\n\n /**\n * Get the miter limit for the stroke.\n * @return {number|undefined} Miter limit.\n * @api\n */\n getMiterLimit() {\n return this.miterLimit_;\n }\n\n /**\n * Get the stroke width.\n * @return {number|undefined} Width.\n * @api\n */\n getWidth() {\n return this.width_;\n }\n\n /**\n * Set the color.\n *\n * @param {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} color Color.\n * @api\n */\n setColor(color) {\n this.color_ = color;\n }\n\n /**\n * Set the line cap.\n *\n * @param {CanvasLineCap|undefined} lineCap Line cap.\n * @api\n */\n setLineCap(lineCap) {\n this.lineCap_ = lineCap;\n }\n\n /**\n * Set the line dash.\n *\n * Please note that Internet Explorer 10 and lower [do not support][mdn] the\n * `setLineDash` method on the `CanvasRenderingContext2D` and therefore this\n * property will have no visual effect in these browsers.\n *\n * [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility\n *\n * @param {Array<number>} lineDash Line dash.\n * @api\n */\n setLineDash(lineDash) {\n this.lineDash_ = lineDash;\n }\n\n /**\n * Set the line dash offset.\n *\n * @param {number|undefined} lineDashOffset Line dash offset.\n * @api\n */\n setLineDashOffset(lineDashOffset) {\n this.lineDashOffset_ = lineDashOffset;\n }\n\n /**\n * Set the line join.\n *\n * @param {CanvasLineJoin|undefined} lineJoin Line join.\n * @api\n */\n setLineJoin(lineJoin) {\n this.lineJoin_ = lineJoin;\n }\n\n /**\n * Set the miter limit.\n *\n * @param {number|undefined} miterLimit Miter limit.\n * @api\n */\n setMiterLimit(miterLimit) {\n this.miterLimit_ = miterLimit;\n }\n\n /**\n * Set the width.\n *\n * @param {number|undefined} width Width.\n * @api\n */\n setWidth(width) {\n this.width_ = width;\n }\n}\n\nexport default Stroke;\n","/**\n * @module ol/ImageState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/size\n */\n\n/**\n * An array of numbers representing a size: `[width, height]`.\n * @typedef {Array<number>} Size\n * @api\n */\n\n/**\n * Returns a buffered size.\n * @param {Size} size Size.\n * @param {number} num The amount by which to buffer.\n * @param {Size=} opt_size Optional reusable size array.\n * @return {Size} The buffered size.\n */\nexport function buffer(size, num, opt_size) {\n if (opt_size === undefined) {\n opt_size = [0, 0];\n }\n opt_size[0] = size[0] + 2 * num;\n opt_size[1] = size[1] + 2 * num;\n return opt_size;\n}\n\n/**\n * Determines if a size has a positive area.\n * @param {Size} size The size to test.\n * @return {boolean} The size has a positive area.\n */\nexport function hasArea(size) {\n return size[0] > 0 && size[1] > 0;\n}\n\n/**\n * Returns a size scaled by a ratio. The result will be an array of integers.\n * @param {Size} size Size.\n * @param {number} ratio Ratio.\n * @param {Size=} opt_size Optional reusable size array.\n * @return {Size} The scaled size.\n */\nexport function scale(size, ratio, opt_size) {\n if (opt_size === undefined) {\n opt_size = [0, 0];\n }\n opt_size[0] = (size[0] * ratio + 0.5) | 0;\n opt_size[1] = (size[1] * ratio + 0.5) | 0;\n return opt_size;\n}\n\n/**\n * Returns an `Size` array for the passed in number (meaning: square) or\n * `Size` array.\n * (meaning: non-square),\n * @param {number|Size} size Width and height.\n * @param {Size=} opt_size Optional reusable size array.\n * @return {Size} Size.\n * @api\n */\nexport function toSize(size, opt_size) {\n if (Array.isArray(size)) {\n return size;\n } else {\n if (opt_size === undefined) {\n opt_size = [size, size];\n } else {\n opt_size[0] = size;\n opt_size[1] = size;\n }\n return opt_size;\n }\n}\n","/**\n * @module ol/style/Image\n */\nimport {abstract} from '../util.js';\nimport {toSize} from '../size.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} opacity\n * @property {boolean} rotateWithView\n * @property {number} rotation\n * @property {number|import(\"../size.js\").Size} scale\n * @property {Array<number>} displacement\n */\n\n/**\n * @classdesc\n * A base class used for creating subclasses and not instantiated in\n * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and\n * {@link module:ol/style/RegularShape~RegularShape}.\n * @abstract\n * @api\n */\nclass ImageStyle {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n /**\n * @private\n * @type {number}\n */\n this.opacity_ = options.opacity;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ = options.rotateWithView;\n\n /**\n * @private\n * @type {number}\n */\n this.rotation_ = options.rotation;\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size}\n */\n this.scale_ = options.scale;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.scaleArray_ = toSize(options.scale);\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.displacement_ = options.displacement;\n }\n\n /**\n * Clones the style.\n * @return {ImageStyle} The cloned style.\n * @api\n */\n clone() {\n const scale = this.getScale();\n return new ImageStyle({\n opacity: this.getOpacity(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n displacement: this.getDisplacement().slice(),\n });\n }\n\n /**\n * Get the symbolizer opacity.\n * @return {number} Opacity.\n * @api\n */\n getOpacity() {\n return this.opacity_;\n }\n\n /**\n * Determine whether the symbolizer rotates with the map.\n * @return {boolean} Rotate with map.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Get the symoblizer rotation.\n * @return {number} Rotation.\n * @api\n */\n getRotation() {\n return this.rotation_;\n }\n\n /**\n * Get the symbolizer scale.\n * @return {number|import(\"../size.js\").Size} Scale.\n * @api\n */\n getScale() {\n return this.scale_;\n }\n\n /**\n * Get the symbolizer scale array.\n * @return {import(\"../size.js\").Size} Scale array.\n */\n getScaleArray() {\n return this.scaleArray_;\n }\n\n /**\n * Get the displacement of the shape\n * @return {Array<number>} Shape's center displacement\n * @api\n */\n getDisplacement() {\n return this.displacement_;\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @abstract\n * @return {Array<number>} Anchor.\n */\n getAnchor() {\n return abstract();\n }\n\n /**\n * Get the image element for the symbolizer.\n * @abstract\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.\n */\n getImage(pixelRatio) {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.\n */\n getHitDetectionImage() {\n return abstract();\n }\n\n /*\n * Get the image pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * */\n getPixelRatio(pixelRatio) {\n return 1;\n }\n\n /**\n * @abstract\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {import(\"../size.js\").Size} Image size.\n */\n getImageSize() {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {import(\"../size.js\").Size} Size of the hit-detection image.\n */\n getHitDetectionImageSize() {\n return abstract();\n }\n\n /**\n * Get the origin of the symbolizer.\n * @abstract\n * @return {Array<number>} Origin.\n */\n getOrigin() {\n return abstract();\n }\n\n /**\n * Get the size of the symbolizer (in pixels).\n * @abstract\n * @return {import(\"../size.js\").Size} Size.\n */\n getSize() {\n return abstract();\n }\n\n /**\n * Set the opacity.\n *\n * @param {number} opacity Opacity.\n * @api\n */\n setOpacity(opacity) {\n this.opacity_ = opacity;\n }\n\n /**\n * Set whether to rotate the style with the view.\n *\n * @param {boolean} rotateWithView Rotate with map.\n * @api\n */\n setRotateWithView(rotateWithView) {\n this.rotateWithView_ = rotateWithView;\n }\n\n /**\n * Set the rotation.\n *\n * @param {number} rotation Rotation.\n * @api\n */\n setRotation(rotation) {\n this.rotation_ = rotation;\n }\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size} scale Scale.\n * @api\n */\n setScale(scale) {\n this.scale_ = scale;\n this.scaleArray_ = toSize(scale);\n }\n\n /**\n * @abstract\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n listenImageChange(listener) {\n abstract();\n }\n\n /**\n * Load not yet loaded URI.\n * @abstract\n */\n load() {\n abstract();\n }\n\n /**\n * @abstract\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n unlistenImageChange(listener) {\n abstract();\n }\n}\n\nexport default ImageStyle;\n","/**\n * @module ol/color\n */\nimport {assert} from './asserts.js';\nimport {clamp} from './math.js';\n\n/**\n * A color represented as a short array [red, green, blue, alpha].\n * red, green, and blue should be integers in the range 0..255 inclusive.\n * alpha should be a float in the range 0..1 inclusive. If no alpha value is\n * given then `1` will be used.\n * @typedef {Array<number>} Color\n * @api\n */\n\n/**\n * This RegExp matches # followed by 3, 4, 6, or 8 hex digits.\n * @const\n * @type {RegExp}\n * @private\n */\nconst HEX_COLOR_RE_ = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i;\n\n/**\n * Regular expression for matching potential named color style strings.\n * @const\n * @type {RegExp}\n * @private\n */\nconst NAMED_COLOR_RE_ = /^([a-z]*)$|^hsla?\\(.*\\)$/i;\n\n/**\n * Return the color as an rgba string.\n * @param {Color|string} color Color.\n * @return {string} Rgba string.\n * @api\n */\nexport function asString(color) {\n if (typeof color === 'string') {\n return color;\n } else {\n return toString(color);\n }\n}\n\n/**\n * Return named color as an rgba string.\n * @param {string} color Named color.\n * @return {string} Rgb string.\n */\nfunction fromNamed(color) {\n const el = document.createElement('div');\n el.style.color = color;\n if (el.style.color !== '') {\n document.body.appendChild(el);\n const rgb = getComputedStyle(el).color;\n document.body.removeChild(el);\n return rgb;\n } else {\n return '';\n }\n}\n\n/**\n * @param {string} s String.\n * @return {Color} Color.\n */\nexport const fromString = (function () {\n // We maintain a small cache of parsed strings. To provide cheap LRU-like\n // semantics, whenever the cache grows too large we simply delete an\n // arbitrary 25% of the entries.\n\n /**\n * @const\n * @type {number}\n */\n const MAX_CACHE_SIZE = 1024;\n\n /**\n * @type {Object<string, Color>}\n */\n const cache = {};\n\n /**\n * @type {number}\n */\n let cacheSize = 0;\n\n return (\n /**\n * @param {string} s String.\n * @return {Color} Color.\n */\n function (s) {\n let color;\n if (cache.hasOwnProperty(s)) {\n color = cache[s];\n } else {\n if (cacheSize >= MAX_CACHE_SIZE) {\n let i = 0;\n for (const key in cache) {\n if ((i++ & 3) === 0) {\n delete cache[key];\n --cacheSize;\n }\n }\n }\n color = fromStringInternal_(s);\n cache[s] = color;\n ++cacheSize;\n }\n return color;\n }\n );\n})();\n\n/**\n * Return the color as an array. This function maintains a cache of calculated\n * arrays which means the result should not be modified.\n * @param {Color|string} color Color.\n * @return {Color} Color.\n * @api\n */\nexport function asArray(color) {\n if (Array.isArray(color)) {\n return color;\n } else {\n return fromString(color);\n }\n}\n\n/**\n * @param {string} s String.\n * @private\n * @return {Color} Color.\n */\nfunction fromStringInternal_(s) {\n let r, g, b, a, color;\n\n if (NAMED_COLOR_RE_.exec(s)) {\n s = fromNamed(s);\n }\n\n if (HEX_COLOR_RE_.exec(s)) {\n // hex\n const n = s.length - 1; // number of hex digits\n let d; // number of digits per channel\n if (n <= 4) {\n d = 1;\n } else {\n d = 2;\n }\n const hasAlpha = n === 4 || n === 8;\n r = parseInt(s.substr(1 + 0 * d, d), 16);\n g = parseInt(s.substr(1 + 1 * d, d), 16);\n b = parseInt(s.substr(1 + 2 * d, d), 16);\n if (hasAlpha) {\n a = parseInt(s.substr(1 + 3 * d, d), 16);\n } else {\n a = 255;\n }\n if (d == 1) {\n r = (r << 4) + r;\n g = (g << 4) + g;\n b = (b << 4) + b;\n if (hasAlpha) {\n a = (a << 4) + a;\n }\n }\n color = [r, g, b, a / 255];\n } else if (s.indexOf('rgba(') == 0) {\n // rgba()\n color = s.slice(5, -1).split(',').map(Number);\n normalize(color);\n } else if (s.indexOf('rgb(') == 0) {\n // rgb()\n color = s.slice(4, -1).split(',').map(Number);\n color.push(1);\n normalize(color);\n } else {\n assert(false, 14); // Invalid color\n }\n return color;\n}\n\n/**\n * TODO this function is only used in the test, we probably shouldn't export it\n * @param {Color} color Color.\n * @return {Color} Clamped color.\n */\nexport function normalize(color) {\n color[0] = clamp((color[0] + 0.5) | 0, 0, 255);\n color[1] = clamp((color[1] + 0.5) | 0, 0, 255);\n color[2] = clamp((color[2] + 0.5) | 0, 0, 255);\n color[3] = clamp(color[3], 0, 1);\n return color;\n}\n\n/**\n * @param {Color} color Color.\n * @return {string} String.\n */\nexport function toString(color) {\n let r = color[0];\n if (r != (r | 0)) {\n r = (r + 0.5) | 0;\n }\n let g = color[1];\n if (g != (g | 0)) {\n g = (g + 0.5) | 0;\n }\n let b = color[2];\n if (b != (b | 0)) {\n b = (b + 0.5) | 0;\n }\n const a = color[3] === undefined ? 1 : color[3];\n return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';\n}\n\n/**\n * @param {string} s String.\n * @return {boolean} Whether the string is actually a valid color\n */\nexport function isStringColor(s) {\n if (NAMED_COLOR_RE_.test(s)) {\n s = fromNamed(s);\n }\n return (\n HEX_COLOR_RE_.test(s) || s.indexOf('rgba(') === 0 || s.indexOf('rgb(') === 0\n );\n}\n","/**\n * @module ol/colorlike\n */\nimport {toString} from './color.js';\n\n/**\n * A type accepted by CanvasRenderingContext2D.fillStyle\n * or CanvasRenderingContext2D.strokeStyle.\n * Represents a color, pattern, or gradient. The origin for patterns and\n * gradients as fill style is an increment of 512 css pixels from map coordinate\n * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image\n * must be a factor of two (2, 4, 8, ..., 512).\n *\n * @typedef {string|CanvasPattern|CanvasGradient} ColorLike\n * @api\n */\n\n/**\n * @param {import(\"./color.js\").Color|ColorLike} color Color.\n * @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}.\n * @api\n */\nexport function asColorLike(color) {\n if (Array.isArray(color)) {\n return toString(color);\n } else {\n return color;\n }\n}\n","/**\n * @module ol/has\n */\n\nconst ua =\n typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined'\n ? navigator.userAgent.toLowerCase()\n : '';\n\n/**\n * User agent string says we are dealing with Firefox as browser.\n * @type {boolean}\n */\nexport const FIREFOX = ua.indexOf('firefox') !== -1;\n\n/**\n * User agent string says we are dealing with Safari as browser.\n * @type {boolean}\n */\nexport const SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1;\n\n/**\n * User agent string says we are dealing with a WebKit engine.\n * @type {boolean}\n */\nexport const WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1;\n\n/**\n * User agent string says we are dealing with a Mac as platform.\n * @type {boolean}\n */\nexport const MAC = ua.indexOf('macintosh') !== -1;\n\n/**\n * The ratio between physical pixels and device-independent pixels\n * (dips) on the device (`window.devicePixelRatio`).\n * @const\n * @type {number}\n * @api\n */\nexport const DEVICE_PIXEL_RATIO =\n typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1;\n\n/**\n * The execution context is a worker with OffscreenCanvas available.\n * @const\n * @type {boolean}\n */\nexport const WORKER_OFFSCREEN_CANVAS =\n typeof WorkerGlobalScope !== 'undefined' &&\n typeof OffscreenCanvas !== 'undefined' &&\n self instanceof WorkerGlobalScope; //eslint-disable-line\n\n/**\n * Image.prototype.decode() is supported.\n * @type {boolean}\n */\nexport const IMAGE_DECODE =\n typeof Image !== 'undefined' && Image.prototype.decode;\n\n/**\n * @type {boolean}\n */\nexport const PASSIVE_EVENT_LISTENERS = (function () {\n let passive = false;\n try {\n const options = Object.defineProperty({}, 'passive', {\n get: function () {\n passive = true;\n },\n });\n\n window.addEventListener('_', null, options);\n window.removeEventListener('_', null, options);\n } catch (error) {\n // passive not supported\n }\n return passive;\n})();\n","import {WORKER_OFFSCREEN_CANVAS} from './has.js';\n\n/**\n * @module ol/dom\n */\n\n//FIXME Move this function to the canvas module\n/**\n * Create an html canvas element and returns its 2d context.\n * @param {number=} opt_width Canvas width.\n * @param {number=} opt_height Canvas height.\n * @param {Array<HTMLCanvasElement>=} opt_canvasPool Canvas pool to take existing canvas from.\n * @return {CanvasRenderingContext2D} The context.\n */\nexport function createCanvasContext2D(opt_width, opt_height, opt_canvasPool) {\n const canvas =\n opt_canvasPool && opt_canvasPool.length\n ? opt_canvasPool.shift()\n : WORKER_OFFSCREEN_CANVAS\n ? new OffscreenCanvas(opt_width || 300, opt_height || 300)\n : document.createElement('canvas');\n if (opt_width) {\n canvas.width = opt_width;\n }\n if (opt_height) {\n canvas.height = opt_height;\n }\n //FIXME Allow OffscreenCanvasRenderingContext2D as return type\n return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));\n}\n\n/**\n * Get the current computed width for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerWidth(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The width.\n */\nexport function outerWidth(element) {\n let width = element.offsetWidth;\n const style = getComputedStyle(element);\n width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);\n\n return width;\n}\n\n/**\n * Get the current computed height for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerHeight(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The height.\n */\nexport function outerHeight(element) {\n let height = element.offsetHeight;\n const style = getComputedStyle(element);\n height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);\n\n return height;\n}\n\n/**\n * @param {Node} newNode Node to replace old node\n * @param {Node} oldNode The node to be replaced\n */\nexport function replaceNode(newNode, oldNode) {\n const parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n}\n\n/**\n * @param {Node} node The node to remove.\n * @returns {Node} The node that was removed or null.\n */\nexport function removeNode(node) {\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n}\n\n/**\n * @param {Node} node The node to remove the children from.\n */\nexport function removeChildren(node) {\n while (node.lastChild) {\n node.removeChild(node.lastChild);\n }\n}\n\n/**\n * Transform the children of a parent node so they match the\n * provided list of children. This function aims to efficiently\n * remove, add, and reorder child nodes while maintaining a simple\n * implementation (it is not guaranteed to minimize DOM operations).\n * @param {Node} node The parent node whose children need reworking.\n * @param {Array<Node>} children The desired children.\n */\nexport function replaceChildren(node, children) {\n const oldChildren = node.childNodes;\n\n for (let i = 0; true; ++i) {\n const oldChild = oldChildren[i];\n const newChild = children[i];\n\n // check if our work is done\n if (!oldChild && !newChild) {\n break;\n }\n\n // check if children match\n if (oldChild === newChild) {\n continue;\n }\n\n // check if a new child needs to be added\n if (!oldChild) {\n node.appendChild(newChild);\n continue;\n }\n\n // check if an old child needs to be removed\n if (!newChild) {\n node.removeChild(oldChild);\n --i;\n continue;\n }\n\n // reorder\n node.insertBefore(newChild, oldChild);\n }\n}\n","/**\n * @module ol/css\n */\n\n/**\n * @typedef {Object} FontParameters\n * @property {string} style\n * @property {string} variant\n * @property {string} weight\n * @property {string} size\n * @property {string} lineHeight\n * @property {string} family\n * @property {Array<string>} families\n */\n\n/**\n * The CSS class for hidden feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_HIDDEN = 'ol-hidden';\n\n/**\n * The CSS class that we'll give the DOM elements to have them selectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_SELECTABLE = 'ol-selectable';\n\n/**\n * The CSS class that we'll give the DOM elements to have them unselectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSELECTABLE = 'ol-unselectable';\n\n/**\n * The CSS class for unsupported feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSUPPORTED = 'ol-unsupported';\n\n/**\n * The CSS class for controls.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_CONTROL = 'ol-control';\n\n/**\n * The CSS class that we'll give the DOM elements that are collapsed, i.e.\n * to those elements which usually can be expanded.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_COLLAPSED = 'ol-collapsed';\n\n/**\n * From http://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font\n * @type {RegExp}\n */\nconst fontRegEx = new RegExp(\n [\n '^\\\\s*(?=(?:(?:[-a-z]+\\\\s*){0,2}(italic|oblique))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(small-caps))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',\n '(?:(?:normal|\\\\1|\\\\2|\\\\3)\\\\s*){0,3}((?:xx?-)?',\n '(?:small|large)|medium|smaller|larger|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx]))',\n '(?:\\\\s*\\\\/\\\\s*(normal|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx])?))',\n '?\\\\s*([-,\\\\\"\\\\\\'\\\\sa-z]+?)\\\\s*$',\n ].join(''),\n 'i'\n);\nconst fontRegExMatchIndex = [\n 'style',\n 'variant',\n 'weight',\n 'size',\n 'lineHeight',\n 'family',\n];\n\n/**\n * Get the list of font families from a font spec. Note that this doesn't work\n * for font families that have commas in them.\n * @param {string} fontSpec The CSS font property.\n * @return {FontParameters} The font parameters (or null if the input spec is invalid).\n */\nexport const getFontParameters = function (fontSpec) {\n const match = fontSpec.match(fontRegEx);\n if (!match) {\n return null;\n }\n const style = /** @type {FontParameters} */ ({\n lineHeight: 'normal',\n size: '1.2em',\n style: 'normal',\n weight: 'normal',\n variant: 'normal',\n });\n for (let i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {\n const value = match[i + 1];\n if (value !== undefined) {\n style[fontRegExMatchIndex[i]] = value;\n }\n }\n style.families = style.family.split(/,\\s?/);\n return style;\n};\n","/**\n * @module ol/render/canvas\n */\nimport BaseObject from '../Object.js';\nimport EventTarget from '../events/Target.js';\nimport {WORKER_OFFSCREEN_CANVAS} from '../has.js';\nimport {clear} from '../obj.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {getFontParameters} from '../css.js';\nimport {toString} from '../transform.js';\n\n/**\n * @typedef {Object} FillState\n * @property {import(\"../colorlike.js\").ColorLike} fillStyle\n */\n\n/**\n * @typedef Label\n * @property {number} width\n * @property {number} height\n * @property {Array<string|number>} contextInstructions\n */\n\n/**\n * @typedef {Object} FillStrokeState\n * @property {import(\"../colorlike.js\").ColorLike} [currentFillStyle]\n * @property {import(\"../colorlike.js\").ColorLike} [currentStrokeStyle]\n * @property {CanvasLineCap} [currentLineCap]\n * @property {Array<number>} currentLineDash\n * @property {number} [currentLineDashOffset]\n * @property {CanvasLineJoin} [currentLineJoin]\n * @property {number} [currentLineWidth]\n * @property {number} [currentMiterLimit]\n * @property {number} [lastStroke]\n * @property {import(\"../colorlike.js\").ColorLike} [fillStyle]\n * @property {import(\"../colorlike.js\").ColorLike} [strokeStyle]\n * @property {CanvasLineCap} [lineCap]\n * @property {Array<number>} lineDash\n * @property {number} [lineDashOffset]\n * @property {CanvasLineJoin} [lineJoin]\n * @property {number} [lineWidth]\n * @property {number} [miterLimit]\n */\n\n/**\n * @typedef {Object} StrokeState\n * @property {CanvasLineCap} lineCap\n * @property {Array<number>} lineDash\n * @property {number} lineDashOffset\n * @property {CanvasLineJoin} lineJoin\n * @property {number} lineWidth\n * @property {number} miterLimit\n * @property {import(\"../colorlike.js\").ColorLike} strokeStyle\n */\n\n/**\n * @typedef {Object} TextState\n * @property {string} font\n * @property {string} [textAlign]\n * @property {string} textBaseline\n * @property {string} [placement]\n * @property {number} [maxAngle]\n * @property {boolean} [overflow]\n * @property {import(\"../style/Fill.js\").default} [backgroundFill]\n * @property {import(\"../style/Stroke.js\").default} [backgroundStroke]\n * @property {import(\"../size.js\").Size} [scale]\n * @property {Array<number>} [padding]\n */\n\n/**\n * Container for decluttered replay instructions that need to be rendered or\n * omitted together, i.e. when styles render both an image and text, or for the\n * characters that form text along lines. The basic elements of this array are\n * `[minX, minY, maxX, maxY, count]`, where the first four entries are the\n * rendered extent of the group in pixel space. `count` is the number of styles\n * in the group, i.e. 2 when an image and a text are grouped, or 1 otherwise.\n * In addition to these four elements, declutter instruction arrays (i.e. the\n * arguments to {@link module:ol/render/canvas~drawImage} are appended to the array.\n * @typedef {Array<*>} DeclutterGroup\n */\n\n/**\n * Declutter groups for support of multi geometries.\n * @typedef {Array<DeclutterGroup>} DeclutterGroups\n */\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultFont = '10px sans-serif';\n\n/**\n * @const\n * @type {import(\"../colorlike.js\").ColorLike}\n */\nexport const defaultFillStyle = '#000';\n\n/**\n * @const\n * @type {CanvasLineCap}\n */\nexport const defaultLineCap = 'round';\n\n/**\n * @const\n * @type {Array<number>}\n */\nexport const defaultLineDash = [];\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultLineDashOffset = 0;\n\n/**\n * @const\n * @type {CanvasLineJoin}\n */\nexport const defaultLineJoin = 'round';\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultMiterLimit = 10;\n\n/**\n * @const\n * @type {import(\"../colorlike.js\").ColorLike}\n */\nexport const defaultStrokeStyle = '#000';\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultTextAlign = 'center';\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultTextBaseline = 'middle';\n\n/**\n * @const\n * @type {Array<number>}\n */\nexport const defaultPadding = [0, 0, 0, 0];\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultLineWidth = 1;\n\n/**\n * @type {BaseObject}\n */\nexport const checkedFonts = new BaseObject();\n\n/**\n * The label cache for text rendering. To change the default cache size of 2048\n * entries, use {@link module:ol/structs/LRUCache#setSize}.\n * Deprecated - there is no label cache any more.\n * @type {?}\n * @api\n * @deprecated\n */\nexport const labelCache = new EventTarget();\nlabelCache.setSize = function () {\n console.warn('labelCache is deprecated.'); //eslint-disable-line\n};\n\n/**\n * @type {CanvasRenderingContext2D}\n */\nlet measureContext = null;\n\n/**\n * @type {string}\n */\nlet measureFont;\n\n/**\n * @type {!Object<string, number>}\n */\nexport const textHeights = {};\n\n/**\n * Clears the label cache when a font becomes available.\n * @param {string} fontSpec CSS font spec.\n */\nexport const registerFont = (function () {\n const retries = 100;\n const size = '32px ';\n const referenceFonts = ['monospace', 'serif'];\n const len = referenceFonts.length;\n const text = 'wmytzilWMYTZIL@#/&?$%10\\uF013';\n let interval, referenceWidth;\n\n /**\n * @param {string} fontStyle Css font-style\n * @param {string} fontWeight Css font-weight\n * @param {*} fontFamily Css font-family\n * @return {boolean} Font with style and weight is available\n */\n function isAvailable(fontStyle, fontWeight, fontFamily) {\n let available = true;\n for (let i = 0; i < len; ++i) {\n const referenceFont = referenceFonts[i];\n referenceWidth = measureTextWidth(\n fontStyle + ' ' + fontWeight + ' ' + size + referenceFont,\n text\n );\n if (fontFamily != referenceFont) {\n const width = measureTextWidth(\n fontStyle +\n ' ' +\n fontWeight +\n ' ' +\n size +\n fontFamily +\n ',' +\n referenceFont,\n text\n );\n // If width and referenceWidth are the same, then the fallback was used\n // instead of the font we wanted, so the font is not available.\n available = available && width != referenceWidth;\n }\n }\n if (available) {\n return true;\n }\n return false;\n }\n\n function check() {\n let done = true;\n const fonts = checkedFonts.getKeys();\n for (let i = 0, ii = fonts.length; i < ii; ++i) {\n const font = fonts[i];\n if (checkedFonts.get(font) < retries) {\n if (isAvailable.apply(this, font.split('\\n'))) {\n clear(textHeights);\n // Make sure that loaded fonts are picked up by Safari\n measureContext = null;\n measureFont = undefined;\n checkedFonts.set(font, retries);\n } else {\n checkedFonts.set(font, checkedFonts.get(font) + 1, true);\n done = false;\n }\n }\n }\n if (done) {\n clearInterval(interval);\n interval = undefined;\n }\n }\n\n return function (fontSpec) {\n const font = getFontParameters(fontSpec);\n if (!font) {\n return;\n }\n const families = font.families;\n for (let i = 0, ii = families.length; i < ii; ++i) {\n const family = families[i];\n const key = font.style + '\\n' + font.weight + '\\n' + family;\n if (checkedFonts.get(key) === undefined) {\n checkedFonts.set(key, retries, true);\n if (!isAvailable(font.style, font.weight, family)) {\n checkedFonts.set(key, 0, true);\n if (interval === undefined) {\n interval = setInterval(check, 32);\n }\n }\n }\n }\n };\n})();\n\n/**\n * @param {string} font Font to use for measuring.\n * @return {import(\"../size.js\").Size} Measurement.\n */\nexport const measureTextHeight = (function () {\n /**\n * @type {HTMLDivElement}\n */\n let div;\n const heights = textHeights;\n return function (fontSpec) {\n let height = heights[fontSpec];\n if (height == undefined) {\n if (WORKER_OFFSCREEN_CANVAS) {\n const font = getFontParameters(fontSpec);\n const metrics = measureText(fontSpec, 'Žg');\n const lineHeight = isNaN(Number(font.lineHeight))\n ? 1.2\n : Number(font.lineHeight);\n textHeights[fontSpec] =\n lineHeight *\n (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);\n } else {\n if (!div) {\n div = document.createElement('div');\n div.innerHTML = 'M';\n div.style.margin = '0 !important';\n div.style.padding = '0 !important';\n div.style.position = 'absolute !important';\n div.style.left = '-99999px !important';\n }\n div.style.font = fontSpec;\n document.body.appendChild(div);\n height = div.offsetHeight;\n heights[fontSpec] = height;\n document.body.removeChild(div);\n }\n }\n return height;\n };\n})();\n\n/**\n * @param {string} font Font.\n * @param {string} text Text.\n * @return {TextMetrics} Text metrics.\n */\nfunction measureText(font, text) {\n if (!measureContext) {\n measureContext = createCanvasContext2D(1, 1);\n }\n if (font != measureFont) {\n measureContext.font = font;\n measureFont = measureContext.font;\n }\n return measureContext.measureText(text);\n}\n\n/**\n * @param {string} font Font.\n * @param {string} text Text.\n * @return {number} Width.\n */\nexport function measureTextWidth(font, text) {\n return measureText(font, text).width;\n}\n\n/**\n * Measure text width using a cache.\n * @param {string} font The font.\n * @param {string} text The text to measure.\n * @param {Object<string, number>} cache A lookup of cached widths by text.\n * @returns {number} The text width.\n */\nexport function measureAndCacheTextWidth(font, text, cache) {\n if (text in cache) {\n return cache[text];\n }\n const width = measureTextWidth(font, text);\n cache[text] = width;\n return width;\n}\n\n/**\n * @param {string} font Font to use for measuring.\n * @param {Array<string>} lines Lines to measure.\n * @param {Array<number>} widths Array will be populated with the widths of\n * each line.\n * @return {number} Width of the whole text.\n */\nexport function measureTextWidths(font, lines, widths) {\n const numLines = lines.length;\n let width = 0;\n for (let i = 0; i < numLines; ++i) {\n const currentWidth = measureTextWidth(font, lines[i]);\n width = Math.max(width, currentWidth);\n widths.push(currentWidth);\n }\n return width;\n}\n\n/**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} rotation Rotation.\n * @param {number} offsetX X offset.\n * @param {number} offsetY Y offset.\n */\nexport function rotateAtOffset(context, rotation, offsetX, offsetY) {\n if (rotation !== 0) {\n context.translate(offsetX, offsetY);\n context.rotate(rotation);\n context.translate(-offsetX, -offsetY);\n }\n}\n\n/**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../transform.js\").Transform|null} transform Transform.\n * @param {number} opacity Opacity.\n * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.\n * @param {number} originX Origin X.\n * @param {number} originY Origin Y.\n * @param {number} w Width.\n * @param {number} h Height.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../size.js\").Size} scale Scale.\n */\nexport function drawImageOrLabel(\n context,\n transform,\n opacity,\n labelOrImage,\n originX,\n originY,\n w,\n h,\n x,\n y,\n scale\n) {\n context.save();\n\n if (opacity !== 1) {\n context.globalAlpha *= opacity;\n }\n if (transform) {\n context.setTransform.apply(context, transform);\n }\n\n if (/** @type {*} */ (labelOrImage).contextInstructions) {\n // label\n context.translate(x, y);\n context.scale(scale[0], scale[1]);\n executeLabelInstructions(/** @type {Label} */ (labelOrImage), context);\n } else if (scale[0] < 0 || scale[1] < 0) {\n // flipped image\n context.translate(x, y);\n context.scale(scale[0], scale[1]);\n context.drawImage(\n /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage),\n originX,\n originY,\n w,\n h,\n 0,\n 0,\n w,\n h\n );\n } else {\n // if image not flipped translate and scale can be avoided\n context.drawImage(\n /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage),\n originX,\n originY,\n w,\n h,\n x,\n y,\n w * scale[0],\n h * scale[1]\n );\n }\n\n context.restore();\n}\n\n/**\n * @param {Label} label Label.\n * @param {CanvasRenderingContext2D} context Context.\n */\nfunction executeLabelInstructions(label, context) {\n const contextInstructions = label.contextInstructions;\n for (let i = 0, ii = contextInstructions.length; i < ii; i += 2) {\n if (Array.isArray(contextInstructions[i + 1])) {\n context[contextInstructions[i]].apply(\n context,\n contextInstructions[i + 1]\n );\n } else {\n context[contextInstructions[i]] = contextInstructions[i + 1];\n }\n }\n}\n\n/**\n * @type {HTMLCanvasElement}\n * @private\n */\nlet createTransformStringCanvas = null;\n\n/**\n * @param {import(\"../transform.js\").Transform} transform Transform.\n * @return {string} CSS transform.\n */\nexport function createTransformString(transform) {\n if (WORKER_OFFSCREEN_CANVAS) {\n return toString(transform);\n } else {\n if (!createTransformStringCanvas) {\n createTransformStringCanvas = createCanvasContext2D(1, 1).canvas;\n }\n createTransformStringCanvas.style.transform = toString(transform);\n return createTransformStringCanvas.style.transform;\n }\n}\n","/**\n * @module ol/style/RegularShape\n */\n\nimport ImageState from '../ImageState.js';\nimport ImageStyle from './Image.js';\nimport {asArray} from '../color.js';\nimport {asColorLike} from '../colorlike.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {\n defaultFillStyle,\n defaultLineCap,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n} from '../render/canvas.js';\n\n/**\n * Specify radius for regular polygons, or radius1 and radius2 for stars.\n * @typedef {Object} Options\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points\n * is the number of sides.\n * @property {number} [radius] Radius of a regular polygon.\n * @property {number} [radius1] Outer radius of a star.\n * @property {number} [radius2] Inner radius of a star.\n * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.\n * @property {Array<number>} [displacement=[0,0]] Displacement of the shape\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.\n */\n\n/**\n * @typedef {Object} RenderOptions\n * @property {import(\"../colorlike.js\").ColorLike} [strokeStyle]\n * @property {number} strokeWidth\n * @property {number} size\n * @property {CanvasLineCap} lineCap\n * @property {Array<number>} lineDash\n * @property {number} lineDashOffset\n * @property {CanvasLineJoin} lineJoin\n * @property {number} miterLimit\n */\n\n/**\n * @classdesc\n * Set regular shape style for vector features. The resulting shape will be\n * a regular polygon when `radius` is provided, or a star when `radius1` and\n * `radius2` are provided.\n * @api\n */\nclass RegularShape extends ImageStyle {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n /**\n * @type {boolean}\n */\n const rotateWithView =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n super({\n opacity: 1,\n rotateWithView: rotateWithView,\n rotation: options.rotation !== undefined ? options.rotation : 0,\n scale: 1,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n });\n\n /**\n * @private\n * @type {Object<number, HTMLCanvasElement>}\n */\n this.canvas_ = {};\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.hitDetectionCanvas_ = null;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default}\n */\n this.fill_ = options.fill !== undefined ? options.fill : null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.origin_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.points_ = options.points;\n\n /**\n * @protected\n * @type {number}\n */\n this.radius_ =\n options.radius !== undefined ? options.radius : options.radius1;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.radius2_ = options.radius2;\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = options.angle !== undefined ? options.angle : 0;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.imageSize_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.hitDetectionImageSize_ = null;\n\n this.render();\n }\n\n /**\n * Clones the style.\n * @return {RegularShape} The cloned style.\n * @api\n */\n clone() {\n const style = new RegularShape({\n fill: this.getFill() ? this.getFill().clone() : undefined,\n points: this.getPoints(),\n radius: this.getRadius(),\n radius2: this.getRadius2(),\n angle: this.getAngle(),\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n displacement: this.getDisplacement().slice(),\n });\n style.setOpacity(this.getOpacity());\n style.setScale(this.getScale());\n return style;\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @return {Array<number>} Anchor.\n * @api\n */\n getAnchor() {\n return this.anchor_;\n }\n\n /**\n * Get the angle used in generating the shape.\n * @return {number} Shape's rotation in radians.\n * @api\n */\n getAngle() {\n return this.angle_;\n }\n\n /**\n * Get the fill style for the shape.\n * @return {import(\"./Fill.js\").default} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * @return {HTMLCanvasElement} Image element.\n */\n getHitDetectionImage() {\n if (!this.hitDetectionCanvas_) {\n const renderOptions = this.createRenderOptions();\n\n this.createHitDetectionCanvas_(renderOptions);\n }\n return this.hitDetectionCanvas_;\n }\n\n /**\n * Get the image icon.\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLCanvasElement} Image or Canvas element.\n * @api\n */\n getImage(pixelRatio) {\n if (!this.canvas_[pixelRatio || 1]) {\n const renderOptions = this.createRenderOptions();\n\n const context = createCanvasContext2D(\n renderOptions.size * pixelRatio || 1,\n renderOptions.size * pixelRatio || 1\n );\n\n this.draw_(renderOptions, context, 0, 0, pixelRatio || 1);\n\n this.canvas_[pixelRatio || 1] = context.canvas;\n }\n return this.canvas_[pixelRatio || 1];\n }\n\n /*\n * Get the image pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * */\n getPixelRatio(pixelRatio) {\n return pixelRatio;\n }\n\n /**\n * @return {import(\"../size.js\").Size} Image size.\n */\n getImageSize() {\n return this.imageSize_;\n }\n\n /**\n * @return {import(\"../size.js\").Size} Size of the hit-detection image.\n */\n getHitDetectionImageSize() {\n return this.hitDetectionImageSize_;\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return ImageState.LOADED;\n }\n\n /**\n * Get the origin of the symbolizer.\n * @return {Array<number>} Origin.\n * @api\n */\n getOrigin() {\n return this.origin_;\n }\n\n /**\n * Get the number of points for generating the shape.\n * @return {number} Number of points for stars and regular polygons.\n * @api\n */\n getPoints() {\n return this.points_;\n }\n\n /**\n * Get the (primary) radius for the shape.\n * @return {number} Radius.\n * @api\n */\n getRadius() {\n return this.radius_;\n }\n\n /**\n * Get the secondary radius for the shape.\n * @return {number|undefined} Radius2.\n * @api\n */\n getRadius2() {\n return this.radius2_;\n }\n\n /**\n * Get the size of the symbolizer (in pixels).\n * @return {import(\"../size.js\").Size} Size.\n * @api\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * Get the stroke style for the shape.\n * @return {import(\"./Stroke.js\").default} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n listenImageChange(listener) {}\n\n /**\n * Load not yet loaded URI.\n */\n load() {}\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n unlistenImageChange(listener) {}\n\n /**\n * @returns {RenderOptions} The render options\n * @protected\n */\n createRenderOptions() {\n let lineCap = defaultLineCap;\n let lineJoin = defaultLineJoin;\n let miterLimit = 0;\n let lineDash = null;\n let lineDashOffset = 0;\n let strokeStyle;\n let strokeWidth = 0;\n\n if (this.stroke_) {\n strokeStyle = this.stroke_.getColor();\n if (strokeStyle === null) {\n strokeStyle = defaultStrokeStyle;\n }\n strokeStyle = asColorLike(strokeStyle);\n strokeWidth = this.stroke_.getWidth();\n if (strokeWidth === undefined) {\n strokeWidth = defaultLineWidth;\n }\n lineDash = this.stroke_.getLineDash();\n lineDashOffset = this.stroke_.getLineDashOffset();\n lineJoin = this.stroke_.getLineJoin();\n if (lineJoin === undefined) {\n lineJoin = defaultLineJoin;\n }\n lineCap = this.stroke_.getLineCap();\n if (lineCap === undefined) {\n lineCap = defaultLineCap;\n }\n miterLimit = this.stroke_.getMiterLimit();\n if (miterLimit === undefined) {\n miterLimit = defaultMiterLimit;\n }\n }\n\n const size = 2 * (this.radius_ + strokeWidth) + 1;\n\n return {\n strokeStyle: strokeStyle,\n strokeWidth: strokeWidth,\n size: size,\n lineCap: lineCap,\n lineDash: lineDash,\n lineDashOffset: lineDashOffset,\n lineJoin: lineJoin,\n miterLimit: miterLimit,\n };\n }\n\n /**\n * @protected\n */\n render() {\n const renderOptions = this.createRenderOptions();\n\n const context = createCanvasContext2D(\n renderOptions.size,\n renderOptions.size\n );\n\n this.draw_(renderOptions, context, 0, 0, 1);\n\n this.canvas_[1] = context.canvas;\n\n // canvas.width and height are rounded to the closest integer\n const size = context.canvas.width;\n const imageSize = size;\n const displacement = this.getDisplacement();\n\n this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];\n this.createHitDetectionCanvas_(renderOptions);\n\n this.anchor_ = [size / 2 - displacement[0], size / 2 + displacement[1]];\n this.size_ = [size, size];\n this.imageSize_ = [imageSize, imageSize];\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @param {CanvasRenderingContext2D} context The rendering context.\n * @param {number} x The origin for the symbol (x).\n * @param {number} y The origin for the symbol (y).\n * @param {number} pixelRatio The pixel ratio.\n */\n draw_(renderOptions, context, x, y, pixelRatio) {\n let i, angle0, radiusC;\n\n // reset transform\n context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n\n // then move to (x, y)\n context.translate(x, y);\n\n context.beginPath();\n\n let points = this.points_;\n if (points === Infinity) {\n context.arc(\n renderOptions.size / 2,\n renderOptions.size / 2,\n this.radius_,\n 0,\n 2 * Math.PI,\n true\n );\n } else {\n const radius2 =\n this.radius2_ !== undefined ? this.radius2_ : this.radius_;\n if (radius2 !== this.radius_) {\n points = 2 * points;\n }\n for (i = 0; i <= points; i++) {\n angle0 = (i * 2 * Math.PI) / points - Math.PI / 2 + this.angle_;\n radiusC = i % 2 === 0 ? this.radius_ : radius2;\n context.lineTo(\n renderOptions.size / 2 + radiusC * Math.cos(angle0),\n renderOptions.size / 2 + radiusC * Math.sin(angle0)\n );\n }\n }\n\n if (this.fill_) {\n let color = this.fill_.getColor();\n if (color === null) {\n color = defaultFillStyle;\n }\n context.fillStyle = asColorLike(color);\n context.fill();\n }\n if (this.stroke_) {\n context.strokeStyle = renderOptions.strokeStyle;\n context.lineWidth = renderOptions.strokeWidth;\n if (context.setLineDash && renderOptions.lineDash) {\n context.setLineDash(renderOptions.lineDash);\n context.lineDashOffset = renderOptions.lineDashOffset;\n }\n context.lineCap = renderOptions.lineCap;\n context.lineJoin = renderOptions.lineJoin;\n context.miterLimit = renderOptions.miterLimit;\n context.stroke();\n }\n context.closePath();\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n */\n createHitDetectionCanvas_(renderOptions) {\n this.hitDetectionCanvas_ = this.getImage(1);\n if (this.fill_) {\n let color = this.fill_.getColor();\n\n // determine if fill is transparent (or pattern or gradient)\n let opacity = 0;\n if (typeof color === 'string') {\n color = asArray(color);\n }\n if (color === null) {\n opacity = 1;\n } else if (Array.isArray(color)) {\n opacity = color.length === 4 ? color[3] : 1;\n }\n if (opacity === 0) {\n // if a transparent fill style is set, create an extra hit-detection image\n // with a default fill style\n const context = createCanvasContext2D(\n renderOptions.size,\n renderOptions.size\n );\n this.hitDetectionCanvas_ = context.canvas;\n\n this.drawHitDetectionCanvas_(renderOptions, context, 0, 0);\n }\n }\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @param {CanvasRenderingContext2D} context The context.\n * @param {number} x The origin for the symbol (x).\n * @param {number} y The origin for the symbol (y).\n */\n drawHitDetectionCanvas_(renderOptions, context, x, y) {\n // move to (x, y)\n context.translate(x, y);\n\n context.beginPath();\n\n let points = this.points_;\n if (points === Infinity) {\n context.arc(\n renderOptions.size / 2,\n renderOptions.size / 2,\n this.radius_,\n 0,\n 2 * Math.PI,\n true\n );\n } else {\n const radius2 =\n this.radius2_ !== undefined ? this.radius2_ : this.radius_;\n if (radius2 !== this.radius_) {\n points = 2 * points;\n }\n let i, radiusC, angle0;\n for (i = 0; i <= points; i++) {\n angle0 = (i * 2 * Math.PI) / points - Math.PI / 2 + this.angle_;\n radiusC = i % 2 === 0 ? this.radius_ : radius2;\n context.lineTo(\n renderOptions.size / 2 + radiusC * Math.cos(angle0),\n renderOptions.size / 2 + radiusC * Math.sin(angle0)\n );\n }\n }\n\n context.fillStyle = defaultFillStyle;\n context.fill();\n if (this.stroke_) {\n context.strokeStyle = renderOptions.strokeStyle;\n context.lineWidth = renderOptions.strokeWidth;\n if (renderOptions.lineDash) {\n context.setLineDash(renderOptions.lineDash);\n context.lineDashOffset = renderOptions.lineDashOffset;\n }\n context.stroke();\n }\n context.closePath();\n }\n}\n\nexport default RegularShape;\n","/**\n * @module ol/style/Circle\n */\n\nimport RegularShape from './RegularShape.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {number} radius Circle radius.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {Array<number>} [displacement=[0,0]] displacement\n */\n\n/**\n * @classdesc\n * Set circle style for vector features.\n * @api\n */\nclass CircleStyle extends RegularShape {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n points: Infinity,\n fill: options.fill,\n radius: options.radius,\n stroke: options.stroke,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n });\n }\n\n /**\n * Clones the style.\n * @return {CircleStyle} The cloned style.\n * @api\n */\n clone() {\n const style = new CircleStyle({\n fill: this.getFill() ? this.getFill().clone() : undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n radius: this.getRadius(),\n displacement: this.getDisplacement().slice(),\n });\n style.setOpacity(this.getOpacity());\n style.setScale(this.getScale());\n return style;\n }\n\n /**\n * Set the circle radius.\n *\n * @param {number} radius Circle radius.\n * @api\n */\n setRadius(radius) {\n this.radius_ = radius;\n this.render();\n }\n}\n\nexport default CircleStyle;\n","/**\n * @module ol/style/Style\n */\n\nimport CircleStyle from './Circle.js';\nimport Fill from './Fill.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport Stroke from './Stroke.js';\nimport {assert} from '../asserts.js';\n\n/**\n * A function that takes an {@link module:ol/Feature} and a `{number}`\n * representing the view's resolution. The function should return a\n * {@link module:ol/style/Style} or an array of them. This way e.g. a\n * vector layer can be styled. If the function returns `undefined`, the\n * feature will not be rendered.\n *\n * @typedef {function(import(\"../Feature.js\").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction\n */\n\n/**\n * A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}.\n * @typedef {Style|Array<Style>|StyleFunction} StyleLike\n */\n\n/**\n * A function that takes an {@link module:ol/Feature} as argument and returns an\n * {@link module:ol/geom/Geometry} that will be rendered and styled for the feature.\n *\n * @typedef {function(import(\"../Feature.js\").FeatureLike):\n * (import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default|undefined)} GeometryFunction\n */\n\n/**\n * Custom renderer function. Takes two arguments:\n *\n * 1. The pixel coordinates of the geometry in GeoJSON notation.\n * 2. The {@link module:ol/render~State} of the layer renderer.\n *\n * @typedef {function((import(\"../coordinate.js\").Coordinate|Array<import(\"../coordinate.js\").Coordinate>|Array<Array<import(\"../coordinate.js\").Coordinate>>),import(\"../render.js\").State): void}\n * RenderFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {string|import(\"../geom/Geometry.js\").default|GeometryFunction} [geometry] Feature property or geometry\n * or function returning a geometry to render for this style.\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {import(\"./Image.js\").default} [image] Image style.\n * @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be\n * ignored, and the provided function will be called with each render frame for each geometry.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {import(\"./Text.js\").default} [text] Text style.\n * @property {number} [zIndex] Z index.\n */\n\n/**\n * @classdesc\n * Container for vector feature rendering styles. Any changes made to the style\n * or its children through `set*()` methods will not take effect until the\n * feature or layer that uses the style is re-rendered.\n *\n * ## Feature styles\n *\n * If no style is defined, the following default style is used:\n * ```js\n * import {Fill, Stroke, Circle, Style} from 'ol/style';\n *\n * var fill = new Fill({\n * color: 'rgba(255,255,255,0.4)'\n * });\n * var stroke = new Stroke({\n * color: '#3399CC',\n * width: 1.25\n * });\n * var styles = [\n * new Style({\n * image: new Circle({\n * fill: fill,\n * stroke: stroke,\n * radius: 5\n * }),\n * fill: fill,\n * stroke: stroke\n * })\n * ];\n * ```\n *\n * A separate editing style has the following defaults:\n * ```js\n * import {Fill, Stroke, Circle, Style} from 'ol/style';\n * import GeometryType from 'ol/geom/GeometryType';\n *\n * var white = [255, 255, 255, 1];\n * var blue = [0, 153, 255, 1];\n * var width = 3;\n * styles[GeometryType.POLYGON] = [\n * new Style({\n * fill: new Fill({\n * color: [255, 255, 255, 0.5]\n * })\n * })\n * ];\n * styles[GeometryType.MULTI_POLYGON] =\n * styles[GeometryType.POLYGON];\n * styles[GeometryType.LINE_STRING] = [\n * new Style({\n * stroke: new Stroke({\n * color: white,\n * width: width + 2\n * })\n * }),\n * new Style({\n * stroke: new Stroke({\n * color: blue,\n * width: width\n * })\n * })\n * ];\n * styles[GeometryType.MULTI_LINE_STRING] =\n * styles[GeometryType.LINE_STRING];\n * styles[GeometryType.POINT] = [\n * new Style({\n * image: new Circle({\n * radius: width * 2,\n * fill: new Fill({\n * color: blue\n * }),\n * stroke: new Stroke({\n * color: white,\n * width: width / 2\n * })\n * }),\n * zIndex: Infinity\n * })\n * ];\n * styles[GeometryType.MULTI_POINT] =\n * styles[GeometryType.POINT];\n * styles[GeometryType.GEOMETRY_COLLECTION] =\n * styles[GeometryType.POLYGON].concat(\n * styles[GeometryType.LINE_STRING],\n * styles[GeometryType.POINT]\n * );\n * ```\n *\n * @api\n */\nclass Style {\n /**\n * @param {Options=} opt_options Style options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n /**\n * @private\n * @type {string|import(\"../geom/Geometry.js\").default|GeometryFunction}\n */\n this.geometry_ = null;\n\n /**\n * @private\n * @type {!GeometryFunction}\n */\n this.geometryFunction_ = defaultGeometryFunction;\n\n if (options.geometry !== undefined) {\n this.setGeometry(options.geometry);\n }\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default}\n */\n this.fill_ = options.fill !== undefined ? options.fill : null;\n\n /**\n * @private\n * @type {import(\"./Image.js\").default}\n */\n this.image_ = options.image !== undefined ? options.image : null;\n\n /**\n * @private\n * @type {RenderFunction|null}\n */\n this.renderer_ = options.renderer !== undefined ? options.renderer : null;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {import(\"./Text.js\").default}\n */\n this.text_ = options.text !== undefined ? options.text : null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.zIndex_ = options.zIndex;\n }\n\n /**\n * Clones the style.\n * @return {Style} The cloned style.\n * @api\n */\n clone() {\n let geometry = this.getGeometry();\n if (geometry && typeof geometry === 'object') {\n geometry = /** @type {import(\"../geom/Geometry.js\").default} */ (geometry).clone();\n }\n return new Style({\n geometry: geometry,\n fill: this.getFill() ? this.getFill().clone() : undefined,\n image: this.getImage() ? this.getImage().clone() : undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n text: this.getText() ? this.getText().clone() : undefined,\n zIndex: this.getZIndex(),\n });\n }\n\n /**\n * Get the custom renderer function that was configured with\n * {@link #setRenderer} or the `renderer` constructor option.\n * @return {RenderFunction|null} Custom renderer function.\n * @api\n */\n getRenderer() {\n return this.renderer_;\n }\n\n /**\n * Sets a custom renderer function for this style. When set, `fill`, `stroke`\n * and `image` options of the style will be ignored.\n * @param {RenderFunction|null} renderer Custom renderer function.\n * @api\n */\n setRenderer(renderer) {\n this.renderer_ = renderer;\n }\n\n /**\n * Get the geometry to be rendered.\n * @return {string|import(\"../geom/Geometry.js\").default|GeometryFunction}\n * Feature property or geometry or function that returns the geometry that will\n * be rendered with this style.\n * @api\n */\n getGeometry() {\n return this.geometry_;\n }\n\n /**\n * Get the function used to generate a geometry for rendering.\n * @return {!GeometryFunction} Function that is called with a feature\n * and returns the geometry to render instead of the feature's geometry.\n * @api\n */\n getGeometryFunction() {\n return this.geometryFunction_;\n }\n\n /**\n * Get the fill style.\n * @return {import(\"./Fill.js\").default} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * Set the fill style.\n * @param {import(\"./Fill.js\").default} fill Fill style.\n * @api\n */\n setFill(fill) {\n this.fill_ = fill;\n }\n\n /**\n * Get the image style.\n * @return {import(\"./Image.js\").default} Image style.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Set the image style.\n * @param {import(\"./Image.js\").default} image Image style.\n * @api\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * Get the stroke style.\n * @return {import(\"./Stroke.js\").default} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * Set the stroke style.\n * @param {import(\"./Stroke.js\").default} stroke Stroke style.\n * @api\n */\n setStroke(stroke) {\n this.stroke_ = stroke;\n }\n\n /**\n * Get the text style.\n * @return {import(\"./Text.js\").default} Text style.\n * @api\n */\n getText() {\n return this.text_;\n }\n\n /**\n * Set the text style.\n * @param {import(\"./Text.js\").default} text Text style.\n * @api\n */\n setText(text) {\n this.text_ = text;\n }\n\n /**\n * Get the z-index for the style.\n * @return {number|undefined} ZIndex.\n * @api\n */\n getZIndex() {\n return this.zIndex_;\n }\n\n /**\n * Set a geometry that is rendered instead of the feature's geometry.\n *\n * @param {string|import(\"../geom/Geometry.js\").default|GeometryFunction} geometry\n * Feature property or geometry or function returning a geometry to render\n * for this style.\n * @api\n */\n setGeometry(geometry) {\n if (typeof geometry === 'function') {\n this.geometryFunction_ = geometry;\n } else if (typeof geometry === 'string') {\n this.geometryFunction_ = function (feature) {\n return /** @type {import(\"../geom/Geometry.js\").default} */ (feature.get(\n geometry\n ));\n };\n } else if (!geometry) {\n this.geometryFunction_ = defaultGeometryFunction;\n } else if (geometry !== undefined) {\n this.geometryFunction_ = function () {\n return /** @type {import(\"../geom/Geometry.js\").default} */ (geometry);\n };\n }\n this.geometry_ = geometry;\n }\n\n /**\n * Set the z-index.\n *\n * @param {number|undefined} zIndex ZIndex.\n * @api\n */\n setZIndex(zIndex) {\n this.zIndex_ = zIndex;\n }\n}\n\n/**\n * Convert the provided object into a style function. Functions passed through\n * unchanged. Arrays of Style or single style objects wrapped in a\n * new style function.\n * @param {StyleFunction|Array<Style>|Style} obj\n * A style function, a single style, or an array of styles.\n * @return {StyleFunction} A style function.\n */\nexport function toFunction(obj) {\n let styleFunction;\n\n if (typeof obj === 'function') {\n styleFunction = obj;\n } else {\n /**\n * @type {Array<Style>}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(typeof (/** @type {?} */ (obj).getZIndex) === 'function', 41); // Expected an `Style` or an array of `Style`\n const style = /** @type {Style} */ (obj);\n styles = [style];\n }\n styleFunction = function () {\n return styles;\n };\n }\n return styleFunction;\n}\n\n/**\n * @type {Array<Style>}\n */\nlet defaultStyles = null;\n\n/**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} resolution Resolution.\n * @return {Array<Style>} Style.\n */\nexport function createDefaultStyle(feature, resolution) {\n // We don't use an immediately-invoked function\n // and a closure so we don't get an error at script evaluation time in\n // browsers that do not support Canvas. (import(\"./Circle.js\").CircleStyle does\n // canvas.getContext('2d') at construction time, which will cause an.error\n // in such browsers.)\n if (!defaultStyles) {\n const fill = new Fill({\n color: 'rgba(255,255,255,0.4)',\n });\n const stroke = new Stroke({\n color: '#3399CC',\n width: 1.25,\n });\n defaultStyles = [\n new Style({\n image: new CircleStyle({\n fill: fill,\n stroke: stroke,\n radius: 5,\n }),\n fill: fill,\n stroke: stroke,\n }),\n ];\n }\n return defaultStyles;\n}\n\n/**\n * Default styles for editing features.\n * @return {Object<import(\"../geom/GeometryType.js\").default, Array<Style>>} Styles\n */\nexport function createEditingStyle() {\n /** @type {Object<import(\"../geom/GeometryType.js\").default, Array<Style>>} */\n const styles = {};\n const white = [255, 255, 255, 1];\n const blue = [0, 153, 255, 1];\n const width = 3;\n styles[GeometryType.POLYGON] = [\n new Style({\n fill: new Fill({\n color: [255, 255, 255, 0.5],\n }),\n }),\n ];\n styles[GeometryType.MULTI_POLYGON] = styles[GeometryType.POLYGON];\n\n styles[GeometryType.LINE_STRING] = [\n new Style({\n stroke: new Stroke({\n color: white,\n width: width + 2,\n }),\n }),\n new Style({\n stroke: new Stroke({\n color: blue,\n width: width,\n }),\n }),\n ];\n styles[GeometryType.MULTI_LINE_STRING] = styles[GeometryType.LINE_STRING];\n\n styles[GeometryType.CIRCLE] = styles[GeometryType.POLYGON].concat(\n styles[GeometryType.LINE_STRING]\n );\n\n styles[GeometryType.POINT] = [\n new Style({\n image: new CircleStyle({\n radius: width * 2,\n fill: new Fill({\n color: blue,\n }),\n stroke: new Stroke({\n color: white,\n width: width / 2,\n }),\n }),\n zIndex: Infinity,\n }),\n ];\n styles[GeometryType.MULTI_POINT] = styles[GeometryType.POINT];\n\n styles[GeometryType.GEOMETRY_COLLECTION] = styles[\n GeometryType.POLYGON\n ].concat(styles[GeometryType.LINE_STRING], styles[GeometryType.POINT]);\n\n return styles;\n}\n\n/**\n * Function that is called with a feature and returns its default geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature to get the geometry for.\n * @return {import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default|undefined} Geometry to render.\n */\nfunction defaultGeometryFunction(feature) {\n return feature.getGeometry();\n}\n\nexport default Style;\n","/**\n * @module ol/style/TextPlacement\n */\n\n/**\n * Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that\n * `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString},\n * {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or\n * {@link module:ol/geom/MultiPolygon~MultiPolygon}.\n * @enum {string}\n */\nexport default {\n POINT: 'point',\n LINE: 'line',\n};\n","/**\n * @module ol/style/Text\n */\nimport Fill from './Fill.js';\nimport TextPlacement from './TextPlacement.js';\nimport {toSize} from '../size.js';\n\n/**\n * The default fill color to use if no fill was set at construction time; a\n * blackish `#333`.\n *\n * @const {string}\n */\nconst DEFAULT_FILL_COLOR = '#333';\n\n/**\n * @typedef {Object} Options\n * @property {string} [font] Font style as CSS 'font' value, see:\n * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'\n * @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.\n * The expected value is in radians, and the default is 45° (`Math.PI / 4`).\n * @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.\n * @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down.\n * @property {boolean} [overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed\n * the width of the polygon at the label position or the length of the path that it follows.\n * @property {import(\"./TextPlacement.js\").default|string} [placement='point'] Text placement.\n * @property {number|import(\"../size.js\").Size} [scale] Scale.\n * @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {string} [text] Text content.\n * @property {string} [textAlign] Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.\n * Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a\n * placement where `maxAngle` is not exceeded.\n * @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',\n * 'hanging', 'ideographic'.\n * @property {import(\"./Fill.js\").default} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {import(\"./Fill.js\").default} [backgroundFill] Fill style for the text background when `placement` is\n * `'point'`. Default is no fill.\n * @property {import(\"./Stroke.js\").default} [backgroundStroke] Stroke style for the text background when `placement`\n * is `'point'`. Default is no stroke.\n * @property {Array<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of\n * values in the array is `[top, right, bottom, left]`.\n */\n\n/**\n * @classdesc\n * Set text style for vector features.\n * @api\n */\nclass Text {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.font_ = options.font;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = options.rotation;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.rotateWithView_ = options.rotateWithView;\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size|undefined}\n */\n this.scale_ = options.scale;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.scaleArray_ = toSize(options.scale !== undefined ? options.scale : 1);\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.text_ = options.text;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.textAlign_ = options.textAlign;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.textBaseline_ = options.textBaseline;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default}\n */\n this.fill_ =\n options.fill !== undefined\n ? options.fill\n : new Fill({color: DEFAULT_FILL_COLOR});\n\n /**\n * @private\n * @type {number}\n */\n this.maxAngle_ =\n options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;\n\n /**\n * @private\n * @type {import(\"./TextPlacement.js\").default|string}\n */\n this.placement_ =\n options.placement !== undefined ? options.placement : TextPlacement.POINT;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overflow_ = !!options.overflow;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {number}\n */\n this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;\n\n /**\n * @private\n * @type {number}\n */\n this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default}\n */\n this.backgroundFill_ = options.backgroundFill\n ? options.backgroundFill\n : null;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default}\n */\n this.backgroundStroke_ = options.backgroundStroke\n ? options.backgroundStroke\n : null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.padding_ = options.padding === undefined ? null : options.padding;\n }\n\n /**\n * Clones the style.\n * @return {Text} The cloned style.\n * @api\n */\n clone() {\n const scale = this.getScale();\n return new Text({\n font: this.getFont(),\n placement: this.getPlacement(),\n maxAngle: this.getMaxAngle(),\n overflow: this.getOverflow(),\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n text: this.getText(),\n textAlign: this.getTextAlign(),\n textBaseline: this.getTextBaseline(),\n fill: this.getFill() ? this.getFill().clone() : undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n offsetX: this.getOffsetX(),\n offsetY: this.getOffsetY(),\n backgroundFill: this.getBackgroundFill()\n ? this.getBackgroundFill().clone()\n : undefined,\n backgroundStroke: this.getBackgroundStroke()\n ? this.getBackgroundStroke().clone()\n : undefined,\n padding: this.getPadding(),\n });\n }\n\n /**\n * Get the `overflow` configuration.\n * @return {boolean} Let text overflow the length of the path they follow.\n * @api\n */\n getOverflow() {\n return this.overflow_;\n }\n\n /**\n * Get the font name.\n * @return {string|undefined} Font.\n * @api\n */\n getFont() {\n return this.font_;\n }\n\n /**\n * Get the maximum angle between adjacent characters.\n * @return {number} Angle in radians.\n * @api\n */\n getMaxAngle() {\n return this.maxAngle_;\n }\n\n /**\n * Get the label placement.\n * @return {import(\"./TextPlacement.js\").default|string} Text placement.\n * @api\n */\n getPlacement() {\n return this.placement_;\n }\n\n /**\n * Get the x-offset for the text.\n * @return {number} Horizontal text offset.\n * @api\n */\n getOffsetX() {\n return this.offsetX_;\n }\n\n /**\n * Get the y-offset for the text.\n * @return {number} Vertical text offset.\n * @api\n */\n getOffsetY() {\n return this.offsetY_;\n }\n\n /**\n * Get the fill style for the text.\n * @return {import(\"./Fill.js\").default} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * Determine whether the text rotates with the map.\n * @return {boolean|undefined} Rotate with map.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Get the text rotation.\n * @return {number|undefined} Rotation.\n * @api\n */\n getRotation() {\n return this.rotation_;\n }\n\n /**\n * Get the text scale.\n * @return {number|import(\"../size.js\").Size|undefined} Scale.\n * @api\n */\n getScale() {\n return this.scale_;\n }\n\n /**\n * Get the symbolizer scale array.\n * @return {import(\"../size.js\").Size} Scale array.\n */\n getScaleArray() {\n return this.scaleArray_;\n }\n\n /**\n * Get the stroke style for the text.\n * @return {import(\"./Stroke.js\").default} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * Get the text to be rendered.\n * @return {string|undefined} Text.\n * @api\n */\n getText() {\n return this.text_;\n }\n\n /**\n * Get the text alignment.\n * @return {string|undefined} Text align.\n * @api\n */\n getTextAlign() {\n return this.textAlign_;\n }\n\n /**\n * Get the text baseline.\n * @return {string|undefined} Text baseline.\n * @api\n */\n getTextBaseline() {\n return this.textBaseline_;\n }\n\n /**\n * Get the background fill style for the text.\n * @return {import(\"./Fill.js\").default} Fill style.\n * @api\n */\n getBackgroundFill() {\n return this.backgroundFill_;\n }\n\n /**\n * Get the background stroke style for the text.\n * @return {import(\"./Stroke.js\").default} Stroke style.\n * @api\n */\n getBackgroundStroke() {\n return this.backgroundStroke_;\n }\n\n /**\n * Get the padding for the text.\n * @return {Array<number>} Padding.\n * @api\n */\n getPadding() {\n return this.padding_;\n }\n\n /**\n * Set the `overflow` property.\n *\n * @param {boolean} overflow Let text overflow the path that it follows.\n * @api\n */\n setOverflow(overflow) {\n this.overflow_ = overflow;\n }\n\n /**\n * Set the font.\n *\n * @param {string|undefined} font Font.\n * @api\n */\n setFont(font) {\n this.font_ = font;\n }\n\n /**\n * Set the maximum angle between adjacent characters.\n *\n * @param {number} maxAngle Angle in radians.\n * @api\n */\n setMaxAngle(maxAngle) {\n this.maxAngle_ = maxAngle;\n }\n\n /**\n * Set the x offset.\n *\n * @param {number} offsetX Horizontal text offset.\n * @api\n */\n setOffsetX(offsetX) {\n this.offsetX_ = offsetX;\n }\n\n /**\n * Set the y offset.\n *\n * @param {number} offsetY Vertical text offset.\n * @api\n */\n setOffsetY(offsetY) {\n this.offsetY_ = offsetY;\n }\n\n /**\n * Set the text placement.\n *\n * @param {import(\"./TextPlacement.js\").default|string} placement Placement.\n * @api\n */\n setPlacement(placement) {\n this.placement_ = placement;\n }\n\n /**\n * Set whether to rotate the text with the view.\n *\n * @param {boolean} rotateWithView Rotate with map.\n * @api\n */\n setRotateWithView(rotateWithView) {\n this.rotateWithView_ = rotateWithView;\n }\n\n /**\n * Set the fill.\n *\n * @param {import(\"./Fill.js\").default} fill Fill style.\n * @api\n */\n setFill(fill) {\n this.fill_ = fill;\n }\n\n /**\n * Set the rotation.\n *\n * @param {number|undefined} rotation Rotation.\n * @api\n */\n setRotation(rotation) {\n this.rotation_ = rotation;\n }\n\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size|undefined} scale Scale.\n * @api\n */\n setScale(scale) {\n this.scale_ = scale;\n this.scaleArray_ = toSize(scale !== undefined ? scale : 1);\n }\n\n /**\n * Set the stroke.\n *\n * @param {import(\"./Stroke.js\").default} stroke Stroke style.\n * @api\n */\n setStroke(stroke) {\n this.stroke_ = stroke;\n }\n\n /**\n * Set the text.\n *\n * @param {string|undefined} text Text.\n * @api\n */\n setText(text) {\n this.text_ = text;\n }\n\n /**\n * Set the text alignment.\n *\n * @param {string|undefined} textAlign Text align.\n * @api\n */\n setTextAlign(textAlign) {\n this.textAlign_ = textAlign;\n }\n\n /**\n * Set the text baseline.\n *\n * @param {string|undefined} textBaseline Text baseline.\n * @api\n */\n setTextBaseline(textBaseline) {\n this.textBaseline_ = textBaseline;\n }\n\n /**\n * Set the background fill.\n *\n * @param {import(\"./Fill.js\").default} fill Fill style.\n * @api\n */\n setBackgroundFill(fill) {\n this.backgroundFill_ = fill;\n }\n\n /**\n * Set the background stroke.\n *\n * @param {import(\"./Stroke.js\").default} stroke Stroke style.\n * @api\n */\n setBackgroundStroke(stroke) {\n this.backgroundStroke_ = stroke;\n }\n\n /**\n * Set the padding (`[top, right, bottom, left]`).\n *\n * @param {!Array<number>} padding Padding.\n * @api\n */\n setPadding(padding) {\n this.padding_ = padding;\n }\n}\n\nexport default Text;\n","/**\n * @module ol/layer/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n OPACITY: 'opacity',\n VISIBLE: 'visible',\n EXTENT: 'extent',\n Z_INDEX: 'zIndex',\n MAX_RESOLUTION: 'maxResolution',\n MIN_RESOLUTION: 'minResolution',\n MAX_ZOOM: 'maxZoom',\n MIN_ZOOM: 'minZoom',\n SOURCE: 'source',\n};\n","/**\n * @module ol/layer/Base\n */\nimport BaseObject from '../Object.js';\nimport LayerProperty from './Property.js';\nimport {abstract} from '../util.js';\nimport {assert} from '../asserts.js';\nimport {assign} from '../obj.js';\nimport {clamp} from '../math.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in\n * the options is set as a {@link module:ol/Object} property on the layer object, so\n * is observable, and has get/set accessors.\n *\n * @api\n */\nclass BaseLayer extends BaseObject {\n /**\n * @param {Options} options Layer options.\n */\n constructor(options) {\n super();\n\n /**\n * @type {Object<string, *>}\n */\n const properties = assign({}, options);\n\n properties[LayerProperty.OPACITY] =\n options.opacity !== undefined ? options.opacity : 1;\n assert(typeof properties[LayerProperty.OPACITY] === 'number', 64); // Layer opacity must be a number\n\n properties[LayerProperty.VISIBLE] =\n options.visible !== undefined ? options.visible : true;\n properties[LayerProperty.Z_INDEX] = options.zIndex;\n properties[LayerProperty.MAX_RESOLUTION] =\n options.maxResolution !== undefined ? options.maxResolution : Infinity;\n properties[LayerProperty.MIN_RESOLUTION] =\n options.minResolution !== undefined ? options.minResolution : 0;\n properties[LayerProperty.MIN_ZOOM] =\n options.minZoom !== undefined ? options.minZoom : -Infinity;\n properties[LayerProperty.MAX_ZOOM] =\n options.maxZoom !== undefined ? options.maxZoom : Infinity;\n\n /**\n * @type {string}\n * @private\n */\n this.className_ =\n properties.className !== undefined ? options.className : 'ol-layer';\n delete properties.className;\n\n this.setProperties(properties);\n\n /**\n * @type {import(\"./Layer.js\").State}\n * @private\n */\n this.state_ = null;\n }\n\n /**\n * @return {string} CSS class name.\n */\n getClassName() {\n return this.className_;\n }\n\n /**\n * This method is not meant to be called by layers or layer renderers because the state\n * is incorrect if the layer is included in a layer group.\n *\n * @param {boolean=} opt_managed Layer is managed.\n * @return {import(\"./Layer.js\").State} Layer state.\n */\n getLayerState(opt_managed) {\n /** @type {import(\"./Layer.js\").State} */\n const state =\n this.state_ ||\n /** @type {?} */ ({\n layer: this,\n managed: opt_managed === undefined ? true : opt_managed,\n });\n const zIndex = this.getZIndex();\n state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);\n state.sourceState = this.getSourceState();\n state.visible = this.getVisible();\n state.extent = this.getExtent();\n state.zIndex =\n zIndex !== undefined ? zIndex : state.managed === false ? Infinity : 0;\n state.maxResolution = this.getMaxResolution();\n state.minResolution = Math.max(this.getMinResolution(), 0);\n state.minZoom = this.getMinZoom();\n state.maxZoom = this.getMaxZoom();\n this.state_ = state;\n\n return state;\n }\n\n /**\n * @abstract\n * @param {Array<import(\"./Layer.js\").default>=} opt_array Array of layers (to be\n * modified in place).\n * @return {Array<import(\"./Layer.js\").default>} Array of layers.\n */\n getLayersArray(opt_array) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Array<import(\"./Layer.js\").State>=} opt_states Optional list of layer\n * states (to be modified in place).\n * @return {Array<import(\"./Layer.js\").State>} List of layer states.\n */\n getLayerStatesArray(opt_states) {\n return abstract();\n }\n\n /**\n * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it\n * will be visible regardless of extent.\n * @return {import(\"../extent.js\").Extent|undefined} The layer extent.\n * @observable\n * @api\n */\n getExtent() {\n return /** @type {import(\"../extent.js\").Extent|undefined} */ (this.get(\n LayerProperty.EXTENT\n ));\n }\n\n /**\n * Return the maximum resolution of the layer.\n * @return {number} The maximum resolution of the layer.\n * @observable\n * @api\n */\n getMaxResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));\n }\n\n /**\n * Return the minimum resolution of the layer.\n * @return {number} The minimum resolution of the layer.\n * @observable\n * @api\n */\n getMinResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));\n }\n\n /**\n * Return the minimum zoom level of the layer.\n * @return {number} The minimum zoom level of the layer.\n * @observable\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_ZOOM));\n }\n\n /**\n * Return the maximum zoom level of the layer.\n * @return {number} The maximum zoom level of the layer.\n * @observable\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_ZOOM));\n }\n\n /**\n * Return the opacity of the layer (between 0 and 1).\n * @return {number} The opacity of the layer.\n * @observable\n * @api\n */\n getOpacity() {\n return /** @type {number} */ (this.get(LayerProperty.OPACITY));\n }\n\n /**\n * @abstract\n * @return {import(\"../source/State.js\").default} Source state.\n */\n getSourceState() {\n return abstract();\n }\n\n /**\n * Return the visibility of the layer (`true` or `false`).\n * @return {boolean} The visibility of the layer.\n * @observable\n * @api\n */\n getVisible() {\n return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));\n }\n\n /**\n * Return the Z-index of the layer, which is used to order layers before\n * rendering. The default Z-index is 0.\n * @return {number} The Z-index of the layer.\n * @observable\n * @api\n */\n getZIndex() {\n return /** @type {number} */ (this.get(LayerProperty.Z_INDEX));\n }\n\n /**\n * Set the extent at which the layer is visible. If `undefined`, the layer\n * will be visible at all extents.\n * @param {import(\"../extent.js\").Extent|undefined} extent The extent of the layer.\n * @observable\n * @api\n */\n setExtent(extent) {\n this.set(LayerProperty.EXTENT, extent);\n }\n\n /**\n * Set the maximum resolution at which the layer is visible.\n * @param {number} maxResolution The maximum resolution of the layer.\n * @observable\n * @api\n */\n setMaxResolution(maxResolution) {\n this.set(LayerProperty.MAX_RESOLUTION, maxResolution);\n }\n\n /**\n * Set the minimum resolution at which the layer is visible.\n * @param {number} minResolution The minimum resolution of the layer.\n * @observable\n * @api\n */\n setMinResolution(minResolution) {\n this.set(LayerProperty.MIN_RESOLUTION, minResolution);\n }\n\n /**\n * Set the maximum zoom (exclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} maxZoom The maximum zoom of the layer.\n * @observable\n * @api\n */\n setMaxZoom(maxZoom) {\n this.set(LayerProperty.MAX_ZOOM, maxZoom);\n }\n\n /**\n * Set the minimum zoom (inclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} minZoom The minimum zoom of the layer.\n * @observable\n * @api\n */\n setMinZoom(minZoom) {\n this.set(LayerProperty.MIN_ZOOM, minZoom);\n }\n\n /**\n * Set the opacity of the layer, allowed values range from 0 to 1.\n * @param {number} opacity The opacity of the layer.\n * @observable\n * @api\n */\n setOpacity(opacity) {\n assert(typeof opacity === 'number', 64); // Layer opacity must be a number\n this.set(LayerProperty.OPACITY, opacity);\n }\n\n /**\n * Set the visibility of the layer (`true` or `false`).\n * @param {boolean} visible The visibility of the layer.\n * @observable\n * @api\n */\n setVisible(visible) {\n this.set(LayerProperty.VISIBLE, visible);\n }\n\n /**\n * Set Z-index of the layer, which is used to order layers before rendering.\n * The default Z-index is 0.\n * @param {number} zindex The z-index of the layer.\n * @observable\n * @api\n */\n setZIndex(zindex) {\n this.set(LayerProperty.Z_INDEX, zindex);\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n if (this.state_) {\n this.state_.layer = null;\n this.state_ = null;\n }\n super.disposeInternal();\n }\n}\n\nexport default BaseLayer;\n","/**\n * @module ol/source/State\n */\n\n/**\n * @enum {string}\n * State of the source, one of 'undefined', 'loading', 'ready' or 'error'.\n */\nexport default {\n UNDEFINED: 'undefined',\n LOADING: 'loading',\n READY: 'ready',\n ERROR: 'error',\n};\n","/**\n * @module ol/layer/Layer\n */\nimport BaseLayer from './Base.js';\nimport EventType from '../events/EventType.js';\nimport LayerProperty from './Property.js';\nimport RenderEventType from '../render/EventType.js';\nimport SourceState from '../source/State.js';\nimport {assert} from '../asserts.js';\nimport {assign} from '../obj.js';\nimport {getChangeEventType} from '../Object.js';\nimport {listen, unlistenByKey} from '../events.js';\n\n/**\n * @typedef {function(import(\"../PluggableMap.js\").FrameState):HTMLElement} RenderFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../source/Source.js\").default} [source] Source for this layer. If not provided to the constructor,\n * the source can be set by calling {@link module:ol/layer/Layer#setSource layer.setSource(source)} after\n * construction.\n * @property {import(\"../PluggableMap.js\").default} [map] Map.\n * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an\n * HTML element. Will overwrite the default rendering for the layer.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./Layer.js\").default} layer\n * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.\n * @property {import(\"../source/State.js\").default} sourceState\n * @property {boolean} visible\n * @property {boolean} managed\n * @property {import(\"../extent.js\").Extent} [extent]\n * @property {number} zIndex\n * @property {number} maxResolution\n * @property {number} minResolution\n * @property {number} minZoom\n * @property {number} maxZoom\n */\n\n/**\n * @classdesc\n * Base class from which all layer types are derived. This should only be instantiated\n * in the case where a custom layer is be added to the map with a custom `render` function.\n * Such a function can be specified in the `options` object, and is expected to return an HTML element.\n *\n * A visual representation of raster or vector map data.\n * Layers group together those properties that pertain to how the data is to be\n * displayed, irrespective of the source of that data.\n *\n * Layers are usually added to a map with {@link module:ol/Map#addLayer}. Components\n * like {@link module:ol/interaction/Select~Select} use unmanaged layers\n * internally. These unmanaged layers are associated with the map using\n * {@link module:ol/layer/Layer~Layer#setMap} instead.\n *\n * A generic `change` event is fired when the state of the source changes.\n *\n * Please note that for performance reasons several layers might get rendered to\n * the same HTML element, which will cause {@link module:ol/Map~Map#forEachLayerAtPixel} to\n * give false positives. To avoid this, apply different `className` properties to the\n * layers at creation time.\n *\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n *\n * @template {import(\"../source/Source.js\").default} SourceType\n * @api\n */\nclass Layer extends BaseLayer {\n /**\n * @param {Options} options Layer options.\n */\n constructor(options) {\n const baseOptions = assign({}, options);\n delete baseOptions.source;\n\n super(baseOptions);\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.mapPrecomposeKey_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.mapRenderKey_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.sourceChangeKey_ = null;\n\n /**\n * @private\n * @type {import(\"../renderer/Layer.js\").default}\n */\n this.renderer_ = null;\n\n // Overwrite default render method with a custom one\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.map) {\n this.setMap(options.map);\n }\n\n this.addEventListener(\n getChangeEventType(LayerProperty.SOURCE),\n this.handleSourcePropertyChange_\n );\n\n const source = options.source\n ? /** @type {SourceType} */ (options.source)\n : null;\n this.setSource(source);\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").default>=} opt_array Array of layers (to be modified in place).\n * @return {Array<import(\"./Layer.js\").default>} Array of layers.\n */\n getLayersArray(opt_array) {\n const array = opt_array ? opt_array : [];\n array.push(this);\n return array;\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").State>=} opt_states Optional list of layer states (to be modified in place).\n * @return {Array<import(\"./Layer.js\").State>} List of layer states.\n */\n getLayerStatesArray(opt_states) {\n const states = opt_states ? opt_states : [];\n states.push(this.getLayerState());\n return states;\n }\n\n /**\n * Get the layer source.\n * @return {SourceType} The layer source (or `null` if not yet set).\n * @observable\n * @api\n */\n getSource() {\n return /** @type {SourceType} */ (this.get(LayerProperty.SOURCE)) || null;\n }\n\n /**\n * @return {import(\"../source/State.js\").default} Source state.\n */\n getSourceState() {\n const source = this.getSource();\n return !source ? SourceState.UNDEFINED : source.getState();\n }\n\n /**\n * @private\n */\n handleSourceChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleSourcePropertyChange_() {\n if (this.sourceChangeKey_) {\n unlistenByKey(this.sourceChangeKey_);\n this.sourceChangeKey_ = null;\n }\n const source = this.getSource();\n if (source) {\n this.sourceChangeKey_ = listen(\n source,\n EventType.CHANGE,\n this.handleSourceChange_,\n this\n );\n }\n this.changed();\n }\n\n /**\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").default>>} Promise that resolves with\n * an array of features.\n */\n getFeatures(pixel) {\n return this.renderer_.getFeatures(pixel);\n }\n\n /**\n * In charge to manage the rendering of the layer. One layer type is\n * bounded with one layer renderer.\n * @param {?import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target which the renderer may (but need not) use\n * for rendering its content.\n * @return {HTMLElement} The rendered element.\n */\n render(frameState, target) {\n const layerRenderer = this.getRenderer();\n\n if (layerRenderer.prepareFrame(frameState)) {\n return layerRenderer.renderFrame(frameState, target);\n }\n }\n\n /**\n * Sets the layer to be rendered on top of other layers on a map. The map will\n * not manage this layer in its layers collection, and the callback in\n * {@link module:ol/Map#forEachLayerAtPixel} will receive `null` as layer. This\n * is useful for temporary layers. To remove an unmanaged layer from the map,\n * use `#setMap(null)`.\n *\n * To add the layer to a map and have it managed by the map, use\n * {@link module:ol/Map#addLayer} instead.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n if (this.mapPrecomposeKey_) {\n unlistenByKey(this.mapPrecomposeKey_);\n this.mapPrecomposeKey_ = null;\n }\n if (!map) {\n this.changed();\n }\n if (this.mapRenderKey_) {\n unlistenByKey(this.mapRenderKey_);\n this.mapRenderKey_ = null;\n }\n if (map) {\n this.mapPrecomposeKey_ = listen(\n map,\n RenderEventType.PRECOMPOSE,\n function (evt) {\n const renderEvent = /** @type {import(\"../render/Event.js\").default} */ (evt);\n const layerStatesArray = renderEvent.frameState.layerStatesArray;\n const layerState = this.getLayerState(false);\n // A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.\n assert(\n !layerStatesArray.some(function (arrayLayerState) {\n return arrayLayerState.layer === layerState.layer;\n }),\n 67\n );\n layerStatesArray.push(layerState);\n },\n this\n );\n this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);\n this.changed();\n }\n }\n\n /**\n * Set the layer source.\n * @param {SourceType} source The layer source.\n * @observable\n * @api\n */\n setSource(source) {\n this.set(LayerProperty.SOURCE, source);\n }\n\n /**\n * Get the renderer for this layer.\n * @return {import(\"../renderer/Layer.js\").default} The layer renderer.\n */\n getRenderer() {\n if (!this.renderer_) {\n this.renderer_ = this.createRenderer();\n }\n return this.renderer_;\n }\n\n /**\n * @return {boolean} The layer has a renderer.\n */\n hasRenderer() {\n return !!this.renderer_;\n }\n\n /**\n * Create a renderer for this layer.\n * @return {import(\"../renderer/Layer.js\").default} A layer renderer.\n * @protected\n */\n createRenderer() {\n return null;\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.setSource(null);\n super.disposeInternal();\n }\n}\n\n/**\n * Return `true` if the layer is visible and if the provided view state\n * has resolution and zoom levels that are in range of the layer's min/max.\n * @param {State} layerState Layer state.\n * @param {import(\"../View.js\").State} viewState View state.\n * @return {boolean} The layer is visible at the given view state.\n */\nexport function inView(layerState, viewState) {\n if (!layerState.visible) {\n return false;\n }\n const resolution = viewState.resolution;\n if (\n resolution < layerState.minResolution ||\n resolution >= layerState.maxResolution\n ) {\n return false;\n }\n const zoom = viewState.zoom;\n return zoom > layerState.minZoom && zoom <= layerState.maxZoom;\n}\n\nexport default Layer;\n","/**\n * @module ol/layer/BaseVector\n */\nimport Layer from './Layer.js';\nimport {assign} from '../obj.js';\nimport {\n createDefaultStyle,\n toFunction as toStyleFunction,\n} from '../style/Style.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {import(\"../source/Vector.js\").default} [source] Source.\n * @property {import(\"../PluggableMap.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link module:ol/Map#addLayer}.\n * @property {boolean} [declutter=false] Declutter images and text. Decluttering is applied to all\n * image and text styles of all Vector and VectorTile layers that have set this to `true`. The priority\n * is defined by the z-index of the layer, the `zIndex` of the style and the render order of features.\n * Higher z-index means higher priority. Within the same z-index, a feature rendered before another has\n * higher priority.\n * @property {import(\"../style/Style.js\").StyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style} for default style\n * which will be used if this is not set.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will\n * be recreated during animations. This means that no vectors will be shown clipped, but the\n * setting will have a performance impact for large amounts of vector data. When set to `false`,\n * batches will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will\n * be recreated during interactions. See also `updateWhileAnimating`.\n */\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n RENDER_ORDER: 'renderOrder',\n};\n\n/**\n * @classdesc\n * Vector data that is rendered client-side.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default|import(\"../source/VectorTile.js\").default} VectorSourceType\n * @extends {Layer<VectorSourceType>}\n * @api\n */\nclass BaseVectorLayer extends Layer {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const baseOptions = assign({}, options);\n\n delete baseOptions.style;\n delete baseOptions.renderBuffer;\n delete baseOptions.updateWhileAnimating;\n delete baseOptions.updateWhileInteracting;\n super(baseOptions);\n\n /**\n * @private\n * @type {boolean}\n */\n this.declutter_ =\n options.declutter !== undefined ? options.declutter : false;\n\n /**\n * @type {number}\n * @private\n */\n this.renderBuffer_ =\n options.renderBuffer !== undefined ? options.renderBuffer : 100;\n\n /**\n * User provided style.\n * @type {import(\"../style/Style.js\").StyleLike}\n * @private\n */\n this.style_ = null;\n\n /**\n * Style function for use within the library.\n * @type {import(\"../style/Style.js\").StyleFunction|undefined}\n * @private\n */\n this.styleFunction_ = undefined;\n\n this.setStyle(options.style);\n\n /**\n * @type {boolean}\n * @private\n */\n this.updateWhileAnimating_ =\n options.updateWhileAnimating !== undefined\n ? options.updateWhileAnimating\n : false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.updateWhileInteracting_ =\n options.updateWhileInteracting !== undefined\n ? options.updateWhileInteracting\n : false;\n }\n\n /**\n * @return {boolean} Declutter.\n */\n getDeclutter() {\n return this.declutter_;\n }\n\n /**\n * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise\n * that resolves with an array of features. The array will either contain the topmost feature\n * when a hit was detected, or it will be empty.\n *\n * The hit detection algorithm used for this method is optimized for performance, but is less\n * accurate than the one used in {@link import(\"../PluggableMap.js\").default#getFeaturesAtPixel}: Text\n * is not considered, and icons are only represented by their bounding box instead of the exact\n * image.\n *\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").default>>} Promise that resolves with an array of features.\n * @api\n */\n getFeatures(pixel) {\n return super.getFeatures(pixel);\n }\n\n /**\n * @return {number|undefined} Render buffer.\n */\n getRenderBuffer() {\n return this.renderBuffer_;\n }\n\n /**\n * @return {function(import(\"../Feature.js\").default, import(\"../Feature.js\").default): number|null|undefined} Render\n * order.\n */\n getRenderOrder() {\n return /** @type {import(\"../render.js\").OrderFunction|null|undefined} */ (this.get(\n Property.RENDER_ORDER\n ));\n }\n\n /**\n * Get the style for features. This returns whatever was passed to the `style`\n * option at construction or to the `setStyle` method.\n * @return {import(\"../style/Style.js\").StyleLike|null|undefined} Layer style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the style function.\n * @return {import(\"../style/Style.js\").StyleFunction|undefined} Layer style function.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @return {boolean} Whether the rendered layer should be updated while\n * animating.\n */\n getUpdateWhileAnimating() {\n return this.updateWhileAnimating_;\n }\n\n /**\n * @return {boolean} Whether the rendered layer should be updated while\n * interacting.\n */\n getUpdateWhileInteracting() {\n return this.updateWhileInteracting_;\n }\n\n /**\n * @param {import(\"../render.js\").OrderFunction|null|undefined} renderOrder\n * Render order.\n */\n setRenderOrder(renderOrder) {\n this.set(Property.RENDER_ORDER, renderOrder);\n }\n\n /**\n * Set the style for features. This can be a single style object, an array\n * of styles, or a function that takes a feature and resolution and returns\n * an array of styles. If set to `null`, the layer has no style (a `null` style),\n * so only features that have their own styles will be rendered in the layer. Call\n * `setStyle()` without arguments to reset to the default style. See\n * {@link module:ol/style} for information on the default style.\n * @param {(import(\"../style/Style.js\").StyleLike|null)=} opt_style Layer style.\n * @api\n */\n setStyle(opt_style) {\n this.style_ = opt_style !== undefined ? opt_style : createDefaultStyle;\n this.styleFunction_ =\n opt_style === null ? undefined : toStyleFunction(this.style_);\n this.changed();\n }\n}\n\nexport default BaseVectorLayer;\n","/**\n * @module ol/render/canvas/Instruction\n */\n\n/**\n * @enum {number}\n */\nconst Instruction = {\n BEGIN_GEOMETRY: 0,\n BEGIN_PATH: 1,\n CIRCLE: 2,\n CLOSE_PATH: 3,\n CUSTOM: 4,\n DRAW_CHARS: 5,\n DRAW_IMAGE: 6,\n END_GEOMETRY: 7,\n FILL: 8,\n MOVE_TO_LINE_TO: 9,\n SET_FILL_STYLE: 10,\n SET_STROKE_STYLE: 11,\n STROKE: 12,\n};\n\n/**\n * @type {Array<Instruction>}\n */\nexport const fillInstruction = [Instruction.FILL];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const strokeInstruction = [Instruction.STROKE];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const beginPathInstruction = [Instruction.BEGIN_PATH];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const closePathInstruction = [Instruction.CLOSE_PATH];\n\nexport default Instruction;\n","/**\n * @module ol/render/VectorContext\n */\n\n/**\n * @classdesc\n * Context for drawing geometries. A vector context is available on render\n * events and does not need to be constructed directly.\n * @api\n */\nclass VectorContext {\n /**\n * Render a geometry with a custom renderer.\n *\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n */\n drawCustom(geometry, feature, renderer) {}\n\n /**\n * Render a geometry.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry The geometry to render.\n */\n drawGeometry(geometry) {}\n\n /**\n * Set the rendering style.\n *\n * @param {import(\"../style/Style.js\").default} style The rendering style.\n */\n setStyle(style) {}\n\n /**\n * @param {import(\"../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../Feature.js\").default} feature Feature.\n */\n drawCircle(circleGeometry, feature) {}\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n */\n drawFeature(feature, style) {}\n\n /**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometryCollectionGeometry Geometry collection.\n * @param {import(\"../Feature.js\").default} feature Feature.\n */\n drawGeometryCollection(geometryCollectionGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/LineString.js\").default|import(\"./Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawLineString(lineStringGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"./Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawMultiLineString(multiLineStringGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"./Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawMultiPoint(multiPointGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawMultiPolygon(multiPolygonGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/Point.js\").default|import(\"./Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawPoint(pointGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/Polygon.js\").default|import(\"./Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawPolygon(polygonGeometry, feature) {}\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default|import(\"./Feature.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\n drawText(geometry, feature) {}\n\n /**\n * @param {import(\"../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../style/Stroke.js\").default} strokeStyle Stroke style.\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {}\n\n /**\n * @param {import(\"../style/Image.js\").default} imageStyle Image style.\n * @param {import(\"./canvas.js\").DeclutterGroup=} opt_declutterGroup Declutter.\n */\n setImageStyle(imageStyle, opt_declutterGroup) {}\n\n /**\n * @param {import(\"../style/Text.js\").default} textStyle Text style.\n * @param {import(\"./canvas.js\").DeclutterGroups=} opt_declutterGroups Declutter.\n */\n setTextStyle(textStyle, opt_declutterGroups) {}\n}\n\nexport default VectorContext;\n","/**\n * @module ol/render/canvas/Builder\n */\nimport CanvasInstruction from './Instruction.js';\nimport GeometryType from '../../geom/GeometryType.js';\nimport Relationship from '../../extent/Relationship.js';\nimport VectorContext from '../VectorContext.js';\nimport {asColorLike} from '../../colorlike.js';\nimport {buffer, clone, coordinateRelationship} from '../../extent.js';\nimport {\n defaultFillStyle,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n} from '../canvas.js';\nimport {equals, reverseSubArray} from '../../array.js';\nimport {\n inflateCoordinates,\n inflateCoordinatesArray,\n inflateMultiCoordinatesArray,\n} from '../../geom/flat/inflate.js';\n\n/**\n * @typedef {Object} SerializableInstructions\n * @property {Array<*>} instructions The rendering instructions.\n * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.\n * @property {Array<number>} coordinates The array of all coordinates.\n * @property {!Object<string, import(\"../canvas.js\").TextState>} [textStates] The text states (decluttering).\n * @property {!Object<string, import(\"../canvas.js\").FillState>} [fillStates] The fill states (decluttering).\n * @property {!Object<string, import(\"../canvas.js\").StrokeState>} [strokeStates] The stroke states (decluttering).\n */\n\nclass CanvasBuilder extends VectorContext {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super();\n\n /**\n * @protected\n * @type {number}\n */\n this.tolerance = tolerance;\n\n /**\n * @protected\n * @const\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent = maxExtent;\n\n /**\n * @protected\n * @type {number}\n */\n this.pixelRatio = pixelRatio;\n\n /**\n * @protected\n * @type {number}\n */\n this.maxLineWidth = 0;\n\n /**\n * @protected\n * @const\n * @type {number}\n */\n this.resolution = resolution;\n\n /**\n * @private\n * @type {Array<*>}\n */\n this.beginGeometryInstruction1_ = null;\n\n /**\n * @private\n * @type {Array<*>}\n */\n this.beginGeometryInstruction2_ = null;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.bufferedMaxExtent_ = null;\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.instructions = [];\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.coordinates = [];\n\n /**\n * @private\n * @type {import(\"../../coordinate.js\").Coordinate}\n */\n this.tmpCoordinate_ = [];\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.hitDetectionInstructions = [];\n\n /**\n * @protected\n * @type {import(\"../canvas.js\").FillStrokeState}\n */\n this.state = /** @type {import(\"../canvas.js\").FillStrokeState} */ ({});\n }\n\n /**\n * @protected\n * @param {Array<number>} dashArray Dash array.\n * @return {Array<number>} Dash array with pixel ratio applied\n */\n applyPixelRatio(dashArray) {\n const pixelRatio = this.pixelRatio;\n return pixelRatio == 1\n ? dashArray\n : dashArray.map(function (dash) {\n return dash * pixelRatio;\n });\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {boolean} closed Last input coordinate equals first.\n * @param {boolean} skipFirst Skip first coordinate.\n * @protected\n * @return {number} My end.\n */\n appendFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n closed,\n skipFirst\n ) {\n let myEnd = this.coordinates.length;\n const extent = this.getBufferedMaxExtent();\n if (skipFirst) {\n offset += stride;\n }\n let lastXCoord = flatCoordinates[offset];\n let lastYCoord = flatCoordinates[offset + 1];\n const nextCoord = this.tmpCoordinate_;\n let skipped = true;\n\n let i, lastRel, nextRel;\n for (i = offset + stride; i < end; i += stride) {\n nextCoord[0] = flatCoordinates[i];\n nextCoord[1] = flatCoordinates[i + 1];\n nextRel = coordinateRelationship(extent, nextCoord);\n if (nextRel !== lastRel) {\n if (skipped) {\n this.coordinates[myEnd++] = lastXCoord;\n this.coordinates[myEnd++] = lastYCoord;\n }\n this.coordinates[myEnd++] = nextCoord[0];\n this.coordinates[myEnd++] = nextCoord[1];\n skipped = false;\n } else if (nextRel === Relationship.INTERSECTING) {\n this.coordinates[myEnd++] = nextCoord[0];\n this.coordinates[myEnd++] = nextCoord[1];\n skipped = false;\n } else {\n skipped = true;\n }\n lastXCoord = nextCoord[0];\n lastYCoord = nextCoord[1];\n lastRel = nextRel;\n }\n\n // Last coordinate equals first or only one point to append:\n if ((closed && skipped) || i === offset + stride) {\n this.coordinates[myEnd++] = lastXCoord;\n this.coordinates[myEnd++] = lastYCoord;\n }\n return myEnd;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<number>} builderEnds Builder ends.\n * @return {number} Offset.\n */\n drawCustomCoordinates_(flatCoordinates, offset, ends, stride, builderEnds) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const builderEnd = this.appendFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false\n );\n builderEnds.push(builderEnd);\n offset = end;\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n */\n drawCustom(geometry, feature, renderer) {\n this.beginGeometry(geometry, feature);\n const type = geometry.getType();\n const stride = geometry.getStride();\n const builderBegin = this.coordinates.length;\n let flatCoordinates, builderEnd, builderEnds, builderEndss;\n let offset;\n if (type == GeometryType.MULTI_POLYGON) {\n flatCoordinates = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (geometry).getOrientedFlatCoordinates();\n builderEndss = [];\n const endss = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (geometry).getEndss();\n offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const myEnds = [];\n offset = this.drawCustomCoordinates_(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n myEnds\n );\n builderEndss.push(myEnds);\n }\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEndss,\n geometry,\n renderer,\n inflateMultiCoordinatesArray,\n ]);\n } else if (\n type == GeometryType.POLYGON ||\n type == GeometryType.MULTI_LINE_STRING\n ) {\n builderEnds = [];\n flatCoordinates =\n type == GeometryType.POLYGON\n ? /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry).getOrientedFlatCoordinates()\n : geometry.getFlatCoordinates();\n offset = this.drawCustomCoordinates_(\n flatCoordinates,\n 0,\n /** @type {import(\"../../geom/Polygon.js\").default|import(\"../../geom/MultiLineString.js\").default} */ (geometry).getEnds(),\n stride,\n builderEnds\n );\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnds,\n geometry,\n renderer,\n inflateCoordinatesArray,\n ]);\n } else if (\n type == GeometryType.LINE_STRING ||\n type == GeometryType.MULTI_POINT\n ) {\n flatCoordinates = geometry.getFlatCoordinates();\n builderEnd = this.appendFlatCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false\n );\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n inflateCoordinates,\n ]);\n } else if (type == GeometryType.POINT) {\n flatCoordinates = geometry.getFlatCoordinates();\n this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);\n builderEnd = this.coordinates.length;\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n ]);\n }\n this.endGeometry(feature);\n }\n\n /**\n * @protected\n * @param {import(\"../../geom/Geometry\").default|import(\"../Feature.js\").default} geometry The geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n beginGeometry(geometry, feature) {\n const extent = geometry.getExtent();\n this.beginGeometryInstruction1_ = [\n CanvasInstruction.BEGIN_GEOMETRY,\n feature,\n 0,\n extent,\n ];\n this.instructions.push(this.beginGeometryInstruction1_);\n this.beginGeometryInstruction2_ = [\n CanvasInstruction.BEGIN_GEOMETRY,\n feature,\n 0,\n extent,\n ];\n this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);\n }\n\n /**\n * @return {SerializableInstructions} the serializable instructions.\n */\n finish() {\n return {\n instructions: this.instructions,\n hitDetectionInstructions: this.hitDetectionInstructions,\n coordinates: this.coordinates,\n };\n }\n\n /**\n * Reverse the hit detection instructions.\n */\n reverseHitDetectionInstructions() {\n const hitDetectionInstructions = this.hitDetectionInstructions;\n // step 1 - reverse array\n hitDetectionInstructions.reverse();\n // step 2 - reverse instructions within geometry blocks\n let i;\n const n = hitDetectionInstructions.length;\n let instruction;\n let type;\n let begin = -1;\n for (i = 0; i < n; ++i) {\n instruction = hitDetectionInstructions[i];\n type = /** @type {import(\"./Instruction.js\").default} */ (instruction[0]);\n if (type == CanvasInstruction.END_GEOMETRY) {\n begin = i;\n } else if (type == CanvasInstruction.BEGIN_GEOMETRY) {\n instruction[2] = i;\n reverseSubArray(this.hitDetectionInstructions, begin, i);\n begin = -1;\n }\n }\n }\n\n /**\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {\n const state = this.state;\n if (fillStyle) {\n const fillStyleColor = fillStyle.getColor();\n state.fillStyle = asColorLike(\n fillStyleColor ? fillStyleColor : defaultFillStyle\n );\n } else {\n state.fillStyle = undefined;\n }\n if (strokeStyle) {\n const strokeStyleColor = strokeStyle.getColor();\n state.strokeStyle = asColorLike(\n strokeStyleColor ? strokeStyleColor : defaultStrokeStyle\n );\n const strokeStyleLineCap = strokeStyle.getLineCap();\n state.lineCap =\n strokeStyleLineCap !== undefined ? strokeStyleLineCap : defaultLineCap;\n const strokeStyleLineDash = strokeStyle.getLineDash();\n state.lineDash = strokeStyleLineDash\n ? strokeStyleLineDash.slice()\n : defaultLineDash;\n const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();\n state.lineDashOffset = strokeStyleLineDashOffset\n ? strokeStyleLineDashOffset\n : defaultLineDashOffset;\n const strokeStyleLineJoin = strokeStyle.getLineJoin();\n state.lineJoin =\n strokeStyleLineJoin !== undefined\n ? strokeStyleLineJoin\n : defaultLineJoin;\n const strokeStyleWidth = strokeStyle.getWidth();\n state.lineWidth =\n strokeStyleWidth !== undefined ? strokeStyleWidth : defaultLineWidth;\n const strokeStyleMiterLimit = strokeStyle.getMiterLimit();\n state.miterLimit =\n strokeStyleMiterLimit !== undefined\n ? strokeStyleMiterLimit\n : defaultMiterLimit;\n\n if (state.lineWidth > this.maxLineWidth) {\n this.maxLineWidth = state.lineWidth;\n // invalidate the buffered max extent cache\n this.bufferedMaxExtent_ = null;\n }\n } else {\n state.strokeStyle = undefined;\n state.lineCap = undefined;\n state.lineDash = null;\n state.lineDashOffset = undefined;\n state.lineJoin = undefined;\n state.lineWidth = undefined;\n state.miterLimit = undefined;\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {Array<*>} Fill instruction.\n */\n createFill(state) {\n const fillStyle = state.fillStyle;\n /** @type {Array<*>} */\n const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle];\n if (typeof fillStyle !== 'string') {\n // Fill is a pattern or gradient - align it!\n fillInstruction.push(true);\n }\n return fillInstruction;\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n */\n applyStroke(state) {\n this.instructions.push(this.createStroke(state));\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {Array<*>} Stroke instruction.\n */\n createStroke(state) {\n return [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth * this.pixelRatio,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n this.applyPixelRatio(state.lineDash),\n state.lineDashOffset * this.pixelRatio,\n ];\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @param {function(this:CanvasBuilder, import(\"../canvas.js\").FillStrokeState):Array<*>} createFill Create fill.\n */\n updateFillStyle(state, createFill) {\n const fillStyle = state.fillStyle;\n if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {\n if (fillStyle !== undefined) {\n this.instructions.push(createFill.call(this, state));\n }\n state.currentFillStyle = fillStyle;\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @param {function(this:CanvasBuilder, import(\"../canvas.js\").FillStrokeState): void} applyStroke Apply stroke.\n */\n updateStrokeStyle(state, applyStroke) {\n const strokeStyle = state.strokeStyle;\n const lineCap = state.lineCap;\n const lineDash = state.lineDash;\n const lineDashOffset = state.lineDashOffset;\n const lineJoin = state.lineJoin;\n const lineWidth = state.lineWidth;\n const miterLimit = state.miterLimit;\n if (\n state.currentStrokeStyle != strokeStyle ||\n state.currentLineCap != lineCap ||\n (lineDash != state.currentLineDash &&\n !equals(state.currentLineDash, lineDash)) ||\n state.currentLineDashOffset != lineDashOffset ||\n state.currentLineJoin != lineJoin ||\n state.currentLineWidth != lineWidth ||\n state.currentMiterLimit != miterLimit\n ) {\n if (strokeStyle !== undefined) {\n applyStroke.call(this, state);\n }\n state.currentStrokeStyle = strokeStyle;\n state.currentLineCap = lineCap;\n state.currentLineDash = lineDash;\n state.currentLineDashOffset = lineDashOffset;\n state.currentLineJoin = lineJoin;\n state.currentLineWidth = lineWidth;\n state.currentMiterLimit = miterLimit;\n }\n }\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n endGeometry(feature) {\n this.beginGeometryInstruction1_[2] = this.instructions.length;\n this.beginGeometryInstruction1_ = null;\n this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;\n this.beginGeometryInstruction2_ = null;\n const endGeometryInstruction = [CanvasInstruction.END_GEOMETRY, feature];\n this.instructions.push(endGeometryInstruction);\n this.hitDetectionInstructions.push(endGeometryInstruction);\n }\n\n /**\n * Get the buffered rendering extent. Rendering will be clipped to the extent\n * provided to the constructor. To account for symbolizers that may intersect\n * this extent, we calculate a buffered extent (e.g. based on stroke width).\n * @return {import(\"../../extent.js\").Extent} The buffered rendering extent.\n * @protected\n */\n getBufferedMaxExtent() {\n if (!this.bufferedMaxExtent_) {\n this.bufferedMaxExtent_ = clone(this.maxExtent);\n if (this.maxLineWidth > 0) {\n const width = (this.resolution * (this.maxLineWidth + 1)) / 2;\n buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_);\n }\n }\n return this.bufferedMaxExtent_;\n }\n}\n\nexport default CanvasBuilder;\n","/**\n * @module ol/render/canvas/ImageBuilder\n */\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction from './Instruction.js';\n\nclass CanvasImageBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n\n /**\n * @private\n * @type {import(\"../canvas.js\").DeclutterGroups}\n */\n this.declutterGroups_ = null;\n\n /**\n * @private\n * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}\n */\n this.hitDetectionImage_ = null;\n\n /**\n * @private\n * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}\n */\n this.image_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.imagePixelRatio_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.anchorX_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.anchorY_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.height_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.opacity_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.originX_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.originY_ = undefined;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.rotateWithView_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size|undefined}\n */\n this.scale_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.width_ = undefined;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n * @return {number} My end.\n */\n drawCoordinates_(flatCoordinates, offset, end, stride) {\n return this.appendFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false\n );\n }\n\n /**\n * @param {import(\"../../geom/Point.js\").default|import(\"../Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawPoint(pointGeometry, feature) {\n if (!this.image_) {\n return;\n }\n this.beginGeometry(pointGeometry, feature);\n const flatCoordinates = pointGeometry.getFlatCoordinates();\n const stride = pointGeometry.getStride();\n const myBegin = this.coordinates.length;\n const myEnd = this.drawCoordinates_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride\n );\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.image_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_ * this.imagePixelRatio_,\n this.anchorY_ * this.imagePixelRatio_,\n this.declutterGroups_,\n Math.ceil(this.height_ * this.imagePixelRatio_),\n this.opacity_,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n [\n (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,\n (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,\n ],\n Math.ceil(this.width_ * this.imagePixelRatio_),\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.hitDetectionImage_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_,\n this.anchorY_,\n this.declutterGroups_,\n this.height_,\n this.opacity_,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n this.scale_,\n this.width_,\n ]);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPoint.js\").default|import(\"../Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawMultiPoint(multiPointGeometry, feature) {\n if (!this.image_) {\n return;\n }\n this.beginGeometry(multiPointGeometry, feature);\n const flatCoordinates = multiPointGeometry.getFlatCoordinates();\n const stride = multiPointGeometry.getStride();\n const myBegin = this.coordinates.length;\n const myEnd = this.drawCoordinates_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride\n );\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.image_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_ * this.imagePixelRatio_,\n this.anchorY_ * this.imagePixelRatio_,\n this.declutterGroups_,\n Math.ceil(this.height_ * this.imagePixelRatio_),\n this.opacity_,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n [\n (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,\n (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,\n ],\n Math.ceil(this.width_ * this.imagePixelRatio_),\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.hitDetectionImage_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_,\n this.anchorY_,\n this.declutterGroups_,\n this.height_,\n this.opacity_,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n this.scale_,\n this.width_,\n ]);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"./Builder.js\").SerializableInstructions} the serializable instructions.\n */\n finish() {\n this.reverseHitDetectionInstructions();\n // FIXME this doesn't really protect us against further calls to draw*Geometry\n this.anchorX_ = undefined;\n this.anchorY_ = undefined;\n this.hitDetectionImage_ = null;\n this.image_ = null;\n this.imagePixelRatio_ = undefined;\n this.height_ = undefined;\n this.scale_ = undefined;\n this.opacity_ = undefined;\n this.originX_ = undefined;\n this.originY_ = undefined;\n this.rotateWithView_ = undefined;\n this.rotation_ = undefined;\n this.width_ = undefined;\n return super.finish();\n }\n\n /**\n * @param {import(\"../../style/Image.js\").default} imageStyle Image style.\n * @param {import(\"../canvas.js\").DeclutterGroup} declutterGroups Declutter.\n */\n setImageStyle(imageStyle, declutterGroups) {\n const anchor = imageStyle.getAnchor();\n const size = imageStyle.getSize();\n const hitDetectionImage = imageStyle.getHitDetectionImage();\n const image = imageStyle.getImage(this.pixelRatio);\n const origin = imageStyle.getOrigin();\n this.imagePixelRatio_ = imageStyle.getPixelRatio(this.pixelRatio);\n this.anchorX_ = anchor[0];\n this.anchorY_ = anchor[1];\n this.declutterGroups_ = declutterGroups;\n this.hitDetectionImage_ = hitDetectionImage;\n this.image_ = image;\n this.height_ = size[1];\n this.opacity_ = imageStyle.getOpacity();\n this.originX_ = origin[0];\n this.originY_ = origin[1];\n this.rotateWithView_ = imageStyle.getRotateWithView();\n this.rotation_ = imageStyle.getRotation();\n this.scale_ = imageStyle.getScaleArray();\n this.width_ = size[0];\n }\n}\n\nexport default CanvasImageBuilder;\n","/**\n * @module ol/render/canvas/LineStringBuilder\n */\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasLineStringBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n * @return {number} end.\n */\n drawFlatCoordinates_(flatCoordinates, offset, end, stride) {\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false\n );\n const moveToLineToInstruction = [\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n ];\n this.instructions.push(moveToLineToInstruction);\n this.hitDetectionInstructions.push(moveToLineToInstruction);\n return end;\n }\n\n /**\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawLineString(lineStringGeometry, feature) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(lineStringGeometry, feature);\n this.hitDetectionInstructions.push(\n [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash,\n state.lineDashOffset,\n ],\n beginPathInstruction\n );\n const flatCoordinates = lineStringGeometry.getFlatCoordinates();\n const stride = lineStringGeometry.getStride();\n this.drawFlatCoordinates_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride\n );\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawMultiLineString(multiLineStringGeometry, feature) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(multiLineStringGeometry, feature);\n this.hitDetectionInstructions.push(\n [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash,\n state.lineDashOffset,\n ],\n beginPathInstruction\n );\n const ends = multiLineStringGeometry.getEnds();\n const flatCoordinates = multiLineStringGeometry.getFlatCoordinates();\n const stride = multiLineStringGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.drawFlatCoordinates_(\n flatCoordinates,\n offset,\n /** @type {number} */ (ends[i]),\n stride\n );\n }\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"./Builder.js\").SerializableInstructions} the serializable instructions.\n */\n finish() {\n const state = this.state;\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n }\n this.reverseHitDetectionInstructions();\n this.state = null;\n return super.finish();\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n */\n applyStroke(state) {\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n state.lastStroke = this.coordinates.length;\n }\n state.lastStroke = 0;\n super.applyStroke(state);\n this.instructions.push(beginPathInstruction);\n }\n}\n\nexport default CanvasLineStringBuilder;\n","/**\n * @module ol/render/canvas/PolygonBuilder\n */\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n closePathInstruction,\n fillInstruction,\n strokeInstruction,\n} from './Instruction.js';\nimport {defaultFillStyle} from '../canvas.js';\nimport {snap} from '../../geom/flat/simplify.js';\n\nclass CanvasPolygonBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @private\n * @return {number} End.\n */\n drawFlatCoordinatess_(flatCoordinates, offset, ends, stride) {\n const state = this.state;\n const fill = state.fillStyle !== undefined;\n const stroke = state.strokeStyle !== undefined;\n const numEnds = ends.length;\n this.instructions.push(beginPathInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction);\n for (let i = 0; i < numEnds; ++i) {\n const end = ends[i];\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n true,\n !stroke\n );\n const moveToLineToInstruction = [\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n ];\n this.instructions.push(moveToLineToInstruction);\n this.hitDetectionInstructions.push(moveToLineToInstruction);\n if (stroke) {\n // Performance optimization: only call closePath() when we have a stroke.\n // Otherwise the ring is closed already (see appendFlatCoordinates above).\n this.instructions.push(closePathInstruction);\n this.hitDetectionInstructions.push(closePathInstruction);\n }\n offset = end;\n }\n if (fill) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (stroke) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../../Feature.js\").default} feature Feature.\n */\n drawCircle(circleGeometry, feature) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(circleGeometry, feature);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash,\n state.lineDashOffset,\n ]);\n }\n const flatCoordinates = circleGeometry.getFlatCoordinates();\n const stride = circleGeometry.getStride();\n const myBegin = this.coordinates.length;\n this.appendFlatCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false\n );\n const circleInstruction = [CanvasInstruction.CIRCLE, myBegin];\n this.instructions.push(beginPathInstruction, circleInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);\n if (state.fillStyle !== undefined) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (state.strokeStyle !== undefined) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawPolygon(polygonGeometry, feature) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(polygonGeometry, feature);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash,\n state.lineDashOffset,\n ]);\n }\n const ends = polygonGeometry.getEnds();\n const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();\n const stride = polygonGeometry.getStride();\n this.drawFlatCoordinatess_(\n flatCoordinates,\n 0,\n /** @type {Array<number>} */ (ends),\n stride\n );\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawMultiPolygon(multiPolygonGeometry, feature) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(multiPolygonGeometry, feature);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash,\n state.lineDashOffset,\n ]);\n }\n const endss = multiPolygonGeometry.getEndss();\n const flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();\n const stride = multiPolygonGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = this.drawFlatCoordinatess_(\n flatCoordinates,\n offset,\n endss[i],\n stride\n );\n }\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"./Builder.js\").SerializableInstructions} the serializable instructions.\n */\n finish() {\n this.reverseHitDetectionInstructions();\n this.state = null;\n // We want to preserve topology when drawing polygons. Polygons are\n // simplified using quantization and point elimination. However, we might\n // have received a mix of quantized and non-quantized geometries, so ensure\n // that all are quantized by quantizing all coordinates in the batch.\n const tolerance = this.tolerance;\n if (tolerance !== 0) {\n const coordinates = this.coordinates;\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = snap(coordinates[i], tolerance);\n }\n }\n return super.finish();\n }\n\n /**\n * @private\n */\n setFillStrokeStyles_() {\n const state = this.state;\n const fillStyle = state.fillStyle;\n if (fillStyle !== undefined) {\n this.updateFillStyle(state, this.createFill);\n }\n if (state.strokeStyle !== undefined) {\n this.updateStrokeStyle(state, this.applyStroke);\n }\n }\n}\n\nexport default CanvasPolygonBuilder;\n","/**\n * @module ol/geom/flat/straightchunk\n */\n\n/**\n * @param {number} maxAngle Maximum acceptable angle delta between segments.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Array<number>} Start and end of the first suitable chunk of the\n * given `flatCoordinates`.\n */\nexport function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {\n let chunkStart = offset;\n let chunkEnd = offset;\n let chunkM = 0;\n let m = 0;\n let start = offset;\n let acos, i, m12, m23, x1, y1, x12, y12, x23, y23;\n for (i = offset; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n if (x1 !== undefined) {\n x23 = x2 - x1;\n y23 = y2 - y1;\n m23 = Math.sqrt(x23 * x23 + y23 * y23);\n if (x12 !== undefined) {\n m += m12;\n acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23));\n if (acos > maxAngle) {\n if (m > chunkM) {\n chunkM = m;\n chunkStart = start;\n chunkEnd = i;\n }\n m = 0;\n start = i - stride;\n }\n }\n m12 = m23;\n x12 = x23;\n y12 = y23;\n }\n x1 = x2;\n y1 = y2;\n }\n m += m23;\n return m > chunkM ? [start, i] : [chunkStart, chunkEnd];\n}\n","/**\n * @module ol/render/canvas/TextBuilder\n */\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction from './Instruction.js';\nimport GeometryType from '../../geom/GeometryType.js';\nimport TextPlacement from '../../style/TextPlacement.js';\nimport {asColorLike} from '../../colorlike.js';\nimport {\n defaultFillStyle,\n defaultFont,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultPadding,\n defaultStrokeStyle,\n defaultTextAlign,\n defaultTextBaseline,\n registerFont,\n} from '../canvas.js';\nimport {getUid} from '../../util.js';\nimport {intersects} from '../../extent.js';\nimport {matchingChunk} from '../../geom/flat/straightchunk.js';\n/**\n * @const\n * @enum {number}\n */\nexport const TEXT_ALIGN = {\n 'left': 0,\n 'end': 0,\n 'center': 0.5,\n 'right': 1,\n 'start': 1,\n 'top': 0,\n 'middle': 0.5,\n 'hanging': 0.2,\n 'alphabetic': 0.8,\n 'ideographic': 0.8,\n 'bottom': 1,\n};\n\nclass CanvasTextBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n\n /**\n * @private\n * @type {import(\"../canvas.js\").DeclutterGroups}\n */\n this.declutterGroups_;\n\n /**\n * @private\n * @type {Array<HTMLCanvasElement>}\n */\n this.labels_ = null;\n\n /**\n * @private\n * @type {string}\n */\n this.text_ = '';\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetY_ = 0;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.textRotateWithView_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.textRotation_ = 0;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.textFillState_ = null;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").FillState>}\n */\n this.fillStates = {};\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.textStrokeState_ = null;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").StrokeState>}\n */\n this.strokeStates = {};\n\n /**\n * @private\n * @type {import(\"../canvas.js\").TextState}\n */\n this.textState_ = /** @type {import(\"../canvas.js\").TextState} */ ({});\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").TextState>}\n */\n this.textStates = {};\n\n /**\n * @private\n * @type {string}\n */\n this.textKey_ = '';\n\n /**\n * @private\n * @type {string}\n */\n this.fillKey_ = '';\n\n /**\n * @private\n * @type {string}\n */\n this.strokeKey_ = '';\n }\n\n /**\n * @return {import(\"./Builder.js\").SerializableInstructions} the serializable instructions.\n */\n finish() {\n const instructions = super.finish();\n instructions.textStates = this.textStates;\n instructions.fillStates = this.fillStates;\n instructions.strokeStates = this.strokeStates;\n return instructions;\n }\n\n /**\n * @param {import(\"../../geom/SimpleGeometry.js\").default|import(\"../Feature.js\").default} geometry Geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n drawText(geometry, feature) {\n const fillState = this.textFillState_;\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n if (this.text_ === '' || !textState || (!fillState && !strokeState)) {\n return;\n }\n\n let begin = this.coordinates.length;\n\n const geometryType = geometry.getType();\n let flatCoordinates = null;\n let end = 2;\n let stride = geometry.getStride();\n let i, ii;\n\n if (textState.placement === TextPlacement.LINE) {\n if (!intersects(this.getBufferedMaxExtent(), geometry.getExtent())) {\n return;\n }\n let ends;\n flatCoordinates = geometry.getFlatCoordinates();\n if (geometryType == GeometryType.LINE_STRING) {\n ends = [flatCoordinates.length];\n } else if (geometryType == GeometryType.MULTI_LINE_STRING) {\n ends = /** @type {import(\"../../geom/MultiLineString.js\").default} */ (geometry).getEnds();\n } else if (geometryType == GeometryType.POLYGON) {\n ends = /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry)\n .getEnds()\n .slice(0, 1);\n } else if (geometryType == GeometryType.MULTI_POLYGON) {\n const endss = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (geometry).getEndss();\n ends = [];\n for (i = 0, ii = endss.length; i < ii; ++i) {\n ends.push(endss[i][0]);\n }\n }\n this.beginGeometry(geometry, feature);\n const textAlign = textState.textAlign;\n let flatOffset = 0;\n let flatEnd;\n for (let o = 0, oo = ends.length; o < oo; ++o) {\n if (textAlign == undefined) {\n const range = matchingChunk(\n textState.maxAngle,\n flatCoordinates,\n flatOffset,\n ends[o],\n stride\n );\n flatOffset = range[0];\n flatEnd = range[1];\n } else {\n flatEnd = ends[o];\n }\n for (i = flatOffset; i < flatEnd; i += stride) {\n this.coordinates.push(flatCoordinates[i], flatCoordinates[i + 1]);\n }\n end = this.coordinates.length;\n flatOffset = ends[o];\n const declutterGroup = this.declutterGroups_\n ? o === 0\n ? this.declutterGroups_[0]\n : [].concat(this.declutterGroups_[0])\n : null;\n this.drawChars_(begin, end, declutterGroup);\n begin = end;\n }\n this.endGeometry(feature);\n } else {\n let geometryWidths = null;\n if (!textState.overflow) {\n geometryWidths = [];\n }\n switch (geometryType) {\n case GeometryType.POINT:\n case GeometryType.MULTI_POINT:\n flatCoordinates = /** @type {import(\"../../geom/MultiPoint.js\").default} */ (geometry).getFlatCoordinates();\n end = flatCoordinates.length;\n break;\n case GeometryType.LINE_STRING:\n flatCoordinates = /** @type {import(\"../../geom/LineString.js\").default} */ (geometry).getFlatMidpoint();\n break;\n case GeometryType.CIRCLE:\n flatCoordinates = /** @type {import(\"../../geom/Circle.js\").default} */ (geometry).getCenter();\n break;\n case GeometryType.MULTI_LINE_STRING:\n flatCoordinates = /** @type {import(\"../../geom/MultiLineString.js\").default} */ (geometry).getFlatMidpoints();\n stride = 2;\n end = flatCoordinates.length;\n break;\n case GeometryType.POLYGON:\n flatCoordinates = /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry).getFlatInteriorPoint();\n if (!textState.overflow) {\n geometryWidths.push(flatCoordinates[2] / this.resolution);\n }\n stride = 3;\n break;\n case GeometryType.MULTI_POLYGON:\n const interiorPoints = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (geometry).getFlatInteriorPoints();\n flatCoordinates = [];\n for (i = 0, ii = interiorPoints.length; i < ii; i += 3) {\n if (!textState.overflow) {\n geometryWidths.push(interiorPoints[i + 2] / this.resolution);\n }\n flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);\n }\n stride = 2;\n end = flatCoordinates.length;\n if (end == 0) {\n return;\n }\n break;\n default:\n }\n end = this.appendFlatCoordinates(\n flatCoordinates,\n 0,\n end,\n stride,\n false,\n false\n );\n\n this.saveTextStates_();\n\n if (textState.backgroundFill || textState.backgroundStroke) {\n this.setFillStrokeStyle(\n textState.backgroundFill,\n textState.backgroundStroke\n );\n if (textState.backgroundFill) {\n this.updateFillStyle(this.state, this.createFill);\n this.hitDetectionInstructions.push(this.createFill(this.state));\n }\n if (textState.backgroundStroke) {\n this.updateStrokeStyle(this.state, this.applyStroke);\n this.hitDetectionInstructions.push(this.createStroke(this.state));\n }\n }\n\n this.beginGeometry(geometry, feature);\n\n // adjust padding for negative scale\n let padding = textState.padding;\n if (\n padding != defaultPadding &&\n (textState.scale[0] < 0 || textState.scale[1] < 0)\n ) {\n let p0 = textState.padding[0];\n let p1 = textState.padding[1];\n let p2 = textState.padding[2];\n let p3 = textState.padding[3];\n if (textState.scale[0] < 0) {\n p1 = -p1;\n p3 = -p3;\n }\n if (textState.scale[1] < 0) {\n p0 = -p0;\n p2 = -p2;\n }\n padding = [p0, p1, p2, p3];\n }\n\n // The image is unknown at this stage so we pass null; it will be computed at render time.\n // For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at\n // render time.\n const pixelRatio = this.pixelRatio;\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n begin,\n end,\n null,\n NaN,\n NaN,\n this.declutterGroups_,\n NaN,\n 1,\n 0,\n 0,\n this.textRotateWithView_,\n this.textRotation_,\n [1, 1],\n NaN,\n padding == defaultPadding\n ? defaultPadding\n : padding.map(function (p) {\n return p * pixelRatio;\n }),\n !!textState.backgroundFill,\n !!textState.backgroundStroke,\n this.text_,\n this.textKey_,\n this.strokeKey_,\n this.fillKey_,\n this.textOffsetX_,\n this.textOffsetY_,\n geometryWidths,\n ]);\n const scale = 1 / pixelRatio;\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n begin,\n end,\n null,\n NaN,\n NaN,\n this.declutterGroups_,\n NaN,\n 1,\n 0,\n 0,\n this.textRotateWithView_,\n this.textRotation_,\n [scale, scale],\n NaN,\n padding,\n !!textState.backgroundFill,\n !!textState.backgroundStroke,\n this.text_,\n this.textKey_,\n this.strokeKey_,\n this.fillKey_,\n this.textOffsetX_,\n this.textOffsetY_,\n geometryWidths,\n ]);\n\n this.endGeometry(feature);\n }\n }\n\n /**\n * @private\n */\n saveTextStates_() {\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n const fillState = this.textFillState_;\n\n const strokeKey = this.strokeKey_;\n if (strokeState) {\n if (!(strokeKey in this.strokeStates)) {\n this.strokeStates[strokeKey] = {\n strokeStyle: strokeState.strokeStyle,\n lineCap: strokeState.lineCap,\n lineDashOffset: strokeState.lineDashOffset,\n lineWidth: strokeState.lineWidth,\n lineJoin: strokeState.lineJoin,\n miterLimit: strokeState.miterLimit,\n lineDash: strokeState.lineDash,\n };\n }\n }\n const textKey = this.textKey_;\n if (!(textKey in this.textStates)) {\n this.textStates[textKey] = {\n font: textState.font,\n textAlign: textState.textAlign || defaultTextAlign,\n textBaseline: textState.textBaseline || defaultTextBaseline,\n scale: textState.scale,\n };\n }\n const fillKey = this.fillKey_;\n if (fillState) {\n if (!(fillKey in this.fillStates)) {\n this.fillStates[fillKey] = {\n fillStyle: fillState.fillStyle,\n };\n }\n }\n }\n\n /**\n * @private\n * @param {number} begin Begin.\n * @param {number} end End.\n * @param {import(\"../canvas.js\").DeclutterGroup} declutterGroup Declutter group.\n */\n drawChars_(begin, end, declutterGroup) {\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n\n const strokeKey = this.strokeKey_;\n const textKey = this.textKey_;\n const fillKey = this.fillKey_;\n this.saveTextStates_();\n\n const pixelRatio = this.pixelRatio;\n const baseline = TEXT_ALIGN[textState.textBaseline];\n\n const offsetY = this.textOffsetY_ * pixelRatio;\n const text = this.text_;\n const strokeWidth = strokeState\n ? (strokeState.lineWidth * Math.abs(textState.scale[0])) / 2\n : 0;\n\n this.instructions.push([\n CanvasInstruction.DRAW_CHARS,\n begin,\n end,\n baseline,\n declutterGroup,\n textState.overflow,\n fillKey,\n textState.maxAngle,\n pixelRatio,\n offsetY,\n strokeKey,\n strokeWidth * pixelRatio,\n text,\n textKey,\n 1,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_CHARS,\n begin,\n end,\n baseline,\n declutterGroup,\n textState.overflow,\n fillKey,\n textState.maxAngle,\n 1,\n offsetY,\n strokeKey,\n strokeWidth,\n text,\n textKey,\n 1 / pixelRatio,\n ]);\n }\n\n /**\n * @param {import(\"../../style/Text.js\").default} textStyle Text style.\n * @param {import(\"../canvas.js\").DeclutterGroups} declutterGroups Declutter.\n */\n setTextStyle(textStyle, declutterGroups) {\n let textState, fillState, strokeState;\n if (!textStyle) {\n this.text_ = '';\n } else {\n this.declutterGroups_ = declutterGroups;\n\n const textFillStyle = textStyle.getFill();\n if (!textFillStyle) {\n fillState = null;\n this.textFillState_ = fillState;\n } else {\n fillState = this.textFillState_;\n if (!fillState) {\n fillState = /** @type {import(\"../canvas.js\").FillState} */ ({});\n this.textFillState_ = fillState;\n }\n fillState.fillStyle = asColorLike(\n textFillStyle.getColor() || defaultFillStyle\n );\n }\n\n const textStrokeStyle = textStyle.getStroke();\n if (!textStrokeStyle) {\n strokeState = null;\n this.textStrokeState_ = strokeState;\n } else {\n strokeState = this.textStrokeState_;\n if (!strokeState) {\n strokeState = /** @type {import(\"../canvas.js\").StrokeState} */ ({});\n this.textStrokeState_ = strokeState;\n }\n const lineDash = textStrokeStyle.getLineDash();\n const lineDashOffset = textStrokeStyle.getLineDashOffset();\n const lineWidth = textStrokeStyle.getWidth();\n const miterLimit = textStrokeStyle.getMiterLimit();\n strokeState.lineCap = textStrokeStyle.getLineCap() || defaultLineCap;\n strokeState.lineDash = lineDash ? lineDash.slice() : defaultLineDash;\n strokeState.lineDashOffset =\n lineDashOffset === undefined ? defaultLineDashOffset : lineDashOffset;\n strokeState.lineJoin = textStrokeStyle.getLineJoin() || defaultLineJoin;\n strokeState.lineWidth =\n lineWidth === undefined ? defaultLineWidth : lineWidth;\n strokeState.miterLimit =\n miterLimit === undefined ? defaultMiterLimit : miterLimit;\n strokeState.strokeStyle = asColorLike(\n textStrokeStyle.getColor() || defaultStrokeStyle\n );\n }\n\n textState = this.textState_;\n const font = textStyle.getFont() || defaultFont;\n registerFont(font);\n const textScale = textStyle.getScaleArray();\n textState.overflow = textStyle.getOverflow();\n textState.font = font;\n textState.maxAngle = textStyle.getMaxAngle();\n textState.placement = textStyle.getPlacement();\n textState.textAlign = textStyle.getTextAlign();\n textState.textBaseline =\n textStyle.getTextBaseline() || defaultTextBaseline;\n textState.backgroundFill = textStyle.getBackgroundFill();\n textState.backgroundStroke = textStyle.getBackgroundStroke();\n textState.padding = textStyle.getPadding() || defaultPadding;\n textState.scale = textScale === undefined ? [1, 1] : textScale;\n\n const textOffsetX = textStyle.getOffsetX();\n const textOffsetY = textStyle.getOffsetY();\n const textRotateWithView = textStyle.getRotateWithView();\n const textRotation = textStyle.getRotation();\n this.text_ = textStyle.getText() || '';\n this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;\n this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;\n this.textRotateWithView_ =\n textRotateWithView === undefined ? false : textRotateWithView;\n this.textRotation_ = textRotation === undefined ? 0 : textRotation;\n\n this.strokeKey_ = strokeState\n ? (typeof strokeState.strokeStyle == 'string'\n ? strokeState.strokeStyle\n : getUid(strokeState.strokeStyle)) +\n strokeState.lineCap +\n strokeState.lineDashOffset +\n '|' +\n strokeState.lineWidth +\n strokeState.lineJoin +\n strokeState.miterLimit +\n '[' +\n strokeState.lineDash.join() +\n ']'\n : '';\n this.textKey_ =\n textState.font +\n textState.scale +\n (textState.textAlign || '?') +\n (textState.textBaseline || '?');\n this.fillKey_ = fillState\n ? typeof fillState.fillStyle == 'string'\n ? fillState.fillStyle\n : '|' + getUid(fillState.fillStyle)\n : '';\n }\n }\n}\n\nexport default CanvasTextBuilder;\n","/**\n * @module ol/render/canvas/BuilderGroup\n */\n\nimport Builder from './Builder.js';\nimport ImageBuilder from './ImageBuilder.js';\nimport LineStringBuilder from './LineStringBuilder.js';\nimport PolygonBuilder from './PolygonBuilder.js';\nimport TextBuilder from './TextBuilder.js';\n\n/**\n * @type {Object<import(\"./BuilderType\").default, typeof Builder>}\n */\nconst BATCH_CONSTRUCTORS = {\n 'Circle': PolygonBuilder,\n 'Default': Builder,\n 'Image': ImageBuilder,\n 'LineString': LineStringBuilder,\n 'Polygon': PolygonBuilder,\n 'Text': TextBuilder,\n};\n\nclass BuilderGroup {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Max extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} declutter Decluttering enabled.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio, declutter) {\n /**\n * @type {boolean}\n * @private\n */\n this.declutter_ = declutter;\n\n /**\n * @type {import(\"../canvas.js\").DeclutterGroups}\n * @private\n */\n this.declutterGroups_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.tolerance_ = tolerance;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent_ = maxExtent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.resolution_ = resolution;\n\n /**\n * @private\n * @type {!Object<string, !Object<import(\"./BuilderType\").default, Builder>>}\n */\n this.buildersByZIndex_ = {};\n }\n\n /**\n * @param {boolean} group Group with previous builder.\n * @return {import(\"../canvas\").DeclutterGroups} The resulting instruction groups.\n */\n addDeclutter(group) {\n /** @type {Array<*>} */\n let declutter = null;\n if (this.declutter_) {\n if (group) {\n declutter = this.declutterGroups_;\n /** @type {number} */ (declutter[0][0])++;\n } else {\n declutter = [[1]];\n this.declutterGroups_ = declutter;\n }\n }\n return declutter;\n }\n\n /**\n * @return {!Object<string, !Object<import(\"./BuilderType\").default, import(\"./Builder.js\").SerializableInstructions>>} The serializable instructions\n */\n finish() {\n const builderInstructions = {};\n for (const zKey in this.buildersByZIndex_) {\n builderInstructions[zKey] = builderInstructions[zKey] || {};\n const builders = this.buildersByZIndex_[zKey];\n for (const builderKey in builders) {\n const builderInstruction = builders[builderKey].finish();\n builderInstructions[zKey][builderKey] = builderInstruction;\n }\n }\n return builderInstructions;\n }\n\n /**\n * @param {number|undefined} zIndex Z index.\n * @param {import(\"./BuilderType.js\").default} builderType Replay type.\n * @return {import(\"../VectorContext.js\").default} Replay.\n */\n getBuilder(zIndex, builderType) {\n const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';\n let replays = this.buildersByZIndex_[zIndexKey];\n if (replays === undefined) {\n replays = {};\n this.buildersByZIndex_[zIndexKey] = replays;\n }\n let replay = replays[builderType];\n if (replay === undefined) {\n const Constructor = BATCH_CONSTRUCTORS[builderType];\n replay = new Constructor(\n this.tolerance_,\n this.maxExtent_,\n this.resolution_,\n this.pixelRatio_\n );\n replays[builderType] = replay;\n }\n return replay;\n }\n}\n\nexport default BuilderGroup;\n","/**\n * @module ol/renderer/Layer\n */\nimport EventType from '../events/EventType.js';\nimport ImageState from '../ImageState.js';\nimport Observable from '../Observable.js';\nimport SourceState from '../source/State.js';\nimport {abstract} from '../util.js';\n\n/**\n * @template {import(\"../layer/Layer.js\").default} LayerType\n */\nclass LayerRenderer extends Observable {\n /**\n * @param {LayerType} layer Layer.\n */\n constructor(layer) {\n super();\n\n /** @private */\n this.boundHandleImageChange_ = this.handleImageChange_.bind(this);\n\n /**\n * @protected\n * @type {LayerType}\n */\n this.layer_ = layer;\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").default>>} Promise that resolves with\n * an array of features.\n */\n getFeatures(pixel) {\n return abstract();\n }\n\n /**\n * Determine whether render should be called.\n * @abstract\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n */\n prepareFrame(frameState) {\n return abstract();\n }\n\n /**\n * Render the layer.\n * @abstract\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n */\n renderFrame(frameState, target) {\n return abstract();\n }\n\n /**\n * @param {Object<number, Object<string, import(\"../Tile.js\").default>>} tiles Lookup of loaded tiles by zoom level.\n * @param {number} zoom Zoom level.\n * @param {import(\"../Tile.js\").default} tile Tile.\n * @return {boolean|void} If `false`, the tile will not be considered loaded.\n */\n loadedTileCallback(tiles, zoom, tile) {\n if (!tiles[zoom]) {\n tiles[zoom] = {};\n }\n tiles[zoom][tile.tileCoord.toString()] = tile;\n return undefined;\n }\n\n /**\n * Create a function that adds loaded tiles to the tile lookup.\n * @param {import(\"../source/Tile.js\").default} source Tile source.\n * @param {import(\"../proj/Projection.js\").default} projection Projection of the tiles.\n * @param {Object<number, Object<string, import(\"../Tile.js\").default>>} tiles Lookup of loaded tiles by zoom level.\n * @return {function(number, import(\"../TileRange.js\").default):boolean} A function that can be\n * called with a zoom level and a tile range to add loaded tiles to the lookup.\n * @protected\n */\n createLoadedTileFinder(source, projection, tiles) {\n return (\n /**\n * @param {number} zoom Zoom level.\n * @param {import(\"../TileRange.js\").default} tileRange Tile range.\n * @return {boolean} The tile range is fully loaded.\n * @this {LayerRenderer}\n */\n function (zoom, tileRange) {\n const callback = this.loadedTileCallback.bind(this, tiles, zoom);\n return source.forEachLoadedTile(projection, zoom, tileRange, callback);\n }.bind(this)\n );\n }\n /**\n * @abstract\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../Feature.js\").FeatureLike, import(\"../layer/Layer.js\").default): T} callback Feature callback.\n * @param {Array<import(\"../Feature.js\").FeatureLike>} declutteredFeatures Decluttered features.\n * @return {T|void} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n declutteredFeatures\n ) {}\n\n /**\n * @abstract\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel\n * location, null will be returned. If there is data, but pixel values cannot be\n * returned, and empty array will be returned.\n */\n getDataAtPixel(pixel, frameState, hitTolerance) {\n return abstract();\n }\n\n /**\n * @return {LayerType} Layer.\n */\n getLayer() {\n return this.layer_;\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n * @abstract\n */\n handleFontsChanged() {}\n\n /**\n * Handle changes in image state.\n * @param {import(\"../events/Event.js\").default} event Image change event.\n * @private\n */\n handleImageChange_(event) {\n const image = /** @type {import(\"../Image.js\").default} */ (event.target);\n if (image.getState() === ImageState.LOADED) {\n this.renderIfReadyAndVisible();\n }\n }\n\n /**\n * Load the image if not already loaded, and register the image change\n * listener if needed.\n * @param {import(\"../ImageBase.js\").default} image Image.\n * @return {boolean} `true` if the image is already loaded, `false` otherwise.\n * @protected\n */\n loadImage(image) {\n let imageState = image.getState();\n if (imageState != ImageState.LOADED && imageState != ImageState.ERROR) {\n image.addEventListener(EventType.CHANGE, this.boundHandleImageChange_);\n }\n if (imageState == ImageState.IDLE) {\n image.load();\n imageState = image.getState();\n }\n return imageState == ImageState.LOADED;\n }\n\n /**\n * @protected\n */\n renderIfReadyAndVisible() {\n const layer = this.getLayer();\n if (layer.getVisible() && layer.getSourceState() == SourceState.READY) {\n layer.changed();\n }\n }\n}\n\nexport default LayerRenderer;\n","/**\n * @module ol/render/Event\n */\n\nimport Event from '../events/Event.js';\n\nclass RenderEvent extends Event {\n /**\n * @param {import(\"./EventType.js\").default} type Type.\n * @param {import(\"../transform.js\").Transform=} opt_inversePixelTransform Transform for\n * CSS pixels to rendered pixels.\n * @param {import(\"../PluggableMap.js\").FrameState=} opt_frameState Frame state.\n * @param {?CanvasRenderingContext2D=} opt_context Context.\n */\n constructor(type, opt_inversePixelTransform, opt_frameState, opt_context) {\n super(type);\n\n /**\n * Transform from CSS pixels (relative to the top-left corner of the map viewport)\n * to rendered pixels on this event's `context`.\n * @type {import(\"../transform.js\").Transform|undefined}\n * @api\n */\n this.inversePixelTransform = opt_inversePixelTransform;\n\n /**\n * An object representing the current render frame state.\n * @type {import(\"../PluggableMap.js\").FrameState|undefined}\n * @api\n */\n this.frameState = opt_frameState;\n\n /**\n * Canvas context. Not available when the event is dispatched by the map. Only available\n * when a Canvas renderer is used, null otherwise.\n * @type {CanvasRenderingContext2D|null|undefined}\n * @api\n */\n this.context = opt_context;\n }\n}\n\nexport default RenderEvent;\n","/**\n * @module ol/renderer/canvas/Layer\n */\nimport LayerRenderer from '../Layer.js';\nimport RenderEvent from '../../render/Event.js';\nimport RenderEventType from '../../render/EventType.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {\n getBottomLeft,\n getBottomRight,\n getTopLeft,\n getTopRight,\n} from '../../extent.js';\nimport {rotateAtOffset} from '../../render/canvas.js';\n\n/**\n * @abstract\n * @template {import(\"../../layer/Layer.js\").default} LayerType\n */\nclass CanvasLayerRenderer extends LayerRenderer {\n /**\n * @param {LayerType} layer Layer.\n */\n constructor(layer) {\n super(layer);\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.container = null;\n\n /**\n * @protected\n * @type {number}\n */\n this.renderedResolution;\n\n /**\n * A temporary transform. The values in this transform should only be used in a\n * function that sets the values.\n * @protected\n * @type {import(\"../../transform.js\").Transform}\n */\n this.tempTransform = createTransform();\n\n /**\n * The transform for rendered pixels to viewport CSS pixels. This transform must\n * be set when rendering a frame and may be used by other functions after rendering.\n * @protected\n * @type {import(\"../../transform.js\").Transform}\n */\n this.pixelTransform = createTransform();\n\n /**\n * The transform for viewport CSS pixels to rendered pixels. This transform must\n * be set when rendering a frame and may be used by other functions after rendering.\n * @protected\n * @type {import(\"../../transform.js\").Transform}\n */\n this.inversePixelTransform = createTransform();\n\n /**\n * @type {CanvasRenderingContext2D}\n */\n this.context = null;\n\n /**\n * @type {boolean}\n */\n this.containerReused = false;\n }\n\n /**\n * Get a rendering container from an existing target, if compatible.\n * @param {HTMLElement} target Potential render target.\n * @param {string} transform CSS Transform.\n * @param {number} opacity Opacity.\n */\n useContainer(target, transform, opacity) {\n const layerClassName = this.getLayer().getClassName();\n let container, context;\n if (\n target &&\n target.style.opacity === '' &&\n target.className === layerClassName\n ) {\n const canvas = target.firstElementChild;\n if (canvas instanceof HTMLCanvasElement) {\n context = canvas.getContext('2d');\n }\n }\n if (\n context &&\n (context.canvas.width === 0 ||\n context.canvas.style.transform === transform)\n ) {\n // Container of the previous layer renderer can be used.\n this.container = target;\n this.context = context;\n this.containerReused = true;\n } else if (this.containerReused) {\n // Previously reused container cannot be used any more.\n this.container = null;\n this.context = null;\n this.containerReused = false;\n }\n if (!this.container) {\n container = document.createElement('div');\n container.className = layerClassName;\n let style = container.style;\n style.position = 'absolute';\n style.width = '100%';\n style.height = '100%';\n context = createCanvasContext2D();\n const canvas = context.canvas;\n container.appendChild(canvas);\n style = canvas.style;\n style.position = 'absolute';\n style.left = '0';\n style.transformOrigin = 'top left';\n this.container = container;\n this.context = context;\n }\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent Clip extent.\n * @protected\n */\n clip(context, frameState, extent) {\n const pixelRatio = frameState.pixelRatio;\n const halfWidth = (frameState.size[0] * pixelRatio) / 2;\n const halfHeight = (frameState.size[1] * pixelRatio) / 2;\n const rotation = frameState.viewState.rotation;\n const topLeft = getTopLeft(extent);\n const topRight = getTopRight(extent);\n const bottomRight = getBottomRight(extent);\n const bottomLeft = getBottomLeft(extent);\n\n applyTransform(frameState.coordinateToPixelTransform, topLeft);\n applyTransform(frameState.coordinateToPixelTransform, topRight);\n applyTransform(frameState.coordinateToPixelTransform, bottomRight);\n applyTransform(frameState.coordinateToPixelTransform, bottomLeft);\n\n context.save();\n rotateAtOffset(context, -rotation, halfWidth, halfHeight);\n context.beginPath();\n context.moveTo(topLeft[0] * pixelRatio, topLeft[1] * pixelRatio);\n context.lineTo(topRight[0] * pixelRatio, topRight[1] * pixelRatio);\n context.lineTo(bottomRight[0] * pixelRatio, bottomRight[1] * pixelRatio);\n context.lineTo(bottomLeft[0] * pixelRatio, bottomLeft[1] * pixelRatio);\n context.clip();\n rotateAtOffset(context, rotation, halfWidth, halfHeight);\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent Clip extent.\n * @protected\n */\n clipUnrotated(context, frameState, extent) {\n const topLeft = getTopLeft(extent);\n const topRight = getTopRight(extent);\n const bottomRight = getBottomRight(extent);\n const bottomLeft = getBottomLeft(extent);\n\n applyTransform(frameState.coordinateToPixelTransform, topLeft);\n applyTransform(frameState.coordinateToPixelTransform, topRight);\n applyTransform(frameState.coordinateToPixelTransform, bottomRight);\n applyTransform(frameState.coordinateToPixelTransform, bottomLeft);\n\n const inverted = this.inversePixelTransform;\n applyTransform(inverted, topLeft);\n applyTransform(inverted, topRight);\n applyTransform(inverted, bottomRight);\n applyTransform(inverted, bottomLeft);\n\n context.save();\n context.beginPath();\n context.moveTo(Math.round(topLeft[0]), Math.round(topLeft[1]));\n context.lineTo(Math.round(topRight[0]), Math.round(topRight[1]));\n context.lineTo(Math.round(bottomRight[0]), Math.round(bottomRight[1]));\n context.lineTo(Math.round(bottomLeft[0]), Math.round(bottomLeft[1]));\n context.clip();\n }\n\n /**\n * @param {import(\"../../render/EventType.js\").default} type Event type.\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @private\n */\n dispatchRenderEvent_(type, context, frameState) {\n const layer = this.getLayer();\n if (layer.hasListener(type)) {\n const event = new RenderEvent(\n type,\n this.inversePixelTransform,\n frameState,\n context\n );\n layer.dispatchEvent(event);\n }\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @protected\n */\n preRender(context, frameState) {\n this.dispatchRenderEvent_(RenderEventType.PRERENDER, context, frameState);\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @protected\n */\n postRender(context, frameState) {\n this.dispatchRenderEvent_(RenderEventType.POSTRENDER, context, frameState);\n }\n\n /**\n * Creates a transform for rendering to an element that will be rotated after rendering.\n * @param {import(\"../../coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} width Width of the rendered element (in pixels).\n * @param {number} height Height of the rendered element (in pixels).\n * @param {number} offsetX Offset on the x-axis in view coordinates.\n * @protected\n * @return {!import(\"../../transform.js\").Transform} Transform.\n */\n getRenderTransform(\n center,\n resolution,\n rotation,\n pixelRatio,\n width,\n height,\n offsetX\n ) {\n const dx1 = width / 2;\n const dy1 = height / 2;\n const sx = pixelRatio / resolution;\n const sy = -sx;\n const dx2 = -center[0] + offsetX;\n const dy2 = -center[1];\n return composeTransform(\n this.tempTransform,\n dx1,\n dy1,\n sx,\n sy,\n -rotation,\n dx2,\n dy2\n );\n }\n\n /**\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel\n * location, null will be returned. If there is data, but pixel values cannot be\n * returned, and empty array will be returned.\n */\n getDataAtPixel(pixel, frameState, hitTolerance) {\n const renderPixel = applyTransform(\n this.inversePixelTransform,\n pixel.slice()\n );\n const context = this.context;\n\n let data;\n try {\n const x = Math.round(renderPixel[0]);\n const y = Math.round(renderPixel[1]);\n const newCanvas = document.createElement('canvas');\n const newContext = newCanvas.getContext('2d');\n newCanvas.width = 1;\n newCanvas.height = 1;\n newContext.clearRect(0, 0, 1, 1);\n newContext.drawImage(context.canvas, x, y, 1, 1, 0, 0, 1, 1);\n data = newContext.getImageData(0, 0, 1, 1).data;\n } catch (err) {\n if (err.name === 'SecurityError') {\n // tainted canvas, we assume there is data at the given pixel (although there might not be)\n return new Uint8Array();\n }\n return data;\n }\n\n if (data[3] === 0) {\n return null;\n }\n return data;\n }\n}\n\nexport default CanvasLayerRenderer;\n","/**\n * @module ol/render/canvas/BuilderType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n CIRCLE: 'Circle',\n DEFAULT: 'Default',\n IMAGE: 'Image',\n LINE_STRING: 'LineString',\n POLYGON: 'Polygon',\n TEXT: 'Text',\n};\n","(function (global, factory) {\ntypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\ntypeof define === 'function' && define.amd ? define(factory) :\n(global = global || self, global.RBush = factory());\n}(this, function () { 'use strict';\n\nfunction quickselect(arr, k, left, right, compare) {\n quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);\n}\n\nfunction quickselectStep(arr, k, left, right, compare) {\n\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselectStep(arr, k, newLeft, newRight, compare);\n }\n\n var t = arr[k];\n var i = left;\n var j = right;\n\n swap(arr, left, k);\n if (compare(arr[right], t) > 0) { swap(arr, left, right); }\n\n while (i < j) {\n swap(arr, i, j);\n i++;\n j--;\n while (compare(arr[i], t) < 0) { i++; }\n while (compare(arr[j], t) > 0) { j--; }\n }\n\n if (compare(arr[left], t) === 0) { swap(arr, left, j); }\n else {\n j++;\n swap(arr, j, right);\n }\n\n if (j <= k) { left = j + 1; }\n if (k <= j) { right = j - 1; }\n }\n}\n\nfunction swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nvar RBush = function RBush(maxEntries) {\n if ( maxEntries === void 0 ) maxEntries = 9;\n\n // max entries in a node is 9 by default; min node fill is 40% for best performance\n this._maxEntries = Math.max(4, maxEntries);\n this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));\n this.clear();\n};\n\nRBush.prototype.all = function all () {\n return this._all(this.data, []);\n};\n\nRBush.prototype.search = function search (bbox) {\n var node = this.data;\n var result = [];\n\n if (!intersects(bbox, node)) { return result; }\n\n var toBBox = this.toBBox;\n var nodesToSearch = [];\n\n while (node) {\n for (var i = 0; i < node.children.length; i++) {\n var child = node.children[i];\n var childBBox = node.leaf ? toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf) { result.push(child); }\n else if (contains(bbox, childBBox)) { this._all(child, result); }\n else { nodesToSearch.push(child); }\n }\n }\n node = nodesToSearch.pop();\n }\n\n return result;\n};\n\nRBush.prototype.collides = function collides (bbox) {\n var node = this.data;\n\n if (!intersects(bbox, node)) { return false; }\n\n var nodesToSearch = [];\n while (node) {\n for (var i = 0; i < node.children.length; i++) {\n var child = node.children[i];\n var childBBox = node.leaf ? this.toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf || contains(bbox, childBBox)) { return true; }\n nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return false;\n};\n\nRBush.prototype.load = function load (data) {\n if (!(data && data.length)) { return this; }\n\n if (data.length < this._minEntries) {\n for (var i = 0; i < data.length; i++) {\n this.insert(data[i]);\n }\n return this;\n }\n\n // recursively build the tree with the given data from scratch using OMT algorithm\n var node = this._build(data.slice(), 0, data.length - 1, 0);\n\n if (!this.data.children.length) {\n // save as is if tree is empty\n this.data = node;\n\n } else if (this.data.height === node.height) {\n // split root if trees have the same height\n this._splitRoot(this.data, node);\n\n } else {\n if (this.data.height < node.height) {\n // swap trees if inserted one is bigger\n var tmpNode = this.data;\n this.data = node;\n node = tmpNode;\n }\n\n // insert the small tree into the large tree at appropriate level\n this._insert(node, this.data.height - node.height - 1, true);\n }\n\n return this;\n};\n\nRBush.prototype.insert = function insert (item) {\n if (item) { this._insert(item, this.data.height - 1); }\n return this;\n};\n\nRBush.prototype.clear = function clear () {\n this.data = createNode([]);\n return this;\n};\n\nRBush.prototype.remove = function remove (item, equalsFn) {\n if (!item) { return this; }\n\n var node = this.data;\n var bbox = this.toBBox(item);\n var path = [];\n var indexes = [];\n var i, parent, goingUp;\n\n // depth-first iterative tree traversal\n while (node || path.length) {\n\n if (!node) { // go up\n node = path.pop();\n parent = path[path.length - 1];\n i = indexes.pop();\n goingUp = true;\n }\n\n if (node.leaf) { // check current node\n var index = findItem(item, node.children, equalsFn);\n\n if (index !== -1) {\n // item found, remove the item and condense tree upwards\n node.children.splice(index, 1);\n path.push(node);\n this._condense(path);\n return this;\n }\n }\n\n if (!goingUp && !node.leaf && contains(node, bbox)) { // go down\n path.push(node);\n indexes.push(i);\n i = 0;\n parent = node;\n node = node.children[0];\n\n } else if (parent) { // go right\n i++;\n node = parent.children[i];\n goingUp = false;\n\n } else { node = null; } // nothing found\n }\n\n return this;\n};\n\nRBush.prototype.toBBox = function toBBox (item) { return item; };\n\nRBush.prototype.compareMinX = function compareMinX (a, b) { return a.minX - b.minX; };\nRBush.prototype.compareMinY = function compareMinY (a, b) { return a.minY - b.minY; };\n\nRBush.prototype.toJSON = function toJSON () { return this.data; };\n\nRBush.prototype.fromJSON = function fromJSON (data) {\n this.data = data;\n return this;\n};\n\nRBush.prototype._all = function _all (node, result) {\n var nodesToSearch = [];\n while (node) {\n if (node.leaf) { result.push.apply(result, node.children); }\n else { nodesToSearch.push.apply(nodesToSearch, node.children); }\n\n node = nodesToSearch.pop();\n }\n return result;\n};\n\nRBush.prototype._build = function _build (items, left, right, height) {\n\n var N = right - left + 1;\n var M = this._maxEntries;\n var node;\n\n if (N <= M) {\n // reached leaf level; return leaf\n node = createNode(items.slice(left, right + 1));\n calcBBox(node, this.toBBox);\n return node;\n }\n\n if (!height) {\n // target height of the bulk-loaded tree\n height = Math.ceil(Math.log(N) / Math.log(M));\n\n // target number of root entries to maximize storage utilization\n M = Math.ceil(N / Math.pow(M, height - 1));\n }\n\n node = createNode([]);\n node.leaf = false;\n node.height = height;\n\n // split the items into M mostly square tiles\n\n var N2 = Math.ceil(N / M);\n var N1 = N2 * Math.ceil(Math.sqrt(M));\n\n multiSelect(items, left, right, N1, this.compareMinX);\n\n for (var i = left; i <= right; i += N1) {\n\n var right2 = Math.min(i + N1 - 1, right);\n\n multiSelect(items, i, right2, N2, this.compareMinY);\n\n for (var j = i; j <= right2; j += N2) {\n\n var right3 = Math.min(j + N2 - 1, right2);\n\n // pack each entry recursively\n node.children.push(this._build(items, j, right3, height - 1));\n }\n }\n\n calcBBox(node, this.toBBox);\n\n return node;\n};\n\nRBush.prototype._chooseSubtree = function _chooseSubtree (bbox, node, level, path) {\n while (true) {\n path.push(node);\n\n if (node.leaf || path.length - 1 === level) { break; }\n\n var minArea = Infinity;\n var minEnlargement = Infinity;\n var targetNode = (void 0);\n\n for (var i = 0; i < node.children.length; i++) {\n var child = node.children[i];\n var area = bboxArea(child);\n var enlargement = enlargedArea(bbox, child) - area;\n\n // choose entry with the least area enlargement\n if (enlargement < minEnlargement) {\n minEnlargement = enlargement;\n minArea = area < minArea ? area : minArea;\n targetNode = child;\n\n } else if (enlargement === minEnlargement) {\n // otherwise choose one with the smallest area\n if (area < minArea) {\n minArea = area;\n targetNode = child;\n }\n }\n }\n\n node = targetNode || node.children[0];\n }\n\n return node;\n};\n\nRBush.prototype._insert = function _insert (item, level, isNode) {\n var bbox = isNode ? item : this.toBBox(item);\n var insertPath = [];\n\n // find the best node for accommodating the item, saving all nodes along the path too\n var node = this._chooseSubtree(bbox, this.data, level, insertPath);\n\n // put the item into the node\n node.children.push(item);\n extend(node, bbox);\n\n // split on node overflow; propagate upwards if necessary\n while (level >= 0) {\n if (insertPath[level].children.length > this._maxEntries) {\n this._split(insertPath, level);\n level--;\n } else { break; }\n }\n\n // adjust bboxes along the insertion path\n this._adjustParentBBoxes(bbox, insertPath, level);\n};\n\n// split overflowed node into two\nRBush.prototype._split = function _split (insertPath, level) {\n var node = insertPath[level];\n var M = node.children.length;\n var m = this._minEntries;\n\n this._chooseSplitAxis(node, m, M);\n\n var splitIndex = this._chooseSplitIndex(node, m, M);\n\n var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));\n newNode.height = node.height;\n newNode.leaf = node.leaf;\n\n calcBBox(node, this.toBBox);\n calcBBox(newNode, this.toBBox);\n\n if (level) { insertPath[level - 1].children.push(newNode); }\n else { this._splitRoot(node, newNode); }\n};\n\nRBush.prototype._splitRoot = function _splitRoot (node, newNode) {\n // split root node\n this.data = createNode([node, newNode]);\n this.data.height = node.height + 1;\n this.data.leaf = false;\n calcBBox(this.data, this.toBBox);\n};\n\nRBush.prototype._chooseSplitIndex = function _chooseSplitIndex (node, m, M) {\n var index;\n var minOverlap = Infinity;\n var minArea = Infinity;\n\n for (var i = m; i <= M - m; i++) {\n var bbox1 = distBBox(node, 0, i, this.toBBox);\n var bbox2 = distBBox(node, i, M, this.toBBox);\n\n var overlap = intersectionArea(bbox1, bbox2);\n var area = bboxArea(bbox1) + bboxArea(bbox2);\n\n // choose distribution with minimum overlap\n if (overlap < minOverlap) {\n minOverlap = overlap;\n index = i;\n\n minArea = area < minArea ? area : minArea;\n\n } else if (overlap === minOverlap) {\n // otherwise choose distribution with minimum area\n if (area < minArea) {\n minArea = area;\n index = i;\n }\n }\n }\n\n return index || M - m;\n};\n\n// sorts node children by the best axis for split\nRBush.prototype._chooseSplitAxis = function _chooseSplitAxis (node, m, M) {\n var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;\n var compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;\n var xMargin = this._allDistMargin(node, m, M, compareMinX);\n var yMargin = this._allDistMargin(node, m, M, compareMinY);\n\n // if total distributions margin value is minimal for x, sort by minX,\n // otherwise it's already sorted by minY\n if (xMargin < yMargin) { node.children.sort(compareMinX); }\n};\n\n// total margin of all possible split distributions where each node is at least m full\nRBush.prototype._allDistMargin = function _allDistMargin (node, m, M, compare) {\n node.children.sort(compare);\n\n var toBBox = this.toBBox;\n var leftBBox = distBBox(node, 0, m, toBBox);\n var rightBBox = distBBox(node, M - m, M, toBBox);\n var margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);\n\n for (var i = m; i < M - m; i++) {\n var child = node.children[i];\n extend(leftBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(leftBBox);\n }\n\n for (var i$1 = M - m - 1; i$1 >= m; i$1--) {\n var child$1 = node.children[i$1];\n extend(rightBBox, node.leaf ? toBBox(child$1) : child$1);\n margin += bboxMargin(rightBBox);\n }\n\n return margin;\n};\n\nRBush.prototype._adjustParentBBoxes = function _adjustParentBBoxes (bbox, path, level) {\n // adjust bboxes along the given tree path\n for (var i = level; i >= 0; i--) {\n extend(path[i], bbox);\n }\n};\n\nRBush.prototype._condense = function _condense (path) {\n // go through the path, removing empty nodes and updating bboxes\n for (var i = path.length - 1, siblings = (void 0); i >= 0; i--) {\n if (path[i].children.length === 0) {\n if (i > 0) {\n siblings = path[i - 1].children;\n siblings.splice(siblings.indexOf(path[i]), 1);\n\n } else { this.clear(); }\n\n } else { calcBBox(path[i], this.toBBox); }\n }\n};\n\nfunction findItem(item, items, equalsFn) {\n if (!equalsFn) { return items.indexOf(item); }\n\n for (var i = 0; i < items.length; i++) {\n if (equalsFn(item, items[i])) { return i; }\n }\n return -1;\n}\n\n// calculate node's bbox from bboxes of its children\nfunction calcBBox(node, toBBox) {\n distBBox(node, 0, node.children.length, toBBox, node);\n}\n\n// min bounding rectangle of node children from k to p-1\nfunction distBBox(node, k, p, toBBox, destNode) {\n if (!destNode) { destNode = createNode(null); }\n destNode.minX = Infinity;\n destNode.minY = Infinity;\n destNode.maxX = -Infinity;\n destNode.maxY = -Infinity;\n\n for (var i = k; i < p; i++) {\n var child = node.children[i];\n extend(destNode, node.leaf ? toBBox(child) : child);\n }\n\n return destNode;\n}\n\nfunction extend(a, b) {\n a.minX = Math.min(a.minX, b.minX);\n a.minY = Math.min(a.minY, b.minY);\n a.maxX = Math.max(a.maxX, b.maxX);\n a.maxY = Math.max(a.maxY, b.maxY);\n return a;\n}\n\nfunction compareNodeMinX(a, b) { return a.minX - b.minX; }\nfunction compareNodeMinY(a, b) { return a.minY - b.minY; }\n\nfunction bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }\nfunction bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }\n\nfunction enlargedArea(a, b) {\n return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *\n (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));\n}\n\nfunction intersectionArea(a, b) {\n var minX = Math.max(a.minX, b.minX);\n var minY = Math.max(a.minY, b.minY);\n var maxX = Math.min(a.maxX, b.maxX);\n var maxY = Math.min(a.maxY, b.maxY);\n\n return Math.max(0, maxX - minX) *\n Math.max(0, maxY - minY);\n}\n\nfunction contains(a, b) {\n return a.minX <= b.minX &&\n a.minY <= b.minY &&\n b.maxX <= a.maxX &&\n b.maxY <= a.maxY;\n}\n\nfunction intersects(a, b) {\n return b.minX <= a.maxX &&\n b.minY <= a.maxY &&\n b.maxX >= a.minX &&\n b.maxY >= a.minY;\n}\n\nfunction createNode(children) {\n return {\n children: children,\n height: 1,\n leaf: true,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n}\n\n// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;\n// combines selection algorithm with binary divide & conquer approach\n\nfunction multiSelect(arr, left, right, n, compare) {\n var stack = [left, right];\n\n while (stack.length) {\n right = stack.pop();\n left = stack.pop();\n\n if (right - left <= n) { continue; }\n\n var mid = left + Math.ceil((right - left) / n / 2) * n;\n quickselect(arr, mid, left, right, compare);\n\n stack.push(left, mid, mid, right);\n }\n}\n\nreturn RBush;\n\n}));\n","/**\n * @module ol/geom/flat/textpath\n */\nimport {lerp} from '../../math.js';\nimport {rotate} from './transform.js';\n\n/**\n * @param {Array<number>} flatCoordinates Path to put text on.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @param {string} text Text to place on the path.\n * @param {number} startM m along the path where the text starts.\n * @param {number} maxAngle Max angle between adjacent chars in radians.\n * @param {number} scale The product of the text scale and the device pixel ratio.\n * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width.\n * @param {string} font The font.\n * @param {Object<string, number>} cache A cache of measured widths.\n * @param {number} rotation Rotation to apply to the flatCoordinates to determine whether text needs to be reversed.\n * @return {Array<Array<*>>} The result array (or null if `maxAngle` was\n * exceeded). Entries of the array are x, y, anchorX, angle, chunk.\n */\nexport function drawTextOnPath(\n flatCoordinates,\n offset,\n end,\n stride,\n text,\n startM,\n maxAngle,\n scale,\n measureAndCacheTextWidth,\n font,\n cache,\n rotation\n) {\n const result = [];\n\n // Keep text upright\n let reverse;\n if (rotation) {\n const rotatedCoordinates = rotate(\n flatCoordinates,\n offset,\n end,\n stride,\n rotation,\n [flatCoordinates[offset], flatCoordinates[offset + 1]]\n );\n reverse =\n rotatedCoordinates[0] >\n rotatedCoordinates[rotatedCoordinates.length - stride];\n } else {\n reverse = flatCoordinates[offset] > flatCoordinates[end - stride];\n }\n\n const numChars = text.length;\n\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n offset += stride;\n let x2 = flatCoordinates[offset];\n let y2 = flatCoordinates[offset + 1];\n let segmentM = 0;\n let segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n let angleChanged = false;\n\n let index, previousAngle;\n for (let i = 0; i < numChars; ++i) {\n index = reverse ? numChars - i - 1 : i;\n const char = text[index];\n const charLength = scale * measureAndCacheTextWidth(font, char, cache);\n const charM = startM + charLength / 2;\n while (offset < end - stride && segmentM + segmentLength < charM) {\n x1 = x2;\n y1 = y2;\n offset += stride;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n segmentM += segmentLength;\n segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n }\n const segmentPos = charM - segmentM;\n let angle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n angle += angle > 0 ? -Math.PI : Math.PI;\n }\n if (previousAngle !== undefined) {\n let delta = angle - previousAngle;\n angleChanged = angleChanged || delta !== 0;\n delta +=\n delta > Math.PI ? -2 * Math.PI : delta < -Math.PI ? 2 * Math.PI : 0;\n if (Math.abs(delta) > maxAngle) {\n return null;\n }\n }\n previousAngle = angle;\n const interpolate = segmentPos / segmentLength;\n const x = lerp(x1, x2, interpolate);\n const y = lerp(y1, y2, interpolate);\n result[index] = [x, y, charLength / 2, angle, char];\n startM += charLength;\n }\n return angleChanged\n ? result\n : [[result[0][0], result[0][1], result[0][2], result[0][3], text]];\n}\n","/**\n * @module ol/render/canvas/Executor\n */\nimport CanvasInstruction from './Instruction.js';\nimport RBush from 'rbush/rbush.js';\nimport {TEXT_ALIGN} from './TextBuilder.js';\nimport {WORKER_OFFSCREEN_CANVAS} from '../../has.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n create as createTransform,\n setFromArray as transformSetFromArray,\n} from '../../transform.js';\nimport {\n createEmpty,\n createOrUpdate,\n getHeight,\n getWidth,\n intersects,\n} from '../../extent.js';\nimport {\n defaultPadding,\n defaultTextBaseline,\n drawImageOrLabel,\n} from '../canvas.js';\nimport {\n defaultTextAlign,\n measureAndCacheTextWidth,\n measureTextHeight,\n measureTextWidths,\n} from '../canvas.js';\nimport {drawTextOnPath} from '../../geom/flat/textpath.js';\nimport {equals} from '../../array.js';\nimport {lineStringLength} from '../../geom/flat/length.js';\nimport {transform2D} from '../../geom/flat/transform.js';\n\n/**\n * @typedef {Object} SerializableInstructions\n * @property {Array<*>} instructions The rendering instructions.\n * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.\n * @property {Array<number>} coordinates The array of all coordinates.\n * @property {!Object<string, import(\"../canvas.js\").TextState>} textStates The text states (decluttering).\n * @property {!Object<string, import(\"../canvas.js\").FillState>} fillStates The fill states (decluttering).\n * @property {!Object<string, import(\"../canvas.js\").StrokeState>} strokeStates The stroke states (decluttering).\n */\n\n/**\n * @type {import(\"../../extent.js\").Extent}\n */\nconst tmpExtent = createEmpty();\n\n/**\n * @type {!import(\"../../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p1 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p2 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p3 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p4 = [];\n\nclass Executor {\n /**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} overlaps The replay can have overlapping geometries.\n * @param {SerializableInstructions} instructions The serializable instructions\n * @param {import(\"../../size.js\").Size} renderBuffer Render buffer (width/height) in pixels.\n */\n constructor(resolution, pixelRatio, overlaps, instructions, renderBuffer) {\n /**\n * @protected\n * @type {boolean}\n */\n this.overlaps = overlaps;\n\n /**\n * @protected\n * @type {number}\n */\n this.pixelRatio = pixelRatio;\n\n /**\n * @protected\n * @const\n * @type {number}\n */\n this.resolution = resolution;\n\n /**\n * @private\n * @type {boolean}\n */\n this.alignFill_;\n\n /**\n * @type {Array<*>}\n */\n this.declutterItems = [];\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.instructions = instructions.instructions;\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.coordinates = instructions.coordinates;\n\n /**\n * @private\n * @type {!Object<number,import(\"../../coordinate.js\").Coordinate|Array<import(\"../../coordinate.js\").Coordinate>|Array<Array<import(\"../../coordinate.js\").Coordinate>>>}\n */\n this.coordinateCache_ = {};\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.renderBuffer_ = renderBuffer;\n\n /**\n * @private\n * @type {!import(\"../../transform.js\").Transform}\n */\n this.renderedTransform_ = createTransform();\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.hitDetectionInstructions = instructions.hitDetectionInstructions;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.pixelCoordinates_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.viewRotation_ = 0;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").FillState>}\n */\n this.fillStates = instructions.fillStates || {};\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").StrokeState>}\n */\n this.strokeStates = instructions.strokeStates || {};\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").TextState>}\n */\n this.textStates = instructions.textStates || {};\n\n /**\n * @private\n * @type {Object<string, Object<string, number>>}\n */\n this.widths_ = {};\n\n /**\n * @private\n * @type {Object<string, import(\"../canvas.js\").Label>}\n */\n this.labels_ = {};\n }\n\n /**\n * @param {string} text Text.\n * @param {string} textKey Text style key.\n * @param {string} fillKey Fill style key.\n * @param {string} strokeKey Stroke style key.\n * @return {import(\"../canvas.js\").Label} Label.\n */\n createLabel(text, textKey, fillKey, strokeKey) {\n const key = text + textKey + fillKey + strokeKey;\n if (this.labels_[key]) {\n return this.labels_[key];\n }\n const strokeState = strokeKey ? this.strokeStates[strokeKey] : null;\n const fillState = fillKey ? this.fillStates[fillKey] : null;\n const textState = this.textStates[textKey];\n const pixelRatio = this.pixelRatio;\n const scale = [\n textState.scale[0] * pixelRatio,\n textState.scale[1] * pixelRatio,\n ];\n const align = TEXT_ALIGN[textState.textAlign || defaultTextAlign];\n const strokeWidth =\n strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0;\n\n const lines = text.split('\\n');\n const numLines = lines.length;\n const widths = [];\n const width = measureTextWidths(textState.font, lines, widths);\n const lineHeight = measureTextHeight(textState.font);\n const height = lineHeight * numLines;\n const renderWidth = width + strokeWidth;\n const contextInstructions = [];\n // make canvas 2 pixels wider to account for italic text width measurement errors\n const w = (renderWidth + 2) * scale[0];\n const h = (height + strokeWidth) * scale[1];\n /** @type {import(\"../canvas.js\").Label} */\n const label = {\n width: w < 0 ? Math.floor(w) : Math.ceil(w),\n height: h < 0 ? Math.floor(h) : Math.ceil(h),\n contextInstructions: contextInstructions,\n };\n if (scale[0] != 1 || scale[1] != 1) {\n contextInstructions.push('scale', scale);\n }\n contextInstructions.push('font', textState.font);\n if (strokeKey) {\n contextInstructions.push('strokeStyle', strokeState.strokeStyle);\n contextInstructions.push('lineWidth', strokeWidth);\n contextInstructions.push('lineCap', strokeState.lineCap);\n contextInstructions.push('lineJoin', strokeState.lineJoin);\n contextInstructions.push('miterLimit', strokeState.miterLimit);\n // eslint-disable-next-line\n const Context = WORKER_OFFSCREEN_CANVAS ? OffscreenCanvasRenderingContext2D : CanvasRenderingContext2D;\n if (Context.prototype.setLineDash) {\n contextInstructions.push('setLineDash', [strokeState.lineDash]);\n contextInstructions.push('lineDashOffset', strokeState.lineDashOffset);\n }\n }\n if (fillKey) {\n contextInstructions.push('fillStyle', fillState.fillStyle);\n }\n contextInstructions.push('textBaseline', 'middle');\n contextInstructions.push('textAlign', 'center');\n const leftRight = 0.5 - align;\n const x = align * renderWidth + leftRight * strokeWidth;\n let i;\n if (strokeKey) {\n for (i = 0; i < numLines; ++i) {\n contextInstructions.push('strokeText', [\n lines[i],\n x + leftRight * widths[i],\n 0.5 * (strokeWidth + lineHeight) + i * lineHeight,\n ]);\n }\n }\n if (fillKey) {\n for (i = 0; i < numLines; ++i) {\n contextInstructions.push('fillText', [\n lines[i],\n x + leftRight * widths[i],\n 0.5 * (strokeWidth + lineHeight) + i * lineHeight,\n ]);\n }\n }\n this.labels_[key] = label;\n return label;\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../coordinate.js\").Coordinate} p1 1st point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p2 2nd point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p3 3rd point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p4 4th point of the background box.\n * @param {Array<*>} fillInstruction Fill instruction.\n * @param {Array<*>} strokeInstruction Stroke instruction.\n * @param {boolean} declutter Declutter.\n */\n replayTextBackground_(\n context,\n p1,\n p2,\n p3,\n p4,\n fillInstruction,\n strokeInstruction,\n declutter\n ) {\n context.beginPath();\n context.moveTo.apply(context, p1);\n context.lineTo.apply(context, p2);\n context.lineTo.apply(context, p3);\n context.lineTo.apply(context, p4);\n context.lineTo.apply(context, p1);\n if (fillInstruction) {\n this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]);\n if (declutter) {\n context.fillStyle = /** @type {import(\"../../colorlike.js\").ColorLike} */ (fillInstruction[1]);\n }\n this.fill_(context);\n }\n if (strokeInstruction) {\n this.setStrokeStyle_(\n context,\n /** @type {Array<*>} */ (strokeInstruction)\n );\n context.stroke();\n }\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} contextScale Scale of the context.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../canvas.js\").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.\n * @param {number} anchorX Anchor X.\n * @param {number} anchorY Anchor Y.\n * @param {import(\"../canvas.js\").DeclutterGroup} declutterGroup Declutter group.\n * @param {number} height Height.\n * @param {number} opacity Opacity.\n * @param {number} originX Origin X.\n * @param {number} originY Origin Y.\n * @param {number} rotation Rotation.\n * @param {import(\"../../size.js\").Size} scale Scale.\n * @param {boolean} snapToPixel Snap to pixel.\n * @param {number} width Width.\n * @param {Array<number>} padding Padding.\n * @param {Array<*>} fillInstruction Fill instruction.\n * @param {Array<*>} strokeInstruction Stroke instruction.\n * @return {boolean} The image or label was rendered.\n */\n replayImageOrLabel_(\n context,\n contextScale,\n x,\n y,\n imageOrLabel,\n anchorX,\n anchorY,\n declutterGroup,\n height,\n opacity,\n originX,\n originY,\n rotation,\n scale,\n snapToPixel,\n width,\n padding,\n fillInstruction,\n strokeInstruction\n ) {\n const fillStroke = fillInstruction || strokeInstruction;\n anchorX *= scale[0];\n anchorY *= scale[1];\n x -= anchorX;\n y -= anchorY;\n\n const w =\n width + originX > imageOrLabel.width\n ? imageOrLabel.width - originX\n : width;\n const h =\n height + originY > imageOrLabel.height\n ? imageOrLabel.height - originY\n : height;\n const boxW = padding[3] + w * scale[0] + padding[1];\n const boxH = padding[0] + h * scale[1] + padding[2];\n const boxX = x - padding[3];\n const boxY = y - padding[0];\n\n if (fillStroke || rotation !== 0) {\n p1[0] = boxX;\n p4[0] = boxX;\n p1[1] = boxY;\n p2[1] = boxY;\n p2[0] = boxX + boxW;\n p3[0] = p2[0];\n p3[1] = boxY + boxH;\n p4[1] = p3[1];\n }\n\n let transform = null;\n if (rotation !== 0) {\n const centerX = x + anchorX;\n const centerY = y + anchorY;\n transform = composeTransform(\n tmpTransform,\n centerX,\n centerY,\n 1,\n 1,\n rotation,\n -centerX,\n -centerY\n );\n\n applyTransform(tmpTransform, p1);\n applyTransform(tmpTransform, p2);\n applyTransform(tmpTransform, p3);\n applyTransform(tmpTransform, p4);\n createOrUpdate(\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n tmpExtent\n );\n } else {\n createOrUpdate(boxX, boxY, boxX + boxW, boxY + boxH, tmpExtent);\n }\n let renderBufferX = 0;\n let renderBufferY = 0;\n if (declutterGroup) {\n const renderBuffer = this.renderBuffer_;\n renderBuffer[0] = Math.max(renderBuffer[0], getWidth(tmpExtent));\n renderBufferX = renderBuffer[0];\n renderBuffer[1] = Math.max(renderBuffer[1], getHeight(tmpExtent));\n renderBufferY = renderBuffer[1];\n }\n const canvas = context.canvas;\n const strokePadding = strokeInstruction\n ? (strokeInstruction[2] * scale[0]) / 2\n : 0;\n const intersects =\n tmpExtent[0] - strokePadding <=\n (canvas.width + renderBufferX) / contextScale &&\n tmpExtent[2] + strokePadding >= -renderBufferX / contextScale &&\n tmpExtent[1] - strokePadding <=\n (canvas.height + renderBufferY) / contextScale &&\n tmpExtent[3] + strokePadding >= -renderBufferY / contextScale;\n\n if (snapToPixel) {\n x = Math.round(x);\n y = Math.round(y);\n }\n\n if (declutterGroup) {\n if (!intersects && declutterGroup[0] == 1) {\n return false;\n }\n const declutterArgs = intersects\n ? [\n context,\n transform ? transform.slice(0) : null,\n opacity,\n imageOrLabel,\n originX,\n originY,\n w,\n h,\n x,\n y,\n scale,\n tmpExtent.slice(),\n ]\n : null;\n if (declutterArgs) {\n if (fillStroke) {\n declutterArgs.push(\n fillInstruction,\n strokeInstruction,\n p1.slice(0),\n p2.slice(0),\n p3.slice(0),\n p4.slice(0)\n );\n }\n declutterGroup.push(declutterArgs);\n }\n } else if (intersects) {\n if (fillStroke) {\n this.replayTextBackground_(\n context,\n p1,\n p2,\n p3,\n p4,\n /** @type {Array<*>} */ (fillInstruction),\n /** @type {Array<*>} */ (strokeInstruction),\n false\n );\n }\n drawImageOrLabel(\n context,\n transform,\n opacity,\n imageOrLabel,\n originX,\n originY,\n w,\n h,\n x,\n y,\n scale\n );\n }\n return true;\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n */\n fill_(context) {\n if (this.alignFill_) {\n const origin = applyTransform(this.renderedTransform_, [0, 0]);\n const repeatSize = 512 * this.pixelRatio;\n context.save();\n context.translate(origin[0] % repeatSize, origin[1] % repeatSize);\n context.rotate(this.viewRotation_);\n }\n context.fill();\n if (this.alignFill_) {\n context.restore();\n }\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {Array<*>} instruction Instruction.\n */\n setStrokeStyle_(context, instruction) {\n context.strokeStyle = /** @type {import(\"../../colorlike.js\").ColorLike} */ (instruction[1]);\n context.lineWidth = /** @type {number} */ (instruction[2]);\n context.lineCap = /** @type {CanvasLineCap} */ (instruction[3]);\n context.lineJoin = /** @type {CanvasLineJoin} */ (instruction[4]);\n context.miterLimit = /** @type {number} */ (instruction[5]);\n if (context.setLineDash) {\n context.lineDashOffset = /** @type {number} */ (instruction[7]);\n context.setLineDash(/** @type {Array<number>} */ (instruction[6]));\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").DeclutterGroup} declutterGroup Declutter group.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} opacity Layer opacity.\n * @param {?} declutterTree Declutter tree.\n * @return {?} Declutter tree.\n */\n renderDeclutter(declutterGroup, feature, opacity, declutterTree) {\n /** @type {Array<import(\"../../structs/RBush.js\").Entry>} */\n const boxes = [];\n for (let i = 1, ii = declutterGroup.length; i < ii; ++i) {\n const declutterData = declutterGroup[i];\n const box = declutterData[11];\n boxes.push({\n minX: box[0],\n minY: box[1],\n maxX: box[2],\n maxY: box[3],\n value: feature,\n });\n }\n if (!declutterTree) {\n declutterTree = new RBush(9);\n }\n let collides = false;\n for (let i = 0, ii = boxes.length; i < ii; ++i) {\n if (declutterTree.collides(boxes[i])) {\n collides = true;\n break;\n }\n }\n if (!collides) {\n declutterTree.load(boxes);\n for (let j = 1, jj = declutterGroup.length; j < jj; ++j) {\n const declutterData = /** @type {Array} */ (declutterGroup[j]);\n const context = declutterData[0];\n const currentAlpha = context.globalAlpha;\n if (currentAlpha !== opacity) {\n context.globalAlpha = opacity;\n }\n if (declutterData.length > 12) {\n this.replayTextBackground_(\n declutterData[0],\n declutterData[14],\n declutterData[15],\n declutterData[16],\n declutterData[17],\n declutterData[12],\n declutterData[13],\n true\n );\n }\n drawImageOrLabel.apply(undefined, declutterData);\n if (currentAlpha !== opacity) {\n context.globalAlpha = currentAlpha;\n }\n }\n }\n declutterGroup.length = 1;\n return declutterTree;\n }\n\n /**\n * @private\n * @param {string} text The text to draw.\n * @param {string} textKey The key of the text state.\n * @param {string} strokeKey The key for the stroke state.\n * @param {string} fillKey The key for the fill state.\n * @return {{label: import(\"../canvas.js\").Label, anchorX: number, anchorY: number}} The text image and its anchor.\n */\n drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey) {\n const textState = this.textStates[textKey];\n\n const label = this.createLabel(text, textKey, fillKey, strokeKey);\n\n const strokeState = this.strokeStates[strokeKey];\n const pixelRatio = this.pixelRatio;\n const align = TEXT_ALIGN[textState.textAlign || defaultTextAlign];\n const baseline = TEXT_ALIGN[textState.textBaseline || defaultTextBaseline];\n const strokeWidth =\n strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0;\n\n // Remove the 2 pixels we added in createLabel() for the anchor\n const width = label.width / pixelRatio - 2 * textState.scale[0];\n const anchorX = align * width + 2 * (0.5 - align) * strokeWidth;\n const anchorY =\n (baseline * label.height) / pixelRatio +\n 2 * (0.5 - baseline) * strokeWidth;\n\n return {\n label: label,\n anchorX: anchorX,\n anchorY: anchorY,\n };\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} contextScale Scale of the context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array<*>} instructions Instructions array.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n * @param {function(import(\"../../Feature.js\").FeatureLike): T|undefined} featureCallback Feature callback.\n * @param {import(\"../../extent.js\").Extent=} opt_hitExtent Only check features that intersect this\n * extent.\n * @return {T|undefined} Callback result.\n * @template T\n */\n execute_(\n context,\n contextScale,\n transform,\n instructions,\n snapToPixel,\n featureCallback,\n opt_hitExtent\n ) {\n this.declutterItems.length = 0;\n /** @type {Array<number>} */\n let pixelCoordinates;\n if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {\n pixelCoordinates = this.pixelCoordinates_;\n } else {\n if (!this.pixelCoordinates_) {\n this.pixelCoordinates_ = [];\n }\n pixelCoordinates = transform2D(\n this.coordinates,\n 0,\n this.coordinates.length,\n 2,\n transform,\n this.pixelCoordinates_\n );\n transformSetFromArray(this.renderedTransform_, transform);\n }\n let i = 0; // instruction index\n const ii = instructions.length; // end of instructions\n let d = 0; // data index\n let dd; // end of per-instruction data\n let anchorX,\n anchorY,\n prevX,\n prevY,\n roundX,\n roundY,\n declutterGroup,\n declutterGroups,\n image,\n text,\n textKey;\n let strokeKey, fillKey;\n let pendingFill = 0;\n let pendingStroke = 0;\n let lastFillInstruction = null;\n let lastStrokeInstruction = null;\n const coordinateCache = this.coordinateCache_;\n const viewRotation = this.viewRotation_;\n const viewRotationFromTransform =\n Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12;\n\n const state = /** @type {import(\"../../render.js\").State} */ ({\n context: context,\n pixelRatio: this.pixelRatio,\n resolution: this.resolution,\n rotation: viewRotation,\n });\n\n // When the batch size gets too big, performance decreases. 200 is a good\n // balance between batch size and number of fill/stroke instructions.\n const batchSize =\n this.instructions != instructions || this.overlaps ? 0 : 200;\n let /** @type {import(\"../../Feature.js\").FeatureLike} */ feature;\n let x, y;\n while (i < ii) {\n const instruction = instructions[i];\n const type = /** @type {import(\"./Instruction.js\").default} */ (instruction[0]);\n switch (type) {\n case CanvasInstruction.BEGIN_GEOMETRY:\n feature = /** @type {import(\"../../Feature.js\").FeatureLike} */ (instruction[1]);\n if (!feature.getGeometry()) {\n i = /** @type {number} */ (instruction[2]);\n } else if (\n opt_hitExtent !== undefined &&\n !intersects(opt_hitExtent, instruction[3])\n ) {\n i = /** @type {number} */ (instruction[2]) + 1;\n } else {\n ++i;\n }\n break;\n case CanvasInstruction.BEGIN_PATH:\n if (pendingFill > batchSize) {\n this.fill_(context);\n pendingFill = 0;\n }\n if (pendingStroke > batchSize) {\n context.stroke();\n pendingStroke = 0;\n }\n if (!pendingFill && !pendingStroke) {\n context.beginPath();\n prevX = NaN;\n prevY = NaN;\n }\n ++i;\n break;\n case CanvasInstruction.CIRCLE:\n d = /** @type {number} */ (instruction[1]);\n const x1 = pixelCoordinates[d];\n const y1 = pixelCoordinates[d + 1];\n const x2 = pixelCoordinates[d + 2];\n const y2 = pixelCoordinates[d + 3];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const r = Math.sqrt(dx * dx + dy * dy);\n context.moveTo(x1 + r, y1);\n context.arc(x1, y1, r, 0, 2 * Math.PI, true);\n ++i;\n break;\n case CanvasInstruction.CLOSE_PATH:\n context.closePath();\n ++i;\n break;\n case CanvasInstruction.CUSTOM:\n d = /** @type {number} */ (instruction[1]);\n dd = instruction[2];\n const geometry = /** @type {import(\"../../geom/SimpleGeometry.js\").default} */ (instruction[3]);\n const renderer = instruction[4];\n const fn = instruction.length == 6 ? instruction[5] : undefined;\n state.geometry = geometry;\n state.feature = feature;\n if (!(i in coordinateCache)) {\n coordinateCache[i] = [];\n }\n const coords = coordinateCache[i];\n if (fn) {\n fn(pixelCoordinates, d, dd, 2, coords);\n } else {\n coords[0] = pixelCoordinates[d];\n coords[1] = pixelCoordinates[d + 1];\n coords.length = 2;\n }\n renderer(coords, state);\n ++i;\n break;\n case CanvasInstruction.DRAW_IMAGE:\n d = /** @type {number} */ (instruction[1]);\n dd = /** @type {number} */ (instruction[2]);\n image = /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ (instruction[3]);\n\n // Remaining arguments in DRAW_IMAGE are in alphabetical order\n anchorX = /** @type {number} */ (instruction[4]);\n anchorY = /** @type {number} */ (instruction[5]);\n declutterGroups = featureCallback ? null : instruction[6];\n let height = /** @type {number} */ (instruction[7]);\n const opacity = /** @type {number} */ (instruction[8]);\n const originX = /** @type {number} */ (instruction[9]);\n const originY = /** @type {number} */ (instruction[10]);\n const rotateWithView = /** @type {boolean} */ (instruction[11]);\n let rotation = /** @type {number} */ (instruction[12]);\n const scale = /** @type {import(\"../../size.js\").Size} */ (instruction[13]);\n let width = /** @type {number} */ (instruction[14]);\n\n if (!image && instruction.length >= 19) {\n // create label images\n text = /** @type {string} */ (instruction[18]);\n textKey = /** @type {string} */ (instruction[19]);\n strokeKey = /** @type {string} */ (instruction[20]);\n fillKey = /** @type {string} */ (instruction[21]);\n const labelWithAnchor = this.drawLabelWithPointPlacement_(\n text,\n textKey,\n strokeKey,\n fillKey\n );\n image = labelWithAnchor.label;\n instruction[3] = image;\n const textOffsetX = /** @type {number} */ (instruction[22]);\n anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;\n instruction[4] = anchorX;\n const textOffsetY = /** @type {number} */ (instruction[23]);\n anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;\n instruction[5] = anchorY;\n height = image.height;\n instruction[7] = height;\n width = image.width;\n instruction[14] = width;\n }\n\n let geometryWidths;\n if (instruction.length > 24) {\n geometryWidths = /** @type {number} */ (instruction[24]);\n }\n\n let padding, backgroundFill, backgroundStroke;\n if (instruction.length > 16) {\n padding = /** @type {Array<number>} */ (instruction[15]);\n backgroundFill = /** @type {boolean} */ (instruction[16]);\n backgroundStroke = /** @type {boolean} */ (instruction[17]);\n } else {\n padding = defaultPadding;\n backgroundFill = false;\n backgroundStroke = false;\n }\n\n if (rotateWithView && viewRotationFromTransform) {\n // Canvas is expected to be rotated to reverse view rotation.\n rotation += viewRotation;\n } else if (!rotateWithView && !viewRotationFromTransform) {\n // Canvas is not rotated, images need to be rotated back to be north-up.\n rotation -= viewRotation;\n }\n let widthIndex = 0;\n let declutterGroupIndex = 0;\n for (; d < dd; d += 2) {\n if (\n geometryWidths &&\n geometryWidths[widthIndex++] < width / this.pixelRatio\n ) {\n continue;\n }\n if (declutterGroups) {\n const index = Math.floor(declutterGroupIndex);\n declutterGroup =\n declutterGroups.length < index + 1\n ? [declutterGroups[0][0]]\n : declutterGroups[index];\n }\n const rendered = this.replayImageOrLabel_(\n context,\n contextScale,\n pixelCoordinates[d],\n pixelCoordinates[d + 1],\n image,\n anchorX,\n anchorY,\n declutterGroup,\n height,\n opacity,\n originX,\n originY,\n rotation,\n scale,\n snapToPixel,\n width,\n padding,\n backgroundFill\n ? /** @type {Array<*>} */ (lastFillInstruction)\n : null,\n backgroundStroke\n ? /** @type {Array<*>} */ (lastStrokeInstruction)\n : null\n );\n if (\n rendered &&\n declutterGroup &&\n declutterGroups[declutterGroups.length - 1] !== declutterGroup\n ) {\n declutterGroups.push(declutterGroup);\n }\n if (declutterGroup) {\n if (declutterGroup.length - 1 === declutterGroup[0]) {\n this.declutterItems.push(this, declutterGroup, feature);\n }\n declutterGroupIndex += 1 / declutterGroup[0];\n }\n }\n ++i;\n break;\n case CanvasInstruction.DRAW_CHARS:\n const begin = /** @type {number} */ (instruction[1]);\n const end = /** @type {number} */ (instruction[2]);\n const baseline = /** @type {number} */ (instruction[3]);\n declutterGroup = featureCallback ? null : instruction[4];\n const overflow = /** @type {number} */ (instruction[5]);\n fillKey = /** @type {string} */ (instruction[6]);\n const maxAngle = /** @type {number} */ (instruction[7]);\n const measurePixelRatio = /** @type {number} */ (instruction[8]);\n const offsetY = /** @type {number} */ (instruction[9]);\n strokeKey = /** @type {string} */ (instruction[10]);\n const strokeWidth = /** @type {number} */ (instruction[11]);\n text = /** @type {string} */ (instruction[12]);\n textKey = /** @type {string} */ (instruction[13]);\n const pixelRatioScale = [\n /** @type {number} */ (instruction[14]),\n /** @type {number} */ (instruction[14]),\n ];\n\n const textState = this.textStates[textKey];\n const font = textState.font;\n const textScale = [\n textState.scale[0] * measurePixelRatio,\n textState.scale[1] * measurePixelRatio,\n ];\n\n let cachedWidths;\n if (font in this.widths_) {\n cachedWidths = this.widths_[font];\n } else {\n cachedWidths = {};\n this.widths_[font] = cachedWidths;\n }\n\n const pathLength = lineStringLength(pixelCoordinates, begin, end, 2);\n const textLength =\n Math.abs(textScale[0]) *\n measureAndCacheTextWidth(font, text, cachedWidths);\n if (overflow || textLength <= pathLength) {\n const textAlign = this.textStates[textKey].textAlign;\n const startM = (pathLength - textLength) * TEXT_ALIGN[textAlign];\n const parts = drawTextOnPath(\n pixelCoordinates,\n begin,\n end,\n 2,\n text,\n startM,\n maxAngle,\n Math.abs(textScale[0]),\n measureAndCacheTextWidth,\n font,\n cachedWidths,\n viewRotationFromTransform ? 0 : this.viewRotation_\n );\n if (parts) {\n let rendered = false;\n let c, cc, chars, label, part;\n if (strokeKey) {\n for (c = 0, cc = parts.length; c < cc; ++c) {\n part = parts[c]; // x, y, anchorX, rotation, chunk\n chars = /** @type {string} */ (part[4]);\n label = this.createLabel(chars, textKey, '', strokeKey);\n anchorX = /** @type {number} */ (part[2]) + strokeWidth;\n anchorY =\n baseline * label.height +\n ((0.5 - baseline) * 2 * strokeWidth * textScale[1]) /\n textScale[0] -\n offsetY;\n rendered =\n this.replayImageOrLabel_(\n context,\n contextScale,\n /** @type {number} */ (part[0]),\n /** @type {number} */ (part[1]),\n label,\n anchorX,\n anchorY,\n declutterGroup,\n label.height,\n 1,\n 0,\n 0,\n /** @type {number} */ (part[3]),\n pixelRatioScale,\n false,\n label.width,\n defaultPadding,\n null,\n null\n ) || rendered;\n }\n }\n if (fillKey) {\n for (c = 0, cc = parts.length; c < cc; ++c) {\n part = parts[c]; // x, y, anchorX, rotation, chunk\n chars = /** @type {string} */ (part[4]);\n label = this.createLabel(chars, textKey, fillKey, '');\n anchorX = /** @type {number} */ (part[2]);\n anchorY = baseline * label.height - offsetY;\n rendered =\n this.replayImageOrLabel_(\n context,\n contextScale,\n /** @type {number} */ (part[0]),\n /** @type {number} */ (part[1]),\n label,\n anchorX,\n anchorY,\n declutterGroup,\n label.height,\n 1,\n 0,\n 0,\n /** @type {number} */ (part[3]),\n pixelRatioScale,\n false,\n label.width,\n defaultPadding,\n null,\n null\n ) || rendered;\n }\n }\n if (rendered) {\n this.declutterItems.push(this, declutterGroup, feature);\n }\n }\n }\n ++i;\n break;\n case CanvasInstruction.END_GEOMETRY:\n if (featureCallback !== undefined) {\n feature = /** @type {import(\"../../Feature.js\").FeatureLike} */ (instruction[1]);\n const result = featureCallback(feature);\n if (result) {\n return result;\n }\n }\n ++i;\n break;\n case CanvasInstruction.FILL:\n if (batchSize) {\n pendingFill++;\n } else {\n this.fill_(context);\n }\n ++i;\n break;\n case CanvasInstruction.MOVE_TO_LINE_TO:\n d = /** @type {number} */ (instruction[1]);\n dd = /** @type {number} */ (instruction[2]);\n x = pixelCoordinates[d];\n y = pixelCoordinates[d + 1];\n roundX = (x + 0.5) | 0;\n roundY = (y + 0.5) | 0;\n if (roundX !== prevX || roundY !== prevY) {\n context.moveTo(x, y);\n prevX = roundX;\n prevY = roundY;\n }\n for (d += 2; d < dd; d += 2) {\n x = pixelCoordinates[d];\n y = pixelCoordinates[d + 1];\n roundX = (x + 0.5) | 0;\n roundY = (y + 0.5) | 0;\n if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {\n context.lineTo(x, y);\n prevX = roundX;\n prevY = roundY;\n }\n }\n ++i;\n break;\n case CanvasInstruction.SET_FILL_STYLE:\n lastFillInstruction = instruction;\n this.alignFill_ = instruction[2];\n\n if (pendingFill) {\n this.fill_(context);\n pendingFill = 0;\n if (pendingStroke) {\n context.stroke();\n pendingStroke = 0;\n }\n }\n\n context.fillStyle = /** @type {import(\"../../colorlike.js\").ColorLike} */ (instruction[1]);\n ++i;\n break;\n case CanvasInstruction.SET_STROKE_STYLE:\n lastStrokeInstruction = instruction;\n if (pendingStroke) {\n context.stroke();\n pendingStroke = 0;\n }\n this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));\n ++i;\n break;\n case CanvasInstruction.STROKE:\n if (batchSize) {\n pendingStroke++;\n } else {\n context.stroke();\n }\n ++i;\n break;\n default:\n ++i; // consume the instruction anyway, to avoid an infinite loop\n break;\n }\n }\n if (pendingFill) {\n this.fill_(context);\n }\n if (pendingStroke) {\n context.stroke();\n }\n return undefined;\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} contextScale Scale of the context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n */\n execute(context, contextScale, transform, viewRotation, snapToPixel) {\n this.viewRotation_ = viewRotation;\n this.execute_(\n context,\n contextScale,\n transform,\n this.instructions,\n snapToPixel,\n undefined,\n undefined\n );\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {function(import(\"../../Feature.js\").FeatureLike): T=} opt_featureCallback\n * Feature callback.\n * @param {import(\"../../extent.js\").Extent=} opt_hitExtent Only check features that intersect this\n * extent.\n * @return {T|undefined} Callback result.\n * @template T\n */\n executeHitDetection(\n context,\n transform,\n viewRotation,\n opt_featureCallback,\n opt_hitExtent\n ) {\n this.viewRotation_ = viewRotation;\n return this.execute_(\n context,\n 1,\n transform,\n this.hitDetectionInstructions,\n true,\n opt_featureCallback,\n opt_hitExtent\n );\n }\n}\n\nexport default Executor;\n","/**\n * @module ol/render/canvas/ExecutorGroup\n */\n\nimport BuilderType from './BuilderType.js';\nimport Executor from './Executor.js';\nimport {buffer, createEmpty, extendCoordinate} from '../../extent.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {isEmpty} from '../../obj.js';\nimport {numberSafeCompareFunction} from '../../array.js';\nimport {transform2D} from '../../geom/flat/transform.js';\n\n/**\n * @const\n * @type {Array<import(\"./BuilderType.js\").default>}\n */\nconst ORDER = [\n BuilderType.POLYGON,\n BuilderType.CIRCLE,\n BuilderType.LINE_STRING,\n BuilderType.IMAGE,\n BuilderType.TEXT,\n BuilderType.DEFAULT,\n];\n\nclass ExecutorGroup {\n /**\n * @param {import(\"../../extent.js\").Extent} maxExtent Max extent for clipping. When a\n * `maxExtent` was set on the Buillder for this executor group, the same `maxExtent`\n * should be set here, unless the target context does not exceet that extent (which\n * can be the case when rendering to tiles).\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} overlaps The executor group can have overlapping geometries.\n * @param {!Object<string, !Object<import(\"./BuilderType.js\").default, import(\"./Builder.js\").SerializableInstructions>>} allInstructions\n * The serializable instructions.\n * @param {number=} opt_renderBuffer Optional rendering buffer.\n */\n constructor(\n maxExtent,\n resolution,\n pixelRatio,\n overlaps,\n allInstructions,\n opt_renderBuffer\n ) {\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent_ = maxExtent;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = overlaps;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.resolution_ = resolution;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderBuffer_ = opt_renderBuffer;\n\n /**\n * @private\n * @type {!Object<string, !Object<import(\"./BuilderType.js\").default, import(\"./Executor\").default>>}\n */\n this.executorsByZIndex_ = {};\n\n /**\n * @private\n * @type {CanvasRenderingContext2D}\n */\n this.hitDetectionContext_ = null;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.hitDetectionTransform_ = createTransform();\n\n this.createExecutors_(allInstructions);\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n */\n clip(context, transform) {\n const flatClipCoords = this.getClipCoords(transform);\n context.beginPath();\n context.moveTo(flatClipCoords[0], flatClipCoords[1]);\n context.lineTo(flatClipCoords[2], flatClipCoords[3]);\n context.lineTo(flatClipCoords[4], flatClipCoords[5]);\n context.lineTo(flatClipCoords[6], flatClipCoords[7]);\n context.clip();\n }\n\n /**\n * Create executors and populate them using the provided instructions.\n * @private\n * @param {!Object<string, !Object<import(\"./BuilderType.js\").default, import(\"./Builder.js\").SerializableInstructions>>} allInstructions The serializable instructions\n */\n createExecutors_(allInstructions) {\n for (const zIndex in allInstructions) {\n let executors = this.executorsByZIndex_[zIndex];\n if (executors === undefined) {\n executors = {};\n this.executorsByZIndex_[zIndex] = executors;\n }\n const instructionByZindex = allInstructions[zIndex];\n const renderBuffer = [this.renderBuffer_ || 0, this.renderBuffer_ || 0];\n for (const builderType in instructionByZindex) {\n const instructions = instructionByZindex[builderType];\n executors[builderType] = new Executor(\n this.resolution_,\n this.pixelRatio_,\n this.overlaps_,\n instructions,\n renderBuffer\n );\n }\n }\n }\n\n /**\n * @param {Array<import(\"./BuilderType.js\").default>} executors Executors.\n * @return {boolean} Has executors of the provided types.\n */\n hasExecutors(executors) {\n for (const zIndex in this.executorsByZIndex_) {\n const candidates = this.executorsByZIndex_[zIndex];\n for (let i = 0, ii = executors.length; i < ii; ++i) {\n if (executors[i] in candidates) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../../Feature.js\").FeatureLike): T} callback Feature callback.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} declutteredFeatures Decluttered features.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n callback,\n declutteredFeatures\n ) {\n hitTolerance = Math.round(hitTolerance);\n const contextSize = hitTolerance * 2 + 1;\n const transform = composeTransform(\n this.hitDetectionTransform_,\n hitTolerance + 0.5,\n hitTolerance + 0.5,\n 1 / resolution,\n -1 / resolution,\n -rotation,\n -coordinate[0],\n -coordinate[1]\n );\n\n if (!this.hitDetectionContext_) {\n this.hitDetectionContext_ = createCanvasContext2D(\n contextSize,\n contextSize\n );\n }\n const context = this.hitDetectionContext_;\n\n if (\n context.canvas.width !== contextSize ||\n context.canvas.height !== contextSize\n ) {\n context.canvas.width = contextSize;\n context.canvas.height = contextSize;\n } else {\n context.clearRect(0, 0, contextSize, contextSize);\n }\n\n /**\n * @type {import(\"../../extent.js\").Extent}\n */\n let hitExtent;\n if (this.renderBuffer_ !== undefined) {\n hitExtent = createEmpty();\n extendCoordinate(hitExtent, coordinate);\n buffer(\n hitExtent,\n resolution * (this.renderBuffer_ + hitTolerance),\n hitExtent\n );\n }\n\n const mask = getCircleArray(hitTolerance);\n\n let builderType;\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @return {?} Callback result.\n */\n function featureCallback(feature) {\n const imageData = context.getImageData(0, 0, contextSize, contextSize)\n .data;\n for (let i = 0; i < contextSize; i++) {\n for (let j = 0; j < contextSize; j++) {\n if (mask[i][j]) {\n if (imageData[(j * contextSize + i) * 4 + 3] > 0) {\n let result;\n if (\n !(\n declutteredFeatures &&\n (builderType == BuilderType.IMAGE ||\n builderType == BuilderType.TEXT)\n ) ||\n declutteredFeatures.indexOf(feature) !== -1\n ) {\n result = callback(feature);\n }\n if (result) {\n return result;\n } else {\n context.clearRect(0, 0, contextSize, contextSize);\n return undefined;\n }\n }\n }\n }\n }\n }\n\n /** @type {Array<number>} */\n const zs = Object.keys(this.executorsByZIndex_).map(Number);\n zs.sort(numberSafeCompareFunction);\n\n let i, j, executors, executor, result;\n for (i = zs.length - 1; i >= 0; --i) {\n const zIndexKey = zs[i].toString();\n executors = this.executorsByZIndex_[zIndexKey];\n for (j = ORDER.length - 1; j >= 0; --j) {\n builderType = ORDER[j];\n executor = executors[builderType];\n if (executor !== undefined) {\n result = executor.executeHitDetection(\n context,\n transform,\n rotation,\n featureCallback,\n hitExtent\n );\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @return {Array<number>} Clip coordinates.\n */\n getClipCoords(transform) {\n const maxExtent = this.maxExtent_;\n if (!maxExtent) {\n return null;\n }\n const minX = maxExtent[0];\n const minY = maxExtent[1];\n const maxX = maxExtent[2];\n const maxY = maxExtent[3];\n const flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY];\n transform2D(flatClipCoords, 0, 8, 2, transform, flatClipCoords);\n return flatClipCoords;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return isEmpty(this.executorsByZIndex_);\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} contextScale Scale of the context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {boolean} snapToPixel Snap point symbols and test to integer pixel.\n * @param {Array<import(\"./BuilderType.js\").default>=} opt_builderTypes Ordered replay types to replay.\n * Default is {@link module:ol/render/replay~ORDER}\n * @param {Object<string, import(\"../canvas.js\").DeclutterGroup>=} opt_declutterReplays Declutter replays.\n */\n execute(\n context,\n contextScale,\n transform,\n viewRotation,\n snapToPixel,\n opt_builderTypes,\n opt_declutterReplays\n ) {\n /** @type {Array<number>} */\n const zs = Object.keys(this.executorsByZIndex_).map(Number);\n zs.sort(numberSafeCompareFunction);\n\n // setup clipping so that the parts of over-simplified geometries are not\n // visible outside the current extent when panning\n if (this.maxExtent_) {\n context.save();\n this.clip(context, transform);\n }\n\n const builderTypes = opt_builderTypes ? opt_builderTypes : ORDER;\n let i, ii, j, jj, replays, replay;\n for (i = 0, ii = zs.length; i < ii; ++i) {\n const zIndexKey = zs[i].toString();\n replays = this.executorsByZIndex_[zIndexKey];\n for (j = 0, jj = builderTypes.length; j < jj; ++j) {\n const builderType = builderTypes[j];\n replay = replays[builderType];\n if (replay !== undefined) {\n if (\n opt_declutterReplays &&\n (builderType == BuilderType.IMAGE ||\n builderType == BuilderType.TEXT)\n ) {\n const declutter = opt_declutterReplays[zIndexKey];\n if (!declutter) {\n opt_declutterReplays[zIndexKey] = [replay, transform.slice(0)];\n } else {\n declutter.push(replay, transform.slice(0));\n }\n } else {\n replay.execute(\n context,\n contextScale,\n transform,\n viewRotation,\n snapToPixel\n );\n }\n }\n }\n }\n\n if (this.maxExtent_) {\n context.restore();\n }\n }\n}\n\n/**\n * This cache is used for storing calculated pixel circles for increasing performance.\n * It is a static property to allow each Replaygroup to access it.\n * @type {Object<number, Array<Array<(boolean|undefined)>>>}\n */\nconst circleArrayCache = {\n 0: [[true]],\n};\n\n/**\n * This method fills a row in the array from the given coordinate to the\n * middle with `true`.\n * @param {Array<Array<(boolean|undefined)>>} array The array that will be altered.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n */\nfunction fillCircleArrayRowToMiddle(array, x, y) {\n let i;\n const radius = Math.floor(array.length / 2);\n if (x >= radius) {\n for (i = radius; i < x; i++) {\n array[i][y] = true;\n }\n } else if (x < radius) {\n for (i = x + 1; i < radius; i++) {\n array[i][y] = true;\n }\n }\n}\n\n/**\n * This methods creates a circle inside a fitting array. Points inside the\n * circle are marked by true, points on the outside are undefined.\n * It uses the midpoint circle algorithm.\n * A cache is used to increase performance.\n * @param {number} radius Radius.\n * @returns {Array<Array<(boolean|undefined)>>} An array with marked circle points.\n */\nexport function getCircleArray(radius) {\n if (circleArrayCache[radius] !== undefined) {\n return circleArrayCache[radius];\n }\n\n const arraySize = radius * 2 + 1;\n const arr = new Array(arraySize);\n for (let i = 0; i < arraySize; i++) {\n arr[i] = new Array(arraySize);\n }\n\n let x = radius;\n let y = 0;\n let error = 0;\n\n while (x >= y) {\n fillCircleArrayRowToMiddle(arr, radius + x, radius + y);\n fillCircleArrayRowToMiddle(arr, radius + y, radius + x);\n fillCircleArrayRowToMiddle(arr, radius - y, radius + x);\n fillCircleArrayRowToMiddle(arr, radius - x, radius + y);\n fillCircleArrayRowToMiddle(arr, radius - x, radius - y);\n fillCircleArrayRowToMiddle(arr, radius - y, radius - x);\n fillCircleArrayRowToMiddle(arr, radius + y, radius - x);\n fillCircleArrayRowToMiddle(arr, radius + x, radius - y);\n\n y++;\n error += 1 + 2 * y;\n if (2 * (error - x) + 1 > 0) {\n x -= 1;\n error += 1 - 2 * x;\n }\n }\n\n circleArrayCache[radius] = arr;\n return arr;\n}\n\n/**\n * @param {!Object<string, Array<*>>} declutterReplays Declutter replays.\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} rotation Rotation.\n * @param {number} opacity Opacity.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n * @param {Array<import(\"../../PluggableMap.js\").DeclutterItems>} declutterItems Declutter items.\n */\nexport function replayDeclutter(\n declutterReplays,\n context,\n rotation,\n opacity,\n snapToPixel,\n declutterItems\n) {\n const zs = Object.keys(declutterReplays)\n .map(Number)\n .sort(numberSafeCompareFunction);\n for (let z = 0, zz = zs.length; z < zz; ++z) {\n const executorData = declutterReplays[zs[z].toString()];\n let currentExecutor;\n for (let i = 0, ii = executorData.length; i < ii; ) {\n const executor = executorData[i++];\n const transform = executorData[i++];\n executor.execute(context, 1, transform, rotation, snapToPixel);\n if (executor !== currentExecutor && executor.declutterItems.length > 0) {\n currentExecutor = executor;\n declutterItems.push({\n items: executor.declutterItems,\n opacity: opacity,\n });\n }\n }\n }\n}\n\nexport default ExecutorGroup;\n","/**\n * @module ol/ViewHint\n */\n\n/**\n * @enum {number}\n */\nexport default {\n ANIMATING: 0,\n INTERACTING: 1,\n};\n","/**\n * @module ol/render/canvas/Immediate\n */\n// FIXME test, especially polygons with holes and multipolygons\n// FIXME need to handle large thick features (where pixel size matters)\n// FIXME add offset and end to ol/geom/flat/transform~transform2D?\n\nimport GeometryType from '../../geom/GeometryType.js';\nimport VectorContext from '../VectorContext.js';\nimport {asColorLike} from '../../colorlike.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport {\n defaultFillStyle,\n defaultFont,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n defaultTextAlign,\n defaultTextBaseline,\n} from '../canvas.js';\nimport {equals} from '../../array.js';\nimport {intersects} from '../../extent.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {transformGeom2D} from '../../geom/SimpleGeometry.js';\n\n/**\n * @classdesc\n * A concrete subclass of {@link module:ol/render/VectorContext} that implements\n * direct rendering of features and geometries to an HTML5 Canvas context.\n * Instances of this class are created internally by the library and\n * provided to application code as vectorContext member of the\n * {@link module:ol/render/Event~RenderEvent} object associated with postcompose, precompose and\n * render events emitted by layers and maps.\n */\nclass CanvasImmediateRenderer extends VectorContext {\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {number=} opt_squaredTolerance Optional squared tolerance for simplification.\n * @param {import(\"../../proj.js\").TransformFunction=} opt_userTransform Transform from user to view projection.\n */\n constructor(\n context,\n pixelRatio,\n extent,\n transform,\n viewRotation,\n opt_squaredTolerance,\n opt_userTransform\n ) {\n super();\n\n /**\n * @private\n * @type {CanvasRenderingContext2D}\n */\n this.context_ = context;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.extent_ = extent;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.transform_ = transform;\n\n /**\n * @private\n * @type {number}\n */\n this.viewRotation_ = viewRotation;\n\n /**\n * @private\n * @type {number}\n */\n this.squaredTolerance_ = opt_squaredTolerance;\n\n /**\n * @private\n * @type {import(\"../../proj.js\").TransformFunction}\n */\n this.userTransform_ = opt_userTransform;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.contextFillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.contextStrokeState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").TextState}\n */\n this.contextTextState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.fillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.strokeState_ = null;\n\n /**\n * @private\n * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}\n */\n this.image_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.imageAnchorX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageAnchorY_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageHeight_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOpacity_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOriginX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOriginY_ = 0;\n\n /**\n * @private\n * @type {boolean}\n */\n this.imageRotateWithView_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.imageRotation_ = 0;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.imageScale_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.imageWidth_ = 0;\n\n /**\n * @private\n * @type {string}\n */\n this.text_ = '';\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetY_ = 0;\n\n /**\n * @private\n * @type {boolean}\n */\n this.textRotateWithView_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.textRotation_ = 0;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.textScale_ = [0, 0];\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.textFillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.textStrokeState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").TextState}\n */\n this.textState_ = null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.pixelCoordinates_ = [];\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.tmpLocalTransform_ = createTransform();\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n */\n drawImages_(flatCoordinates, offset, end, stride) {\n if (!this.image_) {\n return;\n }\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n 2,\n this.transform_,\n this.pixelCoordinates_\n );\n const context = this.context_;\n const localTransform = this.tmpLocalTransform_;\n const alpha = context.globalAlpha;\n if (this.imageOpacity_ != 1) {\n context.globalAlpha = alpha * this.imageOpacity_;\n }\n let rotation = this.imageRotation_;\n if (this.imageRotateWithView_) {\n rotation += this.viewRotation_;\n }\n for (let i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {\n const x = pixelCoordinates[i] - this.imageAnchorX_;\n const y = pixelCoordinates[i + 1] - this.imageAnchorY_;\n if (\n rotation !== 0 ||\n this.imageScale_[0] != 1 ||\n this.imageScale_[1] != 1\n ) {\n const centerX = x + this.imageAnchorX_;\n const centerY = y + this.imageAnchorY_;\n composeTransform(\n localTransform,\n centerX,\n centerY,\n 1,\n 1,\n rotation,\n -centerX,\n -centerY\n );\n context.setTransform.apply(context, localTransform);\n context.translate(centerX, centerY);\n context.scale(this.imageScale_[0], this.imageScale_[1]);\n context.drawImage(\n this.image_,\n this.imageOriginX_,\n this.imageOriginY_,\n this.imageWidth_,\n this.imageHeight_,\n -this.imageAnchorX_,\n -this.imageAnchorY_,\n this.imageWidth_,\n this.imageHeight_\n );\n context.setTransform(1, 0, 0, 1, 0, 0);\n } else {\n context.drawImage(\n this.image_,\n this.imageOriginX_,\n this.imageOriginY_,\n this.imageWidth_,\n this.imageHeight_,\n x,\n y,\n this.imageWidth_,\n this.imageHeight_\n );\n }\n }\n if (this.imageOpacity_ != 1) {\n context.globalAlpha = alpha;\n }\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n */\n drawText_(flatCoordinates, offset, end, stride) {\n if (!this.textState_ || this.text_ === '') {\n return;\n }\n if (this.textFillState_) {\n this.setContextFillState_(this.textFillState_);\n }\n if (this.textStrokeState_) {\n this.setContextStrokeState_(this.textStrokeState_);\n }\n this.setContextTextState_(this.textState_);\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_\n );\n const context = this.context_;\n let rotation = this.textRotation_;\n if (this.textRotateWithView_) {\n rotation += this.viewRotation_;\n }\n for (; offset < end; offset += stride) {\n const x = pixelCoordinates[offset] + this.textOffsetX_;\n const y = pixelCoordinates[offset + 1] + this.textOffsetY_;\n if (\n rotation !== 0 ||\n this.textScale_[0] != 1 ||\n this.textScale_[1] != 1\n ) {\n const localTransform = composeTransform(\n this.tmpLocalTransform_,\n x,\n y,\n 1,\n 1,\n rotation,\n -x,\n -y\n );\n context.setTransform.apply(context, localTransform);\n context.translate(x, y);\n context.scale(this.textScale_[0], this.textScale_[1]);\n if (this.textStrokeState_) {\n context.strokeText(this.text_, 0, 0);\n }\n if (this.textFillState_) {\n context.fillText(this.text_, 0, 0);\n }\n context.setTransform(1, 0, 0, 1, 0, 0);\n } else {\n if (this.textStrokeState_) {\n context.strokeText(this.text_, x, y);\n }\n if (this.textFillState_) {\n context.fillText(this.text_, x, y);\n }\n }\n }\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {boolean} close Close.\n * @private\n * @return {number} end End.\n */\n moveToLineTo_(flatCoordinates, offset, end, stride, close) {\n const context = this.context_;\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_\n );\n context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);\n let length = pixelCoordinates.length;\n if (close) {\n length -= 2;\n }\n for (let i = 2; i < length; i += 2) {\n context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);\n }\n if (close) {\n context.closePath();\n }\n return end;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @private\n * @return {number} End.\n */\n drawRings_(flatCoordinates, offset, ends, stride) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.moveToLineTo_(\n flatCoordinates,\n offset,\n ends[i],\n stride,\n true\n );\n }\n return offset;\n }\n\n /**\n * Render a circle geometry into the canvas. Rendering is immediate and uses\n * the current fill and stroke styles.\n *\n * @param {import(\"../../geom/Circle.js\").default} geometry Circle geometry.\n * @api\n */\n drawCircle(geometry) {\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.fillState_ || this.strokeState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const pixelCoordinates = transformGeom2D(\n geometry,\n this.transform_,\n this.pixelCoordinates_\n );\n const dx = pixelCoordinates[2] - pixelCoordinates[0];\n const dy = pixelCoordinates[3] - pixelCoordinates[1];\n const radius = Math.sqrt(dx * dx + dy * dy);\n const context = this.context_;\n context.beginPath();\n context.arc(\n pixelCoordinates[0],\n pixelCoordinates[1],\n radius,\n 0,\n 2 * Math.PI\n );\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n this.drawText_(geometry.getCenter(), 0, 2, 2);\n }\n }\n\n /**\n * Set the rendering style. Note that since this is an immediate rendering API,\n * any `zIndex` on the provided style will be ignored.\n *\n * @param {import(\"../../style/Style.js\").default} style The rendering style.\n * @api\n */\n setStyle(style) {\n this.setFillStrokeStyle(style.getFill(), style.getStroke());\n this.setImageStyle(style.getImage());\n this.setTextStyle(style.getText());\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n */\n setTransform(transform) {\n this.transform_ = transform;\n }\n\n /**\n * Render a geometry into the canvas. Call\n * {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style.\n *\n * @param {import(\"../../geom/Geometry.js\").default|import(\"../Feature.js\").default} geometry The geometry to render.\n * @api\n */\n drawGeometry(geometry) {\n const type = geometry.getType();\n switch (type) {\n case GeometryType.POINT:\n this.drawPoint(\n /** @type {import(\"../../geom/Point.js\").default} */ (geometry)\n );\n break;\n case GeometryType.LINE_STRING:\n this.drawLineString(\n /** @type {import(\"../../geom/LineString.js\").default} */ (geometry)\n );\n break;\n case GeometryType.POLYGON:\n this.drawPolygon(\n /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry)\n );\n break;\n case GeometryType.MULTI_POINT:\n this.drawMultiPoint(\n /** @type {import(\"../../geom/MultiPoint.js\").default} */ (geometry)\n );\n break;\n case GeometryType.MULTI_LINE_STRING:\n this.drawMultiLineString(\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (geometry)\n );\n break;\n case GeometryType.MULTI_POLYGON:\n this.drawMultiPolygon(\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (geometry)\n );\n break;\n case GeometryType.GEOMETRY_COLLECTION:\n this.drawGeometryCollection(\n /** @type {import(\"../../geom/GeometryCollection.js\").default} */ (geometry)\n );\n break;\n case GeometryType.CIRCLE:\n this.drawCircle(\n /** @type {import(\"../../geom/Circle.js\").default} */ (geometry)\n );\n break;\n default:\n }\n }\n\n /**\n * Render a feature into the canvas. Note that any `zIndex` on the provided\n * style will be ignored - features are rendered immediately in the order that\n * this method is called. If you need `zIndex` support, you should be using an\n * {@link module:ol/layer/Vector~VectorLayer} instead.\n *\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {import(\"../../style/Style.js\").default} style Style.\n * @api\n */\n drawFeature(feature, style) {\n const geometry = style.getGeometryFunction()(feature);\n if (!geometry || !intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n this.setStyle(style);\n this.drawGeometry(geometry);\n }\n\n /**\n * Render a GeometryCollection to the canvas. Rendering is immediate and\n * uses the current styles appropriate for each geometry in the collection.\n *\n * @param {import(\"../../geom/GeometryCollection.js\").default} geometry Geometry collection.\n */\n drawGeometryCollection(geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n this.drawGeometry(geometries[i]);\n }\n }\n\n /**\n * Render a Point geometry into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/Point.js\").default|import(\"../Feature.js\").default} geometry Point geometry.\n */\n drawPoint(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Point.js\").default} */ (geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_\n ));\n }\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n if (this.image_) {\n this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n if (this.text_ !== '') {\n this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n }\n\n /**\n * Render a MultiPoint geometry into the canvas. Rendering is immediate and\n * uses the current style.\n *\n * @param {import(\"../../geom/MultiPoint.js\").default|import(\"../Feature.js\").default} geometry MultiPoint geometry.\n */\n drawMultiPoint(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiPoint.js\").default} */ (geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_\n ));\n }\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n if (this.image_) {\n this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n if (this.text_ !== '') {\n this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n }\n\n /**\n * Render a LineString into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} geometry LineString geometry.\n */\n drawLineString(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/LineString.js\").default} */ (geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_\n ));\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n const context = this.context_;\n const flatCoordinates = geometry.getFlatCoordinates();\n context.beginPath();\n this.moveToLineTo_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n geometry.getStride(),\n false\n );\n context.stroke();\n }\n if (this.text_ !== '') {\n const flatMidpoint = geometry.getFlatMidpoint();\n this.drawText_(flatMidpoint, 0, 2, 2);\n }\n }\n\n /**\n * Render a MultiLineString geometry into the canvas. Rendering is immediate\n * and uses the current style.\n *\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} geometry MultiLineString geometry.\n */\n drawMultiLineString(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiLineString.js\").default} */ (geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_\n ));\n }\n const geometryExtent = geometry.getExtent();\n if (!intersects(this.extent_, geometryExtent)) {\n return;\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n const context = this.context_;\n const flatCoordinates = geometry.getFlatCoordinates();\n let offset = 0;\n const ends = /** @type {Array<number>} */ (geometry.getEnds());\n const stride = geometry.getStride();\n context.beginPath();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.moveToLineTo_(\n flatCoordinates,\n offset,\n ends[i],\n stride,\n false\n );\n }\n context.stroke();\n }\n if (this.text_ !== '') {\n const flatMidpoints = geometry.getFlatMidpoints();\n this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);\n }\n }\n\n /**\n * Render a Polygon geometry into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} geometry Polygon geometry.\n */\n drawPolygon(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_\n ));\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_ || this.fillState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const context = this.context_;\n context.beginPath();\n this.drawRings_(\n geometry.getOrientedFlatCoordinates(),\n 0,\n /** @type {Array<number>} */ (geometry.getEnds()),\n geometry.getStride()\n );\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n const flatInteriorPoint = geometry.getFlatInteriorPoint();\n this.drawText_(flatInteriorPoint, 0, 2, 2);\n }\n }\n\n /**\n * Render MultiPolygon geometry into the canvas. Rendering is immediate and\n * uses the current style.\n * @param {import(\"../../geom/MultiPolygon.js\").default} geometry MultiPolygon geometry.\n */\n drawMultiPolygon(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_\n ));\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_ || this.fillState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const context = this.context_;\n const flatCoordinates = geometry.getOrientedFlatCoordinates();\n let offset = 0;\n const endss = geometry.getEndss();\n const stride = geometry.getStride();\n context.beginPath();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n offset = this.drawRings_(flatCoordinates, offset, ends, stride);\n }\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n const flatInteriorPoints = geometry.getFlatInteriorPoints();\n this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillState} fillState Fill state.\n * @private\n */\n setContextFillState_(fillState) {\n const context = this.context_;\n const contextFillState = this.contextFillState_;\n if (!contextFillState) {\n context.fillStyle = fillState.fillStyle;\n this.contextFillState_ = {\n fillStyle: fillState.fillStyle,\n };\n } else {\n if (contextFillState.fillStyle != fillState.fillStyle) {\n contextFillState.fillStyle = fillState.fillStyle;\n context.fillStyle = fillState.fillStyle;\n }\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").StrokeState} strokeState Stroke state.\n * @private\n */\n setContextStrokeState_(strokeState) {\n const context = this.context_;\n const contextStrokeState = this.contextStrokeState_;\n if (!contextStrokeState) {\n context.lineCap = strokeState.lineCap;\n if (context.setLineDash) {\n context.setLineDash(strokeState.lineDash);\n context.lineDashOffset = strokeState.lineDashOffset;\n }\n context.lineJoin = strokeState.lineJoin;\n context.lineWidth = strokeState.lineWidth;\n context.miterLimit = strokeState.miterLimit;\n context.strokeStyle = strokeState.strokeStyle;\n this.contextStrokeState_ = {\n lineCap: strokeState.lineCap,\n lineDash: strokeState.lineDash,\n lineDashOffset: strokeState.lineDashOffset,\n lineJoin: strokeState.lineJoin,\n lineWidth: strokeState.lineWidth,\n miterLimit: strokeState.miterLimit,\n strokeStyle: strokeState.strokeStyle,\n };\n } else {\n if (contextStrokeState.lineCap != strokeState.lineCap) {\n contextStrokeState.lineCap = strokeState.lineCap;\n context.lineCap = strokeState.lineCap;\n }\n if (context.setLineDash) {\n if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {\n context.setLineDash(\n (contextStrokeState.lineDash = strokeState.lineDash)\n );\n }\n if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {\n contextStrokeState.lineDashOffset = strokeState.lineDashOffset;\n context.lineDashOffset = strokeState.lineDashOffset;\n }\n }\n if (contextStrokeState.lineJoin != strokeState.lineJoin) {\n contextStrokeState.lineJoin = strokeState.lineJoin;\n context.lineJoin = strokeState.lineJoin;\n }\n if (contextStrokeState.lineWidth != strokeState.lineWidth) {\n contextStrokeState.lineWidth = strokeState.lineWidth;\n context.lineWidth = strokeState.lineWidth;\n }\n if (contextStrokeState.miterLimit != strokeState.miterLimit) {\n contextStrokeState.miterLimit = strokeState.miterLimit;\n context.miterLimit = strokeState.miterLimit;\n }\n if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {\n contextStrokeState.strokeStyle = strokeState.strokeStyle;\n context.strokeStyle = strokeState.strokeStyle;\n }\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").TextState} textState Text state.\n * @private\n */\n setContextTextState_(textState) {\n const context = this.context_;\n const contextTextState = this.contextTextState_;\n const textAlign = textState.textAlign\n ? textState.textAlign\n : defaultTextAlign;\n if (!contextTextState) {\n context.font = textState.font;\n context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);\n context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);\n this.contextTextState_ = {\n font: textState.font,\n textAlign: textAlign,\n textBaseline: textState.textBaseline,\n };\n } else {\n if (contextTextState.font != textState.font) {\n contextTextState.font = textState.font;\n context.font = textState.font;\n }\n if (contextTextState.textAlign != textAlign) {\n contextTextState.textAlign = /** @type {CanvasTextAlign} */ (textAlign);\n context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);\n }\n if (contextTextState.textBaseline != textState.textBaseline) {\n contextTextState.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);\n context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);\n }\n }\n }\n\n /**\n * Set the fill and stroke style for subsequent draw operations. To clear\n * either fill or stroke styles, pass null for the appropriate parameter.\n *\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {\n if (!fillStyle) {\n this.fillState_ = null;\n } else {\n const fillStyleColor = fillStyle.getColor();\n this.fillState_ = {\n fillStyle: asColorLike(\n fillStyleColor ? fillStyleColor : defaultFillStyle\n ),\n };\n }\n if (!strokeStyle) {\n this.strokeState_ = null;\n } else {\n const strokeStyleColor = strokeStyle.getColor();\n const strokeStyleLineCap = strokeStyle.getLineCap();\n const strokeStyleLineDash = strokeStyle.getLineDash();\n const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();\n const strokeStyleLineJoin = strokeStyle.getLineJoin();\n const strokeStyleWidth = strokeStyle.getWidth();\n const strokeStyleMiterLimit = strokeStyle.getMiterLimit();\n this.strokeState_ = {\n lineCap:\n strokeStyleLineCap !== undefined\n ? strokeStyleLineCap\n : defaultLineCap,\n lineDash: strokeStyleLineDash ? strokeStyleLineDash : defaultLineDash,\n lineDashOffset: strokeStyleLineDashOffset\n ? strokeStyleLineDashOffset\n : defaultLineDashOffset,\n lineJoin:\n strokeStyleLineJoin !== undefined\n ? strokeStyleLineJoin\n : defaultLineJoin,\n lineWidth:\n this.pixelRatio_ *\n (strokeStyleWidth !== undefined\n ? strokeStyleWidth\n : defaultLineWidth),\n miterLimit:\n strokeStyleMiterLimit !== undefined\n ? strokeStyleMiterLimit\n : defaultMiterLimit,\n strokeStyle: asColorLike(\n strokeStyleColor ? strokeStyleColor : defaultStrokeStyle\n ),\n };\n }\n }\n\n /**\n * Set the image style for subsequent draw operations. Pass null to remove\n * the image style.\n *\n * @param {import(\"../../style/Image.js\").default} imageStyle Image style.\n */\n setImageStyle(imageStyle) {\n if (!imageStyle) {\n this.image_ = null;\n } else {\n const imageSize = imageStyle.getSize();\n if (!imageSize) {\n this.image_ = null;\n } else {\n const imageAnchor = imageStyle.getAnchor();\n // FIXME pixel ratio\n const imageImage = imageStyle.getImage(1);\n const imageOrigin = imageStyle.getOrigin();\n const imageScale = imageStyle.getScaleArray();\n this.imageAnchorX_ = imageAnchor[0];\n this.imageAnchorY_ = imageAnchor[1];\n this.imageHeight_ = imageSize[1];\n this.image_ = imageImage;\n this.imageOpacity_ = imageStyle.getOpacity();\n this.imageOriginX_ = imageOrigin[0];\n this.imageOriginY_ = imageOrigin[1];\n this.imageRotateWithView_ = imageStyle.getRotateWithView();\n this.imageRotation_ = imageStyle.getRotation();\n this.imageScale_ = [\n this.pixelRatio_ * imageScale[0],\n this.pixelRatio_ * imageScale[1],\n ];\n this.imageWidth_ = imageSize[0];\n }\n }\n }\n\n /**\n * Set the text style for subsequent draw operations. Pass null to\n * remove the text style.\n *\n * @param {import(\"../../style/Text.js\").default} textStyle Text style.\n */\n setTextStyle(textStyle) {\n if (!textStyle) {\n this.text_ = '';\n } else {\n const textFillStyle = textStyle.getFill();\n if (!textFillStyle) {\n this.textFillState_ = null;\n } else {\n const textFillStyleColor = textFillStyle.getColor();\n this.textFillState_ = {\n fillStyle: asColorLike(\n textFillStyleColor ? textFillStyleColor : defaultFillStyle\n ),\n };\n }\n const textStrokeStyle = textStyle.getStroke();\n if (!textStrokeStyle) {\n this.textStrokeState_ = null;\n } else {\n const textStrokeStyleColor = textStrokeStyle.getColor();\n const textStrokeStyleLineCap = textStrokeStyle.getLineCap();\n const textStrokeStyleLineDash = textStrokeStyle.getLineDash();\n const textStrokeStyleLineDashOffset = textStrokeStyle.getLineDashOffset();\n const textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();\n const textStrokeStyleWidth = textStrokeStyle.getWidth();\n const textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();\n this.textStrokeState_ = {\n lineCap:\n textStrokeStyleLineCap !== undefined\n ? textStrokeStyleLineCap\n : defaultLineCap,\n lineDash: textStrokeStyleLineDash\n ? textStrokeStyleLineDash\n : defaultLineDash,\n lineDashOffset: textStrokeStyleLineDashOffset\n ? textStrokeStyleLineDashOffset\n : defaultLineDashOffset,\n lineJoin:\n textStrokeStyleLineJoin !== undefined\n ? textStrokeStyleLineJoin\n : defaultLineJoin,\n lineWidth:\n textStrokeStyleWidth !== undefined\n ? textStrokeStyleWidth\n : defaultLineWidth,\n miterLimit:\n textStrokeStyleMiterLimit !== undefined\n ? textStrokeStyleMiterLimit\n : defaultMiterLimit,\n strokeStyle: asColorLike(\n textStrokeStyleColor ? textStrokeStyleColor : defaultStrokeStyle\n ),\n };\n }\n const textFont = textStyle.getFont();\n const textOffsetX = textStyle.getOffsetX();\n const textOffsetY = textStyle.getOffsetY();\n const textRotateWithView = textStyle.getRotateWithView();\n const textRotation = textStyle.getRotation();\n const textScale = textStyle.getScaleArray();\n const textText = textStyle.getText();\n const textTextAlign = textStyle.getTextAlign();\n const textTextBaseline = textStyle.getTextBaseline();\n this.textState_ = {\n font: textFont !== undefined ? textFont : defaultFont,\n textAlign:\n textTextAlign !== undefined ? textTextAlign : defaultTextAlign,\n textBaseline:\n textTextBaseline !== undefined\n ? textTextBaseline\n : defaultTextBaseline,\n };\n this.text_ = textText !== undefined ? textText : '';\n this.textOffsetX_ =\n textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;\n this.textOffsetY_ =\n textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0;\n this.textRotateWithView_ =\n textRotateWithView !== undefined ? textRotateWithView : false;\n this.textRotation_ = textRotation !== undefined ? textRotation : 0;\n this.textScale_ = [\n this.pixelRatio_ * textScale[0],\n this.pixelRatio_ * textScale[1],\n ];\n }\n }\n}\n\nexport default CanvasImmediateRenderer;\n","/**\n * @module ol/style/IconAnchorUnits\n */\n\n/**\n * Icon anchor units. One of 'fraction', 'pixels'.\n * @enum {string}\n */\nexport default {\n /**\n * Anchor is a fraction\n * @api\n */\n FRACTION: 'fraction',\n /**\n * Anchor is in pixels\n * @api\n */\n PIXELS: 'pixels',\n};\n","/**\n * @module ol/style/IconOrigin\n */\n\n/**\n * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.\n * @enum {string}\n */\nexport default {\n /**\n * Origin is at bottom left\n * @api\n */\n BOTTOM_LEFT: 'bottom-left',\n /**\n * Origin is at bottom right\n * @api\n */\n BOTTOM_RIGHT: 'bottom-right',\n /**\n * Origin is at top left\n * @api\n */\n TOP_LEFT: 'top-left',\n /**\n * Origin is at top right\n * @api\n */\n TOP_RIGHT: 'top-right',\n};\n","/**\n * @module ol/style/IconImageCache\n */\nimport {asString} from '../color.js';\n\n/**\n * @classdesc\n * Singleton class. Available through {@link module:ol/style/IconImageCache~shared}.\n */\nclass IconImageCache {\n constructor() {\n /**\n * @type {!Object<string, import(\"./IconImage.js\").default>}\n * @private\n */\n this.cache_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.cacheSize_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.maxCacheSize_ = 32;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.cache_ = {};\n this.cacheSize_ = 0;\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n return this.cacheSize_ > this.maxCacheSize_;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n expire() {\n if (this.canExpireCache()) {\n let i = 0;\n for (const key in this.cache_) {\n const iconImage = this.cache_[key];\n if ((i++ & 3) === 0 && !iconImage.hasListener()) {\n delete this.cache_[key];\n --this.cacheSize_;\n }\n }\n }\n }\n\n /**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color} color Color.\n * @return {import(\"./IconImage.js\").default} Icon image.\n */\n get(src, crossOrigin, color) {\n const key = getKey(src, crossOrigin, color);\n return key in this.cache_ ? this.cache_[key] : null;\n }\n\n /**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color} color Color.\n * @param {import(\"./IconImage.js\").default} iconImage Icon image.\n */\n set(src, crossOrigin, color, iconImage) {\n const key = getKey(src, crossOrigin, color);\n this.cache_[key] = iconImage;\n ++this.cacheSize_;\n }\n\n /**\n * Set the cache size of the icon cache. Default is `32`. Change this value when\n * your map uses more than 32 different icon images and you are not caching icon\n * styles on the application level.\n * @param {number} maxCacheSize Cache max size.\n * @api\n */\n setSize(maxCacheSize) {\n this.maxCacheSize_ = maxCacheSize;\n this.expire();\n }\n}\n\n/**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color} color Color.\n * @return {string} Cache key.\n */\nfunction getKey(src, crossOrigin, color) {\n const colorString = color ? asString(color) : 'null';\n return crossOrigin + ':' + src + ':' + colorString;\n}\n\nexport default IconImageCache;\n\n/**\n * The {@link module:ol/style/IconImageCache~IconImageCache} for\n * {@link module:ol/style/Icon~Icon} images.\n * @api\n */\nexport const shared = new IconImageCache();\n","/**\n * @module ol/ImageBase\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport {abstract} from './util.js';\n\n/**\n * @abstract\n */\nclass ImageBase extends EventTarget {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number|undefined} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./ImageState.js\").default} state State.\n */\n constructor(extent, resolution, pixelRatio, state) {\n super();\n\n /**\n * @protected\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = extent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @protected\n * @type {number|undefined}\n */\n this.resolution = resolution;\n\n /**\n * @protected\n * @type {import(\"./ImageState.js\").default}\n */\n this.state = state;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n getExtent() {\n return this.extent;\n }\n\n /**\n * @abstract\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n */\n getImage() {\n return abstract();\n }\n\n /**\n * @return {number} PixelRatio.\n */\n getPixelRatio() {\n return this.pixelRatio_;\n }\n\n /**\n * @return {number} Resolution.\n */\n getResolution() {\n return /** @type {number} */ (this.resolution);\n }\n\n /**\n * @return {import(\"./ImageState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Load not yet loaded URI.\n * @abstract\n */\n load() {\n abstract();\n }\n}\n\nexport default ImageBase;\n","/**\n * @module ol/Image\n */\nimport EventType from './events/EventType.js';\nimport ImageBase from './ImageBase.js';\nimport ImageState from './ImageState.js';\nimport {IMAGE_DECODE} from './has.js';\nimport {getHeight} from './extent.js';\nimport {listenOnce, unlistenByKey} from './events.js';\n\n/**\n * A function that takes an {@link module:ol/Image~Image} for the image and a\n * `{string}` for the src as arguments. It is supposed to make it so the\n * underlying image {@link module:ol/Image~Image#getImage} is assigned the\n * content specified by the src. If not specified, the default is\n *\n * function(image, src) {\n * image.getImage().src = src;\n * }\n *\n * Providing a custom `imageLoadFunction` can be useful to load images with\n * post requests or - in general - through XHR requests, where the src of the\n * image element would be set to a data URI when the content is loaded.\n *\n * @typedef {function(ImageWrapper, string): void} LoadFunction\n * @api\n */\n\nclass ImageWrapper extends ImageBase {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number|undefined} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {string} src Image source URI.\n * @param {?string} crossOrigin Cross origin.\n * @param {LoadFunction} imageLoadFunction Image load function.\n */\n constructor(\n extent,\n resolution,\n pixelRatio,\n src,\n crossOrigin,\n imageLoadFunction\n ) {\n super(extent, resolution, pixelRatio, ImageState.IDLE);\n\n /**\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n /**\n * @private\n * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}\n */\n this.image_ = new Image();\n if (crossOrigin !== null) {\n this.image_.crossOrigin = crossOrigin;\n }\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @protected\n * @type {import(\"./ImageState.js\").default}\n */\n this.state = ImageState.IDLE;\n\n /**\n * @private\n * @type {LoadFunction}\n */\n this.imageLoadFunction_ = imageLoadFunction;\n }\n\n /**\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Tracks loading or read errors.\n *\n * @private\n */\n handleImageError_() {\n this.state = ImageState.ERROR;\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Tracks successful image load.\n *\n * @private\n */\n handleImageLoad_() {\n if (this.resolution === undefined) {\n this.resolution = getHeight(this.extent) / this.image_.height;\n }\n this.state = ImageState.LOADED;\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n * @api\n */\n load() {\n if (this.state == ImageState.IDLE || this.state == ImageState.ERROR) {\n this.state = ImageState.LOADING;\n this.changed();\n this.imageLoadFunction_(this, this.src_);\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this)\n );\n }\n }\n\n /**\n * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n}\n\n/**\n * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image element.\n * @param {function():any} loadHandler Load callback function.\n * @param {function():any} errorHandler Error callback function.\n * @return {function():void} Callback to stop listening.\n */\nexport function listenImage(image, loadHandler, errorHandler) {\n const img = /** @type {HTMLImageElement} */ (image);\n\n if (img.src && IMAGE_DECODE) {\n const promise = img.decode();\n let listening = true;\n const unlisten = function () {\n listening = false;\n };\n promise\n .then(function () {\n if (listening) {\n loadHandler();\n }\n })\n .catch(function (error) {\n if (listening) {\n // FIXME: Unconditionally call errorHandler() when this bug is fixed upstream:\n // https://bugs.webkit.org/show_bug.cgi?id=198527\n if (\n error.name === 'EncodingError' &&\n error.message === 'Invalid image type.'\n ) {\n loadHandler();\n } else {\n errorHandler();\n }\n }\n });\n return unlisten;\n }\n\n const listenerKeys = [\n listenOnce(img, EventType.LOAD, loadHandler),\n listenOnce(img, EventType.ERROR, errorHandler),\n ];\n return function unlisten() {\n listenerKeys.forEach(unlistenByKey);\n };\n}\n\nexport default ImageWrapper;\n","/**\n * @module ol/style/IconImage\n */\n\nimport EventTarget from '../events/Target.js';\nimport EventType from '../events/EventType.js';\nimport ImageState from '../ImageState.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {shared as iconImageCache} from './IconImageCache.js';\nimport {listenImage} from '../Image.js';\n\n/**\n * @type {CanvasRenderingContext2D}\n */\nlet taintedTestContext = null;\n\nclass IconImage extends EventTarget {\n /**\n * @param {HTMLImageElement|HTMLCanvasElement} image Image.\n * @param {string|undefined} src Src.\n * @param {import(\"../size.js\").Size} size Size.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../ImageState.js\").default} imageState Image state.\n * @param {import(\"../color.js\").Color} color Color.\n */\n constructor(image, src, size, crossOrigin, imageState, color) {\n super();\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n this.hitDetectionImage_ = null;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n this.image_ = !image ? new Image() : image;\n\n if (crossOrigin !== null) {\n /** @type {HTMLImageElement} */ (this.image_).crossOrigin = crossOrigin;\n }\n\n /**\n * @private\n * @type {Object<number, HTMLCanvasElement>}\n */\n this.canvas_ = {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color}\n */\n this.color_ = color;\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @private\n * @type {import(\"../ImageState.js\").default}\n */\n this.imageState_ = imageState;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_ = size;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.src_ = src;\n\n /**\n * @private\n */\n this.tainted_;\n }\n\n /**\n * @private\n * @return {boolean} The image canvas is tainted.\n */\n isTainted_() {\n if (this.tainted_ === undefined && this.imageState_ === ImageState.LOADED) {\n if (!taintedTestContext) {\n taintedTestContext = createCanvasContext2D(1, 1);\n }\n taintedTestContext.drawImage(this.image_, 0, 0);\n try {\n taintedTestContext.getImageData(0, 0, 1, 1);\n this.tainted_ = false;\n } catch (e) {\n taintedTestContext = null;\n this.tainted_ = true;\n }\n }\n return this.tainted_ === true;\n }\n\n /**\n * @private\n */\n dispatchChangeEvent_() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @private\n */\n handleImageError_() {\n this.imageState_ = ImageState.ERROR;\n this.unlistenImage_();\n this.dispatchChangeEvent_();\n }\n\n /**\n * @private\n */\n handleImageLoad_() {\n this.imageState_ = ImageState.LOADED;\n if (this.size_) {\n this.image_.width = this.size_[0];\n this.image_.height = this.size_[1];\n } else {\n this.size_ = [this.image_.width, this.image_.height];\n }\n this.unlistenImage_();\n this.dispatchChangeEvent_();\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.\n */\n getImage(pixelRatio) {\n this.replaceColor_(pixelRatio);\n return this.canvas_[pixelRatio] ? this.canvas_[pixelRatio] : this.image_;\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Image or Canvas element.\n */\n getPixelRatio(pixelRatio) {\n this.replaceColor_(pixelRatio);\n return this.canvas_[pixelRatio] ? pixelRatio : 1;\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return this.imageState_;\n }\n\n /**\n * @return {HTMLImageElement|HTMLCanvasElement} Image element.\n */\n getHitDetectionImage() {\n if (!this.hitDetectionImage_) {\n if (this.isTainted_()) {\n const width = this.size_[0];\n const height = this.size_[1];\n const context = createCanvasContext2D(width, height);\n context.fillRect(0, 0, width, height);\n this.hitDetectionImage_ = context.canvas;\n } else {\n this.hitDetectionImage_ = this.image_;\n }\n }\n return this.hitDetectionImage_;\n }\n\n /**\n * Get the size of the icon (in pixels).\n * @return {import(\"../size.js\").Size} Image size.\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * @return {string|undefined} Image src.\n */\n getSrc() {\n return this.src_;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.imageState_ == ImageState.IDLE) {\n this.imageState_ = ImageState.LOADING;\n try {\n /** @type {HTMLImageElement} */ (this.image_).src = this.src_;\n } catch (e) {\n this.handleImageError_();\n }\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this)\n );\n }\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @private\n */\n replaceColor_(pixelRatio) {\n if (!this.color_ || this.canvas_[pixelRatio]) {\n return;\n }\n\n const canvas = document.createElement('canvas');\n this.canvas_[pixelRatio] = canvas;\n\n canvas.width = Math.ceil(this.image_.width * pixelRatio);\n canvas.height = Math.ceil(this.image_.height * pixelRatio);\n\n const ctx = canvas.getContext('2d');\n ctx.scale(pixelRatio, pixelRatio);\n ctx.drawImage(this.image_, 0, 0);\n\n if (this.isTainted_()) {\n // If reading from the canvas throws a SecurityError the same effect can be\n // achieved with globalCompositeOperation.\n // This could be used as the default, but it is not fully supported by all\n // browsers. E. g. Internet Explorer 11 does not support the multiply\n // operation and the resulting image shape will be completelly filled with\n // the provided color.\n // So this is only used as a fallback. It is still better than having no icon\n // at all.\n const c = this.color_;\n ctx.globalCompositeOperation = 'multiply';\n ctx.fillStyle = 'rgb(' + c[0] + ',' + c[1] + ',' + c[2] + ')';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n ctx.globalCompositeOperation = 'destination-in';\n ctx.drawImage(this.image_, 0, 0);\n return;\n }\n\n const imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n const data = imgData.data;\n const r = this.color_[0] / 255.0;\n const g = this.color_[1] / 255.0;\n const b = this.color_[2] / 255.0;\n\n for (let i = 0, ii = data.length; i < ii; i += 4) {\n data[i] *= r;\n data[i + 1] *= g;\n data[i + 2] *= b;\n }\n ctx.putImageData(imgData, 0, 0);\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n}\n\n/**\n * @param {HTMLImageElement|HTMLCanvasElement} image Image.\n * @param {string} src Src.\n * @param {import(\"../size.js\").Size} size Size.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../ImageState.js\").default} imageState Image state.\n * @param {import(\"../color.js\").Color} color Color.\n * @return {IconImage} Icon image.\n */\nexport function get(image, src, size, crossOrigin, imageState, color) {\n let iconImage = iconImageCache.get(src, crossOrigin, color);\n if (!iconImage) {\n iconImage = new IconImage(image, src, size, crossOrigin, imageState, color);\n iconImageCache.set(src, crossOrigin, color, iconImage);\n }\n return iconImage;\n}\n\nexport default IconImage;\n","/**\n * @module ol/style/Icon\n */\nimport EventType from '../events/EventType.js';\nimport IconAnchorUnits from './IconAnchorUnits.js';\nimport IconOrigin from './IconOrigin.js';\nimport ImageState from '../ImageState.js';\nimport ImageStyle from './Image.js';\nimport {asArray} from '../color.js';\nimport {assert} from '../asserts.js';\nimport {get as getIconImage} from './IconImage.js';\nimport {getUid} from '../util.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.\n * @property {import(\"./IconOrigin.js\").default} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {import(\"./IconAnchorUnits.js\").default} [anchorXUnits='fraction'] Units in which the anchor x value is\n * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates\n * the x value in pixels.\n * @property {import(\"./IconAnchorUnits.js\").default} [anchorYUnits='fraction'] Units in which the anchor y value is\n * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates\n * the y value in pixels.\n * @property {import(\"../color.js\").Color|string} [color] Color to tint the icon. If not specified,\n * the icon will be left as is.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a\n * `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the\n * provided image must already be loaded. And in that case, it is required\n * to provide the size of the image, with the `imgSize` option.\n * @property {Array<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the\n * sub-rectangle to use from the original icon image.\n * @property {Array<number>} [displacement=[0,0]] Displacement the icon\n * @property {import(\"./IconOrigin.js\").default} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {number} [opacity=1] Opacity of the icon.\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale.\n * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {import(\"../size.js\").Size} [size] Icon size in pixel. Can be used together with `offset` to define the\n * sub-rectangle to use from the origin (sprite) icon image.\n * @property {import(\"../size.js\").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not, and\n * for SVG images in Internet Explorer 11. The provided `imgSize` needs to match the actual size of the image.\n * @property {string} [src] Image source URI.\n */\n\n/**\n * @classdesc\n * Set icon style for vector features.\n * @api\n */\nclass Icon extends ImageStyle {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n /**\n * @type {number}\n */\n const opacity = options.opacity !== undefined ? options.opacity : 1;\n\n /**\n * @type {number}\n */\n const rotation = options.rotation !== undefined ? options.rotation : 0;\n\n /**\n * @type {number|import(\"../size.js\").Size}\n */\n const scale = options.scale !== undefined ? options.scale : 1;\n\n /**\n * @type {boolean}\n */\n const rotateWithView =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n super({\n opacity: opacity,\n rotation: rotation,\n scale: scale,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n rotateWithView: rotateWithView,\n });\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5];\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.normalizedAnchor_ = null;\n\n /**\n * @private\n * @type {import(\"./IconOrigin.js\").default}\n */\n this.anchorOrigin_ =\n options.anchorOrigin !== undefined\n ? options.anchorOrigin\n : IconOrigin.TOP_LEFT;\n\n /**\n * @private\n * @type {import(\"./IconAnchorUnits.js\").default}\n */\n this.anchorXUnits_ =\n options.anchorXUnits !== undefined\n ? options.anchorXUnits\n : IconAnchorUnits.FRACTION;\n\n /**\n * @private\n * @type {import(\"./IconAnchorUnits.js\").default}\n */\n this.anchorYUnits_ =\n options.anchorYUnits !== undefined\n ? options.anchorYUnits\n : IconAnchorUnits.FRACTION;\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n const image = options.img !== undefined ? options.img : null;\n\n /**\n * @type {import(\"../size.js\").Size}\n */\n const imgSize = options.imgSize !== undefined ? options.imgSize : null;\n\n /**\n * @type {string|undefined}\n */\n let src = options.src;\n\n assert(!(src !== undefined && image), 4); // `image` and `src` cannot be provided at the same time\n assert(!image || (image && imgSize), 5); // `imgSize` must be set when `image` is provided\n\n if ((src === undefined || src.length === 0) && image) {\n src = /** @type {HTMLImageElement} */ (image).src || getUid(image);\n }\n assert(src !== undefined && src.length > 0, 6); // A defined and non-empty `src` or `image` must be provided\n\n /**\n * @type {import(\"../ImageState.js\").default}\n */\n const imageState =\n options.src !== undefined ? ImageState.IDLE : ImageState.LOADED;\n\n /**\n * @private\n * @type {import(\"../color.js\").Color}\n */\n this.color_ = options.color !== undefined ? asArray(options.color) : null;\n\n /**\n * @private\n * @type {import(\"./IconImage.js\").default}\n */\n this.iconImage_ = getIconImage(\n image,\n /** @type {string} */ (src),\n imgSize,\n this.crossOrigin_,\n imageState,\n this.color_\n );\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.offset_ = options.offset !== undefined ? options.offset : [0, 0];\n /**\n * @private\n * @type {import(\"./IconOrigin.js\").default}\n */\n this.offsetOrigin_ =\n options.offsetOrigin !== undefined\n ? options.offsetOrigin\n : IconOrigin.TOP_LEFT;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.origin_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_ = options.size !== undefined ? options.size : null;\n }\n\n /**\n * Clones the style. The underlying Image/HTMLCanvasElement is not cloned.\n * @return {Icon} The cloned style.\n * @api\n */\n clone() {\n const scale = this.getScale();\n return new Icon({\n anchor: this.anchor_.slice(),\n anchorOrigin: this.anchorOrigin_,\n anchorXUnits: this.anchorXUnits_,\n anchorYUnits: this.anchorYUnits_,\n crossOrigin: this.crossOrigin_,\n color:\n this.color_ && this.color_.slice\n ? this.color_.slice()\n : this.color_ || undefined,\n src: this.getSrc(),\n offset: this.offset_.slice(),\n offsetOrigin: this.offsetOrigin_,\n size: this.size_ !== null ? this.size_.slice() : undefined,\n opacity: this.getOpacity(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n });\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @return {Array<number>} Anchor.\n * @api\n */\n getAnchor() {\n if (this.normalizedAnchor_) {\n return this.normalizedAnchor_;\n }\n let anchor = this.anchor_;\n const size = this.getSize();\n if (\n this.anchorXUnits_ == IconAnchorUnits.FRACTION ||\n this.anchorYUnits_ == IconAnchorUnits.FRACTION\n ) {\n if (!size) {\n return null;\n }\n anchor = this.anchor_.slice();\n if (this.anchorXUnits_ == IconAnchorUnits.FRACTION) {\n anchor[0] *= size[0];\n }\n if (this.anchorYUnits_ == IconAnchorUnits.FRACTION) {\n anchor[1] *= size[1];\n }\n }\n\n if (this.anchorOrigin_ != IconOrigin.TOP_LEFT) {\n if (!size) {\n return null;\n }\n if (anchor === this.anchor_) {\n anchor = this.anchor_.slice();\n }\n if (\n this.anchorOrigin_ == IconOrigin.TOP_RIGHT ||\n this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT\n ) {\n anchor[0] = -anchor[0] + size[0];\n }\n if (\n this.anchorOrigin_ == IconOrigin.BOTTOM_LEFT ||\n this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT\n ) {\n anchor[1] = -anchor[1] + size[1];\n }\n }\n this.normalizedAnchor_ = anchor;\n return this.normalizedAnchor_;\n }\n\n /**\n * Set the anchor point. The anchor determines the center point for the\n * symbolizer.\n *\n * @param {Array<number>} anchor Anchor.\n * @api\n */\n setAnchor(anchor) {\n this.anchor_ = anchor;\n this.normalizedAnchor_ = null;\n }\n\n /**\n * Get the icon color.\n * @return {import(\"../color.js\").Color} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Get the image icon.\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.\n * @api\n */\n getImage(pixelRatio) {\n return this.iconImage_.getImage(pixelRatio);\n }\n\n /**\n * Get the pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} The pixel ration of the image.\n * @api\n */\n getPixelRatio(pixelRatio) {\n return this.iconImage_.getPixelRatio(pixelRatio);\n }\n\n /**\n * @return {import(\"../size.js\").Size} Image size.\n */\n getImageSize() {\n return this.iconImage_.getSize();\n }\n\n /**\n * @return {import(\"../size.js\").Size} Size of the hit-detection image.\n */\n getHitDetectionImageSize() {\n return this.getImageSize();\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return this.iconImage_.getImageState();\n }\n\n /**\n * @return {HTMLImageElement|HTMLCanvasElement} Image element.\n */\n getHitDetectionImage() {\n return this.iconImage_.getHitDetectionImage();\n }\n\n /**\n * Get the origin of the symbolizer.\n * @return {Array<number>} Origin.\n * @api\n */\n getOrigin() {\n if (this.origin_) {\n return this.origin_;\n }\n let offset = this.offset_;\n const displacement = this.getDisplacement();\n\n if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {\n const size = this.getSize();\n const iconImageSize = this.iconImage_.getSize();\n if (!size || !iconImageSize) {\n return null;\n }\n offset = offset.slice();\n if (\n this.offsetOrigin_ == IconOrigin.TOP_RIGHT ||\n this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT\n ) {\n offset[0] = iconImageSize[0] - size[0] - offset[0];\n }\n if (\n this.offsetOrigin_ == IconOrigin.BOTTOM_LEFT ||\n this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT\n ) {\n offset[1] = iconImageSize[1] - size[1] - offset[1];\n }\n }\n offset[0] += displacement[0];\n offset[1] += displacement[1];\n this.origin_ = offset;\n return this.origin_;\n }\n\n /**\n * Get the image URL.\n * @return {string|undefined} Image src.\n * @api\n */\n getSrc() {\n return this.iconImage_.getSrc();\n }\n\n /**\n * Get the size of the icon (in pixels).\n * @return {import(\"../size.js\").Size} Image size.\n * @api\n */\n getSize() {\n return !this.size_ ? this.iconImage_.getSize() : this.size_;\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n listenImageChange(listener) {\n this.iconImage_.addEventListener(EventType.CHANGE, listener);\n }\n\n /**\n * Load not yet loaded URI.\n * When rendering a feature with an icon style, the vector renderer will\n * automatically call this method. However, you might want to call this\n * method yourself for preloading or other purposes.\n * @api\n */\n load() {\n this.iconImage_.load();\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n unlistenImageChange(listener) {\n this.iconImage_.removeEventListener(EventType.CHANGE, listener);\n }\n}\n\nexport default Icon;\n","/**\n * @module ol/style\n */\n\nexport {default as Circle} from './style/Circle.js';\nexport {default as Fill} from './style/Fill.js';\nexport {default as Icon} from './style/Icon.js';\nexport {default as IconImage} from './style/IconImage.js';\nexport {default as Image} from './style/Image.js';\nexport {default as RegularShape} from './style/RegularShape.js';\nexport {default as Stroke} from './style/Stroke.js';\nexport {default as Style} from './style/Style.js';\nexport {default as Text} from './style/Text.js';\n","/**\n * @module ol/render/canvas/hitdetet\n */\n\nimport CanvasImmediateRenderer from './Immediate.js';\nimport GeometryType from '../../geom/GeometryType.js';\nimport IconAnchorUnits from '../../style/IconAnchorUnits.js';\nimport {Icon} from '../../style.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {intersects} from '../../extent.js';\nimport {numberSafeCompareFunction} from '../../array.js';\n\n/**\n * @param {import(\"../../size.js\").Size} size Canvas size in css pixels.\n * @param {Array<import(\"../../transform.js\").Transform>} transforms Transforms\n * for rendering features to all worlds of the viewport, from coordinates to css\n * pixels.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} features\n * Features to consider for hit detection.\n * @param {import(\"../../style/Style.js\").StyleFunction|undefined} styleFunction\n * Layer style function.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @return {ImageData} Hit detection image data.\n */\nexport function createHitDetectionImageData(\n size,\n transforms,\n features,\n styleFunction,\n extent,\n resolution,\n rotation\n) {\n const width = size[0] / 2;\n const height = size[1] / 2;\n const context = createCanvasContext2D(width, height);\n context.imageSmoothingEnabled = false;\n const canvas = context.canvas;\n const renderer = new CanvasImmediateRenderer(\n context,\n 0.5,\n extent,\n null,\n rotation\n );\n const featureCount = features.length;\n // Stretch hit detection index to use the whole available color range\n const indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount);\n const featuresByZIndex = {};\n for (let i = 1; i <= featureCount; ++i) {\n const feature = features[i - 1];\n const featureStyleFunction = feature.getStyleFunction() || styleFunction;\n if (!styleFunction) {\n continue;\n }\n let styles = featureStyleFunction(feature, resolution);\n if (!styles) {\n continue;\n }\n if (!Array.isArray(styles)) {\n styles = [styles];\n }\n const index = i * indexFactor;\n const color = '#' + ('000000' + index.toString(16)).slice(-6);\n for (let j = 0, jj = styles.length; j < jj; ++j) {\n const originalStyle = styles[j];\n const style = originalStyle.clone();\n const fill = style.getFill();\n if (fill) {\n fill.setColor(color);\n }\n const stroke = style.getStroke();\n if (stroke) {\n stroke.setColor(color);\n }\n style.setText(undefined);\n const image = originalStyle.getImage();\n if (image) {\n const imgSize = image.getImageSize();\n if (!imgSize) {\n continue;\n }\n\n const canvas = document.createElement('canvas');\n canvas.width = imgSize[0];\n canvas.height = imgSize[1];\n const imgContext = canvas.getContext('2d', {alpha: false});\n imgContext.fillStyle = color;\n const img = imgContext.canvas;\n imgContext.fillRect(0, 0, img.width, img.height);\n const width = imgSize ? imgSize[0] : img.width;\n const height = imgSize ? imgSize[1] : img.height;\n const iconContext = createCanvasContext2D(width, height);\n iconContext.drawImage(img, 0, 0);\n style.setImage(\n new Icon({\n img: img,\n imgSize: imgSize,\n anchor: image.getAnchor(),\n anchorXUnits: IconAnchorUnits.PIXELS,\n anchorYUnits: IconAnchorUnits.PIXELS,\n offset: image.getOrigin(),\n size: image.getSize(),\n opacity: image.getOpacity(),\n scale: image.getScale(),\n rotation: image.getRotation(),\n rotateWithView: image.getRotateWithView(),\n })\n );\n }\n const zIndex = Number(style.getZIndex());\n let byGeometryType = featuresByZIndex[zIndex];\n if (!byGeometryType) {\n byGeometryType = {};\n featuresByZIndex[zIndex] = byGeometryType;\n byGeometryType[GeometryType.POLYGON] = [];\n byGeometryType[GeometryType.CIRCLE] = [];\n byGeometryType[GeometryType.LINE_STRING] = [];\n byGeometryType[GeometryType.POINT] = [];\n }\n const geometry = style.getGeometryFunction()(feature);\n if (geometry && intersects(extent, geometry.getExtent())) {\n byGeometryType[geometry.getType().replace('Multi', '')].push(\n geometry,\n style\n );\n }\n }\n }\n\n const zIndexKeys = Object.keys(featuresByZIndex)\n .map(Number)\n .sort(numberSafeCompareFunction);\n for (let i = 0, ii = zIndexKeys.length; i < ii; ++i) {\n const byGeometryType = featuresByZIndex[zIndexKeys[i]];\n for (const type in byGeometryType) {\n const geomAndStyle = byGeometryType[type];\n for (let j = 0, jj = geomAndStyle.length; j < jj; j += 2) {\n renderer.setStyle(geomAndStyle[j + 1]);\n for (let k = 0, kk = transforms.length; k < kk; ++k) {\n renderer.setTransform(transforms[k]);\n renderer.drawGeometry(geomAndStyle[j]);\n }\n }\n }\n }\n return context.getImageData(0, 0, canvas.width, canvas.height);\n}\n\n/**\n * @param {import(\"../../pixel\").Pixel} pixel Pixel coordinate on the hit\n * detection canvas in css pixels.\n * @param {Array<import(\"../../Feature\").FeatureLike>} features Features. Has to\n * match the `features` array that was passed to `createHitDetectionImageData()`.\n * @param {ImageData} imageData Hit detection image data generated by\n * `createHitDetectionImageData()`.\n * @return {Array<import(\"../../Feature\").FeatureLike>} features Features.\n */\nexport function hitDetect(pixel, features, imageData) {\n const resultFeatures = [];\n if (imageData) {\n const index =\n (Math.round(pixel[0] / 2) + Math.round(pixel[1] / 2) * imageData.width) *\n 4;\n const r = imageData.data[index];\n const g = imageData.data[index + 1];\n const b = imageData.data[index + 2];\n const i = b + 256 * (g + 256 * r);\n const indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length);\n if (i && i % indexFactor === 0) {\n resultFeatures.push(features[i / indexFactor - 1]);\n }\n }\n return resultFeatures;\n}\n","/**\n * @module ol/renderer/vector\n */\nimport BuilderType from '../render/canvas/BuilderType.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport ImageState from '../ImageState.js';\nimport {getUid} from '../util.js';\n\n/**\n * Tolerance for geometry simplification in device pixels.\n * @type {number}\n */\nconst SIMPLIFY_TOLERANCE = 0.5;\n\n/**\n * @const\n * @type {Object<import(\"../geom/GeometryType.js\").default,\n * function(import(\"../render/canvas/BuilderGroup.js\").default, import(\"../geom/Geometry.js\").default,\n * import(\"../style/Style.js\").default, Object): void>}\n */\nconst GEOMETRY_RENDERERS = {\n 'Point': renderPointGeometry,\n 'LineString': renderLineStringGeometry,\n 'Polygon': renderPolygonGeometry,\n 'MultiPoint': renderMultiPointGeometry,\n 'MultiLineString': renderMultiLineStringGeometry,\n 'MultiPolygon': renderMultiPolygonGeometry,\n 'GeometryCollection': renderGeometryCollectionGeometry,\n 'Circle': renderCircleGeometry,\n};\n\n/**\n * @param {import(\"../Feature.js\").FeatureLike} feature1 Feature 1.\n * @param {import(\"../Feature.js\").FeatureLike} feature2 Feature 2.\n * @return {number} Order.\n */\nexport function defaultOrder(feature1, feature2) {\n return parseInt(getUid(feature1), 10) - parseInt(getUid(feature2), 10);\n}\n\n/**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Squared pixel tolerance.\n */\nexport function getSquaredTolerance(resolution, pixelRatio) {\n const tolerance = getTolerance(resolution, pixelRatio);\n return tolerance * tolerance;\n}\n\n/**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel tolerance.\n */\nexport function getTolerance(resolution, pixelRatio) {\n return (SIMPLIFY_TOLERANCE * resolution) / pixelRatio;\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Builder group.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n */\nfunction renderCircleGeometry(builderGroup, geometry, style, feature) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (fillStyle || strokeStyle) {\n const circleReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.CIRCLE\n );\n circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n circleReplay.drawCircle(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @param {import(\"../proj.js\").TransformFunction} [opt_transform] Transform from user to view projection.\n * @return {boolean} `true` if style is loading.\n * @template T\n */\nexport function renderFeature(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n listener,\n opt_transform\n) {\n let loading = false;\n const imageStyle = style.getImage();\n if (imageStyle) {\n let imageState = imageStyle.getImageState();\n if (imageState == ImageState.LOADED || imageState == ImageState.ERROR) {\n imageStyle.unlistenImageChange(listener);\n } else {\n if (imageState == ImageState.IDLE) {\n imageStyle.load();\n }\n imageState = imageStyle.getImageState();\n imageStyle.listenImageChange(listener);\n loading = true;\n }\n }\n renderFeatureInternal(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n opt_transform\n );\n\n return loading;\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [opt_transform] Optional transform function.\n */\nfunction renderFeatureInternal(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n opt_transform\n) {\n const geometry = style.getGeometryFunction()(feature);\n if (!geometry) {\n return;\n }\n const simplifiedGeometry = geometry.simplifyTransformed(\n squaredTolerance,\n opt_transform\n );\n const renderer = style.getRenderer();\n if (renderer) {\n renderGeometry(replayGroup, simplifiedGeometry, style, feature);\n } else {\n const geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()];\n geometryRenderer(replayGroup, simplifiedGeometry, style, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\nfunction renderGeometry(replayGroup, geometry, style, feature) {\n if (geometry.getType() == GeometryType.GEOMETRY_COLLECTION) {\n const geometries = /** @type {import(\"../geom/GeometryCollection.js\").default} */ (geometry).getGeometries();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n renderGeometry(replayGroup, geometries[i], style, feature);\n }\n return;\n }\n const replay = replayGroup.getBuilder(style.getZIndex(), BuilderType.DEFAULT);\n replay.drawCustom(\n /** @type {import(\"../geom/SimpleGeometry.js\").default} */ (geometry),\n feature,\n style.getRenderer()\n );\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n */\nfunction renderGeometryCollectionGeometry(\n replayGroup,\n geometry,\n style,\n feature\n) {\n const geometries = geometry.getGeometriesArray();\n let i, ii;\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n const geometryRenderer = GEOMETRY_RENDERERS[geometries[i].getType()];\n geometryRenderer(replayGroup, geometries[i], style, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/LineString.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\nfunction renderLineStringGeometry(builderGroup, geometry, style, feature) {\n const strokeStyle = style.getStroke();\n if (strokeStyle) {\n const lineStringReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.LINE_STRING\n );\n lineStringReplay.setFillStrokeStyle(null, strokeStyle);\n lineStringReplay.drawLineString(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\nfunction renderMultiLineStringGeometry(builderGroup, geometry, style, feature) {\n const strokeStyle = style.getStroke();\n if (strokeStyle) {\n const lineStringReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.LINE_STRING\n );\n lineStringReplay.setFillStrokeStyle(null, strokeStyle);\n lineStringReplay.drawMultiLineString(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n */\nfunction renderMultiPolygonGeometry(builderGroup, geometry, style, feature) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (strokeStyle || fillStyle) {\n const polygonReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.POLYGON\n );\n polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n polygonReplay.drawMultiPolygon(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/Point.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\nfunction renderPointGeometry(builderGroup, geometry, style, feature) {\n const imageStyle = style.getImage();\n if (imageStyle) {\n if (imageStyle.getImageState() != ImageState.LOADED) {\n return;\n }\n const imageReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.IMAGE\n );\n imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false));\n imageReplay.drawPoint(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle));\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\nfunction renderMultiPointGeometry(builderGroup, geometry, style, feature) {\n const imageStyle = style.getImage();\n if (imageStyle) {\n if (imageStyle.getImageState() != ImageState.LOADED) {\n return;\n }\n const imageReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.IMAGE\n );\n imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false));\n imageReplay.drawMultiPoint(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle));\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/Polygon.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n */\nfunction renderPolygonGeometry(builderGroup, geometry, style, feature) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (fillStyle || strokeStyle) {\n const polygonReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.POLYGON\n );\n polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n polygonReplay.drawPolygon(geometry, feature);\n }\n const textStyle = style.getText();\n if (textStyle) {\n const textReplay = builderGroup.getBuilder(\n style.getZIndex(),\n BuilderType.TEXT\n );\n textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));\n textReplay.drawText(geometry, feature);\n }\n}\n","/**\n * @module ol/renderer/canvas/VectorLayer\n */\nimport CanvasBuilderGroup from '../../render/canvas/BuilderGroup.js';\nimport CanvasLayerRenderer from './Layer.js';\nimport ExecutorGroup, {\n replayDeclutter,\n} from '../../render/canvas/ExecutorGroup.js';\nimport ViewHint from '../../ViewHint.js';\nimport {\n apply,\n makeInverse,\n makeScale,\n toString as transformToString,\n} from '../../transform.js';\nimport {\n buffer,\n containsExtent,\n createEmpty,\n getWidth,\n intersects as intersectsExtent,\n wrapX as wrapExtentX,\n} from '../../extent.js';\nimport {\n createHitDetectionImageData,\n hitDetect,\n} from '../../render/canvas/hitdetect.js';\nimport {\n defaultOrder as defaultRenderOrder,\n getTolerance as getRenderTolerance,\n getSquaredTolerance as getSquaredRenderTolerance,\n renderFeature,\n} from '../vector.js';\nimport {\n fromUserExtent,\n getTransformFromProjections,\n getUserProjection,\n toUserExtent,\n} from '../../proj.js';\nimport {getUid} from '../../util.js';\nimport {wrapX as wrapCoordinateX} from '../../coordinate.js';\n\n/**\n * @classdesc\n * Canvas renderer for vector layers.\n * @api\n */\nclass CanvasVectorLayerRenderer extends CanvasLayerRenderer {\n /**\n * @param {import(\"../../layer/Vector.js\").default} vectorLayer Vector layer.\n */\n constructor(vectorLayer) {\n super(vectorLayer);\n\n /** @private */\n this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this);\n\n /**\n * @type {boolean}\n */\n this.animatingOrInteracting_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.dirty_ = false;\n\n /**\n * @type {ImageData}\n */\n this.hitDetectionImageData_ = null;\n\n /**\n * @type {Array<import(\"../../Feature.js\").default>}\n */\n this.renderedFeatures_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedResolution_ = NaN;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.renderedExtent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRotation_;\n\n /**\n * @private\n * @type {import(\"../../coordinate\").Coordinate}\n */\n this.renderedCenter_ = null;\n\n /**\n * @private\n * @type {import(\"../../proj/Projection\").default}\n */\n this.renderedProjection_ = null;\n\n /**\n * @private\n * @type {function(import(\"../../Feature.js\").default, import(\"../../Feature.js\").default): number|null}\n */\n this.renderedRenderOrder_ = null;\n\n /**\n * @private\n * @type {import(\"../../render/canvas/ExecutorGroup\").default}\n */\n this.replayGroup_ = null;\n\n /**\n * A new replay group had to be created by `prepareFrame()`\n * @type {boolean}\n */\n this.replayGroupChanged = true;\n\n /**\n * Clipping to be performed by `renderFrame()`\n * @type {boolean}\n */\n this.clipping = true;\n }\n\n /**\n * Get a rendering container from an existing target, if compatible.\n * @param {HTMLElement} target Potential render target.\n * @param {string} transform CSS Transform.\n * @param {number} opacity Opacity.\n */\n useContainer(target, transform, opacity) {\n if (opacity < 1) {\n target = null;\n }\n super.useContainer(target, transform, opacity);\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n */\n renderFrame(frameState, target) {\n const pixelRatio = frameState.pixelRatio;\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n\n // set forward and inverse pixel transforms\n makeScale(this.pixelTransform, 1 / pixelRatio, 1 / pixelRatio);\n makeInverse(this.inversePixelTransform, this.pixelTransform);\n\n const canvasTransform = transformToString(this.pixelTransform);\n\n this.useContainer(target, canvasTransform, layerState.opacity);\n const context = this.context;\n const canvas = context.canvas;\n\n const replayGroup = this.replayGroup_;\n if (!replayGroup || replayGroup.isEmpty()) {\n if (!this.containerReused && canvas.width > 0) {\n canvas.width = 0;\n }\n return this.container;\n }\n\n // resize and clear\n const width = Math.round(frameState.size[0] * pixelRatio);\n const height = Math.round(frameState.size[1] * pixelRatio);\n if (canvas.width != width || canvas.height != height) {\n canvas.width = width;\n canvas.height = height;\n if (canvas.style.transform !== canvasTransform) {\n canvas.style.transform = canvasTransform;\n }\n } else if (!this.containerReused) {\n context.clearRect(0, 0, width, height);\n }\n\n this.preRender(context, frameState);\n\n const extent = frameState.extent;\n const viewState = frameState.viewState;\n const center = viewState.center;\n const resolution = viewState.resolution;\n const projection = viewState.projection;\n const rotation = viewState.rotation;\n const projectionExtent = projection.getExtent();\n const vectorSource = this.getLayer().getSource();\n\n // clipped rendering if layer extent is set\n let clipped = false;\n if (layerState.extent && this.clipping) {\n const layerExtent = fromUserExtent(layerState.extent, projection);\n clipped =\n !containsExtent(layerExtent, frameState.extent) &&\n intersectsExtent(layerExtent, frameState.extent);\n if (clipped) {\n this.clipUnrotated(context, frameState, layerExtent);\n }\n }\n\n const viewHints = frameState.viewHints;\n const snapToPixel = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n\n const transform = this.getRenderTransform(\n center,\n resolution,\n rotation,\n pixelRatio,\n width,\n height,\n 0\n );\n const declutterReplays = this.getLayer().getDeclutter() ? {} : null;\n replayGroup.execute(\n context,\n 1,\n transform,\n rotation,\n snapToPixel,\n undefined,\n declutterReplays\n );\n\n if (\n vectorSource.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n let startX = extent[0];\n const worldWidth = getWidth(projectionExtent);\n let world = 0;\n let offsetX;\n while (startX < projectionExtent[0]) {\n --world;\n offsetX = worldWidth * world;\n const transform = this.getRenderTransform(\n center,\n resolution,\n rotation,\n pixelRatio,\n width,\n height,\n offsetX\n );\n replayGroup.execute(\n context,\n 1,\n transform,\n rotation,\n snapToPixel,\n undefined,\n declutterReplays\n );\n startX += worldWidth;\n }\n world = 0;\n startX = extent[2];\n while (startX > projectionExtent[2]) {\n ++world;\n offsetX = worldWidth * world;\n const transform = this.getRenderTransform(\n center,\n resolution,\n rotation,\n pixelRatio,\n width,\n height,\n offsetX\n );\n replayGroup.execute(\n context,\n 1,\n transform,\n rotation,\n snapToPixel,\n undefined,\n declutterReplays\n );\n startX -= worldWidth;\n }\n }\n if (declutterReplays) {\n const viewHints = frameState.viewHints;\n const hifi = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n replayDeclutter(\n declutterReplays,\n context,\n rotation,\n 1,\n hifi,\n frameState.declutterItems\n );\n }\n\n if (clipped) {\n context.restore();\n }\n\n this.postRender(context, frameState);\n\n const opacity = layerState.opacity;\n const container = this.container;\n if (opacity !== parseFloat(container.style.opacity)) {\n container.style.opacity = opacity === 1 ? '' : String(opacity);\n }\n\n if (this.renderedRotation_ !== viewState.rotation) {\n this.renderedRotation_ = viewState.rotation;\n this.hitDetectionImageData_ = null;\n }\n return this.container;\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../../Feature\").default>>} Promise that resolves with an array of features.\n */\n getFeatures(pixel) {\n return new Promise(\n function (resolve, reject) {\n if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {\n const size = [this.context.canvas.width, this.context.canvas.height];\n apply(this.pixelTransform, size);\n const center = this.renderedCenter_;\n const resolution = this.renderedResolution_;\n const rotation = this.renderedRotation_;\n const projection = this.renderedProjection_;\n const extent = this.renderedExtent_;\n const layer = this.getLayer();\n const transforms = [];\n const width = size[0] / 2;\n const height = size[1] / 2;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n 0.5,\n width,\n height,\n 0\n ).slice()\n );\n const source = layer.getSource();\n const projectionExtent = projection.getExtent();\n if (\n source.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n let startX = extent[0];\n const worldWidth = getWidth(projectionExtent);\n let world = 0;\n let offsetX;\n while (startX < projectionExtent[0]) {\n --world;\n offsetX = worldWidth * world;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n 0.5,\n width,\n height,\n offsetX\n ).slice()\n );\n startX += worldWidth;\n }\n world = 0;\n startX = extent[2];\n while (startX > projectionExtent[2]) {\n ++world;\n offsetX = worldWidth * world;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n 0.5,\n width,\n height,\n offsetX\n ).slice()\n );\n startX -= worldWidth;\n }\n }\n\n this.hitDetectionImageData_ = createHitDetectionImageData(\n size,\n transforms,\n this.renderedFeatures_,\n layer.getStyleFunction(),\n extent,\n resolution,\n rotation\n );\n }\n resolve(\n hitDetect(pixel, this.renderedFeatures_, this.hitDetectionImageData_)\n );\n }.bind(this)\n );\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../../Feature.js\").FeatureLike, import(\"../../layer/Layer.js\").default): T} callback Feature callback.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} declutteredFeatures Decluttered features.\n * @return {T|void} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n declutteredFeatures\n ) {\n if (!this.replayGroup_) {\n return undefined;\n } else {\n const resolution = frameState.viewState.resolution;\n const rotation = frameState.viewState.rotation;\n const layer = this.getLayer();\n /** @type {!Object<string, boolean>} */\n const features = {};\n\n const result = this.replayGroup_.forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @return {?} Callback result.\n */\n function (feature) {\n const key = getUid(feature);\n if (!(key in features)) {\n features[key] = true;\n return callback(feature, layer);\n }\n },\n layer.getDeclutter() ? declutteredFeatures : null\n );\n\n return result;\n }\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n */\n handleFontsChanged() {\n const layer = this.getLayer();\n if (layer.getVisible() && this.replayGroup_) {\n layer.changed();\n }\n }\n\n /**\n * Handle changes in image style state.\n * @param {import(\"../../events/Event.js\").default} event Image style change event.\n * @private\n */\n handleStyleImageChange_(event) {\n this.renderIfReadyAndVisible();\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n */\n prepareFrame(frameState) {\n const vectorLayer = this.getLayer();\n const vectorSource = vectorLayer.getSource();\n if (!vectorSource) {\n return false;\n }\n\n const animating = frameState.viewHints[ViewHint.ANIMATING];\n const interacting = frameState.viewHints[ViewHint.INTERACTING];\n const updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();\n const updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();\n\n if (\n (!this.dirty_ && !updateWhileAnimating && animating) ||\n (!updateWhileInteracting && interacting)\n ) {\n this.animatingOrInteracting_ = true;\n return true;\n }\n this.animatingOrInteracting_ = false;\n\n const frameStateExtent = frameState.extent;\n const viewState = frameState.viewState;\n const projection = viewState.projection;\n const resolution = viewState.resolution;\n const pixelRatio = frameState.pixelRatio;\n const vectorLayerRevision = vectorLayer.getRevision();\n const vectorLayerRenderBuffer = vectorLayer.getRenderBuffer();\n let vectorLayerRenderOrder = vectorLayer.getRenderOrder();\n\n if (vectorLayerRenderOrder === undefined) {\n vectorLayerRenderOrder = defaultRenderOrder;\n }\n\n const center = viewState.center.slice();\n const extent = buffer(\n frameStateExtent,\n vectorLayerRenderBuffer * resolution\n );\n const loadExtents = [extent.slice()];\n const projectionExtent = projection.getExtent();\n\n if (\n vectorSource.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(projectionExtent, frameState.extent)\n ) {\n // For the replay group, we need an extent that intersects the real world\n // (-180° to +180°). To support geometries in a coordinate range from -540°\n // to +540°, we add at least 1 world width on each side of the projection\n // extent. If the viewport is wider than the world, we need to add half of\n // the viewport width to make sure we cover the whole viewport.\n const worldWidth = getWidth(projectionExtent);\n const gutter = Math.max(getWidth(extent) / 2, worldWidth);\n extent[0] = projectionExtent[0] - gutter;\n extent[2] = projectionExtent[2] + gutter;\n wrapCoordinateX(center, projection);\n const loadExtent = wrapExtentX(loadExtents[0], projection);\n // If the extent crosses the date line, we load data for both edges of the worlds\n if (\n loadExtent[0] < projectionExtent[0] &&\n loadExtent[2] < projectionExtent[2]\n ) {\n loadExtents.push([\n loadExtent[0] + worldWidth,\n loadExtent[1],\n loadExtent[2] + worldWidth,\n loadExtent[3],\n ]);\n } else if (\n loadExtent[0] > projectionExtent[0] &&\n loadExtent[2] > projectionExtent[2]\n ) {\n loadExtents.push([\n loadExtent[0] - worldWidth,\n loadExtent[1],\n loadExtent[2] - worldWidth,\n loadExtent[3],\n ]);\n }\n }\n\n if (\n !this.dirty_ &&\n this.renderedResolution_ == resolution &&\n this.renderedRevision_ == vectorLayerRevision &&\n this.renderedRenderOrder_ == vectorLayerRenderOrder &&\n containsExtent(this.renderedExtent_, extent)\n ) {\n this.replayGroupChanged = false;\n return true;\n }\n\n this.replayGroup_ = null;\n\n this.dirty_ = false;\n\n const replayGroup = new CanvasBuilderGroup(\n getRenderTolerance(resolution, pixelRatio),\n extent,\n resolution,\n pixelRatio,\n vectorLayer.getDeclutter()\n );\n\n const userProjection = getUserProjection();\n let userTransform;\n if (userProjection) {\n for (let i = 0, ii = loadExtents.length; i < ii; ++i) {\n vectorSource.loadFeatures(\n toUserExtent(loadExtents[i], projection),\n resolution,\n userProjection\n );\n }\n userTransform = getTransformFromProjections(userProjection, projection);\n } else {\n for (let i = 0, ii = loadExtents.length; i < ii; ++i) {\n vectorSource.loadFeatures(loadExtents[i], resolution, projection);\n }\n }\n\n const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);\n\n /**\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @this {CanvasVectorLayerRenderer}\n */\n const render = function (feature) {\n let styles;\n const styleFunction =\n feature.getStyleFunction() || vectorLayer.getStyleFunction();\n if (styleFunction) {\n styles = styleFunction(feature, resolution);\n }\n if (styles) {\n const dirty = this.renderFeature(\n feature,\n squaredTolerance,\n styles,\n replayGroup,\n userTransform\n );\n this.dirty_ = this.dirty_ || dirty;\n }\n }.bind(this);\n\n const userExtent = toUserExtent(extent, projection);\n /** @type {Array<import(\"../../Feature.js\").default>} */\n const features = vectorSource.getFeaturesInExtent(userExtent);\n if (vectorLayerRenderOrder) {\n features.sort(vectorLayerRenderOrder);\n }\n for (let i = 0, ii = features.length; i < ii; ++i) {\n render(features[i]);\n }\n this.renderedFeatures_ = features;\n\n const replayGroupInstructions = replayGroup.finish();\n const executorGroup = new ExecutorGroup(\n extent,\n resolution,\n pixelRatio,\n vectorSource.getOverlaps(),\n replayGroupInstructions,\n vectorLayer.getRenderBuffer()\n );\n\n this.renderedResolution_ = resolution;\n this.renderedRevision_ = vectorLayerRevision;\n this.renderedRenderOrder_ = vectorLayerRenderOrder;\n this.renderedExtent_ = extent;\n this.renderedCenter_ = center;\n this.renderedProjection_ = projection;\n this.replayGroup_ = executorGroup;\n this.hitDetectionImageData_ = null;\n\n this.replayGroupChanged = true;\n return true;\n }\n\n /**\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} squaredTolerance Squared render tolerance.\n * @param {import(\"../../style/Style.js\").default|Array<import(\"../../style/Style.js\").default>} styles The style or array of styles.\n * @param {import(\"../../render/canvas/BuilderGroup.js\").default} builderGroup Builder group.\n * @param {import(\"../../proj.js\").TransformFunction=} opt_transform Transform from user to view projection.\n * @return {boolean} `true` if an image is loading.\n */\n renderFeature(\n feature,\n squaredTolerance,\n styles,\n builderGroup,\n opt_transform\n ) {\n if (!styles) {\n return false;\n }\n let loading = false;\n if (Array.isArray(styles)) {\n for (let i = 0, ii = styles.length; i < ii; ++i) {\n loading =\n renderFeature(\n builderGroup,\n feature,\n styles[i],\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n opt_transform\n ) || loading;\n }\n } else {\n loading = renderFeature(\n builderGroup,\n feature,\n styles,\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n opt_transform\n );\n }\n return loading;\n }\n}\n\nexport default CanvasVectorLayerRenderer;\n","/**\n * @module ol/layer/Vector\n */\nimport BaseVectorLayer from './BaseVector.js';\nimport CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js';\n\n/**\n * @classdesc\n * Vector data that is rendered client-side.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @extends {BaseVectorLayer<import(\"../source/Vector.js\").default>}\n * @api\n */\nclass VectorLayer extends BaseVectorLayer {\n /**\n * @param {import(\"./BaseVector.js\").Options=} opt_options Options.\n */\n constructor(opt_options) {\n super(opt_options);\n }\n\n /**\n * Create a renderer for this layer.\n * @return {import(\"../renderer/Layer.js\").default} A layer renderer.\n */\n createRenderer() {\n return new CanvasVectorLayerRenderer(this);\n }\n}\n\nexport default VectorLayer;\n","/**\n * @module ol/structs/RBush\n */\nimport RBush_ from 'rbush/rbush.js';\nimport {createOrUpdate, equals} from '../extent.js';\nimport {getUid} from '../util.js';\nimport {isEmpty} from '../obj.js';\n\n/**\n * @typedef {Object} Entry\n * @property {number} minX\n * @property {number} minY\n * @property {number} maxX\n * @property {number} maxY\n * @property {Object} [value]\n */\n\n/**\n * @classdesc\n * Wrapper around the RBush by Vladimir Agafonkin.\n * See https://github.com/mourner/rbush.\n *\n * @template T\n */\nclass RBush {\n /**\n * @param {number=} opt_maxEntries Max entries.\n */\n constructor(opt_maxEntries) {\n /**\n * @private\n */\n this.rbush_ = new RBush_(opt_maxEntries);\n\n /**\n * A mapping between the objects added to this rbush wrapper\n * and the objects that are actually added to the internal rbush.\n * @private\n * @type {Object<string, Entry>}\n */\n this.items_ = {};\n }\n\n /**\n * Insert a value into the RBush.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {T} value Value.\n */\n insert(extent, value) {\n /** @type {Entry} */\n const item = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n value: value,\n };\n\n this.rbush_.insert(item);\n this.items_[getUid(value)] = item;\n }\n\n /**\n * Bulk-insert values into the RBush.\n * @param {Array<import(\"../extent.js\").Extent>} extents Extents.\n * @param {Array<T>} values Values.\n */\n load(extents, values) {\n const items = new Array(values.length);\n for (let i = 0, l = values.length; i < l; i++) {\n const extent = extents[i];\n const value = values[i];\n\n /** @type {Entry} */\n const item = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n value: value,\n };\n items[i] = item;\n this.items_[getUid(value)] = item;\n }\n this.rbush_.load(items);\n }\n\n /**\n * Remove a value from the RBush.\n * @param {T} value Value.\n * @return {boolean} Removed.\n */\n remove(value) {\n const uid = getUid(value);\n\n // get the object in which the value was wrapped when adding to the\n // internal rbush. then use that object to do the removal.\n const item = this.items_[uid];\n delete this.items_[uid];\n return this.rbush_.remove(item) !== null;\n }\n\n /**\n * Update the extent of a value in the RBush.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {T} value Value.\n */\n update(extent, value) {\n const item = this.items_[getUid(value)];\n const bbox = [item.minX, item.minY, item.maxX, item.maxY];\n if (!equals(bbox, extent)) {\n this.remove(value);\n this.insert(extent, value);\n }\n }\n\n /**\n * Return all values in the RBush.\n * @return {Array<T>} All.\n */\n getAll() {\n const items = this.rbush_.all();\n return items.map(function (item) {\n return item.value;\n });\n }\n\n /**\n * Return all values in the given extent.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {Array<T>} All in extent.\n */\n getInExtent(extent) {\n /** @type {Entry} */\n const bbox = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n };\n const items = this.rbush_.search(bbox);\n return items.map(function (item) {\n return item.value;\n });\n }\n\n /**\n * Calls a callback function with each value in the tree.\n * If the callback returns a truthy value, this value is returned without\n * checking the rest of the tree.\n * @param {function(T): *} callback Callback.\n * @return {*} Callback return value.\n */\n forEach(callback) {\n return this.forEach_(this.getAll(), callback);\n }\n\n /**\n * Calls a callback function with each value in the provided extent.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(T): *} callback Callback.\n * @return {*} Callback return value.\n */\n forEachInExtent(extent, callback) {\n return this.forEach_(this.getInExtent(extent), callback);\n }\n\n /**\n * @param {Array<T>} values Values.\n * @param {function(T): *} callback Callback.\n * @private\n * @return {*} Callback return value.\n */\n forEach_(values, callback) {\n let result;\n for (let i = 0, l = values.length; i < l; i++) {\n result = callback(values[i]);\n if (result) {\n return result;\n }\n }\n return result;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return isEmpty(this.items_);\n }\n\n /**\n * Remove all values from the RBush.\n */\n clear() {\n this.rbush_.clear();\n this.items_ = {};\n }\n\n /**\n * @param {import(\"../extent.js\").Extent=} opt_extent Extent.\n * @return {import(\"../extent.js\").Extent} Extent.\n */\n getExtent(opt_extent) {\n const data = this.rbush_.toJSON();\n return createOrUpdate(\n data.minX,\n data.minY,\n data.maxX,\n data.maxY,\n opt_extent\n );\n }\n\n /**\n * @param {RBush} rbush R-Tree.\n */\n concat(rbush) {\n this.rbush_.load(rbush.rbush_.all());\n for (const i in rbush.items_) {\n this.items_[i] = rbush.items_[i];\n }\n }\n}\n\nexport default RBush;\n","/**\n * @module ol/source/Source\n */\nimport BaseObject from '../Object.js';\nimport SourceState from './State.js';\nimport {abstract} from '../util.js';\nimport {get as getProjection} from '../proj.js';\n\n/**\n * A function that returns a string or an array of strings representing source\n * attributions.\n *\n * @typedef {function(import(\"../PluggableMap.js\").FrameState): (string|Array<string>)} Attribution\n */\n\n/**\n * A type that can be used to provide attribution information for data sources.\n *\n * It represents either\n * * a simple string (e.g. `'© Acme Inc.'`)\n * * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)\n * * a function that returns a string or array of strings ({@link module:ol/source/Source~Attribution})\n *\n * @typedef {string|Array<string>|Attribution} AttributionLike\n */\n\n/**\n * @typedef {Object} Options\n * @property {AttributionLike} [attributions]\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {import(\"./State.js\").default} [state='ready']\n * @property {boolean} [wrapX=false]\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for {@link module:ol/layer/Layer~Layer} sources.\n *\n * A generic `change` event is triggered when the state of the source changes.\n * @abstract\n * @api\n */\nclass Source extends BaseObject {\n /**\n * @param {Options} options Source options.\n */\n constructor(options) {\n super();\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = getProjection(options.projection);\n\n /**\n * @private\n * @type {?Attribution}\n */\n this.attributions_ = adaptAttributions(options.attributions);\n\n /**\n * @private\n * @type {boolean}\n */\n this.attributionsCollapsible_ =\n options.attributionsCollapsible !== undefined\n ? options.attributionsCollapsible\n : true;\n\n /**\n * This source is currently loading data. Sources that defer loading to the\n * map's tile queue never set this to `true`.\n * @type {boolean}\n */\n this.loading = false;\n\n /**\n * @private\n * @type {import(\"./State.js\").default}\n */\n this.state_ =\n options.state !== undefined ? options.state : SourceState.READY;\n\n /**\n * @private\n * @type {boolean}\n */\n this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;\n }\n\n /**\n * Get the attribution function for the source.\n * @return {?Attribution} Attribution function.\n */\n getAttributions() {\n return this.attributions_;\n }\n\n /**\n * @return {boolean} Attributions are collapsible.\n */\n getAttributionsCollapsible() {\n return this.attributionsCollapsible_;\n }\n\n /**\n * Get the projection of the source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n */\n getProjection() {\n return this.projection_;\n }\n\n /**\n * @abstract\n * @return {Array<number>|undefined} Resolutions.\n */\n getResolutions() {\n return abstract();\n }\n\n /**\n * Get the state of the source, see {@link module:ol/source/State~State} for possible states.\n * @return {import(\"./State.js\").default} State.\n * @api\n */\n getState() {\n return this.state_;\n }\n\n /**\n * @return {boolean|undefined} Wrap X.\n */\n getWrapX() {\n return this.wrapX_;\n }\n\n /**\n * @return {Object|undefined} Context options.\n */\n getContextOptions() {\n return undefined;\n }\n\n /**\n * Refreshes the source. The source will be cleared, and data from the server will be reloaded.\n * @api\n */\n refresh() {\n this.changed();\n }\n\n /**\n * Set the attributions of the source.\n * @param {AttributionLike|undefined} attributions Attributions.\n * Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},\n * or `undefined`.\n * @api\n */\n setAttributions(attributions) {\n this.attributions_ = adaptAttributions(attributions);\n this.changed();\n }\n\n /**\n * Set the state of the source.\n * @param {import(\"./State.js\").default} state State.\n */\n setState(state) {\n this.state_ = state;\n this.changed();\n }\n}\n\n/**\n * Turns the attributions option into an attributions function.\n * @param {AttributionLike|undefined} attributionLike The attribution option.\n * @return {?Attribution} An attribution function (or null).\n */\nfunction adaptAttributions(attributionLike) {\n if (!attributionLike) {\n return null;\n }\n if (Array.isArray(attributionLike)) {\n return function (frameState) {\n return attributionLike;\n };\n }\n\n if (typeof attributionLike === 'function') {\n return attributionLike;\n }\n\n return function (frameState) {\n return [attributionLike];\n };\n}\n\nexport default Source;\n","/**\n * @module ol/source/VectorEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a feature is added to the source.\n * @event module:ol/source/Vector.VectorSourceEvent#addfeature\n * @api\n */\n ADDFEATURE: 'addfeature',\n\n /**\n * Triggered when a feature is updated.\n * @event module:ol/source/Vector.VectorSourceEvent#changefeature\n * @api\n */\n CHANGEFEATURE: 'changefeature',\n\n /**\n * Triggered when the clear method is called on the source.\n * @event module:ol/source/Vector.VectorSourceEvent#clear\n * @api\n */\n CLEAR: 'clear',\n\n /**\n * Triggered when a feature is removed from the source.\n * See {@link module:ol/source/Vector#clear source.clear()} for exceptions.\n * @event module:ol/source/Vector.VectorSourceEvent#removefeature\n * @api\n */\n REMOVEFEATURE: 'removefeature',\n};\n","/**\n * @module ol/loadingstrategy\n */\n\n/**\n * Strategy function for loading all features with a single request.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n * @api\n */\nexport function all(extent, resolution) {\n return [[-Infinity, -Infinity, Infinity, Infinity]];\n}\n\n/**\n * Strategy function for loading features based on the view's extent and\n * resolution.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n * @api\n */\nexport function bbox(extent, resolution) {\n return [extent];\n}\n\n/**\n * Creates a strategy function for loading features based on a tile grid.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {function(import(\"./extent.js\").Extent, number): Array<import(\"./extent.js\").Extent>} Loading strategy.\n * @api\n */\nexport function tile(tileGrid) {\n return (\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n */\n function (extent, resolution) {\n const z = tileGrid.getZForResolution(resolution);\n const tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);\n /** @type {Array<import(\"./extent.js\").Extent>} */\n const extents = [];\n /** @type {import(\"./tilecoord.js\").TileCoord} */\n const tileCoord = [z, 0, 0];\n for (\n tileCoord[1] = tileRange.minX;\n tileCoord[1] <= tileRange.maxX;\n ++tileCoord[1]\n ) {\n for (\n tileCoord[2] = tileRange.minY;\n tileCoord[2] <= tileRange.maxY;\n ++tileCoord[2]\n ) {\n extents.push(tileGrid.getTileCoordExtent(tileCoord));\n }\n }\n return extents;\n }\n );\n}\n","/**\n * @module ol/format/FormatType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n ARRAY_BUFFER: 'arraybuffer',\n JSON: 'json',\n TEXT: 'text',\n XML: 'xml',\n};\n","/**\n * @module ol/featureloader\n */\nimport FormatType from './format/FormatType.js';\nimport {VOID} from './functions.js';\n\n/**\n *\n * @type {boolean}\n * @private\n */\nlet withCredentials = false;\n\n/**\n * {@link module:ol/source/Vector} sources use a function of this type to\n * load features.\n *\n * This function takes an {@link module:ol/extent~Extent} representing the area to be loaded,\n * a `{number}` representing the resolution (map units per pixel) and an\n * {@link module:ol/proj/Projection} for the projection as\n * arguments. `this` within the function is bound to the\n * {@link module:ol/source/Vector} it's called from.\n *\n * The function is responsible for loading the features and adding them to the\n * source.\n * @typedef {function(this:(import(\"./source/Vector\").default|import(\"./VectorTile.js\").default), import(\"./extent.js\").Extent, number,\n * import(\"./proj/Projection.js\").default): void} FeatureLoader\n * @api\n */\n\n/**\n * {@link module:ol/source/Vector} sources use a function of this type to\n * get the url to load features from.\n *\n * This function takes an {@link module:ol/extent~Extent} representing the area\n * to be loaded, a `{number}` representing the resolution (map units per pixel)\n * and an {@link module:ol/proj/Projection} for the projection as\n * arguments and returns a `{string}` representing the URL.\n * @typedef {function(import(\"./extent.js\").Extent, number, import(\"./proj/Projection.js\").default): string} FeatureUrlFunction\n * @api\n */\n\n/**\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @param {function(this:import(\"./VectorTile.js\").default, Array<import(\"./Feature.js\").default>, import(\"./proj/Projection.js\").default, import(\"./extent.js\").Extent): void|function(this:import(\"./source/Vector\").default, Array<import(\"./Feature.js\").default>): void} success\n * Function called with the loaded features and optionally with the data\n * projection. Called with the vector tile or source as `this`.\n * @param {function(this:import(\"./VectorTile.js\").default): void|function(this:import(\"./source/Vector\").default): void} failure\n * Function called when loading failed. Called with the vector tile or\n * source as `this`.\n * @return {FeatureLoader} The feature loader.\n */\nexport function loadFeaturesXhr(url, format, success, failure) {\n return (\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @this {import(\"./source/Vector\").default|import(\"./VectorTile.js\").default}\n */\n function (extent, resolution, projection) {\n const xhr = new XMLHttpRequest();\n xhr.open(\n 'GET',\n typeof url === 'function' ? url(extent, resolution, projection) : url,\n true\n );\n if (format.getType() == FormatType.ARRAY_BUFFER) {\n xhr.responseType = 'arraybuffer';\n }\n xhr.withCredentials = withCredentials;\n /**\n * @param {Event} event Event.\n * @private\n */\n xhr.onload = function (event) {\n // status will be 0 for file:// urls\n if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {\n const type = format.getType();\n /** @type {Document|Node|Object|string|undefined} */\n let source;\n if (type == FormatType.JSON || type == FormatType.TEXT) {\n source = xhr.responseText;\n } else if (type == FormatType.XML) {\n source = xhr.responseXML;\n if (!source) {\n source = new DOMParser().parseFromString(\n xhr.responseText,\n 'application/xml'\n );\n }\n } else if (type == FormatType.ARRAY_BUFFER) {\n source = /** @type {ArrayBuffer} */ (xhr.response);\n }\n if (source) {\n success.call(\n this,\n format.readFeatures(source, {\n extent: extent,\n featureProjection: projection,\n }),\n format.readProjection(source)\n );\n } else {\n failure.call(this);\n }\n } else {\n failure.call(this);\n }\n }.bind(this);\n /**\n * @private\n */\n xhr.onerror = function () {\n failure.call(this);\n }.bind(this);\n xhr.send();\n }\n );\n}\n\n/**\n * Create an XHR feature loader for a `url` and `format`. The feature loader\n * loads features (with XHR), parses the features, and adds them to the\n * vector source.\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @return {FeatureLoader} The feature loader.\n * @api\n */\nexport function xhr(url, format) {\n return loadFeaturesXhr(\n url,\n format,\n /**\n * @param {Array<import(\"./Feature.js\").default>} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data\n * projection.\n * @this {import(\"./source/Vector\").default|import(\"./VectorTile.js\").default}\n */\n function (features, dataProjection) {\n const sourceOrTile = /** @type {?} */ (this);\n if (typeof sourceOrTile.addFeatures === 'function') {\n /** @type {import(\"./source/Vector\").default} */ (sourceOrTile).addFeatures(\n features\n );\n }\n },\n /* FIXME handle error */ VOID\n );\n}\n\n/**\n * Setter for the withCredentials configuration for the XHR.\n *\n * @param {boolean} xhrWithCredentials The value of withCredentials to set.\n * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/\n * @api\n */\nexport function setWithCredentials(xhrWithCredentials) {\n withCredentials = xhrWithCredentials;\n}\n","/**\n * @module ol/source/Vector\n */\n\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport RBush from '../structs/RBush.js';\nimport Source from './Source.js';\nimport SourceState from './State.js';\nimport VectorEventType from './VectorEventType.js';\nimport {TRUE, VOID} from '../functions.js';\nimport {all as allStrategy} from '../loadingstrategy.js';\nimport {assert} from '../asserts.js';\nimport {containsExtent, equals} from '../extent.js';\nimport {extend} from '../array.js';\nimport {getUid} from '../util.js';\nimport {getValues, isEmpty} from '../obj.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {xhr} from '../featureloader.js';\n\n/**\n * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and\n * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this\n * is one of the standard {@link module:ol/loadingstrategy} strategies.\n *\n * @typedef {function(import(\"../extent.js\").Extent, number): Array<import(\"../extent.js\").Extent>} LoadingStrategy\n * @api\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Vector} instances are instances of this\n * type.\n * @template {import(\"../geom/Geometry.js\").default} Geometry\n */\nexport class VectorSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {import(\"../Feature.js\").default<Geometry>=} opt_feature Feature.\n */\n constructor(type, opt_feature) {\n super(type);\n\n /**\n * The feature being added or removed.\n * @type {import(\"../Feature.js\").default<Geometry>|undefined}\n * @api\n */\n this.feature = opt_feature;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {Array<import(\"../Feature.js\").default>|Collection<import(\"../Feature.js\").default>} [features]\n * Features. If provided as {@link module:ol/Collection}, the features in the source\n * and the collection will stay in sync.\n * @property {import(\"../format/Feature.js\").default} [format] The feature format used by the XHR\n * feature loader when `url` is set. Required if `url` is set, otherwise ignored.\n * @property {import(\"../featureloader.js\").FeatureLoader} [loader]\n * The loader function used to load features, from a remote source for example.\n * If this is not set and `url` is set, the source will create and use an XHR\n * feature loader.\n *\n * Example:\n *\n * ```js\n * import {Vector} from 'ol/source';\n * import {GeoJSON} from 'ol/format';\n * import {bbox} from 'ol/loadingstrategy';\n *\n * var vectorSource = new Vector({\n * format: new GeoJSON(),\n * loader: function(extent, resolution, projection) {\n * var proj = projection.getCode();\n * var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +\n * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +\n * 'outputFormat=application/json&srsname=' + proj + '&' +\n * 'bbox=' + extent.join(',') + ',' + proj;\n * var xhr = new XMLHttpRequest();\n * xhr.open('GET', url);\n * var onError = function() {\n * vectorSource.removeLoadedExtent(extent);\n * }\n * xhr.onerror = onError;\n * xhr.onload = function() {\n * if (xhr.status == 200) {\n * vectorSource.addFeatures(\n * vectorSource.getFormat().readFeatures(xhr.responseText));\n * } else {\n * onError();\n * }\n * }\n * xhr.send();\n * },\n * strategy: bbox\n * });\n * ```\n * @property {boolean} [overlaps=true] This source may have overlapping geometries.\n * Setting this to `false` (e.g. for sources with polygons that represent administrative\n * boundaries or TopoJSON sources) allows the renderer to optimise fill and\n * stroke operations.\n * @property {LoadingStrategy} [strategy] The loading strategy to use.\n * By default an {@link module:ol/loadingstrategy~all}\n * strategy is used, a one-off strategy which loads all features at once.\n * @property {string|import(\"../featureloader.js\").FeatureUrlFunction} [url]\n * Setting this option instructs the source to load features using an XHR loader\n * (see {@link module:ol/featureloader~xhr}). Use a `string` and an\n * {@link module:ol/loadingstrategy~all} for a one-off download of all features from\n * the given URL. Use a {@link module:ol/featureloader~FeatureUrlFunction} to generate the url with\n * other loading strategies.\n * Requires `format` to be set as well.\n * When default XHR feature loader is provided, the features will\n * be transformed from the data projection to the view projection\n * during parsing. If your remote data source does not advertise its projection\n * properly, this transformation will be incorrect. For some formats, the\n * default projection (usually EPSG:4326) can be overridden by setting the\n * dataProjection constructor option on the format.\n * Note that if a source contains non-feature data, such as a GeoJSON geometry\n * or a KML NetworkLink, these will be ignored. Use a custom loader to load these.\n * @property {boolean} [useSpatialIndex=true]\n * By default, an RTree is used as spatial index. When features are removed and\n * added frequently, and the total number of features is low, setting this to\n * `false` may improve performance.\n *\n * Note that\n * {@link module:ol/source/Vector~VectorSource#getFeaturesInExtent},\n * {@link module:ol/source/Vector~VectorSource#getClosestFeatureToCoordinate} and\n * {@link module:ol/source/Vector~VectorSource#getExtent} cannot be used when `useSpatialIndex` is\n * set to `false`, and {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent} will loop\n * through all features.\n *\n * When set to `false`, the features will be maintained in an\n * {@link module:ol/Collection}, which can be retrieved through\n * {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}.\n * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the\n * -180° and 180° meridians to work properly, this should be set to `false`. The\n * resulting geometry coordinates will then exceed the world bounds.\n */\n\n/**\n * @classdesc\n * Provides a source of features for vector layers. Vector features provided\n * by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for\n * vector data that is optimized for rendering.\n *\n * @fires VectorSourceEvent\n * @api\n * @template {import(\"../geom/Geometry.js\").default} Geometry\n */\nclass VectorSource extends Source {\n /**\n * @param {Options=} opt_options Vector source options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n super({\n attributions: options.attributions,\n projection: undefined,\n state: SourceState.READY,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n });\n\n /**\n * @private\n * @type {import(\"../featureloader.js\").FeatureLoader}\n */\n this.loader_ = VOID;\n\n /**\n * @private\n * @type {import(\"../format/Feature.js\").default|undefined}\n */\n this.format_ = options.format;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = options.overlaps === undefined ? true : options.overlaps;\n\n /**\n * @private\n * @type {string|import(\"../featureloader.js\").FeatureUrlFunction|undefined}\n */\n this.url_ = options.url;\n\n if (options.loader !== undefined) {\n this.loader_ = options.loader;\n } else if (this.url_ !== undefined) {\n assert(this.format_, 7); // `format` must be set when `url` is set\n // create a XHR feature loader for \"url\" and \"format\"\n this.loader_ = xhr(\n this.url_,\n /** @type {import(\"../format/Feature.js\").default} */ (this.format_)\n );\n }\n\n /**\n * @private\n * @type {LoadingStrategy}\n */\n this.strategy_ =\n options.strategy !== undefined ? options.strategy : allStrategy;\n\n const useSpatialIndex =\n options.useSpatialIndex !== undefined ? options.useSpatialIndex : true;\n\n /**\n * @private\n * @type {RBush<import(\"../Feature.js\").default<Geometry>>}\n */\n this.featuresRtree_ = useSpatialIndex ? new RBush() : null;\n\n /**\n * @private\n * @type {RBush<{extent: import(\"../extent.js\").Extent}>}\n */\n this.loadedExtentsRtree_ = new RBush();\n\n /**\n * @private\n * @type {!Object<string, import(\"../Feature.js\").default<Geometry>>}\n */\n this.nullGeometryFeatures_ = {};\n\n /**\n * A lookup of features by id (the return from feature.getId()).\n * @private\n * @type {!Object<string, import(\"../Feature.js\").default<Geometry>>}\n */\n this.idIndex_ = {};\n\n /**\n * A lookup of features by uid (using getUid(feature)).\n * @private\n * @type {!Object<string, import(\"../Feature.js\").default<Geometry>>}\n */\n this.uidIndex_ = {};\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").EventsKey>>}\n */\n this.featureChangeKeys_ = {};\n\n /**\n * @private\n * @type {Collection<import(\"../Feature.js\").default<Geometry>>}\n */\n this.featuresCollection_ = null;\n\n let collection, features;\n if (Array.isArray(options.features)) {\n features = options.features;\n } else if (options.features) {\n collection = options.features;\n features = collection.getArray();\n }\n if (!useSpatialIndex && collection === undefined) {\n collection = new Collection(features);\n }\n if (features !== undefined) {\n this.addFeaturesInternal(features);\n }\n if (collection !== undefined) {\n this.bindFeaturesCollection_(collection);\n }\n }\n\n /**\n * Add a single feature to the source. If you want to add a batch of features\n * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}\n * instead. A feature will not be added to the source if feature with\n * the same id is already there. The reason for this behavior is to avoid\n * feature duplication when using bbox or tile loading strategies.\n * Note: this also applies if an {@link module:ol/Collection} is used for features,\n * meaning that if a feature with a duplicate id is added in the collection, it will\n * be removed from it right away.\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature to add.\n * @api\n */\n addFeature(feature) {\n this.addFeatureInternal(feature);\n this.changed();\n }\n\n /**\n * Add a feature without firing a `change` event.\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature.\n * @protected\n */\n addFeatureInternal(feature) {\n const featureKey = getUid(feature);\n\n if (!this.addToIndex_(featureKey, feature)) {\n if (this.featuresCollection_) {\n this.featuresCollection_.remove(feature);\n }\n return;\n }\n\n this.setupChangeEvents_(featureKey, feature);\n\n const geometry = feature.getGeometry();\n if (geometry) {\n const extent = geometry.getExtent();\n if (this.featuresRtree_) {\n this.featuresRtree_.insert(extent, feature);\n }\n } else {\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.ADDFEATURE, feature)\n );\n }\n\n /**\n * @param {string} featureKey Unique identifier for the feature.\n * @param {import(\"../Feature.js\").default<Geometry>} feature The feature.\n * @private\n */\n setupChangeEvents_(featureKey, feature) {\n this.featureChangeKeys_[featureKey] = [\n listen(feature, EventType.CHANGE, this.handleFeatureChange_, this),\n listen(\n feature,\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n this\n ),\n ];\n }\n\n /**\n * @param {string} featureKey Unique identifier for the feature.\n * @param {import(\"../Feature.js\").default<Geometry>} feature The feature.\n * @return {boolean} The feature is \"valid\", in the sense that it is also a\n * candidate for insertion into the Rtree.\n * @private\n */\n addToIndex_(featureKey, feature) {\n let valid = true;\n const id = feature.getId();\n if (id !== undefined) {\n if (!(id.toString() in this.idIndex_)) {\n this.idIndex_[id.toString()] = feature;\n } else {\n valid = false;\n }\n }\n if (valid) {\n assert(!(featureKey in this.uidIndex_), 30); // The passed `feature` was already added to the source\n this.uidIndex_[featureKey] = feature;\n }\n return valid;\n }\n\n /**\n * Add a batch of features to the source.\n * @param {Array<import(\"../Feature.js\").default<Geometry>>} features Features to add.\n * @api\n */\n addFeatures(features) {\n this.addFeaturesInternal(features);\n this.changed();\n }\n\n /**\n * Add features without firing a `change` event.\n * @param {Array<import(\"../Feature.js\").default<Geometry>>} features Features.\n * @protected\n */\n addFeaturesInternal(features) {\n const extents = [];\n const newFeatures = [];\n const geometryFeatures = [];\n\n for (let i = 0, length = features.length; i < length; i++) {\n const feature = features[i];\n const featureKey = getUid(feature);\n if (this.addToIndex_(featureKey, feature)) {\n newFeatures.push(feature);\n }\n }\n\n for (let i = 0, length = newFeatures.length; i < length; i++) {\n const feature = newFeatures[i];\n const featureKey = getUid(feature);\n this.setupChangeEvents_(featureKey, feature);\n\n const geometry = feature.getGeometry();\n if (geometry) {\n const extent = geometry.getExtent();\n extents.push(extent);\n geometryFeatures.push(feature);\n } else {\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n }\n if (this.featuresRtree_) {\n this.featuresRtree_.load(extents, geometryFeatures);\n }\n\n for (let i = 0, length = newFeatures.length; i < length; i++) {\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.ADDFEATURE, newFeatures[i])\n );\n }\n }\n\n /**\n * @param {!Collection<import(\"../Feature.js\").default<Geometry>>} collection Collection.\n * @private\n */\n bindFeaturesCollection_(collection) {\n let modifyingCollection = false;\n this.addEventListener(\n VectorEventType.ADDFEATURE,\n /**\n * @param {VectorSourceEvent<Geometry>} evt The vector source event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n collection.push(evt.feature);\n modifyingCollection = false;\n }\n }\n );\n this.addEventListener(\n VectorEventType.REMOVEFEATURE,\n /**\n * @param {VectorSourceEvent<Geometry>} evt The vector source event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n collection.remove(evt.feature);\n modifyingCollection = false;\n }\n }\n );\n collection.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} evt The collection event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n this.addFeature(\n /** @type {import(\"../Feature.js\").default<Geometry>} */ (evt.element)\n );\n modifyingCollection = false;\n }\n }.bind(this)\n );\n collection.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} evt The collection event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n this.removeFeature(\n /** @type {import(\"../Feature.js\").default<Geometry>} */ (evt.element)\n );\n modifyingCollection = false;\n }\n }.bind(this)\n );\n this.featuresCollection_ = collection;\n }\n\n /**\n * Remove all features from the source.\n * @param {boolean=} opt_fast Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#removefeature} events.\n * @api\n */\n clear(opt_fast) {\n if (opt_fast) {\n for (const featureId in this.featureChangeKeys_) {\n const keys = this.featureChangeKeys_[featureId];\n keys.forEach(unlistenByKey);\n }\n if (!this.featuresCollection_) {\n this.featureChangeKeys_ = {};\n this.idIndex_ = {};\n this.uidIndex_ = {};\n }\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.forEach(this.removeFeatureInternal.bind(this));\n for (const id in this.nullGeometryFeatures_) {\n this.removeFeatureInternal(this.nullGeometryFeatures_[id]);\n }\n }\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.clear();\n }\n\n if (this.featuresRtree_) {\n this.featuresRtree_.clear();\n }\n this.nullGeometryFeatures_ = {};\n\n const clearEvent = new VectorSourceEvent(VectorEventType.CLEAR);\n this.dispatchEvent(clearEvent);\n this.changed();\n }\n\n /**\n * Iterate through all features on the source, calling the provided callback\n * with each one. If the callback returns any \"truthy\" value, iteration will\n * stop and the function will return the same value.\n * Note: this function only iterate through the feature that have a defined geometry.\n *\n * @param {function(import(\"../Feature.js\").default<Geometry>): T} callback Called with each feature\n * on the source. Return a truthy value to stop iteration.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeature(callback) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.forEach(callback);\n } else if (this.featuresCollection_) {\n this.featuresCollection_.forEach(callback);\n }\n }\n\n /**\n * Iterate through all features whose geometries contain the provided\n * coordinate, calling the callback with each feature. If the callback returns\n * a \"truthy\" value, iteration will stop and the function will return the same\n * value.\n *\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(import(\"../Feature.js\").default<Geometry>): T} callback Called with each feature\n * whose goemetry contains the provided coordinate.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n */\n forEachFeatureAtCoordinateDirect(coordinate, callback) {\n const extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];\n return this.forEachFeatureInExtent(extent, function (feature) {\n const geometry = feature.getGeometry();\n if (geometry.intersectsCoordinate(coordinate)) {\n return callback(feature);\n } else {\n return undefined;\n }\n });\n }\n\n /**\n * Iterate through all features whose bounding box intersects the provided\n * extent (note that the feature's geometry may not intersect the extent),\n * calling the callback with each feature. If the callback returns a \"truthy\"\n * value, iteration will stop and the function will return the same value.\n *\n * If you are interested in features whose geometry intersects an extent, call\n * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.\n *\n * When `useSpatialIndex` is set to false, this method will loop through all\n * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(import(\"../Feature.js\").default<Geometry>): T} callback Called with each feature\n * whose bounding box intersects the provided extent.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeatureInExtent(extent, callback) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.forEachInExtent(extent, callback);\n } else if (this.featuresCollection_) {\n this.featuresCollection_.forEach(callback);\n }\n }\n\n /**\n * Iterate through all features whose geometry intersects the provided extent,\n * calling the callback with each feature. If the callback returns a \"truthy\"\n * value, iteration will stop and the function will return the same value.\n *\n * If you only want to test for bounding box intersection, call the\n * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(import(\"../Feature.js\").default<Geometry>): T} callback Called with each feature\n * whose geometry intersects the provided extent.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeatureIntersectingExtent(extent, callback) {\n return this.forEachFeatureInExtent(\n extent,\n /**\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature.\n * @return {T|undefined} The return value from the last call to the callback.\n */\n function (feature) {\n const geometry = feature.getGeometry();\n if (geometry.intersectsExtent(extent)) {\n const result = callback(feature);\n if (result) {\n return result;\n }\n }\n }\n );\n }\n\n /**\n * Get the features collection associated with this source. Will be `null`\n * unless the source was configured with `useSpatialIndex` set to `false`, or\n * with an {@link module:ol/Collection} as `features`.\n * @return {Collection<import(\"../Feature.js\").default<Geometry>>} The collection of features.\n * @api\n */\n getFeaturesCollection() {\n return this.featuresCollection_;\n }\n\n /**\n * Get all features on the source in random order.\n * @return {Array<import(\"../Feature.js\").default<Geometry>>} Features.\n * @api\n */\n getFeatures() {\n let features;\n if (this.featuresCollection_) {\n features = this.featuresCollection_.getArray();\n } else if (this.featuresRtree_) {\n features = this.featuresRtree_.getAll();\n if (!isEmpty(this.nullGeometryFeatures_)) {\n extend(features, getValues(this.nullGeometryFeatures_));\n }\n }\n return /** @type {Array<import(\"../Feature.js\").default<Geometry>>} */ (features);\n }\n\n /**\n * Get all features whose geometry intersects the provided coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {Array<import(\"../Feature.js\").default<Geometry>>} Features.\n * @api\n */\n getFeaturesAtCoordinate(coordinate) {\n const features = [];\n this.forEachFeatureAtCoordinateDirect(coordinate, function (feature) {\n features.push(feature);\n });\n return features;\n }\n\n /**\n * Get all features whose bounding box intersects the provided extent. Note that this returns an array of\n * all features intersecting the given extent in random order (so it may include\n * features whose geometries do not intersect the extent).\n *\n * When `useSpatialIndex` is set to false, this method will return all\n * features.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {Array<import(\"../Feature.js\").default<Geometry>>} Features.\n * @api\n */\n getFeaturesInExtent(extent) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.getInExtent(extent);\n } else if (this.featuresCollection_) {\n return this.featuresCollection_.getArray();\n } else {\n return [];\n }\n }\n\n /**\n * Get the closest feature to the provided coordinate.\n *\n * This method is not available when the source is configured with\n * `useSpatialIndex` set to `false`.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(import(\"../Feature.js\").default<Geometry>):boolean=} opt_filter Feature filter function.\n * The filter function will receive one argument, the {@link module:ol/Feature feature}\n * and it should return a boolean value. By default, no filtering is made.\n * @return {import(\"../Feature.js\").default<Geometry>} Closest feature.\n * @api\n */\n getClosestFeatureToCoordinate(coordinate, opt_filter) {\n // Find the closest feature using branch and bound. We start searching an\n // infinite extent, and find the distance from the first feature found. This\n // becomes the closest feature. We then compute a smaller extent which any\n // closer feature must intersect. We continue searching with this smaller\n // extent, trying to find a closer feature. Every time we find a closer\n // feature, we update the extent being searched so that any even closer\n // feature must intersect it. We continue until we run out of features.\n const x = coordinate[0];\n const y = coordinate[1];\n let closestFeature = null;\n const closestPoint = [NaN, NaN];\n let minSquaredDistance = Infinity;\n const extent = [-Infinity, -Infinity, Infinity, Infinity];\n const filter = opt_filter ? opt_filter : TRUE;\n this.featuresRtree_.forEachInExtent(\n extent,\n /**\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature.\n */\n function (feature) {\n if (filter(feature)) {\n const geometry = feature.getGeometry();\n const previousMinSquaredDistance = minSquaredDistance;\n minSquaredDistance = geometry.closestPointXY(\n x,\n y,\n closestPoint,\n minSquaredDistance\n );\n if (minSquaredDistance < previousMinSquaredDistance) {\n closestFeature = feature;\n // This is sneaky. Reduce the extent that it is currently being\n // searched while the R-Tree traversal using this same extent object\n // is still in progress. This is safe because the new extent is\n // strictly contained by the old extent.\n const minDistance = Math.sqrt(minSquaredDistance);\n extent[0] = x - minDistance;\n extent[1] = y - minDistance;\n extent[2] = x + minDistance;\n extent[3] = y + minDistance;\n }\n }\n }\n );\n return closestFeature;\n }\n\n /**\n * Get the extent of the features currently in the source.\n *\n * This method is not available when the source is configured with\n * `useSpatialIndex` set to `false`.\n * @param {import(\"../extent.js\").Extent=} opt_extent Destination extent. If provided, no new extent\n * will be created. Instead, that extent's coordinates will be overwritten.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent(opt_extent) {\n return this.featuresRtree_.getExtent(opt_extent);\n }\n\n /**\n * Get a feature by its identifier (the value returned by feature.getId()).\n * Note that the index treats string and numeric identifiers as the same. So\n * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.\n *\n * @param {string|number} id Feature identifier.\n * @return {import(\"../Feature.js\").default<Geometry>} The feature (or `null` if not found).\n * @api\n */\n getFeatureById(id) {\n const feature = this.idIndex_[id.toString()];\n return feature !== undefined ? feature : null;\n }\n\n /**\n * Get a feature by its internal unique identifier (using `getUid`).\n *\n * @param {string} uid Feature identifier.\n * @return {import(\"../Feature.js\").default<Geometry>} The feature (or `null` if not found).\n */\n getFeatureByUid(uid) {\n const feature = this.uidIndex_[uid];\n return feature !== undefined ? feature : null;\n }\n\n /**\n * Get the format associated with this source.\n *\n * @return {import(\"../format/Feature.js\").default|undefined} The feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * @return {boolean} The source can have overlapping geometries.\n */\n getOverlaps() {\n return this.overlaps_;\n }\n\n /**\n * Get the url associated with this source.\n *\n * @return {string|import(\"../featureloader.js\").FeatureUrlFunction|undefined} The url.\n * @api\n */\n getUrl() {\n return this.url_;\n }\n\n /**\n * @param {Event} event Event.\n * @private\n */\n handleFeatureChange_(event) {\n const feature = /** @type {import(\"../Feature.js\").default<Geometry>} */ (event.target);\n const featureKey = getUid(feature);\n const geometry = feature.getGeometry();\n if (!geometry) {\n if (!(featureKey in this.nullGeometryFeatures_)) {\n if (this.featuresRtree_) {\n this.featuresRtree_.remove(feature);\n }\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n } else {\n const extent = geometry.getExtent();\n if (featureKey in this.nullGeometryFeatures_) {\n delete this.nullGeometryFeatures_[featureKey];\n if (this.featuresRtree_) {\n this.featuresRtree_.insert(extent, feature);\n }\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.update(extent, feature);\n }\n }\n }\n const id = feature.getId();\n if (id !== undefined) {\n const sid = id.toString();\n if (this.idIndex_[sid] !== feature) {\n this.removeFromIdIndex_(feature);\n this.idIndex_[sid] = feature;\n }\n } else {\n this.removeFromIdIndex_(feature);\n this.uidIndex_[featureKey] = feature;\n }\n this.changed();\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.CHANGEFEATURE, feature)\n );\n }\n\n /**\n * Returns true if the feature is contained within the source.\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature.\n * @return {boolean} Has feature.\n * @api\n */\n hasFeature(feature) {\n const id = feature.getId();\n if (id !== undefined) {\n return id in this.idIndex_;\n } else {\n return getUid(feature) in this.uidIndex_;\n }\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n */\n loadFeatures(extent, resolution, projection) {\n const loadedExtentsRtree = this.loadedExtentsRtree_;\n const extentsToLoad = this.strategy_(extent, resolution);\n this.loading = false;\n for (let i = 0, ii = extentsToLoad.length; i < ii; ++i) {\n const extentToLoad = extentsToLoad[i];\n const alreadyLoaded = loadedExtentsRtree.forEachInExtent(\n extentToLoad,\n /**\n * @param {{extent: import(\"../extent.js\").Extent}} object Object.\n * @return {boolean} Contains.\n */\n function (object) {\n return containsExtent(object.extent, extentToLoad);\n }\n );\n if (!alreadyLoaded) {\n this.loader_.call(this, extentToLoad, resolution, projection);\n loadedExtentsRtree.insert(extentToLoad, {extent: extentToLoad.slice()});\n this.loading = this.loader_ !== VOID;\n }\n }\n }\n\n refresh() {\n this.clear(true);\n this.loadedExtentsRtree_.clear();\n super.refresh();\n }\n\n /**\n * Remove an extent from the list of loaded extents.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n removeLoadedExtent(extent) {\n const loadedExtentsRtree = this.loadedExtentsRtree_;\n let obj;\n loadedExtentsRtree.forEachInExtent(extent, function (object) {\n if (equals(object.extent, extent)) {\n obj = object;\n return true;\n }\n });\n if (obj) {\n loadedExtentsRtree.remove(obj);\n }\n }\n\n /**\n * Remove a single feature from the source. If you want to remove all features\n * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method\n * instead.\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature to remove.\n * @api\n */\n removeFeature(feature) {\n const featureKey = getUid(feature);\n if (featureKey in this.nullGeometryFeatures_) {\n delete this.nullGeometryFeatures_[featureKey];\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.remove(feature);\n }\n }\n this.removeFeatureInternal(feature);\n this.changed();\n }\n\n /**\n * Remove feature without firing a `change` event.\n * @param {import(\"../Feature.js\").default<Geometry>} feature Feature.\n * @protected\n */\n removeFeatureInternal(feature) {\n const featureKey = getUid(feature);\n this.featureChangeKeys_[featureKey].forEach(unlistenByKey);\n delete this.featureChangeKeys_[featureKey];\n const id = feature.getId();\n if (id !== undefined) {\n delete this.idIndex_[id.toString()];\n }\n delete this.uidIndex_[featureKey];\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.REMOVEFEATURE, feature)\n );\n }\n\n /**\n * Remove a feature from the id index. Called internally when the feature id\n * may have changed.\n * @param {import(\"../Feature.js\").default<Geometry>} feature The feature.\n * @return {boolean} Removed the feature from the index.\n * @private\n */\n removeFromIdIndex_(feature) {\n let removed = false;\n for (const id in this.idIndex_) {\n if (this.idIndex_[id] === feature) {\n delete this.idIndex_[id];\n removed = true;\n break;\n }\n }\n return removed;\n }\n\n /**\n * Set the new loader of the source. The next render cycle will use the\n * new loader.\n * @param {import(\"../featureloader.js\").FeatureLoader} loader The loader to set.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n\n /**\n * Points the source to a new url. The next render cycle will use the new url.\n * @param {string|import(\"../featureloader.js\").FeatureUrlFunction} url Url.\n * @api\n */\n setUrl(url) {\n assert(this.format_, 7); // `format` must be set when `url` is set\n this.setLoader(xhr(url, this.format_));\n }\n}\n\nexport default VectorSource;\n","/**\n * @module ol/render\n */\nimport CanvasImmediateRenderer from './render/canvas/Immediate.js';\nimport {DEVICE_PIXEL_RATIO} from './has.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n multiply as multiplyTransform,\n scale as scaleTransform,\n} from './transform.js';\nimport {getSquaredTolerance} from './renderer/vector.js';\nimport {getTransformFromProjections, getUserProjection} from './proj.js';\n\n/**\n * @typedef {Object} State\n * @property {CanvasRenderingContext2D} context Canvas context that the layer is being rendered to.\n * @property {import(\"./Feature.js\").FeatureLike} feature\n * @property {import(\"./geom/SimpleGeometry.js\").default} geometry\n * @property {number} pixelRatio Pixel ratio used by the layer renderer.\n * @property {number} resolution Resolution that the render batch was created and optimized for.\n * This is not the view's resolution that is being rendered.\n * @property {number} rotation Rotation of the rendered layer in radians.\n */\n\n/**\n * A function to be used when sorting features before rendering.\n * It takes two instances of {@link module:ol/Feature} or\n * {@link module:ol/render/Feature} and returns a `{number}`.\n *\n * @typedef {function(import(\"./Feature.js\").FeatureLike, import(\"./Feature.js\").FeatureLike):number} OrderFunction\n */\n\n/**\n * @typedef {Object} ToContextOptions\n * @property {import(\"./size.js\").Size} [size] Desired size of the canvas in css\n * pixels. When provided, both canvas and css size will be set according to the\n * `pixelRatio`. If not provided, the current canvas and css sizes will not be\n * altered.\n * @property {number} [pixelRatio=window.devicePixelRatio] Pixel ratio (canvas\n * pixel to css pixel ratio) for the canvas.\n */\n\n/**\n * Binds a Canvas Immediate API to a canvas context, to allow drawing geometries\n * to the context's canvas.\n *\n * The units for geometry coordinates are css pixels relative to the top left\n * corner of the canvas element.\n * ```js\n * import {toContext} from 'ol/render';\n * import Fill from 'ol/style/Fill';\n * import Polygon from 'ol/geom/Polygon';\n *\n * var canvas = document.createElement('canvas');\n * var render = toContext(canvas.getContext('2d'),\n * { size: [100, 100] });\n * render.setFillStrokeStyle(new Fill({ color: blue }));\n * render.drawPolygon(\n * new Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]]));\n * ```\n *\n * @param {CanvasRenderingContext2D} context Canvas context.\n * @param {ToContextOptions=} opt_options Options.\n * @return {CanvasImmediateRenderer} Canvas Immediate.\n * @api\n */\nexport function toContext(context, opt_options) {\n const canvas = context.canvas;\n const options = opt_options ? opt_options : {};\n const pixelRatio = options.pixelRatio || DEVICE_PIXEL_RATIO;\n const size = options.size;\n if (size) {\n canvas.width = size[0] * pixelRatio;\n canvas.height = size[1] * pixelRatio;\n canvas.style.width = size[0] + 'px';\n canvas.style.height = size[1] + 'px';\n }\n const extent = [0, 0, canvas.width, canvas.height];\n const transform = scaleTransform(createTransform(), pixelRatio, pixelRatio);\n return new CanvasImmediateRenderer(context, pixelRatio, extent, transform, 0);\n}\n\n/**\n * Gets a vector context for drawing to the event's canvas.\n * @param {import(\"./render/Event.js\").default} event Render event.\n * @returns {CanvasImmediateRenderer} Vector context.\n * @api\n */\nexport function getVectorContext(event) {\n const frameState = event.frameState;\n const transform = multiplyTransform(\n event.inversePixelTransform.slice(),\n frameState.coordinateToPixelTransform\n );\n const squaredTolerance = getSquaredTolerance(\n frameState.viewState.resolution,\n frameState.pixelRatio\n );\n let userTransform;\n const userProjection = getUserProjection();\n if (userProjection) {\n userTransform = getTransformFromProjections(\n userProjection,\n frameState.viewState.projection\n );\n }\n return new CanvasImmediateRenderer(\n event.context,\n frameState.pixelRatio,\n frameState.extent,\n transform,\n frameState.viewState.rotation,\n squaredTolerance,\n userTransform\n );\n}\n\n/**\n * Gets the pixel of the event's canvas context from the map viewport's CSS pixel.\n * @param {import(\"./render/Event.js\").default} event Render event.\n * @param {import(\"./pixel.js\").Pixel} pixel CSS pixel relative to the top-left\n * corner of the map viewport.\n * @returns {import(\"./pixel.js\").Pixel} Pixel on the event's canvas context.\n * @api\n */\nexport function getRenderPixel(event, pixel) {\n const result = pixel.slice(0);\n applyTransform(event.inversePixelTransform.slice(), result);\n return result;\n}\n\n/**\n * @param {import(\"./PluggableMap.js\").FrameState} frameState Frame state.\n * @param {?} declutterTree Declutter tree.\n * @returns {?} Declutter tree.\n */\nexport function renderDeclutterItems(frameState, declutterTree) {\n if (declutterTree) {\n declutterTree.clear();\n }\n const items = frameState.declutterItems;\n for (let z = items.length - 1; z >= 0; --z) {\n const item = items[z];\n const zIndexItems = item.items;\n for (let i = 0, ii = zIndexItems.length; i < ii; i += 3) {\n declutterTree = zIndexItems[i].renderDeclutter(\n zIndexItems[i + 1],\n zIndexItems[i + 2],\n item.opacity,\n declutterTree\n );\n }\n }\n items.length = 0;\n return declutterTree;\n}\n","/**\n * @module ol/geom/flat/geodesic\n */\nimport {get as getProjection, getTransform} from '../../proj.js';\nimport {squaredSegmentDistance, toDegrees, toRadians} from '../../math.js';\n\n/**\n * @param {function(number): import(\"../../coordinate.js\").Coordinate} interpolate Interpolate function.\n * @param {import(\"../../proj.js\").TransformFunction} transform Transform from longitude/latitude to\n * projected coordinates.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nfunction line(interpolate, transform, squaredTolerance) {\n // FIXME reduce garbage generation\n // FIXME optimize stack operations\n\n /** @type {Array<number>} */\n const flatCoordinates = [];\n\n let geoA = interpolate(0);\n let geoB = interpolate(1);\n\n let a = transform(geoA);\n let b = transform(geoB);\n\n /** @type {Array<import(\"../../coordinate.js\").Coordinate>} */\n const geoStack = [geoB, geoA];\n /** @type {Array<import(\"../../coordinate.js\").Coordinate>} */\n const stack = [b, a];\n /** @type {Array<number>} */\n const fractionStack = [1, 0];\n\n /** @type {!Object<string, boolean>} */\n const fractions = {};\n\n let maxIterations = 1e5;\n let geoM, m, fracA, fracB, fracM, key;\n\n while (--maxIterations > 0 && fractionStack.length > 0) {\n // Pop the a coordinate off the stack\n fracA = fractionStack.pop();\n geoA = geoStack.pop();\n a = stack.pop();\n // Add the a coordinate if it has not been added yet\n key = fracA.toString();\n if (!(key in fractions)) {\n flatCoordinates.push(a[0], a[1]);\n fractions[key] = true;\n }\n // Pop the b coordinate off the stack\n fracB = fractionStack.pop();\n geoB = geoStack.pop();\n b = stack.pop();\n // Find the m point between the a and b coordinates\n fracM = (fracA + fracB) / 2;\n geoM = interpolate(fracM);\n m = transform(geoM);\n if (\n squaredSegmentDistance(m[0], m[1], a[0], a[1], b[0], b[1]) <\n squaredTolerance\n ) {\n // If the m point is sufficiently close to the straight line, then we\n // discard it. Just use the b coordinate and move on to the next line\n // segment.\n flatCoordinates.push(b[0], b[1]);\n key = fracB.toString();\n fractions[key] = true;\n } else {\n // Otherwise, we need to subdivide the current line segment. Split it\n // into two and push the two line segments onto the stack.\n fractionStack.push(fracB, fracM, fracM, fracA);\n stack.push(b, m, m, a);\n geoStack.push(geoB, geoM, geoM, geoA);\n }\n }\n\n return flatCoordinates;\n}\n\n/**\n * Generate a great-circle arcs between two lat/lon points.\n * @param {number} lon1 Longitude 1 in degrees.\n * @param {number} lat1 Latitude 1 in degrees.\n * @param {number} lon2 Longitude 2 in degrees.\n * @param {number} lat2 Latitude 2 in degrees.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nexport function greatCircleArc(\n lon1,\n lat1,\n lon2,\n lat2,\n projection,\n squaredTolerance\n) {\n const geoProjection = getProjection('EPSG:4326');\n\n const cosLat1 = Math.cos(toRadians(lat1));\n const sinLat1 = Math.sin(toRadians(lat1));\n const cosLat2 = Math.cos(toRadians(lat2));\n const sinLat2 = Math.sin(toRadians(lat2));\n const cosDeltaLon = Math.cos(toRadians(lon2 - lon1));\n const sinDeltaLon = Math.sin(toRadians(lon2 - lon1));\n const d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon;\n\n return line(\n /**\n * @param {number} frac Fraction.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\n function (frac) {\n if (1 <= d) {\n return [lon2, lat2];\n }\n const D = frac * Math.acos(d);\n const cosD = Math.cos(D);\n const sinD = Math.sin(D);\n const y = sinDeltaLon * cosLat2;\n const x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon;\n const theta = Math.atan2(y, x);\n const lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));\n const lon =\n toRadians(lon1) +\n Math.atan2(\n Math.sin(theta) * sinD * cosLat1,\n cosD - sinLat1 * Math.sin(lat)\n );\n return [toDegrees(lon), toDegrees(lat)];\n },\n getTransform(geoProjection, projection),\n squaredTolerance\n );\n}\n\n/**\n * Generate a meridian (line at constant longitude).\n * @param {number} lon Longitude.\n * @param {number} lat1 Latitude 1.\n * @param {number} lat2 Latitude 2.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nexport function meridian(lon, lat1, lat2, projection, squaredTolerance) {\n const epsg4326Projection = getProjection('EPSG:4326');\n return line(\n /**\n * @param {number} frac Fraction.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\n function (frac) {\n return [lon, lat1 + (lat2 - lat1) * frac];\n },\n getTransform(epsg4326Projection, projection),\n squaredTolerance\n );\n}\n\n/**\n * Generate a parallel (line at constant latitude).\n * @param {number} lat Latitude.\n * @param {number} lon1 Longitude 1.\n * @param {number} lon2 Longitude 2.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nexport function parallel(lat, lon1, lon2, projection, squaredTolerance) {\n const epsg4326Projection = getProjection('EPSG:4326');\n return line(\n /**\n * @param {number} frac Fraction.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\n function (frac) {\n return [lon1 + (lon2 - lon1) * frac, lat];\n },\n getTransform(epsg4326Projection, projection),\n squaredTolerance\n );\n}\n","/**\n * @module ol/layer/Graticule\n */\nimport Collection from '../Collection.js';\nimport EventType from '../render/EventType.js';\nimport Feature from '../Feature.js';\nimport Fill from '../style/Fill.js';\nimport GeometryLayout from '../geom/GeometryLayout.js';\nimport LineString from '../geom/LineString.js';\nimport Point from '../geom/Point.js';\nimport Stroke from '../style/Stroke.js';\nimport Style from '../style/Style.js';\nimport Text from '../style/Text.js';\nimport VectorLayer from './Vector.js';\nimport VectorSource from '../source/Vector.js';\nimport {\n applyTransform,\n approximatelyEquals,\n containsCoordinate,\n containsExtent,\n equals,\n getCenter,\n getHeight,\n getIntersection,\n getWidth,\n intersects,\n isEmpty,\n wrapX as wrapExtentX,\n} from '../extent.js';\nimport {assign} from '../obj.js';\nimport {clamp} from '../math.js';\nimport {degreesToStringHDMS} from '../coordinate.js';\nimport {\n equivalent as equivalentProjection,\n get as getProjection,\n getTransform,\n} from '../proj.js';\nimport {getVectorContext} from '../render.js';\nimport {meridian, parallel} from '../geom/flat/geodesic.js';\n\n/**\n * @type {Stroke}\n * @private\n * @const\n */\nconst DEFAULT_STROKE_STYLE = new Stroke({\n color: 'rgba(0,0,0,0.2)',\n});\n\n/**\n * @type {Array<number>}\n * @private\n */\nconst INTERVALS = [\n 90,\n 45,\n 30,\n 20,\n 10,\n 5,\n 2,\n 1,\n 0.5,\n 0.2,\n 0.1,\n 0.05,\n 0.01,\n 0.005,\n 0.002,\n 0.001,\n];\n\n/**\n * @typedef {Object} GraticuleLabelDataType\n * @property {Point} geom\n * @property {string} text\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [maxLines=100] The maximum number of meridians and\n * parallels from the center of the map. The default value of 100 means that at\n * most 200 meridians and 200 parallels will be displayed. The default value is\n * appropriate for conformal projections like Spherical Mercator. If you\n * increase the value, more lines will be drawn and the drawing performance will\n * decrease.\n * @property {Stroke} [strokeStyle='rgba(0,0,0,0.2)'] The\n * stroke style to use for drawing the graticule. If not provided, a not fully\n * opaque black will be used.\n * @property {number} [targetSize=100] The target size of the graticule cells,\n * in pixels.\n * @property {boolean} [showLabels=false] Render a label with the respective\n * latitude/longitude for each graticule line.\n * @property {function(number):string} [lonLabelFormatter] Label formatter for\n * longitudes. This function is called with the longitude as argument, and\n * should return a formatted string representing the longitude. By default,\n * labels are formatted as degrees, minutes, seconds and hemisphere.\n * @property {function(number):string} [latLabelFormatter] Label formatter for\n * latitudes. This function is called with the latitude as argument, and\n * should return a formatted string representing the latitude. By default,\n * labels are formatted as degrees, minutes, seconds and hemisphere.\n * @property {number} [lonLabelPosition=0] Longitude label position in fractions\n * (0..1) of view extent. 0 means at the bottom of the viewport, 1 means at the\n * top.\n * @property {number} [latLabelPosition=1] Latitude label position in fractions\n * (0..1) of view extent. 0 means at the left of the viewport, 1 means at the\n * right.\n * @property {Text} [lonLabelStyle] Longitude label text\n * style. If not provided, the following style will be used:\n * ```js\n * new Text({\n * font: '12px Calibri,sans-serif',\n * textBaseline: 'bottom',\n * fill: new Fill({\n * color: 'rgba(0,0,0,1)'\n * }),\n * stroke: new Stroke({\n * color: 'rgba(255,255,255,1)',\n * width: 3\n * })\n * });\n * ```\n * Note that the default's `textBaseline` configuration will not work well for\n * `lonLabelPosition` configurations that position labels close to the top of\n * the viewport.\n * @property {Text} [latLabelStyle] Latitude label text style.\n * If not provided, the following style will be used:\n * ```js\n * new Text({\n * font: '12px Calibri,sans-serif',\n * textAlign: 'end',\n * fill: new Fill({\n * color: 'rgba(0,0,0,1)'\n * }),\n * stroke: Stroke({\n * color: 'rgba(255,255,255,1)',\n * width: 3\n * })\n * });\n * ```\n * Note that the default's `textAlign` configuration will not work well for\n * `latLabelPosition` configurations that position labels close to the left of\n * the viewport.\n * @property {Array<number>} [intervals=[90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001]]\n * Intervals (in degrees) for the graticule. Example to limit graticules to 30 and 10 degrees intervals:\n * ```js\n * [30, 10]\n * ```\n * @property {boolean} [wrapX=true] Whether to repeat the graticule horizontally.\n */\n\n/**\n * @classdesc\n * Layer that renders a grid for a coordinate system (currently only EPSG:4326 is supported).\n * Note that the view projection must define both extent and worldExtent.\n *\n * @fires import(\"../render/Event.js\").RenderEvent\n * @api\n */\nclass Graticule extends VectorLayer {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const baseOptions = assign(\n {\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n renderBuffer: 0,\n },\n options\n );\n\n delete baseOptions.maxLines;\n delete baseOptions.strokeStyle;\n delete baseOptions.targetSize;\n delete baseOptions.showLabels;\n delete baseOptions.lonLabelFormatter;\n delete baseOptions.latLabelFormatter;\n delete baseOptions.lonLabelPosition;\n delete baseOptions.latLabelPosition;\n delete baseOptions.lonLabelStyle;\n delete baseOptions.latLabelStyle;\n delete baseOptions.intervals;\n super(baseOptions);\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = null;\n\n /**\n * @type {number}\n * @private\n */\n this.maxLat_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.maxLon_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minLat_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minLon_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.maxX_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.maxY_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minX_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minY_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.targetSize_ =\n options.targetSize !== undefined ? options.targetSize : 100;\n\n /**\n * @type {number}\n * @private\n */\n this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;\n\n /**\n * @type {Array<LineString>}\n * @private\n */\n this.meridians_ = [];\n\n /**\n * @type {Array<LineString>}\n * @private\n */\n this.parallels_ = [];\n\n /**\n * @type {Stroke}\n * @private\n */\n this.strokeStyle_ =\n options.strokeStyle !== undefined\n ? options.strokeStyle\n : DEFAULT_STROKE_STYLE;\n\n /**\n * @type {import(\"../proj.js\").TransformFunction|undefined}\n * @private\n */\n this.fromLonLatTransform_ = undefined;\n\n /**\n * @type {import(\"../proj.js\").TransformFunction|undefined}\n * @private\n */\n this.toLonLatTransform_ = undefined;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.projectionCenterLonLat_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.bottomLeft_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.bottomRight_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.topLeft_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.topRight_ = null;\n\n /**\n * @type {Array<GraticuleLabelDataType>}\n * @private\n */\n this.meridiansLabels_ = null;\n\n /**\n * @type {Array<GraticuleLabelDataType>}\n * @private\n */\n this.parallelsLabels_ = null;\n\n if (options.showLabels) {\n /**\n * @type {null|function(number):string}\n * @private\n */\n this.lonLabelFormatter_ =\n options.lonLabelFormatter == undefined\n ? degreesToStringHDMS.bind(this, 'EW')\n : options.lonLabelFormatter;\n\n /**\n * @type {function(number):string}\n * @private\n */\n this.latLabelFormatter_ =\n options.latLabelFormatter == undefined\n ? degreesToStringHDMS.bind(this, 'NS')\n : options.latLabelFormatter;\n\n /**\n * Longitude label position in fractions (0..1) of view extent. 0 means\n * bottom, 1 means top.\n * @type {number}\n * @private\n */\n this.lonLabelPosition_ =\n options.lonLabelPosition == undefined ? 0 : options.lonLabelPosition;\n\n /**\n * Latitude Label position in fractions (0..1) of view extent. 0 means left, 1\n * means right.\n * @type {number}\n * @private\n */\n this.latLabelPosition_ =\n options.latLabelPosition == undefined ? 1 : options.latLabelPosition;\n\n /**\n * @type {Style}\n * @private\n */\n this.lonLabelStyleBase_ = new Style({\n text:\n options.lonLabelStyle !== undefined\n ? options.lonLabelStyle.clone()\n : new Text({\n font: '12px Calibri,sans-serif',\n textBaseline: 'bottom',\n fill: new Fill({\n color: 'rgba(0,0,0,1)',\n }),\n stroke: new Stroke({\n color: 'rgba(255,255,255,1)',\n width: 3,\n }),\n }),\n });\n\n /**\n * @private\n * @param {import(\"../Feature\").default} feature Feature\n * @return {Style} style\n */\n this.lonLabelStyle_ = function (feature) {\n const label = feature.get('graticule_label');\n this.lonLabelStyleBase_.getText().setText(label);\n return this.lonLabelStyleBase_;\n }.bind(this);\n\n /**\n * @type {Style}\n * @private\n */\n this.latLabelStyleBase_ = new Style({\n text:\n options.latLabelStyle !== undefined\n ? options.latLabelStyle.clone()\n : new Text({\n font: '12px Calibri,sans-serif',\n textAlign: 'right',\n fill: new Fill({\n color: 'rgba(0,0,0,1)',\n }),\n stroke: new Stroke({\n color: 'rgba(255,255,255,1)',\n width: 3,\n }),\n }),\n });\n\n /**\n * @private\n * @param {import(\"../Feature\").default} feature Feature\n * @return {Style} style\n */\n this.latLabelStyle_ = function (feature) {\n const label = feature.get('graticule_label');\n this.latLabelStyleBase_.getText().setText(label);\n return this.latLabelStyleBase_;\n }.bind(this);\n\n this.meridiansLabels_ = [];\n this.parallelsLabels_ = [];\n\n this.addEventListener(EventType.POSTRENDER, this.drawLabels_.bind(this));\n }\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.intervals_ =\n options.intervals !== undefined ? options.intervals : INTERVALS;\n\n // use a source with a custom loader for lines & text\n this.setSource(\n new VectorSource({\n loader: this.loaderFunction.bind(this),\n strategy: this.strategyFunction.bind(this),\n features: new Collection(),\n overlaps: false,\n useSpatialIndex: false,\n wrapX: options.wrapX,\n })\n );\n\n /**\n * feature pool to use when updating graticule\n * @type {Array<Feature>}\n * @private\n */\n this.featurePool_ = [];\n\n /**\n * @type {Style}\n * @private\n */\n this.lineStyle_ = new Style({\n stroke: this.strokeStyle_,\n });\n\n /**\n * @type {?import(\"../extent.js\").Extent}\n * @private\n */\n this.loadedExtent_ = null;\n\n /**\n * @type {?import(\"../extent.js\").Extent}\n */\n this.renderedExtent_ = null;\n\n this.setRenderOrder(null);\n }\n\n /**\n * Strategy function for loading features based on the view's extent and\n * resolution.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"../extent.js\").Extent>} Extents.\n */\n strategyFunction(extent, resolution) {\n // extents may be passed in different worlds, to avoid endless loop we use only one\n let realWorldExtent = extent.slice();\n if (this.projection_ && this.getSource().getWrapX()) {\n wrapExtentX(realWorldExtent, this.projection_);\n }\n if (this.loadedExtent_) {\n if (\n approximatelyEquals(this.loadedExtent_, realWorldExtent, resolution)\n ) {\n // make sure result is exactly equal to previous extent\n realWorldExtent = this.loadedExtent_.slice();\n } else {\n // we should not keep track of loaded extents\n this.getSource().removeLoadedExtent(this.loadedExtent_);\n }\n }\n return [realWorldExtent];\n }\n\n /**\n * Update geometries in the source based on current view\n * @param {import(\"../extent\").Extent} extent Extent\n * @param {number} resolution Resolution\n * @param {import(\"../proj/Projection.js\").default} projection Projection\n */\n loaderFunction(extent, resolution, projection) {\n this.loadedExtent_ = extent;\n const source = this.getSource();\n\n // only consider the intersection between our own extent & the requested one\n const layerExtent = this.getExtent() || [\n -Infinity,\n -Infinity,\n Infinity,\n Infinity,\n ];\n const renderExtent = getIntersection(layerExtent, extent);\n\n if (this.renderedExtent_ && equals(this.renderedExtent_, renderExtent)) {\n return;\n }\n this.renderedExtent_ = renderExtent;\n\n // bail out if nothing to render\n if (isEmpty(renderExtent)) {\n return;\n }\n\n // update projection info\n const center = getCenter(renderExtent);\n const squaredTolerance = (resolution * resolution) / 4;\n\n const updateProjectionInfo =\n !this.projection_ || !equivalentProjection(this.projection_, projection);\n\n if (updateProjectionInfo) {\n this.updateProjectionInfo_(projection);\n }\n\n this.createGraticule_(renderExtent, center, resolution, squaredTolerance);\n\n // first make sure we have enough features in the pool\n let featureCount = this.meridians_.length + this.parallels_.length;\n if (this.meridiansLabels_) {\n featureCount += this.meridians_.length;\n }\n if (this.parallelsLabels_) {\n featureCount += this.parallels_.length;\n }\n\n let feature;\n while (featureCount > this.featurePool_.length) {\n feature = new Feature();\n this.featurePool_.push(feature);\n }\n\n const featuresColl = source.getFeaturesCollection();\n featuresColl.clear();\n let poolIndex = 0;\n\n // add features for the lines & labels\n let i, l;\n for (i = 0, l = this.meridians_.length; i < l; ++i) {\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(this.meridians_[i]);\n feature.setStyle(this.lineStyle_);\n featuresColl.push(feature);\n }\n for (i = 0, l = this.parallels_.length; i < l; ++i) {\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(this.parallels_[i]);\n feature.setStyle(this.lineStyle_);\n featuresColl.push(feature);\n }\n }\n\n /**\n * @param {number} lon Longitude.\n * @param {number} minLat Minimal latitude.\n * @param {number} maxLat Maximal latitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {number} Index.\n * @private\n */\n addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, index) {\n const lineString = this.getMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n index\n );\n if (intersects(lineString.getExtent(), extent)) {\n if (this.meridiansLabels_) {\n const text = this.lonLabelFormatter_(lon);\n if (index in this.meridiansLabels_) {\n this.meridiansLabels_[index].text = text;\n } else {\n this.meridiansLabels_[index] = {\n geom: new Point([]),\n text: text,\n };\n }\n }\n this.meridians_[index++] = lineString;\n }\n return index;\n }\n\n /**\n * @param {number} lat Latitude.\n * @param {number} minLon Minimal longitude.\n * @param {number} maxLon Maximal longitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {number} Index.\n * @private\n */\n addParallel_(lat, minLon, maxLon, squaredTolerance, extent, index) {\n const lineString = this.getParallel_(\n lat,\n minLon,\n maxLon,\n squaredTolerance,\n index\n );\n if (intersects(lineString.getExtent(), extent)) {\n if (this.parallelsLabels_) {\n const text = this.latLabelFormatter_(lat);\n if (index in this.parallelsLabels_) {\n this.parallelsLabels_[index].text = text;\n } else {\n this.parallelsLabels_[index] = {\n geom: new Point([]),\n text: text,\n };\n }\n }\n this.parallels_[index++] = lineString;\n }\n return index;\n }\n\n /**\n * @param {import(\"../render/Event.js\").default} event Render event.\n * @private\n */\n drawLabels_(event) {\n const rotation = event.frameState.viewState.rotation;\n const extent = event.frameState.extent;\n const rotationCenter = getCenter(extent);\n let rotationExtent = extent;\n if (rotation) {\n const width = getWidth(extent);\n const height = getHeight(extent);\n const cr = Math.abs(Math.cos(rotation));\n const sr = Math.abs(Math.sin(rotation));\n const unrotatedWidth = (sr * height - cr * width) / (sr * sr - cr * cr);\n const unrotatedHeight = (sr * width - cr * height) / (sr * sr - cr * cr);\n rotationExtent = [\n rotationCenter[0] - unrotatedWidth / 2,\n rotationCenter[1] - unrotatedHeight / 2,\n rotationCenter[0] + unrotatedWidth / 2,\n rotationCenter[1] + unrotatedHeight / 2,\n ];\n }\n\n let startWorld = 0;\n let endWorld = 0;\n let labelsAtStart = this.latLabelPosition_ < 0.5;\n const projectionExtent = this.projection_.getExtent();\n const worldWidth = getWidth(projectionExtent);\n if (\n this.getSource().getWrapX() &&\n this.projection_.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n startWorld = Math.floor((extent[0] - projectionExtent[0]) / worldWidth);\n endWorld = Math.ceil((extent[2] - projectionExtent[2]) / worldWidth);\n const inverted = Math.abs(rotation) > Math.PI / 2;\n labelsAtStart = labelsAtStart !== inverted;\n }\n const vectorContext = getVectorContext(event);\n\n for (let world = startWorld; world <= endWorld; ++world) {\n let poolIndex = this.meridians_.length + this.parallels_.length;\n let feature, index, l, textPoint;\n\n if (this.meridiansLabels_) {\n for (index = 0, l = this.meridiansLabels_.length; index < l; ++index) {\n const lineString = this.meridians_[index];\n if (!rotation && world === 0) {\n textPoint = this.getMeridianPoint_(lineString, extent, index);\n } else {\n const clone = lineString.clone();\n clone.translate(world * worldWidth, 0);\n clone.rotate(-rotation, rotationCenter);\n textPoint = this.getMeridianPoint_(clone, rotationExtent, index);\n textPoint.rotate(rotation, rotationCenter);\n }\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(textPoint);\n feature.set('graticule_label', this.meridiansLabels_[index].text);\n vectorContext.drawFeature(feature, this.lonLabelStyle_(feature));\n }\n }\n if (this.parallelsLabels_) {\n if (\n (world === startWorld && labelsAtStart) ||\n (world === endWorld && !labelsAtStart)\n ) {\n for (index = 0, l = this.parallels_.length; index < l; ++index) {\n const lineString = this.parallels_[index];\n if (!rotation && world === 0) {\n textPoint = this.getParallelPoint_(lineString, extent, index);\n } else {\n const clone = lineString.clone();\n clone.translate(world * worldWidth, 0);\n clone.rotate(-rotation, rotationCenter);\n textPoint = this.getParallelPoint_(clone, rotationExtent, index);\n textPoint.rotate(rotation, rotationCenter);\n }\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(textPoint);\n feature.set('graticule_label', this.parallelsLabels_[index].text);\n vectorContext.drawFeature(feature, this.latLabelStyle_(feature));\n }\n }\n }\n }\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} squaredTolerance Squared tolerance.\n * @private\n */\n createGraticule_(extent, center, resolution, squaredTolerance) {\n const interval = this.getInterval_(resolution);\n if (interval == -1) {\n this.meridians_.length = 0;\n this.parallels_.length = 0;\n if (this.meridiansLabels_) {\n this.meridiansLabels_.length = 0;\n }\n if (this.parallelsLabels_) {\n this.parallelsLabels_.length = 0;\n }\n return;\n }\n\n let wrapX = false;\n const projectionExtent = this.projection_.getExtent();\n const worldWidth = getWidth(projectionExtent);\n if (\n this.getSource().getWrapX() &&\n this.projection_.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n if (getWidth(extent) >= worldWidth) {\n extent[0] = projectionExtent[0];\n extent[2] = projectionExtent[2];\n } else {\n wrapX = true;\n }\n }\n\n // Constrain the center to fit into the extent available to the graticule\n\n const validCenterP = [\n clamp(center[0], this.minX_, this.maxX_),\n clamp(center[1], this.minY_, this.maxY_),\n ];\n\n // Transform the center to lon lat\n // Some projections may have a void area at the poles\n // so replace any NaN latitudes with the min or max value closest to a pole\n\n const centerLonLat = this.toLonLatTransform_(validCenterP);\n if (isNaN(centerLonLat[1])) {\n centerLonLat[1] =\n Math.abs(this.maxLat_) >= Math.abs(this.minLat_)\n ? this.maxLat_\n : this.minLat_;\n }\n let centerLon = clamp(centerLonLat[0], this.minLon_, this.maxLon_);\n let centerLat = clamp(centerLonLat[1], this.minLat_, this.maxLat_);\n const maxLines = this.maxLines_;\n let cnt, idx, lat, lon;\n\n // Limit the extent to fit into the extent available to the graticule\n\n let validExtentP = extent;\n if (!wrapX) {\n validExtentP = [\n clamp(extent[0], this.minX_, this.maxX_),\n clamp(extent[1], this.minY_, this.maxY_),\n clamp(extent[2], this.minX_, this.maxX_),\n clamp(extent[3], this.minY_, this.maxY_),\n ];\n }\n\n // Transform the extent to get the lon lat ranges for the edges of the extent\n\n const validExtent = applyTransform(\n validExtentP,\n this.toLonLatTransform_,\n undefined,\n 8\n );\n\n let maxLat = validExtent[3];\n let maxLon = validExtent[2];\n let minLat = validExtent[1];\n let minLon = validExtent[0];\n\n if (!wrapX) {\n // Check if extremities of the world extent lie inside the extent\n // (for example the pole in a polar projection)\n // and extend the extent as appropriate\n\n if (containsCoordinate(validExtentP, this.bottomLeft_)) {\n minLon = this.minLon_;\n minLat = this.minLat_;\n }\n if (containsCoordinate(validExtentP, this.bottomRight_)) {\n maxLon = this.maxLon_;\n minLat = this.minLat_;\n }\n if (containsCoordinate(validExtentP, this.topLeft_)) {\n minLon = this.minLon_;\n maxLat = this.maxLat_;\n }\n if (containsCoordinate(validExtentP, this.topRight_)) {\n maxLon = this.maxLon_;\n maxLat = this.maxLat_;\n }\n\n // The transformed center may also extend the lon lat ranges used for rendering\n\n maxLat = clamp(maxLat, centerLat, this.maxLat_);\n maxLon = clamp(maxLon, centerLon, this.maxLon_);\n minLat = clamp(minLat, this.minLat_, centerLat);\n minLon = clamp(minLon, this.minLon_, centerLon);\n }\n\n // Create meridians\n\n centerLon = Math.floor(centerLon / interval) * interval;\n lon = clamp(centerLon, this.minLon_, this.maxLon_);\n\n idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, 0);\n\n cnt = 0;\n if (wrapX) {\n while ((lon -= interval) >= minLon && cnt++ < maxLines) {\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx\n );\n }\n } else {\n while (lon != this.minLon_ && cnt++ < maxLines) {\n lon = Math.max(lon - interval, this.minLon_);\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx\n );\n }\n }\n\n lon = clamp(centerLon, this.minLon_, this.maxLon_);\n\n cnt = 0;\n if (wrapX) {\n while ((lon += interval) <= maxLon && cnt++ < maxLines) {\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx\n );\n }\n } else {\n while (lon != this.maxLon_ && cnt++ < maxLines) {\n lon = Math.min(lon + interval, this.maxLon_);\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx\n );\n }\n }\n\n this.meridians_.length = idx;\n if (this.meridiansLabels_) {\n this.meridiansLabels_.length = idx;\n }\n\n // Create parallels\n\n centerLat = Math.floor(centerLat / interval) * interval;\n lat = clamp(centerLat, this.minLat_, this.maxLat_);\n\n idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, 0);\n\n cnt = 0;\n while (lat != this.minLat_ && cnt++ < maxLines) {\n lat = Math.max(lat - interval, this.minLat_);\n idx = this.addParallel_(\n lat,\n minLon,\n maxLon,\n squaredTolerance,\n extent,\n idx\n );\n }\n\n lat = clamp(centerLat, this.minLat_, this.maxLat_);\n\n cnt = 0;\n while (lat != this.maxLat_ && cnt++ < maxLines) {\n lat = Math.min(lat + interval, this.maxLat_);\n idx = this.addParallel_(\n lat,\n minLon,\n maxLon,\n squaredTolerance,\n extent,\n idx\n );\n }\n\n this.parallels_.length = idx;\n if (this.parallelsLabels_) {\n this.parallelsLabels_.length = idx;\n }\n }\n\n /**\n * @param {number} resolution Resolution.\n * @return {number} The interval in degrees.\n * @private\n */\n getInterval_(resolution) {\n const centerLon = this.projectionCenterLonLat_[0];\n const centerLat = this.projectionCenterLonLat_[1];\n let interval = -1;\n const target = Math.pow(this.targetSize_ * resolution, 2);\n /** @type {Array<number>} **/\n const p1 = [];\n /** @type {Array<number>} **/\n const p2 = [];\n for (let i = 0, ii = this.intervals_.length; i < ii; ++i) {\n const delta = clamp(this.intervals_[i] / 2, 0, 90);\n // Don't attempt to transform latitudes beyond the poles!\n const clampedLat = clamp(centerLat, -90 + delta, 90 - delta);\n p1[0] = centerLon - delta;\n p1[1] = clampedLat - delta;\n p2[0] = centerLon + delta;\n p2[1] = clampedLat + delta;\n this.fromLonLatTransform_(p1, p1);\n this.fromLonLatTransform_(p2, p2);\n const dist = Math.pow(p2[0] - p1[0], 2) + Math.pow(p2[1] - p1[1], 2);\n if (dist <= target) {\n break;\n }\n interval = this.intervals_[i];\n }\n return interval;\n }\n\n /**\n * @param {number} lon Longitude.\n * @param {number} minLat Minimal latitude.\n * @param {number} maxLat Maximal latitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} The meridian line string.\n * @param {number} index Index.\n * @private\n */\n getMeridian_(lon, minLat, maxLat, squaredTolerance, index) {\n const flatCoordinates = meridian(\n lon,\n minLat,\n maxLat,\n this.projection_,\n squaredTolerance\n );\n let lineString = this.meridians_[index];\n if (!lineString) {\n lineString = new LineString(flatCoordinates, GeometryLayout.XY);\n this.meridians_[index] = lineString;\n } else {\n lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);\n lineString.changed();\n }\n return lineString;\n }\n\n /**\n * @param {LineString} lineString Meridian\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {Point} Meridian point.\n * @private\n */\n getMeridianPoint_(lineString, extent, index) {\n const flatCoordinates = lineString.getFlatCoordinates();\n let bottom = 1;\n let top = flatCoordinates.length - 1;\n if (flatCoordinates[bottom] > flatCoordinates[top]) {\n bottom = top;\n top = 1;\n }\n const clampedBottom = Math.max(extent[1], flatCoordinates[bottom]);\n const clampedTop = Math.min(extent[3], flatCoordinates[top]);\n const lat = clamp(\n extent[1] + Math.abs(extent[1] - extent[3]) * this.lonLabelPosition_,\n clampedBottom,\n clampedTop\n );\n const coordinate0 =\n flatCoordinates[bottom - 1] +\n ((flatCoordinates[top - 1] - flatCoordinates[bottom - 1]) *\n (lat - flatCoordinates[bottom])) /\n (flatCoordinates[top] - flatCoordinates[bottom]);\n const coordinate = [coordinate0, lat];\n const point = this.meridiansLabels_[index].geom;\n point.setCoordinates(coordinate);\n return point;\n }\n\n /**\n * Get the list of meridians. Meridians are lines of equal longitude.\n * @return {Array<LineString>} The meridians.\n * @api\n */\n getMeridians() {\n return this.meridians_;\n }\n\n /**\n * @param {number} lat Latitude.\n * @param {number} minLon Minimal longitude.\n * @param {number} maxLon Maximal longitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} The parallel line string.\n * @param {number} index Index.\n * @private\n */\n getParallel_(lat, minLon, maxLon, squaredTolerance, index) {\n const flatCoordinates = parallel(\n lat,\n minLon,\n maxLon,\n this.projection_,\n squaredTolerance\n );\n let lineString = this.parallels_[index];\n if (!lineString) {\n lineString = new LineString(flatCoordinates, GeometryLayout.XY);\n } else {\n lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);\n lineString.changed();\n }\n return lineString;\n }\n\n /**\n * @param {LineString} lineString Parallels.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {Point} Parallel point.\n * @private\n */\n getParallelPoint_(lineString, extent, index) {\n const flatCoordinates = lineString.getFlatCoordinates();\n let left = 0;\n let right = flatCoordinates.length - 2;\n if (flatCoordinates[left] > flatCoordinates[right]) {\n left = right;\n right = 0;\n }\n const clampedLeft = Math.max(extent[0], flatCoordinates[left]);\n const clampedRight = Math.min(extent[2], flatCoordinates[right]);\n const lon = clamp(\n extent[0] + Math.abs(extent[0] - extent[2]) * this.latLabelPosition_,\n clampedLeft,\n clampedRight\n );\n const coordinate1 =\n flatCoordinates[left + 1] +\n ((flatCoordinates[right + 1] - flatCoordinates[left + 1]) *\n (lon - flatCoordinates[left])) /\n (flatCoordinates[right] - flatCoordinates[left]);\n const coordinate = [lon, coordinate1];\n const point = this.parallelsLabels_[index].geom;\n point.setCoordinates(coordinate);\n return point;\n }\n\n /**\n * Get the list of parallels. Parallels are lines of equal latitude.\n * @return {Array<LineString>} The parallels.\n * @api\n */\n getParallels() {\n return this.parallels_;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @private\n */\n updateProjectionInfo_(projection) {\n const epsg4326Projection = getProjection('EPSG:4326');\n\n const worldExtent = projection.getWorldExtent();\n\n this.maxLat_ = worldExtent[3];\n this.maxLon_ = worldExtent[2];\n this.minLat_ = worldExtent[1];\n this.minLon_ = worldExtent[0];\n\n // If the world extent crosses the dateline define a custom transform to\n // return longitudes which wrap the dateline\n\n const toLonLatTransform = getTransform(projection, epsg4326Projection);\n if (this.minLon_ < this.maxLon_) {\n this.toLonLatTransform_ = toLonLatTransform;\n } else {\n const split = this.minLon_ + this.maxLon_ / 2;\n this.maxLon_ += 360;\n this.toLonLatTransform_ = function (\n coordinates,\n opt_output,\n opt_dimension\n ) {\n const dimension = opt_dimension || 2;\n const lonLatCoordinates = toLonLatTransform(\n coordinates,\n opt_output,\n dimension\n );\n for (let i = 0, l = lonLatCoordinates.length; i < l; i += dimension) {\n if (lonLatCoordinates[i] < split) {\n lonLatCoordinates[i] += 360;\n }\n }\n return lonLatCoordinates;\n };\n }\n\n // Transform the extent to get the limits of the view projection extent\n // which should be available to the graticule\n\n this.fromLonLatTransform_ = getTransform(epsg4326Projection, projection);\n const worldExtentP = applyTransform(\n [this.minLon_, this.minLat_, this.maxLon_, this.maxLat_],\n this.fromLonLatTransform_,\n undefined,\n 8\n );\n\n this.minX_ = worldExtentP[0];\n this.maxX_ = worldExtentP[2];\n this.minY_ = worldExtentP[1];\n this.maxY_ = worldExtentP[3];\n\n // Determine the view projection coordinates of the extremities of the world extent\n // as these may lie inside a view extent (for example the pole in a polar projection)\n\n this.bottomLeft_ = this.fromLonLatTransform_([this.minLon_, this.minLat_]);\n this.bottomRight_ = this.fromLonLatTransform_([this.maxLon_, this.minLat_]);\n this.topLeft_ = this.fromLonLatTransform_([this.minLon_, this.maxLat_]);\n this.topRight_ = this.fromLonLatTransform_([this.maxLon_, this.maxLat_]);\n\n // Transform the projection center to lon lat\n // Some projections may have a void area at the poles\n // so replace any NaN latitudes with the min or max value closest to a pole\n\n this.projectionCenterLonLat_ = this.toLonLatTransform_(\n getCenter(projection.getExtent())\n );\n if (isNaN(this.projectionCenterLonLat_[1])) {\n this.projectionCenterLonLat_[1] =\n Math.abs(this.maxLat_) >= Math.abs(this.minLat_)\n ? this.maxLat_\n : this.minLat_;\n }\n\n this.projection_ = projection;\n }\n}\n\nexport default Graticule;\n","/**\n * @module ol/ImageCanvas\n */\nimport ImageBase from './ImageBase.js';\nimport ImageState from './ImageState.js';\n\n/**\n * A function that is called to trigger asynchronous canvas drawing. It is\n * called with a \"done\" callback that should be called when drawing is done.\n * If any error occurs during drawing, the \"done\" callback should be called with\n * that error.\n *\n * @typedef {function(function(Error=): void): void} Loader\n */\n\nclass ImageCanvas extends ImageBase {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {HTMLCanvasElement} canvas Canvas.\n * @param {Loader=} opt_loader Optional loader function to\n * support asynchronous canvas drawing.\n */\n constructor(extent, resolution, pixelRatio, canvas, opt_loader) {\n const state =\n opt_loader !== undefined ? ImageState.IDLE : ImageState.LOADED;\n\n super(extent, resolution, pixelRatio, state);\n\n /**\n * Optional canvas loader function.\n * @type {?Loader}\n * @private\n */\n this.loader_ = opt_loader !== undefined ? opt_loader : null;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = canvas;\n\n /**\n * @private\n * @type {?Error}\n */\n this.error_ = null;\n }\n\n /**\n * Get any error associated with asynchronous rendering.\n * @return {?Error} Any error that occurred during rendering.\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Handle async drawing complete.\n * @param {Error=} err Any error during drawing.\n * @private\n */\n handleLoad_(err) {\n if (err) {\n this.error_ = err;\n this.state = ImageState.ERROR;\n } else {\n this.state = ImageState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n this.state = ImageState.LOADING;\n this.changed();\n this.loader_(this.handleLoad_.bind(this));\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Canvas element.\n */\n getImage() {\n return this.canvas_;\n }\n}\n\nexport default ImageCanvas;\n","/**\n * @module ol/TileState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n /**\n * Indicates that tile loading failed\n * @type {number}\n */\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/easing\n */\n\n/**\n * Start slow and speed up.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeIn(t) {\n return Math.pow(t, 3);\n}\n\n/**\n * Start fast and slow down.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeOut(t) {\n return 1 - easeIn(1 - t);\n}\n\n/**\n * Start slow, speed up, and then slow down again.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function inAndOut(t) {\n return 3 * t * t - 2 * t * t * t;\n}\n\n/**\n * Maintain a constant speed over time.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function linear(t) {\n return t;\n}\n\n/**\n * Start slow, speed up, and at the very end slow down again. This has the\n * same general behavior as {@link module:ol/easing~inAndOut}, but the final\n * slowdown is delayed.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function upAndDown(t) {\n if (t < 0.5) {\n return inAndOut(2 * t);\n } else {\n return 1 - inAndOut(2 * (t - 0.5));\n }\n}\n","/**\n * @module ol/Tile\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport TileState from './TileState.js';\nimport {abstract} from './util.js';\nimport {easeIn} from './easing.js';\n\n/**\n * A function that takes an {@link module:ol/Tile} for the tile and a\n * `{string}` for the url as arguments. The default is\n * ```js\n * source.setTileLoadFunction(function(tile, src) {\n * tile.getImage().src = src;\n * });\n * ```\n * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve\n * error handling:\n *\n * ```js\n * import TileState from 'ol/TileState';\n *\n * source.setTileLoadFunction(function(tile, src) {\n * var xhr = new XMLHttpRequest();\n * xhr.responseType = 'blob';\n * xhr.addEventListener('loadend', function (evt) {\n * var data = this.response;\n * if (data !== undefined) {\n * tile.getImage().src = URL.createObjectURL(data);\n * } else {\n * tile.setState(TileState.ERROR);\n * }\n * });\n * xhr.addEventListener('error', function () {\n * tile.setState(TileState.ERROR);\n * });\n * xhr.open('GET', src);\n * xhr.send();\n * });\n * ```\n *\n * @typedef {function(Tile, string): void} LoadFunction\n * @api\n */\n\n/**\n * {@link module:ol/source/Tile~Tile} sources use a function of this type to get\n * the url that provides a tile for a given tile coordinate.\n *\n * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile\n * coordinate, a `{number}` representing the pixel ratio and a\n * {@link module:ol/proj/Projection} for the projection as arguments\n * and returns a `{string}` representing the tile URL, or undefined if no tile\n * should be requested for the passed tile coordinate.\n *\n * @typedef {function(import(\"./tilecoord.js\").TileCoord, number,\n * import(\"./proj/Projection.js\").default): (string|undefined)} UrlFunction\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @api\n */\n\n/**\n * @classdesc\n * Base class for tiles.\n *\n * @abstract\n */\nclass Tile extends EventTarget {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {Options=} opt_options Tile options.\n */\n constructor(tileCoord, state, opt_options) {\n super();\n\n const options = opt_options ? opt_options : {};\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.tileCoord = tileCoord;\n\n /**\n * @protected\n * @type {import(\"./TileState.js\").default}\n */\n this.state = state;\n\n /**\n * An \"interim\" tile for this tile. The interim tile may be used while this\n * one is loading, for \"smooth\" transitions when changing params/dimensions\n * on the source.\n * @type {Tile}\n */\n this.interimTile = null;\n\n /**\n * The tile is available at the highest possible resolution. Subclasses can\n * set this to `false` initially. Tile load listeners will not be\n * unregistered before this is set to `true` and a `#changed()` is called.\n * @type {boolean}\n */\n this.hifi = true;\n\n /**\n * A key assigned to the tile. This is used by the tile source to determine\n * if this tile can effectively be used, or if a new tile should be created\n * and this one be used as an interim tile for this new tile.\n * @type {string}\n */\n this.key = '';\n\n /**\n * The duration for the opacity transition.\n * @type {number}\n */\n this.transition_ =\n options.transition === undefined ? 250 : options.transition;\n\n /**\n * Lookup of start times for rendering transitions. If the start time is\n * equal to -1, the transition is complete.\n * @type {Object<string, number>}\n */\n this.transitionStarts_ = {};\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Called by the tile cache when the tile is removed from the cache due to expiry\n */\n release() {}\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.key + '/' + this.tileCoord;\n }\n\n /**\n * Get the interim tile most suitable for rendering using the chain of interim\n * tiles. This corresponds to the most recent tile that has been loaded, if no\n * such tile exists, the original tile is returned.\n * @return {!Tile} Best tile for rendering.\n */\n getInterimTile() {\n if (!this.interimTile) {\n //empty chain\n return this;\n }\n let tile = this.interimTile;\n\n // find the first loaded tile and return it. Since the chain is sorted in\n // decreasing order of creation time, there is no need to search the remainder\n // of the list (all those tiles correspond to older requests and will be\n // cleaned up by refreshInterimChain)\n do {\n if (tile.getState() == TileState.LOADED) {\n // Show tile immediately instead of fading it in after loading, because\n // the interim tile is in place already\n this.transition_ = 0;\n return tile;\n }\n tile = tile.interimTile;\n } while (tile);\n\n // we can not find a better tile\n return this;\n }\n\n /**\n * Goes through the chain of interim tiles and discards sections of the chain\n * that are no longer relevant.\n */\n refreshInterimChain() {\n if (!this.interimTile) {\n return;\n }\n\n let tile = this.interimTile;\n let prev = /** @type {Tile} */ (this);\n\n do {\n if (tile.getState() == TileState.LOADED) {\n //we have a loaded tile, we can discard the rest of the list\n //we would could abort any LOADING tile request\n //older than this tile (i.e. any LOADING tile following this entry in the chain)\n tile.interimTile = null;\n break;\n } else if (tile.getState() == TileState.LOADING) {\n //keep this LOADING tile any loaded tiles later in the chain are\n //older than this tile, so we're still interested in the request\n prev = tile;\n } else if (tile.getState() == TileState.IDLE) {\n //the head of the list is the most current tile, we don't need\n //to start any other requests for this chain\n prev.interimTile = tile.interimTile;\n } else {\n prev = tile;\n }\n tile = prev.interimTile;\n } while (tile);\n }\n\n /**\n * Get the tile coordinate for this tile.\n * @return {import(\"./tilecoord.js\").TileCoord} The tile coordinate.\n * @api\n */\n getTileCoord() {\n return this.tileCoord;\n }\n\n /**\n * @return {import(\"./TileState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,\n * it is important to set the state correctly to {@link module:ol/TileState~ERROR}\n * when the tile cannot be loaded. Otherwise the tile cannot be removed from\n * the tile queue and will block other requests.\n * @param {import(\"./TileState.js\").default} state State.\n * @api\n */\n setState(state) {\n if (this.state !== TileState.ERROR && this.state > state) {\n throw new Error('Tile load sequence violation');\n }\n this.state = state;\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n * @abstract\n * @api\n */\n load() {\n abstract();\n }\n\n /**\n * Get the alpha value for rendering.\n * @param {string} id An id for the renderer.\n * @param {number} time The render frame time.\n * @return {number} A number between 0 and 1.\n */\n getAlpha(id, time) {\n if (!this.transition_) {\n return 1;\n }\n\n let start = this.transitionStarts_[id];\n if (!start) {\n start = time;\n this.transitionStarts_[id] = start;\n } else if (start === -1) {\n return 1;\n }\n\n const delta = time - start + 1000 / 60; // avoid rendering at 0\n if (delta >= this.transition_) {\n return 1;\n }\n return easeIn(delta / this.transition_);\n }\n\n /**\n * Determine if a tile is in an alpha transition. A tile is considered in\n * transition if tile.getAlpha() has not yet been called or has been called\n * and returned 1.\n * @param {string} id An id for the renderer.\n * @return {boolean} The tile is in transition.\n */\n inTransition(id) {\n if (!this.transition_) {\n return false;\n }\n return this.transitionStarts_[id] !== -1;\n }\n\n /**\n * Mark a transition as complete.\n * @param {string} id An id for the renderer.\n */\n endTransition(id) {\n if (this.transition_) {\n this.transitionStarts_[id] = -1;\n }\n }\n}\n\nexport default Tile;\n","/**\n * @module ol/ImageTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {listenImage} from './Image.js';\n\nclass ImageTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options=} opt_options Tile options.\n */\n constructor(\n tileCoord,\n state,\n src,\n crossOrigin,\n tileLoadFunction,\n opt_options\n ) {\n super(tileCoord, state, opt_options);\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ = crossOrigin;\n\n /**\n * Image URI\n *\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n this.image_ = new Image();\n if (crossOrigin !== null) {\n this.image_.crossOrigin = crossOrigin;\n }\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n }\n\n /**\n * Get the HTML image element for this tile (may be a Canvas, Image, or Video).\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.src_;\n }\n\n /**\n * Tracks loading or read errors.\n *\n * @private\n */\n handleImageError_() {\n this.state = TileState.ERROR;\n this.unlistenImage_();\n this.image_ = getBlankImage();\n this.changed();\n }\n\n /**\n * Tracks successful image load.\n *\n * @private\n */\n handleImageLoad_() {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n * @api\n */\n load() {\n if (this.state == TileState.ERROR) {\n this.state = TileState.IDLE;\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n }\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n this.tileLoadFunction_(this, this.src_);\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this)\n );\n }\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n}\n\n/**\n * Get a 1-pixel blank image.\n * @return {HTMLCanvasElement} Blank image.\n */\nfunction getBlankImage() {\n const ctx = createCanvasContext2D(1, 1);\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return ctx.canvas;\n}\n\nexport default ImageTile;\n","/**\n * @module ol/Kinetic\n */\n\n/**\n * @classdesc\n * Implementation of inertial deceleration for map movement.\n *\n * @api\n */\nclass Kinetic {\n /**\n * @param {number} decay Rate of decay (must be negative).\n * @param {number} minVelocity Minimum velocity (pixels/millisecond).\n * @param {number} delay Delay to consider to calculate the kinetic\n * initial values (milliseconds).\n */\n constructor(decay, minVelocity, delay) {\n /**\n * @private\n * @type {number}\n */\n this.decay_ = decay;\n\n /**\n * @private\n * @type {number}\n */\n this.minVelocity_ = minVelocity;\n\n /**\n * @private\n * @type {number}\n */\n this.delay_ = delay;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.points_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.initialVelocity_ = 0;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n begin() {\n this.points_.length = 0;\n this.angle_ = 0;\n this.initialVelocity_ = 0;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n */\n update(x, y) {\n this.points_.push(x, y, Date.now());\n }\n\n /**\n * @return {boolean} Whether we should do kinetic animation.\n */\n end() {\n if (this.points_.length < 6) {\n // at least 2 points are required (i.e. there must be at least 6 elements\n // in the array)\n return false;\n }\n const delay = Date.now() - this.delay_;\n const lastIndex = this.points_.length - 3;\n if (this.points_[lastIndex + 2] < delay) {\n // the last tracked point is too old, which means that the user stopped\n // panning before releasing the map\n return false;\n }\n\n // get the first point which still falls into the delay time\n let firstIndex = lastIndex - 3;\n while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {\n firstIndex -= 3;\n }\n\n const duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];\n // we don't want a duration of 0 (divide by zero)\n // we also make sure the user panned for a duration of at least one frame\n // (1/60s) to compute sane displacement values\n if (duration < 1000 / 60) {\n return false;\n }\n\n const dx = this.points_[lastIndex] - this.points_[firstIndex];\n const dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];\n this.angle_ = Math.atan2(dy, dx);\n this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;\n return this.initialVelocity_ > this.minVelocity_;\n }\n\n /**\n * @return {number} Total distance travelled (pixels).\n */\n getDistance() {\n return (this.minVelocity_ - this.initialVelocity_) / this.decay_;\n }\n\n /**\n * @return {number} Angle of the kinetic panning animation (radians).\n */\n getAngle() {\n return this.angle_;\n }\n}\n\nexport default Kinetic;\n","/**\n * @module ol/renderer/Map\n */\nimport Disposable from '../Disposable.js';\nimport {TRUE} from '../functions.js';\nimport {abstract} from '../util.js';\nimport {compose as composeTransform, makeInverse} from '../transform.js';\nimport {getWidth} from '../extent.js';\nimport {shared as iconImageCache} from '../style/IconImageCache.js';\nimport {inView} from '../layer/Layer.js';\nimport {renderDeclutterItems} from '../render.js';\nimport {wrapX} from '../coordinate.js';\n\n/**\n * @abstract\n */\nclass MapRenderer extends Disposable {\n /**\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n constructor(map) {\n super();\n\n /**\n * @private\n * @type {import(\"../PluggableMap.js\").default}\n */\n this.map_ = map;\n\n /**\n * @private\n */\n this.declutterTree_ = null;\n }\n\n /**\n * @abstract\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../PluggableMap.js\").FrameState} frameState FrameState.\n * @protected\n */\n calculateMatrices2D(frameState) {\n const viewState = frameState.viewState;\n const coordinateToPixelTransform = frameState.coordinateToPixelTransform;\n const pixelToCoordinateTransform = frameState.pixelToCoordinateTransform;\n\n composeTransform(\n coordinateToPixelTransform,\n frameState.size[0] / 2,\n frameState.size[1] / 2,\n 1 / viewState.resolution,\n -1 / viewState.resolution,\n -viewState.rotation,\n -viewState.center[0],\n -viewState.center[1]\n );\n\n makeInverse(pixelToCoordinateTransform, coordinateToPixelTransform);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {function(this: S, import(\"../Feature.js\").FeatureLike,\n * import(\"../layer/Layer.js\").default): T} callback Feature callback.\n * @param {S} thisArg Value to use as `this` when executing `callback`.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.\n * @return {T|undefined} Callback result.\n * @template S,T,U\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n callback,\n thisArg,\n layerFilter,\n thisArg2\n ) {\n let result;\n const viewState = frameState.viewState;\n\n /**\n * @param {boolean} managed Managed layer.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @return {?} Callback result.\n */\n function forEachFeatureAtCoordinate(managed, feature, layer) {\n return callback.call(thisArg, feature, managed ? layer : null);\n }\n\n const projection = viewState.projection;\n\n const translatedCoordinate = wrapX(coordinate.slice(), projection);\n const offsets = [[0, 0]];\n if (projection.canWrapX() && checkWrapped) {\n const projectionExtent = projection.getExtent();\n const worldWidth = getWidth(projectionExtent);\n offsets.push([-worldWidth, 0], [worldWidth, 0]);\n }\n\n const layerStates = frameState.layerStatesArray;\n const numLayers = layerStates.length;\n let declutteredFeatures;\n if (this.declutterTree_) {\n declutteredFeatures = this.declutterTree_.all().map(function (entry) {\n return entry.value;\n });\n }\n\n const tmpCoord = [];\n for (let i = 0; i < offsets.length; i++) {\n for (let j = numLayers - 1; j >= 0; --j) {\n const layerState = layerStates[j];\n const layer = /** @type {import(\"../layer/Layer.js\").default} */ (layerState.layer);\n if (\n layer.hasRenderer() &&\n inView(layerState, viewState) &&\n layerFilter.call(thisArg2, layer)\n ) {\n const layerRenderer = layer.getRenderer();\n const source = layer.getSource();\n if (layerRenderer && source) {\n const coordinates = source.getWrapX()\n ? translatedCoordinate\n : coordinate;\n const callback = forEachFeatureAtCoordinate.bind(\n null,\n layerState.managed\n );\n tmpCoord[0] = coordinates[0] + offsets[i][0];\n tmpCoord[1] = coordinates[1] + offsets[i][1];\n result = layerRenderer.forEachFeatureAtCoordinate(\n tmpCoord,\n frameState,\n hitTolerance,\n callback,\n declutteredFeatures\n );\n }\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n }\n\n /**\n * @abstract\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../layer/Layer.js\").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer\n * callback.\n * @param {function(import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) {\n return abstract();\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg Value to use as `this` when executing `layerFilter`.\n * @return {boolean} Is there a feature at the given coordinate?\n * @template U\n */\n hasFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n layerFilter,\n thisArg\n ) {\n const hasFeature = this.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n TRUE,\n this,\n layerFilter,\n thisArg\n );\n\n return hasFeature !== undefined;\n }\n\n /**\n * @return {import(\"../PluggableMap.js\").default} Map.\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Render.\n * @param {?import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n this.declutterTree_ = renderDeclutterItems(frameState, this.declutterTree_);\n }\n\n /**\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @protected\n */\n scheduleExpireIconCache(frameState) {\n if (iconImageCache.canExpireCache()) {\n frameState.postRenderFunctions.push(expireIconCache);\n }\n }\n}\n\n/**\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\nfunction expireIconCache(map, frameState) {\n iconImageCache.expire();\n}\n\nexport default MapRenderer;\n","/**\n * @module ol/renderer/Composite\n */\nimport MapRenderer from './Map.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport RenderEvent from '../render/Event.js';\nimport RenderEventType from '../render/EventType.js';\nimport SourceState from '../source/State.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {checkedFonts} from '../render/canvas.js';\nimport {inView} from '../layer/Layer.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {replaceChildren} from '../dom.js';\n\n/**\n * @classdesc\n * Canvas map renderer.\n * @api\n */\nclass CompositeMapRenderer extends MapRenderer {\n /**\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n constructor(map) {\n super(map);\n\n /**\n * @type {import(\"../events.js\").EventsKey}\n */\n this.fontChangeListenerKey_ = listen(\n checkedFonts,\n ObjectEventType.PROPERTYCHANGE,\n map.redrawText.bind(map)\n );\n\n /**\n * @private\n * @type {HTMLDivElement}\n */\n this.element_ = document.createElement('div');\n const style = this.element_.style;\n style.position = 'absolute';\n style.width = '100%';\n style.height = '100%';\n style.zIndex = '0';\n\n this.element_.className = CLASS_UNSELECTABLE + ' ol-layers';\n\n const container = map.getViewport();\n container.insertBefore(this.element_, container.firstChild || null);\n\n /**\n * @private\n * @type {Array<HTMLElement>}\n */\n this.children_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n const map = this.getMap();\n if (map.hasListener(type)) {\n const event = new RenderEvent(type, undefined, frameState);\n map.dispatchEvent(event);\n }\n }\n\n disposeInternal() {\n unlistenByKey(this.fontChangeListenerKey_);\n this.element_.parentNode.removeChild(this.element_);\n super.disposeInternal();\n }\n\n /**\n * Render.\n * @param {?import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element_.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n this.calculateMatrices2D(frameState);\n this.dispatchRenderEvent(RenderEventType.PRECOMPOSE, frameState);\n\n const layerStatesArray = frameState.layerStatesArray.sort(function (a, b) {\n return a.zIndex - b.zIndex;\n });\n const viewState = frameState.viewState;\n\n this.children_.length = 0;\n let previousElement = null;\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const layerState = layerStatesArray[i];\n frameState.layerIndex = i;\n if (\n !inView(layerState, viewState) ||\n (layerState.sourceState != SourceState.READY &&\n layerState.sourceState != SourceState.UNDEFINED)\n ) {\n continue;\n }\n\n const layer = layerState.layer;\n const element = layer.render(frameState, previousElement);\n if (!element) {\n continue;\n }\n if (element !== previousElement) {\n this.children_.push(element);\n previousElement = element;\n }\n }\n super.renderFrame(frameState);\n\n replaceChildren(this.element_, this.children_);\n\n this.dispatchRenderEvent(RenderEventType.POSTCOMPOSE, frameState);\n\n if (!this.renderedVisible_) {\n this.element_.style.display = '';\n this.renderedVisible_ = true;\n }\n\n this.scheduleExpireIconCache(frameState);\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../layer/Layer.js\").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer\n * callback.\n * @param {function(import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) {\n const viewState = frameState.viewState;\n\n const layerStates = frameState.layerStatesArray;\n const numLayers = layerStates.length;\n\n for (let i = numLayers - 1; i >= 0; --i) {\n const layerState = layerStates[i];\n const layer = layerState.layer;\n if (\n layer.hasRenderer() &&\n inView(layerState, viewState) &&\n layerFilter(layer)\n ) {\n const layerRenderer = layer.getRenderer();\n const data = layerRenderer.getDataAtPixel(\n pixel,\n frameState,\n hitTolerance\n );\n if (data) {\n const result = callback(layer, data);\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n }\n}\n\nexport default CompositeMapRenderer;\n","/**\n * @module ol/layer/Group\n */\nimport BaseLayer from './Base.js';\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport EventType from '../events/EventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport SourceState from '../source/State.js';\nimport {assert} from '../asserts.js';\nimport {assign, clear} from '../obj.js';\nimport {getChangeEventType} from '../Object.js';\nimport {getIntersection} from '../extent.js';\nimport {getUid} from '../util.js';\nimport {listen, unlistenByKey} from '../events.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {Array<import(\"./Base.js\").default>|import(\"../Collection.js\").default<import(\"./Base.js\").default>} [layers] Child layers.\n */\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LAYERS: 'layers',\n};\n\n/**\n * @classdesc\n * A {@link module:ol/Collection~Collection} of layers that are handled together.\n *\n * A generic `change` event is triggered when the group/Collection changes.\n *\n * @api\n */\nclass LayerGroup extends BaseLayer {\n /**\n * @param {Options=} opt_options Layer options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n const baseOptions = /** @type {Options} */ (assign({}, options));\n delete baseOptions.layers;\n\n let layers = options.layers;\n\n super(baseOptions);\n\n /**\n * @private\n * @type {Array<import(\"../events.js\").EventsKey>}\n */\n this.layersListenerKeys_ = [];\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").EventsKey>>}\n */\n this.listenerKeys_ = {};\n\n this.addEventListener(\n getChangeEventType(Property.LAYERS),\n this.handleLayersChanged_\n );\n\n if (layers) {\n if (Array.isArray(layers)) {\n layers = new Collection(layers.slice(), {unique: true});\n } else {\n assert(typeof (/** @type {?} */ (layers).getArray) === 'function', 43); // Expected `layers` to be an array or a `Collection`\n }\n } else {\n layers = new Collection(undefined, {unique: true});\n }\n\n this.setLayers(layers);\n }\n\n /**\n * @private\n */\n handleLayerChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleLayersChanged_() {\n this.layersListenerKeys_.forEach(unlistenByKey);\n this.layersListenerKeys_.length = 0;\n\n const layers = this.getLayers();\n this.layersListenerKeys_.push(\n listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this),\n listen(layers, CollectionEventType.REMOVE, this.handleLayersRemove_, this)\n );\n\n for (const id in this.listenerKeys_) {\n this.listenerKeys_[id].forEach(unlistenByKey);\n }\n clear(this.listenerKeys_);\n\n const layersArray = layers.getArray();\n for (let i = 0, ii = layersArray.length; i < ii; i++) {\n const layer = layersArray[i];\n this.listenerKeys_[getUid(layer)] = [\n listen(\n layer,\n ObjectEventType.PROPERTYCHANGE,\n this.handleLayerChange_,\n this\n ),\n listen(layer, EventType.CHANGE, this.handleLayerChange_, this),\n ];\n }\n\n this.changed();\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} collectionEvent CollectionEvent.\n * @private\n */\n handleLayersAdd_(collectionEvent) {\n const layer = /** @type {import(\"./Base.js\").default} */ (collectionEvent.element);\n this.listenerKeys_[getUid(layer)] = [\n listen(\n layer,\n ObjectEventType.PROPERTYCHANGE,\n this.handleLayerChange_,\n this\n ),\n listen(layer, EventType.CHANGE, this.handleLayerChange_, this),\n ];\n this.changed();\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} collectionEvent CollectionEvent.\n * @private\n */\n handleLayersRemove_(collectionEvent) {\n const layer = /** @type {import(\"./Base.js\").default} */ (collectionEvent.element);\n const key = getUid(layer);\n this.listenerKeys_[key].forEach(unlistenByKey);\n delete this.listenerKeys_[key];\n this.changed();\n }\n\n /**\n * Returns the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @return {!import(\"../Collection.js\").default<import(\"./Base.js\").default>} Collection of\n * {@link module:ol/layer/Base layers} that are part of this group.\n * @observable\n * @api\n */\n getLayers() {\n return /** @type {!import(\"../Collection.js\").default<import(\"./Base.js\").default>} */ (this.get(\n Property.LAYERS\n ));\n }\n\n /**\n * Set the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @param {!import(\"../Collection.js\").default<import(\"./Base.js\").default>} layers Collection of\n * {@link module:ol/layer/Base layers} that are part of this group.\n * @observable\n * @api\n */\n setLayers(layers) {\n this.set(Property.LAYERS, layers);\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").default>=} opt_array Array of layers (to be modified in place).\n * @return {Array<import(\"./Layer.js\").default>} Array of layers.\n */\n getLayersArray(opt_array) {\n const array = opt_array !== undefined ? opt_array : [];\n this.getLayers().forEach(function (layer) {\n layer.getLayersArray(array);\n });\n return array;\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").State>=} opt_states Optional list of layer states (to be modified in place).\n * @return {Array<import(\"./Layer.js\").State>} List of layer states.\n */\n getLayerStatesArray(opt_states) {\n const states = opt_states !== undefined ? opt_states : [];\n\n const pos = states.length;\n\n this.getLayers().forEach(function (layer) {\n layer.getLayerStatesArray(states);\n });\n\n const ownLayerState = this.getLayerState();\n for (let i = pos, ii = states.length; i < ii; i++) {\n const layerState = states[i];\n layerState.opacity *= ownLayerState.opacity;\n layerState.visible = layerState.visible && ownLayerState.visible;\n layerState.maxResolution = Math.min(\n layerState.maxResolution,\n ownLayerState.maxResolution\n );\n layerState.minResolution = Math.max(\n layerState.minResolution,\n ownLayerState.minResolution\n );\n layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom);\n layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom);\n if (ownLayerState.extent !== undefined) {\n if (layerState.extent !== undefined) {\n layerState.extent = getIntersection(\n layerState.extent,\n ownLayerState.extent\n );\n } else {\n layerState.extent = ownLayerState.extent;\n }\n }\n }\n\n return states;\n }\n\n /**\n * @return {import(\"../source/State.js\").default} Source state.\n */\n getSourceState() {\n return SourceState.READY;\n }\n}\n\nexport default LayerGroup;\n","/**\n * @module ol/MapEvent\n */\nimport Event from './events/Event.js';\n\n/**\n * @classdesc\n * Events emitted as map events are instances of this type.\n * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event.\n */\nclass MapEvent extends Event {\n /**\n * @param {string} type Event type.\n * @param {import(\"./PluggableMap.js\").default} map Map.\n * @param {?import(\"./PluggableMap.js\").FrameState=} opt_frameState Frame state.\n */\n constructor(type, map, opt_frameState) {\n super(type);\n\n /**\n * The map where the event occurred.\n * @type {import(\"./PluggableMap.js\").default}\n * @api\n */\n this.map = map;\n\n /**\n * The frame state at the time of the event.\n * @type {?import(\"./PluggableMap.js\").FrameState}\n * @api\n */\n this.frameState = opt_frameState !== undefined ? opt_frameState : null;\n }\n}\n\nexport default MapEvent;\n","/**\n * @module ol/MapBrowserEvent\n */\nimport MapEvent from './MapEvent.js';\n\n/**\n * @classdesc\n * Events emitted as map browser events are instances of this type.\n * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event.\n * @template {UIEvent} EVENT\n */\nclass MapBrowserEvent extends MapEvent {\n /**\n * @param {string} type Event type.\n * @param {import(\"./PluggableMap.js\").default} map Map.\n * @param {EVENT} originalEvent Original event.\n * @param {boolean=} opt_dragging Is the map currently being dragged?\n * @param {?import(\"./PluggableMap.js\").FrameState=} opt_frameState Frame state.\n */\n constructor(type, map, originalEvent, opt_dragging, opt_frameState) {\n super(type, map, opt_frameState);\n\n /**\n * The original browser event.\n * @const\n * @type {EVENT}\n * @api\n */\n this.originalEvent = originalEvent;\n\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {?import(\"./pixel.js\").Pixel}\n */\n this.pixel_ = null;\n\n /**\n * The coordinate in the user projection corresponding to the original browser event.\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.coordinate_ = null;\n\n /**\n * Indicates if the map is currently being dragged. Only set for\n * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.\n *\n * @type {boolean}\n * @api\n */\n this.dragging = opt_dragging !== undefined ? opt_dragging : false;\n }\n\n /**\n * The map pixel relative to the viewport corresponding to the original event.\n * @type {import(\"./pixel.js\").Pixel}\n * @api\n */\n get pixel() {\n if (!this.pixel_) {\n this.pixel_ = this.map.getEventPixel(this.originalEvent);\n }\n return this.pixel_;\n }\n set pixel(pixel) {\n this.pixel_ = pixel;\n }\n\n /**\n * The coordinate corresponding to the original browser event. This will be in the user\n * projection if one is set. Otherwise it will be in the view projection.\n * @type {import(\"./coordinate.js\").Coordinate}\n * @api\n */\n get coordinate() {\n if (!this.coordinate_) {\n this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);\n }\n return this.coordinate_;\n }\n set coordinate(coordinate) {\n this.coordinate_ = coordinate;\n }\n\n /**\n * Prevents the default browser action.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.\n * @api\n */\n preventDefault() {\n super.preventDefault();\n this.originalEvent.preventDefault();\n }\n\n /**\n * Prevents further propagation of the current event.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.\n * @api\n */\n stopPropagation() {\n super.stopPropagation();\n this.originalEvent.stopPropagation();\n }\n}\n\nexport default MapBrowserEvent;\n","/**\n * @module ol/MapBrowserEventType\n */\nimport EventType from './events/EventType.js';\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n /**\n * A true single click with no dragging and no double click. Note that this\n * event is delayed by 250 ms to ensure that it is not a double click.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick\n * @api\n */\n SINGLECLICK: 'singleclick',\n\n /**\n * A click with no dragging. A double click will fire two of this.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#click\n * @api\n */\n CLICK: EventType.CLICK,\n\n /**\n * A true double click, with no dragging.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick\n * @api\n */\n DBLCLICK: EventType.DBLCLICK,\n\n /**\n * Triggered when a pointer is dragged.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag\n * @api\n */\n POINTERDRAG: 'pointerdrag',\n\n /**\n * Triggered when a pointer is moved. Note that on touch devices this is\n * triggered when the map is panned, so is not the same as mousemove.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove\n * @api\n */\n POINTERMOVE: 'pointermove',\n\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n","/**\n * @module ol/pointer/EventType\n */\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n POINTERMOVE: 'pointermove',\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n","/**\n * @module ol/MapBrowserEventHandler\n */\n\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport PointerEventType from './pointer/EventType.js';\nimport {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';\nimport {listen, unlistenByKey} from './events.js';\n\nclass MapBrowserEventHandler extends EventTarget {\n /**\n * @param {import(\"./PluggableMap.js\").default} map The map with the viewport to listen to events on.\n * @param {number=} moveTolerance The minimal distance the pointer must travel to trigger a move.\n */\n constructor(map, moveTolerance) {\n super(map);\n\n /**\n * This is the element that we will listen to the real events on.\n * @type {import(\"./PluggableMap.js\").default}\n * @private\n */\n this.map_ = map;\n\n /**\n * @type {any}\n * @private\n */\n this.clickTimeoutId_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_ = false;\n\n /**\n * @type {!Array<import(\"./events.js\").EventsKey>}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * @type {number}\n * @private\n */\n this.moveTolerance_ = moveTolerance\n ? moveTolerance * DEVICE_PIXEL_RATIO\n : DEVICE_PIXEL_RATIO;\n\n /**\n * The most recent \"down\" type event (or null if none have occurred).\n * Set on pointerdown.\n * @type {PointerEvent}\n * @private\n */\n this.down_ = null;\n\n const element = this.map_.getViewport();\n\n /**\n * @type {number}\n * @private\n */\n this.activePointers_ = 0;\n\n /**\n * @type {!Object<number, boolean>}\n * @private\n */\n this.trackedTouches_ = {};\n\n this.element_ = element;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.pointerdownListenerKey_ = listen(\n element,\n PointerEventType.POINTERDOWN,\n this.handlePointerDown_,\n this\n );\n\n /**\n * @type {PointerEvent}\n * @private\n */\n this.originalPointerMoveEvent_;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.relayedListenerKey_ = listen(\n element,\n PointerEventType.POINTERMOVE,\n this.relayEvent_,\n this\n );\n\n /**\n * @private\n */\n this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this);\n\n this.element_.addEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false\n );\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n emulateClick_(pointerEvent) {\n let newEvent = new MapBrowserEvent(\n MapBrowserEventType.CLICK,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n if (this.clickTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.clickTimeoutId_);\n this.clickTimeoutId_ = undefined;\n newEvent = new MapBrowserEvent(\n MapBrowserEventType.DBLCLICK,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n } else {\n // click\n this.clickTimeoutId_ = setTimeout(\n function () {\n this.clickTimeoutId_ = undefined;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.SINGLECLICK,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n }.bind(this),\n 250\n );\n }\n }\n\n /**\n * Keeps track on how many pointers are currently active.\n *\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n updateActivePointers_(pointerEvent) {\n const event = pointerEvent;\n\n if (\n event.type == MapBrowserEventType.POINTERUP ||\n event.type == MapBrowserEventType.POINTERCANCEL\n ) {\n delete this.trackedTouches_[event.pointerId];\n } else if (event.type == MapBrowserEventType.POINTERDOWN) {\n this.trackedTouches_[event.pointerId] = true;\n }\n this.activePointers_ = Object.keys(this.trackedTouches_).length;\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerUp_(pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERUP,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n\n // We emulate click events on left mouse button click, touch contact, and pen\n // contact. isMouseActionButton returns true in these cases (evt.button is set\n // to 0).\n // See http://www.w3.org/TR/pointerevents/#button-states\n // We only fire click, singleclick, and doubleclick if nobody has called\n // event.stopPropagation() or event.preventDefault().\n if (\n !newEvent.propagationStopped &&\n !this.dragging_ &&\n this.isMouseActionButton_(pointerEvent)\n ) {\n this.emulateClick_(this.down_);\n }\n\n if (this.activePointers_ === 0) {\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.dragging_ = false;\n this.down_ = null;\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} If the left mouse button was pressed.\n * @private\n */\n isMouseActionButton_(pointerEvent) {\n return pointerEvent.button === 0;\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerDown_(pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDOWN,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n\n this.down_ = pointerEvent;\n\n if (this.dragListenerKeys_.length === 0) {\n this.dragListenerKeys_.push(\n listen(\n document,\n MapBrowserEventType.POINTERMOVE,\n this.handlePointerMove_,\n this\n ),\n listen(\n document,\n MapBrowserEventType.POINTERUP,\n this.handlePointerUp_,\n this\n ),\n /* Note that the listener for `pointercancel is set up on\n * `pointerEventHandler_` and not `documentPointerEventHandler_` like\n * the `pointerup` and `pointermove` listeners.\n *\n * The reason for this is the following: `TouchSource.vacuumTouches_()`\n * issues `pointercancel` events, when there was no `touchend` for a\n * `touchstart`. Now, let's say a first `touchstart` is registered on\n * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.\n * But `documentPointerEventHandler_` doesn't know about the first\n * `touchstart`. If there is no `touchend` for the `touchstart`, we can\n * only receive a `touchcancel` from `pointerEventHandler_`, because it is\n * only registered there.\n */\n listen(\n this.element_,\n MapBrowserEventType.POINTERCANCEL,\n this.handlePointerUp_,\n this\n )\n );\n if (\n this.element_.getRootNode &&\n this.element_.getRootNode() !== document\n ) {\n this.dragListenerKeys_.push(\n listen(\n this.element_.getRootNode(),\n MapBrowserEventType.POINTERUP,\n this.handlePointerUp_,\n this\n )\n );\n }\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerMove_(pointerEvent) {\n // Between pointerdown and pointerup, pointermove events are triggered.\n // To avoid a 'false' touchmove event to be dispatched, we test if the pointer\n // moved a significant distance.\n if (this.isMoving_(pointerEvent)) {\n this.dragging_ = true;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDRAG,\n this.map_,\n pointerEvent,\n this.dragging_\n );\n this.dispatchEvent(newEvent);\n }\n }\n\n /**\n * Wrap and relay a pointer event. Note that this requires that the type\n * string for the MapBrowserEvent matches the PointerEvent type.\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n relayEvent_(pointerEvent) {\n this.originalPointerMoveEvent_ = pointerEvent;\n const dragging = !!(this.down_ && this.isMoving_(pointerEvent));\n this.dispatchEvent(\n new MapBrowserEvent(pointerEvent.type, this.map_, pointerEvent, dragging)\n );\n }\n\n /**\n * Flexible handling of a `touch-action: none` css equivalent: because calling\n * `preventDefault()` on a `pointermove` event does not stop native page scrolling\n * and zooming, we also listen for `touchmove` and call `preventDefault()` on it\n * when an interaction (currently `DragPan` handles the event.\n * @param {TouchEvent} event Event.\n * @private\n */\n handleTouchMove_(event) {\n // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`\n // may not be initialized yet when we get here on a platform without native pointer events.\n if (\n !this.originalPointerMoveEvent_ ||\n this.originalPointerMoveEvent_.defaultPrevented\n ) {\n event.preventDefault();\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} Is moving.\n * @private\n */\n isMoving_(pointerEvent) {\n return (\n this.dragging_ ||\n Math.abs(pointerEvent.clientX - this.down_.clientX) >\n this.moveTolerance_ ||\n Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_\n );\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n if (this.relayedListenerKey_) {\n unlistenByKey(this.relayedListenerKey_);\n this.relayedListenerKey_ = null;\n }\n this.element_.removeEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_\n );\n\n if (this.pointerdownListenerKey_) {\n unlistenByKey(this.pointerdownListenerKey_);\n this.pointerdownListenerKey_ = null;\n }\n\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n\n this.element_ = null;\n super.disposeInternal();\n }\n}\n\nexport default MapBrowserEventHandler;\n","/**\n * @module ol/MapEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered after a map frame is rendered.\n * @event module:ol/MapEvent~MapEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered when the map starts moving.\n * @event module:ol/MapEvent~MapEvent#movestart\n * @api\n */\n MOVESTART: 'movestart',\n\n /**\n * Triggered after the map is moved.\n * @event module:ol/MapEvent~MapEvent#moveend\n * @api\n */\n MOVEEND: 'moveend',\n};\n","/**\n * @module ol/MapProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n LAYERGROUP: 'layergroup',\n SIZE: 'size',\n TARGET: 'target',\n VIEW: 'view',\n};\n","/**\n * @module ol/structs/PriorityQueue\n */\nimport {assert} from '../asserts.js';\nimport {clear} from '../obj.js';\n\n/**\n * @type {number}\n */\nexport const DROP = Infinity;\n\n/**\n * @classdesc\n * Priority queue.\n *\n * The implementation is inspired from the Closure Library's Heap class and\n * Python's heapq module.\n *\n * See http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html\n * and http://hg.python.org/cpython/file/2.7/Lib/heapq.py.\n *\n * @template T\n */\nclass PriorityQueue {\n /**\n * @param {function(T): number} priorityFunction Priority function.\n * @param {function(T): string} keyFunction Key function.\n */\n constructor(priorityFunction, keyFunction) {\n /**\n * @type {function(T): number}\n * @private\n */\n this.priorityFunction_ = priorityFunction;\n\n /**\n * @type {function(T): string}\n * @private\n */\n this.keyFunction_ = keyFunction;\n\n /**\n * @type {Array<T>}\n * @private\n */\n this.elements_ = [];\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.priorities_ = [];\n\n /**\n * @type {!Object<string, boolean>}\n * @private\n */\n this.queuedElements_ = {};\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.elements_.length = 0;\n this.priorities_.length = 0;\n clear(this.queuedElements_);\n }\n\n /**\n * Remove and return the highest-priority element. O(log N).\n * @return {T} Element.\n */\n dequeue() {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[0];\n if (elements.length == 1) {\n elements.length = 0;\n priorities.length = 0;\n } else {\n elements[0] = elements.pop();\n priorities[0] = priorities.pop();\n this.siftUp_(0);\n }\n const elementKey = this.keyFunction_(element);\n delete this.queuedElements_[elementKey];\n return element;\n }\n\n /**\n * Enqueue an element. O(log N).\n * @param {T} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n assert(!(this.keyFunction_(element) in this.queuedElements_), 31); // Tried to enqueue an `element` that was already added to the queue\n const priority = this.priorityFunction_(element);\n if (priority != DROP) {\n this.elements_.push(element);\n this.priorities_.push(priority);\n this.queuedElements_[this.keyFunction_(element)] = true;\n this.siftDown_(0, this.elements_.length - 1);\n return true;\n }\n return false;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.elements_.length;\n }\n\n /**\n * Gets the index of the left child of the node at the given index.\n * @param {number} index The index of the node to get the left child for.\n * @return {number} The index of the left child.\n * @private\n */\n getLeftChildIndex_(index) {\n return index * 2 + 1;\n }\n\n /**\n * Gets the index of the right child of the node at the given index.\n * @param {number} index The index of the node to get the right child for.\n * @return {number} The index of the right child.\n * @private\n */\n getRightChildIndex_(index) {\n return index * 2 + 2;\n }\n\n /**\n * Gets the index of the parent of the node at the given index.\n * @param {number} index The index of the node to get the parent for.\n * @return {number} The index of the parent.\n * @private\n */\n getParentIndex_(index) {\n return (index - 1) >> 1;\n }\n\n /**\n * Make this a heap. O(N).\n * @private\n */\n heapify_() {\n let i;\n for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {\n this.siftUp_(i);\n }\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.elements_.length === 0;\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Is key queued.\n */\n isKeyQueued(key) {\n return key in this.queuedElements_;\n }\n\n /**\n * @param {T} element Element.\n * @return {boolean} Is queued.\n */\n isQueued(element) {\n return this.isKeyQueued(this.keyFunction_(element));\n }\n\n /**\n * @param {number} index The index of the node to move down.\n * @private\n */\n siftUp_(index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const count = elements.length;\n const element = elements[index];\n const priority = priorities[index];\n const startIndex = index;\n\n while (index < count >> 1) {\n const lIndex = this.getLeftChildIndex_(index);\n const rIndex = this.getRightChildIndex_(index);\n\n const smallerChildIndex =\n rIndex < count && priorities[rIndex] < priorities[lIndex]\n ? rIndex\n : lIndex;\n\n elements[index] = elements[smallerChildIndex];\n priorities[index] = priorities[smallerChildIndex];\n index = smallerChildIndex;\n }\n\n elements[index] = element;\n priorities[index] = priority;\n this.siftDown_(startIndex, index);\n }\n\n /**\n * @param {number} startIndex The index of the root.\n * @param {number} index The index of the node to move up.\n * @private\n */\n siftDown_(startIndex, index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[index];\n const priority = priorities[index];\n\n while (index > startIndex) {\n const parentIndex = this.getParentIndex_(index);\n if (priorities[parentIndex] > priority) {\n elements[index] = elements[parentIndex];\n priorities[index] = priorities[parentIndex];\n index = parentIndex;\n } else {\n break;\n }\n }\n elements[index] = element;\n priorities[index] = priority;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n reprioritize() {\n const priorityFunction = this.priorityFunction_;\n const elements = this.elements_;\n const priorities = this.priorities_;\n let index = 0;\n const n = elements.length;\n let element, i, priority;\n for (i = 0; i < n; ++i) {\n element = elements[i];\n priority = priorityFunction(element);\n if (priority == DROP) {\n delete this.queuedElements_[this.keyFunction_(element)];\n } else {\n priorities[index] = priority;\n elements[index++] = element;\n }\n }\n elements.length = index;\n priorities.length = index;\n this.heapify_();\n }\n}\n\nexport default PriorityQueue;\n","/**\n * @module ol/TileQueue\n */\nimport EventType from './events/EventType.js';\nimport PriorityQueue, {DROP} from './structs/PriorityQueue.js';\nimport TileState from './TileState.js';\n\n/**\n * @typedef {function(import(\"./Tile.js\").default, string, import(\"./coordinate.js\").Coordinate, number): number} PriorityFunction\n */\n\nclass TileQueue extends PriorityQueue {\n /**\n * @param {PriorityFunction} tilePriorityFunction Tile priority function.\n * @param {function(): ?} tileChangeCallback Function called on each tile change event.\n */\n constructor(tilePriorityFunction, tileChangeCallback) {\n super(\n /**\n * @param {Array} element Element.\n * @return {number} Priority.\n */\n function (element) {\n return tilePriorityFunction.apply(null, element);\n },\n /**\n * @param {Array} element Element.\n * @return {string} Key.\n */\n function (element) {\n return /** @type {import(\"./Tile.js\").default} */ (element[0]).getKey();\n }\n );\n\n /** @private */\n this.boundHandleTileChange_ = this.handleTileChange.bind(this);\n\n /**\n * @private\n * @type {function(): ?}\n */\n this.tileChangeCallback_ = tileChangeCallback;\n\n /**\n * @private\n * @type {number}\n */\n this.tilesLoading_ = 0;\n\n /**\n * @private\n * @type {!Object<string,boolean>}\n */\n this.tilesLoadingKeys_ = {};\n }\n\n /**\n * @param {Array} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n const added = super.enqueue(element);\n if (added) {\n const tile = element[0];\n tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n return added;\n }\n\n /**\n * @return {number} Number of tiles loading.\n */\n getTilesLoading() {\n return this.tilesLoading_;\n }\n\n /**\n * @param {import(\"./events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"./Tile.js\").default} */ (event.target);\n const state = tile.getState();\n if (\n (tile.hifi && state === TileState.LOADED) ||\n state === TileState.ERROR ||\n state === TileState.EMPTY\n ) {\n tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n const tileKey = tile.getKey();\n if (tileKey in this.tilesLoadingKeys_) {\n delete this.tilesLoadingKeys_[tileKey];\n --this.tilesLoading_;\n }\n this.tileChangeCallback_();\n }\n }\n\n /**\n * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.\n * @param {number} maxNewLoads Maximum number of new tiles to load.\n */\n loadMoreTiles(maxTotalLoading, maxNewLoads) {\n let newLoads = 0;\n let state, tile, tileKey;\n while (\n this.tilesLoading_ < maxTotalLoading &&\n newLoads < maxNewLoads &&\n this.getCount() > 0\n ) {\n tile = /** @type {import(\"./Tile.js\").default} */ (this.dequeue()[0]);\n tileKey = tile.getKey();\n state = tile.getState();\n if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {\n this.tilesLoadingKeys_[tileKey] = true;\n ++this.tilesLoading_;\n ++newLoads;\n tile.load();\n }\n }\n }\n}\n\nexport default TileQueue;\n\n/**\n * @param {import('./PluggableMap.js').FrameState} frameState Frame state.\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\nexport function getTilePriority(\n frameState,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution\n) {\n // Filter out tiles at higher zoom levels than the current zoom level, or that\n // are outside the visible extent.\n if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {\n return DROP;\n }\n if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {\n return DROP;\n }\n // Prioritize the highest zoom level tiles closest to the focus.\n // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).\n // Within a zoom level, tiles are prioritized by the distance in pixels between\n // the center of the tile and the center of the viewport. The factor of 65536\n // means that the prioritization should behave as desired for tiles up to\n // 65536 * Math.log(2) = 45426 pixels from the focus.\n const center = frameState.viewState.center;\n const deltaX = tileCenter[0] - center[0];\n const deltaY = tileCenter[1] - center[1];\n return (\n 65536 * Math.log(tileResolution) +\n Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution\n );\n}\n","/**\n * @module ol/ViewProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n CENTER: 'center',\n RESOLUTION: 'resolution',\n ROTATION: 'rotation',\n};\n","/**\n * @module ol/tilegrid/common\n */\n\n/**\n * Default maximum zoom for default tile grids.\n * @type {number}\n */\nexport const DEFAULT_MAX_ZOOM = 42;\n\n/**\n * Default tile size.\n * @type {number}\n */\nexport const DEFAULT_TILE_SIZE = 256;\n","/**\n * @module ol/centerconstraint\n */\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((import(\"./coordinate.js\").Coordinate|undefined), number, import(\"./size.js\").Size, boolean=): (import(\"./coordinate.js\").Coordinate|undefined)} Type\n */\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.\n * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent\n * (only during interaction and animation).\n * @return {Type} The constraint.\n */\nexport function createExtent(extent, onlyCenter, smooth) {\n return (\n /**\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center Center.\n * @param {number} resolution Resolution.\n * @param {import(\"./size.js\").Size} size Viewport size; unused if `onlyCenter` was specified.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\n function (center, resolution, size, opt_isMoving) {\n if (center) {\n const viewWidth = onlyCenter ? 0 : size[0] * resolution;\n const viewHeight = onlyCenter ? 0 : size[1] * resolution;\n let minX = extent[0] + viewWidth / 2;\n let maxX = extent[2] - viewWidth / 2;\n let minY = extent[1] + viewHeight / 2;\n let maxY = extent[3] - viewHeight / 2;\n\n // note: when zooming out of bounds, min and max values for x and y may\n // end up inverted (min > max); this has to be accounted for\n if (minX > maxX) {\n minX = (maxX + minX) / 2;\n maxX = minX;\n }\n if (minY > maxY) {\n minY = (maxY + minY) / 2;\n maxY = minY;\n }\n\n let x = clamp(center[0], minX, maxX);\n let y = clamp(center[1], minY, maxY);\n const ratio = 30 * resolution;\n\n // during an interaction, allow some overscroll\n if (opt_isMoving && smooth) {\n x +=\n -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);\n y +=\n -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);\n }\n\n return [x, y];\n } else {\n return undefined;\n }\n }\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate=} center Center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\nexport function none(center) {\n return center;\n}\n","/**\n * @module ol/resolutionconstraint\n */\nimport {clamp} from './math.js';\nimport {getHeight, getWidth} from './extent.js';\nimport {linearFindNearest} from './array.js';\n\n/**\n * @typedef {function((number|undefined), number, import(\"./size.js\").Size, boolean=): (number|undefined)} Type\n */\n\n/**\n * Returns a modified resolution taking into account the viewport size and maximum\n * allowed extent.\n * @param {number} resolution Resolution\n * @param {import(\"./extent.js\").Extent=} maxExtent Maximum allowed extent.\n * @param {import(\"./size.js\").Size} viewportSize Viewport size.\n * @param {boolean} showFullExtent Whether to show the full extent.\n * @return {number} Capped resolution.\n */\nfunction getViewportClampedResolution(\n resolution,\n maxExtent,\n viewportSize,\n showFullExtent\n) {\n const xResolution = getWidth(maxExtent) / viewportSize[0];\n const yResolution = getHeight(maxExtent) / viewportSize[1];\n\n if (showFullExtent) {\n return Math.min(resolution, Math.max(xResolution, yResolution));\n }\n return Math.min(resolution, Math.min(xResolution, yResolution));\n}\n\n/**\n * Returns a modified resolution to be between maxResolution and minResolution while\n * still allowing the value to be slightly out of bounds.\n * Note: the computation is based on the logarithm function (ln):\n * - at 1, ln(x) is 0\n * - above 1, ln(x) keeps increasing but at a much slower pace than x\n * The final result is clamped to prevent getting too far away from bounds.\n * @param {number} resolution Resolution.\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @return {number} Smoothed resolution.\n */\nfunction getSmoothClampedResolution(resolution, maxResolution, minResolution) {\n let result = Math.min(resolution, maxResolution);\n const ratio = 50;\n\n result *=\n Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio +\n 1;\n if (minResolution) {\n result = Math.max(result, minResolution);\n result /=\n Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) /\n ratio +\n 1;\n }\n return clamp(result, minResolution / 2, maxResolution * 2);\n}\n\n/**\n * @param {Array<number>} resolutions Resolutions.\n * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent=} opt_maxExtent Maximum allowed extent.\n * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToResolutions(\n resolutions,\n opt_smooth,\n opt_maxExtent,\n opt_showFullExtent\n) {\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, opt_isMoving) {\n if (resolution !== undefined) {\n const maxResolution = resolutions[0];\n const minResolution = resolutions[resolutions.length - 1];\n const cappedMaxRes = opt_maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n opt_maxExtent,\n size,\n opt_showFullExtent\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (opt_isMoving) {\n const smooth = opt_smooth !== undefined ? opt_smooth : true;\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution\n );\n }\n\n const capped = Math.min(cappedMaxRes, resolution);\n const z = Math.floor(linearFindNearest(resolutions, capped, direction));\n if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {\n return resolutions[z + 1];\n }\n return resolutions[z];\n } else {\n return undefined;\n }\n }\n );\n}\n\n/**\n * @param {number} power Power.\n * @param {number} maxResolution Maximum resolution.\n * @param {number=} opt_minResolution Minimum resolution.\n * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent=} opt_maxExtent Maximum allowed extent.\n * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToPower(\n power,\n maxResolution,\n opt_minResolution,\n opt_smooth,\n opt_maxExtent,\n opt_showFullExtent\n) {\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, opt_isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = opt_maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n opt_maxExtent,\n size,\n opt_showFullExtent\n )\n : maxResolution;\n const minResolution =\n opt_minResolution !== undefined ? opt_minResolution : 0;\n\n // during interacting or animating, allow intermediary values\n if (opt_isMoving) {\n const smooth = opt_smooth !== undefined ? opt_smooth : true;\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution\n );\n }\n\n const tolerance = 1e-9;\n const minZoomLevel = Math.ceil(\n Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance\n );\n const offset = -direction * (0.5 - tolerance) + 0.5;\n const capped = Math.min(cappedMaxRes, resolution);\n const cappedZoomLevel = Math.floor(\n Math.log(maxResolution / capped) / Math.log(power) + offset\n );\n const zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);\n const newResolution = maxResolution / Math.pow(power, zoomLevel);\n return clamp(newResolution, minResolution, cappedMaxRes);\n } else {\n return undefined;\n }\n }\n );\n}\n\n/**\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent=} opt_maxExtent Maximum allowed extent.\n * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createMinMaxResolution(\n maxResolution,\n minResolution,\n opt_smooth,\n opt_maxExtent,\n opt_showFullExtent\n) {\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, opt_isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = opt_maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n opt_maxExtent,\n size,\n opt_showFullExtent\n )\n : maxResolution;\n const smooth = opt_smooth !== undefined ? opt_smooth : true;\n\n if (!smooth || !opt_isMoving) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution\n );\n } else {\n return undefined;\n }\n }\n );\n}\n","/**\n * @module ol/rotationconstraint\n */\nimport {toRadians} from './math.js';\n\n/**\n * @typedef {function((number|undefined), boolean=): (number|undefined)} Type\n */\n\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function disable(rotation) {\n if (rotation !== undefined) {\n return 0;\n } else {\n return undefined;\n }\n}\n\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function none(rotation) {\n if (rotation !== undefined) {\n return rotation;\n } else {\n return undefined;\n }\n}\n\n/**\n * @param {number} n N.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToN(n) {\n const theta = (2 * Math.PI) / n;\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, opt_isMoving) {\n if (opt_isMoving) {\n return rotation;\n }\n\n if (rotation !== undefined) {\n rotation = Math.floor(rotation / theta + 0.5) * theta;\n return rotation;\n } else {\n return undefined;\n }\n }\n );\n}\n\n/**\n * @param {number=} opt_tolerance Tolerance.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToZero(opt_tolerance) {\n const tolerance = opt_tolerance || toRadians(5);\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, opt_isMoving) {\n if (opt_isMoving) {\n return rotation;\n }\n\n if (rotation !== undefined) {\n if (Math.abs(rotation) <= tolerance) {\n return 0;\n } else {\n return rotation;\n }\n } else {\n return undefined;\n }\n }\n );\n}\n","/**\n * @module ol/View\n */\nimport BaseObject from './Object.js';\nimport GeometryType from './geom/GeometryType.js';\nimport Units from './proj/Units.js';\nimport ViewHint from './ViewHint.js';\nimport ViewProperty from './ViewProperty.js';\nimport {DEFAULT_TILE_SIZE} from './tilegrid/common.js';\nimport {\n METERS_PER_UNIT,\n createProjection,\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from './proj.js';\nimport {VOID} from './functions.js';\nimport {\n add as addCoordinate,\n equals as coordinatesEqual,\n rotate as rotateCoordinate,\n} from './coordinate.js';\nimport {assert} from './asserts.js';\nimport {assign} from './obj.js';\nimport {none as centerNone, createExtent} from './centerconstraint.js';\nimport {clamp, modulo} from './math.js';\nimport {createMinMaxResolution} from './resolutionconstraint.js';\nimport {\n createSnapToN,\n createSnapToZero,\n disable,\n none as rotationNone,\n} from './rotationconstraint.js';\nimport {\n createSnapToPower,\n createSnapToResolutions,\n} from './resolutionconstraint.js';\nimport {easeOut} from './easing.js';\nimport {equals} from './coordinate.js';\nimport {\n getCenter,\n getForViewAndSize,\n getHeight,\n getWidth,\n isEmpty,\n} from './extent.js';\nimport {inAndOut} from './easing.js';\nimport {linearFindNearest} from './array.js';\nimport {fromExtent as polygonFromExtent} from './geom/Polygon.js';\n\n/**\n * An animation configuration\n *\n * @typedef {Object} Animation\n * @property {import(\"./coordinate.js\").Coordinate} [sourceCenter]\n * @property {import(\"./coordinate.js\").Coordinate} [targetCenter]\n * @property {number} [sourceResolution]\n * @property {number} [targetResolution]\n * @property {number} [sourceRotation]\n * @property {number} [targetRotation]\n * @property {import(\"./coordinate.js\").Coordinate} [anchor]\n * @property {number} start\n * @property {number} duration\n * @property {boolean} complete\n * @property {function(number):number} easing\n * @property {function(boolean):void} callback\n */\n\n/**\n * @typedef {Object} Constraints\n * @property {import(\"./centerconstraint.js\").Type} center\n * @property {import(\"./resolutionconstraint.js\").Type} resolution\n * @property {import(\"./rotationconstraint.js\").Type} rotation\n */\n\n/**\n * @typedef {Object} FitOptions\n * @property {import(\"./size.js\").Size} [size] The size in pixels of the box to fit\n * the extent into. Default is the current size of the first map in the DOM that\n * uses this view, or `[100, 100]` if no such map is found.\n * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be\n * cleared inside the view. Values in the array are top, right, bottom and left\n * padding.\n * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,\n * get the nearest extent instead of the closest that actually fits the view.\n * @property {number} [minResolution=0] Minimum resolution that we zoom to.\n * @property {number} [maxZoom] Maximum zoom level that we zoom to. If\n * `minResolution` is given, this property is ignored.\n * @property {number} [duration] The duration of the animation in milliseconds.\n * By default, there is no animation to the target extent.\n * @property {function(number):number} [easing] The easing function used during\n * the animation (defaults to {@link module:ol/easing~inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n * @property {function(boolean):void} [callback] Function called when the view is in\n * its final position. The callback will be called with `true` if the animation\n * series completed on its own or `false` if it was cancelled.\n */\n\n/**\n * @typedef {Object} ViewOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The initial center for\n * the view. If a user projection is not set, the coordinate system for the center is\n * specified with the `projection` option. Layer sources will not be fetched if this\n * is not set, but the center can be set later with {@link #setCenter}.\n * @property {boolean|number} [constrainRotation=true] Rotation constraint.\n * `false` means no constraint. `true` means no constraint, but snap to zero\n * near zero. A number constrains the rotation to that number of values. For\n * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.\n * @property {boolean} [enableRotation=true] Enable rotation.\n * If `false`, a rotation constraint that always sets the rotation to zero is\n * used. The `constrainRotation` option has no effect if `enableRotation` is\n * `false`.\n * @property {import(\"./extent.js\").Extent} [extent] The extent that constrains the\n * view, in other words, nothing outside of this extent can be visible on the map.\n * @property {boolean} [constrainOnlyCenter=false] If true, the extent\n * constraint will only apply to the view center and not the whole extent.\n * @property {boolean} [smoothExtentConstraint=true] If true, the extent\n * constraint will be applied smoothly, i.e. allow the view to go slightly outside\n * of the given `extent`.\n * @property {number} [maxResolution] The maximum resolution used to determine\n * the resolution constraint. It is used together with `minResolution` (or\n * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way\n * that the projection's validity extent fits in a 256x256 px tile. If the\n * projection is Spherical Mercator (the default) then `maxResolution` defaults\n * to `40075016.68557849 / 256 = 156543.03392804097`.\n * @property {number} [minResolution] The minimum resolution used to determine\n * the resolution constraint. It is used together with `maxResolution` (or\n * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29\n * zoom levels (with a factor of 2). If the projection is Spherical Mercator\n * (the default) then `minResolution` defaults to\n * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.\n * @property {number} [maxZoom=28] The maximum zoom level used to determine the\n * resolution constraint. It is used together with `minZoom` (or\n * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also\n * provided, it is given precedence over `maxZoom`.\n * @property {number} [minZoom=0] The minimum zoom level used to determine the\n * resolution constraint. It is used together with `maxZoom` (or\n * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also\n * provided, it is given precedence over `minZoom`.\n * @property {boolean} [multiWorld=false] If `false` the view is constrained so\n * only one world is visible, and you cannot pan off the edge. If `true` the map\n * may show multiple worlds at low zoom levels. Only used if the `projection` is\n * global. Note that if `extent` is also provided it is given precedence.\n * @property {boolean} [constrainResolution=false] If true, the view will always\n * animate to the closest zoom level after an interaction; false means\n * intermediary zoom levels are allowed.\n * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution\n * min/max values will be applied smoothly, i. e. allow the view to exceed slightly\n * the given resolution or zoom bounds.\n * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to\n * show the full configured extent. By default, when a view is configured with an\n * extent, users will not be able to zoom out so the viewport exceeds the extent in\n * either dimension. This means the full extent may not be visible if the viewport\n * is taller or wider than the aspect ratio of the configured extent. If\n * showFullExtent is true, the user will be able to zoom out so that the viewport\n * exceeds the height or width of the configured extent, but not both, allowing the\n * full extent to be shown.\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857'] The\n * projection. The default is Spherical Mercator.\n * @property {number} [resolution] The initial resolution for the view. The\n * units are `projection` units per pixel (e.g. meters per pixel). An\n * alternative to setting this is to set `zoom`. Layer sources will not be\n * fetched if neither this nor `zoom` are defined, but they can be set later\n * with {@link #setZoom} or {@link #setResolution}.\n * @property {Array<number>} [resolutions] Resolutions to determine the\n * resolution constraint. If set the `maxResolution`, `minResolution`,\n * `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.\n * @property {number} [rotation=0] The initial rotation for the view in radians\n * (positive rotation clockwise, 0 means North).\n * @property {number} [zoom] Only used if `resolution` is not defined. Zoom\n * level used to calculate the initial resolution for the view.\n * @property {number} [zoomFactor=2] The zoom factor used to compute the\n * corresponding resolution.\n */\n\n/**\n * @typedef {Object} AnimationOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The center of the view at the end of\n * the animation.\n * @property {number} [zoom] The zoom level of the view at the end of the\n * animation. This takes precedence over `resolution`.\n * @property {number} [resolution] The resolution of the view at the end\n * of the animation. If `zoom` is also provided, this option will be ignored.\n * @property {number} [rotation] The rotation of the view at the end of\n * the animation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Optional anchor to remain fixed\n * during a rotation or resolution animation.\n * @property {number} [duration=1000] The duration of the animation in milliseconds.\n * @property {function(number):number} [easing] The easing function used\n * during the animation (defaults to {@link module:ol/easing~inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./coordinate.js\").Coordinate} center\n * @property {import(\"./proj/Projection.js\").default} projection\n * @property {number} resolution\n * @property {number} rotation\n * @property {number} zoom\n */\n\n/**\n * Default min zoom level for the map view.\n * @type {number}\n */\nconst DEFAULT_MIN_ZOOM = 0;\n\n/**\n * @classdesc\n * A View object represents a simple 2D view of the map.\n *\n * This is the object to act upon to change the center, resolution,\n * and rotation of the map.\n *\n * A View has a `projection`. The projection determines the\n * coordinate system of the center, and its units determine the units of the\n * resolution (projection units per pixel). The default projection is\n * Spherical Mercator (EPSG:3857).\n *\n * ### The view states\n *\n * A View is determined by three states: `center`, `resolution`,\n * and `rotation`. Each state has a corresponding getter and setter, e.g.\n * `getCenter` and `setCenter` for the `center` state.\n *\n * The `zoom` state is actually not saved on the view: all computations\n * internally use the `resolution` state. Still, the `setZoom` and `getZoom`\n * methods are available, as well as `getResolutionForZoom` and\n * `getZoomForResolution` to switch from one system to the other.\n *\n * ### The constraints\n *\n * `setCenter`, `setResolution` and `setRotation` can be used to change the\n * states of the view, but any constraint defined in the constructor will\n * be applied along the way.\n *\n * A View object can have a *resolution constraint*, a *rotation constraint*\n * and a *center constraint*.\n *\n * The *resolution constraint* typically restricts min/max values and\n * snaps to specific resolutions. It is determined by the following\n * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.\n * If `resolutions` is set, the other three options are ignored. See\n * documentation for each option for more information. By default, the view\n * only has a min/max restriction and allow intermediary zoom levels when\n * pinch-zooming for example.\n *\n * The *rotation constraint* snaps to specific angles. It is determined\n * by the following options: `enableRotation` and `constrainRotation`.\n * By default rotation is allowed and its value is snapped to zero when approaching the\n * horizontal.\n *\n * The *center constraint* is determined by the `extent` option. By\n * default the view center is not constrained at all.\n *\n * ### Changing the view state\n *\n * It is important to note that `setZoom`, `setResolution`, `setCenter` and\n * `setRotation` are subject to the above mentioned constraints. As such, it\n * may sometimes not be possible to know in advance the resulting state of the\n * View. For example, calling `setResolution(10)` does not guarantee that\n * `getResolution()` will return `10`.\n *\n * A consequence of this is that, when applying a delta on the view state, one\n * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`\n * rather than the corresponding setters. This will let view do its internal\n * computations. Besides, the `adjust*` methods also take an `opt_anchor`\n * argument which allows specifying an origin for the transformation.\n *\n * ### Interacting with the view\n *\n * View constraints are usually only applied when the view is *at rest*, meaning that\n * no interaction or animation is ongoing. As such, if the user puts the view in a\n * state that is not equivalent to a constrained one (e.g. rotating the view when\n * the snap angle is 0), an animation will be triggered at the interaction end to\n * put back the view to a stable state;\n *\n * @api\n */\nclass View extends BaseObject {\n /**\n * @param {ViewOptions=} opt_options View options.\n */\n constructor(opt_options) {\n super();\n\n const options = assign({}, opt_options);\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.hints_ = [0, 0];\n\n /**\n * @private\n * @type {Array<Array<Animation>>}\n */\n this.animations_ = [];\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.updateAnimationKey_;\n\n /**\n * @private\n * @const\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection_ = createProjection(options.projection, 'EPSG:3857');\n\n /**\n * @private\n * @type {import(\"./size.js\").Size}\n */\n this.viewportSize_ = [100, 100];\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.targetCenter_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetResolution_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.cancelAnchor_ = undefined;\n\n if (options.center) {\n options.center = fromUserCoordinate(options.center, this.projection_);\n }\n if (options.extent) {\n options.extent = fromUserExtent(options.extent, this.projection_);\n }\n\n this.applyOptions_(options);\n }\n\n /**\n * Set up the view with the given options.\n * @param {ViewOptions} options View options.\n */\n applyOptions_(options) {\n /**\n * @type {Object<string, *>}\n */\n const properties = {};\n\n const resolutionConstraintInfo = createResolutionConstraint(options);\n\n /**\n * @private\n * @type {number}\n */\n this.maxResolution_ = resolutionConstraintInfo.maxResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.minResolution_ = resolutionConstraintInfo.minResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;\n\n /**\n * @private\n * @type {Array<number>|undefined}\n */\n this.resolutions_ = options.resolutions;\n\n /**\n * @private\n * @type {number}\n */\n this.minZoom_ = resolutionConstraintInfo.minZoom;\n\n const centerConstraint = createCenterConstraint(options);\n const resolutionConstraint = resolutionConstraintInfo.constraint;\n const rotationConstraint = createRotationConstraint(options);\n\n /**\n * @private\n * @type {Constraints}\n */\n this.constraints_ = {\n center: centerConstraint,\n resolution: resolutionConstraint,\n rotation: rotationConstraint,\n };\n\n this.setRotation(options.rotation !== undefined ? options.rotation : 0);\n this.setCenterInternal(\n options.center !== undefined ? options.center : null\n );\n if (options.resolution !== undefined) {\n this.setResolution(options.resolution);\n } else if (options.zoom !== undefined) {\n this.setZoom(options.zoom);\n }\n\n this.setProperties(properties);\n\n /**\n * @private\n * @type {ViewOptions}\n */\n this.options_ = options;\n }\n\n /**\n * Get an updated version of the view options used to construct the view. The\n * current resolution (or zoom), center, and rotation are applied to any stored\n * options. The provided options can be used to apply new min/max zoom or\n * resolution limits.\n * @param {ViewOptions} newOptions New options to be applied.\n * @return {ViewOptions} New options updated with the current view state.\n */\n getUpdatedOptions_(newOptions) {\n const options = assign({}, this.options_);\n\n // preserve resolution (or zoom)\n if (options.resolution !== undefined) {\n options.resolution = this.getResolution();\n } else {\n options.zoom = this.getZoom();\n }\n\n // preserve center\n options.center = this.getCenterInternal();\n\n // preserve rotation\n options.rotation = this.getRotation();\n\n return assign({}, options, newOptions);\n }\n\n /**\n * Animate the view. The view's center, zoom (or resolution), and rotation\n * can be animated for smooth transitions between view states. For example,\n * to animate the view to a new zoom level:\n *\n * view.animate({zoom: view.getZoom() + 1});\n *\n * By default, the animation lasts one second and uses in-and-out easing. You\n * can customize this behavior by including `duration` (in milliseconds) and\n * `easing` options (see {@link module:ol/easing}).\n *\n * To chain together multiple animations, call the method with multiple\n * animation objects. For example, to first zoom and then pan:\n *\n * view.animate({zoom: 10}, {center: [0, 0]});\n *\n * If you provide a function as the last argument to the animate method, it\n * will get called at the end of an animation series. The callback will be\n * called with `true` if the animation series completed on its own or `false`\n * if it was cancelled.\n *\n * Animations are cancelled by user interactions (e.g. dragging the map) or by\n * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`\n * (or another method that calls one of these).\n *\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation\n * options. Multiple animations can be run in series by passing multiple\n * options objects. To run multiple animations in parallel, call the method\n * multiple times. An optional callback can be provided as a final\n * argument. The callback will be called with a boolean indicating whether\n * the animation completed without being cancelled.\n * @api\n */\n animate(var_args) {\n if (this.isDef() && !this.getAnimating()) {\n this.resolveConstraints(0);\n }\n const args = new Array(arguments.length);\n for (let i = 0; i < args.length; ++i) {\n let options = arguments[i];\n if (options.center) {\n options = assign({}, options);\n options.center = fromUserCoordinate(\n options.center,\n this.getProjection()\n );\n }\n if (options.anchor) {\n options = assign({}, options);\n options.anchor = fromUserCoordinate(\n options.anchor,\n this.getProjection()\n );\n }\n args[i] = options;\n }\n this.animateInternal.apply(this, args);\n }\n\n /**\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.\n */\n animateInternal(var_args) {\n let animationCount = arguments.length;\n let callback;\n if (\n animationCount > 1 &&\n typeof arguments[animationCount - 1] === 'function'\n ) {\n callback = arguments[animationCount - 1];\n --animationCount;\n }\n if (!this.isDef()) {\n // if view properties are not yet set, shortcut to the final state\n const state = arguments[animationCount - 1];\n if (state.center) {\n this.setCenterInternal(state.center);\n }\n if (state.zoom !== undefined) {\n this.setZoom(state.zoom);\n }\n if (state.rotation !== undefined) {\n this.setRotation(state.rotation);\n }\n if (callback) {\n animationCallback(callback, true);\n }\n return;\n }\n let start = Date.now();\n let center = this.targetCenter_.slice();\n let resolution = this.targetResolution_;\n let rotation = this.targetRotation_;\n const series = [];\n for (let i = 0; i < animationCount; ++i) {\n const options = /** @type {AnimationOptions} */ (arguments[i]);\n\n const animation = {\n start: start,\n complete: false,\n anchor: options.anchor,\n duration: options.duration !== undefined ? options.duration : 1000,\n easing: options.easing || inAndOut,\n callback: callback,\n };\n\n if (options.center) {\n animation.sourceCenter = center;\n animation.targetCenter = options.center.slice();\n center = animation.targetCenter;\n }\n\n if (options.zoom !== undefined) {\n animation.sourceResolution = resolution;\n animation.targetResolution = this.getResolutionForZoom(options.zoom);\n resolution = animation.targetResolution;\n } else if (options.resolution) {\n animation.sourceResolution = resolution;\n animation.targetResolution = options.resolution;\n resolution = animation.targetResolution;\n }\n\n if (options.rotation !== undefined) {\n animation.sourceRotation = rotation;\n const delta =\n modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;\n animation.targetRotation = rotation + delta;\n rotation = animation.targetRotation;\n }\n\n // check if animation is a no-op\n if (isNoopAnimation(animation)) {\n animation.complete = true;\n // we still push it onto the series for callback handling\n } else {\n start += animation.duration;\n }\n series.push(animation);\n }\n this.animations_.push(series);\n this.setHint(ViewHint.ANIMATING, 1);\n this.updateAnimations_();\n }\n\n /**\n * Determine if the view is being animated.\n * @return {boolean} The view is being animated.\n * @api\n */\n getAnimating() {\n return this.hints_[ViewHint.ANIMATING] > 0;\n }\n\n /**\n * Determine if the user is interacting with the view, such as panning or zooming.\n * @return {boolean} The view is being interacted with.\n * @api\n */\n getInteracting() {\n return this.hints_[ViewHint.INTERACTING] > 0;\n }\n\n /**\n * Cancel any ongoing animations.\n * @api\n */\n cancelAnimations() {\n this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);\n let anchor;\n for (let i = 0, ii = this.animations_.length; i < ii; ++i) {\n const series = this.animations_[i];\n if (series[0].callback) {\n animationCallback(series[0].callback, false);\n }\n if (!anchor) {\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (!animation.complete) {\n anchor = animation.anchor;\n break;\n }\n }\n }\n }\n this.animations_.length = 0;\n this.cancelAnchor_ = anchor;\n }\n\n /**\n * Update all animations.\n */\n updateAnimations_() {\n if (this.updateAnimationKey_ !== undefined) {\n cancelAnimationFrame(this.updateAnimationKey_);\n this.updateAnimationKey_ = undefined;\n }\n if (!this.getAnimating()) {\n return;\n }\n const now = Date.now();\n let more = false;\n for (let i = this.animations_.length - 1; i >= 0; --i) {\n const series = this.animations_[i];\n let seriesComplete = true;\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (animation.complete) {\n continue;\n }\n const elapsed = now - animation.start;\n let fraction =\n animation.duration > 0 ? elapsed / animation.duration : 1;\n if (fraction >= 1) {\n animation.complete = true;\n fraction = 1;\n } else {\n seriesComplete = false;\n }\n const progress = animation.easing(fraction);\n if (animation.sourceCenter) {\n const x0 = animation.sourceCenter[0];\n const y0 = animation.sourceCenter[1];\n const x1 = animation.targetCenter[0];\n const y1 = animation.targetCenter[1];\n const x = x0 + progress * (x1 - x0);\n const y = y0 + progress * (y1 - y0);\n this.targetCenter_ = [x, y];\n }\n if (animation.sourceResolution && animation.targetResolution) {\n const resolution =\n progress === 1\n ? animation.targetResolution\n : animation.sourceResolution +\n progress *\n (animation.targetResolution - animation.sourceResolution);\n if (animation.anchor) {\n const size = this.getViewportSize_(this.getRotation());\n const constrainedResolution = this.constraints_.resolution(\n resolution,\n 0,\n size,\n true\n );\n this.targetCenter_ = this.calculateCenterZoom(\n constrainedResolution,\n animation.anchor\n );\n }\n this.targetResolution_ = resolution;\n this.applyTargetState_(true);\n }\n if (\n animation.sourceRotation !== undefined &&\n animation.targetRotation !== undefined\n ) {\n const rotation =\n progress === 1\n ? modulo(animation.targetRotation + Math.PI, 2 * Math.PI) -\n Math.PI\n : animation.sourceRotation +\n progress *\n (animation.targetRotation - animation.sourceRotation);\n if (animation.anchor) {\n const constrainedRotation = this.constraints_.rotation(\n rotation,\n true\n );\n this.targetCenter_ = this.calculateCenterRotate(\n constrainedRotation,\n animation.anchor\n );\n }\n this.targetRotation_ = rotation;\n }\n this.applyTargetState_(true);\n more = true;\n if (!animation.complete) {\n break;\n }\n }\n if (seriesComplete) {\n this.animations_[i] = null;\n this.setHint(ViewHint.ANIMATING, -1);\n const callback = series[0].callback;\n if (callback) {\n animationCallback(callback, true);\n }\n }\n }\n // prune completed series\n this.animations_ = this.animations_.filter(Boolean);\n if (more && this.updateAnimationKey_ === undefined) {\n this.updateAnimationKey_ = requestAnimationFrame(\n this.updateAnimations_.bind(this)\n );\n }\n }\n\n /**\n * @param {number} rotation Target rotation.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Rotation anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for rotation and anchor.\n */\n calculateCenterRotate(rotation, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n if (currentCenter !== undefined) {\n center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];\n rotateCoordinate(center, rotation - this.getRotation());\n addCoordinate(center, anchor);\n }\n return center;\n }\n\n /**\n * @param {number} resolution Target resolution.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Zoom anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for resolution and anchor.\n */\n calculateCenterZoom(resolution, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n const currentResolution = this.getResolution();\n if (currentCenter !== undefined && currentResolution !== undefined) {\n const x =\n anchor[0] -\n (resolution * (anchor[0] - currentCenter[0])) / currentResolution;\n const y =\n anchor[1] -\n (resolution * (anchor[1] - currentCenter[1])) / currentResolution;\n center = [x, y];\n }\n return center;\n }\n\n /**\n * Returns the current viewport size.\n * @private\n * @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size or `[100, 100]` when no viewport is found.\n */\n getViewportSize_(opt_rotation) {\n const size = this.viewportSize_;\n if (opt_rotation) {\n const w = size[0];\n const h = size[1];\n return [\n Math.abs(w * Math.cos(opt_rotation)) +\n Math.abs(h * Math.sin(opt_rotation)),\n Math.abs(w * Math.sin(opt_rotation)) +\n Math.abs(h * Math.cos(opt_rotation)),\n ];\n } else {\n return size;\n }\n }\n\n /**\n * Stores the viewport size on the view. The viewport size is not read every time from the DOM\n * to avoid performance hit and layout reflow.\n * This should be done on map size change.\n * Note: the constraints are not resolved during an animation to avoid stopping it\n * @param {import(\"./size.js\").Size=} opt_size Viewport size; if undefined, [100, 100] is assumed\n */\n setViewportSize(opt_size) {\n this.viewportSize_ = Array.isArray(opt_size)\n ? opt_size.slice()\n : [100, 100];\n if (!this.getAnimating()) {\n this.resolveConstraints(0);\n }\n }\n\n /**\n * Get the view center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n * @observable\n * @api\n */\n getCenter() {\n const center = this.getCenterInternal();\n if (!center) {\n return center;\n }\n return toUserCoordinate(center, this.getProjection());\n }\n\n /**\n * Get the view center without transforming to user projection.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n */\n getCenterInternal() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (this.get(\n ViewProperty.CENTER\n ));\n }\n\n /**\n * @return {Constraints} Constraints.\n */\n getConstraints() {\n return this.constraints_;\n }\n\n /**\n * @return {boolean} Resolution constraint is set\n */\n getConstrainResolution() {\n return this.options_.constrainResolution;\n }\n\n /**\n * @param {Array<number>=} opt_hints Destination array.\n * @return {Array<number>} Hint.\n */\n getHints(opt_hints) {\n if (opt_hints !== undefined) {\n opt_hints[0] = this.hints_[0];\n opt_hints[1] = this.hints_[1];\n return opt_hints;\n } else {\n return this.hints_.slice();\n }\n }\n\n /**\n * Calculate the extent for the current view state and the passed size.\n * The size is the pixel dimensions of the box into which the calculated extent\n * should fit. In most cases you want to get the extent of the entire map,\n * that is `map.getSize()`.\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size. If not provided, the size\n * of the map that uses this view will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n * @api\n */\n calculateExtent(opt_size) {\n const extent = this.calculateExtentInternal(opt_size);\n return toUserExtent(extent, this.getProjection());\n }\n\n /**\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size. If not provided, the size of the\n * first map that uses this view will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n calculateExtentInternal(opt_size) {\n const size = opt_size || this.getViewportSize_();\n const center = /** @type {!import(\"./coordinate.js\").Coordinate} */ (this.getCenterInternal());\n assert(center, 1); // The view center is not defined\n const resolution = /** @type {!number} */ (this.getResolution());\n assert(resolution !== undefined, 2); // The view resolution is not defined\n const rotation = /** @type {!number} */ (this.getRotation());\n assert(rotation !== undefined, 3); // The view rotation is not defined\n\n return getForViewAndSize(center, resolution, rotation, size);\n }\n\n /**\n * Get the maximum resolution of the view.\n * @return {number} The maximum resolution of the view.\n * @api\n */\n getMaxResolution() {\n return this.maxResolution_;\n }\n\n /**\n * Get the minimum resolution of the view.\n * @return {number} The minimum resolution of the view.\n * @api\n */\n getMinResolution() {\n return this.minResolution_;\n }\n\n /**\n * Get the maximum zoom level for the view.\n * @return {number} The maximum zoom level.\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (this.getZoomForResolution(\n this.minResolution_\n ));\n }\n\n /**\n * Set a new maximum zoom level for the view.\n * @param {number} zoom The maximum zoom level.\n * @api\n */\n setMaxZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));\n }\n\n /**\n * Get the minimum zoom level for the view.\n * @return {number} The minimum zoom level.\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (this.getZoomForResolution(\n this.maxResolution_\n ));\n }\n\n /**\n * Set a new minimum zoom level for the view.\n * @param {number} zoom The minimum zoom level.\n * @api\n */\n setMinZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));\n }\n\n /**\n * Set whether the view shoud allow intermediary zoom levels.\n * @param {boolean} enabled Whether the resolution is constrained.\n * @api\n */\n setConstrainResolution(enabled) {\n this.applyOptions_(this.getUpdatedOptions_({constrainResolution: enabled}));\n }\n\n /**\n * Get the view projection.\n * @return {import(\"./proj/Projection.js\").default} The projection of the view.\n * @api\n */\n getProjection() {\n return this.projection_;\n }\n\n /**\n * Get the view resolution.\n * @return {number|undefined} The resolution of the view.\n * @observable\n * @api\n */\n getResolution() {\n return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));\n }\n\n /**\n * Get the resolutions for the view. This returns the array of resolutions\n * passed to the constructor of the View, or undefined if none were given.\n * @return {Array<number>|undefined} The resolutions of the view.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n * @api\n */\n getResolutionForExtent(extent, opt_size) {\n return this.getResolutionForExtentInternal(\n fromUserExtent(extent, this.getProjection()),\n opt_size\n );\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size=} opt_size Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n */\n getResolutionForExtentInternal(extent, opt_size) {\n const size = opt_size || this.getViewportSize_();\n const xResolution = getWidth(extent) / size[0];\n const yResolution = getHeight(extent) / size[1];\n return Math.max(xResolution, yResolution);\n }\n\n /**\n * Return a function that returns a value between 0 and 1 for a\n * resolution. Exponential scaling is assumed.\n * @param {number=} opt_power Power.\n * @return {function(number): number} Resolution for value function.\n */\n getResolutionForValueFunction(opt_power) {\n const power = opt_power || 2;\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} value Value.\n * @return {number} Resolution.\n */\n function (value) {\n const resolution = maxResolution / Math.pow(power, value * max);\n return resolution;\n }\n );\n }\n\n /**\n * Get the view rotation.\n * @return {number} The rotation of the view in radians.\n * @observable\n * @api\n */\n getRotation() {\n return /** @type {number} */ (this.get(ViewProperty.ROTATION));\n }\n\n /**\n * Return a function that returns a resolution for a value between\n * 0 and 1. Exponential scaling is assumed.\n * @param {number=} opt_power Power.\n * @return {function(number): number} Value for resolution function.\n */\n getValueForResolutionFunction(opt_power) {\n const logPower = Math.log(opt_power || 2);\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / logPower;\n return (\n /**\n * @param {number} resolution Resolution.\n * @return {number} Value.\n */\n function (resolution) {\n const value = Math.log(maxResolution / resolution) / logPower / max;\n return value;\n }\n );\n }\n\n /**\n * @return {State} View state.\n */\n getState() {\n const center = /** @type {import(\"./coordinate.js\").Coordinate} */ (this.getCenterInternal());\n const projection = this.getProjection();\n const resolution = /** @type {number} */ (this.getResolution());\n const rotation = this.getRotation();\n return {\n center: center.slice(0),\n projection: projection !== undefined ? projection : null,\n resolution: resolution,\n rotation: rotation,\n zoom: this.getZoom(),\n };\n }\n\n /**\n * Get the current zoom level. This method may return non-integer zoom levels\n * if the view does not constrain the resolution, or if an interaction or\n * animation is underway.\n * @return {number|undefined} Zoom.\n * @api\n */\n getZoom() {\n let zoom;\n const resolution = this.getResolution();\n if (resolution !== undefined) {\n zoom = this.getZoomForResolution(resolution);\n }\n return zoom;\n }\n\n /**\n * Get the zoom level for a resolution.\n * @param {number} resolution The resolution.\n * @return {number|undefined} The zoom level for the provided resolution.\n * @api\n */\n getZoomForResolution(resolution) {\n let offset = this.minZoom_ || 0;\n let max, zoomFactor;\n if (this.resolutions_) {\n const nearest = linearFindNearest(this.resolutions_, resolution, 1);\n offset = nearest;\n max = this.resolutions_[nearest];\n if (nearest == this.resolutions_.length - 1) {\n zoomFactor = 2;\n } else {\n zoomFactor = max / this.resolutions_[nearest + 1];\n }\n } else {\n max = this.maxResolution_;\n zoomFactor = this.zoomFactor_;\n }\n return offset + Math.log(max / resolution) / Math.log(zoomFactor);\n }\n\n /**\n * Get the resolution for a zoom level.\n * @param {number} zoom Zoom level.\n * @return {number} The view resolution for the provided zoom level.\n * @api\n */\n getResolutionForZoom(zoom) {\n if (this.resolutions_) {\n if (this.resolutions_.length <= 1) {\n return 0;\n }\n const baseLevel = clamp(\n Math.floor(zoom),\n 0,\n this.resolutions_.length - 2\n );\n const zoomFactor =\n this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];\n return (\n this.resolutions_[baseLevel] /\n Math.pow(zoomFactor, clamp(zoom - baseLevel, 0, 1))\n );\n } else {\n return (\n this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_)\n );\n }\n }\n\n /**\n * Fit the given geometry or extent based on the given map size and border.\n * The size is pixel dimensions of the box to fit the extent into.\n * In most cases you will want to use the map size, that is `map.getSize()`.\n * Takes care of the map angle.\n * @param {import(\"./geom/SimpleGeometry.js\").default|import(\"./extent.js\").Extent} geometryOrExtent The geometry or\n * extent to fit the view to.\n * @param {FitOptions=} opt_options Options.\n * @api\n */\n fit(geometryOrExtent, opt_options) {\n const options = assign({size: this.getViewportSize_()}, opt_options || {});\n\n /** @type {import(\"./geom/SimpleGeometry.js\").default} */\n let geometry;\n assert(\n Array.isArray(geometryOrExtent) ||\n typeof (/** @type {?} */ (geometryOrExtent).getSimplifiedGeometry) ===\n 'function',\n 24\n ); // Invalid extent or geometry provided as `geometry`\n if (Array.isArray(geometryOrExtent)) {\n assert(!isEmpty(geometryOrExtent), 25); // Cannot fit empty extent provided as `geometry`\n const extent = fromUserExtent(geometryOrExtent, this.getProjection());\n geometry = polygonFromExtent(extent);\n } else if (geometryOrExtent.getType() === GeometryType.CIRCLE) {\n const extent = fromUserExtent(\n geometryOrExtent.getExtent(),\n this.getProjection()\n );\n geometry = polygonFromExtent(extent);\n geometry.rotate(this.getRotation(), getCenter(extent));\n } else {\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (geometryOrExtent\n .clone()\n .transform(userProjection, this.getProjection()));\n } else {\n geometry = geometryOrExtent;\n }\n }\n\n this.fitInternal(geometry, options);\n }\n\n /**\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @param {FitOptions=} opt_options Options.\n */\n fitInternal(geometry, opt_options) {\n const options = opt_options || {};\n let size = options.size;\n if (!size) {\n size = this.getViewportSize_();\n }\n const padding =\n options.padding !== undefined ? options.padding : [0, 0, 0, 0];\n const nearest = options.nearest !== undefined ? options.nearest : false;\n let minResolution;\n if (options.minResolution !== undefined) {\n minResolution = options.minResolution;\n } else if (options.maxZoom !== undefined) {\n minResolution = this.getResolutionForZoom(options.maxZoom);\n } else {\n minResolution = 0;\n }\n const coords = geometry.getFlatCoordinates();\n\n // calculate rotated extent\n const rotation = this.getRotation();\n const cosAngle = Math.cos(-rotation);\n let sinAngle = Math.sin(-rotation);\n let minRotX = +Infinity;\n let minRotY = +Infinity;\n let maxRotX = -Infinity;\n let maxRotY = -Infinity;\n const stride = geometry.getStride();\n for (let i = 0, ii = coords.length; i < ii; i += stride) {\n const rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;\n const rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;\n minRotX = Math.min(minRotX, rotX);\n minRotY = Math.min(minRotY, rotY);\n maxRotX = Math.max(maxRotX, rotX);\n maxRotY = Math.max(maxRotY, rotY);\n }\n\n // calculate resolution\n let resolution = this.getResolutionForExtentInternal(\n [minRotX, minRotY, maxRotX, maxRotY],\n [size[0] - padding[1] - padding[3], size[1] - padding[0] - padding[2]]\n );\n resolution = isNaN(resolution)\n ? minResolution\n : Math.max(resolution, minResolution);\n resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);\n\n // calculate center\n sinAngle = -sinAngle; // go back to original rotation\n let centerRotX = (minRotX + maxRotX) / 2;\n let centerRotY = (minRotY + maxRotY) / 2;\n centerRotX += ((padding[1] - padding[3]) / 2) * resolution;\n centerRotY += ((padding[0] - padding[2]) / 2) * resolution;\n const centerX = centerRotX * cosAngle - centerRotY * sinAngle;\n const centerY = centerRotY * cosAngle + centerRotX * sinAngle;\n const center = [centerX, centerY];\n const callback = options.callback ? options.callback : VOID;\n\n if (options.duration !== undefined) {\n this.animateInternal(\n {\n resolution: resolution,\n center: this.getConstrainedCenter(center, resolution),\n duration: options.duration,\n easing: options.easing,\n },\n callback\n );\n } else {\n this.targetResolution_ = resolution;\n this.targetCenter_ = center;\n this.applyTargetState_(false, true);\n animationCallback(callback, true);\n }\n }\n\n /**\n * Center on coordinate and view position.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @api\n */\n centerOn(coordinate, size, position) {\n this.centerOnInternal(\n fromUserCoordinate(coordinate, this.getProjection()),\n size,\n position\n );\n }\n\n /**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n */\n centerOnInternal(coordinate, size, position) {\n // calculate rotated position\n const rotation = this.getRotation();\n const cosAngle = Math.cos(-rotation);\n let sinAngle = Math.sin(-rotation);\n let rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n let rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n const resolution = this.getResolution();\n rotX += (size[0] / 2 - position[0]) * resolution;\n rotY += (position[1] - size[1] / 2) * resolution;\n\n // go back to original angle\n sinAngle = -sinAngle; // go back to original rotation\n const centerX = rotX * cosAngle - rotY * sinAngle;\n const centerY = rotY * cosAngle + rotX * sinAngle;\n\n this.setCenterInternal([centerX, centerY]);\n }\n\n /**\n * @return {boolean} Is defined.\n */\n isDef() {\n return !!this.getCenterInternal() && this.getResolution() !== undefined;\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n * @api\n */\n adjustCenter(deltaCoordinates) {\n const center = toUserCoordinate(this.targetCenter_, this.getProjection());\n this.setCenter([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n */\n adjustCenterInternal(deltaCoordinates) {\n const center = this.targetCenter_;\n this.setCenterInternal([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n * @api\n */\n adjustResolution(ratio, opt_anchor) {\n const anchor =\n opt_anchor && fromUserCoordinate(opt_anchor, this.getProjection());\n this.adjustResolutionInternal(ratio, anchor);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n */\n adjustResolutionInternal(ratio, opt_anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const size = this.getViewportSize_(this.getRotation());\n const newResolution = this.constraints_.resolution(\n this.targetResolution_ * ratio,\n 0,\n size,\n isMoving\n );\n\n if (opt_anchor) {\n this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);\n }\n\n this.targetResolution_ *= ratio;\n this.applyTargetState_();\n }\n\n /**\n * Adds a value to the view zoom level, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom level.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n * @api\n */\n adjustZoom(delta, opt_anchor) {\n this.adjustResolution(Math.pow(this.zoomFactor_, -delta), opt_anchor);\n }\n\n /**\n * Adds a value to the view rotation, optionally using an anchor. Any rotation\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The rotation center.\n * @api\n */\n adjustRotation(delta, opt_anchor) {\n if (opt_anchor) {\n opt_anchor = fromUserCoordinate(opt_anchor, this.getProjection());\n }\n this.adjustRotationInternal(delta, opt_anchor);\n }\n\n /**\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The rotation center.\n */\n adjustRotationInternal(delta, opt_anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const newRotation = this.constraints_.rotation(\n this.targetRotation_ + delta,\n isMoving\n );\n if (opt_anchor) {\n this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);\n }\n this.targetRotation_ += delta;\n this.applyTargetState_();\n }\n\n /**\n * Set the center of the current view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n * @observable\n * @api\n */\n setCenter(center) {\n this.setCenterInternal(fromUserCoordinate(center, this.getProjection()));\n }\n\n /**\n * Set the center using the view projection (not the user projection).\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n */\n setCenterInternal(center) {\n this.targetCenter_ = center;\n this.applyTargetState_();\n }\n\n /**\n * @param {import(\"./ViewHint.js\").default} hint Hint.\n * @param {number} delta Delta.\n * @return {number} New value.\n */\n setHint(hint, delta) {\n this.hints_[hint] += delta;\n this.changed();\n return this.hints_[hint];\n }\n\n /**\n * Set the resolution for this view. Any resolution constraint will apply.\n * @param {number|undefined} resolution The resolution of the view.\n * @observable\n * @api\n */\n setResolution(resolution) {\n this.targetResolution_ = resolution;\n this.applyTargetState_();\n }\n\n /**\n * Set the rotation for this view. Any rotation constraint will apply.\n * @param {number} rotation The rotation of the view in radians.\n * @observable\n * @api\n */\n setRotation(rotation) {\n this.targetRotation_ = rotation;\n this.applyTargetState_();\n }\n\n /**\n * Zoom to a specific zoom level. Any resolution constrain will apply.\n * @param {number} zoom Zoom level.\n * @api\n */\n setZoom(zoom) {\n this.setResolution(this.getResolutionForZoom(zoom));\n }\n\n /**\n * Recompute rotation/resolution/center based on target values.\n * Note: we have to compute rotation first, then resolution and center considering that\n * parameters can influence one another in case a view extent constraint is present.\n * @param {boolean=} opt_doNotCancelAnims Do not cancel animations.\n * @param {boolean=} opt_forceMoving Apply constraints as if the view is moving.\n * @private\n */\n applyTargetState_(opt_doNotCancelAnims, opt_forceMoving) {\n const isMoving =\n this.getAnimating() || this.getInteracting() || opt_forceMoving;\n\n // compute rotation\n const newRotation = this.constraints_.rotation(\n this.targetRotation_,\n isMoving\n );\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n 0,\n size,\n isMoving\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n isMoving\n );\n\n if (this.get(ViewProperty.ROTATION) !== newRotation) {\n this.set(ViewProperty.ROTATION, newRotation);\n }\n if (this.get(ViewProperty.RESOLUTION) !== newResolution) {\n this.set(ViewProperty.RESOLUTION, newResolution);\n }\n if (\n !this.get(ViewProperty.CENTER) ||\n !equals(this.get(ViewProperty.CENTER), newCenter)\n ) {\n this.set(ViewProperty.CENTER, newCenter);\n }\n\n if (this.getAnimating() && !opt_doNotCancelAnims) {\n this.cancelAnimations();\n }\n this.cancelAnchor_ = undefined;\n }\n\n /**\n * If any constraints need to be applied, an animation will be triggered.\n * This is typically done on interaction end.\n * Note: calling this with a duration of 0 will apply the constrained values straight away,\n * without animation.\n * @param {number=} opt_duration The animation duration in ms.\n * @param {number=} opt_resolutionDirection Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n */\n resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor) {\n const duration = opt_duration !== undefined ? opt_duration : 200;\n const direction = opt_resolutionDirection || 0;\n\n const newRotation = this.constraints_.rotation(this.targetRotation_);\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n direction,\n size\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size\n );\n\n if (duration === 0 && !this.cancelAnchor_) {\n this.targetResolution_ = newResolution;\n this.targetRotation_ = newRotation;\n this.targetCenter_ = newCenter;\n this.applyTargetState_();\n return;\n }\n\n const anchor =\n opt_anchor || (duration === 0 ? this.cancelAnchor_ : undefined);\n this.cancelAnchor_ = undefined;\n\n if (\n this.getResolution() !== newResolution ||\n this.getRotation() !== newRotation ||\n !this.getCenterInternal() ||\n !equals(this.getCenterInternal(), newCenter)\n ) {\n if (this.getAnimating()) {\n this.cancelAnimations();\n }\n\n this.animateInternal({\n rotation: newRotation,\n center: newCenter,\n resolution: newResolution,\n duration: duration,\n easing: easeOut,\n anchor: anchor,\n });\n }\n }\n\n /**\n * Notify the View that an interaction has started.\n * The view state will be resolved to a stable one if needed\n * (depending on its constraints).\n * @api\n */\n beginInteraction() {\n this.resolveConstraints(0);\n\n this.setHint(ViewHint.INTERACTING, 1);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number=} opt_duration Animation duration in ms.\n * @param {number=} opt_resolutionDirection Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n * @api\n */\n endInteraction(opt_duration, opt_resolutionDirection, opt_anchor) {\n const anchor =\n opt_anchor && fromUserCoordinate(opt_anchor, this.getProjection());\n this.endInteractionInternal(opt_duration, opt_resolutionDirection, anchor);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number=} opt_duration Animation duration in ms.\n * @param {number=} opt_resolutionDirection Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate=} opt_anchor The origin of the transformation.\n */\n endInteractionInternal(opt_duration, opt_resolutionDirection, opt_anchor) {\n this.setHint(ViewHint.INTERACTING, -1);\n\n this.resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor);\n }\n\n /**\n * Get a valid position for the view center according to the current constraints.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} targetCenter Target center position.\n * @param {number=} opt_targetResolution Target resolution. If not supplied, the current one will be used.\n * This is useful to guess a valid center position at a different zoom level.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Valid center position.\n */\n getConstrainedCenter(targetCenter, opt_targetResolution) {\n const size = this.getViewportSize_(this.getRotation());\n return this.constraints_.center(\n targetCenter,\n opt_targetResolution || this.getResolution(),\n size\n );\n }\n\n /**\n * Get a valid zoom level according to the current view constraints.\n * @param {number|undefined} targetZoom Target zoom.\n * @param {number=} [opt_direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid zoom level.\n */\n getConstrainedZoom(targetZoom, opt_direction) {\n const targetRes = this.getResolutionForZoom(targetZoom);\n return this.getZoomForResolution(\n this.getConstrainedResolution(targetRes, opt_direction)\n );\n }\n\n /**\n * Get a valid resolution according to the current view constraints.\n * @param {number|undefined} targetResolution Target resolution.\n * @param {number=} [opt_direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid resolution.\n */\n getConstrainedResolution(targetResolution, opt_direction) {\n const direction = opt_direction || 0;\n const size = this.getViewportSize_(this.getRotation());\n\n return this.constraints_.resolution(targetResolution, direction, size);\n }\n}\n\n/**\n * @param {Function} callback Callback.\n * @param {*} returnValue Return value.\n */\nfunction animationCallback(callback, returnValue) {\n setTimeout(function () {\n callback(returnValue);\n }, 0);\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./centerconstraint.js\").Type} The constraint.\n */\nexport function createCenterConstraint(options) {\n if (options.extent !== undefined) {\n const smooth =\n options.smoothExtentConstraint !== undefined\n ? options.smoothExtentConstraint\n : true;\n return createExtent(options.extent, options.constrainOnlyCenter, smooth);\n }\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n if (options.multiWorld !== true && projection.isGlobal()) {\n const extent = projection.getExtent().slice();\n extent[0] = -Infinity;\n extent[2] = Infinity;\n return createExtent(extent, false, false);\n }\n\n return centerNone;\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {{constraint: import(\"./resolutionconstraint.js\").Type, maxResolution: number,\n * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.\n */\nexport function createResolutionConstraint(options) {\n let resolutionConstraint;\n let maxResolution;\n let minResolution;\n\n // TODO: move these to be ol constants\n // see https://github.com/openlayers/openlayers/issues/2076\n const defaultMaxZoom = 28;\n const defaultZoomFactor = 2;\n\n let minZoom =\n options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM;\n\n let maxZoom =\n options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom;\n\n const zoomFactor =\n options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor;\n\n const multiWorld =\n options.multiWorld !== undefined ? options.multiWorld : false;\n\n const smooth =\n options.smoothResolutionConstraint !== undefined\n ? options.smoothResolutionConstraint\n : true;\n\n const showFullExtent =\n options.showFullExtent !== undefined ? options.showFullExtent : false;\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n const projExtent = projection.getExtent();\n let constrainOnlyCenter = options.constrainOnlyCenter;\n let extent = options.extent;\n if (!multiWorld && !extent && projection.isGlobal()) {\n constrainOnlyCenter = false;\n extent = projExtent;\n }\n\n if (options.resolutions !== undefined) {\n const resolutions = options.resolutions;\n maxResolution = resolutions[minZoom];\n minResolution =\n resolutions[maxZoom] !== undefined\n ? resolutions[maxZoom]\n : resolutions[resolutions.length - 1];\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToResolutions(\n resolutions,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n }\n } else {\n // calculate the default min and max resolution\n const size = !projExtent\n ? // use an extent that can fit the whole world if need be\n (360 * METERS_PER_UNIT[Units.DEGREES]) / projection.getMetersPerUnit()\n : Math.max(getWidth(projExtent), getHeight(projExtent));\n\n const defaultMaxResolution =\n size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);\n\n const defaultMinResolution =\n defaultMaxResolution /\n Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);\n\n // user provided maxResolution takes precedence\n maxResolution = options.maxResolution;\n if (maxResolution !== undefined) {\n minZoom = 0;\n } else {\n maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);\n }\n\n // user provided minResolution takes precedence\n minResolution = options.minResolution;\n if (minResolution === undefined) {\n if (options.maxZoom !== undefined) {\n if (options.maxResolution !== undefined) {\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);\n } else {\n minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);\n }\n } else {\n minResolution = defaultMinResolution;\n }\n }\n\n // given discrete zoom levels, minResolution may be different than provided\n maxZoom =\n minZoom +\n Math.floor(\n Math.log(maxResolution / minResolution) / Math.log(zoomFactor)\n );\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToPower(\n zoomFactor,\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n }\n }\n return {\n constraint: resolutionConstraint,\n maxResolution: maxResolution,\n minResolution: minResolution,\n minZoom: minZoom,\n zoomFactor: zoomFactor,\n };\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./rotationconstraint.js\").Type} Rotation constraint.\n */\nexport function createRotationConstraint(options) {\n const enableRotation =\n options.enableRotation !== undefined ? options.enableRotation : true;\n if (enableRotation) {\n const constrainRotation = options.constrainRotation;\n if (constrainRotation === undefined || constrainRotation === true) {\n return createSnapToZero();\n } else if (constrainRotation === false) {\n return rotationNone;\n } else if (typeof constrainRotation === 'number') {\n return createSnapToN(constrainRotation);\n } else {\n return rotationNone;\n }\n } else {\n return disable;\n }\n}\n\n/**\n * Determine if an animation involves no view change.\n * @param {Animation} animation The animation.\n * @return {boolean} The animation involves no view change.\n */\nexport function isNoopAnimation(animation) {\n if (animation.sourceCenter && animation.targetCenter) {\n if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {\n return false;\n }\n }\n if (animation.sourceResolution !== animation.targetResolution) {\n return false;\n }\n if (animation.sourceRotation !== animation.targetRotation) {\n return false;\n }\n return true;\n}\n\nexport default View;\n","/**\n * @module ol/PluggableMap\n */\nimport BaseObject, {getChangeEventType} from './Object.js';\nimport Collection from './Collection.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport EventType from './events/EventType.js';\nimport LayerGroup from './layer/Group.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventHandler from './MapBrowserEventHandler.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport MapEvent from './MapEvent.js';\nimport MapEventType from './MapEventType.js';\nimport MapProperty from './MapProperty.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport PointerEventType from './pointer/EventType.js';\nimport RenderEventType from './render/EventType.js';\nimport TileQueue, {getTilePriority} from './TileQueue.js';\nimport View from './View.js';\nimport ViewHint from './ViewHint.js';\nimport {\n DEVICE_PIXEL_RATIO,\n IMAGE_DECODE,\n PASSIVE_EVENT_LISTENERS,\n} from './has.js';\nimport {TRUE} from './functions.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n} from './transform.js';\nimport {assert} from './asserts.js';\nimport {\n clone,\n createOrUpdateEmpty,\n equals,\n getForViewAndSize,\n isEmpty,\n} from './extent.js';\nimport {fromUserCoordinate, toUserCoordinate} from './proj.js';\nimport {hasArea} from './size.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {removeNode} from './dom.js';\n\n/**\n * State of the current frame. Only `pixelRatio`, `time` and `viewState` should\n * be used in applications.\n * @typedef {Object} FrameState\n * @property {number} pixelRatio The pixel ratio of the frame.\n * @property {number} time The time when rendering of the frame was requested.\n * @property {import(\"./View.js\").State} viewState The state of the current view.\n * @property {boolean} animate\n * @property {import(\"./transform.js\").Transform} coordinateToPixelTransform\n * @property {null|import(\"./extent.js\").Extent} extent\n * @property {Array<DeclutterItems>} declutterItems\n * @property {number} index\n * @property {Array<import(\"./layer/Layer.js\").State>} layerStatesArray\n * @property {number} layerIndex\n * @property {import(\"./transform.js\").Transform} pixelToCoordinateTransform\n * @property {Array<PostRenderFunction>} postRenderFunctions\n * @property {import(\"./size.js\").Size} size\n * @property {TileQueue} tileQueue\n * @property {!Object<string, Object<string, boolean>>} usedTiles\n * @property {Array<number>} viewHints\n * @property {!Object<string, Object<string, boolean>>} wantedTiles\n */\n\n/**\n * @typedef {Object} DeclutterItems\n * @property {Array<*>} items Declutter items of an executor.\n * @property {number} opacity Layer opacity.\n */\n\n/**\n * @typedef {function(PluggableMap, ?FrameState): any} PostRenderFunction\n */\n\n/**\n * @typedef {Object} AtPixelOptions\n * @property {undefined|function(import(\"./layer/Layer.js\").default): boolean} [layerFilter] Layer filter\n * function. The filter function will receive one argument, the\n * {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value.\n * Only layers which are visible and for which this function returns `true`\n * will be tested for features. By default, all visible layers will be tested.\n * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels\n * inside the radius around the given position will be checked for features.\n * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for for wrapped geometries inside the range of\n * +/- 1 world width. Works only if a projection is used that can be wrapped.\n */\n\n/**\n * @typedef {Object} MapOptionsInternal\n * @property {Collection<import(\"./control/Control.js\").default>} [controls]\n * @property {Collection<import(\"./interaction/Interaction.js\").default>} [interactions]\n * @property {HTMLElement|Document} keyboardEventTarget\n * @property {Collection<import(\"./Overlay.js\").default>} overlays\n * @property {Object<string, *>} values\n */\n\n/**\n * Object literal with config options for the map.\n * @typedef {Object} MapOptions\n * @property {Collection<import(\"./control/Control.js\").default>|Array<import(\"./control/Control.js\").default>} [controls]\n * Controls initially added to the map. If not specified,\n * {@link module:ol/control~defaults} is used.\n * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between\n * physical pixels and device-independent pixels (dips) on the device.\n * @property {Collection<import(\"./interaction/Interaction.js\").default>|Array<import(\"./interaction/Interaction.js\").default>} [interactions]\n * Interactions that are initially added to the map. If not specified,\n * {@link module:ol/interaction~defaults} is used.\n * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to\n * listen to keyboard events on. This determines when the `KeyboardPan` and\n * `KeyboardZoom` interactions trigger. For example, if this option is set to\n * `document` the keyboard interactions will always trigger. If this option is\n * not specified, the element the library listens to keyboard events on is the\n * map target (i.e. the user-provided div for the map). If this is not\n * `document`, the target element needs to be focused for key events to be\n * emitted, requiring that the target element has a `tabindex` attribute.\n * @property {Array<import(\"./layer/Base.js\").default>|Collection<import(\"./layer/Base.js\").default>|LayerGroup} [layers]\n * Layers. If this is not defined, a map with no layers will be rendered. Note\n * that layers are rendered in the order supplied, so if you want, for example,\n * a vector layer to appear on top of a tile layer, it must come after the tile\n * layer.\n * @property {number} [maxTilesLoading=16] Maximum number tiles to load\n * simultaneously.\n * @property {number} [moveTolerance=1] The minimum distance in pixels the\n * cursor must move to be detected as a map move event instead of a click.\n * Increasing this value can make it easier to click on the map.\n * @property {Collection<import(\"./Overlay.js\").default>|Array<import(\"./Overlay.js\").default>} [overlays]\n * Overlays initially added to the map. By default, no overlays are added.\n * @property {HTMLElement|string} [target] The container for the map, either the\n * element itself or the `id` of the element. If not specified at construction\n * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be\n * rendered.\n * @property {View} [view] The map's view. No layer sources will be\n * fetched unless this is specified at construction time or through\n * {@link module:ol/Map~Map#setView}.\n */\n\n/**\n * @fires import(\"./MapBrowserEvent.js\").MapBrowserEvent\n * @fires import(\"./MapEvent.js\").MapEvent\n * @fires import(\"./render/Event.js\").default#precompose\n * @fires import(\"./render/Event.js\").default#postcompose\n * @fires import(\"./render/Event.js\").default#rendercomplete\n * @api\n */\nclass PluggableMap extends BaseObject {\n /**\n * @param {MapOptions} options Map options.\n */\n constructor(options) {\n super();\n\n const optionsInternal = createOptionsInternal(options);\n\n /** @private */\n this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this);\n\n /**\n * @type {number}\n * @private\n */\n this.maxTilesLoading_ =\n options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ =\n options.pixelRatio !== undefined\n ? options.pixelRatio\n : DEVICE_PIXEL_RATIO;\n\n /**\n * @private\n * @type {*}\n */\n this.postRenderTimeoutHandle_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.animationDelayKey_;\n\n /**\n * @private\n */\n this.animationDelay_ = function () {\n this.animationDelayKey_ = undefined;\n this.renderFrame_(Date.now());\n }.bind(this);\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.coordinateToPixelTransform_ = createTransform();\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.pixelToCoordinateTransform_ = createTransform();\n\n /**\n * @private\n * @type {number}\n */\n this.frameIndex_ = 0;\n\n /**\n * @private\n * @type {?FrameState}\n */\n this.frameState_ = null;\n\n /**\n * The extent at the previous 'moveend' event.\n * @private\n * @type {import(\"./extent.js\").Extent}\n */\n this.previousExtent_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewPropertyListenerKey_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewChangeListenerKey_ = null;\n\n /**\n * @private\n * @type {?Array<import(\"./events.js\").EventsKey>}\n */\n this.layerGroupPropertyListenerKeys_ = null;\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.viewport_ = document.createElement('div');\n this.viewport_.className =\n 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');\n this.viewport_.style.position = 'relative';\n this.viewport_.style.overflow = 'hidden';\n this.viewport_.style.width = '100%';\n this.viewport_.style.height = '100%';\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainer_ = document.createElement('div');\n this.overlayContainer_.style.position = 'absolute';\n this.overlayContainer_.style.zIndex = '0';\n this.overlayContainer_.style.width = '100%';\n this.overlayContainer_.style.height = '100%';\n this.overlayContainer_.style.pointerEvents = 'none';\n this.overlayContainer_.className = 'ol-overlaycontainer';\n this.viewport_.appendChild(this.overlayContainer_);\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainerStopEvent_ = document.createElement('div');\n this.overlayContainerStopEvent_.style.position = 'absolute';\n this.overlayContainerStopEvent_.style.zIndex = '0';\n this.overlayContainerStopEvent_.style.width = '100%';\n this.overlayContainerStopEvent_.style.height = '100%';\n this.overlayContainerStopEvent_.style.pointerEvents = 'none';\n this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';\n this.viewport_.appendChild(this.overlayContainerStopEvent_);\n\n /**\n * @private\n * @type {MapBrowserEventHandler}\n */\n this.mapBrowserEventHandler_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.moveTolerance_ = options.moveTolerance;\n\n /**\n * @private\n * @type {HTMLElement|Document}\n */\n this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;\n\n /**\n * @private\n * @type {?Array<import(\"./events.js\").EventsKey>}\n */\n this.keyHandlerKeys_ = null;\n\n /**\n * @type {Collection<import(\"./control/Control.js\").default>}\n * @protected\n */\n this.controls = optionsInternal.controls || new Collection();\n\n /**\n * @type {Collection<import(\"./interaction/Interaction.js\").default>}\n * @protected\n */\n this.interactions = optionsInternal.interactions || new Collection();\n\n /**\n * @type {Collection<import(\"./Overlay.js\").default>}\n * @private\n */\n this.overlays_ = optionsInternal.overlays;\n\n /**\n * A lookup of overlays by id.\n * @private\n * @type {Object<string, import(\"./Overlay.js\").default>}\n */\n this.overlayIdIndex_ = {};\n\n /**\n * @type {import(\"./renderer/Map.js\").default}\n * @private\n */\n this.renderer_ = null;\n\n /**\n * @type {undefined|function(Event): void}\n * @private\n */\n this.handleResize_;\n\n /**\n * @private\n * @type {!Array<PostRenderFunction>}\n */\n this.postRenderFunctions_ = [];\n\n /**\n * @private\n * @type {TileQueue}\n */\n this.tileQueue_ = new TileQueue(\n this.getTilePriority.bind(this),\n this.handleTileChange_.bind(this)\n );\n\n this.addEventListener(\n getChangeEventType(MapProperty.LAYERGROUP),\n this.handleLayerGroupChanged_\n );\n this.addEventListener(\n getChangeEventType(MapProperty.VIEW),\n this.handleViewChanged_\n );\n this.addEventListener(\n getChangeEventType(MapProperty.SIZE),\n this.handleSizeChanged_\n );\n this.addEventListener(\n getChangeEventType(MapProperty.TARGET),\n this.handleTargetChanged_\n );\n\n // setProperties will trigger the rendering of the map if the map\n // is \"defined\" already.\n this.setProperties(optionsInternal.values);\n\n this.controls.forEach(\n /**\n * @param {import(\"./control/Control.js\").default} control Control.\n * @this {PluggableMap}\n */\n function (control) {\n control.setMap(this);\n }.bind(this)\n );\n\n this.controls.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(this);\n }.bind(this)\n );\n\n this.controls.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(null);\n }.bind(this)\n );\n\n this.interactions.forEach(\n /**\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction.\n * @this {PluggableMap}\n */\n function (interaction) {\n interaction.setMap(this);\n }.bind(this)\n );\n\n this.interactions.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(this);\n }.bind(this)\n );\n\n this.interactions.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n event.element.setMap(null);\n }.bind(this)\n );\n\n this.overlays_.forEach(this.addOverlayInternal_.bind(this));\n\n this.overlays_.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n this.addOverlayInternal_(\n /** @type {import(\"./Overlay.js\").default} */ (event.element)\n );\n }.bind(this)\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n function (event) {\n const overlay = /** @type {import(\"./Overlay.js\").default} */ (event.element);\n const id = overlay.getId();\n if (id !== undefined) {\n delete this.overlayIdIndex_[id.toString()];\n }\n event.element.setMap(null);\n }.bind(this)\n );\n }\n\n /**\n * @abstract\n * @return {import(\"./renderer/Map.js\").default} The map renderer\n */\n createRenderer() {\n throw new Error('Use a map type that has a createRenderer method');\n }\n\n /**\n * Add the given control to the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @api\n */\n addControl(control) {\n this.getControls().push(control);\n }\n\n /**\n * Add the given interaction to the map. If you want to add an interaction\n * at another point of the collection use `getInteraction()` and the methods\n * available on {@link module:ol/Collection~Collection}. This can be used to\n * stop the event propagation from the handleEvent function. The interactions\n * get to handle the events in the reverse order of this collection.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to add.\n * @api\n */\n addInteraction(interaction) {\n this.getInteractions().push(interaction);\n }\n\n /**\n * Adds the given layer to the top of this map. If you want to add a layer\n * elsewhere in the stack, use `getLayers()` and the methods available on\n * {@link module:ol/Collection~Collection}.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @api\n */\n addLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n layers.push(layer);\n }\n\n /**\n * Add the given overlay to the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @api\n */\n addOverlay(overlay) {\n this.getOverlays().push(overlay);\n }\n\n /**\n * This deals with map's overlay collection changes.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @private\n */\n addOverlayInternal_(overlay) {\n const id = overlay.getId();\n if (id !== undefined) {\n this.overlayIdIndex_[id.toString()] = overlay;\n }\n overlay.setMap(this);\n }\n\n /**\n *\n * Clean up.\n */\n disposeInternal() {\n this.setTarget(null);\n super.disposeInternal();\n }\n\n /**\n * Detect features that intersect a pixel on the viewport, and execute a\n * callback with each intersecting feature. Layers included in the detection can\n * be configured through the `layerFilter` option in `opt_options`.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(this: S, import(\"./Feature.js\").FeatureLike,\n * import(\"./layer/Layer.js\").default): T} callback Feature callback. The callback will be\n * called with two arguments. The first argument is one\n * {@link module:ol/Feature feature} or\n * {@link module:ol/render/Feature render feature} at the pixel, the second is\n * the {@link module:ol/layer/Layer layer} of the feature and will be null for\n * unmanaged layers. To stop detection, callback functions can return a\n * truthy value.\n * @param {AtPixelOptions=} opt_options Optional options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template S,T\n * @api\n */\n forEachFeatureAtPixel(pixel, callback, opt_options) {\n if (!this.frameState_) {\n return;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n opt_options = opt_options !== undefined ? opt_options : {};\n const hitTolerance =\n opt_options.hitTolerance !== undefined\n ? opt_options.hitTolerance * this.frameState_.pixelRatio\n : 0;\n const layerFilter =\n opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;\n const checkWrapped = opt_options.checkWrapped !== false;\n return this.renderer_.forEachFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n callback,\n null,\n layerFilter,\n null\n );\n }\n\n /**\n * Get all features that intersect a pixel on the viewport.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions=} opt_options Optional options.\n * @return {Array<import(\"./Feature.js\").FeatureLike>} The detected features or\n * an empty array if none were found.\n * @api\n */\n getFeaturesAtPixel(pixel, opt_options) {\n const features = [];\n this.forEachFeatureAtPixel(\n pixel,\n function (feature) {\n features.push(feature);\n },\n opt_options\n );\n return features;\n }\n\n /**\n * Detect layers that have a color value at a pixel on the viewport, and\n * execute a callback with each matching layer. Layers included in the\n * detection can be configured through `opt_layerFilter`.\n *\n * Note: this may give false positives unless the map layers have had different `className`\n * properties assigned to them.\n *\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(this: S, import(\"./layer/Layer.js\").default, (Uint8ClampedArray|Uint8Array)): T} callback\n * Layer callback. This callback will receive two arguments: first is the\n * {@link module:ol/layer/Layer layer}, second argument is an array representing\n * [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types\n * that do not currently support this argument. To stop detection, callback\n * functions can return a truthy value.\n * @param {AtPixelOptions=} opt_options Configuration options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template S,T\n * @api\n */\n forEachLayerAtPixel(pixel, callback, opt_options) {\n if (!this.frameState_) {\n return;\n }\n const options = opt_options || {};\n const hitTolerance =\n options.hitTolerance !== undefined\n ? options.hitTolerance * this.frameState_.pixelRatio\n : 0;\n const layerFilter = options.layerFilter || TRUE;\n return this.renderer_.forEachLayerAtPixel(\n pixel,\n this.frameState_,\n hitTolerance,\n callback,\n layerFilter\n );\n }\n\n /**\n * Detect if features intersect a pixel on the viewport. Layers included in the\n * detection can be configured through `opt_layerFilter`.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions=} opt_options Optional options.\n * @return {boolean} Is there a feature at the given pixel?\n * @api\n */\n hasFeatureAtPixel(pixel, opt_options) {\n if (!this.frameState_) {\n return false;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n opt_options = opt_options !== undefined ? opt_options : {};\n const layerFilter =\n opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;\n const hitTolerance =\n opt_options.hitTolerance !== undefined\n ? opt_options.hitTolerance * this.frameState_.pixelRatio\n : 0;\n const checkWrapped = opt_options.checkWrapped !== false;\n return this.renderer_.hasFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n layerFilter,\n null\n );\n }\n\n /**\n * Returns the coordinate in user projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n getEventCoordinate(event) {\n return this.getCoordinateFromPixel(this.getEventPixel(event));\n }\n\n /**\n * Returns the coordinate in view projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n */\n getEventCoordinateInternal(event) {\n return this.getCoordinateFromPixelInternal(this.getEventPixel(event));\n }\n\n /**\n * Returns the map pixel position for a browser event relative to the viewport.\n * @param {UIEvent} event Event.\n * @return {import(\"./pixel.js\").Pixel} Pixel.\n * @api\n */\n getEventPixel(event) {\n const viewportPosition = this.viewport_.getBoundingClientRect();\n const eventPosition =\n //FIXME Are we really calling this with a TouchEvent anywhere?\n 'changedTouches' in event\n ? /** @type {TouchEvent} */ (event).changedTouches[0]\n : /** @type {MouseEvent} */ (event);\n\n return [\n eventPosition.clientX - viewportPosition.left,\n eventPosition.clientY - viewportPosition.top,\n ];\n }\n\n /**\n * Get the target in which this map is rendered.\n * Note that this returns what is entered as an option or in setTarget:\n * if that was an element, it returns an element; if a string, it returns that.\n * @return {HTMLElement|string|undefined} The Element or id of the Element that the\n * map is rendered in.\n * @observable\n * @api\n */\n getTarget() {\n return /** @type {HTMLElement|string|undefined} */ (this.get(\n MapProperty.TARGET\n ));\n }\n\n /**\n * Get the DOM element into which this map is rendered. In contrast to\n * `getTarget` this method always return an `Element`, or `null` if the\n * map has no target.\n * @return {HTMLElement} The element that the map is rendered in.\n * @api\n */\n getTargetElement() {\n const target = this.getTarget();\n if (target !== undefined) {\n return typeof target === 'string'\n ? document.getElementById(target)\n : target;\n } else {\n return null;\n }\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * user projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n * @api\n */\n getCoordinateFromPixel(pixel) {\n return toUserCoordinate(\n this.getCoordinateFromPixelInternal(pixel),\n this.getView().getProjection()\n );\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * map view projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n */\n getCoordinateFromPixelInternal(pixel) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n } else {\n return applyTransform(\n frameState.pixelToCoordinateTransform,\n pixel.slice()\n );\n }\n }\n\n /**\n * Get the map controls. Modifying this collection changes the controls\n * associated with the map.\n * @return {Collection<import(\"./control/Control.js\").default>} Controls.\n * @api\n */\n getControls() {\n return this.controls;\n }\n\n /**\n * Get the map overlays. Modifying this collection changes the overlays\n * associated with the map.\n * @return {Collection<import(\"./Overlay.js\").default>} Overlays.\n * @api\n */\n getOverlays() {\n return this.overlays_;\n }\n\n /**\n * Get an overlay by its identifier (the value returned by overlay.getId()).\n * Note that the index treats string and numeric identifiers as the same. So\n * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.\n * @param {string|number} id Overlay identifier.\n * @return {import(\"./Overlay.js\").default} Overlay.\n * @api\n */\n getOverlayById(id) {\n const overlay = this.overlayIdIndex_[id.toString()];\n return overlay !== undefined ? overlay : null;\n }\n\n /**\n * Get the map interactions. Modifying this collection changes the interactions\n * associated with the map.\n *\n * Interactions are used for e.g. pan, zoom and rotate.\n * @return {Collection<import(\"./interaction/Interaction.js\").default>} Interactions.\n * @api\n */\n getInteractions() {\n return this.interactions;\n }\n\n /**\n * Get the layergroup associated with this map.\n * @return {LayerGroup} A layer group containing the layers in this map.\n * @observable\n * @api\n */\n getLayerGroup() {\n return /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP));\n }\n\n /**\n * Get the collection of layers associated with this map.\n * @return {!Collection<import(\"./layer/Base.js\").default>} Layers.\n * @api\n */\n getLayers() {\n const layers = this.getLayerGroup().getLayers();\n return layers;\n }\n\n /**\n * @return {boolean} Layers have sources that are still loading.\n */\n getLoading() {\n const layerStatesArray = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const layer = layerStatesArray[i].layer;\n const source = /** @type {import(\"./layer/Layer.js\").default} */ (layer).getSource();\n if (source && source.loading) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the user\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n * @api\n */\n getPixelFromCoordinate(coordinate) {\n const viewCoordinate = fromUserCoordinate(\n coordinate,\n this.getView().getProjection()\n );\n return this.getPixelFromCoordinateInternal(viewCoordinate);\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the map view\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n */\n getPixelFromCoordinateInternal(coordinate) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n } else {\n return applyTransform(\n frameState.coordinateToPixelTransform,\n coordinate.slice(0, 2)\n );\n }\n }\n\n /**\n * Get the map renderer.\n * @return {import(\"./renderer/Map.js\").default} Renderer\n */\n getRenderer() {\n return this.renderer_;\n }\n\n /**\n * Get the size of this map.\n * @return {import(\"./size.js\").Size|undefined} The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n getSize() {\n return /** @type {import(\"./size.js\").Size|undefined} */ (this.get(\n MapProperty.SIZE\n ));\n }\n\n /**\n * Get the view associated with this map. A view manages properties such as\n * center and resolution.\n * @return {View} The view that controls this map.\n * @observable\n * @api\n */\n getView() {\n return /** @type {View} */ (this.get(MapProperty.VIEW));\n }\n\n /**\n * Get the element that serves as the map viewport.\n * @return {HTMLElement} Viewport.\n * @api\n */\n getViewport() {\n return this.viewport_;\n }\n\n /**\n * Get the element that serves as the container for overlays. Elements added to\n * this container will let mousedown and touchstart events through to the map,\n * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}\n * events.\n * @return {!HTMLElement} The map's overlay container.\n */\n getOverlayContainer() {\n return this.overlayContainer_;\n }\n\n /**\n * Get the element that serves as a container for overlays that don't allow\n * event propagation. Elements added to this container won't let mousedown and\n * touchstart events through to the map, so clicks and gestures on an overlay\n * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @return {!HTMLElement} The map's overlay container that stops events.\n */\n getOverlayContainerStopEvent() {\n return this.overlayContainerStopEvent_;\n }\n\n /**\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\n getTilePriority(tile, tileSourceKey, tileCenter, tileResolution) {\n return getTilePriority(\n this.frameState_,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution\n );\n }\n\n /**\n * @param {UIEvent} browserEvent Browser event.\n * @param {string=} opt_type Type.\n */\n handleBrowserEvent(browserEvent, opt_type) {\n const type = opt_type || browserEvent.type;\n const mapBrowserEvent = new MapBrowserEvent(type, this, browserEvent);\n this.handleMapBrowserEvent(mapBrowserEvent);\n }\n\n /**\n * @param {MapBrowserEvent} mapBrowserEvent The event to handle.\n */\n handleMapBrowserEvent(mapBrowserEvent) {\n if (!this.frameState_) {\n // With no view defined, we cannot translate pixels into geographical\n // coordinates so interactions cannot be used.\n return;\n }\n const originalEvent = /** @type {PointerEvent} */ (mapBrowserEvent.originalEvent);\n const eventType = originalEvent.type;\n if (\n eventType === PointerEventType.POINTERDOWN ||\n eventType === EventType.WHEEL ||\n eventType === EventType.KEYDOWN\n ) {\n const rootNode = this.viewport_.getRootNode\n ? this.viewport_.getRootNode()\n : document;\n const target =\n rootNode === document\n ? /** @type {Node} */ (originalEvent.target)\n : /** @type {ShadowRoot} */ (rootNode).elementFromPoint(\n originalEvent.clientX,\n originalEvent.clientY\n );\n if (\n // Abort if the target is a child of the container for elements whose events are not meant\n // to be handled by map interactions.\n this.overlayContainerStopEvent_.contains(target) ||\n // Abort if the event target is a child of the container that is no longer in the page.\n // It's possible for the target to no longer be in the page if it has been removed in an\n // event listener, this might happen in a Control that recreates it's content based on\n // user interaction either manually or via a render in something like https://reactjs.org/\n !(rootNode === document ? document.documentElement : rootNode).contains(\n target\n )\n ) {\n return;\n }\n }\n mapBrowserEvent.frameState = this.frameState_;\n const interactionsArray = this.getInteractions().getArray();\n if (this.dispatchEvent(mapBrowserEvent) !== false) {\n for (let i = interactionsArray.length - 1; i >= 0; i--) {\n const interaction = interactionsArray[i];\n if (!interaction.getActive()) {\n continue;\n }\n const cont = interaction.handleEvent(mapBrowserEvent);\n if (!cont) {\n break;\n }\n }\n }\n }\n\n /**\n * @protected\n */\n handlePostRender() {\n const frameState = this.frameState_;\n\n // Manage the tile queue\n // Image loads are expensive and a limited resource, so try to use them\n // efficiently:\n // * When the view is static we allow a large number of parallel tile loads\n // to complete the frame as quickly as possible.\n // * When animating or interacting, image loads can cause janks, so we reduce\n // the maximum number of loads per frame and limit the number of parallel\n // tile loads to remain reactive to view changes and to reduce the chance of\n // loading tiles that will quickly disappear from view.\n const tileQueue = this.tileQueue_;\n if (!tileQueue.isEmpty()) {\n let maxTotalLoading = this.maxTilesLoading_;\n let maxNewLoads = maxTotalLoading;\n if (frameState) {\n const hints = frameState.viewHints;\n if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) {\n const lowOnFrameBudget =\n !IMAGE_DECODE && Date.now() - frameState.time > 8;\n maxTotalLoading = lowOnFrameBudget ? 0 : 8;\n maxNewLoads = lowOnFrameBudget ? 0 : 2;\n }\n }\n if (tileQueue.getTilesLoading() < maxTotalLoading) {\n tileQueue.reprioritize(); // FIXME only call if view has changed\n tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);\n }\n }\n\n if (\n frameState &&\n this.hasListener(RenderEventType.RENDERCOMPLETE) &&\n !frameState.animate &&\n !this.tileQueue_.getTilesLoading() &&\n !this.getLoading()\n ) {\n this.renderer_.dispatchRenderEvent(\n RenderEventType.RENDERCOMPLETE,\n frameState\n );\n }\n\n const postRenderFunctions = this.postRenderFunctions_;\n for (let i = 0, ii = postRenderFunctions.length; i < ii; ++i) {\n postRenderFunctions[i](this, frameState);\n }\n postRenderFunctions.length = 0;\n }\n\n /**\n * @private\n */\n handleSizeChanged_() {\n if (this.getView() && !this.getView().getAnimating()) {\n this.getView().resolveConstraints(0);\n }\n\n this.render();\n }\n\n /**\n * @private\n */\n handleTargetChanged_() {\n // target may be undefined, null, a string or an Element.\n // If it's a string we convert it to an Element before proceeding.\n // If it's not now an Element we remove the viewport from the DOM.\n // If it's an Element we append the viewport element to it.\n\n let targetElement;\n if (this.getTarget()) {\n targetElement = this.getTargetElement();\n }\n\n if (this.mapBrowserEventHandler_) {\n for (let i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.keyHandlerKeys_[i]);\n }\n this.keyHandlerKeys_ = null;\n this.viewport_.removeEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_\n );\n this.viewport_.removeEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_\n );\n if (this.handleResize_ !== undefined) {\n removeEventListener(EventType.RESIZE, this.handleResize_, false);\n this.handleResize_ = undefined;\n }\n this.mapBrowserEventHandler_.dispose();\n this.mapBrowserEventHandler_ = null;\n removeNode(this.viewport_);\n }\n\n if (!targetElement) {\n if (this.renderer_) {\n clearTimeout(this.postRenderTimeoutHandle_);\n this.postRenderFunctions_.length = 0;\n this.renderer_.dispose();\n this.renderer_ = null;\n }\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n this.animationDelayKey_ = undefined;\n }\n } else {\n targetElement.appendChild(this.viewport_);\n if (!this.renderer_) {\n this.renderer_ = this.createRenderer();\n }\n\n this.mapBrowserEventHandler_ = new MapBrowserEventHandler(\n this,\n this.moveTolerance_\n );\n for (const key in MapBrowserEventType) {\n this.mapBrowserEventHandler_.addEventListener(\n MapBrowserEventType[key],\n this.handleMapBrowserEvent.bind(this)\n );\n }\n this.viewport_.addEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_,\n false\n );\n this.viewport_.addEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false\n );\n\n const keyboardEventTarget = !this.keyboardEventTarget_\n ? targetElement\n : this.keyboardEventTarget_;\n this.keyHandlerKeys_ = [\n listen(\n keyboardEventTarget,\n EventType.KEYDOWN,\n this.handleBrowserEvent,\n this\n ),\n listen(\n keyboardEventTarget,\n EventType.KEYPRESS,\n this.handleBrowserEvent,\n this\n ),\n ];\n\n if (!this.handleResize_) {\n this.handleResize_ = this.updateSize.bind(this);\n window.addEventListener(EventType.RESIZE, this.handleResize_, false);\n }\n }\n\n this.updateSize();\n // updateSize calls setSize, so no need to call this.render\n // ourselves here.\n }\n\n /**\n * @private\n */\n handleTileChange_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewPropertyChanged_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewChanged_() {\n if (this.viewPropertyListenerKey_) {\n unlistenByKey(this.viewPropertyListenerKey_);\n this.viewPropertyListenerKey_ = null;\n }\n if (this.viewChangeListenerKey_) {\n unlistenByKey(this.viewChangeListenerKey_);\n this.viewChangeListenerKey_ = null;\n }\n const view = this.getView();\n if (view) {\n this.updateViewportSize_();\n\n this.viewPropertyListenerKey_ = listen(\n view,\n ObjectEventType.PROPERTYCHANGE,\n this.handleViewPropertyChanged_,\n this\n );\n this.viewChangeListenerKey_ = listen(\n view,\n EventType.CHANGE,\n this.handleViewPropertyChanged_,\n this\n );\n\n view.resolveConstraints(0);\n }\n this.render();\n }\n\n /**\n * @private\n */\n handleLayerGroupChanged_() {\n if (this.layerGroupPropertyListenerKeys_) {\n this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey);\n this.layerGroupPropertyListenerKeys_ = null;\n }\n const layerGroup = this.getLayerGroup();\n if (layerGroup) {\n this.layerGroupPropertyListenerKeys_ = [\n listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this),\n listen(layerGroup, EventType.CHANGE, this.render, this),\n ];\n }\n this.render();\n }\n\n /**\n * @return {boolean} Is rendered.\n */\n isRendered() {\n return !!this.frameState_;\n }\n\n /**\n * Requests an immediate render in a synchronous manner.\n * @api\n */\n renderSync() {\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n }\n this.animationDelay_();\n }\n\n /**\n * Redraws all text after new fonts have loaded\n */\n redrawText() {\n const layerStates = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStates.length; i < ii; ++i) {\n const layer = layerStates[i].layer;\n if (layer.hasRenderer()) {\n layer.getRenderer().handleFontsChanged();\n }\n }\n }\n\n /**\n * Request a map rendering (at the next animation frame).\n * @api\n */\n render() {\n if (this.renderer_ && this.animationDelayKey_ === undefined) {\n this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);\n }\n }\n\n /**\n * Remove the given control from the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @return {import(\"./control/Control.js\").default|undefined} The removed control (or undefined\n * if the control was not found).\n * @api\n */\n removeControl(control) {\n return this.getControls().remove(control);\n }\n\n /**\n * Remove the given interaction from the map.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to remove.\n * @return {import(\"./interaction/Interaction.js\").default|undefined} The removed interaction (or\n * undefined if the interaction was not found).\n * @api\n */\n removeInteraction(interaction) {\n return this.getInteractions().remove(interaction);\n }\n\n /**\n * Removes the given layer from the map.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @return {import(\"./layer/Base.js\").default|undefined} The removed layer (or undefined if the\n * layer was not found).\n * @api\n */\n removeLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n return layers.remove(layer);\n }\n\n /**\n * Remove the given overlay from the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @return {import(\"./Overlay.js\").default|undefined} The removed overlay (or undefined\n * if the overlay was not found).\n * @api\n */\n removeOverlay(overlay) {\n return this.getOverlays().remove(overlay);\n }\n\n /**\n * @param {number} time Time.\n * @private\n */\n renderFrame_(time) {\n const size = this.getSize();\n const view = this.getView();\n const previousFrameState = this.frameState_;\n /** @type {?FrameState} */\n let frameState = null;\n if (size !== undefined && hasArea(size) && view && view.isDef()) {\n const viewHints = view.getHints(\n this.frameState_ ? this.frameState_.viewHints : undefined\n );\n const viewState = view.getState();\n frameState = {\n animate: false,\n coordinateToPixelTransform: this.coordinateToPixelTransform_,\n declutterItems: previousFrameState\n ? previousFrameState.declutterItems\n : [],\n extent: getForViewAndSize(\n viewState.center,\n viewState.resolution,\n viewState.rotation,\n size\n ),\n index: this.frameIndex_++,\n layerIndex: 0,\n layerStatesArray: this.getLayerGroup().getLayerStatesArray(),\n pixelRatio: this.pixelRatio_,\n pixelToCoordinateTransform: this.pixelToCoordinateTransform_,\n postRenderFunctions: [],\n size: size,\n tileQueue: this.tileQueue_,\n time: time,\n usedTiles: {},\n viewState: viewState,\n viewHints: viewHints,\n wantedTiles: {},\n };\n }\n\n this.frameState_ = frameState;\n this.renderer_.renderFrame(frameState);\n\n if (frameState) {\n if (frameState.animate) {\n this.render();\n }\n Array.prototype.push.apply(\n this.postRenderFunctions_,\n frameState.postRenderFunctions\n );\n\n if (previousFrameState) {\n const moveStart =\n !this.previousExtent_ ||\n (!isEmpty(this.previousExtent_) &&\n !equals(frameState.extent, this.previousExtent_));\n if (moveStart) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVESTART, this, previousFrameState)\n );\n this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);\n }\n }\n\n const idle =\n this.previousExtent_ &&\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING] &&\n !equals(frameState.extent, this.previousExtent_);\n\n if (idle) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVEEND, this, frameState)\n );\n clone(frameState.extent, this.previousExtent_);\n }\n }\n\n this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));\n\n this.postRenderTimeoutHandle_ = setTimeout(\n this.handlePostRender.bind(this),\n 0\n );\n }\n\n /**\n * Sets the layergroup of this map.\n * @param {LayerGroup} layerGroup A layer group containing the layers in this map.\n * @observable\n * @api\n */\n setLayerGroup(layerGroup) {\n this.set(MapProperty.LAYERGROUP, layerGroup);\n }\n\n /**\n * Set the size of this map.\n * @param {import(\"./size.js\").Size|undefined} size The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n setSize(size) {\n this.set(MapProperty.SIZE, size);\n }\n\n /**\n * Set the target element to render this map into.\n * @param {HTMLElement|string|undefined} target The Element or id of the Element\n * that the map is rendered in.\n * @observable\n * @api\n */\n setTarget(target) {\n this.set(MapProperty.TARGET, target);\n }\n\n /**\n * Set the view for this map.\n * @param {View} view The view that controls this map.\n * @observable\n * @api\n */\n setView(view) {\n this.set(MapProperty.VIEW, view);\n }\n\n /**\n * Force a recalculation of the map viewport size. This should be called when\n * third-party code changes the size of the map viewport.\n * @api\n */\n updateSize() {\n const targetElement = this.getTargetElement();\n\n if (!targetElement) {\n this.setSize(undefined);\n } else {\n const computedStyle = getComputedStyle(targetElement);\n this.setSize([\n targetElement.offsetWidth -\n parseFloat(computedStyle['borderLeftWidth']) -\n parseFloat(computedStyle['paddingLeft']) -\n parseFloat(computedStyle['paddingRight']) -\n parseFloat(computedStyle['borderRightWidth']),\n targetElement.offsetHeight -\n parseFloat(computedStyle['borderTopWidth']) -\n parseFloat(computedStyle['paddingTop']) -\n parseFloat(computedStyle['paddingBottom']) -\n parseFloat(computedStyle['borderBottomWidth']),\n ]);\n }\n\n this.updateViewportSize_();\n }\n\n /**\n * Recomputes the viewport size and save it on the view object (if any)\n * @private\n */\n updateViewportSize_() {\n const view = this.getView();\n if (view) {\n let size = undefined;\n const computedStyle = getComputedStyle(this.viewport_);\n if (computedStyle.width && computedStyle.height) {\n size = [\n parseInt(computedStyle.width, 10),\n parseInt(computedStyle.height, 10),\n ];\n }\n view.setViewportSize(size);\n }\n }\n}\n\n/**\n * @param {MapOptions} options Map options.\n * @return {MapOptionsInternal} Internal map options.\n */\nfunction createOptionsInternal(options) {\n /**\n * @type {HTMLElement|Document}\n */\n let keyboardEventTarget = null;\n if (options.keyboardEventTarget !== undefined) {\n keyboardEventTarget =\n typeof options.keyboardEventTarget === 'string'\n ? document.getElementById(options.keyboardEventTarget)\n : options.keyboardEventTarget;\n }\n\n /**\n * @type {Object<string, *>}\n */\n const values = {};\n\n const layerGroup =\n options.layers &&\n typeof (/** @type {?} */ (options.layers).getLayers) === 'function'\n ? /** @type {LayerGroup} */ (options.layers)\n : new LayerGroup({layers: /** @type {Collection} */ (options.layers)});\n values[MapProperty.LAYERGROUP] = layerGroup;\n\n values[MapProperty.TARGET] = options.target;\n\n values[MapProperty.VIEW] =\n options.view !== undefined ? options.view : new View();\n\n let controls;\n if (options.controls !== undefined) {\n if (Array.isArray(options.controls)) {\n controls = new Collection(options.controls.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.controls).getArray) === 'function',\n 47\n ); // Expected `controls` to be an array or an `import(\"./Collection.js\").Collection`\n controls = /** @type {Collection} */ (options.controls);\n }\n }\n\n let interactions;\n if (options.interactions !== undefined) {\n if (Array.isArray(options.interactions)) {\n interactions = new Collection(options.interactions.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.interactions).getArray) ===\n 'function',\n 48\n ); // Expected `interactions` to be an array or an `import(\"./Collection.js\").Collection`\n interactions = /** @type {Collection} */ (options.interactions);\n }\n }\n\n let overlays;\n if (options.overlays !== undefined) {\n if (Array.isArray(options.overlays)) {\n overlays = new Collection(options.overlays.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.overlays).getArray) === 'function',\n 49\n ); // Expected `overlays` to be an array or an `import(\"./Collection.js\").Collection`\n overlays = options.overlays;\n }\n } else {\n overlays = new Collection();\n }\n\n return {\n controls: controls,\n interactions: interactions,\n keyboardEventTarget: keyboardEventTarget,\n overlays: overlays,\n values: values,\n };\n}\nexport default PluggableMap;\n","/**\n * @module ol/control/Control\n */\nimport BaseObject from '../Object.js';\nimport MapEventType from '../MapEventType.js';\nimport {VOID} from '../functions.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {removeNode} from '../dom.js';\n\n/**\n * @typedef {Object} Options\n * @property {HTMLElement} [element] The element is the control's\n * container element. This only needs to be specified if you're developing\n * a custom control.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want\n * the control to be rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control is a visible widget with a DOM element in a fixed position on the\n * screen. They can involve user input (buttons), or be informational only;\n * the position is determined using CSS. By default these are placed in the\n * container with CSS class name `ol-overlaycontainer-stopevent`, but can use\n * any outside DOM element.\n *\n * This is the base class for controls. You can use it for simple custom\n * controls by creating the element with listeners, creating an instance:\n * ```js\n * var myControl = new Control({element: myElement});\n * ```\n * and then adding this to the map.\n *\n * The main advantage of having this as a control rather than a simple separate\n * DOM element is that preventing propagation is handled for you. Controls\n * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.\n *\n * You can also extend this base for your own control class. See\n * examples/custom-controls for an example of how to do this.\n *\n * @api\n */\nclass Control extends BaseObject {\n /**\n * @param {Options} options Control options.\n */\n constructor(options) {\n super();\n\n const element = options.element;\n if (element && !options.target && !element.style.pointerEvents) {\n element.style.pointerEvents = 'auto';\n }\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = element ? element : null;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.target_ = null;\n\n /**\n * @private\n * @type {import(\"../PluggableMap.js\").default}\n */\n this.map_ = null;\n\n /**\n * @protected\n * @type {!Array<import(\"../events.js\").EventsKey>}\n */\n this.listenerKeys = [];\n\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.target) {\n this.setTarget(options.target);\n }\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n removeNode(this.element);\n super.disposeInternal();\n }\n\n /**\n * Get the map associated with this control.\n * @return {import(\"../PluggableMap.js\").default} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n if (this.map_) {\n removeNode(this.element);\n }\n for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys[i]);\n }\n this.listenerKeys.length = 0;\n this.map_ = map;\n if (this.map_) {\n const target = this.target_\n ? this.target_\n : map.getOverlayContainerStopEvent();\n target.appendChild(this.element);\n if (this.render !== VOID) {\n this.listenerKeys.push(\n listen(map, MapEventType.POSTRENDER, this.render, this)\n );\n }\n map.render();\n }\n }\n\n /**\n * Renders the control.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @api\n */\n render(mapEvent) {}\n\n /**\n * This function is used to set a target element for the control. It has no\n * effect if it is called after the control has been added to the map (i.e.\n * after `setMap` is called on the control). If no `target` is set in the\n * options passed to the control constructor and if `setTarget` is not called\n * then the control is added to the map's overlay container.\n * @param {HTMLElement|string} target Target.\n * @api\n */\n setTarget(target) {\n this.target_ =\n typeof target === 'string' ? document.getElementById(target) : target;\n }\n}\n\nexport default Control;\n","/**\n * @module ol/control/Attribution\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {equals} from '../array.js';\nimport {inView} from '../layer/Layer.js';\nimport {removeChildren, replaceNode} from '../dom.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-attribution'] CSS class name.\n * @property {HTMLElement|string} [target] Specify a target if you\n * want the control to be rendered outside of the map's\n * viewport.\n * @property {boolean} [collapsible] Specify if attributions can\n * be collapsed. If not specified, sources control this behavior with their\n * `attributionsCollapsible` setting.\n * @property {boolean} [collapsed=true] Specify if attributions should\n * be collapsed at startup.\n * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.\n * @property {string} [label='i'] Text label to use for the\n * collapsed attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [collapseLabel='»'] Text label to use\n * for the expanded attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n */\n\n/**\n * @classdesc\n * Control to show all the attributions associated with the layer sources\n * in the map. This control is one of the default controls included in maps.\n * By default it will show in the bottom right portion of the map, but this can\n * be changed by using a css selector for `.ol-attribution`.\n *\n * @api\n */\nclass Attribution extends Control {\n /**\n * @param {Options=} opt_options Attribution options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.ulElement_ = document.createElement('ul');\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overrideCollapsible_ = options.collapsible !== undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n const className =\n options.className !== undefined ? options.className : 'ol-attribution';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Attributions';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u00BB';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : 'i';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(activeLabel);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.ulElement_);\n element.appendChild(button);\n\n /**\n * A list of currently rendered resolutions.\n * @type {Array<string>}\n * @private\n */\n this.renderedAttributions_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * Collect a list of visible attributions and set the collapsible state.\n * @param {import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n * @return {Array<string>} Attributions.\n * @private\n */\n collectSourceAttributions_(frameState) {\n /**\n * Used to determine if an attribution already exists.\n * @type {!Object<string, boolean>}\n */\n const lookup = {};\n\n /**\n * A list of visible attributions.\n * @type {Array<string>}\n */\n const visibleAttributions = [];\n\n const layerStatesArray = frameState.layerStatesArray;\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const layerState = layerStatesArray[i];\n if (!inView(layerState, frameState.viewState)) {\n continue;\n }\n\n const source = /** @type {import(\"../layer/Layer.js\").default} */ (layerState.layer).getSource();\n if (!source) {\n continue;\n }\n\n const attributionGetter = source.getAttributions();\n if (!attributionGetter) {\n continue;\n }\n\n const attributions = attributionGetter(frameState);\n if (!attributions) {\n continue;\n }\n\n if (\n !this.overrideCollapsible_ &&\n source.getAttributionsCollapsible() === false\n ) {\n this.setCollapsible(false);\n }\n\n if (Array.isArray(attributions)) {\n for (let j = 0, jj = attributions.length; j < jj; ++j) {\n if (!(attributions[j] in lookup)) {\n visibleAttributions.push(attributions[j]);\n lookup[attributions[j]] = true;\n }\n }\n } else {\n if (!(attributions in lookup)) {\n visibleAttributions.push(attributions);\n lookup[attributions] = true;\n }\n }\n }\n return visibleAttributions;\n }\n\n /**\n * @private\n * @param {?import(\"../PluggableMap.js\").FrameState} frameState Frame state.\n */\n updateElement_(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const attributions = this.collectSourceAttributions_(frameState);\n\n const visible = attributions.length > 0;\n if (this.renderedVisible_ != visible) {\n this.element.style.display = visible ? '' : 'none';\n this.renderedVisible_ = visible;\n }\n\n if (equals(attributions, this.renderedAttributions_)) {\n return;\n }\n\n removeChildren(this.ulElement_);\n\n // append the attributions\n for (let i = 0, ii = attributions.length; i < ii; ++i) {\n const element = document.createElement('li');\n element.innerHTML = attributions[i];\n this.ulElement_.appendChild(element);\n }\n\n this.renderedAttributions_ = attributions;\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n }\n\n /**\n * Return `true` if the attribution is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the attribution should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (!collapsible && this.collapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the attribution according to the passed parameter. Will\n * not do anything if the attribution isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Return `true` when the attribution is currently collapsed or `false`\n * otherwise.\n * @return {boolean} True if the widget is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Update the attribution element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.updateElement_(mapEvent.frameState);\n }\n}\n\nexport default Attribution;\n","/**\n * @module ol/control/Rotate\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-rotate'] CSS class name.\n * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {boolean} [autoHide=true] Hide the control when rotation is 0.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control should\n * be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {function():void} [resetNorth] Function called when the control is clicked.\n * This will override the default `resetNorth`.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A button control to reset rotation to 0.\n * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css\n * selector is added to the button when the rotation is 0.\n *\n * @api\n */\nclass Rotate extends Control {\n /**\n * @param {Options=} opt_options Rotate options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-rotate';\n\n const label = options.label !== undefined ? options.label : '\\u21E7';\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.label_ = null;\n\n if (typeof label === 'string') {\n this.label_ = document.createElement('span');\n this.label_.className = 'ol-compass';\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n this.label_.classList.add('ol-compass');\n }\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';\n\n const button = document.createElement('button');\n button.className = className + '-reset';\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(this.label_);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n\n this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n if (this.autoHide_) {\n this.element.classList.add(CLASS_HIDDEN);\n }\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n if (this.callResetNorth_ !== undefined) {\n this.callResetNorth_();\n } else {\n this.resetNorth_();\n }\n }\n\n /**\n * @private\n */\n resetNorth_() {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const rotation = view.getRotation();\n if (rotation !== undefined) {\n if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {\n view.animate({\n rotation: 0,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setRotation(0);\n }\n }\n }\n\n /**\n * Update the rotate control element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n return;\n }\n const rotation = frameState.viewState.rotation;\n if (rotation != this.rotation_) {\n const transform = 'rotate(' + rotation + 'rad)';\n if (this.autoHide_) {\n const contains = this.element.classList.contains(CLASS_HIDDEN);\n if (!contains && rotation === 0) {\n this.element.classList.add(CLASS_HIDDEN);\n } else if (contains && rotation !== 0) {\n this.element.classList.remove(CLASS_HIDDEN);\n }\n }\n this.label_.style.transform = transform;\n }\n this.rotation_ = rotation;\n }\n}\n\nexport default Rotate;\n","/**\n * @module ol/control/Zoom\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {string} [className='ol-zoom'] CSS class name.\n * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in\n * button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [zoomOutLabel='-'] Text label to use for the zoom-out button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.\n * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.\n * @property {number} [delta=1] The zoom delta applied on each click.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control with 2 buttons, one for zoom in and one for zoom out.\n * This control is one of the default controls of a map. To style this control\n * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.\n *\n * @api\n */\nclass Zoom extends Control {\n /**\n * @param {Options=} opt_options Zoom options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom';\n\n const delta = options.delta !== undefined ? options.delta : 1;\n\n const zoomInLabel =\n options.zoomInLabel !== undefined ? options.zoomInLabel : '+';\n const zoomOutLabel =\n options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\\u2212';\n\n const zoomInTipLabel =\n options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';\n const zoomOutTipLabel =\n options.zoomOutTipLabel !== undefined\n ? options.zoomOutTipLabel\n : 'Zoom out';\n\n const inElement = document.createElement('button');\n inElement.className = className + '-in';\n inElement.setAttribute('type', 'button');\n inElement.title = zoomInTipLabel;\n inElement.appendChild(\n typeof zoomInLabel === 'string'\n ? document.createTextNode(zoomInLabel)\n : zoomInLabel\n );\n\n inElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, delta),\n false\n );\n\n const outElement = document.createElement('button');\n outElement.className = className + '-out';\n outElement.setAttribute('type', 'button');\n outElement.title = zoomOutTipLabel;\n outElement.appendChild(\n typeof zoomOutLabel === 'string'\n ? document.createTextNode(zoomOutLabel)\n : zoomOutLabel\n );\n\n outElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, -delta),\n false\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(inElement);\n element.appendChild(outElement);\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(delta, event) {\n event.preventDefault();\n this.zoomByDelta_(delta);\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @private\n */\n zoomByDelta_(delta) {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const currentZoom = view.getZoom();\n if (currentZoom !== undefined) {\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n if (this.duration_ > 0) {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n zoom: newZoom,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setZoom(newZoom);\n }\n }\n }\n}\n\nexport default Zoom;\n","/**\n * @module ol/control/FullScreen\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE, CLASS_UNSUPPORTED} from '../css.js';\nimport {listen} from '../events.js';\nimport {replaceNode} from '../dom.js';\n\nconst events = [\n 'fullscreenchange',\n 'webkitfullscreenchange',\n 'MSFullscreenChange',\n];\n\n/**\n * @enum {string}\n */\nconst FullScreenEventType = {\n /**\n * Triggered after the map entered fullscreen.\n * @event FullScreenEventType#enterfullscreen\n * @api\n */\n ENTERFULLSCREEN: 'enterfullscreen',\n\n /**\n * Triggered after the map leave fullscreen.\n * @event FullScreenEventType#leavefullscreen\n * @api\n */\n LEAVEFULLSCREEN: 'leavefullscreen',\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-full-screen'] CSS class name.\n * @property {string|Text} [label='\\u2922'] Text label to use for the button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|Text} [labelActive='\\u00d7'] Text label to use for the\n * button when full-screen is active.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.\n * @property {boolean} [keys=false] Full keyboard access.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {HTMLElement|string} [source] The element to be displayed\n * fullscreen. When not provided, the element containing the map viewport will\n * be displayed fullscreen.\n */\n\n/**\n * @classdesc\n * Provides a button that when clicked fills up the full screen with the map.\n * The full screen source element is by default the element containing the map viewport unless\n * overridden by providing the `source` option. In which case, the dom\n * element introduced using this parameter will be displayed in full screen.\n *\n * When in full screen mode, a close button is shown to exit full screen mode.\n * The [Fullscreen API](http://www.w3.org/TR/fullscreen/) is used to\n * toggle the map in full screen mode.\n *\n * @fires FullScreenEventType#enterfullscreen\n * @fires FullScreenEventType#leavefullscreen\n * @api\n */\nclass FullScreen extends Control {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n /**\n * @private\n * @type {string}\n */\n this.cssClassName_ =\n options.className !== undefined ? options.className : 'ol-full-screen';\n\n const label = options.label !== undefined ? options.label : '\\u2922';\n\n /**\n * @private\n * @type {Text}\n */\n this.labelNode_ =\n typeof label === 'string' ? document.createTextNode(label) : label;\n\n const labelActive =\n options.labelActive !== undefined ? options.labelActive : '\\u00d7';\n\n /**\n * @private\n * @type {Text}\n */\n this.labelActiveNode_ =\n typeof labelActive === 'string'\n ? document.createTextNode(labelActive)\n : labelActive;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.button_ = document.createElement('button');\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';\n this.setClassName_(this.button_, isFullScreen());\n this.button_.setAttribute('type', 'button');\n this.button_.title = tipLabel;\n this.button_.appendChild(this.labelNode_);\n\n this.button_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n const cssClasses =\n this.cssClassName_ +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n ' ' +\n (!isFullScreenSupported() ? CLASS_UNSUPPORTED : '');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.button_);\n\n /**\n * @private\n * @type {boolean}\n */\n this.keys_ = options.keys !== undefined ? options.keys : false;\n\n /**\n * @private\n * @type {HTMLElement|string|undefined}\n */\n this.source_ = options.source;\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleFullScreen_();\n }\n\n /**\n * @private\n */\n handleFullScreen_() {\n if (!isFullScreenSupported()) {\n return;\n }\n const map = this.getMap();\n if (!map) {\n return;\n }\n if (isFullScreen()) {\n exitFullScreen();\n } else {\n let element;\n if (this.source_) {\n element =\n typeof this.source_ === 'string'\n ? document.getElementById(this.source_)\n : this.source_;\n } else {\n element = map.getTargetElement();\n }\n if (this.keys_) {\n requestFullScreenWithKeys(element);\n } else {\n requestFullScreen(element);\n }\n }\n }\n\n /**\n * @private\n */\n handleFullScreenChange_() {\n const map = this.getMap();\n if (isFullScreen()) {\n this.setClassName_(this.button_, true);\n replaceNode(this.labelActiveNode_, this.labelNode_);\n this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN);\n } else {\n this.setClassName_(this.button_, false);\n replaceNode(this.labelNode_, this.labelActiveNode_);\n this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN);\n }\n if (map) {\n map.updateSize();\n }\n }\n\n /**\n * @param {HTMLElement} element Target element\n * @param {boolean} fullscreen True if fullscreen class name should be active\n * @private\n */\n setClassName_(element, fullscreen) {\n const activeClassName = this.cssClassName_ + '-true';\n const inactiveClassName = this.cssClassName_ + '-false';\n const nextClassName = fullscreen ? activeClassName : inactiveClassName;\n element.classList.remove(activeClassName);\n element.classList.remove(inactiveClassName);\n element.classList.add(nextClassName);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n for (let i = 0, ii = events.length; i < ii; ++i) {\n this.listenerKeys.push(\n listen(document, events[i], this.handleFullScreenChange_, this)\n );\n }\n }\n }\n}\n\n/**\n * @return {boolean} Fullscreen is supported by the current platform.\n */\nfunction isFullScreenSupported() {\n const body = document.body;\n return !!(\n body['webkitRequestFullscreen'] ||\n (body['msRequestFullscreen'] && document['msFullscreenEnabled']) ||\n (body.requestFullscreen && document.fullscreenEnabled)\n );\n}\n\n/**\n * @return {boolean} Element is currently in fullscreen.\n */\nfunction isFullScreen() {\n return !!(\n document['webkitIsFullScreen'] ||\n document['msFullscreenElement'] ||\n document.fullscreenElement\n );\n}\n\n/**\n * Request to fullscreen an element.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreen(element) {\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element['msRequestFullscreen']) {\n element['msRequestFullscreen']();\n } else if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n }\n}\n\n/**\n * Request to fullscreen an element with keyboard input.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreenWithKeys(element) {\n if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n } else {\n requestFullScreen(element);\n }\n}\n\n/**\n * Exit fullscreen.\n */\nfunction exitFullScreen() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document['msExitFullscreen']) {\n document['msExitFullscreen']();\n } else if (document['webkitExitFullscreen']) {\n document['webkitExitFullscreen']();\n }\n}\n\nexport default FullScreen;\n","/**\n * @module ol/control/MousePosition\n */\n\nimport Control from './Control.js';\nimport EventType from '../pointer/EventType.js';\nimport {getChangeEventType} from '../Object.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n getUserProjection,\n identityTransform,\n} from '../proj.js';\nimport {listen} from '../events.js';\n\n/**\n * @type {string}\n */\nconst PROJECTION = 'projection';\n\n/**\n * @type {string}\n */\nconst COORDINATE_FORMAT = 'coordinateFormat';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-mouse-position'] CSS class name.\n * @property {import(\"../coordinate.js\").CoordinateFormat} [coordinateFormat] Coordinate format.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the\n * control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {string} [undefinedHTML=' '] Markup to show when coordinates are not\n * available (e.g. when the pointer leaves the map viewport). By default, the last position\n * will be replaced with `' '` (` `) when the pointer leaves the viewport. To\n * retain the last rendered position, set this option to something falsey (like an empty\n * string `''`).\n */\n\n/**\n * @classdesc\n * A control to show the 2D coordinates of the mouse cursor. By default, these\n * are in the view projection, but can be in any supported projection.\n * By default the control is shown in the top right corner of the map, but this\n * can be changed by using the css selector `.ol-mouse-position`.\n *\n * On touch devices, which usually do not have a mouse cursor, the coordinates\n * of the currently touched position are shown.\n *\n * @api\n */\nclass MousePosition extends Control {\n /**\n * @param {Options=} opt_options Mouse position options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const element = document.createElement('div');\n element.className =\n options.className !== undefined ? options.className : 'ol-mouse-position';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n this.addEventListener(\n getChangeEventType(PROJECTION),\n this.handleProjectionChanged_\n );\n\n if (options.coordinateFormat) {\n this.setCoordinateFormat(options.coordinateFormat);\n }\n if (options.projection) {\n this.setProjection(options.projection);\n }\n\n /**\n * @private\n * @type {string}\n */\n this.undefinedHTML_ =\n options.undefinedHTML !== undefined ? options.undefinedHTML : ' ';\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderOnMouseOut_ = !!this.undefinedHTML_;\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = element.innerHTML;\n\n /**\n * @private\n * @type {?import(\"../proj/Projection.js\").default}\n */\n this.mapProjection_ = null;\n\n /**\n * @private\n * @type {?import(\"../proj.js\").TransformFunction}\n */\n this.transform_ = null;\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n this.transform_ = null;\n }\n\n /**\n * Return the coordinate format type used to render the current position or\n * undefined.\n * @return {import(\"../coordinate.js\").CoordinateFormat|undefined} The format to render the current\n * position in.\n * @observable\n * @api\n */\n getCoordinateFormat() {\n return /** @type {import(\"../coordinate.js\").CoordinateFormat|undefined} */ (this.get(\n COORDINATE_FORMAT\n ));\n }\n\n /**\n * Return the projection that is used to report the mouse position.\n * @return {import(\"../proj/Projection.js\").default|undefined} The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"../proj/Projection.js\").default|undefined} */ (this.get(\n PROJECTION\n ));\n }\n\n /**\n * @param {MouseEvent} event Browser event.\n * @protected\n */\n handleMouseMove(event) {\n const map = this.getMap();\n this.updateHTML_(map.getEventPixel(event));\n }\n\n /**\n * @param {Event} event Browser event.\n * @protected\n */\n handleMouseOut(event) {\n this.updateHTML_(null);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n const viewport = map.getViewport();\n this.listenerKeys.push(\n listen(viewport, EventType.POINTERMOVE, this.handleMouseMove, this)\n );\n if (this.renderOnMouseOut_) {\n this.listenerKeys.push(\n listen(viewport, EventType.POINTEROUT, this.handleMouseOut, this)\n );\n }\n }\n }\n\n /**\n * Set the coordinate format type used to render the current position.\n * @param {import(\"../coordinate.js\").CoordinateFormat} format The format to render the current\n * position in.\n * @observable\n * @api\n */\n setCoordinateFormat(format) {\n this.set(COORDINATE_FORMAT, format);\n }\n\n /**\n * Set the projection that is used to report the mouse position.\n * @param {import(\"../proj.js\").ProjectionLike} projection The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(PROJECTION, getProjection(projection));\n }\n\n /**\n * @param {?import(\"../pixel.js\").Pixel} pixel Pixel.\n * @private\n */\n updateHTML_(pixel) {\n let html = this.undefinedHTML_;\n if (pixel && this.mapProjection_) {\n if (!this.transform_) {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n projection\n );\n } else {\n this.transform_ = identityTransform;\n }\n }\n const map = this.getMap();\n const coordinate = map.getCoordinateFromPixelInternal(pixel);\n if (coordinate) {\n const userProjection = getUserProjection();\n if (userProjection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n userProjection\n );\n }\n this.transform_(coordinate, coordinate);\n const coordinateFormat = this.getCoordinateFormat();\n if (coordinateFormat) {\n html = coordinateFormat(coordinate);\n } else {\n html = coordinate.toString();\n }\n }\n }\n if (!this.renderedHTML_ || html !== this.renderedHTML_) {\n this.element.innerHTML = html;\n this.renderedHTML_ = html;\n }\n }\n\n /**\n * Update the projection. Rendering of the coordinates is done in\n * `handleMouseMove` and `handleMouseUp`.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.mapProjection_ = null;\n } else {\n if (this.mapProjection_ != frameState.viewState.projection) {\n this.mapProjection_ = frameState.viewState.projection;\n this.transform_ = null;\n }\n }\n }\n}\n\nexport default MousePosition;\n","/**\n * @module ol/OverlayPositioning\n */\n\n/**\n * Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, `'top-right'`\n * @enum {string}\n */\nexport default {\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_CENTER: 'bottom-center',\n BOTTOM_RIGHT: 'bottom-right',\n CENTER_LEFT: 'center-left',\n CENTER_CENTER: 'center-center',\n CENTER_RIGHT: 'center-right',\n TOP_LEFT: 'top-left',\n TOP_CENTER: 'top-center',\n TOP_RIGHT: 'top-right',\n};\n","/**\n * @module ol/Overlay\n */\nimport BaseObject, {getChangeEventType} from './Object.js';\nimport MapEventType from './MapEventType.js';\nimport OverlayPositioning from './OverlayPositioning.js';\nimport {CLASS_SELECTABLE} from './css.js';\nimport {containsExtent} from './extent.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {outerHeight, outerWidth, removeChildren, removeNode} from './dom.js';\n\n/**\n * @typedef {Object} Options\n * @property {number|string} [id] Set the overlay id. The overlay id can be used\n * with the {@link module:ol/Map~Map#getOverlayById} method.\n * @property {HTMLElement} [element] The overlay element.\n * @property {Array<number>} [offset=[0, 0]] Offsets in pixels used when positioning\n * the overlay. The first element in the\n * array is the horizontal offset. A positive value shifts the overlay right.\n * The second element in the array is the vertical offset. A positive value\n * shifts the overlay down.\n * @property {import(\"./coordinate.js\").Coordinate} [position] The overlay position\n * in map projection.\n * @property {import(\"./OverlayPositioning.js\").default} [positioning='top-left'] Defines how\n * the overlay is actually positioned with respect to its `position` property.\n * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, and `'top-right'`.\n * @property {boolean} [stopEvent=true] Whether event propagation to the map\n * viewport should be stopped. If `true` the overlay is placed in the same\n * container as that of the controls (CSS class name\n * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container\n * with CSS class name specified by the `className` property.\n * @property {boolean} [insertFirst=true] Whether the overlay is inserted first\n * in the overlay container, or appended. If the overlay is placed in the same\n * container as that of the controls (see the `stopEvent` option) you will\n * probably set `insertFirst` to `true` so the overlay is displayed below the\n * controls.\n * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling\n * `setPosition`, so that the overlay is entirely visible in the current viewport?\n * If `true` (deprecated), then `autoPanAnimation` and `autoPanMargin` will be\n * used to determine the panning parameters; if an object is supplied then other\n * parameters are ignored.\n * @property {PanOptions} [autoPanAnimation] The animation options used to pan\n * the overlay into view. This animation is only used when `autoPan` is enabled.\n * A `duration` and `easing` may be provided to customize the animation.\n * Deprecated and ignored if `autoPan` is supplied as an object.\n * @property {number} [autoPanMargin=20] The margin (in pixels) between the\n * overlay and the borders of the map when autopanning. Deprecated and ignored\n * if `autoPan` is supplied as an object.\n * @property {PanIntoViewOptions} [autoPanOptions] The options to use for the\n * autoPan. This is only used when `autoPan` is enabled and has preference over\n * the individual `autoPanMargin` and `autoPanOptions`.\n * @property {string} [className='ol-overlay-container ol-selectable'] CSS class\n * name.\n */\n\n/**\n * @typedef {Object} PanOptions\n * @property {number} [duration=1000] The duration of the animation in\n * milliseconds.\n * @property {function(number):number} [easing] The easing function to use. Can\n * be one from {@link module:ol/easing} or a custom function.\n * Default is {@link module:ol/easing~inAndOut}.\n */\n\n/**\n * @typedef {Object} PanIntoViewOptions\n * @property {PanOptions} [animation={}] The animation parameters for the pan\n * @property {number} [margin=20] The margin (in pixels) between the\n * overlay and the borders of the map when panning into view.\n */\n\n/**\n * @enum {string}\n * @protected\n */\nconst Property = {\n ELEMENT: 'element',\n MAP: 'map',\n OFFSET: 'offset',\n POSITION: 'position',\n POSITIONING: 'positioning',\n};\n\n/**\n * @classdesc\n * An element to be displayed over the map and attached to a single map\n * location. Like {@link module:ol/control/Control~Control}, Overlays are\n * visible widgets. Unlike Controls, they are not in a fixed position on the\n * screen, but are tied to a geographical coordinate, so panning the map will\n * move an Overlay but not a Control.\n *\n * Example:\n *\n * import Overlay from 'ol/Overlay';\n *\n * var popup = new Overlay({\n * element: document.getElementById('popup')\n * });\n * popup.setPosition(coordinate);\n * map.addOverlay(popup);\n *\n * @api\n */\nclass Overlay extends BaseObject {\n /**\n * @param {Options} options Overlay options.\n */\n constructor(options) {\n super();\n\n /**\n * @protected\n * @type {Options}\n */\n this.options = options;\n\n /**\n * @protected\n * @type {number|string|undefined}\n */\n this.id = options.id;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.insertFirst =\n options.insertFirst !== undefined ? options.insertFirst : true;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true;\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = document.createElement('div');\n this.element.className =\n options.className !== undefined\n ? options.className\n : 'ol-overlay-container ' + CLASS_SELECTABLE;\n this.element.style.position = 'absolute';\n this.element.style.pointerEvents = 'auto';\n\n let autoPan = options.autoPan;\n if (autoPan && 'object' !== typeof autoPan) {\n autoPan = {\n animation: options.autoPanAnimation,\n margin: options.autoPanMargin,\n };\n }\n /**\n * @protected\n * @type {PanIntoViewOptions|false}\n */\n this.autoPan = /** @type {PanIntoViewOptions} */ (autoPan) || false;\n\n /**\n * @protected\n * @type {{transform_: string,\n * visible: boolean}}\n */\n this.rendered = {\n transform_: '',\n visible: true,\n };\n\n /**\n * @protected\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.mapPostrenderListenerKey = null;\n\n this.addEventListener(\n getChangeEventType(Property.ELEMENT),\n this.handleElementChanged\n );\n this.addEventListener(\n getChangeEventType(Property.MAP),\n this.handleMapChanged\n );\n this.addEventListener(\n getChangeEventType(Property.OFFSET),\n this.handleOffsetChanged\n );\n this.addEventListener(\n getChangeEventType(Property.POSITION),\n this.handlePositionChanged\n );\n this.addEventListener(\n getChangeEventType(Property.POSITIONING),\n this.handlePositioningChanged\n );\n\n if (options.element !== undefined) {\n this.setElement(options.element);\n }\n\n this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);\n\n this.setPositioning(\n options.positioning !== undefined\n ? /** @type {import(\"./OverlayPositioning.js\").default} */ (options.positioning)\n : OverlayPositioning.TOP_LEFT\n );\n\n if (options.position !== undefined) {\n this.setPosition(options.position);\n }\n }\n\n /**\n * Get the DOM element of this overlay.\n * @return {HTMLElement|undefined} The Element containing the overlay.\n * @observable\n * @api\n */\n getElement() {\n return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));\n }\n\n /**\n * Get the overlay identifier which is set on constructor.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id;\n }\n\n /**\n * Get the map associated with this overlay.\n * @return {import(\"./PluggableMap.js\").default|undefined} The map that the\n * overlay is part of.\n * @observable\n * @api\n */\n getMap() {\n return /** @type {import(\"./PluggableMap.js\").default|undefined} */ (this.get(\n Property.MAP\n ));\n }\n\n /**\n * Get the offset of this overlay.\n * @return {Array<number>} The offset.\n * @observable\n * @api\n */\n getOffset() {\n return /** @type {Array<number>} */ (this.get(Property.OFFSET));\n }\n\n /**\n * Get the current position of this overlay.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The spatial point that the overlay is\n * anchored at.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (this.get(\n Property.POSITION\n ));\n }\n\n /**\n * Get the current positioning of this overlay.\n * @return {import(\"./OverlayPositioning.js\").default} How the overlay is positioned\n * relative to its point on the map.\n * @observable\n * @api\n */\n getPositioning() {\n return /** @type {import(\"./OverlayPositioning.js\").default} */ (this.get(\n Property.POSITIONING\n ));\n }\n\n /**\n * @protected\n */\n handleElementChanged() {\n removeChildren(this.element);\n const element = this.getElement();\n if (element) {\n this.element.appendChild(element);\n }\n }\n\n /**\n * @protected\n */\n handleMapChanged() {\n if (this.mapPostrenderListenerKey) {\n removeNode(this.element);\n unlistenByKey(this.mapPostrenderListenerKey);\n this.mapPostrenderListenerKey = null;\n }\n const map = this.getMap();\n if (map) {\n this.mapPostrenderListenerKey = listen(\n map,\n MapEventType.POSTRENDER,\n this.render,\n this\n );\n this.updatePixelPosition();\n const container = this.stopEvent\n ? map.getOverlayContainerStopEvent()\n : map.getOverlayContainer();\n if (this.insertFirst) {\n container.insertBefore(this.element, container.childNodes[0] || null);\n } else {\n container.appendChild(this.element);\n }\n this.performAutoPan();\n }\n }\n\n /**\n * @protected\n */\n render() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handleOffsetChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handlePositionChanged() {\n this.updatePixelPosition();\n this.performAutoPan();\n }\n\n /**\n * @protected\n */\n handlePositioningChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * Set the DOM element to be associated with this overlay.\n * @param {HTMLElement|undefined} element The Element containing the overlay.\n * @observable\n * @api\n */\n setElement(element) {\n this.set(Property.ELEMENT, element);\n }\n\n /**\n * Set the map to be associated with this overlay.\n * @param {import(\"./PluggableMap.js\").default|undefined} map The map that the\n * overlay is part of.\n * @observable\n * @api\n */\n setMap(map) {\n this.set(Property.MAP, map);\n }\n\n /**\n * Set the offset for this overlay.\n * @param {Array<number>} offset Offset.\n * @observable\n * @api\n */\n setOffset(offset) {\n this.set(Property.OFFSET, offset);\n }\n\n /**\n * Set the position for this overlay. If the position is `undefined` the\n * overlay is hidden.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} position The spatial point that the overlay\n * is anchored at.\n * @observable\n * @api\n */\n setPosition(position) {\n this.set(Property.POSITION, position);\n }\n\n /**\n * Pan the map so that the overlay is entirely visisble in the current viewport\n * (if necessary) using the configured autoPan parameters\n * @protected\n */\n performAutoPan() {\n if (this.autoPan) {\n this.panIntoView(this.autoPan);\n }\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary).\n * @param {PanIntoViewOptions=} opt_panIntoViewOptions Options for the pan action\n * @api\n */\n panIntoView(opt_panIntoViewOptions) {\n const map = this.getMap();\n\n if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {\n return;\n }\n\n const mapRect = this.getRect(map.getTargetElement(), map.getSize());\n const element = this.getElement();\n const overlayRect = this.getRect(element, [\n outerWidth(element),\n outerHeight(element),\n ]);\n\n const panIntoViewOptions = opt_panIntoViewOptions || {};\n\n const myMargin =\n panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin;\n if (!containsExtent(mapRect, overlayRect)) {\n // the overlay is not completely inside the viewport, so pan the map\n const offsetLeft = overlayRect[0] - mapRect[0];\n const offsetRight = mapRect[2] - overlayRect[2];\n const offsetTop = overlayRect[1] - mapRect[1];\n const offsetBottom = mapRect[3] - overlayRect[3];\n\n const delta = [0, 0];\n if (offsetLeft < 0) {\n // move map to the left\n delta[0] = offsetLeft - myMargin;\n } else if (offsetRight < 0) {\n // move map to the right\n delta[0] = Math.abs(offsetRight) + myMargin;\n }\n if (offsetTop < 0) {\n // move map up\n delta[1] = offsetTop - myMargin;\n } else if (offsetBottom < 0) {\n // move map down\n delta[1] = Math.abs(offsetBottom) + myMargin;\n }\n\n if (delta[0] !== 0 || delta[1] !== 0) {\n const center = /** @type {import(\"./coordinate.js\").Coordinate} */ (map\n .getView()\n .getCenterInternal());\n const centerPx = map.getPixelFromCoordinateInternal(center);\n const newCenterPx = [centerPx[0] + delta[0], centerPx[1] + delta[1]];\n\n const panOptions = panIntoViewOptions.animation || {};\n map.getView().animateInternal({\n center: map.getCoordinateFromPixelInternal(newCenterPx),\n duration: panOptions.duration,\n easing: panOptions.easing,\n });\n }\n }\n }\n\n /**\n * Get the extent of an element relative to the document\n * @param {HTMLElement} element The element.\n * @param {import(\"./size.js\").Size} size The size of the element.\n * @return {import(\"./extent.js\").Extent} The extent.\n * @protected\n */\n getRect(element, size) {\n const box = element.getBoundingClientRect();\n const offsetX = box.left + window.pageXOffset;\n const offsetY = box.top + window.pageYOffset;\n return [offsetX, offsetY, offsetX + size[0], offsetY + size[1]];\n }\n\n /**\n * Set the positioning for this overlay.\n * @param {import(\"./OverlayPositioning.js\").default} positioning how the overlay is\n * positioned relative to its point on the map.\n * @observable\n * @api\n */\n setPositioning(positioning) {\n this.set(Property.POSITIONING, positioning);\n }\n\n /**\n * Modify the visibility of the element.\n * @param {boolean} visible Element visibility.\n * @protected\n */\n setVisible(visible) {\n if (this.rendered.visible !== visible) {\n this.element.style.display = visible ? '' : 'none';\n this.rendered.visible = visible;\n }\n }\n\n /**\n * Update pixel position.\n * @protected\n */\n updatePixelPosition() {\n const map = this.getMap();\n const position = this.getPosition();\n if (!map || !map.isRendered() || !position) {\n this.setVisible(false);\n return;\n }\n\n const pixel = map.getPixelFromCoordinate(position);\n const mapSize = map.getSize();\n this.updateRenderedPosition(pixel, mapSize);\n }\n\n /**\n * @param {import(\"./pixel.js\").Pixel} pixel The pixel location.\n * @param {import(\"./size.js\").Size|undefined} mapSize The map size.\n * @protected\n */\n updateRenderedPosition(pixel, mapSize) {\n const style = this.element.style;\n const offset = this.getOffset();\n\n const positioning = this.getPositioning();\n\n this.setVisible(true);\n\n const x = Math.round(pixel[0] + offset[0]) + 'px';\n const y = Math.round(pixel[1] + offset[1]) + 'px';\n let posX = '0%';\n let posY = '0%';\n if (\n positioning == OverlayPositioning.BOTTOM_RIGHT ||\n positioning == OverlayPositioning.CENTER_RIGHT ||\n positioning == OverlayPositioning.TOP_RIGHT\n ) {\n posX = '-100%';\n } else if (\n positioning == OverlayPositioning.BOTTOM_CENTER ||\n positioning == OverlayPositioning.CENTER_CENTER ||\n positioning == OverlayPositioning.TOP_CENTER\n ) {\n posX = '-50%';\n }\n if (\n positioning == OverlayPositioning.BOTTOM_LEFT ||\n positioning == OverlayPositioning.BOTTOM_CENTER ||\n positioning == OverlayPositioning.BOTTOM_RIGHT\n ) {\n posY = '-100%';\n } else if (\n positioning == OverlayPositioning.CENTER_LEFT ||\n positioning == OverlayPositioning.CENTER_CENTER ||\n positioning == OverlayPositioning.CENTER_RIGHT\n ) {\n posY = '-50%';\n }\n const transform = `translate(${posX}, ${posY}) translate(${x}, ${y})`;\n if (this.rendered.transform_ != transform) {\n this.rendered.transform_ = transform;\n style.transform = transform;\n // @ts-ignore IE9\n style.msTransform = transform;\n }\n }\n\n /**\n * returns the options this Overlay has been created with\n * @return {Options} overlay options\n */\n getOptions() {\n return this.options;\n }\n}\n\nexport default Overlay;\n","/**\n * @module ol/control/OverviewMap\n */\nimport CompositeMapRenderer from '../renderer/Composite.js';\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport MapEventType from '../MapEventType.js';\nimport MapProperty from '../MapProperty.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport Overlay from '../Overlay.js';\nimport OverlayPositioning from '../OverlayPositioning.js';\nimport PluggableMap from '../PluggableMap.js';\nimport View from '../View.js';\nimport ViewProperty from '../ViewProperty.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {\n containsExtent,\n equals as equalsExtent,\n getBottomRight,\n getTopLeft,\n scaleFromCenter,\n} from '../extent.js';\nimport {getChangeEventType} from '../Object.js';\nimport {listen, listenOnce} from '../events.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport {replaceNode} from '../dom.js';\n\n/**\n * Maximum width and/or height extent ratio that determines when the overview\n * map should be zoomed out.\n * @type {number}\n */\nconst MAX_RATIO = 0.75;\n\n/**\n * Minimum width and/or height extent ratio that determines when the overview\n * map should be zoomed in.\n * @type {number}\n */\nconst MIN_RATIO = 0.1;\n\nclass ControlledMap extends PluggableMap {\n createRenderer() {\n return new CompositeMapRenderer(this);\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-overviewmap'] CSS class name.\n * @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).\n * @property {string|HTMLElement} [collapseLabel='«'] Text label to use for the\n * expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {boolean} [collapsible=true] Whether the control can be collapsed or not.\n * @property {string|HTMLElement} [label='»'] Text label to use for the collapsed\n * overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {Array<import(\"../layer/Layer.js\").default>|import(\"../Collection.js\").default<import(\"../layer/Layer.js\").default>} [layers]\n * Layers for the overview map.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {string} [tipLabel='Overview map'] Text label to use for the button tip.\n * @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,\n * a default view with the same projection as the main map will be used.\n */\n\n/**\n * Create a new control with a map acting as an overview map for another\n * defined map.\n *\n * @api\n */\nclass OverviewMap extends Control {\n /**\n * @param {Options=} opt_options OverviewMap options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n */\n this.boundHandleRotationChanged_ = this.handleRotationChanged_.bind(this);\n\n /**\n * @type {boolean}\n * @private\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent|undefined}\n */\n this.viewExtent_ = undefined;\n\n const className =\n options.className !== undefined ? options.className : 'ol-overviewmap';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Overview map';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u00AB';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : '\\u00BB';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(activeLabel);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.ovmapDiv_ = document.createElement('div');\n this.ovmapDiv_.className = 'ol-overviewmap-map';\n\n /**\n * Explicitly given view to be used instead of a view derived from the main map.\n * @type {View}\n * @private\n */\n this.view_ = options.view;\n\n /**\n * @type {ControlledMap}\n * @private\n */\n this.ovmap_ = new ControlledMap({\n view: options.view,\n });\n const ovmap = this.ovmap_;\n\n if (options.layers) {\n options.layers.forEach(function (layer) {\n ovmap.addLayer(layer);\n });\n }\n\n const box = document.createElement('div');\n box.className = 'ol-overviewmap-box';\n box.style.boxSizing = 'border-box';\n\n /**\n * @type {import(\"../Overlay.js\").default}\n * @private\n */\n this.boxOverlay_ = new Overlay({\n position: [0, 0],\n positioning: OverlayPositioning.CENTER_CENTER,\n element: box,\n });\n this.ovmap_.addOverlay(this.boxOverlay_);\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.ovmapDiv_);\n element.appendChild(button);\n\n /* Interactive map */\n\n const scope = this;\n\n const overlay = this.boxOverlay_;\n const overlayBox = this.boxOverlay_.getElement();\n\n /* Functions definition */\n\n const computeDesiredMousePosition = function (mousePosition) {\n return {\n clientX: mousePosition.clientX,\n clientY: mousePosition.clientY,\n };\n };\n\n const move = function (event) {\n const position = /** @type {?} */ (computeDesiredMousePosition(event));\n const coordinates = ovmap.getEventCoordinateInternal(\n /** @type {MouseEvent} */ (position)\n );\n\n overlay.setPosition(coordinates);\n };\n\n const endMoving = function (event) {\n const coordinates = ovmap.getEventCoordinateInternal(event);\n\n scope.getMap().getView().setCenterInternal(coordinates);\n\n window.removeEventListener('mousemove', move);\n window.removeEventListener('mouseup', endMoving);\n };\n\n /* Binding */\n\n overlayBox.addEventListener('mousedown', function () {\n window.addEventListener('mousemove', move);\n window.addEventListener('mouseup', endMoving);\n });\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (map === oldMap) {\n return;\n }\n if (oldMap) {\n const oldView = oldMap.getView();\n if (oldView) {\n this.unbindView_(oldView);\n }\n this.ovmap_.setTarget(null);\n }\n super.setMap(map);\n\n if (map) {\n this.ovmap_.setTarget(this.ovmapDiv_);\n this.listenerKeys.push(\n listen(\n map,\n ObjectEventType.PROPERTYCHANGE,\n this.handleMapPropertyChange_,\n this\n )\n );\n\n const view = map.getView();\n if (view) {\n this.bindView_(view);\n if (view.isDef()) {\n this.ovmap_.updateSize();\n this.resetExtent_();\n }\n }\n }\n }\n\n /**\n * Handle map property changes. This only deals with changes to the map's view.\n * @param {import(\"../Object.js\").ObjectEvent} event The propertychange event.\n * @private\n */\n handleMapPropertyChange_(event) {\n if (event.key === MapProperty.VIEW) {\n const oldView = /** @type {import(\"../View.js\").default} */ (event.oldValue);\n if (oldView) {\n this.unbindView_(oldView);\n }\n const newView = this.getMap().getView();\n this.bindView_(newView);\n }\n }\n\n /**\n * Register listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n bindView_(view) {\n if (!this.view_) {\n // Unless an explicit view definition was given, derive default from whatever main map uses.\n const newView = new View({\n projection: view.getProjection(),\n });\n this.ovmap_.setView(newView);\n }\n\n view.addEventListener(\n getChangeEventType(ViewProperty.ROTATION),\n this.boundHandleRotationChanged_\n );\n // Sync once with the new view\n this.handleRotationChanged_();\n }\n\n /**\n * Unregister listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n unbindView_(view) {\n view.removeEventListener(\n getChangeEventType(ViewProperty.ROTATION),\n this.boundHandleRotationChanged_\n );\n }\n\n /**\n * Handle rotation changes to the main map.\n * @private\n */\n handleRotationChanged_() {\n if (this.rotateWithView_) {\n this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());\n }\n }\n\n /**\n * Reset the overview map extent if the box size (width or\n * height) is less than the size of the overview map size times minRatio\n * or is greater than the size of the overview size times maxRatio.\n *\n * If the map extent was not reset, the box size can fits in the defined\n * ratio sizes. This method then checks if is contained inside the overview\n * map current extent. If not, recenter the overview map to the current\n * main map center location.\n * @private\n */\n validateExtent_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n if (this.viewExtent_ && equalsExtent(extent, this.viewExtent_)) {\n // repeats of the same extent may indicate constraint conflicts leading to an endless cycle\n return;\n }\n this.viewExtent_ = extent;\n\n const ovmapSize = /** @type {import(\"../size.js\").Size} */ (ovmap.getSize());\n\n const ovview = ovmap.getView();\n const ovextent = ovview.calculateExtentInternal(ovmapSize);\n\n const topLeftPixel = ovmap.getPixelFromCoordinateInternal(\n getTopLeft(extent)\n );\n const bottomRightPixel = ovmap.getPixelFromCoordinateInternal(\n getBottomRight(extent)\n );\n\n const boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);\n const boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);\n\n const ovmapWidth = ovmapSize[0];\n const ovmapHeight = ovmapSize[1];\n\n if (\n boxWidth < ovmapWidth * MIN_RATIO ||\n boxHeight < ovmapHeight * MIN_RATIO ||\n boxWidth > ovmapWidth * MAX_RATIO ||\n boxHeight > ovmapHeight * MAX_RATIO\n ) {\n this.resetExtent_();\n } else if (!containsExtent(ovextent, extent)) {\n this.recenter_();\n }\n }\n\n /**\n * Reset the overview map extent to half calculated min and max ratio times\n * the extent of the main map.\n * @private\n */\n resetExtent_() {\n if (MAX_RATIO === 0 || MIN_RATIO === 0) {\n return;\n }\n\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n const ovview = ovmap.getView();\n\n // get how many times the current map overview could hold different\n // box sizes using the min and max ratio, pick the step in the middle used\n // to calculate the extent from the main map to set it to the overview map,\n const steps = Math.log(MAX_RATIO / MIN_RATIO) / Math.LN2;\n const ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);\n scaleFromCenter(extent, ratio);\n ovview.fitInternal(polygonFromExtent(extent));\n }\n\n /**\n * Set the center of the overview map to the map center without changing its\n * resolution.\n * @private\n */\n recenter_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n ovview.setCenterInternal(view.getCenterInternal());\n }\n\n /**\n * Update the box using the main map extent\n * @private\n */\n updateBox_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n const rotation = this.rotateWithView_ ? 0 : -view.getRotation();\n\n const overlay = this.boxOverlay_;\n const box = this.boxOverlay_.getElement();\n const center = view.getCenterInternal();\n const resolution = view.getResolution();\n const ovresolution = ovview.getResolution();\n const width = (mapSize[0] * resolution) / ovresolution;\n const height = (mapSize[1] * resolution) / ovresolution;\n\n // set position using center coordinates\n overlay.setPosition(center);\n\n // set box size calculated from map extent size and overview map resolution\n if (box) {\n box.style.width = width + 'px';\n box.style.height = height + 'px';\n const transform = 'rotate(' + rotation + 'rad)';\n box.style.transform = transform;\n }\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n\n // manage overview map if it had not been rendered before and control\n // is expanded\n const ovmap = this.ovmap_;\n if (!this.collapsed_) {\n if (ovmap.isRendered()) {\n this.viewExtent_ = undefined;\n ovmap.render();\n return;\n }\n ovmap.updateSize();\n this.resetExtent_();\n listenOnce(\n ovmap,\n MapEventType.POSTRENDER,\n function (event) {\n this.updateBox_();\n },\n this\n );\n }\n }\n\n /**\n * Return `true` if the overview map is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the overview map should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (!collapsible && this.collapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the overview map according to the passed parameter. Will\n * not do anything if the overview map isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Determine if the overview map is collapsed.\n * @return {boolean} The overview map is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Return `true` if the overview map view can rotate, `false` otherwise.\n * @return {boolean} True if the control view can rotate.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Set whether the overview map view should rotate with the main map view.\n * @param {boolean} rotateWithView True if the control view should rotate.\n * @api\n */\n setRotateWithView(rotateWithView) {\n if (this.rotateWithView_ === rotateWithView) {\n return;\n }\n this.rotateWithView_ = rotateWithView;\n if (this.getMap().getView().getRotation() !== 0) {\n if (this.rotateWithView_) {\n this.handleRotationChanged_();\n } else {\n this.ovmap_.getView().setRotation(0);\n }\n this.viewExtent_ = undefined;\n this.validateExtent_();\n this.updateBox_();\n }\n }\n\n /**\n * Return the overview map.\n * @return {import(\"../PluggableMap.js\").default} Overview map.\n * @api\n */\n getOverviewMap() {\n return this.ovmap_;\n }\n\n /**\n * Update the overview map element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.validateExtent_();\n this.updateBox_();\n }\n}\n\nexport default OverviewMap;\n","/**\n * @module ol/control/ScaleLine\n */\nimport Control from './Control.js';\nimport ProjUnits from '../proj/Units.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {METERS_PER_UNIT, getPointResolution} from '../proj.js';\nimport {assert} from '../asserts.js';\nimport {getChangeEventType} from '../Object.js';\n\n/**\n * @type {string}\n */\nconst UNITS_PROP = 'units';\n\n/**\n * Units for the scale line. Supported values are `'degrees'`, `'imperial'`,\n * `'nautical'`, `'metric'`, `'us'`.\n * @enum {string}\n */\nexport const Units = {\n DEGREES: 'degrees',\n IMPERIAL: 'imperial',\n NAUTICAL: 'nautical',\n METRIC: 'metric',\n US: 'us',\n};\n\n/**\n * @const\n * @type {Array<number>}\n */\nconst LEADING_DIGITS = [1, 2, 5];\n\n/**\n * @const\n * @type {number}\n */\nconst DEFAULT_DPI = 25.4 / 0.28;\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-scale-line'] CSS Class name.\n * @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {import(\"./ScaleLine.js\").Units|string} [units='metric'] Units.\n * @property {boolean} [bar=false] Render scalebars instead of a line.\n * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers\n * for best results. Only applies when `bar` is `true`.\n * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies\n * when `bar` is `true`.\n * @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies\n * when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.\n */\n\n/**\n * @classdesc\n * A control displaying rough y-axis distances, calculated for the center of the\n * viewport. For conformal projections (e.g. EPSG:3857, the default view\n * projection in OpenLayers), the scale is valid for all directions.\n * No scale line will be shown when the y-axis distance of a pixel at the\n * viewport center cannot be calculated in the view projection.\n * By default the scale line will show in the bottom left portion of the map,\n * but this can be changed by using the css selector `.ol-scale-line`.\n * When specifying `bar` as `true`, a scalebar will be rendered instead\n * of a scaleline.\n *\n * @api\n */\nclass ScaleLine extends Control {\n /**\n * @param {Options=} opt_options Scale line options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const className =\n options.className !== undefined\n ? options.className\n : options.bar\n ? 'ol-scale-bar'\n : 'ol-scale-line';\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.innerElement_ = document.createElement('div');\n this.innerElement_.className = className + '-inner';\n\n this.element.className = className + ' ' + CLASS_UNSELECTABLE;\n this.element.appendChild(this.innerElement_);\n\n /**\n * @private\n * @type {?import(\"../View.js\").State}\n */\n this.viewState_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderedWidth_ = undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = '';\n\n this.addEventListener(\n getChangeEventType(UNITS_PROP),\n this.handleUnitsChanged_\n );\n\n this.setUnits(options.units || Units.METRIC);\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBar_ = options.bar || false;\n\n /**\n * @private\n * @type {number}\n */\n this.scaleBarSteps_ = options.steps || 4;\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBarText_ = options.text || false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.dpi_ = options.dpi || undefined;\n }\n\n /**\n * Return the units to use in the scale line.\n * @return {import(\"./ScaleLine.js\").Units} The units\n * to use in the scale line.\n * @observable\n * @api\n */\n getUnits() {\n return this.get(UNITS_PROP);\n }\n\n /**\n * @private\n */\n handleUnitsChanged_() {\n this.updateElement_();\n }\n\n /**\n * Set the units to use in the scale line.\n * @param {import(\"./ScaleLine.js\").Units} units The units to use in the scale line.\n * @observable\n * @api\n */\n setUnits(units) {\n this.set(UNITS_PROP, units);\n }\n\n /**\n * Specify the dpi of output device such as printer.\n * @param {number|undefined} dpi The dpi of output device.\n * @api\n */\n setDpi(dpi) {\n this.dpi_ = dpi;\n }\n\n /**\n * @private\n */\n updateElement_() {\n const viewState = this.viewState_;\n\n if (!viewState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const center = viewState.center;\n const projection = viewState.projection;\n const units = this.getUnits();\n const pointResolutionUnits =\n units == Units.DEGREES ? ProjUnits.DEGREES : ProjUnits.METERS;\n let pointResolution = getPointResolution(\n projection,\n viewState.resolution,\n center,\n pointResolutionUnits\n );\n\n const minWidth =\n (this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;\n\n let nominalCount = minWidth * pointResolution;\n let suffix = '';\n if (units == Units.DEGREES) {\n const metersPerDegree = METERS_PER_UNIT[ProjUnits.DEGREES];\n nominalCount *= metersPerDegree;\n if (nominalCount < metersPerDegree / 60) {\n suffix = '\\u2033'; // seconds\n pointResolution *= 3600;\n } else if (nominalCount < metersPerDegree) {\n suffix = '\\u2032'; // minutes\n pointResolution *= 60;\n } else {\n suffix = '\\u00b0'; // degrees\n }\n } else if (units == Units.IMPERIAL) {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution /= 0.0254;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.3048;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.344;\n }\n } else if (units == Units.NAUTICAL) {\n pointResolution /= 1852;\n suffix = 'nm';\n } else if (units == Units.METRIC) {\n if (nominalCount < 0.001) {\n suffix = 'μm';\n pointResolution *= 1000000;\n } else if (nominalCount < 1) {\n suffix = 'mm';\n pointResolution *= 1000;\n } else if (nominalCount < 1000) {\n suffix = 'm';\n } else {\n suffix = 'km';\n pointResolution /= 1000;\n }\n } else if (units == Units.US) {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution *= 39.37;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.30480061;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.3472;\n }\n } else {\n assert(false, 33); // Invalid units\n }\n\n let i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));\n let count, width, decimalCount;\n while (true) {\n decimalCount = Math.floor(i / 3);\n const decimal = Math.pow(10, decimalCount);\n count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;\n width = Math.round(count / pointResolution);\n if (isNaN(width)) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n return;\n } else if (width >= minWidth) {\n break;\n }\n ++i;\n }\n let html;\n if (this.scaleBar_) {\n html = this.createScaleBar(width, count, suffix);\n } else {\n html = count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;\n }\n\n if (this.renderedHTML_ != html) {\n this.innerElement_.innerHTML = html;\n this.renderedHTML_ = html;\n }\n\n if (this.renderedWidth_ != width) {\n this.innerElement_.style.width = width + 'px';\n this.renderedWidth_ = width;\n }\n\n if (!this.renderedVisible_) {\n this.element.style.display = '';\n this.renderedVisible_ = true;\n }\n }\n\n /**\n * @private\n * @param {number} width The current width of the scalebar.\n * @param {number} scale The current scale.\n * @param {string} suffix The suffix to append to the scale text.\n * @returns {string} The stringified HTML of the scalebar.\n */\n createScaleBar(width, scale, suffix) {\n const mapScale =\n '1 : ' + Math.round(this.getScaleForResolution()).toLocaleString();\n const scaleSteps = [];\n const stepWidth = width / this.scaleBarSteps_;\n let backgroundColor = '#ffffff';\n for (let i = 0; i < this.scaleBarSteps_; i++) {\n if (i === 0) {\n // create the first marker at position 0\n scaleSteps.push(this.createMarker('absolute', i));\n }\n scaleSteps.push(\n '<div>' +\n '<div ' +\n 'class=\"ol-scale-singlebar\" ' +\n 'style=' +\n '\"width: ' +\n stepWidth +\n 'px;' +\n 'background-color: ' +\n backgroundColor +\n ';\"' +\n '>' +\n '</div>' +\n this.createMarker('relative', i) +\n /*render text every second step, except when only 2 steps */\n (i % 2 === 0 || this.scaleBarSteps_ === 2\n ? this.createStepText(i, width, false, scale, suffix)\n : '') +\n '</div>'\n );\n if (i === this.scaleBarSteps_ - 1) {\n {\n /*render text at the end */\n }\n scaleSteps.push(this.createStepText(i + 1, width, true, scale, suffix));\n }\n // switch colors of steps between black and white\n if (backgroundColor === '#ffffff') {\n backgroundColor = '#000000';\n } else {\n backgroundColor = '#ffffff';\n }\n }\n\n let scaleBarText;\n if (this.scaleBarText_) {\n scaleBarText =\n '<div ' +\n 'class=\"ol-scale-text\" ' +\n 'style=\"width: ' +\n width +\n 'px;\">' +\n mapScale +\n '</div>';\n } else {\n scaleBarText = '';\n }\n const container =\n '<div ' +\n 'style=\"display: flex;\">' +\n scaleBarText +\n scaleSteps.join('') +\n '</div>';\n return container;\n }\n\n /**\n * Creates a marker at given position\n * @param {string} position - The position, absolute or relative\n * @param {number} i - The iterator\n * @returns {string} The stringified div containing the marker\n */\n createMarker(position, i) {\n const top = position === 'absolute' ? 3 : -10;\n return (\n '<div ' +\n 'class=\"ol-scale-step-marker\" ' +\n 'style=\"position: ' +\n position +\n ';' +\n 'top: ' +\n top +\n 'px;\"' +\n '></div>'\n );\n }\n\n /**\n * Creates the label for a marker marker at given position\n * @param {number} i - The iterator\n * @param {number} width - The width the scalebar will currently use\n * @param {boolean} isLast - Flag indicating if we add the last step text\n * @param {number} scale - The current scale for the whole scalebar\n * @param {string} suffix - The suffix for the scale\n * @returns {string} The stringified div containing the step text\n */\n createStepText(i, width, isLast, scale, suffix) {\n const length =\n i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;\n const lengthString = length + (i === 0 ? '' : ' ' + suffix);\n const margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;\n const minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;\n return (\n '<div ' +\n 'class=\"ol-scale-step-text\" ' +\n 'style=\"' +\n 'margin-left: ' +\n margin +\n 'px;' +\n 'text-align: ' +\n (i === 0 ? 'left' : 'center') +\n '; ' +\n 'min-width: ' +\n minWidth +\n 'px;' +\n 'left: ' +\n (isLast ? width + 'px' : 'unset') +\n ';\"' +\n '>' +\n lengthString +\n '</div>'\n );\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units.\n * @return {number} The appropriate scale.\n */\n getScaleForResolution() {\n const resolution = getPointResolution(\n this.viewState_.projection,\n this.viewState_.resolution,\n this.viewState_.center\n );\n const dpi = this.dpi_ || DEFAULT_DPI;\n const mpu = this.viewState_.projection.getMetersPerUnit();\n const inchesPerMeter = 39.37;\n return parseFloat(resolution.toString()) * mpu * inchesPerMeter * dpi;\n }\n\n /**\n * Update the scale line element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.viewState_ = null;\n } else {\n this.viewState_ = frameState.viewState;\n }\n this.updateElement_();\n }\n}\n\nexport default ScaleLine;\n","/**\n * @module ol/control/ZoomSlider\n */\n\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport PointerEventType from '../pointer/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {clamp} from '../math.js';\nimport {easeOut} from '../easing.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {stopPropagation} from '../events/Event.js';\n\n/**\n * The enum for available directions.\n *\n * @enum {number}\n */\nconst Direction = {\n VERTICAL: 0,\n HORIZONTAL: 1,\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-zoomslider'] CSS class name.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n */\n\n/**\n * @classdesc\n * A slider type of control for zooming.\n *\n * Example:\n *\n * map.addControl(new ZoomSlider());\n *\n * @api\n */\nclass ZoomSlider extends Control {\n /**\n * @param {Options=} opt_options Zoom slider options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n });\n\n /**\n * @type {!Array.<import(\"../events.js\").EventsKey>}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * Will hold the current resolution of the view.\n *\n * @type {number|undefined}\n * @private\n */\n this.currentResolution_ = undefined;\n\n /**\n * The direction of the slider. Will be determined from actual display of the\n * container and defaults to Direction.VERTICAL.\n *\n * @type {Direction}\n * @private\n */\n this.direction_ = Direction.VERTICAL;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_;\n\n /**\n * @type {number}\n * @private\n */\n this.heightLimit_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.widthLimit_ = 0;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startX_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startY_;\n\n /**\n * The calculated thumb size (border box plus margins). Set when initSlider_\n * is called.\n * @type {import(\"../size.js\").Size}\n * @private\n */\n this.thumbSize_ = null;\n\n /**\n * Whether the slider is initialized.\n * @type {boolean}\n * @private\n */\n this.sliderInitialized_ = false;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoomslider';\n const thumbElement = document.createElement('button');\n thumbElement.setAttribute('type', 'button');\n thumbElement.className = className + '-thumb ' + CLASS_UNSELECTABLE;\n const containerElement = this.element;\n containerElement.className =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n containerElement.appendChild(thumbElement);\n\n containerElement.addEventListener(\n PointerEventType.POINTERDOWN,\n this.handleDraggerStart_.bind(this),\n false\n );\n containerElement.addEventListener(\n PointerEventType.POINTERMOVE,\n this.handleDraggerDrag_.bind(this),\n false\n );\n containerElement.addEventListener(\n PointerEventType.POINTERUP,\n this.handleDraggerEnd_.bind(this),\n false\n );\n\n containerElement.addEventListener(\n EventType.CLICK,\n this.handleContainerClick_.bind(this),\n false\n );\n thumbElement.addEventListener(EventType.CLICK, stopPropagation, false);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n map.render();\n }\n }\n\n /**\n * Initializes the slider element. This will determine and set this controls\n * direction_ and also constrain the dragging of the thumb to always be within\n * the bounds of the container.\n *\n * @return {boolean} Initialization successful\n * @private\n */\n initSlider_() {\n const container = this.element;\n const containerWidth = container.offsetWidth;\n const containerHeight = container.offsetHeight;\n if (containerWidth === 0 && containerHeight === 0) {\n return (this.sliderInitialized_ = false);\n }\n\n const thumb = /** @type {HTMLElement} */ (container.firstElementChild);\n const computedStyle = getComputedStyle(thumb);\n const thumbWidth =\n thumb.offsetWidth +\n parseFloat(computedStyle['marginRight']) +\n parseFloat(computedStyle['marginLeft']);\n const thumbHeight =\n thumb.offsetHeight +\n parseFloat(computedStyle['marginTop']) +\n parseFloat(computedStyle['marginBottom']);\n this.thumbSize_ = [thumbWidth, thumbHeight];\n\n if (containerWidth > containerHeight) {\n this.direction_ = Direction.HORIZONTAL;\n this.widthLimit_ = containerWidth - thumbWidth;\n } else {\n this.direction_ = Direction.VERTICAL;\n this.heightLimit_ = containerHeight - thumbHeight;\n }\n return (this.sliderInitialized_ = true);\n }\n\n /**\n * @param {PointerEvent} event The browser event to handle.\n * @private\n */\n handleContainerClick_(event) {\n const view = this.getMap().getView();\n\n const relativePosition = this.getRelativePosition_(\n event.offsetX - this.thumbSize_[0] / 2,\n event.offsetY - this.thumbSize_[1] / 2\n );\n\n const resolution = this.getResolutionForPosition_(relativePosition);\n const zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution));\n\n view.animateInternal({\n zoom: zoom,\n duration: this.duration_,\n easing: easeOut,\n });\n }\n\n /**\n * Handle dragger start events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerStart_(event) {\n if (!this.dragging_ && event.target === this.element.firstElementChild) {\n const element = /** @type {HTMLElement} */ (this.element\n .firstElementChild);\n this.getMap().getView().beginInteraction();\n this.startX_ = event.clientX - parseFloat(element.style.left);\n this.startY_ = event.clientY - parseFloat(element.style.top);\n this.dragging_ = true;\n\n if (this.dragListenerKeys_.length === 0) {\n const drag = this.handleDraggerDrag_;\n const end = this.handleDraggerEnd_;\n this.dragListenerKeys_.push(\n listen(document, PointerEventType.POINTERMOVE, drag, this),\n listen(document, PointerEventType.POINTERUP, end, this)\n );\n }\n }\n }\n\n /**\n * Handle dragger drag events.\n *\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerDrag_(event) {\n if (this.dragging_) {\n const deltaX = event.clientX - this.startX_;\n const deltaY = event.clientY - this.startY_;\n const relativePosition = this.getRelativePosition_(deltaX, deltaY);\n this.currentResolution_ = this.getResolutionForPosition_(\n relativePosition\n );\n this.getMap().getView().setResolution(this.currentResolution_);\n }\n }\n\n /**\n * Handle dragger end events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerEnd_(event) {\n if (this.dragging_) {\n const view = this.getMap().getView();\n view.endInteraction();\n\n this.dragging_ = false;\n this.startX_ = undefined;\n this.startY_ = undefined;\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n }\n }\n\n /**\n * Positions the thumb inside its container according to the given resolution.\n *\n * @param {number} res The res.\n * @private\n */\n setThumbPosition_(res) {\n const position = this.getPositionForResolution_(res);\n const thumb = /** @type {HTMLElement} */ (this.element.firstElementChild);\n\n if (this.direction_ == Direction.HORIZONTAL) {\n thumb.style.left = this.widthLimit_ * position + 'px';\n } else {\n thumb.style.top = this.heightLimit_ * position + 'px';\n }\n }\n\n /**\n * Calculates the relative position of the thumb given x and y offsets. The\n * relative position scales from 0 to 1. The x and y offsets are assumed to be\n * in pixel units within the dragger limits.\n *\n * @param {number} x Pixel position relative to the left of the slider.\n * @param {number} y Pixel position relative to the top of the slider.\n * @return {number} The relative position of the thumb.\n * @private\n */\n getRelativePosition_(x, y) {\n let amount;\n if (this.direction_ === Direction.HORIZONTAL) {\n amount = x / this.widthLimit_;\n } else {\n amount = y / this.heightLimit_;\n }\n return clamp(amount, 0, 1);\n }\n\n /**\n * Calculates the corresponding resolution of the thumb given its relative\n * position (where 0 is the minimum and 1 is the maximum).\n *\n * @param {number} position The relative position of the thumb.\n * @return {number} The corresponding resolution.\n * @private\n */\n getResolutionForPosition_(position) {\n const fn = this.getMap().getView().getResolutionForValueFunction();\n return fn(1 - position);\n }\n\n /**\n * Determines the relative position of the slider for the given resolution. A\n * relative position of 0 corresponds to the minimum view resolution. A\n * relative position of 1 corresponds to the maximum view resolution.\n *\n * @param {number} res The resolution.\n * @return {number} The relative position value (between 0 and 1).\n * @private\n */\n getPositionForResolution_(res) {\n const fn = this.getMap().getView().getValueForResolutionFunction();\n return clamp(1 - fn(res), 0, 1);\n }\n\n /**\n * Update the zoomslider element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n if (!mapEvent.frameState) {\n return;\n }\n if (!this.sliderInitialized_ && !this.initSlider_()) {\n return;\n }\n const res = mapEvent.frameState.viewState.resolution;\n this.currentResolution_ = res;\n this.setThumbPosition_(res);\n }\n}\n\nexport default ZoomSlider;\n","/**\n * @module ol/control/ZoomToExtent\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-zoom-extent'] Class name.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {string|HTMLElement} [label='E'] Text label to use for the button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.\n * @property {import(\"../extent.js\").Extent} [extent] The extent to zoom to. If undefined the validity\n * extent of the view projection is used.\n */\n\n/**\n * @classdesc\n * A button control which, when pressed, changes the map view to a specific\n * extent. To style this control use the css selector `.ol-zoom-extent`.\n *\n * @api\n */\nclass ZoomToExtent extends Control {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n /**\n * @type {?import(\"../extent.js\").Extent}\n * @protected\n */\n this.extent = options.extent ? options.extent : null;\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom-extent';\n\n const label = options.label !== undefined ? options.label : 'E';\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent';\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(\n typeof label === 'string' ? document.createTextNode(label) : label\n );\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleZoomToExtent();\n }\n\n /**\n * @protected\n */\n handleZoomToExtent() {\n const map = this.getMap();\n const view = map.getView();\n const extent = !this.extent\n ? view.getProjection().getExtent()\n : this.extent;\n view.fitInternal(polygonFromExtent(extent));\n }\n}\n\nexport default ZoomToExtent;\n","/**\n * @module ol/control\n */\nimport Attribution from './control/Attribution.js';\nimport Collection from './Collection.js';\nimport Rotate from './control/Rotate.js';\nimport Zoom from './control/Zoom.js';\n\nexport {default as Attribution} from './control/Attribution.js';\nexport {default as Control} from './control/Control.js';\nexport {default as FullScreen} from './control/FullScreen.js';\nexport {default as MousePosition} from './control/MousePosition.js';\nexport {default as OverviewMap} from './control/OverviewMap.js';\nexport {default as Rotate} from './control/Rotate.js';\nexport {default as ScaleLine} from './control/ScaleLine.js';\nexport {default as Zoom} from './control/Zoom.js';\nexport {default as ZoomSlider} from './control/ZoomSlider.js';\nexport {default as ZoomToExtent} from './control/ZoomToExtent.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [attribution=true] Include\n * {@link module:ol/control/Attribution~Attribution}.\n * @property {import(\"./control/Attribution.js\").Options} [attributionOptions]\n * Options for {@link module:ol/control/Attribution~Attribution}.\n * @property {boolean} [rotate=true] Include\n * {@link module:ol/control/Rotate~Rotate}.\n * @property {import(\"./control/Rotate.js\").Options} [rotateOptions] Options\n * for {@link module:ol/control/Rotate~Rotate}.\n * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.\n * @property {import(\"./control/Zoom.js\").Options} [zoomOptions] Options for\n * {@link module:ol/control/Zoom~Zoom}.\n * @api\n */\n\n/**\n * Set of controls included in maps by default. Unless configured otherwise,\n * this returns a collection containing an instance of each of the following\n * controls:\n * * {@link module:ol/control/Zoom~Zoom}\n * * {@link module:ol/control/Rotate~Rotate}\n * * {@link module:ol/control/Attribution~Attribution}\n *\n * @param {DefaultsOptions=} opt_options\n * Defaults options.\n * @return {Collection<import(\"./control/Control.js\").default>}\n * Controls.\n * @api\n */\nexport function defaults(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const controls = new Collection();\n\n const zoomControl = options.zoom !== undefined ? options.zoom : true;\n if (zoomControl) {\n controls.push(new Zoom(options.zoomOptions));\n }\n\n const rotateControl = options.rotate !== undefined ? options.rotate : true;\n if (rotateControl) {\n controls.push(new Rotate(options.rotateOptions));\n }\n\n const attributionControl =\n options.attribution !== undefined ? options.attribution : true;\n if (attributionControl) {\n controls.push(new Attribution(options.attributionOptions));\n }\n\n return controls;\n}\n","/**\n * @module ol/interaction/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n ACTIVE: 'active',\n};\n","/**\n * @module ol/interaction/Interaction\n */\nimport BaseObject from '../Object.js';\nimport InteractionProperty from './Property.js';\nimport {easeOut, linear} from '../easing.js';\n\n/**\n * Object literal with config options for interactions.\n * @typedef {Object} InteractionOptions\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} handleEvent\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. If the function returns a falsy value, propagation of\n * the event to other interactions in the map's interactions chain will be\n * prevented (this includes functions with no explicit return). The interactions\n * are traversed in reverse order of the interactions collection of the map.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * User actions that change the state of the map. Some are similar to controls,\n * but are not associated with a DOM element.\n * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is\n * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered\n * by a keyboard event not a button element event.\n * Although interactions do not have a DOM element, some of them do render\n * vectors and so are visible on the screen.\n * @api\n */\nclass Interaction extends BaseObject {\n /**\n * @param {InteractionOptions=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n if (opt_options && opt_options.handleEvent) {\n this.handleEvent = opt_options.handleEvent;\n }\n\n /**\n * @private\n * @type {import(\"../PluggableMap.js\").default}\n */\n this.map_ = null;\n\n this.setActive(true);\n }\n\n /**\n * Return whether the interaction is currently active.\n * @return {boolean} `true` if the interaction is active, `false` otherwise.\n * @observable\n * @api\n */\n getActive() {\n return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));\n }\n\n /**\n * Get the map associated with this interaction.\n * @return {import(\"../PluggableMap.js\").default} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event}.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(mapBrowserEvent) {\n return true;\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n this.set(InteractionProperty.ACTIVE, active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n this.map_ = map;\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {import(\"../coordinate.js\").Coordinate} delta Delta.\n * @param {number=} opt_duration Duration.\n */\nexport function pan(view, delta, opt_duration) {\n const currentCenter = view.getCenterInternal();\n if (currentCenter) {\n const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];\n view.animateInternal({\n duration: opt_duration !== undefined ? opt_duration : 250,\n easing: linear,\n center: view.getConstrainedCenter(center),\n });\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {number} delta Delta from previous zoom level.\n * @param {import(\"../coordinate.js\").Coordinate=} opt_anchor Anchor coordinate in the user projection.\n * @param {number=} opt_duration Duration.\n */\nexport function zoomByDelta(view, delta, opt_anchor, opt_duration) {\n const currentZoom = view.getZoom();\n\n if (currentZoom === undefined) {\n return;\n }\n\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n const newResolution = view.getResolutionForZoom(newZoom);\n\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n resolution: newResolution,\n anchor: opt_anchor,\n duration: opt_duration !== undefined ? opt_duration : 250,\n easing: easeOut,\n });\n}\n\nexport default Interaction;\n","/**\n * @module ol/interaction/DoubleClickZoom\n */\nimport Interaction, {zoomByDelta} from './Interaction.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [delta=1] The zoom delta applied on each double click.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom by double-clicking on the map.\n * @api\n */\nclass DoubleClickZoom extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n const options = opt_options ? opt_options : {};\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a\n * doubleclick) and eventually zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {\n const browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);\n const map = mapBrowserEvent.map;\n const anchor = mapBrowserEvent.coordinate;\n const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, anchor, this.duration_);\n mapBrowserEvent.preventDefault();\n stopEvent = true;\n }\n return !stopEvent;\n }\n}\n\nexport default DoubleClickZoom;\n","/**\n * @module ol/interaction/Pointer\n */\nimport Interaction from './Interaction.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {getValues} from '../obj.js';\n\n/**\n * @typedef {Object} Options\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleDownEvent]\n * Function handling \"down\" events. If the function returns `true` then a drag\n * sequence is started.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleDragEvent]\n * Function handling \"drag\" events. This function is called on \"move\" events\n * during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleEvent]\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. The function may return `false` to prevent the\n * propagation of the event to other interactions in the map's interactions\n * chain.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleMoveEvent]\n * Function handling \"move\" events. This function is called on \"move\" events.\n * This functions is also called during a drag sequence, so during a drag\n * sequence both the `handleDragEvent` function and this function are called.\n * If `handleDownEvent` is defined and it returns true this function will not\n * be called during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleUpEvent]\n * Function handling \"up\" events. If the function returns `false` then the\n * current drag sequence is stopped.\n * @property {function(boolean):boolean} [stopDown]\n * Should the down event be propagated to other interactions, or should be\n * stopped?\n */\n\n/**\n * @classdesc\n * Base class that calls user-defined functions on `down`, `move` and `up`\n * events. This class also manages \"drag sequences\".\n *\n * When the `handleDownEvent` user function returns `true` a drag sequence is\n * started. During a drag sequence the `handleDragEvent` user function is\n * called on `move` events. The drag sequence ends when the `handleUpEvent`\n * user function is called and returns `false`.\n * @api\n */\nclass PointerInteraction extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options)\n );\n\n if (options.handleDownEvent) {\n this.handleDownEvent = options.handleDownEvent;\n }\n\n if (options.handleDragEvent) {\n this.handleDragEvent = options.handleDragEvent;\n }\n\n if (options.handleMoveEvent) {\n this.handleMoveEvent = options.handleMoveEvent;\n }\n\n if (options.handleUpEvent) {\n this.handleUpEvent = options.handleUpEvent;\n }\n\n if (options.stopDown) {\n this.stopDown = options.stopDown;\n }\n\n /**\n * @type {boolean}\n * @protected\n */\n this.handlingDownUpSequence = false;\n\n /**\n * @type {!Object<string, PointerEvent>}\n * @private\n */\n this.trackedPointers_ = {};\n\n /**\n * @type {Array<PointerEvent>}\n * @protected\n */\n this.targetPointers = [];\n }\n\n /**\n * Returns the current number of pointers involved in the interaction,\n * e.g. `2` when two fingers are used.\n * @return {number} The number of pointers.\n * @api\n */\n getPointerCount() {\n return this.targetPointers.length;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleDownEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleDragEvent(mapBrowserEvent) {}\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into\n * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are\n * detected.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n\n let stopEvent = false;\n this.updateTrackedPointers_(mapBrowserEvent);\n if (this.handlingDownUpSequence) {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {\n this.handleDragEvent(mapBrowserEvent);\n // prevent page scrolling during dragging\n mapBrowserEvent.preventDefault();\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n const handledUp = this.handleUpEvent(mapBrowserEvent);\n this.handlingDownUpSequence =\n handledUp && this.targetPointers.length > 0;\n }\n } else {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n const handled = this.handleDownEvent(mapBrowserEvent);\n this.handlingDownUpSequence = handled;\n stopEvent = this.stopDown(handled);\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE) {\n this.handleMoveEvent(mapBrowserEvent);\n }\n }\n return !stopEvent;\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleMoveEvent(mapBrowserEvent) {}\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleUpEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * This function is used to determine if \"down\" events should be propagated\n * to other interactions or should be stopped.\n * @param {boolean} handled Was the event handled by the interaction?\n * @return {boolean} Should the `down` event be stopped?\n */\n stopDown(handled) {\n return handled;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @private\n */\n updateTrackedPointers_(mapBrowserEvent) {\n if (isPointerDraggingEvent(mapBrowserEvent)) {\n const event = mapBrowserEvent.originalEvent;\n\n const id = event.pointerId.toString();\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n delete this.trackedPointers_[id];\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n this.trackedPointers_[id] = event;\n } else if (id in this.trackedPointers_) {\n // update only when there was a pointerdown event for this pointer\n this.trackedPointers_[id] = event;\n }\n this.targetPointers = getValues(this.trackedPointers_);\n }\n }\n}\n\n/**\n * @param {Array<PointerEvent>} pointerEvents List of events.\n * @return {import(\"../pixel.js\").Pixel} Centroid pixel.\n */\nexport function centroid(pointerEvents) {\n const length = pointerEvents.length;\n let clientX = 0;\n let clientY = 0;\n for (let i = 0; i < length; i++) {\n clientX += pointerEvents[i].clientX;\n clientY += pointerEvents[i].clientY;\n }\n return [clientX / length, clientY / length];\n}\n\n/**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} Whether the event is a pointerdown, pointerdrag\n * or pointerup event.\n */\nfunction isPointerDraggingEvent(mapBrowserEvent) {\n const type = mapBrowserEvent.type;\n return (\n type === MapBrowserEventType.POINTERDOWN ||\n type === MapBrowserEventType.POINTERDRAG ||\n type === MapBrowserEventType.POINTERUP\n );\n}\n\nexport default PointerInteraction;\n","/**\n * @module ol/events/condition\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {MAC, WEBKIT} from '../has.js';\nimport {assert} from '../asserts.js';\n\n/**\n * A function that takes an {@link module:ol/MapBrowserEvent} and returns a\n * `{boolean}`. If the condition is met, true should be returned.\n *\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default): boolean} Condition\n */\n\n/**\n * Creates a condition function that passes when all provided conditions pass.\n * @param {...Condition} var_args Conditions to check.\n * @return {Condition} Condition function.\n */\nexport function all(var_args) {\n const conditions = arguments;\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} All conditions passed.\n */\n return function (event) {\n let pass = true;\n for (let i = 0, ii = conditions.length; i < ii; ++i) {\n pass = pass && conditions[i](event);\n if (!pass) {\n break;\n }\n }\n return pass;\n };\n}\n\n/**\n * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when\n * additionally the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt key is pressed.\n * @api\n */\nexport const altKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise\n * (e.g. when additionally the platform-modifier-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt and shift keys are pressed.\n * @api\n */\nexport const altShiftKeysOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the map has the focus. This condition requires a map target\n * element with a `tabindex` attribute, e.g. `<div id=\"map\" tabindex=\"1\">`.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map has the focus.\n * @api\n */\nexport const focus = function (event) {\n return event.target.getTargetElement().contains(document.activeElement);\n};\n\n/**\n * Return `true` if the map has the focus or no 'tabindex' attribute set.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map container has the focus or no 'tabindex' attribute.\n */\nexport const focusWithTabindex = function (event) {\n return event.map.getTargetElement().hasAttribute('tabindex')\n ? focus(event)\n : true;\n};\n\n/**\n * Return always true.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True.\n * @api\n */\nexport const always = TRUE;\n\n/**\n * Return `true` if the event is a `click` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `click` event.\n * @api\n */\nexport const click = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.CLICK;\n};\n\n/**\n * Return `true` if the event has an \"action\"-producing mouse button.\n *\n * By definition, this includes left-click on windows/linux, and left-click\n * without the ctrl key on Macs.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} The result.\n */\nexport const mouseActionButton = function (mapBrowserEvent) {\n const originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);\n return originalEvent.button == 0 && !(WEBKIT && MAC && originalEvent.ctrlKey);\n};\n\n/**\n * Return always false.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} False.\n * @api\n */\nexport const never = FALSE;\n\n/**\n * Return `true` if the browser event is a `pointermove` event, `false`\n * otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the browser event is a `pointermove` event.\n * @api\n */\nexport const pointerMove = function (mapBrowserEvent) {\n return mapBrowserEvent.type == 'pointermove';\n};\n\n/**\n * Return `true` if the event is a map `singleclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `singleclick` event.\n * @api\n */\nexport const singleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;\n};\n\n/**\n * Return `true` if the event is a map `dblclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `dblclick` event.\n * @api\n */\nexport const doubleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;\n};\n\n/**\n * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is\n * pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if there no modifier keys are pressed.\n * @api\n */\nexport const noModifierKeys = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally\n * the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (\n !originalEvent.altKey &&\n (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when\n * additionally the alt-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the shift key is pressed.\n * @api\n */\nexport const shiftKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the target element is not editable, i.e. not a `<input>`-,\n * `<select>`- or `<textarea>`-element, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if the target element is not editable.\n * @api\n */\nexport const targetNotEditable = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);\n const tagName = /** @type {Element} */ (originalEvent.target).tagName;\n return tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA';\n};\n\n/**\n * Return `true` if the event originates from a mouse device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a mouse device.\n * @api\n */\nexport const mouseOnly = function (mapBrowserEvent) {\n const pointerEvent = /** @type {import(\"../MapBrowserEvent\").default} */ (mapBrowserEvent)\n .originalEvent;\n assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event\n // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvent.pointerType == 'mouse';\n};\n\n/**\n * Return `true` if the event originates from a touchable device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a touchable device.\n * @api\n */\nexport const touchOnly = function (mapBrowserEvent) {\n const pointerEvt = /** @type {import(\"../MapBrowserEvent\").default} */ (mapBrowserEvent)\n .originalEvent;\n assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event\n // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvt.pointerType === 'touch';\n};\n\n/**\n * Return `true` if the event originates from a digital pen.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a digital pen.\n * @api\n */\nexport const penOnly = function (mapBrowserEvent) {\n const pointerEvt = /** @type {import(\"../MapBrowserEvent\").default} */ (mapBrowserEvent)\n .originalEvent;\n assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event\n // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvt.pointerType === 'pen';\n};\n\n/**\n * Return `true` if the event originates from a primary pointer in\n * contact with the surface or if the left mouse button is pressed.\n * See http://www.w3.org/TR/pointerevents/#button-states.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a primary pointer.\n * @api\n */\nexport const primaryAction = function (mapBrowserEvent) {\n const pointerEvent = /** @type {import(\"../MapBrowserEvent\").default} */ (mapBrowserEvent)\n .originalEvent;\n assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event\n return pointerEvent.isPrimary && pointerEvent.button === 0;\n};\n","/**\n * @module ol/interaction/DragPan\n */\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\nimport {FALSE} from '../functions.js';\nimport {\n all,\n focusWithTabindex,\n noModifierKeys,\n primaryAction,\n} from '../events/condition.js';\nimport {easeOut} from '../easing.js';\nimport {\n rotate as rotateCoordinate,\n scale as scaleCoordinate,\n} from '../coordinate.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition~noModifierKeys} and {@link module:ol/events/condition~primaryAction}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {import(\"../Kinetic.js\").default} [kinetic] Kinetic inertia to apply to the pan.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map by dragging the map.\n * @api\n */\nclass DragPan extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super({\n stopDown: FALSE,\n });\n\n const options = opt_options ? opt_options : {};\n\n /**\n * @private\n * @type {import(\"../Kinetic.js\").default|undefined}\n */\n this.kinetic_ = options.kinetic;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.lastCentroid = null;\n\n /**\n * @type {number}\n */\n this.lastPointersCount_;\n\n /**\n * @type {boolean}\n */\n this.panning_ = false;\n\n const condition = options.condition\n ? options.condition\n : all(noModifierKeys, primaryAction);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {boolean}\n */\n this.noKinetic_ = false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n if (!this.panning_) {\n this.panning_ = true;\n this.getMap().getView().beginInteraction();\n }\n const targetPointers = this.targetPointers;\n const centroid = centroidFromPointers(targetPointers);\n if (targetPointers.length == this.lastPointersCount_) {\n if (this.kinetic_) {\n this.kinetic_.update(centroid[0], centroid[1]);\n }\n if (this.lastCentroid) {\n const delta = [\n this.lastCentroid[0] - centroid[0],\n centroid[1] - this.lastCentroid[1],\n ];\n const map = mapBrowserEvent.map;\n const view = map.getView();\n scaleCoordinate(delta, view.getResolution());\n rotateCoordinate(delta, view.getRotation());\n view.adjustCenterInternal(delta);\n }\n } else if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger down, tiny drag, second finger down\n this.kinetic_.begin();\n }\n this.lastCentroid = centroid;\n this.lastPointersCount_ = targetPointers.length;\n mapBrowserEvent.originalEvent.preventDefault();\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (this.targetPointers.length === 0) {\n if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {\n const distance = this.kinetic_.getDistance();\n const angle = this.kinetic_.getAngle();\n const center = view.getCenterInternal();\n const centerpx = map.getPixelFromCoordinateInternal(center);\n const dest = map.getCoordinateFromPixelInternal([\n centerpx[0] - distance * Math.cos(angle),\n centerpx[1] - distance * Math.sin(angle),\n ]);\n view.animateInternal({\n center: view.getConstrainedCenter(dest),\n duration: 500,\n easing: easeOut,\n });\n }\n if (this.panning_) {\n this.panning_ = false;\n view.endInteraction();\n }\n return false;\n } else {\n if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger up, tiny drag, second finger up\n this.kinetic_.begin();\n }\n this.lastCentroid = null;\n return true;\n }\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n this.lastCentroid = null;\n // stop any current animation\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n if (this.kinetic_) {\n this.kinetic_.begin();\n }\n // No kinetic as soon as more than one pointer on the screen is\n // detected. This is to prevent nasty pans after pinch.\n this.noKinetic_ = this.targetPointers.length > 1;\n return true;\n } else {\n return false;\n }\n }\n}\n\nexport default DragPan;\n","/**\n * @module ol/interaction/DragRotate\n */\nimport PointerInteraction from './Pointer.js';\nimport {FALSE} from '../functions.js';\nimport {\n altShiftKeysOnly,\n mouseActionButton,\n mouseOnly,\n} from '../events/condition.js';\nimport {disable} from '../rotationconstraint.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes an\n * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition~altShiftKeysOnly}.\n * @property {number} [duration=250] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by clicking and dragging on the map,\n * normally combined with an {@link module:ol/events/condition} that limits\n * it to when the alt and shift keys are held down.\n *\n * This interaction is only supported for mouse devices.\n * @api\n */\nclass DragRotate extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n stopDown: FALSE,\n });\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : altShiftKeysOnly;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n const size = map.getSize();\n const offset = mapBrowserEvent.pixel;\n const theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);\n if (this.lastAngle_ !== undefined) {\n const delta = theta - this.lastAngle_;\n view.adjustRotationInternal(-delta);\n }\n this.lastAngle_ = theta;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return false;\n }\n\n if (\n mouseActionButton(mapBrowserEvent) &&\n this.condition_(mapBrowserEvent)\n ) {\n const map = mapBrowserEvent.map;\n map.getView().beginInteraction();\n this.lastAngle_ = undefined;\n return true;\n } else {\n return false;\n }\n }\n}\n\nexport default DragRotate;\n","/**\n * @module ol/render/Box\n */\n\nimport Disposable from '../Disposable.js';\nimport Polygon from '../geom/Polygon.js';\n\nclass RenderBox extends Disposable {\n /**\n * @param {string} className CSS class name.\n */\n constructor(className) {\n super();\n\n /**\n * @type {import(\"../geom/Polygon.js\").default}\n * @private\n */\n this.geometry_ = null;\n\n /**\n * @type {HTMLDivElement}\n * @private\n */\n this.element_ = document.createElement('div');\n this.element_.style.position = 'absolute';\n this.element_.style.pointerEvents = 'auto';\n this.element_.className = 'ol-box ' + className;\n\n /**\n * @private\n * @type {import(\"../PluggableMap.js\").default}\n */\n this.map_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.endPixel_ = null;\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.setMap(null);\n }\n\n /**\n * @private\n */\n render_() {\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const px = 'px';\n const style = this.element_.style;\n style.left = Math.min(startPixel[0], endPixel[0]) + px;\n style.top = Math.min(startPixel[1], endPixel[1]) + px;\n style.width = Math.abs(endPixel[0] - startPixel[0]) + px;\n style.height = Math.abs(endPixel[1] - startPixel[1]) + px;\n }\n\n /**\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n if (this.map_) {\n this.map_.getOverlayContainer().removeChild(this.element_);\n const style = this.element_.style;\n style.left = 'inherit';\n style.top = 'inherit';\n style.width = 'inherit';\n style.height = 'inherit';\n }\n this.map_ = map;\n if (this.map_) {\n this.map_.getOverlayContainer().appendChild(this.element_);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} startPixel Start pixel.\n * @param {import(\"../pixel.js\").Pixel} endPixel End pixel.\n */\n setPixels(startPixel, endPixel) {\n this.startPixel_ = startPixel;\n this.endPixel_ = endPixel;\n this.createOrUpdateGeometry();\n this.render_();\n }\n\n /**\n * Creates or updates the cached geometry.\n */\n createOrUpdateGeometry() {\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const pixels = [\n startPixel,\n [startPixel[0], endPixel[1]],\n endPixel,\n [endPixel[0], startPixel[1]],\n ];\n const coordinates = pixels.map(\n this.map_.getCoordinateFromPixelInternal,\n this.map_\n );\n // close the polygon\n coordinates[4] = coordinates[0].slice();\n if (!this.geometry_) {\n this.geometry_ = new Polygon([coordinates]);\n } else {\n this.geometry_.setCoordinates([coordinates]);\n }\n }\n\n /**\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n */\n getGeometry() {\n return this.geometry_;\n }\n}\n\nexport default RenderBox;\n","/**\n * @module ol/interaction/DragBox\n */\n// FIXME draw drag box\nimport Event from '../events/Event.js';\nimport PointerInteraction from './Pointer.js';\nimport RenderBox from '../render/Box.js';\nimport {mouseActionButton} from '../events/condition.js';\n\n/**\n * A function that takes a {@link module:ol/MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,\n * true should be returned.\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default, import(\"../pixel.js\").Pixel, import(\"../pixel.js\").Pixel):boolean} EndCondition\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragbox'] CSS class name for styling the box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link ol/events/condition~mouseActionButton}.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default\n * `boxEndCondition` function.\n * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.\n * Default is `true` if the area of the box is bigger than the `minArea` option.\n * @property {function(this:DragBox, import(\"../MapBrowserEvent.js\").default):void} [onBoxEnd] Code to execute just\n * before `boxend` is fired.\n */\n\n/**\n * @enum {string}\n */\nconst DragBoxEventType = {\n /**\n * Triggered upon drag box start.\n * @event DragBoxEvent#boxstart\n * @api\n */\n BOXSTART: 'boxstart',\n\n /**\n * Triggered on drag when box is active.\n * @event DragBoxEvent#boxdrag\n * @api\n */\n BOXDRAG: 'boxdrag',\n\n /**\n * Triggered upon drag box end.\n * @event DragBoxEvent#boxend\n * @api\n */\n BOXEND: 'boxend',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of\n * this type.\n */\nclass DragBoxEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Originating event.\n */\n constructor(type, coordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * @const\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map,\n * normally combined with an {@link module:ol/events/condition} that limits\n * it to when the shift or other key is held down. This is used, for example,\n * for zooming to a specific area of the map\n * (see {@link module:ol/interaction/DragZoom~DragZoom} and\n * {@link module:ol/interaction/DragRotateAndZoom}).\n *\n * @fires DragBoxEvent\n * @api\n */\nclass DragBox extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n const options = opt_options ? opt_options : {};\n\n /**\n * @type {import(\"../render/Box.js\").default}\n * @private\n */\n this.box_ = new RenderBox(options.className || 'ol-dragbox');\n\n /**\n * @type {number}\n * @private\n */\n this.minArea_ = options.minArea !== undefined ? options.minArea : 64;\n\n if (options.onBoxEnd) {\n this.onBoxEnd = options.onBoxEnd;\n }\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : mouseActionButton;\n\n /**\n * @private\n * @type {EndCondition}\n */\n this.boxEndCondition_ = options.boxEndCondition\n ? options.boxEndCondition\n : this.defaultBoxEndCondition;\n }\n\n /**\n * The default condition for determining whether the boxend event\n * should fire.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent The originating MapBrowserEvent\n * leading to the box end.\n * @param {import(\"../pixel.js\").Pixel} startPixel The starting pixel of the box.\n * @param {import(\"../pixel.js\").Pixel} endPixel The end pixel of the box.\n * @return {boolean} Whether or not the boxend condition should be fired.\n */\n defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {\n const width = endPixel[0] - startPixel[0];\n const height = endPixel[1] - startPixel[1];\n return width * width + height * height >= this.minArea_;\n }\n\n /**\n * Returns geometry of last drawn box.\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n * @api\n */\n getGeometry() {\n return this.box_.getGeometry();\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);\n\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXDRAG,\n mapBrowserEvent.coordinate,\n mapBrowserEvent\n )\n );\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n this.box_.setMap(null);\n\n if (\n this.boxEndCondition_(\n mapBrowserEvent,\n this.startPixel_,\n mapBrowserEvent.pixel\n )\n ) {\n this.onBoxEnd(mapBrowserEvent);\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXEND,\n mapBrowserEvent.coordinate,\n mapBrowserEvent\n )\n );\n }\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.condition_(mapBrowserEvent)) {\n this.startPixel_ = mapBrowserEvent.pixel;\n this.box_.setMap(mapBrowserEvent.map);\n this.box_.setPixels(this.startPixel_, this.startPixel_);\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXSTART,\n mapBrowserEvent.coordinate,\n mapBrowserEvent\n )\n );\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n onBoxEnd(event) {}\n}\n\nexport default DragBox;\n","/**\n * @module ol/interaction/DragZoom\n */\nimport DragBox from './DragBox.js';\nimport {\n createOrUpdateFromCoordinates,\n getBottomLeft,\n getCenter,\n getTopRight,\n scaleFromCenter,\n} from '../extent.js';\nimport {easeOut} from '../easing.js';\nimport {shiftKeyOnly} from '../events/condition.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragzoom'] CSS class name for styling the\n * box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition~shiftKeyOnly}.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {boolean} [out=false] Use interaction for zooming out.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default\n * `boxEndCondition` function.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by clicking and dragging on the map,\n * normally combined with an {@link module:ol/events/condition} that limits\n * it to when a key, shift by default, is held down.\n *\n * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or\n * your custom one configured with `className`.\n * @api\n */\nclass DragZoom extends DragBox {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const condition = options.condition ? options.condition : shiftKeyOnly;\n\n super({\n condition: condition,\n className: options.className || 'ol-dragzoom',\n minArea: options.minArea,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n /**\n * @private\n * @type {boolean}\n */\n this.out_ = options.out !== undefined ? options.out : false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n onBoxEnd(event) {\n const map = this.getMap();\n const view = /** @type {!import(\"../View.js\").default} */ (map.getView());\n const size = /** @type {!import(\"../size.js\").Size} */ (map.getSize());\n let extent = this.getGeometry().getExtent();\n\n if (this.out_) {\n const mapExtent = view.calculateExtentInternal(size);\n const boxPixelExtent = createOrUpdateFromCoordinates([\n map.getPixelFromCoordinateInternal(getBottomLeft(extent)),\n map.getPixelFromCoordinateInternal(getTopRight(extent)),\n ]);\n const factor = view.getResolutionForExtentInternal(boxPixelExtent, size);\n\n scaleFromCenter(mapExtent, 1 / factor);\n extent = mapExtent;\n }\n\n const resolution = view.getConstrainedResolution(\n view.getResolutionForExtentInternal(extent, size)\n );\n const center = view.getConstrainedCenter(getCenter(extent), resolution);\n\n view.animateInternal({\n resolution: resolution,\n center: center,\n duration: this.duration_,\n easing: easeOut,\n });\n }\n}\n\nexport default DragZoom;\n","/**\n * @module ol/events/KeyCode\n */\n\n/**\n * @enum {number}\n * @const\n */\nexport default {\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n};\n","/**\n * @module ol/interaction/KeyboardPan\n */\nimport EventType from '../events/EventType.js';\nimport Interaction, {pan} from './Interaction.js';\nimport KeyCode from '../events/KeyCode.js';\nimport {noModifierKeys, targetNotEditable} from '../events/condition.js';\nimport {rotate as rotateCoordinate} from '../coordinate.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition~noModifierKeys} and\n * {@link module:ol/events/condition~targetNotEditable}.\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {number} [pixelDelta=128] The amount of pixels to pan on each key\n * press.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map using keyboard arrows.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.\n * @api\n */\nclass KeyboardPan extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n const options = opt_options || {};\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultCondition_ = function (mapBrowserEvent) {\n return (\n noModifierKeys(mapBrowserEvent) && targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ =\n options.condition !== undefined\n ? options.condition\n : this.defaultCondition_;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelDelta_ =\n options.pixelDelta !== undefined ? options.pixelDelta : 128;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides the direction to pan to (if an arrow key was\n * pressed).\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @this {KeyboardPan}\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == EventType.KEYDOWN) {\n const keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);\n const keyCode = keyEvent.keyCode;\n if (\n this.condition_(mapBrowserEvent) &&\n (keyCode == KeyCode.DOWN ||\n keyCode == KeyCode.LEFT ||\n keyCode == KeyCode.RIGHT ||\n keyCode == KeyCode.UP)\n ) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const mapUnitsDelta = view.getResolution() * this.pixelDelta_;\n let deltaX = 0,\n deltaY = 0;\n if (keyCode == KeyCode.DOWN) {\n deltaY = -mapUnitsDelta;\n } else if (keyCode == KeyCode.LEFT) {\n deltaX = -mapUnitsDelta;\n } else if (keyCode == KeyCode.RIGHT) {\n deltaX = mapUnitsDelta;\n } else {\n deltaY = mapUnitsDelta;\n }\n const delta = [deltaX, deltaY];\n rotateCoordinate(delta, view.getRotation());\n pan(view, delta, this.duration_);\n mapBrowserEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardPan;\n","/**\n * @module ol/interaction/KeyboardZoom\n */\nimport EventType from '../events/EventType.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\nimport {targetNotEditable} from '../events/condition.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition~targetNotEditable}.\n * @property {number} [delta=1] The zoom level delta on each key press.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map using keyboard + and -.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.\n * @api\n */\nclass KeyboardZoom extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n const options = opt_options ? opt_options : {};\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : targetNotEditable;\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides whether to zoom in or out (depending on whether the\n * key pressed was '+' or '-').\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @this {KeyboardZoom}\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (\n mapBrowserEvent.type == EventType.KEYDOWN ||\n mapBrowserEvent.type == EventType.KEYPRESS\n ) {\n const keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);\n const charCode = keyEvent.charCode;\n if (\n this.condition_(mapBrowserEvent) &&\n (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))\n ) {\n const map = mapBrowserEvent.map;\n const delta =\n charCode == '+'.charCodeAt(0) ? this.delta_ : -this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, undefined, this.duration_);\n mapBrowserEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardZoom;\n","/**\n * @module ol/interaction/MouseWheelZoom\n */\nimport EventType from '../events/EventType.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\nimport {DEVICE_PIXEL_RATIO, FIREFOX} from '../has.js';\nimport {all, always, focusWithTabindex} from '../events/condition.js';\nimport {clamp} from '../math.js';\n\n/**\n * @enum {string}\n */\nexport const Mode = {\n TRACKPAD: 'trackpad',\n WHEEL: 'wheel',\n};\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition~always}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {number} [maxDelta=1] Maximum mouse wheel delta.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.\n * @property {boolean} [useAnchor=true] Enable zooming using the mouse's\n * location as the anchor. When set to `false`, zooming in and out will zoom to\n * the center of the screen instead of zooming on the mouse's location.\n * @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom\n * event will always animate to the closest zoom level after an interaction;\n * false means intermediary zoom levels are allowed.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by scrolling the mouse wheel.\n * @api\n */\nclass MouseWheelZoom extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options)\n );\n\n /**\n * @private\n * @type {number}\n */\n this.totalDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.lastDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @private\n * @type {number}\n */\n this.timeout_ = options.timeout !== undefined ? options.timeout : 80;\n\n /**\n * @private\n * @type {boolean}\n */\n this.useAnchor_ =\n options.useAnchor !== undefined ? options.useAnchor : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.constrainResolution_ =\n options.constrainResolution !== undefined\n ? options.constrainResolution\n : false;\n\n const condition = options.condition ? options.condition : always;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {?import(\"../coordinate.js\").Coordinate}\n */\n this.lastAnchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.startTime_ = undefined;\n\n /**\n * @private\n * @type {?}\n */\n this.timeoutId_;\n\n /**\n * @private\n * @type {Mode|undefined}\n */\n this.mode_ = undefined;\n\n /**\n * Trackpad events separated by this delay will be considered separate\n * interactions.\n * @type {number}\n */\n this.trackpadEventGap_ = 400;\n\n /**\n * @type {?}\n */\n this.trackpadTimeoutId_;\n\n /**\n * The number of delta values per zoom level\n * @private\n * @type {number}\n */\n this.deltaPerZoom_ = 300;\n }\n\n /**\n * @private\n */\n endInteraction_() {\n this.trackpadTimeoutId_ = undefined;\n const view = this.getMap().getView();\n view.endInteraction(\n undefined,\n this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0,\n this.lastAnchor_\n );\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually\n * zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n if (!this.condition_(mapBrowserEvent)) {\n return true;\n }\n const type = mapBrowserEvent.type;\n if (type !== EventType.WHEEL) {\n return true;\n }\n\n mapBrowserEvent.preventDefault();\n\n const map = mapBrowserEvent.map;\n const wheelEvent = /** @type {WheelEvent} */ (mapBrowserEvent.originalEvent);\n\n if (this.useAnchor_) {\n this.lastAnchor_ = mapBrowserEvent.coordinate;\n }\n\n // Delta normalisation inspired by\n // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js\n let delta;\n if (mapBrowserEvent.type == EventType.WHEEL) {\n delta = wheelEvent.deltaY;\n if (FIREFOX && wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n delta /= DEVICE_PIXEL_RATIO;\n }\n if (wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n delta *= 40;\n }\n }\n\n if (delta === 0) {\n return false;\n } else {\n this.lastDelta_ = delta;\n }\n\n const now = Date.now();\n\n if (this.startTime_ === undefined) {\n this.startTime_ = now;\n }\n\n if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {\n this.mode_ = Math.abs(delta) < 4 ? Mode.TRACKPAD : Mode.WHEEL;\n }\n\n const view = map.getView();\n if (\n this.mode_ === Mode.TRACKPAD &&\n !(view.getConstrainResolution() || this.constrainResolution_)\n ) {\n if (this.trackpadTimeoutId_) {\n clearTimeout(this.trackpadTimeoutId_);\n } else {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.beginInteraction();\n }\n this.trackpadTimeoutId_ = setTimeout(\n this.endInteraction_.bind(this),\n this.timeout_\n );\n view.adjustZoom(-delta / this.deltaPerZoom_, this.lastAnchor_);\n this.startTime_ = now;\n return false;\n }\n\n this.totalDelta_ += delta;\n\n const timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);\n\n clearTimeout(this.timeoutId_);\n this.timeoutId_ = setTimeout(\n this.handleWheelZoom_.bind(this, map),\n timeLeft\n );\n\n return false;\n }\n\n /**\n * @private\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n handleWheelZoom_(map) {\n const view = map.getView();\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n let delta =\n -clamp(\n this.totalDelta_,\n -this.maxDelta_ * this.deltaPerZoom_,\n this.maxDelta_ * this.deltaPerZoom_\n ) / this.deltaPerZoom_;\n if (view.getConstrainResolution() || this.constrainResolution_) {\n // view has a zoom constraint, zoom by 1\n delta = delta ? (delta > 0 ? 1 : -1) : 0;\n }\n zoomByDelta(view, delta, this.lastAnchor_, this.duration_);\n\n this.mode_ = undefined;\n this.totalDelta_ = 0;\n this.lastAnchor_ = null;\n this.startTime_ = undefined;\n this.timeoutId_ = undefined;\n }\n\n /**\n * Enable or disable using the mouse's location as an anchor when zooming\n * @param {boolean} useAnchor true to zoom to the mouse's location, false\n * to zoom to the center of the map\n * @api\n */\n setMouseAnchor(useAnchor) {\n this.useAnchor_ = useAnchor;\n if (!useAnchor) {\n this.lastAnchor_ = null;\n }\n }\n}\n\nexport default MouseWheelZoom;\n","/**\n * @module ol/interaction/PinchRotate\n */\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\nimport {FALSE} from '../functions.js';\nimport {disable} from '../rotationconstraint.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] The duration of the animation in\n * milliseconds.\n * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by twisting with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchRotate extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (options);\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotating_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.rotationDelta_ = 0.0;\n\n /**\n * @private\n * @type {number}\n */\n this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n let rotationDelta = 0.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n\n // angle between touches\n const angle = Math.atan2(\n touch1.clientY - touch0.clientY,\n touch1.clientX - touch0.clientX\n );\n\n if (this.lastAngle_ !== undefined) {\n const delta = angle - this.lastAngle_;\n this.rotationDelta_ += delta;\n if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {\n this.rotating_ = true;\n }\n rotationDelta = delta;\n }\n this.lastAngle_ = angle;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n\n // rotate anchor point.\n // FIXME: should be the intersection point between the lines:\n // touch0,touch1 and previousTouch0,previousTouch1\n const viewportPosition = map.getViewport().getBoundingClientRect();\n const centroid = centroidFromPointers(this.targetPointers);\n centroid[0] -= viewportPosition.left;\n centroid[1] -= viewportPosition.top;\n this.anchor_ = map.getCoordinateFromPixelInternal(centroid);\n\n // rotate\n if (this.rotating_) {\n map.render();\n view.adjustRotationInternal(rotationDelta, this.anchor_);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n } else {\n return true;\n }\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastAngle_ = undefined;\n this.rotating_ = false;\n this.rotationDelta_ = 0.0;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n } else {\n return false;\n }\n }\n}\n\nexport default PinchRotate;\n","/**\n * @module ol/interaction/PinchZoom\n */\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\nimport {FALSE} from '../functions.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=400] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by pinching with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchZoom extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (options);\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 400;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastDistance_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.lastScaleDelta_ = 1;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n let scaleDelta = 1.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n const dx = touch0.clientX - touch1.clientX;\n const dy = touch0.clientY - touch1.clientY;\n\n // distance between touches\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (this.lastDistance_ !== undefined) {\n scaleDelta = this.lastDistance_ / distance;\n }\n this.lastDistance_ = distance;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n\n if (scaleDelta != 1.0) {\n this.lastScaleDelta_ = scaleDelta;\n }\n\n // scale anchor point.\n const viewportPosition = map.getViewport().getBoundingClientRect();\n const centroid = centroidFromPointers(this.targetPointers);\n centroid[0] -= viewportPosition.left;\n centroid[1] -= viewportPosition.top;\n this.anchor_ = map.getCoordinateFromPixelInternal(centroid);\n\n // scale, bypass the resolution constraint\n map.render();\n view.adjustResolutionInternal(scaleDelta, this.anchor_);\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n return false;\n } else {\n return true;\n }\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastDistance_ = undefined;\n this.lastScaleDelta_ = 1;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n } else {\n return false;\n }\n }\n}\n\nexport default PinchZoom;\n","/**\n * @module ol/interaction/DragAndDrop\n */\n// FIXME should handle all geo-referenced data, not just vector data\n\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport Interaction from './Interaction.js';\nimport {TRUE} from '../functions.js';\nimport {get as getProjection} from '../proj.js';\nimport {listen, unlistenByKey} from '../events.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<typeof import(\"../format/Feature.js\").default>} [formatConstructors] Format constructors.\n * @property {import(\"../source/Vector.js\").default} [source] Optional vector source where features will be added. If a source is provided\n * all existing features will be removed and new features will be added when\n * they are dropped on the target. If you want to add features to a vector\n * source without removing the existing features (append only), instead of\n * providing the source option listen for the \"addfeatures\" event.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.\n * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.\n */\n\n/**\n * @enum {string}\n */\nconst DragAndDropEventType = {\n /**\n * Triggered when features are added\n * @event DragAndDropEvent#addfeatures\n * @api\n */\n ADD_FEATURES: 'addfeatures',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances\n * of this type.\n */\nclass DragAndDropEvent extends Event {\n /**\n * @param {DragAndDropEventType} type Type.\n * @param {File} file File.\n * @param {Array<import(\"../Feature.js\").default>=} opt_features Features.\n * @param {import(\"../proj/Projection.js\").default=} opt_projection Projection.\n */\n constructor(type, file, opt_features, opt_projection) {\n super(type);\n\n /**\n * The features parsed from dropped data.\n * @type {Array<import(\"../Feature.js\").FeatureLike>|undefined}\n * @api\n */\n this.features = opt_features;\n\n /**\n * The dropped file.\n * @type {File}\n * @api\n */\n this.file = file;\n\n /**\n * The feature projection.\n * @type {import(\"../proj/Projection.js\").default|undefined}\n * @api\n */\n this.projection = opt_projection;\n }\n}\n\n/**\n * @classdesc\n * Handles input of vector data by drag and drop.\n * @api\n *\n * @fires DragAndDropEvent\n */\nclass DragAndDrop extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super({\n handleEvent: TRUE,\n });\n\n /**\n * @private\n * @type {Array<typeof import(\"../format/Feature.js\").default>}\n */\n this.formatConstructors_ = options.formatConstructors\n ? options.formatConstructors\n : [];\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = options.projection\n ? getProjection(options.projection)\n : null;\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.dropListenKeys_ = null;\n\n /**\n * @private\n * @type {import(\"../source/Vector.js\").default}\n */\n this.source_ = options.source || null;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.target = options.target ? options.target : null;\n }\n\n /**\n * @param {File} file File.\n * @param {Event} event Load event.\n * @private\n */\n handleResult_(file, event) {\n const result = event.target.result;\n const map = this.getMap();\n let projection = this.projection_;\n if (!projection) {\n const view = map.getView();\n projection = view.getProjection();\n }\n\n const formatConstructors = this.formatConstructors_;\n for (let i = 0, ii = formatConstructors.length; i < ii; ++i) {\n const format = new formatConstructors[i]();\n const features = this.tryReadFeatures_(format, result, {\n featureProjection: projection,\n });\n if (features && features.length > 0) {\n if (this.source_) {\n this.source_.clear();\n this.source_.addFeatures(features);\n }\n this.dispatchEvent(\n new DragAndDropEvent(\n DragAndDropEventType.ADD_FEATURES,\n file,\n features,\n projection\n )\n );\n break;\n }\n }\n }\n\n /**\n * @private\n */\n registerListeners_() {\n const map = this.getMap();\n if (map) {\n const dropArea = this.target ? this.target : map.getViewport();\n this.dropListenKeys_ = [\n listen(dropArea, EventType.DROP, this.handleDrop, this),\n listen(dropArea, EventType.DRAGENTER, this.handleStop, this),\n listen(dropArea, EventType.DRAGOVER, this.handleStop, this),\n listen(dropArea, EventType.DROP, this.handleStop, this),\n ];\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n if (!this.getActive() && active) {\n this.registerListeners_();\n }\n if (this.getActive() && !active) {\n this.unregisterListeners_();\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n this.unregisterListeners_();\n super.setMap(map);\n if (this.getActive()) {\n this.registerListeners_();\n }\n }\n\n /**\n * @param {import(\"../format/Feature.js\").default} format Format.\n * @param {string} text Text.\n * @param {import(\"../format/Feature.js\").ReadOptions} options Read options.\n * @private\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n tryReadFeatures_(format, text, options) {\n try {\n return (\n /** @type {Array<import(\"../Feature.js\").default>} */\n (format.readFeatures(text, options))\n );\n } catch (e) {\n return null;\n }\n }\n\n /**\n * @private\n */\n unregisterListeners_() {\n if (this.dropListenKeys_) {\n this.dropListenKeys_.forEach(unlistenByKey);\n this.dropListenKeys_ = null;\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleDrop(event) {\n const files = event.dataTransfer.files;\n for (let i = 0, ii = files.length; i < ii; ++i) {\n const file = files.item(i);\n const reader = new FileReader();\n reader.addEventListener(\n EventType.LOAD,\n this.handleResult_.bind(this, file)\n );\n reader.readAsText(file);\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleStop(event) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n}\n\nexport default DragAndDrop;\n","/**\n * @module ol/interaction/DragRotateAndZoom\n */\nimport PointerInteraction from './Pointer.js';\nimport {mouseOnly, shiftKeyOnly} from '../events/condition.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition~shiftKeyOnly}.\n * @property {number} [duration=400] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom and rotate the map by clicking and dragging\n * on the map. By default, this interaction is limited to when the shift\n * key is held down.\n *\n * This interaction is only supported for mouse devices.\n *\n * And this interaction is not included in the default interactions.\n * @api\n */\nclass DragRotateAndZoom extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : shiftKeyOnly;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastMagnitude_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.lastScaleDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 400;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return;\n }\n\n const map = mapBrowserEvent.map;\n const size = map.getSize();\n const offset = mapBrowserEvent.pixel;\n const deltaX = offset[0] - size[0] / 2;\n const deltaY = size[1] / 2 - offset[1];\n const theta = Math.atan2(deltaY, deltaX);\n const magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n const view = map.getView();\n if (this.lastAngle_ !== undefined) {\n const angleDelta = this.lastAngle_ - theta;\n view.adjustRotationInternal(angleDelta);\n }\n this.lastAngle_ = theta;\n if (this.lastMagnitude_ !== undefined) {\n view.adjustResolutionInternal(this.lastMagnitude_ / magnitude);\n }\n if (this.lastMagnitude_ !== undefined) {\n this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;\n }\n this.lastMagnitude_ = magnitude;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n this.lastScaleDelta_ = 0;\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return false;\n }\n\n if (this.condition_(mapBrowserEvent)) {\n mapBrowserEvent.map.getView().beginInteraction();\n this.lastAngle_ = undefined;\n this.lastMagnitude_ = undefined;\n return true;\n } else {\n return false;\n }\n }\n}\n\nexport default DragRotateAndZoom;\n","/**\n * @module ol/geom/Circle\n */\nimport GeometryType from './GeometryType.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {createOrUpdate, forEachCorner, intersects} from '../extent.js';\nimport {deflateCoordinate} from './flat/deflate.js';\nimport {rotate, translate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Circle geometry.\n *\n * @api\n */\nclass Circle extends SimpleGeometry {\n /**\n * @param {!import(\"../coordinate.js\").Coordinate} center Center.\n * For internal use, flat coordinates in combination with `opt_layout` and no\n * `opt_radius` are also accepted.\n * @param {number=} opt_radius Radius.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n constructor(center, opt_radius, opt_layout) {\n super();\n if (opt_layout !== undefined && opt_radius === undefined) {\n this.setFlatCoordinates(opt_layout, center);\n } else {\n const radius = opt_radius ? opt_radius : 0;\n this.setCenterAndRadius(center, radius, opt_layout);\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Circle} Clone.\n * @api\n */\n clone() {\n return new Circle(this.flatCoordinates.slice(), undefined, this.layout);\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const dx = x - flatCoordinates[0];\n const dy = y - flatCoordinates[1];\n const squaredDistance = dx * dx + dy * dy;\n if (squaredDistance < minSquaredDistance) {\n if (squaredDistance === 0) {\n for (let i = 0; i < this.stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n } else {\n const delta = this.getRadius() / Math.sqrt(squaredDistance);\n closestPoint[0] = flatCoordinates[0] + delta * dx;\n closestPoint[1] = flatCoordinates[1] + delta * dy;\n for (let i = 2; i < this.stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n }\n closestPoint.length = this.stride;\n return squaredDistance;\n } else {\n return minSquaredDistance;\n }\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n const flatCoordinates = this.flatCoordinates;\n const dx = x - flatCoordinates[0];\n const dy = y - flatCoordinates[1];\n return dx * dx + dy * dy <= this.getRadiusSquared_();\n }\n\n /**\n * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.\n * @return {import(\"../coordinate.js\").Coordinate} Center.\n * @api\n */\n getCenter() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const radius = flatCoordinates[this.stride] - flatCoordinates[0];\n return createOrUpdate(\n flatCoordinates[0] - radius,\n flatCoordinates[1] - radius,\n flatCoordinates[0] + radius,\n flatCoordinates[1] + radius,\n extent\n );\n }\n\n /**\n * Return the radius of the circle.\n * @return {number} Radius.\n * @api\n */\n getRadius() {\n return Math.sqrt(this.getRadiusSquared_());\n }\n\n /**\n * @private\n * @return {number} Radius squared.\n */\n getRadiusSquared_() {\n const dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0];\n const dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1];\n return dx * dx + dy * dy;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.CIRCLE;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n const circleExtent = this.getExtent();\n if (intersects(extent, circleExtent)) {\n const center = this.getCenter();\n\n if (extent[0] <= center[0] && extent[2] >= center[0]) {\n return true;\n }\n if (extent[1] <= center[1] && extent[3] >= center[1]) {\n return true;\n }\n\n return forEachCorner(extent, this.intersectsCoordinate.bind(this));\n }\n return false;\n }\n\n /**\n * Set the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} center Center.\n * @api\n */\n setCenter(center) {\n const stride = this.stride;\n const radius = this.flatCoordinates[stride] - this.flatCoordinates[0];\n const flatCoordinates = center.slice();\n flatCoordinates[stride] = flatCoordinates[0] + radius;\n for (let i = 1; i < stride; ++i) {\n flatCoordinates[stride + i] = center[i];\n }\n this.setFlatCoordinates(this.layout, flatCoordinates);\n this.changed();\n }\n\n /**\n * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as\n * number) of the circle.\n * @param {!import(\"../coordinate.js\").Coordinate} center Center.\n * @param {number} radius Radius.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCenterAndRadius(center, radius, opt_layout) {\n this.setLayout(opt_layout, center, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n /** @type {Array<number>} */\n const flatCoordinates = this.flatCoordinates;\n let offset = deflateCoordinate(flatCoordinates, 0, center, this.stride);\n flatCoordinates[offset++] = flatCoordinates[0] + radius;\n for (let i = 1, ii = this.stride; i < ii; ++i) {\n flatCoordinates[offset++] = flatCoordinates[i];\n }\n flatCoordinates.length = offset;\n this.changed();\n }\n\n getCoordinates() {\n return null;\n }\n\n setCoordinates(coordinates, opt_layout) {}\n\n /**\n * Set the radius of the circle. The radius is in the units of the projection.\n * @param {number} radius Radius.\n * @api\n */\n setRadius(radius) {\n this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;\n this.changed();\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n const center = this.getCenter();\n const stride = this.getStride();\n this.setCenter(\n rotate(center, 0, center.length, stride, angle, anchor, center)\n );\n this.changed();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n const center = this.getCenter();\n const stride = this.getStride();\n this.setCenter(\n translate(center, 0, center.length, stride, deltaX, deltaY, center)\n );\n this.changed();\n }\n}\n\n/**\n * Transform each coordinate of the circle from one coordinate reference system\n * to another. The geometry is modified in place.\n * If you do not want the geometry modified in place, first clone() it and\n * then use this function on the clone.\n *\n * Internally a circle is currently represented by two points: the center of\n * the circle `[cx, cy]`, and the point to the right of the circle\n * `[cx + r, cy]`. This `transform` function just transforms these two points.\n * So the resulting geometry is also a circle, and that circle does not\n * correspond to the shape that would be obtained by transforming every point\n * of the original circle.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {Circle} This geometry. Note that original geometry is\n * modified in place.\n * @function\n * @api\n */\nCircle.prototype.transform;\nexport default Circle;\n","/**\n * @module ol/geom/MultiLineString\n */\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport LineString from './LineString.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {douglasPeuckerArray} from './flat/simplify.js';\nimport {extend} from '../array.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {\n interpolatePoint,\n lineStringsCoordinateAtM,\n} from './flat/interpolate.js';\nimport {intersectsLineStringArray} from './flat/intersectsextent.js';\n\n/**\n * @classdesc\n * Multi-linestring geometry.\n *\n * @api\n */\nclass MultiLineString extends SimpleGeometry {\n /**\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>|LineString>|Array<number>} coordinates\n * Coordinates or LineString geometries. (For internal use, flat coordinates in\n * combination with `opt_layout` and `opt_ends` are also accepted.)\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @param {Array<number>=} opt_ends Flat coordinate ends for internal use.\n */\n constructor(coordinates, opt_layout, opt_ends) {\n super();\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (Array.isArray(coordinates[0])) {\n this.setCoordinates(\n /** @type {Array<Array<import(\"../coordinate.js\").Coordinate>>} */ (coordinates),\n opt_layout\n );\n } else if (opt_layout !== undefined && opt_ends) {\n this.setFlatCoordinates(\n opt_layout,\n /** @type {Array<number>} */ (coordinates)\n );\n this.ends_ = opt_ends;\n } else {\n let layout = this.getLayout();\n const lineStrings = /** @type {Array<LineString>} */ (coordinates);\n const flatCoordinates = [];\n const ends = [];\n for (let i = 0, ii = lineStrings.length; i < ii; ++i) {\n const lineString = lineStrings[i];\n if (i === 0) {\n layout = lineString.getLayout();\n }\n extend(flatCoordinates, lineString.getFlatCoordinates());\n ends.push(flatCoordinates.length);\n }\n this.setFlatCoordinates(layout, flatCoordinates);\n this.ends_ = ends;\n }\n }\n\n /**\n * Append the passed linestring to the multilinestring.\n * @param {LineString} lineString LineString.\n * @api\n */\n appendLineString(lineString) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = lineString.getFlatCoordinates().slice();\n } else {\n extend(this.flatCoordinates, lineString.getFlatCoordinates().slice());\n }\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiLineString} Clone.\n * @api\n */\n clone() {\n return new MultiLineString(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice()\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0\n )\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `opt_extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * `opt_interpolate` controls interpolation between consecutive LineStrings\n * within the MultiLineString. If `opt_interpolate` is `true` the coordinates\n * will be linearly interpolated between the last coordinate of one LineString\n * and the first coordinate of the next LineString. If `opt_interpolate` is\n * `false` then the function will return `null` for Ms falling between\n * LineStrings.\n *\n * @param {number} m M.\n * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`.\n * @param {boolean=} opt_interpolate Interpolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n getCoordinateAtM(m, opt_extrapolate, opt_interpolate) {\n if (\n (this.layout != GeometryLayout.XYM &&\n this.layout != GeometryLayout.XYZM) ||\n this.flatCoordinates.length === 0\n ) {\n return null;\n }\n const extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;\n const interpolate = opt_interpolate !== undefined ? opt_interpolate : false;\n return lineStringsCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n m,\n extrapolate,\n interpolate\n );\n }\n\n /**\n * Return the coordinates of the multilinestring.\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride\n );\n }\n\n /**\n * @return {Array<number>} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * Return the linestring at the specified index.\n * @param {number} index Index.\n * @return {LineString} LineString.\n * @api\n */\n getLineString(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LineString(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index]\n ),\n this.layout\n );\n }\n\n /**\n * Return the linestrings of this multilinestring.\n * @return {Array<LineString>} LineStrings.\n * @api\n */\n getLineStrings() {\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const layout = this.layout;\n /** @type {Array<LineString>} */\n const lineStrings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const lineString = new LineString(\n flatCoordinates.slice(offset, end),\n layout\n );\n lineStrings.push(lineString);\n offset = end;\n }\n return lineStrings;\n }\n\n /**\n * @return {Array<number>} Flat midpoints.\n */\n getFlatMidpoints() {\n const midpoints = [];\n const flatCoordinates = this.flatCoordinates;\n let offset = 0;\n const ends = this.ends_;\n const stride = this.stride;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const midpoint = interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n 0.5\n );\n extend(midpoints, midpoint);\n offset = end;\n }\n return midpoints;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiLineString} Simplified MultiLineString.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n const simplifiedFlatCoordinates = [];\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = douglasPeuckerArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds\n );\n return new MultiLineString(\n simplifiedFlatCoordinates,\n GeometryLayout.XY,\n simplifiedEnds\n );\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.MULTI_LINE_STRING;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLineStringArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n extent\n );\n }\n\n /**\n * Set the coordinates of the multilinestring.\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>} coordinates Coordinates.\n * @param {GeometryLayout=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default MultiLineString;\n","/**\n * @module ol/geom/MultiPoint\n */\nimport GeometryType from './GeometryType.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {closestSquaredDistanceXY, containsXY} from '../extent.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {extend} from '../array.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {squaredDistance as squaredDx} from '../math.js';\n\n/**\n * @classdesc\n * Multi-point geometry.\n *\n * @api\n */\nclass MultiPoint extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `opt_layout` are also accepted.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n */\n constructor(coordinates, opt_layout) {\n super();\n if (opt_layout && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n opt_layout,\n /** @type {Array<number>} */ (coordinates)\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (coordinates),\n opt_layout\n );\n }\n }\n\n /**\n * Append the passed point to this multipoint.\n * @param {Point} point Point.\n * @api\n */\n appendPoint(point) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = point.getFlatCoordinates().slice();\n } else {\n extend(this.flatCoordinates, point.getFlatCoordinates());\n }\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPoint} Clone.\n * @api\n */\n clone() {\n const multiPoint = new MultiPoint(\n this.flatCoordinates.slice(),\n this.layout\n );\n return multiPoint;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[i],\n flatCoordinates[i + 1]\n );\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (let j = 0; j < stride; ++j) {\n closestPoint[j] = flatCoordinates[i + j];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinates of the multipoint.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride\n );\n }\n\n /**\n * Return the point at the specified index.\n * @param {number} index Index.\n * @return {Point} Point.\n * @api\n */\n getPoint(index) {\n const n = !this.flatCoordinates\n ? 0\n : this.flatCoordinates.length / this.stride;\n if (index < 0 || n <= index) {\n return null;\n }\n return new Point(\n this.flatCoordinates.slice(\n index * this.stride,\n (index + 1) * this.stride\n ),\n this.layout\n );\n }\n\n /**\n * Return the points of this multipoint.\n * @return {Array<Point>} Points.\n * @api\n */\n getPoints() {\n const flatCoordinates = this.flatCoordinates;\n const layout = this.layout;\n const stride = this.stride;\n /** @type {Array<Point>} */\n const points = [];\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const point = new Point(flatCoordinates.slice(i, i + stride), layout);\n points.push(point);\n }\n return points;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.MULTI_POINT;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n if (containsXY(extent, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Set the coordinates of the multipoint.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride\n );\n this.changed();\n }\n}\n\nexport default MultiPoint;\n","/**\n * @module ol/geom/flat/center\n */\nimport {createEmpty, createOrUpdateFromFlatCoordinates} from '../../extent.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @return {Array<number>} Flat centers.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n const flatCenters = [];\n let extent = createEmpty();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n extent = createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n ends[0],\n stride\n );\n flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);\n offset = ends[ends.length - 1];\n }\n return flatCenters;\n}\n","/**\n * @module ol/geom/MultiPolygon\n */\nimport GeometryLayout from './GeometryLayout.js';\nimport GeometryType from './GeometryType.js';\nimport MultiPoint from './MultiPoint.js';\nimport Polygon from './Polygon.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {\n assignClosestMultiArrayPoint,\n multiArrayMaxSquaredDelta,\n} from './flat/closest.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport {deflateMultiCoordinatesArray} from './flat/deflate.js';\nimport {extend} from '../array.js';\nimport {getInteriorPointsOfMultiArray} from './flat/interiorpoint.js';\nimport {inflateMultiCoordinatesArray} from './flat/inflate.js';\nimport {intersectsLinearRingMultiArray} from './flat/intersectsextent.js';\nimport {\n linearRingssAreOriented,\n orientLinearRingsArray,\n} from './flat/orient.js';\nimport {linearRingss as linearRingssArea} from './flat/area.js';\nimport {linearRingss as linearRingssCenter} from './flat/center.js';\nimport {linearRingssContainsXY} from './flat/contains.js';\nimport {quantizeMultiArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Multi-polygon geometry.\n *\n * @api\n */\nclass MultiPolygon extends SimpleGeometry {\n /**\n * @param {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `opt_layout` and `opt_endss` are also accepted.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @param {Array<Array<number>>=} opt_endss Array of ends for internal use with flat coordinates.\n */\n constructor(coordinates, opt_layout, opt_endss) {\n super();\n\n /**\n * @type {Array<Array<number>>}\n * @private\n */\n this.endss_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointsRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatInteriorPoints_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (!opt_endss && !Array.isArray(coordinates[0])) {\n let layout = this.getLayout();\n const polygons = /** @type {Array<Polygon>} */ (coordinates);\n const flatCoordinates = [];\n const endss = [];\n for (let i = 0, ii = polygons.length; i < ii; ++i) {\n const polygon = polygons[i];\n if (i === 0) {\n layout = polygon.getLayout();\n }\n const offset = flatCoordinates.length;\n const ends = polygon.getEnds();\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] += offset;\n }\n extend(flatCoordinates, polygon.getFlatCoordinates());\n endss.push(ends);\n }\n opt_layout = layout;\n coordinates = flatCoordinates;\n opt_endss = endss;\n }\n if (opt_layout !== undefined && opt_endss) {\n this.setFlatCoordinates(\n opt_layout,\n /** @type {Array<number>} */ (coordinates)\n );\n this.endss_ = opt_endss;\n } else {\n this.setCoordinates(\n /** @type {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} */ (coordinates),\n opt_layout\n );\n }\n }\n\n /**\n * Append the passed polygon to this multipolygon.\n * @param {Polygon} polygon Polygon.\n * @api\n */\n appendPolygon(polygon) {\n /** @type {Array<number>} */\n let ends;\n if (!this.flatCoordinates) {\n this.flatCoordinates = polygon.getFlatCoordinates().slice();\n ends = polygon.getEnds().slice();\n this.endss_.push();\n } else {\n const offset = this.flatCoordinates.length;\n extend(this.flatCoordinates, polygon.getFlatCoordinates());\n ends = polygon.getEnds().slice();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] += offset;\n }\n }\n this.endss_.push(ends);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPolygon} Clone.\n * @api\n */\n clone() {\n const len = this.endss_.length;\n const newEndss = new Array(len);\n for (let i = 0; i < len; ++i) {\n newEndss[i] = this.endss_[i].slice();\n }\n\n return new MultiPolygon(\n this.flatCoordinates.slice(),\n this.layout,\n newEndss\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n multiArrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n 0\n )\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestMultiArrayPoint(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n return linearRingssContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n x,\n y\n );\n }\n\n /**\n * Return the area of the multipolygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingssArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for multi-polygons.\n *\n * @param {boolean=} opt_right Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} Coordinates.\n * @api\n */\n getCoordinates(opt_right) {\n let flatCoordinates;\n if (opt_right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRingsArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n opt_right\n );\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride\n );\n }\n\n /**\n * @return {Array<Array<number>>} Endss.\n */\n getEndss() {\n return this.endss_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoints() {\n if (this.flatInteriorPointsRevision_ != this.getRevision()) {\n const flatCenters = linearRingssCenter(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride\n );\n this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n flatCenters\n );\n this.flatInteriorPointsRevision_ = this.getRevision();\n }\n return this.flatInteriorPoints_;\n }\n\n /**\n * Return the interior points as {@link module:ol/geom/MultiPoint multipoint}.\n * @return {MultiPoint} Interior points as XYM coordinates, where M is\n * the length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoints() {\n return new MultiPoint(\n this.getFlatInteriorPoints().slice(),\n GeometryLayout.XYM\n );\n }\n\n /**\n * @return {Array<number>} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (\n linearRingssAreOriented(flatCoordinates, 0, this.endss_, this.stride)\n ) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRingsArray(\n this.orientedFlatCoordinates_,\n 0,\n this.endss_,\n this.stride\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return this.orientedFlatCoordinates_;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiPolygon} Simplified MultiPolygon.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n const simplifiedFlatCoordinates = [];\n const simplifiedEndss = [];\n simplifiedFlatCoordinates.length = quantizeMultiArray(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEndss\n );\n return new MultiPolygon(\n simplifiedFlatCoordinates,\n GeometryLayout.XY,\n simplifiedEndss\n );\n }\n\n /**\n * Return the polygon at the specified index.\n * @param {number} index Index.\n * @return {Polygon} Polygon.\n * @api\n */\n getPolygon(index) {\n if (index < 0 || this.endss_.length <= index) {\n return null;\n }\n let offset;\n if (index === 0) {\n offset = 0;\n } else {\n const prevEnds = this.endss_[index - 1];\n offset = prevEnds[prevEnds.length - 1];\n }\n const ends = this.endss_[index].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] -= offset;\n }\n }\n return new Polygon(\n this.flatCoordinates.slice(offset, end),\n this.layout,\n ends\n );\n }\n\n /**\n * Return the polygons of this multipolygon.\n * @return {Array<Polygon>} Polygons.\n * @api\n */\n getPolygons() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const endss = this.endss_;\n const polygons = [];\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] -= offset;\n }\n }\n const polygon = new Polygon(\n flatCoordinates.slice(offset, end),\n layout,\n ends\n );\n polygons.push(polygon);\n offset = end;\n }\n return polygons;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./GeometryType.js\").default} Geometry type.\n * @api\n */\n getType() {\n return GeometryType.MULTI_POLYGON;\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n */\n intersectsExtent(extent) {\n return intersectsLinearRingMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n extent\n );\n }\n\n /**\n * Set the coordinates of the multipolygon.\n * @param {!Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} coordinates Coordinates.\n * @param {import(\"./GeometryLayout.js\").default=} opt_layout Layout.\n * @api\n */\n setCoordinates(coordinates, opt_layout) {\n this.setLayout(opt_layout, coordinates, 3);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const endss = deflateMultiCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.endss_\n );\n if (endss.length === 0) {\n this.flatCoordinates.length = 0;\n } else {\n const lastEnds = endss[endss.length - 1];\n this.flatCoordinates.length =\n lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1];\n }\n this.changed();\n }\n}\n\nexport default MultiPolygon;\n","/**\n * @module ol/interaction/Draw\n */\nimport Circle from '../geom/Circle.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport Feature from '../Feature.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport InteractionProperty from './Property.js';\nimport LineString from '../geom/LineString.js';\nimport MapBrowserEvent from '../MapBrowserEvent.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport PointerInteraction from './Pointer.js';\nimport Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js';\nimport VectorLayer from '../layer/Vector.js';\nimport VectorSource from '../source/Vector.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {always, noModifierKeys, shiftKeyOnly} from '../events/condition.js';\nimport {\n boundingExtent,\n getBottomLeft,\n getBottomRight,\n getTopLeft,\n getTopRight,\n} from '../extent.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {fromUserCoordinate, getUserProjection} from '../proj.js';\nimport {getChangeEventType} from '../Object.js';\nimport {squaredDistance as squaredCoordinateDistance} from '../coordinate.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../geom/GeometryType.js\").default} type Geometry type of\n * the geometries being drawn with this instance.\n * @property {number} [clickTolerance=6] The maximum distance in pixels between\n * \"down\" and \"up\" for a \"up\" event to be considered a \"click\" event and\n * actually add a point/vertex to the geometry being drawn. The default of `6`\n * was chosen for the draw interaction to behave correctly on mouse as well as\n * on touch devices.\n * @property {import(\"../Collection.js\").default<Feature>} [features]\n * Destination collection for the drawn features.\n * @property {VectorSource} [source] Destination source for\n * the drawn features.\n * @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown\n * before the current vertex can be dragged to its exact position.\n * @property {number} [snapTolerance=12] Pixel distance for snapping to the\n * drawing finish.\n * @property {boolean} [stopClick=false] Stop click, singleclick, and\n * doubleclick events from firing during drawing.\n * @property {number} [maxPoints] The number of points that can be drawn before\n * a polygon ring or line string is finished. By default there is no\n * restriction.\n * @property {number} [minPoints] The number of points that must be drawn\n * before a polygon ring or line string can be finished. Default is `3` for\n * polygon rings and `2` for line strings.\n * @property {import(\"../events/condition.js\").Condition} [finishCondition] A function\n * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether the drawing can be finished.\n * @property {import(\"../style/Style.js\").StyleLike} [style]\n * Style for sketch features.\n * @property {GeometryFunction} [geometryFunction]\n * Function that is called when a geometry's coordinates are updated.\n * @property {string} [geometryName] Geometry name to use for features created\n * by the draw interaction.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default {@link module:ol/events/condition~noModifierKeys}, i.e. a click,\n * adds a vertex or deactivates freehand drawing.\n * @property {boolean} [freehand=false] Operate in freehand mode for lines,\n * polygons, and circles. This makes the interaction always operate in freehand\n * mode and takes precedence over any `freehandCondition` option.\n * @property {import(\"../events/condition.js\").Condition} [freehandCondition]\n * Condition that activates freehand drawing for lines and polygons. This\n * function takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether that event should be handled. The\n * default is {@link module:ol/events/condition~shiftKeyOnly}, meaning that the\n * Shift key activates freehand drawing.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n */\n\n/**\n * Coordinate type when drawing points.\n * @typedef {import(\"../coordinate.js\").Coordinate} PointCoordType\n */\n\n/**\n * Coordinate type when drawing lines.\n * @typedef {Array<import(\"../coordinate.js\").Coordinate>} LineCoordType\n */\n\n/**\n * Coordinate type when drawing polygons.\n * @typedef {Array<Array<import(\"../coordinate.js\").Coordinate>>} PolyCoordType\n */\n\n/**\n * Types used for drawing coordinates.\n * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType\n */\n\n/**\n * Function that takes an array of coordinates and an optional existing geometry\n * and a projection as arguments, and returns a geometry. The optional existing\n * geometry is the geometry that is returned when the function is called without\n * a second argument.\n * @typedef {function(!SketchCoordType, import(\"../geom/SimpleGeometry.js\").default=,\n * import(\"../proj/Projection.js\").default=):\n * import(\"../geom/SimpleGeometry.js\").default} GeometryFunction\n */\n\n/**\n * Draw mode. This collapses multi-part geometry types with their single-part\n * cousins.\n * @enum {string}\n */\nconst Mode = {\n POINT: 'Point',\n LINE_STRING: 'LineString',\n POLYGON: 'Polygon',\n CIRCLE: 'Circle',\n};\n\n/**\n * @enum {string}\n */\nconst DrawEventType = {\n /**\n * Triggered upon feature draw start\n * @event DrawEvent#drawstart\n * @api\n */\n DRAWSTART: 'drawstart',\n /**\n * Triggered upon feature draw end\n * @event DrawEvent#drawend\n * @api\n */\n DRAWEND: 'drawend',\n /**\n * Triggered upon feature draw abortion\n * @event DrawEvent#drawabort\n * @api\n */\n DRAWABORT: 'drawabort',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Draw~Draw} instances are\n * instances of this type.\n */\nclass DrawEvent extends Event {\n /**\n * @param {DrawEventType} type Type.\n * @param {Feature} feature The feature drawn.\n */\n constructor(type, feature) {\n super(type);\n\n /**\n * The feature being drawn.\n * @type {Feature}\n * @api\n */\n this.feature = feature;\n }\n}\n\n/**\n * @classdesc\n * Interaction for drawing feature geometries.\n *\n * @fires DrawEvent\n * @api\n */\nclass Draw extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (options);\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @type {boolean}\n * @private\n */\n this.shouldHandle_ = false;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.downPx_ = null;\n\n /**\n * @type {?}\n * @private\n */\n this.downTimeout_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.lastDragTime_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.freehand_ = false;\n\n /**\n * Target source for drawn features.\n * @type {VectorSource}\n * @private\n */\n this.source_ = options.source ? options.source : null;\n\n /**\n * Target collection for drawn features.\n * @type {import(\"../Collection.js\").default<Feature>}\n * @private\n */\n this.features_ = options.features ? options.features : null;\n\n /**\n * Pixel distance for snapping.\n * @type {number}\n * @private\n */\n this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12;\n\n /**\n * Geometry type.\n * @type {import(\"../geom/GeometryType.js\").default}\n * @private\n */\n this.type_ = /** @type {import(\"../geom/GeometryType.js\").default} */ (options.type);\n\n /**\n * Drawing mode (derived from geometry type.\n * @type {Mode}\n * @private\n */\n this.mode_ = getMode(this.type_);\n\n /**\n * Stop click, singleclick, and doubleclick events from firing during drawing.\n * Default is `false`.\n * @type {boolean}\n * @private\n */\n this.stopClick_ = !!options.stopClick;\n\n /**\n * The number of points that must be drawn before a polygon ring or line\n * string can be finished. The default is 3 for polygon rings and 2 for\n * line strings.\n * @type {number}\n * @private\n */\n this.minPoints_ = options.minPoints\n ? options.minPoints\n : this.mode_ === Mode.POLYGON\n ? 3\n : 2;\n\n /**\n * The number of points that can be drawn before a polygon ring or line string\n * is finished. The default is no restriction.\n * @type {number}\n * @private\n */\n this.maxPoints_ = options.maxPoints ? options.maxPoints : Infinity;\n\n /**\n * A function to decide if a potential finish coordinate is permissible\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.finishCondition_ = options.finishCondition\n ? options.finishCondition\n : TRUE;\n\n let geometryFunction = options.geometryFunction;\n if (!geometryFunction) {\n if (this.type_ === GeometryType.CIRCLE) {\n /**\n * @param {!LineCoordType} coordinates The coordinates.\n * @param {import(\"../geom/SimpleGeometry.js\").default=} opt_geometry Optional geometry.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../geom/SimpleGeometry.js\").default} A geometry.\n */\n geometryFunction = function (coordinates, opt_geometry, projection) {\n const circle = opt_geometry\n ? /** @type {Circle} */ (opt_geometry)\n : new Circle([NaN, NaN]);\n const center = fromUserCoordinate(coordinates[0], projection);\n const squaredLength = squaredCoordinateDistance(\n center,\n fromUserCoordinate(coordinates[1], projection)\n );\n circle.setCenterAndRadius(center, Math.sqrt(squaredLength));\n const userProjection = getUserProjection();\n if (userProjection) {\n circle.transform(projection, userProjection);\n }\n return circle;\n };\n } else {\n let Constructor;\n const mode = this.mode_;\n if (mode === Mode.POINT) {\n Constructor = Point;\n } else if (mode === Mode.LINE_STRING) {\n Constructor = LineString;\n } else if (mode === Mode.POLYGON) {\n Constructor = Polygon;\n }\n /**\n * @param {!LineCoordType} coordinates The coordinates.\n * @param {import(\"../geom/SimpleGeometry.js\").default=} opt_geometry Optional geometry.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../geom/SimpleGeometry.js\").default} A geometry.\n */\n geometryFunction = function (coordinates, opt_geometry, projection) {\n let geometry = opt_geometry;\n if (geometry) {\n if (mode === Mode.POLYGON) {\n if (coordinates[0].length) {\n // Add a closing coordinate to match the first\n geometry.setCoordinates([\n coordinates[0].concat([coordinates[0][0]]),\n ]);\n } else {\n geometry.setCoordinates([]);\n }\n } else {\n geometry.setCoordinates(coordinates);\n }\n } else {\n geometry = new Constructor(coordinates);\n }\n return geometry;\n };\n }\n }\n\n /**\n * @type {GeometryFunction}\n * @private\n */\n this.geometryFunction_ = geometryFunction;\n\n /**\n * @type {number}\n * @private\n */\n this.dragVertexDelay_ =\n options.dragVertexDelay !== undefined ? options.dragVertexDelay : 500;\n\n /**\n * Finish coordinate for the feature (first point for polygons, last point for\n * linestrings).\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.finishCoordinate_ = null;\n\n /**\n * Sketch feature.\n * @type {Feature}\n * @private\n */\n this.sketchFeature_ = null;\n\n /**\n * Sketch point.\n * @type {Feature<Point>}\n * @private\n */\n this.sketchPoint_ = null;\n\n /**\n * Sketch coordinates. Used when drawing a line or polygon.\n * @type {SketchCoordType}\n * @private\n */\n this.sketchCoords_ = null;\n\n /**\n * Sketch line. Used when drawing polygon.\n * @type {Feature<LineString>}\n * @private\n */\n this.sketchLine_ = null;\n\n /**\n * Sketch line coordinates. Used when drawing a polygon or circle.\n * @type {LineCoordType}\n * @private\n */\n this.sketchLineCoords_ = null;\n\n /**\n * Squared tolerance for handling up events. If the squared distance\n * between a down and up event is greater than this tolerance, up events\n * will not be handled.\n * @type {number}\n * @private\n */\n this.squaredClickTolerance_ = options.clickTolerance\n ? options.clickTolerance * options.clickTolerance\n : 36;\n\n /**\n * Draw overlay where our sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: options.wrapX ? options.wrapX : false,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileInteracting: true,\n });\n\n /**\n * Name of the geometry attribute for newly created features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : noModifierKeys;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.freehandCondition_;\n if (options.freehand) {\n this.freehandCondition_ = always;\n } else {\n this.freehandCondition_ = options.freehandCondition\n ? options.freehandCondition\n : shiftKeyOnly;\n }\n\n this.addEventListener(\n getChangeEventType(InteractionProperty.ACTIVE),\n this.updateState_\n );\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n super.setMap(map);\n this.updateState_();\n }\n\n /**\n * Get the overlay layer that this interaction renders sketch features to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing.\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(event) {\n if (event.originalEvent.type === EventType.CONTEXTMENU) {\n // Avoid context menu for long taps when drawing on mobile\n event.preventDefault();\n }\n this.freehand_ =\n this.mode_ !== Mode.POINT && this.freehandCondition_(event);\n let move = event.type === MapBrowserEventType.POINTERMOVE;\n let pass = true;\n if (\n !this.freehand_ &&\n this.lastDragTime_ &&\n event.type === MapBrowserEventType.POINTERDRAG\n ) {\n const now = Date.now();\n if (now - this.lastDragTime_ >= this.dragVertexDelay_) {\n this.downPx_ = event.pixel;\n this.shouldHandle_ = !this.freehand_;\n move = true;\n } else {\n this.lastDragTime_ = undefined;\n }\n if (this.shouldHandle_ && this.downTimeout_ !== undefined) {\n clearTimeout(this.downTimeout_);\n this.downTimeout_ = undefined;\n }\n }\n if (\n this.freehand_ &&\n event.type === MapBrowserEventType.POINTERDRAG &&\n this.sketchFeature_ !== null\n ) {\n this.addToDrawing_(event.coordinate);\n pass = false;\n } else if (\n this.freehand_ &&\n event.type === MapBrowserEventType.POINTERDOWN\n ) {\n pass = false;\n } else if (move) {\n pass = event.type === MapBrowserEventType.POINTERMOVE;\n if (pass && this.freehand_) {\n this.handlePointerMove_(event);\n if (this.shouldHandle_) {\n // Avoid page scrolling when freehand drawing on mobile\n event.preventDefault();\n }\n } else if (\n event.originalEvent.pointerType == 'mouse' ||\n (event.type === MapBrowserEventType.POINTERDRAG &&\n this.downTimeout_ === undefined)\n ) {\n this.handlePointerMove_(event);\n }\n } else if (event.type === MapBrowserEventType.DBLCLICK) {\n pass = false;\n }\n\n return super.handleEvent(event) && pass;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(event) {\n this.shouldHandle_ = !this.freehand_;\n\n if (this.freehand_) {\n this.downPx_ = event.pixel;\n if (!this.finishCoordinate_) {\n this.startDrawing_(event);\n }\n return true;\n } else if (this.condition_(event)) {\n this.lastDragTime_ = Date.now();\n this.downTimeout_ = setTimeout(\n function () {\n this.handlePointerMove_(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n event.map,\n event.originalEvent,\n false,\n event.frameState\n )\n );\n }.bind(this),\n this.dragVertexDelay_\n );\n this.downPx_ = event.pixel;\n return true;\n } else {\n this.lastDragTime_ = undefined;\n return false;\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(event) {\n let pass = true;\n\n if (this.downTimeout_) {\n clearTimeout(this.downTimeout_);\n this.downTimeout_ = undefined;\n }\n\n this.handlePointerMove_(event);\n\n const circleMode = this.mode_ === Mode.CIRCLE;\n\n if (this.shouldHandle_) {\n if (!this.finishCoordinate_) {\n this.startDrawing_(event);\n if (this.mode_ === Mode.POINT) {\n this.finishDrawing();\n }\n } else if (this.freehand_ || circleMode) {\n this.finishDrawing();\n } else if (this.atFinish_(event)) {\n if (this.finishCondition_(event)) {\n this.finishDrawing();\n }\n } else {\n this.addToDrawing_(event.coordinate);\n }\n pass = false;\n } else if (this.freehand_) {\n this.abortDrawing();\n }\n if (!pass && this.stopClick_) {\n event.stopPropagation();\n }\n return pass;\n }\n\n /**\n * Handle move events.\n * @param {import(\"../MapBrowserEvent.js\").default} event A move event.\n * @private\n */\n handlePointerMove_(event) {\n if (\n this.downPx_ &&\n ((!this.freehand_ && this.shouldHandle_) ||\n (this.freehand_ && !this.shouldHandle_))\n ) {\n const downPx = this.downPx_;\n const clickPx = event.pixel;\n const dx = downPx[0] - clickPx[0];\n const dy = downPx[1] - clickPx[1];\n const squaredDistance = dx * dx + dy * dy;\n this.shouldHandle_ = this.freehand_\n ? squaredDistance > this.squaredClickTolerance_\n : squaredDistance <= this.squaredClickTolerance_;\n if (!this.shouldHandle_) {\n return;\n }\n }\n\n if (this.finishCoordinate_) {\n this.modifyDrawing_(event);\n } else {\n this.createOrUpdateSketchPoint_(event);\n }\n }\n\n /**\n * Determine if an event is within the snapping tolerance of the start coord.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} The event is within the snapping tolerance of the start.\n * @private\n */\n atFinish_(event) {\n let at = false;\n if (this.sketchFeature_) {\n let potentiallyDone = false;\n let potentiallyFinishCoordinates = [this.finishCoordinate_];\n if (this.mode_ === Mode.LINE_STRING) {\n potentiallyDone = this.sketchCoords_.length > this.minPoints_;\n } else if (this.mode_ === Mode.POLYGON) {\n const sketchCoords = /** @type {PolyCoordType} */ (this.sketchCoords_);\n potentiallyDone = sketchCoords[0].length > this.minPoints_;\n potentiallyFinishCoordinates = [\n sketchCoords[0][0],\n sketchCoords[0][sketchCoords[0].length - 2],\n ];\n }\n if (potentiallyDone) {\n const map = event.map;\n for (let i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) {\n const finishCoordinate = potentiallyFinishCoordinates[i];\n const finishPixel = map.getPixelFromCoordinate(finishCoordinate);\n const pixel = event.pixel;\n const dx = pixel[0] - finishPixel[0];\n const dy = pixel[1] - finishPixel[1];\n const snapTolerance = this.freehand_ ? 1 : this.snapTolerance_;\n at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance;\n if (at) {\n this.finishCoordinate_ = finishCoordinate;\n break;\n }\n }\n }\n }\n return at;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n createOrUpdateSketchPoint_(event) {\n const coordinates = event.coordinate.slice();\n if (!this.sketchPoint_) {\n this.sketchPoint_ = new Feature(new Point(coordinates));\n this.updateSketchFeatures_();\n } else {\n const sketchPointGeom = this.sketchPoint_.getGeometry();\n sketchPointGeom.setCoordinates(coordinates);\n }\n }\n\n /**\n * Start the drawing.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n startDrawing_(event) {\n const start = event.coordinate;\n const projection = event.map.getView().getProjection();\n this.finishCoordinate_ = start;\n if (this.mode_ === Mode.POINT) {\n this.sketchCoords_ = start.slice();\n } else if (this.mode_ === Mode.POLYGON) {\n this.sketchCoords_ = [[start.slice(), start.slice()]];\n this.sketchLineCoords_ = this.sketchCoords_[0];\n } else {\n this.sketchCoords_ = [start.slice(), start.slice()];\n }\n if (this.sketchLineCoords_) {\n this.sketchLine_ = new Feature(new LineString(this.sketchLineCoords_));\n }\n const geometry = this.geometryFunction_(\n this.sketchCoords_,\n undefined,\n projection\n );\n this.sketchFeature_ = new Feature();\n if (this.geometryName_) {\n this.sketchFeature_.setGeometryName(this.geometryName_);\n }\n this.sketchFeature_.setGeometry(geometry);\n this.updateSketchFeatures_();\n this.dispatchEvent(\n new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_)\n );\n }\n\n /**\n * Modify the drawing.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n modifyDrawing_(event) {\n let coordinate = event.coordinate;\n const geometry = this.sketchFeature_.getGeometry();\n const projection = event.map.getView().getProjection();\n let coordinates, last;\n if (this.mode_ === Mode.POINT) {\n last = this.sketchCoords_;\n } else if (this.mode_ === Mode.POLYGON) {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n last = coordinates[coordinates.length - 1];\n if (this.atFinish_(event)) {\n // snap to finish\n coordinate = this.finishCoordinate_.slice();\n }\n } else {\n coordinates = this.sketchCoords_;\n last = coordinates[coordinates.length - 1];\n }\n last[0] = coordinate[0];\n last[1] = coordinate[1];\n this.geometryFunction_(\n /** @type {!LineCoordType} */ (this.sketchCoords_),\n geometry,\n projection\n );\n if (this.sketchPoint_) {\n const sketchPointGeom = this.sketchPoint_.getGeometry();\n sketchPointGeom.setCoordinates(coordinate);\n }\n /** @type {LineString} */\n let sketchLineGeom;\n if (\n geometry.getType() == GeometryType.POLYGON &&\n this.mode_ !== Mode.POLYGON\n ) {\n if (!this.sketchLine_) {\n this.sketchLine_ = new Feature();\n }\n const ring = geometry.getLinearRing(0);\n sketchLineGeom = this.sketchLine_.getGeometry();\n if (!sketchLineGeom) {\n sketchLineGeom = new LineString(\n ring.getFlatCoordinates(),\n ring.getLayout()\n );\n this.sketchLine_.setGeometry(sketchLineGeom);\n } else {\n sketchLineGeom.setFlatCoordinates(\n ring.getLayout(),\n ring.getFlatCoordinates()\n );\n sketchLineGeom.changed();\n }\n } else if (this.sketchLineCoords_) {\n sketchLineGeom = this.sketchLine_.getGeometry();\n sketchLineGeom.setCoordinates(this.sketchLineCoords_);\n }\n this.updateSketchFeatures_();\n }\n\n /**\n * Add a new coordinate to the drawing.\n * @param {!PointCoordType} coordinate Coordinate\n * @private\n */\n addToDrawing_(coordinate) {\n const geometry = this.sketchFeature_.getGeometry();\n const projection = this.getMap().getView().getProjection();\n let done;\n let coordinates;\n if (this.mode_ === Mode.LINE_STRING) {\n this.finishCoordinate_ = coordinate.slice();\n coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);\n if (coordinates.length >= this.maxPoints_) {\n if (this.freehand_) {\n coordinates.pop();\n } else {\n done = true;\n }\n }\n coordinates.push(coordinate.slice());\n this.geometryFunction_(coordinates, geometry, projection);\n } else if (this.mode_ === Mode.POLYGON) {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n if (coordinates.length >= this.maxPoints_) {\n if (this.freehand_) {\n coordinates.pop();\n } else {\n done = true;\n }\n }\n coordinates.push(coordinate.slice());\n if (done) {\n this.finishCoordinate_ = coordinates[0];\n }\n this.geometryFunction_(this.sketchCoords_, geometry, projection);\n }\n this.updateSketchFeatures_();\n if (done) {\n this.finishDrawing();\n }\n }\n\n /**\n * Remove last point of the feature currently being drawn.\n * @api\n */\n removeLastPoint() {\n if (!this.sketchFeature_) {\n return;\n }\n const geometry = this.sketchFeature_.getGeometry();\n const projection = this.getMap().getView().getProjection();\n let coordinates;\n /** @type {LineString} */\n let sketchLineGeom;\n if (this.mode_ === Mode.LINE_STRING) {\n coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);\n coordinates.splice(-2, 1);\n this.geometryFunction_(coordinates, geometry, projection);\n if (coordinates.length >= 2) {\n this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();\n }\n } else if (this.mode_ === Mode.POLYGON) {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n coordinates.splice(-2, 1);\n sketchLineGeom = this.sketchLine_.getGeometry();\n sketchLineGeom.setCoordinates(coordinates);\n this.geometryFunction_(this.sketchCoords_, geometry, projection);\n }\n\n if (coordinates.length === 0) {\n this.abortDrawing();\n }\n\n this.updateSketchFeatures_();\n }\n\n /**\n * Stop drawing and add the sketch feature to the target layer.\n * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is\n * dispatched before inserting the feature.\n * @api\n */\n finishDrawing() {\n const sketchFeature = this.abortDrawing_();\n if (!sketchFeature) {\n return;\n }\n let coordinates = this.sketchCoords_;\n const geometry = sketchFeature.getGeometry();\n const projection = this.getMap().getView().getProjection();\n if (this.mode_ === Mode.LINE_STRING) {\n // remove the redundant last point\n coordinates.pop();\n this.geometryFunction_(coordinates, geometry, projection);\n } else if (this.mode_ === Mode.POLYGON) {\n // remove the redundant last point in ring\n /** @type {PolyCoordType} */ (coordinates)[0].pop();\n this.geometryFunction_(coordinates, geometry, projection);\n coordinates = geometry.getCoordinates();\n }\n\n // cast multi-part geometries\n if (this.type_ === GeometryType.MULTI_POINT) {\n sketchFeature.setGeometry(\n new MultiPoint([/** @type {PointCoordType} */ (coordinates)])\n );\n } else if (this.type_ === GeometryType.MULTI_LINE_STRING) {\n sketchFeature.setGeometry(\n new MultiLineString([/** @type {LineCoordType} */ (coordinates)])\n );\n } else if (this.type_ === GeometryType.MULTI_POLYGON) {\n sketchFeature.setGeometry(\n new MultiPolygon([/** @type {PolyCoordType} */ (coordinates)])\n );\n }\n\n // First dispatch event to allow full set up of feature\n this.dispatchEvent(new DrawEvent(DrawEventType.DRAWEND, sketchFeature));\n\n // Then insert feature\n if (this.features_) {\n this.features_.push(sketchFeature);\n }\n if (this.source_) {\n this.source_.addFeature(sketchFeature);\n }\n }\n\n /**\n * Stop drawing without adding the sketch feature to the target layer.\n * @return {Feature} The sketch feature (or null if none).\n * @private\n */\n abortDrawing_() {\n this.finishCoordinate_ = null;\n const sketchFeature = this.sketchFeature_;\n this.sketchFeature_ = null;\n this.sketchPoint_ = null;\n this.sketchLine_ = null;\n this.overlay_.getSource().clear(true);\n return sketchFeature;\n }\n\n /**\n * Stop drawing without adding the sketch feature to the target layer.\n * @api\n */\n abortDrawing() {\n const sketchFeature = this.abortDrawing_();\n if (sketchFeature) {\n this.dispatchEvent(new DrawEvent(DrawEventType.DRAWABORT, sketchFeature));\n }\n }\n\n /**\n * Append coordinates to the end of the geometry that is currently being drawn.\n * This can be used when drawing LineStrings or Polygons. Coordinates will\n * either be appended to the current LineString or the outer ring of the current\n * Polygon.\n * @param {!LineCoordType} coordinates Linear coordinates to be appended into\n * the coordinate array.\n * @api\n */\n appendCoordinates(coordinates) {\n const mode = this.mode_;\n let sketchCoords = [];\n if (mode === Mode.LINE_STRING) {\n sketchCoords = /** @type {LineCoordType} */ this.sketchCoords_;\n } else if (mode === Mode.POLYGON) {\n sketchCoords =\n this.sketchCoords_ && this.sketchCoords_.length\n ? /** @type {PolyCoordType} */ (this.sketchCoords_)[0]\n : [];\n }\n\n // Remove last coordinate from sketch drawing (this coordinate follows cursor position)\n const ending = sketchCoords.pop();\n\n // Append coordinate list\n for (let i = 0; i < coordinates.length; i++) {\n this.addToDrawing_(coordinates[i]);\n }\n\n // Duplicate last coordinate for sketch drawing\n this.addToDrawing_(ending);\n }\n\n /**\n * Initiate draw mode by starting from an existing geometry which will\n * receive new additional points. This only works on features with\n * `LineString` geometries, where the interaction will extend lines by adding\n * points to the end of the coordinates array.\n * This will change the original feature, instead of drawing a copy.\n *\n * The function will dispatch a `drawstart` event.\n *\n * @param {!Feature<LineString>} feature Feature to be extended.\n * @api\n */\n extend(feature) {\n const geometry = feature.getGeometry();\n const lineString = geometry;\n this.sketchFeature_ = feature;\n this.sketchCoords_ = lineString.getCoordinates();\n const last = this.sketchCoords_[this.sketchCoords_.length - 1];\n this.finishCoordinate_ = last.slice();\n this.sketchCoords_.push(last.slice());\n this.updateSketchFeatures_();\n this.dispatchEvent(\n new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_)\n );\n }\n\n /**\n * Redraw the sketch features.\n * @private\n */\n updateSketchFeatures_() {\n const sketchFeatures = [];\n if (this.sketchFeature_) {\n sketchFeatures.push(this.sketchFeature_);\n }\n if (this.sketchLine_) {\n sketchFeatures.push(this.sketchLine_);\n }\n if (this.sketchPoint_) {\n sketchFeatures.push(this.sketchPoint_);\n }\n const overlaySource = this.overlay_.getSource();\n overlaySource.clear(true);\n overlaySource.addFeatures(sketchFeatures);\n }\n\n /**\n * @private\n */\n updateState_() {\n const map = this.getMap();\n const active = this.getActive();\n if (!map || !active) {\n this.abortDrawing();\n }\n this.overlay_.setMap(active ? map : null);\n }\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const styles = createEditingStyle();\n return function (feature, resolution) {\n return styles[feature.getGeometry().getType()];\n };\n}\n\n/**\n * Create a `geometryFunction` for `type: 'Circle'` that will create a regular\n * polygon with a user specified number of sides and start angle instead of an\n * `import(\"../geom/Circle.js\").Circle` geometry.\n * @param {number=} opt_sides Number of sides of the regular polygon. Default is\n * 32.\n * @param {number=} opt_angle Angle of the first point in radians. 0 means East.\n * Default is the angle defined by the heading from the center of the\n * regular polygon to the current pointer position.\n * @return {GeometryFunction} Function that draws a\n * polygon.\n * @api\n */\nexport function createRegularPolygon(opt_sides, opt_angle) {\n return function (coordinates, opt_geometry, projection) {\n const center = fromUserCoordinate(\n /** @type {LineCoordType} */ (coordinates)[0],\n projection\n );\n const end = fromUserCoordinate(\n /** @type {LineCoordType} */ (coordinates)[1],\n projection\n );\n const radius = Math.sqrt(squaredCoordinateDistance(center, end));\n const geometry = opt_geometry\n ? /** @type {Polygon} */ (opt_geometry)\n : fromCircle(new Circle(center), opt_sides);\n let angle = opt_angle;\n if (!opt_angle) {\n const x = end[0] - center[0];\n const y = end[1] - center[1];\n angle = Math.atan(y / x) - (x < 0 ? Math.PI : 0);\n }\n makeRegular(geometry, center, radius, angle);\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry.transform(projection, userProjection);\n }\n return geometry;\n };\n}\n\n/**\n * Create a `geometryFunction` that will create a box-shaped polygon (aligned\n * with the coordinate system axes). Use this with the draw interaction and\n * `type: 'Circle'` to return a box instead of a circle geometry.\n * @return {GeometryFunction} Function that draws a box-shaped polygon.\n * @api\n */\nexport function createBox() {\n return function (coordinates, opt_geometry, projection) {\n const extent = boundingExtent(\n /** @type {LineCoordType} */ (coordinates).map(function (coordinate) {\n return fromUserCoordinate(coordinate, projection);\n })\n );\n const boxCoordinates = [\n [\n getBottomLeft(extent),\n getBottomRight(extent),\n getTopRight(extent),\n getTopLeft(extent),\n getBottomLeft(extent),\n ],\n ];\n let geometry = opt_geometry;\n if (geometry) {\n geometry.setCoordinates(boxCoordinates);\n } else {\n geometry = new Polygon(boxCoordinates);\n }\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry.transform(projection, userProjection);\n }\n return geometry;\n };\n}\n\n/**\n * Get the drawing mode. The mode for mult-part geometries is the same as for\n * their single-part cousins.\n * @param {import(\"../geom/GeometryType.js\").default} type Geometry type.\n * @return {Mode} Drawing mode.\n */\nfunction getMode(type) {\n let mode;\n if (type === GeometryType.POINT || type === GeometryType.MULTI_POINT) {\n mode = Mode.POINT;\n } else if (\n type === GeometryType.LINE_STRING ||\n type === GeometryType.MULTI_LINE_STRING\n ) {\n mode = Mode.LINE_STRING;\n } else if (\n type === GeometryType.POLYGON ||\n type === GeometryType.MULTI_POLYGON\n ) {\n mode = Mode.POLYGON;\n } else if (type === GeometryType.CIRCLE) {\n mode = Mode.CIRCLE;\n }\n return /** @type {!Mode} */ (mode);\n}\n\nexport default Draw;\n","/**\n * @module ol/interaction/Extent\n */\nimport Event from '../events/Event.js';\nimport Feature from '../Feature.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Point from '../geom/Point.js';\nimport PointerInteraction from './Pointer.js';\nimport VectorLayer from '../layer/Vector.js';\nimport VectorSource from '../source/Vector.js';\nimport {always} from '../events/condition.js';\nimport {boundingExtent, getArea} from '../extent.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport {toUserExtent} from '../proj.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition~always}.\n * @property {import(\"../extent.js\").Extent} [extent] Initial extent. Defaults to no\n * initial extent.\n * @property {import(\"../style/Style.js\").StyleLike} [boxStyle]\n * Style for the drawn extent box. Defaults to\n * {@link module:ol/style/Style~createEditing()['Polygon']}\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike} [pointerStyle]\n * Style for the cursor used to draw the extent. Defaults to\n * {@link module:ol/style/Style~createEditing()['Point']}\n * @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps\n * in the X direction? Only affects visuals, not functionality.\n */\n\n/**\n * @enum {string}\n */\nconst ExtentEventType = {\n /**\n * Triggered after the extent is changed\n * @event ExtentEvent#extentchanged\n * @api\n */\n EXTENTCHANGED: 'extentchanged',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Extent~Extent} instances are\n * instances of this type.\n */\nclass ExtentEvent extends Event {\n /**\n * @param {import(\"../extent.js\").Extent} extent the new extent\n */\n constructor(extent) {\n super(ExtentEventType.EXTENTCHANGED);\n\n /**\n * The current extent.\n * @type {import(\"../extent.js\").Extent}\n * @api\n */\n this.extent = extent;\n }\n}\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map.\n * Once drawn, the vector box can be modified by dragging its vertices or edges.\n * This interaction is only supported for mouse devices.\n *\n * @fires ExtentEvent\n * @api\n */\nclass Extent extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /**\n * Condition\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.condition_ = options.condition ? options.condition : always;\n\n /**\n * Extent of the drawn box\n * @type {import(\"../extent.js\").Extent}\n * @private\n */\n this.extent_ = null;\n\n /**\n * Handler for pointer move events\n * @type {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent|null}\n * @private\n */\n this.pointerHandler_ = null;\n\n /**\n * Pixel threshold to snap to extent\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * Is the pointer snapped to an extent vertex\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Feature for displaying the visible extent\n * @type {Feature}\n * @private\n */\n this.extentFeature_ = null;\n\n /**\n * Feature for displaying the visible pointer\n * @type {Feature<Point>}\n * @private\n */\n this.vertexFeature_ = null;\n\n if (!opt_options) {\n opt_options = {};\n }\n\n /**\n * Layer for the extentFeature\n * @type {VectorLayer}\n * @private\n */\n this.extentOverlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!opt_options.wrapX,\n }),\n style: opt_options.boxStyle\n ? opt_options.boxStyle\n : getDefaultExtentStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * Layer for the vertexFeature\n * @type {VectorLayer}\n * @private\n */\n this.vertexOverlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!opt_options.wrapX,\n }),\n style: opt_options.pointerStyle\n ? opt_options.pointerStyle\n : getDefaultPointerStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n if (opt_options.extent) {\n this.setExtent(opt_options.extent);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel cursor location\n * @param {import(\"../PluggableMap.js\").default} map map\n * @returns {import(\"../coordinate.js\").Coordinate|null} snapped vertex on extent\n * @private\n */\n snapToVertex_(pixel, map) {\n const pixelCoordinate = map.getCoordinateFromPixelInternal(pixel);\n const sortByDistance = function (a, b) {\n return (\n squaredDistanceToSegment(pixelCoordinate, a) -\n squaredDistanceToSegment(pixelCoordinate, b)\n );\n };\n const extent = this.getExtentInternal();\n if (extent) {\n //convert extents to line segments and find the segment closest to pixelCoordinate\n const segments = getSegments(extent);\n segments.sort(sortByDistance);\n const closestSegment = segments[0];\n\n let vertex = closestOnSegment(pixelCoordinate, closestSegment);\n const vertexPixel = map.getPixelFromCoordinateInternal(vertex);\n\n //if the distance is within tolerance, snap to the segment\n if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {\n //test if we should further snap to a vertex\n const pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];\n }\n return vertex;\n }\n }\n return null;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent pointer move event\n * @private\n */\n handlePointerMove_(mapBrowserEvent) {\n const pixel = mapBrowserEvent.pixel;\n const map = mapBrowserEvent.map;\n\n let vertex = this.snapToVertex_(pixel, map);\n if (!vertex) {\n vertex = map.getCoordinateFromPixelInternal(pixel);\n }\n this.createOrUpdatePointerFeature_(vertex);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent extent\n * @returns {Feature} extent as featrue\n * @private\n */\n createOrUpdateExtentFeature_(extent) {\n let extentFeature = this.extentFeature_;\n\n if (!extentFeature) {\n if (!extent) {\n extentFeature = new Feature({});\n } else {\n extentFeature = new Feature(polygonFromExtent(extent));\n }\n this.extentFeature_ = extentFeature;\n this.extentOverlay_.getSource().addFeature(extentFeature);\n } else {\n if (!extent) {\n extentFeature.setGeometry(undefined);\n } else {\n extentFeature.setGeometry(polygonFromExtent(extent));\n }\n }\n return extentFeature;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} vertex location of feature\n * @returns {Feature} vertex as feature\n * @private\n */\n createOrUpdatePointerFeature_(vertex) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(vertex));\n this.vertexFeature_ = vertexFeature;\n this.vertexOverlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(vertex);\n }\n return vertexFeature;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent || !this.condition_(mapBrowserEvent)) {\n return true;\n }\n //display pointer (if not dragging)\n if (\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n //call pointer to determine up/down/drag\n super.handleEvent(mapBrowserEvent);\n //return false to stop propagation\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n const pixel = mapBrowserEvent.pixel;\n const map = mapBrowserEvent.map;\n\n const extent = this.getExtentInternal();\n let vertex = this.snapToVertex_(pixel, map);\n\n //find the extent corner opposite the passed corner\n const getOpposingPoint = function (point) {\n let x_ = null;\n let y_ = null;\n if (point[0] == extent[0]) {\n x_ = extent[2];\n } else if (point[0] == extent[2]) {\n x_ = extent[0];\n }\n if (point[1] == extent[1]) {\n y_ = extent[3];\n } else if (point[1] == extent[3]) {\n y_ = extent[1];\n }\n if (x_ !== null && y_ !== null) {\n return [x_, y_];\n }\n return null;\n };\n if (vertex && extent) {\n const x =\n vertex[0] == extent[0] || vertex[0] == extent[2] ? vertex[0] : null;\n const y =\n vertex[1] == extent[1] || vertex[1] == extent[3] ? vertex[1] : null;\n\n //snap to point\n if (x !== null && y !== null) {\n this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex));\n //snap to edge\n } else if (x !== null) {\n this.pointerHandler_ = getEdgeHandler(\n getOpposingPoint([x, extent[1]]),\n getOpposingPoint([x, extent[3]])\n );\n } else if (y !== null) {\n this.pointerHandler_ = getEdgeHandler(\n getOpposingPoint([extent[0], y]),\n getOpposingPoint([extent[2], y])\n );\n }\n //no snap - new bbox\n } else {\n vertex = map.getCoordinateFromPixelInternal(pixel);\n this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]);\n this.pointerHandler_ = getPointHandler(vertex);\n }\n return true; //event handled; start downup sequence\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n if (this.pointerHandler_) {\n const pixelCoordinate = mapBrowserEvent.coordinate;\n this.setExtent(this.pointerHandler_(pixelCoordinate));\n this.createOrUpdatePointerFeature_(pixelCoordinate);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n this.pointerHandler_ = null;\n //If bbox is zero area, set to null;\n const extent = this.getExtentInternal();\n if (!extent || getArea(extent) === 0) {\n this.setExtent(null);\n }\n return false; //Stop handling downup sequence\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n this.extentOverlay_.setMap(map);\n this.vertexOverlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Returns the current drawn extent in the view projection (or user projection if set)\n *\n * @return {import(\"../extent.js\").Extent} Drawn extent in the view projection.\n * @api\n */\n getExtent() {\n return toUserExtent(\n this.getExtentInternal(),\n this.getMap().getView().getProjection()\n );\n }\n\n /**\n * Returns the current drawn extent in the view projection\n *\n * @return {import(\"../extent.js\").Extent} Drawn extent in the view projection.\n * @api\n */\n getExtentInternal() {\n return this.extent_;\n }\n\n /**\n * Manually sets the drawn extent, using the view projection.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent\n * @api\n */\n setExtent(extent) {\n //Null extent means no bbox\n this.extent_ = extent ? extent : null;\n this.createOrUpdateExtentFeature_(extent);\n this.dispatchEvent(new ExtentEvent(this.extent_));\n }\n}\n\n/**\n * Returns the default style for the drawn bbox\n *\n * @return {import(\"../style/Style.js\").StyleFunction} Default Extent style\n */\nfunction getDefaultExtentStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style[GeometryType.POLYGON];\n };\n}\n\n/**\n * Returns the default style for the pointer\n *\n * @return {import(\"../style/Style.js\").StyleFunction} Default pointer style\n */\nfunction getDefaultPointerStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style[GeometryType.POINT];\n };\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} fixedPoint corner that will be unchanged in the new extent\n * @returns {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent} event handler\n */\nfunction getPointHandler(fixedPoint) {\n return function (point) {\n return boundingExtent([fixedPoint, point]);\n };\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} fixedP1 first corner that will be unchanged in the new extent\n * @param {import(\"../coordinate.js\").Coordinate} fixedP2 second corner that will be unchanged in the new extent\n * @returns {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent|null} event handler\n */\nfunction getEdgeHandler(fixedP1, fixedP2) {\n if (fixedP1[0] == fixedP2[0]) {\n return function (point) {\n return boundingExtent([fixedP1, [point[0], fixedP2[1]]]);\n };\n } else if (fixedP1[1] == fixedP2[1]) {\n return function (point) {\n return boundingExtent([fixedP1, [fixedP2[0], point[1]]]);\n };\n } else {\n return null;\n }\n}\n\n/**\n * @param {import(\"../extent.js\").Extent} extent extent\n * @returns {Array<Array<import(\"../coordinate.js\").Coordinate>>} extent line segments\n */\nfunction getSegments(extent) {\n return [\n [\n [extent[0], extent[1]],\n [extent[0], extent[3]],\n ],\n [\n [extent[0], extent[3]],\n [extent[2], extent[3]],\n ],\n [\n [extent[2], extent[3]],\n [extent[2], extent[1]],\n ],\n [\n [extent[2], extent[1]],\n [extent[0], extent[1]],\n ],\n ];\n}\n\nexport default Extent;\n","/**\n * @module ol/interaction/Modify\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport Feature from '../Feature.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Point from '../geom/Point.js';\nimport PointerInteraction from './Pointer.js';\nimport RBush from '../structs/RBush.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport VectorLayer from '../layer/Vector.js';\nimport VectorSource from '../source/Vector.js';\nimport {\n altKeyOnly,\n always,\n primaryAction,\n singleClick,\n} from '../events/condition.js';\nimport {\n boundingExtent,\n buffer as bufferExtent,\n createOrUpdateFromCoordinate as createExtent,\n} from '../extent.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n equals as coordinatesEqual,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {equals} from '../array.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport {\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport {getUid} from '../util.js';\n\n/**\n * The segment index assigned to a circle's center when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CENTER_INDEX = 0;\n\n/**\n * The segment index assigned to a circle's circumference when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CIRCUMFERENCE_INDEX = 1;\n\nconst tempExtent = [0, 0, 0, 0];\nconst tempSegment = [];\n\n/**\n * @enum {string}\n */\nconst ModifyEventType = {\n /**\n * Triggered upon feature modification start\n * @event ModifyEvent#modifystart\n * @api\n */\n MODIFYSTART: 'modifystart',\n /**\n * Triggered upon feature modification end\n * @event ModifyEvent#modifyend\n * @api\n */\n MODIFYEND: 'modifyend',\n};\n\n/**\n * @typedef {Object} SegmentData\n * @property {Array<number>} [depth]\n * @property {Feature} feature\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry\n * @property {number} [index]\n * @property {Array<import(\"../extent.js\").Extent>} segment\n * @property {Array<SegmentData>} [featureSegments]\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event will be considered to add or move a\n * vertex to the sketch. Default is\n * {@link module:ol/events/condition~primaryAction}.\n * @property {import(\"../events/condition.js\").Condition} [deleteCondition] A function\n * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. By default,\n * {@link module:ol/events/condition~singleClick} with\n * {@link module:ol/events/condition~altKeyOnly} results in a vertex deletion.\n * @property {import(\"../events/condition.js\").Condition} [insertVertexCondition] A\n * function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether a new vertex should be added to the sketch\n * features. Default is {@link module:ol/events/condition~always}.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike} [style]\n * Style used for the features being modified. By default the default edit\n * style is used (see {@link module:ol/style}).\n * @property {VectorSource} [source] The vector source with\n * features to modify. If a vector source is not provided, a feature collection\n * must be provided with the features option.\n * @property {Collection<Feature>} [features]\n * The features the interaction works on. If a feature collection is not\n * provided, a vector source must be provided with the source option.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Modify~Modify} instances are\n * instances of this type.\n */\nexport class ModifyEvent extends Event {\n /**\n * @param {ModifyEventType} type Type.\n * @param {Collection<Feature>} features\n * The features modified.\n * @param {import(\"../MapBrowserEvent.js\").default} MapBrowserEvent\n * Associated {@link module:ol/MapBrowserEvent}.\n */\n constructor(type, features, MapBrowserEvent) {\n super(type);\n\n /**\n * The features being modified.\n * @type {Collection<Feature>}\n * @api\n */\n this.features = features;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = MapBrowserEvent;\n }\n}\n\n/**\n * @classdesc\n * Interaction for modifying feature geometries. To modify features that have\n * been added to an existing source, construct the modify interaction with the\n * `source` option. If you want to modify features in a collection (for example,\n * the collection used by a select interaction), construct the interaction with\n * the `features` option. The interaction must be constructed with either a\n * `source` or `features` option.\n *\n * By default, the interaction will allow deletion of vertices when the `alt`\n * key is pressed. To configure the interaction with a different condition\n * for deletion, use the `deleteCondition` option.\n * @fires ModifyEvent\n * @api\n */\nclass Modify extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /** @private */\n this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : primaryAction;\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultDeleteCondition_ = function (mapBrowserEvent) {\n return altKeyOnly(mapBrowserEvent) && singleClick(mapBrowserEvent);\n };\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.deleteCondition_ = options.deleteCondition\n ? options.deleteCondition\n : this.defaultDeleteCondition_;\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.insertVertexCondition_ = options.insertVertexCondition\n ? options.insertVertexCondition\n : always;\n\n /**\n * Editing vertex.\n * @type {Feature}\n * @private\n */\n this.vertexFeature_ = null;\n\n /**\n * Segments intersecting {@link this.vertexFeature_} by segment uid.\n * @type {Object<string, boolean>}\n * @private\n */\n this.vertexSegments_ = null;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.lastPixel_ = [0, 0];\n\n /**\n * Tracks if the next `singleclick` event should be ignored to prevent\n * accidental deletion right after vertex creation.\n * @type {boolean}\n * @private\n */\n this.ignoreNextSingleClick_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.modified_ = false;\n\n /**\n * Segment RTree for each layer\n * @type {RBush<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Indicate whether the interaction is currently changing a feature's\n * coordinates.\n * @type {boolean}\n * @private\n */\n this.changingFeature_ = false;\n\n /**\n * @type {Array}\n * @private\n */\n this.dragSegments_ = [];\n\n /**\n * Draw overlay where sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * @const\n * @private\n * @type {!Object<string, function(Feature, import(\"../geom/Geometry.js\").default): void>}\n */\n this.SEGMENT_WRITERS_ = {\n 'Point': this.writePointGeometry_.bind(this),\n 'LineString': this.writeLineStringGeometry_.bind(this),\n 'LinearRing': this.writeLineStringGeometry_.bind(this),\n 'Polygon': this.writePolygonGeometry_.bind(this),\n 'MultiPoint': this.writeMultiPointGeometry_.bind(this),\n 'MultiLineString': this.writeMultiLineStringGeometry_.bind(this),\n 'MultiPolygon': this.writeMultiPolygonGeometry_.bind(this),\n 'Circle': this.writeCircleGeometry_.bind(this),\n 'GeometryCollection': this.writeGeometryCollectionGeometry_.bind(this),\n };\n\n /**\n * @type {VectorSource}\n * @private\n */\n this.source_ = null;\n\n let features;\n if (options.source) {\n this.source_ = options.source;\n features = new Collection(this.source_.getFeatures());\n this.source_.addEventListener(\n VectorEventType.ADDFEATURE,\n this.handleSourceAdd_.bind(this)\n );\n this.source_.addEventListener(\n VectorEventType.REMOVEFEATURE,\n this.handleSourceRemove_.bind(this)\n );\n } else {\n features = options.features;\n }\n if (!features) {\n throw new Error('The modify interaction requires features or a source');\n }\n\n /**\n * @type {Collection<Feature>}\n * @private\n */\n this.features_ = features;\n\n this.features_.forEach(this.addFeature_.bind(this));\n this.features_.addEventListener(\n CollectionEventType.ADD,\n this.handleFeatureAdd_.bind(this)\n );\n this.features_.addEventListener(\n CollectionEventType.REMOVE,\n this.handleFeatureRemove_.bind(this)\n );\n\n /**\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @private\n */\n this.lastPointerEvent_ = null;\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n addFeature_(feature) {\n const geometry = feature.getGeometry();\n if (geometry) {\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n if (writer) {\n writer(feature, geometry);\n }\n }\n const map = this.getMap();\n if (map && map.isRendered() && this.getActive()) {\n this.handlePointerAtPixel_(this.lastPixel_, map);\n }\n feature.addEventListener(EventType.CHANGE, this.boundHandleFeatureChange_);\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event\n * @private\n */\n willModifyFeatures_(evt) {\n if (!this.modified_) {\n this.modified_ = true;\n this.dispatchEvent(\n new ModifyEvent(ModifyEventType.MODIFYSTART, this.features_, evt)\n );\n }\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeature_(feature) {\n this.removeFeatureSegmentData_(feature);\n // Remove the vertex feature if the collection of canditate features is empty.\n if (this.vertexFeature_ && this.features_.getLength() === 0) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n feature.removeEventListener(\n EventType.CHANGE,\n this.boundHandleFeatureChange_\n );\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeatureSegmentData_(feature) {\n const rBush = this.rBush_;\n /** @type {Array<SegmentData>} */\n const nodesToRemove = [];\n rBush.forEach(\n /**\n * @param {SegmentData} node RTree node.\n */\n function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n }\n );\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n const nodeToRemove = nodesToRemove[i];\n for (let j = this.dragSegments_.length - 1; j >= 0; --j) {\n if (this.dragSegments_[j][0] === nodeToRemove) {\n this.dragSegments_.splice(j, 1);\n }\n }\n rBush.remove(nodeToRemove);\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n if (this.vertexFeature_ && !active) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n this.overlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Get the overlay layer that this interaction renders sketch features to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceAdd_(event) {\n if (event.feature) {\n this.features_.push(event.feature);\n }\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceRemove_(event) {\n if (event.feature) {\n this.features_.remove(event.feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} evt Event.\n * @private\n */\n handleFeatureAdd_(evt) {\n this.addFeature_(/** @type {Feature} */ (evt.element));\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n if (!this.changingFeature_) {\n const feature = /** @type {Feature} */ (evt.target);\n this.removeFeature_(feature);\n this.addFeature_(feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} evt Event.\n * @private\n */\n handleFeatureRemove_(evt) {\n const feature = /** @type {Feature} */ (evt.element);\n this.removeFeature_(feature);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {Point} geometry Geometry.\n * @private\n */\n writePointGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPointGeometry_(feature, geometry) {\n const points = geometry.getCoordinates();\n for (let i = 0, ii = points.length; i < ii; ++i) {\n const coordinates = points[i];\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [i],\n index: i,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @private\n */\n writeLineStringGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @private\n */\n writeMultiLineStringGeometry_(feature, geometry) {\n const lines = geometry.getCoordinates();\n for (let j = 0, jj = lines.length; j < jj; ++j) {\n const coordinates = lines[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @private\n */\n writePolygonGeometry_(feature, geometry) {\n const rings = geometry.getCoordinates();\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPolygonGeometry_(feature, geometry) {\n const polygons = geometry.getCoordinates();\n for (let k = 0, kk = polygons.length; k < kk; ++k) {\n const rings = polygons[k];\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j, k],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n }\n\n /**\n * We convert a circle into two segments. The segment at index\n * {@link CIRCLE_CENTER_INDEX} is the\n * circle's center (a point). The segment at index\n * {@link CIRCLE_CIRCUMFERENCE_INDEX} is\n * the circumference, and is not a line segment.\n *\n * @param {Feature} feature Feature.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @private\n */\n writeCircleGeometry_(feature, geometry) {\n const coordinates = geometry.getCenter();\n\n /** @type {SegmentData} */\n const centerSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CENTER_INDEX,\n segment: [coordinates, coordinates],\n };\n\n /** @type {SegmentData} */\n const circumferenceSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CIRCUMFERENCE_INDEX,\n segment: [coordinates, coordinates],\n };\n\n const featureSegments = [centerSegmentData, circumferenceSegmentData];\n centerSegmentData.featureSegments = featureSegments;\n circumferenceSegmentData.featureSegments = featureSegments;\n this.rBush_.insert(createExtent(coordinates), centerSegmentData);\n let circleGeometry = /** @type {import(\"../geom/Geometry.js\").default} */ (geometry);\n const userProjection = getUserProjection();\n if (userProjection && this.getMap()) {\n const projection = this.getMap().getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry)\n ).transform(projection, userProjection);\n }\n this.rBush_.insert(circleGeometry.getExtent(), circumferenceSegmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @private\n */\n writeGeometryCollectionGeometry_(feature, geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const geometry = geometries[i];\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n writer(feature, geometry);\n }\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @return {Feature} Vertex feature.\n * @private\n */\n createOrUpdateVertexFeature_(coordinates) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(coordinates));\n this.vertexFeature_ = vertexFeature;\n this.overlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(coordinates);\n }\n return vertexFeature;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n this.lastPointerEvent_ = mapBrowserEvent;\n\n let handled;\n if (\n !mapBrowserEvent.map.getView().getInteracting() &&\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {\n if (\n mapBrowserEvent.type != MapBrowserEventType.SINGLECLICK ||\n !this.ignoreNextSingleClick_\n ) {\n handled = this.removePoint();\n } else {\n handled = true;\n }\n }\n\n if (mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK) {\n this.ignoreNextSingleClick_ = false;\n }\n\n return super.handleEvent(mapBrowserEvent) && !handled;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n */\n handleDragEvent(evt) {\n this.ignoreNextSingleClick_ = false;\n this.willModifyFeatures_(evt);\n\n const vertex = evt.coordinate;\n for (let i = 0, ii = this.dragSegments_.length; i < ii; ++i) {\n const dragSegment = this.dragSegments_[i];\n const segmentData = dragSegment[0];\n const depth = segmentData.depth;\n const geometry = segmentData.geometry;\n let coordinates;\n const segment = segmentData.segment;\n const index = dragSegment[1];\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(segment[index][vertex.length]);\n }\n\n switch (geometry.getType()) {\n case GeometryType.POINT:\n coordinates = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case GeometryType.MULTI_POINT:\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index] = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case GeometryType.LINE_STRING:\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case GeometryType.MULTI_LINE_STRING:\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case GeometryType.POLYGON:\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case GeometryType.MULTI_POLYGON:\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case GeometryType.CIRCLE:\n segment[0] = vertex;\n segment[1] = vertex;\n if (segmentData.index === CIRCLE_CENTER_INDEX) {\n this.changingFeature_ = true;\n geometry.setCenter(vertex);\n this.changingFeature_ = false;\n } else {\n // We're dragging the circle's circumference:\n this.changingFeature_ = true;\n const projection = evt.map.getView().getProjection();\n let radius = coordinateDistance(\n fromUserCoordinate(geometry.getCenter(), projection),\n fromUserCoordinate(vertex, projection)\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n const circleGeometry = geometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry.setRadius(radius);\n radius = circleGeometry\n .transform(projection, userProjection)\n .getRadius();\n }\n geometry.setRadius(radius);\n this.changingFeature_ = false;\n }\n break;\n default:\n // pass\n }\n\n if (coordinates) {\n this.setGeometryCoordinates_(geometry, coordinates);\n }\n }\n this.createOrUpdateVertexFeature_(vertex);\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(evt) {\n if (!this.condition_(evt)) {\n return false;\n }\n const pixelCoordinate = evt.coordinate;\n this.handlePointerAtPixel_(evt.pixel, evt.map, pixelCoordinate);\n this.dragSegments_.length = 0;\n this.modified_ = false;\n const vertexFeature = this.vertexFeature_;\n if (vertexFeature) {\n const projection = evt.map.getView().getProjection();\n const insertVertices = [];\n const vertex = vertexFeature.getGeometry().getCoordinates();\n const vertexExtent = boundingExtent([vertex]);\n const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);\n const componentSegments = {};\n segmentDataMatches.sort(compareIndexes);\n for (let i = 0, ii = segmentDataMatches.length; i < ii; ++i) {\n const segmentDataMatch = segmentDataMatches[i];\n const segment = segmentDataMatch.segment;\n let uid = getUid(segmentDataMatch.geometry);\n const depth = segmentDataMatch.depth;\n if (depth) {\n uid += '-' + depth.join('-'); // separate feature components\n }\n if (!componentSegments[uid]) {\n componentSegments[uid] = new Array(2);\n }\n\n if (\n segmentDataMatch.geometry.getType() === GeometryType.CIRCLE &&\n segmentDataMatch.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n const closestVertex = closestOnSegmentData(\n pixelCoordinate,\n segmentDataMatch,\n projection\n );\n if (\n coordinatesEqual(closestVertex, vertex) &&\n !componentSegments[uid][0]\n ) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n }\n continue;\n }\n\n if (\n coordinatesEqual(segment[0], vertex) &&\n !componentSegments[uid][0]\n ) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n continue;\n }\n\n if (\n coordinatesEqual(segment[1], vertex) &&\n !componentSegments[uid][1]\n ) {\n // prevent dragging closed linestrings by the connecting node\n if (\n (segmentDataMatch.geometry.getType() === GeometryType.LINE_STRING ||\n segmentDataMatch.geometry.getType() ===\n GeometryType.MULTI_LINE_STRING) &&\n componentSegments[uid][0] &&\n componentSegments[uid][0].index === 0\n ) {\n continue;\n }\n\n this.dragSegments_.push([segmentDataMatch, 1]);\n componentSegments[uid][1] = segmentDataMatch;\n continue;\n }\n\n if (\n getUid(segment) in this.vertexSegments_ &&\n !componentSegments[uid][0] &&\n !componentSegments[uid][1] &&\n this.insertVertexCondition_(evt)\n ) {\n insertVertices.push([segmentDataMatch, vertex]);\n }\n }\n\n if (insertVertices.length) {\n this.willModifyFeatures_(evt);\n }\n\n for (let j = insertVertices.length - 1; j >= 0; --j) {\n this.insertVertex_.apply(this, insertVertices[j]);\n }\n }\n return !!this.vertexFeature_;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(evt) {\n for (let i = this.dragSegments_.length - 1; i >= 0; --i) {\n const segmentData = this.dragSegments_[i][0];\n const geometry = segmentData.geometry;\n if (geometry.getType() === GeometryType.CIRCLE) {\n // Update a circle object in the R* bush:\n const coordinates = geometry.getCenter();\n const centerSegmentData = segmentData.featureSegments[0];\n const circumferenceSegmentData = segmentData.featureSegments[1];\n centerSegmentData.segment[0] = coordinates;\n centerSegmentData.segment[1] = coordinates;\n circumferenceSegmentData.segment[0] = coordinates;\n circumferenceSegmentData.segment[1] = coordinates;\n this.rBush_.update(createExtent(coordinates), centerSegmentData);\n let circleGeometry = geometry;\n const userProjection = getUserProjection();\n if (userProjection) {\n const projection = evt.map.getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(circleGeometry).transform(\n projection,\n userProjection\n );\n }\n this.rBush_.update(\n circleGeometry.getExtent(),\n circumferenceSegmentData\n );\n } else {\n this.rBush_.update(boundingExtent(segmentData.segment), segmentData);\n }\n }\n if (this.modified_) {\n this.dispatchEvent(\n new ModifyEvent(ModifyEventType.MODIFYEND, this.features_, evt)\n );\n this.modified_ = false;\n }\n return false;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @private\n */\n handlePointerMove_(evt) {\n this.lastPixel_ = evt.pixel;\n this.handlePointerAtPixel_(evt.pixel, evt.map, evt.coordinate);\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @param {import(\"../coordinate.js\").Coordinate=} opt_coordinate The pixel Coordinate.\n * @private\n */\n handlePointerAtPixel_(pixel, map, opt_coordinate) {\n const pixelCoordinate = opt_coordinate || map.getCoordinateFromPixel(pixel);\n const projection = map.getView().getProjection();\n const sortByDistance = function (a, b) {\n return (\n projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) -\n projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection)\n );\n };\n\n const viewExtent = fromUserExtent(\n createExtent(pixelCoordinate, tempExtent),\n projection\n );\n const buffer = map.getView().getResolution() * this.pixelTolerance_;\n const box = toUserExtent(\n bufferExtent(viewExtent, buffer, tempExtent),\n projection\n );\n\n const rBush = this.rBush_;\n const nodes = rBush.getInExtent(box);\n if (nodes.length > 0) {\n nodes.sort(sortByDistance);\n const node = nodes[0];\n const closestSegment = node.segment;\n let vertex = closestOnSegmentData(pixelCoordinate, node, projection);\n const vertexPixel = map.getPixelFromCoordinate(vertex);\n let dist = coordinateDistance(pixel, vertexPixel);\n if (dist <= this.pixelTolerance_) {\n /** @type {Object<string, boolean>} */\n const vertexSegments = {};\n\n if (\n node.geometry.getType() === GeometryType.CIRCLE &&\n node.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n this.snappedToVertex_ = true;\n this.createOrUpdateVertexFeature_(vertex);\n } else {\n const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2\n ? closestSegment[1]\n : closestSegment[0];\n }\n this.createOrUpdateVertexFeature_(vertex);\n for (let i = 1, ii = nodes.length; i < ii; ++i) {\n const segment = nodes[i].segment;\n if (\n (coordinatesEqual(closestSegment[0], segment[0]) &&\n coordinatesEqual(closestSegment[1], segment[1])) ||\n (coordinatesEqual(closestSegment[0], segment[1]) &&\n coordinatesEqual(closestSegment[1], segment[0]))\n ) {\n vertexSegments[getUid(segment)] = true;\n } else {\n break;\n }\n }\n }\n\n vertexSegments[getUid(closestSegment)] = true;\n this.vertexSegments_ = vertexSegments;\n return;\n }\n }\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n }\n\n /**\n * @param {SegmentData} segmentData Segment data.\n * @param {import(\"../coordinate.js\").Coordinate} vertex Vertex.\n * @private\n */\n insertVertex_(segmentData, vertex) {\n const segment = segmentData.segment;\n const feature = segmentData.feature;\n const geometry = segmentData.geometry;\n const depth = segmentData.depth;\n const index = segmentData.index;\n let coordinates;\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(0);\n }\n\n switch (geometry.getType()) {\n case GeometryType.MULTI_LINE_STRING:\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case GeometryType.POLYGON:\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case GeometryType.MULTI_POLYGON:\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex);\n break;\n case GeometryType.LINE_STRING:\n coordinates = geometry.getCoordinates();\n coordinates.splice(index + 1, 0, vertex);\n break;\n default:\n return;\n }\n\n this.setGeometryCoordinates_(geometry, coordinates);\n const rTree = this.rBush_;\n rTree.remove(segmentData);\n this.updateSegmentIndices_(geometry, index, depth, 1);\n\n /** @type {SegmentData} */\n const newSegmentData = {\n segment: [segment[0], vertex],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index,\n };\n\n rTree.insert(boundingExtent(newSegmentData.segment), newSegmentData);\n this.dragSegments_.push([newSegmentData, 1]);\n\n /** @type {SegmentData} */\n const newSegmentData2 = {\n segment: [vertex, segment[1]],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index + 1,\n };\n\n rTree.insert(boundingExtent(newSegmentData2.segment), newSegmentData2);\n this.dragSegments_.push([newSegmentData2, 0]);\n this.ignoreNextSingleClick_ = true;\n }\n\n /**\n * Removes the vertex currently being pointed.\n * @return {boolean} True when a vertex was removed.\n * @api\n */\n removePoint() {\n if (\n this.lastPointerEvent_ &&\n this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG\n ) {\n const evt = this.lastPointerEvent_;\n this.willModifyFeatures_(evt);\n const removed = this.removeVertex_();\n this.dispatchEvent(\n new ModifyEvent(ModifyEventType.MODIFYEND, this.features_, evt)\n );\n this.modified_ = false;\n return removed;\n }\n return false;\n }\n\n /**\n * Removes a vertex from all matching features.\n * @return {boolean} True when a vertex was removed.\n * @private\n */\n removeVertex_() {\n const dragSegments = this.dragSegments_;\n const segmentsByFeature = {};\n let deleted = false;\n let component, coordinates, dragSegment, geometry, i, index, left;\n let newIndex, right, segmentData, uid;\n for (i = dragSegments.length - 1; i >= 0; --i) {\n dragSegment = dragSegments[i];\n segmentData = dragSegment[0];\n uid = getUid(segmentData.feature);\n if (segmentData.depth) {\n // separate feature components\n uid += '-' + segmentData.depth.join('-');\n }\n if (!(uid in segmentsByFeature)) {\n segmentsByFeature[uid] = {};\n }\n if (dragSegment[1] === 0) {\n segmentsByFeature[uid].right = segmentData;\n segmentsByFeature[uid].index = segmentData.index;\n } else if (dragSegment[1] == 1) {\n segmentsByFeature[uid].left = segmentData;\n segmentsByFeature[uid].index = segmentData.index + 1;\n }\n }\n for (uid in segmentsByFeature) {\n right = segmentsByFeature[uid].right;\n left = segmentsByFeature[uid].left;\n index = segmentsByFeature[uid].index;\n newIndex = index - 1;\n if (left !== undefined) {\n segmentData = left;\n } else {\n segmentData = right;\n }\n if (newIndex < 0) {\n newIndex = 0;\n }\n geometry = segmentData.geometry;\n coordinates = geometry.getCoordinates();\n component = coordinates;\n deleted = false;\n switch (geometry.getType()) {\n case GeometryType.MULTI_LINE_STRING:\n if (coordinates[segmentData.depth[0]].length > 2) {\n coordinates[segmentData.depth[0]].splice(index, 1);\n deleted = true;\n }\n break;\n case GeometryType.LINE_STRING:\n if (coordinates.length > 2) {\n coordinates.splice(index, 1);\n deleted = true;\n }\n break;\n case GeometryType.MULTI_POLYGON:\n component = component[segmentData.depth[1]];\n /* falls through */\n case GeometryType.POLYGON:\n component = component[segmentData.depth[0]];\n if (component.length > 4) {\n if (index == component.length - 1) {\n index = 0;\n }\n component.splice(index, 1);\n deleted = true;\n if (index === 0) {\n // close the ring again\n component.pop();\n component.push(component[0]);\n newIndex = component.length - 1;\n }\n }\n break;\n default:\n // pass\n }\n\n if (deleted) {\n this.setGeometryCoordinates_(geometry, coordinates);\n const segments = [];\n if (left !== undefined) {\n this.rBush_.remove(left);\n segments.push(left.segment[0]);\n }\n if (right !== undefined) {\n this.rBush_.remove(right);\n segments.push(right.segment[1]);\n }\n if (left !== undefined && right !== undefined) {\n /** @type {SegmentData} */\n const newSegmentData = {\n depth: segmentData.depth,\n feature: segmentData.feature,\n geometry: segmentData.geometry,\n index: newIndex,\n segment: segments,\n };\n\n this.rBush_.insert(\n boundingExtent(newSegmentData.segment),\n newSegmentData\n );\n }\n this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n dragSegments.length = 0;\n }\n }\n return deleted;\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {Array} coordinates Coordinates.\n * @private\n */\n setGeometryCoordinates_(geometry, coordinates) {\n this.changingFeature_ = true;\n geometry.setCoordinates(coordinates);\n this.changingFeature_ = false;\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} index Index.\n * @param {Array<number>|undefined} depth Depth.\n * @param {number} delta Delta (1 or -1).\n * @private\n */\n updateSegmentIndices_(geometry, index, depth, delta) {\n this.rBush_.forEachInExtent(geometry.getExtent(), function (\n segmentDataMatch\n ) {\n if (\n segmentDataMatch.geometry === geometry &&\n (depth === undefined ||\n segmentDataMatch.depth === undefined ||\n equals(segmentDataMatch.depth, depth)) &&\n segmentDataMatch.index > index\n ) {\n segmentDataMatch.index += delta;\n }\n });\n }\n}\n\n/**\n * @param {SegmentData} a The first segment data.\n * @param {SegmentData} b The second segment data.\n * @return {number} The difference in indexes.\n */\nfunction compareIndexes(a, b) {\n return a.index - b.index;\n}\n\n/**\n * Returns the distance from a point to a line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The coordinates of the point from\n * which to calculate the distance.\n * @param {SegmentData} segmentData The object describing the line\n * segment we are calculating the distance to.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {number} The square of the distance between a point and a line segment.\n */\nfunction projectedDistanceToSegmentDataSquared(\n pointCoordinates,\n segmentData,\n projection\n) {\n const geometry = segmentData.geometry;\n\n if (geometry.getType() === GeometryType.CIRCLE) {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (geometry);\n\n if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry\n .clone()\n .transform(userProjection, projection));\n }\n const distanceToCenterSquared = squaredCoordinateDistance(\n circleGeometry.getCenter(),\n fromUserCoordinate(pointCoordinates, projection)\n );\n const distanceToCircumference =\n Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius();\n return distanceToCircumference * distanceToCircumference;\n }\n }\n\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return squaredDistanceToSegment(coordinate, tempSegment);\n}\n\n/**\n * Returns the point closest to a given line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The point to which a closest point\n * should be found.\n * @param {SegmentData} segmentData The object describing the line\n * segment which should contain the closest point.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../coordinate.js\").Coordinate} The point closest to the specified line segment.\n */\nfunction closestOnSegmentData(pointCoordinates, segmentData, projection) {\n const geometry = segmentData.geometry;\n\n if (\n geometry.getType() === GeometryType.CIRCLE &&\n segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (geometry);\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry\n .clone()\n .transform(userProjection, projection));\n }\n return toUserCoordinate(\n circleGeometry.getClosestPoint(\n fromUserCoordinate(pointCoordinates, projection)\n ),\n projection\n );\n }\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return toUserCoordinate(\n closestOnSegment(coordinate, tempSegment),\n projection\n );\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style[GeometryType.POINT];\n };\n}\n\nexport default Modify;\n","/**\n * @module ol/interaction/Select\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Event from '../events/Event.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport Interaction from './Interaction.js';\nimport {TRUE} from '../functions.js';\nimport {clear} from '../obj.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {extend, includes} from '../array.js';\nimport {getUid} from '../util.js';\nimport {never, shiftKeyOnly, singleClick} from '../events/condition.js';\n\n/**\n * @enum {string}\n */\nconst SelectEventType = {\n /**\n * Triggered when feature(s) has been (de)selected.\n * @event SelectEvent#select\n * @api\n */\n SELECT: 'select',\n};\n\n/**\n * A function that takes an {@link module:ol/Feature} or\n * {@link module:ol/render/Feature} and an\n * {@link module:ol/layer/Layer} and returns `true` if the feature may be\n * selected or `false` otherwise.\n * @typedef {function(import(\"../Feature.js\").FeatureLike, import(\"../layer/Layer.js\").default):boolean} FilterFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [addCondition] A function\n * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default, this is {@link module:ol/events/condition~never}. Use this if you\n * want to use different events for add and remove instead of `toggle`.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. This is the event\n * for the selected features as a whole. By default, this is\n * {@link module:ol/events/condition~singleClick}. Clicking on a feature selects that\n * feature and removes any that were in the selection. Clicking outside any\n * feature removes all from the selection.\n * See `toggle`, `add`, `remove` options for adding/removing extra features to/\n * from the selection.\n * @property {Array<import(\"../layer/Layer.js\").default>|function(import(\"../layer/Layer.js\").default): boolean} [layers]\n * A list of layers from which features should be selected. Alternatively, a\n * filter function can be provided. The function will be called for each layer\n * in the map and should return `true` for layers that you want to be\n * selectable. If the option is absent, all visible layers will be considered\n * selectable.\n * @property {import(\"../style/Style.js\").StyleLike|null} [style]\n * Style for the selected features. By default the default edit style is used\n * (see {@link module:ol/style}). Set to `null` if this interaction should not apply\n * any style changes for selected features.\n * If set to a falsey value, the selected feature's style will not change.\n * @property {import(\"../events/condition.js\").Condition} [removeCondition] A function\n * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default, this is {@link module:ol/events/condition~never}. Use this if you\n * want to use different events for add and remove instead of `toggle`.\n * @property {import(\"../events/condition.js\").Condition} [toggleCondition] A function\n * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. This is in addition\n * to the `condition` event. By default,\n * {@link module:ol/events/condition~shiftKeyOnly}, i.e. pressing `shift` as\n * well as the `condition` event, adds that feature to the current selection if\n * it is not currently selected, and removes it if it is. See `add` and `remove`\n * if you want to use different events instead of a toggle.\n * @property {boolean} [multi=false] A boolean that determines if the default\n * behaviour should select only single features or all (overlapping) features at\n * the clicked map position. The default of `false` means single select.\n * @property {import(\"../Collection.js\").default<import(\"../Feature.js\").default>} [features]\n * Collection where the interaction will place selected features. Optional. If\n * not set the interaction will create a collection. In any case the collection\n * used by the interaction is returned by\n * {@link module:ol/interaction/Select~Select#getFeatures}.\n * @property {FilterFunction} [filter] A function\n * that takes an {@link module:ol/Feature} and an\n * {@link module:ol/layer/Layer} and returns `true` if the feature may be\n * selected or `false` otherwise.\n * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside\n * the radius around the given position will be checked for features.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Select~Select} instances are instances of\n * this type.\n */\nclass SelectEvent extends Event {\n /**\n * @param {SelectEventType} type The event type.\n * @param {Array<import(\"../Feature.js\").default>} selected Selected features.\n * @param {Array<import(\"../Feature.js\").default>} deselected Deselected features.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Associated\n * {@link module:ol/MapBrowserEvent}.\n */\n constructor(type, selected, deselected, mapBrowserEvent) {\n super(type);\n\n /**\n * Selected features array.\n * @type {Array<import(\"../Feature.js\").default>}\n * @api\n */\n this.selected = selected;\n\n /**\n * Deselected features array.\n * @type {Array<import(\"../Feature.js\").default>}\n * @api\n */\n this.deselected = deselected;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/**\n * Original feature styles to reset to when features are no longer selected.\n * @type {Object.<number, import(\"../style/Style.js\").default|Array.<import(\"../style/Style.js\").default>|import(\"../style/Style.js\").StyleFunction>}\n */\nconst originalFeatureStyles = {};\n\n/**\n * @classdesc\n * Interaction for selecting vector features. By default, selected features are\n * styled differently, so this interaction can be used for visual highlighting,\n * as well as selecting features for other actions, such as modification or\n * output. There are three ways of controlling which features are selected:\n * using the browser event as defined by the `condition` and optionally the\n * `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a\n * further feature filter using the `filter` option.\n *\n * Selected features are added to an internal unmanaged layer.\n *\n * @fires SelectEvent\n * @api\n */\nclass Select extends Interaction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n super();\n\n const options = opt_options ? opt_options : {};\n\n /**\n * @private\n */\n this.boundAddFeature_ = this.addFeature_.bind(this);\n\n /**\n * @private\n */\n this.boundRemoveFeature_ = this.removeFeature_.bind(this);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : singleClick;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.addCondition_ = options.addCondition ? options.addCondition : never;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.removeCondition_ = options.removeCondition\n ? options.removeCondition\n : never;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.toggleCondition_ = options.toggleCondition\n ? options.toggleCondition\n : shiftKeyOnly;\n\n /**\n * @private\n * @type {boolean}\n */\n this.multi_ = options.multi ? options.multi : false;\n\n /**\n * @private\n * @type {FilterFunction}\n */\n this.filter_ = options.filter ? options.filter : TRUE;\n\n /**\n * @private\n * @type {number}\n */\n this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;\n\n /**\n * @private\n * @type {import(\"../style/Style.js\").default|Array.<import(\"../style/Style.js\").default>|import(\"../style/Style.js\").StyleFunction|null}\n */\n this.style_ =\n options.style !== undefined ? options.style : getDefaultStyleFunction();\n\n /**\n * @private\n * @type {import(\"../Collection.js\").default}\n */\n this.features_ = options.features || new Collection();\n\n /** @type {function(import(\"../layer/Layer.js\").default): boolean} */\n let layerFilter;\n if (options.layers) {\n if (typeof options.layers === 'function') {\n layerFilter = options.layers;\n } else {\n const layers = options.layers;\n layerFilter = function (layer) {\n return includes(layers, layer);\n };\n }\n } else {\n layerFilter = TRUE;\n }\n\n /**\n * @private\n * @type {function(import(\"../layer/Layer.js\").default): boolean}\n */\n this.layerFilter_ = layerFilter;\n\n /**\n * An association between selected feature (key)\n * and layer (value)\n * @private\n * @type {Object<string, import(\"../layer/Layer.js\").default>}\n */\n this.featureLayerAssociation_ = {};\n }\n\n /**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @private\n */\n addFeatureLayerAssociation_(feature, layer) {\n this.featureLayerAssociation_[getUid(feature)] = layer;\n }\n\n /**\n * Get the selected features.\n * @return {import(\"../Collection.js\").default<import(\"../Feature.js\").default>} Features collection.\n * @api\n */\n getFeatures() {\n return this.features_;\n }\n\n /**\n * Returns the Hit-detection tolerance.\n * @returns {number} Hit tolerance in pixels.\n * @api\n */\n getHitTolerance() {\n return this.hitTolerance_;\n }\n\n /**\n * Returns the associated {@link module:ol/layer/Vector~Vector vectorlayer} of\n * the (last) selected feature. Note that this will not work with any\n * programmatic method like pushing features to\n * {@link module:ol/interaction/Select~Select#getFeatures collection}.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature\n * @return {import('../layer/Vector.js').default} Layer.\n * @api\n */\n getLayer(feature) {\n return /** @type {import('../layer/Vector.js').default} */ (this\n .featureLayerAssociation_[getUid(feature)]);\n }\n\n /**\n * Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @api\n */\n setHitTolerance(hitTolerance) {\n this.hitTolerance_ = hitTolerance;\n }\n\n /**\n * Remove the interaction from its current map, if any, and attach it to a new\n * map, if any. Pass `null` to just remove the interaction from the current map.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @api\n */\n setMap(map) {\n const currentMap = this.getMap();\n if (currentMap && this.style_) {\n this.features_.forEach(this.restorePreviousStyle_.bind(this));\n }\n super.setMap(map);\n if (map) {\n this.features_.addEventListener(\n CollectionEventType.ADD,\n this.boundAddFeature_\n );\n this.features_.addEventListener(\n CollectionEventType.REMOVE,\n this.boundRemoveFeature_\n );\n\n if (this.style_) {\n this.features_.forEach(this.applySelectedStyle_.bind(this));\n }\n } else {\n this.features_.removeEventListener(\n CollectionEventType.ADD,\n this.boundAddFeature_\n );\n this.features_.removeEventListener(\n CollectionEventType.REMOVE,\n this.boundRemoveFeature_\n );\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} evt Event.\n * @private\n */\n addFeature_(evt) {\n const feature = evt.element;\n if (this.style_) {\n this.applySelectedStyle_(feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} evt Event.\n * @private\n */\n removeFeature_(evt) {\n const feature = evt.element;\n if (this.style_) {\n this.restorePreviousStyle_(feature);\n }\n }\n\n /**\n * @return {import(\"../style/Style.js\").StyleLike|null} Select style.\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @private\n */\n applySelectedStyle_(feature) {\n const key = getUid(feature);\n if (!(key in originalFeatureStyles)) {\n originalFeatureStyles[key] = feature.getStyle();\n }\n feature.setStyle(this.style_);\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @private\n */\n restorePreviousStyle_(feature) {\n const key = getUid(feature);\n const selectInteractions = /** @type {Array<Select>} */ (this.getMap()\n .getInteractions()\n .getArray()\n .filter(function (interaction) {\n return (\n interaction instanceof Select &&\n interaction.getStyle() &&\n interaction.getFeatures().getArray().indexOf(feature) !== -1\n );\n }));\n if (selectInteractions.length > 0) {\n feature.setStyle(\n selectInteractions[selectInteractions.length - 1].getStyle()\n );\n } else {\n feature.setStyle(originalFeatureStyles[key]);\n delete originalFeatureStyles[key];\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @private\n */\n removeFeatureLayerAssociation_(feature) {\n delete this.featureLayerAssociation_[getUid(feature)];\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent map browser event} and may change the\n * selected state of features.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @this {Select}\n */\n handleEvent(mapBrowserEvent) {\n if (!this.condition_(mapBrowserEvent)) {\n return true;\n }\n const add = this.addCondition_(mapBrowserEvent);\n const remove = this.removeCondition_(mapBrowserEvent);\n const toggle = this.toggleCondition_(mapBrowserEvent);\n const set = !add && !remove && !toggle;\n const map = mapBrowserEvent.map;\n const features = this.getFeatures();\n const deselected = [];\n const selected = [];\n if (set) {\n // Replace the currently selected feature(s) with the feature(s) at the\n // pixel, or clear the selected feature(s) if there is no feature at\n // the pixel.\n clear(this.featureLayerAssociation_);\n map.forEachFeatureAtPixel(\n mapBrowserEvent.pixel,\n /**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @return {boolean|undefined} Continue to iterate over the features.\n */\n function (feature, layer) {\n if (this.filter_(feature, layer)) {\n selected.push(feature);\n this.addFeatureLayerAssociation_(feature, layer);\n return !this.multi_;\n }\n }.bind(this),\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n }\n );\n for (let i = features.getLength() - 1; i >= 0; --i) {\n const feature = features.item(i);\n const index = selected.indexOf(feature);\n if (index > -1) {\n // feature is already selected\n selected.splice(index, 1);\n } else {\n features.remove(feature);\n deselected.push(feature);\n }\n }\n if (selected.length !== 0) {\n features.extend(selected);\n }\n } else {\n // Modify the currently selected feature(s).\n map.forEachFeatureAtPixel(\n mapBrowserEvent.pixel,\n /**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @return {boolean|undefined} Continue to iterate over the features.\n */\n function (feature, layer) {\n if (this.filter_(feature, layer)) {\n if ((add || toggle) && !includes(features.getArray(), feature)) {\n selected.push(feature);\n this.addFeatureLayerAssociation_(feature, layer);\n } else if (\n (remove || toggle) &&\n includes(features.getArray(), feature)\n ) {\n deselected.push(feature);\n this.removeFeatureLayerAssociation_(feature);\n }\n return !this.multi_;\n }\n }.bind(this),\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n }\n );\n for (let j = deselected.length - 1; j >= 0; --j) {\n features.remove(deselected[j]);\n }\n features.extend(selected);\n }\n if (selected.length > 0 || deselected.length > 0) {\n this.dispatchEvent(\n new SelectEvent(\n SelectEventType.SELECT,\n selected,\n deselected,\n mapBrowserEvent\n )\n );\n }\n return true;\n }\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const styles = createEditingStyle();\n extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]);\n extend(\n styles[GeometryType.GEOMETRY_COLLECTION],\n styles[GeometryType.LINE_STRING]\n );\n\n return function (feature) {\n if (!feature.getGeometry()) {\n return null;\n }\n return styles[feature.getGeometry().getType()];\n };\n}\n\nexport default Select;\n","/**\n * @module ol/interaction/Snap\n */\nimport CollectionEventType from '../CollectionEventType.js';\nimport EventType from '../events/EventType.js';\nimport GeometryType from '../geom/GeometryType.js';\nimport PointerInteraction from './Pointer.js';\nimport RBush from '../structs/RBush.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {boundingExtent, createEmpty} from '../extent.js';\nimport {\n closestOnCircle,\n closestOnSegment,\n distance as coordinateDistance,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport {\n fromUserCoordinate,\n getUserProjection,\n toUserCoordinate,\n} from '../proj.js';\nimport {getUid} from '../util.js';\nimport {getValues} from '../obj.js';\nimport {listen, unlistenByKey} from '../events.js';\n\n/**\n * @typedef {Object} Result\n * @property {boolean} snapped\n * @property {import(\"../coordinate.js\").Coordinate|null} vertex\n * @property {import(\"../pixel.js\").Pixel|null} vertexPixel\n */\n\n/**\n * @typedef {Object} SegmentData\n * @property {import(\"../Feature.js\").default} feature\n * @property {Array<import(\"../coordinate.js\").Coordinate>} segment\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../Collection.js\").default<import(\"../Feature.js\").default>} [features] Snap to these features. Either this option or source should be provided.\n * @property {boolean} [edge=true] Snap to edges.\n * @property {boolean} [vertex=true] Snap to vertices.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or\n * vertex for snapping.\n * @property {import(\"../source/Vector.js\").default} [source] Snap to features from this source. Either this option or features should be provided\n */\n\n/**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent} evt Event.\n * @return {import(\"../Feature.js\").default} Feature.\n */\nfunction getFeatureFromEvent(evt) {\n if (\n /** @type {import(\"../source/Vector.js\").VectorSourceEvent} */ (evt).feature\n ) {\n return /** @type {import(\"../source/Vector.js\").VectorSourceEvent} */ (evt)\n .feature;\n } else if (\n /** @type {import(\"../Collection.js\").CollectionEvent} */ (evt).element\n ) {\n return /** @type {import(\"../Feature.js\").default} */ (\n /** @type {import(\"../Collection.js\").CollectionEvent} */ (evt).element\n );\n }\n}\n\nconst tempSegment = [];\n\n/**\n * @classdesc\n * Handles snapping of vector features while modifying or drawing them. The\n * features can come from a {@link module:ol/source/Vector} or {@link module:ol/Collection~Collection}\n * Any interaction object that allows the user to interact\n * with the features using the mouse can benefit from the snapping, as long\n * as it is added before.\n *\n * The snap interaction modifies map browser event `coordinate` and `pixel`\n * properties to force the snap to occur to any interaction that them.\n *\n * Example:\n *\n * import Snap from 'ol/interaction/Snap';\n *\n * const snap = new Snap({\n * source: source\n * });\n *\n * map.addInteraction(snap);\n *\n * @api\n */\nclass Snap extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (options);\n\n if (!pointerOptions.handleDownEvent) {\n pointerOptions.handleDownEvent = TRUE;\n }\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @type {import(\"../source/Vector.js\").default}\n * @private\n */\n this.source_ = options.source ? options.source : null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.vertex_ = options.vertex !== undefined ? options.vertex : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.edge_ = options.edge !== undefined ? options.edge : true;\n\n /**\n * @type {import(\"../Collection.js\").default<import(\"../Feature.js\").default>}\n * @private\n */\n this.features_ = options.features ? options.features : null;\n\n /**\n * @type {Array<import(\"../events.js\").EventsKey>}\n * @private\n */\n this.featuresListenerKeys_ = [];\n\n /**\n * @type {Object<string, import(\"../events.js\").EventsKey>}\n * @private\n */\n this.featureChangeListenerKeys_ = {};\n\n /**\n * Extents are preserved so indexed segment can be quickly removed\n * when its feature geometry changes\n * @type {Object<string, import(\"../extent.js\").Extent>}\n * @private\n */\n this.indexedFeaturesExtents_ = {};\n\n /**\n * If a feature geometry changes while a pointer drag|move event occurs, the\n * feature doesn't get updated right away. It will be at the next 'pointerup'\n * event fired.\n * @type {!Object<string, import(\"../Feature.js\").default>}\n * @private\n */\n this.pendingFeatures_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * Segment RTree for each layer\n * @type {import(\"../structs/RBush.js\").default<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * @const\n * @private\n * @type {Object<string, function(import(\"../Feature.js\").default, import(\"../geom/Geometry.js\").default): void>}\n */\n this.SEGMENT_WRITERS_ = {\n 'Point': this.writePointGeometry_.bind(this),\n 'LineString': this.writeLineStringGeometry_.bind(this),\n 'LinearRing': this.writeLineStringGeometry_.bind(this),\n 'Polygon': this.writePolygonGeometry_.bind(this),\n 'MultiPoint': this.writeMultiPointGeometry_.bind(this),\n 'MultiLineString': this.writeMultiLineStringGeometry_.bind(this),\n 'MultiPolygon': this.writeMultiPolygonGeometry_.bind(this),\n 'GeometryCollection': this.writeGeometryCollectionGeometry_.bind(this),\n 'Circle': this.writeCircleGeometry_.bind(this),\n };\n }\n\n /**\n * Add a feature to the collection of features that we may snap to.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {boolean=} opt_listen Whether to listen to the feature change or not\n * Defaults to `true`.\n * @api\n */\n addFeature(feature, opt_listen) {\n const register = opt_listen !== undefined ? opt_listen : true;\n const feature_uid = getUid(feature);\n const geometry = feature.getGeometry();\n if (geometry) {\n const segmentWriter = this.SEGMENT_WRITERS_[geometry.getType()];\n if (segmentWriter) {\n this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent(\n createEmpty()\n );\n segmentWriter(feature, geometry);\n }\n }\n\n if (register) {\n this.featureChangeListenerKeys_[feature_uid] = listen(\n feature,\n EventType.CHANGE,\n this.handleFeatureChange_,\n this\n );\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @private\n */\n forEachFeatureAdd_(feature) {\n this.addFeature(feature);\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @private\n */\n forEachFeatureRemove_(feature) {\n this.removeFeature(feature);\n }\n\n /**\n * @return {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|Array<import(\"../Feature.js\").default>} Features.\n * @private\n */\n getFeatures_() {\n let features;\n if (this.features_) {\n features = this.features_;\n } else if (this.source_) {\n features = this.source_.getFeatures();\n }\n return features;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event.\n * @return {boolean} `false` to stop event propagation.\n */\n handleEvent(evt) {\n const result = this.snapTo(evt.pixel, evt.coordinate, evt.map);\n if (result.snapped) {\n evt.coordinate = result.vertex.slice(0, 2);\n evt.pixel = result.vertexPixel;\n }\n return super.handleEvent(evt);\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent} evt Event.\n * @private\n */\n handleFeatureAdd_(evt) {\n const feature = getFeatureFromEvent(evt);\n this.addFeature(feature);\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent} evt Event.\n * @private\n */\n handleFeatureRemove_(evt) {\n const feature = getFeatureFromEvent(evt);\n this.removeFeature(feature);\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n const feature = /** @type {import(\"../Feature.js\").default} */ (evt.target);\n if (this.handlingDownUpSequence) {\n const uid = getUid(feature);\n if (!(uid in this.pendingFeatures_)) {\n this.pendingFeatures_[uid] = feature;\n }\n } else {\n this.updateFeature_(feature);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(evt) {\n const featuresToUpdate = getValues(this.pendingFeatures_);\n if (featuresToUpdate.length) {\n featuresToUpdate.forEach(this.updateFeature_.bind(this));\n this.pendingFeatures_ = {};\n }\n return false;\n }\n\n /**\n * Remove a feature from the collection of features that we may snap to.\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {boolean=} opt_unlisten Whether to unlisten to the feature change\n * or not. Defaults to `true`.\n * @api\n */\n removeFeature(feature, opt_unlisten) {\n const unregister = opt_unlisten !== undefined ? opt_unlisten : true;\n const feature_uid = getUid(feature);\n const extent = this.indexedFeaturesExtents_[feature_uid];\n if (extent) {\n const rBush = this.rBush_;\n const nodesToRemove = [];\n rBush.forEachInExtent(extent, function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n });\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n rBush.remove(nodesToRemove[i]);\n }\n }\n\n if (unregister) {\n unlistenByKey(this.featureChangeListenerKeys_[feature_uid]);\n delete this.featureChangeListenerKeys_[feature_uid];\n }\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n const currentMap = this.getMap();\n const keys = this.featuresListenerKeys_;\n const features = /** @type {Array<import(\"../Feature.js\").default>} */ (this.getFeatures_());\n\n if (currentMap) {\n keys.forEach(unlistenByKey);\n keys.length = 0;\n features.forEach(this.forEachFeatureRemove_.bind(this));\n }\n super.setMap(map);\n\n if (map) {\n if (this.features_) {\n keys.push(\n listen(\n this.features_,\n CollectionEventType.ADD,\n this.handleFeatureAdd_,\n this\n ),\n listen(\n this.features_,\n CollectionEventType.REMOVE,\n this.handleFeatureRemove_,\n this\n )\n );\n } else if (this.source_) {\n keys.push(\n listen(\n this.source_,\n VectorEventType.ADDFEATURE,\n this.handleFeatureAdd_,\n this\n ),\n listen(\n this.source_,\n VectorEventType.REMOVEFEATURE,\n this.handleFeatureRemove_,\n this\n )\n );\n }\n features.forEach(this.forEachFeatureAdd_.bind(this));\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate Coordinate\n * @param {import(\"../PluggableMap.js\").default} map Map.\n * @return {Result} Snap result\n */\n snapTo(pixel, pixelCoordinate, map) {\n const lowerLeft = map.getCoordinateFromPixel([\n pixel[0] - this.pixelTolerance_,\n pixel[1] + this.pixelTolerance_,\n ]);\n const upperRight = map.getCoordinateFromPixel([\n pixel[0] + this.pixelTolerance_,\n pixel[1] - this.pixelTolerance_,\n ]);\n const box = boundingExtent([lowerLeft, upperRight]);\n\n let segments = this.rBush_.getInExtent(box);\n\n // If snapping on vertices only, don't consider circles\n if (this.vertex_ && !this.edge_) {\n segments = segments.filter(function (segment) {\n return segment.feature.getGeometry().getType() !== GeometryType.CIRCLE;\n });\n }\n\n let snapped = false;\n let vertex = null;\n let vertexPixel = null;\n\n if (segments.length === 0) {\n return {\n snapped: snapped,\n vertex: vertex,\n vertexPixel: vertexPixel,\n };\n }\n\n const projection = map.getView().getProjection();\n const projectedCoordinate = fromUserCoordinate(pixelCoordinate, projection);\n\n let closestSegmentData;\n let minSquaredDistance = Infinity;\n for (let i = 0; i < segments.length; ++i) {\n const segmentData = segments[i];\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n const delta = squaredDistanceToSegment(projectedCoordinate, tempSegment);\n if (delta < minSquaredDistance) {\n closestSegmentData = segmentData;\n minSquaredDistance = delta;\n }\n }\n const closestSegment = closestSegmentData.segment;\n\n if (this.vertex_ && !this.edge_) {\n const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(pixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(pixel, pixel2);\n const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n if (dist <= this.pixelTolerance_) {\n snapped = true;\n vertex =\n squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];\n vertexPixel = map.getPixelFromCoordinate(vertex);\n }\n } else if (this.edge_) {\n const isCircle =\n closestSegmentData.feature.getGeometry().getType() ===\n GeometryType.CIRCLE;\n if (isCircle) {\n let circleGeometry = closestSegmentData.feature.getGeometry();\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n vertex = toUserCoordinate(\n closestOnCircle(\n projectedCoordinate,\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry)\n ),\n projection\n );\n } else {\n tempSegment[0] = fromUserCoordinate(closestSegment[0], projection);\n tempSegment[1] = fromUserCoordinate(closestSegment[1], projection);\n vertex = toUserCoordinate(\n closestOnSegment(projectedCoordinate, tempSegment),\n projection\n );\n }\n vertexPixel = map.getPixelFromCoordinate(vertex);\n\n if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {\n snapped = true;\n if (this.vertex_ && !isCircle) {\n const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n if (dist <= this.pixelTolerance_) {\n vertex =\n squaredDist1 > squaredDist2\n ? closestSegment[1]\n : closestSegment[0];\n vertexPixel = map.getPixelFromCoordinate(vertex);\n }\n }\n }\n }\n\n if (snapped) {\n vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])];\n }\n\n return {\n snapped: snapped,\n vertex: vertex,\n vertexPixel: vertexPixel,\n };\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @private\n */\n updateFeature_(feature) {\n this.removeFeature(feature, false);\n this.addFeature(feature, false);\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @private\n */\n writeCircleGeometry_(feature, geometry) {\n const projection = this.getMap().getView().getProjection();\n let circleGeometry = geometry;\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry\n .clone()\n .transform(userProjection, projection));\n }\n const polygon = fromCircle(circleGeometry);\n if (userProjection) {\n polygon.transform(projection, userProjection);\n }\n const coordinates = polygon.getCoordinates()[0];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n const segmentData = {\n feature: feature,\n segment: segment,\n };\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @private\n */\n writeGeometryCollectionGeometry_(feature, geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const segmentWriter = this.SEGMENT_WRITERS_[geometries[i].getType()];\n if (segmentWriter) {\n segmentWriter(feature, geometries[i]);\n }\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @private\n */\n writeLineStringGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n const segmentData = {\n feature: feature,\n segment: segment,\n };\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @private\n */\n writeMultiLineStringGeometry_(feature, geometry) {\n const lines = geometry.getCoordinates();\n for (let j = 0, jj = lines.length; j < jj; ++j) {\n const coordinates = lines[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n const segmentData = {\n feature: feature,\n segment: segment,\n };\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPointGeometry_(feature, geometry) {\n const points = geometry.getCoordinates();\n for (let i = 0, ii = points.length; i < ii; ++i) {\n const coordinates = points[i];\n const segmentData = {\n feature: feature,\n segment: [coordinates, coordinates],\n };\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPolygonGeometry_(feature, geometry) {\n const polygons = geometry.getCoordinates();\n for (let k = 0, kk = polygons.length; k < kk; ++k) {\n const rings = polygons[k];\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n const segmentData = {\n feature: feature,\n segment: segment,\n };\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @private\n */\n writePointGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n const segmentData = {\n feature: feature,\n segment: [coordinates, coordinates],\n };\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @private\n */\n writePolygonGeometry_(feature, geometry) {\n const rings = geometry.getCoordinates();\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n const segmentData = {\n feature: feature,\n segment: segment,\n };\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n}\n\nexport default Snap;\n","/**\n * @module ol/interaction/Translate\n */\nimport Collection from '../Collection.js';\nimport Event from '../events/Event.js';\nimport InteractionProperty from './Property.js';\nimport PointerInteraction from './Pointer.js';\nimport {TRUE} from '../functions.js';\nimport {getChangeEventType} from '../Object.js';\nimport {includes} from '../array.js';\n\n/**\n * @enum {string}\n */\nconst TranslateEventType = {\n /**\n * Triggered upon feature translation start.\n * @event TranslateEvent#translatestart\n * @api\n */\n TRANSLATESTART: 'translatestart',\n /**\n * Triggered upon feature translation.\n * @event TranslateEvent#translating\n * @api\n */\n TRANSLATING: 'translating',\n /**\n * Triggered upon feature translation end.\n * @event TranslateEvent#translateend\n * @api\n */\n TRANSLATEEND: 'translateend',\n};\n\n/**\n * A function that takes an {@link module:ol/Feature} or\n * {@link module:ol/render/Feature} and an\n * {@link module:ol/layer/Layer} and returns `true` if the feature may be\n * translated or `false` otherwise.\n * @typedef {function(import(\"../Feature.js\").FeatureLike, import(\"../layer/Layer.js\").default):boolean} FilterFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {Collection<import(\"../Feature.js\").default>} [features] Only features contained in this collection will be able to be translated. If\n * not specified, all features on the map will be able to be translated.\n * @property {Array<import(\"../layer/Layer.js\").default>|function(import(\"../layer/Layer.js\").default): boolean} [layers] A list of layers from which features should be\n * translated. Alternatively, a filter function can be provided. The\n * function will be called for each layer in the map and should return\n * `true` for layers that you want to be translatable. If the option is\n * absent, all visible layers will be considered translatable.\n * @property {FilterFunction} [filter] A function\n * that takes an {@link module:ol/Feature} and an\n * {@link module:ol/layer/Layer} and returns `true` if the feature may be\n * translated or `false` otherwise.\n * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Translate~Translate} instances\n * are instances of this type.\n */\nexport class TranslateEvent extends Event {\n /**\n * @param {TranslateEventType} type Type.\n * @param {Collection<import(\"../Feature.js\").default>} features The features translated.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} startCoordinate The original coordinates before.translation started\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n */\n constructor(type, features, coordinate, startCoordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The features being translated.\n * @type {Collection<import(\"../Feature.js\").default>}\n * @api\n */\n this.features = features;\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * The coordinate of the start position before translation started.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.startCoordinate = startCoordinate;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/**\n * @classdesc\n * Interaction for translating (moving) features.\n *\n * @fires TranslateEvent\n * @api\n */\nclass Translate extends PointerInteraction {\n /**\n * @param {Options=} opt_options Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /**\n * The last position we translated to.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.lastCoordinate_ = null;\n\n /**\n * The start position before translation started.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.startCoordinate_ = null;\n\n /**\n * @type {Collection<import(\"../Feature.js\").default>}\n * @private\n */\n this.features_ = options.features !== undefined ? options.features : null;\n\n /** @type {function(import(\"../layer/Layer.js\").default): boolean} */\n let layerFilter;\n if (options.layers) {\n if (typeof options.layers === 'function') {\n layerFilter = options.layers;\n } else {\n const layers = options.layers;\n layerFilter = function (layer) {\n return includes(layers, layer);\n };\n }\n } else {\n layerFilter = TRUE;\n }\n\n /**\n * @private\n * @type {function(import(\"../layer/Layer.js\").default): boolean}\n */\n this.layerFilter_ = layerFilter;\n\n /**\n * @private\n * @type {FilterFunction}\n */\n this.filter_ = options.filter ? options.filter : TRUE;\n\n /**\n * @private\n * @type {number}\n */\n this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;\n\n /**\n * @type {import(\"../Feature.js\").default}\n * @private\n */\n this.lastFeature_ = null;\n\n this.addEventListener(\n getChangeEventType(InteractionProperty.ACTIVE),\n this.handleActiveChanged_\n );\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(event) {\n this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);\n if (!this.lastCoordinate_ && this.lastFeature_) {\n this.startCoordinate_ = event.coordinate;\n this.lastCoordinate_ = event.coordinate;\n this.handleMoveEvent(event);\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATESTART,\n features,\n event.coordinate,\n this.startCoordinate_,\n event\n )\n );\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(event) {\n if (this.lastCoordinate_) {\n this.lastCoordinate_ = null;\n this.handleMoveEvent(event);\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATEEND,\n features,\n event.coordinate,\n this.startCoordinate_,\n event\n )\n );\n // cleanup\n this.startCoordinate_ = null;\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n handleDragEvent(event) {\n if (this.lastCoordinate_) {\n const newCoordinate = event.coordinate;\n const deltaX = newCoordinate[0] - this.lastCoordinate_[0];\n const deltaY = newCoordinate[1] - this.lastCoordinate_[1];\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n features.forEach(function (feature) {\n const geom = feature.getGeometry();\n geom.translate(deltaX, deltaY);\n feature.setGeometry(geom);\n });\n\n this.lastCoordinate_ = newCoordinate;\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATING,\n features,\n newCoordinate,\n this.startCoordinate_,\n event\n )\n );\n }\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n handleMoveEvent(event) {\n const elem = event.map.getViewport();\n\n // Change the cursor to grab/grabbing if hovering any of the features managed\n // by the interaction\n if (this.featuresAtPixel_(event.pixel, event.map)) {\n elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing');\n elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab');\n } else {\n elem.classList.remove('ol-grab', 'ol-grabbing');\n }\n }\n\n /**\n * Tests to see if the given coordinates intersects any of our selected\n * features.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel coordinate to test for intersection.\n * @param {import(\"../PluggableMap.js\").default} map Map to test the intersection on.\n * @return {import(\"../Feature.js\").default} Returns the feature found at the specified pixel\n * coordinates.\n * @private\n */\n featuresAtPixel_(pixel, map) {\n return map.forEachFeatureAtPixel(\n pixel,\n function (feature, layer) {\n if (this.filter_(feature, layer)) {\n if (!this.features_ || includes(this.features_.getArray(), feature)) {\n return feature;\n }\n }\n }.bind(this),\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n }\n );\n }\n\n /**\n * Returns the Hit-detection tolerance.\n * @returns {number} Hit tolerance in pixels.\n * @api\n */\n getHitTolerance() {\n return this.hitTolerance_;\n }\n\n /**\n * Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @api\n */\n setHitTolerance(hitTolerance) {\n this.hitTolerance_ = hitTolerance;\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../PluggableMap.js\").default} map Map.\n */\n setMap(map) {\n const oldMap = this.getMap();\n super.setMap(map);\n this.updateState_(oldMap);\n }\n\n /**\n * @private\n */\n handleActiveChanged_() {\n this.updateState_(null);\n }\n\n /**\n * @param {import(\"../PluggableMap.js\").default} oldMap Old map.\n * @private\n */\n updateState_(oldMap) {\n let map = this.getMap();\n const active = this.getActive();\n if (!map || !active) {\n map = map || oldMap;\n if (map) {\n const elem = map.getViewport();\n elem.classList.remove('ol-grab', 'ol-grabbing');\n }\n }\n }\n}\n\nexport default Translate;\n","/**\n * @module ol/interaction\n */\nimport Collection from './Collection.js';\nimport DoubleClickZoom from './interaction/DoubleClickZoom.js';\nimport DragPan from './interaction/DragPan.js';\nimport DragRotate from './interaction/DragRotate.js';\nimport DragZoom from './interaction/DragZoom.js';\nimport KeyboardPan from './interaction/KeyboardPan.js';\nimport KeyboardZoom from './interaction/KeyboardZoom.js';\nimport Kinetic from './Kinetic.js';\nimport MouseWheelZoom from './interaction/MouseWheelZoom.js';\nimport PinchRotate from './interaction/PinchRotate.js';\nimport PinchZoom from './interaction/PinchZoom.js';\n\nexport {default as DoubleClickZoom} from './interaction/DoubleClickZoom.js';\nexport {default as DragAndDrop} from './interaction/DragAndDrop.js';\nexport {default as DragBox} from './interaction/DragBox.js';\nexport {default as DragPan} from './interaction/DragPan.js';\nexport {default as DragRotate} from './interaction/DragRotate.js';\nexport {default as DragRotateAndZoom} from './interaction/DragRotateAndZoom.js';\nexport {default as DragZoom} from './interaction/DragZoom.js';\nexport {default as Draw} from './interaction/Draw.js';\nexport {default as Extent} from './interaction/Extent.js';\nexport {default as Interaction} from './interaction/Interaction.js';\nexport {default as KeyboardPan} from './interaction/KeyboardPan.js';\nexport {default as KeyboardZoom} from './interaction/KeyboardZoom.js';\nexport {default as Modify} from './interaction/Modify.js';\nexport {default as MouseWheelZoom} from './interaction/MouseWheelZoom.js';\nexport {default as PinchRotate} from './interaction/PinchRotate.js';\nexport {default as PinchZoom} from './interaction/PinchZoom.js';\nexport {default as Pointer} from './interaction/Pointer.js';\nexport {default as Select} from './interaction/Select.js';\nexport {default as Snap} from './interaction/Snap.js';\nexport {default as Translate} from './interaction/Translate.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is\n * desired.\n * @property {boolean} [onFocusOnly=false] Interact only when the map has the\n * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is\n * useful when page scroll is desired for maps that do not have the browser's\n * focus.\n * @property {boolean} [doubleClickZoom=true] Whether double click zoom is\n * desired.\n * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.\n * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.\n * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.\n * @property {boolean} [dragPan=true] Whether drag pan is desired.\n * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.\n * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.\n * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.\n * @property {number} [zoomDuration] Duration of the zoom animation in\n * milliseconds.\n */\n\n/**\n * Set of interactions included in maps by default. Specific interactions can be\n * excluded by setting the appropriate option to false in the constructor\n * options, but the order of the interactions is fixed. If you want to specify\n * a different order for interactions, you will need to create your own\n * {@link module:ol/interaction/Interaction} instances and insert\n * them into a {@link module:ol/Collection} in the order you want\n * before creating your {@link module:ol/Map~Map} instance. Changing the order can\n * be of interest if the event propagation needs to be stopped at a point.\n * The default set of interactions, in sequence, is:\n * * {@link module:ol/interaction/DragRotate~DragRotate}\n * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}\n * * {@link module:ol/interaction/DragPan~DragPan}\n * * {@link module:ol/interaction/PinchRotate~PinchRotate}\n * * {@link module:ol/interaction/PinchZoom~PinchZoom}\n * * {@link module:ol/interaction/KeyboardPan~KeyboardPan}\n * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}\n * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}\n * * {@link module:ol/interaction/DragZoom~DragZoom}\n *\n * @param {DefaultsOptions=} opt_options Defaults options.\n * @return {import(\"./Collection.js\").default<import(\"./interaction/Interaction.js\").default>}\n * A collection of interactions to be used with the {@link module:ol/Map~Map}\n * constructor's `interactions` option.\n * @api\n */\nexport function defaults(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const interactions = new Collection();\n\n const kinetic = new Kinetic(-0.005, 0.05, 100);\n\n const altShiftDragRotate =\n options.altShiftDragRotate !== undefined\n ? options.altShiftDragRotate\n : true;\n if (altShiftDragRotate) {\n interactions.push(new DragRotate());\n }\n\n const doubleClickZoom =\n options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;\n if (doubleClickZoom) {\n interactions.push(\n new DoubleClickZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n })\n );\n }\n\n const dragPan = options.dragPan !== undefined ? options.dragPan : true;\n if (dragPan) {\n interactions.push(\n new DragPan({\n onFocusOnly: options.onFocusOnly,\n kinetic: kinetic,\n })\n );\n }\n\n const pinchRotate =\n options.pinchRotate !== undefined ? options.pinchRotate : true;\n if (pinchRotate) {\n interactions.push(new PinchRotate());\n }\n\n const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;\n if (pinchZoom) {\n interactions.push(\n new PinchZoom({\n duration: options.zoomDuration,\n })\n );\n }\n\n const keyboard = options.keyboard !== undefined ? options.keyboard : true;\n if (keyboard) {\n interactions.push(new KeyboardPan());\n interactions.push(\n new KeyboardZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n })\n );\n }\n\n const mouseWheelZoom =\n options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;\n if (mouseWheelZoom) {\n interactions.push(\n new MouseWheelZoom({\n onFocusOnly: options.onFocusOnly,\n duration: options.zoomDuration,\n })\n );\n }\n\n const shiftDragZoom =\n options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;\n if (shiftDragZoom) {\n interactions.push(\n new DragZoom({\n duration: options.zoomDuration,\n })\n );\n }\n\n return interactions;\n}\n","/**\n * @module ol/Map\n */\nimport CompositeMapRenderer from './renderer/Composite.js';\nimport PluggableMap from './PluggableMap.js';\nimport {assign} from './obj.js';\nimport {defaults as defaultControls} from './control.js';\nimport {defaults as defaultInteractions} from './interaction.js';\n\n/**\n * @classdesc\n * The map is the core component of OpenLayers. For a map to render, a view,\n * one or more layers, and a target container are needed:\n *\n * import Map from 'ol/Map';\n * import View from 'ol/View';\n * import TileLayer from 'ol/layer/Tile';\n * import OSM from 'ol/source/OSM';\n *\n * var map = new Map({\n * view: new View({\n * center: [0, 0],\n * zoom: 1\n * }),\n * layers: [\n * new TileLayer({\n * source: new OSM()\n * })\n * ],\n * target: 'map'\n * });\n *\n * The above snippet creates a map using a {@link module:ol/layer/Tile} to\n * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM\n * element with the id `map`.\n *\n * The constructor places a viewport container (with CSS class name\n * `ol-viewport`) in the target element (see `getViewport()`), and then two\n * further elements within the viewport: one with CSS class name\n * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with\n * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`\n * option of {@link module:ol/Overlay~Overlay} for the difference). The map\n * itself is placed in a further element within the viewport.\n *\n * Layers are stored as a {@link module:ol/Collection~Collection} in\n * layerGroups. A top-level group is provided by the library. This is what is\n * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the\n * options are added to this group, and `addLayer` and `removeLayer` change the\n * layer collection in the group. `getLayers` is a convenience function for\n * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~Group}\n * is a subclass of {@link module:ol/layer/Base}, so layers entered in the\n * options or added with `addLayer` can be groups, which can contain further\n * groups, and so on.\n *\n * @api\n */\nclass Map extends PluggableMap {\n /**\n * @param {import(\"./PluggableMap.js\").MapOptions} options Map options.\n */\n constructor(options) {\n options = assign({}, options);\n if (!options.controls) {\n options.controls = defaultControls();\n }\n if (!options.interactions) {\n options.interactions = defaultInteractions({\n onFocusOnly: true,\n });\n }\n\n super(options);\n }\n\n createRenderer() {\n return new CompositeMapRenderer(this);\n }\n}\n\nexport default Map;\n","/**\n * @module ol/structs/LRUCache\n */\n\nimport {assert} from '../asserts.js';\n\n/**\n * @typedef {Object} Entry\n * @property {string} key_\n * @property {Object} newer\n * @property {Object} older\n * @property {*} value_\n */\n\n/**\n * @classdesc\n * Implements a Least-Recently-Used cache where the keys do not conflict with\n * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring\n * items from the cache is the responsibility of the user.\n *\n * @fires import(\"../events/Event.js\").default\n * @template T\n */\nclass LRUCache {\n /**\n * @param {number=} opt_highWaterMark High water mark.\n */\n constructor(opt_highWaterMark) {\n /**\n * Desired max cache size after expireCache(). If set to 0, no cache entries\n * will be pruned at all.\n * @type {number}\n */\n this.highWaterMark =\n opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;\n\n /**\n * @private\n * @type {number}\n */\n this.count_ = 0;\n\n /**\n * @private\n * @type {!Object<string, Entry>}\n */\n this.entries_ = {};\n\n /**\n * @private\n * @type {?Entry}\n */\n this.oldest_ = null;\n\n /**\n * @private\n * @type {?Entry}\n */\n this.newest_ = null;\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n return this.highWaterMark > 0 && this.getCount() > this.highWaterMark;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.count_ = 0;\n this.entries_ = {};\n this.oldest_ = null;\n this.newest_ = null;\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Contains key.\n */\n containsKey(key) {\n return this.entries_.hasOwnProperty(key);\n }\n\n /**\n * @param {function(T, string, LRUCache<T>): ?} f The function\n * to call for every entry from the oldest to the newer. This function takes\n * 3 arguments (the entry value, the entry key and the LRUCache object).\n * The return value is ignored.\n */\n forEach(f) {\n let entry = this.oldest_;\n while (entry) {\n f(entry.value_, entry.key_, this);\n entry = entry.newer;\n }\n }\n\n /**\n * @param {string} key Key.\n * @param {*=} opt_options Options (reserverd for subclasses).\n * @return {T} Value.\n */\n get(key, opt_options) {\n const entry = this.entries_[key];\n assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache\n if (entry === this.newest_) {\n return entry.value_;\n } else if (entry === this.oldest_) {\n this.oldest_ = /** @type {Entry} */ (this.oldest_.newer);\n this.oldest_.older = null;\n } else {\n entry.newer.older = entry.older;\n entry.older.newer = entry.newer;\n }\n entry.newer = null;\n entry.older = this.newest_;\n this.newest_.newer = entry;\n this.newest_ = entry;\n return entry.value_;\n }\n\n /**\n * Remove an entry from the cache.\n * @param {string} key The entry key.\n * @return {T} The removed entry.\n */\n remove(key) {\n const entry = this.entries_[key];\n assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache\n if (entry === this.newest_) {\n this.newest_ = /** @type {Entry} */ (entry.older);\n if (this.newest_) {\n this.newest_.newer = null;\n }\n } else if (entry === this.oldest_) {\n this.oldest_ = /** @type {Entry} */ (entry.newer);\n if (this.oldest_) {\n this.oldest_.older = null;\n }\n } else {\n entry.newer.older = entry.older;\n entry.older.newer = entry.newer;\n }\n delete this.entries_[key];\n --this.count_;\n return entry.value_;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.count_;\n }\n\n /**\n * @return {Array<string>} Keys.\n */\n getKeys() {\n const keys = new Array(this.count_);\n let i = 0;\n let entry;\n for (entry = this.newest_; entry; entry = entry.older) {\n keys[i++] = entry.key_;\n }\n return keys;\n }\n\n /**\n * @return {Array<T>} Values.\n */\n getValues() {\n const values = new Array(this.count_);\n let i = 0;\n let entry;\n for (entry = this.newest_; entry; entry = entry.older) {\n values[i++] = entry.value_;\n }\n return values;\n }\n\n /**\n * @return {T} Last value.\n */\n peekLast() {\n return this.oldest_.value_;\n }\n\n /**\n * @return {string} Last key.\n */\n peekLastKey() {\n return this.oldest_.key_;\n }\n\n /**\n * Get the key of the newest item in the cache. Throws if the cache is empty.\n * @return {string} The newest key.\n */\n peekFirstKey() {\n return this.newest_.key_;\n }\n\n /**\n * @return {T} value Value.\n */\n pop() {\n const entry = this.oldest_;\n delete this.entries_[entry.key_];\n if (entry.newer) {\n entry.newer.older = null;\n }\n this.oldest_ = /** @type {Entry} */ (entry.newer);\n if (!this.oldest_) {\n this.newest_ = null;\n }\n --this.count_;\n return entry.value_;\n }\n\n /**\n * @param {string} key Key.\n * @param {T} value Value.\n */\n replace(key, value) {\n this.get(key); // update `newest_`\n this.entries_[key].value_ = value;\n }\n\n /**\n * @param {string} key Key.\n * @param {T} value Value.\n */\n set(key, value) {\n assert(!(key in this.entries_), 16); // Tried to set a value for a key that is used already\n const entry = {\n key_: key,\n newer: null,\n older: this.newest_,\n value_: value,\n };\n if (!this.newest_) {\n this.oldest_ = entry;\n } else {\n this.newest_.newer = entry;\n }\n this.newest_ = entry;\n this.entries_[key] = entry;\n ++this.count_;\n }\n\n /**\n * Set a maximum number of entries for the cache.\n * @param {number} size Cache size.\n * @api\n */\n setSize(size) {\n this.highWaterMark = size;\n }\n}\n\nexport default LRUCache;\n","/**\n * @module ol/tilecoord\n */\n\n/**\n * An array of three numbers representing the location of a tile in a tile\n * grid. The order is `z` (zoom level), `x` (column), and `y` (row).\n * @typedef {Array<number>} TileCoord\n * @api\n */\n\n/**\n * @param {number} z Z.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {TileCoord=} opt_tileCoord Tile coordinate.\n * @return {TileCoord} Tile coordinate.\n */\nexport function createOrUpdate(z, x, y, opt_tileCoord) {\n if (opt_tileCoord !== undefined) {\n opt_tileCoord[0] = z;\n opt_tileCoord[1] = x;\n opt_tileCoord[2] = y;\n return opt_tileCoord;\n } else {\n return [z, x, y];\n }\n}\n\n/**\n * @param {number} z Z.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {string} Key.\n */\nexport function getKeyZXY(z, x, y) {\n return z + '/' + x + '/' + y;\n}\n\n/**\n * Get the key for a tile coord.\n * @param {TileCoord} tileCoord The tile coord.\n * @return {string} Key.\n */\nexport function getKey(tileCoord) {\n return getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]);\n}\n\n/**\n * Get a tile coord given a key.\n * @param {string} key The tile coord key.\n * @return {TileCoord} The tile coord.\n */\nexport function fromKey(key) {\n return key.split('/').map(Number);\n}\n\n/**\n * @param {TileCoord} tileCoord Tile coord.\n * @return {number} Hash.\n */\nexport function hash(tileCoord) {\n return (tileCoord[1] << tileCoord[0]) + tileCoord[2];\n}\n\n/**\n * @param {TileCoord} tileCoord Tile coordinate.\n * @param {!import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {boolean} Tile coordinate is within extent and zoom level range.\n */\nexport function withinExtentAndZ(tileCoord, tileGrid) {\n const z = tileCoord[0];\n const x = tileCoord[1];\n const y = tileCoord[2];\n\n if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) {\n return false;\n }\n const extent = tileGrid.getExtent();\n let tileRange;\n if (!extent) {\n tileRange = tileGrid.getFullTileRange(z);\n } else {\n tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);\n }\n if (!tileRange) {\n return true;\n } else {\n return tileRange.containsXY(x, y);\n }\n}\n","/**\n * @module ol/TileCache\n */\nimport LRUCache from './structs/LRUCache.js';\nimport {fromKey, getKey} from './tilecoord.js';\n\nclass TileCache extends LRUCache {\n /**\n * @param {!Object<string, boolean>} usedTiles Used tiles.\n */\n expireCache(usedTiles) {\n while (this.canExpireCache()) {\n const tile = this.peekLast();\n if (tile.getKey() in usedTiles) {\n break;\n } else {\n this.pop().release();\n }\n }\n }\n\n /**\n * Prune all tiles from the cache that don't have the same z as the newest tile.\n */\n pruneExceptNewestZ() {\n if (this.getCount() === 0) {\n return;\n }\n const key = this.peekFirstKey();\n const tileCoord = fromKey(key);\n const z = tileCoord[0];\n this.forEach(\n function (tile) {\n if (tile.tileCoord[0] !== z) {\n this.remove(getKey(tile.tileCoord));\n tile.release();\n }\n }.bind(this)\n );\n }\n}\n\nexport default TileCache;\n","/**\n * @module ol/TileRange\n */\n\n/**\n * A representation of a contiguous block of tiles. A tile range is specified\n * by its min/max tile coordinates and is inclusive of coordinates.\n */\nclass TileRange {\n /**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n */\n constructor(minX, maxX, minY, maxY) {\n /**\n * @type {number}\n */\n this.minX = minX;\n\n /**\n * @type {number}\n */\n this.maxX = maxX;\n\n /**\n * @type {number}\n */\n this.minY = minY;\n\n /**\n * @type {number}\n */\n this.maxY = maxY;\n }\n\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {boolean} Contains tile coordinate.\n */\n contains(tileCoord) {\n return this.containsXY(tileCoord[1], tileCoord[2]);\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Contains.\n */\n containsTileRange(tileRange) {\n return (\n this.minX <= tileRange.minX &&\n tileRange.maxX <= this.maxX &&\n this.minY <= tileRange.minY &&\n tileRange.maxY <= this.maxY\n );\n }\n\n /**\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @return {boolean} Contains coordinate.\n */\n containsXY(x, y) {\n return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Equals.\n */\n equals(tileRange) {\n return (\n this.minX == tileRange.minX &&\n this.minY == tileRange.minY &&\n this.maxX == tileRange.maxX &&\n this.maxY == tileRange.maxY\n );\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n */\n extend(tileRange) {\n if (tileRange.minX < this.minX) {\n this.minX = tileRange.minX;\n }\n if (tileRange.maxX > this.maxX) {\n this.maxX = tileRange.maxX;\n }\n if (tileRange.minY < this.minY) {\n this.minY = tileRange.minY;\n }\n if (tileRange.maxY > this.maxY) {\n this.maxY = tileRange.maxY;\n }\n }\n\n /**\n * @return {number} Height.\n */\n getHeight() {\n return this.maxY - this.minY + 1;\n }\n\n /**\n * @return {import(\"./size.js\").Size} Size.\n */\n getSize() {\n return [this.getWidth(), this.getHeight()];\n }\n\n /**\n * @return {number} Width.\n */\n getWidth() {\n return this.maxX - this.minX + 1;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Intersects.\n */\n intersects(tileRange) {\n return (\n this.minX <= tileRange.maxX &&\n this.maxX >= tileRange.minX &&\n this.minY <= tileRange.maxY &&\n this.maxY >= tileRange.minY\n );\n }\n}\n\n/**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n * @param {TileRange=} tileRange TileRange.\n * @return {TileRange} Tile range.\n */\nexport function createOrUpdate(minX, maxX, minY, maxY, tileRange) {\n if (tileRange !== undefined) {\n tileRange.minX = minX;\n tileRange.maxX = maxX;\n tileRange.minY = minY;\n tileRange.maxY = maxY;\n return tileRange;\n } else {\n return new TileRange(minX, maxX, minY, maxY);\n }\n}\n\nexport default TileRange;\n","/**\n * @module ol/VectorRenderTile\n */\nimport Tile from './Tile.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {getUid} from './util.js';\n\n/**\n * @typedef {Object} ReplayState\n * @property {boolean} dirty\n * @property {null|import(\"./render.js\").OrderFunction} renderedRenderOrder\n * @property {number} renderedTileRevision\n * @property {number} renderedResolution\n * @property {number} renderedRevision\n * @property {number} renderedZ\n * @property {number} renderedTileResolution\n * @property {number} renderedTileZ\n */\n\n/**\n * @type {Array<HTMLCanvasElement>}\n */\nconst canvasPool = [];\n\nclass VectorRenderTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {import(\"./tilecoord.js\").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.\n * @param {function(VectorRenderTile):Array<import(\"./VectorTile\").default>} getSourceTiles Function\n * to get source tiles for this tile.\n */\n constructor(tileCoord, state, urlTileCoord, getSourceTiles) {\n super(tileCoord, state, {transition: 0});\n\n /**\n * @private\n * @type {!Object<string, CanvasRenderingContext2D>}\n */\n this.context_ = {};\n\n /**\n * Executor groups by layer uid. Entries are read/written by the renderer.\n * @type {Object<string, Array<import(\"./render/canvas/ExecutorGroup.js\").default>>}\n */\n this.executorGroups = {};\n\n /**\n * Number of loading source tiles. Read/written by the source.\n * @type {number}\n */\n this.loadingSourceTiles = 0;\n\n /**\n * Tile keys of error source tiles. Read/written by the source.\n * @type {Object<string, boolean>}\n */\n this.errorSourceTileKeys = {};\n\n /**\n * @type {Object<number, ImageData>}\n */\n this.hitDetectionImageData = {};\n\n /**\n * @private\n * @type {!Object<string, ReplayState>}\n */\n this.replayState_ = {};\n\n /**\n * @type {Array<import(\"./VectorTile.js\").default>}\n */\n this.sourceTiles = null;\n\n /**\n * @type {number}\n */\n this.wantedResolution;\n\n /**\n * @type {!function():Array<import(\"./VectorTile.js\").default>}\n */\n this.getSourceTiles = getSourceTiles.bind(undefined, this);\n\n /**\n * z of the source tiles of the last getSourceTiles call.\n * @type {number}\n */\n this.sourceZ = -1;\n\n /**\n * True when all tiles for this tile's nominal resolution are available.\n * @type {boolean}\n */\n this.hifi = false;\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.wrappedTileCoord = urlTileCoord;\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {CanvasRenderingContext2D} The rendering context.\n */\n getContext(layer) {\n const key = getUid(layer);\n if (!(key in this.context_)) {\n this.context_[key] = createCanvasContext2D(1, 1, canvasPool);\n }\n return this.context_[key];\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {boolean} Tile has a rendering context for the given layer.\n */\n hasContext(layer) {\n return getUid(layer) in this.context_;\n }\n\n /**\n * Get the Canvas for this tile.\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {HTMLCanvasElement} Canvas.\n */\n getImage(layer) {\n return this.hasContext(layer) ? this.getContext(layer).canvas : null;\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {ReplayState} The replay state.\n */\n getReplayState(layer) {\n const key = getUid(layer);\n if (!(key in this.replayState_)) {\n this.replayState_[key] = {\n dirty: false,\n renderedRenderOrder: null,\n renderedResolution: NaN,\n renderedRevision: -1,\n renderedTileResolution: NaN,\n renderedTileRevision: -1,\n renderedZ: -1,\n renderedTileZ: -1,\n };\n }\n return this.replayState_[key];\n }\n\n /**\n * Load the tile.\n */\n load() {\n this.getSourceTiles();\n }\n\n /**\n * Remove from the cache due to expiry\n */\n release() {\n for (const key in this.context_) {\n canvasPool.push(this.context_[key].canvas);\n }\n super.release();\n }\n}\n\nexport default VectorRenderTile;\n","/**\n * @module ol/VectorTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\n\nclass VectorTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Data source url.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options=} opt_options Tile options.\n */\n constructor(tileCoord, state, src, format, tileLoadFunction, opt_options) {\n super(tileCoord, state, opt_options);\n\n /**\n * Extent of this tile; set by the source.\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = null;\n\n /**\n * @private\n * @type {import(\"./format/Feature.js\").default}\n */\n this.format_ = format;\n\n /**\n * @private\n * @type {Array<import(\"./Feature.js\").default>}\n */\n this.features_ = null;\n\n /**\n * @private\n * @type {import(\"./featureloader.js\").FeatureLoader}\n */\n this.loader_;\n\n /**\n * Feature projection of this tile; set by the source.\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection = null;\n\n /**\n * Resolution of this tile; set by the source.\n * @type {number}\n */\n this.resolution;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n\n /**\n * @private\n * @type {string}\n */\n this.url_ = src;\n }\n\n /**\n * Get the feature format assigned for reading this tile's features.\n * @return {import(\"./format/Feature.js\").default} Feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * Get the features for this tile. Geometries will be in the view projection.\n * @return {Array<import(\"./Feature.js\").FeatureLike>} Features.\n * @api\n */\n getFeatures() {\n return this.features_;\n }\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.url_;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == TileState.IDLE) {\n this.setState(TileState.LOADING);\n this.tileLoadFunction_(this, this.url_);\n if (this.loader_) {\n this.loader_(this.extent, this.resolution, this.projection);\n }\n }\n }\n\n /**\n * Handler for successful tile load.\n * @param {Array<import(\"./Feature.js\").default>} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data projection.\n */\n onLoad(features, dataProjection) {\n this.setFeatures(features);\n }\n\n /**\n * Handler for tile load errors.\n */\n onError() {\n this.setState(TileState.ERROR);\n }\n\n /**\n * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.\n * Sets the features for the tile.\n * @param {Array<import(\"./Feature.js\").default>} features Features.\n * @api\n */\n setFeatures(features) {\n this.features_ = features;\n this.setState(TileState.LOADED);\n }\n\n /**\n * Set the feature loader for reading this tile's features.\n * @param {import(\"./featureloader.js\").FeatureLoader} loader Feature loader.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n}\n\nexport default VectorTile;\n","/**\n * @module ol\n */\n\nexport {default as AssertionError} from './AssertionError.js';\nexport {default as Collection} from './Collection.js';\nexport {default as Disposable} from './Disposable.js';\nexport {default as Feature} from './Feature.js';\nexport {default as Geolocation} from './Geolocation.js';\nexport {default as Graticule} from './layer/Graticule.js';\nexport {default as Image} from './Image.js';\nexport {default as ImageBase} from './ImageBase.js';\nexport {default as ImageCanvas} from './ImageCanvas.js';\nexport {default as ImageTile} from './ImageTile.js';\nexport {default as Kinetic} from './Kinetic.js';\nexport {default as Map} from './Map.js';\nexport {default as MapBrowserEvent} from './MapBrowserEvent.js';\nexport {default as MapBrowserEventHandler} from './MapBrowserEventHandler.js';\nexport {default as MapEvent} from './MapEvent.js';\nexport {default as Object} from './Object.js';\nexport {default as Observable} from './Observable.js';\nexport {default as Overlay} from './Overlay.js';\nexport {default as PluggableMap} from './PluggableMap.js';\nexport {default as Tile} from './Tile.js';\nexport {default as TileCache} from './TileCache.js';\nexport {default as TileQueue} from './TileQueue.js';\nexport {default as TileRange} from './TileRange.js';\nexport {default as VectorRenderTile} from './VectorRenderTile.js';\nexport {default as VectorTile} from './VectorTile.js';\nexport {default as View} from './View.js';\n\nexport {getUid, VERSION} from './util.js';\n","/**\n * @module ol/layer/TileProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n PRELOAD: 'preload',\n USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError',\n};\n","/**\n * @module ol/layer/BaseTile\n */\nimport Layer from './Layer.js';\nimport TileProperty from './TileProperty.js';\nimport {assign} from '../obj.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {import(\"../source/Tile.js\").default} [source] Source for this layer.\n * @property {import(\"../PluggableMap.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link module:ol/Map#addLayer}.\n * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.\n */\n\n/**\n * @classdesc\n * For layer sources that provide pre-rendered, tiled images in grids that are\n * organized by zoom levels for specific resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @extends {Layer<import(\"../source/Tile.js\").default>}\n * @api\n */\nclass BaseTileLayer extends Layer {\n /**\n * @param {Options=} opt_options Tile layer options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n const baseOptions = assign({}, options);\n\n delete baseOptions.preload;\n delete baseOptions.useInterimTilesOnError;\n super(baseOptions);\n\n this.setPreload(options.preload !== undefined ? options.preload : 0);\n this.setUseInterimTilesOnError(\n options.useInterimTilesOnError !== undefined\n ? options.useInterimTilesOnError\n : true\n );\n }\n\n /**\n * Return the level as number to which we will preload tiles up to.\n * @return {number} The level to preload tiles up to.\n * @observable\n * @api\n */\n getPreload() {\n return /** @type {number} */ (this.get(TileProperty.PRELOAD));\n }\n\n /**\n * Set the level as number to which we will preload tiles up to.\n * @param {number} preload The level to preload tiles up to.\n * @observable\n * @api\n */\n setPreload(preload) {\n this.set(TileProperty.PRELOAD, preload);\n }\n\n /**\n * Whether we use interim tiles on error.\n * @return {boolean} Use interim tiles on error.\n * @observable\n * @api\n */\n getUseInterimTilesOnError() {\n return /** @type {boolean} */ (this.get(\n TileProperty.USE_INTERIM_TILES_ON_ERROR\n ));\n }\n\n /**\n * Set whether we use interim tiles on error.\n * @param {boolean} useInterimTilesOnError Use interim tiles on error.\n * @observable\n * @api\n */\n setUseInterimTilesOnError(useInterimTilesOnError) {\n this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);\n }\n}\n\nexport default BaseTileLayer;\n","/**\n * @module ol/renderer/canvas/TileLayer\n */\nimport CanvasLayerRenderer from './Layer.js';\nimport TileRange from '../../TileRange.js';\nimport TileState from '../../TileState.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n makeInverse,\n} from '../../transform.js';\nimport {assign} from '../../obj.js';\nimport {\n createEmpty,\n equals,\n getIntersection,\n getTopLeft,\n} from '../../extent.js';\nimport {createTransformString} from '../../render/canvas.js';\nimport {fromUserExtent} from '../../proj.js';\nimport {getUid} from '../../util.js';\nimport {numberSafeCompareFunction} from '../../array.js';\n\n/**\n * @classdesc\n * Canvas renderer for tile layers.\n * @api\n */\nclass CanvasTileLayerRenderer extends CanvasLayerRenderer {\n /**\n * @param {import(\"../../layer/Tile.js\").default|import(\"../../layer/VectorTile.js\").default} tileLayer Tile layer.\n */\n constructor(tileLayer) {\n super(tileLayer);\n\n /**\n * Rendered extent has changed since the previous `renderFrame()` call\n * @type {boolean}\n */\n this.extentChanged = true;\n\n /**\n * @private\n * @type {?import(\"../../extent.js\").Extent}\n */\n this.renderedExtent_ = null;\n\n /**\n * @protected\n * @type {number}\n */\n this.renderedPixelRatio;\n\n /**\n * @protected\n * @type {import(\"../../proj/Projection.js\").default}\n */\n this.renderedProjection = null;\n\n /**\n * @protected\n * @type {number}\n */\n this.renderedRevision;\n\n /**\n * @protected\n * @type {!Array<import(\"../../Tile.js\").default>}\n */\n this.renderedTiles = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.newTiles_ = false;\n\n /**\n * @protected\n * @type {import(\"../../extent.js\").Extent}\n */\n this.tmpExtent = createEmpty();\n\n /**\n * @private\n * @type {import(\"../../TileRange.js\").default}\n */\n this.tmpTileRange_ = new TileRange(0, 0, 0, 0);\n }\n\n /**\n * @protected\n * @param {import(\"../../Tile.js\").default} tile Tile.\n * @return {boolean} Tile is drawable.\n */\n isDrawableTile(tile) {\n const tileLayer = this.getLayer();\n const tileState = tile.getState();\n const useInterimTilesOnError = tileLayer.getUseInterimTilesOnError();\n return (\n tileState == TileState.LOADED ||\n tileState == TileState.EMPTY ||\n (tileState == TileState.ERROR && !useInterimTilesOnError)\n );\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @return {!import(\"../../Tile.js\").default} Tile.\n */\n getTile(z, x, y, frameState) {\n const pixelRatio = frameState.pixelRatio;\n const projection = frameState.viewState.projection;\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getSource();\n let tile = tileSource.getTile(z, x, y, pixelRatio, projection);\n if (tile.getState() == TileState.ERROR) {\n if (!tileLayer.getUseInterimTilesOnError()) {\n // When useInterimTilesOnError is false, we consider the error tile as loaded.\n tile.setState(TileState.LOADED);\n } else if (tileLayer.getPreload() > 0) {\n // Preloaded tiles for lower resolutions might have finished loading.\n this.newTiles_ = true;\n }\n }\n if (!this.isDrawableTile(tile)) {\n tile = tile.getInterimTile();\n }\n return tile;\n }\n\n /**\n * @param {Object<number, Object<string, import(\"../../Tile.js\").default>>} tiles Lookup of loaded tiles by zoom level.\n * @param {number} zoom Zoom level.\n * @param {import(\"../../Tile.js\").default} tile Tile.\n * @return {boolean|void} If `false`, the tile will not be considered loaded.\n */\n loadedTileCallback(tiles, zoom, tile) {\n if (this.isDrawableTile(tile)) {\n return super.loadedTileCallback(tiles, zoom, tile);\n }\n return false;\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n */\n prepareFrame(frameState) {\n return !!this.getLayer().getSource();\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n */\n renderFrame(frameState, target) {\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const viewState = frameState.viewState;\n const projection = viewState.projection;\n const viewResolution = viewState.resolution;\n const viewCenter = viewState.center;\n const rotation = viewState.rotation;\n const pixelRatio = frameState.pixelRatio;\n\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getSource();\n const sourceRevision = tileSource.getRevision();\n const tileGrid = tileSource.getTileGridForProjection(projection);\n const z = tileGrid.getZForResolution(viewResolution, tileSource.zDirection);\n const tileResolution = tileGrid.getResolution(z);\n\n let extent = frameState.extent;\n const layerExtent =\n layerState.extent && fromUserExtent(layerState.extent, projection);\n if (layerExtent) {\n extent = getIntersection(\n extent,\n fromUserExtent(layerState.extent, projection)\n );\n }\n\n const tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio);\n\n // desired dimensions of the canvas in pixels\n let width = Math.round(frameState.size[0] * tilePixelRatio);\n let height = Math.round(frameState.size[1] * tilePixelRatio);\n\n if (rotation) {\n const size = Math.round(Math.sqrt(width * width + height * height));\n width = size;\n height = size;\n }\n\n const dx = (tileResolution * width) / 2 / tilePixelRatio;\n const dy = (tileResolution * height) / 2 / tilePixelRatio;\n const canvasExtent = [\n viewCenter[0] - dx,\n viewCenter[1] - dy,\n viewCenter[0] + dx,\n viewCenter[1] + dy,\n ];\n\n const tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);\n\n /**\n * @type {Object<number, Object<string, import(\"../../Tile.js\").default>>}\n */\n const tilesToDrawByZ = {};\n tilesToDrawByZ[z] = {};\n\n const findLoadedTiles = this.createLoadedTileFinder(\n tileSource,\n projection,\n tilesToDrawByZ\n );\n\n const tmpExtent = this.tmpExtent;\n const tmpTileRange = this.tmpTileRange_;\n this.newTiles_ = false;\n for (let x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (let y = tileRange.minY; y <= tileRange.maxY; ++y) {\n const tile = this.getTile(z, x, y, frameState);\n if (this.isDrawableTile(tile)) {\n const uid = getUid(this);\n if (tile.getState() == TileState.LOADED) {\n tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;\n const inTransition = tile.inTransition(uid);\n if (\n !this.newTiles_ &&\n (inTransition || this.renderedTiles.indexOf(tile) === -1)\n ) {\n this.newTiles_ = true;\n }\n }\n if (tile.getAlpha(uid, frameState.time) === 1) {\n // don't look for alt tiles if alpha is 1\n continue;\n }\n }\n\n const childTileRange = tileGrid.getTileCoordChildTileRange(\n tile.tileCoord,\n tmpTileRange,\n tmpExtent\n );\n\n let covered = false;\n if (childTileRange) {\n covered = findLoadedTiles(z + 1, childTileRange);\n }\n if (!covered) {\n tileGrid.forEachTileCoordParentTileRange(\n tile.tileCoord,\n findLoadedTiles,\n tmpTileRange,\n tmpExtent\n );\n }\n }\n }\n\n const canvasScale = tileResolution / viewResolution;\n\n // set forward and inverse pixel transforms\n composeTransform(\n this.pixelTransform,\n frameState.size[0] / 2,\n frameState.size[1] / 2,\n 1 / tilePixelRatio,\n 1 / tilePixelRatio,\n rotation,\n -width / 2,\n -height / 2\n );\n\n const canvasTransform = createTransformString(this.pixelTransform);\n\n this.useContainer(target, canvasTransform, layerState.opacity);\n const context = this.context;\n const canvas = context.canvas;\n\n makeInverse(this.inversePixelTransform, this.pixelTransform);\n\n // set scale transform for calculating tile positions on the canvas\n composeTransform(\n this.tempTransform,\n width / 2,\n height / 2,\n canvasScale,\n canvasScale,\n 0,\n -width / 2,\n -height / 2\n );\n\n if (canvas.width != width || canvas.height != height) {\n canvas.width = width;\n canvas.height = height;\n } else if (!this.containerReused) {\n context.clearRect(0, 0, width, height);\n }\n\n if (layerExtent) {\n this.clipUnrotated(context, frameState, layerExtent);\n }\n\n assign(context, tileSource.getContextOptions());\n this.preRender(context, frameState);\n\n this.renderedTiles.length = 0;\n /** @type {Array<number>} */\n let zs = Object.keys(tilesToDrawByZ).map(Number);\n zs.sort(numberSafeCompareFunction);\n\n let clips, clipZs, currentClip;\n if (\n layerState.opacity === 1 &&\n (!this.containerReused ||\n tileSource.getOpaque(frameState.viewState.projection))\n ) {\n zs = zs.reverse();\n } else {\n clips = [];\n clipZs = [];\n }\n for (let i = zs.length - 1; i >= 0; --i) {\n const currentZ = zs[i];\n const currentTilePixelSize = tileSource.getTilePixelSize(\n currentZ,\n pixelRatio,\n projection\n );\n const currentResolution = tileGrid.getResolution(currentZ);\n const currentScale = currentResolution / tileResolution;\n const dx = currentTilePixelSize[0] * currentScale * canvasScale;\n const dy = currentTilePixelSize[1] * currentScale * canvasScale;\n const originTileCoord = tileGrid.getTileCoordForCoordAndZ(\n getTopLeft(canvasExtent),\n currentZ\n );\n const originTileExtent = tileGrid.getTileCoordExtent(originTileCoord);\n const origin = applyTransform(this.tempTransform, [\n (tilePixelRatio * (originTileExtent[0] - canvasExtent[0])) /\n tileResolution,\n (tilePixelRatio * (canvasExtent[3] - originTileExtent[3])) /\n tileResolution,\n ]);\n const tileGutter =\n tilePixelRatio * tileSource.getGutterForProjection(projection);\n const tilesToDraw = tilesToDrawByZ[currentZ];\n for (const tileCoordKey in tilesToDraw) {\n const tile = /** @type {import(\"../../ImageTile.js\").default} */ (tilesToDraw[\n tileCoordKey\n ]);\n const tileCoord = tile.tileCoord;\n\n // Calculate integer positions and sizes so that tiles align\n const floatX = origin[0] - (originTileCoord[1] - tileCoord[1]) * dx;\n const nextX = Math.round(floatX + dx);\n const floatY = origin[1] - (originTileCoord[2] - tileCoord[2]) * dy;\n const nextY = Math.round(floatY + dy);\n const x = Math.round(floatX);\n const y = Math.round(floatY);\n const w = nextX - x;\n const h = nextY - y;\n const transition = z === currentZ;\n\n const inTransition =\n transition && tile.getAlpha(getUid(this), frameState.time) !== 1;\n if (!inTransition) {\n if (clips) {\n // Clip mask for regions in this tile that already filled by a higher z tile\n context.save();\n currentClip = [x, y, x + w, y, x + w, y + h, x, y + h];\n for (let i = 0, ii = clips.length; i < ii; ++i) {\n if (z !== currentZ && currentZ < clipZs[i]) {\n const clip = clips[i];\n context.beginPath();\n // counter-clockwise (outer ring) for current tile\n context.moveTo(currentClip[0], currentClip[1]);\n context.lineTo(currentClip[2], currentClip[3]);\n context.lineTo(currentClip[4], currentClip[5]);\n context.lineTo(currentClip[6], currentClip[7]);\n // clockwise (inner ring) for higher z tile\n context.moveTo(clip[6], clip[7]);\n context.lineTo(clip[4], clip[5]);\n context.lineTo(clip[2], clip[3]);\n context.lineTo(clip[0], clip[1]);\n context.clip();\n }\n }\n clips.push(currentClip);\n clipZs.push(currentZ);\n } else {\n context.clearRect(x, y, w, h);\n }\n }\n this.drawTileImage(\n tile,\n frameState,\n x,\n y,\n w,\n h,\n tileGutter,\n transition,\n layerState.opacity\n );\n if (clips && !inTransition) {\n context.restore();\n }\n this.renderedTiles.push(tile);\n this.updateUsedTiles(frameState.usedTiles, tileSource, tile);\n }\n }\n\n this.renderedRevision = sourceRevision;\n this.renderedResolution = tileResolution;\n this.extentChanged =\n !this.renderedExtent_ || !equals(this.renderedExtent_, canvasExtent);\n this.renderedExtent_ = canvasExtent;\n this.renderedPixelRatio = pixelRatio;\n this.renderedProjection = projection;\n\n this.manageTilePyramid(\n frameState,\n tileSource,\n tileGrid,\n pixelRatio,\n projection,\n extent,\n z,\n tileLayer.getPreload()\n );\n this.scheduleExpireCache(frameState, tileSource);\n\n this.postRender(context, frameState);\n\n if (layerState.extent) {\n context.restore();\n }\n\n if (canvasTransform !== canvas.style.transform) {\n canvas.style.transform = canvasTransform;\n }\n\n return this.container;\n }\n\n /**\n * @param {import(\"../../ImageTile.js\").default} tile Tile.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {number} x Left of the tile.\n * @param {number} y Top of the tile.\n * @param {number} w Width of the tile.\n * @param {number} h Height of the tile.\n * @param {number} gutter Tile gutter.\n * @param {boolean} transition Apply an alpha transition.\n * @param {number} opacity Opacity.\n */\n drawTileImage(tile, frameState, x, y, w, h, gutter, transition, opacity) {\n const image = this.getTileImage(tile);\n if (!image) {\n return;\n }\n const uid = getUid(this);\n const tileAlpha = transition ? tile.getAlpha(uid, frameState.time) : 1;\n const alpha = opacity * tileAlpha;\n const alphaChanged = alpha !== this.context.globalAlpha;\n if (alphaChanged) {\n this.context.save();\n this.context.globalAlpha = alpha;\n }\n this.context.drawImage(\n image,\n gutter,\n gutter,\n image.width - 2 * gutter,\n image.height - 2 * gutter,\n x,\n y,\n w,\n h\n );\n\n if (alphaChanged) {\n this.context.restore();\n }\n if (tileAlpha !== 1) {\n frameState.animate = true;\n } else if (transition) {\n tile.endTransition(uid);\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Image\n */\n getImage() {\n const context = this.context;\n return context ? context.canvas : null;\n }\n\n /**\n * Get the image from a tile.\n * @param {import(\"../../ImageTile.js\").default} tile Tile.\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @protected\n */\n getTileImage(tile) {\n return tile.getImage();\n }\n\n /**\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {import(\"../../source/Tile.js\").default} tileSource Tile source.\n * @protected\n */\n scheduleExpireCache(frameState, tileSource) {\n if (tileSource.canExpireCache()) {\n /**\n * @param {import(\"../../source/Tile.js\").default} tileSource Tile source.\n * @param {import(\"../../PluggableMap.js\").default} map Map.\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n */\n const postRenderFunction = function (tileSource, map, frameState) {\n const tileSourceKey = getUid(tileSource);\n if (tileSourceKey in frameState.usedTiles) {\n tileSource.expireCache(\n frameState.viewState.projection,\n frameState.usedTiles[tileSourceKey]\n );\n }\n }.bind(null, tileSource);\n\n frameState.postRenderFunctions.push(\n /** @type {import(\"../../PluggableMap.js\").PostRenderFunction} */ (postRenderFunction)\n );\n }\n }\n\n /**\n * @param {!Object<string, !Object<string, boolean>>} usedTiles Used tiles.\n * @param {import(\"../../source/Tile.js\").default} tileSource Tile source.\n * @param {import('../../Tile.js').default} tile Tile.\n * @protected\n */\n updateUsedTiles(usedTiles, tileSource, tile) {\n // FIXME should we use tilesToDrawByZ instead?\n const tileSourceKey = getUid(tileSource);\n if (!(tileSourceKey in usedTiles)) {\n usedTiles[tileSourceKey] = {};\n }\n usedTiles[tileSourceKey][tile.getKey()] = true;\n }\n\n /**\n * Manage tile pyramid.\n * This function performs a number of functions related to the tiles at the\n * current zoom and lower zoom levels:\n * - registers idle tiles in frameState.wantedTiles so that they are not\n * discarded by the tile queue\n * - enqueues missing tiles\n * @param {import(\"../../PluggableMap.js\").FrameState} frameState Frame state.\n * @param {import(\"../../source/Tile.js\").default} tileSource Tile source.\n * @param {import(\"../../tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {number} currentZ Current Z.\n * @param {number} preload Load low resolution tiles up to 'preload' levels.\n * @param {function(import(\"../../Tile.js\").default)=} opt_tileCallback Tile callback.\n * @protected\n */\n manageTilePyramid(\n frameState,\n tileSource,\n tileGrid,\n pixelRatio,\n projection,\n extent,\n currentZ,\n preload,\n opt_tileCallback\n ) {\n const tileSourceKey = getUid(tileSource);\n if (!(tileSourceKey in frameState.wantedTiles)) {\n frameState.wantedTiles[tileSourceKey] = {};\n }\n const wantedTiles = frameState.wantedTiles[tileSourceKey];\n const tileQueue = frameState.tileQueue;\n const minZoom = tileGrid.getMinZoom();\n let tileCount = 0;\n let tile, tileRange, tileResolution, x, y, z;\n for (z = minZoom; z <= currentZ; ++z) {\n tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z, tileRange);\n tileResolution = tileGrid.getResolution(z);\n for (x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (y = tileRange.minY; y <= tileRange.maxY; ++y) {\n if (currentZ - z <= preload) {\n ++tileCount;\n tile = tileSource.getTile(z, x, y, pixelRatio, projection);\n if (tile.getState() == TileState.IDLE) {\n wantedTiles[tile.getKey()] = true;\n if (!tileQueue.isKeyQueued(tile.getKey())) {\n tileQueue.enqueue([\n tile,\n tileSourceKey,\n tileGrid.getTileCoordCenter(tile.tileCoord),\n tileResolution,\n ]);\n }\n }\n if (opt_tileCallback !== undefined) {\n opt_tileCallback(tile);\n }\n } else {\n tileSource.useTile(z, x, y, projection);\n }\n }\n }\n }\n tileSource.updateCacheSize(tileCount, projection);\n }\n}\n\n/**\n * @function\n * @return {import(\"../../layer/Tile.js\").default|import(\"../../layer/VectorTile.js\").default}\n */\nCanvasTileLayerRenderer.prototype.getLayer;\n\nexport default CanvasTileLayerRenderer;\n","/**\n * @module ol/layer/Tile\n */\nimport BaseTileLayer from './BaseTile.js';\nimport CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js';\n\n/**\n * @classdesc\n * For layer sources that provide pre-rendered, tiled images in grids that are\n * organized by zoom levels for specific resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @api\n */\nclass TileLayer extends BaseTileLayer {\n /**\n * @param {import(\"./BaseTile.js\").Options=} opt_options Tile layer options.\n */\n constructor(opt_options) {\n super(opt_options);\n }\n\n /**\n * Create a renderer for this layer.\n * @return {import(\"../renderer/Layer.js\").default} A layer renderer.\n * @protected\n */\n createRenderer() {\n return new CanvasTileLayerRenderer(this);\n }\n}\n\nexport default TileLayer;\n","/**\n * @module ol/reproj/common\n */\n\n/**\n * Default maximum allowed threshold (in pixels) for reprojection\n * triangulation.\n * @type {number}\n */\nexport const ERROR_THRESHOLD = 0.5;\n\n/**\n * Enable automatic reprojection of raster sources. Default is `true`.\n * TODO: decide if we want to expose this as a build flag or remove it\n * @type {boolean}\n */\nexport const ENABLE_RASTER_REPROJECTION = true;\n","/**\n * @module ol/reproj/Triangulation\n */\nimport {\n boundingExtent,\n createEmpty,\n extendCoordinate,\n getArea,\n getBottomLeft,\n getBottomRight,\n getTopLeft,\n getTopRight,\n getWidth,\n intersects,\n} from '../extent.js';\nimport {getTransform} from '../proj.js';\nimport {log2, modulo} from '../math.js';\n\n/**\n * Single triangle; consists of 3 source points and 3 target points.\n * @typedef {Object} Triangle\n * @property {Array<import(\"../coordinate.js\").Coordinate>} source\n * @property {Array<import(\"../coordinate.js\").Coordinate>} target\n */\n\n/**\n * Maximum number of subdivision steps during raster reprojection triangulation.\n * Prevents high memory usage and large number of proj4 calls (for certain\n * transformations and areas). At most `2*(2^this)` triangles are created for\n * each triangulated extent (tile/image).\n * @type {number}\n */\nconst MAX_SUBDIVISION = 10;\n\n/**\n * Maximum allowed size of triangle relative to world width. When transforming\n * corners of world extent between certain projections, the resulting\n * triangulation seems to have zero error and no subdivision is performed. If\n * the triangle width is more than this (relative to world width; 0-1),\n * subdivison is forced (up to `MAX_SUBDIVISION`). Default is `0.25`.\n * @type {number}\n */\nconst MAX_TRIANGLE_WIDTH = 0.25;\n\n/**\n * @classdesc\n * Class containing triangulation of the given target extent.\n * Used for determining source data and the reprojection itself.\n */\nclass Triangulation {\n /**\n * @param {import(\"../proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"../proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"../extent.js\").Extent} targetExtent Target extent to triangulate.\n * @param {import(\"../extent.js\").Extent} maxSourceExtent Maximal source extent that can be used.\n * @param {number} errorThreshold Acceptable error (in source units).\n * @param {?number} opt_destinationResolution The (optional) resolution of the destination.\n */\n constructor(\n sourceProj,\n targetProj,\n targetExtent,\n maxSourceExtent,\n errorThreshold,\n opt_destinationResolution\n ) {\n /**\n * @type {import(\"../proj/Projection.js\").default}\n * @private\n */\n this.sourceProj_ = sourceProj;\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n * @private\n */\n this.targetProj_ = targetProj;\n\n /** @type {!Object<string, import(\"../coordinate.js\").Coordinate>} */\n let transformInvCache = {};\n const transformInv = getTransform(this.targetProj_, this.sourceProj_);\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} c A coordinate.\n * @return {import(\"../coordinate.js\").Coordinate} Transformed coordinate.\n * @private\n */\n this.transformInv_ = function (c) {\n const key = c[0] + '/' + c[1];\n if (!transformInvCache[key]) {\n transformInvCache[key] = transformInv(c);\n }\n return transformInvCache[key];\n };\n\n /**\n * @type {import(\"../extent.js\").Extent}\n * @private\n */\n this.maxSourceExtent_ = maxSourceExtent;\n\n /**\n * @type {number}\n * @private\n */\n this.errorThresholdSquared_ = errorThreshold * errorThreshold;\n\n /**\n * @type {Array<Triangle>}\n * @private\n */\n this.triangles_ = [];\n\n /**\n * Indicates that the triangulation crosses edge of the source projection.\n * @type {boolean}\n * @private\n */\n this.wrapsXInSource_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.canWrapXInSource_ =\n this.sourceProj_.canWrapX() &&\n !!maxSourceExtent &&\n !!this.sourceProj_.getExtent() &&\n getWidth(maxSourceExtent) == getWidth(this.sourceProj_.getExtent());\n\n /**\n * @type {?number}\n * @private\n */\n this.sourceWorldWidth_ = this.sourceProj_.getExtent()\n ? getWidth(this.sourceProj_.getExtent())\n : null;\n\n /**\n * @type {?number}\n * @private\n */\n this.targetWorldWidth_ = this.targetProj_.getExtent()\n ? getWidth(this.targetProj_.getExtent())\n : null;\n\n const destinationTopLeft = getTopLeft(targetExtent);\n const destinationTopRight = getTopRight(targetExtent);\n const destinationBottomRight = getBottomRight(targetExtent);\n const destinationBottomLeft = getBottomLeft(targetExtent);\n const sourceTopLeft = this.transformInv_(destinationTopLeft);\n const sourceTopRight = this.transformInv_(destinationTopRight);\n const sourceBottomRight = this.transformInv_(destinationBottomRight);\n const sourceBottomLeft = this.transformInv_(destinationBottomLeft);\n\n /*\n * The maxSubdivision controls how many splittings of the target area can\n * be done. The idea here is to do a linear mapping of the target areas\n * but the actual overal reprojection (can be) extremely non-linear. The\n * default value of MAX_SUBDIVISION was chosen based on mapping a 256x256\n * tile size. However this function is also called to remap canvas rendered\n * layers which can be much larger. This calculation increases the maxSubdivision\n * value by the right factor so that each 256x256 pixel area has\n * MAX_SUBDIVISION divisions.\n */\n const maxSubdivision =\n MAX_SUBDIVISION +\n (opt_destinationResolution\n ? Math.max(\n 0,\n Math.ceil(\n log2(\n getArea(targetExtent) /\n (opt_destinationResolution *\n opt_destinationResolution *\n 256 *\n 256)\n )\n )\n )\n : 0);\n\n this.addQuad_(\n destinationTopLeft,\n destinationTopRight,\n destinationBottomRight,\n destinationBottomLeft,\n sourceTopLeft,\n sourceTopRight,\n sourceBottomRight,\n sourceBottomLeft,\n maxSubdivision\n );\n\n if (this.wrapsXInSource_) {\n let leftBound = Infinity;\n this.triangles_.forEach(function (triangle, i, arr) {\n leftBound = Math.min(\n leftBound,\n triangle.source[0][0],\n triangle.source[1][0],\n triangle.source[2][0]\n );\n });\n\n // Shift triangles to be as close to `leftBound` as possible\n // (if the distance is more than `worldWidth / 2` it can be closer.\n this.triangles_.forEach(\n function (triangle) {\n if (\n Math.max(\n triangle.source[0][0],\n triangle.source[1][0],\n triangle.source[2][0]\n ) -\n leftBound >\n this.sourceWorldWidth_ / 2\n ) {\n const newTriangle = [\n [triangle.source[0][0], triangle.source[0][1]],\n [triangle.source[1][0], triangle.source[1][1]],\n [triangle.source[2][0], triangle.source[2][1]],\n ];\n if (newTriangle[0][0] - leftBound > this.sourceWorldWidth_ / 2) {\n newTriangle[0][0] -= this.sourceWorldWidth_;\n }\n if (newTriangle[1][0] - leftBound > this.sourceWorldWidth_ / 2) {\n newTriangle[1][0] -= this.sourceWorldWidth_;\n }\n if (newTriangle[2][0] - leftBound > this.sourceWorldWidth_ / 2) {\n newTriangle[2][0] -= this.sourceWorldWidth_;\n }\n\n // Rarely (if the extent contains both the dateline and prime meridian)\n // the shift can in turn break some triangles.\n // Detect this here and don't shift in such cases.\n const minX = Math.min(\n newTriangle[0][0],\n newTriangle[1][0],\n newTriangle[2][0]\n );\n const maxX = Math.max(\n newTriangle[0][0],\n newTriangle[1][0],\n newTriangle[2][0]\n );\n if (maxX - minX < this.sourceWorldWidth_ / 2) {\n triangle.source = newTriangle;\n }\n }\n }.bind(this)\n );\n }\n\n transformInvCache = {};\n }\n\n /**\n * Adds triangle to the triangulation.\n * @param {import(\"../coordinate.js\").Coordinate} a The target a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} b The target b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} c The target c coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} aSrc The source a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} bSrc The source b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} cSrc The source c coordinate.\n * @private\n */\n addTriangle_(a, b, c, aSrc, bSrc, cSrc) {\n this.triangles_.push({\n source: [aSrc, bSrc, cSrc],\n target: [a, b, c],\n });\n }\n\n /**\n * Adds quad (points in clock-wise order) to the triangulation\n * (and reprojects the vertices) if valid.\n * Performs quad subdivision if needed to increase precision.\n *\n * @param {import(\"../coordinate.js\").Coordinate} a The target a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} b The target b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} c The target c coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} d The target d coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} aSrc The source a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} bSrc The source b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} cSrc The source c coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} dSrc The source d coordinate.\n * @param {number} maxSubdivision Maximal allowed subdivision of the quad.\n * @private\n */\n addQuad_(a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) {\n const sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]);\n const sourceCoverageX = this.sourceWorldWidth_\n ? getWidth(sourceQuadExtent) / this.sourceWorldWidth_\n : null;\n const sourceWorldWidth = /** @type {number} */ (this.sourceWorldWidth_);\n\n // when the quad is wrapped in the source projection\n // it covers most of the projection extent, but not fully\n const wrapsX =\n this.sourceProj_.canWrapX() &&\n sourceCoverageX > 0.5 &&\n sourceCoverageX < 1;\n\n let needsSubdivision = false;\n\n if (maxSubdivision > 0) {\n if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {\n const targetQuadExtent = boundingExtent([a, b, c, d]);\n const targetCoverageX =\n getWidth(targetQuadExtent) / this.targetWorldWidth_;\n needsSubdivision =\n targetCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision;\n }\n if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {\n needsSubdivision =\n sourceCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision;\n }\n }\n\n if (!needsSubdivision && this.maxSourceExtent_) {\n if (\n isFinite(sourceQuadExtent[0]) &&\n isFinite(sourceQuadExtent[1]) &&\n isFinite(sourceQuadExtent[2]) &&\n isFinite(sourceQuadExtent[3])\n ) {\n if (!intersects(sourceQuadExtent, this.maxSourceExtent_)) {\n // whole quad outside source projection extent -> ignore\n return;\n }\n }\n }\n\n let isNotFinite = 0;\n\n if (!needsSubdivision) {\n if (\n !isFinite(aSrc[0]) ||\n !isFinite(aSrc[1]) ||\n !isFinite(bSrc[0]) ||\n !isFinite(bSrc[1]) ||\n !isFinite(cSrc[0]) ||\n !isFinite(cSrc[1]) ||\n !isFinite(dSrc[0]) ||\n !isFinite(dSrc[1])\n ) {\n if (maxSubdivision > 0) {\n needsSubdivision = true;\n } else {\n // It might be the case that only 1 of the points is infinite. In this case\n // we can draw a single triangle with the other three points\n isNotFinite =\n (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) ? 8 : 0) +\n (!isFinite(bSrc[0]) || !isFinite(bSrc[1]) ? 4 : 0) +\n (!isFinite(cSrc[0]) || !isFinite(cSrc[1]) ? 2 : 0) +\n (!isFinite(dSrc[0]) || !isFinite(dSrc[1]) ? 1 : 0);\n if (\n isNotFinite != 1 &&\n isNotFinite != 2 &&\n isNotFinite != 4 &&\n isNotFinite != 8\n ) {\n return;\n }\n }\n }\n }\n\n if (maxSubdivision > 0) {\n if (!needsSubdivision) {\n const center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2];\n const centerSrc = this.transformInv_(center);\n\n let dx;\n if (wrapsX) {\n const centerSrcEstimX =\n (modulo(aSrc[0], sourceWorldWidth) +\n modulo(cSrc[0], sourceWorldWidth)) /\n 2;\n dx = centerSrcEstimX - modulo(centerSrc[0], sourceWorldWidth);\n } else {\n dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0];\n }\n const dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1];\n const centerSrcErrorSquared = dx * dx + dy * dy;\n needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_;\n }\n if (needsSubdivision) {\n if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) {\n // split horizontally (top & bottom)\n const bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2];\n const bcSrc = this.transformInv_(bc);\n const da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2];\n const daSrc = this.transformInv_(da);\n\n this.addQuad_(\n a,\n b,\n bc,\n da,\n aSrc,\n bSrc,\n bcSrc,\n daSrc,\n maxSubdivision - 1\n );\n this.addQuad_(\n da,\n bc,\n c,\n d,\n daSrc,\n bcSrc,\n cSrc,\n dSrc,\n maxSubdivision - 1\n );\n } else {\n // split vertically (left & right)\n const ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const abSrc = this.transformInv_(ab);\n const cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2];\n const cdSrc = this.transformInv_(cd);\n\n this.addQuad_(\n a,\n ab,\n cd,\n d,\n aSrc,\n abSrc,\n cdSrc,\n dSrc,\n maxSubdivision - 1\n );\n this.addQuad_(\n ab,\n b,\n c,\n cd,\n abSrc,\n bSrc,\n cSrc,\n cdSrc,\n maxSubdivision - 1\n );\n }\n return;\n }\n }\n\n if (wrapsX) {\n if (!this.canWrapXInSource_) {\n return;\n }\n this.wrapsXInSource_ = true;\n }\n\n // Exactly zero or one of *Src is not finite\n // The triangles must have the diagonal line as the first side\n // This is to allow easy code in reproj.s to make it straight for broken\n // browsers that can't handle diagonal clipping\n if ((isNotFinite & 0xb) == 0) {\n this.addTriangle_(a, c, d, aSrc, cSrc, dSrc);\n }\n if ((isNotFinite & 0xe) == 0) {\n this.addTriangle_(a, c, b, aSrc, cSrc, bSrc);\n }\n if (isNotFinite) {\n // Try the other two triangles\n if ((isNotFinite & 0xd) == 0) {\n this.addTriangle_(b, d, a, bSrc, dSrc, aSrc);\n }\n if ((isNotFinite & 0x7) == 0) {\n this.addTriangle_(b, d, c, bSrc, dSrc, cSrc);\n }\n }\n }\n\n /**\n * Calculates extent of the 'source' coordinates from all the triangles.\n *\n * @return {import(\"../extent.js\").Extent} Calculated extent.\n */\n calculateSourceExtent() {\n const extent = createEmpty();\n\n this.triangles_.forEach(function (triangle, i, arr) {\n const src = triangle.source;\n extendCoordinate(extent, src[0]);\n extendCoordinate(extent, src[1]);\n extendCoordinate(extent, src[2]);\n });\n\n return extent;\n }\n\n /**\n * @return {Array<Triangle>} Array of the calculated triangles.\n */\n getTriangles() {\n return this.triangles_;\n }\n}\n\nexport default Triangulation;\n","/**\n * @module ol/source/common\n */\n\n/**\n * Default WMS version.\n * @type {string}\n */\nexport const DEFAULT_WMS_VERSION = '1.3.0';\n\n/**\n * Context options to disable image smoothing.\n * @type {Object}\n */\nexport const IMAGE_SMOOTHING_DISABLED = {\n imageSmoothingEnabled: false,\n msImageSmoothingEnabled: false,\n};\n","/**\n * @module ol/reproj\n */\nimport {IMAGE_SMOOTHING_DISABLED} from './source/common.js';\nimport {assign} from './obj.js';\nimport {\n containsCoordinate,\n createEmpty,\n extend,\n forEachCorner,\n getCenter,\n getHeight,\n getTopLeft,\n getWidth,\n} from './extent.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {getPointResolution, transform} from './proj.js';\nimport {solveLinearSystem} from './math.js';\n\nlet brokenDiagonalRendering_;\n\n/**\n * This draws a small triangle into a canvas by setting the triangle as the clip region\n * and then drawing a (too large) rectangle\n *\n * @param {CanvasRenderingContext2D} ctx The context in which to draw the triangle\n * @param {number} u1 The x-coordinate of the second point. The first point is 0,0.\n * @param {number} v1 The y-coordinate of the second point.\n * @param {number} u2 The x-coordinate of the third point.\n * @param {number} v2 The y-coordinate of the third point.\n */\nfunction drawTestTriangle(ctx, u1, v1, u2, v2) {\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(u1, v1);\n ctx.lineTo(u2, v2);\n ctx.closePath();\n ctx.save();\n ctx.clip();\n ctx.fillRect(0, 0, Math.max(u1, u2) + 1, Math.max(v1, v2));\n ctx.restore();\n}\n\n/**\n * Given the data from getImageData, see if the right values appear at the provided offset.\n * Returns true if either the color or transparency is off\n *\n * @param {Uint8ClampedArray} data The data returned from getImageData\n * @param {number} offset The pixel offset from the start of data.\n * @return {boolean} true if the diagonal rendering is broken\n */\nfunction verifyBrokenDiagonalRendering(data, offset) {\n // the values ought to be close to the rgba(210, 0, 0, 0.75)\n return (\n Math.abs(data[offset * 4] - 210) > 2 ||\n Math.abs(data[offset * 4 + 3] - 0.75 * 255) > 2\n );\n}\n\n/**\n * Determines if the current browser configuration can render triangular clip regions correctly.\n * This value is cached so the function is only expensive the first time called.\n * Firefox on Windows (as of now) does not if HWA is enabled. See https://bugzilla.mozilla.org/show_bug.cgi?id=1606976\n * IE also doesn't. Chrome works, and everything seems to work on OSX and Android. This function caches the\n * result. I suppose that it is conceivably possible that a browser might flip modes while the app is\n * running, but lets hope not.\n *\n * @return {boolean} true if the Diagonal Rendering is broken.\n */\nfunction isBrokenDiagonalRendering() {\n if (brokenDiagonalRendering_ === undefined) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.globalCompositeOperation = 'lighter';\n ctx.fillStyle = 'rgba(210, 0, 0, 0.75)';\n drawTestTriangle(ctx, 4, 5, 4, 0);\n drawTestTriangle(ctx, 4, 5, 0, 5);\n const data = ctx.getImageData(0, 0, 3, 3).data;\n brokenDiagonalRendering_ =\n verifyBrokenDiagonalRendering(data, 0) ||\n verifyBrokenDiagonalRendering(data, 4) ||\n verifyBrokenDiagonalRendering(data, 8);\n }\n\n return brokenDiagonalRendering_;\n}\n\n/**\n * Calculates ideal resolution to use from the source in order to achieve\n * pixel mapping as close as possible to 1:1 during reprojection.\n * The resolution is calculated regardless of what resolutions\n * are actually available in the dataset (TileGrid, Image, ...).\n *\n * @param {import(\"./proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"./proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"./coordinate.js\").Coordinate} targetCenter Target center.\n * @param {number} targetResolution Target resolution.\n * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.\n */\nexport function calculateSourceResolution(\n sourceProj,\n targetProj,\n targetCenter,\n targetResolution\n) {\n const sourceCenter = transform(targetCenter, targetProj, sourceProj);\n\n // calculate the ideal resolution of the source data\n let sourceResolution = getPointResolution(\n targetProj,\n targetResolution,\n targetCenter\n );\n\n const targetMetersPerUnit = targetProj.getMetersPerUnit();\n if (targetMetersPerUnit !== undefined) {\n sourceResolution *= targetMetersPerUnit;\n }\n const sourceMetersPerUnit = sourceProj.getMetersPerUnit();\n if (sourceMetersPerUnit !== undefined) {\n sourceResolution /= sourceMetersPerUnit;\n }\n\n // Based on the projection properties, the point resolution at the specified\n // coordinates may be slightly different. We need to reverse-compensate this\n // in order to achieve optimal results.\n\n const sourceExtent = sourceProj.getExtent();\n if (!sourceExtent || containsCoordinate(sourceExtent, sourceCenter)) {\n const compensationFactor =\n getPointResolution(sourceProj, sourceResolution, sourceCenter) /\n sourceResolution;\n if (isFinite(compensationFactor) && compensationFactor > 0) {\n sourceResolution /= compensationFactor;\n }\n }\n\n return sourceResolution;\n}\n\n/**\n * Calculates ideal resolution to use from the source in order to achieve\n * pixel mapping as close as possible to 1:1 during reprojection.\n * The resolution is calculated regardless of what resolutions\n * are actually available in the dataset (TileGrid, Image, ...).\n *\n * @param {import(\"./proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"./proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"./extent.js\").Extent} targetExtent Target extent\n * @param {number} targetResolution Target resolution.\n * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.\n */\nexport function calculateSourceExtentResolution(\n sourceProj,\n targetProj,\n targetExtent,\n targetResolution\n) {\n const targetCenter = getCenter(targetExtent);\n let sourceResolution = calculateSourceResolution(\n sourceProj,\n targetProj,\n targetCenter,\n targetResolution\n );\n\n if (!isFinite(sourceResolution) || sourceResolution <= 0) {\n forEachCorner(targetExtent, function (corner) {\n sourceResolution = calculateSourceResolution(\n sourceProj,\n targetProj,\n corner,\n targetResolution\n );\n return isFinite(sourceResolution) && sourceResolution > 0;\n });\n }\n\n return sourceResolution;\n}\n\n/**\n * Renders the source data into new canvas based on the triangulation.\n *\n * @param {number} width Width of the canvas.\n * @param {number} height Height of the canvas.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} sourceResolution Source resolution.\n * @param {import(\"./extent.js\").Extent} sourceExtent Extent of the data source.\n * @param {number} targetResolution Target resolution.\n * @param {import(\"./extent.js\").Extent} targetExtent Target extent.\n * @param {import(\"./reproj/Triangulation.js\").default} triangulation\n * Calculated triangulation.\n * @param {Array<{extent: import(\"./extent.js\").Extent,\n * image: (HTMLCanvasElement|HTMLImageElement|HTMLVideoElement)}>} sources\n * Array of sources.\n * @param {number} gutter Gutter of the sources.\n * @param {boolean=} opt_renderEdges Render reprojection edges.\n * @param {object=} opt_contextOptions Properties to set on the canvas context.\n * @return {HTMLCanvasElement} Canvas with reprojected data.\n */\nexport function render(\n width,\n height,\n pixelRatio,\n sourceResolution,\n sourceExtent,\n targetResolution,\n targetExtent,\n triangulation,\n sources,\n gutter,\n opt_renderEdges,\n opt_contextOptions\n) {\n const context = createCanvasContext2D(\n Math.round(pixelRatio * width),\n Math.round(pixelRatio * height)\n );\n assign(context, opt_contextOptions);\n\n if (sources.length === 0) {\n return context.canvas;\n }\n\n context.scale(pixelRatio, pixelRatio);\n\n function pixelRound(value) {\n return Math.round(value * pixelRatio) / pixelRatio;\n }\n\n context.globalCompositeOperation = 'lighter';\n\n const sourceDataExtent = createEmpty();\n sources.forEach(function (src, i, arr) {\n extend(sourceDataExtent, src.extent);\n });\n\n const canvasWidthInUnits = getWidth(sourceDataExtent);\n const canvasHeightInUnits = getHeight(sourceDataExtent);\n const stitchContext = createCanvasContext2D(\n Math.round((pixelRatio * canvasWidthInUnits) / sourceResolution),\n Math.round((pixelRatio * canvasHeightInUnits) / sourceResolution)\n );\n assign(stitchContext, opt_contextOptions);\n\n const stitchScale = pixelRatio / sourceResolution;\n\n sources.forEach(function (src, i, arr) {\n const xPos = src.extent[0] - sourceDataExtent[0];\n const yPos = -(src.extent[3] - sourceDataExtent[3]);\n const srcWidth = getWidth(src.extent);\n const srcHeight = getHeight(src.extent);\n\n // This test should never fail -- but it does. Need to find a fix the upstream condition\n if (src.image.width > 0 && src.image.height > 0) {\n stitchContext.drawImage(\n src.image,\n gutter,\n gutter,\n src.image.width - 2 * gutter,\n src.image.height - 2 * gutter,\n xPos * stitchScale,\n yPos * stitchScale,\n srcWidth * stitchScale,\n srcHeight * stitchScale\n );\n }\n });\n\n const targetTopLeft = getTopLeft(targetExtent);\n\n triangulation.getTriangles().forEach(function (triangle, i, arr) {\n /* Calculate affine transform (src -> dst)\n * Resulting matrix can be used to transform coordinate\n * from `sourceProjection` to destination pixels.\n *\n * To optimize number of context calls and increase numerical stability,\n * we also do the following operations:\n * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1)\n * here before solving the linear system so [ui, vi] are pixel coordinates.\n *\n * Src points: xi, yi\n * Dst points: ui, vi\n * Affine coefficients: aij\n *\n * | x0 y0 1 0 0 0 | |a00| |u0|\n * | x1 y1 1 0 0 0 | |a01| |u1|\n * | x2 y2 1 0 0 0 | x |a02| = |u2|\n * | 0 0 0 x0 y0 1 | |a10| |v0|\n * | 0 0 0 x1 y1 1 | |a11| |v1|\n * | 0 0 0 x2 y2 1 | |a12| |v2|\n */\n const source = triangle.source;\n const target = triangle.target;\n let x0 = source[0][0],\n y0 = source[0][1];\n let x1 = source[1][0],\n y1 = source[1][1];\n let x2 = source[2][0],\n y2 = source[2][1];\n // Make sure that everything is on pixel boundaries\n const u0 = pixelRound((target[0][0] - targetTopLeft[0]) / targetResolution);\n const v0 = pixelRound(\n -(target[0][1] - targetTopLeft[1]) / targetResolution\n );\n const u1 = pixelRound((target[1][0] - targetTopLeft[0]) / targetResolution);\n const v1 = pixelRound(\n -(target[1][1] - targetTopLeft[1]) / targetResolution\n );\n const u2 = pixelRound((target[2][0] - targetTopLeft[0]) / targetResolution);\n const v2 = pixelRound(\n -(target[2][1] - targetTopLeft[1]) / targetResolution\n );\n\n // Shift all the source points to improve numerical stability\n // of all the subsequent calculations. The [x0, y0] is used here.\n // This is also used to simplify the linear system.\n const sourceNumericalShiftX = x0;\n const sourceNumericalShiftY = y0;\n x0 = 0;\n y0 = 0;\n x1 -= sourceNumericalShiftX;\n y1 -= sourceNumericalShiftY;\n x2 -= sourceNumericalShiftX;\n y2 -= sourceNumericalShiftY;\n\n const augmentedMatrix = [\n [x1, y1, 0, 0, u1 - u0],\n [x2, y2, 0, 0, u2 - u0],\n [0, 0, x1, y1, v1 - v0],\n [0, 0, x2, y2, v2 - v0],\n ];\n const affineCoefs = solveLinearSystem(augmentedMatrix);\n if (!affineCoefs) {\n return;\n }\n\n context.save();\n context.beginPath();\n\n if (\n isBrokenDiagonalRendering() ||\n opt_contextOptions === IMAGE_SMOOTHING_DISABLED\n ) {\n // Make sure that all lines are horizontal or vertical\n context.moveTo(u1, v1);\n // This is the diagonal line. Do it in 4 steps\n const steps = 4;\n const ud = u0 - u1;\n const vd = v0 - v1;\n for (let step = 0; step < steps; step++) {\n // Go horizontally\n context.lineTo(\n u1 + pixelRound(((step + 1) * ud) / steps),\n v1 + pixelRound((step * vd) / (steps - 1))\n );\n // Go vertically\n if (step != steps - 1) {\n context.lineTo(\n u1 + pixelRound(((step + 1) * ud) / steps),\n v1 + pixelRound(((step + 1) * vd) / (steps - 1))\n );\n }\n }\n // We are almost at u0r, v0r\n context.lineTo(u2, v2);\n } else {\n context.moveTo(u1, v1);\n context.lineTo(u0, v0);\n context.lineTo(u2, v2);\n }\n\n context.clip();\n\n context.transform(\n affineCoefs[0],\n affineCoefs[2],\n affineCoefs[1],\n affineCoefs[3],\n u0,\n v0\n );\n\n context.translate(\n sourceDataExtent[0] - sourceNumericalShiftX,\n sourceDataExtent[3] - sourceNumericalShiftY\n );\n\n context.scale(\n sourceResolution / pixelRatio,\n -sourceResolution / pixelRatio\n );\n\n context.drawImage(stitchContext.canvas, 0, 0);\n context.restore();\n });\n\n if (opt_renderEdges) {\n context.save();\n\n context.globalCompositeOperation = 'source-over';\n context.strokeStyle = 'black';\n context.lineWidth = 1;\n\n triangulation.getTriangles().forEach(function (triangle, i, arr) {\n const target = triangle.target;\n const u0 = (target[0][0] - targetTopLeft[0]) / targetResolution;\n const v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution;\n const u1 = (target[1][0] - targetTopLeft[0]) / targetResolution;\n const v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution;\n const u2 = (target[2][0] - targetTopLeft[0]) / targetResolution;\n const v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution;\n\n context.beginPath();\n context.moveTo(u1, v1);\n context.lineTo(u0, v0);\n context.lineTo(u2, v2);\n context.closePath();\n context.stroke();\n });\n\n context.restore();\n }\n return context.canvas;\n}\n","/**\n * @module ol/reproj/Tile\n */\nimport {ERROR_THRESHOLD} from './common.js';\n\nimport EventType from '../events/EventType.js';\nimport Tile from '../Tile.js';\nimport TileState from '../TileState.js';\nimport Triangulation from './Triangulation.js';\nimport {\n calculateSourceExtentResolution,\n render as renderReprojected,\n} from '../reproj.js';\nimport {clamp} from '../math.js';\nimport {getArea, getIntersection} from '../extent.js';\nimport {listen, unlistenByKey} from '../events.js';\n\n/**\n * @typedef {function(number, number, number, number) : import(\"../Tile.js\").default} FunctionType\n */\n\n/**\n * @classdesc\n * Class encapsulating single reprojected tile.\n * See {@link module:ol/source/TileImage~TileImage}.\n *\n */\nclass ReprojTile extends Tile {\n /**\n * @param {import(\"../proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} sourceTileGrid Source tile grid.\n * @param {import(\"../proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} targetTileGrid Target tile grid.\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Coordinate of the tile.\n * @param {import(\"../tilecoord.js\").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} gutter Gutter of the source tiles.\n * @param {FunctionType} getTileFunction\n * Function returning source tiles (z, x, y, pixelRatio).\n * @param {number=} opt_errorThreshold Acceptable reprojection error (in px).\n * @param {boolean=} opt_renderEdges Render reprojection edges.\n * @param {object=} opt_contextOptions Properties to set on the canvas context.\n */\n constructor(\n sourceProj,\n sourceTileGrid,\n targetProj,\n targetTileGrid,\n tileCoord,\n wrappedTileCoord,\n pixelRatio,\n gutter,\n getTileFunction,\n opt_errorThreshold,\n opt_renderEdges,\n opt_contextOptions\n ) {\n super(tileCoord, TileState.IDLE);\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderEdges_ = opt_renderEdges !== undefined ? opt_renderEdges : false;\n\n /**\n * @private\n * @type {object}\n */\n this.contextOptions_ = opt_contextOptions;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.gutter_ = gutter;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = null;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.sourceTileGrid_ = sourceTileGrid;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.targetTileGrid_ = targetTileGrid;\n\n /**\n * @private\n * @type {import(\"../tilecoord.js\").TileCoord}\n */\n this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord;\n\n /**\n * @private\n * @type {!Array<import(\"../Tile.js\").default>}\n */\n this.sourceTiles_ = [];\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.sourcesListenerKeys_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.sourceZ_ = 0;\n\n const targetExtent = targetTileGrid.getTileCoordExtent(\n this.wrappedTileCoord_\n );\n const maxTargetExtent = this.targetTileGrid_.getExtent();\n let maxSourceExtent = this.sourceTileGrid_.getExtent();\n\n const limitedTargetExtent = maxTargetExtent\n ? getIntersection(targetExtent, maxTargetExtent)\n : targetExtent;\n\n if (getArea(limitedTargetExtent) === 0) {\n // Tile is completely outside range -> EMPTY\n // TODO: is it actually correct that the source even creates the tile ?\n this.state = TileState.EMPTY;\n return;\n }\n\n const sourceProjExtent = sourceProj.getExtent();\n if (sourceProjExtent) {\n if (!maxSourceExtent) {\n maxSourceExtent = sourceProjExtent;\n } else {\n maxSourceExtent = getIntersection(maxSourceExtent, sourceProjExtent);\n }\n }\n\n const targetResolution = targetTileGrid.getResolution(\n this.wrappedTileCoord_[0]\n );\n\n const sourceResolution = calculateSourceExtentResolution(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n targetResolution\n );\n\n if (!isFinite(sourceResolution) || sourceResolution <= 0) {\n // invalid sourceResolution -> EMPTY\n // probably edges of the projections when no extent is defined\n this.state = TileState.EMPTY;\n return;\n }\n\n const errorThresholdInPixels =\n opt_errorThreshold !== undefined ? opt_errorThreshold : ERROR_THRESHOLD;\n\n /**\n * @private\n * @type {!import(\"./Triangulation.js\").default}\n */\n this.triangulation_ = new Triangulation(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n maxSourceExtent,\n sourceResolution * errorThresholdInPixels,\n targetResolution\n );\n\n if (this.triangulation_.getTriangles().length === 0) {\n // no valid triangles -> EMPTY\n this.state = TileState.EMPTY;\n return;\n }\n\n this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution);\n let sourceExtent = this.triangulation_.calculateSourceExtent();\n\n if (maxSourceExtent) {\n if (sourceProj.canWrapX()) {\n sourceExtent[1] = clamp(\n sourceExtent[1],\n maxSourceExtent[1],\n maxSourceExtent[3]\n );\n sourceExtent[3] = clamp(\n sourceExtent[3],\n maxSourceExtent[1],\n maxSourceExtent[3]\n );\n } else {\n sourceExtent = getIntersection(sourceExtent, maxSourceExtent);\n }\n }\n\n if (!getArea(sourceExtent)) {\n this.state = TileState.EMPTY;\n } else {\n const sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(\n sourceExtent,\n this.sourceZ_\n );\n\n for (let srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {\n for (let srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) {\n const tile = getTileFunction(this.sourceZ_, srcX, srcY, pixelRatio);\n if (tile) {\n this.sourceTiles_.push(tile);\n }\n }\n }\n\n if (this.sourceTiles_.length === 0) {\n this.state = TileState.EMPTY;\n }\n }\n }\n\n /**\n * Get the HTML Canvas element for this tile.\n * @return {HTMLCanvasElement} Canvas.\n */\n getImage() {\n return this.canvas_;\n }\n\n /**\n * @private\n */\n reproject_() {\n const sources = [];\n this.sourceTiles_.forEach(\n function (tile, i, arr) {\n if (tile && tile.getState() == TileState.LOADED) {\n sources.push({\n extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),\n image: tile.getImage(),\n });\n }\n }.bind(this)\n );\n this.sourceTiles_.length = 0;\n\n if (sources.length === 0) {\n this.state = TileState.ERROR;\n } else {\n const z = this.wrappedTileCoord_[0];\n const size = this.targetTileGrid_.getTileSize(z);\n const width = typeof size === 'number' ? size : size[0];\n const height = typeof size === 'number' ? size : size[1];\n const targetResolution = this.targetTileGrid_.getResolution(z);\n const sourceResolution = this.sourceTileGrid_.getResolution(\n this.sourceZ_\n );\n\n const targetExtent = this.targetTileGrid_.getTileCoordExtent(\n this.wrappedTileCoord_\n );\n this.canvas_ = renderReprojected(\n width,\n height,\n this.pixelRatio_,\n sourceResolution,\n this.sourceTileGrid_.getExtent(),\n targetResolution,\n targetExtent,\n this.triangulation_,\n sources,\n this.gutter_,\n this.renderEdges_,\n this.contextOptions_\n );\n\n this.state = TileState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n\n let leftToLoad = 0;\n\n this.sourcesListenerKeys_ = [];\n this.sourceTiles_.forEach(\n function (tile, i, arr) {\n const state = tile.getState();\n if (state == TileState.IDLE || state == TileState.LOADING) {\n leftToLoad++;\n\n const sourceListenKey = listen(\n tile,\n EventType.CHANGE,\n function (e) {\n const state = tile.getState();\n if (\n state == TileState.LOADED ||\n state == TileState.ERROR ||\n state == TileState.EMPTY\n ) {\n unlistenByKey(sourceListenKey);\n leftToLoad--;\n if (leftToLoad === 0) {\n this.unlistenSources_();\n this.reproject_();\n }\n }\n },\n this\n );\n this.sourcesListenerKeys_.push(sourceListenKey);\n }\n }.bind(this)\n );\n\n this.sourceTiles_.forEach(function (tile, i, arr) {\n const state = tile.getState();\n if (state == TileState.IDLE) {\n tile.load();\n }\n });\n\n if (leftToLoad === 0) {\n setTimeout(this.reproject_.bind(this), 0);\n }\n }\n }\n\n /**\n * @private\n */\n unlistenSources_() {\n this.sourcesListenerKeys_.forEach(unlistenByKey);\n this.sourcesListenerKeys_ = null;\n }\n}\n\nexport default ReprojTile;\n","/**\n * @module ol/source/TileEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a tile starts loading.\n * @event module:ol/source/Tile.TileSourceEvent#tileloadstart\n * @api\n */\n TILELOADSTART: 'tileloadstart',\n\n /**\n * Triggered when a tile finishes loading, either when its data is loaded,\n * or when loading was aborted because the tile is no longer needed.\n * @event module:ol/source/Tile.TileSourceEvent#tileloadend\n * @api\n */\n TILELOADEND: 'tileloadend',\n\n /**\n * Triggered if tile loading results in an error.\n * @event module:ol/source/Tile.TileSourceEvent#tileloaderror\n * @api\n */\n TILELOADERROR: 'tileloaderror',\n};\n","/**\n * @module ol/tilegrid/TileGrid\n */\nimport TileRange, {\n createOrUpdate as createOrUpdateTileRange,\n} from '../TileRange.js';\nimport {DEFAULT_TILE_SIZE} from './common.js';\nimport {assert} from '../asserts.js';\nimport {clamp} from '../math.js';\nimport {createOrUpdate, getTopLeft} from '../extent.js';\nimport {createOrUpdate as createOrUpdateTileCoord} from '../tilecoord.js';\nimport {isSorted, linearFindNearest} from '../array.js';\nimport {toSize} from '../size.js';\n\n/**\n * @private\n * @type {import(\"../tilecoord.js\").TileCoord}\n */\nconst tmpTileCoord = [0, 0, 0];\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../extent.js\").Extent} [extent] Extent for the tile grid. No tiles outside this\n * extent will be requested by {@link module:ol/source/Tile} sources. When no `origin` or\n * `origins` are configured, the `origin` will be set to the top-left corner of the extent.\n * @property {number} [minZoom=0] Minimum zoom.\n * @property {import(\"../coordinate.js\").Coordinate} [origin] The tile grid origin, i.e. where the `x`\n * and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left to right and downwards. If not\n * specified, `extent` or `origins` must be provided.\n * @property {Array<import(\"../coordinate.js\").Coordinate>} [origins] Tile grid origins, i.e. where\n * the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If given, the array length\n * should match the length of the `resolutions` array, i.e. each resolution can have a different\n * origin. Tile coordinates increase left to right and downwards. If not specified, `extent` or\n * `origin` must be provided.\n * @property {!Array<number>} resolutions Resolutions. The array index of each resolution needs\n * to match the zoom level. This means that even if a `minZoom` is configured, the resolutions\n * array will have a length of `maxZoom + 1`.\n * @property {Array<import(\"../size.js\").Size>} [sizes] Number of tile rows and columns\n * of the grid for each zoom level. If specified the values\n * define each zoom level's extent together with the `origin` or `origins`.\n * A grid `extent` can be configured in addition, and will further limit the extent\n * for which tile requests are made by sources. If the bottom-left corner of\n * an extent is used as `origin` or `origins`, then the `y` value must be\n * negative because OpenLayers tile coordinates use the top left as the origin.\n * @property {number|import(\"../size.js\").Size} [tileSize] Tile size.\n * Default is `[256, 256]`.\n * @property {Array<import(\"../size.js\").Size>} [tileSizes] Tile sizes. If given, the array length\n * should match the length of the `resolutions` array, i.e. each resolution can have a different\n * tile size.\n */\n\n/**\n * @classdesc\n * Base class for setting the grid pattern for sources accessing tiled-image\n * servers.\n * @api\n */\nclass TileGrid {\n /**\n * @param {Options} options Tile grid options.\n */\n constructor(options) {\n /**\n * @protected\n * @type {number}\n */\n this.minZoom = options.minZoom !== undefined ? options.minZoom : 0;\n\n /**\n * @private\n * @type {!Array<number>}\n */\n this.resolutions_ = options.resolutions;\n assert(\n isSorted(\n this.resolutions_,\n function (a, b) {\n return b - a;\n },\n true\n ),\n 17\n ); // `resolutions` must be sorted in descending order\n\n // check if we've got a consistent zoom factor and origin\n let zoomFactor;\n if (!options.origins) {\n for (let i = 0, ii = this.resolutions_.length - 1; i < ii; ++i) {\n if (!zoomFactor) {\n zoomFactor = this.resolutions_[i] / this.resolutions_[i + 1];\n } else {\n if (this.resolutions_[i] / this.resolutions_[i + 1] !== zoomFactor) {\n zoomFactor = undefined;\n break;\n }\n }\n }\n }\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.zoomFactor_ = zoomFactor;\n\n /**\n * @protected\n * @type {number}\n */\n this.maxZoom = this.resolutions_.length - 1;\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.origin_ = options.origin !== undefined ? options.origin : null;\n\n /**\n * @private\n * @type {Array<import(\"../coordinate.js\").Coordinate>}\n */\n this.origins_ = null;\n if (options.origins !== undefined) {\n this.origins_ = options.origins;\n assert(this.origins_.length == this.resolutions_.length, 20); // Number of `origins` and `resolutions` must be equal\n }\n\n const extent = options.extent;\n\n if (extent !== undefined && !this.origin_ && !this.origins_) {\n this.origin_ = getTopLeft(extent);\n }\n\n assert(\n (!this.origin_ && this.origins_) || (this.origin_ && !this.origins_),\n 18\n ); // Either `origin` or `origins` must be configured, never both\n\n /**\n * @private\n * @type {Array<number|import(\"../size.js\").Size>}\n */\n this.tileSizes_ = null;\n if (options.tileSizes !== undefined) {\n this.tileSizes_ = options.tileSizes;\n assert(this.tileSizes_.length == this.resolutions_.length, 19); // Number of `tileSizes` and `resolutions` must be equal\n }\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size}\n */\n this.tileSize_ =\n options.tileSize !== undefined\n ? options.tileSize\n : !this.tileSizes_\n ? DEFAULT_TILE_SIZE\n : null;\n assert(\n (!this.tileSize_ && this.tileSizes_) ||\n (this.tileSize_ && !this.tileSizes_),\n 22\n ); // Either `tileSize` or `tileSizes` must be configured, never both\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = extent !== undefined ? extent : null;\n\n /**\n * @private\n * @type {Array<import(\"../TileRange.js\").default>}\n */\n this.fullTileRanges_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.tmpSize_ = [0, 0];\n\n if (options.sizes !== undefined) {\n this.fullTileRanges_ = options.sizes.map(function (size, z) {\n const tileRange = new TileRange(\n Math.min(0, size[0]),\n Math.max(size[0] - 1, -1),\n Math.min(0, size[1]),\n Math.max(size[1] - 1, -1)\n );\n return tileRange;\n }, this);\n } else if (extent) {\n this.calculateTileRanges_(extent);\n }\n }\n\n /**\n * Call a function with each tile coordinate for a given extent and zoom level.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} zoom Integer zoom level.\n * @param {function(import(\"../tilecoord.js\").TileCoord): void} callback Function called with each tile coordinate.\n * @api\n */\n forEachTileCoord(extent, zoom, callback) {\n const tileRange = this.getTileRangeForExtentAndZ(extent, zoom);\n for (let i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {\n for (let j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {\n callback([zoom, i, j]);\n }\n }\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {function(number, import(\"../TileRange.js\").default): boolean} callback Callback.\n * @param {import(\"../TileRange.js\").default=} opt_tileRange Temporary import(\"../TileRange.js\").default object.\n * @param {import(\"../extent.js\").Extent=} opt_extent Temporary import(\"../extent.js\").Extent object.\n * @return {boolean} Callback succeeded.\n */\n forEachTileCoordParentTileRange(\n tileCoord,\n callback,\n opt_tileRange,\n opt_extent\n ) {\n let tileRange, x, y;\n let tileCoordExtent = null;\n let z = tileCoord[0] - 1;\n if (this.zoomFactor_ === 2) {\n x = tileCoord[1];\n y = tileCoord[2];\n } else {\n tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);\n }\n while (z >= this.minZoom) {\n if (this.zoomFactor_ === 2) {\n x = Math.floor(x / 2);\n y = Math.floor(y / 2);\n tileRange = createOrUpdateTileRange(x, x, y, y, opt_tileRange);\n } else {\n tileRange = this.getTileRangeForExtentAndZ(\n tileCoordExtent,\n z,\n opt_tileRange\n );\n }\n if (callback(z, tileRange)) {\n return true;\n }\n --z;\n }\n return false;\n }\n\n /**\n * Get the extent for this tile grid, if it was configured.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n return this.extent_;\n }\n\n /**\n * Get the maximum zoom level for the grid.\n * @return {number} Max zoom.\n * @api\n */\n getMaxZoom() {\n return this.maxZoom;\n }\n\n /**\n * Get the minimum zoom level for the grid.\n * @return {number} Min zoom.\n * @api\n */\n getMinZoom() {\n return this.minZoom;\n }\n\n /**\n * Get the origin for the grid at the given zoom level.\n * @param {number} z Integer zoom level.\n * @return {import(\"../coordinate.js\").Coordinate} Origin.\n * @api\n */\n getOrigin(z) {\n if (this.origin_) {\n return this.origin_;\n } else {\n return this.origins_[z];\n }\n }\n\n /**\n * Get the resolution for the given zoom level.\n * @param {number} z Integer zoom level.\n * @return {number} Resolution.\n * @api\n */\n getResolution(z) {\n return this.resolutions_[z];\n }\n\n /**\n * Get the list of resolutions for the tile grid.\n * @return {Array<number>} Resolutions.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../TileRange.js\").default=} opt_tileRange Temporary import(\"../TileRange.js\").default object.\n * @param {import(\"../extent.js\").Extent=} opt_extent Temporary import(\"../extent.js\").Extent object.\n * @return {import(\"../TileRange.js\").default} Tile range.\n */\n getTileCoordChildTileRange(tileCoord, opt_tileRange, opt_extent) {\n if (tileCoord[0] < this.maxZoom) {\n if (this.zoomFactor_ === 2) {\n const minX = tileCoord[1] * 2;\n const minY = tileCoord[2] * 2;\n return createOrUpdateTileRange(\n minX,\n minX + 1,\n minY,\n minY + 1,\n opt_tileRange\n );\n }\n const tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);\n return this.getTileRangeForExtentAndZ(\n tileCoordExtent,\n tileCoord[0] + 1,\n opt_tileRange\n );\n }\n return null;\n }\n\n /**\n * Get the extent for a tile range.\n * @param {number} z Integer zoom level.\n * @param {import(\"../TileRange.js\").default} tileRange Tile range.\n * @param {import(\"../extent.js\").Extent=} opt_extent Temporary import(\"../extent.js\").Extent object.\n * @return {import(\"../extent.js\").Extent} Extent.\n */\n getTileRangeExtent(z, tileRange, opt_extent) {\n const origin = this.getOrigin(z);\n const resolution = this.getResolution(z);\n const tileSize = toSize(this.getTileSize(z), this.tmpSize_);\n const minX = origin[0] + tileRange.minX * tileSize[0] * resolution;\n const maxX = origin[0] + (tileRange.maxX + 1) * tileSize[0] * resolution;\n const minY = origin[1] + tileRange.minY * tileSize[1] * resolution;\n const maxY = origin[1] + (tileRange.maxY + 1) * tileSize[1] * resolution;\n return createOrUpdate(minX, minY, maxX, maxY, opt_extent);\n }\n\n /**\n * Get a tile range for the given extent and integer zoom level.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} z Integer zoom level.\n * @param {import(\"../TileRange.js\").default=} opt_tileRange Temporary tile range object.\n * @return {import(\"../TileRange.js\").default} Tile range.\n */\n getTileRangeForExtentAndZ(extent, z, opt_tileRange) {\n const tileCoord = tmpTileCoord;\n this.getTileCoordForXYAndZ_(extent[0], extent[3], z, false, tileCoord);\n const minX = tileCoord[1];\n const minY = tileCoord[2];\n this.getTileCoordForXYAndZ_(extent[2], extent[1], z, true, tileCoord);\n return createOrUpdateTileRange(\n minX,\n tileCoord[1],\n minY,\n tileCoord[2],\n opt_tileRange\n );\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {import(\"../coordinate.js\").Coordinate} Tile center.\n */\n getTileCoordCenter(tileCoord) {\n const origin = this.getOrigin(tileCoord[0]);\n const resolution = this.getResolution(tileCoord[0]);\n const tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);\n return [\n origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution,\n origin[1] - (tileCoord[2] + 0.5) * tileSize[1] * resolution,\n ];\n }\n\n /**\n * Get the extent of a tile coordinate.\n *\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../extent.js\").Extent=} opt_extent Temporary extent object.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getTileCoordExtent(tileCoord, opt_extent) {\n const origin = this.getOrigin(tileCoord[0]);\n const resolution = this.getResolution(tileCoord[0]);\n const tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);\n const minX = origin[0] + tileCoord[1] * tileSize[0] * resolution;\n const minY = origin[1] - (tileCoord[2] + 1) * tileSize[1] * resolution;\n const maxX = minX + tileSize[0] * resolution;\n const maxY = minY + tileSize[1] * resolution;\n return createOrUpdate(minX, minY, maxX, maxY, opt_extent);\n }\n\n /**\n * Get the tile coordinate for the given map coordinate and resolution. This\n * method considers that coordinates that intersect tile boundaries should be\n * assigned the higher tile coordinate.\n *\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {import(\"../tilecoord.js\").TileCoord=} opt_tileCoord Destination import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @api\n */\n getTileCoordForCoordAndResolution(coordinate, resolution, opt_tileCoord) {\n return this.getTileCoordForXYAndResolution_(\n coordinate[0],\n coordinate[1],\n resolution,\n false,\n opt_tileCoord\n );\n }\n\n /**\n * Note that this method should not be called for resolutions that correspond\n * to an integer zoom level. Instead call the `getTileCoordForXYAndZ_` method.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {number} resolution Resolution (for a non-integer zoom level).\n * @param {boolean} reverseIntersectionPolicy Instead of letting edge\n * intersections go to the higher tile coordinate, let edge intersections\n * go to the lower tile coordinate.\n * @param {import(\"../tilecoord.js\").TileCoord=} opt_tileCoord Temporary import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @private\n */\n getTileCoordForXYAndResolution_(\n x,\n y,\n resolution,\n reverseIntersectionPolicy,\n opt_tileCoord\n ) {\n const z = this.getZForResolution(resolution);\n const scale = resolution / this.getResolution(z);\n const origin = this.getOrigin(z);\n const tileSize = toSize(this.getTileSize(z), this.tmpSize_);\n\n const adjustX = reverseIntersectionPolicy ? 0.5 : 0;\n const adjustY = reverseIntersectionPolicy ? 0.5 : 0;\n const xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX);\n const yFromOrigin = Math.floor((origin[1] - y) / resolution + adjustY);\n let tileCoordX = (scale * xFromOrigin) / tileSize[0];\n let tileCoordY = (scale * yFromOrigin) / tileSize[1];\n\n if (reverseIntersectionPolicy) {\n tileCoordX = Math.ceil(tileCoordX) - 1;\n tileCoordY = Math.ceil(tileCoordY) - 1;\n } else {\n tileCoordX = Math.floor(tileCoordX);\n tileCoordY = Math.floor(tileCoordY);\n }\n\n return createOrUpdateTileCoord(z, tileCoordX, tileCoordY, opt_tileCoord);\n }\n\n /**\n * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,\n * they should have separate implementations. This method is for integer zoom\n * levels. The other method should only be called for resolutions corresponding\n * to non-integer zoom levels.\n * @param {number} x Map x coordinate.\n * @param {number} y Map y coordinate.\n * @param {number} z Integer zoom level.\n * @param {boolean} reverseIntersectionPolicy Instead of letting edge\n * intersections go to the higher tile coordinate, let edge intersections\n * go to the lower tile coordinate.\n * @param {import(\"../tilecoord.js\").TileCoord=} opt_tileCoord Temporary import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @private\n */\n getTileCoordForXYAndZ_(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {\n const origin = this.getOrigin(z);\n const resolution = this.getResolution(z);\n const tileSize = toSize(this.getTileSize(z), this.tmpSize_);\n\n const adjustX = reverseIntersectionPolicy ? 0.5 : 0;\n const adjustY = reverseIntersectionPolicy ? 0.5 : 0;\n const xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX);\n const yFromOrigin = Math.floor((origin[1] - y) / resolution + adjustY);\n let tileCoordX = xFromOrigin / tileSize[0];\n let tileCoordY = yFromOrigin / tileSize[1];\n\n if (reverseIntersectionPolicy) {\n tileCoordX = Math.ceil(tileCoordX) - 1;\n tileCoordY = Math.ceil(tileCoordY) - 1;\n } else {\n tileCoordX = Math.floor(tileCoordX);\n tileCoordY = Math.floor(tileCoordY);\n }\n\n return createOrUpdateTileCoord(z, tileCoordX, tileCoordY, opt_tileCoord);\n }\n\n /**\n * Get a tile coordinate given a map coordinate and zoom level.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} z Zoom level.\n * @param {import(\"../tilecoord.js\").TileCoord=} opt_tileCoord Destination import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @api\n */\n getTileCoordForCoordAndZ(coordinate, z, opt_tileCoord) {\n return this.getTileCoordForXYAndZ_(\n coordinate[0],\n coordinate[1],\n z,\n false,\n opt_tileCoord\n );\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {number} Tile resolution.\n */\n getTileCoordResolution(tileCoord) {\n return this.resolutions_[tileCoord[0]];\n }\n\n /**\n * Get the tile size for a zoom level. The type of the return value matches the\n * `tileSize` or `tileSizes` that the tile grid was configured with. To always\n * get an `import(\"../size.js\").Size`, run the result through `import(\"../size.js\").Size.toSize()`.\n * @param {number} z Z.\n * @return {number|import(\"../size.js\").Size} Tile size.\n * @api\n */\n getTileSize(z) {\n if (this.tileSize_) {\n return this.tileSize_;\n } else {\n return this.tileSizes_[z];\n }\n }\n\n /**\n * @param {number} z Zoom level.\n * @return {import(\"../TileRange.js\").default} Extent tile range for the specified zoom level.\n */\n getFullTileRange(z) {\n if (!this.fullTileRanges_) {\n return null;\n } else {\n return this.fullTileRanges_[z];\n }\n }\n\n /**\n * @param {number} resolution Resolution.\n * @param {number=} opt_direction If 0, the nearest resolution will be used.\n * If 1, the nearest lower resolution will be used. If -1, the nearest\n * higher resolution will be used. Default is 0.\n * @return {number} Z.\n * @api\n */\n getZForResolution(resolution, opt_direction) {\n const z = linearFindNearest(\n this.resolutions_,\n resolution,\n opt_direction || 0\n );\n return clamp(z, this.minZoom, this.maxZoom);\n }\n\n /**\n * @param {!import(\"../extent.js\").Extent} extent Extent for this tile grid.\n * @private\n */\n calculateTileRanges_(extent) {\n const length = this.resolutions_.length;\n const fullTileRanges = new Array(length);\n for (let z = this.minZoom; z < length; ++z) {\n fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z);\n }\n this.fullTileRanges_ = fullTileRanges;\n }\n}\n\nexport default TileGrid;\n","/**\n * @module ol/tilegrid\n */\nimport Corner from './extent/Corner.js';\nimport TileGrid from './tilegrid/TileGrid.js';\nimport Units from './proj/Units.js';\nimport {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './tilegrid/common.js';\nimport {METERS_PER_UNIT, get as getProjection} from './proj.js';\nimport {\n containsCoordinate,\n createOrUpdate,\n getCorner,\n getHeight,\n getWidth,\n} from './extent.js';\nimport {toSize} from './size.js';\n\n/**\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {!TileGrid} Default tile grid for the\n * passed projection.\n */\nexport function getForProjection(projection) {\n let tileGrid = projection.getDefaultTileGrid();\n if (!tileGrid) {\n tileGrid = createForProjection(projection);\n projection.setDefaultTileGrid(tileGrid);\n }\n return tileGrid;\n}\n\n/**\n * @param {TileGrid} tileGrid Tile grid.\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {import(\"./tilecoord.js\").TileCoord} Tile coordinate.\n */\nexport function wrapX(tileGrid, tileCoord, projection) {\n const z = tileCoord[0];\n const center = tileGrid.getTileCoordCenter(tileCoord);\n const projectionExtent = extentFromProjection(projection);\n if (!containsCoordinate(projectionExtent, center)) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.ceil(\n (projectionExtent[0] - center[0]) / worldWidth\n );\n center[0] += worldWidth * worldsAway;\n return tileGrid.getTileCoordForCoordAndZ(center, z);\n } else {\n return tileCoord;\n }\n}\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number=} opt_maxZoom Maximum zoom level (default is\n * DEFAULT_MAX_ZOOM).\n * @param {number|import(\"./size.js\").Size=} opt_tileSize Tile size (default uses\n * DEFAULT_TILE_SIZE).\n * @param {import(\"./extent/Corner.js\").default=} opt_corner Extent corner (default is `'top-left'`).\n * @return {!TileGrid} TileGrid instance.\n */\nexport function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {\n const corner = opt_corner !== undefined ? opt_corner : Corner.TOP_LEFT;\n\n const resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize);\n\n return new TileGrid({\n extent: extent,\n origin: getCorner(extent, corner),\n resolutions: resolutions,\n tileSize: opt_tileSize,\n });\n}\n\n/**\n * @typedef {Object} XYZOptions\n * @property {import(\"./extent.js\").Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the\n * top-left corner of the extent. If `maxResolution` is not provided the zero level of the grid is defined by the resolution\n * at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used.\n * @property {number} [maxResolution] Resolution at level zero.\n * @property {number} [maxZoom] Maximum zoom. The default is `42`. This determines the number of levels\n * in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set.\n * @property {number} [minZoom=0] Minimum zoom.\n * @property {number|import(\"./size.js\").Size} [tileSize=[256, 256]] Tile size in pixels.\n */\n\n/**\n * Creates a tile grid with a standard XYZ tiling scheme.\n * @param {XYZOptions=} opt_options Tile grid options.\n * @return {!TileGrid} Tile grid instance.\n * @api\n */\nexport function createXYZ(opt_options) {\n const xyzOptions = opt_options || {};\n\n const extent = xyzOptions.extent || getProjection('EPSG:3857').getExtent();\n\n const gridOptions = {\n extent: extent,\n minZoom: xyzOptions.minZoom,\n tileSize: xyzOptions.tileSize,\n resolutions: resolutionsFromExtent(\n extent,\n xyzOptions.maxZoom,\n xyzOptions.tileSize,\n xyzOptions.maxResolution\n ),\n };\n return new TileGrid(gridOptions);\n}\n\n/**\n * Create a resolutions array from an extent. A zoom factor of 2 is assumed.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number=} opt_maxZoom Maximum zoom level (default is\n * DEFAULT_MAX_ZOOM).\n * @param {number|import(\"./size.js\").Size=} opt_tileSize Tile size (default uses\n * DEFAULT_TILE_SIZE).\n * @param {number=} opt_maxResolution Resolution at level zero.\n * @return {!Array<number>} Resolutions array.\n */\nfunction resolutionsFromExtent(\n extent,\n opt_maxZoom,\n opt_tileSize,\n opt_maxResolution\n) {\n const maxZoom = opt_maxZoom !== undefined ? opt_maxZoom : DEFAULT_MAX_ZOOM;\n\n const height = getHeight(extent);\n const width = getWidth(extent);\n\n const tileSize = toSize(\n opt_tileSize !== undefined ? opt_tileSize : DEFAULT_TILE_SIZE\n );\n const maxResolution =\n opt_maxResolution > 0\n ? opt_maxResolution\n : Math.max(width / tileSize[0], height / tileSize[1]);\n\n const length = maxZoom + 1;\n const resolutions = new Array(length);\n for (let z = 0; z < length; ++z) {\n resolutions[z] = maxResolution / Math.pow(2, z);\n }\n return resolutions;\n}\n\n/**\n * @param {import(\"./proj.js\").ProjectionLike} projection Projection.\n * @param {number=} opt_maxZoom Maximum zoom level (default is\n * DEFAULT_MAX_ZOOM).\n * @param {number|import(\"./size.js\").Size=} opt_tileSize Tile size (default uses\n * DEFAULT_TILE_SIZE).\n * @param {import(\"./extent/Corner.js\").default=} opt_corner Extent corner (default is `'top-left'`).\n * @return {!TileGrid} TileGrid instance.\n */\nexport function createForProjection(\n projection,\n opt_maxZoom,\n opt_tileSize,\n opt_corner\n) {\n const extent = extentFromProjection(projection);\n return createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner);\n}\n\n/**\n * Generate a tile grid extent from a projection. If the projection has an\n * extent, it is used. If not, a global extent is assumed.\n * @param {import(\"./proj.js\").ProjectionLike} projection Projection.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\nexport function extentFromProjection(projection) {\n projection = getProjection(projection);\n let extent = projection.getExtent();\n if (!extent) {\n const half =\n (180 * METERS_PER_UNIT[Units.DEGREES]) / projection.getMetersPerUnit();\n extent = createOrUpdate(-half, -half, half, half);\n }\n return extent;\n}\n","/**\n * @module ol/source/Tile\n */\nimport Event from '../events/Event.js';\nimport Source from './Source.js';\nimport TileCache from '../TileCache.js';\nimport TileState from '../TileState.js';\nimport {abstract} from '../util.js';\nimport {equivalent} from '../proj.js';\nimport {getKeyZXY, withinExtentAndZ} from '../tilecoord.js';\nimport {\n getForProjection as getTileGridForProjection,\n wrapX,\n} from '../tilegrid.js';\nimport {scale as scaleSize, toSize} from '../size.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions]\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize]\n * @property {boolean} [opaque=false] Whether the layer is opaque.\n * @property {number} [tilePixelRatio]\n * @property {import(\"../proj.js\").ProjectionLike} [projection]\n * @property {import(\"./State.js\").default} [state]\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid]\n * @property {boolean} [wrapX=true]\n * @property {number} [transition]\n * @property {string} [key]\n * @property {number} [zDirection=0]\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for sources providing images divided into a tile grid.\n * @abstract\n * @api\n */\nclass TileSource extends Source {\n /**\n * @param {Options} options SourceTile source options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n projection: options.projection,\n state: options.state,\n wrapX: options.wrapX,\n });\n\n /**\n * @private\n * @type {boolean}\n */\n this.opaque_ = options.opaque !== undefined ? options.opaque : false;\n\n /**\n * @private\n * @type {number}\n */\n this.tilePixelRatio_ =\n options.tilePixelRatio !== undefined ? options.tilePixelRatio : 1;\n\n /**\n * @protected\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;\n\n const tileSize = [256, 256];\n const tileGrid = options.tileGrid;\n if (tileGrid) {\n toSize(tileGrid.getTileSize(tileGrid.getMinZoom()), tileSize);\n }\n\n /**\n * @protected\n * @type {import(\"../TileCache.js\").default}\n */\n this.tileCache = new TileCache(options.cacheSize || 0);\n\n /**\n * @protected\n * @type {import(\"../size.js\").Size}\n */\n this.tmpSize = [0, 0];\n\n /**\n * @private\n * @type {string}\n */\n this.key_ = options.key || '';\n\n /**\n * @protected\n * @type {import(\"../Tile.js\").Options}\n */\n this.tileOptions = {transition: options.transition};\n\n /**\n * zDirection hint, read by the renderer. Indicates which resolution should be used\n * by a renderer if the views resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @type {number}\n */\n this.zDirection = options.zDirection ? options.zDirection : 0;\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n return this.tileCache.canExpireCache();\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {!Object<string, boolean>} usedTiles Used tiles.\n */\n expireCache(projection, usedTiles) {\n const tileCache = this.getTileCacheForProjection(projection);\n if (tileCache) {\n tileCache.expireCache(usedTiles);\n }\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {number} z Zoom level.\n * @param {import(\"../TileRange.js\").default} tileRange Tile range.\n * @param {function(import(\"../Tile.js\").default):(boolean|void)} callback Called with each\n * loaded tile. If the callback returns `false`, the tile will not be\n * considered loaded.\n * @return {boolean} The tile range is fully covered with loaded tiles.\n */\n forEachLoadedTile(projection, z, tileRange, callback) {\n const tileCache = this.getTileCacheForProjection(projection);\n if (!tileCache) {\n return false;\n }\n\n let covered = true;\n let tile, tileCoordKey, loaded;\n for (let x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (let y = tileRange.minY; y <= tileRange.maxY; ++y) {\n tileCoordKey = getKeyZXY(z, x, y);\n loaded = false;\n if (tileCache.containsKey(tileCoordKey)) {\n tile = /** @type {!import(\"../Tile.js\").default} */ (tileCache.get(\n tileCoordKey\n ));\n loaded = tile.getState() === TileState.LOADED;\n if (loaded) {\n loaded = callback(tile) !== false;\n }\n }\n if (!loaded) {\n covered = false;\n }\n }\n }\n return covered;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {number} Gutter.\n */\n getGutterForProjection(projection) {\n return 0;\n }\n\n /**\n * Return the key to be used for all tiles in the source.\n * @return {string} The key for all tiles.\n * @protected\n */\n getKey() {\n return this.key_;\n }\n\n /**\n * Set the value to be used as the key for all tiles in the source.\n * @param {string} key The key for tiles.\n * @protected\n */\n setKey(key) {\n if (this.key_ !== key) {\n this.key_ = key;\n this.changed();\n }\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {boolean} Opaque.\n */\n getOpaque(projection) {\n return this.opaque_;\n }\n\n /**\n * @return {Array<number>} Resolutions.\n */\n getResolutions() {\n return this.tileGrid.getResolutions();\n }\n\n /**\n * @abstract\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../Tile.js\").default} Tile.\n */\n getTile(z, x, y, pixelRatio, projection) {\n return abstract();\n }\n\n /**\n * Return the tile grid of the tile source.\n * @return {import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n * @api\n */\n getTileGrid() {\n return this.tileGrid;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n */\n getTileGridForProjection(projection) {\n if (!this.tileGrid) {\n return getTileGridForProjection(projection);\n } else {\n return this.tileGrid;\n }\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../TileCache.js\").default} Tile cache.\n * @protected\n */\n getTileCacheForProjection(projection) {\n const thisProj = this.getProjection();\n if (thisProj && !equivalent(thisProj, projection)) {\n return null;\n } else {\n return this.tileCache;\n }\n }\n\n /**\n * Get the tile pixel ratio for this source. Subclasses may override this\n * method, which is meant to return a supported pixel ratio that matches the\n * provided `pixelRatio` as close as possible.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Tile pixel ratio.\n */\n getTilePixelRatio(pixelRatio) {\n return this.tilePixelRatio_;\n }\n\n /**\n * @param {number} z Z.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../size.js\").Size} Tile size.\n */\n getTilePixelSize(z, pixelRatio, projection) {\n const tileGrid = this.getTileGridForProjection(projection);\n const tilePixelRatio = this.getTilePixelRatio(pixelRatio);\n const tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);\n if (tilePixelRatio == 1) {\n return tileSize;\n } else {\n return scaleSize(tileSize, tilePixelRatio, this.tmpSize);\n }\n }\n\n /**\n * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate\n * is outside the resolution and extent range of the tile grid, `null` will be\n * returned.\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../proj/Projection.js\").default=} opt_projection Projection.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate to be passed to the tileUrlFunction or\n * null if no tile URL should be created for the passed `tileCoord`.\n */\n getTileCoordForTileUrlFunction(tileCoord, opt_projection) {\n const projection =\n opt_projection !== undefined ? opt_projection : this.getProjection();\n const tileGrid = this.getTileGridForProjection(projection);\n if (this.getWrapX() && projection.isGlobal()) {\n tileCoord = wrapX(tileGrid, tileCoord, projection);\n }\n return withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;\n }\n\n /**\n * Remove all cached tiles from the source. The next render cycle will fetch new tiles.\n * @api\n */\n clear() {\n this.tileCache.clear();\n }\n\n refresh() {\n this.clear();\n super.refresh();\n }\n\n /**\n * Increases the cache size if needed\n * @param {number} tileCount Minimum number of tiles needed.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n */\n updateCacheSize(tileCount, projection) {\n const tileCache = this.getTileCacheForProjection(projection);\n if (tileCount > tileCache.highWaterMark) {\n tileCache.highWaterMark = tileCount;\n }\n }\n\n /**\n * Marks a tile coord as being used, without triggering a load.\n * @abstract\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n */\n useTile(z, x, y, projection) {}\n}\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Tile~TileSource} instances are instances of this\n * type.\n */\nexport class TileSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {import(\"../Tile.js\").default} tile The tile.\n */\n constructor(type, tile) {\n super(type);\n\n /**\n * The tile related to the event.\n * @type {import(\"../Tile.js\").default}\n * @api\n */\n this.tile = tile;\n }\n}\n\nexport default TileSource;\n","/**\n * @module ol/tileurlfunction\n */\nimport {assert} from './asserts.js';\nimport {modulo} from './math.js';\nimport {hash as tileCoordHash} from './tilecoord.js';\n\n/**\n * @param {string} template Template.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {import(\"./Tile.js\").UrlFunction} Tile URL function.\n */\nexport function createFromTemplate(template, tileGrid) {\n const zRegEx = /\\{z\\}/g;\n const xRegEx = /\\{x\\}/g;\n const yRegEx = /\\{y\\}/g;\n const dashYRegEx = /\\{-y\\}/g;\n return (\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile Coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n } else {\n return template\n .replace(zRegEx, tileCoord[0].toString())\n .replace(xRegEx, tileCoord[1].toString())\n .replace(yRegEx, tileCoord[2].toString())\n .replace(dashYRegEx, function () {\n const z = tileCoord[0];\n const range = tileGrid.getFullTileRange(z);\n assert(range, 55); // The {-y} placeholder requires a tile grid with extent\n const y = range.getHeight() - tileCoord[2] - 1;\n return y.toString();\n });\n }\n }\n );\n}\n\n/**\n * @param {Array<string>} templates Templates.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {import(\"./Tile.js\").UrlFunction} Tile URL function.\n */\nexport function createFromTemplates(templates, tileGrid) {\n const len = templates.length;\n const tileUrlFunctions = new Array(len);\n for (let i = 0; i < len; ++i) {\n tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid);\n }\n return createFromTileUrlFunctions(tileUrlFunctions);\n}\n\n/**\n * @param {Array<import(\"./Tile.js\").UrlFunction>} tileUrlFunctions Tile URL Functions.\n * @return {import(\"./Tile.js\").UrlFunction} Tile URL function.\n */\nexport function createFromTileUrlFunctions(tileUrlFunctions) {\n if (tileUrlFunctions.length === 1) {\n return tileUrlFunctions[0];\n }\n return (\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile Coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n } else {\n const h = tileCoordHash(tileCoord);\n const index = modulo(h, tileUrlFunctions.length);\n return tileUrlFunctions[index](tileCoord, pixelRatio, projection);\n }\n }\n );\n}\n\n/**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\nexport function nullTileUrlFunction(tileCoord, pixelRatio, projection) {\n return undefined;\n}\n\n/**\n * @param {string} url URL.\n * @return {Array<string>} Array of urls.\n */\nexport function expandUrl(url) {\n const urls = [];\n let match = /\\{([a-z])-([a-z])\\}/.exec(url);\n if (match) {\n // char range\n const startCharCode = match[1].charCodeAt(0);\n const stopCharCode = match[2].charCodeAt(0);\n let charCode;\n for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {\n urls.push(url.replace(match[0], String.fromCharCode(charCode)));\n }\n return urls;\n }\n match = /\\{(\\d+)-(\\d+)\\}/.exec(url);\n if (match) {\n // number range\n const stop = parseInt(match[2], 10);\n for (let i = parseInt(match[1], 10); i <= stop; i++) {\n urls.push(url.replace(match[0], i.toString()));\n }\n return urls;\n }\n urls.push(url);\n return urls;\n}\n","/**\n * @module ol/source/UrlTile\n */\nimport TileEventType from './TileEventType.js';\nimport TileSource, {TileSourceEvent} from './Tile.js';\nimport TileState from '../TileState.js';\nimport {createFromTemplates, expandUrl} from '../tileurlfunction.js';\nimport {getKeyZXY} from '../tilecoord.js';\nimport {getUid} from '../util.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions]\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize]\n * @property {boolean} [opaque=false] Whether the layer is opaque.\n * @property {import(\"../proj.js\").ProjectionLike} [projection]\n * @property {import(\"./State.js\").default} [state]\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid]\n * @property {import(\"../Tile.js\").LoadFunction} tileLoadFunction\n * @property {number} [tilePixelRatio]\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction]\n * @property {string} [url]\n * @property {Array<string>} [urls]\n * @property {boolean} [wrapX=true]\n * @property {number} [transition]\n * @property {string} [key]\n * @property {number} [zDirection=0]\n */\n\n/**\n * @classdesc\n * Base class for sources providing tiles divided into a tile grid over http.\n *\n * @fires import(\"./Tile.js\").TileSourceEvent\n */\nclass UrlTile extends TileSource {\n /**\n * @param {Options} options Image tile options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n opaque: options.opaque,\n projection: options.projection,\n state: options.state,\n tileGrid: options.tileGrid,\n tilePixelRatio: options.tilePixelRatio,\n wrapX: options.wrapX,\n transition: options.transition,\n key: options.key,\n attributionsCollapsible: options.attributionsCollapsible,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {boolean}\n */\n this.generateTileUrlFunction_ =\n this.tileUrlFunction === UrlTile.prototype.tileUrlFunction;\n\n /**\n * @protected\n * @type {import(\"../Tile.js\").LoadFunction}\n */\n this.tileLoadFunction = options.tileLoadFunction;\n\n if (options.tileUrlFunction) {\n this.tileUrlFunction = options.tileUrlFunction.bind(this);\n }\n\n /**\n * @protected\n * @type {!Array<string>|null}\n */\n this.urls = null;\n\n if (options.urls) {\n this.setUrls(options.urls);\n } else if (options.url) {\n this.setUrl(options.url);\n }\n\n /**\n * @private\n * @type {!Object<string, boolean>}\n */\n this.tileLoadingKeys_ = {};\n }\n\n /**\n * Return the tile load function of the source.\n * @return {import(\"../Tile.js\").LoadFunction} TileLoadFunction\n * @api\n */\n getTileLoadFunction() {\n return this.tileLoadFunction;\n }\n\n /**\n * Return the tile URL function of the source.\n * @return {import(\"../Tile.js\").UrlFunction} TileUrlFunction\n * @api\n */\n getTileUrlFunction() {\n return this.tileUrlFunction;\n }\n\n /**\n * Return the URLs used for this source.\n * When a tileUrlFunction is used instead of url or urls,\n * null will be returned.\n * @return {!Array<string>|null} URLs.\n * @api\n */\n getUrls() {\n return this.urls;\n }\n\n /**\n * Handle tile change events.\n * @param {import(\"../events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"../Tile.js\").default} */ (event.target);\n const uid = getUid(tile);\n const tileState = tile.getState();\n let type;\n if (tileState == TileState.LOADING) {\n this.tileLoadingKeys_[uid] = true;\n type = TileEventType.TILELOADSTART;\n } else if (uid in this.tileLoadingKeys_) {\n delete this.tileLoadingKeys_[uid];\n type =\n tileState == TileState.ERROR\n ? TileEventType.TILELOADERROR\n : tileState == TileState.LOADED\n ? TileEventType.TILELOADEND\n : undefined;\n }\n if (type != undefined) {\n this.dispatchEvent(new TileSourceEvent(type, tile));\n }\n }\n\n /**\n * Set the tile load function of the source.\n * @param {import(\"../Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @api\n */\n setTileLoadFunction(tileLoadFunction) {\n this.tileCache.clear();\n this.tileLoadFunction = tileLoadFunction;\n this.changed();\n }\n\n /**\n * Set the tile URL function of the source.\n * @param {import(\"../Tile.js\").UrlFunction} tileUrlFunction Tile URL function.\n * @param {string=} key Optional new tile key for the source.\n * @api\n */\n setTileUrlFunction(tileUrlFunction, key) {\n this.tileUrlFunction = tileUrlFunction;\n this.tileCache.pruneExceptNewestZ();\n if (typeof key !== 'undefined') {\n this.setKey(key);\n } else {\n this.changed();\n }\n }\n\n /**\n * Set the URL to use for requests.\n * @param {string} url URL.\n * @api\n */\n setUrl(url) {\n const urls = expandUrl(url);\n this.urls = urls;\n this.setUrls(urls);\n }\n\n /**\n * Set the URLs to use for requests.\n * @param {Array<string>} urls URLs.\n * @api\n */\n setUrls(urls) {\n this.urls = urls;\n const key = urls.join('\\n');\n if (this.generateTileUrlFunction_) {\n this.setTileUrlFunction(createFromTemplates(urls, this.tileGrid), key);\n } else {\n this.setKey(key);\n }\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n tileUrlFunction(tileCoord, pixelRatio, projection) {\n return undefined;\n }\n\n /**\n * Marks a tile coord as being used, without triggering a load.\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n */\n useTile(z, x, y) {\n const tileCoordKey = getKeyZXY(z, x, y);\n if (this.tileCache.containsKey(tileCoordKey)) {\n this.tileCache.get(tileCoordKey);\n }\n }\n}\n\nexport default UrlTile;\n","/**\n * @module ol/source/TileImage\n */\nimport EventType from '../events/EventType.js';\nimport ImageTile from '../ImageTile.js';\nimport ReprojTile from '../reproj/Tile.js';\nimport TileCache from '../TileCache.js';\nimport TileState from '../TileState.js';\nimport UrlTile from './UrlTile.js';\nimport {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';\nimport {IMAGE_SMOOTHING_DISABLED} from './common.js';\nimport {equivalent, get as getProjection} from '../proj.js';\nimport {getKey, getKeyZXY} from '../tilecoord.js';\nimport {getForProjection as getTileGridForProjection} from '../tilegrid.js';\nimport {getUid} from '../util.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [imageSmoothing=true] Enable image smoothing.\n * @property {boolean} [opaque=false] Whether the layer is opaque.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"./State.js\").default} [state] Source state.\n * @property {typeof import(\"../ImageTile.js\").default} [tileClass] Class used to instantiate image tiles.\n * Default is {@link module:ol/ImageTile~ImageTile}.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile\n * service advertizes 256px by 256px tiles but actually sends 512px\n * by 512px images (for retina/hidpi devices) then `tilePixelRatio`\n * should be set to `2`.\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.\n * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be\n * used instead of defining each one separately in the `urls` option.\n * @property {Array<string>} [urls] An array of URL templates.\n * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to\n * request out-of-bounds tiles from the server. When set to `false`, only one\n * world will be rendered. When set to `true`, tiles will be requested for one\n * world only, but they will be wrapped horizontally to render multiple worlds.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {string} [key] Optional tile key for proper cache fetching\n * @property {number} [zDirection=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n */\n\n/**\n * @classdesc\n * Base class for sources providing images divided into a tile grid.\n *\n * @fires import(\"./Tile.js\").TileSourceEvent\n * @api\n */\nclass TileImage extends UrlTile {\n /**\n * @param {!Options} options Image tile options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n opaque: options.opaque,\n projection: options.projection,\n state: options.state,\n tileGrid: options.tileGrid,\n tileLoadFunction: options.tileLoadFunction\n ? options.tileLoadFunction\n : defaultTileLoadFunction,\n tilePixelRatio: options.tilePixelRatio,\n tileUrlFunction: options.tileUrlFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX,\n transition: options.transition,\n key: options.key,\n attributionsCollapsible: options.attributionsCollapsible,\n zDirection: options.zDirection,\n });\n\n /**\n * @protected\n * @type {?string}\n */\n this.crossOrigin =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @protected\n * @type {typeof ImageTile}\n */\n this.tileClass =\n options.tileClass !== undefined ? options.tileClass : ImageTile;\n\n /**\n * @protected\n * @type {!Object<string, TileCache>}\n */\n this.tileCacheForProjection = {};\n\n /**\n * @protected\n * @type {!Object<string, import(\"../tilegrid/TileGrid.js\").default>}\n */\n this.tileGridForProjection = {};\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;\n\n /**\n * @private\n * @type {object|undefined}\n */\n this.contextOptions_ =\n options.imageSmoothing === false ? IMAGE_SMOOTHING_DISABLED : undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderReprojectionEdges_ = false;\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n if (!ENABLE_RASTER_REPROJECTION) {\n return super.canExpireCache();\n }\n if (this.tileCache.canExpireCache()) {\n return true;\n } else {\n for (const key in this.tileCacheForProjection) {\n if (this.tileCacheForProjection[key].canExpireCache()) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {!Object<string, boolean>} usedTiles Used tiles.\n */\n expireCache(projection, usedTiles) {\n if (!ENABLE_RASTER_REPROJECTION) {\n super.expireCache(projection, usedTiles);\n return;\n }\n const usedTileCache = this.getTileCacheForProjection(projection);\n\n this.tileCache.expireCache(\n this.tileCache == usedTileCache ? usedTiles : {}\n );\n for (const id in this.tileCacheForProjection) {\n const tileCache = this.tileCacheForProjection[id];\n tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {});\n }\n }\n\n /**\n * @return {Object|undefined} Context options.\n */\n getContextOptions() {\n return this.contextOptions_;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {number} Gutter.\n */\n getGutterForProjection(projection) {\n if (\n ENABLE_RASTER_REPROJECTION &&\n this.getProjection() &&\n projection &&\n !equivalent(this.getProjection(), projection)\n ) {\n return 0;\n } else {\n return this.getGutter();\n }\n }\n\n /**\n * @return {number} Gutter.\n */\n getGutter() {\n return 0;\n }\n\n /**\n * Return the key to be used for all tiles in the source.\n * @return {string} The key for all tiles.\n * @protected\n */\n getKey() {\n return (\n super.getKey() +\n (this.contextOptions_ ? '\\n' + JSON.stringify(this.contextOptions_) : '')\n );\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {boolean} Opaque.\n */\n getOpaque(projection) {\n if (\n ENABLE_RASTER_REPROJECTION &&\n this.getProjection() &&\n projection &&\n !equivalent(this.getProjection(), projection)\n ) {\n return false;\n } else {\n return super.getOpaque(projection);\n }\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n */\n getTileGridForProjection(projection) {\n if (!ENABLE_RASTER_REPROJECTION) {\n return super.getTileGridForProjection(projection);\n }\n const thisProj = this.getProjection();\n if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {\n return this.tileGrid;\n } else {\n const projKey = getUid(projection);\n if (!(projKey in this.tileGridForProjection)) {\n this.tileGridForProjection[projKey] = getTileGridForProjection(\n projection\n );\n }\n return this.tileGridForProjection[projKey];\n }\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../TileCache.js\").default} Tile cache.\n */\n getTileCacheForProjection(projection) {\n if (!ENABLE_RASTER_REPROJECTION) {\n return super.getTileCacheForProjection(projection);\n }\n const thisProj = this.getProjection();\n if (!thisProj || equivalent(thisProj, projection)) {\n return this.tileCache;\n } else {\n const projKey = getUid(projection);\n if (!(projKey in this.tileCacheForProjection)) {\n this.tileCacheForProjection[projKey] = new TileCache(\n this.tileCache.highWaterMark\n );\n }\n return this.tileCacheForProjection[projKey];\n }\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {string} key The key set on the tile.\n * @return {!import(\"../Tile.js\").default} Tile.\n * @private\n */\n createTile_(z, x, y, pixelRatio, projection, key) {\n const tileCoord = [z, x, y];\n const urlTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n projection\n );\n const tileUrl = urlTileCoord\n ? this.tileUrlFunction(urlTileCoord, pixelRatio, projection)\n : undefined;\n const tile = new this.tileClass(\n tileCoord,\n tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,\n tileUrl !== undefined ? tileUrl : '',\n this.crossOrigin,\n this.tileLoadFunction,\n this.tileOptions\n );\n tile.key = key;\n tile.addEventListener(EventType.CHANGE, this.handleTileChange.bind(this));\n return tile;\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../Tile.js\").default} Tile.\n */\n getTile(z, x, y, pixelRatio, projection) {\n const sourceProjection = this.getProjection();\n if (\n !ENABLE_RASTER_REPROJECTION ||\n !sourceProjection ||\n !projection ||\n equivalent(sourceProjection, projection)\n ) {\n return this.getTileInternal(\n z,\n x,\n y,\n pixelRatio,\n sourceProjection || projection\n );\n } else {\n const cache = this.getTileCacheForProjection(projection);\n const tileCoord = [z, x, y];\n let tile;\n const tileCoordKey = getKey(tileCoord);\n if (cache.containsKey(tileCoordKey)) {\n tile = cache.get(tileCoordKey);\n }\n const key = this.getKey();\n if (tile && tile.key == key) {\n return tile;\n } else {\n const sourceTileGrid = this.getTileGridForProjection(sourceProjection);\n const targetTileGrid = this.getTileGridForProjection(projection);\n const wrappedTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n projection\n );\n const newTile = new ReprojTile(\n sourceProjection,\n sourceTileGrid,\n projection,\n targetTileGrid,\n tileCoord,\n wrappedTileCoord,\n this.getTilePixelRatio(pixelRatio),\n this.getGutter(),\n function (z, x, y, pixelRatio) {\n return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);\n }.bind(this),\n this.reprojectionErrorThreshold_,\n this.renderReprojectionEdges_,\n this.contextOptions_\n );\n newTile.key = key;\n\n if (tile) {\n newTile.interimTile = tile;\n newTile.refreshInterimChain();\n cache.replace(tileCoordKey, newTile);\n } else {\n cache.set(tileCoordKey, newTile);\n }\n return newTile;\n }\n }\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {!import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../Tile.js\").default} Tile.\n * @protected\n */\n getTileInternal(z, x, y, pixelRatio, projection) {\n let tile = null;\n const tileCoordKey = getKeyZXY(z, x, y);\n const key = this.getKey();\n if (!this.tileCache.containsKey(tileCoordKey)) {\n tile = this.createTile_(z, x, y, pixelRatio, projection, key);\n this.tileCache.set(tileCoordKey, tile);\n } else {\n tile = this.tileCache.get(tileCoordKey);\n if (tile.key != key) {\n // The source's params changed. If the tile has an interim tile and if we\n // can use it then we use it. Otherwise we create a new tile. In both\n // cases we attempt to assign an interim tile to the new tile.\n const interimTile = tile;\n tile = this.createTile_(z, x, y, pixelRatio, projection, key);\n\n //make the new tile the head of the list,\n if (interimTile.getState() == TileState.IDLE) {\n //the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it\n tile.interimTile = interimTile.interimTile;\n } else {\n tile.interimTile = interimTile;\n }\n tile.refreshInterimChain();\n this.tileCache.replace(tileCoordKey, tile);\n }\n }\n return tile;\n }\n\n /**\n * Sets whether to render reprojection edges or not (usually for debugging).\n * @param {boolean} render Render the edges.\n * @api\n */\n setRenderReprojectionEdges(render) {\n if (\n !ENABLE_RASTER_REPROJECTION ||\n this.renderReprojectionEdges_ == render\n ) {\n return;\n }\n this.renderReprojectionEdges_ = render;\n for (const id in this.tileCacheForProjection) {\n this.tileCacheForProjection[id].clear();\n }\n this.changed();\n }\n\n /**\n * Sets the tile grid to use when reprojecting the tiles to the given\n * projection instead of the default tile grid for the projection.\n *\n * This can be useful when the default tile grid cannot be created\n * (e.g. projection has no extent defined) or\n * for optimization reasons (custom tile size, resolutions, ...).\n *\n * @param {import(\"../proj.js\").ProjectionLike} projection Projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} tilegrid Tile grid to use for the projection.\n * @api\n */\n setTileGridForProjection(projection, tilegrid) {\n if (ENABLE_RASTER_REPROJECTION) {\n const proj = getProjection(projection);\n if (proj) {\n const projKey = getUid(proj);\n if (!(projKey in this.tileGridForProjection)) {\n this.tileGridForProjection[projKey] = tilegrid;\n }\n }\n }\n }\n}\n\n/**\n * @param {ImageTile} imageTile Image tile.\n * @param {string} src Source.\n */\nfunction defaultTileLoadFunction(imageTile, src) {\n /** @type {HTMLImageElement|HTMLVideoElement} */ (imageTile.getImage()).src = src;\n}\n\nexport default TileImage;\n","/**\n * @module ol/source/XYZ\n */\n\nimport TileImage from './TileImage.js';\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [imageSmoothing=true] Enable image smoothing.\n * @property {boolean} [opaque=false] Whether the layer is opaque.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Projection.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided.\n * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided.\n * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.\n * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px\n * by 512px images (for retina/hidpi devices) then `tilePixelRatio`\n * should be set to `2`.\n * @property {number|import(\"../size.js\").Size} [tileSize=[256, 256]] The tile size used by the tile service.\n * Not used if `tileGrid` is provided.\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction] Optional function to get\n * tile URL given a tile coordinate and the projection.\n * Required if `url` or `urls` are not provided.\n * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`,\n * and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`,\n * may be used instead of defining each one separately in the `urls` option.\n * @property {Array<string>} [urls] An array of URL templates.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number} [zDirection=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n */\n\n/**\n * @classdesc\n * Layer source for tile data with URLs in a set XYZ format that are\n * defined in a URL template. By default, this follows the widely-used\n * Google grid where `x` 0 and `y` 0 are in the top left. Grids like\n * TMS where `x` 0 and `y` 0 are in the bottom left can be used by\n * using the `{-y}` placeholder in the URL template, so long as the\n * source does not have a custom tile grid. In this case,\n * {@link module:ol/source/TileImage} can be used with a `tileUrlFunction`\n * such as:\n *\n * tileUrlFunction: function(coordinate) {\n * return 'http://mapserver.com/' + coordinate[0] + '/' +\n * coordinate[1] + '/' + coordinate[2] + '.png';\n * }\n *\n * @api\n */\nclass XYZ extends TileImage {\n /**\n * @param {Options=} opt_options XYZ options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n const projection =\n options.projection !== undefined ? options.projection : 'EPSG:3857';\n\n const tileGrid =\n options.tileGrid !== undefined\n ? options.tileGrid\n : createXYZ({\n extent: extentFromProjection(projection),\n maxResolution: options.maxResolution,\n maxZoom: options.maxZoom,\n minZoom: options.minZoom,\n tileSize: options.tileSize,\n });\n\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n imageSmoothing: options.imageSmoothing,\n opaque: options.opaque,\n projection: projection,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileGrid: tileGrid,\n tileLoadFunction: options.tileLoadFunction,\n tilePixelRatio: options.tilePixelRatio,\n tileUrlFunction: options.tileUrlFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n attributionsCollapsible: options.attributionsCollapsible,\n zDirection: options.zDirection,\n });\n }\n}\n\nexport default XYZ;\n","/**\n * @module ol/source/OSM\n */\n\nimport XYZ from './XYZ.js';\n\n/**\n * The attribution containing a link to the OpenStreetMap Copyright and License\n * page.\n * @const\n * @type {string}\n * @api\n */\nexport const ATTRIBUTION =\n '© ' +\n '<a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> ' +\n 'contributors.';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.\n * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [imageSmoothing=true] Enable image smoothing.\n * @property {number} [maxZoom=19] Max zoom.\n * @property {boolean} [opaque=true] Whether the layer is opaque.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template.\n * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n */\n\n/**\n * @classdesc\n * Layer source for the OpenStreetMap tile server.\n * @api\n */\nclass OSM extends XYZ {\n /**\n * @param {Options=} [opt_options] Open Street Map options.\n */\n constructor(opt_options) {\n const options = opt_options || {};\n\n let attributions;\n if (options.attributions !== undefined) {\n attributions = options.attributions;\n } else {\n attributions = [ATTRIBUTION];\n }\n\n const crossOrigin =\n options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';\n\n const url =\n options.url !== undefined\n ? options.url\n : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';\n\n super({\n attributions: attributions,\n cacheSize: options.cacheSize,\n crossOrigin: crossOrigin,\n imageSmoothing: options.imageSmoothing,\n opaque: options.opaque !== undefined ? options.opaque : true,\n maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileLoadFunction: options.tileLoadFunction,\n url: url,\n wrapX: options.wrapX,\n attributionsCollapsible: false,\n });\n }\n}\n\nexport default OSM;\n","import 'ol/ol.css';\nimport { Map, View } from 'ol';\nimport Feature from 'ol/Feature';\nimport Point from 'ol/geom/Point';\nimport { Fill, Stroke, Style, Circle } from 'ol/style';\nimport TileLayer from 'ol/layer/Tile';\nimport OSM from 'ol/source/OSM';\nimport { fromLonLat } from 'ol/proj';\nimport VectorLayer from 'ol/layer/Vector';\nimport VectorSource from 'ol/source/Vector';\nimport Layer from 'ol/layer/Layer';\n\n/* When the user clicks on the button,\ntoggle between hiding and showing the dropdown content */\n$('.ui.dropdown')\n .dropdown()\n;\n\nexport function viewMap(center, users){\n let longLat = [center.long, center.lat];\n let WebMercator = fromLonLat(longLat);\n \n const features = users.map(({ location }) => {\n if (!location) { return; }\n\n const { longitude, latitude } = location;\n \n if (!longitude || !latitude) { return; }\n\n const marker = new Feature({\n geometry: new Point(fromLonLat([longitude, latitude])),\n name: `[${longitude},${latitude}]`\n });\n\n marker.setStyle(\n new Style({\n image: new Circle({\n fill: new Fill({ color: '#ff0000' }),\n stroke: new Stroke({ color: '#000000', width: 1 }),\n radius: 5\n })\n })\n );\n\n return marker;\n });\n\n const tileLayer = new TileLayer({\n source: new OSM()\n });\n \n const vectorLayer = new VectorLayer({\n source: new VectorSource({ features: features.filter(f => f) })\n });\n\n const map = new Map({\n target: 'map',\n layers: [\n tileLayer,\n vectorLayer,\n ],\n view: new View({\n center: WebMercator,\n zoom: 13\n })\n });\n} ","var bundleURL = null;\nfunction getBundleURLCached() {\n if (!bundleURL) {\n bundleURL = getBundleURL();\n }\n\n return bundleURL;\n}\n\nfunction getBundleURL() {\n // Attempt to find the URL of the current script and use that as the base URL\n try {\n throw new Error;\n } catch (err) {\n var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\\/\\/[^)\\n]+/g);\n if (matches) {\n return getBaseURL(matches[0]);\n }\n }\n\n return '/';\n}\n\nfunction getBaseURL(url) {\n return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\\/\\/.+)\\/[^/]+$/, '$1') + '/';\n}\n\nexports.getBundleURL = getBundleURLCached;\nexports.getBaseURL = getBaseURL;\n","var bundle = require('./bundle-url');\n\nfunction updateLink(link) {\n var newLink = link.cloneNode();\n newLink.onload = function () {\n link.remove();\n };\n newLink.href = link.href.split('?')[0] + '?' + Date.now();\n link.parentNode.insertBefore(newLink, link.nextSibling);\n}\n\nvar cssTimeout = null;\nfunction reloadCSS() {\n if (cssTimeout) {\n return;\n }\n\n cssTimeout = setTimeout(function () {\n var links = document.querySelectorAll('link[rel=\"stylesheet\"]');\n for (var i = 0; i < links.length; i++) {\n if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {\n updateLink(links[i]);\n }\n }\n\n cssTimeout = null;\n }, 50);\n}\n\nmodule.exports = reloadCSS;\n","var OVERLAY_ID = '__parcel__error__overlay__';\n\nvar OldModule = module.bundle.Module;\n\nfunction Module(moduleName) {\n OldModule.call(this, moduleName);\n this.hot = {\n data: module.bundle.hotData,\n _acceptCallbacks: [],\n _disposeCallbacks: [],\n accept: function (fn) {\n this._acceptCallbacks.push(fn || function () {});\n },\n dispose: function (fn) {\n this._disposeCallbacks.push(fn);\n }\n };\n\n module.bundle.hotData = null;\n}\n\nmodule.bundle.Module = Module;\nvar checkedAssets, assetsToAccept;\n\nvar parent = module.bundle.parent;\nif ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {\n var hostname = process.env.HMR_HOSTNAME || location.hostname;\n var protocol = location.protocol === 'https:' ? 'wss' : 'ws';\n var ws = new WebSocket(protocol + '://' + hostname + ':' + process.env.HMR_PORT + '/');\n ws.onmessage = function(event) {\n checkedAssets = {};\n assetsToAccept = [];\n\n var data = JSON.parse(event.data);\n\n if (data.type === 'update') {\n var handled = false;\n data.assets.forEach(function(asset) {\n if (!asset.isNew) {\n var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);\n if (didAccept) {\n handled = true;\n }\n }\n });\n\n // Enable HMR for CSS by default.\n handled = handled || data.assets.every(function(asset) {\n return asset.type === 'css' && asset.generated.js;\n });\n\n if (handled) {\n console.clear();\n\n data.assets.forEach(function (asset) {\n hmrApply(global.parcelRequire, asset);\n });\n\n assetsToAccept.forEach(function (v) {\n hmrAcceptRun(v[0], v[1]);\n });\n } else if (location.reload) { // `location` global exists in a web worker context but lacks `.reload()` function.\n location.reload();\n }\n }\n\n if (data.type === 'reload') {\n ws.close();\n ws.onclose = function () {\n location.reload();\n }\n }\n\n if (data.type === 'error-resolved') {\n console.log('[parcel] ✨ Error resolved');\n\n removeErrorOverlay();\n }\n\n if (data.type === 'error') {\n console.error('[parcel] 🚨 ' + data.error.message + '\\n' + data.error.stack);\n\n removeErrorOverlay();\n\n var overlay = createErrorOverlay(data);\n document.body.appendChild(overlay);\n }\n };\n}\n\nfunction removeErrorOverlay() {\n var overlay = document.getElementById(OVERLAY_ID);\n if (overlay) {\n overlay.remove();\n }\n}\n\nfunction createErrorOverlay(data) {\n var overlay = document.createElement('div');\n overlay.id = OVERLAY_ID;\n\n // html encode message and stack trace\n var message = document.createElement('div');\n var stackTrace = document.createElement('pre');\n message.innerText = data.error.message;\n stackTrace.innerText = data.error.stack;\n\n overlay.innerHTML = (\n '<div style=\"background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;\">' +\n '<span style=\"background: red; padding: 2px 4px; border-radius: 2px;\">ERROR</span>' +\n '<span style=\"top: 2px; margin-left: 5px; position: relative;\">🚨</span>' +\n '<div style=\"font-size: 18px; font-weight: bold; margin-top: 20px;\">' + message.innerHTML + '</div>' +\n '<pre>' + stackTrace.innerHTML + '</pre>' +\n '</div>'\n );\n\n return overlay;\n\n}\n\nfunction getParents(bundle, id) {\n var modules = bundle.modules;\n if (!modules) {\n return [];\n }\n\n var parents = [];\n var k, d, dep;\n\n for (k in modules) {\n for (d in modules[k][1]) {\n dep = modules[k][1][d];\n if (dep === id || (Array.isArray(dep) && dep[dep.length - 1] === id)) {\n parents.push(k);\n }\n }\n }\n\n if (bundle.parent) {\n parents = parents.concat(getParents(bundle.parent, id));\n }\n\n return parents;\n}\n\nfunction hmrApply(bundle, asset) {\n var modules = bundle.modules;\n if (!modules) {\n return;\n }\n\n if (modules[asset.id] || !bundle.parent) {\n var fn = new Function('require', 'module', 'exports', asset.generated.js);\n asset.isNew = !modules[asset.id];\n modules[asset.id] = [fn, asset.deps];\n } else if (bundle.parent) {\n hmrApply(bundle.parent, asset);\n }\n}\n\nfunction hmrAcceptCheck(bundle, id) {\n var modules = bundle.modules;\n if (!modules) {\n return;\n }\n\n if (!modules[id] && bundle.parent) {\n return hmrAcceptCheck(bundle.parent, id);\n }\n\n if (checkedAssets[id]) {\n return;\n }\n checkedAssets[id] = true;\n\n var cached = bundle.cache[id];\n\n assetsToAccept.push([bundle, id]);\n\n if (cached && cached.hot && cached.hot._acceptCallbacks.length) {\n return true;\n }\n\n return getParents(global.parcelRequire, id).some(function (id) {\n return hmrAcceptCheck(global.parcelRequire, id)\n });\n}\n\nfunction hmrAcceptRun(bundle, id) {\n var cached = bundle.cache[id];\n bundle.hotData = {};\n if (cached) {\n cached.hot.data = bundle.hotData;\n }\n\n if (cached && cached.hot && cached.hot._disposeCallbacks.length) {\n cached.hot._disposeCallbacks.forEach(function (cb) {\n cb(bundle.hotData);\n });\n }\n\n delete bundle.cache[id];\n bundle(id);\n\n cached = bundle.cache[id];\n if (cached && cached.hot && cached.hot._acceptCallbacks.length) {\n cached.hot._acceptCallbacks.forEach(function (cb) {\n cb();\n });\n return true;\n }\n}\n"]} \ No newline at end of file diff --git a/public/assets/js/general.js b/public/assets/js/general.js deleted file mode 100644 index b39ea1724be5f8711890be6559a262f078aac1aa..0000000000000000000000000000000000000000 --- a/public/assets/js/general.js +++ /dev/null @@ -1,5 +0,0 @@ -/* When the user clicks on the button, -toggle between hiding and showing the dropdown content */ -$('.ui.dropdown') - .dropdown() -; \ No newline at end of file diff --git a/public/assets/js/map.js b/public/assets/js/map.js new file mode 100644 index 0000000000000000000000000000000000000000..fa8ae09354e3b275cc1a82f39111430d12bae015 --- /dev/null +++ b/public/assets/js/map.js @@ -0,0 +1,67 @@ +import 'ol/ol.css'; +import { Map, View } from 'ol'; +import Feature from 'ol/Feature'; +import Point from 'ol/geom/Point'; +import { Fill, Stroke, Style, Circle } from 'ol/style'; +import TileLayer from 'ol/layer/Tile'; +import OSM from 'ol/source/OSM'; +import { fromLonLat } from 'ol/proj'; +import VectorLayer from 'ol/layer/Vector'; +import VectorSource from 'ol/source/Vector'; +import Layer from 'ol/layer/Layer'; + +/* When the user clicks on the button, +toggle between hiding and showing the dropdown content */ +$('.ui.dropdown') + .dropdown() +; + +export function viewMap(center, users){ + let longLat = [center.long, center.lat]; + let WebMercator = fromLonLat(longLat); + + const features = users.map(({ location }) => { + if (!location) { return; } + + const { longitude, latitude } = location; + + if (!longitude || !latitude) { return; } + + const marker = new Feature({ + geometry: new Point(fromLonLat([longitude, latitude])), + name: `[${longitude},${latitude}]` + }); + + marker.setStyle( + new Style({ + image: new Circle({ + fill: new Fill({ color: '#ff0000' }), + stroke: new Stroke({ color: '#000000', width: 1 }), + radius: 5 + }) + }) + ); + + return marker; + }); + + const tileLayer = new TileLayer({ + source: new OSM() + }); + + const vectorLayer = new VectorLayer({ + source: new VectorSource({ features: features.filter(f => f) }) + }); + + const map = new Map({ + target: 'map', + layers: [ + tileLayer, + vectorLayer, + ], + view: new View({ + center: WebMercator, + zoom: 13 + }) + }); +} \ No newline at end of file