From 064ec75ed3f5f385091ef86ebaa0ee24f18d182b Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Tue, 21 Nov 2023 12:53:58 +0100 Subject: [PATCH] Adding the ability to click on things. --- js-src/conquer/index.ts | 142 +++++++++++-- public/js/bundle.js | 432 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 558 insertions(+), 16 deletions(-) diff --git a/js-src/conquer/index.ts b/js-src/conquer/index.ts index 345c4a9..3ca5013 100644 --- a/js-src/conquer/index.ts +++ b/js-src/conquer/index.ts @@ -1,4 +1,6 @@ import Map from "ol/Map" +import MapEvent from "ol/MapEvent" +import MapBrowserEvent from "ol/MapBrowserEvent" import View from "ol/View" import Projection from "ol/proj/Projection.js" import TileLayer from 'ol/layer/Tile' @@ -6,7 +8,16 @@ import OSM from 'ol/source/OSM' import * as olProj from "ol/proj" import Feature from 'ol/Feature' import Point from 'ol/geom/Point' +import VectorLayer from 'ol/layer/Vector' +import VectorSource from 'ol/source/Vector' +import Stroke from 'ol/style/Stroke' +import Fill from 'ol/style/Fill' +import CircleStyle from 'ol/style/Circle' +import Style from 'ol/style/Style' +import BaseEvent from 'ol/events/Event' +import {click} from 'ol/events/condition' +type StylesInterface = Record export default class Conquer { private conquerContainer: HTMLDivElement private map: Map @@ -30,6 +41,7 @@ export default class Conquer { private conquerRegisterSubmit: HTMLButtonElement private conquerRegisterError: HTMLParagraphElement private currentPositionFeature: Feature | null + private vectorLayer: VectorLayer | null = null private alpha = 0 private beta = 0 private gamma = 0 @@ -129,7 +141,61 @@ export default class Conquer { this.unsetLoginAndRegisterErrors() const isLogged = await this.isLogged() if (isLogged) { - await this.removeLoginRegisterCombo() + this.onLoginSuccess() + } + } + async onLoginSuccess(): Promise { + await this.removeLoginRegisterCombo() + const currentPositionFeature = this.currentPositionFeature + if (currentPositionFeature === null) { + return + } + this.map.on('click', (event: MapEvent) => { + this.onClickMap(event) + }) + } + + async onClickMap(event: MapEvent): Promise { + if (this.vectorLayer === null) { + return + } + if (!(event instanceof MapBrowserEvent)) { + return + } + if (event.dragging) { + return + } + const pixel = event.pixel + const features = this.map.getFeaturesAtPixel(pixel) + const feature = features.length ? features[0] : undefined + if (feature === undefined) { + return + } + if (!(feature instanceof Feature)) { + return + } + this.onClickFeature(feature) + } + + async onClickSelf(): Promise { + alert('Pulsaste en ti mismo') + } + private isFeatureEnabledMap: Record = {} + + async onClickFeature(feature: Feature): Promise { + if (this.isFeatureEnabledMap[feature.getProperties().type] === undefined) { + this.isFeatureEnabledMap[feature.getProperties().type] = true + } + if (!this.isFeatureEnabledMap[feature.getProperties().type]) { + return + } + this.isFeatureEnabledMap[feature.getProperties().type] = false + window.setTimeout(() => { + this.isFeatureEnabledMap[feature.getProperties().type] = true + }, 100); + if (feature === this.currentPositionFeature) { + this.onClickSelf() + return } } @@ -252,13 +318,19 @@ export default class Conquer { this.conquerRegisterError.innerText = error this.conquerRegisterError.classList.remove('conquer-display-none') } - async run() { - this.fillConquerLogin() - this.fillConquerRegister() + + async checkLogin(): Promise { const isLogged = await this.isLogged() if (!isLogged) { this.conquerLogin.classList.remove('conquer-display-none') + return } + this.onLoginSuccess() + } + async run() { + this.fillConquerLogin() + this.fillConquerRegister() + this.checkLogin() const conquerContainer = this.conquerContainer //layer.on('prerender', (evt) => { // // return @@ -302,6 +374,15 @@ export default class Conquer { } } + addCurrentLocationMarkerToMap(currentLatitude: number, + currentLongitude: number) { + const currentPositionFeature = new Feature({ + type: 'currentPositionFeature', + geometry: new Point(this.realCoordinatesToOl(currentLatitude, currentLongitude)) + }) + this.currentPositionFeature = currentPositionFeature + } + processLocation(location: GeolocationPosition) { this.currentLatitude = location.coords.latitude this.currentLongitude = location. coords.longitude @@ -309,13 +390,44 @@ export default class Conquer { this.disableSetRotationOffset = true this.heading = location.coords.heading this.rotationOffset = this.compassHeading(this.alpha, this.beta, this.gamma) + (location.coords.heading*Math.PI*2)/360 - this.setCenterDisplaced(this.currentLatitude, this.currentLongitude) - const currentPositionFeature = new Feature({ - type: 'currentPositionFeature', - geometry: new Point([this.currentLatitude, this.currentLongitude]) - }) - this.currentPositionFeature = currentPositionFeature } + this.setCenterDisplaced(this.currentLatitude, this.currentLongitude) + this.addCurrentLocationMarkerToMap(this.currentLatitude, this.currentLongitude) + this.refreshLayers() + } + + private refreshLayers(): void { + if (this.currentPositionFeature === null) { + return + } + const styles: StylesInterface = { + currentPositionFeature: new Style({ + image: new CircleStyle({ + radius: 14, + fill: new Fill({color: 'white'}), + stroke: new Stroke({ + color: 'blue', + width: 2, + }) + }) + }) + }; + const vectorLayer = new VectorLayer({ + source: new VectorSource({ + features: [this.currentPositionFeature] + }), + }) + if (this.vectorLayer !== null) { + this.map.removeLayer(this.vectorLayer) + } + vectorLayer.setStyle((feature) => { + return styles[feature.getProperties().type] + }) + this.map.addLayer(vectorLayer) + this.vectorLayer = vectorLayer + this.map.on('click', (event: MapEvent) => { + this.onClickMap(event) + }) } setLocationChangeTriggers(): void { window.setInterval(() => { @@ -330,18 +442,20 @@ export default class Conquer { return }, { enableHighAccuracy: true, - maximumAge: 0 }) - }, 1000) + }, 3000) }, 1000) - this.setCenterDisplaced(37.58237, -5.96766) + const initialLatitude = 37.58237 + const initialLongitude = -5.96766 + this.setCenterDisplaced(initialLatitude, initialLongitude) + this.addCurrentLocationMarkerToMap(initialLatitude, initialLongitude) + this.refreshLayers() navigator.geolocation.watchPosition((location) => { this.processLocation(location) }, (err) => { return }, { enableHighAccuracy: true, - maximumAge: 0 }) } realCoordinatesToOl(lat: number, lon: number): number[] { diff --git a/public/js/bundle.js b/public/js/bundle.js index 265b882..4279529 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -20,6 +20,16 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tabl /***/ }), +/***/ "./node_modules/rbush/rbush.min.js": +/*!*****************************************!*\ + !*** ./node_modules/rbush/rbush.min.js ***! + \*****************************************/ +/***/ (function(module) { + +eval("!function(t,i){ true?module.exports=i():0}(this,function(){\"use strict\";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return ti?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r});\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/rbush/rbush.min.js?"); + +/***/ }), + /***/ "./node_modules/tablesort/src/sorts/tablesort.number.js": /*!**************************************************************!*\ !*** ./node_modules/tablesort/src/sorts/tablesort.number.js ***! @@ -47,7 +57,7 @@ eval(";(function() {\n function Tablesort(el, options) {\n if (!(this instan /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Conquer)\n/* harmony export */ });\n/* harmony import */ var ol_Map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ol/Map */ \"./node_modules/ol/Map.js\");\n/* harmony import */ var ol_View__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ol/View */ \"./node_modules/ol/View.js\");\n/* harmony import */ var ol_proj_Projection_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ol/proj/Projection.js */ \"./node_modules/ol/proj/Projection.js\");\n/* harmony import */ var ol_layer_Tile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ol/layer/Tile */ \"./node_modules/ol/layer/Tile.js\");\n/* harmony import */ var ol_source_OSM__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ol/source/OSM */ \"./node_modules/ol/source/OSM.js\");\n/* harmony import */ var ol_proj__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ol/proj */ \"./node_modules/ol/proj.js\");\n/* harmony import */ var ol_Feature__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ol/Feature */ \"./node_modules/ol/Feature.js\");\n/* harmony import */ var ol_geom_Point__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ol/geom/Point */ \"./node_modules/ol/geom/Point.js\");\n\n\n\n\n\n\n\n\nclass Conquer {\n static start() {\n const conquerContainer = document.querySelector(\".conquer-container\");\n if (conquerContainer !== null) {\n if (!(conquerContainer instanceof HTMLDivElement)) {\n console.error(\".conquer-container is not a div.\");\n return;\n }\n const conquer = new Conquer(conquerContainer);\n conquer.run();\n }\n }\n setCenterDisplaced(lat, lon) {\n const olCoordinates = this.realCoordinatesToOl(lat, lon);\n const size = this.map.getSize();\n if (size === undefined) {\n return;\n }\n this.map.getView().centerOn(olCoordinates, size, [size[0] / 2, size[1] - 60]);\n }\n static fail(error) {\n alert('Error de interfaz');\n throw new Error(error);\n }\n fillConquerLogin() {\n const conquerLogin = document.querySelector('.conquer-login');\n if (conquerLogin === null || !(conquerLogin instanceof HTMLDivElement)) {\n Conquer.fail('conquerLogin is invalid');\n }\n this.conquerLogin = conquerLogin;\n const conquerLoginGoToRegister = document.querySelector('.conquer-login-go-to-register');\n if (conquerLoginGoToRegister === null || !(conquerLoginGoToRegister instanceof HTMLAnchorElement)) {\n Conquer.fail('Link to go to register from login is invalid.');\n }\n this.conquerLoginGoToRegister = conquerLoginGoToRegister;\n this.conquerLoginGoToRegister.addEventListener('click', () => {\n this.goToRegister();\n });\n const conquerLoginError = document.querySelector('.conquer-login-error');\n if (conquerLoginError === null || !(conquerLoginError instanceof HTMLParagraphElement)) {\n Conquer.fail('Unable to find conquer login error.');\n }\n this.conquerLoginError = conquerLoginError;\n const conquerLoginSuccess = document.querySelector('.conquer-login-success');\n if (conquerLoginSuccess === null || !(conquerLoginSuccess instanceof HTMLParagraphElement)) {\n Conquer.fail('Unable to find conquer login success.');\n }\n this.conquerLoginSuccess = conquerLoginSuccess;\n const conquerLoginUsername = document.querySelector('.conquer-login-username');\n if (conquerLoginUsername === null || !(conquerLoginUsername instanceof HTMLInputElement)) {\n Conquer.fail('Unable to find conquer login username field.');\n }\n this.conquerLoginUsername = conquerLoginUsername;\n const conquerLoginPassword = document.querySelector('.conquer-login-password');\n if (conquerLoginPassword === null || !(conquerLoginPassword instanceof HTMLInputElement)) {\n Conquer.fail('Unable to find conquer login password field.');\n }\n this.conquerLoginPassword = conquerLoginPassword;\n const conquerLoginSubmit = document.querySelector('.conquer-login-submit');\n if (conquerLoginSubmit === null || !(conquerLoginSubmit instanceof HTMLButtonElement)) {\n Conquer.fail('Unable to find the submit button for the login.');\n }\n this.conquerLoginSubmit = conquerLoginSubmit;\n this.conquerLoginSubmit.addEventListener('click', (event) => {\n event.preventDefault();\n this.onLoginRequested();\n });\n }\n async onLoginRequested() {\n const username = this.conquerLoginUsername.value;\n const password = this.conquerLoginPassword.value;\n const urlUser = new URL('/conquer/user/login', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n let responseJson;\n let status;\n try {\n const response = await fetch(urlUser, {\n method: 'POST',\n body: JSON.stringify({\n username: username,\n password: password,\n })\n });\n responseJson = await response.json();\n status = response.status;\n }\n catch (e) {\n console.error(e);\n this.addNewLoginError('El servidor ha enviado datos inesperados.');\n return;\n }\n if (status !== 200) {\n this.addNewLoginError(responseJson.error);\n return;\n }\n this.unsetLoginAndRegisterErrors();\n const isLogged = await this.isLogged();\n if (isLogged) {\n await this.removeLoginRegisterCombo();\n }\n }\n async goToRegister() {\n const isLogged = await this.isLogged();\n await this.removeLoginRegisterCombo();\n if (!isLogged) {\n this.conquerRegister.classList.remove('conquer-display-none');\n }\n }\n async goToLogin() {\n const isLogged = await this.isLogged();\n await this.removeLoginRegisterCombo();\n if (!isLogged) {\n this.conquerLogin.classList.remove('conquer-display-none');\n }\n }\n async removeLoginRegisterCombo() {\n this.conquerLogin.classList.add('conquer-display-none');\n this.conquerRegister.classList.add('conquer-display-none');\n }\n fillConquerRegister() {\n const conquerRegister = document.querySelector('.conquer-register');\n if (conquerRegister === null || !(conquerRegister instanceof HTMLDivElement)) {\n Conquer.fail('conquerRegister is invalid');\n }\n this.conquerRegister = conquerRegister;\n const conquerRegisterGoToLogin = document.querySelector('.conquer-register-go-to-login');\n if (conquerRegisterGoToLogin === null || !(conquerRegisterGoToLogin instanceof HTMLAnchorElement)) {\n Conquer.fail('Link to go to login from register is invalid.');\n }\n this.conquerRegisterGoToLogin = conquerRegisterGoToLogin;\n this.conquerRegisterGoToLogin.addEventListener('click', () => {\n this.goToLogin();\n });\n const conquerRegisterUsername = document.querySelector('.conquer-register-username');\n if (conquerRegisterUsername === null || !(conquerRegisterUsername instanceof HTMLInputElement)) {\n Conquer.fail('No username field in conquer register.');\n }\n this.conquerRegisterUsername = conquerRegisterUsername;\n const conquerRegisterPassword = document.querySelector('.conquer-register-password');\n if (conquerRegisterPassword === null || !(conquerRegisterPassword instanceof HTMLInputElement)) {\n Conquer.fail('No password field in conquer register.');\n }\n this.conquerRegisterPassword = conquerRegisterPassword;\n const conquerRegisterRepeatPassword = document.querySelector('.conquer-register-repeat-password');\n if (conquerRegisterRepeatPassword === null || !(conquerRegisterRepeatPassword instanceof HTMLInputElement)) {\n Conquer.fail('No repeat password field in conquer register.');\n }\n this.conquerRegisterRepeatPassword = conquerRegisterRepeatPassword;\n const conquerRegisterSubmit = document.querySelector('.conquer-register-submit');\n if (conquerRegisterSubmit === null || !(conquerRegisterSubmit instanceof HTMLButtonElement)) {\n Conquer.fail('No register submit button found.');\n }\n this.conquerRegisterSubmit = conquerRegisterSubmit;\n this.conquerRegisterSubmit.addEventListener('click', (event) => {\n event.preventDefault();\n this.onRegisterRequest();\n });\n const conquerRegisterError = document.querySelector('.conquer-register-error');\n if (conquerRegisterError === null || !(conquerRegisterError instanceof HTMLParagraphElement)) {\n Conquer.fail('Unable to find the conquer error element.');\n }\n this.conquerRegisterError = conquerRegisterError;\n }\n unsetLoginAndRegisterErrors() {\n this.conquerRegisterError.classList.add('conquer-display-none');\n this.conquerLoginError.classList.add('conquer-display-none');\n }\n async onRegisterRequest() {\n const username = this.conquerRegisterUsername.value;\n const password = this.conquerRegisterPassword.value;\n const repeatPassword = this.conquerRegisterRepeatPassword.value;\n const urlUser = new URL('/conquer/user', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n let responseJson;\n let status;\n try {\n const response = await fetch(urlUser, {\n method: 'PUT',\n body: JSON.stringify({\n username: username,\n password: password,\n repeat_password: repeatPassword\n })\n });\n responseJson = await response.json();\n status = response.status;\n }\n catch (e) {\n console.error(e);\n this.addNewRegisterError('El servidor ha enviado datos inesperados.');\n return;\n }\n if (status !== 200) {\n this.addNewRegisterError(responseJson.error);\n return;\n }\n this.addNewLoginSuccessText(`Usuario registrado ${username}.`);\n this.goToLogin();\n }\n addNewLoginSuccessText(message) {\n this.unsetLoginAndRegisterErrors();\n this.conquerLoginSuccess.innerText = message;\n this.conquerLoginSuccess.classList.remove('conquer-display-none');\n }\n addNewLoginError(error) {\n this.unsetLoginAndRegisterErrors();\n this.conquerLoginSuccess.classList.add('conquer-display-none');\n this.conquerLoginError.innerText = error;\n this.conquerLoginError.classList.remove('conquer-display-none');\n }\n addNewRegisterError(error) {\n this.unsetLoginAndRegisterErrors();\n this.conquerLoginSuccess.classList.add('conquer-display-none');\n this.conquerRegisterError.innerText = error;\n this.conquerRegisterError.classList.remove('conquer-display-none');\n }\n async run() {\n this.fillConquerLogin();\n this.fillConquerRegister();\n const isLogged = await this.isLogged();\n if (!isLogged) {\n this.conquerLogin.classList.remove('conquer-display-none');\n }\n const conquerContainer = this.conquerContainer;\n //layer.on('prerender', (evt) => {\n // // return\n // if (evt.context) {\n // const context = evt.context as CanvasRenderingContext2D\n // context.filter = 'grayscale(80%) invert(100%) '\n // context.globalCompositeOperation = 'source-over'\n // }\n //})\n //layer.on('postrender', (evt) => {\n // if (evt.context) {\n // const context = evt.context as CanvasRenderingContext2D\n // context.filter = 'none'\n // }\n //})\n ol_proj__WEBPACK_IMPORTED_MODULE_0__.useGeographic();\n this.map = new ol_Map__WEBPACK_IMPORTED_MODULE_1__[\"default\"]({\n target: conquerContainer,\n layers: [\n new ol_layer_Tile__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n source: new ol_source_OSM__WEBPACK_IMPORTED_MODULE_3__[\"default\"]()\n })\n ],\n view: new ol_View__WEBPACK_IMPORTED_MODULE_4__[\"default\"]({\n zoom: 21,\n maxZoom: 22,\n }),\n });\n this.setLocationChangeTriggers();\n this.setRotationChangeTriggers();\n }\n setRotationChangeTriggers() {\n if (window.DeviceOrientationEvent) {\n window.addEventListener(\"deviceorientation\", (event) => {\n if (event.alpha !== null && event.beta !== null && event.gamma !== null) {\n this.onRotate(event.alpha, event.beta, event.gamma);\n }\n }, true);\n }\n }\n processLocation(location) {\n this.currentLatitude = location.coords.latitude;\n this.currentLongitude = location.coords.longitude;\n if (location.coords.heading !== null && (this.alpha != 0 || this.beta != 0 || this.gamma != 0) && !this.disableSetRotationOffset) {\n this.disableSetRotationOffset = true;\n this.heading = location.coords.heading;\n this.rotationOffset = this.compassHeading(this.alpha, this.beta, this.gamma) + (location.coords.heading * Math.PI * 2) / 360;\n this.setCenterDisplaced(this.currentLatitude, this.currentLongitude);\n const currentPositionFeature = new ol_Feature__WEBPACK_IMPORTED_MODULE_5__[\"default\"]({\n type: 'currentPositionFeature',\n geometry: new ol_geom_Point__WEBPACK_IMPORTED_MODULE_6__[\"default\"]([this.currentLatitude, this.currentLongitude])\n });\n this.currentPositionFeature = currentPositionFeature;\n }\n }\n setLocationChangeTriggers() {\n window.setInterval(() => {\n this.disableSetRotationOffset = false;\n }, 10000);\n this.currentPositionFeature = null;\n window.setTimeout(() => {\n window.setInterval(() => {\n navigator.geolocation.getCurrentPosition((location) => {\n this.processLocation(location);\n }, () => {\n return;\n }, {\n enableHighAccuracy: true,\n maximumAge: 0\n });\n }, 1000);\n }, 1000);\n this.setCenterDisplaced(37.58237, -5.96766);\n navigator.geolocation.watchPosition((location) => {\n this.processLocation(location);\n }, (err) => {\n return;\n }, {\n enableHighAccuracy: true,\n maximumAge: 0\n });\n }\n realCoordinatesToOl(lat, lon) {\n return ol_proj__WEBPACK_IMPORTED_MODULE_0__.transform([lon, lat], new ol_proj_Projection_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({ code: \"WGS84\" }), new ol_proj_Projection_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({ code: \"EPSG:900913\" }));\n }\n compassHeading(alpha, beta, gamma) {\n const alphaRad = alpha * (Math.PI / 180);\n return alphaRad;\n }\n logToServer(logValue) {\n const urlLog = new URL('/conquer/log', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n urlLog.searchParams.append('log', logValue);\n fetch(urlLog).then(() => {\n return;\n }).catch((error) => {\n console.error(error);\n });\n }\n onRotate(alpha, beta, gamma) {\n if (this.enabledOnRotate) {\n this.alpha = alpha;\n this.beta = beta;\n this.gamma = gamma;\n this.enabledOnRotate = false;\n this.map.getView().setRotation((this.compassHeading(alpha, beta, gamma) - this.rotationOffset));\n window.setTimeout(() => {\n this.enabledOnRotate = true;\n }, 10);\n }\n this.setCenterDisplaced(this.currentLatitude, this.currentLongitude);\n }\n constructor(conquerContainer) {\n this.rotationOffset = 0;\n this.heading = 0;\n this.disableSetRotationOffset = false;\n this.alpha = 0;\n this.beta = 0;\n this.gamma = 0;\n this.enabledOnRotate = true;\n this.conquerContainer = conquerContainer;\n }\n async addNewLoginRegisterError(message) {\n this.addNewRegisterError(message);\n this.addNewLoginError(message);\n }\n async isLogged() {\n const urlUser = new URL('/conquer/user', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n let responseJson;\n let status;\n try {\n const response = await fetch(urlUser);\n status = response.status;\n }\n catch {\n this.addNewLoginRegisterError('Error del servidor');\n return false;\n }\n return status === 200;\n }\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/conquer/index.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Conquer)\n/* harmony export */ });\n/* harmony import */ var ol_Map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ol/Map */ \"./node_modules/ol/Map.js\");\n/* harmony import */ var ol_MapBrowserEvent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ol/MapBrowserEvent */ \"./node_modules/ol/MapBrowserEvent.js\");\n/* harmony import */ var ol_View__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ol/View */ \"./node_modules/ol/View.js\");\n/* harmony import */ var ol_proj_Projection_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ol/proj/Projection.js */ \"./node_modules/ol/proj/Projection.js\");\n/* harmony import */ var ol_layer_Tile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ol/layer/Tile */ \"./node_modules/ol/layer/Tile.js\");\n/* harmony import */ var ol_source_OSM__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ol/source/OSM */ \"./node_modules/ol/source/OSM.js\");\n/* harmony import */ var ol_proj__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ol/proj */ \"./node_modules/ol/proj.js\");\n/* harmony import */ var ol_Feature__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ol/Feature */ \"./node_modules/ol/Feature.js\");\n/* harmony import */ var ol_geom_Point__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ol/geom/Point */ \"./node_modules/ol/geom/Point.js\");\n/* harmony import */ var ol_layer_Vector__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ol/layer/Vector */ \"./node_modules/ol/layer/Vector.js\");\n/* harmony import */ var ol_source_Vector__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ol/source/Vector */ \"./node_modules/ol/source/Vector.js\");\n/* harmony import */ var ol_style_Stroke__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ol/style/Stroke */ \"./node_modules/ol/style/Stroke.js\");\n/* harmony import */ var ol_style_Fill__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ol/style/Fill */ \"./node_modules/ol/style/Fill.js\");\n/* harmony import */ var ol_style_Circle__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ol/style/Circle */ \"./node_modules/ol/style/Circle.js\");\n/* harmony import */ var ol_style_Style__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ol/style/Style */ \"./node_modules/ol/style/Style.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass Conquer {\n static start() {\n const conquerContainer = document.querySelector(\".conquer-container\");\n if (conquerContainer !== null) {\n if (!(conquerContainer instanceof HTMLDivElement)) {\n console.error(\".conquer-container is not a div.\");\n return;\n }\n const conquer = new Conquer(conquerContainer);\n conquer.run();\n }\n }\n setCenterDisplaced(lat, lon) {\n const olCoordinates = this.realCoordinatesToOl(lat, lon);\n const size = this.map.getSize();\n if (size === undefined) {\n return;\n }\n this.map.getView().centerOn(olCoordinates, size, [size[0] / 2, size[1] - 60]);\n }\n static fail(error) {\n alert('Error de interfaz');\n throw new Error(error);\n }\n fillConquerLogin() {\n const conquerLogin = document.querySelector('.conquer-login');\n if (conquerLogin === null || !(conquerLogin instanceof HTMLDivElement)) {\n Conquer.fail('conquerLogin is invalid');\n }\n this.conquerLogin = conquerLogin;\n const conquerLoginGoToRegister = document.querySelector('.conquer-login-go-to-register');\n if (conquerLoginGoToRegister === null || !(conquerLoginGoToRegister instanceof HTMLAnchorElement)) {\n Conquer.fail('Link to go to register from login is invalid.');\n }\n this.conquerLoginGoToRegister = conquerLoginGoToRegister;\n this.conquerLoginGoToRegister.addEventListener('click', () => {\n this.goToRegister();\n });\n const conquerLoginError = document.querySelector('.conquer-login-error');\n if (conquerLoginError === null || !(conquerLoginError instanceof HTMLParagraphElement)) {\n Conquer.fail('Unable to find conquer login error.');\n }\n this.conquerLoginError = conquerLoginError;\n const conquerLoginSuccess = document.querySelector('.conquer-login-success');\n if (conquerLoginSuccess === null || !(conquerLoginSuccess instanceof HTMLParagraphElement)) {\n Conquer.fail('Unable to find conquer login success.');\n }\n this.conquerLoginSuccess = conquerLoginSuccess;\n const conquerLoginUsername = document.querySelector('.conquer-login-username');\n if (conquerLoginUsername === null || !(conquerLoginUsername instanceof HTMLInputElement)) {\n Conquer.fail('Unable to find conquer login username field.');\n }\n this.conquerLoginUsername = conquerLoginUsername;\n const conquerLoginPassword = document.querySelector('.conquer-login-password');\n if (conquerLoginPassword === null || !(conquerLoginPassword instanceof HTMLInputElement)) {\n Conquer.fail('Unable to find conquer login password field.');\n }\n this.conquerLoginPassword = conquerLoginPassword;\n const conquerLoginSubmit = document.querySelector('.conquer-login-submit');\n if (conquerLoginSubmit === null || !(conquerLoginSubmit instanceof HTMLButtonElement)) {\n Conquer.fail('Unable to find the submit button for the login.');\n }\n this.conquerLoginSubmit = conquerLoginSubmit;\n this.conquerLoginSubmit.addEventListener('click', (event) => {\n event.preventDefault();\n this.onLoginRequested();\n });\n }\n async onLoginRequested() {\n const username = this.conquerLoginUsername.value;\n const password = this.conquerLoginPassword.value;\n const urlUser = new URL('/conquer/user/login', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n let responseJson;\n let status;\n try {\n const response = await fetch(urlUser, {\n method: 'POST',\n body: JSON.stringify({\n username: username,\n password: password,\n })\n });\n responseJson = await response.json();\n status = response.status;\n }\n catch (e) {\n console.error(e);\n this.addNewLoginError('El servidor ha enviado datos inesperados.');\n return;\n }\n if (status !== 200) {\n this.addNewLoginError(responseJson.error);\n return;\n }\n this.unsetLoginAndRegisterErrors();\n const isLogged = await this.isLogged();\n if (isLogged) {\n this.onLoginSuccess();\n }\n }\n async onLoginSuccess() {\n await this.removeLoginRegisterCombo();\n const currentPositionFeature = this.currentPositionFeature;\n if (currentPositionFeature === null) {\n return;\n }\n this.map.on('click', (event) => {\n this.onClickMap(event);\n });\n }\n async onClickMap(event) {\n if (this.vectorLayer === null) {\n return;\n }\n if (!(event instanceof ol_MapBrowserEvent__WEBPACK_IMPORTED_MODULE_1__[\"default\"])) {\n return;\n }\n if (event.dragging) {\n return;\n }\n const pixel = event.pixel;\n const features = this.map.getFeaturesAtPixel(pixel);\n const feature = features.length ? features[0] : undefined;\n if (feature === undefined) {\n return;\n }\n if (!(feature instanceof ol_Feature__WEBPACK_IMPORTED_MODULE_2__[\"default\"])) {\n return;\n }\n this.onClickFeature(feature);\n }\n async onClickSelf() {\n alert('Pulsaste en ti mismo');\n }\n async onClickFeature(feature) {\n if (this.isFeatureEnabledMap[feature.getProperties().type] === undefined) {\n this.isFeatureEnabledMap[feature.getProperties().type] = true;\n }\n if (!this.isFeatureEnabledMap[feature.getProperties().type]) {\n return;\n }\n this.isFeatureEnabledMap[feature.getProperties().type] = false;\n window.setTimeout(() => {\n this.isFeatureEnabledMap[feature.getProperties().type] = true;\n }, 100);\n if (feature === this.currentPositionFeature) {\n this.onClickSelf();\n return;\n }\n }\n async goToRegister() {\n const isLogged = await this.isLogged();\n await this.removeLoginRegisterCombo();\n if (!isLogged) {\n this.conquerRegister.classList.remove('conquer-display-none');\n }\n }\n async goToLogin() {\n const isLogged = await this.isLogged();\n await this.removeLoginRegisterCombo();\n if (!isLogged) {\n this.conquerLogin.classList.remove('conquer-display-none');\n }\n }\n async removeLoginRegisterCombo() {\n this.conquerLogin.classList.add('conquer-display-none');\n this.conquerRegister.classList.add('conquer-display-none');\n }\n fillConquerRegister() {\n const conquerRegister = document.querySelector('.conquer-register');\n if (conquerRegister === null || !(conquerRegister instanceof HTMLDivElement)) {\n Conquer.fail('conquerRegister is invalid');\n }\n this.conquerRegister = conquerRegister;\n const conquerRegisterGoToLogin = document.querySelector('.conquer-register-go-to-login');\n if (conquerRegisterGoToLogin === null || !(conquerRegisterGoToLogin instanceof HTMLAnchorElement)) {\n Conquer.fail('Link to go to login from register is invalid.');\n }\n this.conquerRegisterGoToLogin = conquerRegisterGoToLogin;\n this.conquerRegisterGoToLogin.addEventListener('click', () => {\n this.goToLogin();\n });\n const conquerRegisterUsername = document.querySelector('.conquer-register-username');\n if (conquerRegisterUsername === null || !(conquerRegisterUsername instanceof HTMLInputElement)) {\n Conquer.fail('No username field in conquer register.');\n }\n this.conquerRegisterUsername = conquerRegisterUsername;\n const conquerRegisterPassword = document.querySelector('.conquer-register-password');\n if (conquerRegisterPassword === null || !(conquerRegisterPassword instanceof HTMLInputElement)) {\n Conquer.fail('No password field in conquer register.');\n }\n this.conquerRegisterPassword = conquerRegisterPassword;\n const conquerRegisterRepeatPassword = document.querySelector('.conquer-register-repeat-password');\n if (conquerRegisterRepeatPassword === null || !(conquerRegisterRepeatPassword instanceof HTMLInputElement)) {\n Conquer.fail('No repeat password field in conquer register.');\n }\n this.conquerRegisterRepeatPassword = conquerRegisterRepeatPassword;\n const conquerRegisterSubmit = document.querySelector('.conquer-register-submit');\n if (conquerRegisterSubmit === null || !(conquerRegisterSubmit instanceof HTMLButtonElement)) {\n Conquer.fail('No register submit button found.');\n }\n this.conquerRegisterSubmit = conquerRegisterSubmit;\n this.conquerRegisterSubmit.addEventListener('click', (event) => {\n event.preventDefault();\n this.onRegisterRequest();\n });\n const conquerRegisterError = document.querySelector('.conquer-register-error');\n if (conquerRegisterError === null || !(conquerRegisterError instanceof HTMLParagraphElement)) {\n Conquer.fail('Unable to find the conquer error element.');\n }\n this.conquerRegisterError = conquerRegisterError;\n }\n unsetLoginAndRegisterErrors() {\n this.conquerRegisterError.classList.add('conquer-display-none');\n this.conquerLoginError.classList.add('conquer-display-none');\n }\n async onRegisterRequest() {\n const username = this.conquerRegisterUsername.value;\n const password = this.conquerRegisterPassword.value;\n const repeatPassword = this.conquerRegisterRepeatPassword.value;\n const urlUser = new URL('/conquer/user', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n let responseJson;\n let status;\n try {\n const response = await fetch(urlUser, {\n method: 'PUT',\n body: JSON.stringify({\n username: username,\n password: password,\n repeat_password: repeatPassword\n })\n });\n responseJson = await response.json();\n status = response.status;\n }\n catch (e) {\n console.error(e);\n this.addNewRegisterError('El servidor ha enviado datos inesperados.');\n return;\n }\n if (status !== 200) {\n this.addNewRegisterError(responseJson.error);\n return;\n }\n this.addNewLoginSuccessText(`Usuario registrado ${username}.`);\n this.goToLogin();\n }\n addNewLoginSuccessText(message) {\n this.unsetLoginAndRegisterErrors();\n this.conquerLoginSuccess.innerText = message;\n this.conquerLoginSuccess.classList.remove('conquer-display-none');\n }\n addNewLoginError(error) {\n this.unsetLoginAndRegisterErrors();\n this.conquerLoginSuccess.classList.add('conquer-display-none');\n this.conquerLoginError.innerText = error;\n this.conquerLoginError.classList.remove('conquer-display-none');\n }\n addNewRegisterError(error) {\n this.unsetLoginAndRegisterErrors();\n this.conquerLoginSuccess.classList.add('conquer-display-none');\n this.conquerRegisterError.innerText = error;\n this.conquerRegisterError.classList.remove('conquer-display-none');\n }\n async checkLogin() {\n const isLogged = await this.isLogged();\n if (!isLogged) {\n this.conquerLogin.classList.remove('conquer-display-none');\n return;\n }\n this.onLoginSuccess();\n }\n async run() {\n this.fillConquerLogin();\n this.fillConquerRegister();\n this.checkLogin();\n const conquerContainer = this.conquerContainer;\n //layer.on('prerender', (evt) => {\n // // return\n // if (evt.context) {\n // const context = evt.context as CanvasRenderingContext2D\n // context.filter = 'grayscale(80%) invert(100%) '\n // context.globalCompositeOperation = 'source-over'\n // }\n //})\n //layer.on('postrender', (evt) => {\n // if (evt.context) {\n // const context = evt.context as CanvasRenderingContext2D\n // context.filter = 'none'\n // }\n //})\n ol_proj__WEBPACK_IMPORTED_MODULE_0__.useGeographic();\n this.map = new ol_Map__WEBPACK_IMPORTED_MODULE_3__[\"default\"]({\n target: conquerContainer,\n layers: [\n new ol_layer_Tile__WEBPACK_IMPORTED_MODULE_4__[\"default\"]({\n source: new ol_source_OSM__WEBPACK_IMPORTED_MODULE_5__[\"default\"]()\n })\n ],\n view: new ol_View__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n zoom: 21,\n maxZoom: 22,\n }),\n });\n this.setLocationChangeTriggers();\n this.setRotationChangeTriggers();\n }\n setRotationChangeTriggers() {\n if (window.DeviceOrientationEvent) {\n window.addEventListener(\"deviceorientation\", (event) => {\n if (event.alpha !== null && event.beta !== null && event.gamma !== null) {\n this.onRotate(event.alpha, event.beta, event.gamma);\n }\n }, true);\n }\n }\n addCurrentLocationMarkerToMap(currentLatitude, currentLongitude) {\n const currentPositionFeature = new ol_Feature__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n type: 'currentPositionFeature',\n geometry: new ol_geom_Point__WEBPACK_IMPORTED_MODULE_7__[\"default\"](this.realCoordinatesToOl(currentLatitude, currentLongitude))\n });\n this.currentPositionFeature = currentPositionFeature;\n }\n processLocation(location) {\n this.currentLatitude = location.coords.latitude;\n this.currentLongitude = location.coords.longitude;\n if (location.coords.heading !== null && (this.alpha != 0 || this.beta != 0 || this.gamma != 0) && !this.disableSetRotationOffset) {\n this.disableSetRotationOffset = true;\n this.heading = location.coords.heading;\n this.rotationOffset = this.compassHeading(this.alpha, this.beta, this.gamma) + (location.coords.heading * Math.PI * 2) / 360;\n }\n this.setCenterDisplaced(this.currentLatitude, this.currentLongitude);\n this.addCurrentLocationMarkerToMap(this.currentLatitude, this.currentLongitude);\n this.refreshLayers();\n }\n refreshLayers() {\n if (this.currentPositionFeature === null) {\n return;\n }\n const styles = {\n currentPositionFeature: new ol_style_Style__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n image: new ol_style_Circle__WEBPACK_IMPORTED_MODULE_9__[\"default\"]({\n radius: 14,\n fill: new ol_style_Fill__WEBPACK_IMPORTED_MODULE_10__[\"default\"]({ color: 'white' }),\n stroke: new ol_style_Stroke__WEBPACK_IMPORTED_MODULE_11__[\"default\"]({\n color: 'blue',\n width: 2,\n })\n })\n })\n };\n const vectorLayer = new ol_layer_Vector__WEBPACK_IMPORTED_MODULE_12__[\"default\"]({\n source: new ol_source_Vector__WEBPACK_IMPORTED_MODULE_13__[\"default\"]({\n features: [this.currentPositionFeature]\n }),\n });\n if (this.vectorLayer !== null) {\n this.map.removeLayer(this.vectorLayer);\n }\n vectorLayer.setStyle((feature) => {\n return styles[feature.getProperties().type];\n });\n this.map.addLayer(vectorLayer);\n this.vectorLayer = vectorLayer;\n this.map.on('click', (event) => {\n this.onClickMap(event);\n });\n }\n setLocationChangeTriggers() {\n window.setInterval(() => {\n this.disableSetRotationOffset = false;\n }, 10000);\n this.currentPositionFeature = null;\n window.setTimeout(() => {\n window.setInterval(() => {\n navigator.geolocation.getCurrentPosition((location) => {\n this.processLocation(location);\n }, () => {\n return;\n }, {\n enableHighAccuracy: true,\n });\n }, 3000);\n }, 1000);\n const initialLatitude = 37.58237;\n const initialLongitude = -5.96766;\n this.setCenterDisplaced(initialLatitude, initialLongitude);\n this.addCurrentLocationMarkerToMap(initialLatitude, initialLongitude);\n this.refreshLayers();\n navigator.geolocation.watchPosition((location) => {\n this.processLocation(location);\n }, (err) => {\n return;\n }, {\n enableHighAccuracy: true,\n });\n }\n realCoordinatesToOl(lat, lon) {\n return ol_proj__WEBPACK_IMPORTED_MODULE_0__.transform([lon, lat], new ol_proj_Projection_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]({ code: \"WGS84\" }), new ol_proj_Projection_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]({ code: \"EPSG:900913\" }));\n }\n compassHeading(alpha, beta, gamma) {\n const alphaRad = alpha * (Math.PI / 180);\n return alphaRad;\n }\n logToServer(logValue) {\n const urlLog = new URL('/conquer/log', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n urlLog.searchParams.append('log', logValue);\n fetch(urlLog).then(() => {\n return;\n }).catch((error) => {\n console.error(error);\n });\n }\n onRotate(alpha, beta, gamma) {\n if (this.enabledOnRotate) {\n this.alpha = alpha;\n this.beta = beta;\n this.gamma = gamma;\n this.enabledOnRotate = false;\n this.map.getView().setRotation((this.compassHeading(alpha, beta, gamma) - this.rotationOffset));\n window.setTimeout(() => {\n this.enabledOnRotate = true;\n }, 10);\n }\n this.setCenterDisplaced(this.currentLatitude, this.currentLongitude);\n }\n constructor(conquerContainer) {\n this.rotationOffset = 0;\n this.heading = 0;\n this.disableSetRotationOffset = false;\n this.vectorLayer = null;\n this.alpha = 0;\n this.beta = 0;\n this.gamma = 0;\n this.isFeatureEnabledMap = {};\n this.enabledOnRotate = true;\n this.conquerContainer = conquerContainer;\n }\n async addNewLoginRegisterError(message) {\n this.addNewRegisterError(message);\n this.addNewLoginError(message);\n }\n async isLogged() {\n const urlUser = new URL('/conquer/user', window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n let responseJson;\n let status;\n try {\n const response = await fetch(urlUser);\n status = response.status;\n }\n catch {\n this.addNewLoginRegisterError('Error del servidor');\n return false;\n }\n return status === 200;\n }\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/conquer/index.ts?"); /***/ }), @@ -381,6 +391,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ol/colorlike.js": +/*!**************************************!*\ + !*** ./node_modules/ol/colorlike.js ***! + \**************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asColorLike: () => (/* binding */ asColorLike)\n/* harmony export */ });\n/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./color.js */ \"./node_modules/ol/color.js\");\n/**\n * @module ol/colorlike\n */\n\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 */\nfunction asColorLike(color) {\n if (Array.isArray(color)) {\n return (0,_color_js__WEBPACK_IMPORTED_MODULE_0__.toString)(color);\n }\n return color;\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/colorlike.js?"); + +/***/ }), + /***/ "./node_modules/ol/console.js": /*!************************************!*\ !*** ./node_modules/ol/console.js ***! @@ -557,6 +578,28 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ol/expr/cpu.js": +/*!*************************************!*\ + !*** ./node_modules/ol/expr/cpu.js ***! + \*************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ buildExpression: () => (/* binding */ buildExpression),\n/* harmony export */ newEvaluationContext: () => (/* binding */ newEvaluationContext)\n/* harmony export */ });\n/* harmony import */ var _expression_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression.js */ \"./node_modules/ol/expr/expression.js\");\n/**\n * @module ol/expr/cpu\n */\n\n\n\n/**\n * @fileoverview This module includes functions to build expressions for evaluation on the CPU.\n * Building is composed of two steps: parsing and compiling. The parsing step takes an encoded\n * expression and returns an instance of one of the expression classes. The compiling step takes\n * the expression instance and returns a function that can be evaluated in to return a literal\n * value. The evaluator function should do as little allocation and work as possible.\n */\n\n/**\n * @typedef {Object} EvaluationContext\n * @property {Object} properties The values for properties used in 'get' expressions.\n * @property {Object} variables The values for variables used in 'var' expressions.\n * @property {number} resolution The map resolution.\n */\n\n/**\n * @return {EvaluationContext} A new evaluation context.\n */\nfunction newEvaluationContext() {\n return {\n variables: {},\n properties: {},\n resolution: NaN,\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):import(\"./expression.js\").LiteralValue} ExpressionEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):boolean} BooleanEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):number} NumberEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):string} StringEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array|string)} ColorLikeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array} NumberArrayEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array} CoordinateEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array|number)} SizeLikeEvaluator\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The expression evaluator.\n */\nfunction buildExpression(encoded, type, context) {\n const expression = (0,_expression_js__WEBPACK_IMPORTED_MODULE_0__.parse)(encoded, context);\n if (!(0,_expression_js__WEBPACK_IMPORTED_MODULE_0__.overlapsType)(type, expression.type)) {\n const expected = (0,_expression_js__WEBPACK_IMPORTED_MODULE_0__.typeName)(type);\n const actual = (0,_expression_js__WEBPACK_IMPORTED_MODULE_0__.typeName)(expression.type);\n throw new Error(\n `Expected expression to be of type ${expected}, got ${actual}`\n );\n }\n return compileExpression(expression, context);\n}\n\n/**\n * @param {import(\"./expression.js\").Expression} expression The expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileExpression(expression, context) {\n if (expression instanceof _expression_js__WEBPACK_IMPORTED_MODULE_0__.LiteralExpression) {\n return function () {\n return expression.value;\n };\n }\n const operator = expression.operator;\n switch (operator) {\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Number:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.String: {\n return compileAssertionExpression(expression, context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Get:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Var: {\n return compileAccessorExpression(expression, context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Resolution: {\n return (context) => context.resolution;\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Any:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.All:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Not: {\n return compileLogicalExpression(expression, context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Equal:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.NotEqual:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.LessThan:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.LessThanOrEqualTo:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.GreaterThan:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.GreaterThanOrEqualTo: {\n return compileComparisonExpression(expression, context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Multiply:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Divide:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Add:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Subtract:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Clamp:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Mod:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Pow:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Abs:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Floor:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Ceil:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Round:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Sin:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Cos:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Atan:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Sqrt: {\n return compileNumericExpression(expression, context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Match: {\n return compileMatchExpression(expression, context);\n }\n default: {\n throw new Error(`Unsupported operator ${operator}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAssertionExpression(expression, context) {\n const type = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (type) {\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Number:\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.String: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value === type) {\n return value;\n }\n }\n throw new Error(`Expected one of the values to be a ${type}`);\n };\n }\n default: {\n throw new Error(`Unsupported assertion operator ${type}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAccessorExpression(expression, context) {\n const nameExpression = expression.args[0];\n if (!(nameExpression instanceof _expression_js__WEBPACK_IMPORTED_MODULE_0__.LiteralExpression)) {\n throw new Error('Expected literal name');\n }\n const name = nameExpression.value;\n if (typeof name !== 'string') {\n throw new Error('Expected string name');\n }\n switch (expression.operator) {\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Get: {\n return (context) => context.properties[name];\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Var: {\n return (context) => context.variables[name];\n }\n default: {\n throw new Error(`Unsupported accessor operator ${expression.operator}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileComparisonExpression(expression, context) {\n const op = expression.operator;\n const left = compileExpression(expression.args[0], context);\n const right = compileExpression(expression.args[1], context);\n switch (op) {\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Equal: {\n return (context) => left(context) === right(context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.NotEqual: {\n return (context) => left(context) !== right(context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.LessThan: {\n return (context) => left(context) < right(context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.LessThanOrEqualTo: {\n return (context) => left(context) <= right(context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.GreaterThan: {\n return (context) => left(context) > right(context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.GreaterThanOrEqualTo: {\n return (context) => left(context) >= right(context);\n }\n default: {\n throw new Error(`Unsupported comparison operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileLogicalExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Any: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.All: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (!args[i](context)) {\n return false;\n }\n }\n return true;\n };\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Not: {\n return (context) => !args[0](context);\n }\n default: {\n throw new Error(`Unsupported logical operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {NumberEvaluator} The evaluator function.\n */\nfunction compileNumericExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Multiply: {\n return (context) => {\n let value = 1;\n for (let i = 0; i < length; ++i) {\n value *= args[i](context);\n }\n return value;\n };\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Divide: {\n return (context) => args[0](context) / args[1](context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Add: {\n return (context) => {\n let value = 0;\n for (let i = 0; i < length; ++i) {\n value += args[i](context);\n }\n return value;\n };\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Subtract: {\n return (context) => args[0](context) - args[1](context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Clamp: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n if (value < min) {\n return min;\n }\n const max = args[2](context);\n if (value > max) {\n return max;\n }\n return value;\n };\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Mod: {\n return (context) => args[0](context) % args[1](context);\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Pow: {\n return (context) => Math.pow(args[0](context), args[1](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Abs: {\n return (context) => Math.abs(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Floor: {\n return (context) => Math.floor(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Ceil: {\n return (context) => Math.ceil(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Round: {\n return (context) => Math.round(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Sin: {\n return (context) => Math.sin(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Cos: {\n return (context) => Math.cos(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Atan: {\n if (length === 2) {\n return (context) => Math.atan2(args[0](context), args[1](context));\n }\n return (context) => Math.atan(args[0](context));\n }\n case _expression_js__WEBPACK_IMPORTED_MODULE_0__.Ops.Sqrt: {\n return (context) => Math.sqrt(args[0](context));\n }\n default: {\n throw new Error(`Unsupported numeric operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileMatchExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length; i += 2) {\n if (value === args[i](context)) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/expr/cpu.js?"); + +/***/ }), + +/***/ "./node_modules/ol/expr/expression.js": +/*!********************************************!*\ + !*** ./node_modules/ol/expr/expression.js ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AnyType: () => (/* binding */ AnyType),\n/* harmony export */ BooleanType: () => (/* binding */ BooleanType),\n/* harmony export */ CallExpression: () => (/* binding */ CallExpression),\n/* harmony export */ ColorType: () => (/* binding */ ColorType),\n/* harmony export */ LiteralExpression: () => (/* binding */ LiteralExpression),\n/* harmony export */ NoneType: () => (/* binding */ NoneType),\n/* harmony export */ NumberArrayType: () => (/* binding */ NumberArrayType),\n/* harmony export */ NumberType: () => (/* binding */ NumberType),\n/* harmony export */ Ops: () => (/* binding */ Ops),\n/* harmony export */ StringType: () => (/* binding */ StringType),\n/* harmony export */ includesType: () => (/* binding */ includesType),\n/* harmony export */ isType: () => (/* binding */ isType),\n/* harmony export */ newParsingContext: () => (/* binding */ newParsingContext),\n/* harmony export */ overlapsType: () => (/* binding */ overlapsType),\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ typeName: () => (/* binding */ typeName)\n/* harmony export */ });\n/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ \"./node_modules/ol/array.js\");\n/**\n * @module ol/expr/expression\n */\n\n\n\n/**\n * @fileoverview This module includes types and functions for parsing array encoded expressions.\n * The result of parsing an encoded expression is one of the specific expression classes.\n * During parsing, information is added to the parsing context about the data accessed by the\n * expression.\n */\n\nlet numTypes = 0;\nconst NoneType = 0;\nconst BooleanType = 1 << numTypes++;\nconst NumberType = 1 << numTypes++;\nconst StringType = 1 << numTypes++;\nconst ColorType = 1 << numTypes++;\nconst NumberArrayType = 1 << numTypes++;\nconst AnyType = Math.pow(2, numTypes) - 1;\n\nconst typeNames = {\n [BooleanType]: 'boolean',\n [NumberType]: 'number',\n [StringType]: 'string',\n [ColorType]: 'color',\n [NumberArrayType]: 'number[]',\n};\n\nconst namedTypes = Object.keys(typeNames).map(Number).sort(_array_js__WEBPACK_IMPORTED_MODULE_0__.ascending);\n\n/**\n * Get a string representation for a type.\n * @param {number} type The type.\n * @return {string} The type name.\n */\nfunction typeName(type) {\n const names = [];\n for (const namedType of namedTypes) {\n if (includesType(type, namedType)) {\n names.push(typeNames[namedType]);\n }\n }\n if (names.length === 0) {\n return 'untyped';\n }\n if (names.length < 3) {\n return names.join(' or ');\n }\n return names.slice(0, -1).join(', ') + ', or ' + names[names.length - 1];\n}\n\n/**\n * @param {number} broad The broad type.\n * @param {number} specific The specific type.\n * @return {boolean} The broad type includes the specific type.\n */\nfunction includesType(broad, specific) {\n return (broad & specific) === specific;\n}\n\n/**\n * @param {number} oneType One type.\n * @param {number} otherType Another type.\n * @return {boolean} The set of types overlap (share a common specific type)\n */\nfunction overlapsType(oneType, otherType) {\n return !!(oneType & otherType);\n}\n\n/**\n * @param {number} type The type.\n * @param {number} expected The expected type.\n * @return {boolean} The given type is exactly the expected type.\n */\nfunction isType(type, expected) {\n return type === expected;\n}\n\n/**\n * @typedef {boolean|number|string|Array} LiteralValue\n */\n\nclass LiteralExpression {\n /**\n * @param {number} type The value type.\n * @param {LiteralValue} value The literal value.\n */\n constructor(type, value) {\n this.type = type;\n this.value = value;\n }\n}\n\nclass CallExpression {\n /**\n * @param {number} type The return type.\n * @param {string} operator The operator.\n * @param {...Expression} args The arguments.\n */\n constructor(type, operator, ...args) {\n this.type = type;\n this.operator = operator;\n this.args = args;\n }\n}\n\n/**\n * @typedef {LiteralExpression|CallExpression} Expression\n */\n\n/**\n * @typedef {Object} ParsingContext\n * @property {Set} variables Variables referenced with the 'var' operator.\n * @property {Set} properties Properties referenced with the 'get' operator.\n */\n\n/**\n * @return {ParsingContext} A new parsing context.\n */\nfunction newParsingContext() {\n return {\n variables: new Set(),\n properties: new Set(),\n };\n}\n\n/**\n * @typedef {LiteralValue|Array} EncodedExpression\n */\n\n/**\n * @param {EncodedExpression} encoded The encoded expression.\n * @param {ParsingContext} context The parsing context.\n * @return {Expression} The parsed expression result.\n */\nfunction parse(encoded, context) {\n switch (typeof encoded) {\n case 'boolean': {\n return new LiteralExpression(BooleanType, encoded);\n }\n case 'number': {\n return new LiteralExpression(NumberType, encoded);\n }\n case 'string': {\n return new LiteralExpression(StringType, encoded);\n }\n default: {\n // pass\n }\n }\n\n if (!Array.isArray(encoded)) {\n throw new Error('Expression must be an array or a primitive value');\n }\n\n if (encoded.length === 0) {\n throw new Error('Empty expression');\n }\n\n if (typeof encoded[0] === 'string') {\n return parseCallExpression(encoded, context);\n }\n\n for (const item of encoded) {\n if (typeof item !== 'number') {\n throw new Error('Expected an array of numbers');\n }\n }\n\n let type = NumberArrayType;\n if (encoded.length === 3 || encoded.length === 4) {\n type |= ColorType;\n }\n\n return new LiteralExpression(type, encoded);\n}\n\n/**\n * @type {Object}\n */\nconst Ops = {\n Number: 'number',\n String: 'string',\n Get: 'get',\n Var: 'var',\n Any: 'any',\n All: 'all',\n Not: '!',\n Resolution: 'resolution',\n Equal: '==',\n NotEqual: '!=',\n GreaterThan: '>',\n GreaterThanOrEqualTo: '>=',\n LessThan: '<',\n LessThanOrEqualTo: '<=',\n Multiply: '*',\n Divide: '/',\n Add: '+',\n Subtract: '-',\n Clamp: 'clamp',\n Mod: '%',\n Pow: '^',\n Abs: 'abs',\n Floor: 'floor',\n Ceil: 'ceil',\n Round: 'round',\n Sin: 'sin',\n Cos: 'cos',\n Atan: 'atan',\n Sqrt: 'sqrt',\n Match: 'match',\n};\n\n/**\n * @typedef {function(Array, ParsingContext):Expression} Parser\n */\n\n/**\n * @type {Object}\n */\nconst parsers = {\n [Ops.Number]: createParser(withArgs(1, Infinity, AnyType), NumberType),\n [Ops.String]: createParser(withArgs(1, Infinity, AnyType), StringType),\n [Ops.Get]: createParser(withGetArgs, AnyType),\n [Ops.Var]: createParser(withVarArgs, AnyType),\n [Ops.Resolution]: createParser(withNoArgs, NumberType),\n [Ops.Any]: createParser(withArgs(2, Infinity, BooleanType), BooleanType),\n [Ops.All]: createParser(withArgs(2, Infinity, BooleanType), BooleanType),\n [Ops.Not]: createParser(withArgs(1, 1, BooleanType), BooleanType),\n [Ops.Equal]: createParser(withArgs(2, 2, AnyType), BooleanType),\n [Ops.NotEqual]: createParser(withArgs(2, 2, AnyType), BooleanType),\n [Ops.GreaterThan]: createParser(withArgs(2, 2, AnyType), BooleanType),\n [Ops.GreaterThanOrEqualTo]: createParser(\n withArgs(2, 2, AnyType),\n BooleanType\n ),\n [Ops.LessThan]: createParser(withArgs(2, 2, AnyType), BooleanType),\n [Ops.LessThanOrEqualTo]: createParser(withArgs(2, 2, AnyType), BooleanType),\n [Ops.Multiply]: createParser(withArgs(2, Infinity, NumberType), NumberType),\n [Ops.Divide]: createParser(withArgs(2, 2, NumberType), NumberType),\n [Ops.Add]: createParser(withArgs(2, Infinity, NumberType), NumberType),\n [Ops.Subtract]: createParser(withArgs(2, 2, NumberType), NumberType),\n [Ops.Clamp]: createParser(withArgs(3, 3, NumberType), NumberType),\n [Ops.Mod]: createParser(withArgs(2, 2, NumberType), NumberType),\n [Ops.Pow]: createParser(withArgs(2, 2, NumberType), NumberType),\n [Ops.Abs]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Floor]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Ceil]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Round]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Sin]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Cos]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Atan]: createParser(withArgs(1, 2, NumberType), NumberType),\n [Ops.Sqrt]: createParser(withArgs(1, 1, NumberType), NumberType),\n [Ops.Match]: createParser(\n withArgs(4, Infinity, StringType | NumberType),\n AnyType\n ),\n};\n\n/**\n * @typedef {function(Array, ParsingContext):Array} ArgValidator\n */\n\n/**\n * @type ArgValidator\n */\nfunction withGetArgs(encoded, context) {\n if (encoded.length !== 2) {\n throw new Error('Expected 1 argument for get operation');\n }\n const arg = parse(encoded[1], context);\n if (!(arg instanceof LiteralExpression)) {\n throw new Error('Expected a literal argument for get operation');\n }\n if (typeof arg.value !== 'string') {\n throw new Error('Expected a string argument for get operation');\n }\n context.properties.add(arg.value);\n return [arg];\n}\n\n/**\n * @type ArgValidator\n */\nfunction withVarArgs(encoded, context) {\n if (encoded.length !== 2) {\n throw new Error('Expected 1 argument for var operation');\n }\n const arg = parse(encoded[1], context);\n if (!(arg instanceof LiteralExpression)) {\n throw new Error('Expected a literal argument for var operation');\n }\n if (typeof arg.value !== 'string') {\n throw new Error('Expected a string argument for get operation');\n }\n context.variables.add(arg.value);\n return [arg];\n}\n\n/**\n * @type ArgValidator\n */\nfunction withNoArgs(encoded, context) {\n const operation = encoded[0];\n if (encoded.length !== 1) {\n throw new Error(`Expected no arguments for ${operation} operation`);\n }\n return [];\n}\n\n/**\n * @param {number} minArgs The minimum number of arguments.\n * @param {number} maxArgs The maximum number of arguments.\n * @param {number} argType The argument type.\n * @return {ArgValidator} The argument validator\n */\nfunction withArgs(minArgs, maxArgs, argType) {\n return function (encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (minArgs === maxArgs) {\n if (argCount !== minArgs) {\n const plural = minArgs === 1 ? '' : 's';\n throw new Error(\n `Expected ${minArgs} argument${plural} for operation ${operation}, got ${argCount}`\n );\n }\n } else if (argCount < minArgs || argCount > maxArgs) {\n throw new Error(\n `Expected ${minArgs} to ${maxArgs} arguments for operation ${operation}, got ${argCount}`\n );\n }\n\n /**\n * @type {Array}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], context);\n if (!overlapsType(argType, expression.type)) {\n const gotType = typeName(argType);\n const expectedType = typeName(expression.type);\n throw new Error(\n `Unexpected type for argument ${i} of ${operation} operation` +\n ` : got ${gotType} but expected ${expectedType}`\n );\n }\n args[i] = expression;\n }\n\n return args;\n };\n}\n\n/**\n * @param {ArgValidator} argValidator The argument validator.\n * @param {number} returnType The return type.\n * @return {Parser} The parser.\n */\nfunction createParser(argValidator, returnType) {\n return function (encoded, context) {\n const operator = encoded[0];\n const args = argValidator(encoded, context);\n return new CallExpression(returnType, operator, ...args);\n };\n}\n\n/**\n * @param {Array} encoded The encoded expression.\n * @param {ParsingContext} context The parsing context.\n * @return {Expression} The parsed expression.\n */\nfunction parseCallExpression(encoded, context) {\n const operator = encoded[0];\n\n const parser = parsers[operator];\n if (!parser) {\n throw new Error(`Unknown operator: ${operator}`);\n }\n return parser(encoded, context);\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/expr/expression.js?"); + +/***/ }), + /***/ "./node_modules/ol/extent.js": /*!***********************************!*\ !*** ./node_modules/ol/extent.js ***! @@ -579,6 +622,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ol/featureloader.js": +/*!******************************************!*\ + !*** ./node_modules/ol/featureloader.js ***! + \******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadFeaturesXhr: () => (/* binding */ loadFeaturesXhr),\n/* harmony export */ setWithCredentials: () => (/* binding */ setWithCredentials),\n/* harmony export */ xhr: () => (/* binding */ xhr)\n/* harmony export */ });\n/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./functions.js */ \"./node_modules/ol/functions.js\");\n/**\n * @module ol/featureloader\n */\n\n\n/**\n *\n * @type {boolean}\n * @private\n */\nlet withCredentials = false;\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * load features.\n *\n * This function takes up to 5 arguments. These are an {@link module:ol/extent~Extent} representing\n * the area to be loaded, a `{number}` representing the resolution (map units per pixel), an\n * {@link module:ol/proj/Projection~Projection} for the projection, an optional success callback that should get\n * the loaded features passed as an argument and an optional failure callback with no arguments. If\n * the callbacks are not used, the corresponding vector source will not fire `'featuresloadend'` and\n * `'featuresloaderror'` events. `this` within the function is bound to the\n * {@link module:ol/source/Vector~VectorSource} 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),\n * import(\"./extent.js\").Extent,\n * number,\n * import(\"./proj/Projection.js\").default,\n * function(Array): void=,\n * function(): void=): void} FeatureLoader\n * @api\n */\n\n/**\n * {@link module:ol/source/Vector~VectorSource} 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~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 {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array, import(\"./proj/Projection.js\").default): void} success Success\n * Function called with the loaded features and optionally with the data projection.\n * @param {function(): void} failure Failure\n * Function called when loading failed.\n */\nfunction loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n success,\n failure\n) {\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() == 'arraybuffer') {\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 == 'json' || type == 'text') {\n source = xhr.responseText;\n } else if (type == '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 == 'arraybuffer') {\n source = /** @type {ArrayBuffer} */ (xhr.response);\n }\n if (source) {\n success(\n /** @type {Array} */\n (\n format.readFeatures(source, {\n extent: extent,\n featureProjection: projection,\n })\n ),\n format.readProjection(source)\n );\n } else {\n failure();\n }\n } else {\n failure();\n }\n };\n /**\n * @private\n */\n xhr.onerror = failure;\n xhr.send();\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 */\nfunction xhr(url, format) {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array): void} [success] Success\n * Function called when loading succeeded.\n * @param {function(): void} [failure] Failure\n * Function called when loading failed.\n */\n return function (extent, resolution, projection, success, failure) {\n const source = /** @type {import(\"./source/Vector\").default} */ (this);\n loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n /**\n * @param {Array} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data\n * projection.\n */\n function (features, dataProjection) {\n source.addFeatures(features);\n if (success !== undefined) {\n success(features);\n }\n },\n /* FIXME handle error */ failure ? failure : _functions_js__WEBPACK_IMPORTED_MODULE_0__.VOID\n );\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 */\nfunction setWithCredentials(xhrWithCredentials) {\n withCredentials = xhrWithCredentials;\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/featureloader.js?"); + +/***/ }), + /***/ "./node_modules/ol/functions.js": /*!**************************************!*\ !*** ./node_modules/ol/functions.js ***! @@ -722,6 +776,28 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ol/geom/flat/length.js": +/*!*********************************************!*\ + !*** ./node_modules/ol/geom/flat/length.js ***! + \*********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ lineStringLength: () => (/* binding */ lineStringLength),\n/* harmony export */ linearRingLength: () => (/* binding */ linearRingLength)\n/* harmony export */ });\n/**\n * @module ol/geom/flat/length\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Length.\n */\nfunction 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} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Perimeter.\n */\nfunction 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\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/geom/flat/length.js?"); + +/***/ }), + +/***/ "./node_modules/ol/geom/flat/linechunk.js": +/*!************************************************!*\ + !*** ./node_modules/ol/geom/flat/linechunk.js ***! + \************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ lineChunk: () => (/* binding */ lineChunk)\n/* harmony export */ });\n/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ \"./node_modules/ol/math.js\");\n\n\n/**\n * Creates chunks of equal length from a linestring\n * @param {number} chunkLength Length of each chunk.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @return {Array>} Chunks of linestrings with stride 2.\n */\nfunction lineChunk(chunkLength, flatCoordinates, offset, end, stride) {\n const chunks = [];\n let cursor = offset;\n let chunkM = 0;\n let currentChunk = flatCoordinates.slice(offset, 2);\n while (chunkM < chunkLength && cursor + stride < end) {\n const [x1, y1] = currentChunk.slice(-2);\n const x2 = flatCoordinates[cursor + stride];\n const y2 = flatCoordinates[cursor + stride + 1];\n const segmentLength = Math.sqrt(\n (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)\n );\n chunkM += segmentLength;\n if (chunkM >= chunkLength) {\n const m = (chunkLength - chunkM + segmentLength) / segmentLength;\n const x = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, m);\n const y = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, m);\n currentChunk.push(x, y);\n chunks.push(currentChunk);\n currentChunk = [x, y];\n if (chunkM == chunkLength) {\n cursor += stride;\n }\n chunkM = 0;\n } else if (chunkM < chunkLength) {\n currentChunk.push(\n flatCoordinates[cursor + stride],\n flatCoordinates[cursor + stride + 1]\n );\n cursor += stride;\n } else {\n const missing = segmentLength - chunkM;\n const x = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, missing / segmentLength);\n const y = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, missing / segmentLength);\n currentChunk.push(x, y);\n chunks.push(currentChunk);\n currentChunk = [x, y];\n chunkM = 0;\n cursor += stride;\n }\n }\n if (chunkM > 0) {\n chunks.push(currentChunk);\n }\n return chunks;\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/geom/flat/linechunk.js?"); + +/***/ }), + /***/ "./node_modules/ol/geom/flat/orient.js": /*!*********************************************!*\ !*** ./node_modules/ol/geom/flat/orient.js ***! @@ -766,6 +842,28 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ol/geom/flat/straightchunk.js": +/*!****************************************************!*\ + !*** ./node_modules/ol/geom/flat/straightchunk.js ***! + \****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ matchingChunk: () => (/* binding */ matchingChunk)\n/* harmony export */ });\n/**\n * @module ol/geom/flat/straightchunk\n */\n\n/**\n * @param {number} maxAngle Maximum acceptable angle delta between segments.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Array} Start and end of the first suitable chunk of the\n * given `flatCoordinates`.\n */\nfunction 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\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/geom/flat/straightchunk.js?"); + +/***/ }), + +/***/ "./node_modules/ol/geom/flat/textpath.js": +/*!***********************************************!*\ + !*** ./node_modules/ol/geom/flat/textpath.js ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawTextOnPath: () => (/* binding */ drawTextOnPath)\n/* harmony export */ });\n/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ \"./node_modules/ol/math.js\");\n/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transform.js */ \"./node_modules/ol/geom/flat/transform.js\");\n/**\n * @module ol/geom/flat/textpath\n */\n\n\n\n/**\n * @param {Array} 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):number} measureAndCacheTextWidth Measure and cache text width.\n * @param {string} font The font.\n * @param {Object} 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>|null} The result array (or null if `maxAngle` was\n * exceeded). Entries of the array are x, y, anchorX, angle, chunk.\n */\nfunction 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 let x2 = flatCoordinates[offset];\n let y2 = flatCoordinates[offset + 1];\n let x1 = 0;\n let y1 = 0;\n let segmentLength = 0;\n let segmentM = 0;\n\n function advance() {\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((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n }\n do {\n advance();\n } while (offset < end - stride && segmentM + segmentLength < startM);\n\n let interpolate =\n segmentLength === 0 ? 0 : (startM - segmentM) / segmentLength;\n const beginX = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, interpolate);\n const beginY = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, interpolate);\n\n const startOffset = offset - stride;\n const startLength = segmentM;\n const endM = startM + scale * measureAndCacheTextWidth(font, text, cache);\n while (offset < end - stride && segmentM + segmentLength < endM) {\n advance();\n }\n interpolate = segmentLength === 0 ? 0 : (endM - segmentM) / segmentLength;\n const endX = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, interpolate);\n const endY = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, interpolate);\n\n // Keep text upright\n let reverse;\n if (rotation) {\n const flat = [beginX, beginY, endX, endY];\n (0,_transform_js__WEBPACK_IMPORTED_MODULE_1__.rotate)(flat, 0, 4, 2, rotation, flat, flat);\n reverse = flat[0] > flat[2];\n } else {\n reverse = beginX > endX;\n }\n\n const PI = Math.PI;\n const result = [];\n const singleSegment = startOffset + stride === offset;\n\n offset = startOffset;\n segmentLength = 0;\n segmentM = startLength;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n\n let previousAngle;\n // All on the same segment\n if (singleSegment) {\n advance();\n\n previousAngle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n previousAngle += previousAngle > 0 ? -PI : PI;\n }\n const x = (endX + beginX) / 2;\n const y = (endY + beginY) / 2;\n result[0] = [x, y, (endM - startM) / 2, previousAngle, text];\n return result;\n }\n\n // rendering across line segments\n text = text.replace(/\\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines\n\n for (let i = 0, ii = text.length; i < ii; ) {\n advance();\n let angle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n angle += angle > 0 ? -PI : PI;\n }\n if (previousAngle !== undefined) {\n let delta = angle - previousAngle;\n delta += delta > PI ? -2 * PI : delta < -PI ? 2 * PI : 0;\n if (Math.abs(delta) > maxAngle) {\n return null;\n }\n }\n previousAngle = angle;\n\n const iStart = i;\n let charLength = 0;\n for (; i < ii; ++i) {\n const index = reverse ? ii - i - 1 : i;\n const len = scale * measureAndCacheTextWidth(font, text[index], cache);\n if (\n offset + stride < end &&\n segmentM + segmentLength < startM + charLength + len / 2\n ) {\n break;\n }\n charLength += len;\n }\n if (i === iStart) {\n continue;\n }\n const chars = reverse\n ? text.substring(ii - iStart, ii - i)\n : text.substring(iStart, i);\n interpolate =\n segmentLength === 0\n ? 0\n : (startM + charLength / 2 - segmentM) / segmentLength;\n const x = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(x1, x2, interpolate);\n const y = (0,_math_js__WEBPACK_IMPORTED_MODULE_0__.lerp)(y1, y2, interpolate);\n result.push([x, y, charLength / 2, angle, chars]);\n startM += charLength;\n }\n return result;\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/ol/geom/flat/textpath.js?"); + +/***/ }), + /***/ "./node_modules/ol/geom/flat/transform.js": /*!************************************************!*\ !*** ./node_modules/ol/geom/flat/transform.js ***! @@ -964,6 +1062,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ol/layer/BaseVector.js": +/*!*********************************************!*\ + !*** ./node_modules/ol/layer/BaseVector.js ***! + \*********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Layer.js */ \"./node_modules/ol/layer/Layer.js\");\n/* harmony import */ var rbush__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rbush */ \"./node_modules/rbush/rbush.min.js\");\n/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style/Style.js */ \"./node_modules/ol/style/Style.js\");\n/* harmony import */ var _render_canvas_style_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../render/canvas/style.js */ \"./node_modules/ol/render/canvas/style.js\");\n/**\n * @module ol/layer/BaseVector\n */\n\n\n\n\n\n/**\n * @template {import(\"../source/Vector.js\").default|import(\"../source/VectorTile.js\").default} VectorSourceType\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 {VectorSourceType} [source] Source.\n * @property {import(\"../Map.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 [map.addLayer()]{@link import(\"../Map.js\").default#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 *\n * As an optimization decluttered features from layers with the same `className` are rendered above\n * the fill and stroke styles of all of those layers regardless of z-index. To opt out of this\n * behavior and place declutterd features with their own layer configure the layer with a `className`\n * other than `ol-layer`.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\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 * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\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 * @template {import(\"../renderer/canvas/VectorLayer.js\").default|import(\"../renderer/canvas/VectorTileLayer.js\").default|import(\"../renderer/canvas/VectorImageLayer.js\").default|import(\"../renderer/webgl/PointsLayer.js\").default} RendererType\n * @extends {Layer}\n * @api\n */\nclass BaseVectorLayer extends _Layer_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.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 [map.getFeaturesAtPixel()]{@link import(\"../Map.js\").default#getFeaturesAtPixel}.\n * Text 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>} 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} */ (\n this.get(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 * Render declutter items for this layer\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderDeclutter(frameState) {\n if (!frameState.declutterTree) {\n frameState.declutterTree = new rbush__WEBPACK_IMPORTED_MODULE_0__(9);\n }\n /** @type {*} */ (this.getRenderer()).renderDeclutter(frameState);\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 * [the ol/style/Style module]{@link module:ol/style/Style~Style} for information on the default style.\n *\n * If your layer has a static style, you can use [flat style]{@link module:ol/style/flat~FlatStyle} object\n * literals instead of using the `Style` and symbolizer constructors (`Fill`, `Stroke`, etc.):\n * ```js\n * vectorLayer.setStyle({\n * \"fill-color\": \"yellow\",\n * \"stroke-color\": \"black\",\n * \"stroke-width\": 4\n * })\n * ```\n *\n * @param {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style.\n * @api\n */\n setStyle(style) {\n this.style_ = toStyleLike(style);\n this.styleFunction_ =\n style === null ? undefined : (0,_style_Style_js__WEBPACK_IMPORTED_MODULE_2__.toFunction)(this.style_);\n this.changed();\n }\n}\n\n/**\n * Coerce the allowed style types into a shorter list of types. Flat styles, arrays of flat\n * styles, and arrays of rules are converted into style functions.\n *\n * @param {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style.\n * @return {import(\"../style/Style.js\").StyleLike|null} The style.\n */\nfunction toStyleLike(style) {\n if (style === undefined) {\n return _style_Style_js__WEBPACK_IMPORTED_MODULE_2__.createDefaultStyle;\n }\n if (!style) {\n return null;\n }\n if (typeof style === 'function') {\n return style;\n }\n if (style instanceof _style_Style_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]) {\n return style;\n }\n if (!Array.isArray(style)) {\n return (0,_render_canvas_style_js__WEBPACK_IMPORTED_MODULE_3__.flatStylesToStyleFunction)([style]);\n }\n if (style.length === 0) {\n return [];\n }\n\n const length = style.length;\n const first = style[0];\n\n if (first instanceof _style_Style_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]) {\n /**\n * @type {Array