vendor: 3,623 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = "/themes/user/reinos_maps/dist"; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 0); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
vendor: 361 bytes, lines 89-99
89/***/ "./node_modules/axios/index.js": 90/*!*************************************!*\ 91 !*** ./node_modules/axios/index.js ***! 92 \*************************************/ 93/*! no static exports found */ 94/***/ (function(module, exports, __webpack_require__) { 95 96module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); 97 98/***/ }), 99
vendor: 6,690 bytes, lines 100-290
100/***/ "./node_modules/axios/lib/adapters/xhr.js": 101/*!************************************************!*\ 102 !*** ./node_modules/axios/lib/adapters/xhr.js ***! 103 \************************************************/ 104/*! no static exports found */ 105/***/ (function(module, exports, __webpack_require__) { 106 107"use strict"; 108 109 110var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 111var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); 112var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); 113var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 114var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); 115var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); 116var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); 117var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); 118 119module.exports = function xhrAdapter(config) { 120 return new Promise(function dispatchXhrRequest(resolve, reject) { 121 var requestData = config.data; 122 var requestHeaders = config.headers; 123 124 if (utils.isFormData(requestData)) { 125 delete requestHeaders['Content-Type']; // Let the browser set it 126 } 127 128 var request = new XMLHttpRequest(); 129 130 // HTTP basic authentication 131 if (config.auth) { 132 var username = config.auth.username || ''; 133 var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; 134 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 135 } 136 137 var fullPath = buildFullPath(config.baseURL, config.url); 138 request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); 139 140 // Set the request timeout in MS 141 request.timeout = config.timeout; 142 143 // Listen for ready state 144 request.onreadystatechange = function handleLoad() { 145 if (!request || request.readyState !== 4) { 146 return; 147 } 148 149 // The request errored out and we didn't get a response, this will be 150 // handled by onerror instead 151 // With one exception: request that using file: protocol, most browsers 152 // will return status as 0 even though it's a successful request 153 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 154 return; 155 } 156 157 // Prepare the response 158 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 159 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 160 var response = { 161 data: responseData, 162 status: request.status, 163 statusText: request.statusText, 164 headers: responseHeaders, 165 config: config, 166 request: request 167 }; 168 169 settle(resolve, reject, response); 170 171 // Clean up request 172 request = null; 173 }; 174 175 // Handle browser request cancellation (as opposed to a manual cancellation) 176 request.onabort = function handleAbort() { 177 if (!request) { 178 return; 179 } 180 181 reject(createError('Request aborted', config, 'ECONNABORTED', request)); 182 183 // Clean up request 184 request = null; 185 }; 186 187 // Handle low level network errors 188 request.onerror = function handleError() { 189 // Real errors are hidden from us by the browser 190 // onerror should only fire if it's a network error 191 reject(createError('Network Error', config, null, request)); 192 193 // Clean up request 194 request = null; 195 }; 196 197 // Handle timeout 198 request.ontimeout = function handleTimeout() { 199 var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; 200 if (config.timeoutErrorMessage) { 201 timeoutErrorMessage = config.timeoutErrorMessage; 202 } 203 reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', 204 request)); 205 206 // Clean up request 207 request = null; 208 }; 209 210 // Add xsrf header 211 // This is only done if running in a standard browser environment. 212 // Specifically not if we're in a web worker, or react-native. 213 if (utils.isStandardBrowserEnv()) { 214 // Add xsrf header 215 var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? 216 cookies.read(config.xsrfCookieName) : 217 undefined; 218 219 if (xsrfValue) { 220 requestHeaders[config.xsrfHeaderName] = xsrfValue; 221 } 222 } 223 224 // Add headers to the request 225 if ('setRequestHeader' in request) { 226 utils.forEach(requestHeaders, function setRequestHeader(val, key) { 227 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 228 // Remove Content-Type if data is undefined 229 delete requestHeaders[key]; 230 } else { 231 // Otherwise add header to the request 232 request.setRequestHeader(key, val); 233 } 234 }); 235 } 236 237 // Add withCredentials to request if needed 238 if (!utils.isUndefined(config.withCredentials)) { 239 request.withCredentials = !!config.withCredentials; 240 } 241 242 // Add responseType to request if needed 243 if (config.responseType) { 244 try { 245 request.responseType = config.responseType; 246 } catch (e) { 247 // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. 248 // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. 249 if (config.responseType !== 'json') { 250 throw e; 251 } 252 } 253 } 254 255 // Handle progress if needed 256 if (typeof config.onDownloadProgress === 'function') { 257 request.addEventListener('progress', config.onDownloadProgress); 258 } 259 260 // Not all browsers support upload events 261 if (typeof config.onUploadProgress === 'function' && request.upload) { 262 request.upload.addEventListener('progress', config.onUploadProgress); 263 } 264 265 if (config.cancelToken) { 266 // Handle cancellation 267 config.cancelToken.promise.then(function onCanceled(cancel) { 268 if (!request) { 269 return; 270 } 271 272 request.abort(); 273 reject(cancel); 274 // Clean up request 275 request = null; 276 }); 277 } 278 279 if (!requestData) { 280 requestData = null; 281 } 282 283 // Send the request 284 request.send(requestData); 285 }); 286}; 287 288 289/***/ }), 290
vendor: 2,251 bytes, lines 291-355
291/***/ "./node_modules/axios/lib/axios.js": 292/*!*****************************************!*\ 293 !*** ./node_modules/axios/lib/axios.js ***! 294 \*****************************************/ 295/*! no static exports found */ 296/***/ (function(module, exports, __webpack_require__) { 297 298"use strict"; 299 300 301var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 302var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 303var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); 304var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 305var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); 306 307/** 308 * Create an instance of Axios 309 * 310 * @param {Object} defaultConfig The default config for the instance 311 * @return {Axios} A new instance of Axios 312 */ 313function createInstance(defaultConfig) { 314 var context = new Axios(defaultConfig); 315 var instance = bind(Axios.prototype.request, context); 316 317 // Copy axios.prototype to instance 318 utils.extend(instance, Axios.prototype, context); 319 320 // Copy context to instance 321 utils.extend(instance, context); 322 323 return instance; 324} 325 326// Create the default instance to be exported 327var axios = createInstance(defaults); 328 329// Expose Axios class to allow class inheritance 330axios.Axios = Axios; 331 332// Factory for creating new instances 333axios.create = function create(instanceConfig) { 334 return createInstance(mergeConfig(axios.defaults, instanceConfig)); 335}; 336 337// Expose Cancel & CancelToken 338axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 339axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); 340axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 341 342// Expose all/spread 343axios.all = function all(promises) { 344 return Promise.all(promises); 345}; 346axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); 347 348module.exports = axios; 349 350// Allow use of default import syntax in TypeScript 351module.exports.default = axios; 352 353 354/***/ }), 355
vendor: 702 bytes, lines 356-386
356/***/ "./node_modules/axios/lib/cancel/Cancel.js": 357/*!*************************************************!*\ 358 !*** ./node_modules/axios/lib/cancel/Cancel.js ***! 359 \*************************************************/ 360/*! no static exports found */ 361/***/ (function(module, exports, __webpack_require__) { 362 363"use strict"; 364 365 366/** 367 * A `Cancel` is an object that is thrown when an operation is canceled. 368 * 369 * @class 370 * @param {string=} message The message. 371 */ 372function Cancel(message) { 373 this.message = message; 374} 375 376Cancel.prototype.toString = function toString() { 377 return 'Cancel' + (this.message ? ': ' + this.message : ''); 378}; 379 380Cancel.prototype.__CANCEL__ = true; 381 382module.exports = Cancel; 383 384 385/***/ }), 386
vendor: 1,638 bytes, lines 387-455
387/***/ "./node_modules/axios/lib/cancel/CancelToken.js": 388/*!******************************************************!*\ 389 !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! 390 \******************************************************/ 391/*! no static exports found */ 392/***/ (function(module, exports, __webpack_require__) { 393 394"use strict"; 395 396 397var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 398 399/** 400 * A `CancelToken` is an object that can be used to request cancellation of an operation. 401 * 402 * @class 403 * @param {Function} executor The executor function. 404 */ 405function CancelToken(executor) { 406 if (typeof executor !== 'function') { 407 throw new TypeError('executor must be a function.'); 408 } 409 410 var resolvePromise; 411 this.promise = new Promise(function promiseExecutor(resolve) { 412 resolvePromise = resolve; 413 }); 414 415 var token = this; 416 executor(function cancel(message) { 417 if (token.reason) { 418 // Cancellation has already been requested 419 return; 420 } 421 422 token.reason = new Cancel(message); 423 resolvePromise(token.reason); 424 }); 425} 426 427/** 428 * Throws a `Cancel` if cancellation has been requested. 429 */ 430CancelToken.prototype.throwIfRequested = function throwIfRequested() { 431 if (this.reason) { 432 throw this.reason; 433 } 434}; 435 436/** 437 * Returns an object that contains a new `CancelToken` and a function that, when called, 438 * cancels the `CancelToken`. 439 */ 440CancelToken.source = function source() { 441 var cancel; 442 var token = new CancelToken(function executor(c) { 443 cancel = c; 444 }); 445 return { 446 token: token, 447 cancel: cancel 448 }; 449}; 450 451module.exports = CancelToken; 452 453 454/***/ }), 455
vendor: 427 bytes, lines 456-472
456/***/ "./node_modules/axios/lib/cancel/isCancel.js": 457/*!***************************************************!*\ 458 !*** ./node_modules/axios/lib/cancel/isCancel.js ***! 459 \***************************************************/ 460/*! no static exports found */ 461/***/ (function(module, exports, __webpack_require__) { 462 463"use strict"; 464 465 466module.exports = function isCancel(value) { 467 return !!(value && value.__CANCEL__); 468}; 469 470 471/***/ }), 472
vendor: 3,273 bytes, lines 473-579
473/***/ "./node_modules/axios/lib/core/Axios.js": 474/*!**********************************************!*\ 475 !*** ./node_modules/axios/lib/core/Axios.js ***! 476 \**********************************************/ 477/*! no static exports found */ 478/***/ (function(module, exports, __webpack_require__) { 479 480"use strict"; 481 482 483var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 484var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 485var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); 486var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); 487var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 488 489/** 490 * Create a new instance of Axios 491 * 492 * @param {Object} instanceConfig The default config for the instance 493 */ 494function Axios(instanceConfig) { 495 this.defaults = instanceConfig; 496 this.interceptors = { 497 request: new InterceptorManager(), 498 response: new InterceptorManager() 499 }; 500} 501 502/** 503 * Dispatch a request 504 * 505 * @param {Object} config The config specific for this request (merged with this.defaults) 506 */ 507Axios.prototype.request = function request(config) { 508 /*eslint no-param-reassign:0*/ 509 // Allow for axios('example/url'[, config]) a la fetch API 510 if (typeof config === 'string') { 511 config = arguments[1] || {}; 512 config.url = arguments[0]; 513 } else { 514 config = config || {}; 515 } 516 517 config = mergeConfig(this.defaults, config); 518 519 // Set config.method 520 if (config.method) { 521 config.method = config.method.toLowerCase(); 522 } else if (this.defaults.method) { 523 config.method = this.defaults.method.toLowerCase(); 524 } else { 525 config.method = 'get'; 526 } 527 528 // Hook up interceptors middleware 529 var chain = [dispatchRequest, undefined]; 530 var promise = Promise.resolve(config); 531 532 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 533 chain.unshift(interceptor.fulfilled, interceptor.rejected); 534 }); 535 536 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 537 chain.push(interceptor.fulfilled, interceptor.rejected); 538 }); 539 540 while (chain.length) { 541 promise = promise.then(chain.shift(), chain.shift()); 542 } 543 544 return promise; 545}; 546 547Axios.prototype.getUri = function getUri(config) { 548 config = mergeConfig(this.defaults, config); 549 return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); 550}; 551 552// Provide aliases for supported request methods 553utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 554 /*eslint func-names:0*/ 555 Axios.prototype[method] = function(url, config) { 556 return this.request(mergeConfig(config || {}, { 557 method: method, 558 url: url, 559 data: (config || {}).data 560 })); 561 }; 562}); 563 564utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 565 /*eslint func-names:0*/ 566 Axios.prototype[method] = function(url, data, config) { 567 return this.request(mergeConfig(config || {}, { 568 method: method, 569 url: url, 570 data: data 571 })); 572 }; 573}); 574 575module.exports = Axios; 576 577 578/***/ }), 579
vendor: 1,661 bytes, lines 580-643
580/***/ "./node_modules/axios/lib/core/InterceptorManager.js": 581/*!***********************************************************!*\ 582 !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! 583 \***********************************************************/ 584/*! no static exports found */ 585/***/ (function(module, exports, __webpack_require__) { 586 587"use strict"; 588 589 590var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 591 592function InterceptorManager() { 593 this.handlers = []; 594} 595 596/** 597 * Add a new interceptor to the stack 598 * 599 * @param {Function} fulfilled The function to handle `then` for a `Promise` 600 * @param {Function} rejected The function to handle `reject` for a `Promise` 601 * 602 * @return {Number} An ID used to remove interceptor later 603 */ 604InterceptorManager.prototype.use = function use(fulfilled, rejected) { 605 this.handlers.push({ 606 fulfilled: fulfilled, 607 rejected: rejected 608 }); 609 return this.handlers.length - 1; 610}; 611 612/** 613 * Remove an interceptor from the stack 614 * 615 * @param {Number} id The ID that was returned by `use` 616 */ 617InterceptorManager.prototype.eject = function eject(id) { 618 if (this.handlers[id]) { 619 this.handlers[id] = null; 620 } 621}; 622 623/** 624 * Iterate over all the registered interceptors 625 * 626 * This method is particularly useful for skipping over any 627 * interceptors that may have become `null` calling `eject`. 628 * 629 * @param {Function} fn The function to call for each interceptor 630 */ 631InterceptorManager.prototype.forEach = function forEach(fn) { 632 utils.forEach(this.handlers, function forEachHandler(h) { 633 if (h !== null) { 634 fn(h); 635 } 636 }); 637}; 638 639module.exports = InterceptorManager; 640 641 642/***/ }), 643
vendor: 1,168 bytes, lines 644-675
644/***/ "./node_modules/axios/lib/core/buildFullPath.js": 645/*!******************************************************!*\ 646 !*** ./node_modules/axios/lib/core/buildFullPath.js ***! 647 \******************************************************/ 648/*! no static exports found */ 649/***/ (function(module, exports, __webpack_require__) { 650 651"use strict"; 652 653 654var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); 655var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); 656 657/** 658 * Creates a new URL by combining the baseURL with the requestedURL, 659 * only when the requestedURL is not already an absolute URL. 660 * If the requestURL is absolute, this function returns the requestedURL untouched. 661 * 662 * @param {string} baseURL The base URL 663 * @param {string} requestedURL Absolute or relative URL to combine 664 * @returns {string} The combined full path 665 */ 666module.exports = function buildFullPath(baseURL, requestedURL) { 667 if (baseURL && !isAbsoluteURL(requestedURL)) { 668 return combineURLs(baseURL, requestedURL); 669 } 670 return requestedURL; 671}; 672 673 674/***/ }), 675
vendor: 1,019 bytes, lines 676-705
676/***/ "./node_modules/axios/lib/core/createError.js": 677/*!****************************************************!*\ 678 !*** ./node_modules/axios/lib/core/createError.js ***! 679 \****************************************************/ 680/*! no static exports found */ 681/***/ (function(module, exports, __webpack_require__) { 682 683"use strict"; 684 685 686var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); 687 688/** 689 * Create an Error with the specified message, config, error code, request and response. 690 * 691 * @param {string} message The error message. 692 * @param {Object} config The config. 693 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 694 * @param {Object} [request] The request. 695 * @param {Object} [response] The response. 696 * @returns {Error} The created error. 697 */ 698module.exports = function createError(message, config, code, request, response) { 699 var error = new Error(message); 700 return enhanceError(error, config, code, request, response); 701}; 702 703 704/***/ }), 705
vendor: 2,517 bytes, lines 706-796
706/***/ "./node_modules/axios/lib/core/dispatchRequest.js": 707/*!********************************************************!*\ 708 !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! 709 \********************************************************/ 710/*! no static exports found */ 711/***/ (function(module, exports, __webpack_require__) { 712 713"use strict"; 714 715 716var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 717var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); 718var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 719var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); 720 721/** 722 * Throws a `Cancel` if cancellation has been requested. 723 */ 724function throwIfCancellationRequested(config) { 725 if (config.cancelToken) { 726 config.cancelToken.throwIfRequested(); 727 } 728} 729 730/** 731 * Dispatch a request to the server using the configured adapter. 732 * 733 * @param {object} config The config that is to be used for the request 734 * @returns {Promise} The Promise to be fulfilled 735 */ 736module.exports = function dispatchRequest(config) { 737 throwIfCancellationRequested(config); 738 739 // Ensure headers exist 740 config.headers = config.headers || {}; 741 742 // Transform request data 743 config.data = transformData( 744 config.data, 745 config.headers, 746 config.transformRequest 747 ); 748 749 // Flatten headers 750 config.headers = utils.merge( 751 config.headers.common || {}, 752 config.headers[config.method] || {}, 753 config.headers 754 ); 755 756 utils.forEach( 757 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 758 function cleanHeaderConfig(method) { 759 delete config.headers[method]; 760 } 761 ); 762 763 var adapter = config.adapter || defaults.adapter; 764 765 return adapter(config).then(function onAdapterResolution(response) { 766 throwIfCancellationRequested(config); 767 768 // Transform response data 769 response.data = transformData( 770 response.data, 771 response.headers, 772 config.transformResponse 773 ); 774 775 return response; 776 }, function onAdapterRejection(reason) { 777 if (!isCancel(reason)) { 778 throwIfCancellationRequested(config); 779 780 // Transform response data 781 if (reason && reason.response) { 782 reason.response.data = transformData( 783 reason.response.data, 784 reason.response.headers, 785 config.transformResponse 786 ); 787 } 788 } 789 790 return Promise.reject(reason); 791 }); 792}; 793 794 795/***/ }), 796
vendor: 1,382 bytes, lines 797-850
797/***/ "./node_modules/axios/lib/core/enhanceError.js": 798/*!*****************************************************!*\ 799 !*** ./node_modules/axios/lib/core/enhanceError.js ***! 800 \*****************************************************/ 801/*! no static exports found */ 802/***/ (function(module, exports, __webpack_require__) { 803 804"use strict"; 805 806 807/** 808 * Update an Error with the specified config, error code, and response. 809 * 810 * @param {Error} error The error to update. 811 * @param {Object} config The config. 812 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 813 * @param {Object} [request] The request. 814 * @param {Object} [response] The response. 815 * @returns {Error} The error. 816 */ 817module.exports = function enhanceError(error, config, code, request, response) { 818 error.config = config; 819 if (code) { 820 error.code = code; 821 } 822 823 error.request = request; 824 error.response = response; 825 error.isAxiosError = true; 826 827 error.toJSON = function toJSON() { 828 return { 829 // Standard 830 message: this.message, 831 name: this.name, 832 // Microsoft 833 description: this.description, 834 number: this.number, 835 // Mozilla 836 fileName: this.fileName, 837 lineNumber: this.lineNumber, 838 columnNumber: this.columnNumber, 839 stack: this.stack, 840 // Axios 841 config: this.config, 842 code: this.code 843 }; 844 }; 845 return error; 846}; 847 848 849/***/ }), 850
vendor: 3,277 bytes, lines 851-949
851/***/ "./node_modules/axios/lib/core/mergeConfig.js": 852/*!****************************************************!*\ 853 !*** ./node_modules/axios/lib/core/mergeConfig.js ***! 854 \****************************************************/ 855/*! no static exports found */ 856/***/ (function(module, exports, __webpack_require__) { 857 858"use strict"; 859 860 861var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 862 863/** 864 * Config-specific merge-function which creates a new config-object 865 * by merging two configuration objects together. 866 * 867 * @param {Object} config1 868 * @param {Object} config2 869 * @returns {Object} New object resulting from merging config2 to config1 870 */ 871module.exports = function mergeConfig(config1, config2) { 872 // eslint-disable-next-line no-param-reassign 873 config2 = config2 || {}; 874 var config = {}; 875 876 var valueFromConfig2Keys = ['url', 'method', 'data']; 877 var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; 878 var defaultToConfig2Keys = [ 879 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', 880 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 881 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', 882 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', 883 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' 884 ]; 885 var directMergeKeys = ['validateStatus']; 886 887 function getMergedValue(target, source) { 888 if (utils.isPlainObject(target) && utils.isPlainObject(source)) { 889 return utils.merge(target, source); 890 } else if (utils.isPlainObject(source)) { 891 return utils.merge({}, source); 892 } else if (utils.isArray(source)) { 893 return source.slice(); 894 } 895 return source; 896 } 897 898 function mergeDeepProperties(prop) { 899 if (!utils.isUndefined(config2[prop])) { 900 config[prop] = getMergedValue(config1[prop], config2[prop]); 901 } else if (!utils.isUndefined(config1[prop])) { 902 config[prop] = getMergedValue(undefined, config1[prop]); 903 } 904 } 905 906 utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { 907 if (!utils.isUndefined(config2[prop])) { 908 config[prop] = getMergedValue(undefined, config2[prop]); 909 } 910 }); 911 912 utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); 913 914 utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { 915 if (!utils.isUndefined(config2[prop])) { 916 config[prop] = getMergedValue(undefined, config2[prop]); 917 } else if (!utils.isUndefined(config1[prop])) { 918 config[prop] = getMergedValue(undefined, config1[prop]); 919 } 920 }); 921 922 utils.forEach(directMergeKeys, function merge(prop) { 923 if (prop in config2) { 924 config[prop] = getMergedValue(config1[prop], config2[prop]); 925 } else if (prop in config1) { 926 config[prop] = getMergedValue(undefined, config1[prop]); 927 } 928 }); 929 930 var axiosKeys = valueFromConfig2Keys 931 .concat(mergeDeepPropertiesKeys) 932 .concat(defaultToConfig2Keys) 933 .concat(directMergeKeys); 934 935 var otherKeys = Object 936 .keys(config1) 937 .concat(Object.keys(config2)) 938 .filter(function filterAxiosKeys(key) { 939 return axiosKeys.indexOf(key) === -1; 940 }); 941 942 utils.forEach(otherKeys, mergeDeepProperties); 943 944 return config; 945}; 946 947 948/***/ }), 949
vendor: 1,079 bytes, lines 950-986
950/***/ "./node_modules/axios/lib/core/settle.js": 951/*!***********************************************!*\ 952 !*** ./node_modules/axios/lib/core/settle.js ***! 953 \***********************************************/ 954/*! no static exports found */ 955/***/ (function(module, exports, __webpack_require__) { 956 957"use strict"; 958 959 960var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); 961 962/** 963 * Resolve or reject a Promise based on response status. 964 * 965 * @param {Function} resolve A function that resolves the promise. 966 * @param {Function} reject A function that rejects the promise. 967 * @param {object} response The response. 968 */ 969module.exports = function settle(resolve, reject, response) { 970 var validateStatus = response.config.validateStatus; 971 if (!response.status || !validateStatus || validateStatus(response.status)) { 972 resolve(response); 973 } else { 974 reject(createError( 975 'Request failed with status code ' + response.status, 976 response.config, 977 null, 978 response.request, 979 response 980 )); 981 } 982}; 983 984 985/***/ }), 986
vendor: 940 bytes, lines 987-1018
987/***/ "./node_modules/axios/lib/core/transformData.js": 988/*!******************************************************!*\ 989 !*** ./node_modules/axios/lib/core/transformData.js ***! 990 \******************************************************/ 991/*! no static exports found */ 992/***/ (function(module, exports, __webpack_require__) { 993 994"use strict"; 995 996 997var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 998 999/** 1000 * Transform the data for a request or a response 1001 * 1002 * @param {Object|String} data The data to be transformed 1003 * @param {Array} headers The headers for the request or response 1004 * @param {Array|Function} fns A single function or Array of functions 1005 * @returns {*} The resulting transformed data 1006 */ 1007module.exports = function transformData(data, headers, fns) { 1008 /*eslint no-param-reassign:0*/ 1009 utils.forEach(fns, function transform(fn) { 1010 data = fn(data, headers); 1011 }); 1012 1013 return data; 1014}; 1015 1016 1017/***/ }), 1018
vendor: 3,288 bytes, lines 1019-1129
1019/***/ "./node_modules/axios/lib/defaults.js": 1020/*!********************************************!*\ 1021 !*** ./node_modules/axios/lib/defaults.js ***! 1022 \********************************************/ 1023/*! no static exports found */ 1024/***/ (function(module, exports, __webpack_require__) { 1025 1026"use strict"; 1027/* WEBPACK VAR INJECTION */(function(process) { 1028 1029var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 1030var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); 1031 1032var DEFAULT_CONTENT_TYPE = { 1033 'Content-Type': 'application/x-www-form-urlencoded' 1034}; 1035 1036function setContentTypeIfUnset(headers, value) { 1037 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 1038 headers['Content-Type'] = value; 1039 } 1040} 1041 1042function getDefaultAdapter() { 1043 var adapter; 1044 if (typeof XMLHttpRequest !== 'undefined') { 1045 // For browsers use XHR adapter 1046 adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); 1047 } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { 1048 // For node use HTTP adapter 1049 adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); 1050 } 1051 return adapter; 1052} 1053 1054var defaults = { 1055 adapter: getDefaultAdapter(), 1056 1057 transformRequest: [function transformRequest(data, headers) { 1058 normalizeHeaderName(headers, 'Accept'); 1059 normalizeHeaderName(headers, 'Content-Type'); 1060 if (utils.isFormData(data) || 1061 utils.isArrayBuffer(data) || 1062 utils.isBuffer(data) || 1063 utils.isStream(data) || 1064 utils.isFile(data) || 1065 utils.isBlob(data) 1066 ) { 1067 return data; 1068 } 1069 if (utils.isArrayBufferView(data)) { 1070 return data.buffer; 1071 } 1072 if (utils.isURLSearchParams(data)) { 1073 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 1074 return data.toString(); 1075 } 1076 if (utils.isObject(data)) { 1077 setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 1078 return JSON.stringify(data); 1079 } 1080 return data; 1081 }], 1082 1083 transformResponse: [function transformResponse(data) { 1084 /*eslint no-param-reassign:0*/ 1085 if (typeof data === 'string') { 1086 try { 1087 data = JSON.parse(data); 1088 } catch (e) { /* Ignore */ } 1089 } 1090 return data; 1091 }], 1092 1093 /** 1094 * A timeout in milliseconds to abort a request. If set to 0 (default) a 1095 * timeout is not created. 1096 */ 1097 timeout: 0, 1098 1099 xsrfCookieName: 'XSRF-TOKEN', 1100 xsrfHeaderName: 'X-XSRF-TOKEN', 1101 1102 maxContentLength: -1, 1103 maxBodyLength: -1, 1104 1105 validateStatus: function validateStatus(status) { 1106 return status >= 200 && status < 300; 1107 } 1108}; 1109 1110defaults.headers = { 1111 common: { 1112 'Accept': 'application/json, text/plain, */*' 1113 } 1114}; 1115 1116utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 1117 defaults.headers[method] = {}; 1118}); 1119 1120utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 1121 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 1122}); 1123 1124module.exports = defaults; 1125 1126/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) 1127 1128/***/ }), 1129
vendor: 569 bytes, lines 1130-1152
1130/***/ "./node_modules/axios/lib/helpers/bind.js": 1131/*!************************************************!*\ 1132 !*** ./node_modules/axios/lib/helpers/bind.js ***! 1133 \************************************************/ 1134/*! no static exports found */ 1135/***/ (function(module, exports, __webpack_require__) { 1136 1137"use strict"; 1138 1139 1140module.exports = function bind(fn, thisArg) { 1141 return function wrap() { 1142 var args = new Array(arguments.length); 1143 for (var i = 0; i < args.length; i++) { 1144 args[i] = arguments[i]; 1145 } 1146 return fn.apply(thisArg, args); 1147 }; 1148}; 1149 1150 1151/***/ }), 1152
vendor: 2,026 bytes, lines 1153-1234
1153/***/ "./node_modules/axios/lib/helpers/buildURL.js": 1154/*!****************************************************!*\ 1155 !*** ./node_modules/axios/lib/helpers/buildURL.js ***! 1156 \****************************************************/ 1157/*! no static exports found */ 1158/***/ (function(module, exports, __webpack_require__) { 1159 1160"use strict"; 1161 1162 1163var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1164 1165function encode(val) { 1166 return encodeURIComponent(val). 1167 replace(/%3A/gi, ':'). 1168 replace(/%24/g, '$'). 1169 replace(/%2C/gi, ','). 1170 replace(/%20/g, '+'). 1171 replace(/%5B/gi, '['). 1172 replace(/%5D/gi, ']'); 1173} 1174 1175/** 1176 * Build a URL by appending params to the end 1177 * 1178 * @param {string} url The base of the url (e.g., http://www.google.com) 1179 * @param {object} [params] The params to be appended 1180 * @returns {string} The formatted url 1181 */ 1182module.exports = function buildURL(url, params, paramsSerializer) { 1183 /*eslint no-param-reassign:0*/ 1184 if (!params) { 1185 return url; 1186 } 1187 1188 var serializedParams; 1189 if (paramsSerializer) { 1190 serializedParams = paramsSerializer(params); 1191 } else if (utils.isURLSearchParams(params)) { 1192 serializedParams = params.toString(); 1193 } else { 1194 var parts = []; 1195 1196 utils.forEach(params, function serialize(val, key) { 1197 if (val === null || typeof val === 'undefined') { 1198 return; 1199 } 1200 1201 if (utils.isArray(val)) { 1202 key = key + '[]'; 1203 } else { 1204 val = [val]; 1205 } 1206 1207 utils.forEach(val, function parseValue(v) { 1208 if (utils.isDate(v)) { 1209 v = v.toISOString(); 1210 } else if (utils.isObject(v)) { 1211 v = JSON.stringify(v); 1212 } 1213 parts.push(encode(key) + '=' + encode(v)); 1214 }); 1215 }); 1216 1217 serializedParams = parts.join('&'); 1218 } 1219 1220 if (serializedParams) { 1221 var hashmarkIndex = url.indexOf('#'); 1222 if (hashmarkIndex !== -1) { 1223 url = url.slice(0, hashmarkIndex); 1224 } 1225 1226 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 1227 } 1228 1229 return url; 1230}; 1231 1232 1233/***/ }), 1234
vendor: 721 bytes, lines 1235-1260
1235/***/ "./node_modules/axios/lib/helpers/combineURLs.js": 1236/*!*******************************************************!*\ 1237 !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! 1238 \*******************************************************/ 1239/*! no static exports found */ 1240/***/ (function(module, exports, __webpack_require__) { 1241 1242"use strict"; 1243 1244 1245/** 1246 * Creates a new URL by combining the specified URLs 1247 * 1248 * @param {string} baseURL The base URL 1249 * @param {string} relativeURL The relative URL 1250 * @returns {string} The combined URL 1251 */ 1252module.exports = function combineURLs(baseURL, relativeURL) { 1253 return relativeURL 1254 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 1255 : baseURL; 1256}; 1257 1258 1259/***/ }), 1260
vendor: 1,813 bytes, lines 1261-1325
1261/***/ "./node_modules/axios/lib/helpers/cookies.js": 1262/*!***************************************************!*\ 1263 !*** ./node_modules/axios/lib/helpers/cookies.js ***! 1264 \***************************************************/ 1265/*! no static exports found */ 1266/***/ (function(module, exports, __webpack_require__) { 1267 1268"use strict"; 1269 1270 1271var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1272 1273module.exports = ( 1274 utils.isStandardBrowserEnv() ? 1275 1276 // Standard browser envs support document.cookie 1277 (function standardBrowserEnv() { 1278 return { 1279 write: function write(name, value, expires, path, domain, secure) { 1280 var cookie = []; 1281 cookie.push(name + '=' + encodeURIComponent(value)); 1282 1283 if (utils.isNumber(expires)) { 1284 cookie.push('expires=' + new Date(expires).toGMTString()); 1285 } 1286 1287 if (utils.isString(path)) { 1288 cookie.push('path=' + path); 1289 } 1290 1291 if (utils.isString(domain)) { 1292 cookie.push('domain=' + domain); 1293 } 1294 1295 if (secure === true) { 1296 cookie.push('secure'); 1297 } 1298 1299 document.cookie = cookie.join('; '); 1300 }, 1301 1302 read: function read(name) { 1303 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 1304 return (match ? decodeURIComponent(match[3]) : null); 1305 }, 1306 1307 remove: function remove(name) { 1308 this.write(name, '', Date.now() - 86400000); 1309 } 1310 }; 1311 })() : 1312 1313 // Non standard browser env (web workers, react-native) lack needed support. 1314 (function nonStandardBrowserEnv() { 1315 return { 1316 write: function write() {}, 1317 read: function read() { return null; }, 1318 remove: function remove() {} 1319 }; 1320 })() 1321); 1322 1323 1324/***/ }), 1325
vendor: 912 bytes, lines 1326-1351
1326/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": 1327/*!*********************************************************!*\ 1328 !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! 1329 \*********************************************************/ 1330/*! no static exports found */ 1331/***/ (function(module, exports, __webpack_require__) { 1332 1333"use strict"; 1334 1335 1336/** 1337 * Determines whether the specified URL is absolute 1338 * 1339 * @param {string} url The URL to test 1340 * @returns {boolean} True if the specified URL is absolute, otherwise false 1341 */ 1342module.exports = function isAbsoluteURL(url) { 1343 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 1344 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 1345 // by any combination of letters, digits, plus, period, or hyphen. 1346 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 1347}; 1348 1349 1350/***/ }), 1351
vendor: 2,715 bytes, lines 1352-1431
1352/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": 1353/*!***********************************************************!*\ 1354 !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! 1355 \***********************************************************/ 1356/*! no static exports found */ 1357/***/ (function(module, exports, __webpack_require__) { 1358 1359"use strict"; 1360 1361 1362var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1363 1364module.exports = ( 1365 utils.isStandardBrowserEnv() ? 1366 1367 // Standard browser envs have full support of the APIs needed to test 1368 // whether the request URL is of the same origin as current location. 1369 (function standardBrowserEnv() { 1370 var msie = /(msie|trident)/i.test(navigator.userAgent); 1371 var urlParsingNode = document.createElement('a'); 1372 var originURL; 1373 1374 /** 1375 * Parse a URL to discover it's components 1376 * 1377 * @param {String} url The URL to be parsed 1378 * @returns {Object} 1379 */ 1380 function resolveURL(url) { 1381 var href = url; 1382 1383 if (msie) { 1384 // IE needs attribute set twice to normalize properties 1385 urlParsingNode.setAttribute('href', href); 1386 href = urlParsingNode.href; 1387 } 1388 1389 urlParsingNode.setAttribute('href', href); 1390 1391 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 1392 return { 1393 href: urlParsingNode.href, 1394 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 1395 host: urlParsingNode.host, 1396 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 1397 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 1398 hostname: urlParsingNode.hostname, 1399 port: urlParsingNode.port, 1400 pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 1401 urlParsingNode.pathname : 1402 '/' + urlParsingNode.pathname 1403 }; 1404 } 1405 1406 originURL = resolveURL(window.location.href); 1407 1408 /** 1409 * Determine if a URL shares the same origin as the current location 1410 * 1411 * @param {String} requestURL The URL to test 1412 * @returns {boolean} True if URL shares the same origin, otherwise false 1413 */ 1414 return function isURLSameOrigin(requestURL) { 1415 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 1416 return (parsed.protocol === originURL.protocol && 1417 parsed.host === originURL.host); 1418 }; 1419 })() : 1420 1421 // Non standard browser envs (web workers, react-native) lack needed support. 1422 (function nonStandardBrowserEnv() { 1423 return function isURLSameOrigin() { 1424 return true; 1425 }; 1426 })() 1427); 1428 1429 1430/***/ }), 1431
vendor: 783 bytes, lines 1432-1455
1432/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": 1433/*!***************************************************************!*\ 1434 !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! 1435 \***************************************************************/ 1436/*! no static exports found */ 1437/***/ (function(module, exports, __webpack_require__) { 1438 1439"use strict"; 1440 1441 1442var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 1443 1444module.exports = function normalizeHeaderName(headers, normalizedName) { 1445 utils.forEach(headers, function processHeader(value, name) { 1446 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 1447 headers[normalizedName] = value; 1448 delete headers[name]; 1449 } 1450 }); 1451}; 1452 1453 1454/***/ }), 1455
vendor: 1,791 bytes, lines 1456-1520
1456/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": 1457/*!********************************************************!*\ 1458 !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! 1459 \********************************************************/ 1460/*! no static exports found */ 1461/***/ (function(module, exports, __webpack_require__) { 1462 1463"use strict"; 1464 1465 1466var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1467 1468// Headers whose duplicates are ignored by node 1469// c.f. https://nodejs.org/api/http.html#http_message_headers 1470var ignoreDuplicateOf = [ 1471 'age', 'authorization', 'content-length', 'content-type', 'etag', 1472 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 1473 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 1474 'referer', 'retry-after', 'user-agent' 1475]; 1476 1477/** 1478 * Parse headers into an object 1479 * 1480 * ``` 1481 * Date: Wed, 27 Aug 2014 08:58:49 GMT 1482 * Content-Type: application/json 1483 * Connection: keep-alive 1484 * Transfer-Encoding: chunked 1485 * ``` 1486 * 1487 * @param {String} headers Headers needing to be parsed 1488 * @returns {Object} Headers parsed into an object 1489 */ 1490module.exports = function parseHeaders(headers) { 1491 var parsed = {}; 1492 var key; 1493 var val; 1494 var i; 1495 1496 if (!headers) { return parsed; } 1497 1498 utils.forEach(headers.split('\n'), function parser(line) { 1499 i = line.indexOf(':'); 1500 key = utils.trim(line.substr(0, i)).toLowerCase(); 1501 val = utils.trim(line.substr(i + 1)); 1502 1503 if (key) { 1504 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 1505 return; 1506 } 1507 if (key === 'set-cookie') { 1508 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 1509 } else { 1510 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 1511 } 1512 } 1513 }); 1514 1515 return parsed; 1516}; 1517 1518 1519/***/ }), 1520
vendor: 885 bytes, lines 1521-1559
1521/***/ "./node_modules/axios/lib/helpers/spread.js": 1522/*!**************************************************!*\ 1523 !*** ./node_modules/axios/lib/helpers/spread.js ***! 1524 \**************************************************/ 1525/*! no static exports found */ 1526/***/ (function(module, exports, __webpack_require__) { 1527 1528"use strict"; 1529 1530 1531/** 1532 * Syntactic sugar for invoking a function and expanding an array for arguments. 1533 * 1534 * Common use case would be to use `Function.prototype.apply`. 1535 * 1536 * ```js 1537 * function f(x, y, z) {} 1538 * var args = [1, 2, 3]; 1539 * f.apply(null, args); 1540 * ``` 1541 * 1542 * With `spread` this example can be re-written. 1543 * 1544 * ```js 1545 * spread(function(x, y, z) {})([1, 2, 3]); 1546 * ``` 1547 * 1548 * @param {Function} callback 1549 * @returns {Function} 1550 */ 1551module.exports = function spread(callback) { 1552 return function wrap(arr) { 1553 return callback.apply(null, arr); 1554 }; 1555}; 1556 1557 1558/***/ }), 1559
vendor: 9,292 bytes, lines 1560-1922
1560/***/ "./node_modules/axios/lib/utils.js": 1561/*!*****************************************!*\ 1562 !*** ./node_modules/axios/lib/utils.js ***! 1563 \*****************************************/ 1564/*! no static exports found */ 1565/***/ (function(module, exports, __webpack_require__) { 1566 1567"use strict"; 1568 1569 1570var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 1571 1572/*global toString:true*/ 1573 1574// utils is a library of generic helper functions non-specific to axios 1575 1576var toString = Object.prototype.toString; 1577 1578/** 1579 * Determine if a value is an Array 1580 * 1581 * @param {Object} val The value to test 1582 * @returns {boolean} True if value is an Array, otherwise false 1583 */ 1584function isArray(val) { 1585 return toString.call(val) === '[object Array]'; 1586} 1587 1588/** 1589 * Determine if a value is undefined 1590 * 1591 * @param {Object} val The value to test 1592 * @returns {boolean} True if the value is undefined, otherwise false 1593 */ 1594function isUndefined(val) { 1595 return typeof val === 'undefined'; 1596} 1597 1598/** 1599 * Determine if a value is a Buffer 1600 * 1601 * @param {Object} val The value to test 1602 * @returns {boolean} True if value is a Buffer, otherwise false 1603 */ 1604function isBuffer(val) { 1605 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) 1606 && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); 1607} 1608 1609/** 1610 * Determine if a value is an ArrayBuffer 1611 * 1612 * @param {Object} val The value to test 1613 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 1614 */ 1615function isArrayBuffer(val) { 1616 return toString.call(val) === '[object ArrayBuffer]'; 1617} 1618 1619/** 1620 * Determine if a value is a FormData 1621 * 1622 * @param {Object} val The value to test 1623 * @returns {boolean} True if value is an FormData, otherwise false 1624 */ 1625function isFormData(val) { 1626 return (typeof FormData !== 'undefined') && (val instanceof FormData); 1627} 1628 1629/** 1630 * Determine if a value is a view on an ArrayBuffer 1631 * 1632 * @param {Object} val The value to test 1633 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 1634 */ 1635function isArrayBufferView(val) { 1636 var result; 1637 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 1638 result = ArrayBuffer.isView(val); 1639 } else { 1640 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 1641 } 1642 return result; 1643} 1644 1645/** 1646 * Determine if a value is a String 1647 * 1648 * @param {Object} val The value to test 1649 * @returns {boolean} True if value is a String, otherwise false 1650 */ 1651function isString(val) { 1652 return typeof val === 'string'; 1653} 1654 1655/** 1656 * Determine if a value is a Number 1657 * 1658 * @param {Object} val The value to test 1659 * @returns {boolean} True if value is a Number, otherwise false 1660 */ 1661function isNumber(val) { 1662 return typeof val === 'number'; 1663} 1664 1665/** 1666 * Determine if a value is an Object 1667 * 1668 * @param {Object} val The value to test 1669 * @returns {boolean} True if value is an Object, otherwise false 1670 */ 1671function isObject(val) { 1672 return val !== null && typeof val === 'object'; 1673} 1674 1675/** 1676 * Determine if a value is a plain Object 1677 * 1678 * @param {Object} val The value to test 1679 * @return {boolean} True if value is a plain Object, otherwise false 1680 */ 1681function isPlainObject(val) { 1682 if (toString.call(val) !== '[object Object]') { 1683 return false; 1684 } 1685 1686 var prototype = Object.getPrototypeOf(val); 1687 return prototype === null || prototype === Object.prototype; 1688} 1689 1690/** 1691 * Determine if a value is a Date 1692 * 1693 * @param {Object} val The value to test 1694 * @returns {boolean} True if value is a Date, otherwise false 1695 */ 1696function isDate(val) { 1697 return toString.call(val) === '[object Date]'; 1698} 1699 1700/** 1701 * Determine if a value is a File 1702 * 1703 * @param {Object} val The value to test 1704 * @returns {boolean} True if value is a File, otherwise false 1705 */ 1706function isFile(val) { 1707 return toString.call(val) === '[object File]'; 1708} 1709 1710/** 1711 * Determine if a value is a Blob 1712 * 1713 * @param {Object} val The value to test 1714 * @returns {boolean} True if value is a Blob, otherwise false 1715 */ 1716function isBlob(val) { 1717 return toString.call(val) === '[object Blob]'; 1718} 1719 1720/** 1721 * Determine if a value is a Function 1722 * 1723 * @param {Object} val The value to test 1724 * @returns {boolean} True if value is a Function, otherwise false 1725 */ 1726function isFunction(val) { 1727 return toString.call(val) === '[object Function]'; 1728} 1729 1730/** 1731 * Determine if a value is a Stream 1732 * 1733 * @param {Object} val The value to test 1734 * @returns {boolean} True if value is a Stream, otherwise false 1735 */ 1736function isStream(val) { 1737 return isObject(val) && isFunction(val.pipe); 1738} 1739 1740/** 1741 * Determine if a value is a URLSearchParams object 1742 * 1743 * @param {Object} val The value to test 1744 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 1745 */ 1746function isURLSearchParams(val) { 1747 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 1748} 1749 1750/** 1751 * Trim excess whitespace off the beginning and end of a string 1752 * 1753 * @param {String} str The String to trim 1754 * @returns {String} The String freed of excess whitespace 1755 */ 1756function trim(str) { 1757 return str.replace(/^\s*/, '').replace(/\s*$/, ''); 1758} 1759 1760/** 1761 * Determine if we're running in a standard browser environment 1762 * 1763 * This allows axios to run in a web worker, and react-native. 1764 * Both environments support XMLHttpRequest, but not fully standard globals. 1765 * 1766 * web workers: 1767 * typeof window -> undefined 1768 * typeof document -> undefined 1769 * 1770 * react-native: 1771 * navigator.product -> 'ReactNative' 1772 * nativescript 1773 * navigator.product -> 'NativeScript' or 'NS' 1774 */ 1775function isStandardBrowserEnv() { 1776 if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || 1777 navigator.product === 'NativeScript' || 1778 navigator.product === 'NS')) { 1779 return false; 1780 } 1781 return ( 1782 typeof window !== 'undefined' && 1783 typeof document !== 'undefined' 1784 ); 1785} 1786 1787/** 1788 * Iterate over an Array or an Object invoking a function for each item. 1789 * 1790 * If `obj` is an Array callback will be called passing 1791 * the value, index, and complete array for each item. 1792 * 1793 * If 'obj' is an Object callback will be called passing 1794 * the value, key, and complete object for each property. 1795 * 1796 * @param {Object|Array} obj The object to iterate 1797 * @param {Function} fn The callback to invoke for each item 1798 */ 1799function forEach(obj, fn) { 1800 // Don't bother if no value provided 1801 if (obj === null || typeof obj === 'undefined') { 1802 return; 1803 } 1804 1805 // Force an array if not already something iterable 1806 if (typeof obj !== 'object') { 1807 /*eslint no-param-reassign:0*/ 1808 obj = [obj]; 1809 } 1810 1811 if (isArray(obj)) { 1812 // Iterate over array values 1813 for (var i = 0, l = obj.length; i < l; i++) { 1814 fn.call(null, obj[i], i, obj); 1815 } 1816 } else { 1817 // Iterate over object keys 1818 for (var key in obj) { 1819 if (Object.prototype.hasOwnProperty.call(obj, key)) { 1820 fn.call(null, obj[key], key, obj); 1821 } 1822 } 1823 } 1824} 1825 1826/** 1827 * Accepts varargs expecting each argument to be an object, then 1828 * immutably merges the properties of each object and returns result. 1829 * 1830 * When multiple objects contain the same key the later object in 1831 * the arguments list will take precedence. 1832 * 1833 * Example: 1834 * 1835 * ```js 1836 * var result = merge({foo: 123}, {foo: 456}); 1837 * console.log(result.foo); // outputs 456 1838 * ``` 1839 * 1840 * @param {Object} obj1 Object to merge 1841 * @returns {Object} Result of all merge properties 1842 */ 1843function merge(/* obj1, obj2, obj3, ... */) { 1844 var result = {}; 1845 function assignValue(val, key) { 1846 if (isPlainObject(result[key]) && isPlainObject(val)) { 1847 result[key] = merge(result[key], val); 1848 } else if (isPlainObject(val)) { 1849 result[key] = merge({}, val); 1850 } else if (isArray(val)) { 1851 result[key] = val.slice(); 1852 } else { 1853 result[key] = val; 1854 } 1855 } 1856 1857 for (var i = 0, l = arguments.length; i < l; i++) { 1858 forEach(arguments[i], assignValue); 1859 } 1860 return result; 1861} 1862 1863/** 1864 * Extends object a by mutably adding to it the properties of object b. 1865 * 1866 * @param {Object} a The object to be extended 1867 * @param {Object} b The object to copy properties from 1868 * @param {Object} thisArg The object to bind function to 1869 * @return {Object} The resulting value of object a 1870 */ 1871function extend(a, b, thisArg) { 1872 forEach(b, function assignValue(val, key) { 1873 if (thisArg && typeof val === 'function') { 1874 a[key] = bind(val, thisArg); 1875 } else { 1876 a[key] = val; 1877 } 1878 }); 1879 return a; 1880} 1881 1882/** 1883 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) 1884 * 1885 * @param {string} content with BOM 1886 * @return {string} content value without BOM 1887 */ 1888function stripBOM(content) { 1889 if (content.charCodeAt(0) === 0xFEFF) { 1890 content = content.slice(1); 1891 } 1892 return content; 1893} 1894 1895module.exports = { 1896 isArray: isArray, 1897 isArrayBuffer: isArrayBuffer, 1898 isBuffer: isBuffer, 1899 isFormData: isFormData, 1900 isArrayBufferView: isArrayBufferView, 1901 isString: isString, 1902 isNumber: isNumber, 1903 isObject: isObject, 1904 isPlainObject: isPlainObject, 1905 isUndefined: isUndefined, 1906 isDate: isDate, 1907 isFile: isFile, 1908 isBlob: isBlob, 1909 isFunction: isFunction, 1910 isStream: isStream, 1911 isURLSearchParams: isURLSearchParams, 1912 isStandardBrowserEnv: isStandardBrowserEnv, 1913 forEach: forEach, 1914 merge: merge, 1915 extend: extend, 1916 trim: trim, 1917 stripBOM: stripBOM 1918}; 1919 1920 1921/***/ }), 1922
vendor: 8,480 bytes, lines 1923-2136
1923/***/ "./node_modules/domtastic/src/array.js": 1924/*!*********************************************!*\ 1925 !*** ./node_modules/domtastic/src/array.js ***! 1926 \*********************************************/ 1927/*! exports provided: every, filter, forEach, each, indexOf, map, pop, push, reduce, reduceRight, reverse, shift, some, unshift */ 1928/***/ (function(module, __webpack_exports__, __webpack_require__) { 1929 1930"use strict"; 1931__webpack_require__.r(__webpack_exports__); 1932/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return every; }); 1933/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return filter; }); 1934/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; }); 1935/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return each; }); 1936/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return indexOf; }); 1937/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; }); 1938/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pop", function() { return pop; }); 1939/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "push", function() { return push; }); 1940/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return reduce; }); 1941/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return reduceRight; }); 1942/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reverse", function() { return reverse; }); 1943/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shift", function() { return shift; }); 1944/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return some; }); 1945/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unshift", function() { return unshift; }); 1946/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./node_modules/domtastic/src/util.js"); 1947/* harmony import */ var _selector_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./selector/index */ "./node_modules/domtastic/src/selector/index.js"); 1948/** 1949 * @module Array 1950 */ 1951 1952 1953 1954 1955const ArrayProto = Array.prototype; 1956 1957/** 1958 * Checks if the given callback returns a true(-ish) value for each element in the collection. 1959 * 1960 * @param {Function} callback Function to execute for each element, invoked with `element` as argument. 1961 * @param {Object} [thisArg] Value to use as `this` when executing `callback`. 1962 * @return {Boolean} Whether each element passed the callback check. 1963 * @example 1964 * // Test whether every element in the collection has the "active" attribute 1965 * $('.items').every(function(element) { 1966 * return element.hasAttribute('active') 1967 * }); 1968 */ 1969 1970const every = ArrayProto.every; 1971 1972/** 1973 * Filter the collection by selector or function, and return a new collection with the result. 1974 * 1975 * @param {String|Function} selector Selector or function to filter the collection. 1976 * @param {Object} [thisArg] Value to use as `this` when executing `callback`. 1977 * @return {Object} A new wrapped collection 1978 * @chainable 1979 * @example 1980 * $('.items').filter('.active'); 1981 * @example 1982 * $('.items').filter(function(element) { 1983 * return element.hasAttribute('active') 1984 * }); 1985 */ 1986 1987const filter = function(selector, thisArg) { 1988 const callback = typeof selector === 'function' ? selector : element => Object(_selector_index__WEBPACK_IMPORTED_MODULE_1__["matches"])(element, selector); 1989 return Object(_selector_index__WEBPACK_IMPORTED_MODULE_1__["$"])(ArrayProto.filter.call(this, callback, thisArg)); 1990}; 1991 1992/** 1993 * Execute a function for each element in the collection. 1994 * 1995 * @param {Function} callback Function to execute for each element, invoked with `element` as argument. 1996 * @param {Object} [thisArg] Value to use as `this` when executing `callback`. 1997 * @return {Object} The wrapped collection 1998 * @chainable 1999 * @example 2000 * $('.items').forEach(function(element) { 2001 * element.style.color = 'evergreen'; 2002 * ); 2003 */ 2004 2005const forEach = function(callback, thisArg) { 2006 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, callback, thisArg); 2007}; 2008 2009const each = forEach; 2010 2011/** 2012 * Returns the index of an element in the collection. 2013 * 2014 * @param {Node} element 2015 * @return {Number} The zero-based index, -1 if not found. 2016 * @example 2017 * $('.items').indexOf(element); // 2 2018 */ 2019 2020const indexOf = ArrayProto.indexOf; 2021 2022/** 2023 * Create a new collection by executing the callback for each element in the collection. 2024 * 2025 * @param {Function} callback Function to execute for each element, invoked with `element` as argument. 2026 * @param {Object} [thisArg] Value to use as `this` when executing `callback`. 2027 * @return {Array} Collection with the return value of the executed callback for each element. 2028 * @example 2029 * // Create a new array with the attribute value of each element: 2030 * $('.items').map(function(element) { 2031 * return element.getAttribute('name') 2032 */ 2033 2034const map = ArrayProto.map; 2035 2036/** 2037 * Removes the last element from the collection, and returns that element. 2038 * 2039 * @return {Object} The last element from the collection. 2040 * @example 2041 * var lastElement = $('.items').pop(); 2042 */ 2043 2044const pop = ArrayProto.pop; 2045 2046/** 2047 * Adds one or more elements to the end of the collection, and returns the new length of the collection. 2048 * 2049 * @param {Object} element Element(s) to add to the collection 2050 * @return {Number} The new length of the collection 2051 * @example 2052 * $('.items').push(element); 2053 */ 2054 2055const push = ArrayProto.push; 2056 2057/** 2058 * Apply a function against each element in the collection, and this accumulator function has to reduce it 2059 * to a single value. 2060 * 2061 * @param {Function} callback Function to execute on each value in the array, taking four arguments (see example). 2062 * @param {Mixed} initialValue Object to use as the first argument to the first call of the callback. 2063 * @example 2064 * // Calculate the combined height of elements: 2065 * $('.items').reduce(function(previousValue, element, index, collection) { 2066 * return previousValue + element.clientHeight; 2067 * }, 0); 2068 */ 2069 2070const reduce = ArrayProto.reduce; 2071 2072/** 2073 * Apply a function against each element in the collection (from right-to-left), and this accumulator function has 2074 * to reduce it to a single value. 2075 * 2076 * @param {Function} callback Function to execute on each value in the array, taking four arguments (see example). 2077 * @param {Mixed} initialValue Object to use as the first argument to the first call of the callback. 2078 * @example 2079 * // Concatenate the text of elements in reversed order: 2080 * $('.items').reduceRight(function(previousValue, element, index, collection) { 2081 * return previousValue + element.textContent; 2082 * }, ''); 2083 */ 2084 2085const reduceRight = ArrayProto.reduceRight; 2086 2087/** 2088 * Reverses an array in place. The first array element becomes the last and the last becomes the first. 2089 * 2090 * @return {Object} The wrapped collection, reversed 2091 * @chainable 2092 * @example 2093 * $('.items').reverse(); 2094 */ 2095 2096const reverse = function() { 2097 return Object(_selector_index__WEBPACK_IMPORTED_MODULE_1__["$"])(Object(_util__WEBPACK_IMPORTED_MODULE_0__["toArray"])(this).reverse()); 2098}; 2099 2100/** 2101 * Removes the first element from the collection, and returns that element. 2102 * 2103 * @return {Object} The first element from the collection. 2104 * @example 2105 * var firstElement = $('.items').shift(); 2106 */ 2107 2108const shift = ArrayProto.shift; 2109 2110/** 2111 * Checks if the given callback returns a true(-ish) value for any of the elements in the collection. 2112 * 2113 * @param {Function} callback Function to execute for each element, invoked with `element` as argument. 2114 * @return {Boolean} Whether any element passed the callback check. 2115 * @example 2116 * $('.items').some(function(element) { 2117 * return element.hasAttribute('active') 2118 * }); // true/false 2119 */ 2120 2121const some = ArrayProto.some; 2122 2123/** 2124 * Adds one or more elements to the beginning of the collection, and returns the new length of the collection. 2125 * 2126 * @param {Object} element Element(s) to add to the collection 2127 * @return {Number} The new length of the collection 2128 * @example 2129 * $('.items').unshift(element); 2130 */ 2131 2132const unshift = ArrayProto.unshift; 2133 2134 2135/***/ }), 2136
vendor: 2,025 bytes, lines 2137-2198
2137/***/ "./node_modules/domtastic/src/baseClass.js": 2138/*!*************************************************!*\ 2139 !*** ./node_modules/domtastic/src/baseClass.js ***! 2140 \*************************************************/ 2141/*! exports provided: default */ 2142/***/ (function(module, __webpack_exports__, __webpack_require__) { 2143 2144"use strict"; 2145__webpack_require__.r(__webpack_exports__); 2146/* harmony import */ var _selector_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./selector/index */ "./node_modules/domtastic/src/selector/index.js"); 2147/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "./node_modules/domtastic/src/util.js"); 2148/** 2149 * @module BaseClass 2150 */ 2151 2152 2153 2154 2155/* harmony default export */ __webpack_exports__["default"] = (function(api) { 2156 2157 /** 2158 * Provide subclass for classes or components to extend from. 2159 * The opposite and successor of plugins (no need to extend `$.fn` anymore, complete control). 2160 * 2161 * @return {Class} The class to extend from, including all `$.fn` methods. 2162 * @example 2163 * import { BaseClass } from 'domtastic'; 2164 * 2165 * class MyComponent extends BaseClass { 2166 * doSomething() { 2167 * return this.addClass('.foo'); 2168 * } 2169 * } 2170 * 2171 * let component = new MyComponent('body'); 2172 * component.doSomething(); 2173 * 2174 * @example 2175 * import $ from 'domtastic'; 2176 * 2177 * class MyComponent extends $.BaseClass { 2178 * progress(value) { 2179 * return this.attr('data-progress', value); 2180 * } 2181 * } 2182 * 2183 * let component = new MyComponent(document.body); 2184 * component.progress('ive').append('<p>enhancement</p>'); 2185 */ 2186 2187 class BaseClass { 2188 constructor() { 2189 _selector_index__WEBPACK_IMPORTED_MODULE_0__["DOMtastic"].call(this, Object(_selector_index__WEBPACK_IMPORTED_MODULE_0__["$"])(...arguments)); 2190 } 2191 } 2192 Object(_util__WEBPACK_IMPORTED_MODULE_1__["extend"])(BaseClass.prototype, api); 2193 return BaseClass; 2194}); 2195 2196 2197/***/ }), 2198
vendor: 2,403 bytes, lines 2199-2277
2199/***/ "./node_modules/domtastic/src/css.js": 2200/*!*******************************************!*\ 2201 !*** ./node_modules/domtastic/src/css.js ***! 2202 \*******************************************/ 2203/*! exports provided: css */ 2204/***/ (function(module, __webpack_exports__, __webpack_require__) { 2205 2206"use strict"; 2207__webpack_require__.r(__webpack_exports__); 2208/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "css", function() { return css; }); 2209/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./node_modules/domtastic/src/util.js"); 2210/** 2211 * @module CSS 2212 */ 2213 2214 2215 2216const isNumeric = value => !isNaN(parseFloat(value)) && isFinite(value); 2217 2218const camelize = value => value.replace(/-([\da-z])/gi, (matches, letter) => letter.toUpperCase()); 2219 2220const dasherize = value => value.replace(/([a-z\d])([A-Z])/g, '$1-$2').toLowerCase(); 2221 2222/** 2223 * Get the value of a style property for the first element, or set one or more style properties for each element in the collection. 2224 * 2225 * @param {String|Object} key The name of the style property to get or set. Or an object containing key-value pairs to set as style properties. 2226 * @param {String} [value] The value of the style property to set. 2227 * @return {Object} The wrapped collection 2228 * @chainable 2229 * @example 2230 * $('.item').css('padding-left'); // get 2231 * $('.item').css('color', '#f00'); // set 2232 * $('.item').css({'border-width': '1px', display: 'inline-block'}); // set multiple 2233 */ 2234 2235const css = function(key, value) { 2236 2237 let styleProps, prop, val; 2238 2239 if(typeof key === 'string') { 2240 key = camelize(key); 2241 2242 if(typeof value === 'undefined') { 2243 let element = this.nodeType ? this : this[0]; 2244 if(element) { 2245 val = element.style[key]; 2246 return isNumeric(val) ? parseFloat(val) : val; 2247 } 2248 return undefined; 2249 } 2250 2251 styleProps = {}; 2252 styleProps[key] = value; 2253 } else { 2254 styleProps = key; 2255 for(prop in styleProps) { 2256 val = styleProps[prop]; 2257 delete styleProps[prop]; 2258 styleProps[camelize(prop)] = val; 2259 } 2260 } 2261 2262 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 2263 for(prop in styleProps) { 2264 if(styleProps[prop] || styleProps[prop] === 0) { 2265 element.style[prop] = styleProps[prop]; 2266 } else { 2267 element.style.removeProperty(dasherize(prop)); 2268 } 2269 } 2270 }); 2271 2272 return this; 2273}; 2274 2275 2276/***/ }), 2277
vendor: 2,219 bytes, lines 2278-2343
2278/***/ "./node_modules/domtastic/src/dom/attr.js": 2279/*!************************************************!*\ 2280 !*** ./node_modules/domtastic/src/dom/attr.js ***! 2281 \************************************************/ 2282/*! exports provided: attr, removeAttr */ 2283/***/ (function(module, __webpack_exports__, __webpack_require__) { 2284 2285"use strict"; 2286__webpack_require__.r(__webpack_exports__); 2287/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "attr", function() { return attr; }); 2288/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAttr", function() { return removeAttr; }); 2289/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2290/** 2291 * @module Attr 2292 */ 2293 2294 2295 2296/** 2297 * Get the value of an attribute for the first element, or set one or more attributes for each element in the collection. 2298 * 2299 * @param {String|Object} key The name of the attribute to get or set. Or an object containing key-value pairs to set as attributes. 2300 * @param {String} [value] The value of the attribute to set. 2301 * @return {Object} The wrapped collection 2302 * @chainable 2303 * @example 2304 * $('.item').attr('attrName'); // get 2305 * $('.item').attr('attrName', 'attrValue'); // set 2306 * $('.item').attr({attr1: 'value1', 'attr-2': 'value2'}); // set multiple 2307 */ 2308 2309const attr = function(key, value) { 2310 2311 if(typeof key === 'string' && typeof value === 'undefined') { 2312 const element = this.nodeType ? this : this[0]; 2313 return element ? element.getAttribute(key) : undefined; 2314 } 2315 2316 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 2317 if(typeof key === 'object') { 2318 for(let attr in key) { 2319 element.setAttribute(attr, key[attr]); 2320 } 2321 } else { 2322 element.setAttribute(key, value); 2323 } 2324 }); 2325}; 2326 2327/** 2328 * Remove attribute from each element in the collection. 2329 * 2330 * @param {String} key Attribute name 2331 * @return {Object} The wrapped collection 2332 * @chainable 2333 * @example 2334 * $('.items').removeAttr('attrName'); 2335 */ 2336 2337const removeAttr = function(key) { 2338 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element.removeAttribute(key)); 2339}; 2340 2341 2342/***/ }), 2343
vendor: 3,536 bytes, lines 2344-2449
2344/***/ "./node_modules/domtastic/src/dom/class.js": 2345/*!*************************************************!*\ 2346 !*** ./node_modules/domtastic/src/dom/class.js ***! 2347 \*************************************************/ 2348/*! exports provided: addClass, removeClass, toggleClass, hasClass */ 2349/***/ (function(module, __webpack_exports__, __webpack_require__) { 2350 2351"use strict"; 2352__webpack_require__.r(__webpack_exports__); 2353/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addClass", function() { return addClass; }); 2354/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeClass", function() { return removeClass; }); 2355/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toggleClass", function() { return toggleClass; }); 2356/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasClass", function() { return hasClass; }); 2357/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2358/** 2359 * @module Class 2360 */ 2361 2362 2363 2364/** 2365 * Add a class to the element(s) 2366 * 2367 * @param {String} value Space-separated class name(s) to add to the element(s). 2368 * @return {Object} The wrapped collection 2369 * @chainable 2370 * @example 2371 * $('.item').addClass('bar'); 2372 * $('.item').addClass('bar foo'); 2373 */ 2374 2375const addClass = function(value) { 2376 if(value && value.length) { 2377 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(value.split(' '), _each.bind(this, 'add')); 2378 } 2379 return this; 2380}; 2381 2382/** 2383 * Remove a class from the element(s) 2384 * 2385 * @param {String} value Space-separated class name(s) to remove from the element(s). 2386 * @return {Object} The wrapped collection 2387 * @chainable 2388 * @example 2389 * $('.items').removeClass('bar'); 2390 * $('.items').removeClass('bar foo'); 2391 */ 2392 2393const removeClass = function(value) { 2394 if(value && value.length) { 2395 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(value.split(' '), _each.bind(this, 'remove')); 2396 } 2397 return this; 2398}; 2399 2400/** 2401 * Toggle a class at the element(s) 2402 * 2403 * @param {String} value Space-separated class name(s) to toggle at the element(s). 2404 * @param {Boolean} [state] A Boolean value to determine whether the class should be added or removed. 2405 * @return {Object} The wrapped collection 2406 * @chainable 2407 * @example 2408 * $('.item').toggleClass('bar'); 2409 * $('.item').toggleClass('bar foo'); 2410 * $('.item').toggleClass('bar', true); 2411 */ 2412 2413const toggleClass = function(value, state) { 2414 if(value && value.length) { 2415 const action = typeof state === 'boolean' ? state ? 'add' : 'remove' : 'toggle'; 2416 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(value.split(' '), _each.bind(this, action)); 2417 } 2418 return this; 2419}; 2420 2421/** 2422 * Check if the element(s) have a class. 2423 * 2424 * @param {String} value Check if the DOM element contains the class name. When applied to multiple elements, 2425 * returns `true` if _any_ of them contains the class name. 2426 * @return {Boolean} Whether the element's class attribute contains the class name. 2427 * @example 2428 * $('.item').hasClass('bar'); 2429 */ 2430 2431const hasClass = function(value) { 2432 return (this.nodeType ? [this] : this).some(element => element.classList.contains(value)); 2433}; 2434 2435/** 2436 * Specialized iteration, applying `fn` of the classList API to each element. 2437 * 2438 * @param {String} fnName 2439 * @param {String} className 2440 * @private 2441 */ 2442 2443const _each = function(fnName, className) { 2444 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element.classList[fnName](className)); 2445}; 2446 2447 2448/***/ }), 2449
vendor: 1,301 bytes, lines 2450-2487
2450/***/ "./node_modules/domtastic/src/dom/contains.js": 2451/*!****************************************************!*\ 2452 !*** ./node_modules/domtastic/src/dom/contains.js ***! 2453 \****************************************************/ 2454/*! exports provided: contains */ 2455/***/ (function(module, __webpack_exports__, __webpack_require__) { 2456 2457"use strict"; 2458__webpack_require__.r(__webpack_exports__); 2459/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return contains; }); 2460/** 2461 * @module contains 2462 */ 2463 2464/** 2465 * Test whether an element contains another element in the DOM. 2466 * 2467 * @param {Element} container The element that may contain the other element. 2468 * @param {Element} element The element that may be a descendant of the other element. 2469 * @return {Boolean} Whether the `container` element contains the `element`. 2470 * @example 2471 * $.contains(parentElement, childElement); // true/false 2472 */ 2473 2474const contains = (container, element) => { 2475 if(!container || !element || container === element) { 2476 return false; 2477 } else if(container.contains) { 2478 return container.contains(element); 2479 } else if(container.compareDocumentPosition) { 2480 return !(container.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED); 2481 } 2482 return false; 2483}; 2484 2485 2486/***/ }), 2487
vendor: 2,609 bytes, lines 2488-2563
2488/***/ "./node_modules/domtastic/src/dom/data.js": 2489/*!************************************************!*\ 2490 !*** ./node_modules/domtastic/src/dom/data.js ***! 2491 \************************************************/ 2492/*! exports provided: data, prop */ 2493/***/ (function(module, __webpack_exports__, __webpack_require__) { 2494 2495"use strict"; 2496__webpack_require__.r(__webpack_exports__); 2497/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "data", function() { return data; }); 2498/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prop", function() { return prop; }); 2499/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2500/** 2501 * @module Data 2502 */ 2503 2504 2505 2506const isSupportsDataSet = typeof document !== 'undefined' && 'dataset' in document.documentElement; 2507const DATAKEYPROP = isSupportsDataSet ? 'dataset' : '__DOMTASTIC_DATA__'; 2508 2509const camelize = str => str.replace(/-+(.)?/g, (match, char) => char ? char.toUpperCase() : ''); 2510 2511/** 2512 * Get data from first element, or set data for each element in the collection. 2513 * 2514 * @param {String} key The key for the data to get or set. 2515 * @param {String} [value] The data to set. 2516 * @return {Object} The wrapped collection 2517 * @chainable 2518 * @example 2519 * $('.item').data('attrName'); // get 2520 * $('.item').data('attrName', {any: 'data'}); // set 2521 */ 2522 2523const data = function(key, value) { 2524 2525 if(typeof key === 'string' && typeof value === 'undefined') { 2526 const element = this.nodeType ? this : this[0]; 2527 return element && DATAKEYPROP in element ? element[DATAKEYPROP][camelize(key)] : undefined; 2528 } 2529 2530 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 2531 if(!isSupportsDataSet) { 2532 element[DATAKEYPROP] = element[DATAKEYPROP] || {}; 2533 } 2534 2535 element[DATAKEYPROP][camelize(key)] = value; 2536 }); 2537}; 2538 2539/** 2540 * Get property from first element, or set property on each element in the collection. 2541 * 2542 * @param {String} key The name of the property to get or set. 2543 * @param {String} [value] The value of the property to set. 2544 * @return {Object} The wrapped collection 2545 * @chainable 2546 * @example 2547 * $('.item').prop('attrName'); // get 2548 * $('.item').prop('attrName', 'attrValue'); // set 2549 */ 2550 2551const prop = function(key, value) { 2552 2553 if(typeof key === 'string' && typeof value === 'undefined') { 2554 const element = this.nodeType ? this : this[0]; 2555 return element && element ? element[key] : undefined; 2556 } 2557 2558 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element[key] = value); 2559}; 2560 2561 2562/***/ }), 2563
vendor: 4,035 bytes, lines 2564-2685
2564/***/ "./node_modules/domtastic/src/dom/extra.js": 2565/*!*************************************************!*\ 2566 !*** ./node_modules/domtastic/src/dom/extra.js ***! 2567 \*************************************************/ 2568/*! exports provided: appendTo, empty, remove, replaceWith, text, val */ 2569/***/ (function(module, __webpack_exports__, __webpack_require__) { 2570 2571"use strict"; 2572__webpack_require__.r(__webpack_exports__); 2573/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "appendTo", function() { return appendTo; }); 2574/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "empty", function() { return empty; }); 2575/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "remove", function() { return remove; }); 2576/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "replaceWith", function() { return replaceWith; }); 2577/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "text", function() { return text; }); 2578/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "val", function() { return val; }); 2579/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2580/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index */ "./node_modules/domtastic/src/dom/index.js"); 2581/* harmony import */ var _selector_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../selector/index */ "./node_modules/domtastic/src/selector/index.js"); 2582/** 2583 * @module DOM (extra) 2584 */ 2585 2586 2587 2588 2589 2590/** 2591 * Append each element in the collection to the specified element(s). 2592 * 2593 * @param {Node|NodeList|Object} element What to append the element(s) to. Clones elements as necessary. 2594 * @return {Object} The wrapped collection 2595 * @chainable 2596 * @example 2597 * $('.item').appendTo(container); 2598 */ 2599 2600const appendTo = function(element) { 2601 const context = typeof element === 'string' ? Object(_selector_index__WEBPACK_IMPORTED_MODULE_2__["$"])(element) : element; 2602 _index__WEBPACK_IMPORTED_MODULE_1__["append"].call(context, this); 2603 return this; 2604}; 2605 2606/* 2607 * Empty each element in the collection. 2608 * 2609 * @return {Object} The wrapped collection 2610 * @chainable 2611 * @example 2612 * $('.item').empty(); 2613 */ 2614 2615const empty = function() { 2616 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element.innerHTML = ''); 2617}; 2618 2619/** 2620 * Remove the collection from the DOM. 2621 * 2622 * @return {Array} Array containing the removed elements 2623 * @example 2624 * $('.item').remove(); 2625 */ 2626 2627const remove = function() { 2628 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 2629 if(element.parentNode) { 2630 element.parentNode.removeChild(element); 2631 } 2632 }); 2633}; 2634 2635/** 2636 * Replace each element in the collection with the provided new content, and return the array of elements that were replaced. 2637 * 2638 * @return {Array} Array containing the replaced elements 2639 */ 2640 2641const replaceWith = function() { 2642 return _index__WEBPACK_IMPORTED_MODULE_1__["before"].apply(this, arguments).remove(); 2643}; 2644 2645/** 2646 * Get the `textContent` from the first, or set the `textContent` of each element in the collection. 2647 * 2648 * @param {String} [value] 2649 * @return {Object} The wrapped collection 2650 * @chainable 2651 * @example 2652 * $('.item').text('New content'); 2653 */ 2654 2655const text = function(value) { 2656 2657 if(value === undefined) { 2658 return this[0].textContent; 2659 } 2660 2661 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element.textContent = '' + value); 2662}; 2663 2664/** 2665 * Get the `value` from the first, or set the `value` of each element in the collection. 2666 * 2667 * @param {String} [value] 2668 * @return {Object} The wrapped collection 2669 * @chainable 2670 * @example 2671 * $('input.firstName').val('New value'); 2672 */ 2673 2674const val = function(value) { 2675 2676 if(value === undefined) { 2677 return this.length > 0 ? this[0].value : undefined; 2678 } 2679 2680 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element.value = value); 2681}; 2682 2683 2684/***/ }), 2685
vendor: 1,332 bytes, lines 2686-2726
2686/***/ "./node_modules/domtastic/src/dom/html.js": 2687/*!************************************************!*\ 2688 !*** ./node_modules/domtastic/src/dom/html.js ***! 2689 \************************************************/ 2690/*! exports provided: html */ 2691/***/ (function(module, __webpack_exports__, __webpack_require__) { 2692 2693"use strict"; 2694__webpack_require__.r(__webpack_exports__); 2695/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "html", function() { return html; }); 2696/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2697/** 2698 * @module HTML 2699 */ 2700 2701 2702 2703/* 2704 * Get the HTML contents of the first element, or set the HTML contents for each element in the collection. 2705 * 2706 * @param {String} [fragment] HTML fragment to set for the element. If this argument is omitted, the HTML contents are returned. 2707 * @return {Object} The wrapped collection 2708 * @chainable 2709 * @example 2710 * $('.item').html(); 2711 * $('.item').html('<span>more</span>'); 2712 */ 2713 2714const html = function(fragment) { 2715 2716 if(fragment === undefined) { 2717 const element = this.nodeType ? this : this[0]; 2718 return element ? element.innerHTML : undefined; 2719 } 2720 2721 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => element.innerHTML = fragment); 2722}; 2723 2724 2725/***/ }), 2726
vendor: 6,158 bytes, lines 2727-2919
2727/***/ "./node_modules/domtastic/src/dom/index.js": 2728/*!*************************************************!*\ 2729 !*** ./node_modules/domtastic/src/dom/index.js ***! 2730 \*************************************************/ 2731/*! exports provided: append, prepend, before, after, clone, _clone, _each */ 2732/***/ (function(module, __webpack_exports__, __webpack_require__) { 2733 2734"use strict"; 2735__webpack_require__.r(__webpack_exports__); 2736/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "append", function() { return append; }); 2737/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prepend", function() { return prepend; }); 2738/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return before; }); 2739/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return after; }); 2740/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; }); 2741/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_clone", function() { return _clone; }); 2742/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_each", function() { return _each; }); 2743/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2744/* harmony import */ var _selector_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../selector/index */ "./node_modules/domtastic/src/selector/index.js"); 2745/** 2746 * @module DOM 2747 */ 2748 2749 2750 2751 2752const forEach = Array.prototype.forEach; 2753 2754/** 2755 * Append element(s) to each element in the collection. 2756 * 2757 * @param {String|Node|NodeList|Object} element What to append to the element(s). 2758 * Clones elements as necessary. 2759 * @return {Object} The wrapped collection 2760 * @chainable 2761 * @example 2762 * $('.item').append('<p>more</p>'); 2763 */ 2764 2765const append = function(element) { 2766 if(this instanceof Node) { 2767 if(typeof element === 'string') { 2768 this.insertAdjacentHTML('beforeend', element); 2769 } else { 2770 if(element instanceof Node) { 2771 this.appendChild(element); 2772 } else { 2773 const elements = element instanceof NodeList ? Object(_util__WEBPACK_IMPORTED_MODULE_0__["toArray"])(element) : element; 2774 forEach.call(elements, this.appendChild.bind(this)); 2775 } 2776 } 2777 } else { 2778 _each(this, append, element); 2779 } 2780 return this; 2781}; 2782 2783/** 2784 * Place element(s) at the beginning of each element in the collection. 2785 * 2786 * @param {String|Node|NodeList|Object} element What to place at the beginning of the element(s). 2787 * Clones elements as necessary. 2788 * @return {Object} The wrapped collection 2789 * @chainable 2790 * @example 2791 * $('.item').prepend('<span>start</span>'); 2792 */ 2793 2794const prepend = function(element) { 2795 if(this instanceof Node) { 2796 if(typeof element === 'string') { 2797 this.insertAdjacentHTML('afterbegin', element); 2798 } else { 2799 if(element instanceof Node) { 2800 this.insertBefore(element, this.firstChild); 2801 } else { 2802 let elements = element instanceof NodeList ? Object(_util__WEBPACK_IMPORTED_MODULE_0__["toArray"])(element) : element; 2803 forEach.call(elements.reverse(), prepend.bind(this)); 2804 } 2805 } 2806 } else { 2807 _each(this, prepend, element); 2808 } 2809 return this; 2810}; 2811 2812/** 2813 * Place element(s) before each element in the collection. 2814 * 2815 * @param {String|Node|NodeList|Object} element What to place as sibling(s) before to the element(s). 2816 * Clones elements as necessary. 2817 * @return {Object} The wrapped collection 2818 * @chainable 2819 * @example 2820 * $('.items').before('<p>prefix</p>'); 2821 */ 2822 2823const before = function(element) { 2824 if(this instanceof Node) { 2825 if(typeof element === 'string') { 2826 this.insertAdjacentHTML('beforebegin', element); 2827 } else { 2828 if(element instanceof Node) { 2829 this.parentNode.insertBefore(element, this); 2830 } else { 2831 const elements = element instanceof NodeList ? Object(_util__WEBPACK_IMPORTED_MODULE_0__["toArray"])(element) : element; 2832 forEach.call(elements, before.bind(this)); 2833 } 2834 } 2835 } else { 2836 _each(this, before, element); 2837 } 2838 return this; 2839}; 2840 2841/** 2842 * Place element(s) after each element in the collection. 2843 * 2844 * @param {String|Node|NodeList|Object} element What to place as sibling(s) after to the element(s). Clones elements as necessary. 2845 * @return {Object} The wrapped collection 2846 * @chainable 2847 * @example 2848 * $('.items').after('<span>suf</span><span>fix</span>'); 2849 */ 2850 2851const after = function(element) { 2852 if(this instanceof Node) { 2853 if(typeof element === 'string') { 2854 this.insertAdjacentHTML('afterend', element); 2855 } else { 2856 if(element instanceof Node) { 2857 this.parentNode.insertBefore(element, this.nextSibling); 2858 } else { 2859 const elements = element instanceof NodeList ? Object(_util__WEBPACK_IMPORTED_MODULE_0__["toArray"])(element) : element; 2860 forEach.call(elements.reverse(), after.bind(this)); 2861 } 2862 } 2863 } else { 2864 _each(this, after, element); 2865 } 2866 return this; 2867}; 2868 2869/** 2870 * Clone a wrapped object. 2871 * 2872 * @return {Object} Wrapped collection of cloned nodes. 2873 * @example 2874 * $(element).clone(); 2875 */ 2876 2877const clone = function() { 2878 return Object(_selector_index__WEBPACK_IMPORTED_MODULE_1__["$"])(_clone(this)); 2879}; 2880 2881/** 2882 * Clone an object 2883 * 2884 * @param {String|Node|NodeList|Array} element The element(s) to clone. 2885 * @return {String|Node|NodeList|Array} The cloned element(s) 2886 * @private 2887 */ 2888 2889const _clone = element => { 2890 if(typeof element === 'string') { 2891 return element; 2892 } else if(element instanceof Node) { 2893 return element.cloneNode(true); 2894 } else if('length' in element) { 2895 return [].map.call(element, el => el.cloneNode(true)); 2896 } 2897 return element; 2898}; 2899 2900/** 2901 * Specialized iteration, applying `fn` in reversed manner to a clone of each element, but the provided one. 2902 * 2903 * @param {NodeList|Array} collection 2904 * @param {Function} fn 2905 * @param {Node} element 2906 * @private 2907 */ 2908 2909const _each = (collection, fn, element) => { 2910 let l = collection.length; 2911 while(l--) { 2912 const elm = l === 0 ? element : _clone(element); 2913 fn.call(collection[l], elm); 2914 } 2915}; 2916 2917 2918/***/ }), 2919
vendor: 8,720 bytes, lines 2920-3199
2920/***/ "./node_modules/domtastic/src/event/index.js": 2921/*!***************************************************!*\ 2922 !*** ./node_modules/domtastic/src/event/index.js ***! 2923 \***************************************************/ 2924/*! exports provided: on, off, one, getHandlers, clearHandlers, proxyHandler, delegateHandler, bind, unbind */ 2925/***/ (function(module, __webpack_exports__, __webpack_require__) { 2926 2927"use strict"; 2928__webpack_require__.r(__webpack_exports__); 2929/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "on", function() { return on; }); 2930/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "off", function() { return off; }); 2931/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "one", function() { return one; }); 2932/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHandlers", function() { return getHandlers; }); 2933/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearHandlers", function() { return clearHandlers; }); 2934/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "proxyHandler", function() { return proxyHandler; }); 2935/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delegateHandler", function() { return delegateHandler; }); 2936/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return bind; }); 2937/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unbind", function() { return unbind; }); 2938/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 2939/* harmony import */ var _selector_closest__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../selector/closest */ "./node_modules/domtastic/src/selector/closest.js"); 2940/** 2941 * @module Events 2942 */ 2943 2944 2945 2946 2947/** 2948 * Shorthand for `addEventListener`. Supports event delegation if a filter (`selector`) is provided. 2949 * 2950 * @param {String} eventNames List of space-separated event types to be added to the element(s) 2951 * @param {String} [selector] Selector to filter descendants that delegate the event to this element. 2952 * @param {Function} handler Event handler 2953 * @param {Boolean} useCapture=false 2954 * @param {Boolean} once=false 2955 * @return {Object} The wrapped collection 2956 * @chainable 2957 * @example 2958 * $('.item').on('click', callback); 2959 * $('.container').on('click focus', '.item', handler); 2960 */ 2961 2962const on = function(eventNames, selector, handler, useCapture, once) { 2963 2964 if(typeof selector === 'function') { 2965 handler = selector; 2966 selector = null; 2967 } 2968 2969 let parts, 2970 namespace, 2971 eventListener; 2972 2973 eventNames.split(' ').forEach(eventName => { 2974 2975 parts = eventName.split('.'); 2976 eventName = parts[0] || null; 2977 namespace = parts[1] || null; 2978 2979 eventListener = proxyHandler(handler); 2980 2981 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 2982 2983 if(selector) { 2984 eventListener = delegateHandler.bind(element, selector, eventListener); 2985 } 2986 2987 if(once) { 2988 const listener = eventListener; 2989 eventListener = event => { 2990 off.call(element, eventNames, selector, handler, useCapture); 2991 listener.call(element, event); 2992 }; 2993 } 2994 2995 element.addEventListener(eventName, eventListener, useCapture || false); 2996 2997 getHandlers(element).push({ 2998 eventName, 2999 handler, 3000 eventListener, 3001 selector, 3002 namespace 3003 }); 3004 }); 3005 3006 }, this); 3007 3008 return this; 3009}; 3010 3011/** 3012 * Shorthand for `removeEventListener`. 3013 * 3014 * @param {String} eventNames List of space-separated event types to be removed from the element(s) 3015 * @param {String} [selector] Selector to filter descendants that undelegate the event to this element. 3016 * @param {Function} handler Event handler 3017 * @param {Boolean} useCapture=false 3018 * @return {Object} The wrapped collection 3019 * @chainable 3020 * @example 3021 * $('.item').off('click', callback); 3022 * $('#my-element').off('myEvent myOtherEvent'); 3023 * $('.item').off(); 3024 */ 3025 3026const off = function(eventNames = '', selector, handler, useCapture) { 3027 3028 if(typeof selector === 'function') { 3029 handler = selector; 3030 selector = null; 3031 } 3032 3033 let parts, 3034 namespace, 3035 handlers; 3036 3037 eventNames.split(' ').forEach(eventName => { 3038 3039 parts = eventName.split('.'); 3040 eventName = parts[0] || null; 3041 namespace = parts[1] || null; 3042 3043 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 3044 3045 handlers = getHandlers(element); 3046 3047 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(handlers.filter(item => { 3048 return ( 3049 (!eventName || item.eventName === eventName) && 3050 (!namespace || item.namespace === namespace) && 3051 (!handler || item.handler === handler) && 3052 (!selector || item.selector === selector) 3053 ); 3054 }), item => { 3055 element.removeEventListener(item.eventName, item.eventListener, useCapture || false); 3056 handlers.splice(handlers.indexOf(item), 1); 3057 }); 3058 3059 if(!eventName && !namespace && !selector && !handler) { 3060 clearHandlers(element); 3061 } else if(handlers.length === 0) { 3062 clearHandlers(element); 3063 } 3064 3065 }); 3066 3067 }, this); 3068 3069 return this; 3070}; 3071 3072/** 3073 * Add event listener and execute the handler at most once per element. 3074 * 3075 * @param eventNames 3076 * @param selector 3077 * @param handler 3078 * @param useCapture 3079 * @return {Object} The wrapped collection 3080 * @chainable 3081 * @example 3082 * $('.item').one('click', callback); 3083 */ 3084 3085const one = function(eventNames, selector, handler, useCapture) { 3086 return on.call(this, eventNames, selector, handler, useCapture, 1); 3087}; 3088 3089/** 3090 * Get event handlers from an element 3091 * 3092 * @private 3093 * @param {Node} element 3094 * @return {Array} 3095 */ 3096 3097const eventKeyProp = '__domtastic_event__'; 3098let id = 1; 3099let handlers = {}; 3100let unusedKeys = []; 3101 3102const getHandlers = element => { 3103 if(!element[eventKeyProp]) { 3104 element[eventKeyProp] = unusedKeys.length === 0 ? ++id : unusedKeys.pop(); 3105 } 3106 const key = element[eventKeyProp]; 3107 return handlers[key] || (handlers[key] = []); 3108}; 3109 3110/** 3111 * Clear event handlers for an element 3112 * 3113 * @private 3114 * @param {Node} element 3115 */ 3116 3117const clearHandlers = element => { 3118 const key = element[eventKeyProp]; 3119 if(handlers[key]) { 3120 handlers[key] = null; 3121 element[eventKeyProp] = null; 3122 unusedKeys.push(key); 3123 } 3124}; 3125 3126/** 3127 * Function to create a handler that augments the event object with some extra methods, 3128 * and executes the callback with the event and the event data (i.e. `event.detail`). 3129 * 3130 * @private 3131 * @param handler Callback to execute as `handler(event, data)` 3132 * @return {Function} 3133 */ 3134 3135const proxyHandler = handler => function(event) { 3136 return handler.call(this, augmentEvent(event)); 3137}; 3138 3139const eventMethods = { 3140 preventDefault: 'isDefaultPrevented', 3141 stopImmediatePropagation: 'isImmediatePropagationStopped', 3142 stopPropagation: 'isPropagationStopped' 3143}; 3144const returnTrue = () => true; 3145const returnFalse = () => false; 3146 3147/** 3148 * Attempt to augment events and implement something closer to DOM Level 3 Events. 3149 * 3150 * @private 3151 * @param {Object} event 3152 * @return {Function} 3153 */ 3154 3155const augmentEvent = event => { 3156 if(!event.isDefaultPrevented || event.stopImmediatePropagation || event.stopPropagation) { 3157 for(const methodName in eventMethods) { 3158 (function(methodName, testMethodName, originalMethod) { 3159 event[methodName] = function() { 3160 this[testMethodName] = returnTrue; 3161 return originalMethod && originalMethod.apply(this, arguments); 3162 }; 3163 event[testMethodName] = returnFalse; 3164 }(methodName, eventMethods[methodName], event[methodName])); 3165 } 3166 if(event._preventDefault) { 3167 event.preventDefault(); 3168 } 3169 } 3170 return event; 3171}; 3172 3173/** 3174 * Function to test whether delegated events match the provided `selector` (filter), 3175 * if the event propagation was stopped, and then actually call the provided event handler. 3176 * Use `this` instead of `event.currentTarget` on the event object. 3177 * 3178 * @private 3179 * @param {String} selector Selector to filter descendants that undelegate the event to this element. 3180 * @param {Function} handler Event handler 3181 * @param {Event} event 3182 */ 3183 3184const delegateHandler = function(selector, handler, event) { 3185 const eventTarget = event._target || event.target; 3186 const currentTarget = _selector_closest__WEBPACK_IMPORTED_MODULE_1__["closest"].call([eventTarget], selector, this)[0]; 3187 if(currentTarget && currentTarget !== this) { 3188 if(currentTarget === eventTarget || !(event.isPropagationStopped && event.isPropagationStopped())) { 3189 handler.call(currentTarget, event); 3190 } 3191 } 3192}; 3193 3194const bind = on; 3195const unbind = off; 3196 3197 3198/***/ }), 3199
vendor: 1,058 bytes, lines 3200-3235
3200/***/ "./node_modules/domtastic/src/event/ready.js": 3201/*!***************************************************!*\ 3202 !*** ./node_modules/domtastic/src/event/ready.js ***! 3203 \***************************************************/ 3204/*! exports provided: ready */ 3205/***/ (function(module, __webpack_exports__, __webpack_require__) { 3206 3207"use strict"; 3208__webpack_require__.r(__webpack_exports__); 3209/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ready", function() { return ready; }); 3210/** 3211 * @module Ready 3212 */ 3213 3214/** 3215 * Execute callback when `DOMContentLoaded` fires for `document`, or immediately if called afterwards. 3216 * 3217 * @param handler Callback to execute when initial DOM content is loaded. 3218 * @return {Object} The wrapped collection 3219 * @chainable 3220 * @example 3221 * $(document).ready(callback); 3222 */ 3223 3224const ready = function(handler) { 3225 if(/complete|loaded|interactive/.test(document.readyState) && document.body) { 3226 handler(); 3227 } else { 3228 document.addEventListener('DOMContentLoaded', handler, false); 3229 } 3230 return this; 3231}; 3232 3233 3234/***/ }), 3235
vendor: 6,472 bytes, lines 3236-3433
3236/***/ "./node_modules/domtastic/src/event/trigger.js": 3237/*!*****************************************************!*\ 3238 !*** ./node_modules/domtastic/src/event/trigger.js ***! 3239 \*****************************************************/ 3240/*! exports provided: trigger, triggerHandler */ 3241/***/ (function(module, __webpack_exports__, __webpack_require__) { 3242 3243"use strict"; 3244__webpack_require__.r(__webpack_exports__); 3245/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trigger", function() { return trigger; }); 3246/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "triggerHandler", function() { return triggerHandler; }); 3247/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 3248/* harmony import */ var _dom_contains__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom/contains */ "./node_modules/domtastic/src/dom/contains.js"); 3249/** 3250 * @module trigger 3251 */ 3252 3253 3254 3255 3256const reMouseEvent = /^(mouse(down|up|over|out|enter|leave|move)|contextmenu|(dbl)?click)$/; 3257const reKeyEvent = /^key(down|press|up)$/; 3258 3259/** 3260 * Trigger event at element(s) 3261 * 3262 * @param {String} type Type of the event 3263 * @param {Object} data Data to be sent with the event (`params.detail` will be set to this). 3264 * @param {Object} [params] Event parameters (optional) 3265 * @param {Boolean} params.bubbles=true Does the event bubble up through the DOM or not. 3266 * @param {Boolean} params.cancelable=true Is the event cancelable or not. 3267 * @param {Mixed} params.detail=undefined Additional information about the event. 3268 * @return {Object} The wrapped collection 3269 * @chainable 3270 * @example 3271 * $('.item').trigger('anyEventType'); 3272 */ 3273 3274const trigger = function(type, data, {bubbles = true, cancelable = true, preventDefault = false} = {}) { 3275 3276 const EventConstructor = getEventConstructor(type); 3277 const event = new EventConstructor(type, { 3278 bubbles, 3279 cancelable, 3280 preventDefault, 3281 detail: data 3282 }); 3283 3284 event._preventDefault = preventDefault; 3285 3286 return Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 3287 if(!bubbles || isEventBubblingInDetachedTree || isAttachedToDocument(element)) { 3288 dispatchEvent(element, event); 3289 } else { 3290 triggerForPath(element, type, { 3291 bubbles, 3292 cancelable, 3293 preventDefault, 3294 detail: data 3295 }); 3296 } 3297 }); 3298}; 3299 3300const getEventConstructor = type => isSupportsOtherEventConstructors ? (reMouseEvent.test(type) ? MouseEvent : (reKeyEvent.test(type) ? KeyboardEvent : CustomEvent)) : CustomEvent; 3301 3302/** 3303 * Trigger event at first element in the collection. Similar to `trigger()`, except: 3304 * 3305 * - Event does not bubble 3306 * - Default event behavior is prevented 3307 * - Only triggers handler for first matching element 3308 * 3309 * @param {String} type Type of the event 3310 * @param {Object} data Data to be sent with the event 3311 * @example 3312 * $('form').triggerHandler('submit'); 3313 */ 3314 3315const triggerHandler = function(type, data) { 3316 if(this[0]) { 3317 trigger.call(this[0], type, data, { 3318 bubbles: false, 3319 preventDefault: true 3320 }); 3321 } 3322}; 3323 3324/** 3325 * Check whether the element is attached to or detached from) the document 3326 * 3327 * @private 3328 * @param {Node} element Element to test 3329 * @return {Boolean} 3330 */ 3331 3332const isAttachedToDocument = element => { 3333 if(element === window || element === document) { 3334 return true; 3335 } 3336 return Object(_dom_contains__WEBPACK_IMPORTED_MODULE_1__["contains"])(element.ownerDocument.documentElement, element); 3337}; 3338 3339/** 3340 * Dispatch the event at the element and its ancestors. 3341 * Required to support delegated events in browsers that don't bubble events in detached DOM trees. 3342 * 3343 * @private 3344 * @param {Node} element First element to dispatch the event at 3345 * @param {String} type Type of the event 3346 * @param {Object} [params] Event parameters (optional) 3347 * @param {Boolean} params.bubbles=true Does the event bubble up through the DOM or not. 3348 * Will be set to false (but shouldn't matter since events don't bubble anyway). 3349 * @param {Boolean} params.cancelable=true Is the event cancelable or not. 3350 * @param {Mixed} params.detail=undefined Additional information about the event. 3351 */ 3352 3353const triggerForPath = (element, type, params = {}) => { 3354 params.bubbles = false; 3355 const event = new CustomEvent(type, params); 3356 event._target = element; 3357 do { 3358 dispatchEvent(element, event); 3359 } while(element = element.parentNode); // eslint-disable-line no-cond-assign 3360}; 3361 3362/** 3363 * Dispatch event to element, but call direct event methods instead if available 3364 * (e.g. "blur()", "submit()") and if the event is non-cancelable. 3365 * 3366 * @private 3367 * @param {Node} element Element to dispatch the event at 3368 * @param {Object} event Event to dispatch 3369 */ 3370 3371const directEventMethods = ['blur', 'focus', 'select', 'submit']; 3372 3373const dispatchEvent = (element, event) => { 3374 if(directEventMethods.indexOf(event.type) !== -1 && typeof element[event.type] === 'function' && !event._preventDefault && !event.cancelable) { 3375 element[event.type](); 3376 } else { 3377 element.dispatchEvent(event); 3378 } 3379}; 3380 3381/** 3382 * Polyfill for CustomEvent, borrowed from [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill). 3383 * Needed to support IE (9, 10, 11) & PhantomJS 3384 */ 3385 3386(() => { 3387 const CustomEvent = function(event, params = { 3388 bubbles: false, 3389 cancelable: false, 3390 detail: undefined 3391 }) { 3392 let customEvent = document.createEvent('CustomEvent'); 3393 customEvent.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 3394 return customEvent; 3395 }; 3396 3397 CustomEvent.prototype = _util__WEBPACK_IMPORTED_MODULE_0__["win"].CustomEvent && _util__WEBPACK_IMPORTED_MODULE_0__["win"].CustomEvent.prototype; 3398 _util__WEBPACK_IMPORTED_MODULE_0__["win"].CustomEvent = CustomEvent; 3399 3400})(); 3401 3402/* 3403 * Are events bubbling in detached DOM trees? 3404 * @private 3405 */ 3406 3407const isEventBubblingInDetachedTree = (() =>{ 3408 let isBubbling = false; 3409 const doc = _util__WEBPACK_IMPORTED_MODULE_0__["win"].document; 3410 if(doc) { 3411 const parent = doc.createElement('div'); 3412 const child = parent.cloneNode(); 3413 parent.appendChild(child); 3414 parent.addEventListener('e', function() { 3415 isBubbling = true; 3416 }); 3417 child.dispatchEvent(new CustomEvent('e', {bubbles: true})); 3418 } 3419 return isBubbling; 3420})(); 3421 3422const isSupportsOtherEventConstructors = (() => { 3423 try { 3424 new MouseEvent('click'); 3425 } catch(e) { 3426 return false; 3427 } 3428 return true; 3429})(); 3430 3431 3432/***/ }), 3433
vendor: 4,874 bytes, lines 3434-3523
3434/***/ "./node_modules/domtastic/src/index.js": 3435/*!*********************************************!*\ 3436 !*** ./node_modules/domtastic/src/index.js ***! 3437 \*********************************************/ 3438/*! exports provided: default */ 3439/***/ (function(module, __webpack_exports__, __webpack_require__) { 3440 3441"use strict"; 3442__webpack_require__.r(__webpack_exports__); 3443/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./node_modules/domtastic/src/util.js"); 3444/* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array */ "./node_modules/domtastic/src/array.js"); 3445/* harmony import */ var _baseClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./baseClass */ "./node_modules/domtastic/src/baseClass.js"); 3446/* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./css */ "./node_modules/domtastic/src/css.js"); 3447/* harmony import */ var _dom_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dom/index */ "./node_modules/domtastic/src/dom/index.js"); 3448/* harmony import */ var _dom_attr__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dom/attr */ "./node_modules/domtastic/src/dom/attr.js"); 3449/* harmony import */ var _dom_class__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dom/class */ "./node_modules/domtastic/src/dom/class.js"); 3450/* harmony import */ var _dom_contains__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dom/contains */ "./node_modules/domtastic/src/dom/contains.js"); 3451/* harmony import */ var _dom_data__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom/data */ "./node_modules/domtastic/src/dom/data.js"); 3452/* harmony import */ var _dom_extra__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./dom/extra */ "./node_modules/domtastic/src/dom/extra.js"); 3453/* harmony import */ var _dom_html__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./dom/html */ "./node_modules/domtastic/src/dom/html.js"); 3454/* harmony import */ var _event_index__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./event/index */ "./node_modules/domtastic/src/event/index.js"); 3455/* harmony import */ var _event_trigger__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./event/trigger */ "./node_modules/domtastic/src/event/trigger.js"); 3456/* harmony import */ var _event_ready__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./event/ready */ "./node_modules/domtastic/src/event/ready.js"); 3457/* harmony import */ var _noconflict__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./noconflict */ "./node_modules/domtastic/src/noconflict.js"); 3458/* harmony import */ var _selector_index__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./selector/index */ "./node_modules/domtastic/src/selector/index.js"); 3459/* harmony import */ var _selector_closest__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./selector/closest */ "./node_modules/domtastic/src/selector/closest.js"); 3460/* harmony import */ var _selector_extra__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./selector/extra */ "./node_modules/domtastic/src/selector/extra.js"); 3461/* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./type */ "./node_modules/domtastic/src/type.js"); 3462/** 3463 * @module API 3464 */ 3465 3466 3467 3468const api = {}; 3469let $ = {}; 3470 3471// Import modules to build up the API 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492if(typeof _selector_index__WEBPACK_IMPORTED_MODULE_15__ !== 'undefined') { 3493 $ = _selector_index__WEBPACK_IMPORTED_MODULE_15__["$"]; 3494 $.matches = _selector_index__WEBPACK_IMPORTED_MODULE_15__["matches"]; 3495 api.find = _selector_index__WEBPACK_IMPORTED_MODULE_15__["find"]; 3496} 3497 3498Object(_util__WEBPACK_IMPORTED_MODULE_0__["extend"])($, _dom_contains__WEBPACK_IMPORTED_MODULE_7__, _noconflict__WEBPACK_IMPORTED_MODULE_14__, _type__WEBPACK_IMPORTED_MODULE_18__); 3499Object(_util__WEBPACK_IMPORTED_MODULE_0__["extend"])(api, _array__WEBPACK_IMPORTED_MODULE_1__, _css__WEBPACK_IMPORTED_MODULE_3__, _dom_attr__WEBPACK_IMPORTED_MODULE_5__, _dom_index__WEBPACK_IMPORTED_MODULE_4__, _dom_class__WEBPACK_IMPORTED_MODULE_6__, _dom_data__WEBPACK_IMPORTED_MODULE_8__, _dom_extra__WEBPACK_IMPORTED_MODULE_9__, _dom_html__WEBPACK_IMPORTED_MODULE_10__, _event_index__WEBPACK_IMPORTED_MODULE_11__, _event_trigger__WEBPACK_IMPORTED_MODULE_12__, _event_ready__WEBPACK_IMPORTED_MODULE_13__, _selector_closest__WEBPACK_IMPORTED_MODULE_16__, _selector_extra__WEBPACK_IMPORTED_MODULE_17__); 3500 3501$.fn = api; 3502 3503// Version 3504 3505$.version = '__VERSION__'; 3506 3507// Util 3508 3509$.extend = _util__WEBPACK_IMPORTED_MODULE_0__["extend"]; 3510 3511// Provide base class to extend from 3512 3513if(typeof _baseClass__WEBPACK_IMPORTED_MODULE_2__["default"] !== 'undefined') { 3514 $.BaseClass = Object(_baseClass__WEBPACK_IMPORTED_MODULE_2__["default"])($.fn); 3515} 3516 3517// Export interface 3518 3519/* harmony default export */ __webpack_exports__["default"] = ($); 3520 3521 3522/***/ }), 3523
vendor: 1,239 bytes, lines 3524-3564
3524/***/ "./node_modules/domtastic/src/noconflict.js": 3525/*!**************************************************!*\ 3526 !*** ./node_modules/domtastic/src/noconflict.js ***! 3527 \**************************************************/ 3528/*! exports provided: noConflict */ 3529/***/ (function(module, __webpack_exports__, __webpack_require__) { 3530 3531"use strict"; 3532__webpack_require__.r(__webpack_exports__); 3533/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noConflict", function() { return noConflict; }); 3534/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./node_modules/domtastic/src/util.js"); 3535/** 3536 * @module noConflict 3537 */ 3538 3539 3540 3541/* 3542 * Save the previous value of the global `$` variable, so that it can be restored later on. 3543 * @private 3544 */ 3545 3546const previousLib = _util__WEBPACK_IMPORTED_MODULE_0__["win"].$; 3547 3548/** 3549 * In case another library sets the global `$` variable before DOMtastic does, 3550 * this method can be used to return the global `$` to that other library. 3551 * 3552 * @return {Object} Reference to DOMtastic. 3553 * @example 3554 * var domtastic = $.noConflict(); 3555 */ 3556 3557const noConflict = function() { 3558 _util__WEBPACK_IMPORTED_MODULE_0__["win"].$ = previousLib; 3559 return this; 3560}; 3561 3562 3563/***/ }), 3564
vendor: 2,311 bytes, lines 3565-3629
3565/***/ "./node_modules/domtastic/src/selector/closest.js": 3566/*!********************************************************!*\ 3567 !*** ./node_modules/domtastic/src/selector/closest.js ***! 3568 \********************************************************/ 3569/*! exports provided: closest */ 3570/***/ (function(module, __webpack_exports__, __webpack_require__) { 3571 3572"use strict"; 3573__webpack_require__.r(__webpack_exports__); 3574/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closest", function() { return closest; }); 3575/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ "./node_modules/domtastic/src/selector/index.js"); 3576/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 3577/** 3578 * @module closest 3579 */ 3580 3581 3582 3583 3584/** 3585 * Return the closest element matching the selector (starting by itself) for each element in the collection. 3586 * 3587 * @param {String} selector Filter 3588 * @param {Object} [context] If provided, matching elements must be a descendant of this element 3589 * @return {Object} New wrapped collection (containing zero or one element) 3590 * @chainable 3591 * @example 3592 * $('.selector').closest('.container'); 3593 */ 3594 3595const closest = (() => { 3596 3597 const closest = function(selector, context) { 3598 const nodes = []; 3599 Object(_util__WEBPACK_IMPORTED_MODULE_1__["each"])(this, node => { 3600 while(node && node !== context) { 3601 if(Object(_index__WEBPACK_IMPORTED_MODULE_0__["matches"])(node, selector)) { 3602 nodes.push(node); 3603 break; 3604 } 3605 node = node.parentElement; 3606 } 3607 }); 3608 return Object(_index__WEBPACK_IMPORTED_MODULE_0__["$"])(Object(_util__WEBPACK_IMPORTED_MODULE_1__["uniq"])(nodes)); 3609 }; 3610 3611 return typeof Element === 'undefined' || !Element.prototype.closest ? closest : function(selector, context) { 3612 if(!context) { 3613 const nodes = []; 3614 Object(_util__WEBPACK_IMPORTED_MODULE_1__["each"])(this, node => { 3615 const n = node.closest(selector); 3616 if(n) { 3617 nodes.push(n); 3618 } 3619 }); 3620 return Object(_index__WEBPACK_IMPORTED_MODULE_0__["$"])(Object(_util__WEBPACK_IMPORTED_MODULE_1__["uniq"])(nodes)); 3621 } else { 3622 return closest.call(this, selector, context); 3623 } 3624 }; 3625})(); 3626 3627 3628/***/ }), 3629
vendor: 6,571 bytes, lines 3630-3818
3630/***/ "./node_modules/domtastic/src/selector/extra.js": 3631/*!******************************************************!*\ 3632 !*** ./node_modules/domtastic/src/selector/extra.js ***! 3633 \******************************************************/ 3634/*! exports provided: children, concat, contents, eq, first, get, parent, siblings, slice */ 3635/***/ (function(module, __webpack_exports__, __webpack_require__) { 3636 3637"use strict"; 3638__webpack_require__.r(__webpack_exports__); 3639/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "children", function() { return children; }); 3640/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return concat; }); 3641/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "contents", function() { return contents; }); 3642/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "eq", function() { return eq; }); 3643/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; }); 3644/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; }); 3645/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parent", function() { return parent; }); 3646/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "siblings", function() { return siblings; }); 3647/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "slice", function() { return slice; }); 3648/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 3649/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index */ "./node_modules/domtastic/src/selector/index.js"); 3650/** 3651 * @module Selector (extra) 3652 */ 3653 3654 3655 3656 3657/** 3658 * Return children of each element in the collection, optionally filtered by a selector. 3659 * 3660 * @param {String} [selector] Filter 3661 * @return {Object} New wrapped collection 3662 * @chainable 3663 * @example 3664 * $('.selector').children(); 3665 * $('.selector').children('.filter'); 3666 */ 3667 3668const children = function(selector) { 3669 const nodes = []; 3670 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 3671 if(element.children) { 3672 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(element.children, child => { 3673 if(!selector || (selector && Object(_index__WEBPACK_IMPORTED_MODULE_1__["matches"])(child, selector))) { 3674 nodes.push(child); 3675 } 3676 }); 3677 } 3678 }); 3679 return Object(_index__WEBPACK_IMPORTED_MODULE_1__["$"])(nodes); 3680}; 3681 3682/** 3683 * Add the elements of a wrapped collection to another. 3684 * 3685 * @param {String|Node|NodeList|Array} selector Query selector, `Node`, `NodeList`, array of elements, or HTML fragment string. 3686 * @return {Object} The extended wrapped collection 3687 * @example 3688 * $('.items').concat($('.more-items)); 3689 * $('.items').concat('.more-items); 3690 * $('.items').concat('<div>more</div>'); 3691 */ 3692 3693const concat = function(selector) { 3694 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(Object(_index__WEBPACK_IMPORTED_MODULE_1__["$"])(selector), element => { 3695 if([].indexOf.call(this, element) === -1) { 3696 [].push.call(this, element); 3697 } 3698 }); 3699 return this; 3700}; 3701 3702/** 3703 * Return child nodes of each element in the collection, including text and comment nodes. 3704 * 3705 * @return {Object} New wrapped collection 3706 * @example 3707 * $('.selector').contents(); 3708 */ 3709 3710const contents = function() { 3711 const nodes = []; 3712 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => nodes.push.apply(nodes, Object(_util__WEBPACK_IMPORTED_MODULE_0__["toArray"])(element.childNodes))); 3713 return Object(_index__WEBPACK_IMPORTED_MODULE_1__["$"])(nodes); 3714}; 3715 3716/** 3717 * Return a collection containing only the one at the specified index. 3718 * 3719 * @param {Number} index 3720 * @return {Object} New wrapped collection 3721 * @chainable 3722 * @example 3723 * $('.items').eq(1) 3724 * // The second item; result is the same as doing $($('.items')[1]); 3725 */ 3726 3727const eq = function(index) { 3728 return slice.call(this, index, index + 1); 3729}; 3730 3731/** 3732 * Return a collection containing only the first item. 3733 * 3734 * @return {Object} New wrapped collection 3735 * @chainable 3736 * @example 3737 * $('.items').first() 3738 * // The first item; result is the same as doing $($('.items')[0]); 3739 */ 3740 3741const first = function() { 3742 return slice.call(this, 0, 1); 3743}; 3744 3745/** 3746 * Return the DOM element at the specified index. 3747 * 3748 * @param {Number} index 3749 * @return {Node} Element at the specified index 3750 * @example 3751 * $('.items').get(1) 3752 * // The second element; result is the same as doing $('.items')[1]; 3753 */ 3754 3755const get = function(index) { 3756 return this[index]; 3757}; 3758 3759/** 3760 * Return the parent elements of each element in the collection, optionally filtered by a selector. 3761 * 3762 * @param {String} [selector] Filter 3763 * @return {Object} New wrapped collection 3764 * @chainable 3765 * @example 3766 * $('.selector').parent(); 3767 * $('.selector').parent('.filter'); 3768 */ 3769 3770const parent = function(selector) { 3771 const nodes = []; 3772 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => { 3773 if(!selector || (selector && Object(_index__WEBPACK_IMPORTED_MODULE_1__["matches"])(element.parentNode, selector))) { 3774 nodes.push(element.parentNode); 3775 } 3776 }); 3777 return Object(_index__WEBPACK_IMPORTED_MODULE_1__["$"])(nodes); 3778}; 3779 3780/** 3781 * Return the sibling elements of each element in the collection, optionally filtered by a selector. 3782 * 3783 * @param {String} [selector] Filter 3784 * @return {Object} New wrapped collection 3785 * @chainable 3786 * @example 3787 * $('.selector').siblings(); 3788 * $('.selector').siblings('.filter'); 3789 */ 3790 3791const siblings = function(selector) { 3792 const nodes = []; 3793 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, element => Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(element.parentNode.children, sibling => { 3794 if(sibling !== element && (!selector || (selector && Object(_index__WEBPACK_IMPORTED_MODULE_1__["matches"])(sibling, selector)))) { 3795 nodes.push(sibling); 3796 } 3797 })); 3798 return Object(_index__WEBPACK_IMPORTED_MODULE_1__["$"])(nodes); 3799}; 3800 3801/** 3802 * Create a new, sliced collection. 3803 * 3804 * @param {Number} start 3805 * @param {Number} end 3806 * @return {Object} New wrapped collection 3807 * @example 3808 * $('.items').slice(1, 3) 3809 * // New wrapped collection containing the second, third, and fourth element. 3810 */ 3811 3812const slice = function(start, end) { // eslint-disable-line no-unused-vars 3813 return Object(_index__WEBPACK_IMPORTED_MODULE_1__["$"])([].slice.apply(this, arguments)); 3814}; 3815 3816 3817/***/ }), 3818
vendor: 5,920 bytes, lines 3819-4025
3819/***/ "./node_modules/domtastic/src/selector/index.js": 3820/*!******************************************************!*\ 3821 !*** ./node_modules/domtastic/src/selector/index.js ***! 3822 \******************************************************/ 3823/*! exports provided: $, find, matches, DOMtastic */ 3824/***/ (function(module, __webpack_exports__, __webpack_require__) { 3825 3826"use strict"; 3827__webpack_require__.r(__webpack_exports__); 3828/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$", function() { return $; }); 3829/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return find; }); 3830/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return matches; }); 3831/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMtastic", function() { return DOMtastic; }); 3832/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./node_modules/domtastic/src/util.js"); 3833/** 3834 * @module Selector 3835 */ 3836 3837 3838 3839let isPrototypeSet = false; 3840 3841const reFragment = /^\s*<(\w+|!)[^>]*>/; 3842const reSingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/; 3843const reSimpleSelector = /^[.#]?[\w-]*$/; 3844 3845/* 3846 * Versatile wrapper for `querySelectorAll`. 3847 * 3848 * @param {String|Node|NodeList|Array} selector Query selector, `Node`, `NodeList`, array of elements, or HTML fragment string. 3849 * @param {String|Node|NodeList} context=document The context for the selector to query elements. 3850 * @return {Object} The wrapped collection 3851 * @chainable 3852 * @example 3853 * var $items = $(.items'); 3854 * @example 3855 * var $element = $(domElement); 3856 * @example 3857 * var $list = $(nodeList, document.body); 3858 * @example 3859 * var $element = $('<p>evergreen</p>'); 3860 */ 3861 3862const domtastic = function domtastic(selector, context = document) { 3863 3864 let collection; 3865 3866 if(!selector) { 3867 3868 collection = document.querySelectorAll(null); 3869 3870 } else if(selector instanceof DOMtastic) { 3871 3872 return selector; 3873 3874 } else if(typeof selector !== 'string') { 3875 3876 collection = selector.nodeType || selector === window ? [selector] : selector; 3877 3878 } else if(reFragment.test(selector)) { 3879 3880 collection = createFragment(selector); 3881 3882 } else { 3883 3884 context = typeof context === 'string' ? document.querySelector(context) : context.length ? context[0] : context; 3885 3886 collection = querySelector(selector, context); 3887 3888 } 3889 3890 return wrap(collection); 3891 3892}; 3893 3894const $ = domtastic; 3895 3896/* 3897 * Find descendants matching the provided `selector` for each element in the collection. 3898 * 3899 * @param {String|Node|NodeList|Array} selector Query selector, `Node`, `NodeList`, array of elements, or HTML fragment string. 3900 * @return {Object} The wrapped collection 3901 * @example 3902 * $('.selector').find('.deep').$('.deepest'); 3903 */ 3904 3905const find = function(selector) { 3906 const nodes = []; 3907 Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(this, node => Object(_util__WEBPACK_IMPORTED_MODULE_0__["each"])(querySelector(selector, node), child => { 3908 if(nodes.indexOf(child) === -1) { 3909 nodes.push(child); 3910 } 3911 })); 3912 return $(nodes); 3913}; 3914 3915/* 3916 * Returns `true` if the element would be selected by the specified selector string; otherwise, returns `false`. 3917 * 3918 * @param {Node} element Element to test 3919 * @param {String} selector Selector to match against element 3920 * @return {Boolean} 3921 * 3922 * @example 3923 * $.matches(element, '.match'); 3924 */ 3925 3926const matches = (() => { 3927 const context = typeof Element !== 'undefined' ? Element.prototype : _util__WEBPACK_IMPORTED_MODULE_0__["win"]; 3928 const _matches = context.matches || context.matchesSelector || context.mozMatchesSelector || context.msMatchesSelector || context.oMatchesSelector || context.webkitMatchesSelector; 3929 return (element, selector) => _matches.call(element, selector); 3930})(); 3931 3932/* 3933 * Use the faster `getElementById`, `getElementsByClassName` or `getElementsByTagName` over `querySelectorAll` if possible. 3934 * 3935 * @private 3936 * @param {String} selector Query selector. 3937 * @param {Node} context The context for the selector to query elements. 3938 * @return {Object} NodeList, HTMLCollection, or Array of matching elements (depending on method used). 3939 */ 3940 3941const querySelector = (selector, context) => { 3942 3943 const isSimpleSelector = reSimpleSelector.test(selector); 3944 3945 if(isSimpleSelector) { 3946 if(selector[0] === '#') { 3947 const element = (context.getElementById ? context : document).getElementById(selector.slice(1)); 3948 return element ? [element] : []; 3949 } 3950 if(selector[0] === '.') { 3951 return context.getElementsByClassName(selector.slice(1)); 3952 } 3953 return context.getElementsByTagName(selector); 3954 } 3955 3956 return context.querySelectorAll(selector); 3957 3958}; 3959 3960/* 3961 * Create DOM fragment from an HTML string 3962 * 3963 * @private 3964 * @param {String} html String representing HTML. 3965 * @return {NodeList} 3966 */ 3967 3968const createFragment = html => { 3969 3970 if(reSingleTag.test(html)) { 3971 return [document.createElement(RegExp.$1)]; 3972 } 3973 3974 const elements = []; 3975 const container = document.createElement('div'); 3976 const children = container.childNodes; 3977 3978 container.innerHTML = html; 3979 3980 for(let i = 0, l = children.length; i < l; i++) { 3981 elements.push(children[i]); 3982 } 3983 3984 return elements; 3985}; 3986 3987/* 3988 * Calling `$(selector)` returns a wrapped collection of elements. 3989 * 3990 * @private 3991 * @param {NodeList|Array} collection Element(s) to wrap. 3992 * @return Object) The wrapped collection 3993 */ 3994 3995const wrap = collection => { 3996 3997 if(!isPrototypeSet) { 3998 DOMtastic.prototype = $.fn; 3999 DOMtastic.prototype.constructor = DOMtastic; 4000 isPrototypeSet = true; 4001 } 4002 4003 return new DOMtastic(collection); 4004}; 4005 4006/* 4007 * Constructor for the Object.prototype strategy 4008 * 4009 * @constructor 4010 * @private 4011 * @param {NodeList|Array} collection Element(s) to wrap. 4012 */ 4013 4014const DOMtastic = function DOMtastic(collection) { 4015 let i = 0; 4016 const length = collection.length; 4017 for(; i < length;) { 4018 this[i] = collection[i++]; 4019 } 4020 this.length = length; 4021}; 4022 4023 4024/***/ }), 4025
vendor: 1,242 bytes, lines 4026-4069
4026/***/ "./node_modules/domtastic/src/type.js": 4027/*!********************************************!*\ 4028 !*** ./node_modules/domtastic/src/type.js ***! 4029 \********************************************/ 4030/*! exports provided: isFunction, isArray */ 4031/***/ (function(module, __webpack_exports__, __webpack_require__) { 4032 4033"use strict"; 4034__webpack_require__.r(__webpack_exports__); 4035/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return isFunction; }); 4036/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return isArray; }); 4037/** 4038 * @module Type 4039 */ 4040 4041/* 4042 * Determine if the argument passed is a Javascript function object. 4043 * 4044 * @param {Object} [obj] Object to test whether or not it is a function. 4045 * @return {boolean} 4046 * @example 4047 * $.isFunction(function(){}); // true 4048 * @example 4049 * $.isFunction({}); // false 4050 */ 4051 4052const isFunction = obj => typeof obj === 'function'; 4053 4054/* 4055 * Determine whether the argument is an array. 4056 * 4057 * @param {Object} [obj] Object to test whether or not it is an array. 4058 * @return {boolean} 4059 * @example 4060 * $.isArray([]); // true 4061 * @example 4062 * $.isArray({}); // false 4063 */ 4064 4065const isArray = Array.isArray; 4066 4067 4068/***/ }), 4069
vendor: 2,710 bytes, lines 4070-4167
4070/***/ "./node_modules/domtastic/src/util.js": 4071/*!********************************************!*\ 4072 !*** ./node_modules/domtastic/src/util.js ***! 4073 \********************************************/ 4074/*! exports provided: win, toArray, each, extend, uniq */ 4075/***/ (function(module, __webpack_exports__, __webpack_require__) { 4076 4077"use strict"; 4078__webpack_require__.r(__webpack_exports__); 4079/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "win", function() { return win; }); 4080/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return toArray; }); 4081/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return each; }); 4082/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; }); 4083/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return uniq; }); 4084/* 4085 * @module Util 4086 */ 4087 4088/* 4089 * Reference to the window object 4090 * @private 4091 */ 4092 4093const win = typeof window !== 'undefined' ? window : {}; 4094 4095/** 4096 * Convert `NodeList` to `Array`. 4097 * 4098 * @param {NodeList|Array} collection 4099 * @return {Array} 4100 * @private 4101 */ 4102 4103const toArray = collection => { 4104 const length = collection.length; 4105 const result = new Array(length); 4106 for(let i = 0; i < length; i++) { 4107 result[i] = collection[i]; 4108 } 4109 return result; 4110}; 4111 4112/** 4113 * Faster alternative to [].forEach method 4114 * 4115 * @param {Node|NodeList|Array} collection 4116 * @param {Function} callback 4117 * @return {Node|NodeList|Array} 4118 * @private 4119 */ 4120 4121const each = (collection, callback, thisArg) => { 4122 const length = collection.length; 4123 if(length !== undefined && collection.nodeType === undefined) { 4124 for(let i = 0; i < length; i++) { 4125 callback.call(thisArg, collection[i], i, collection); 4126 } 4127 } else { 4128 callback.call(thisArg, collection, 0, collection); 4129 } 4130 return collection; 4131}; 4132 4133/** 4134 * Assign enumerable properties from source object(s) to target object 4135 * 4136 * @method extend 4137 * @param {Object} target Object to extend 4138 * @param {Object} [source] Object to extend from 4139 * @return {Object} Extended object 4140 * @example 4141 * $.extend({a: 1}, {b: 2}); // {a: 1, b: 2} 4142 * @example 4143 * $.extend({a: 1}, {b: 2}, {a: 3}); // {a: 3, b: 2} 4144 */ 4145 4146const extend = (target, ...sources) => { 4147 sources.forEach(src => { 4148 for(let prop in src) { 4149 target[prop] = src[prop]; 4150 } 4151 }); 4152 return target; 4153}; 4154 4155/** 4156 * Return the collection without duplicates 4157 * 4158 * @param collection Collection to remove duplicates from 4159 * @return {Node|NodeList|Array} 4160 * @private 4161 */ 4162 4163const uniq = collection => collection.filter((item, index) => collection.indexOf(item) === index); 4164 4165 4166/***/ }), 4167
vendor: 12,980 bytes, lines 4168-4498
4168/***/ "./node_modules/js-base64/base64.mjs": 4169/*!*******************************************!*\ 4170 !*** ./node_modules/js-base64/base64.mjs ***! 4171 \*******************************************/ 4172/*! exports provided: version, VERSION, atob, atobPolyfill, btoa, btoaPolyfill, fromBase64, toBase64, utob, encode, encodeURI, encodeURL, btou, decode, isValid, fromUint8Array, toUint8Array, extendString, extendUint8Array, extendBuiltins, Base64 */ 4173/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { 4174 4175"use strict"; 4176__webpack_require__.r(__webpack_exports__); 4177/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); 4178/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); 4179/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "atob", function() { return _atob; }); 4180/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "atobPolyfill", function() { return atobPolyfill; }); 4181/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "btoa", function() { return _btoa; }); 4182/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "btoaPolyfill", function() { return btoaPolyfill; }); 4183/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromBase64", function() { return decode; }); 4184/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toBase64", function() { return encode; }); 4185/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "utob", function() { return utob; }); 4186/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encode", function() { return encode; }); 4187/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeURI", function() { return encodeURI; }); 4188/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeURL", function() { return encodeURI; }); 4189/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "btou", function() { return btou; }); 4190/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decode", function() { return decode; }); 4191/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValid", function() { return isValid; }); 4192/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromUint8Array", function() { return fromUint8Array; }); 4193/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUint8Array", function() { return toUint8Array; }); 4194/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendString", function() { return extendString; }); 4195/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendUint8Array", function() { return extendUint8Array; }); 4196/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendBuiltins", function() { return extendBuiltins; }); 4197/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Base64", function() { return gBase64; }); 4198/** 4199 * base64.ts 4200 * 4201 * Licensed under the BSD 3-Clause License. 4202 * http://opensource.org/licenses/BSD-3-Clause 4203 * 4204 * References: 4205 * http://en.wikipedia.org/wiki/Base64 4206 * 4207 * @author Dan Kogai (https://github.com/dankogai) 4208 */ 4209const version = '3.6.0'; 4210/** 4211 * @deprecated use lowercase `version`. 4212 */ 4213const VERSION = version; 4214const _hasatob = typeof atob === 'function'; 4215const _hasbtoa = typeof btoa === 'function'; 4216const _hasBuffer = typeof Buffer === 'function'; 4217const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined; 4218const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined; 4219const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 4220const b64chs = [...b64ch]; 4221const b64tab = ((a) => { 4222 let tab = {}; 4223 a.forEach((c, i) => tab[c] = i); 4224 return tab; 4225})(b64chs); 4226const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; 4227const _fromCC = String.fromCharCode.bind(String); 4228const _U8Afrom = typeof Uint8Array.from === 'function' 4229 ? Uint8Array.from.bind(Uint8Array) 4230 : (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn)); 4231const _mkUriSafe = (src) => src 4232 .replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_') 4233 .replace(/=+$/m, ''); 4234const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, ''); 4235/** 4236 * polyfill version of `btoa` 4237 */ 4238const btoaPolyfill = (bin) => { 4239 // console.log('polyfilled'); 4240 let u32, c0, c1, c2, asc = ''; 4241 const pad = bin.length % 3; 4242 for (let i = 0; i < bin.length;) { 4243 if ((c0 = bin.charCodeAt(i++)) > 255 || 4244 (c1 = bin.charCodeAt(i++)) > 255 || 4245 (c2 = bin.charCodeAt(i++)) > 255) 4246 throw new TypeError('invalid character found'); 4247 u32 = (c0 << 16) | (c1 << 8) | c2; 4248 asc += b64chs[u32 >> 18 & 63] 4249 + b64chs[u32 >> 12 & 63] 4250 + b64chs[u32 >> 6 & 63] 4251 + b64chs[u32 & 63]; 4252 } 4253 return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc; 4254}; 4255/** 4256 * does what `window.btoa` of web browsers do. 4257 * @param {String} bin binary string 4258 * @returns {string} Base64-encoded string 4259 */ 4260const _btoa = _hasbtoa ? (bin) => btoa(bin) 4261 : _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64') 4262 : btoaPolyfill; 4263const _fromUint8Array = _hasBuffer 4264 ? (u8a) => Buffer.from(u8a).toString('base64') 4265 : (u8a) => { 4266 // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326 4267 const maxargs = 0x1000; 4268 let strs = []; 4269 for (let i = 0, l = u8a.length; i < l; i += maxargs) { 4270 strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); 4271 } 4272 return _btoa(strs.join('')); 4273 }; 4274/** 4275 * converts a Uint8Array to a Base64 string. 4276 * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5 4277 * @returns {string} Base64 string 4278 */ 4279const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); 4280// This trick is found broken https://github.com/dankogai/js-base64/issues/130 4281// const utob = (src: string) => unescape(encodeURIComponent(src)); 4282// reverting good old fationed regexp 4283const cb_utob = (c) => { 4284 if (c.length < 2) { 4285 var cc = c.charCodeAt(0); 4286 return cc < 0x80 ? c 4287 : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6)) 4288 + _fromCC(0x80 | (cc & 0x3f))) 4289 : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f)) 4290 + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) 4291 + _fromCC(0x80 | (cc & 0x3f))); 4292 } 4293 else { 4294 var cc = 0x10000 4295 + (c.charCodeAt(0) - 0xD800) * 0x400 4296 + (c.charCodeAt(1) - 0xDC00); 4297 return (_fromCC(0xf0 | ((cc >>> 18) & 0x07)) 4298 + _fromCC(0x80 | ((cc >>> 12) & 0x3f)) 4299 + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) 4300 + _fromCC(0x80 | (cc & 0x3f))); 4301 } 4302}; 4303const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; 4304/** 4305 * @deprecated should have been internal use only. 4306 * @param {string} src UTF-8 string 4307 * @returns {string} UTF-16 string 4308 */ 4309const utob = (u) => u.replace(re_utob, cb_utob); 4310// 4311const _encode = _hasBuffer 4312 ? (s) => Buffer.from(s, 'utf8').toString('base64') 4313 : _TE 4314 ? (s) => _fromUint8Array(_TE.encode(s)) 4315 : (s) => _btoa(utob(s)); 4316/** 4317 * converts a UTF-8-encoded string to a Base64 string. 4318 * @param {boolean} [urlsafe] if `true` make the result URL-safe 4319 * @returns {string} Base64 string 4320 */ 4321const encode = (src, urlsafe = false) => urlsafe 4322 ? _mkUriSafe(_encode(src)) 4323 : _encode(src); 4324/** 4325 * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5. 4326 * @returns {string} Base64 string 4327 */ 4328const encodeURI = (src) => encode(src, true); 4329// This trick is found broken https://github.com/dankogai/js-base64/issues/130 4330// const btou = (src: string) => decodeURIComponent(escape(src)); 4331// reverting good old fationed regexp 4332const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; 4333const cb_btou = (cccc) => { 4334 switch (cccc.length) { 4335 case 4: 4336 var cp = ((0x07 & cccc.charCodeAt(0)) << 18) 4337 | ((0x3f & cccc.charCodeAt(1)) << 12) 4338 | ((0x3f & cccc.charCodeAt(2)) << 6) 4339 | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000; 4340 return (_fromCC((offset >>> 10) + 0xD800) 4341 + _fromCC((offset & 0x3FF) + 0xDC00)); 4342 case 3: 4343 return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12) 4344 | ((0x3f & cccc.charCodeAt(1)) << 6) 4345 | (0x3f & cccc.charCodeAt(2))); 4346 default: 4347 return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6) 4348 | (0x3f & cccc.charCodeAt(1))); 4349 } 4350}; 4351/** 4352 * @deprecated should have been internal use only. 4353 * @param {string} src UTF-16 string 4354 * @returns {string} UTF-8 string 4355 */ 4356const btou = (b) => b.replace(re_btou, cb_btou); 4357/** 4358 * polyfill version of `atob` 4359 */ 4360const atobPolyfill = (asc) => { 4361 // console.log('polyfilled'); 4362 asc = asc.replace(/\s+/g, ''); 4363 if (!b64re.test(asc)) 4364 throw new TypeError('malformed base64.'); 4365 asc += '=='.slice(2 - (asc.length & 3)); 4366 let u24, bin = '', r1, r2; 4367 for (let i = 0; i < asc.length;) { 4368 u24 = b64tab[asc.charAt(i++)] << 18 4369 | b64tab[asc.charAt(i++)] << 12 4370 | (r1 = b64tab[asc.charAt(i++)]) << 6 4371 | (r2 = b64tab[asc.charAt(i++)]); 4372 bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) 4373 : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) 4374 : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255); 4375 } 4376 return bin; 4377}; 4378/** 4379 * does what `window.atob` of web browsers do. 4380 * @param {String} asc Base64-encoded string 4381 * @returns {string} binary string 4382 */ 4383const _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) 4384 : _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary') 4385 : atobPolyfill; 4386// 4387const _toUint8Array = _hasBuffer 4388 ? (a) => _U8Afrom(Buffer.from(a, 'base64')) 4389 : (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0)); 4390/** 4391 * converts a Base64 string to a Uint8Array. 4392 */ 4393const toUint8Array = (a) => _toUint8Array(_unURI(a)); 4394// 4395const _decode = _hasBuffer 4396 ? (a) => Buffer.from(a, 'base64').toString('utf8') 4397 : _TD 4398 ? (a) => _TD.decode(_toUint8Array(a)) 4399 : (a) => btou(_atob(a)); 4400const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/')); 4401/** 4402 * converts a Base64 string to a UTF-8 string. 4403 * @param {String} src Base64 string. Both normal and URL-safe are supported 4404 * @returns {string} UTF-8 string 4405 */ 4406const decode = (src) => _decode(_unURI(src)); 4407/** 4408 * check if a value is a valid Base64 string 4409 * @param {String} src a value to check 4410 */ 4411const isValid = (src) => { 4412 if (typeof src !== 'string') 4413 return false; 4414 const s = src.replace(/\s+/g, '').replace(/=+$/, ''); 4415 return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s); 4416}; 4417// 4418const _noEnum = (v) => { 4419 return { 4420 value: v, enumerable: false, writable: true, configurable: true 4421 }; 4422}; 4423/** 4424 * extend String.prototype with relevant methods 4425 */ 4426const extendString = function () { 4427 const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body)); 4428 _add('fromBase64', function () { return decode(this); }); 4429 _add('toBase64', function (urlsafe) { return encode(this, urlsafe); }); 4430 _add('toBase64URI', function () { return encode(this, true); }); 4431 _add('toBase64URL', function () { return encode(this, true); }); 4432 _add('toUint8Array', function () { return toUint8Array(this); }); 4433}; 4434/** 4435 * extend Uint8Array.prototype with relevant methods 4436 */ 4437const extendUint8Array = function () { 4438 const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); 4439 _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); }); 4440 _add('toBase64URI', function () { return fromUint8Array(this, true); }); 4441 _add('toBase64URL', function () { return fromUint8Array(this, true); }); 4442}; 4443/** 4444 * extend Builtin prototypes with relevant methods 4445 */ 4446const extendBuiltins = () => { 4447 extendString(); 4448 extendUint8Array(); 4449}; 4450const gBase64 = { 4451 version: version, 4452 VERSION: VERSION, 4453 atob: _atob, 4454 atobPolyfill: atobPolyfill, 4455 btoa: _btoa, 4456 btoaPolyfill: btoaPolyfill, 4457 fromBase64: decode, 4458 toBase64: encode, 4459 encode: encode, 4460 encodeURI: encodeURI, 4461 encodeURL: encodeURI, 4462 utob: utob, 4463 btou: btou, 4464 decode: decode, 4465 isValid: isValid, 4466 fromUint8Array: fromUint8Array, 4467 toUint8Array: toUint8Array, 4468 extendString: extendString, 4469 extendUint8Array: extendUint8Array, 4470 extendBuiltins: extendBuiltins, 4471}; 4472// makecjs:CUT // 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493// and finally, 4494 4495 4496 4497/***/ }), 4498
vendor: 49,632 bytes, lines 4499-6087
4499/***/ "./node_modules/leaflet-openweathermap/leaflet-openweathermap.js": 4500/*!***********************************************************************!*\ 4501 !*** ./node_modules/leaflet-openweathermap/leaflet-openweathermap.js ***! 4502 \***********************************************************************/ 4503/*! no static exports found */ 4504/***/ (function(module, exports) { 4505 4506/** 4507 * A JavaScript library for using OpenWeatherMap's layers and OWM's city data for leaflet based maps without hassle. 4508 * License: CC0 (Creative Commons Zero), see https://creativecommons.org/publicdomain/zero/1.0/ 4509 * Project page: https://github.com/buche/leaflet-openweathermap/ 4510 */ 4511 4512L.OWM = L.TileLayer.extend({ 4513 options: { 4514 appId: 'GET_YOUR_OWN_APPID', /* pass your own AppId as parameter when creating the layer. Get your own AppId at https://www.openweathermap.org/appid */ 4515 baseUrl: "https://{s}.tile.openweathermap.org/map/{layername}/{z}/{x}/{y}.png", 4516 maxZoom: 18, 4517 showLegend: true, 4518 legendImagePath: null, 4519 legendPosition: 'bottomleft', 4520 attribution: 'Weather from <a href="https://openweathermap.org/" alt="World Map and worldwide Weather Forecast online">OpenWeatherMap</a>' 4521 }, 4522 4523 initialize: function (options) { 4524 L.Util.setOptions(this, options); 4525 var tileurl = this.options.baseUrl.replace('{layername}', this._owmLayerName); 4526 tileurl = tileurl + '?appid=' + this.options.appId; 4527 4528 this._map = null; 4529 this._legendControl = null; 4530 this._legendId = null; 4531 this._owmtileurl = tileurl; 4532 L.TileLayer.prototype.initialize.call(this, this._owmtileurl, options); 4533 }, 4534 4535 onAdd: function(map) { 4536 this._map = map; 4537 if (this.options.showLegend && this.options.legendImagePath != null) { 4538 this._legendControl = this._getLegendControl(); 4539 this._legendId = this._legendControl.addLegend(this.options.legendImagePath); 4540 } 4541 L.TileLayer.prototype.onAdd.call(this, map); 4542 }, 4543 4544 onRemove: function(map) { 4545 if (this._legendControl != null) { 4546 this._legendControl.removeLegend(this._legendId); 4547 this._legendControl = null; 4548 this._legendId = null; 4549 } 4550 L.TileLayer.prototype.onRemove.call(this, map); 4551 this._map = null; 4552 }, 4553 4554 _getLegendControl: function() { 4555 if (typeof this._map._owm_legendcontrol == 'undefined' || !this._map._owm_legendcontrol) { 4556 this._map._owm_legendcontrol = new L.OWM.LegendControl({position: this.options.legendPosition}); 4557 this._map.addControl(this._map._owm_legendcontrol); 4558 } 4559 return this._map._owm_legendcontrol; 4560 } 4561}); 4562 4563(function () { 4564 4565 L.OWM.Precipitation = L.OWM.extend({ 4566 _owmLayerName: 'precipitation' 4567 }); 4568 L.OWM.precipitation = function (options) { return new L.OWM.Precipitation(options); }; 4569 4570 L.OWM.PrecipitationClassic = L.OWM.extend({ 4571 _owmLayerName: 'precipitation_cls' 4572 }); 4573 L.OWM.precipitationClassic = function (options) { 4574 var layer = new L.OWM.PrecipitationClassic(options); 4575 if (layer.options.legendImagePath == null) { 4576 layer.options.legendImagePath = 'https://openweathermap.org/img/a/PR.png'; 4577 } 4578 return layer; 4579 }; 4580 4581 L.OWM.Rain = L.OWM.extend({ 4582 _owmLayerName: 'rain' 4583 }); 4584 L.OWM.rain = function (options) { return new L.OWM.Rain(options); }; 4585 4586 L.OWM.RainClassic = L.OWM.extend({ 4587 _owmLayerName: 'rain_cls' 4588 }); 4589 L.OWM.rainClassic = function (options) { 4590 var layer = new L.OWM.RainClassic(options); 4591 if (layer.options.legendImagePath == null) { 4592 layer.options.legendImagePath = 'https://openweathermap.org/img/a/RN.png'; 4593 } 4594 return layer; 4595 }; 4596 4597 L.OWM.Snow = L.OWM.extend({ 4598 _owmLayerName: 'snow' 4599 }); 4600 L.OWM.snow = function (options) { 4601 var layer = new L.OWM.Snow(options); 4602 if (layer.options.legendImagePath == null) { 4603 layer.options.legendImagePath = 'https://openweathermap.org/img/a/SN.png'; 4604 } 4605 return layer; 4606 }; 4607 4608 L.OWM.Clouds = L.OWM.extend({ 4609 _owmLayerName: 'clouds' 4610 }); 4611 L.OWM.clouds = function (options) { return new L.OWM.Clouds(options); }; 4612 4613 L.OWM.CloudsClassic = L.OWM.extend({ 4614 _owmLayerName: 'clouds_cls' 4615 }); 4616 L.OWM.cloudsClassic = function (options) { 4617 var layer = new L.OWM.CloudsClassic(options); 4618 if (layer.options.legendImagePath == null) { 4619 layer.options.legendImagePath = 'https://openweathermap.org/img/a/NT.png'; 4620 } 4621 return layer; 4622 }; 4623 4624 L.OWM.Pressure = L.OWM.extend({ 4625 _owmLayerName: 'pressure' 4626 }); 4627 L.OWM.pressure = function (options) { 4628 var layer = new L.OWM.Pressure(options); 4629 if (layer.options.legendImagePath == null) { 4630 layer.options.legendImagePath = 'https://openweathermap.org/img/a/PN.png'; 4631 } 4632 return layer; 4633 }; 4634 4635 L.OWM.PressureContour = L.OWM.extend({ 4636 _owmLayerName: 'pressure_cntr' 4637 }); 4638 L.OWM.pressureContour = function (options) { return new L.OWM.PressureContour(options); }; 4639 4640 L.OWM.Temperature = L.OWM.extend({ 4641 _owmLayerName: 'temp' 4642 }); 4643 L.OWM.temperature = function (options) { 4644 var layer = new L.OWM.Temperature(options); 4645 if (layer.options.legendImagePath == null) { 4646 layer.options.legendImagePath = 'https://openweathermap.org/img/a/TT.png'; 4647 } 4648 return layer; 4649 }; 4650 4651 L.OWM.Wind = L.OWM.extend({ 4652 _owmLayerName: 'wind' 4653 }); 4654 L.OWM.wind = function (options) { 4655 var layer = new L.OWM.Wind(options); 4656 if (layer.options.legendImagePath == null) { 4657 layer.options.legendImagePath = 'https://openweathermap.org/img/a/UV.png'; 4658 } 4659 return layer; 4660 }; 4661 4662}()); 4663 4664L.OWM.LegendControl = L.Control.extend({ 4665 options: { 4666 position: "bottomleft" 4667 }, 4668 4669 initialize: function(options) { 4670 L.Util.setOptions(this, options); 4671 this._container = L.DomUtil.create('div', 'owm-legend-container'); 4672 this._container.style.display = 'none'; 4673 this._legendCounter = 0; 4674 this._legendContainer = new Array(); 4675 }, 4676 4677 onAdd: function(map) { 4678 return this._container; 4679 }, 4680 4681 addLegend: function(legendImagePath) { 4682 var legendId = this._legendCounter++; 4683 this._legendContainer[legendId] = legendImagePath; 4684 this._redrawLegend(); 4685 this._container.style.display = 'block'; 4686 return legendId; 4687 }, 4688 4689 removeLegend: function(legendId) { 4690 if (typeof this._legendContainer[legendId] != 'undefined') { 4691 delete this._legendContainer[legendId]; 4692 } 4693 // reset counter if no legend is in collection 4694 var containerEmpty = true; 4695 for (var idx in this._legendContainer) { 4696 containerEmpty = false; 4697 break; 4698 } 4699 if (containerEmpty) { 4700 this._legendCounter = 0; 4701 this._container.style.display = 'none'; 4702 } 4703 this._redrawLegend(); 4704 }, 4705 4706 _redrawLegend: function() { 4707 this._container.innerHTML = ''; // clear container 4708 var isLeft = this.options.position.indexOf('left') !== -1; 4709 var cssFloat = isLeft ? 'left' : 'right'; 4710 for (var idx in this._legendContainer) { 4711 if (isNaN(idx)) { 4712 continue; 4713 } 4714 var imgPath = this._legendContainer[idx]; 4715 var item = L.DomUtil.create('div', 'owm-legend-item', this._container); 4716 item.style.cssFloat = cssFloat; 4717 if (isLeft) { 4718 item.style.marginRight = '10px'; 4719 } else { 4720 item.style.marginLeft = '10px'; 4721 } 4722 item.innerHTML = '<img src="' + imgPath + '" border="0" />'; 4723 } 4724 } 4725}); 4726 4727/** 4728 * Layer for current weather of cities. 4729 */ 4730L.OWM.Current = L.Layer.extend({ 4731 4732 options: { 4733 appId: null, // get your free Application ID at www.openweathermap.org 4734 type: 'city', // available types: 'city'. 'station' is not supported any more 4735 lang: 'en', // available: 'en', 'de', 'ru', 'fr', 'nl', 'es', 'ca' (not every language is finished yet) 4736 minZoom: 7, 4737 interval: 0, // interval for rereading city data in minutes 4738 progressControl: true, // available: true, false 4739 imageLoadingUrl: 'owmloading.gif', // URL of loading image relative to HTML document 4740 imageLoadingBgUrl: null, // URL of background image for progress control 4741 temperatureUnit: 'C', // available: 'K' (Kelvin), 'C' (Celsius), 'F' (Fahrenheit) 4742 temperatureDigits: 1, 4743 speedUnit: 'ms', // available: 'ms' (m/s), 'kmh' (km/h), 'mph' (mph) 4744 speedDigits: 0, 4745 popup: true, // available: true, false 4746 keepPopup: true, // available: true, false 4747 showOwmStationLink: true, // available: true, false 4748 showWindSpeed: 'both', // available: 'speed', 'beaufort', 'both' 4749 showWindDirection: 'both', // available: 'deg', 'desc', 'both' 4750 showTimestamp: true, // available: true, false 4751 showTempMinMax: true, // available: true, false 4752 useLocalTime: true, // available: true, false 4753 clusterSize: 150, 4754 imageUrlCity: 'https://openweathermap.org/img/w/{icon}.png', 4755 imageWidth: 50, 4756 imageHeight: 50, 4757 imageUrlStation: 'https://openweathermap.org/img/s/istation.png', 4758 imageWidthStation: 25, 4759 imageHeightStation: 25, 4760 imageUrlPlane: 'https://openweathermap.org/img/s/iplane.png', 4761 imageWidthPlane: 25, 4762 imageHeightPlane: 25, 4763 markerFunction: null, // user defined function for marker creation 4764 popupFunction: null, // user defined function for popup creation 4765 caching: true, // use caching of current weather data 4766 cacheMaxAge: 15, // maximum age of cache content in minutes before it gets invalidated 4767 keepOnMinZoom: false // keep or remove markers when zoom < minZoom 4768 }, 4769 4770 initialize: function(options) { 4771 L.setOptions(this, options); 4772 this._layer = L.layerGroup(); 4773 this._timeoutId = null; 4774 this._requests = {}; 4775 this._markers = new Array(); 4776 this._markedMarker = null; 4777 this._map = null; 4778 this._urlTemplate = 'https://api.openweathermap.org/data/2.5/box/{type}?{appId}cnt=300&format=json&units=metric&bbox={minlon},{minlat},{maxlon},{maxlat},10'; 4779 this._directions = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N']; 4780 this._msbft = [0.3, 1.6, 3.4, 5.5, 8.0, 10.8, 13.9, 17.2, 20.8, 24.5, 28.5, 32.7, 37.0, 41.5, 46.2, 51.0, 56.1, 61.3]; // Beaufort scala 4781 this._tempUnits = { K: 'K', C: '°C', F: 'F'}; 4782 this._progressCtrl = null; 4783 if (this.options.progressControl) { 4784 var bgIcon; 4785 if (this.options.imageLoadingBgUrl) { 4786 bgIcon = this.options.imageLoadingBgUrl; 4787 } else { 4788 bgIcon = this.options.imageUrlCity.replace('{icon}', '10d'); 4789 if (this.options.type != 'city') { 4790 var bgIcon = this.options.imageUrlStation; 4791 } 4792 } 4793 this._progressCtrl = L.OWM.progressControl({ 4794 type: this.options.type 4795 , bgImage: bgIcon 4796 , imageLoadingUrl: this.options.imageLoadingUrl 4797 , owmInstance: this 4798 }); 4799 } 4800 this._cache = L.OWM.currentCache({ maxAge: this.options.cacheMaxAge }); 4801 }, 4802 4803 onAdd: function(map) { 4804 this._map = map; 4805 this._map.addLayer(this._layer); 4806 this._map.on('moveend', this.update, this); 4807 // add progress control 4808 if (this._progressCtrl != null) { 4809 this._map.addControl(this._progressCtrl); 4810 } 4811 this.update(); 4812 }, 4813 4814 onRemove: function(map) { 4815 // clear timeout 4816 if (this._timeoutId !== null) { 4817 window.clearTimeout(this._timeoutId); 4818 this._timeoutId = null; 4819 } 4820 // remove progress control 4821 if (this._progressCtrl != null) { 4822 this._map.removeControl(this._progressCtrl); 4823 } 4824 // remove layer and markers 4825 this._map.off('moveend', this.update, this); 4826 this._map.removeLayer(this._layer); 4827 this._layer.clearLayers(); 4828 this._map = null; 4829 this._cache.clear(); 4830 }, 4831 4832 getAttribution: function() { 4833 return 'Weather from <a href="https://openweathermap.org/" ' 4834 + 'alt="World Map and worldwide Weather Forecast online">OpenWeatherMap</a>'; 4835 }, 4836 4837 update: function() { 4838 // clear existing timeout 4839 if (this._timeoutId) { 4840 window.clearTimeout(this._timeoutId); 4841 this._timeoutId = null; 4842 } 4843 4844 var _this = this; 4845 4846 // clear requests for all types 4847 for (var typ in this._requests) { 4848 var request = this._requests[typ]; 4849 this.fire('owmloadingend', {type: typ}); 4850 request.abort(); 4851 } 4852 this._requests = {}; 4853 4854 if (this._map.getZoom() < this.options.minZoom) { 4855 this.fire('owmloadingend', {type: _this.options.type}); 4856 if (!this.options.keepOnMinZoom) { 4857 this._layer.clearLayers(); 4858 } 4859 return; 4860 } 4861 4862 // try to get cached data first 4863 var bounds = this._map.getBounds(); 4864 var data = null; 4865 if (this.options.caching) { 4866 data = this._cache.get(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth()); 4867 } 4868 if (data !== null) { 4869 // using cached data 4870 this._processRequestedData(this, data); 4871 } else { 4872 // fetch new data from OWM 4873 this.fire('owmloadingstart', {type: _this.options.type}); 4874 var url = this._urlTemplate 4875 .replace('{appId}', this.options.appId ? 'APPID=' + this.options.appId + '&' : '') 4876 .replace('{type}', this.options.type) 4877 .replace('{minlon}', bounds.getWest()) 4878 .replace('{minlat}', bounds.getSouth()) 4879 .replace('{maxlon}', bounds.getEast()) 4880 .replace('{maxlat}', bounds.getNorth()) 4881 ; 4882 this._requests[this.options.type] = L.OWM.Utils.jsonp(url, function(data) { 4883 delete _this._requests[_this.options.type]; 4884 4885 if (!_this._map) { 4886 // Nothing to do if layer is gone but this request is still active 4887 return; 4888 } 4889 4890 if (_this.options.caching) { 4891 _this._cache.set(data, _this._map.getBounds()); 4892 } 4893 _this._processRequestedData(_this, typeof data.list == 'undefined' ? new Array() : data.list); 4894 _this.fire('owmloadingend', {type: _this.options.type}); 4895 }); 4896 } 4897 if (this.options.interval && this.options.interval > 0) { 4898 this._timeoutId = window.setTimeout(function() {_this.update()}, 60000*this.options.interval); 4899 } 4900 }, 4901 4902 _processRequestedData: function(_this, data) { 4903 4904 // read all cities 4905 var stations = {}; 4906 for (var i in data) { 4907 var stat = data[i]; 4908 if (!_this._map) { // maybe layer is gone while we are looping here 4909 return; 4910 } 4911 // only use cities having a minimum distance of some pixels on the map 4912 var pt = _this._map.latLngToLayerPoint(new L.LatLng(stat.coord.Lat, stat.coord.Lon)); 4913 var key = '' + (Math.round(pt.x/_this.options.clusterSize)) + "_" + (Math.round(pt.y/_this.options.clusterSize)); 4914 if (!stations[key] || parseInt(stations[key].rang) < parseInt(stat.rang)) { 4915 stations[key] = stat; 4916 } 4917 } 4918 4919 // hide LayerGroup from map and remove old markers 4920 var markerWithPopup = null; 4921 if (_this.options.keepPopup) { 4922 markerWithPopup = _this._getMarkerWithPopup(_this._markers); 4923 } 4924 if (_this._map && _this._map.hasLayer(_this._layer)) { 4925 _this._map.removeLayer(_this._layer); 4926 } 4927 _this._layer.clearLayers(); 4928 4929 // add the cities as markers to the LayerGroup 4930 _this._markers = new Array(); 4931 for (var key in stations) { 4932 var marker; 4933 if (_this.options.markerFunction != null && typeof _this.options.markerFunction == 'function') { 4934 marker = _this.options.markerFunction.call(_this, stations[key]); 4935 } else { 4936 marker = _this._createMarker(stations[key]); 4937 } 4938 marker.options.owmId = stations[key].id; 4939 _this._layer.addLayer(marker); 4940 _this._markers.push(marker); 4941 if (_this.options.popup) { 4942 if (_this.options.popupFunction != null && typeof _this.options.popupFunction == 'function') { 4943 marker.bindPopup(_this.options.popupFunction.call(_this, stations[key])); 4944 } else { 4945 marker.bindPopup(_this._createPopup(stations[key])); 4946 } 4947 } 4948 if (markerWithPopup != null 4949 && typeof markerWithPopup.options.owmId != 'undefined' 4950 && markerWithPopup.options.owmId == marker.options.owmId) { 4951 markerWithPopup = marker; 4952 } 4953 } 4954 4955 // add the LayerGroup to the map 4956 _this._map && _this._map.addLayer(_this._layer); 4957 if (markerWithPopup != null) { 4958 markerWithPopup.openPopup(); 4959 } 4960 _this.fire('owmlayeradd', {markers: _this._markers}); 4961 }, 4962 4963 _getMarkerWithPopup: function(markers) { 4964 var marker = null; 4965 for (var idx in markers) { 4966 var m = markers[idx]; 4967 if (m._popup && m._map && m._map.hasLayer(m._popup)) { 4968 marker = m; 4969 break; 4970 } 4971 } 4972 return marker; 4973 }, 4974 4975 _createPopup: function(station) { 4976 var showLink = typeof station.id != 'undefined' && this.options.showOwmStationLink; 4977 var txt = '<div class="owm-popup-name">'; 4978 if (showLink) { 4979 var typ = 'station'; 4980 if (typeof station.weather != 'undefined') { 4981 typ = 'city'; 4982 } 4983 txt += '<a href="https://openweathermap.org/' + typ + '/' + station.id + '" target="_blank" title="' 4984 + this.i18n('owmlinktitle', 'Details at OpenWeatherMap') + '">'; 4985 } 4986 txt += station.name; 4987 if (showLink) { 4988 txt += '</a>'; 4989 } 4990 txt += '</div>'; 4991 if (typeof station.weather != 'undefined' && typeof station.weather[0] != 'undefined') { 4992 if (typeof station.weather[0].description != 'undefined' && typeof station.weather[0].id != 'undefined') { 4993 txt += '<div class="owm-popup-description">' 4994 + this.i18n('id'+station.weather[0].id, station.weather[0].description + ' (' + station.weather[0].id + ')') 4995 + '</div>'; 4996 } 4997 } 4998 var imgData = this._getImageData(station); 4999 txt += '<div class="owm-popup-main"><img src="' + imgData.url + '" width="' + imgData.width 5000 + '" height="' + imgData.height + '" border="0" />'; 5001 if (typeof station.main != 'undefined' && typeof station.main.temp != 'undefined') { 5002 txt += '<span class="owm-popup-temp">' + this._temperatureConvert(station.main.temp) 5003 + ' ' + this._displayTemperatureUnit() + '</span>'; 5004 } 5005 txt += '</div>'; 5006 txt += '<div class="owm-popup-details">'; 5007 if (typeof station.main != 'undefined') { 5008 if (typeof station.main.humidity != 'undefined') { 5009 txt += '<div class="owm-popup-detail">' 5010 + this.i18n('humidity', 'Humidity') 5011 + ': ' + station.main.humidity + ' %</div>'; 5012 } 5013 if (typeof station.main.pressure != 'undefined') { 5014 txt += '<div class="owm-popup-detail">' 5015 + this.i18n('pressure', 'Pressure') 5016 + ': ' + station.main.pressure + ' hPa</div>'; 5017 } 5018 if (this.options.showTempMinMax) { 5019 if (typeof station.main.temp_max != 'undefined' && typeof station.main.temp_min != 'undefined') { 5020 txt += '<div class="owm-popup-detail">' 5021 + this.i18n('temp_minmax', 'Temp. min/max') 5022 + ': ' 5023 + this._temperatureConvert(station.main.temp_min) 5024 + ' / ' 5025 + this._temperatureConvert(station.main.temp_max) 5026 + ' ' + this._displayTemperatureUnit() + '</div>'; 5027 } 5028 } 5029 } 5030 if (station.rain != null && typeof station.rain != 'undefined' && typeof station.rain['1h'] != 'undefined') { 5031 txt += '<div class="owm-popup-detail">' 5032 + this.i18n('rain_1h', 'Rain (1h)') 5033 + ': ' + station.rain['1h'] + ' ml</div>'; 5034 } 5035 if (typeof station.wind != 'undefined') { 5036 if (typeof station.wind.speed != 'undefined') { 5037 txt += '<div class="owm-popup-detail">'; 5038 if (this.options.showWindSpeed == 'beaufort' || this.options.showWindSpeed == 'both') { 5039 txt += this.i18n('windforce', 'Wind Force') 5040 + ': ' + this._windMsToBft(station.wind.speed); 5041 if (this.options.showWindSpeed == 'both') { 5042 txt += ' (' + this._convertSpeed(station.wind.speed) + ' ' 5043 + this._displaySpeedUnit() + ')'; 5044 } 5045 } else { 5046 txt += this.i18n('wind', 'Wind') + ': ' 5047 + this._convertSpeed(station.wind.speed) + ' ' 5048 + this._displaySpeedUnit(); 5049 } 5050 txt += '</div>'; 5051 } 5052 if (typeof station.wind.gust != 'undefined') { 5053 txt += '<div class="owm-popup-detail">'; 5054 if (this.options.showWindSpeed == 'beaufort' || this.options.showWindSpeed == 'both') { 5055 txt += this.i18n('gust', 'Gust') 5056 + ': ' + this._windMsToBft(station.wind.gust); 5057 if (this.options.showWindSpeed == 'both') { 5058 txt += ' (' + this._convertSpeed(station.wind.gust) + ' ' 5059 + this._displaySpeedUnit() + ')'; 5060 } 5061 } else { 5062 txt += this.i18n('gust', 'Gust') + ': ' 5063 + this._convertSpeed(station.wind.gust) + ' ' 5064 + this._displaySpeedUnit(); 5065 } 5066 txt += '</div>'; 5067 } 5068 if (typeof station.wind.deg != 'undefined') { 5069 txt += '<div class="owm-popup-detail">'; 5070 txt += this.i18n('direction', 'Windrichtung') + ': '; 5071 if (this.options.showWindDirection == 'desc' || this.options.showWindDirection == 'both') { 5072 txt += this._directions[(station.wind.deg/22.5).toFixed(0)]; 5073 if (this.options.showWindDirection == 'both') { 5074 txt += ' (' + station.wind.deg + '°)'; 5075 } 5076 } else { 5077 txt += station.wind.deg + '°'; 5078 } 5079 txt += '</div>'; 5080 } 5081 } 5082 if (typeof station.dt != 'undefined' && this.options.showTimestamp) { 5083 txt += '<div class="owm-popup-timestamp">'; 5084 txt += '(' + this._convertTimestamp(station.dt) + ')'; 5085 txt += '</div>'; 5086 } 5087 txt += '</div>'; 5088 return txt; 5089 }, 5090 5091 _getImageData: function(station) { 5092 var imageUrl; 5093 var imageWidth = this.options.imageWidth; 5094 var imageHeight = this.options.imageHeight; 5095 var imageUrlTemplate = this.options.imageUrlCity; 5096 if (station.weather && station.weather[0] && station.weather[0].icon) { 5097 imageUrl = imageUrlTemplate.replace('{icon}', station.weather[0].icon); 5098 } else if (station.type && station.type == 1) { 5099 imageUrl = this.options.imageUrlPlane; 5100 imageWidth = this.options.imageWidthPlane; 5101 imageHeight = this.options.imageWidthPLane; 5102 } else { 5103 imageUrl = this.options.imageUrlStation; 5104 imageWidth = this.options.imageWidthStation; 5105 imageHeight = this.options.imageWidthStation; 5106 } 5107 return {url: imageUrl, width: imageWidth, height: imageHeight}; 5108 }, 5109 5110 _createMarker: function(station) { 5111 var imageData = this._getImageData(station); 5112 var icon = L.divIcon({ 5113 className: '' 5114 , iconAnchor: new L.Point(25, imageData.height/2) 5115 , popupAnchor: new L.Point(0, -10) 5116 , html: this._icondivtext(station, imageData.url, imageData.width, imageData.height) 5117 }); 5118 var marker = L.marker([station.coord.Lat, station.coord.Lon], {icon: icon}); 5119 return marker; 5120 }, 5121 5122 _icondivtext: function(station, imageurl, width, height) { 5123 var txt = ''; 5124 txt += '<div class="owm-icondiv">' 5125 + '<img src="' + imageurl + '" border="0" width="' + width + '" height="' + height + '" />'; 5126 if (typeof station.main != 'undefined' && typeof station.main.temp != 'undefined') { 5127 txt += '<div class="owm-icondiv-temp">' + this._temperatureConvert(station.main.temp) 5128 + ' ' + this._displayTemperatureUnit() + '</div>'; 5129 } 5130 txt += '</div>'; 5131 return txt; 5132 }, 5133 5134 _temperatureConvert: function(tempC) { 5135 var temp = tempC; 5136 switch (this.options.temperatureUnit) { 5137 case 'K': 5138 temp = (tempC + 273.15); 5139 break; 5140 case 'C': 5141 break; 5142 case 'F': 5143 temp = ((tempC + 273.15)*1.8-459.67); 5144 break; 5145 } 5146 return temp.toFixed(this.options.temperatureDigits); 5147 }, 5148 5149 _displayTemperatureUnit: function() { 5150 var unit = this._tempUnits['K']; 5151 if (typeof this._tempUnits[this.options.temperatureUnit] != 'undefined') { 5152 unit = this._tempUnits[this.options.temperatureUnit]; 5153 } 5154 return unit; 5155 }, 5156 5157 _windMsToBft: function(ms) { 5158 var bft = 18; 5159 for (var key in this._msbft) { 5160 if (ms < this._msbft[key]) { 5161 bft = key; 5162 break; 5163 } 5164 } 5165 return bft; 5166 }, 5167 5168 _displaySpeedUnit: function() { 5169 var unit = 'm/s'; 5170 switch (this.options.speedUnit) { 5171 case 'kmh': 5172 unit = 'km/h' 5173 break; 5174 case 'mph': 5175 unit = 'mph' 5176 break; 5177 } 5178 return unit; 5179 }, 5180 5181 _convertSpeed: function(speed) { 5182 var sp = speed; 5183 switch (this.options.speedUnit) { 5184 case 'kmh': 5185 sp = 3.6*sp; 5186 break; 5187 case 'mph': 5188 sp = 2.236*sp; 5189 break; 5190 } 5191 return sp.toFixed(this.options.speedDigits); 5192 }, 5193 5194 _convertTimestamp: function(tstmp) { 5195 if (this.options.useLocalTime) { 5196 return (new Date(tstmp*1000)); 5197 } else { 5198 return (new Date(tstmp*1000)).toUTCString(); 5199 } 5200 }, 5201 5202 i18n: function(key, fallback) { 5203 var lang = this.options.lang; 5204 if (typeof L.OWM.Utils.i18n != 'undefined' 5205 && typeof L.OWM.Utils.i18n[lang] != 'undefined' 5206 && typeof L.OWM.Utils.i18n[lang][key] != 'undefined') { 5207 return L.OWM.Utils.i18n[lang][key] 5208 } 5209 return fallback; 5210 } 5211 5212}); 5213L.OWM.current = function(options) { return new L.OWM.Current(options); }; 5214 5215L.OWM.ProgressControl = L.Control.extend({ 5216 5217 options: { 5218 position: "topleft", 5219 type: 'city', 5220 bgImage: null // bgImage is set in L.OWM.Current when creating this ProgressControll instance 5221 }, 5222 5223 initialize: function(options) { 5224 L.Util.setOptions(this, options); 5225 this._container = L.DomUtil.create('div', 'leaflet-control-layers'); 5226 if (this.options.bgImage != null) { 5227 this._container.style.backgroundImage ='url(' + this.options.bgImage + ')'; 5228 this._container.style.backgroundRepeat = 'no-repeat'; 5229 this._container.style.backgroundPosition = 'center center'; 5230 } 5231 L.DomEvent.disableClickPropagation(this._container); 5232 this._container.innerHTML = '<img src="' + this.options.imageLoadingUrl + '" width="50" height="50" />'; 5233 }, 5234 5235 onAdd: function(map) { 5236 this._map = map; 5237 this.options.owmInstance.on('owmloadingstart', this._activate, this); 5238 this.options.owmInstance.on('owmloadingend', this._deactivate, this); 5239 return this._container; 5240 }, 5241 5242 _activate: function(e) { 5243 if (e.target.options.type == this.options.type) { 5244 this._container.style.display = 'block'; 5245 } 5246 }, 5247 5248 _deactivate: function(e) { 5249 if (e.target.options.type == this.options.type) { 5250 this._container.style.display = 'none'; 5251 } 5252 }, 5253 5254 onRemove: function(map) { 5255 this.options.owmInstance.off('owmloadingstart', this._activate, this); 5256 this.options.owmInstance.off('owmloadingend', this._deactivate, this); 5257 this._container.style.display = 'none'; 5258 this._map = null; 5259 } 5260 5261}); 5262L.OWM.progressControl = function(options) { return new L.OWM.ProgressControl(options); }; 5263 5264L.OWM.CurrentCache = L.Class.extend({ 5265 5266 options: { 5267 maxAge: 15 // age in minutes before cache data is invalidated 5268 }, 5269 5270 initialize: function(options) { 5271 L.Util.setOptions(this, options); 5272 this.clear(); 5273 }, 5274 5275 clear: function() { 5276 this._cachedData = null; 5277 this._cachedTime = 0; 5278 this._cachedBBox = {minLon: 181, minLat: 91, maxLon: -181, maxLat: -91}; 5279 }, 5280 5281 get: function(minLon, minLat, maxLon, maxLat) { 5282 if (this._cachedData == null) { 5283 // no cached data available 5284 return null; 5285 } 5286 if ((new Date()).getTime() - this._cachedTime > 60000*this.options.maxAge) { 5287 // cached data is too old 5288 this.clear(); 5289 return null; 5290 } 5291 if (minLon <= this._cachedBBox.minLon || minLat <= this._cachedBBox.minLat 5292 || maxLon >= this._cachedBBox.maxLon || maxLat >= this._cachedBBox.maxLat) { 5293 // new area is outside of cached area 5294 this.clear(); 5295 return null; 5296 } 5297 5298 // clip cached data to bounds 5299 var clippedStations = new Array(); 5300 var cnt = 0; 5301 for (var k in this._cachedData.list) { 5302 var station = this._cachedData.list[k]; 5303 if (station.coord.Lon >= minLon && station.coord.Lon <= maxLon 5304 && station.coord.Lat >= minLat && station.coord.Lat <= maxLat) { 5305 clippedStations[k] = station; 5306 cnt++; 5307 } 5308 } 5309 return clippedStations; 5310 }, 5311 5312 set: function(data, bounds) { 5313 this._cachedData = data; 5314 this._cachedBBox.minLon = bounds.getWest(); 5315 this._cachedBBox.minLat = bounds.getSouth(); 5316 this._cachedBBox.maxLon = bounds.getEast(); 5317 this._cachedBBox.maxLat = bounds.getNorth(); 5318 this._cachedTime = (new Date()).getTime(); 5319 } 5320 5321}); 5322L.OWM.currentCache = function(options) { return new L.OWM.CurrentCache(options); }; 5323 5324 5325L.OWM.Utils = { 5326 5327 callbacks: {}, 5328 callbackCounter: 0, 5329 5330 jsonp: function(url, callbackFn) { 5331 var _this = this; 5332 var elem = document.createElement('script'); 5333 var counter = this.callbackCounter++; 5334 var callback = 'L.OWM.Utils.callbacks[' + counter + ']'; 5335 var abort = function() { 5336 if (elem.parentNode) { 5337 return elem.parentNode.removeChild(elem); 5338 } 5339 }; 5340 5341 this.callbacks[counter] = function(data) { 5342 delete _this.callbacks[counter]; 5343 return callbackFn(data); 5344 }; 5345 5346 elem.src = '' + url + (url.indexOf('?') >= 0 ? '&' : '?') + 'callback=' + callback; 5347 elem.type = 'text/javascript'; 5348 document.getElementsByTagName('body')[0].appendChild(elem); 5349 return { abort: abort }; 5350 }, 5351 5352 i18n: { 5353 en: { 5354 owmlinktitle: 'Details at OpenWeatherMap' 5355 , temperature: 'Temperature' 5356 , temp_minmax: 'Temp. min/max' 5357 , wind: 'Wind' 5358 , gust: 'Gust' 5359 , windforce: 'Wind Force' 5360 , direction: 'Direction' 5361 , rain_1h: 'Rain' 5362 , humidity: 'Humidity' 5363 , pressure: 'Pressure' 5364 5365 // weather conditions, see https://openweathermap.org/weather-conditions 5366 , id200: 'Thunderstorm with Light Rain' 5367 , id201: 'Thunderstorm with Rain' 5368 , id202: 'Thunderstorm with Heavy Rain' 5369 , id210: 'Light Thunderstorm' 5370 , id211: 'Thunderstorm' 5371 , id212: 'Heavy Thunderstorm' 5372 , id221: 'Ragged Thunderstorm' 5373 , id230: 'Thunderstorm with Light Drizzle' 5374 , id231: 'Thunderstorm with Drizzle' 5375 , id232: 'Thunderstorm with Heavy Drizzle' 5376 5377 , id300: 'Light Intensity Drizzle' 5378 , id301: 'Drizzle' 5379 , id302: 'Heavy Intensity Drizzle' 5380 , id310: 'Light Intensity Drizzle Rain' 5381 , id311: 'Drizzle Rain' 5382 , id312: 'Heavy Intensity Drizzle Rain' 5383 , id321: 'Shower Drizzle' 5384 5385 , id500: 'Light Rain' 5386 , id501: 'Moderate Rain' 5387 , id502: 'Heavy Intensity Rain' 5388 , id503: 'Very Heavy Rain' 5389 , id504: 'Extreme Rain' 5390 , id511: 'Freezing Rain' 5391 , id520: 'Light Intensity Shower Rain' 5392 , id521: 'Shower Rain' 5393 , id522: 'Heavy Intensity Shower Rain' 5394 5395 , id600: 'Light Snow' 5396 , id601: 'Snow' 5397 , id602: 'Heavy Snow' 5398 , id611: 'Sleet' 5399 , id621: 'Shower Snow' 5400 , id622: 'Heavy Shower Snow' 5401 5402 , id701: 'Mist' 5403 , id711: 'Smoke' 5404 , id721: 'Haze' 5405 , id731: 'Sand/Dust Whirls' 5406 , id741: 'Fog' 5407 , id751: 'Sand' 5408 5409 , id800: 'Sky is Clear' 5410 , id801: 'Few Clouds' 5411 , id802: 'Scattered Clouds' 5412 , id803: 'Broken Clouds' 5413 , id804: 'Overcast Clouds' 5414 5415 , id900: 'Tornado' 5416 , id901: 'Tropical Storm' 5417 , id902: 'Hurricane' 5418 , id903: 'Cold' 5419 , id904: 'Hot' 5420 , id905: 'Windy' 5421 , id906: 'Hail' 5422 }, 5423 5424 it: { 5425 owmlinktitle: 'Dettagli su OpenWeatherMap' 5426 , temperature: 'Temperatura' 5427 , temp_minmax: 'Temp. min / max ' 5428 , wind: 'Vento' 5429 , gust: 'Raffica' 5430 , windforce: 'Forza del vento' 5431 , direction: 'Direzione' 5432 , rain_1h: 'Pioggia' 5433 , humidity: 'Umidità ' 5434 , pressure: 'Pressione' 5435 5436 // condizioni meteorologiche, consultare https://openweathermap.org/weather-conditions 5437 // Temporale 5438 , id200: 'Tempesta con pioggia debole' 5439 , id201: 'Tempesta di pioggia' 5440 , id202: 'Tempesta con forti piogge' 5441 , id210: 'Tempesta debole' 5442 , id211: 'Tempesta' 5443 , id212: 'Tempesta forte' 5444 , id221: 'Tempesta irregolare' 5445 , id230: 'Tempesta con deboli acquerugi' 5446 , id231: 'Tempesta con pioviggine' 5447 , id232: 'Tempesta con forte pioviggine' 5448 5449 // Pioggerella 5450 , id300: 'Debole pioviggine' 5451 , id301: 'Pioggerella' 5452 , id302: 'Forti acquerugi' 5453 , id310: 'Pioggia / leggera pioggerellina' 5454 , id311: 'Pioggia / pioviggine' 5455 , id312: 'Pioggia / pioviggine forte' 5456 , id321: 'Pioviggine intensa' 5457 5458 // Pioggia 5459 , id500: 'Debole pioggia' 5460 , id501: 'Pioggia moderata' 5461 , id502: 'Pioggia forte' 5462 , id503: 'Pioggia molto forte' 5463 , id504: 'Pioggia estrema' 5464 , id511: 'Grandine' 5465 , id520: 'Pioggia leggera' 5466 , id521: 'Pioggia' 5467 , id522: 'Pioggia forte' 5468 , id531: 'pioggia irregolare' 5469 5470 // neve 5471 , id600: 'Neve Debole' 5472 , id601: 'Neve' 5473 , id602: 'Forte nevicata' 5474 , id611: 'Nevischio' 5475 , id612: 'Nevischio moderato' 5476 , id615: 'Debole pioggia e neve' 5477 , id616: 'Pioggia e neve' 5478 , id620: 'Nevischio Leggero' 5479 , id621: 'Neve moderata' 5480 , id622: 'Forte nevicata' 5481 5482 // atmosfera 5483 , id701: 'Bruma' 5484 , id711: 'Fumo' 5485 , id721: 'Foschia' 5486 , id731: 'Vortici di sabbia/polvere' 5487 , id741: 'Nebbia' 5488 , id751: 'Sabbia' 5489 , id761: 'Polvere' 5490 , id762: 'Cenere vulcanica' 5491 , id771: 'Tempesta' 5492 , id781: 'Tornado' 5493 5494 // Nuvole 5495 , id800: 'Cielo sereno' 5496 , id801: 'Alcune nuvole' 5497 , id802: 'Nuvole sparse' 5498 , id803: 'Tempo nuvoloso' 5499 , id804: 'Nuvoloso' 5500 5501 // Estremo 5502 , id900: 'Tornado' 5503 , id901: 'Tempesta tropicale' 5504 , id902: 'Uragano' 5505 , id903: 'Molto freddo' 5506 , id904: 'Molto caldo' 5507 , id905: 'Ventoso' 5508 , id906: 'Forte grandine' 5509 5510 // aggiuntivo 5511 , id951: 'Calmo' 5512 , id952: 'Brezza leggera' 5513 , id953: 'Brezza sostenuta' 5514 , id954: 'Brezza moderata' 5515 , id955: 'Brezza fresca' 5516 , id956: 'Brezza forte' 5517 , id957: 'Vento forte, vicino a burrasca' 5518 , id958: 'Burrasca' 5519 , id959: 'Forte burrasca' 5520 , id960: 'Tempesta' 5521 , id961: 'Tempesta violenta' 5522 , id962: 'Uragano' 5523 }, 5524 5525 de: { 5526 owmlinktitle: 'Details bei OpenWeatherMap' 5527 , temperature: 'Temperatur' 5528 , temp_minmax: 'Temp. min/max' 5529 , wind: 'Wind' 5530 , gust: 'Windböen' 5531 , windforce: 'Windstärke' 5532 , direction: 'Windrichtung' 5533 , rain_1h: 'Regen' 5534 , humidity: 'Luftfeuchtigkeit' 5535 , pressure: 'Luftdruck' 5536 5537 // Wetterbedingungen, siehe https://openweathermap.org/weather-conditions 5538 , id200: 'Gewitter mit leichtem Regen' // 'Thunderstorm with Light Rain' 5539 , id201: 'Gewitter mit Regen' // 'Thunderstorm with Rain' 5540 , id202: 'Gewitter mit Starkregen' // 'Thunderstorm with Heavy Rain' 5541 , id210: 'Leichtes Gewitter' // 'Light Thunderstorm' 5542 , id211: 'MäÃiges Gewitter' // 'Thunderstorm' 5543 , id212: 'Starkes Gewitter' // 'Heavy Thunderstorm' 5544 // , id221: 'Ragged Thunderstorm' 5545 // , id230: 'Thunderstorm with Light Drizzle' 5546 // , id231: 'Thunderstorm with Drizzle' 5547 // , id232: 'Thunderstorm with Heavy Drizzle' 5548 5549 , id300: 'Leichter Nieselregen' // 'Light Intensity Drizzle' 5550 , id301: 'Nieselregen' // 'Drizzle' 5551 , id302: 'Starker Nieselregen' // 'Heavy Intensity Drizzle' 5552 // , id310: 'Light Intensity Drizzle Rain' 5553 // , id311: 'Drizzle Rain' 5554 // , id312: 'Heavy Intensity Drizzle Rain' 5555 // , id321: 'Shower Drizzle' 5556 5557 , id500: 'Leichter Regen' // 'Light Rain' 5558 , id501: 'MäÃiger Regen' // 'Moderate Rain' 5559 , id502: 'Starker Regen' // 'Heavy Intensity Rain' 5560 , id503: 'Ergiebiger Regen' // 'Very Heavy Rain' 5561 , id504: 'Starkregen' // 'Extreme Rain' 5562 , id511: 'Gefrierender Regen' // 'Freezing Rain' 5563 , id520: 'Leichte Regenschauer' // 'Light Intensity Shower Rain' 5564 , id521: 'MäÃige Regenschauer' // 'Shower Rain' 5565 , id522: 'Wolkenbruchartige Regenschauer' // 'Heavy Intensity Shower Rain' 5566 5567 , id600: 'Leichter Schneefall' // 'Light Snow' 5568 , id601: 'MäÃiger Schneefall' // 'Snow' 5569 , id602: 'Starker Schneefall' // 'Heavy Snow' 5570 , id611: 'Schneeregen' // 'Sleet' 5571 , id621: 'Schneeschauer' // 'Shower Snow' 5572 , id622: 'Starke Schneeschauer' // 'Heavy Shower Snow' 5573 5574 , id701: 'Dunst' // 'Mist' 5575 , id711: 'Rauch' // 'Smoke' 5576 , id721: 'Eingetrübt' // 'Haze' 5577 , id731: 'Sand-/Staubwirbel' // 'Sand/Dust Whirls' 5578 , id741: 'Nebel' // 'Fog' 5579 , id751: 'Sand' // 'Sand' 5580 5581 , id800: 'Wolkenlos' // 'Sky is Clear' 5582 , id800d: 'Sonnig' // 'Sky is Clear' at day 5583 , id800n: 'Klar' // 'Sky is Clear' at night 5584 , id801: 'Leicht bewölkt' // 'Few Clouds' 5585 , id802: 'Wolkig' // 'Scattered Clouds' 5586 , id803: 'Stark bewölkt' // 'Broken Clouds' 5587 , id804: 'Bedeckt' // 'Overcast Clouds' 5588 5589 , id900: 'Tornado' // 'Tornado' 5590 , id901: 'Tropischer Sturm' // 'Tropical Storm' 5591 , id902: 'Orkan' // 'Hurricane' 5592 , id903: 'Kälte' // 'Cold' 5593 , id904: 'Hitze' // 'Hot' 5594 , id905: 'Windig' // 'Windy' 5595 , id906: 'Hagel' // 'Hail' 5596 }, 5597 5598 ru: { 5599 owmlinktitle: 'ÐнÑоÑмаÑÐ¸Ñ Ð² OpenWeatherMap' 5600 , temperature: 'ТемпеÑаÑÑÑа' 5601 , temp_minmax: 'ÐакÑ./Ðин. Ñемп' 5602 , wind: 'ÐеÑеÑ' 5603 , gust: 'ÐоÑÑвÑ' 5604 , windforce: 'Сила' 5605 , direction: 'ÐапÑавление' 5606 , rain_1h: 'ÐождÑ' 5607 , humidity: 'ÐлажноÑÑÑ' 5608 , pressure: 'Ðавление' 5609 5610 // weather conditions, see https://openweathermap.org/weather-conditions 5611 , id200: 'ÐÑоза Ñ Ð»ÐµÐ³ÐºÐ¸Ð¼ дождем' // 'Thunderstorm with Light Rain' 5612 , id201: 'ÐÑоза Ñ Ð´Ð¾Ð¶Ð´ÐµÐ¼' // 'Thunderstorm with Rain' 5613 , id202: 'ÐÑоза Ñ Ð»Ð¸Ð²Ð½ÐµÐ¼' // 'Thunderstorm with Heavy Rain' 5614 , id210: 'ÐÐµÐ³ÐºÐ°Ñ Ð³Ñоза' // 'Light Thunderstorm' 5615 , id211: 'ÐÑоза' // 'Thunderstorm' 5616 , id212: 'СилÑÐ½Ð°Ñ Ð³Ñоза' // 'Heavy Thunderstorm' 5617 , id221: 'ÐÑеÑÑвиÑÑÐ°Ñ Ð³Ñоза' // 'Ragged Thunderstorm' 5618 , id230: 'ÐÑоза Ñ Ð¼ÐµÐ»ÐºÐ¾Ð¹ моÑоÑÑÑ' // 'Thunderstorm with Light Drizzle' 5619 , id231: 'ÐÑоза Ñ Ð¼Ð¾ÑоÑÑÑ' // 'Thunderstorm with Drizzle' 5620 , id232: 'ÐÑоза Ñ ÑилÑной моÑоÑÑÑ' // 'Thunderstorm with Heavy Drizzle' 5621 5622 , id300: 'ÐоÑоÑÑ Ñлабой инÑенÑивноÑÑи' // 'Light Intensity Drizzle' 5623 , id301: 'ÐоÑоÑÑ' // 'Drizzle' 5624 , id302: 'ÐоÑоÑÑ ÑилÑной инÑенÑивноÑÑи' // 'Heavy Intensity Drizzle' 5625 , id310: 'ÐалоинÑенÑивнÑй моÑоÑÑÑий дождÑ' // 'Light Intensity Drizzle Rain' 5626 , id311: 'ÐоÑоÑÑÑий дождÑ' // 'Drizzle Rain' 5627 , id312: 'СилÑноинÑенÑивнÑй моÑоÑÑÑий дождÑ' // 'Heavy Intensity Drizzle Rain' 5628 , id321: 'ÐÑоливной дождÑ' // 'Shower Drizzle' 5629 5630 , id500: 'ÐеболÑÑой дождÑ' //'Light Rain' 5631 , id501: 'ÐождÑ' // 'Moderate Rain' 5632 , id502: 'СилÑнÑй дождÑ' //'Heavy Intensity Rain' 5633 , id503: 'ÐÑÐµÐ½Ñ ÑилÑнÑй дождÑ' //'Very Heavy Rain' 5634 , id504: 'СилÑнÑй ливенÑ' // 'Extreme Rain' 5635 , id511: 'ÐедÑной дождÑ' // 'Freezing Rain' 5636 , id520: 'ÐÑаÑковÑеменнÑй ÑлабÑй дождÑ' //'Light Intensity Shower Rain' 5637 , id521: 'ÐÑаÑковÑеменнÑй дождÑ' //'Shower Rain' 5638 , id522: 'ÐÑаÑковÑеменнÑй ÑилÑнÑй дождÑ' //'Heavy Intensity Shower Rain' 5639 5640 , id600: 'СлабÑй Ñнег' // 'Light Snow' 5641 , id601: 'Снег' // 'Snow' 5642 , id602: 'СилÑнÑй Ñнег' // 'Heavy Snow' 5643 , id611: 'Снег Ñ Ð´Ð¾Ð¶Ð´ÐµÐ¼' //'Sleet' 5644 , id621: 'ÐÑаÑковÑеменнÑй Ñнег' // 'Shower Snow' 5645 , id622: 'ÐÑаÑковÑеменнÑй ÑилÑнÑй Ñнег' //'Heavy Shower Snow' 5646 5647 , id701: 'Ðгла' // 'Mist' 5648 , id711: 'Смог' //'Smoke' 5649 , id721: 'ÐÑмка' // 'Haze' 5650 , id731: 'ÐеÑоÑнÑе/пÑлÑевÑе Ð²Ð¸Ñ Ñи' // 'Sand/Dust Whirls' 5651 , id741: 'ТÑман' // 'Fog' 5652 , id751: 'ÐеÑок' // 'Sand' 5653 5654 , id800: 'ЯÑно' // 'Sky is Clear' 5655 , id801: 'ÐалооблаÑно' // 'Few Clouds' 5656 , id802: 'ÐеÑÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð¾Ð±Ð»Ð°ÑноÑÑÑ' // 'Scattered Clouds' 5657 , id803: 'ÐблаÑно Ñ Ð¿ÑоÑÑнениÑми' // 'Broken Clouds' 5658 , id804: 'ÐблаÑно' // 'Overcast Clouds' 5659 5660 , id900: 'ТоÑнадо' // 'Tornado' 5661 , id901: 'ТÑопиÑеÑкий ÑÑоÑм' // 'Tropical Storm' 5662 , id902: 'УÑаган' // 'Hurricane' 5663 , id903: 'Холод'//'Cold' 5664 , id904: 'ÐаÑа'//'Hot' 5665 , id905: 'ÐеÑÑено'//'Windy' 5666 , id906: 'ÎÑад' // 'Hail' 5667 }, 5668 5669 fr: { 5670 owmlinktitle: 'Détails à OpenWeatherMap' 5671 , temperature: 'Température' 5672 , temp_minmax: 'Temp. min/max' 5673 , wind: 'Vent' 5674 , gust: 'Rafales' 5675 , windforce: 'Force du vent' 5676 , direction: 'Direction' 5677 , rain_1h: 'Pluie' 5678 , humidity: 'Humidité' 5679 , pressure: 'Pression' 5680 5681 // Les conditions météorologiques, voir https://openweathermap.org/weather-conditions 5682 , id200: 'Orage avec pluie légère' // 'Thunderstorm with Light Rain' 5683 , id201: 'Orage avec pluie' // 'Thunderstorm with Rain' 5684 , id202: 'Orage avec fortes précipitations' // 'Thunderstorm with Heavy Rain' 5685 // , id210: 'Light Thunderstorm' 5686 , id211: 'Orage' 5687 , id212: 'Orage violent' // 'Heavy Thunderstorm' 5688 // , id221: 'Ragged Thunderstorm' 5689 , id230: 'Orage avec bruine faible' // 'Thunderstorm with Light Drizzle' 5690 , id231: 'Orage avec bruine' // 'Thunderstorm with Drizzle' 5691 // , id232: 'Thunderstorm with Heavy Drizzle' 5692 5693 // , id300: 'Light Intensity Drizzle' 5694 , id301: 'Bruine' // 'Drizzle' 5695 // , id302: 'Heavy Intensity Drizzle' 5696 // , id310: 'Light Intensity Drizzle Rain' 5697 // , id311: 'Drizzle Rain' 5698 // , id312: 'Heavy Intensity Drizzle Rain' 5699 // , id321: 'Shower Drizzle' 5700 5701 , id500: 'Pluie légère' // 'Light Rain' 5702 , id501: 'Pluie modérée' // 'Moderate Rain' 5703 , id502: 'Pluie battante' // 'Heavy Intensity Rain' 5704 // , id503: 'Very Heavy Rain' 5705 // , id504: 'Extreme Rain' 5706 , id511: 'Pluie verglassante' // 'Freezing Rain' 5707 , id520: 'Averses de pluie fine' // 'Light Intensity Shower Rain' 5708 // , id521: 'Shower Rain' 5709 // , id522: 'Heavy Intensity Shower Rain' 5710 5711 , id600: 'Légers flocons' // 'Light Snow' 5712 , id601: 'Neige' // 'Snow' 5713 , id602: 'Fortes chutes de neige' // 'Heavy Snow' 5714 , id611: 'Neige fondue' // 'Sleet' 5715 , id621: 'Averses de neige' // 'Shower Snow' 5716 , id622: 'Fortes chutes de neige' // 'Heavy Shower Snow' 5717 5718 , id701: 'Brume' // 'Mist' 5719 , id711: 'Fumée' // 'Smoke' 5720 , id721: 'Brume' // 'Haze' 5721 , id731: 'Tourbillons de sable/poussière' // 'Sand/Dust Whirls' 5722 , id741: 'Brouillard' // 'Fog' 5723 // , id751: 'Sand' 5724 5725 , id800: 'Ciel dégagé' // 'Sky is Clear' 5726 , id801: 'Ciel voilé' 5727 , id802: 'Nuageux' // 'Scattered Clouds' 5728 , id803: 'Nuageux' // 'Broken Clouds' 5729 , id804: 'Ciel couvert' // 'Overcast Clouds' 5730 5731 , id900: 'Tornade' // 'Tornado' 5732 , id901: 'Tempête tropicale'// 'Tropical Storm' 5733 , id902: 'Ouragan' // 'Hurricane' 5734 , id903: 'Froid' // 'Cold' 5735 , id904: 'Chaleur' // 'Hot' 5736 , id905: 'Venteux' // 'Windy' 5737 , id906: 'Grêle' // 'Hail' 5738 }, 5739 5740 nl: { //dutch translation 5741 owmlinktitle: 'Details op OpenWeatherMap' 5742 , temperature: 'Temperatuur' 5743 , temp_minmax: 'Temp. min/max' 5744 , wind: 'Wind' 5745 , gust: 'Windvlaag' 5746 , windforce: 'Windkracht' 5747 , direction: 'Richting' 5748 , rain_1h: 'Regen' 5749 , humidity: 'Luchtvochtigheid' 5750 , pressure: 'Luchtdruk' 5751 5752 // weeercondities, see https://openweathermap.org/weather-conditions 5753 , id200: 'Onweer met lichte regen' 5754 , id201: 'Onweer met met regen' 5755 , id202: 'Onweer met hevige regen' 5756 , id210: 'Lichte onweersbui' 5757 , id211: 'Onweersbui' 5758 , id212: 'Hevig onweer' 5759 , id221: 'Onregelmatige onweersbui' 5760 , id230: 'Onweer met licht motregen' 5761 , id231: 'Onweer met motregen' 5762 , id232: 'Onweer met hevige motregen' 5763 5764 , id300: 'Lichte motregen' 5765 , id301: 'Motregen' 5766 , id302: 'Hevige motregen' 5767 , id310: 'Lichte motregen / regen' 5768 , id311: 'Motregen / regen' 5769 , id312: 'Hevige motregen / regen' 5770 , id321: 'Douche motregen' 5771 5772 , id500: 'Lichte regen' 5773 , id501: 'Gematigde regen' 5774 , id502: 'Hevige regen' 5775 , id503: 'Erg hevige regen' 5776 , id504: 'Extreme regen' 5777 , id511: 'Hagel' 5778 , id520: 'Lichte miezerregen' 5779 , id521: 'Miezerregen' 5780 , id522: 'Hevige miezerregen' 5781 5782 , id600: 'Lichte sneeuwval' 5783 , id601: 'Sneeuw' 5784 , id602: 'Hevige sneeuwval' 5785 , id611: 'Ijzel' 5786 , id621: 'Douche sneeuw' 5787 , id622: 'Hevige douche sneeuw' 5788 5789 , id701: 'Mist' 5790 , id711: 'Rook' 5791 , id721: 'Nevel' 5792 , id731: 'Zand/stof werveling' 5793 , id741: 'Mist' 5794 , id751: 'Zand' 5795 5796 , id800: 'Onbewolkt' 5797 , id801: 'Licht bewolkt' 5798 , id802: 'Half bewolkt' 5799 , id803: 'Overwegend bewolkt' 5800 , id804: 'Bewolkt' 5801 5802 , id900: 'Tornado' 5803 , id901: 'Tropische Storm' 5804 , id902: 'Orkaan' 5805 , id903: 'Koud' 5806 , id904: 'Heet' 5807 , id905: 'Winderig' 5808 , id906: 'Hagel' 5809 }, 5810 5811 es: { //spanish translation 5812 owmlinktitle: 'Detalles en OpenWeatherMap' 5813 , temperature: 'Temperatura' 5814 , temp_minmax: 'Temp. mÃn/máx' 5815 , wind: 'Viento' 5816 , gust: 'Ráfagas' 5817 , windforce: 'Fuerza del viento' 5818 , direction: 'Dirección' 5819 , rain_1h: 'Lluvia' 5820 , humidity: 'Humedad' 5821 , pressure: 'Presión' 5822 5823 // weather conditions, see https://openweathermap.org/weather-conditions 5824 // Thunderstorm 5825 , id200: 'Tormenta con lluvia débil' 5826 , id201: 'Tormenta con lluvia' 5827 , id202: 'Tormenta con lluvia fuerte' 5828 , id210: 'Tormenta débil' 5829 , id211: 'Tormenta' 5830 , id212: 'Tormenta fuerte' 5831 , id221: 'Tormenta irregular' 5832 , id230: 'Tormenta con llovizna débil' 5833 , id231: 'Tormenta con llovizna' 5834 , id232: 'Tormenta con llovizna fuerte' 5835 5836 // Drizzle 5837 , id300: 'Llovizna débil' 5838 , id301: 'Llovizna' 5839 , id302: 'Llovizna fuerte' 5840 , id310: 'Lluvia/llovizna débil' 5841 , id311: 'Lluvia/llovizna' 5842 , id312: 'Lluvia/llovizna fuerte' 5843 , id321: 'Chubasco de llovizna' 5844 5845 // Rain 5846 , id500: 'Lluvia débil' 5847 , id501: 'Lluvia moderada' 5848 , id502: 'Lluvia fuerte' 5849 , id503: 'Lluvia muy fuerte' 5850 , id504: 'Lluvia extrema' 5851 , id511: 'Granizo' 5852 , id520: 'Chubasco de lluvia débil' 5853 , id521: 'Chubasco de lluvia' 5854 , id522: 'Chubasco de lluvia fuerte' 5855 , id531: 'Chubasco de lluvia irregular' 5856 5857 // Snow 5858 , id600: 'Nieve débil' 5859 , id601: 'Nieve' 5860 , id602: 'Nieve fuerte' 5861 , id611: 'Aguanieve' 5862 , id612: 'Chubasco de aguanieve' 5863 , id615: 'Lluvia y nieve débiles' 5864 , id616: 'Lluvia y nieve' 5865 , id620: 'Chubasco de nieve débil' 5866 , id621: 'Chubasco de nieve' 5867 , id622: 'Chubasco de nieve fuerte' 5868 5869 // Atmosphere 5870 , id701: 'Bruma' 5871 , id711: 'Humo' 5872 , id721: 'Neblina' 5873 , id731: 'Torbellinos de arena/polvo' 5874 , id741: 'Niebla' 5875 , id751: 'Arena' 5876 , id761: 'Polvo' 5877 , id762: 'Ceniza volcánica' 5878 , id771: 'Tempestad' 5879 , id781: 'Tornado' 5880 5881 // Clouds 5882 , id800: 'Cielo despejado' 5883 , id801: 'Algunas nubes' 5884 , id802: 'Nubes dispersas' 5885 , id803: 'Intérvalos nubosos' 5886 , id804: 'Nublado' 5887 5888 // Extreme 5889 , id900: 'Tornado' 5890 , id901: 'Tormenta tropical' 5891 , id902: 'Huracán' 5892 , id903: 'Bajas temperaturas' 5893 , id904: 'Altas temperaturas' 5894 , id905: 'Ventoso' 5895 , id906: 'Granizo' 5896 5897 // Additional 5898 , id951: 'Calma' 5899 , id952: 'Brisa ligera' 5900 , id953: 'Brisa suave' 5901 , id954: 'Brisa moderada' 5902 , id955: 'Brisa fresca' 5903 , id956: 'Brisa fuerte' 5904 , id957: 'Viento fuerte, próximo a vendaval' 5905 , id958: 'Vendaval' 5906 , id959: 'Vendaval fuerte' 5907 , id960: 'Tempestad' 5908 , id961: 'Tempestad violenta' 5909 , id962: 'Huracán' 5910 }, 5911 5912 ca: { //catalan translation 5913 owmlinktitle: 'Detalls en OpenWeatherMap' 5914 , temperature: 'Temperatura' 5915 , temp_minmax: 'Temp. mÃn/mà x' 5916 , wind: 'Vent' 5917 , gust: 'Rà fegues' 5918 , windforce: 'Força del vent' 5919 , direction: 'Direcció' 5920 , rain_1h: 'Pluja' 5921 , humidity: 'Humitat' 5922 , pressure: 'Pressió' 5923 5924 // weather conditions, see https://openweathermap.org/weather-conditions 5925 // Thunderstorm 5926 , id200: 'Tempesta amb pluja feble' 5927 , id201: 'Tempesta amb pluja' 5928 , id202: 'Tempesta amb pluja forta' 5929 , id210: 'Tempesta feble' 5930 , id211: 'Tempesta' 5931 , id212: 'Tempesta forta' 5932 , id221: 'Tempesta irregular' 5933 , id230: 'Tempesta amb plugim feble' 5934 , id231: 'Tempesta amb plugim' 5935 , id232: 'Tempesta amb plugim fort' 5936 5937 // Drizzle 5938 , id300: 'Plugim feble' 5939 , id301: 'Plugim' 5940 , id302: 'Plugim fort' 5941 , id310: 'Pluja/plugim feble' 5942 , id311: 'Pluja/plugim' 5943 , id312: 'Pluja/plugim fort' 5944 , id321: 'Ruixat de plugim' 5945 5946 // Rain 5947 , id500: 'Pluja feble' 5948 , id501: 'Pluja moderada' 5949 , id502: 'Pluja forta' 5950 , id503: 'Pluja molt forta' 5951 , id504: 'Pluja extrema' 5952 , id511: 'Calabruix' 5953 , id520: 'Ruixat de pluja feble' 5954 , id521: 'Ruixat de pluja' 5955 , id522: 'Ruixat de pluja fort' 5956 , id531: 'Ruixat de pluja irregular' 5957 5958 // Snow 5959 , id600: 'Neu feble' 5960 , id601: 'Neu' 5961 , id602: 'Neu forta' 5962 , id611: 'Aiguaneu' 5963 , id612: 'Ruixat de aguanieve' 5964 , id615: 'Pluja i neu febles' 5965 , id616: 'Pluja i neu' 5966 , id620: 'Ruixat de neu feble' 5967 , id621: 'Ruixat de neu' 5968 , id622: 'Ruixat de neu fort' 5969 5970 // Atmosphere 5971 , id701: 'Bruma' 5972 , id711: 'Fum' 5973 , id721: 'Boirina' 5974 , id731: 'Torbellinos de arena/polvo' 5975 , id741: 'Boira' 5976 , id751: 'Sorra' 5977 , id761: 'Pols' 5978 , id762: 'Cendra volcà nica' 5979 , id771: 'Tempestat' 5980 , id781: 'Tornado' 5981 5982 // Clouds 5983 , id800: 'Cel clar' 5984 , id801: 'Alguns núvols' 5985 , id802: 'Núvols dispersos' 5986 , id803: 'Intervals nuvolosos' 5987 , id804: 'Ennuvolat' 5988 5989 // Extreme 5990 , id900: 'Tornado' 5991 , id901: 'Tempesta tropical' 5992 , id902: 'Huracà ' 5993 , id903: 'Temperatures baixes' 5994 , id904: 'Temperatures altes' 5995 , id905: 'Ventós' 5996 , id906: 'Calabruix' 5997 5998 // Additional 5999 , id951: 'Calma' 6000 , id952: 'Brisa lleugera' 6001 , id953: 'Brisa suau' 6002 , id954: 'Brisa moderada' 6003 , id955: 'Brisa fresca' 6004 , id956: 'Brisa forta' 6005 , id957: 'Vent fort, pròxim a vendaval' 6006 , id958: 'Ventada' 6007 , id959: 'Ventada forta' 6008 , id960: 'Tempesta' 6009 , id961: 'Tempesta violenta' 6010 , id962: 'Huracà ' 6011 }, 6012 pt_br: { //brazillian translation 6013 owmlinktitle: 'Detalhes em OpenWeatherMap' 6014 , temperature: 'Temperatura' 6015 , temp_minmax: 'Temp. min/max' 6016 , wind: 'Vento' 6017 , gust: 'Rajadas' 6018 , windforce: 'Força do Vento' 6019 , direction: 'Direção' 6020 , rain_1h: 'Chuva' 6021 , humidity: 'Umidade' 6022 , pressure: 'Pressão' 6023 6024 // weather conditions, see https://openweathermap.org/weather-conditions 6025 , id200: 'Trovoadas com chuva fraca' 6026 , id201: 'Trovoadas com chuva' 6027 , id202: 'Trovoadas com chuva forte' 6028 , id210: 'Trovoadas leves' 6029 , id211: 'Trovoadas' 6030 , id212: 'Trovoadas fortes' 6031 , id221: 'Trovoadas irregulares' 6032 , id230: 'Trovoadas com garoa fraca' 6033 , id231: 'Trovoadas com garoa' 6034 , id232: 'Trovoadas com garoa forte' 6035 6036 , id300: 'Garoa de fraca intensidade' 6037 , id301: 'Garoa' 6038 , id302: 'Garoa de forte intensidade' 6039 , id310: 'Chuva com garoa de fraca intensidade' 6040 , id311: 'Chuva com garoa' 6041 , id312: 'Chuva com garoa de forte intensidade' 6042 , id321: 'Garoa persistente' 6043 6044 , id500: 'Chuva fraca' 6045 , id501: 'Chuva' 6046 , id502: 'Chuva forte' 6047 , id503: 'Chuva muito forte' 6048 , id504: 'Chuva extrema' 6049 , id511: 'Chuva de granizo' 6050 , id520: 'Aguaceiro de chuva fraco' 6051 , id521: 'Aguaceiro de chuva' 6052 , id522: 'Aguaceiro de chuva forte' 6053 6054 , id600: 'Neve fraca' 6055 , id601: 'Neve' 6056 , id602: 'Neve forte' 6057 , id611: 'Chuva com neve' 6058 , id621: 'Aguaceiro de neve' 6059 , id622: 'Aguaceiro de neve forte' 6060 6061 , id701: 'Névoa' 6062 , id711: 'Fumaça' 6063 , id721: 'Bruma' 6064 , id731: 'Redemoinhos de Areia/Poeira' 6065 , id741: 'Neblina' 6066 , id751: 'Areia' 6067 6068 , id800: 'Ceu está limpo' 6069 , id801: 'Poucas nuvens' 6070 , id802: 'Nuvens dispersas' 6071 , id803: 'Cirros' 6072 , id804: 'Nublado' 6073 6074 , id900: 'Tornado' 6075 , id901: 'Tempestade tropical' 6076 , id902: 'Furacão' 6077 , id903: 'Frio' 6078 , id904: 'Calor' 6079 , id905: 'Ventania' 6080 , id906: 'Granizo' 6081 } 6082 } 6083}; 6084 6085 6086/***/ }), 6087
vendor: 21,230 bytes, lines 6088-6741
6088/***/ "./node_modules/leaflet-pegman/leaflet-pegman.js": 6089/*!*******************************************************!*\ 6090 !*** ./node_modules/leaflet-pegman/leaflet-pegman.js ***! 6091 \*******************************************************/ 6092/*! no static exports found */ 6093/***/ (function(module, exports) { 6094 6095/** 6096 * leaflet-pegman 6097 * 6098 * @author Raruto 6099 * @license GPL-3.0+ 6100 * @link https://github.com/Raruto/leaflet-pegman 6101 * @desc Leaflet plugin that allows an easy integration with the Google StreetView Service API 6102 */ 6103L.Control.Pegman = L.Control.extend({ 6104 includes: L.Evented ? L.Evented.prototype : L.Mixin.Events, 6105 options: { 6106 position: 'bottomright', 6107 theme: "leaflet-pegman-v3-default", // or "leaflet-pegman-v3-small" 6108 debug: false, 6109 apiKey: '', 6110 libraries: '', 6111 mutant: { 6112 attribution: 'Map data: © <a href="https://www.google.com/intl/en/help/terms_maps.html">Google</a>', 6113 pane: "overlayPane", 6114 type: null, // Non-image map type (used to force a transparent background) 6115 }, 6116 pano: { 6117 enableCloseButton: true, 6118 fullscreenControl: false, 6119 imageDateControl: true 6120 }, 6121 marker: { 6122 draggable: true, 6123 icon: L.icon({ 6124 className: "pegman-marker", 6125 iconSize: [52, 52], 6126 iconAnchor: [24, 33], 6127 iconUrl: 'data:image/png;base64,' + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAFElEQVR4XgXAAQ0AAABAMP1L30IDCPwC/o5WcS4AAAAASUVORK5CYII=", 6128 }), 6129 } 6130 }, 6131 6132 __interactURL: 'https://unpkg.com/[email protected]/dist/interact.min.js', 6133 __gmapsURL: 'https://maps.googleapis.com/maps/api/js?v=3', 6134 __mutantURL: 'https://unpkg.com/[email protected]/Leaflet.GoogleMutant.js', 6135 6136 initialize: function(options) { 6137 6138 if (typeof options.logging !== "undefined") options.debug = options.logging; 6139 6140 L.Util.setOptions(this, options); 6141 6142 // Grab Left/Right/Up/Down Direction of Mouse for Pegman Image 6143 this._mousePos = { 6144 direction: {}, 6145 old: {}, 6146 }; 6147 6148 this._pegmanMarkerCoords = null; 6149 this._streetViewCoords = null; 6150 this._streetViewLayerEnabled = false; 6151 6152 this._dropzoneMapOpts = { 6153 accept: '.draggable', // Only Accept Elements Matching this CSS Selector 6154 overlap: 0.75, // Require a 75% Element Overlap for a Drop to be Possible 6155 ondropactivate: L.bind(this.onDropZoneActivated, this), 6156 ondragenter: L.bind(this.onDropZoneDragEntered, this), 6157 ondragleave: L.bind(this.onDropZoneDragLeaved, this), 6158 ondrop: L.bind(this.onDropZoneDropped, this), 6159 ondropdeactivate: L.bind(this.onDropZoneDeactivated, this), 6160 }; 6161 this._draggableMarkerOpts = { 6162 inertia: false, 6163 onmove: L.bind(this.onDraggableMove, this), 6164 onend: L.bind(this.onDraggableEnd, this), 6165 }; 6166 6167 this._lazyLoaderAdded = false; 6168 }, 6169 6170 onAdd: function(map) { 6171 this._map = map; 6172 6173 this._container = L.DomUtil.create('div', 'leaflet-pegman pegman-control leaflet-bar'); 6174 this._pegman = L.DomUtil.create('div', 'pegman draggable drag-drop', this._container); 6175 this._pegmanButton = L.DomUtil.create('div', 'pegman-button', this._container); 6176 this._pegmanMarker = L.marker([0, 0], this.options.marker); 6177 this._panoDiv = this.options.panoDiv ? document.querySelector(this.options.panoDiv) : L.DomUtil.create('div', '', this._map._container); 6178 6179 L.DomUtil.addClass(this._panoDiv, 'pano-canvas'); 6180 L.DomUtil.addClass(this._map._container, this.options.theme); 6181 6182 L.DomEvent.disableClickPropagation(this._panoDiv); 6183 // L.DomEvent.on(this._container, 'click mousedown touchstart dblclick', this._disableClickPropagation, this); 6184 L.DomEvent.on(this._container, 'click mousedown dblclick', this._disableClickPropagation, this); 6185 6186 this._container.addEventListener('touchstart', this._loadScripts.bind(this, !L.Browser.touch), { once: true }); 6187 this._container.addEventListener('mousedown', this._loadScripts.bind(this, true), { once: true }); 6188 this._container.addEventListener('mouseover', this._loadScripts.bind(this, false), { once: true }); 6189 6190 this._loadInteractHandlers(); 6191 this._loadGoogleHandlers(); 6192 6193 L.DomEvent.on(document, 'mousemove', this.mouseMoveTracking, this); 6194 L.DomEvent.on(document, 'keyup', this.keyUpTracking, this); 6195 6196 this._pegmanMarker.on("dragend", this.onPegmanMarkerDragged, this); 6197 this._map.on("click", this.onMapClick, this); 6198 this._map.on("layeradd", this.onMapLayerAdd, this); 6199 6200 return this._container; 6201 }, 6202 6203 onRemove: function(map) { 6204 if (this._googleStreetViewLayer) this._googleStreetViewLayer.remove(); 6205 if (this._pegmanMarker) this._pegmanMarker.remove(); 6206 6207 L.DomUtil.remove(this._panoDiv); 6208 6209 L.DomEvent.off(document, 'mousemove', this.mouseMoveTracking, this); 6210 L.DomEvent.off(document, 'keyup', this.keyUpTracking, this); 6211 6212 map.off("mousemove", this._setMouseCursor, this); 6213 }, 6214 6215 _log: function(args) { 6216 if (this.options.debug) { 6217 console.log(args); 6218 } 6219 }, 6220 6221 _addClasses: function(el, classNames) { 6222 classNames = classNames.split(" "); 6223 for (var s in classNames) { 6224 L.DomUtil.addClass(el, classNames[s]); 6225 } 6226 }, 6227 6228 _removeClasses: function(el, classNames) { 6229 classNames = classNames.split(" "); 6230 for (var s in classNames) { 6231 L.DomUtil.removeClass(el, classNames[s]); 6232 } 6233 }, 6234 6235 _removeAttributes: function(el, attrNames) { 6236 for (var a in attrNames) { 6237 el.removeAttribute(attrNames[a]); 6238 } 6239 }, 6240 6241 _insertAfter: function(targetNode, newNode) { 6242 targetNode.parentNode.insertBefore(newNode, targetNode.nextSibling); 6243 }, 6244 6245 _translateElement: function(el, dx, dy) { 6246 if (dx === false && dy === false) { 6247 this._removeAttributes(this._pegman, ["style", "data-x", "data-y"]); 6248 } 6249 // Element's position is preserved within the data-x/data-y attributes 6250 var x = (parseFloat(el.getAttribute('data-x')) || 0) + dx; 6251 var y = (parseFloat(el.getAttribute('data-y')) || 0) + dy; 6252 6253 // Translate element 6254 el.style.webkitTransform = el.style.transform = 'translate(' + x + 'px, ' + y + 'px)'; 6255 6256 // Update position attributes 6257 el.setAttribute('data-x', x); 6258 el.setAttribute('data-y', y); 6259 }, 6260 6261 _updateClasses: function(action) { 6262 switch (action) { 6263 case "pegman-dragging": 6264 this._removeClasses(this._pegman, "dropped"); 6265 this._addClasses(this._container, "dragging"); 6266 break; 6267 case "pegman-dragged": 6268 this._removeClasses(this._pegman, "can-drop dragged left right active dropped"); 6269 this._removeAttributes(this._pegman, ["style", "data-x", "data-y"]); 6270 break; 6271 case "dropzone-actived": 6272 this._addClasses(this._map._container, "drop-active"); 6273 break; 6274 case "dropzone-drag-entered": 6275 this._addClasses(this._pegman, "active can-drop"); 6276 this._addClasses(this._map._container, "drop-target"); 6277 break; 6278 case "dropzone-drag-leaved": 6279 this._removeClasses(this._map._container, "drop-target"); 6280 this._removeClasses(this._pegman, "can-drop"); 6281 break; 6282 case "dropzone-drop": 6283 this._removeClasses(this._container, "dragging"); 6284 this._removeClasses(this._pegman, "active left right"); 6285 this._addClasses(this._pegman, "dropped"); 6286 this._removeClasses(this._pegman, "can-drop dragged left right active dropped"); 6287 break; 6288 case "dropzone-deactivated": 6289 this._removeClasses(this._pegman, "active left right"); 6290 this._removeClasses(this._map._container, "drop-active drop-target"); 6291 break; 6292 case "mousemove-top": 6293 this._addClasses(this._pegman, "top"); 6294 this._removeClasses(this._pegman, "bottom right left"); 6295 break; 6296 case "mousemove-bottom": 6297 this._addClasses(this._pegman, "bottom"); 6298 this._removeClasses(this._pegman, "top right left"); 6299 break; 6300 case "mousemove-left": 6301 this._addClasses(this._pegman, "left"); 6302 this._removeClasses(this._pegman, "right top bottom"); 6303 break; 6304 case "mousemove-right": 6305 this._addClasses(this._pegman, "right"); 6306 this._removeClasses(this._pegman, "left top bottom"); 6307 break; 6308 case "pegman-added": 6309 this._addClasses(this._container, "active"); 6310 break; 6311 case "pegman-removed": 6312 this._removeClasses(this._container, "active"); 6313 break; 6314 case "streetview-shown": 6315 this._addClasses(this._container, "streetview-layer-active"); 6316 break; 6317 case "streetview-hidden": 6318 this._removeClasses(this._container, "streetview-layer-active"); 6319 break; 6320 default: 6321 throw "Unhandled event:" + action; 6322 } 6323 this.fire("svpc_" + action); 6324 }, 6325 6326 onDraggableMove: function(e) { 6327 this.mouseMoveTracking(e); 6328 this.pegmanRemove(); 6329 this._updateClasses("pegman-dragging"); 6330 this._translateElement(this._pegman, e.dx, e.dy); 6331 }, 6332 6333 onDraggableEnd: function(e) { 6334 this._pegmanMarkerCoords = this._map.mouseEventToLatLng(e); 6335 this.pegmanAdd(); 6336 this.findStreetViewData(this._pegmanMarkerCoords.lat, this._pegmanMarkerCoords.lng); 6337 this._updateClasses("pegman-dragged"); 6338 }, 6339 6340 onDropZoneActivated: function(e) { 6341 this._updateClasses("dropzone-actived"); 6342 }, 6343 6344 onDropZoneDragEntered: function(e) { 6345 this.showStreetViewLayer(); 6346 this._updateClasses("dropzone-drag-entered"); 6347 }, 6348 6349 onDropZoneDragLeaved: function(e) { 6350 this._updateClasses("dropzone-drag-leaved"); 6351 }, 6352 6353 onDropZoneDropped: function(e) { 6354 this._updateClasses("dropzone-drop"); 6355 this._translateElement(this._pegman, false, false); 6356 }, 6357 6358 onDropZoneDeactivated: function(e) { 6359 this._updateClasses("dropzone-deactivated"); 6360 }, 6361 6362 onPegmanMarkerDragged: function(e) { 6363 this._pegmanMarkerCoords = this._pegmanMarker.getLatLng(); 6364 this.findStreetViewData(this._pegmanMarkerCoords.lat, this._pegmanMarkerCoords.lng); 6365 }, 6366 6367 onMapClick: function(e) { 6368 if (this._streetViewLayerEnabled) { 6369 this.findStreetViewData(e.latlng.lat, e.latlng.lng); 6370 } 6371 }, 6372 6373 onMapLayerAdd: function(e) { 6374 if (this._googleStreetViewLayer) 6375 this._googleStreetViewLayer.bringToFront(); 6376 }, 6377 6378 onStreetViewPanoramaClose: function() { 6379 this.clear(); 6380 }, 6381 6382 onPanoramaPositionChanged: function() { 6383 var pos = this._panorama.getPosition(); 6384 pos = L.latLng(pos.lat(), pos.lng()); 6385 if (this._map && !this._map.getBounds().pad(-0.05).contains(pos)) { 6386 this._map.panTo(pos); 6387 } 6388 this._pegmanMarker.setLatLng(pos); 6389 }, 6390 6391 onPanoramaPovChanged: function() { 6392 var pov = this._panorama.getPov(); 6393 this._pegmanMarker.getElement().style.backgroundPosition = "0 " + -Math.abs((Math.round(pov.heading / (360 / 16)) % 16) * Math.round(835 / 16)) + 'px'; // sprite_height = 835px; num_rows = 16; pegman_angle = [0, 360] deg 6394 }, 6395 6396 clear: function() { 6397 this.pegmanRemove(); 6398 this.hideStreetViewLayer(); 6399 this.closeStreetViewPanorama(); 6400 }, 6401 6402 toggleStreetViewLayer: function(e) { 6403 if (this._streetViewLayerEnabled) this.clear(); 6404 else this.showStreetViewLayer(); 6405 this._log("streetview-layer-toggled"); 6406 }, 6407 6408 pegmanAdd: function() { 6409 this._pegmanMarker.addTo(this._map); 6410 this._pegmanMarker.setLatLng(this._pegmanMarkerCoords); 6411 this.findStreetViewData(this._pegmanMarkerCoords.lat, this._pegmanMarkerCoords.lng); 6412 this._updateClasses("pegman-added"); 6413 }, 6414 6415 pegmanRemove: function() { 6416 this._pegmanMarker.removeFrom(this._map); 6417 this._updateClasses("pegman-removed"); 6418 }, 6419 6420 closeStreetViewPanorama: function() { 6421 this._panoDiv.style.display = "none"; 6422 }, 6423 6424 openStreetViewPanorama: function() { 6425 this._panoDiv.style.display = "block"; 6426 }, 6427 6428 hideStreetViewLayer: function() { 6429 if (this._googleStreetViewLayer) { 6430 this._googleStreetViewLayer.removeFrom(this._map); 6431 this._streetViewLayerEnabled = false; 6432 this._updateClasses("streetview-hidden"); 6433 } 6434 }, 6435 6436 showStreetViewLayer: function() { 6437 if (this._googleStreetViewLayer) { 6438 this._googleStreetViewLayer.addTo(this._map); 6439 this._streetViewLayerEnabled = true; 6440 this._updateClasses("streetview-shown"); 6441 } 6442 }, 6443 6444 findStreetViewData: function(lat, lng) { 6445 if (typeof google === 'undefined') { 6446 this._loadScripts(true) 6447 return this.once('svpc_streetview-shown', L.bind(this.findStreetViewData, this, lat, lng)); 6448 } 6449 6450 if (!this._pegmanMarker._map && this._map) { 6451 this._pegmanMarkerCoords = L.latLng(lat, lng); 6452 return this.pegmanAdd(); 6453 } 6454 6455 // var searchRadiusPx = 24, 6456 // latlng = L.latLng(lat, lng), 6457 // p = this._map.project(latlng).add([searchRadiusPx, 0]), 6458 // searchRadius = latlng.distanceTo(this._map.unproject(p)); 6459 6460 this._streetViewCoords = new google.maps.LatLng(lat, lng); 6461 6462 var zoom = this._map.getZoom(); 6463 var searchRadius = 100; 6464 6465 if (zoom < 6) searchRadius = 5000; 6466 else if (zoom < 10) searchRadius = 500; 6467 else if (zoom < 15) searchRadius = 250; 6468 else if (zoom >= 17) searchRadius = 50; 6469 else searchRadius = 100; 6470 6471 this._streetViewService.getPanoramaByLocation(this._streetViewCoords, searchRadius, L.bind(this.processStreetViewServiceData, this)); 6472 }, 6473 6474 processStreetViewServiceData: function(data, status) { 6475 if (status == google.maps.StreetViewStatus.OK) { 6476 this.openStreetViewPanorama(); 6477 this._panorama.setPano(data.location.pano); 6478 this._panorama.setPov({ 6479 heading: google.maps.geometry.spherical.computeHeading(data.location.latLng, this._streetViewCoords), 6480 pitch: 0, 6481 zoom: 0 6482 }); 6483 this._panorama.setVisible(true); 6484 } else { 6485 console.warn("Street View data not found for this location."); 6486 // this.clear(); // TODO: add a visual feedback when no SV data available 6487 } 6488 }, 6489 6490 /** 6491 * mouseMoveTracking 6492 * @desc internal function used to style pegman while dragging 6493 */ 6494 mouseMoveTracking: function(e) { 6495 var mousePos = this._mousePos; 6496 6497 // Top <--> Bottom 6498 if (e.pageY < mousePos.old.y) { 6499 mousePos.direction.y = 'top'; 6500 this._updateClasses("mousemove-top"); 6501 } else if (e.pageY > mousePos.old.y) { 6502 mousePos.direction.y = 'bottom'; 6503 this._updateClasses("mousemove-bottom"); 6504 } 6505 // Left <--> Right 6506 if (e.pageX < mousePos.old.x) { 6507 mousePos.direction.x = 'left'; 6508 this._updateClasses("mousemove-left"); 6509 } else if (e.pageX > mousePos.old.x) { 6510 mousePos.direction.x = 'right'; 6511 this._updateClasses("mousemove-right"); 6512 } 6513 6514 mousePos.old.x = e.pageX; 6515 mousePos.old.y = e.pageY; 6516 }, 6517 6518 /** 6519 * keyUpTracking 6520 * @desc internal function used to track keyup events 6521 */ 6522 keyUpTracking: function(e) { 6523 if (e.keyCode == 27) { 6524 this._log('escape pressed'); 6525 this.clear(); 6526 } 6527 }, 6528 6529 _disableClickPropagation: function(e) { 6530 L.DomEvent.stopPropagation(e); 6531 L.DomEvent.preventDefault(e); 6532 }, 6533 6534 _loadGoogleHandlers: function(toggleStreetView) { 6535 if (typeof google !== 'object' || typeof google.maps !== 'object' || typeof L.GridLayer.GoogleMutant !== 'function') return; 6536 this._initGoogleMaps(toggleStreetView); 6537 this._initMouseTracker(); 6538 }, 6539 6540 _initGoogleMaps: function(toggleStreetView) { 6541 this._googleStreetViewLayer = L.gridLayer.googleMutant(this.options.mutant); 6542 this._googleStreetViewLayer.addGoogleLayer('StreetViewCoverageLayer'); 6543 6544 this._panorama = new google.maps.StreetViewPanorama(this._panoDiv, this.options.pano); 6545 this._streetViewService = new google.maps.StreetViewService(); 6546 6547 this._panorama.addListener('closeclick', L.bind(this.onStreetViewPanoramaClose, this)); 6548 this._panorama.addListener('position_changed', L.bind(this.onPanoramaPositionChanged, this)); 6549 this._panorama.addListener('pov_changed', L.bind(this.onPanoramaPovChanged, this)); 6550 6551 if (toggleStreetView) { 6552 this.showStreetViewLayer(); 6553 } 6554 }, 6555 6556 _initMouseTracker: function() { 6557 if (!this._googleStreetViewLayer) return; 6558 6559 var tileSize = this._googleStreetViewLayer.getTileSize(); 6560 6561 this.tileWidth = tileSize.x; 6562 this.tileHeight = tileSize.y; 6563 6564 this.defaultDraggableCursor = this._map._container.style.cursor; 6565 6566 this._map.on("mousemove", this._setMouseCursor, this); 6567 }, 6568 6569 _setMouseCursor: function(e) { 6570 var coords = this._getTileCoords(e.latlng.lat, e.latlng.lng, this._map.getZoom()); 6571 var img = this._getTileImage(coords); 6572 var pixel = this._getTilePixelPoint(img, e.originalEvent); 6573 var hasTileData = this._hasTileData(img, pixel); 6574 this._map._container.style.cursor = hasTileData ? 'pointer' : this.defaultDraggableCursor; 6575 }, 6576 6577 _getTileCoords: function(lat, lon, zoom) { 6578 var xtile = parseInt(Math.floor((lon + 180) / 360 * (1 << zoom))); 6579 var ytile = parseInt(Math.floor((1 - Math.log(Math.tan(this._toRad(lat)) + 1 / Math.cos(this._toRad(lat))) / Math.PI) / 2 * (1 << zoom))); 6580 return { 6581 x: xtile, 6582 y: ytile, 6583 z: zoom, 6584 }; 6585 }, 6586 6587 _getTileImage: function(coords) { 6588 if (!this._googleStreetViewLayer || !this._googleStreetViewLayer._tiles) return; 6589 var key = this._googleStreetViewLayer._tileCoordsToKey(coords); 6590 var tile = this._googleStreetViewLayer._tiles[key]; 6591 if (!tile) return; 6592 var img = tile.el.querySelector('img'); 6593 if (!img) return; 6594 this._downloadTile(img.src, this._tileLoaded); // crossOrigin = "Anonymous" 6595 return img; 6596 }, 6597 6598 _getTilePixelPoint: function(img, e) { 6599 if (!img) return; 6600 var imgRect = img.getBoundingClientRect(); 6601 var imgPos = { 6602 pageY: (imgRect.top + window.scrollY).toFixed(0), 6603 pageX: (imgRect.left + window.scrollX).toFixed(0) 6604 }; 6605 var mousePos = { 6606 x: e.pageX - imgPos.pageX, 6607 y: e.pageY - imgPos.pageY 6608 }; 6609 return mousePos; 6610 }, 6611 6612 _hasTileData: function(img, pixelPoint) { 6613 if (!this.tileContext || !pixelPoint) return; 6614 var pixelData = this.tileContext.getImageData(pixelPoint.x, pixelPoint.y, 1, 1).data; 6615 var alpha = pixelData[3]; 6616 var hasTileData = (alpha != 0); 6617 return hasTileData; 6618 }, 6619 6620 _toRad: function(number) { 6621 return number * Math.PI / 180; 6622 }, 6623 6624 _downloadTile: function(imageSrc, callback) { 6625 if (!imageSrc) return; 6626 var img = new Image(); 6627 img.crossOrigin = "Anonymous"; 6628 img.addEventListener("load", callback.bind(this, img), false); 6629 img.src = imageSrc; 6630 }, 6631 6632 _tileLoaded: function(img) { 6633 this.tileCanvas = document.createElement("canvas"); 6634 this.tileContext = this.tileCanvas.getContext("2d"); 6635 6636 this.tileCanvas.width = this.tileWidth; 6637 this.tileCanvas.height = this.tileHeight; 6638 6639 this.tileContext.drawImage(img, 0, 0); 6640 }, 6641 6642 _loadInteractHandlers: function() { 6643 // TODO: trying to replace "interact.js" with default "L.Draggable" object 6644 // var draggable = new L.Draggable(this._container); 6645 // draggable.enable(); 6646 // draggable.on('drag', function(e) { console.log(e); }); 6647 if (typeof interact !== 'function') return; 6648 6649 // Enable Draggable Element to be Dropped into Map Container 6650 this._draggable = interact(this._pegman).draggable(this._draggableMarkerOpts); 6651 this._dropzone = interact(this._map._container).dropzone(this._dropzoneMapOpts); 6652 6653 this._draggable.styleCursor(false); 6654 6655 // Toggle on/off SV Layer on Pegman's Container single clicks 6656 interact(this._container).on("tap", L.bind(this.toggleStreetViewLayer, this)); 6657 6658 // Prevent map drags (Desktop / Mobile) while dragging pegman control 6659 L.DomEvent.on(this._container, "touchstart", function(e) { this._map.dragging.disable(); }, this); 6660 L.DomEvent.on(this._container, "touchend", function(e) { this._map.dragging.enable(); }, this); 6661 }, 6662 6663 _loadScripts: function(toggleStreetView) { 6664 if (this._lazyLoaderAdded) return; 6665 this._lazyLoaderAdded = true; 6666 6667 this._loadJS(this.__interactURL, this._loadInteractHandlers.bind(this), typeof interact !== 'function'); 6668 this._loadJS(this.__gmapsURL + '&key=' + this.options.apiKey + '&libraries=' + this.options.libraries + '&callback=?', this._loadGoogleHandlers.bind(this, toggleStreetView), typeof google !== 'object' || typeof google.maps !== 'object'); 6669 this._loadJS(this.__mutantURL, this._loadGoogleHandlers.bind(this, toggleStreetView), typeof L.GridLayer.GoogleMutant !== 'function'); 6670 6671 }, 6672 6673 _loadJS: function(url, callback, condition) { 6674 if (!condition) { 6675 callback(); 6676 return; 6677 } 6678 if (url.indexOf('callback=?') !== -1) { 6679 this._jsonp(url, callback); 6680 } else { 6681 var script = document.createElement('script'); 6682 script.src = url; 6683 var loaded = function() { 6684 script.onload = script.onreadystatechange = null; 6685 this._log(url + " loaded"); 6686 callback(); 6687 }.bind(this); 6688 script.onload = script.onreadystatechange = loaded; 6689 6690 var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement; 6691 head.insertBefore(script, head.firstChild); 6692 } 6693 }, 6694 6695 _jsonp: function(url, callback, params) { 6696 var query = url.indexOf('?') === -1 ? '?' : '&'; 6697 params = params || {}; 6698 for (var key in params) { 6699 if (params.hasOwnProperty(key)) { 6700 query += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'; 6701 } 6702 } 6703 6704 var timestamp = new Date().getUTCMilliseconds(); 6705 var jsonp = "json_call_" + timestamp; // uniqueId('json_call'); 6706 window[jsonp] = function(data) { 6707 callback(data); 6708 window[jsonp] = undefined; 6709 }; 6710 6711 var script = document.createElement('script'); 6712 if (url.indexOf('callback=?') !== -1) { 6713 script.src = url.replace('callback=?', 'callback=' + jsonp) + query.slice(0, -1); 6714 } else { 6715 script.src = url + query + 'callback=' + jsonp; 6716 } 6717 var loaded = function() { 6718 if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') { 6719 script.onload = script.onreadystatechange = null; 6720 if (script && script.parentNode) { 6721 script.parentNode.removeChild(script); 6722 } 6723 } 6724 }; 6725 script.async = true; 6726 script.onload = script.onreadystatechange = loaded; 6727 var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement; 6728 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 6729 // This arises when a base node is used. 6730 head.insertBefore(script, head.firstChild); 6731 }, 6732 6733}); 6734 6735L.control.pegman = function(options) { 6736 return new L.Control.Pegman(options); 6737}; 6738 6739 6740/***/ }), 6741
vendor: 17,491 bytes, lines 6742-7273
6742/***/ "./node_modules/leaflet.gridlayer.googlemutant/Leaflet.GoogleMutant.js": 6743/*!*****************************************************************************!*\ 6744 !*** ./node_modules/leaflet.gridlayer.googlemutant/Leaflet.GoogleMutant.js ***! 6745 \*****************************************************************************/ 6746/*! no static exports found */ 6747/***/ (function(module, exports) { 6748 6749// Based on https://github.com/shramov/leaflet-plugins 6750// GridLayer like https://avinmathew.com/leaflet-and-google-maps/ , but using MutationObserver instead of jQuery 6751 6752 6753// ðclass GridLayer.GoogleMutant 6754// ðextends GridLayer 6755L.GridLayer.GoogleMutant = L.GridLayer.extend({ 6756 options: { 6757 minZoom: 0, 6758 maxZoom: 21, // can be 23, but ugly if more than maxNativeZoom 6759 tileSize: 256, 6760 subdomains: 'abc', 6761 errorTileUrl: '', 6762 attribution: '', // The mutant container will add its own attribution anyways. 6763 opacity: 1, 6764 continuousWorld: false, 6765 noWrap: false, 6766 // ðoption type: String = 'roadmap' 6767 // Google's map type. Valid values are 'roadmap', 'satellite' or 'terrain'. 'hybrid' is not really supported. 6768 type: 'roadmap', 6769 maxNativeZoom: 21 6770 }, 6771 6772 initialize: function (options) { 6773 L.GridLayer.prototype.initialize.call(this, options); 6774 6775 this._ready = !!window.google && !!window.google.maps && !!window.google.maps.Map; 6776 this._isMounted = true; 6777 6778 this._GAPIPromise = this._ready ? Promise.resolve(window.google) : new Promise(function (resolve, reject) { 6779 var checkCounter = 0, 6780 intervalId = null; 6781 6782 intervalId = setInterval(function () { 6783 if (checkCounter >= 10) { 6784 clearInterval(intervalId); 6785 return reject(new Error('window.google not found after 10 attempts')); 6786 } 6787 if (!!window.google && !!window.google.maps && !!window.google.maps.Map) { 6788 clearInterval(intervalId); 6789 return resolve(window.google); 6790 } 6791 ++checkCounter; 6792 }, 500); 6793 }); 6794 6795 this.once('spawned', function () { 6796 if (this._subLayers) { 6797 //restore previously added google layers 6798 for (var layerName in this._subLayers) { 6799 this._subLayers[layerName].setMap(this._mutant); 6800 } 6801 } 6802 }); 6803 6804 // Couple data structures indexed by tile key 6805 this._tileCallbacks = {}; // Callbacks for promises for tiles that are expected 6806 this._freshTiles = {}; // Tiles from the mutant which haven't been requested yet 6807 6808 this._imagesPerTile = (this.options.type === 'hybrid') ? 2 : 1; 6809 6810 this._boundOnMutatedImage = this._onMutatedImage.bind(this); 6811 }, 6812 6813 onAdd: function (map) { 6814 L.GridLayer.prototype.onAdd.call(this, map); 6815 this._initMutantContainer(); 6816 6817 this._GAPIPromise.then(function () { 6818 if (!this._isMounted) { 6819 return; 6820 } 6821 this._ready = true; 6822 6823 this._initMutant(); 6824 6825 map = this._map; 6826 if (!map) { return; } 6827 var moveevent = this.options.updateWhenIdle ? 'moveend' : 'move'; 6828 map.on(moveevent, this._update, this); 6829 this.once('remove', function () { 6830 this._map.off(moveevent,this._update, this); 6831 }); 6832 //handle layer being added to a map for which there are no Google tiles at the given zoom 6833 google.maps.event.addListenerOnce(this._mutant, 'idle', function () { 6834 if (!this._map) { return; } 6835 this._checkZoomLevels(); 6836 this._mutantIsReady = true; 6837 }.bind(this)); 6838 6839 this._update(); 6840 6841 }.bind(this)); 6842 6843 //20px instead of 1em to avoid a slight overlap with google's attribution 6844 map._controlCorners.bottomright.style.marginBottom = '20px'; 6845 map._controlCorners.bottomleft.style.marginBottom = '20px'; 6846 }, 6847 6848 onRemove: function (map) { 6849 L.GridLayer.prototype.onRemove.call(this, map); 6850 this._observer.disconnect(); 6851 map._container.removeChild(this._mutantContainer); 6852 map._controlContainer.removeChild(this._attributesContainer); 6853 6854 google.maps.event.clearListeners(map, 'idle'); 6855 if (this._mutant) { 6856 google.maps.event.clearListeners(this._mutant, 'idle'); 6857 } 6858 map.off('viewreset', this._reset, this); 6859 map.off('move', this._update, this); 6860 map.off('moveend', this._update, this); 6861 map.off('zoomend', this._handleZoomAnim, this); 6862 map.off('resize', this._resize, this); 6863 6864 if (map._controlCorners) { 6865 map._controlCorners.bottomright.style.marginBottom = 0; 6866 map._controlCorners.bottomleft.style.marginBottom = 0; 6867 } 6868 this._isMounted = false; 6869 }, 6870 6871 // @method addGoogleLayer(name: String, options?: Object): this 6872 // Adds layer with the given name and options to the google Map instance. 6873 // `name`: one of the google maps API layers, with it's constructor available in `google.maps` object. 6874 // currently following values supported: 'TrafficLayer', 'TransitLayer', 'BicyclingLayer'. 6875 // `options`: see https://developers.google.com/maps/documentation/javascript/reference/map 6876 addGoogleLayer: function (googleLayerName, options) { 6877 if (!this._subLayers) this._subLayers = {}; 6878 this._GAPIPromise.then(function () { 6879 var Constructor = google.maps[googleLayerName]; 6880 var googleLayer = new Constructor(options); 6881 if (this._mutant) { googleLayer.setMap(this._mutant); } // otherwise it will be added on 'spawned' 6882 this._subLayers[googleLayerName] = googleLayer; 6883 }.bind(this)); 6884 return this; 6885 }, 6886 6887 // @method removeGoogleLayer(name: String): this 6888 // Removes layer with the given name from the google Map instance. 6889 removeGoogleLayer: function (googleLayerName) { 6890 this._GAPIPromise.then(function () { 6891 var googleLayer = this._subLayers && this._subLayers[googleLayerName]; 6892 if (googleLayer) { 6893 googleLayer.setMap(null); 6894 delete this._subLayers[googleLayerName]; 6895 } 6896 }.bind(this)); 6897 return this; 6898 }, 6899 6900 _initMutantContainer: function () { 6901 if (!this._mutantContainer) { 6902 this._attributesContainer = L.DomUtil.create('div', 'mutant-attr-container'); 6903 this._mutantContainer = L.DomUtil.create('div', 'leaflet-google-mutant leaflet-top leaflet-left'); 6904 this._mutantContainer.id = '_MutantContainer_' + L.Util.stamp(this._mutantContainer); 6905 this._mutantContainer.style.zIndex = 800; //leaflet map pane at 400, controls at 1000 6906 this._mutantContainer.style.pointerEvents = 'none'; 6907 6908 L.DomEvent.off(this._mutantContainer); 6909 6910 } 6911 this._map.getContainer().appendChild(this._mutantContainer); 6912 this._map._controlContainer.appendChild(this._attributesContainer); 6913 6914 this.setOpacity(this.options.opacity); 6915 var style = this._mutantContainer.style; 6916 style.width = '100%'; 6917 style.height = '100%'; 6918 style.zIndex = -1; 6919 6920 this._attachObserver(this._mutantContainer); 6921 }, 6922 6923 _initMutant: function () { 6924 if (this._mutant) { 6925 // reuse old _mutant, just make sure it has the correct size 6926 return; 6927 } 6928 6929 var map = new google.maps.Map(this._mutantContainer, { 6930 center: {lat: 0, lng: 0}, 6931 zoom: 0, 6932 tilt: 0, 6933 mapTypeId: this.options.type, 6934 disableDefaultUI: true, 6935 keyboardShortcuts: false, 6936 draggable: false, 6937 disableDoubleClickZoom: true, 6938 scrollwheel: false, 6939 streetViewControl: false, 6940 styles: this.options.styles || {}, 6941 backgroundColor: 'transparent' 6942 }); 6943 6944 this._mutant = map; 6945 6946 google.maps.event.addListenerOnce(map, 'idle', function () { 6947 var nodes = this._mutantContainer.querySelectorAll('a'); 6948 for (var i = 0; i < nodes.length; ++i) { 6949 nodes[i].style.pointerEvents = 'auto'; 6950 } 6951 }.bind(this)); 6952 6953 // ðevent spawned 6954 // Fired when the mutant has been created. 6955 this.fire('spawned', {mapObject: map}); 6956 }, 6957 6958 _attachObserver: function _attachObserver (node) { 6959// console.log('Gonna observe', node); 6960 6961 if (!this._observer) 6962 this._observer = new MutationObserver(this._onMutations.bind(this)); 6963 6964 // pass in the target node, as well as the observer options 6965 this._observer.observe(node, { childList: true, subtree: true }); 6966 6967 // if we are reusing an old _mutantContainer, we must manually detect 6968 // all existing tiles in it 6969 Array.prototype.forEach.call( 6970 node.querySelectorAll('img'), 6971 this._boundOnMutatedImage 6972 ); 6973 }, 6974 6975 _onMutations: function _onMutations (mutations) { 6976 for (var i = 0; i < mutations.length; ++i) { 6977 var mutation = mutations[i]; 6978 for (var j = 0; j < mutation.addedNodes.length; ++j) { 6979 var node = mutation.addedNodes[j]; 6980 6981 if (node instanceof HTMLImageElement) { 6982 this._onMutatedImage(node); 6983 } else if (node instanceof HTMLElement) { 6984 Array.prototype.forEach.call( 6985 node.querySelectorAll('img'), 6986 this._boundOnMutatedImage 6987 ); 6988 6989 // Check for, and remove, the "Google Maps can't load correctly" div. 6990 // You *are* loading correctly, you dumbwit. 6991 if (node.style.backgroundColor === 'white') { 6992 L.DomUtil.remove(node); 6993 } 6994 6995 // Check for, and remove, the "For development purposes only" divs on the aerial/hybrid tiles. 6996 if (node.textContent.indexOf('For development purposes only') === 0) { 6997 L.DomUtil.remove(node); 6998 } 6999 7000 // Check for, and remove, the "Sorry, we have no imagery here" 7001 // empty <div>s. The [style*="text-align: center"] selector 7002 // avoids matching the attribution notice. 7003 // This empty div doesn't have a reference to the tile 7004 // coordinates, so it's not possible to mark the tile as 7005 // failed. 7006 Array.prototype.forEach.call( 7007 node.querySelectorAll('div[draggable=false][style*="text-align: center"]'), 7008 L.DomUtil.remove 7009 ); 7010 7011 // Move Google attributes to leaflet's control container 7012 if ( 7013 node.querySelectorAll('.gmnoprint').length > 0 || 7014 node.querySelectorAll('a[title="Click to see this area on Google Maps"]').length > 0 7015 ) { 7016 this._attributesContainer.appendChild(node); 7017 } 7018 } 7019 } 7020 } 7021 }, 7022 7023 // Only images which 'src' attrib match this will be considered for moving around. 7024 // Looks like some kind of string-based protobuf, maybe?? 7025 // Only the roads (and terrain, and vector-based stuff) match this pattern 7026 _roadRegexp: /!1i(\d+)!2i(\d+)!3i(\d+)!/, 7027 7028 // On the other hand, raster imagery matches this other pattern 7029 _satRegexp: /x=(\d+)&y=(\d+)&z=(\d+)/, 7030 7031 // On small viewports, when zooming in/out, a static image is requested 7032 // This will not be moved around, just removed from the DOM. 7033 _staticRegExp: /StaticMapService\.GetMapImage/, 7034 7035 _onMutatedImage: function _onMutatedImage (imgNode) { 7036// if (imgNode.src) { 7037// console.log('caught mutated image: ', imgNode.src); 7038// } 7039 7040 var coords, 7041 match = imgNode.src.match(this._roadRegexp), 7042 sublayer = 0; 7043 7044 if (match) { 7045 coords = { 7046 z: match[1], 7047 x: match[2], 7048 y: match[3] 7049 }; 7050 if (this._imagesPerTile > 1) { 7051 imgNode.style.zIndex = 1; 7052 sublayer = 1; 7053 } 7054 } else { 7055 match = imgNode.src.match(this._satRegexp); 7056 if (match) { 7057 coords = { 7058 x: match[1], 7059 y: match[2], 7060 z: match[3] 7061 }; 7062 } 7063// imgNode.style.zIndex = 0; 7064 sublayer = 0; 7065 } 7066 7067 if (coords) { 7068 var tileKey = this._tileCoordsToKey(coords); 7069 imgNode.style.position = 'absolute'; 7070 imgNode.style.visibility = 'hidden'; 7071 7072 var key = tileKey + '/' + sublayer; 7073 // console.log('mutation for tile', key) 7074 //store img so it can also be used in subsequent tile requests 7075 this._freshTiles[key] = imgNode; 7076 7077 if (key in this._tileCallbacks && this._tileCallbacks[key]) { 7078// console.log('Fullfilling callback ', key); 7079 //fullfill most recent tileCallback because there maybe callbacks that will never get a 7080 //corresponding mutation (because map moved to quickly...) 7081 this._tileCallbacks[key].pop()(imgNode); 7082 if (!this._tileCallbacks[key].length) { delete this._tileCallbacks[key]; } 7083 } else { 7084 if (this._tiles[tileKey]) { 7085 //we already have a tile in this position (mutation is probably a google layer being added) 7086 //replace it 7087 var c = this._tiles[tileKey].el, 7088 oldImg = (sublayer === 0) ? c.firstChild : c.firstChild.nextSibling, 7089 cloneImgNode = this._clone(imgNode); 7090 7091 c.replaceChild(cloneImgNode, oldImg); 7092 } 7093 } 7094 } else if (imgNode.src.match(this._staticRegExp)) { 7095 imgNode.style.visibility = 'hidden'; 7096 } 7097 }, 7098 7099 7100 createTile: function (coords, done) { 7101 var key = this._tileCoordsToKey(coords), 7102 tileContainer = L.DomUtil.create('div'); 7103 7104 tileContainer.dataset.pending = this._imagesPerTile; 7105 done = done.bind(this, null, tileContainer); 7106 7107 for (var i = 0; i < this._imagesPerTile; ++i) { 7108 var key2 = key + '/' + i; 7109 if (key2 in this._freshTiles) { 7110 var imgNode = this._freshTiles[key2]; 7111 tileContainer.appendChild(this._clone(imgNode)); 7112 --tileContainer.dataset.pending; 7113// console.log('Got ', key2, ' from _freshTiles'); 7114 } else { 7115 this._tileCallbacks[key2] = this._tileCallbacks[key2] || []; 7116 this._tileCallbacks[key2].push( (function (c/*, k2*/) { 7117 return function (imgNode) { 7118 c.appendChild(this._clone(imgNode)); 7119 --c.dataset.pending; 7120 if (!parseInt(c.dataset.pending)) { done(); } 7121// console.log('Sent ', k2, ' to _tileCallbacks, still ', c.dataset.pending, ' images to go'); 7122 }.bind(this); 7123 }.bind(this))(tileContainer/*, key2*/) ); 7124 } 7125 } 7126 7127 if (!parseInt(tileContainer.dataset.pending)) { 7128 L.Util.requestAnimFrame(done); 7129 } 7130 return tileContainer; 7131 }, 7132 7133 _clone: function (imgNode) { 7134 var clonedImgNode = imgNode.cloneNode(true); 7135 clonedImgNode.style.visibility = 'visible'; 7136 return clonedImgNode; 7137 }, 7138 7139 _checkZoomLevels: function () { 7140 //setting the zoom level on the Google map may result in a different zoom level than the one requested 7141 //(it won't go beyond the level for which they have data). 7142 var zoomLevel = this._map.getZoom(), 7143 gMapZoomLevel = this._mutant.getZoom(); 7144 7145 if (!zoomLevel || !gMapZoomLevel) return; 7146 7147 if ((gMapZoomLevel !== zoomLevel) || //zoom levels are out of sync, Google doesn't have data 7148 (gMapZoomLevel > this.options.maxNativeZoom)) { //at current location, Google does have data (contrary to maxNativeZoom) 7149 //Update maxNativeZoom 7150 this._setMaxNativeZoom(gMapZoomLevel); 7151 } 7152 }, 7153 7154 _setMaxNativeZoom: function (zoomLevel) { 7155 if (zoomLevel !== this.options.maxNativeZoom) { 7156 this.options.maxNativeZoom = zoomLevel; 7157 this._resetView(); 7158 } 7159 }, 7160 7161 _update: function () { 7162 // zoom level check needs to happen before super's implementation (tile addition/creation) 7163 // otherwise tiles may be missed if maxNativeZoom is not yet correctly determined 7164 if (this._mutant) { 7165 var center = this._map.getCenter(), 7166 _center = new google.maps.LatLng(center.lat, center.lng); 7167 7168 this._mutant.setCenter(_center); 7169 7170 var zoom = this._map.getZoom(), 7171 fractionalLevel = zoom !== Math.round(zoom), 7172 mutantZoom = this._mutant.getZoom(); 7173 7174 //ignore fractional zoom levels 7175 if (!fractionalLevel && (zoom !== mutantZoom)) { 7176 this._mutant.setZoom(zoom); 7177 7178 if (this._mutantIsReady) this._checkZoomLevels(); 7179 //else zoom level check will be done later by 'idle' handler 7180 } 7181 } 7182 7183 L.GridLayer.prototype._update.call(this); 7184 }, 7185 7186 _resize: function () { 7187 var size = this._map.getSize(); 7188 if (this._mutantContainer.style.width === size.x && 7189 this._mutantContainer.style.height === size.y) 7190 return; 7191 this.setElementSize(this._mutantContainer, size); 7192 if (!this._mutant) return; 7193 google.maps.event.trigger(this._mutant, 'resize'); 7194 }, 7195 7196 _handleZoomAnim: function () { 7197 if (!this._mutant) return; 7198 7199 var center = this._map.getCenter(), 7200 _center = new google.maps.LatLng(center.lat, center.lng); 7201 7202 this._mutant.setCenter(_center); 7203 this._mutant.setZoom(Math.round(this._map.getZoom())); 7204 var gZoom = this._mutant.getZoom(); 7205 7206 // for (let key of Object.keys(this._freshTiles)) { 7207 // IE-compatible code, in ecmascript5: 7208 for (var key in Object.keys(this._freshTiles)) { 7209 if (gZoom !== parseFloat(key.split(':')[2]) /* tileZoom */) { // @utilmind: gZoom is number. 7210 delete this._freshTiles[key]; 7211 } 7212 } 7213 }, 7214 7215 // Agressively prune _freshtiles when a tile with the same key is removed, 7216 // this prevents a problem where Leaflet keeps a loaded tile longer than 7217 // GMaps, so that GMaps makes two requests but Leaflet only consumes one, 7218 // polluting _freshTiles with stale data. 7219 _removeTile: function (key) { 7220 if (!this._mutant) return; 7221 7222 //give time for animations to finish before checking it tile should be pruned 7223 setTimeout(this._pruneTile.bind(this, key), 1000); 7224 7225 return L.GridLayer.prototype._removeTile.call(this, key); 7226 }, 7227 7228 _getLargeGMapBound: function (googleBounds) { 7229 var sw = googleBounds.getSouthWest(), 7230 ne = googleBounds.getNorthEast(), 7231 swLat = sw.lat(), 7232 swLng = sw.lng(), 7233 neLat = ne.lat(), 7234 neLng = ne.lng(), 7235 latDelta = Math.abs(neLat - swLat), 7236 lngDelta = Math.abs(neLng - swLng); 7237 7238 return L.latLngBounds([[swLat - latDelta, swLng - lngDelta], [neLat + latDelta, neLng + lngDelta]]); 7239 }, 7240 7241 _pruneTile: function (key) { 7242 var gZoom = this._mutant.getZoom(), 7243 tileZoom = key.split(':')[2], 7244 googleBounds = this._mutant.getBounds(), 7245 gMapBounds = this._getLargeGMapBound(googleBounds); 7246 7247 if (!googleBounds) { 7248 return; 7249 } 7250 7251 for (var i=0; i<this._imagesPerTile; ++i) { 7252 var key2 = key + '/' + i; 7253 if (key2 in this._freshTiles) { 7254 var tileBounds = this._map && this._keyToBounds(key), 7255 stillVisible = this._map && tileBounds.overlaps(gMapBounds) && (parseFloat(tileZoom) === gZoom); // @utilmind: TileZoom is string, gZoom is number. 7256 7257 if (!stillVisible) delete this._freshTiles[key2]; 7258// console.log('Prunning of ', key, (!stillVisible)) 7259 } 7260 } 7261 } 7262}); 7263 7264 7265// ðfactory gridLayer.googleMutant(options) 7266// Returns a new `GridLayer.GoogleMutant` given its options 7267L.gridLayer.googleMutant = function (options) { 7268 return new L.GridLayer.GoogleMutant(options); 7269}; 7270 7271 7272/***/ }), 7273
vendor: 5,345 bytes, lines 7274-7400
7274/***/ "./node_modules/leaflet.icon.glyph/Leaflet.Icon.Glyph.js": 7275/*!***************************************************************!*\ 7276 !*** ./node_modules/leaflet.icon.glyph/Leaflet.Icon.Glyph.js ***! 7277 \***************************************************************/ 7278/*! no static exports found */ 7279/***/ (function(module, exports) { 7280 7281 7282 7283 7284L.Icon.Glyph = L.Icon.extend({ 7285 options: { 7286 iconSize: [25, 41], 7287 iconAnchor: [12, 41], 7288 popupAnchor: [1, -34], 7289 shadowSize: [41, 41], 7290// iconUrl: 'glyph-marker-icon.png', 7291// iconSize: [35, 45], 7292// iconAnchor: [17, 42], 7293// popupAnchor: [1, -32], 7294// shadowAnchor: [10, 12], 7295// shadowSize: [36, 16], 7296// bgPos: (Point) 7297 className: '', 7298 prefix: '', 7299 glyph: 'home', 7300 glyphColor: 'white', 7301 glyphSize: '11px', // in CSS units 7302 glyphAnchor: [0, -7] // In pixels, counting from the center of the image. 7303 }, 7304 7305 createIcon: function () { 7306 var div = document.createElement('div'), 7307 options = this.options; 7308 7309 if (options.glyph) { 7310 div.appendChild(this._createGlyph()); 7311 } 7312 7313 this._setIconStyles(div, options.className); 7314 return div; 7315 }, 7316 7317 _createGlyph: function() { 7318 var glyphClass, 7319 textContent, 7320 options = this.options; 7321 7322 if (!options.prefix) { 7323 glyphClass = ''; 7324 textContent = options.glyph; 7325 } else if((options.prefix === "fab") || (options.prefix === "fal") || (options.prefix === "far") || (options.prefix === "fas")) { 7326 // Hack for Font Awesome 5 - it needs two different prefixes. 7327 glyphClass = "fa-" + options.glyph; 7328 } else if(options.glyph.slice(0, options.prefix.length+1) === options.prefix + "-") { 7329 glyphClass = options.glyph; 7330 } else { 7331 glyphClass = options.prefix + "-" + options.glyph; 7332 } 7333 7334 var span = L.DomUtil.create('span', options.prefix + ' ' + glyphClass); 7335 span.style.fontSize = options.glyphSize; 7336 span.style.color = options.glyphColor; 7337 span.style.width = options.iconSize[0] + 'px'; 7338 span.style.lineHeight = options.iconSize[1] + 'px'; 7339 span.style.textAlign = 'center'; 7340 span.style.marginLeft = options.glyphAnchor[0] + 'px'; 7341 span.style.marginTop = options.glyphAnchor[1] + 'px'; 7342 span.style.pointerEvents = 'none'; 7343 span.style.display = 'inline-block'; 7344 7345 if (textContent) { 7346 span.innerHTML = textContent; 7347 } 7348 7349 return span; 7350 }, 7351 7352 _setIconStyles: function (div, name) { 7353 if (name === 'shadow') { 7354 return L.Icon.prototype._setIconStyles.call(this, div, name); 7355 } 7356 7357 var options = this.options, 7358 size = L.point(options['iconSize']), 7359 anchor = L.point(options.iconAnchor); 7360 7361 if (!anchor && size) { 7362 anchor = size.divideBy(2, true); 7363 } 7364 7365 div.className = 'leaflet-marker-icon leaflet-glyph-icon ' + name; 7366 var src = this._getIconUrl('icon'); 7367 if (src) { 7368 div.style.backgroundImage = "url('" + src + "')"; 7369 } 7370 7371 if (options.bgPos) { 7372 div.style.backgroundPosition = (-options.bgPos.x) + 'px ' + (-options.bgPos.y) + 'px'; 7373 } 7374 if (options.bgSize) { 7375 div.style.backgroundSize = (options.bgSize.x) + 'px ' + (options.bgSize.y) + 'px'; 7376 } 7377 7378 if (anchor) { 7379 div.style.marginLeft = (-anchor.x) + 'px'; 7380 div.style.marginTop = (-anchor.y) + 'px'; 7381 } 7382 7383 if (size) { 7384 div.style.width = size.x + 'px'; 7385 div.style.height = size.y + 'px'; 7386 } 7387 } 7388}); 7389 7390L.icon.glyph = function (options) { 7391 return new L.Icon.Glyph(options); 7392}; 7393 7394 7395// Base64-encoded version of glyph-marker-icon.png 7396L.Icon.Glyph.prototype.options.iconUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAUlSURBVFjDrZdLiBxVFIb/e289uqt6kkx6zIiIoKgLRReKuMhCcaOIAUEIiCCE4CIPggZ8kBjooPgM0TiYEUUjqBGchZqAQlyYRTA+kJiJQiJGMjN5zYzT3dP1rrr3HBeTjDGTSfc8Dvyruud89Z9z6kIJdBj31763MivsJXKuZYF6dak5++2mh7NOcsXVHq6sHbhOK/24kOJJMO4AE1vKygwZhxlKSHGKiD+RSu09vOXB43OCrHz96y6T2lsh+OmKXzFdlbLne2UopSAupBhjECcZgjDMgiiSxPhcK/nCr1sfOtcWcm/tq9uEsL4rl0vdK67pKVu2jUwTMk0wBBAzpBCQAnAtiZIlwWQwPlHPglZQAFj1Y23VwVkh92zbd59U+Kanp+p2L12mooKQ5AbcpuclS6LiKoRhxOfHzhXMcs3PtVV7Z0DufXH/LSzpSG9vr1/p6kIz0dDUrvx/IYXAsrJCkWc4e/Z0Zpgf+KX26A/TkNtrXziesY9Xq8tvWNZdVfVYg7hzwKVv3O3ZiKMWj46OTrq5fdOh1x5pSADwjdzo2nbv0u6qqkca2jCIMGcZAuqRhu8vEX7ZK2V2WgMAcXdtvyeKbPS662+osCohzMycHVweniNREoShoZO5KYobpciSh23bFq7rIUgNiLFghRkBlg2v7GlpiccsCHrcryzxUk3zmsNskeYGvt/lxVH4hMWEu9xSWaQFYQ7L1B6iGZ5bBoy+zWKiHiltFHpqeIsVhWaosg1iqlgg4wAAEYEXsV3EmNppJmExMFYUxfVSuIs6E0sI5FkBBhLJzH9laQxLSjBj0WQJgSJPweDTkknvS4JGbCuxKOt7UY4lEQfNnAu9TzLxN2nUdAQTLAEw8YIlAVgAkmDCSBL75eCutSeY+GTUqqNkqUVxUbIl4qgJo4vWzecrhyQAMJldYf1MXLLl1EIsYBZgoGwpRI2zMTPtGBhYbSQAlJF9lieRzNMIriVBzPOWawvoIkYaNC0u9IcAIAHgp75NLQl8ENbPZJ6jgAU48RyFqHEuZyE+Pda/vjENAQBD5s209Y+kPJlyM4+r3lUS0AWSyVEhpHnjYu1pyO+7N4ywwPvhxHDiuwo8j1b5rkQwMZIziYHBXetPzIAAgIV8exZOSMoieI6aU5vKtgR0jqw1JtiYbZfW/R/kSN+mcWbxdtwYjn1XTd9B7cQAfNdCWB/OhBR7jvWv/3tWCAAoO3ktjyZZJ0HHbsq2AooERVQXzPKly2vOgPz29jNNBr+e1IcSz5YAM4hmFzPDtyWS+lDK4N2DfU+dbgsBAFHyd+oszE3agt/GjWcrUBEjj5sQBb96pXpXhAzueDJi4u1p41TsuQpCiFln4bkKeXMoJeadg++tG+sYAgBBXOo3RRrruAnfkWDmGfIdCeQhiiQgQbxjtlqzQk59vCZlNluL5lDiORLyMjcA4DsKeXM4AfDKxa97ThAAqPaMfaR1Nq6jOiqOAhOm5TsKJg1QZGGRedY7V6tzVcjBWk1D0JZ8cigt2RJSimkXnqOgW8MxQLUTb6wN5g0BgGPV0c9BekTH41xx5YXrQ8FkTRgdpxU7ea9djbYQ1GokmJ43wUhWtgRcS04tQjAcw9CWw29tThYOAXD03XVfMps/TTTOy30blDZgiqxFK6p7OsnvCDJ1UD9LyUjORoPDkUQyPfdHbXW+qJCjfRsOwOAoNY4z6Xz01rHq3k5zO4ZMHTabYSIhJD87MLB64f8Ys8WdG/tfBljMJedfwY+s/2P4Pv8AAAAASUVORK5CYII='; 7397 7398 7399/***/ }), 7400
vendor: 9,597 bytes, lines 7401-7713
7401/***/ "./node_modules/leaflet.mapkitmutant/Leaflet.MapkitMutant.js": 7402/*!*******************************************************************!*\ 7403 !*** ./node_modules/leaflet.mapkitmutant/Leaflet.MapkitMutant.js ***! 7404 \*******************************************************************/ 7405/*! no static exports found */ 7406/***/ (function(module, exports) { 7407 7408// Leaflet.MapkitMutant - use (Apple's) MapkitJS basemaps in Leaflet. 7409// See https://gitlab.com/IvanSanchez/Leaflet.MapkitMutant 7410 7411L.MapkitMutant = L.Layer.extend({ 7412 options: { 7413 minZoom: 3, 7414 maxZoom: 23, 7415 7416 // ðoption type: String = 'standard' 7417 // mapkit's map type. Valid values are strings 'standard' (default), 7418 // 'satellite' or 'hybrid'. 7419 type: "standard", 7420 7421 // ðoption authorizationCallback: Function 7422 // An autorization callback function, as described 7423 // in [Apple's mapkitJS documentation](https://developer.apple.com/documentation/mapkitjs/mapkit/2974045-init) 7424 authorizationCallback: function() {}, 7425 7426 // ðoption language: String = undefined 7427 // A language code, as described in 7428 // [Apple's mapkitJS documentation](https://developer.apple.com/documentation/mapkitjs/mapkit/2974045-init). 7429 // By default Mapkit will use the locale setting from the web browser. 7430 7431 // ðoption opacity: Number = 1.0 7432 // The opacity of the MapkitMutant 7433 opacity: 1, 7434 7435 // ðoption debugRectangle: Boolean = false 7436 // Whether to add a rectangle with the bounds of the mutant to the map. 7437 // Only meant for debugging, most useful at low zoom levels. 7438 debugRectangle: false, 7439 }, 7440 7441 initialize: function(options) { 7442 L.Util.setOptions(this, options); 7443 7444 /// TODO: Add a this._mapkitPromise, just like GoogleMutant 7445 7446 mapkit.init({ 7447 authorizationCallback: this.options.authorizationCallback, 7448 language: this.options.langhage, 7449 }); 7450 }, 7451 7452 onAdd: function(map) { 7453 this._map = map; 7454 7455 this._initMutantContainer(); 7456 7457 this._initMutant(); 7458 7459 map.on("move zoom moveend zoomend", this._update, this); 7460 map.on("resize", this._resize, this); 7461 this._resize(); 7462 }, 7463 7464 onRemove: function(map) { 7465 map._container.removeChild(this._mutantContainer); 7466 this._mutantContainer = undefined; 7467 map.off("move zoom moveend zoomend", this._update, this); 7468 map.off("resize", this._resize, this); 7469 this._mutant.removeEventListener( 7470 "region-change-end", 7471 this._onRegionChangeEnd, 7472 this 7473 ); 7474 if (this._canvasOverlay) { 7475 this._canvasOverlay.remove(); 7476 } 7477 }, 7478 7479 // Create the HTMLElement for the mutant map, and add it as a children 7480 // of the Leaflet Map container 7481 _initMutantContainer: function() { 7482 if (!this._mutantContainer) { 7483 this._mutantContainer = L.DomUtil.create( 7484 "div", 7485 "leaflet-mapkit-mutant" 7486 ); 7487 this._mutantContainer.id = 7488 "_MutantContainer_" + L.Util.stamp(this._mutantContainer); 7489 this._mutantContainer.style.zIndex = "200"; //leaflet map pane at 400, controls at 1000 7490 this._mutantContainer.style.pointerEvents = "none"; 7491 7492 this._map.getContainer().appendChild(this._mutantContainer); 7493 } 7494 7495 // this.setOpacity(this.options.opacity); 7496 this.setElementSize(this._mutantContainer, this._map.getSize()); 7497 7498 //this._attachObserver(this._mutantContainer); 7499 }, 7500 7501 // Create the mutant map inside the mutant container 7502 _initMutant: function() { 7503 if (!this._mutantContainer) return; 7504 7505 var mapType = mapkit.Map.MapTypes.Standard; 7506 if (this.options.type === "hybrid") { 7507 mapType = mapkit.Map.MapTypes.Hybrid; 7508 } else if (this.options.type === "satellite") { 7509 mapType = mapkit.Map.MapTypes.Satellite; 7510 } else if (this.options.type === "muted") { 7511 mapType = mapkit.Map.MapTypes.MutedStandard; 7512 } 7513 7514 var map = new mapkit.Map(this._mutantContainer, { 7515 visibleMapRect: this._leafletBoundsToMapkitRect(), 7516 showsUserLocation: false, 7517 showsUserLocationControl: false, 7518 7519 // WTF, apple devs? other options are boolean but this is a 7520 // `mapkit.FeatureVisibility`. F*ck consistency, amirite?! 7521 showsCompass: "hidden", 7522 7523 showsZoomControl: false, 7524 showsUserLocationControl: false, 7525 showsScale: false, 7526 showsMapTypeControl: false, 7527 mapType: mapType, 7528 }); 7529 7530 this._mutant = map; 7531 map.addEventListener("region-change-end", this._onRegionChangeEnd, this); 7532 map.addEventListener("region-change-start", this._onRegionChangeStart, this); 7533 7534 // ðevent spawned 7535 // Fired when the mutant has been created. 7536 this.fire("spawned", { mapObject: map }); 7537 7538 // Call _update once, so that it can fetch the mutant's canvas and 7539 // create the L.ImageOverlay 7540 L.Util.requestAnimFrame(this._update, this); 7541 }, 7542 7543 // Fetches the map's current *projected* (EPSG:3857) bounds, and returns 7544 // an instance of mapkit.MapRect 7545 _leafletBoundsToMapkitRect: function() { 7546 var bounds = this._map.getPixelBounds(); 7547 var scale = this._map.options.crs.scale(this._map.getZoom()); 7548 var nw = bounds.getTopLeft().divideBy(scale); 7549 var se = bounds.getBottomRight().divideBy(scale); 7550 7551 // Map those bounds into a [[0,0]..[1,1]] range 7552 var projectedBounds = L.bounds([nw, se]); 7553 7554 var projectedCenter = projectedBounds.getCenter(); 7555 var projectedSize = projectedBounds.getSize(); 7556 7557 var result = new mapkit.MapRect( 7558 projectedCenter.x - projectedSize.x / 2, 7559 projectedCenter.y - projectedSize.y / 2, 7560 projectedSize.x, 7561 projectedSize.y 7562 ); 7563 return result; 7564 }, 7565 7566 // Given an instance of mapkit.MapRect, returns an instance of L.LatLngBounds 7567 // This depends on the current map center, as to shift the bounds on 7568 // multiples of 360 in order to prevent artifacts when crossing the 7569 // antimeridian. 7570 _mapkitRectToLeafletBounds: function(rect) { 7571 // Ask MapkitJS to provide the lat-lng coords of the rect's corners 7572 var nw = new mapkit.MapPoint(rect.minX(), rect.maxY()).toCoordinate(); 7573 var se = new mapkit.MapPoint(rect.maxX(), rect.minY()).toCoordinate(); 7574 7575 var lw = nw.longitude + Math.floor(rect.minX()) * 360; 7576 var le = se.longitude + Math.floor(rect.maxX()) * 360; 7577 7578 var centerLng = this._map.getCenter().lng; 7579 7580 // Shift the bounding box on the easting axis so it contains the map center 7581 if (centerLng < lw) { 7582 // Shift the whole thing to the west 7583 var offset = Math.floor((centerLng - lw) / 360) * 360; 7584 lw += offset; 7585 le += offset; 7586 } else if (centerLng > le) { 7587 // Shift the whole thing to the east 7588 var offset = Math.ceil((centerLng - le) / 360) * 360; 7589 lw += offset; 7590 le += offset; 7591 } 7592 7593 return L.latLngBounds([ 7594 L.latLng(nw.latitude, lw), 7595 L.latLng(se.latitude, le), 7596 ]); 7597 }, 7598 7599 _update: function() { 7600 if (this._map && this._mutant) { 7601 this._mutant.setVisibleMapRectAnimated( 7602 this._leafletBoundsToMapkitRect(), 7603 false 7604 ); 7605 } 7606 }, 7607 7608 _resize: function() { 7609 var size = this._map.getSize(); 7610 if ( 7611 this._mutantContainer.style.width === size.x && 7612 this._mutantContainer.style.height === size.y 7613 ) 7614 return; 7615 this.setElementSize(this._mutantContainer, size); 7616 if (!this._mutant) return; 7617 }, 7618 7619 _onRegionChangeEnd: function(ev) { 7620 // console.log(ev.target.region.toString()); 7621 7622 if (!this._mutantCanvas) { 7623 this._mutantCanvas = this._mutantContainer.querySelector( 7624 "canvas.syrup-canvas" 7625 ); 7626 } 7627 7628 if (this._map && this._mutantCanvas) { 7629 // Despite the event name and this method's name, fetch the mutant's 7630 // visible MapRect, not the mutant's region. It uses projected 7631 // coordinates (i.e. scaled EPSG:3957 coordinates). This prevents 7632 // latitude shift artifacts. 7633 var bounds = this._mapkitRectToLeafletBounds( 7634 this._mutant.visibleMapRect 7635 ); 7636 7637 // The mutant will take one frame to re-stitch its tiles, so 7638 // repositioning the mutant's overlay has to take place one frame 7639 // after the 'region-change-end' event, in order to avoid graphical 7640 // glitching. 7641 7642 L.Util.cancelAnimFrame(this._requestedFrame); 7643 7644 this._requestedFrame = L.Util.requestAnimFrame(function() { 7645 if (!this._canvasOverlay) { 7646 this._canvasOverlay = L.imageOverlay(null, bounds); 7647 7648 // Hack the ImageOverlay's _image property so that it doesn't 7649 // create a HTMLImageElement 7650 var img = (this._canvasOverlay._image = L.DomUtil.create("div")); 7651 7652 L.DomUtil.addClass(img, "leaflet-image-layer"); 7653 L.DomUtil.addClass(img, "leaflet-zoom-animated"); 7654 7655 // Move the mutant's canvas out of its container, and into 7656 // the L.ImageOverlay's _image 7657 this._mutantCanvas.parentElement.removeChild(this._mutantCanvas); 7658 img.appendChild(this._mutantCanvas); 7659 7660 this._canvasOverlay.addTo(this._map); 7661 this._updateOpacity(); 7662 } else { 7663 this._canvasOverlay.setBounds(bounds); 7664 } 7665 this._mutantCanvas.style.width = "100%"; 7666 this._mutantCanvas.style.height = "100%"; 7667 this._mutantCanvas.style.position = "absolute"; 7668 7669 if (this.options.debugRectangle) { 7670 if (!this.rectangle) { 7671 this.rectangle = L.rectangle(bounds, { 7672 fill: false, 7673 }).addTo(this._map); 7674 } else { 7675 this.rectangle.setBounds(bounds); 7676 } 7677 } 7678 }, this); 7679 } 7680 }, 7681 7682 // ðmethod setOpacity(opacity: Number): this 7683 // Sets the opacity of the MapkitMutant. 7684 setOpacity: function(opacity) { 7685 this.options.opacity = opacity; 7686 this._updateOpacity(); 7687 return this; 7688 }, 7689 7690 _updateOpacity: function() { 7691 if (this._mutantCanvas) { 7692 L.DomUtil.setOpacity(this._mutantCanvas, this.options.opacity); 7693 } 7694 }, 7695 7696 _onRegionChangeStart: function(ev) { 7697 /// TODO: check if there's any use to this event handler, clean up 7698 // console.timeStamp('region-change-start'); 7699 }, 7700 7701 setElementSize: function(e, size) { 7702 e.style.width = size.x + "px"; 7703 e.style.height = size.y + "px"; 7704 }, 7705}); 7706 7707L.mapkitMutant = function mapkitMutant(options) { 7708 return new L.MapkitMutant(options); 7709}; 7710 7711 7712/***/ }), 7713
vendor: 77,960 bytes, lines 7714-10413
7714/***/ "./node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js": 7715/*!******************************************************************************!*\ 7716 !*** ./node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js ***! 7717 \******************************************************************************/ 7718/*! no static exports found */ 7719/***/ (function(module, exports, __webpack_require__) { 7720 7721/* 7722 * Leaflet.markercluster 1.4.1+master.94f9815, 7723 * Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps. 7724 * https://github.com/Leaflet/Leaflet.markercluster 7725 * (c) 2012-2017, Dave Leaver, smartrak 7726 */ 7727(function (global, factory) { 7728 true ? factory(exports) : 7729 undefined; 7730}(this, (function (exports) { 'use strict'; 7731 7732/* 7733 * L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within 7734 */ 7735 7736var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ 7737 7738 options: { 7739 maxClusterRadius: 80, //A cluster will cover at most this many pixels from its center 7740 iconCreateFunction: null, 7741 clusterPane: L.Marker.prototype.options.pane, 7742 7743 spiderfyOnMaxZoom: true, 7744 showCoverageOnHover: true, 7745 zoomToBoundsOnClick: true, 7746 singleMarkerMode: false, 7747 7748 disableClusteringAtZoom: null, 7749 7750 // Setting this to false prevents the removal of any clusters outside of the viewpoint, which 7751 // is the default behaviour for performance reasons. 7752 removeOutsideVisibleBounds: true, 7753 7754 // Set to false to disable all animations (zoom and spiderfy). 7755 // If false, option animateAddingMarkers below has no effect. 7756 // If L.DomUtil.TRANSITION is falsy, this option has no effect. 7757 animate: true, 7758 7759 //Whether to animate adding markers after adding the MarkerClusterGroup to the map 7760 // If you are adding individual markers set to true, if adding bulk markers leave false for massive performance gains. 7761 animateAddingMarkers: false, 7762 7763 //Increase to increase the distance away that spiderfied markers appear from the center 7764 spiderfyDistanceMultiplier: 1, 7765 7766 // Make it possible to specify a polyline options on a spider leg 7767 spiderLegPolylineOptions: { weight: 1.5, color: '#222', opacity: 0.5 }, 7768 7769 // When bulk adding layers, adds markers in chunks. Means addLayers may not add all the layers in the call, others will be loaded during setTimeouts 7770 chunkedLoading: false, 7771 chunkInterval: 200, // process markers for a maximum of ~ n milliseconds (then trigger the chunkProgress callback) 7772 chunkDelay: 50, // at the end of each interval, give n milliseconds back to system/browser 7773 chunkProgress: null, // progress callback: function(processed, total, elapsed) (e.g. for a progress indicator) 7774 7775 //Options to pass to the L.Polygon constructor 7776 polygonOptions: {} 7777 }, 7778 7779 initialize: function (options) { 7780 L.Util.setOptions(this, options); 7781 if (!this.options.iconCreateFunction) { 7782 this.options.iconCreateFunction = this._defaultIconCreateFunction; 7783 } 7784 7785 this._featureGroup = L.featureGroup(); 7786 this._featureGroup.addEventParent(this); 7787 7788 this._nonPointGroup = L.featureGroup(); 7789 this._nonPointGroup.addEventParent(this); 7790 7791 this._inZoomAnimation = 0; 7792 this._needsClustering = []; 7793 this._needsRemoving = []; //Markers removed while we aren't on the map need to be kept track of 7794 //The bounds of the currently shown area (from _getExpandedVisibleBounds) Updated on zoom/move 7795 this._currentShownBounds = null; 7796 7797 this._queue = []; 7798 7799 this._childMarkerEventHandlers = { 7800 'dragstart': this._childMarkerDragStart, 7801 'move': this._childMarkerMoved, 7802 'dragend': this._childMarkerDragEnd, 7803 }; 7804 7805 // Hook the appropriate animation methods. 7806 var animate = L.DomUtil.TRANSITION && this.options.animate; 7807 L.extend(this, animate ? this._withAnimation : this._noAnimation); 7808 // Remember which MarkerCluster class to instantiate (animated or not). 7809 this._markerCluster = animate ? L.MarkerCluster : L.MarkerClusterNonAnimated; 7810 }, 7811 7812 addLayer: function (layer) { 7813 7814 if (layer instanceof L.LayerGroup) { 7815 return this.addLayers([layer]); 7816 } 7817 7818 //Don't cluster non point data 7819 if (!layer.getLatLng) { 7820 this._nonPointGroup.addLayer(layer); 7821 this.fire('layeradd', { layer: layer }); 7822 return this; 7823 } 7824 7825 if (!this._map) { 7826 this._needsClustering.push(layer); 7827 this.fire('layeradd', { layer: layer }); 7828 return this; 7829 } 7830 7831 if (this.hasLayer(layer)) { 7832 return this; 7833 } 7834 7835 7836 //If we have already clustered we'll need to add this one to a cluster 7837 7838 if (this._unspiderfy) { 7839 this._unspiderfy(); 7840 } 7841 7842 this._addLayer(layer, this._maxZoom); 7843 this.fire('layeradd', { layer: layer }); 7844 7845 // Refresh bounds and weighted positions. 7846 this._topClusterLevel._recalculateBounds(); 7847 7848 this._refreshClustersIcons(); 7849 7850 //Work out what is visible 7851 var visibleLayer = layer, 7852 currentZoom = this._zoom; 7853 if (layer.__parent) { 7854 while (visibleLayer.__parent._zoom >= currentZoom) { 7855 visibleLayer = visibleLayer.__parent; 7856 } 7857 } 7858 7859 if (this._currentShownBounds.contains(visibleLayer.getLatLng())) { 7860 if (this.options.animateAddingMarkers) { 7861 this._animationAddLayer(layer, visibleLayer); 7862 } else { 7863 this._animationAddLayerNonAnimated(layer, visibleLayer); 7864 } 7865 } 7866 return this; 7867 }, 7868 7869 removeLayer: function (layer) { 7870 7871 if (layer instanceof L.LayerGroup) { 7872 return this.removeLayers([layer]); 7873 } 7874 7875 //Non point layers 7876 if (!layer.getLatLng) { 7877 this._nonPointGroup.removeLayer(layer); 7878 this.fire('layerremove', { layer: layer }); 7879 return this; 7880 } 7881 7882 if (!this._map) { 7883 if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) { 7884 this._needsRemoving.push({ layer: layer, latlng: layer._latlng }); 7885 } 7886 this.fire('layerremove', { layer: layer }); 7887 return this; 7888 } 7889 7890 if (!layer.__parent) { 7891 return this; 7892 } 7893 7894 if (this._unspiderfy) { 7895 this._unspiderfy(); 7896 this._unspiderfyLayer(layer); 7897 } 7898 7899 //Remove the marker from clusters 7900 this._removeLayer(layer, true); 7901 this.fire('layerremove', { layer: layer }); 7902 7903 // Refresh bounds and weighted positions. 7904 this._topClusterLevel._recalculateBounds(); 7905 7906 this._refreshClustersIcons(); 7907 7908 layer.off(this._childMarkerEventHandlers, this); 7909 7910 if (this._featureGroup.hasLayer(layer)) { 7911 this._featureGroup.removeLayer(layer); 7912 if (layer.clusterShow) { 7913 layer.clusterShow(); 7914 } 7915 } 7916 7917 return this; 7918 }, 7919 7920 //Takes an array of markers and adds them in bulk 7921 addLayers: function (layersArray, skipLayerAddEvent) { 7922 if (!L.Util.isArray(layersArray)) { 7923 return this.addLayer(layersArray); 7924 } 7925 7926 var fg = this._featureGroup, 7927 npg = this._nonPointGroup, 7928 chunked = this.options.chunkedLoading, 7929 chunkInterval = this.options.chunkInterval, 7930 chunkProgress = this.options.chunkProgress, 7931 l = layersArray.length, 7932 offset = 0, 7933 originalArray = true, 7934 m; 7935 7936 if (this._map) { 7937 var started = (new Date()).getTime(); 7938 var process = L.bind(function () { 7939 var start = (new Date()).getTime(); 7940 for (; offset < l; offset++) { 7941 if (chunked && offset % 200 === 0) { 7942 // every couple hundred markers, instrument the time elapsed since processing started: 7943 var elapsed = (new Date()).getTime() - start; 7944 if (elapsed > chunkInterval) { 7945 break; // been working too hard, time to take a break :-) 7946 } 7947 } 7948 7949 m = layersArray[offset]; 7950 7951 // Group of layers, append children to layersArray and skip. 7952 // Side effects: 7953 // - Total increases, so chunkProgress ratio jumps backward. 7954 // - Groups are not included in this group, only their non-group child layers (hasLayer). 7955 // Changing array length while looping does not affect performance in current browsers: 7956 // http://jsperf.com/for-loop-changing-length/6 7957 if (m instanceof L.LayerGroup) { 7958 if (originalArray) { 7959 layersArray = layersArray.slice(); 7960 originalArray = false; 7961 } 7962 this._extractNonGroupLayers(m, layersArray); 7963 l = layersArray.length; 7964 continue; 7965 } 7966 7967 //Not point data, can't be clustered 7968 if (!m.getLatLng) { 7969 npg.addLayer(m); 7970 if (!skipLayerAddEvent) { 7971 this.fire('layeradd', { layer: m }); 7972 } 7973 continue; 7974 } 7975 7976 if (this.hasLayer(m)) { 7977 continue; 7978 } 7979 7980 this._addLayer(m, this._maxZoom); 7981 if (!skipLayerAddEvent) { 7982 this.fire('layeradd', { layer: m }); 7983 } 7984 7985 //If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will 7986 if (m.__parent) { 7987 if (m.__parent.getChildCount() === 2) { 7988 var markers = m.__parent.getAllChildMarkers(), 7989 otherMarker = markers[0] === m ? markers[1] : markers[0]; 7990 fg.removeLayer(otherMarker); 7991 } 7992 } 7993 } 7994 7995 if (chunkProgress) { 7996 // report progress and time elapsed: 7997 chunkProgress(offset, l, (new Date()).getTime() - started); 7998 } 7999 8000 // Completed processing all markers. 8001 if (offset === l) { 8002 8003 // Refresh bounds and weighted positions. 8004 this._topClusterLevel._recalculateBounds(); 8005 8006 this._refreshClustersIcons(); 8007 8008 this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds); 8009 } else { 8010 setTimeout(process, this.options.chunkDelay); 8011 } 8012 }, this); 8013 8014 process(); 8015 } else { 8016 var needsClustering = this._needsClustering; 8017 8018 for (; offset < l; offset++) { 8019 m = layersArray[offset]; 8020 8021 // Group of layers, append children to layersArray and skip. 8022 if (m instanceof L.LayerGroup) { 8023 if (originalArray) { 8024 layersArray = layersArray.slice(); 8025 originalArray = false; 8026 } 8027 this._extractNonGroupLayers(m, layersArray); 8028 l = layersArray.length; 8029 continue; 8030 } 8031 8032 //Not point data, can't be clustered 8033 if (!m.getLatLng) { 8034 npg.addLayer(m); 8035 continue; 8036 } 8037 8038 if (this.hasLayer(m)) { 8039 continue; 8040 } 8041 8042 needsClustering.push(m); 8043 } 8044 } 8045 return this; 8046 }, 8047 8048 //Takes an array of markers and removes them in bulk 8049 removeLayers: function (layersArray) { 8050 var i, m, 8051 l = layersArray.length, 8052 fg = this._featureGroup, 8053 npg = this._nonPointGroup, 8054 originalArray = true; 8055 8056 if (!this._map) { 8057 for (i = 0; i < l; i++) { 8058 m = layersArray[i]; 8059 8060 // Group of layers, append children to layersArray and skip. 8061 if (m instanceof L.LayerGroup) { 8062 if (originalArray) { 8063 layersArray = layersArray.slice(); 8064 originalArray = false; 8065 } 8066 this._extractNonGroupLayers(m, layersArray); 8067 l = layersArray.length; 8068 continue; 8069 } 8070 8071 this._arraySplice(this._needsClustering, m); 8072 npg.removeLayer(m); 8073 if (this.hasLayer(m)) { 8074 this._needsRemoving.push({ layer: m, latlng: m._latlng }); 8075 } 8076 this.fire('layerremove', { layer: m }); 8077 } 8078 return this; 8079 } 8080 8081 if (this._unspiderfy) { 8082 this._unspiderfy(); 8083 8084 // Work on a copy of the array, so that next loop is not affected. 8085 var layersArray2 = layersArray.slice(), 8086 l2 = l; 8087 for (i = 0; i < l2; i++) { 8088 m = layersArray2[i]; 8089 8090 // Group of layers, append children to layersArray and skip. 8091 if (m instanceof L.LayerGroup) { 8092 this._extractNonGroupLayers(m, layersArray2); 8093 l2 = layersArray2.length; 8094 continue; 8095 } 8096 8097 this._unspiderfyLayer(m); 8098 } 8099 } 8100 8101 for (i = 0; i < l; i++) { 8102 m = layersArray[i]; 8103 8104 // Group of layers, append children to layersArray and skip. 8105 if (m instanceof L.LayerGroup) { 8106 if (originalArray) { 8107 layersArray = layersArray.slice(); 8108 originalArray = false; 8109 } 8110 this._extractNonGroupLayers(m, layersArray); 8111 l = layersArray.length; 8112 continue; 8113 } 8114 8115 if (!m.__parent) { 8116 npg.removeLayer(m); 8117 this.fire('layerremove', { layer: m }); 8118 continue; 8119 } 8120 8121 this._removeLayer(m, true, true); 8122 this.fire('layerremove', { layer: m }); 8123 8124 if (fg.hasLayer(m)) { 8125 fg.removeLayer(m); 8126 if (m.clusterShow) { 8127 m.clusterShow(); 8128 } 8129 } 8130 } 8131 8132 // Refresh bounds and weighted positions. 8133 this._topClusterLevel._recalculateBounds(); 8134 8135 this._refreshClustersIcons(); 8136 8137 //Fix up the clusters and markers on the map 8138 this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds); 8139 8140 return this; 8141 }, 8142 8143 //Removes all layers from the MarkerClusterGroup 8144 clearLayers: function () { 8145 //Need our own special implementation as the LayerGroup one doesn't work for us 8146 8147 //If we aren't on the map (yet), blow away the markers we know of 8148 if (!this._map) { 8149 this._needsClustering = []; 8150 this._needsRemoving = []; 8151 delete this._gridClusters; 8152 delete this._gridUnclustered; 8153 } 8154 8155 if (this._noanimationUnspiderfy) { 8156 this._noanimationUnspiderfy(); 8157 } 8158 8159 //Remove all the visible layers 8160 this._featureGroup.clearLayers(); 8161 this._nonPointGroup.clearLayers(); 8162 8163 this.eachLayer(function (marker) { 8164 marker.off(this._childMarkerEventHandlers, this); 8165 delete marker.__parent; 8166 }, this); 8167 8168 if (this._map) { 8169 //Reset _topClusterLevel and the DistanceGrids 8170 this._generateInitialClusters(); 8171 } 8172 8173 return this; 8174 }, 8175 8176 //Override FeatureGroup.getBounds as it doesn't work 8177 getBounds: function () { 8178 var bounds = new L.LatLngBounds(); 8179 8180 if (this._topClusterLevel) { 8181 bounds.extend(this._topClusterLevel._bounds); 8182 } 8183 8184 for (var i = this._needsClustering.length - 1; i >= 0; i--) { 8185 bounds.extend(this._needsClustering[i].getLatLng()); 8186 } 8187 8188 bounds.extend(this._nonPointGroup.getBounds()); 8189 8190 return bounds; 8191 }, 8192 8193 //Overrides LayerGroup.eachLayer 8194 eachLayer: function (method, context) { 8195 var markers = this._needsClustering.slice(), 8196 needsRemoving = this._needsRemoving, 8197 thisNeedsRemoving, i, j; 8198 8199 if (this._topClusterLevel) { 8200 this._topClusterLevel.getAllChildMarkers(markers); 8201 } 8202 8203 for (i = markers.length - 1; i >= 0; i--) { 8204 thisNeedsRemoving = true; 8205 8206 for (j = needsRemoving.length - 1; j >= 0; j--) { 8207 if (needsRemoving[j].layer === markers[i]) { 8208 thisNeedsRemoving = false; 8209 break; 8210 } 8211 } 8212 8213 if (thisNeedsRemoving) { 8214 method.call(context, markers[i]); 8215 } 8216 } 8217 8218 this._nonPointGroup.eachLayer(method, context); 8219 }, 8220 8221 //Overrides LayerGroup.getLayers 8222 getLayers: function () { 8223 var layers = []; 8224 this.eachLayer(function (l) { 8225 layers.push(l); 8226 }); 8227 return layers; 8228 }, 8229 8230 //Overrides LayerGroup.getLayer, WARNING: Really bad performance 8231 getLayer: function (id) { 8232 var result = null; 8233 8234 id = parseInt(id, 10); 8235 8236 this.eachLayer(function (l) { 8237 if (L.stamp(l) === id) { 8238 result = l; 8239 } 8240 }); 8241 8242 return result; 8243 }, 8244 8245 //Returns true if the given layer is in this MarkerClusterGroup 8246 hasLayer: function (layer) { 8247 if (!layer) { 8248 return false; 8249 } 8250 8251 var i, anArray = this._needsClustering; 8252 8253 for (i = anArray.length - 1; i >= 0; i--) { 8254 if (anArray[i] === layer) { 8255 return true; 8256 } 8257 } 8258 8259 anArray = this._needsRemoving; 8260 for (i = anArray.length - 1; i >= 0; i--) { 8261 if (anArray[i].layer === layer) { 8262 return false; 8263 } 8264 } 8265 8266 return !!(layer.__parent && layer.__parent._group === this) || this._nonPointGroup.hasLayer(layer); 8267 }, 8268 8269 //Zoom down to show the given layer (spiderfying if necessary) then calls the callback 8270 zoomToShowLayer: function (layer, callback) { 8271 8272 if (typeof callback !== 'function') { 8273 callback = function () {}; 8274 } 8275 8276 var showMarker = function () { 8277 if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) { 8278 this._map.off('moveend', showMarker, this); 8279 this.off('animationend', showMarker, this); 8280 8281 if (layer._icon) { 8282 callback(); 8283 } else if (layer.__parent._icon) { 8284 this.once('spiderfied', callback, this); 8285 layer.__parent.spiderfy(); 8286 } 8287 } 8288 }; 8289 8290 if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) { 8291 //Layer is visible ond on screen, immediate return 8292 callback(); 8293 } else if (layer.__parent._zoom < Math.round(this._map._zoom)) { 8294 //Layer should be visible at this zoom level. It must not be on screen so just pan over to it 8295 this._map.on('moveend', showMarker, this); 8296 this._map.panTo(layer.getLatLng()); 8297 } else { 8298 this._map.on('moveend', showMarker, this); 8299 this.on('animationend', showMarker, this); 8300 layer.__parent.zoomToBounds(); 8301 } 8302 }, 8303 8304 //Overrides FeatureGroup.onAdd 8305 onAdd: function (map) { 8306 this._map = map; 8307 var i, l, layer; 8308 8309 if (!isFinite(this._map.getMaxZoom())) { 8310 throw "Map has no maxZoom specified"; 8311 } 8312 8313 this._featureGroup.addTo(map); 8314 this._nonPointGroup.addTo(map); 8315 8316 if (!this._gridClusters) { 8317 this._generateInitialClusters(); 8318 } 8319 8320 this._maxLat = map.options.crs.projection.MAX_LATITUDE; 8321 8322 //Restore all the positions as they are in the MCG before removing them 8323 for (i = 0, l = this._needsRemoving.length; i < l; i++) { 8324 layer = this._needsRemoving[i]; 8325 layer.newlatlng = layer.layer._latlng; 8326 layer.layer._latlng = layer.latlng; 8327 } 8328 //Remove them, then restore their new positions 8329 for (i = 0, l = this._needsRemoving.length; i < l; i++) { 8330 layer = this._needsRemoving[i]; 8331 this._removeLayer(layer.layer, true); 8332 layer.layer._latlng = layer.newlatlng; 8333 } 8334 this._needsRemoving = []; 8335 8336 //Remember the current zoom level and bounds 8337 this._zoom = Math.round(this._map._zoom); 8338 this._currentShownBounds = this._getExpandedVisibleBounds(); 8339 8340 this._map.on('zoomend', this._zoomEnd, this); 8341 this._map.on('moveend', this._moveEnd, this); 8342 8343 if (this._spiderfierOnAdd) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely 8344 this._spiderfierOnAdd(); 8345 } 8346 8347 this._bindEvents(); 8348 8349 //Actually add our markers to the map: 8350 l = this._needsClustering; 8351 this._needsClustering = []; 8352 this.addLayers(l, true); 8353 }, 8354 8355 //Overrides FeatureGroup.onRemove 8356 onRemove: function (map) { 8357 map.off('zoomend', this._zoomEnd, this); 8358 map.off('moveend', this._moveEnd, this); 8359 8360 this._unbindEvents(); 8361 8362 //In case we are in a cluster animation 8363 this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', ''); 8364 8365 if (this._spiderfierOnRemove) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely 8366 this._spiderfierOnRemove(); 8367 } 8368 8369 delete this._maxLat; 8370 8371 //Clean up all the layers we added to the map 8372 this._hideCoverage(); 8373 this._featureGroup.remove(); 8374 this._nonPointGroup.remove(); 8375 8376 this._featureGroup.clearLayers(); 8377 8378 this._map = null; 8379 }, 8380 8381 getVisibleParent: function (marker) { 8382 var vMarker = marker; 8383 while (vMarker && !vMarker._icon) { 8384 vMarker = vMarker.__parent; 8385 } 8386 return vMarker || null; 8387 }, 8388 8389 //Remove the given object from the given array 8390 _arraySplice: function (anArray, obj) { 8391 for (var i = anArray.length - 1; i >= 0; i--) { 8392 if (anArray[i] === obj) { 8393 anArray.splice(i, 1); 8394 return true; 8395 } 8396 } 8397 }, 8398 8399 /** 8400 * Removes a marker from all _gridUnclustered zoom levels, starting at the supplied zoom. 8401 * @param marker to be removed from _gridUnclustered. 8402 * @param z integer bottom start zoom level (included) 8403 * @private 8404 */ 8405 _removeFromGridUnclustered: function (marker, z) { 8406 var map = this._map, 8407 gridUnclustered = this._gridUnclustered, 8408 minZoom = Math.floor(this._map.getMinZoom()); 8409 8410 for (; z >= minZoom; z--) { 8411 if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) { 8412 break; 8413 } 8414 } 8415 }, 8416 8417 _childMarkerDragStart: function (e) { 8418 e.target.__dragStart = e.target._latlng; 8419 }, 8420 8421 _childMarkerMoved: function (e) { 8422 if (!this._ignoreMove && !e.target.__dragStart) { 8423 var isPopupOpen = e.target._popup && e.target._popup.isOpen(); 8424 8425 this._moveChild(e.target, e.oldLatLng, e.latlng); 8426 8427 if (isPopupOpen) { 8428 e.target.openPopup(); 8429 } 8430 } 8431 }, 8432 8433 _moveChild: function (layer, from, to) { 8434 layer._latlng = from; 8435 this.removeLayer(layer); 8436 8437 layer._latlng = to; 8438 this.addLayer(layer); 8439 }, 8440 8441 _childMarkerDragEnd: function (e) { 8442 var dragStart = e.target.__dragStart; 8443 delete e.target.__dragStart; 8444 if (dragStart) { 8445 this._moveChild(e.target, dragStart, e.target._latlng); 8446 } 8447 }, 8448 8449 8450 //Internal function for removing a marker from everything. 8451 //dontUpdateMap: set to true if you will handle updating the map manually (for bulk functions) 8452 _removeLayer: function (marker, removeFromDistanceGrid, dontUpdateMap) { 8453 var gridClusters = this._gridClusters, 8454 gridUnclustered = this._gridUnclustered, 8455 fg = this._featureGroup, 8456 map = this._map, 8457 minZoom = Math.floor(this._map.getMinZoom()); 8458 8459 //Remove the marker from distance clusters it might be in 8460 if (removeFromDistanceGrid) { 8461 this._removeFromGridUnclustered(marker, this._maxZoom); 8462 } 8463 8464 //Work our way up the clusters removing them as we go if required 8465 var cluster = marker.__parent, 8466 markers = cluster._markers, 8467 otherMarker; 8468 8469 //Remove the marker from the immediate parents marker list 8470 this._arraySplice(markers, marker); 8471 8472 while (cluster) { 8473 cluster._childCount--; 8474 cluster._boundsNeedUpdate = true; 8475 8476 if (cluster._zoom < minZoom) { 8477 //Top level, do nothing 8478 break; 8479 } else if (removeFromDistanceGrid && cluster._childCount <= 1) { //Cluster no longer required 8480 //We need to push the other marker up to the parent 8481 otherMarker = cluster._markers[0] === marker ? cluster._markers[1] : cluster._markers[0]; 8482 8483 //Update distance grid 8484 gridClusters[cluster._zoom].removeObject(cluster, map.project(cluster._cLatLng, cluster._zoom)); 8485 gridUnclustered[cluster._zoom].addObject(otherMarker, map.project(otherMarker.getLatLng(), cluster._zoom)); 8486 8487 //Move otherMarker up to parent 8488 this._arraySplice(cluster.__parent._childClusters, cluster); 8489 cluster.__parent._markers.push(otherMarker); 8490 otherMarker.__parent = cluster.__parent; 8491 8492 if (cluster._icon) { 8493 //Cluster is currently on the map, need to put the marker on the map instead 8494 fg.removeLayer(cluster); 8495 if (!dontUpdateMap) { 8496 fg.addLayer(otherMarker); 8497 } 8498 } 8499 } else { 8500 cluster._iconNeedsUpdate = true; 8501 } 8502 8503 cluster = cluster.__parent; 8504 } 8505 8506 delete marker.__parent; 8507 }, 8508 8509 _isOrIsParent: function (el, oel) { 8510 while (oel) { 8511 if (el === oel) { 8512 return true; 8513 } 8514 oel = oel.parentNode; 8515 } 8516 return false; 8517 }, 8518 8519 //Override L.Evented.fire 8520 fire: function (type, data, propagate) { 8521 if (data && data.layer instanceof L.MarkerCluster) { 8522 //Prevent multiple clustermouseover/off events if the icon is made up of stacked divs (Doesn't work in ie <= 8, no relatedTarget) 8523 if (data.originalEvent && this._isOrIsParent(data.layer._icon, data.originalEvent.relatedTarget)) { 8524 return; 8525 } 8526 type = 'cluster' + type; 8527 } 8528 8529 L.FeatureGroup.prototype.fire.call(this, type, data, propagate); 8530 }, 8531 8532 //Override L.Evented.listens 8533 listens: function (type, propagate) { 8534 return L.FeatureGroup.prototype.listens.call(this, type, propagate) || L.FeatureGroup.prototype.listens.call(this, 'cluster' + type, propagate); 8535 }, 8536 8537 //Default functionality 8538 _defaultIconCreateFunction: function (cluster) { 8539 var childCount = cluster.getChildCount(); 8540 8541 var c = ' marker-cluster-'; 8542 if (childCount < 10) { 8543 c += 'small'; 8544 } else if (childCount < 100) { 8545 c += 'medium'; 8546 } else { 8547 c += 'large'; 8548 } 8549 8550 return new L.DivIcon({ html: '<div><span>' + childCount + '</span></div>', className: 'marker-cluster' + c, iconSize: new L.Point(40, 40) }); 8551 }, 8552 8553 _bindEvents: function () { 8554 var map = this._map, 8555 spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom, 8556 showCoverageOnHover = this.options.showCoverageOnHover, 8557 zoomToBoundsOnClick = this.options.zoomToBoundsOnClick; 8558 8559 //Zoom on cluster click or spiderfy if we are at the lowest level 8560 if (spiderfyOnMaxZoom || zoomToBoundsOnClick) { 8561 this.on('clusterclick', this._zoomOrSpiderfy, this); 8562 } 8563 8564 //Show convex hull (boundary) polygon on mouse over 8565 if (showCoverageOnHover) { 8566 this.on('clustermouseover', this._showCoverage, this); 8567 this.on('clustermouseout', this._hideCoverage, this); 8568 map.on('zoomend', this._hideCoverage, this); 8569 } 8570 }, 8571 8572 _zoomOrSpiderfy: function (e) { 8573 var cluster = e.layer, 8574 bottomCluster = cluster; 8575 8576 while (bottomCluster._childClusters.length === 1) { 8577 bottomCluster = bottomCluster._childClusters[0]; 8578 } 8579 8580 if (bottomCluster._zoom === this._maxZoom && 8581 bottomCluster._childCount === cluster._childCount && 8582 this.options.spiderfyOnMaxZoom) { 8583 8584 // All child markers are contained in a single cluster from this._maxZoom to this cluster. 8585 cluster.spiderfy(); 8586 } else if (this.options.zoomToBoundsOnClick) { 8587 cluster.zoomToBounds(); 8588 } 8589 8590 // Focus the map again for keyboard users. 8591 if (e.originalEvent && e.originalEvent.keyCode === 13) { 8592 this._map._container.focus(); 8593 } 8594 }, 8595 8596 _showCoverage: function (e) { 8597 var map = this._map; 8598 if (this._inZoomAnimation) { 8599 return; 8600 } 8601 if (this._shownPolygon) { 8602 map.removeLayer(this._shownPolygon); 8603 } 8604 if (e.layer.getChildCount() > 2 && e.layer !== this._spiderfied) { 8605 this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions); 8606 map.addLayer(this._shownPolygon); 8607 } 8608 }, 8609 8610 _hideCoverage: function () { 8611 if (this._shownPolygon) { 8612 this._map.removeLayer(this._shownPolygon); 8613 this._shownPolygon = null; 8614 } 8615 }, 8616 8617 _unbindEvents: function () { 8618 var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom, 8619 showCoverageOnHover = this.options.showCoverageOnHover, 8620 zoomToBoundsOnClick = this.options.zoomToBoundsOnClick, 8621 map = this._map; 8622 8623 if (spiderfyOnMaxZoom || zoomToBoundsOnClick) { 8624 this.off('clusterclick', this._zoomOrSpiderfy, this); 8625 } 8626 if (showCoverageOnHover) { 8627 this.off('clustermouseover', this._showCoverage, this); 8628 this.off('clustermouseout', this._hideCoverage, this); 8629 map.off('zoomend', this._hideCoverage, this); 8630 } 8631 }, 8632 8633 _zoomEnd: function () { 8634 if (!this._map) { //May have been removed from the map by a zoomEnd handler 8635 return; 8636 } 8637 this._mergeSplitClusters(); 8638 8639 this._zoom = Math.round(this._map._zoom); 8640 this._currentShownBounds = this._getExpandedVisibleBounds(); 8641 }, 8642 8643 _moveEnd: function () { 8644 if (this._inZoomAnimation) { 8645 return; 8646 } 8647 8648 var newBounds = this._getExpandedVisibleBounds(); 8649 8650 this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds); 8651 this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds); 8652 8653 this._currentShownBounds = newBounds; 8654 return; 8655 }, 8656 8657 _generateInitialClusters: function () { 8658 var maxZoom = Math.ceil(this._map.getMaxZoom()), 8659 minZoom = Math.floor(this._map.getMinZoom()), 8660 radius = this.options.maxClusterRadius, 8661 radiusFn = radius; 8662 8663 //If we just set maxClusterRadius to a single number, we need to create 8664 //a simple function to return that number. Otherwise, we just have to 8665 //use the function we've passed in. 8666 if (typeof radius !== "function") { 8667 radiusFn = function () { return radius; }; 8668 } 8669 8670 if (this.options.disableClusteringAtZoom !== null) { 8671 maxZoom = this.options.disableClusteringAtZoom - 1; 8672 } 8673 this._maxZoom = maxZoom; 8674 this._gridClusters = {}; 8675 this._gridUnclustered = {}; 8676 8677 //Set up DistanceGrids for each zoom 8678 for (var zoom = maxZoom; zoom >= minZoom; zoom--) { 8679 this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom)); 8680 this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom)); 8681 } 8682 8683 // Instantiate the appropriate L.MarkerCluster class (animated or not). 8684 this._topClusterLevel = new this._markerCluster(this, minZoom - 1); 8685 }, 8686 8687 //Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom) 8688 _addLayer: function (layer, zoom) { 8689 var gridClusters = this._gridClusters, 8690 gridUnclustered = this._gridUnclustered, 8691 minZoom = Math.floor(this._map.getMinZoom()), 8692 markerPoint, z; 8693 8694 if (this.options.singleMarkerMode) { 8695 this._overrideMarkerIcon(layer); 8696 } 8697 8698 layer.on(this._childMarkerEventHandlers, this); 8699 8700 //Find the lowest zoom level to slot this one in 8701 for (; zoom >= minZoom; zoom--) { 8702 markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position 8703 8704 //Try find a cluster close by 8705 var closest = gridClusters[zoom].getNearObject(markerPoint); 8706 if (closest) { 8707 closest._addChild(layer); 8708 layer.__parent = closest; 8709 return; 8710 } 8711 8712 //Try find a marker close by to form a new cluster with 8713 closest = gridUnclustered[zoom].getNearObject(markerPoint); 8714 if (closest) { 8715 var parent = closest.__parent; 8716 if (parent) { 8717 this._removeLayer(closest, false); 8718 } 8719 8720 //Create new cluster with these 2 in it 8721 8722 var newCluster = new this._markerCluster(this, zoom, closest, layer); 8723 gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom)); 8724 closest.__parent = newCluster; 8725 layer.__parent = newCluster; 8726 8727 //First create any new intermediate parent clusters that don't exist 8728 var lastParent = newCluster; 8729 for (z = zoom - 1; z > parent._zoom; z--) { 8730 lastParent = new this._markerCluster(this, z, lastParent); 8731 gridClusters[z].addObject(lastParent, this._map.project(closest.getLatLng(), z)); 8732 } 8733 parent._addChild(lastParent); 8734 8735 //Remove closest from this zoom level and any above that it is in, replace with newCluster 8736 this._removeFromGridUnclustered(closest, zoom); 8737 8738 return; 8739 } 8740 8741 //Didn't manage to cluster in at this zoom, record us as a marker here and continue upwards 8742 gridUnclustered[zoom].addObject(layer, markerPoint); 8743 } 8744 8745 //Didn't get in anything, add us to the top 8746 this._topClusterLevel._addChild(layer); 8747 layer.__parent = this._topClusterLevel; 8748 return; 8749 }, 8750 8751 /** 8752 * Refreshes the icon of all "dirty" visible clusters. 8753 * Non-visible "dirty" clusters will be updated when they are added to the map. 8754 * @private 8755 */ 8756 _refreshClustersIcons: function () { 8757 this._featureGroup.eachLayer(function (c) { 8758 if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) { 8759 c._updateIcon(); 8760 } 8761 }); 8762 }, 8763 8764 //Enqueue code to fire after the marker expand/contract has happened 8765 _enqueue: function (fn) { 8766 this._queue.push(fn); 8767 if (!this._queueTimeout) { 8768 this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300); 8769 } 8770 }, 8771 _processQueue: function () { 8772 for (var i = 0; i < this._queue.length; i++) { 8773 this._queue[i].call(this); 8774 } 8775 this._queue.length = 0; 8776 clearTimeout(this._queueTimeout); 8777 this._queueTimeout = null; 8778 }, 8779 8780 //Merge and split any existing clusters that are too big or small 8781 _mergeSplitClusters: function () { 8782 var mapZoom = Math.round(this._map._zoom); 8783 8784 //In case we are starting to split before the animation finished 8785 this._processQueue(); 8786 8787 if (this._zoom < mapZoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split 8788 this._animationStart(); 8789 //Remove clusters now off screen 8790 this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds()); 8791 8792 this._animationZoomIn(this._zoom, mapZoom); 8793 8794 } else if (this._zoom > mapZoom) { //Zoom out, merge 8795 this._animationStart(); 8796 8797 this._animationZoomOut(this._zoom, mapZoom); 8798 } else { 8799 this._moveEnd(); 8800 } 8801 }, 8802 8803 //Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan) 8804 _getExpandedVisibleBounds: function () { 8805 if (!this.options.removeOutsideVisibleBounds) { 8806 return this._mapBoundsInfinite; 8807 } else if (L.Browser.mobile) { 8808 return this._checkBoundsMaxLat(this._map.getBounds()); 8809 } 8810 8811 return this._checkBoundsMaxLat(this._map.getBounds().pad(1)); // Padding expands the bounds by its own dimensions but scaled with the given factor. 8812 }, 8813 8814 /** 8815 * Expands the latitude to Infinity (or -Infinity) if the input bounds reach the map projection maximum defined latitude 8816 * (in the case of Web/Spherical Mercator, it is 85.0511287798 / see https://en.wikipedia.org/wiki/Web_Mercator#Formulas). 8817 * Otherwise, the removeOutsideVisibleBounds option will remove markers beyond that limit, whereas the same markers without 8818 * this option (or outside MCG) will have their position floored (ceiled) by the projection and rendered at that limit, 8819 * making the user think that MCG "eats" them and never displays them again. 8820 * @param bounds L.LatLngBounds 8821 * @returns {L.LatLngBounds} 8822 * @private 8823 */ 8824 _checkBoundsMaxLat: function (bounds) { 8825 var maxLat = this._maxLat; 8826 8827 if (maxLat !== undefined) { 8828 if (bounds.getNorth() >= maxLat) { 8829 bounds._northEast.lat = Infinity; 8830 } 8831 if (bounds.getSouth() <= -maxLat) { 8832 bounds._southWest.lat = -Infinity; 8833 } 8834 } 8835 8836 return bounds; 8837 }, 8838 8839 //Shared animation code 8840 _animationAddLayerNonAnimated: function (layer, newCluster) { 8841 if (newCluster === layer) { 8842 this._featureGroup.addLayer(layer); 8843 } else if (newCluster._childCount === 2) { 8844 newCluster._addToMap(); 8845 8846 var markers = newCluster.getAllChildMarkers(); 8847 this._featureGroup.removeLayer(markers[0]); 8848 this._featureGroup.removeLayer(markers[1]); 8849 } else { 8850 newCluster._updateIcon(); 8851 } 8852 }, 8853 8854 /** 8855 * Extracts individual (i.e. non-group) layers from a Layer Group. 8856 * @param group to extract layers from. 8857 * @param output {Array} in which to store the extracted layers. 8858 * @returns {*|Array} 8859 * @private 8860 */ 8861 _extractNonGroupLayers: function (group, output) { 8862 var layers = group.getLayers(), 8863 i = 0, 8864 layer; 8865 8866 output = output || []; 8867 8868 for (; i < layers.length; i++) { 8869 layer = layers[i]; 8870 8871 if (layer instanceof L.LayerGroup) { 8872 this._extractNonGroupLayers(layer, output); 8873 continue; 8874 } 8875 8876 output.push(layer); 8877 } 8878 8879 return output; 8880 }, 8881 8882 /** 8883 * Implements the singleMarkerMode option. 8884 * @param layer Marker to re-style using the Clusters iconCreateFunction. 8885 * @returns {L.Icon} The newly created icon. 8886 * @private 8887 */ 8888 _overrideMarkerIcon: function (layer) { 8889 var icon = layer.options.icon = this.options.iconCreateFunction({ 8890 getChildCount: function () { 8891 return 1; 8892 }, 8893 getAllChildMarkers: function () { 8894 return [layer]; 8895 } 8896 }); 8897 8898 return icon; 8899 } 8900}); 8901 8902// Constant bounds used in case option "removeOutsideVisibleBounds" is set to false. 8903L.MarkerClusterGroup.include({ 8904 _mapBoundsInfinite: new L.LatLngBounds(new L.LatLng(-Infinity, -Infinity), new L.LatLng(Infinity, Infinity)) 8905}); 8906 8907L.MarkerClusterGroup.include({ 8908 _noAnimation: { 8909 //Non Animated versions of everything 8910 _animationStart: function () { 8911 //Do nothing... 8912 }, 8913 _animationZoomIn: function (previousZoomLevel, newZoomLevel) { 8914 this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel); 8915 this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); 8916 8917 //We didn't actually animate, but we use this event to mean "clustering animations have finished" 8918 this.fire('animationend'); 8919 }, 8920 _animationZoomOut: function (previousZoomLevel, newZoomLevel) { 8921 this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel); 8922 this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); 8923 8924 //We didn't actually animate, but we use this event to mean "clustering animations have finished" 8925 this.fire('animationend'); 8926 }, 8927 _animationAddLayer: function (layer, newCluster) { 8928 this._animationAddLayerNonAnimated(layer, newCluster); 8929 } 8930 }, 8931 8932 _withAnimation: { 8933 //Animated versions here 8934 _animationStart: function () { 8935 this._map._mapPane.className += ' leaflet-cluster-anim'; 8936 this._inZoomAnimation++; 8937 }, 8938 8939 _animationZoomIn: function (previousZoomLevel, newZoomLevel) { 8940 var bounds = this._getExpandedVisibleBounds(), 8941 fg = this._featureGroup, 8942 minZoom = Math.floor(this._map.getMinZoom()), 8943 i; 8944 8945 this._ignoreMove = true; 8946 8947 //Add all children of current clusters to map and remove those clusters from map 8948 this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) { 8949 var startPos = c._latlng, 8950 markers = c._markers, 8951 m; 8952 8953 if (!bounds.contains(startPos)) { 8954 startPos = null; 8955 } 8956 8957 if (c._isSingleParent() && previousZoomLevel + 1 === newZoomLevel) { //Immediately add the new child and remove us 8958 fg.removeLayer(c); 8959 c._recursivelyAddChildrenToMap(null, newZoomLevel, bounds); 8960 } else { 8961 //Fade out old cluster 8962 c.clusterHide(); 8963 c._recursivelyAddChildrenToMap(startPos, newZoomLevel, bounds); 8964 } 8965 8966 //Remove all markers that aren't visible any more 8967 //TODO: Do we actually need to do this on the higher levels too? 8968 for (i = markers.length - 1; i >= 0; i--) { 8969 m = markers[i]; 8970 if (!bounds.contains(m._latlng)) { 8971 fg.removeLayer(m); 8972 } 8973 } 8974 8975 }); 8976 8977 this._forceLayout(); 8978 8979 //Update opacities 8980 this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel); 8981 //TODO Maybe? Update markers in _recursivelyBecomeVisible 8982 fg.eachLayer(function (n) { 8983 if (!(n instanceof L.MarkerCluster) && n._icon) { 8984 n.clusterShow(); 8985 } 8986 }); 8987 8988 //update the positions of the just added clusters/markers 8989 this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) { 8990 c._recursivelyRestoreChildPositions(newZoomLevel); 8991 }); 8992 8993 this._ignoreMove = false; 8994 8995 //Remove the old clusters and close the zoom animation 8996 this._enqueue(function () { 8997 //update the positions of the just added clusters/markers 8998 this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) { 8999 fg.removeLayer(c); 9000 c.clusterShow(); 9001 }); 9002 9003 this._animationEnd(); 9004 }); 9005 }, 9006 9007 _animationZoomOut: function (previousZoomLevel, newZoomLevel) { 9008 this._animationZoomOutSingle(this._topClusterLevel, previousZoomLevel - 1, newZoomLevel); 9009 9010 //Need to add markers for those that weren't on the map before but are now 9011 this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); 9012 //Remove markers that were on the map before but won't be now 9013 this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds()); 9014 }, 9015 9016 _animationAddLayer: function (layer, newCluster) { 9017 var me = this, 9018 fg = this._featureGroup; 9019 9020 fg.addLayer(layer); 9021 if (newCluster !== layer) { 9022 if (newCluster._childCount > 2) { //Was already a cluster 9023 9024 newCluster._updateIcon(); 9025 this._forceLayout(); 9026 this._animationStart(); 9027 9028 layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng())); 9029 layer.clusterHide(); 9030 9031 this._enqueue(function () { 9032 fg.removeLayer(layer); 9033 layer.clusterShow(); 9034 9035 me._animationEnd(); 9036 }); 9037 9038 } else { //Just became a cluster 9039 this._forceLayout(); 9040 9041 me._animationStart(); 9042 me._animationZoomOutSingle(newCluster, this._map.getMaxZoom(), this._zoom); 9043 } 9044 } 9045 } 9046 }, 9047 9048 // Private methods for animated versions. 9049 _animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) { 9050 var bounds = this._getExpandedVisibleBounds(), 9051 minZoom = Math.floor(this._map.getMinZoom()); 9052 9053 //Animate all of the markers in the clusters to move to their cluster center point 9054 cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, minZoom, previousZoomLevel + 1, newZoomLevel); 9055 9056 var me = this; 9057 9058 //Update the opacity (If we immediately set it they won't animate) 9059 this._forceLayout(); 9060 cluster._recursivelyBecomeVisible(bounds, newZoomLevel); 9061 9062 //TODO: Maybe use the transition timing stuff to make this more reliable 9063 //When the animations are done, tidy up 9064 this._enqueue(function () { 9065 9066 //This cluster stopped being a cluster before the timeout fired 9067 if (cluster._childCount === 1) { 9068 var m = cluster._markers[0]; 9069 //If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it 9070 this._ignoreMove = true; 9071 m.setLatLng(m.getLatLng()); 9072 this._ignoreMove = false; 9073 if (m.clusterShow) { 9074 m.clusterShow(); 9075 } 9076 } else { 9077 cluster._recursively(bounds, newZoomLevel, minZoom, function (c) { 9078 c._recursivelyRemoveChildrenFromMap(bounds, minZoom, previousZoomLevel + 1); 9079 }); 9080 } 9081 me._animationEnd(); 9082 }); 9083 }, 9084 9085 _animationEnd: function () { 9086 if (this._map) { 9087 this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', ''); 9088 } 9089 this._inZoomAnimation--; 9090 this.fire('animationend'); 9091 }, 9092 9093 //Force a browser layout of stuff in the map 9094 // Should apply the current opacity and location to all elements so we can update them again for an animation 9095 _forceLayout: function () { 9096 //In my testing this works, infact offsetWidth of any element seems to work. 9097 //Could loop all this._layers and do this for each _icon if it stops working 9098 9099 L.Util.falseFn(document.body.offsetWidth); 9100 } 9101}); 9102 9103L.markerClusterGroup = function (options) { 9104 return new L.MarkerClusterGroup(options); 9105}; 9106 9107var MarkerCluster = L.MarkerCluster = L.Marker.extend({ 9108 options: L.Icon.prototype.options, 9109 9110 initialize: function (group, zoom, a, b) { 9111 9112 L.Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new L.LatLng(0, 0), 9113 { icon: this, pane: group.options.clusterPane }); 9114 9115 this._group = group; 9116 this._zoom = zoom; 9117 9118 this._markers = []; 9119 this._childClusters = []; 9120 this._childCount = 0; 9121 this._iconNeedsUpdate = true; 9122 this._boundsNeedUpdate = true; 9123 9124 this._bounds = new L.LatLngBounds(); 9125 9126 if (a) { 9127 this._addChild(a); 9128 } 9129 if (b) { 9130 this._addChild(b); 9131 } 9132 }, 9133 9134 //Recursively retrieve all child markers of this cluster 9135 getAllChildMarkers: function (storageArray, ignoreDraggedMarker) { 9136 storageArray = storageArray || []; 9137 9138 for (var i = this._childClusters.length - 1; i >= 0; i--) { 9139 this._childClusters[i].getAllChildMarkers(storageArray); 9140 } 9141 9142 for (var j = this._markers.length - 1; j >= 0; j--) { 9143 if (ignoreDraggedMarker && this._markers[j].__dragStart) { 9144 continue; 9145 } 9146 storageArray.push(this._markers[j]); 9147 } 9148 9149 return storageArray; 9150 }, 9151 9152 //Returns the count of how many child markers we have 9153 getChildCount: function () { 9154 return this._childCount; 9155 }, 9156 9157 //Zoom to the minimum of showing all of the child markers, or the extents of this cluster 9158 zoomToBounds: function (fitBoundsOptions) { 9159 var childClusters = this._childClusters.slice(), 9160 map = this._group._map, 9161 boundsZoom = map.getBoundsZoom(this._bounds), 9162 zoom = this._zoom + 1, 9163 mapZoom = map.getZoom(), 9164 i; 9165 9166 //calculate how far we need to zoom down to see all of the markers 9167 while (childClusters.length > 0 && boundsZoom > zoom) { 9168 zoom++; 9169 var newClusters = []; 9170 for (i = 0; i < childClusters.length; i++) { 9171 newClusters = newClusters.concat(childClusters[i]._childClusters); 9172 } 9173 childClusters = newClusters; 9174 } 9175 9176 if (boundsZoom > zoom) { 9177 this._group._map.setView(this._latlng, zoom); 9178 } else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead 9179 this._group._map.setView(this._latlng, mapZoom + 1); 9180 } else { 9181 this._group._map.fitBounds(this._bounds, fitBoundsOptions); 9182 } 9183 }, 9184 9185 getBounds: function () { 9186 var bounds = new L.LatLngBounds(); 9187 bounds.extend(this._bounds); 9188 return bounds; 9189 }, 9190 9191 _updateIcon: function () { 9192 this._iconNeedsUpdate = true; 9193 if (this._icon) { 9194 this.setIcon(this); 9195 } 9196 }, 9197 9198 //Cludge for Icon, we pretend to be an icon for performance 9199 createIcon: function () { 9200 if (this._iconNeedsUpdate) { 9201 this._iconObj = this._group.options.iconCreateFunction(this); 9202 this._iconNeedsUpdate = false; 9203 } 9204 return this._iconObj.createIcon(); 9205 }, 9206 createShadow: function () { 9207 return this._iconObj.createShadow(); 9208 }, 9209 9210 9211 _addChild: function (new1, isNotificationFromChild) { 9212 9213 this._iconNeedsUpdate = true; 9214 9215 this._boundsNeedUpdate = true; 9216 this._setClusterCenter(new1); 9217 9218 if (new1 instanceof L.MarkerCluster) { 9219 if (!isNotificationFromChild) { 9220 this._childClusters.push(new1); 9221 new1.__parent = this; 9222 } 9223 this._childCount += new1._childCount; 9224 } else { 9225 if (!isNotificationFromChild) { 9226 this._markers.push(new1); 9227 } 9228 this._childCount++; 9229 } 9230 9231 if (this.__parent) { 9232 this.__parent._addChild(new1, true); 9233 } 9234 }, 9235 9236 /** 9237 * Makes sure the cluster center is set. If not, uses the child center if it is a cluster, or the marker position. 9238 * @param child L.MarkerCluster|L.Marker that will be used as cluster center if not defined yet. 9239 * @private 9240 */ 9241 _setClusterCenter: function (child) { 9242 if (!this._cLatLng) { 9243 // when clustering, take position of the first point as the cluster center 9244 this._cLatLng = child._cLatLng || child._latlng; 9245 } 9246 }, 9247 9248 /** 9249 * Assigns impossible bounding values so that the next extend entirely determines the new bounds. 9250 * This method avoids having to trash the previous L.LatLngBounds object and to create a new one, which is much slower for this class. 9251 * As long as the bounds are not extended, most other methods would probably fail, as they would with bounds initialized but not extended. 9252 * @private 9253 */ 9254 _resetBounds: function () { 9255 var bounds = this._bounds; 9256 9257 if (bounds._southWest) { 9258 bounds._southWest.lat = Infinity; 9259 bounds._southWest.lng = Infinity; 9260 } 9261 if (bounds._northEast) { 9262 bounds._northEast.lat = -Infinity; 9263 bounds._northEast.lng = -Infinity; 9264 } 9265 }, 9266 9267 _recalculateBounds: function () { 9268 var markers = this._markers, 9269 childClusters = this._childClusters, 9270 latSum = 0, 9271 lngSum = 0, 9272 totalCount = this._childCount, 9273 i, child, childLatLng, childCount; 9274 9275 // Case where all markers are removed from the map and we are left with just an empty _topClusterLevel. 9276 if (totalCount === 0) { 9277 return; 9278 } 9279 9280 // Reset rather than creating a new object, for performance. 9281 this._resetBounds(); 9282 9283 // Child markers. 9284 for (i = 0; i < markers.length; i++) { 9285 childLatLng = markers[i]._latlng; 9286 9287 this._bounds.extend(childLatLng); 9288 9289 latSum += childLatLng.lat; 9290 lngSum += childLatLng.lng; 9291 } 9292 9293 // Child clusters. 9294 for (i = 0; i < childClusters.length; i++) { 9295 child = childClusters[i]; 9296 9297 // Re-compute child bounds and weighted position first if necessary. 9298 if (child._boundsNeedUpdate) { 9299 child._recalculateBounds(); 9300 } 9301 9302 this._bounds.extend(child._bounds); 9303 9304 childLatLng = child._wLatLng; 9305 childCount = child._childCount; 9306 9307 latSum += childLatLng.lat * childCount; 9308 lngSum += childLatLng.lng * childCount; 9309 } 9310 9311 this._latlng = this._wLatLng = new L.LatLng(latSum / totalCount, lngSum / totalCount); 9312 9313 // Reset dirty flag. 9314 this._boundsNeedUpdate = false; 9315 }, 9316 9317 //Set our markers position as given and add it to the map 9318 _addToMap: function (startPos) { 9319 if (startPos) { 9320 this._backupLatlng = this._latlng; 9321 this.setLatLng(startPos); 9322 } 9323 this._group._featureGroup.addLayer(this); 9324 }, 9325 9326 _recursivelyAnimateChildrenIn: function (bounds, center, maxZoom) { 9327 this._recursively(bounds, this._group._map.getMinZoom(), maxZoom - 1, 9328 function (c) { 9329 var markers = c._markers, 9330 i, m; 9331 for (i = markers.length - 1; i >= 0; i--) { 9332 m = markers[i]; 9333 9334 //Only do it if the icon is still on the map 9335 if (m._icon) { 9336 m._setPos(center); 9337 m.clusterHide(); 9338 } 9339 } 9340 }, 9341 function (c) { 9342 var childClusters = c._childClusters, 9343 j, cm; 9344 for (j = childClusters.length - 1; j >= 0; j--) { 9345 cm = childClusters[j]; 9346 if (cm._icon) { 9347 cm._setPos(center); 9348 cm.clusterHide(); 9349 } 9350 } 9351 } 9352 ); 9353 }, 9354 9355 _recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, mapMinZoom, previousZoomLevel, newZoomLevel) { 9356 this._recursively(bounds, newZoomLevel, mapMinZoom, 9357 function (c) { 9358 c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel); 9359 9360 //TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be. 9361 //As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate 9362 if (c._isSingleParent() && previousZoomLevel - 1 === newZoomLevel) { 9363 c.clusterShow(); 9364 c._recursivelyRemoveChildrenFromMap(bounds, mapMinZoom, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds 9365 } else { 9366 c.clusterHide(); 9367 } 9368 9369 c._addToMap(); 9370 } 9371 ); 9372 }, 9373 9374 _recursivelyBecomeVisible: function (bounds, zoomLevel) { 9375 this._recursively(bounds, this._group._map.getMinZoom(), zoomLevel, null, function (c) { 9376 c.clusterShow(); 9377 }); 9378 }, 9379 9380 _recursivelyAddChildrenToMap: function (startPos, zoomLevel, bounds) { 9381 this._recursively(bounds, this._group._map.getMinZoom() - 1, zoomLevel, 9382 function (c) { 9383 if (zoomLevel === c._zoom) { 9384 return; 9385 } 9386 9387 //Add our child markers at startPos (so they can be animated out) 9388 for (var i = c._markers.length - 1; i >= 0; i--) { 9389 var nm = c._markers[i]; 9390 9391 if (!bounds.contains(nm._latlng)) { 9392 continue; 9393 } 9394 9395 if (startPos) { 9396 nm._backupLatlng = nm.getLatLng(); 9397 9398 nm.setLatLng(startPos); 9399 if (nm.clusterHide) { 9400 nm.clusterHide(); 9401 } 9402 } 9403 9404 c._group._featureGroup.addLayer(nm); 9405 } 9406 }, 9407 function (c) { 9408 c._addToMap(startPos); 9409 } 9410 ); 9411 }, 9412 9413 _recursivelyRestoreChildPositions: function (zoomLevel) { 9414 //Fix positions of child markers 9415 for (var i = this._markers.length - 1; i >= 0; i--) { 9416 var nm = this._markers[i]; 9417 if (nm._backupLatlng) { 9418 nm.setLatLng(nm._backupLatlng); 9419 delete nm._backupLatlng; 9420 } 9421 } 9422 9423 if (zoomLevel - 1 === this._zoom) { 9424 //Reposition child clusters 9425 for (var j = this._childClusters.length - 1; j >= 0; j--) { 9426 this._childClusters[j]._restorePosition(); 9427 } 9428 } else { 9429 for (var k = this._childClusters.length - 1; k >= 0; k--) { 9430 this._childClusters[k]._recursivelyRestoreChildPositions(zoomLevel); 9431 } 9432 } 9433 }, 9434 9435 _restorePosition: function () { 9436 if (this._backupLatlng) { 9437 this.setLatLng(this._backupLatlng); 9438 delete this._backupLatlng; 9439 } 9440 }, 9441 9442 //exceptBounds: If set, don't remove any markers/clusters in it 9443 _recursivelyRemoveChildrenFromMap: function (previousBounds, mapMinZoom, zoomLevel, exceptBounds) { 9444 var m, i; 9445 this._recursively(previousBounds, mapMinZoom - 1, zoomLevel - 1, 9446 function (c) { 9447 //Remove markers at every level 9448 for (i = c._markers.length - 1; i >= 0; i--) { 9449 m = c._markers[i]; 9450 if (!exceptBounds || !exceptBounds.contains(m._latlng)) { 9451 c._group._featureGroup.removeLayer(m); 9452 if (m.clusterShow) { 9453 m.clusterShow(); 9454 } 9455 } 9456 } 9457 }, 9458 function (c) { 9459 //Remove child clusters at just the bottom level 9460 for (i = c._childClusters.length - 1; i >= 0; i--) { 9461 m = c._childClusters[i]; 9462 if (!exceptBounds || !exceptBounds.contains(m._latlng)) { 9463 c._group._featureGroup.removeLayer(m); 9464 if (m.clusterShow) { 9465 m.clusterShow(); 9466 } 9467 } 9468 } 9469 } 9470 ); 9471 }, 9472 9473 //Run the given functions recursively to this and child clusters 9474 // boundsToApplyTo: a L.LatLngBounds representing the bounds of what clusters to recurse in to 9475 // zoomLevelToStart: zoom level to start running functions (inclusive) 9476 // zoomLevelToStop: zoom level to stop running functions (inclusive) 9477 // runAtEveryLevel: function that takes an L.MarkerCluster as an argument that should be applied on every level 9478 // runAtBottomLevel: function that takes an L.MarkerCluster as an argument that should be applied at only the bottom level 9479 _recursively: function (boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel) { 9480 var childClusters = this._childClusters, 9481 zoom = this._zoom, 9482 i, c; 9483 9484 if (zoomLevelToStart <= zoom) { 9485 if (runAtEveryLevel) { 9486 runAtEveryLevel(this); 9487 } 9488 if (runAtBottomLevel && zoom === zoomLevelToStop) { 9489 runAtBottomLevel(this); 9490 } 9491 } 9492 9493 if (zoom < zoomLevelToStart || zoom < zoomLevelToStop) { 9494 for (i = childClusters.length - 1; i >= 0; i--) { 9495 c = childClusters[i]; 9496 if (c._boundsNeedUpdate) { 9497 c._recalculateBounds(); 9498 } 9499 if (boundsToApplyTo.intersects(c._bounds)) { 9500 c._recursively(boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel); 9501 } 9502 } 9503 } 9504 }, 9505 9506 //Returns true if we are the parent of only one cluster and that cluster is the same as us 9507 _isSingleParent: function () { 9508 //Don't need to check this._markers as the rest won't work if there are any 9509 return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount; 9510 } 9511}); 9512 9513/* 9514* Extends L.Marker to include two extra methods: clusterHide and clusterShow. 9515* 9516* They work as setOpacity(0) and setOpacity(1) respectively, but 9517* don't overwrite the options.opacity 9518* 9519*/ 9520 9521L.Marker.include({ 9522 clusterHide: function () { 9523 var backup = this.options.opacity; 9524 this.setOpacity(0); 9525 this.options.opacity = backup; 9526 return this; 9527 }, 9528 9529 clusterShow: function () { 9530 return this.setOpacity(this.options.opacity); 9531 } 9532}); 9533 9534L.DistanceGrid = function (cellSize) { 9535 this._cellSize = cellSize; 9536 this._sqCellSize = cellSize * cellSize; 9537 this._grid = {}; 9538 this._objectPoint = { }; 9539}; 9540 9541L.DistanceGrid.prototype = { 9542 9543 addObject: function (obj, point) { 9544 var x = this._getCoord(point.x), 9545 y = this._getCoord(point.y), 9546 grid = this._grid, 9547 row = grid[y] = grid[y] || {}, 9548 cell = row[x] = row[x] || [], 9549 stamp = L.Util.stamp(obj); 9550 9551 this._objectPoint[stamp] = point; 9552 9553 cell.push(obj); 9554 }, 9555 9556 updateObject: function (obj, point) { 9557 this.removeObject(obj); 9558 this.addObject(obj, point); 9559 }, 9560 9561 //Returns true if the object was found 9562 removeObject: function (obj, point) { 9563 var x = this._getCoord(point.x), 9564 y = this._getCoord(point.y), 9565 grid = this._grid, 9566 row = grid[y] = grid[y] || {}, 9567 cell = row[x] = row[x] || [], 9568 i, len; 9569 9570 delete this._objectPoint[L.Util.stamp(obj)]; 9571 9572 for (i = 0, len = cell.length; i < len; i++) { 9573 if (cell[i] === obj) { 9574 9575 cell.splice(i, 1); 9576 9577 if (len === 1) { 9578 delete row[x]; 9579 } 9580 9581 return true; 9582 } 9583 } 9584 9585 }, 9586 9587 eachObject: function (fn, context) { 9588 var i, j, k, len, row, cell, removed, 9589 grid = this._grid; 9590 9591 for (i in grid) { 9592 row = grid[i]; 9593 9594 for (j in row) { 9595 cell = row[j]; 9596 9597 for (k = 0, len = cell.length; k < len; k++) { 9598 removed = fn.call(context, cell[k]); 9599 if (removed) { 9600 k--; 9601 len--; 9602 } 9603 } 9604 } 9605 } 9606 }, 9607 9608 getNearObject: function (point) { 9609 var x = this._getCoord(point.x), 9610 y = this._getCoord(point.y), 9611 i, j, k, row, cell, len, obj, dist, 9612 objectPoint = this._objectPoint, 9613 closestDistSq = this._sqCellSize, 9614 closest = null; 9615 9616 for (i = y - 1; i <= y + 1; i++) { 9617 row = this._grid[i]; 9618 if (row) { 9619 9620 for (j = x - 1; j <= x + 1; j++) { 9621 cell = row[j]; 9622 if (cell) { 9623 9624 for (k = 0, len = cell.length; k < len; k++) { 9625 obj = cell[k]; 9626 dist = this._sqDist(objectPoint[L.Util.stamp(obj)], point); 9627 if (dist < closestDistSq || 9628 dist <= closestDistSq && closest === null) { 9629 closestDistSq = dist; 9630 closest = obj; 9631 } 9632 } 9633 } 9634 } 9635 } 9636 } 9637 return closest; 9638 }, 9639 9640 _getCoord: function (x) { 9641 var coord = Math.floor(x / this._cellSize); 9642 return isFinite(coord) ? coord : x; 9643 }, 9644 9645 _sqDist: function (p, p2) { 9646 var dx = p2.x - p.x, 9647 dy = p2.y - p.y; 9648 return dx * dx + dy * dy; 9649 } 9650}; 9651 9652/* Copyright (c) 2012 the authors listed at the following URL, and/or 9653the authors of referenced articles or incorporated external code: 9654http://en.literateprograms.org/Quickhull_(Javascript)?action=history&offset=20120410175256 9655 9656Permission is hereby granted, free of charge, to any person obtaining 9657a copy of this software and associated documentation files (the 9658"Software"), to deal in the Software without restriction, including 9659without limitation the rights to use, copy, modify, merge, publish, 9660distribute, sublicense, and/or sell copies of the Software, and to 9661permit persons to whom the Software is furnished to do so, subject to 9662the following conditions: 9663 9664The above copyright notice and this permission notice shall be 9665included in all copies or substantial portions of the Software. 9666 9667THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 9668EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 9669MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 9670IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 9671CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 9672TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 9673SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9674 9675Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=18434 9676*/ 9677 9678(function () { 9679 L.QuickHull = { 9680 9681 /* 9682 * @param {Object} cpt a point to be measured from the baseline 9683 * @param {Array} bl the baseline, as represented by a two-element 9684 * array of latlng objects. 9685 * @returns {Number} an approximate distance measure 9686 */ 9687 getDistant: function (cpt, bl) { 9688 var vY = bl[1].lat - bl[0].lat, 9689 vX = bl[0].lng - bl[1].lng; 9690 return (vX * (cpt.lat - bl[0].lat) + vY * (cpt.lng - bl[0].lng)); 9691 }, 9692 9693 /* 9694 * @param {Array} baseLine a two-element array of latlng objects 9695 * representing the baseline to project from 9696 * @param {Array} latLngs an array of latlng objects 9697 * @returns {Object} the maximum point and all new points to stay 9698 * in consideration for the hull. 9699 */ 9700 findMostDistantPointFromBaseLine: function (baseLine, latLngs) { 9701 var maxD = 0, 9702 maxPt = null, 9703 newPoints = [], 9704 i, pt, d; 9705 9706 for (i = latLngs.length - 1; i >= 0; i--) { 9707 pt = latLngs[i]; 9708 d = this.getDistant(pt, baseLine); 9709 9710 if (d > 0) { 9711 newPoints.push(pt); 9712 } else { 9713 continue; 9714 } 9715 9716 if (d > maxD) { 9717 maxD = d; 9718 maxPt = pt; 9719 } 9720 } 9721 9722 return { maxPoint: maxPt, newPoints: newPoints }; 9723 }, 9724 9725 9726 /* 9727 * Given a baseline, compute the convex hull of latLngs as an array 9728 * of latLngs. 9729 * 9730 * @param {Array} latLngs 9731 * @returns {Array} 9732 */ 9733 buildConvexHull: function (baseLine, latLngs) { 9734 var convexHullBaseLines = [], 9735 t = this.findMostDistantPointFromBaseLine(baseLine, latLngs); 9736 9737 if (t.maxPoint) { // if there is still a point "outside" the base line 9738 convexHullBaseLines = 9739 convexHullBaseLines.concat( 9740 this.buildConvexHull([baseLine[0], t.maxPoint], t.newPoints) 9741 ); 9742 convexHullBaseLines = 9743 convexHullBaseLines.concat( 9744 this.buildConvexHull([t.maxPoint, baseLine[1]], t.newPoints) 9745 ); 9746 return convexHullBaseLines; 9747 } else { // if there is no more point "outside" the base line, the current base line is part of the convex hull 9748 return [baseLine[0]]; 9749 } 9750 }, 9751 9752 /* 9753 * Given an array of latlngs, compute a convex hull as an array 9754 * of latlngs 9755 * 9756 * @param {Array} latLngs 9757 * @returns {Array} 9758 */ 9759 getConvexHull: function (latLngs) { 9760 // find first baseline 9761 var maxLat = false, minLat = false, 9762 maxLng = false, minLng = false, 9763 maxLatPt = null, minLatPt = null, 9764 maxLngPt = null, minLngPt = null, 9765 maxPt = null, minPt = null, 9766 i; 9767 9768 for (i = latLngs.length - 1; i >= 0; i--) { 9769 var pt = latLngs[i]; 9770 if (maxLat === false || pt.lat > maxLat) { 9771 maxLatPt = pt; 9772 maxLat = pt.lat; 9773 } 9774 if (minLat === false || pt.lat < minLat) { 9775 minLatPt = pt; 9776 minLat = pt.lat; 9777 } 9778 if (maxLng === false || pt.lng > maxLng) { 9779 maxLngPt = pt; 9780 maxLng = pt.lng; 9781 } 9782 if (minLng === false || pt.lng < minLng) { 9783 minLngPt = pt; 9784 minLng = pt.lng; 9785 } 9786 } 9787 9788 if (minLat !== maxLat) { 9789 minPt = minLatPt; 9790 maxPt = maxLatPt; 9791 } else { 9792 minPt = minLngPt; 9793 maxPt = maxLngPt; 9794 } 9795 9796 var ch = [].concat(this.buildConvexHull([minPt, maxPt], latLngs), 9797 this.buildConvexHull([maxPt, minPt], latLngs)); 9798 return ch; 9799 } 9800 }; 9801}()); 9802 9803L.MarkerCluster.include({ 9804 getConvexHull: function () { 9805 var childMarkers = this.getAllChildMarkers(), 9806 points = [], 9807 p, i; 9808 9809 for (i = childMarkers.length - 1; i >= 0; i--) { 9810 p = childMarkers[i].getLatLng(); 9811 points.push(p); 9812 } 9813 9814 return L.QuickHull.getConvexHull(points); 9815 } 9816}); 9817 9818//This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet 9819//Huge thanks to jawj for implementing it first to make my job easy :-) 9820 9821L.MarkerCluster.include({ 9822 9823 _2PI: Math.PI * 2, 9824 _circleFootSeparation: 25, //related to circumference of circle 9825 _circleStartAngle: 0, 9826 9827 _spiralFootSeparation: 28, //related to size of spiral (experiment!) 9828 _spiralLengthStart: 11, 9829 _spiralLengthFactor: 5, 9830 9831 _circleSpiralSwitchover: 9, //show spiral instead of circle from this marker count upwards. 9832 // 0 -> always spiral; Infinity -> always circle 9833 9834 spiderfy: function () { 9835 if (this._group._spiderfied === this || this._group._inZoomAnimation) { 9836 return; 9837 } 9838 9839 var childMarkers = this.getAllChildMarkers(null, true), 9840 group = this._group, 9841 map = group._map, 9842 center = map.latLngToLayerPoint(this._latlng), 9843 positions; 9844 9845 this._group._unspiderfy(); 9846 this._group._spiderfied = this; 9847 9848 //TODO Maybe: childMarkers order by distance to center 9849 9850 if (childMarkers.length >= this._circleSpiralSwitchover) { 9851 positions = this._generatePointsSpiral(childMarkers.length, center); 9852 } else { 9853 center.y += 10; // Otherwise circles look wrong => hack for standard blue icon, renders differently for other icons. 9854 positions = this._generatePointsCircle(childMarkers.length, center); 9855 } 9856 9857 this._animationSpiderfy(childMarkers, positions); 9858 }, 9859 9860 unspiderfy: function (zoomDetails) { 9861 /// <param Name="zoomDetails">Argument from zoomanim if being called in a zoom animation or null otherwise</param> 9862 if (this._group._inZoomAnimation) { 9863 return; 9864 } 9865 this._animationUnspiderfy(zoomDetails); 9866 9867 this._group._spiderfied = null; 9868 }, 9869 9870 _generatePointsCircle: function (count, centerPt) { 9871 var circumference = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + count), 9872 legLength = circumference / this._2PI, //radius from circumference 9873 angleStep = this._2PI / count, 9874 res = [], 9875 i, angle; 9876 9877 legLength = Math.max(legLength, 35); // Minimum distance to get outside the cluster icon. 9878 9879 res.length = count; 9880 9881 for (i = 0; i < count; i++) { // Clockwise, like spiral. 9882 angle = this._circleStartAngle + i * angleStep; 9883 res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); 9884 } 9885 9886 return res; 9887 }, 9888 9889 _generatePointsSpiral: function (count, centerPt) { 9890 var spiderfyDistanceMultiplier = this._group.options.spiderfyDistanceMultiplier, 9891 legLength = spiderfyDistanceMultiplier * this._spiralLengthStart, 9892 separation = spiderfyDistanceMultiplier * this._spiralFootSeparation, 9893 lengthFactor = spiderfyDistanceMultiplier * this._spiralLengthFactor * this._2PI, 9894 angle = 0, 9895 res = [], 9896 i; 9897 9898 res.length = count; 9899 9900 // Higher index, closer position to cluster center. 9901 for (i = count; i >= 0; i--) { 9902 // Skip the first position, so that we are already farther from center and we avoid 9903 // being under the default cluster icon (especially important for Circle Markers). 9904 if (i < count) { 9905 res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); 9906 } 9907 angle += separation / legLength + i * 0.0005; 9908 legLength += lengthFactor / angle; 9909 } 9910 return res; 9911 }, 9912 9913 _noanimationUnspiderfy: function () { 9914 var group = this._group, 9915 map = group._map, 9916 fg = group._featureGroup, 9917 childMarkers = this.getAllChildMarkers(null, true), 9918 m, i; 9919 9920 group._ignoreMove = true; 9921 9922 this.setOpacity(1); 9923 for (i = childMarkers.length - 1; i >= 0; i--) { 9924 m = childMarkers[i]; 9925 9926 fg.removeLayer(m); 9927 9928 if (m._preSpiderfyLatlng) { 9929 m.setLatLng(m._preSpiderfyLatlng); 9930 delete m._preSpiderfyLatlng; 9931 } 9932 if (m.setZIndexOffset) { 9933 m.setZIndexOffset(0); 9934 } 9935 9936 if (m._spiderLeg) { 9937 map.removeLayer(m._spiderLeg); 9938 delete m._spiderLeg; 9939 } 9940 } 9941 9942 group.fire('unspiderfied', { 9943 cluster: this, 9944 markers: childMarkers 9945 }); 9946 group._ignoreMove = false; 9947 group._spiderfied = null; 9948 } 9949}); 9950 9951//Non Animated versions of everything 9952L.MarkerClusterNonAnimated = L.MarkerCluster.extend({ 9953 _animationSpiderfy: function (childMarkers, positions) { 9954 var group = this._group, 9955 map = group._map, 9956 fg = group._featureGroup, 9957 legOptions = this._group.options.spiderLegPolylineOptions, 9958 i, m, leg, newPos; 9959 9960 group._ignoreMove = true; 9961 9962 // Traverse in ascending order to make sure that inner circleMarkers are on top of further legs. Normal markers are re-ordered by newPosition. 9963 // The reverse order trick no longer improves performance on modern browsers. 9964 for (i = 0; i < childMarkers.length; i++) { 9965 newPos = map.layerPointToLatLng(positions[i]); 9966 m = childMarkers[i]; 9967 9968 // Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it. 9969 leg = new L.Polyline([this._latlng, newPos], legOptions); 9970 map.addLayer(leg); 9971 m._spiderLeg = leg; 9972 9973 // Now add the marker. 9974 m._preSpiderfyLatlng = m._latlng; 9975 m.setLatLng(newPos); 9976 if (m.setZIndexOffset) { 9977 m.setZIndexOffset(1000000); //Make these appear on top of EVERYTHING 9978 } 9979 9980 fg.addLayer(m); 9981 } 9982 this.setOpacity(0.3); 9983 9984 group._ignoreMove = false; 9985 group.fire('spiderfied', { 9986 cluster: this, 9987 markers: childMarkers 9988 }); 9989 }, 9990 9991 _animationUnspiderfy: function () { 9992 this._noanimationUnspiderfy(); 9993 } 9994}); 9995 9996//Animated versions here 9997L.MarkerCluster.include({ 9998 9999 _animationSpiderfy: function (childMarkers, positions) { 10000 var me = this, 10001 group = this._group, 10002 map = group._map, 10003 fg = group._featureGroup, 10004 thisLayerLatLng = this._latlng, 10005 thisLayerPos = map.latLngToLayerPoint(thisLayerLatLng), 10006 svg = L.Path.SVG, 10007 legOptions = L.extend({}, this._group.options.spiderLegPolylineOptions), // Copy the options so that we can modify them for animation. 10008 finalLegOpacity = legOptions.opacity, 10009 i, m, leg, legPath, legLength, newPos; 10010 10011 if (finalLegOpacity === undefined) { 10012 finalLegOpacity = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity; 10013 } 10014 10015 if (svg) { 10016 // If the initial opacity of the spider leg is not 0 then it appears before the animation starts. 10017 legOptions.opacity = 0; 10018 10019 // Add the class for CSS transitions. 10020 legOptions.className = (legOptions.className || '') + ' leaflet-cluster-spider-leg'; 10021 } else { 10022 // Make sure we have a defined opacity. 10023 legOptions.opacity = finalLegOpacity; 10024 } 10025 10026 group._ignoreMove = true; 10027 10028 // Add markers and spider legs to map, hidden at our center point. 10029 // Traverse in ascending order to make sure that inner circleMarkers are on top of further legs. Normal markers are re-ordered by newPosition. 10030 // The reverse order trick no longer improves performance on modern browsers. 10031 for (i = 0; i < childMarkers.length; i++) { 10032 m = childMarkers[i]; 10033 10034 newPos = map.layerPointToLatLng(positions[i]); 10035 10036 // Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it. 10037 leg = new L.Polyline([thisLayerLatLng, newPos], legOptions); 10038 map.addLayer(leg); 10039 m._spiderLeg = leg; 10040 10041 // Explanations: https://jakearchibald.com/2013/animated-line-drawing-svg/ 10042 // In our case the transition property is declared in the CSS file. 10043 if (svg) { 10044 legPath = leg._path; 10045 legLength = legPath.getTotalLength() + 0.1; // Need a small extra length to avoid remaining dot in Firefox. 10046 legPath.style.strokeDasharray = legLength; // Just 1 length is enough, it will be duplicated. 10047 legPath.style.strokeDashoffset = legLength; 10048 } 10049 10050 // If it is a marker, add it now and we'll animate it out 10051 if (m.setZIndexOffset) { 10052 m.setZIndexOffset(1000000); // Make normal markers appear on top of EVERYTHING 10053 } 10054 if (m.clusterHide) { 10055 m.clusterHide(); 10056 } 10057 10058 // Vectors just get immediately added 10059 fg.addLayer(m); 10060 10061 if (m._setPos) { 10062 m._setPos(thisLayerPos); 10063 } 10064 } 10065 10066 group._forceLayout(); 10067 group._animationStart(); 10068 10069 // Reveal markers and spider legs. 10070 for (i = childMarkers.length - 1; i >= 0; i--) { 10071 newPos = map.layerPointToLatLng(positions[i]); 10072 m = childMarkers[i]; 10073 10074 //Move marker to new position 10075 m._preSpiderfyLatlng = m._latlng; 10076 m.setLatLng(newPos); 10077 10078 if (m.clusterShow) { 10079 m.clusterShow(); 10080 } 10081 10082 // Animate leg (animation is actually delegated to CSS transition). 10083 if (svg) { 10084 leg = m._spiderLeg; 10085 legPath = leg._path; 10086 legPath.style.strokeDashoffset = 0; 10087 //legPath.style.strokeOpacity = finalLegOpacity; 10088 leg.setStyle({opacity: finalLegOpacity}); 10089 } 10090 } 10091 this.setOpacity(0.3); 10092 10093 group._ignoreMove = false; 10094 10095 setTimeout(function () { 10096 group._animationEnd(); 10097 group.fire('spiderfied', { 10098 cluster: me, 10099 markers: childMarkers 10100 }); 10101 }, 200); 10102 }, 10103 10104 _animationUnspiderfy: function (zoomDetails) { 10105 var me = this, 10106 group = this._group, 10107 map = group._map, 10108 fg = group._featureGroup, 10109 thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng), 10110 childMarkers = this.getAllChildMarkers(null, true), 10111 svg = L.Path.SVG, 10112 m, i, leg, legPath, legLength, nonAnimatable; 10113 10114 group._ignoreMove = true; 10115 group._animationStart(); 10116 10117 //Make us visible and bring the child markers back in 10118 this.setOpacity(1); 10119 for (i = childMarkers.length - 1; i >= 0; i--) { 10120 m = childMarkers[i]; 10121 10122 //Marker was added to us after we were spiderfied 10123 if (!m._preSpiderfyLatlng) { 10124 continue; 10125 } 10126 10127 //Close any popup on the marker first, otherwise setting the location of the marker will make the map scroll 10128 m.closePopup(); 10129 10130 //Fix up the location to the real one 10131 m.setLatLng(m._preSpiderfyLatlng); 10132 delete m._preSpiderfyLatlng; 10133 10134 //Hack override the location to be our center 10135 nonAnimatable = true; 10136 if (m._setPos) { 10137 m._setPos(thisLayerPos); 10138 nonAnimatable = false; 10139 } 10140 if (m.clusterHide) { 10141 m.clusterHide(); 10142 nonAnimatable = false; 10143 } 10144 if (nonAnimatable) { 10145 fg.removeLayer(m); 10146 } 10147 10148 // Animate the spider leg back in (animation is actually delegated to CSS transition). 10149 if (svg) { 10150 leg = m._spiderLeg; 10151 legPath = leg._path; 10152 legLength = legPath.getTotalLength() + 0.1; 10153 legPath.style.strokeDashoffset = legLength; 10154 leg.setStyle({opacity: 0}); 10155 } 10156 } 10157 10158 group._ignoreMove = false; 10159 10160 setTimeout(function () { 10161 //If we have only <= one child left then that marker will be shown on the map so don't remove it! 10162 var stillThereChildCount = 0; 10163 for (i = childMarkers.length - 1; i >= 0; i--) { 10164 m = childMarkers[i]; 10165 if (m._spiderLeg) { 10166 stillThereChildCount++; 10167 } 10168 } 10169 10170 10171 for (i = childMarkers.length - 1; i >= 0; i--) { 10172 m = childMarkers[i]; 10173 10174 if (!m._spiderLeg) { //Has already been unspiderfied 10175 continue; 10176 } 10177 10178 if (m.clusterShow) { 10179 m.clusterShow(); 10180 } 10181 if (m.setZIndexOffset) { 10182 m.setZIndexOffset(0); 10183 } 10184 10185 if (stillThereChildCount > 1) { 10186 fg.removeLayer(m); 10187 } 10188 10189 map.removeLayer(m._spiderLeg); 10190 delete m._spiderLeg; 10191 } 10192 group._animationEnd(); 10193 group.fire('unspiderfied', { 10194 cluster: me, 10195 markers: childMarkers 10196 }); 10197 }, 200); 10198 } 10199}); 10200 10201 10202L.MarkerClusterGroup.include({ 10203 //The MarkerCluster currently spiderfied (if any) 10204 _spiderfied: null, 10205 10206 unspiderfy: function () { 10207 this._unspiderfy.apply(this, arguments); 10208 }, 10209 10210 _spiderfierOnAdd: function () { 10211 this._map.on('click', this._unspiderfyWrapper, this); 10212 10213 if (this._map.options.zoomAnimation) { 10214 this._map.on('zoomstart', this._unspiderfyZoomStart, this); 10215 } 10216 //Browsers without zoomAnimation or a big zoom don't fire zoomstart 10217 this._map.on('zoomend', this._noanimationUnspiderfy, this); 10218 10219 if (!L.Browser.touch) { 10220 this._map.getRenderer(this); 10221 //Needs to happen in the pageload, not after, or animations don't work in webkit 10222 // http://stackoverflow.com/questions/8455200/svg-animate-with-dynamically-added-elements 10223 //Disable on touch browsers as the animation messes up on a touch zoom and isn't very noticable 10224 } 10225 }, 10226 10227 _spiderfierOnRemove: function () { 10228 this._map.off('click', this._unspiderfyWrapper, this); 10229 this._map.off('zoomstart', this._unspiderfyZoomStart, this); 10230 this._map.off('zoomanim', this._unspiderfyZoomAnim, this); 10231 this._map.off('zoomend', this._noanimationUnspiderfy, this); 10232 10233 //Ensure that markers are back where they should be 10234 // Use no animation to avoid a sticky leaflet-cluster-anim class on mapPane 10235 this._noanimationUnspiderfy(); 10236 }, 10237 10238 //On zoom start we add a zoomanim handler so that we are guaranteed to be last (after markers are animated) 10239 //This means we can define the animation they do rather than Markers doing an animation to their actual location 10240 _unspiderfyZoomStart: function () { 10241 if (!this._map) { //May have been removed from the map by a zoomEnd handler 10242 return; 10243 } 10244 10245 this._map.on('zoomanim', this._unspiderfyZoomAnim, this); 10246 }, 10247 10248 _unspiderfyZoomAnim: function (zoomDetails) { 10249 //Wait until the first zoomanim after the user has finished touch-zooming before running the animation 10250 if (L.DomUtil.hasClass(this._map._mapPane, 'leaflet-touching')) { 10251 return; 10252 } 10253 10254 this._map.off('zoomanim', this._unspiderfyZoomAnim, this); 10255 this._unspiderfy(zoomDetails); 10256 }, 10257 10258 _unspiderfyWrapper: function () { 10259 /// <summary>_unspiderfy but passes no arguments</summary> 10260 this._unspiderfy(); 10261 }, 10262 10263 _unspiderfy: function (zoomDetails) { 10264 if (this._spiderfied) { 10265 this._spiderfied.unspiderfy(zoomDetails); 10266 } 10267 }, 10268 10269 _noanimationUnspiderfy: function () { 10270 if (this._spiderfied) { 10271 this._spiderfied._noanimationUnspiderfy(); 10272 } 10273 }, 10274 10275 //If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc 10276 _unspiderfyLayer: function (layer) { 10277 if (layer._spiderLeg) { 10278 this._featureGroup.removeLayer(layer); 10279 10280 if (layer.clusterShow) { 10281 layer.clusterShow(); 10282 } 10283 //Position will be fixed up immediately in _animationUnspiderfy 10284 if (layer.setZIndexOffset) { 10285 layer.setZIndexOffset(0); 10286 } 10287 10288 this._map.removeLayer(layer._spiderLeg); 10289 delete layer._spiderLeg; 10290 } 10291 } 10292}); 10293 10294/** 10295 * Adds 1 public method to MCG and 1 to L.Marker to facilitate changing 10296 * markers' icon options and refreshing their icon and their parent clusters 10297 * accordingly (case where their iconCreateFunction uses data of childMarkers 10298 * to make up the cluster icon). 10299 */ 10300 10301 10302L.MarkerClusterGroup.include({ 10303 /** 10304 * Updates the icon of all clusters which are parents of the given marker(s). 10305 * In singleMarkerMode, also updates the given marker(s) icon. 10306 * @param layers L.MarkerClusterGroup|L.LayerGroup|Array(L.Marker)|Map(L.Marker)| 10307 * L.MarkerCluster|L.Marker (optional) list of markers (or single marker) whose parent 10308 * clusters need to be updated. If not provided, retrieves all child markers of this. 10309 * @returns {L.MarkerClusterGroup} 10310 */ 10311 refreshClusters: function (layers) { 10312 if (!layers) { 10313 layers = this._topClusterLevel.getAllChildMarkers(); 10314 } else if (layers instanceof L.MarkerClusterGroup) { 10315 layers = layers._topClusterLevel.getAllChildMarkers(); 10316 } else if (layers instanceof L.LayerGroup) { 10317 layers = layers._layers; 10318 } else if (layers instanceof L.MarkerCluster) { 10319 layers = layers.getAllChildMarkers(); 10320 } else if (layers instanceof L.Marker) { 10321 layers = [layers]; 10322 } // else: must be an Array(L.Marker)|Map(L.Marker) 10323 this._flagParentsIconsNeedUpdate(layers); 10324 this._refreshClustersIcons(); 10325 10326 // In case of singleMarkerMode, also re-draw the markers. 10327 if (this.options.singleMarkerMode) { 10328 this._refreshSingleMarkerModeMarkers(layers); 10329 } 10330 10331 return this; 10332 }, 10333 10334 /** 10335 * Simply flags all parent clusters of the given markers as having a "dirty" icon. 10336 * @param layers Array(L.Marker)|Map(L.Marker) list of markers. 10337 * @private 10338 */ 10339 _flagParentsIconsNeedUpdate: function (layers) { 10340 var id, parent; 10341 10342 // Assumes layers is an Array or an Object whose prototype is non-enumerable. 10343 for (id in layers) { 10344 // Flag parent clusters' icon as "dirty", all the way up. 10345 // Dumb process that flags multiple times upper parents, but still 10346 // much more efficient than trying to be smart and make short lists, 10347 // at least in the case of a hierarchy following a power law: 10348 // http://jsperf.com/flag-nodes-in-power-hierarchy/2 10349 parent = layers[id].__parent; 10350 while (parent) { 10351 parent._iconNeedsUpdate = true; 10352 parent = parent.__parent; 10353 } 10354 } 10355 }, 10356 10357 /** 10358 * Re-draws the icon of the supplied markers. 10359 * To be used in singleMarkerMode only. 10360 * @param layers Array(L.Marker)|Map(L.Marker) list of markers. 10361 * @private 10362 */ 10363 _refreshSingleMarkerModeMarkers: function (layers) { 10364 var id, layer; 10365 10366 for (id in layers) { 10367 layer = layers[id]; 10368 10369 // Make sure we do not override markers that do not belong to THIS group. 10370 if (this.hasLayer(layer)) { 10371 // Need to re-create the icon first, then re-draw the marker. 10372 layer.setIcon(this._overrideMarkerIcon(layer)); 10373 } 10374 } 10375 } 10376}); 10377 10378L.Marker.include({ 10379 /** 10380 * Updates the given options in the marker's icon and refreshes the marker. 10381 * @param options map object of icon options. 10382 * @param directlyRefreshClusters boolean (optional) true to trigger 10383 * MCG.refreshClustersOf() right away with this single marker. 10384 * @returns {L.Marker} 10385 */ 10386 refreshIconOptions: function (options, directlyRefreshClusters) { 10387 var icon = this.options.icon; 10388 10389 L.setOptions(icon, options); 10390 10391 this.setIcon(icon); 10392 10393 // Shortcut to refresh the associated MCG clusters right away. 10394 // To be used when refreshing a single marker. 10395 // Otherwise, better use MCG.refreshClusters() once at the end with 10396 // the list of modified markers. 10397 if (directlyRefreshClusters && this.__parent) { 10398 this.__parent._group.refreshClusters(this); 10399 } 10400 10401 return this; 10402 } 10403}); 10404 10405exports.MarkerClusterGroup = MarkerClusterGroup; 10406exports.MarkerCluster = MarkerCluster; 10407 10408}))); 10409//# sourceMappingURL=leaflet.markercluster-src.js.map 10410 10411 10412/***/ }), 10413
vendor: 400,763 bytes, lines 10414-24503
10414/***/ "./node_modules/leaflet/dist/leaflet-src.js": 10415/*!**************************************************!*\ 10416 !*** ./node_modules/leaflet/dist/leaflet-src.js ***! 10417 \**************************************************/ 10418/*! no static exports found */ 10419/***/ (function(module, exports, __webpack_require__) { 10420 10421/* @preserve 10422 * Leaflet 1.6.0, a JS library for interactive maps. http://leafletjs.com 10423 * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade 10424 */ 10425 10426(function (global, factory) { 10427 true ? factory(exports) : 10428 undefined; 10429}(this, (function (exports) { 'use strict'; 10430 10431var version = "1.6.0"; 10432 10433/* 10434 * @namespace Util 10435 * 10436 * Various utility functions, used by Leaflet internally. 10437 */ 10438 10439var freeze = Object.freeze; 10440Object.freeze = function (obj) { return obj; }; 10441 10442// @function extend(dest: Object, src?: Object): Object 10443// Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut. 10444function extend(dest) { 10445 var i, j, len, src; 10446 10447 for (j = 1, len = arguments.length; j < len; j++) { 10448 src = arguments[j]; 10449 for (i in src) { 10450 dest[i] = src[i]; 10451 } 10452 } 10453 return dest; 10454} 10455 10456// @function create(proto: Object, properties?: Object): Object 10457// Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create) 10458var create = Object.create || (function () { 10459 function F() {} 10460 return function (proto) { 10461 F.prototype = proto; 10462 return new F(); 10463 }; 10464})(); 10465 10466// @function bind(fn: Function, â¦): Function 10467// Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). 10468// Has a `L.bind()` shortcut. 10469function bind(fn, obj) { 10470 var slice = Array.prototype.slice; 10471 10472 if (fn.bind) { 10473 return fn.bind.apply(fn, slice.call(arguments, 1)); 10474 } 10475 10476 var args = slice.call(arguments, 2); 10477 10478 return function () { 10479 return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments); 10480 }; 10481} 10482 10483// @property lastId: Number 10484// Last unique ID used by [`stamp()`](#util-stamp) 10485var lastId = 0; 10486 10487// @function stamp(obj: Object): Number 10488// Returns the unique ID of an object, assigning it one if it doesn't have it. 10489function stamp(obj) { 10490 /*eslint-disable */ 10491 obj._leaflet_id = obj._leaflet_id || ++lastId; 10492 return obj._leaflet_id; 10493 /* eslint-enable */ 10494} 10495 10496// @function throttle(fn: Function, time: Number, context: Object): Function 10497// Returns a function which executes function `fn` with the given scope `context` 10498// (so that the `this` keyword refers to `context` inside `fn`'s code). The function 10499// `fn` will be called no more than one time per given amount of `time`. The arguments 10500// received by the bound function will be any arguments passed when binding the 10501// function, followed by any arguments passed when invoking the bound function. 10502// Has an `L.throttle` shortcut. 10503function throttle(fn, time, context) { 10504 var lock, args, wrapperFn, later; 10505 10506 later = function () { 10507 // reset lock and call if queued 10508 lock = false; 10509 if (args) { 10510 wrapperFn.apply(context, args); 10511 args = false; 10512 } 10513 }; 10514 10515 wrapperFn = function () { 10516 if (lock) { 10517 // called too soon, queue to call later 10518 args = arguments; 10519 10520 } else { 10521 // call and lock until later 10522 fn.apply(context, arguments); 10523 setTimeout(later, time); 10524 lock = true; 10525 } 10526 }; 10527 10528 return wrapperFn; 10529} 10530 10531// @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number 10532// Returns the number `num` modulo `range` in such a way so it lies within 10533// `range[0]` and `range[1]`. The returned value will be always smaller than 10534// `range[1]` unless `includeMax` is set to `true`. 10535function wrapNum(x, range, includeMax) { 10536 var max = range[1], 10537 min = range[0], 10538 d = max - min; 10539 return x === max && includeMax ? x : ((x - min) % d + d) % d + min; 10540} 10541 10542// @function falseFn(): Function 10543// Returns a function which always returns `false`. 10544function falseFn() { return false; } 10545 10546// @function formatNum(num: Number, digits?: Number): Number 10547// Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default. 10548function formatNum(num, digits) { 10549 var pow = Math.pow(10, (digits === undefined ? 6 : digits)); 10550 return Math.round(num * pow) / pow; 10551} 10552 10553// @function trim(str: String): String 10554// Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) 10555function trim(str) { 10556 return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); 10557} 10558 10559// @function splitWords(str: String): String[] 10560// Trims and splits the string on whitespace and returns the array of parts. 10561function splitWords(str) { 10562 return trim(str).split(/\s+/); 10563} 10564 10565// @function setOptions(obj: Object, options: Object): Object 10566// Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut. 10567function setOptions(obj, options) { 10568 if (!obj.hasOwnProperty('options')) { 10569 obj.options = obj.options ? create(obj.options) : {}; 10570 } 10571 for (var i in options) { 10572 obj.options[i] = options[i]; 10573 } 10574 return obj.options; 10575} 10576 10577// @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String 10578// Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}` 10579// translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will 10580// be appended at the end. If `uppercase` is `true`, the parameter names will 10581// be uppercased (e.g. `'?A=foo&B=bar'`) 10582function getParamString(obj, existingUrl, uppercase) { 10583 var params = []; 10584 for (var i in obj) { 10585 params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i])); 10586 } 10587 return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&'); 10588} 10589 10590var templateRe = /\{ *([\w_-]+) *\}/g; 10591 10592// @function template(str: String, data: Object): String 10593// Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'` 10594// and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string 10595// `('Hello foo, bar')`. You can also specify functions instead of strings for 10596// data values â they will be evaluated passing `data` as an argument. 10597function template(str, data) { 10598 return str.replace(templateRe, function (str, key) { 10599 var value = data[key]; 10600 10601 if (value === undefined) { 10602 throw new Error('No value provided for variable ' + str); 10603 10604 } else if (typeof value === 'function') { 10605 value = value(data); 10606 } 10607 return value; 10608 }); 10609} 10610 10611// @function isArray(obj): Boolean 10612// Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) 10613var isArray = Array.isArray || function (obj) { 10614 return (Object.prototype.toString.call(obj) === '[object Array]'); 10615}; 10616 10617// @function indexOf(array: Array, el: Object): Number 10618// Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) 10619function indexOf(array, el) { 10620 for (var i = 0; i < array.length; i++) { 10621 if (array[i] === el) { return i; } 10622 } 10623 return -1; 10624} 10625 10626// @property emptyImageUrl: String 10627// Data URI string containing a base64-encoded empty GIF image. 10628// Used as a hack to free memory from unused images on WebKit-powered 10629// mobile devices (by setting image `src` to this string). 10630var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; 10631 10632// inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 10633 10634function getPrefixed(name) { 10635 return window['webkit' + name] || window['moz' + name] || window['ms' + name]; 10636} 10637 10638var lastTime = 0; 10639 10640// fallback for IE 7-8 10641function timeoutDefer(fn) { 10642 var time = +new Date(), 10643 timeToCall = Math.max(0, 16 - (time - lastTime)); 10644 10645 lastTime = time + timeToCall; 10646 return window.setTimeout(fn, timeToCall); 10647} 10648 10649var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer; 10650var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') || 10651 getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); }; 10652 10653// @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number 10654// Schedules `fn` to be executed when the browser repaints. `fn` is bound to 10655// `context` if given. When `immediate` is set, `fn` is called immediately if 10656// the browser doesn't have native support for 10657// [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame), 10658// otherwise it's delayed. Returns a request ID that can be used to cancel the request. 10659function requestAnimFrame(fn, context, immediate) { 10660 if (immediate && requestFn === timeoutDefer) { 10661 fn.call(context); 10662 } else { 10663 return requestFn.call(window, bind(fn, context)); 10664 } 10665} 10666 10667// @function cancelAnimFrame(id: Number): undefined 10668// Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame). 10669function cancelAnimFrame(id) { 10670 if (id) { 10671 cancelFn.call(window, id); 10672 } 10673} 10674 10675 10676var Util = (Object.freeze || Object)({ 10677 freeze: freeze, 10678 extend: extend, 10679 create: create, 10680 bind: bind, 10681 lastId: lastId, 10682 stamp: stamp, 10683 throttle: throttle, 10684 wrapNum: wrapNum, 10685 falseFn: falseFn, 10686 formatNum: formatNum, 10687 trim: trim, 10688 splitWords: splitWords, 10689 setOptions: setOptions, 10690 getParamString: getParamString, 10691 template: template, 10692 isArray: isArray, 10693 indexOf: indexOf, 10694 emptyImageUrl: emptyImageUrl, 10695 requestFn: requestFn, 10696 cancelFn: cancelFn, 10697 requestAnimFrame: requestAnimFrame, 10698 cancelAnimFrame: cancelAnimFrame 10699}); 10700 10701// @class Class 10702// @aka L.Class 10703 10704// @section 10705// @uninheritable 10706 10707// Thanks to John Resig and Dean Edwards for inspiration! 10708 10709function Class() {} 10710 10711Class.extend = function (props) { 10712 10713 // @function extend(props: Object): Function 10714 // [Extends the current class](#class-inheritance) given the properties to be included. 10715 // Returns a Javascript function that is a class constructor (to be called with `new`). 10716 var NewClass = function () { 10717 10718 // call the constructor 10719 if (this.initialize) { 10720 this.initialize.apply(this, arguments); 10721 } 10722 10723 // call all constructor hooks 10724 this.callInitHooks(); 10725 }; 10726 10727 var parentProto = NewClass.__super__ = this.prototype; 10728 10729 var proto = create(parentProto); 10730 proto.constructor = NewClass; 10731 10732 NewClass.prototype = proto; 10733 10734 // inherit parent's statics 10735 for (var i in this) { 10736 if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') { 10737 NewClass[i] = this[i]; 10738 } 10739 } 10740 10741 // mix static properties into the class 10742 if (props.statics) { 10743 extend(NewClass, props.statics); 10744 delete props.statics; 10745 } 10746 10747 // mix includes into the prototype 10748 if (props.includes) { 10749 checkDeprecatedMixinEvents(props.includes); 10750 extend.apply(null, [proto].concat(props.includes)); 10751 delete props.includes; 10752 } 10753 10754 // merge options 10755 if (proto.options) { 10756 props.options = extend(create(proto.options), props.options); 10757 } 10758 10759 // mix given properties into the prototype 10760 extend(proto, props); 10761 10762 proto._initHooks = []; 10763 10764 // add method for calling all hooks 10765 proto.callInitHooks = function () { 10766 10767 if (this._initHooksCalled) { return; } 10768 10769 if (parentProto.callInitHooks) { 10770 parentProto.callInitHooks.call(this); 10771 } 10772 10773 this._initHooksCalled = true; 10774 10775 for (var i = 0, len = proto._initHooks.length; i < len; i++) { 10776 proto._initHooks[i].call(this); 10777 } 10778 }; 10779 10780 return NewClass; 10781}; 10782 10783 10784// @function include(properties: Object): this 10785// [Includes a mixin](#class-includes) into the current class. 10786Class.include = function (props) { 10787 extend(this.prototype, props); 10788 return this; 10789}; 10790 10791// @function mergeOptions(options: Object): this 10792// [Merges `options`](#class-options) into the defaults of the class. 10793Class.mergeOptions = function (options) { 10794 extend(this.prototype.options, options); 10795 return this; 10796}; 10797 10798// @function addInitHook(fn: Function): this 10799// Adds a [constructor hook](#class-constructor-hooks) to the class. 10800Class.addInitHook = function (fn) { // (Function) || (String, args...) 10801 var args = Array.prototype.slice.call(arguments, 1); 10802 10803 var init = typeof fn === 'function' ? fn : function () { 10804 this[fn].apply(this, args); 10805 }; 10806 10807 this.prototype._initHooks = this.prototype._initHooks || []; 10808 this.prototype._initHooks.push(init); 10809 return this; 10810}; 10811 10812function checkDeprecatedMixinEvents(includes) { 10813 if (typeof L === 'undefined' || !L || !L.Mixin) { return; } 10814 10815 includes = isArray(includes) ? includes : [includes]; 10816 10817 for (var i = 0; i < includes.length; i++) { 10818 if (includes[i] === L.Mixin.Events) { 10819 console.warn('Deprecated include of L.Mixin.Events: ' + 10820 'this property will be removed in future releases, ' + 10821 'please inherit from L.Evented instead.', new Error().stack); 10822 } 10823 } 10824} 10825 10826/* 10827 * @class Evented 10828 * @aka L.Evented 10829 * @inherits Class 10830 * 10831 * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event). 10832 * 10833 * @example 10834 * 10835 * ```js 10836 * map.on('click', function(e) { 10837 * alert(e.latlng); 10838 * } ); 10839 * ``` 10840 * 10841 * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function: 10842 * 10843 * ```js 10844 * function onClick(e) { ... } 10845 * 10846 * map.on('click', onClick); 10847 * map.off('click', onClick); 10848 * ``` 10849 */ 10850 10851var Events = { 10852 /* @method on(type: String, fn: Function, context?: Object): this 10853 * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`). 10854 * 10855 * @alternative 10856 * @method on(eventMap: Object): this 10857 * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` 10858 */ 10859 on: function (types, fn, context) { 10860 10861 // types can be a map of types/handlers 10862 if (typeof types === 'object') { 10863 for (var type in types) { 10864 // we don't process space-separated events here for performance; 10865 // it's a hot path since Layer uses the on(obj) syntax 10866 this._on(type, types[type], fn); 10867 } 10868 10869 } else { 10870 // types can be a string of space-separated words 10871 types = splitWords(types); 10872 10873 for (var i = 0, len = types.length; i < len; i++) { 10874 this._on(types[i], fn, context); 10875 } 10876 } 10877 10878 return this; 10879 }, 10880 10881 /* @method off(type: String, fn?: Function, context?: Object): this 10882 * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener. 10883 * 10884 * @alternative 10885 * @method off(eventMap: Object): this 10886 * Removes a set of type/listener pairs. 10887 * 10888 * @alternative 10889 * @method off: this 10890 * Removes all listeners to all events on the object. This includes implicitly attached events. 10891 */ 10892 off: function (types, fn, context) { 10893 10894 if (!types) { 10895 // clear all listeners if called without arguments 10896 delete this._events; 10897 10898 } else if (typeof types === 'object') { 10899 for (var type in types) { 10900 this._off(type, types[type], fn); 10901 } 10902 10903 } else { 10904 types = splitWords(types); 10905 10906 for (var i = 0, len = types.length; i < len; i++) { 10907 this._off(types[i], fn, context); 10908 } 10909 } 10910 10911 return this; 10912 }, 10913 10914 // attach listener (without syntactic sugar now) 10915 _on: function (type, fn, context) { 10916 this._events = this._events || {}; 10917 10918 /* get/init listeners for type */ 10919 var typeListeners = this._events[type]; 10920 if (!typeListeners) { 10921 typeListeners = []; 10922 this._events[type] = typeListeners; 10923 } 10924 10925 if (context === this) { 10926 // Less memory footprint. 10927 context = undefined; 10928 } 10929 var newListener = {fn: fn, ctx: context}, 10930 listeners = typeListeners; 10931 10932 // check if fn already there 10933 for (var i = 0, len = listeners.length; i < len; i++) { 10934 if (listeners[i].fn === fn && listeners[i].ctx === context) { 10935 return; 10936 } 10937 } 10938 10939 listeners.push(newListener); 10940 }, 10941 10942 _off: function (type, fn, context) { 10943 var listeners, 10944 i, 10945 len; 10946 10947 if (!this._events) { return; } 10948 10949 listeners = this._events[type]; 10950 10951 if (!listeners) { 10952 return; 10953 } 10954 10955 if (!fn) { 10956 // Set all removed listeners to noop so they are not called if remove happens in fire 10957 for (i = 0, len = listeners.length; i < len; i++) { 10958 listeners[i].fn = falseFn; 10959 } 10960 // clear all listeners for a type if function isn't specified 10961 delete this._events[type]; 10962 return; 10963 } 10964 10965 if (context === this) { 10966 context = undefined; 10967 } 10968 10969 if (listeners) { 10970 10971 // find fn and remove it 10972 for (i = 0, len = listeners.length; i < len; i++) { 10973 var l = listeners[i]; 10974 if (l.ctx !== context) { continue; } 10975 if (l.fn === fn) { 10976 10977 // set the removed listener to noop so that's not called if remove happens in fire 10978 l.fn = falseFn; 10979 10980 if (this._firingCount) { 10981 /* copy array in case events are being fired */ 10982 this._events[type] = listeners = listeners.slice(); 10983 } 10984 listeners.splice(i, 1); 10985 10986 return; 10987 } 10988 } 10989 } 10990 }, 10991 10992 // @method fire(type: String, data?: Object, propagate?: Boolean): this 10993 // Fires an event of the specified type. You can optionally provide an data 10994 // object â the first argument of the listener function will contain its 10995 // properties. The event can optionally be propagated to event parents. 10996 fire: function (type, data, propagate) { 10997 if (!this.listens(type, propagate)) { return this; } 10998 10999 var event = extend({}, data, { 11000 type: type, 11001 target: this, 11002 sourceTarget: data && data.sourceTarget || this 11003 }); 11004 11005 if (this._events) { 11006 var listeners = this._events[type]; 11007 11008 if (listeners) { 11009 this._firingCount = (this._firingCount + 1) || 1; 11010 for (var i = 0, len = listeners.length; i < len; i++) { 11011 var l = listeners[i]; 11012 l.fn.call(l.ctx || this, event); 11013 } 11014 11015 this._firingCount--; 11016 } 11017 } 11018 11019 if (propagate) { 11020 // propagate the event to parents (set with addEventParent) 11021 this._propagateEvent(event); 11022 } 11023 11024 return this; 11025 }, 11026 11027 // @method listens(type: String): Boolean 11028 // Returns `true` if a particular event type has any listeners attached to it. 11029 listens: function (type, propagate) { 11030 var listeners = this._events && this._events[type]; 11031 if (listeners && listeners.length) { return true; } 11032 11033 if (propagate) { 11034 // also check parents for listeners if event propagates 11035 for (var id in this._eventParents) { 11036 if (this._eventParents[id].listens(type, propagate)) { return true; } 11037 } 11038 } 11039 return false; 11040 }, 11041 11042 // @method once(â¦): this 11043 // Behaves as [`on(â¦)`](#evented-on), except the listener will only get fired once and then removed. 11044 once: function (types, fn, context) { 11045 11046 if (typeof types === 'object') { 11047 for (var type in types) { 11048 this.once(type, types[type], fn); 11049 } 11050 return this; 11051 } 11052 11053 var handler = bind(function () { 11054 this 11055 .off(types, fn, context) 11056 .off(types, handler, context); 11057 }, this); 11058 11059 // add a listener that's executed once and removed after that 11060 return this 11061 .on(types, fn, context) 11062 .on(types, handler, context); 11063 }, 11064 11065 // @method addEventParent(obj: Evented): this 11066 // Adds an event parent - an `Evented` that will receive propagated events 11067 addEventParent: function (obj) { 11068 this._eventParents = this._eventParents || {}; 11069 this._eventParents[stamp(obj)] = obj; 11070 return this; 11071 }, 11072 11073 // @method removeEventParent(obj: Evented): this 11074 // Removes an event parent, so it will stop receiving propagated events 11075 removeEventParent: function (obj) { 11076 if (this._eventParents) { 11077 delete this._eventParents[stamp(obj)]; 11078 } 11079 return this; 11080 }, 11081 11082 _propagateEvent: function (e) { 11083 for (var id in this._eventParents) { 11084 this._eventParents[id].fire(e.type, extend({ 11085 layer: e.target, 11086 propagatedFrom: e.target 11087 }, e), true); 11088 } 11089 } 11090}; 11091 11092// aliases; we should ditch those eventually 11093 11094// @method addEventListener(â¦): this 11095// Alias to [`on(â¦)`](#evented-on) 11096Events.addEventListener = Events.on; 11097 11098// @method removeEventListener(â¦): this 11099// Alias to [`off(â¦)`](#evented-off) 11100 11101// @method clearAllEventListeners(â¦): this 11102// Alias to [`off()`](#evented-off) 11103Events.removeEventListener = Events.clearAllEventListeners = Events.off; 11104 11105// @method addOneTimeEventListener(â¦): this 11106// Alias to [`once(â¦)`](#evented-once) 11107Events.addOneTimeEventListener = Events.once; 11108 11109// @method fireEvent(â¦): this 11110// Alias to [`fire(â¦)`](#evented-fire) 11111Events.fireEvent = Events.fire; 11112 11113// @method hasEventListeners(â¦): Boolean 11114// Alias to [`listens(â¦)`](#evented-listens) 11115Events.hasEventListeners = Events.listens; 11116 11117var Evented = Class.extend(Events); 11118 11119/* 11120 * @class Point 11121 * @aka L.Point 11122 * 11123 * Represents a point with `x` and `y` coordinates in pixels. 11124 * 11125 * @example 11126 * 11127 * ```js 11128 * var point = L.point(200, 300); 11129 * ``` 11130 * 11131 * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent: 11132 * 11133 * ```js 11134 * map.panBy([200, 300]); 11135 * map.panBy(L.point(200, 300)); 11136 * ``` 11137 * 11138 * Note that `Point` does not inherit from Leafet's `Class` object, 11139 * which means new classes can't inherit from it, and new methods 11140 * can't be added to it with the `include` function. 11141 */ 11142 11143function Point(x, y, round) { 11144 // @property x: Number; The `x` coordinate of the point 11145 this.x = (round ? Math.round(x) : x); 11146 // @property y: Number; The `y` coordinate of the point 11147 this.y = (round ? Math.round(y) : y); 11148} 11149 11150var trunc = Math.trunc || function (v) { 11151 return v > 0 ? Math.floor(v) : Math.ceil(v); 11152}; 11153 11154Point.prototype = { 11155 11156 // @method clone(): Point 11157 // Returns a copy of the current point. 11158 clone: function () { 11159 return new Point(this.x, this.y); 11160 }, 11161 11162 // @method add(otherPoint: Point): Point 11163 // Returns the result of addition of the current and the given points. 11164 add: function (point) { 11165 // non-destructive, returns a new point 11166 return this.clone()._add(toPoint(point)); 11167 }, 11168 11169 _add: function (point) { 11170 // destructive, used directly for performance in situations where it's safe to modify existing point 11171 this.x += point.x; 11172 this.y += point.y; 11173 return this; 11174 }, 11175 11176 // @method subtract(otherPoint: Point): Point 11177 // Returns the result of subtraction of the given point from the current. 11178 subtract: function (point) { 11179 return this.clone()._subtract(toPoint(point)); 11180 }, 11181 11182 _subtract: function (point) { 11183 this.x -= point.x; 11184 this.y -= point.y; 11185 return this; 11186 }, 11187 11188 // @method divideBy(num: Number): Point 11189 // Returns the result of division of the current point by the given number. 11190 divideBy: function (num) { 11191 return this.clone()._divideBy(num); 11192 }, 11193 11194 _divideBy: function (num) { 11195 this.x /= num; 11196 this.y /= num; 11197 return this; 11198 }, 11199 11200 // @method multiplyBy(num: Number): Point 11201 // Returns the result of multiplication of the current point by the given number. 11202 multiplyBy: function (num) { 11203 return this.clone()._multiplyBy(num); 11204 }, 11205 11206 _multiplyBy: function (num) { 11207 this.x *= num; 11208 this.y *= num; 11209 return this; 11210 }, 11211 11212 // @method scaleBy(scale: Point): Point 11213 // Multiply each coordinate of the current point by each coordinate of 11214 // `scale`. In linear algebra terms, multiply the point by the 11215 // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation) 11216 // defined by `scale`. 11217 scaleBy: function (point) { 11218 return new Point(this.x * point.x, this.y * point.y); 11219 }, 11220 11221 // @method unscaleBy(scale: Point): Point 11222 // Inverse of `scaleBy`. Divide each coordinate of the current point by 11223 // each coordinate of `scale`. 11224 unscaleBy: function (point) { 11225 return new Point(this.x / point.x, this.y / point.y); 11226 }, 11227 11228 // @method round(): Point 11229 // Returns a copy of the current point with rounded coordinates. 11230 round: function () { 11231 return this.clone()._round(); 11232 }, 11233 11234 _round: function () { 11235 this.x = Math.round(this.x); 11236 this.y = Math.round(this.y); 11237 return this; 11238 }, 11239 11240 // @method floor(): Point 11241 // Returns a copy of the current point with floored coordinates (rounded down). 11242 floor: function () { 11243 return this.clone()._floor(); 11244 }, 11245 11246 _floor: function () { 11247 this.x = Math.floor(this.x); 11248 this.y = Math.floor(this.y); 11249 return this; 11250 }, 11251 11252 // @method ceil(): Point 11253 // Returns a copy of the current point with ceiled coordinates (rounded up). 11254 ceil: function () { 11255 return this.clone()._ceil(); 11256 }, 11257 11258 _ceil: function () { 11259 this.x = Math.ceil(this.x); 11260 this.y = Math.ceil(this.y); 11261 return this; 11262 }, 11263 11264 // @method trunc(): Point 11265 // Returns a copy of the current point with truncated coordinates (rounded towards zero). 11266 trunc: function () { 11267 return this.clone()._trunc(); 11268 }, 11269 11270 _trunc: function () { 11271 this.x = trunc(this.x); 11272 this.y = trunc(this.y); 11273 return this; 11274 }, 11275 11276 // @method distanceTo(otherPoint: Point): Number 11277 // Returns the cartesian distance between the current and the given points. 11278 distanceTo: function (point) { 11279 point = toPoint(point); 11280 11281 var x = point.x - this.x, 11282 y = point.y - this.y; 11283 11284 return Math.sqrt(x * x + y * y); 11285 }, 11286 11287 // @method equals(otherPoint: Point): Boolean 11288 // Returns `true` if the given point has the same coordinates. 11289 equals: function (point) { 11290 point = toPoint(point); 11291 11292 return point.x === this.x && 11293 point.y === this.y; 11294 }, 11295 11296 // @method contains(otherPoint: Point): Boolean 11297 // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values). 11298 contains: function (point) { 11299 point = toPoint(point); 11300 11301 return Math.abs(point.x) <= Math.abs(this.x) && 11302 Math.abs(point.y) <= Math.abs(this.y); 11303 }, 11304 11305 // @method toString(): String 11306 // Returns a string representation of the point for debugging purposes. 11307 toString: function () { 11308 return 'Point(' + 11309 formatNum(this.x) + ', ' + 11310 formatNum(this.y) + ')'; 11311 } 11312}; 11313 11314// @factory L.point(x: Number, y: Number, round?: Boolean) 11315// Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values. 11316 11317// @alternative 11318// @factory L.point(coords: Number[]) 11319// Expects an array of the form `[x, y]` instead. 11320 11321// @alternative 11322// @factory L.point(coords: Object) 11323// Expects a plain object of the form `{x: Number, y: Number}` instead. 11324function toPoint(x, y, round) { 11325 if (x instanceof Point) { 11326 return x; 11327 } 11328 if (isArray(x)) { 11329 return new Point(x[0], x[1]); 11330 } 11331 if (x === undefined || x === null) { 11332 return x; 11333 } 11334 if (typeof x === 'object' && 'x' in x && 'y' in x) { 11335 return new Point(x.x, x.y); 11336 } 11337 return new Point(x, y, round); 11338} 11339 11340/* 11341 * @class Bounds 11342 * @aka L.Bounds 11343 * 11344 * Represents a rectangular area in pixel coordinates. 11345 * 11346 * @example 11347 * 11348 * ```js 11349 * var p1 = L.point(10, 10), 11350 * p2 = L.point(40, 60), 11351 * bounds = L.bounds(p1, p2); 11352 * ``` 11353 * 11354 * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this: 11355 * 11356 * ```js 11357 * otherBounds.intersects([[10, 10], [40, 60]]); 11358 * ``` 11359 * 11360 * Note that `Bounds` does not inherit from Leafet's `Class` object, 11361 * which means new classes can't inherit from it, and new methods 11362 * can't be added to it with the `include` function. 11363 */ 11364 11365function Bounds(a, b) { 11366 if (!a) { return; } 11367 11368 var points = b ? [a, b] : a; 11369 11370 for (var i = 0, len = points.length; i < len; i++) { 11371 this.extend(points[i]); 11372 } 11373} 11374 11375Bounds.prototype = { 11376 // @method extend(point: Point): this 11377 // Extends the bounds to contain the given point. 11378 extend: function (point) { // (Point) 11379 point = toPoint(point); 11380 11381 // @property min: Point 11382 // The top left corner of the rectangle. 11383 // @property max: Point 11384 // The bottom right corner of the rectangle. 11385 if (!this.min && !this.max) { 11386 this.min = point.clone(); 11387 this.max = point.clone(); 11388 } else { 11389 this.min.x = Math.min(point.x, this.min.x); 11390 this.max.x = Math.max(point.x, this.max.x); 11391 this.min.y = Math.min(point.y, this.min.y); 11392 this.max.y = Math.max(point.y, this.max.y); 11393 } 11394 return this; 11395 }, 11396 11397 // @method getCenter(round?: Boolean): Point 11398 // Returns the center point of the bounds. 11399 getCenter: function (round) { 11400 return new Point( 11401 (this.min.x + this.max.x) / 2, 11402 (this.min.y + this.max.y) / 2, round); 11403 }, 11404 11405 // @method getBottomLeft(): Point 11406 // Returns the bottom-left point of the bounds. 11407 getBottomLeft: function () { 11408 return new Point(this.min.x, this.max.y); 11409 }, 11410 11411 // @method getTopRight(): Point 11412 // Returns the top-right point of the bounds. 11413 getTopRight: function () { // -> Point 11414 return new Point(this.max.x, this.min.y); 11415 }, 11416 11417 // @method getTopLeft(): Point 11418 // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)). 11419 getTopLeft: function () { 11420 return this.min; // left, top 11421 }, 11422 11423 // @method getBottomRight(): Point 11424 // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)). 11425 getBottomRight: function () { 11426 return this.max; // right, bottom 11427 }, 11428 11429 // @method getSize(): Point 11430 // Returns the size of the given bounds 11431 getSize: function () { 11432 return this.max.subtract(this.min); 11433 }, 11434 11435 // @method contains(otherBounds: Bounds): Boolean 11436 // Returns `true` if the rectangle contains the given one. 11437 // @alternative 11438 // @method contains(point: Point): Boolean 11439 // Returns `true` if the rectangle contains the given point. 11440 contains: function (obj) { 11441 var min, max; 11442 11443 if (typeof obj[0] === 'number' || obj instanceof Point) { 11444 obj = toPoint(obj); 11445 } else { 11446 obj = toBounds(obj); 11447 } 11448 11449 if (obj instanceof Bounds) { 11450 min = obj.min; 11451 max = obj.max; 11452 } else { 11453 min = max = obj; 11454 } 11455 11456 return (min.x >= this.min.x) && 11457 (max.x <= this.max.x) && 11458 (min.y >= this.min.y) && 11459 (max.y <= this.max.y); 11460 }, 11461 11462 // @method intersects(otherBounds: Bounds): Boolean 11463 // Returns `true` if the rectangle intersects the given bounds. Two bounds 11464 // intersect if they have at least one point in common. 11465 intersects: function (bounds) { // (Bounds) -> Boolean 11466 bounds = toBounds(bounds); 11467 11468 var min = this.min, 11469 max = this.max, 11470 min2 = bounds.min, 11471 max2 = bounds.max, 11472 xIntersects = (max2.x >= min.x) && (min2.x <= max.x), 11473 yIntersects = (max2.y >= min.y) && (min2.y <= max.y); 11474 11475 return xIntersects && yIntersects; 11476 }, 11477 11478 // @method overlaps(otherBounds: Bounds): Boolean 11479 // Returns `true` if the rectangle overlaps the given bounds. Two bounds 11480 // overlap if their intersection is an area. 11481 overlaps: function (bounds) { // (Bounds) -> Boolean 11482 bounds = toBounds(bounds); 11483 11484 var min = this.min, 11485 max = this.max, 11486 min2 = bounds.min, 11487 max2 = bounds.max, 11488 xOverlaps = (max2.x > min.x) && (min2.x < max.x), 11489 yOverlaps = (max2.y > min.y) && (min2.y < max.y); 11490 11491 return xOverlaps && yOverlaps; 11492 }, 11493 11494 isValid: function () { 11495 return !!(this.min && this.max); 11496 } 11497}; 11498 11499 11500// @factory L.bounds(corner1: Point, corner2: Point) 11501// Creates a Bounds object from two corners coordinate pairs. 11502// @alternative 11503// @factory L.bounds(points: Point[]) 11504// Creates a Bounds object from the given array of points. 11505function toBounds(a, b) { 11506 if (!a || a instanceof Bounds) { 11507 return a; 11508 } 11509 return new Bounds(a, b); 11510} 11511 11512/* 11513 * @class LatLngBounds 11514 * @aka L.LatLngBounds 11515 * 11516 * Represents a rectangular geographical area on a map. 11517 * 11518 * @example 11519 * 11520 * ```js 11521 * var corner1 = L.latLng(40.712, -74.227), 11522 * corner2 = L.latLng(40.774, -74.125), 11523 * bounds = L.latLngBounds(corner1, corner2); 11524 * ``` 11525 * 11526 * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this: 11527 * 11528 * ```js 11529 * map.fitBounds([ 11530 * [40.712, -74.227], 11531 * [40.774, -74.125] 11532 * ]); 11533 * ``` 11534 * 11535 * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range. 11536 * 11537 * Note that `LatLngBounds` does not inherit from Leafet's `Class` object, 11538 * which means new classes can't inherit from it, and new methods 11539 * can't be added to it with the `include` function. 11540 */ 11541 11542function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[]) 11543 if (!corner1) { return; } 11544 11545 var latlngs = corner2 ? [corner1, corner2] : corner1; 11546 11547 for (var i = 0, len = latlngs.length; i < len; i++) { 11548 this.extend(latlngs[i]); 11549 } 11550} 11551 11552LatLngBounds.prototype = { 11553 11554 // @method extend(latlng: LatLng): this 11555 // Extend the bounds to contain the given point 11556 11557 // @alternative 11558 // @method extend(otherBounds: LatLngBounds): this 11559 // Extend the bounds to contain the given bounds 11560 extend: function (obj) { 11561 var sw = this._southWest, 11562 ne = this._northEast, 11563 sw2, ne2; 11564 11565 if (obj instanceof LatLng) { 11566 sw2 = obj; 11567 ne2 = obj; 11568 11569 } else if (obj instanceof LatLngBounds) { 11570 sw2 = obj._southWest; 11571 ne2 = obj._northEast; 11572 11573 if (!sw2 || !ne2) { return this; } 11574 11575 } else { 11576 return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this; 11577 } 11578 11579 if (!sw && !ne) { 11580 this._southWest = new LatLng(sw2.lat, sw2.lng); 11581 this._northEast = new LatLng(ne2.lat, ne2.lng); 11582 } else { 11583 sw.lat = Math.min(sw2.lat, sw.lat); 11584 sw.lng = Math.min(sw2.lng, sw.lng); 11585 ne.lat = Math.max(ne2.lat, ne.lat); 11586 ne.lng = Math.max(ne2.lng, ne.lng); 11587 } 11588 11589 return this; 11590 }, 11591 11592 // @method pad(bufferRatio: Number): LatLngBounds 11593 // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction. 11594 // For example, a ratio of 0.5 extends the bounds by 50% in each direction. 11595 // Negative values will retract the bounds. 11596 pad: function (bufferRatio) { 11597 var sw = this._southWest, 11598 ne = this._northEast, 11599 heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio, 11600 widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio; 11601 11602 return new LatLngBounds( 11603 new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), 11604 new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer)); 11605 }, 11606 11607 // @method getCenter(): LatLng 11608 // Returns the center point of the bounds. 11609 getCenter: function () { 11610 return new LatLng( 11611 (this._southWest.lat + this._northEast.lat) / 2, 11612 (this._southWest.lng + this._northEast.lng) / 2); 11613 }, 11614 11615 // @method getSouthWest(): LatLng 11616 // Returns the south-west point of the bounds. 11617 getSouthWest: function () { 11618 return this._southWest; 11619 }, 11620 11621 // @method getNorthEast(): LatLng 11622 // Returns the north-east point of the bounds. 11623 getNorthEast: function () { 11624 return this._northEast; 11625 }, 11626 11627 // @method getNorthWest(): LatLng 11628 // Returns the north-west point of the bounds. 11629 getNorthWest: function () { 11630 return new LatLng(this.getNorth(), this.getWest()); 11631 }, 11632 11633 // @method getSouthEast(): LatLng 11634 // Returns the south-east point of the bounds. 11635 getSouthEast: function () { 11636 return new LatLng(this.getSouth(), this.getEast()); 11637 }, 11638 11639 // @method getWest(): Number 11640 // Returns the west longitude of the bounds 11641 getWest: function () { 11642 return this._southWest.lng; 11643 }, 11644 11645 // @method getSouth(): Number 11646 // Returns the south latitude of the bounds 11647 getSouth: function () { 11648 return this._southWest.lat; 11649 }, 11650 11651 // @method getEast(): Number 11652 // Returns the east longitude of the bounds 11653 getEast: function () { 11654 return this._northEast.lng; 11655 }, 11656 11657 // @method getNorth(): Number 11658 // Returns the north latitude of the bounds 11659 getNorth: function () { 11660 return this._northEast.lat; 11661 }, 11662 11663 // @method contains(otherBounds: LatLngBounds): Boolean 11664 // Returns `true` if the rectangle contains the given one. 11665 11666 // @alternative 11667 // @method contains (latlng: LatLng): Boolean 11668 // Returns `true` if the rectangle contains the given point. 11669 contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean 11670 if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) { 11671 obj = toLatLng(obj); 11672 } else { 11673 obj = toLatLngBounds(obj); 11674 } 11675 11676 var sw = this._southWest, 11677 ne = this._northEast, 11678 sw2, ne2; 11679 11680 if (obj instanceof LatLngBounds) { 11681 sw2 = obj.getSouthWest(); 11682 ne2 = obj.getNorthEast(); 11683 } else { 11684 sw2 = ne2 = obj; 11685 } 11686 11687 return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) && 11688 (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng); 11689 }, 11690 11691 // @method intersects(otherBounds: LatLngBounds): Boolean 11692 // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common. 11693 intersects: function (bounds) { 11694 bounds = toLatLngBounds(bounds); 11695 11696 var sw = this._southWest, 11697 ne = this._northEast, 11698 sw2 = bounds.getSouthWest(), 11699 ne2 = bounds.getNorthEast(), 11700 11701 latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat), 11702 lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng); 11703 11704 return latIntersects && lngIntersects; 11705 }, 11706 11707 // @method overlaps(otherBounds: Bounds): Boolean 11708 // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area. 11709 overlaps: function (bounds) { 11710 bounds = toLatLngBounds(bounds); 11711 11712 var sw = this._southWest, 11713 ne = this._northEast, 11714 sw2 = bounds.getSouthWest(), 11715 ne2 = bounds.getNorthEast(), 11716 11717 latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat), 11718 lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng); 11719 11720 return latOverlaps && lngOverlaps; 11721 }, 11722 11723 // @method toBBoxString(): String 11724 // Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data. 11725 toBBoxString: function () { 11726 return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(','); 11727 }, 11728 11729 // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean 11730 // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number. 11731 equals: function (bounds, maxMargin) { 11732 if (!bounds) { return false; } 11733 11734 bounds = toLatLngBounds(bounds); 11735 11736 return this._southWest.equals(bounds.getSouthWest(), maxMargin) && 11737 this._northEast.equals(bounds.getNorthEast(), maxMargin); 11738 }, 11739 11740 // @method isValid(): Boolean 11741 // Returns `true` if the bounds are properly initialized. 11742 isValid: function () { 11743 return !!(this._southWest && this._northEast); 11744 } 11745}; 11746 11747// TODO International date line? 11748 11749// @factory L.latLngBounds(corner1: LatLng, corner2: LatLng) 11750// Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle. 11751 11752// @alternative 11753// @factory L.latLngBounds(latlngs: LatLng[]) 11754// Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds). 11755function toLatLngBounds(a, b) { 11756 if (a instanceof LatLngBounds) { 11757 return a; 11758 } 11759 return new LatLngBounds(a, b); 11760} 11761 11762/* @class LatLng 11763 * @aka L.LatLng 11764 * 11765 * Represents a geographical point with a certain latitude and longitude. 11766 * 11767 * @example 11768 * 11769 * ``` 11770 * var latlng = L.latLng(50.5, 30.5); 11771 * ``` 11772 * 11773 * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent: 11774 * 11775 * ``` 11776 * map.panTo([50, 30]); 11777 * map.panTo({lon: 30, lat: 50}); 11778 * map.panTo({lat: 50, lng: 30}); 11779 * map.panTo(L.latLng(50, 30)); 11780 * ``` 11781 * 11782 * Note that `LatLng` does not inherit from Leaflet's `Class` object, 11783 * which means new classes can't inherit from it, and new methods 11784 * can't be added to it with the `include` function. 11785 */ 11786 11787function LatLng(lat, lng, alt) { 11788 if (isNaN(lat) || isNaN(lng)) { 11789 throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')'); 11790 } 11791 11792 // @property lat: Number 11793 // Latitude in degrees 11794 this.lat = +lat; 11795 11796 // @property lng: Number 11797 // Longitude in degrees 11798 this.lng = +lng; 11799 11800 // @property alt: Number 11801 // Altitude in meters (optional) 11802 if (alt !== undefined) { 11803 this.alt = +alt; 11804 } 11805} 11806 11807LatLng.prototype = { 11808 // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean 11809 // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number. 11810 equals: function (obj, maxMargin) { 11811 if (!obj) { return false; } 11812 11813 obj = toLatLng(obj); 11814 11815 var margin = Math.max( 11816 Math.abs(this.lat - obj.lat), 11817 Math.abs(this.lng - obj.lng)); 11818 11819 return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin); 11820 }, 11821 11822 // @method toString(): String 11823 // Returns a string representation of the point (for debugging purposes). 11824 toString: function (precision) { 11825 return 'LatLng(' + 11826 formatNum(this.lat, precision) + ', ' + 11827 formatNum(this.lng, precision) + ')'; 11828 }, 11829 11830 // @method distanceTo(otherLatLng: LatLng): Number 11831 // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines). 11832 distanceTo: function (other) { 11833 return Earth.distance(this, toLatLng(other)); 11834 }, 11835 11836 // @method wrap(): LatLng 11837 // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees. 11838 wrap: function () { 11839 return Earth.wrapLatLng(this); 11840 }, 11841 11842 // @method toBounds(sizeInMeters: Number): LatLngBounds 11843 // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`. 11844 toBounds: function (sizeInMeters) { 11845 var latAccuracy = 180 * sizeInMeters / 40075017, 11846 lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat); 11847 11848 return toLatLngBounds( 11849 [this.lat - latAccuracy, this.lng - lngAccuracy], 11850 [this.lat + latAccuracy, this.lng + lngAccuracy]); 11851 }, 11852 11853 clone: function () { 11854 return new LatLng(this.lat, this.lng, this.alt); 11855 } 11856}; 11857 11858 11859 11860// @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng 11861// Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude). 11862 11863// @alternative 11864// @factory L.latLng(coords: Array): LatLng 11865// Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead. 11866 11867// @alternative 11868// @factory L.latLng(coords: Object): LatLng 11869// Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead. 11870 11871function toLatLng(a, b, c) { 11872 if (a instanceof LatLng) { 11873 return a; 11874 } 11875 if (isArray(a) && typeof a[0] !== 'object') { 11876 if (a.length === 3) { 11877 return new LatLng(a[0], a[1], a[2]); 11878 } 11879 if (a.length === 2) { 11880 return new LatLng(a[0], a[1]); 11881 } 11882 return null; 11883 } 11884 if (a === undefined || a === null) { 11885 return a; 11886 } 11887 if (typeof a === 'object' && 'lat' in a) { 11888 return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt); 11889 } 11890 if (b === undefined) { 11891 return null; 11892 } 11893 return new LatLng(a, b, c); 11894} 11895 11896/* 11897 * @namespace CRS 11898 * @crs L.CRS.Base 11899 * Object that defines coordinate reference systems for projecting 11900 * geographical points into pixel (screen) coordinates and back (and to 11901 * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See 11902 * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system). 11903 * 11904 * Leaflet defines the most usual CRSs by default. If you want to use a 11905 * CRS not defined by default, take a look at the 11906 * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin. 11907 * 11908 * Note that the CRS instances do not inherit from Leafet's `Class` object, 11909 * and can't be instantiated. Also, new classes can't inherit from them, 11910 * and methods can't be added to them with the `include` function. 11911 */ 11912 11913var CRS = { 11914 // @method latLngToPoint(latlng: LatLng, zoom: Number): Point 11915 // Projects geographical coordinates into pixel coordinates for a given zoom. 11916 latLngToPoint: function (latlng, zoom) { 11917 var projectedPoint = this.projection.project(latlng), 11918 scale = this.scale(zoom); 11919 11920 return this.transformation._transform(projectedPoint, scale); 11921 }, 11922 11923 // @method pointToLatLng(point: Point, zoom: Number): LatLng 11924 // The inverse of `latLngToPoint`. Projects pixel coordinates on a given 11925 // zoom into geographical coordinates. 11926 pointToLatLng: function (point, zoom) { 11927 var scale = this.scale(zoom), 11928 untransformedPoint = this.transformation.untransform(point, scale); 11929 11930 return this.projection.unproject(untransformedPoint); 11931 }, 11932 11933 // @method project(latlng: LatLng): Point 11934 // Projects geographical coordinates into coordinates in units accepted for 11935 // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services). 11936 project: function (latlng) { 11937 return this.projection.project(latlng); 11938 }, 11939 11940 // @method unproject(point: Point): LatLng 11941 // Given a projected coordinate returns the corresponding LatLng. 11942 // The inverse of `project`. 11943 unproject: function (point) { 11944 return this.projection.unproject(point); 11945 }, 11946 11947 // @method scale(zoom: Number): Number 11948 // Returns the scale used when transforming projected coordinates into 11949 // pixel coordinates for a particular zoom. For example, it returns 11950 // `256 * 2^zoom` for Mercator-based CRS. 11951 scale: function (zoom) { 11952 return 256 * Math.pow(2, zoom); 11953 }, 11954 11955 // @method zoom(scale: Number): Number 11956 // Inverse of `scale()`, returns the zoom level corresponding to a scale 11957 // factor of `scale`. 11958 zoom: function (scale) { 11959 return Math.log(scale / 256) / Math.LN2; 11960 }, 11961 11962 // @method getProjectedBounds(zoom: Number): Bounds 11963 // Returns the projection's bounds scaled and transformed for the provided `zoom`. 11964 getProjectedBounds: function (zoom) { 11965 if (this.infinite) { return null; } 11966 11967 var b = this.projection.bounds, 11968 s = this.scale(zoom), 11969 min = this.transformation.transform(b.min, s), 11970 max = this.transformation.transform(b.max, s); 11971 11972 return new Bounds(min, max); 11973 }, 11974 11975 // @method distance(latlng1: LatLng, latlng2: LatLng): Number 11976 // Returns the distance between two geographical coordinates. 11977 11978 // @property code: String 11979 // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`) 11980 // 11981 // @property wrapLng: Number[] 11982 // An array of two numbers defining whether the longitude (horizontal) coordinate 11983 // axis wraps around a given range and how. Defaults to `[-180, 180]` in most 11984 // geographical CRSs. If `undefined`, the longitude axis does not wrap around. 11985 // 11986 // @property wrapLat: Number[] 11987 // Like `wrapLng`, but for the latitude (vertical) axis. 11988 11989 // wrapLng: [min, max], 11990 // wrapLat: [min, max], 11991 11992 // @property infinite: Boolean 11993 // If true, the coordinate space will be unbounded (infinite in both axes) 11994 infinite: false, 11995 11996 // @method wrapLatLng(latlng: LatLng): LatLng 11997 // Returns a `LatLng` where lat and lng has been wrapped according to the 11998 // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds. 11999 wrapLatLng: function (latlng) { 12000 var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng, 12001 lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat, 12002 alt = latlng.alt; 12003 12004 return new LatLng(lat, lng, alt); 12005 }, 12006 12007 // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds 12008 // Returns a `LatLngBounds` with the same size as the given one, ensuring 12009 // that its center is within the CRS's bounds. 12010 // Only accepts actual `L.LatLngBounds` instances, not arrays. 12011 wrapLatLngBounds: function (bounds) { 12012 var center = bounds.getCenter(), 12013 newCenter = this.wrapLatLng(center), 12014 latShift = center.lat - newCenter.lat, 12015 lngShift = center.lng - newCenter.lng; 12016 12017 if (latShift === 0 && lngShift === 0) { 12018 return bounds; 12019 } 12020 12021 var sw = bounds.getSouthWest(), 12022 ne = bounds.getNorthEast(), 12023 newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift), 12024 newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift); 12025 12026 return new LatLngBounds(newSw, newNe); 12027 } 12028}; 12029 12030/* 12031 * @namespace CRS 12032 * @crs L.CRS.Earth 12033 * 12034 * Serves as the base for CRS that are global such that they cover the earth. 12035 * Can only be used as the base for other CRS and cannot be used directly, 12036 * since it does not have a `code`, `projection` or `transformation`. `distance()` returns 12037 * meters. 12038 */ 12039 12040var Earth = extend({}, CRS, { 12041 wrapLng: [-180, 180], 12042 12043 // Mean Earth Radius, as recommended for use by 12044 // the International Union of Geodesy and Geophysics, 12045 // see http://rosettacode.org/wiki/Haversine_formula 12046 R: 6371000, 12047 12048 // distance between two geographical points using spherical law of cosines approximation 12049 distance: function (latlng1, latlng2) { 12050 var rad = Math.PI / 180, 12051 lat1 = latlng1.lat * rad, 12052 lat2 = latlng2.lat * rad, 12053 sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2), 12054 sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2), 12055 a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon, 12056 c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 12057 return this.R * c; 12058 } 12059}); 12060 12061/* 12062 * @namespace Projection 12063 * @projection L.Projection.SphericalMercator 12064 * 12065 * Spherical Mercator projection â the most common projection for online maps, 12066 * used by almost all free and commercial tile providers. Assumes that Earth is 12067 * a sphere. Used by the `EPSG:3857` CRS. 12068 */ 12069 12070var earthRadius = 6378137; 12071 12072var SphericalMercator = { 12073 12074 R: earthRadius, 12075 MAX_LATITUDE: 85.0511287798, 12076 12077 project: function (latlng) { 12078 var d = Math.PI / 180, 12079 max = this.MAX_LATITUDE, 12080 lat = Math.max(Math.min(max, latlng.lat), -max), 12081 sin = Math.sin(lat * d); 12082 12083 return new Point( 12084 this.R * latlng.lng * d, 12085 this.R * Math.log((1 + sin) / (1 - sin)) / 2); 12086 }, 12087 12088 unproject: function (point) { 12089 var d = 180 / Math.PI; 12090 12091 return new LatLng( 12092 (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d, 12093 point.x * d / this.R); 12094 }, 12095 12096 bounds: (function () { 12097 var d = earthRadius * Math.PI; 12098 return new Bounds([-d, -d], [d, d]); 12099 })() 12100}; 12101 12102/* 12103 * @class Transformation 12104 * @aka L.Transformation 12105 * 12106 * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d` 12107 * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing 12108 * the reverse. Used by Leaflet in its projections code. 12109 * 12110 * @example 12111 * 12112 * ```js 12113 * var transformation = L.transformation(2, 5, -1, 10), 12114 * p = L.point(1, 2), 12115 * p2 = transformation.transform(p), // L.point(7, 8) 12116 * p3 = transformation.untransform(p2); // L.point(1, 2) 12117 * ``` 12118 */ 12119 12120 12121// factory new L.Transformation(a: Number, b: Number, c: Number, d: Number) 12122// Creates a `Transformation` object with the given coefficients. 12123function Transformation(a, b, c, d) { 12124 if (isArray(a)) { 12125 // use array properties 12126 this._a = a[0]; 12127 this._b = a[1]; 12128 this._c = a[2]; 12129 this._d = a[3]; 12130 return; 12131 } 12132 this._a = a; 12133 this._b = b; 12134 this._c = c; 12135 this._d = d; 12136} 12137 12138Transformation.prototype = { 12139 // @method transform(point: Point, scale?: Number): Point 12140 // Returns a transformed point, optionally multiplied by the given scale. 12141 // Only accepts actual `L.Point` instances, not arrays. 12142 transform: function (point, scale) { // (Point, Number) -> Point 12143 return this._transform(point.clone(), scale); 12144 }, 12145 12146 // destructive transform (faster) 12147 _transform: function (point, scale) { 12148 scale = scale || 1; 12149 point.x = scale * (this._a * point.x + this._b); 12150 point.y = scale * (this._c * point.y + this._d); 12151 return point; 12152 }, 12153 12154 // @method untransform(point: Point, scale?: Number): Point 12155 // Returns the reverse transformation of the given point, optionally divided 12156 // by the given scale. Only accepts actual `L.Point` instances, not arrays. 12157 untransform: function (point, scale) { 12158 scale = scale || 1; 12159 return new Point( 12160 (point.x / scale - this._b) / this._a, 12161 (point.y / scale - this._d) / this._c); 12162 } 12163}; 12164 12165// factory L.transformation(a: Number, b: Number, c: Number, d: Number) 12166 12167// @factory L.transformation(a: Number, b: Number, c: Number, d: Number) 12168// Instantiates a Transformation object with the given coefficients. 12169 12170// @alternative 12171// @factory L.transformation(coefficients: Array): Transformation 12172// Expects an coefficients array of the form 12173// `[a: Number, b: Number, c: Number, d: Number]`. 12174 12175function toTransformation(a, b, c, d) { 12176 return new Transformation(a, b, c, d); 12177} 12178 12179/* 12180 * @namespace CRS 12181 * @crs L.CRS.EPSG3857 12182 * 12183 * The most common CRS for online maps, used by almost all free and commercial 12184 * tile providers. Uses Spherical Mercator projection. Set in by default in 12185 * Map's `crs` option. 12186 */ 12187 12188var EPSG3857 = extend({}, Earth, { 12189 code: 'EPSG:3857', 12190 projection: SphericalMercator, 12191 12192 transformation: (function () { 12193 var scale = 0.5 / (Math.PI * SphericalMercator.R); 12194 return toTransformation(scale, 0.5, -scale, 0.5); 12195 }()) 12196}); 12197 12198var EPSG900913 = extend({}, EPSG3857, { 12199 code: 'EPSG:900913' 12200}); 12201 12202// @namespace SVG; @section 12203// There are several static functions which can be called without instantiating L.SVG: 12204 12205// @function create(name: String): SVGElement 12206// Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement), 12207// corresponding to the class name passed. For example, using 'line' will return 12208// an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement). 12209function svgCreate(name) { 12210 return document.createElementNS('http://www.w3.org/2000/svg', name); 12211} 12212 12213// @function pointsToPath(rings: Point[], closed: Boolean): String 12214// Generates a SVG path string for multiple rings, with each ring turning 12215// into "M..L..L.." instructions 12216function pointsToPath(rings, closed) { 12217 var str = '', 12218 i, j, len, len2, points, p; 12219 12220 for (i = 0, len = rings.length; i < len; i++) { 12221 points = rings[i]; 12222 12223 for (j = 0, len2 = points.length; j < len2; j++) { 12224 p = points[j]; 12225 str += (j ? 'L' : 'M') + p.x + ' ' + p.y; 12226 } 12227 12228 // closes the ring for polygons; "x" is VML syntax 12229 str += closed ? (svg ? 'z' : 'x') : ''; 12230 } 12231 12232 // SVG complains about empty path strings 12233 return str || 'M0 0'; 12234} 12235 12236/* 12237 * @namespace Browser 12238 * @aka L.Browser 12239 * 12240 * A namespace with static properties for browser/feature detection used by Leaflet internally. 12241 * 12242 * @example 12243 * 12244 * ```js 12245 * if (L.Browser.ielt9) { 12246 * alert('Upgrade your browser, dude!'); 12247 * } 12248 * ``` 12249 */ 12250 12251var style$1 = document.documentElement.style; 12252 12253// @property ie: Boolean; `true` for all Internet Explorer versions (not Edge). 12254var ie = 'ActiveXObject' in window; 12255 12256// @property ielt9: Boolean; `true` for Internet Explorer versions less than 9. 12257var ielt9 = ie && !document.addEventListener; 12258 12259// @property edge: Boolean; `true` for the Edge web browser. 12260var edge = 'msLaunchUri' in navigator && !('documentMode' in document); 12261 12262// @property webkit: Boolean; 12263// `true` for webkit-based browsers like Chrome and Safari (including mobile versions). 12264var webkit = userAgentContains('webkit'); 12265 12266// @property android: Boolean 12267// `true` for any browser running on an Android platform. 12268var android = userAgentContains('android'); 12269 12270// @property android23: Boolean; `true` for browsers running on Android 2 or Android 3. 12271var android23 = userAgentContains('android 2') || userAgentContains('android 3'); 12272 12273/* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */ 12274var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit 12275// @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome) 12276var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window); 12277 12278// @property opera: Boolean; `true` for the Opera browser 12279var opera = !!window.opera; 12280 12281// @property chrome: Boolean; `true` for the Chrome browser. 12282var chrome = userAgentContains('chrome'); 12283 12284// @property gecko: Boolean; `true` for gecko-based browsers like Firefox. 12285var gecko = userAgentContains('gecko') && !webkit && !opera && !ie; 12286 12287// @property safari: Boolean; `true` for the Safari browser. 12288var safari = !chrome && userAgentContains('safari'); 12289 12290var phantom = userAgentContains('phantom'); 12291 12292// @property opera12: Boolean 12293// `true` for the Opera browser supporting CSS transforms (version 12 or later). 12294var opera12 = 'OTransition' in style$1; 12295 12296// @property win: Boolean; `true` when the browser is running in a Windows platform 12297var win = navigator.platform.indexOf('Win') === 0; 12298 12299// @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms. 12300var ie3d = ie && ('transition' in style$1); 12301 12302// @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms. 12303var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23; 12304 12305// @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms. 12306var gecko3d = 'MozPerspective' in style$1; 12307 12308// @property any3d: Boolean 12309// `true` for all browsers supporting CSS transforms. 12310var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom; 12311 12312// @property mobile: Boolean; `true` for all browsers running in a mobile device. 12313var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile'); 12314 12315// @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device. 12316var mobileWebkit = mobile && webkit; 12317 12318// @property mobileWebkit3d: Boolean 12319// `true` for all webkit-based browsers in a mobile device supporting CSS transforms. 12320var mobileWebkit3d = mobile && webkit3d; 12321 12322// @property msPointer: Boolean 12323// `true` for browsers implementing the Microsoft touch events model (notably IE10). 12324var msPointer = !window.PointerEvent && window.MSPointerEvent; 12325 12326// @property pointer: Boolean 12327// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx). 12328var pointer = !webkit && !!(window.PointerEvent || msPointer); 12329 12330// @property touch: Boolean 12331// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events). 12332// This does not necessarily mean that the browser is running in a computer with 12333// a touchscreen, it only means that the browser is capable of understanding 12334// touch events. 12335var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window || 12336 (window.DocumentTouch && document instanceof window.DocumentTouch)); 12337 12338// @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device. 12339var mobileOpera = mobile && opera; 12340 12341// @property mobileGecko: Boolean 12342// `true` for gecko-based browsers running in a mobile device. 12343var mobileGecko = mobile && gecko; 12344 12345// @property retina: Boolean 12346// `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%. 12347var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1; 12348 12349// @property passiveEvents: Boolean 12350// `true` for browsers that support passive events. 12351var passiveEvents = (function () { 12352 var supportsPassiveOption = false; 12353 try { 12354 var opts = Object.defineProperty({}, 'passive', { 12355 get: function () { 12356 supportsPassiveOption = true; 12357 } 12358 }); 12359 window.addEventListener('testPassiveEventSupport', falseFn, opts); 12360 window.removeEventListener('testPassiveEventSupport', falseFn, opts); 12361 } catch (e) { 12362 // Errors can safely be ignored since this is only a browser support test. 12363 } 12364 return supportsPassiveOption; 12365}); 12366 12367// @property canvas: Boolean 12368// `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API). 12369var canvas = (function () { 12370 return !!document.createElement('canvas').getContext; 12371}()); 12372 12373// @property svg: Boolean 12374// `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG). 12375var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect); 12376 12377// @property vml: Boolean 12378// `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language). 12379var vml = !svg && (function () { 12380 try { 12381 var div = document.createElement('div'); 12382 div.innerHTML = '<v:shape adj="1"/>'; 12383 12384 var shape = div.firstChild; 12385 shape.style.behavior = 'url(#default#VML)'; 12386 12387 return shape && (typeof shape.adj === 'object'); 12388 12389 } catch (e) { 12390 return false; 12391 } 12392}()); 12393 12394 12395function userAgentContains(str) { 12396 return navigator.userAgent.toLowerCase().indexOf(str) >= 0; 12397} 12398 12399 12400var Browser = (Object.freeze || Object)({ 12401 ie: ie, 12402 ielt9: ielt9, 12403 edge: edge, 12404 webkit: webkit, 12405 android: android, 12406 android23: android23, 12407 androidStock: androidStock, 12408 opera: opera, 12409 chrome: chrome, 12410 gecko: gecko, 12411 safari: safari, 12412 phantom: phantom, 12413 opera12: opera12, 12414 win: win, 12415 ie3d: ie3d, 12416 webkit3d: webkit3d, 12417 gecko3d: gecko3d, 12418 any3d: any3d, 12419 mobile: mobile, 12420 mobileWebkit: mobileWebkit, 12421 mobileWebkit3d: mobileWebkit3d, 12422 msPointer: msPointer, 12423 pointer: pointer, 12424 touch: touch, 12425 mobileOpera: mobileOpera, 12426 mobileGecko: mobileGecko, 12427 retina: retina, 12428 passiveEvents: passiveEvents, 12429 canvas: canvas, 12430 svg: svg, 12431 vml: vml 12432}); 12433 12434/* 12435 * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices. 12436 */ 12437 12438 12439var POINTER_DOWN = msPointer ? 'MSPointerDown' : 'pointerdown'; 12440var POINTER_MOVE = msPointer ? 'MSPointerMove' : 'pointermove'; 12441var POINTER_UP = msPointer ? 'MSPointerUp' : 'pointerup'; 12442var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel'; 12443var TAG_WHITE_LIST = ['INPUT', 'SELECT', 'OPTION']; 12444 12445var _pointers = {}; 12446var _pointerDocListener = false; 12447 12448// DomEvent.DoubleTap needs to know about this 12449var _pointersCount = 0; 12450 12451// Provides a touch events wrapper for (ms)pointer events. 12452// ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890 12453 12454function addPointerListener(obj, type, handler, id) { 12455 if (type === 'touchstart') { 12456 _addPointerStart(obj, handler, id); 12457 12458 } else if (type === 'touchmove') { 12459 _addPointerMove(obj, handler, id); 12460 12461 } else if (type === 'touchend') { 12462 _addPointerEnd(obj, handler, id); 12463 } 12464 12465 return this; 12466} 12467 12468function removePointerListener(obj, type, id) { 12469 var handler = obj['_leaflet_' + type + id]; 12470 12471 if (type === 'touchstart') { 12472 obj.removeEventListener(POINTER_DOWN, handler, false); 12473 12474 } else if (type === 'touchmove') { 12475 obj.removeEventListener(POINTER_MOVE, handler, false); 12476 12477 } else if (type === 'touchend') { 12478 obj.removeEventListener(POINTER_UP, handler, false); 12479 obj.removeEventListener(POINTER_CANCEL, handler, false); 12480 } 12481 12482 return this; 12483} 12484 12485function _addPointerStart(obj, handler, id) { 12486 var onDown = bind(function (e) { 12487 if (e.pointerType !== 'mouse' && e.MSPOINTER_TYPE_MOUSE && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) { 12488 // In IE11, some touch events needs to fire for form controls, or 12489 // the controls will stop working. We keep a whitelist of tag names that 12490 // need these events. For other target tags, we prevent default on the event. 12491 if (TAG_WHITE_LIST.indexOf(e.target.tagName) < 0) { 12492 preventDefault(e); 12493 } else { 12494 return; 12495 } 12496 } 12497 12498 _handlePointer(e, handler); 12499 }); 12500 12501 obj['_leaflet_touchstart' + id] = onDown; 12502 obj.addEventListener(POINTER_DOWN, onDown, false); 12503 12504 // need to keep track of what pointers and how many are active to provide e.touches emulation 12505 if (!_pointerDocListener) { 12506 // we listen documentElement as any drags that end by moving the touch off the screen get fired there 12507 document.documentElement.addEventListener(POINTER_DOWN, _globalPointerDown, true); 12508 document.documentElement.addEventListener(POINTER_MOVE, _globalPointerMove, true); 12509 document.documentElement.addEventListener(POINTER_UP, _globalPointerUp, true); 12510 document.documentElement.addEventListener(POINTER_CANCEL, _globalPointerUp, true); 12511 12512 _pointerDocListener = true; 12513 } 12514} 12515 12516function _globalPointerDown(e) { 12517 _pointers[e.pointerId] = e; 12518 _pointersCount++; 12519} 12520 12521function _globalPointerMove(e) { 12522 if (_pointers[e.pointerId]) { 12523 _pointers[e.pointerId] = e; 12524 } 12525} 12526 12527function _globalPointerUp(e) { 12528 delete _pointers[e.pointerId]; 12529 _pointersCount--; 12530} 12531 12532function _handlePointer(e, handler) { 12533 e.touches = []; 12534 for (var i in _pointers) { 12535 e.touches.push(_pointers[i]); 12536 } 12537 e.changedTouches = [e]; 12538 12539 handler(e); 12540} 12541 12542function _addPointerMove(obj, handler, id) { 12543 var onMove = function (e) { 12544 // don't fire touch moves when mouse isn't down 12545 if ((e.pointerType === e.MSPOINTER_TYPE_MOUSE || e.pointerType === 'mouse') && e.buttons === 0) { return; } 12546 12547 _handlePointer(e, handler); 12548 }; 12549 12550 obj['_leaflet_touchmove' + id] = onMove; 12551 obj.addEventListener(POINTER_MOVE, onMove, false); 12552} 12553 12554function _addPointerEnd(obj, handler, id) { 12555 var onUp = function (e) { 12556 _handlePointer(e, handler); 12557 }; 12558 12559 obj['_leaflet_touchend' + id] = onUp; 12560 obj.addEventListener(POINTER_UP, onUp, false); 12561 obj.addEventListener(POINTER_CANCEL, onUp, false); 12562} 12563 12564/* 12565 * Extends the event handling code with double tap support for mobile browsers. 12566 */ 12567 12568var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart'; 12569var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend'; 12570var _pre = '_leaflet_'; 12571 12572// inspired by Zepto touch code by Thomas Fuchs 12573function addDoubleTapListener(obj, handler, id) { 12574 var last, touch$$1, 12575 doubleTap = false, 12576 delay = 250; 12577 12578 function onTouchStart(e) { 12579 var count; 12580 12581 if (pointer) { 12582 if ((!edge) || e.pointerType === 'mouse') { return; } 12583 count = _pointersCount; 12584 } else { 12585 count = e.touches.length; 12586 } 12587 12588 if (count > 1) { return; } 12589 12590 var now = Date.now(), 12591 delta = now - (last || now); 12592 12593 touch$$1 = e.touches ? e.touches[0] : e; 12594 doubleTap = (delta > 0 && delta <= delay); 12595 last = now; 12596 } 12597 12598 function onTouchEnd(e) { 12599 if (doubleTap && !touch$$1.cancelBubble) { 12600 if (pointer) { 12601 if ((!edge) || e.pointerType === 'mouse') { return; } 12602 // work around .type being readonly with MSPointer* events 12603 var newTouch = {}, 12604 prop, i; 12605 12606 for (i in touch$$1) { 12607 prop = touch$$1[i]; 12608 newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop; 12609 } 12610 touch$$1 = newTouch; 12611 } 12612 touch$$1.type = 'dblclick'; 12613 touch$$1.button = 0; 12614 handler(touch$$1); 12615 last = null; 12616 } 12617 } 12618 12619 obj[_pre + _touchstart + id] = onTouchStart; 12620 obj[_pre + _touchend + id] = onTouchEnd; 12621 obj[_pre + 'dblclick' + id] = handler; 12622 12623 obj.addEventListener(_touchstart, onTouchStart, passiveEvents ? {passive: false} : false); 12624 obj.addEventListener(_touchend, onTouchEnd, passiveEvents ? {passive: false} : false); 12625 12626 // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse), 12627 // the browser doesn't fire touchend/pointerup events but does fire 12628 // native dblclicks. See #4127. 12629 // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180. 12630 obj.addEventListener('dblclick', handler, false); 12631 12632 return this; 12633} 12634 12635function removeDoubleTapListener(obj, id) { 12636 var touchstart = obj[_pre + _touchstart + id], 12637 touchend = obj[_pre + _touchend + id], 12638 dblclick = obj[_pre + 'dblclick' + id]; 12639 12640 obj.removeEventListener(_touchstart, touchstart, passiveEvents ? {passive: false} : false); 12641 obj.removeEventListener(_touchend, touchend, passiveEvents ? {passive: false} : false); 12642 if (!edge) { 12643 obj.removeEventListener('dblclick', dblclick, false); 12644 } 12645 12646 return this; 12647} 12648 12649/* 12650 * @namespace DomUtil 12651 * 12652 * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model) 12653 * tree, used by Leaflet internally. 12654 * 12655 * Most functions expecting or returning a `HTMLElement` also work for 12656 * SVG elements. The only difference is that classes refer to CSS classes 12657 * in HTML and SVG classes in SVG. 12658 */ 12659 12660 12661// @property TRANSFORM: String 12662// Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit). 12663var TRANSFORM = testProp( 12664 ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']); 12665 12666// webkitTransition comes first because some browser versions that drop vendor prefix don't do 12667// the same for the transitionend event, in particular the Android 4.1 stock browser 12668 12669// @property TRANSITION: String 12670// Vendor-prefixed transition style name. 12671var TRANSITION = testProp( 12672 ['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']); 12673 12674// @property TRANSITION_END: String 12675// Vendor-prefixed transitionend event name. 12676var TRANSITION_END = 12677 TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend'; 12678 12679 12680// @function get(id: String|HTMLElement): HTMLElement 12681// Returns an element given its DOM id, or returns the element itself 12682// if it was passed directly. 12683function get(id) { 12684 return typeof id === 'string' ? document.getElementById(id) : id; 12685} 12686 12687// @function getStyle(el: HTMLElement, styleAttrib: String): String 12688// Returns the value for a certain style attribute on an element, 12689// including computed values or values set through CSS. 12690function getStyle(el, style) { 12691 var value = el.style[style] || (el.currentStyle && el.currentStyle[style]); 12692 12693 if ((!value || value === 'auto') && document.defaultView) { 12694 var css = document.defaultView.getComputedStyle(el, null); 12695 value = css ? css[style] : null; 12696 } 12697 return value === 'auto' ? null : value; 12698} 12699 12700// @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement 12701// Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element. 12702function create$1(tagName, className, container) { 12703 var el = document.createElement(tagName); 12704 el.className = className || ''; 12705 12706 if (container) { 12707 container.appendChild(el); 12708 } 12709 return el; 12710} 12711 12712// @function remove(el: HTMLElement) 12713// Removes `el` from its parent element 12714function remove(el) { 12715 var parent = el.parentNode; 12716 if (parent) { 12717 parent.removeChild(el); 12718 } 12719} 12720 12721// @function empty(el: HTMLElement) 12722// Removes all of `el`'s children elements from `el` 12723function empty(el) { 12724 while (el.firstChild) { 12725 el.removeChild(el.firstChild); 12726 } 12727} 12728 12729// @function toFront(el: HTMLElement) 12730// Makes `el` the last child of its parent, so it renders in front of the other children. 12731function toFront(el) { 12732 var parent = el.parentNode; 12733 if (parent && parent.lastChild !== el) { 12734 parent.appendChild(el); 12735 } 12736} 12737 12738// @function toBack(el: HTMLElement) 12739// Makes `el` the first child of its parent, so it renders behind the other children. 12740function toBack(el) { 12741 var parent = el.parentNode; 12742 if (parent && parent.firstChild !== el) { 12743 parent.insertBefore(el, parent.firstChild); 12744 } 12745} 12746 12747// @function hasClass(el: HTMLElement, name: String): Boolean 12748// Returns `true` if the element's class attribute contains `name`. 12749function hasClass(el, name) { 12750 if (el.classList !== undefined) { 12751 return el.classList.contains(name); 12752 } 12753 var className = getClass(el); 12754 return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className); 12755} 12756 12757// @function addClass(el: HTMLElement, name: String) 12758// Adds `name` to the element's class attribute. 12759function addClass(el, name) { 12760 if (el.classList !== undefined) { 12761 var classes = splitWords(name); 12762 for (var i = 0, len = classes.length; i < len; i++) { 12763 el.classList.add(classes[i]); 12764 } 12765 } else if (!hasClass(el, name)) { 12766 var className = getClass(el); 12767 setClass(el, (className ? className + ' ' : '') + name); 12768 } 12769} 12770 12771// @function removeClass(el: HTMLElement, name: String) 12772// Removes `name` from the element's class attribute. 12773function removeClass(el, name) { 12774 if (el.classList !== undefined) { 12775 el.classList.remove(name); 12776 } else { 12777 setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' '))); 12778 } 12779} 12780 12781// @function setClass(el: HTMLElement, name: String) 12782// Sets the element's class. 12783function setClass(el, name) { 12784 if (el.className.baseVal === undefined) { 12785 el.className = name; 12786 } else { 12787 // in case of SVG element 12788 el.className.baseVal = name; 12789 } 12790} 12791 12792// @function getClass(el: HTMLElement): String 12793// Returns the element's class. 12794function getClass(el) { 12795 // Check if the element is an SVGElementInstance and use the correspondingElement instead 12796 // (Required for linked SVG elements in IE11.) 12797 if (el.correspondingElement) { 12798 el = el.correspondingElement; 12799 } 12800 return el.className.baseVal === undefined ? el.className : el.className.baseVal; 12801} 12802 12803// @function setOpacity(el: HTMLElement, opacity: Number) 12804// Set the opacity of an element (including old IE support). 12805// `opacity` must be a number from `0` to `1`. 12806function setOpacity(el, value) { 12807 if ('opacity' in el.style) { 12808 el.style.opacity = value; 12809 } else if ('filter' in el.style) { 12810 _setOpacityIE(el, value); 12811 } 12812} 12813 12814function _setOpacityIE(el, value) { 12815 var filter = false, 12816 filterName = 'DXImageTransform.Microsoft.Alpha'; 12817 12818 // filters collection throws an error if we try to retrieve a filter that doesn't exist 12819 try { 12820 filter = el.filters.item(filterName); 12821 } catch (e) { 12822 // don't set opacity to 1 if we haven't already set an opacity, 12823 // it isn't needed and breaks transparent pngs. 12824 if (value === 1) { return; } 12825 } 12826 12827 value = Math.round(value * 100); 12828 12829 if (filter) { 12830 filter.Enabled = (value !== 100); 12831 filter.Opacity = value; 12832 } else { 12833 el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')'; 12834 } 12835} 12836 12837// @function testProp(props: String[]): String|false 12838// Goes through the array of style names and returns the first name 12839// that is a valid style name for an element. If no such name is found, 12840// it returns false. Useful for vendor-prefixed styles like `transform`. 12841function testProp(props) { 12842 var style = document.documentElement.style; 12843 12844 for (var i = 0; i < props.length; i++) { 12845 if (props[i] in style) { 12846 return props[i]; 12847 } 12848 } 12849 return false; 12850} 12851 12852// @function setTransform(el: HTMLElement, offset: Point, scale?: Number) 12853// Resets the 3D CSS transform of `el` so it is translated by `offset` pixels 12854// and optionally scaled by `scale`. Does not have an effect if the 12855// browser doesn't support 3D CSS transforms. 12856function setTransform(el, offset, scale) { 12857 var pos = offset || new Point(0, 0); 12858 12859 el.style[TRANSFORM] = 12860 (ie3d ? 12861 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 12862 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + 12863 (scale ? ' scale(' + scale + ')' : ''); 12864} 12865 12866// @function setPosition(el: HTMLElement, position: Point) 12867// Sets the position of `el` to coordinates specified by `position`, 12868// using CSS translate or top/left positioning depending on the browser 12869// (used by Leaflet internally to position its layers). 12870function setPosition(el, point) { 12871 12872 /*eslint-disable */ 12873 el._leaflet_pos = point; 12874 /* eslint-enable */ 12875 12876 if (any3d) { 12877 setTransform(el, point); 12878 } else { 12879 el.style.left = point.x + 'px'; 12880 el.style.top = point.y + 'px'; 12881 } 12882} 12883 12884// @function getPosition(el: HTMLElement): Point 12885// Returns the coordinates of an element previously positioned with setPosition. 12886function getPosition(el) { 12887 // this method is only used for elements previously positioned using setPosition, 12888 // so it's safe to cache the position for performance 12889 12890 return el._leaflet_pos || new Point(0, 0); 12891} 12892 12893// @function disableTextSelection() 12894// Prevents the user from generating `selectstart` DOM events, usually generated 12895// when the user drags the mouse through a page with text. Used internally 12896// by Leaflet to override the behaviour of any click-and-drag interaction on 12897// the map. Affects drag interactions on the whole document. 12898 12899// @function enableTextSelection() 12900// Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection). 12901var disableTextSelection; 12902var enableTextSelection; 12903var _userSelect; 12904if ('onselectstart' in document) { 12905 disableTextSelection = function () { 12906 on(window, 'selectstart', preventDefault); 12907 }; 12908 enableTextSelection = function () { 12909 off(window, 'selectstart', preventDefault); 12910 }; 12911} else { 12912 var userSelectProperty = testProp( 12913 ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']); 12914 12915 disableTextSelection = function () { 12916 if (userSelectProperty) { 12917 var style = document.documentElement.style; 12918 _userSelect = style[userSelectProperty]; 12919 style[userSelectProperty] = 'none'; 12920 } 12921 }; 12922 enableTextSelection = function () { 12923 if (userSelectProperty) { 12924 document.documentElement.style[userSelectProperty] = _userSelect; 12925 _userSelect = undefined; 12926 } 12927 }; 12928} 12929 12930// @function disableImageDrag() 12931// As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but 12932// for `dragstart` DOM events, usually generated when the user drags an image. 12933function disableImageDrag() { 12934 on(window, 'dragstart', preventDefault); 12935} 12936 12937// @function enableImageDrag() 12938// Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection). 12939function enableImageDrag() { 12940 off(window, 'dragstart', preventDefault); 12941} 12942 12943var _outlineElement; 12944var _outlineStyle; 12945// @function preventOutline(el: HTMLElement) 12946// Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline) 12947// of the element `el` invisible. Used internally by Leaflet to prevent 12948// focusable elements from displaying an outline when the user performs a 12949// drag interaction on them. 12950function preventOutline(element) { 12951 while (element.tabIndex === -1) { 12952 element = element.parentNode; 12953 } 12954 if (!element.style) { return; } 12955 restoreOutline(); 12956 _outlineElement = element; 12957 _outlineStyle = element.style.outline; 12958 element.style.outline = 'none'; 12959 on(window, 'keydown', restoreOutline); 12960} 12961 12962// @function restoreOutline() 12963// Cancels the effects of a previous [`L.DomUtil.preventOutline`](). 12964function restoreOutline() { 12965 if (!_outlineElement) { return; } 12966 _outlineElement.style.outline = _outlineStyle; 12967 _outlineElement = undefined; 12968 _outlineStyle = undefined; 12969 off(window, 'keydown', restoreOutline); 12970} 12971 12972// @function getSizedParentNode(el: HTMLElement): HTMLElement 12973// Finds the closest parent node which size (width and height) is not null. 12974function getSizedParentNode(element) { 12975 do { 12976 element = element.parentNode; 12977 } while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body); 12978 return element; 12979} 12980 12981// @function getScale(el: HTMLElement): Object 12982// Computes the CSS scale currently applied on the element. 12983// Returns an object with `x` and `y` members as horizontal and vertical scales respectively, 12984// and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). 12985function getScale(element) { 12986 var rect = element.getBoundingClientRect(); // Read-only in old browsers. 12987 12988 return { 12989 x: rect.width / element.offsetWidth || 1, 12990 y: rect.height / element.offsetHeight || 1, 12991 boundingClientRect: rect 12992 }; 12993} 12994 12995 12996var DomUtil = (Object.freeze || Object)({ 12997 TRANSFORM: TRANSFORM, 12998 TRANSITION: TRANSITION, 12999 TRANSITION_END: TRANSITION_END, 13000 get: get, 13001 getStyle: getStyle, 13002 create: create$1, 13003 remove: remove, 13004 empty: empty, 13005 toFront: toFront, 13006 toBack: toBack, 13007 hasClass: hasClass, 13008 addClass: addClass, 13009 removeClass: removeClass, 13010 setClass: setClass, 13011 getClass: getClass, 13012 setOpacity: setOpacity, 13013 testProp: testProp, 13014 setTransform: setTransform, 13015 setPosition: setPosition, 13016 getPosition: getPosition, 13017 disableTextSelection: disableTextSelection, 13018 enableTextSelection: enableTextSelection, 13019 disableImageDrag: disableImageDrag, 13020 enableImageDrag: enableImageDrag, 13021 preventOutline: preventOutline, 13022 restoreOutline: restoreOutline, 13023 getSizedParentNode: getSizedParentNode, 13024 getScale: getScale 13025}); 13026 13027/* 13028 * @namespace DomEvent 13029 * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally. 13030 */ 13031 13032// Inspired by John Resig, Dean Edwards and YUI addEvent implementations. 13033 13034// @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this 13035// Adds a listener function (`fn`) to a particular DOM event type of the 13036// element `el`. You can optionally specify the context of the listener 13037// (object the `this` keyword will point to). You can also pass several 13038// space-separated types (e.g. `'click dblclick'`). 13039 13040// @alternative 13041// @function on(el: HTMLElement, eventMap: Object, context?: Object): this 13042// Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` 13043function on(obj, types, fn, context) { 13044 13045 if (typeof types === 'object') { 13046 for (var type in types) { 13047 addOne(obj, type, types[type], fn); 13048 } 13049 } else { 13050 types = splitWords(types); 13051 13052 for (var i = 0, len = types.length; i < len; i++) { 13053 addOne(obj, types[i], fn, context); 13054 } 13055 } 13056 13057 return this; 13058} 13059 13060var eventsKey = '_leaflet_events'; 13061 13062// @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this 13063// Removes a previously added listener function. 13064// Note that if you passed a custom context to on, you must pass the same 13065// context to `off` in order to remove the listener. 13066 13067// @alternative 13068// @function off(el: HTMLElement, eventMap: Object, context?: Object): this 13069// Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` 13070function off(obj, types, fn, context) { 13071 13072 if (typeof types === 'object') { 13073 for (var type in types) { 13074 removeOne(obj, type, types[type], fn); 13075 } 13076 } else if (types) { 13077 types = splitWords(types); 13078 13079 for (var i = 0, len = types.length; i < len; i++) { 13080 removeOne(obj, types[i], fn, context); 13081 } 13082 } else { 13083 for (var j in obj[eventsKey]) { 13084 removeOne(obj, j, obj[eventsKey][j]); 13085 } 13086 delete obj[eventsKey]; 13087 } 13088 13089 return this; 13090} 13091 13092function addOne(obj, type, fn, context) { 13093 var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''); 13094 13095 if (obj[eventsKey] && obj[eventsKey][id]) { return this; } 13096 13097 var handler = function (e) { 13098 return fn.call(context || obj, e || window.event); 13099 }; 13100 13101 var originalHandler = handler; 13102 13103 if (pointer && type.indexOf('touch') === 0) { 13104 // Needs DomEvent.Pointer.js 13105 addPointerListener(obj, type, handler, id); 13106 13107 } else if (touch && (type === 'dblclick') && addDoubleTapListener && 13108 !(pointer && chrome)) { 13109 // Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener 13110 // See #5180 13111 addDoubleTapListener(obj, handler, id); 13112 13113 } else if ('addEventListener' in obj) { 13114 13115 if (type === 'mousewheel') { 13116 obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, passiveEvents ? {passive: false} : false); 13117 13118 } else if ((type === 'mouseenter') || (type === 'mouseleave')) { 13119 handler = function (e) { 13120 e = e || window.event; 13121 if (isExternalTarget(obj, e)) { 13122 originalHandler(e); 13123 } 13124 }; 13125 obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false); 13126 13127 } else { 13128 if (type === 'click' && android) { 13129 handler = function (e) { 13130 filterClick(e, originalHandler); 13131 }; 13132 } 13133 obj.addEventListener(type, handler, false); 13134 } 13135 13136 } else if ('attachEvent' in obj) { 13137 obj.attachEvent('on' + type, handler); 13138 } 13139 13140 obj[eventsKey] = obj[eventsKey] || {}; 13141 obj[eventsKey][id] = handler; 13142} 13143 13144function removeOne(obj, type, fn, context) { 13145 13146 var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''), 13147 handler = obj[eventsKey] && obj[eventsKey][id]; 13148 13149 if (!handler) { return this; } 13150 13151 if (pointer && type.indexOf('touch') === 0) { 13152 removePointerListener(obj, type, id); 13153 13154 } else if (touch && (type === 'dblclick') && removeDoubleTapListener && 13155 !(pointer && chrome)) { 13156 removeDoubleTapListener(obj, id); 13157 13158 } else if ('removeEventListener' in obj) { 13159 13160 if (type === 'mousewheel') { 13161 obj.removeEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, passiveEvents ? {passive: false} : false); 13162 13163 } else { 13164 obj.removeEventListener( 13165 type === 'mouseenter' ? 'mouseover' : 13166 type === 'mouseleave' ? 'mouseout' : type, handler, false); 13167 } 13168 13169 } else if ('detachEvent' in obj) { 13170 obj.detachEvent('on' + type, handler); 13171 } 13172 13173 obj[eventsKey][id] = null; 13174} 13175 13176// @function stopPropagation(ev: DOMEvent): this 13177// Stop the given event from propagation to parent elements. Used inside the listener functions: 13178// ```js 13179// L.DomEvent.on(div, 'click', function (ev) { 13180// L.DomEvent.stopPropagation(ev); 13181// }); 13182// ``` 13183function stopPropagation(e) { 13184 13185 if (e.stopPropagation) { 13186 e.stopPropagation(); 13187 } else if (e.originalEvent) { // In case of Leaflet event. 13188 e.originalEvent._stopped = true; 13189 } else { 13190 e.cancelBubble = true; 13191 } 13192 skipped(e); 13193 13194 return this; 13195} 13196 13197// @function disableScrollPropagation(el: HTMLElement): this 13198// Adds `stopPropagation` to the element's `'mousewheel'` events (plus browser variants). 13199function disableScrollPropagation(el) { 13200 addOne(el, 'mousewheel', stopPropagation); 13201 return this; 13202} 13203 13204// @function disableClickPropagation(el: HTMLElement): this 13205// Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`, 13206// `'mousedown'` and `'touchstart'` events (plus browser variants). 13207function disableClickPropagation(el) { 13208 on(el, 'mousedown touchstart dblclick', stopPropagation); 13209 addOne(el, 'click', fakeStop); 13210 return this; 13211} 13212 13213// @function preventDefault(ev: DOMEvent): this 13214// Prevents the default action of the DOM Event `ev` from happening (such as 13215// following a link in the href of the a element, or doing a POST request 13216// with page reload when a `<form>` is submitted). 13217// Use it inside listener functions. 13218function preventDefault(e) { 13219 if (e.preventDefault) { 13220 e.preventDefault(); 13221 } else { 13222 e.returnValue = false; 13223 } 13224 return this; 13225} 13226 13227// @function stop(ev: DOMEvent): this 13228// Does `stopPropagation` and `preventDefault` at the same time. 13229function stop(e) { 13230 preventDefault(e); 13231 stopPropagation(e); 13232 return this; 13233} 13234 13235// @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point 13236// Gets normalized mouse position from a DOM event relative to the 13237// `container` (border excluded) or to the whole page if not specified. 13238function getMousePosition(e, container) { 13239 if (!container) { 13240 return new Point(e.clientX, e.clientY); 13241 } 13242 13243 var scale = getScale(container), 13244 offset = scale.boundingClientRect; // left and top values are in page scale (like the event clientX/Y) 13245 13246 return new Point( 13247 // offset.left/top values are in page scale (like clientX/Y), 13248 // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies). 13249 (e.clientX - offset.left) / scale.x - container.clientLeft, 13250 (e.clientY - offset.top) / scale.y - container.clientTop 13251 ); 13252} 13253 13254// Chrome on Win scrolls double the pixels as in other platforms (see #4538), 13255// and Firefox scrolls device pixels, not CSS pixels 13256var wheelPxFactor = 13257 (win && chrome) ? 2 * window.devicePixelRatio : 13258 gecko ? window.devicePixelRatio : 1; 13259 13260// @function getWheelDelta(ev: DOMEvent): Number 13261// Gets normalized wheel delta from a mousewheel DOM event, in vertical 13262// pixels scrolled (negative if scrolling down). 13263// Events from pointing devices without precise scrolling are mapped to 13264// a best guess of 60 pixels. 13265function getWheelDelta(e) { 13266 return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta 13267 (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels 13268 (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines 13269 (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages 13270 (e.deltaX || e.deltaZ) ? 0 : // Skip horizontal/depth wheel events 13271 e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels 13272 (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines 13273 e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages 13274 0; 13275} 13276 13277var skipEvents = {}; 13278 13279function fakeStop(e) { 13280 // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e) 13281 skipEvents[e.type] = true; 13282} 13283 13284function skipped(e) { 13285 var events = skipEvents[e.type]; 13286 // reset when checking, as it's only used in map container and propagates outside of the map 13287 skipEvents[e.type] = false; 13288 return events; 13289} 13290 13291// check if element really left/entered the event target (for mouseenter/mouseleave) 13292function isExternalTarget(el, e) { 13293 13294 var related = e.relatedTarget; 13295 13296 if (!related) { return true; } 13297 13298 try { 13299 while (related && (related !== el)) { 13300 related = related.parentNode; 13301 } 13302 } catch (err) { 13303 return false; 13304 } 13305 return (related !== el); 13306} 13307 13308var lastClick; 13309 13310// this is a horrible workaround for a bug in Android where a single touch triggers two click events 13311function filterClick(e, handler) { 13312 var timeStamp = (e.timeStamp || (e.originalEvent && e.originalEvent.timeStamp)), 13313 elapsed = lastClick && (timeStamp - lastClick); 13314 13315 // are they closer together than 500ms yet more than 100ms? 13316 // Android typically triggers them ~300ms apart while multiple listeners 13317 // on the same event should be triggered far faster; 13318 // or check if click is simulated on the element, and if it is, reject any non-simulated events 13319 13320 if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) { 13321 stop(e); 13322 return; 13323 } 13324 lastClick = timeStamp; 13325 13326 handler(e); 13327} 13328 13329 13330 13331 13332var DomEvent = (Object.freeze || Object)({ 13333 on: on, 13334 off: off, 13335 stopPropagation: stopPropagation, 13336 disableScrollPropagation: disableScrollPropagation, 13337 disableClickPropagation: disableClickPropagation, 13338 preventDefault: preventDefault, 13339 stop: stop, 13340 getMousePosition: getMousePosition, 13341 getWheelDelta: getWheelDelta, 13342 fakeStop: fakeStop, 13343 skipped: skipped, 13344 isExternalTarget: isExternalTarget, 13345 addListener: on, 13346 removeListener: off 13347}); 13348 13349/* 13350 * @class PosAnimation 13351 * @aka L.PosAnimation 13352 * @inherits Evented 13353 * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9. 13354 * 13355 * @example 13356 * ```js 13357 * var fx = new L.PosAnimation(); 13358 * fx.run(el, [300, 500], 0.5); 13359 * ``` 13360 * 13361 * @constructor L.PosAnimation() 13362 * Creates a `PosAnimation` object. 13363 * 13364 */ 13365 13366var PosAnimation = Evented.extend({ 13367 13368 // @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number) 13369 // Run an animation of a given element to a new position, optionally setting 13370 // duration in seconds (`0.25` by default) and easing linearity factor (3rd 13371 // argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1), 13372 // `0.5` by default). 13373 run: function (el, newPos, duration, easeLinearity) { 13374 this.stop(); 13375 13376 this._el = el; 13377 this._inProgress = true; 13378 this._duration = duration || 0.25; 13379 this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2); 13380 13381 this._startPos = getPosition(el); 13382 this._offset = newPos.subtract(this._startPos); 13383 this._startTime = +new Date(); 13384 13385 // @event start: Event 13386 // Fired when the animation starts 13387 this.fire('start'); 13388 13389 this._animate(); 13390 }, 13391 13392 // @method stop() 13393 // Stops the animation (if currently running). 13394 stop: function () { 13395 if (!this._inProgress) { return; } 13396 13397 this._step(true); 13398 this._complete(); 13399 }, 13400 13401 _animate: function () { 13402 // animation loop 13403 this._animId = requestAnimFrame(this._animate, this); 13404 this._step(); 13405 }, 13406 13407 _step: function (round) { 13408 var elapsed = (+new Date()) - this._startTime, 13409 duration = this._duration * 1000; 13410 13411 if (elapsed < duration) { 13412 this._runFrame(this._easeOut(elapsed / duration), round); 13413 } else { 13414 this._runFrame(1); 13415 this._complete(); 13416 } 13417 }, 13418 13419 _runFrame: function (progress, round) { 13420 var pos = this._startPos.add(this._offset.multiplyBy(progress)); 13421 if (round) { 13422 pos._round(); 13423 } 13424 setPosition(this._el, pos); 13425 13426 // @event step: Event 13427 // Fired continuously during the animation. 13428 this.fire('step'); 13429 }, 13430 13431 _complete: function () { 13432 cancelAnimFrame(this._animId); 13433 13434 this._inProgress = false; 13435 // @event end: Event 13436 // Fired when the animation ends. 13437 this.fire('end'); 13438 }, 13439 13440 _easeOut: function (t) { 13441 return 1 - Math.pow(1 - t, this._easeOutPower); 13442 } 13443}); 13444 13445/* 13446 * @class Map 13447 * @aka L.Map 13448 * @inherits Evented 13449 * 13450 * The central class of the API â it is used to create a map on a page and manipulate it. 13451 * 13452 * @example 13453 * 13454 * ```js 13455 * // initialize the map on the "map" div with a given center and zoom 13456 * var map = L.map('map', { 13457 * center: [51.505, -0.09], 13458 * zoom: 13 13459 * }); 13460 * ``` 13461 * 13462 */ 13463 13464var Map = Evented.extend({ 13465 13466 options: { 13467 // @section Map State Options 13468 // @option crs: CRS = L.CRS.EPSG3857 13469 // The [Coordinate Reference System](#crs) to use. Don't change this if you're not 13470 // sure what it means. 13471 crs: EPSG3857, 13472 13473 // @option center: LatLng = undefined 13474 // Initial geographic center of the map 13475 center: undefined, 13476 13477 // @option zoom: Number = undefined 13478 // Initial map zoom level 13479 zoom: undefined, 13480 13481 // @option minZoom: Number = * 13482 // Minimum zoom level of the map. 13483 // If not specified and at least one `GridLayer` or `TileLayer` is in the map, 13484 // the lowest of their `minZoom` options will be used instead. 13485 minZoom: undefined, 13486 13487 // @option maxZoom: Number = * 13488 // Maximum zoom level of the map. 13489 // If not specified and at least one `GridLayer` or `TileLayer` is in the map, 13490 // the highest of their `maxZoom` options will be used instead. 13491 maxZoom: undefined, 13492 13493 // @option layers: Layer[] = [] 13494 // Array of layers that will be added to the map initially 13495 layers: [], 13496 13497 // @option maxBounds: LatLngBounds = null 13498 // When this option is set, the map restricts the view to the given 13499 // geographical bounds, bouncing the user back if the user tries to pan 13500 // outside the view. To set the restriction dynamically, use 13501 // [`setMaxBounds`](#map-setmaxbounds) method. 13502 maxBounds: undefined, 13503 13504 // @option renderer: Renderer = * 13505 // The default method for drawing vector layers on the map. `L.SVG` 13506 // or `L.Canvas` by default depending on browser support. 13507 renderer: undefined, 13508 13509 13510 // @section Animation Options 13511 // @option zoomAnimation: Boolean = true 13512 // Whether the map zoom animation is enabled. By default it's enabled 13513 // in all browsers that support CSS3 Transitions except Android. 13514 zoomAnimation: true, 13515 13516 // @option zoomAnimationThreshold: Number = 4 13517 // Won't animate zoom if the zoom difference exceeds this value. 13518 zoomAnimationThreshold: 4, 13519 13520 // @option fadeAnimation: Boolean = true 13521 // Whether the tile fade animation is enabled. By default it's enabled 13522 // in all browsers that support CSS3 Transitions except Android. 13523 fadeAnimation: true, 13524 13525 // @option markerZoomAnimation: Boolean = true 13526 // Whether markers animate their zoom with the zoom animation, if disabled 13527 // they will disappear for the length of the animation. By default it's 13528 // enabled in all browsers that support CSS3 Transitions except Android. 13529 markerZoomAnimation: true, 13530 13531 // @option transform3DLimit: Number = 2^23 13532 // Defines the maximum size of a CSS translation transform. The default 13533 // value should not be changed unless a web browser positions layers in 13534 // the wrong place after doing a large `panBy`. 13535 transform3DLimit: 8388608, // Precision limit of a 32-bit float 13536 13537 // @section Interaction Options 13538 // @option zoomSnap: Number = 1 13539 // Forces the map's zoom level to always be a multiple of this, particularly 13540 // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom. 13541 // By default, the zoom level snaps to the nearest integer; lower values 13542 // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0` 13543 // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom. 13544 zoomSnap: 1, 13545 13546 // @option zoomDelta: Number = 1 13547 // Controls how much the map's zoom level will change after a 13548 // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+` 13549 // or `-` on the keyboard, or using the [zoom controls](#control-zoom). 13550 // Values smaller than `1` (e.g. `0.5`) allow for greater granularity. 13551 zoomDelta: 1, 13552 13553 // @option trackResize: Boolean = true 13554 // Whether the map automatically handles browser window resize to update itself. 13555 trackResize: true 13556 }, 13557 13558 initialize: function (id, options) { // (HTMLElement or String, Object) 13559 options = setOptions(this, options); 13560 13561 // Make sure to assign internal flags at the beginning, 13562 // to avoid inconsistent state in some edge cases. 13563 this._handlers = []; 13564 this._layers = {}; 13565 this._zoomBoundLayers = {}; 13566 this._sizeChanged = true; 13567 13568 this._initContainer(id); 13569 this._initLayout(); 13570 13571 // hack for https://github.com/Leaflet/Leaflet/issues/1980 13572 this._onResize = bind(this._onResize, this); 13573 13574 this._initEvents(); 13575 13576 if (options.maxBounds) { 13577 this.setMaxBounds(options.maxBounds); 13578 } 13579 13580 if (options.zoom !== undefined) { 13581 this._zoom = this._limitZoom(options.zoom); 13582 } 13583 13584 if (options.center && options.zoom !== undefined) { 13585 this.setView(toLatLng(options.center), options.zoom, {reset: true}); 13586 } 13587 13588 this.callInitHooks(); 13589 13590 // don't animate on browsers without hardware-accelerated transitions or old Android/Opera 13591 this._zoomAnimated = TRANSITION && any3d && !mobileOpera && 13592 this.options.zoomAnimation; 13593 13594 // zoom transitions run with the same duration for all layers, so if one of transitionend events 13595 // happens after starting zoom animation (propagating to the map pane), we know that it ended globally 13596 if (this._zoomAnimated) { 13597 this._createAnimProxy(); 13598 on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this); 13599 } 13600 13601 this._addLayers(this.options.layers); 13602 }, 13603 13604 13605 // @section Methods for modifying map state 13606 13607 // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this 13608 // Sets the view of the map (geographical center and zoom) with the given 13609 // animation options. 13610 setView: function (center, zoom, options) { 13611 13612 zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom); 13613 center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds); 13614 options = options || {}; 13615 13616 this._stop(); 13617 13618 if (this._loaded && !options.reset && options !== true) { 13619 13620 if (options.animate !== undefined) { 13621 options.zoom = extend({animate: options.animate}, options.zoom); 13622 options.pan = extend({animate: options.animate, duration: options.duration}, options.pan); 13623 } 13624 13625 // try animating pan or zoom 13626 var moved = (this._zoom !== zoom) ? 13627 this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) : 13628 this._tryAnimatedPan(center, options.pan); 13629 13630 if (moved) { 13631 // prevent resize handler call, the view will refresh after animation anyway 13632 clearTimeout(this._sizeTimer); 13633 return this; 13634 } 13635 } 13636 13637 // animation didn't start, just reset the map view 13638 this._resetView(center, zoom); 13639 13640 return this; 13641 }, 13642 13643 // @method setZoom(zoom: Number, options?: Zoom/pan options): this 13644 // Sets the zoom of the map. 13645 setZoom: function (zoom, options) { 13646 if (!this._loaded) { 13647 this._zoom = zoom; 13648 return this; 13649 } 13650 return this.setView(this.getCenter(), zoom, {zoom: options}); 13651 }, 13652 13653 // @method zoomIn(delta?: Number, options?: Zoom options): this 13654 // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default). 13655 zoomIn: function (delta, options) { 13656 delta = delta || (any3d ? this.options.zoomDelta : 1); 13657 return this.setZoom(this._zoom + delta, options); 13658 }, 13659 13660 // @method zoomOut(delta?: Number, options?: Zoom options): this 13661 // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default). 13662 zoomOut: function (delta, options) { 13663 delta = delta || (any3d ? this.options.zoomDelta : 1); 13664 return this.setZoom(this._zoom - delta, options); 13665 }, 13666 13667 // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this 13668 // Zooms the map while keeping a specified geographical point on the map 13669 // stationary (e.g. used internally for scroll zoom and double-click zoom). 13670 // @alternative 13671 // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this 13672 // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary. 13673 setZoomAround: function (latlng, zoom, options) { 13674 var scale = this.getZoomScale(zoom), 13675 viewHalf = this.getSize().divideBy(2), 13676 containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng), 13677 13678 centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale), 13679 newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset)); 13680 13681 return this.setView(newCenter, zoom, {zoom: options}); 13682 }, 13683 13684 _getBoundsCenterZoom: function (bounds, options) { 13685 13686 options = options || {}; 13687 bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds); 13688 13689 var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]), 13690 paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]), 13691 13692 zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)); 13693 13694 zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom; 13695 13696 if (zoom === Infinity) { 13697 return { 13698 center: bounds.getCenter(), 13699 zoom: zoom 13700 }; 13701 } 13702 13703 var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2), 13704 13705 swPoint = this.project(bounds.getSouthWest(), zoom), 13706 nePoint = this.project(bounds.getNorthEast(), zoom), 13707 center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom); 13708 13709 return { 13710 center: center, 13711 zoom: zoom 13712 }; 13713 }, 13714 13715 // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this 13716 // Sets a map view that contains the given geographical bounds with the 13717 // maximum zoom level possible. 13718 fitBounds: function (bounds, options) { 13719 13720 bounds = toLatLngBounds(bounds); 13721 13722 if (!bounds.isValid()) { 13723 throw new Error('Bounds are not valid.'); 13724 } 13725 13726 var target = this._getBoundsCenterZoom(bounds, options); 13727 return this.setView(target.center, target.zoom, options); 13728 }, 13729 13730 // @method fitWorld(options?: fitBounds options): this 13731 // Sets a map view that mostly contains the whole world with the maximum 13732 // zoom level possible. 13733 fitWorld: function (options) { 13734 return this.fitBounds([[-90, -180], [90, 180]], options); 13735 }, 13736 13737 // @method panTo(latlng: LatLng, options?: Pan options): this 13738 // Pans the map to a given center. 13739 panTo: function (center, options) { // (LatLng) 13740 return this.setView(center, this._zoom, {pan: options}); 13741 }, 13742 13743 // @method panBy(offset: Point, options?: Pan options): this 13744 // Pans the map by a given number of pixels (animated). 13745 panBy: function (offset, options) { 13746 offset = toPoint(offset).round(); 13747 options = options || {}; 13748 13749 if (!offset.x && !offset.y) { 13750 return this.fire('moveend'); 13751 } 13752 // If we pan too far, Chrome gets issues with tiles 13753 // and makes them disappear or appear in the wrong place (slightly offset) #2602 13754 if (options.animate !== true && !this.getSize().contains(offset)) { 13755 this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom()); 13756 return this; 13757 } 13758 13759 if (!this._panAnim) { 13760 this._panAnim = new PosAnimation(); 13761 13762 this._panAnim.on({ 13763 'step': this._onPanTransitionStep, 13764 'end': this._onPanTransitionEnd 13765 }, this); 13766 } 13767 13768 // don't fire movestart if animating inertia 13769 if (!options.noMoveStart) { 13770 this.fire('movestart'); 13771 } 13772 13773 // animate pan unless animate: false specified 13774 if (options.animate !== false) { 13775 addClass(this._mapPane, 'leaflet-pan-anim'); 13776 13777 var newPos = this._getMapPanePos().subtract(offset).round(); 13778 this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity); 13779 } else { 13780 this._rawPanBy(offset); 13781 this.fire('move').fire('moveend'); 13782 } 13783 13784 return this; 13785 }, 13786 13787 // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this 13788 // Sets the view of the map (geographical center and zoom) performing a smooth 13789 // pan-zoom animation. 13790 flyTo: function (targetCenter, targetZoom, options) { 13791 13792 options = options || {}; 13793 if (options.animate === false || !any3d) { 13794 return this.setView(targetCenter, targetZoom, options); 13795 } 13796 13797 this._stop(); 13798 13799 var from = this.project(this.getCenter()), 13800 to = this.project(targetCenter), 13801 size = this.getSize(), 13802 startZoom = this._zoom; 13803 13804 targetCenter = toLatLng(targetCenter); 13805 targetZoom = targetZoom === undefined ? startZoom : targetZoom; 13806 13807 var w0 = Math.max(size.x, size.y), 13808 w1 = w0 * this.getZoomScale(startZoom, targetZoom), 13809 u1 = (to.distanceTo(from)) || 1, 13810 rho = 1.42, 13811 rho2 = rho * rho; 13812 13813 function r(i) { 13814 var s1 = i ? -1 : 1, 13815 s2 = i ? w1 : w0, 13816 t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1, 13817 b1 = 2 * s2 * rho2 * u1, 13818 b = t1 / b1, 13819 sq = Math.sqrt(b * b + 1) - b; 13820 13821 // workaround for floating point precision bug when sq = 0, log = -Infinite, 13822 // thus triggering an infinite loop in flyTo 13823 var log = sq < 0.000000001 ? -18 : Math.log(sq); 13824 13825 return log; 13826 } 13827 13828 function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; } 13829 function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; } 13830 function tanh(n) { return sinh(n) / cosh(n); } 13831 13832 var r0 = r(0); 13833 13834 function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); } 13835 function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; } 13836 13837 function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); } 13838 13839 var start = Date.now(), 13840 S = (r(1) - r0) / rho, 13841 duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8; 13842 13843 function frame() { 13844 var t = (Date.now() - start) / duration, 13845 s = easeOut(t) * S; 13846 13847 if (t <= 1) { 13848 this._flyToFrame = requestAnimFrame(frame, this); 13849 13850 this._move( 13851 this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), 13852 this.getScaleZoom(w0 / w(s), startZoom), 13853 {flyTo: true}); 13854 13855 } else { 13856 this 13857 ._move(targetCenter, targetZoom) 13858 ._moveEnd(true); 13859 } 13860 } 13861 13862 this._moveStart(true, options.noMoveStart); 13863 13864 frame.call(this); 13865 return this; 13866 }, 13867 13868 // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this 13869 // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto), 13870 // but takes a bounds parameter like [`fitBounds`](#map-fitbounds). 13871 flyToBounds: function (bounds, options) { 13872 var target = this._getBoundsCenterZoom(bounds, options); 13873 return this.flyTo(target.center, target.zoom, options); 13874 }, 13875 13876 // @method setMaxBounds(bounds: Bounds): this 13877 // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option). 13878 setMaxBounds: function (bounds) { 13879 bounds = toLatLngBounds(bounds); 13880 13881 if (!bounds.isValid()) { 13882 this.options.maxBounds = null; 13883 return this.off('moveend', this._panInsideMaxBounds); 13884 } else if (this.options.maxBounds) { 13885 this.off('moveend', this._panInsideMaxBounds); 13886 } 13887 13888 this.options.maxBounds = bounds; 13889 13890 if (this._loaded) { 13891 this._panInsideMaxBounds(); 13892 } 13893 13894 return this.on('moveend', this._panInsideMaxBounds); 13895 }, 13896 13897 // @method setMinZoom(zoom: Number): this 13898 // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option). 13899 setMinZoom: function (zoom) { 13900 var oldZoom = this.options.minZoom; 13901 this.options.minZoom = zoom; 13902 13903 if (this._loaded && oldZoom !== zoom) { 13904 this.fire('zoomlevelschange'); 13905 13906 if (this.getZoom() < this.options.minZoom) { 13907 return this.setZoom(zoom); 13908 } 13909 } 13910 13911 return this; 13912 }, 13913 13914 // @method setMaxZoom(zoom: Number): this 13915 // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option). 13916 setMaxZoom: function (zoom) { 13917 var oldZoom = this.options.maxZoom; 13918 this.options.maxZoom = zoom; 13919 13920 if (this._loaded && oldZoom !== zoom) { 13921 this.fire('zoomlevelschange'); 13922 13923 if (this.getZoom() > this.options.maxZoom) { 13924 return this.setZoom(zoom); 13925 } 13926 } 13927 13928 return this; 13929 }, 13930 13931 // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this 13932 // Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any. 13933 panInsideBounds: function (bounds, options) { 13934 this._enforcingBounds = true; 13935 var center = this.getCenter(), 13936 newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds)); 13937 13938 if (!center.equals(newCenter)) { 13939 this.panTo(newCenter, options); 13940 } 13941 13942 this._enforcingBounds = false; 13943 return this; 13944 }, 13945 13946 // @method panInside(latlng: LatLng, options?: options): this 13947 // Pans the map the minimum amount to make the `latlng` visible. Use 13948 // `padding`, `paddingTopLeft` and `paddingTopRight` options to fit 13949 // the display to more restricted bounds, like [`fitBounds`](#map-fitbounds). 13950 // If `latlng` is already within the (optionally padded) display bounds, 13951 // the map will not be panned. 13952 panInside: function (latlng, options) { 13953 options = options || {}; 13954 13955 var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]), 13956 paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]), 13957 center = this.getCenter(), 13958 pixelCenter = this.project(center), 13959 pixelPoint = this.project(latlng), 13960 pixelBounds = this.getPixelBounds(), 13961 halfPixelBounds = pixelBounds.getSize().divideBy(2), 13962 paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]); 13963 13964 if (!paddedBounds.contains(pixelPoint)) { 13965 this._enforcingBounds = true; 13966 var diff = pixelCenter.subtract(pixelPoint), 13967 newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y); 13968 13969 if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) { 13970 newCenter.x = pixelCenter.x - diff.x; 13971 if (diff.x > 0) { 13972 newCenter.x += halfPixelBounds.x - paddingTL.x; 13973 } else { 13974 newCenter.x -= halfPixelBounds.x - paddingBR.x; 13975 } 13976 } 13977 if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) { 13978 newCenter.y = pixelCenter.y - diff.y; 13979 if (diff.y > 0) { 13980 newCenter.y += halfPixelBounds.y - paddingTL.y; 13981 } else { 13982 newCenter.y -= halfPixelBounds.y - paddingBR.y; 13983 } 13984 } 13985 this.panTo(this.unproject(newCenter), options); 13986 this._enforcingBounds = false; 13987 } 13988 return this; 13989 }, 13990 13991 // @method invalidateSize(options: Zoom/pan options): this 13992 // Checks if the map container size changed and updates the map if so â 13993 // call it after you've changed the map size dynamically, also animating 13994 // pan by default. If `options.pan` is `false`, panning will not occur. 13995 // If `options.debounceMoveend` is `true`, it will delay `moveend` event so 13996 // that it doesn't happen often even if the method is called many 13997 // times in a row. 13998 13999 // @alternative 14000 // @method invalidateSize(animate: Boolean): this 14001 // Checks if the map container size changed and updates the map if so â 14002 // call it after you've changed the map size dynamically, also animating 14003 // pan by default. 14004 invalidateSize: function (options) { 14005 if (!this._loaded) { return this; } 14006 14007 options = extend({ 14008 animate: false, 14009 pan: true 14010 }, options === true ? {animate: true} : options); 14011 14012 var oldSize = this.getSize(); 14013 this._sizeChanged = true; 14014 this._lastCenter = null; 14015 14016 var newSize = this.getSize(), 14017 oldCenter = oldSize.divideBy(2).round(), 14018 newCenter = newSize.divideBy(2).round(), 14019 offset = oldCenter.subtract(newCenter); 14020 14021 if (!offset.x && !offset.y) { return this; } 14022 14023 if (options.animate && options.pan) { 14024 this.panBy(offset); 14025 14026 } else { 14027 if (options.pan) { 14028 this._rawPanBy(offset); 14029 } 14030 14031 this.fire('move'); 14032 14033 if (options.debounceMoveend) { 14034 clearTimeout(this._sizeTimer); 14035 this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200); 14036 } else { 14037 this.fire('moveend'); 14038 } 14039 } 14040 14041 // @section Map state change events 14042 // @event resize: ResizeEvent 14043 // Fired when the map is resized. 14044 return this.fire('resize', { 14045 oldSize: oldSize, 14046 newSize: newSize 14047 }); 14048 }, 14049 14050 // @section Methods for modifying map state 14051 // @method stop(): this 14052 // Stops the currently running `panTo` or `flyTo` animation, if any. 14053 stop: function () { 14054 this.setZoom(this._limitZoom(this._zoom)); 14055 if (!this.options.zoomSnap) { 14056 this.fire('viewreset'); 14057 } 14058 return this._stop(); 14059 }, 14060 14061 // @section Geolocation methods 14062 // @method locate(options?: Locate options): this 14063 // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound) 14064 // event with location data on success or a [`locationerror`](#map-locationerror) event on failure, 14065 // and optionally sets the map view to the user's location with respect to 14066 // detection accuracy (or to the world view if geolocation failed). 14067 // Note that, if your page doesn't use HTTPS, this method will fail in 14068 // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins)) 14069 // See `Locate options` for more details. 14070 locate: function (options) { 14071 14072 options = this._locateOptions = extend({ 14073 timeout: 10000, 14074 watch: false 14075 // setView: false 14076 // maxZoom: <Number> 14077 // maximumAge: 0 14078 // enableHighAccuracy: false 14079 }, options); 14080 14081 if (!('geolocation' in navigator)) { 14082 this._handleGeolocationError({ 14083 code: 0, 14084 message: 'Geolocation not supported.' 14085 }); 14086 return this; 14087 } 14088 14089 var onResponse = bind(this._handleGeolocationResponse, this), 14090 onError = bind(this._handleGeolocationError, this); 14091 14092 if (options.watch) { 14093 this._locationWatchId = 14094 navigator.geolocation.watchPosition(onResponse, onError, options); 14095 } else { 14096 navigator.geolocation.getCurrentPosition(onResponse, onError, options); 14097 } 14098 return this; 14099 }, 14100 14101 // @method stopLocate(): this 14102 // Stops watching location previously initiated by `map.locate({watch: true})` 14103 // and aborts resetting the map view if map.locate was called with 14104 // `{setView: true}`. 14105 stopLocate: function () { 14106 if (navigator.geolocation && navigator.geolocation.clearWatch) { 14107 navigator.geolocation.clearWatch(this._locationWatchId); 14108 } 14109 if (this._locateOptions) { 14110 this._locateOptions.setView = false; 14111 } 14112 return this; 14113 }, 14114 14115 _handleGeolocationError: function (error) { 14116 var c = error.code, 14117 message = error.message || 14118 (c === 1 ? 'permission denied' : 14119 (c === 2 ? 'position unavailable' : 'timeout')); 14120 14121 if (this._locateOptions.setView && !this._loaded) { 14122 this.fitWorld(); 14123 } 14124 14125 // @section Location events 14126 // @event locationerror: ErrorEvent 14127 // Fired when geolocation (using the [`locate`](#map-locate) method) failed. 14128 this.fire('locationerror', { 14129 code: c, 14130 message: 'Geolocation error: ' + message + '.' 14131 }); 14132 }, 14133 14134 _handleGeolocationResponse: function (pos) { 14135 var lat = pos.coords.latitude, 14136 lng = pos.coords.longitude, 14137 latlng = new LatLng(lat, lng), 14138 bounds = latlng.toBounds(pos.coords.accuracy * 2), 14139 options = this._locateOptions; 14140 14141 if (options.setView) { 14142 var zoom = this.getBoundsZoom(bounds); 14143 this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom); 14144 } 14145 14146 var data = { 14147 latlng: latlng, 14148 bounds: bounds, 14149 timestamp: pos.timestamp 14150 }; 14151 14152 for (var i in pos.coords) { 14153 if (typeof pos.coords[i] === 'number') { 14154 data[i] = pos.coords[i]; 14155 } 14156 } 14157 14158 // @event locationfound: LocationEvent 14159 // Fired when geolocation (using the [`locate`](#map-locate) method) 14160 // went successfully. 14161 this.fire('locationfound', data); 14162 }, 14163 14164 // TODO Appropriate docs section? 14165 // @section Other Methods 14166 // @method addHandler(name: String, HandlerClass: Function): this 14167 // Adds a new `Handler` to the map, given its name and constructor function. 14168 addHandler: function (name, HandlerClass) { 14169 if (!HandlerClass) { return this; } 14170 14171 var handler = this[name] = new HandlerClass(this); 14172 14173 this._handlers.push(handler); 14174 14175 if (this.options[name]) { 14176 handler.enable(); 14177 } 14178 14179 return this; 14180 }, 14181 14182 // @method remove(): this 14183 // Destroys the map and clears all related event listeners. 14184 remove: function () { 14185 14186 this._initEvents(true); 14187 14188 if (this._containerId !== this._container._leaflet_id) { 14189 throw new Error('Map container is being reused by another instance'); 14190 } 14191 14192 try { 14193 // throws error in IE6-8 14194 delete this._container._leaflet_id; 14195 delete this._containerId; 14196 } catch (e) { 14197 /*eslint-disable */ 14198 this._container._leaflet_id = undefined; 14199 /* eslint-enable */ 14200 this._containerId = undefined; 14201 } 14202 14203 if (this._locationWatchId !== undefined) { 14204 this.stopLocate(); 14205 } 14206 14207 this._stop(); 14208 14209 remove(this._mapPane); 14210 14211 if (this._clearControlPos) { 14212 this._clearControlPos(); 14213 } 14214 if (this._resizeRequest) { 14215 cancelAnimFrame(this._resizeRequest); 14216 this._resizeRequest = null; 14217 } 14218 14219 this._clearHandlers(); 14220 14221 if (this._loaded) { 14222 // @section Map state change events 14223 // @event unload: Event 14224 // Fired when the map is destroyed with [remove](#map-remove) method. 14225 this.fire('unload'); 14226 } 14227 14228 var i; 14229 for (i in this._layers) { 14230 this._layers[i].remove(); 14231 } 14232 for (i in this._panes) { 14233 remove(this._panes[i]); 14234 } 14235 14236 this._layers = []; 14237 this._panes = []; 14238 delete this._mapPane; 14239 delete this._renderer; 14240 14241 return this; 14242 }, 14243 14244 // @section Other Methods 14245 // @method createPane(name: String, container?: HTMLElement): HTMLElement 14246 // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already, 14247 // then returns it. The pane is created as a child of `container`, or 14248 // as a child of the main map pane if not set. 14249 createPane: function (name, container) { 14250 var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''), 14251 pane = create$1('div', className, container || this._mapPane); 14252 14253 if (name) { 14254 this._panes[name] = pane; 14255 } 14256 return pane; 14257 }, 14258 14259 // @section Methods for Getting Map State 14260 14261 // @method getCenter(): LatLng 14262 // Returns the geographical center of the map view 14263 getCenter: function () { 14264 this._checkIfLoaded(); 14265 14266 if (this._lastCenter && !this._moved()) { 14267 return this._lastCenter; 14268 } 14269 return this.layerPointToLatLng(this._getCenterLayerPoint()); 14270 }, 14271 14272 // @method getZoom(): Number 14273 // Returns the current zoom level of the map view 14274 getZoom: function () { 14275 return this._zoom; 14276 }, 14277 14278 // @method getBounds(): LatLngBounds 14279 // Returns the geographical bounds visible in the current map view 14280 getBounds: function () { 14281 var bounds = this.getPixelBounds(), 14282 sw = this.unproject(bounds.getBottomLeft()), 14283 ne = this.unproject(bounds.getTopRight()); 14284 14285 return new LatLngBounds(sw, ne); 14286 }, 14287 14288 // @method getMinZoom(): Number 14289 // Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default. 14290 getMinZoom: function () { 14291 return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom; 14292 }, 14293 14294 // @method getMaxZoom(): Number 14295 // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers). 14296 getMaxZoom: function () { 14297 return this.options.maxZoom === undefined ? 14298 (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) : 14299 this.options.maxZoom; 14300 }, 14301 14302 // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number 14303 // Returns the maximum zoom level on which the given bounds fit to the map 14304 // view in its entirety. If `inside` (optional) is set to `true`, the method 14305 // instead returns the minimum zoom level on which the map view fits into 14306 // the given bounds in its entirety. 14307 getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number 14308 bounds = toLatLngBounds(bounds); 14309 padding = toPoint(padding || [0, 0]); 14310 14311 var zoom = this.getZoom() || 0, 14312 min = this.getMinZoom(), 14313 max = this.getMaxZoom(), 14314 nw = bounds.getNorthWest(), 14315 se = bounds.getSouthEast(), 14316 size = this.getSize().subtract(padding), 14317 boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(), 14318 snap = any3d ? this.options.zoomSnap : 1, 14319 scalex = size.x / boundsSize.x, 14320 scaley = size.y / boundsSize.y, 14321 scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley); 14322 14323 zoom = this.getScaleZoom(scale, zoom); 14324 14325 if (snap) { 14326 zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level 14327 zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap; 14328 } 14329 14330 return Math.max(min, Math.min(max, zoom)); 14331 }, 14332 14333 // @method getSize(): Point 14334 // Returns the current size of the map container (in pixels). 14335 getSize: function () { 14336 if (!this._size || this._sizeChanged) { 14337 this._size = new Point( 14338 this._container.clientWidth || 0, 14339 this._container.clientHeight || 0); 14340 14341 this._sizeChanged = false; 14342 } 14343 return this._size.clone(); 14344 }, 14345 14346 // @method getPixelBounds(): Bounds 14347 // Returns the bounds of the current map view in projected pixel 14348 // coordinates (sometimes useful in layer and overlay implementations). 14349 getPixelBounds: function (center, zoom) { 14350 var topLeftPoint = this._getTopLeftPoint(center, zoom); 14351 return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize())); 14352 }, 14353 14354 // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to 14355 // the map pane? "left point of the map layer" can be confusing, specially 14356 // since there can be negative offsets. 14357 // @method getPixelOrigin(): Point 14358 // Returns the projected pixel coordinates of the top left point of 14359 // the map layer (useful in custom layer and overlay implementations). 14360 getPixelOrigin: function () { 14361 this._checkIfLoaded(); 14362 return this._pixelOrigin; 14363 }, 14364 14365 // @method getPixelWorldBounds(zoom?: Number): Bounds 14366 // Returns the world's bounds in pixel coordinates for zoom level `zoom`. 14367 // If `zoom` is omitted, the map's current zoom level is used. 14368 getPixelWorldBounds: function (zoom) { 14369 return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom); 14370 }, 14371 14372 // @section Other Methods 14373 14374 // @method getPane(pane: String|HTMLElement): HTMLElement 14375 // Returns a [map pane](#map-pane), given its name or its HTML element (its identity). 14376 getPane: function (pane) { 14377 return typeof pane === 'string' ? this._panes[pane] : pane; 14378 }, 14379 14380 // @method getPanes(): Object 14381 // Returns a plain object containing the names of all [panes](#map-pane) as keys and 14382 // the panes as values. 14383 getPanes: function () { 14384 return this._panes; 14385 }, 14386 14387 // @method getContainer: HTMLElement 14388 // Returns the HTML element that contains the map. 14389 getContainer: function () { 14390 return this._container; 14391 }, 14392 14393 14394 // @section Conversion Methods 14395 14396 // @method getZoomScale(toZoom: Number, fromZoom: Number): Number 14397 // Returns the scale factor to be applied to a map transition from zoom level 14398 // `fromZoom` to `toZoom`. Used internally to help with zoom animations. 14399 getZoomScale: function (toZoom, fromZoom) { 14400 // TODO replace with universal implementation after refactoring projections 14401 var crs = this.options.crs; 14402 fromZoom = fromZoom === undefined ? this._zoom : fromZoom; 14403 return crs.scale(toZoom) / crs.scale(fromZoom); 14404 }, 14405 14406 // @method getScaleZoom(scale: Number, fromZoom: Number): Number 14407 // Returns the zoom level that the map would end up at, if it is at `fromZoom` 14408 // level and everything is scaled by a factor of `scale`. Inverse of 14409 // [`getZoomScale`](#map-getZoomScale). 14410 getScaleZoom: function (scale, fromZoom) { 14411 var crs = this.options.crs; 14412 fromZoom = fromZoom === undefined ? this._zoom : fromZoom; 14413 var zoom = crs.zoom(scale * crs.scale(fromZoom)); 14414 return isNaN(zoom) ? Infinity : zoom; 14415 }, 14416 14417 // @method project(latlng: LatLng, zoom: Number): Point 14418 // Projects a geographical coordinate `LatLng` according to the projection 14419 // of the map's CRS, then scales it according to `zoom` and the CRS's 14420 // `Transformation`. The result is pixel coordinate relative to 14421 // the CRS origin. 14422 project: function (latlng, zoom) { 14423 zoom = zoom === undefined ? this._zoom : zoom; 14424 return this.options.crs.latLngToPoint(toLatLng(latlng), zoom); 14425 }, 14426 14427 // @method unproject(point: Point, zoom: Number): LatLng 14428 // Inverse of [`project`](#map-project). 14429 unproject: function (point, zoom) { 14430 zoom = zoom === undefined ? this._zoom : zoom; 14431 return this.options.crs.pointToLatLng(toPoint(point), zoom); 14432 }, 14433 14434 // @method layerPointToLatLng(point: Point): LatLng 14435 // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin), 14436 // returns the corresponding geographical coordinate (for the current zoom level). 14437 layerPointToLatLng: function (point) { 14438 var projectedPoint = toPoint(point).add(this.getPixelOrigin()); 14439 return this.unproject(projectedPoint); 14440 }, 14441 14442 // @method latLngToLayerPoint(latlng: LatLng): Point 14443 // Given a geographical coordinate, returns the corresponding pixel coordinate 14444 // relative to the [origin pixel](#map-getpixelorigin). 14445 latLngToLayerPoint: function (latlng) { 14446 var projectedPoint = this.project(toLatLng(latlng))._round(); 14447 return projectedPoint._subtract(this.getPixelOrigin()); 14448 }, 14449 14450 // @method wrapLatLng(latlng: LatLng): LatLng 14451 // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the 14452 // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the 14453 // CRS's bounds. 14454 // By default this means longitude is wrapped around the dateline so its 14455 // value is between -180 and +180 degrees. 14456 wrapLatLng: function (latlng) { 14457 return this.options.crs.wrapLatLng(toLatLng(latlng)); 14458 }, 14459 14460 // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds 14461 // Returns a `LatLngBounds` with the same size as the given one, ensuring that 14462 // its center is within the CRS's bounds. 14463 // By default this means the center longitude is wrapped around the dateline so its 14464 // value is between -180 and +180 degrees, and the majority of the bounds 14465 // overlaps the CRS's bounds. 14466 wrapLatLngBounds: function (latlng) { 14467 return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng)); 14468 }, 14469 14470 // @method distance(latlng1: LatLng, latlng2: LatLng): Number 14471 // Returns the distance between two geographical coordinates according to 14472 // the map's CRS. By default this measures distance in meters. 14473 distance: function (latlng1, latlng2) { 14474 return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2)); 14475 }, 14476 14477 // @method containerPointToLayerPoint(point: Point): Point 14478 // Given a pixel coordinate relative to the map container, returns the corresponding 14479 // pixel coordinate relative to the [origin pixel](#map-getpixelorigin). 14480 containerPointToLayerPoint: function (point) { // (Point) 14481 return toPoint(point).subtract(this._getMapPanePos()); 14482 }, 14483 14484 // @method layerPointToContainerPoint(point: Point): Point 14485 // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin), 14486 // returns the corresponding pixel coordinate relative to the map container. 14487 layerPointToContainerPoint: function (point) { // (Point) 14488 return toPoint(point).add(this._getMapPanePos()); 14489 }, 14490 14491 // @method containerPointToLatLng(point: Point): LatLng 14492 // Given a pixel coordinate relative to the map container, returns 14493 // the corresponding geographical coordinate (for the current zoom level). 14494 containerPointToLatLng: function (point) { 14495 var layerPoint = this.containerPointToLayerPoint(toPoint(point)); 14496 return this.layerPointToLatLng(layerPoint); 14497 }, 14498 14499 // @method latLngToContainerPoint(latlng: LatLng): Point 14500 // Given a geographical coordinate, returns the corresponding pixel coordinate 14501 // relative to the map container. 14502 latLngToContainerPoint: function (latlng) { 14503 return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng))); 14504 }, 14505 14506 // @method mouseEventToContainerPoint(ev: MouseEvent): Point 14507 // Given a MouseEvent object, returns the pixel coordinate relative to the 14508 // map container where the event took place. 14509 mouseEventToContainerPoint: function (e) { 14510 return getMousePosition(e, this._container); 14511 }, 14512 14513 // @method mouseEventToLayerPoint(ev: MouseEvent): Point 14514 // Given a MouseEvent object, returns the pixel coordinate relative to 14515 // the [origin pixel](#map-getpixelorigin) where the event took place. 14516 mouseEventToLayerPoint: function (e) { 14517 return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e)); 14518 }, 14519 14520 // @method mouseEventToLatLng(ev: MouseEvent): LatLng 14521 // Given a MouseEvent object, returns geographical coordinate where the 14522 // event took place. 14523 mouseEventToLatLng: function (e) { // (MouseEvent) 14524 return this.layerPointToLatLng(this.mouseEventToLayerPoint(e)); 14525 }, 14526 14527 14528 // map initialization methods 14529 14530 _initContainer: function (id) { 14531 var container = this._container = get(id); 14532 14533 if (!container) { 14534 throw new Error('Map container not found.'); 14535 } else if (container._leaflet_id) { 14536 throw new Error('Map container is already initialized.'); 14537 } 14538 14539 on(container, 'scroll', this._onScroll, this); 14540 this._containerId = stamp(container); 14541 }, 14542 14543 _initLayout: function () { 14544 var container = this._container; 14545 14546 this._fadeAnimated = this.options.fadeAnimation && any3d; 14547 14548 addClass(container, 'leaflet-container' + 14549 (touch ? ' leaflet-touch' : '') + 14550 (retina ? ' leaflet-retina' : '') + 14551 (ielt9 ? ' leaflet-oldie' : '') + 14552 (safari ? ' leaflet-safari' : '') + 14553 (this._fadeAnimated ? ' leaflet-fade-anim' : '')); 14554 14555 var position = getStyle(container, 'position'); 14556 14557 if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') { 14558 container.style.position = 'relative'; 14559 } 14560 14561 this._initPanes(); 14562 14563 if (this._initControlPos) { 14564 this._initControlPos(); 14565 } 14566 }, 14567 14568 _initPanes: function () { 14569 var panes = this._panes = {}; 14570 this._paneRenderers = {}; 14571 14572 // @section 14573 // 14574 // Panes are DOM elements used to control the ordering of layers on the map. You 14575 // can access panes with [`map.getPane`](#map-getpane) or 14576 // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the 14577 // [`map.createPane`](#map-createpane) method. 14578 // 14579 // Every map has the following default panes that differ only in zIndex. 14580 // 14581 // @pane mapPane: HTMLElement = 'auto' 14582 // Pane that contains all other map panes 14583 14584 this._mapPane = this.createPane('mapPane', this._container); 14585 setPosition(this._mapPane, new Point(0, 0)); 14586 14587 // @pane tilePane: HTMLElement = 200 14588 // Pane for `GridLayer`s and `TileLayer`s 14589 this.createPane('tilePane'); 14590 // @pane overlayPane: HTMLElement = 400 14591 // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s 14592 this.createPane('shadowPane'); 14593 // @pane shadowPane: HTMLElement = 500 14594 // Pane for overlay shadows (e.g. `Marker` shadows) 14595 this.createPane('overlayPane'); 14596 // @pane markerPane: HTMLElement = 600 14597 // Pane for `Icon`s of `Marker`s 14598 this.createPane('markerPane'); 14599 // @pane tooltipPane: HTMLElement = 650 14600 // Pane for `Tooltip`s. 14601 this.createPane('tooltipPane'); 14602 // @pane popupPane: HTMLElement = 700 14603 // Pane for `Popup`s. 14604 this.createPane('popupPane'); 14605 14606 if (!this.options.markerZoomAnimation) { 14607 addClass(panes.markerPane, 'leaflet-zoom-hide'); 14608 addClass(panes.shadowPane, 'leaflet-zoom-hide'); 14609 } 14610 }, 14611 14612 14613 // private methods that modify map state 14614 14615 // @section Map state change events 14616 _resetView: function (center, zoom) { 14617 setPosition(this._mapPane, new Point(0, 0)); 14618 14619 var loading = !this._loaded; 14620 this._loaded = true; 14621 zoom = this._limitZoom(zoom); 14622 14623 this.fire('viewprereset'); 14624 14625 var zoomChanged = this._zoom !== zoom; 14626 this 14627 ._moveStart(zoomChanged, false) 14628 ._move(center, zoom) 14629 ._moveEnd(zoomChanged); 14630 14631 // @event viewreset: Event 14632 // Fired when the map needs to redraw its content (this usually happens 14633 // on map zoom or load). Very useful for creating custom overlays. 14634 this.fire('viewreset'); 14635 14636 // @event load: Event 14637 // Fired when the map is initialized (when its center and zoom are set 14638 // for the first time). 14639 if (loading) { 14640 this.fire('load'); 14641 } 14642 }, 14643 14644 _moveStart: function (zoomChanged, noMoveStart) { 14645 // @event zoomstart: Event 14646 // Fired when the map zoom is about to change (e.g. before zoom animation). 14647 // @event movestart: Event 14648 // Fired when the view of the map starts changing (e.g. user starts dragging the map). 14649 if (zoomChanged) { 14650 this.fire('zoomstart'); 14651 } 14652 if (!noMoveStart) { 14653 this.fire('movestart'); 14654 } 14655 return this; 14656 }, 14657 14658 _move: function (center, zoom, data) { 14659 if (zoom === undefined) { 14660 zoom = this._zoom; 14661 } 14662 var zoomChanged = this._zoom !== zoom; 14663 14664 this._zoom = zoom; 14665 this._lastCenter = center; 14666 this._pixelOrigin = this._getNewPixelOrigin(center); 14667 14668 // @event zoom: Event 14669 // Fired repeatedly during any change in zoom level, including zoom 14670 // and fly animations. 14671 if (zoomChanged || (data && data.pinch)) { // Always fire 'zoom' if pinching because #3530 14672 this.fire('zoom', data); 14673 } 14674 14675 // @event move: Event 14676 // Fired repeatedly during any movement of the map, including pan and 14677 // fly animations. 14678 return this.fire('move', data); 14679 }, 14680 14681 _moveEnd: function (zoomChanged) { 14682 // @event zoomend: Event 14683 // Fired when the map has changed, after any animations. 14684 if (zoomChanged) { 14685 this.fire('zoomend'); 14686 } 14687 14688 // @event moveend: Event 14689 // Fired when the center of the map stops changing (e.g. user stopped 14690 // dragging the map). 14691 return this.fire('moveend'); 14692 }, 14693 14694 _stop: function () { 14695 cancelAnimFrame(this._flyToFrame); 14696 if (this._panAnim) { 14697 this._panAnim.stop(); 14698 } 14699 return this; 14700 }, 14701 14702 _rawPanBy: function (offset) { 14703 setPosition(this._mapPane, this._getMapPanePos().subtract(offset)); 14704 }, 14705 14706 _getZoomSpan: function () { 14707 return this.getMaxZoom() - this.getMinZoom(); 14708 }, 14709 14710 _panInsideMaxBounds: function () { 14711 if (!this._enforcingBounds) { 14712 this.panInsideBounds(this.options.maxBounds); 14713 } 14714 }, 14715 14716 _checkIfLoaded: function () { 14717 if (!this._loaded) { 14718 throw new Error('Set map center and zoom first.'); 14719 } 14720 }, 14721 14722 // DOM event handling 14723 14724 // @section Interaction events 14725 _initEvents: function (remove$$1) { 14726 this._targets = {}; 14727 this._targets[stamp(this._container)] = this; 14728 14729 var onOff = remove$$1 ? off : on; 14730 14731 // @event click: MouseEvent 14732 // Fired when the user clicks (or taps) the map. 14733 // @event dblclick: MouseEvent 14734 // Fired when the user double-clicks (or double-taps) the map. 14735 // @event mousedown: MouseEvent 14736 // Fired when the user pushes the mouse button on the map. 14737 // @event mouseup: MouseEvent 14738 // Fired when the user releases the mouse button on the map. 14739 // @event mouseover: MouseEvent 14740 // Fired when the mouse enters the map. 14741 // @event mouseout: MouseEvent 14742 // Fired when the mouse leaves the map. 14743 // @event mousemove: MouseEvent 14744 // Fired while the mouse moves over the map. 14745 // @event contextmenu: MouseEvent 14746 // Fired when the user pushes the right mouse button on the map, prevents 14747 // default browser context menu from showing if there are listeners on 14748 // this event. Also fired on mobile when the user holds a single touch 14749 // for a second (also called long press). 14750 // @event keypress: KeyboardEvent 14751 // Fired when the user presses a key from the keyboard that produces a character value while the map is focused. 14752 // @event keydown: KeyboardEvent 14753 // Fired when the user presses a key from the keyboard while the map is focused. Unlike the `keypress` event, 14754 // the `keydown` event is fired for keys that produce a character value and for keys 14755 // that do not produce a character value. 14756 // @event keyup: KeyboardEvent 14757 // Fired when the user releases a key from the keyboard while the map is focused. 14758 onOff(this._container, 'click dblclick mousedown mouseup ' + 14759 'mouseover mouseout mousemove contextmenu keypress keydown keyup', this._handleDOMEvent, this); 14760 14761 if (this.options.trackResize) { 14762 onOff(window, 'resize', this._onResize, this); 14763 } 14764 14765 if (any3d && this.options.transform3DLimit) { 14766 (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd); 14767 } 14768 }, 14769 14770 _onResize: function () { 14771 cancelAnimFrame(this._resizeRequest); 14772 this._resizeRequest = requestAnimFrame( 14773 function () { this.invalidateSize({debounceMoveend: true}); }, this); 14774 }, 14775 14776 _onScroll: function () { 14777 this._container.scrollTop = 0; 14778 this._container.scrollLeft = 0; 14779 }, 14780 14781 _onMoveEnd: function () { 14782 var pos = this._getMapPanePos(); 14783 if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) { 14784 // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have 14785 // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/ 14786 this._resetView(this.getCenter(), this.getZoom()); 14787 } 14788 }, 14789 14790 _findEventTargets: function (e, type) { 14791 var targets = [], 14792 target, 14793 isHover = type === 'mouseout' || type === 'mouseover', 14794 src = e.target || e.srcElement, 14795 dragging = false; 14796 14797 while (src) { 14798 target = this._targets[stamp(src)]; 14799 if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) { 14800 // Prevent firing click after you just dragged an object. 14801 dragging = true; 14802 break; 14803 } 14804 if (target && target.listens(type, true)) { 14805 if (isHover && !isExternalTarget(src, e)) { break; } 14806 targets.push(target); 14807 if (isHover) { break; } 14808 } 14809 if (src === this._container) { break; } 14810 src = src.parentNode; 14811 } 14812 if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) { 14813 targets = [this]; 14814 } 14815 return targets; 14816 }, 14817 14818 _handleDOMEvent: function (e) { 14819 if (!this._loaded || skipped(e)) { return; } 14820 14821 var type = e.type; 14822 14823 if (type === 'mousedown' || type === 'keypress' || type === 'keyup' || type === 'keydown') { 14824 // prevents outline when clicking on keyboard-focusable element 14825 preventOutline(e.target || e.srcElement); 14826 } 14827 14828 this._fireDOMEvent(e, type); 14829 }, 14830 14831 _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'], 14832 14833 _fireDOMEvent: function (e, type, targets) { 14834 14835 if (e.type === 'click') { 14836 // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups). 14837 // @event preclick: MouseEvent 14838 // Fired before mouse click on the map (sometimes useful when you 14839 // want something to happen on click before any existing click 14840 // handlers start running). 14841 var synth = extend({}, e); 14842 synth.type = 'preclick'; 14843 this._fireDOMEvent(synth, synth.type, targets); 14844 } 14845 14846 if (e._stopped) { return; } 14847 14848 // Find the layer the event is propagating from and its parents. 14849 targets = (targets || []).concat(this._findEventTargets(e, type)); 14850 14851 if (!targets.length) { return; } 14852 14853 var target = targets[0]; 14854 if (type === 'contextmenu' && target.listens(type, true)) { 14855 preventDefault(e); 14856 } 14857 14858 var data = { 14859 originalEvent: e 14860 }; 14861 14862 if (e.type !== 'keypress' && e.type !== 'keydown' && e.type !== 'keyup') { 14863 var isMarker = target.getLatLng && (!target._radius || target._radius <= 10); 14864 data.containerPoint = isMarker ? 14865 this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e); 14866 data.layerPoint = this.containerPointToLayerPoint(data.containerPoint); 14867 data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint); 14868 } 14869 14870 for (var i = 0; i < targets.length; i++) { 14871 targets[i].fire(type, data, true); 14872 if (data.originalEvent._stopped || 14873 (targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; } 14874 } 14875 }, 14876 14877 _draggableMoved: function (obj) { 14878 obj = obj.dragging && obj.dragging.enabled() ? obj : this; 14879 return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved()); 14880 }, 14881 14882 _clearHandlers: function () { 14883 for (var i = 0, len = this._handlers.length; i < len; i++) { 14884 this._handlers[i].disable(); 14885 } 14886 }, 14887 14888 // @section Other Methods 14889 14890 // @method whenReady(fn: Function, context?: Object): this 14891 // Runs the given function `fn` when the map gets initialized with 14892 // a view (center and zoom) and at least one layer, or immediately 14893 // if it's already initialized, optionally passing a function context. 14894 whenReady: function (callback, context) { 14895 if (this._loaded) { 14896 callback.call(context || this, {target: this}); 14897 } else { 14898 this.on('load', callback, context); 14899 } 14900 return this; 14901 }, 14902 14903 14904 // private methods for getting map state 14905 14906 _getMapPanePos: function () { 14907 return getPosition(this._mapPane) || new Point(0, 0); 14908 }, 14909 14910 _moved: function () { 14911 var pos = this._getMapPanePos(); 14912 return pos && !pos.equals([0, 0]); 14913 }, 14914 14915 _getTopLeftPoint: function (center, zoom) { 14916 var pixelOrigin = center && zoom !== undefined ? 14917 this._getNewPixelOrigin(center, zoom) : 14918 this.getPixelOrigin(); 14919 return pixelOrigin.subtract(this._getMapPanePos()); 14920 }, 14921 14922 _getNewPixelOrigin: function (center, zoom) { 14923 var viewHalf = this.getSize()._divideBy(2); 14924 return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round(); 14925 }, 14926 14927 _latLngToNewLayerPoint: function (latlng, zoom, center) { 14928 var topLeft = this._getNewPixelOrigin(center, zoom); 14929 return this.project(latlng, zoom)._subtract(topLeft); 14930 }, 14931 14932 _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) { 14933 var topLeft = this._getNewPixelOrigin(center, zoom); 14934 return toBounds([ 14935 this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft), 14936 this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft), 14937 this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft), 14938 this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft) 14939 ]); 14940 }, 14941 14942 // layer point of the current center 14943 _getCenterLayerPoint: function () { 14944 return this.containerPointToLayerPoint(this.getSize()._divideBy(2)); 14945 }, 14946 14947 // offset of the specified place to the current center in pixels 14948 _getCenterOffset: function (latlng) { 14949 return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint()); 14950 }, 14951 14952 // adjust center for view to get inside bounds 14953 _limitCenter: function (center, zoom, bounds) { 14954 14955 if (!bounds) { return center; } 14956 14957 var centerPoint = this.project(center, zoom), 14958 viewHalf = this.getSize().divideBy(2), 14959 viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)), 14960 offset = this._getBoundsOffset(viewBounds, bounds, zoom); 14961 14962 // If offset is less than a pixel, ignore. 14963 // This prevents unstable projections from getting into 14964 // an infinite loop of tiny offsets. 14965 if (offset.round().equals([0, 0])) { 14966 return center; 14967 } 14968 14969 return this.unproject(centerPoint.add(offset), zoom); 14970 }, 14971 14972 // adjust offset for view to get inside bounds 14973 _limitOffset: function (offset, bounds) { 14974 if (!bounds) { return offset; } 14975 14976 var viewBounds = this.getPixelBounds(), 14977 newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset)); 14978 14979 return offset.add(this._getBoundsOffset(newBounds, bounds)); 14980 }, 14981 14982 // returns offset needed for pxBounds to get inside maxBounds at a specified zoom 14983 _getBoundsOffset: function (pxBounds, maxBounds, zoom) { 14984 var projectedMaxBounds = toBounds( 14985 this.project(maxBounds.getNorthEast(), zoom), 14986 this.project(maxBounds.getSouthWest(), zoom) 14987 ), 14988 minOffset = projectedMaxBounds.min.subtract(pxBounds.min), 14989 maxOffset = projectedMaxBounds.max.subtract(pxBounds.max), 14990 14991 dx = this._rebound(minOffset.x, -maxOffset.x), 14992 dy = this._rebound(minOffset.y, -maxOffset.y); 14993 14994 return new Point(dx, dy); 14995 }, 14996 14997 _rebound: function (left, right) { 14998 return left + right > 0 ? 14999 Math.round(left - right) / 2 : 15000 Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right)); 15001 }, 15002 15003 _limitZoom: function (zoom) { 15004 var min = this.getMinZoom(), 15005 max = this.getMaxZoom(), 15006 snap = any3d ? this.options.zoomSnap : 1; 15007 if (snap) { 15008 zoom = Math.round(zoom / snap) * snap; 15009 } 15010 return Math.max(min, Math.min(max, zoom)); 15011 }, 15012 15013 _onPanTransitionStep: function () { 15014 this.fire('move'); 15015 }, 15016 15017 _onPanTransitionEnd: function () { 15018 removeClass(this._mapPane, 'leaflet-pan-anim'); 15019 this.fire('moveend'); 15020 }, 15021 15022 _tryAnimatedPan: function (center, options) { 15023 // difference between the new and current centers in pixels 15024 var offset = this._getCenterOffset(center)._trunc(); 15025 15026 // don't animate too far unless animate: true specified in options 15027 if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; } 15028 15029 this.panBy(offset, options); 15030 15031 return true; 15032 }, 15033 15034 _createAnimProxy: function () { 15035 15036 var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated'); 15037 this._panes.mapPane.appendChild(proxy); 15038 15039 this.on('zoomanim', function (e) { 15040 var prop = TRANSFORM, 15041 transform = this._proxy.style[prop]; 15042 15043 setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1)); 15044 15045 // workaround for case when transform is the same and so transitionend event is not fired 15046 if (transform === this._proxy.style[prop] && this._animatingZoom) { 15047 this._onZoomTransitionEnd(); 15048 } 15049 }, this); 15050 15051 this.on('load moveend', this._animMoveEnd, this); 15052 15053 this._on('unload', this._destroyAnimProxy, this); 15054 }, 15055 15056 _destroyAnimProxy: function () { 15057 remove(this._proxy); 15058 this.off('load moveend', this._animMoveEnd, this); 15059 delete this._proxy; 15060 }, 15061 15062 _animMoveEnd: function () { 15063 var c = this.getCenter(), 15064 z = this.getZoom(); 15065 setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1)); 15066 }, 15067 15068 _catchTransitionEnd: function (e) { 15069 if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) { 15070 this._onZoomTransitionEnd(); 15071 } 15072 }, 15073 15074 _nothingToAnimate: function () { 15075 return !this._container.getElementsByClassName('leaflet-zoom-animated').length; 15076 }, 15077 15078 _tryAnimatedZoom: function (center, zoom, options) { 15079 15080 if (this._animatingZoom) { return true; } 15081 15082 options = options || {}; 15083 15084 // don't animate if disabled, not supported or zoom difference is too large 15085 if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() || 15086 Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; } 15087 15088 // offset is the pixel coords of the zoom origin relative to the current center 15089 var scale = this.getZoomScale(zoom), 15090 offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale); 15091 15092 // don't animate if the zoom origin isn't within one screen from the current center, unless forced 15093 if (options.animate !== true && !this.getSize().contains(offset)) { return false; } 15094 15095 requestAnimFrame(function () { 15096 this 15097 ._moveStart(true, false) 15098 ._animateZoom(center, zoom, true); 15099 }, this); 15100 15101 return true; 15102 }, 15103 15104 _animateZoom: function (center, zoom, startAnim, noUpdate) { 15105 if (!this._mapPane) { return; } 15106 15107 if (startAnim) { 15108 this._animatingZoom = true; 15109 15110 // remember what center/zoom to set after animation 15111 this._animateToCenter = center; 15112 this._animateToZoom = zoom; 15113 15114 addClass(this._mapPane, 'leaflet-zoom-anim'); 15115 } 15116 15117 // @section Other Events 15118 // @event zoomanim: ZoomAnimEvent 15119 // Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom. 15120 this.fire('zoomanim', { 15121 center: center, 15122 zoom: zoom, 15123 noUpdate: noUpdate 15124 }); 15125 15126 // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693 15127 setTimeout(bind(this._onZoomTransitionEnd, this), 250); 15128 }, 15129 15130 _onZoomTransitionEnd: function () { 15131 if (!this._animatingZoom) { return; } 15132 15133 if (this._mapPane) { 15134 removeClass(this._mapPane, 'leaflet-zoom-anim'); 15135 } 15136 15137 this._animatingZoom = false; 15138 15139 this._move(this._animateToCenter, this._animateToZoom); 15140 15141 // This anim frame should prevent an obscure iOS webkit tile loading race condition. 15142 requestAnimFrame(function () { 15143 this._moveEnd(true); 15144 }, this); 15145 } 15146}); 15147 15148// @section 15149 15150// @factory L.map(id: String, options?: Map options) 15151// Instantiates a map object given the DOM ID of a `<div>` element 15152// and optionally an object literal with `Map options`. 15153// 15154// @alternative 15155// @factory L.map(el: HTMLElement, options?: Map options) 15156// Instantiates a map object given an instance of a `<div>` HTML element 15157// and optionally an object literal with `Map options`. 15158function createMap(id, options) { 15159 return new Map(id, options); 15160} 15161 15162/* 15163 * @class Control 15164 * @aka L.Control 15165 * @inherits Class 15166 * 15167 * L.Control is a base class for implementing map controls. Handles positioning. 15168 * All other controls extend from this class. 15169 */ 15170 15171var Control = Class.extend({ 15172 // @section 15173 // @aka Control options 15174 options: { 15175 // @option position: String = 'topright' 15176 // The position of the control (one of the map corners). Possible values are `'topleft'`, 15177 // `'topright'`, `'bottomleft'` or `'bottomright'` 15178 position: 'topright' 15179 }, 15180 15181 initialize: function (options) { 15182 setOptions(this, options); 15183 }, 15184 15185 /* @section 15186 * Classes extending L.Control will inherit the following methods: 15187 * 15188 * @method getPosition: string 15189 * Returns the position of the control. 15190 */ 15191 getPosition: function () { 15192 return this.options.position; 15193 }, 15194 15195 // @method setPosition(position: string): this 15196 // Sets the position of the control. 15197 setPosition: function (position) { 15198 var map = this._map; 15199 15200 if (map) { 15201 map.removeControl(this); 15202 } 15203 15204 this.options.position = position; 15205 15206 if (map) { 15207 map.addControl(this); 15208 } 15209 15210 return this; 15211 }, 15212 15213 // @method getContainer: HTMLElement 15214 // Returns the HTMLElement that contains the control. 15215 getContainer: function () { 15216 return this._container; 15217 }, 15218 15219 // @method addTo(map: Map): this 15220 // Adds the control to the given map. 15221 addTo: function (map) { 15222 this.remove(); 15223 this._map = map; 15224 15225 var container = this._container = this.onAdd(map), 15226 pos = this.getPosition(), 15227 corner = map._controlCorners[pos]; 15228 15229 addClass(container, 'leaflet-control'); 15230 15231 if (pos.indexOf('bottom') !== -1) { 15232 corner.insertBefore(container, corner.firstChild); 15233 } else { 15234 corner.appendChild(container); 15235 } 15236 15237 this._map.on('unload', this.remove, this); 15238 15239 return this; 15240 }, 15241 15242 // @method remove: this 15243 // Removes the control from the map it is currently active on. 15244 remove: function () { 15245 if (!this._map) { 15246 return this; 15247 } 15248 15249 remove(this._container); 15250 15251 if (this.onRemove) { 15252 this.onRemove(this._map); 15253 } 15254 15255 this._map.off('unload', this.remove, this); 15256 this._map = null; 15257 15258 return this; 15259 }, 15260 15261 _refocusOnMap: function (e) { 15262 // if map exists and event is not a keyboard event 15263 if (this._map && e && e.screenX > 0 && e.screenY > 0) { 15264 this._map.getContainer().focus(); 15265 } 15266 } 15267}); 15268 15269var control = function (options) { 15270 return new Control(options); 15271}; 15272 15273/* @section Extension methods 15274 * @uninheritable 15275 * 15276 * Every control should extend from `L.Control` and (re-)implement the following methods. 15277 * 15278 * @method onAdd(map: Map): HTMLElement 15279 * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo). 15280 * 15281 * @method onRemove(map: Map) 15282 * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove). 15283 */ 15284 15285/* @namespace Map 15286 * @section Methods for Layers and Controls 15287 */ 15288Map.include({ 15289 // @method addControl(control: Control): this 15290 // Adds the given control to the map 15291 addControl: function (control) { 15292 control.addTo(this); 15293 return this; 15294 }, 15295 15296 // @method removeControl(control: Control): this 15297 // Removes the given control from the map 15298 removeControl: function (control) { 15299 control.remove(); 15300 return this; 15301 }, 15302 15303 _initControlPos: function () { 15304 var corners = this._controlCorners = {}, 15305 l = 'leaflet-', 15306 container = this._controlContainer = 15307 create$1('div', l + 'control-container', this._container); 15308 15309 function createCorner(vSide, hSide) { 15310 var className = l + vSide + ' ' + l + hSide; 15311 15312 corners[vSide + hSide] = create$1('div', className, container); 15313 } 15314 15315 createCorner('top', 'left'); 15316 createCorner('top', 'right'); 15317 createCorner('bottom', 'left'); 15318 createCorner('bottom', 'right'); 15319 }, 15320 15321 _clearControlPos: function () { 15322 for (var i in this._controlCorners) { 15323 remove(this._controlCorners[i]); 15324 } 15325 remove(this._controlContainer); 15326 delete this._controlCorners; 15327 delete this._controlContainer; 15328 } 15329}); 15330 15331/* 15332 * @class Control.Layers 15333 * @aka L.Control.Layers 15334 * @inherits Control 15335 * 15336 * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`. 15337 * 15338 * @example 15339 * 15340 * ```js 15341 * var baseLayers = { 15342 * "Mapbox": mapbox, 15343 * "OpenStreetMap": osm 15344 * }; 15345 * 15346 * var overlays = { 15347 * "Marker": marker, 15348 * "Roads": roadsLayer 15349 * }; 15350 * 15351 * L.control.layers(baseLayers, overlays).addTo(map); 15352 * ``` 15353 * 15354 * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values: 15355 * 15356 * ```js 15357 * { 15358 * "<someName1>": layer1, 15359 * "<someName2>": layer2 15360 * } 15361 * ``` 15362 * 15363 * The layer names can contain HTML, which allows you to add additional styling to the items: 15364 * 15365 * ```js 15366 * {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer} 15367 * ``` 15368 */ 15369 15370var Layers = Control.extend({ 15371 // @section 15372 // @aka Control.Layers options 15373 options: { 15374 // @option collapsed: Boolean = true 15375 // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch. 15376 collapsed: true, 15377 position: 'topright', 15378 15379 // @option autoZIndex: Boolean = true 15380 // If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off. 15381 autoZIndex: true, 15382 15383 // @option hideSingleBase: Boolean = false 15384 // If `true`, the base layers in the control will be hidden when there is only one. 15385 hideSingleBase: false, 15386 15387 // @option sortLayers: Boolean = false 15388 // Whether to sort the layers. When `false`, layers will keep the order 15389 // in which they were added to the control. 15390 sortLayers: false, 15391 15392 // @option sortFunction: Function = * 15393 // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) 15394 // that will be used for sorting the layers, when `sortLayers` is `true`. 15395 // The function receives both the `L.Layer` instances and their names, as in 15396 // `sortFunction(layerA, layerB, nameA, nameB)`. 15397 // By default, it sorts layers alphabetically by their name. 15398 sortFunction: function (layerA, layerB, nameA, nameB) { 15399 return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0); 15400 } 15401 }, 15402 15403 initialize: function (baseLayers, overlays, options) { 15404 setOptions(this, options); 15405 15406 this._layerControlInputs = []; 15407 this._layers = []; 15408 this._lastZIndex = 0; 15409 this._handlingClick = false; 15410 15411 for (var i in baseLayers) { 15412 this._addLayer(baseLayers[i], i); 15413 } 15414 15415 for (i in overlays) { 15416 this._addLayer(overlays[i], i, true); 15417 } 15418 }, 15419 15420 onAdd: function (map) { 15421 this._initLayout(); 15422 this._update(); 15423 15424 this._map = map; 15425 map.on('zoomend', this._checkDisabledLayers, this); 15426 15427 for (var i = 0; i < this._layers.length; i++) { 15428 this._layers[i].layer.on('add remove', this._onLayerChange, this); 15429 } 15430 15431 return this._container; 15432 }, 15433 15434 addTo: function (map) { 15435 Control.prototype.addTo.call(this, map); 15436 // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height. 15437 return this._expandIfNotCollapsed(); 15438 }, 15439 15440 onRemove: function () { 15441 this._map.off('zoomend', this._checkDisabledLayers, this); 15442 15443 for (var i = 0; i < this._layers.length; i++) { 15444 this._layers[i].layer.off('add remove', this._onLayerChange, this); 15445 } 15446 }, 15447 15448 // @method addBaseLayer(layer: Layer, name: String): this 15449 // Adds a base layer (radio button entry) with the given name to the control. 15450 addBaseLayer: function (layer, name) { 15451 this._addLayer(layer, name); 15452 return (this._map) ? this._update() : this; 15453 }, 15454 15455 // @method addOverlay(layer: Layer, name: String): this 15456 // Adds an overlay (checkbox entry) with the given name to the control. 15457 addOverlay: function (layer, name) { 15458 this._addLayer(layer, name, true); 15459 return (this._map) ? this._update() : this; 15460 }, 15461 15462 // @method removeLayer(layer: Layer): this 15463 // Remove the given layer from the control. 15464 removeLayer: function (layer) { 15465 layer.off('add remove', this._onLayerChange, this); 15466 15467 var obj = this._getLayer(stamp(layer)); 15468 if (obj) { 15469 this._layers.splice(this._layers.indexOf(obj), 1); 15470 } 15471 return (this._map) ? this._update() : this; 15472 }, 15473 15474 // @method expand(): this 15475 // Expand the control container if collapsed. 15476 expand: function () { 15477 addClass(this._container, 'leaflet-control-layers-expanded'); 15478 this._section.style.height = null; 15479 var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50); 15480 if (acceptableHeight < this._section.clientHeight) { 15481 addClass(this._section, 'leaflet-control-layers-scrollbar'); 15482 this._section.style.height = acceptableHeight + 'px'; 15483 } else { 15484 removeClass(this._section, 'leaflet-control-layers-scrollbar'); 15485 } 15486 this._checkDisabledLayers(); 15487 return this; 15488 }, 15489 15490 // @method collapse(): this 15491 // Collapse the control container if expanded. 15492 collapse: function () { 15493 removeClass(this._container, 'leaflet-control-layers-expanded'); 15494 return this; 15495 }, 15496 15497 _initLayout: function () { 15498 var className = 'leaflet-control-layers', 15499 container = this._container = create$1('div', className), 15500 collapsed = this.options.collapsed; 15501 15502 // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released 15503 container.setAttribute('aria-haspopup', true); 15504 15505 disableClickPropagation(container); 15506 disableScrollPropagation(container); 15507 15508 var section = this._section = create$1('section', className + '-list'); 15509 15510 if (collapsed) { 15511 this._map.on('click', this.collapse, this); 15512 15513 if (!android) { 15514 on(container, { 15515 mouseenter: this.expand, 15516 mouseleave: this.collapse 15517 }, this); 15518 } 15519 } 15520 15521 var link = this._layersLink = create$1('a', className + '-toggle', container); 15522 link.href = '#'; 15523 link.title = 'Layers'; 15524 15525 if (touch) { 15526 on(link, 'click', stop); 15527 on(link, 'click', this.expand, this); 15528 } else { 15529 on(link, 'focus', this.expand, this); 15530 } 15531 15532 if (!collapsed) { 15533 this.expand(); 15534 } 15535 15536 this._baseLayersList = create$1('div', className + '-base', section); 15537 this._separator = create$1('div', className + '-separator', section); 15538 this._overlaysList = create$1('div', className + '-overlays', section); 15539 15540 container.appendChild(section); 15541 }, 15542 15543 _getLayer: function (id) { 15544 for (var i = 0; i < this._layers.length; i++) { 15545 15546 if (this._layers[i] && stamp(this._layers[i].layer) === id) { 15547 return this._layers[i]; 15548 } 15549 } 15550 }, 15551 15552 _addLayer: function (layer, name, overlay) { 15553 if (this._map) { 15554 layer.on('add remove', this._onLayerChange, this); 15555 } 15556 15557 this._layers.push({ 15558 layer: layer, 15559 name: name, 15560 overlay: overlay 15561 }); 15562 15563 if (this.options.sortLayers) { 15564 this._layers.sort(bind(function (a, b) { 15565 return this.options.sortFunction(a.layer, b.layer, a.name, b.name); 15566 }, this)); 15567 } 15568 15569 if (this.options.autoZIndex && layer.setZIndex) { 15570 this._lastZIndex++; 15571 layer.setZIndex(this._lastZIndex); 15572 } 15573 15574 this._expandIfNotCollapsed(); 15575 }, 15576 15577 _update: function () { 15578 if (!this._container) { return this; } 15579 15580 empty(this._baseLayersList); 15581 empty(this._overlaysList); 15582 15583 this._layerControlInputs = []; 15584 var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0; 15585 15586 for (i = 0; i < this._layers.length; i++) { 15587 obj = this._layers[i]; 15588 this._addItem(obj); 15589 overlaysPresent = overlaysPresent || obj.overlay; 15590 baseLayersPresent = baseLayersPresent || !obj.overlay; 15591 baseLayersCount += !obj.overlay ? 1 : 0; 15592 } 15593 15594 // Hide base layers section if there's only one layer. 15595 if (this.options.hideSingleBase) { 15596 baseLayersPresent = baseLayersPresent && baseLayersCount > 1; 15597 this._baseLayersList.style.display = baseLayersPresent ? '' : 'none'; 15598 } 15599 15600 this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none'; 15601 15602 return this; 15603 }, 15604 15605 _onLayerChange: function (e) { 15606 if (!this._handlingClick) { 15607 this._update(); 15608 } 15609 15610 var obj = this._getLayer(stamp(e.target)); 15611 15612 // @namespace Map 15613 // @section Layer events 15614 // @event baselayerchange: LayersControlEvent 15615 // Fired when the base layer is changed through the [layer control](#control-layers). 15616 // @event overlayadd: LayersControlEvent 15617 // Fired when an overlay is selected through the [layer control](#control-layers). 15618 // @event overlayremove: LayersControlEvent 15619 // Fired when an overlay is deselected through the [layer control](#control-layers). 15620 // @namespace Control.Layers 15621 var type = obj.overlay ? 15622 (e.type === 'add' ? 'overlayadd' : 'overlayremove') : 15623 (e.type === 'add' ? 'baselayerchange' : null); 15624 15625 if (type) { 15626 this._map.fire(type, obj); 15627 } 15628 }, 15629 15630 // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe) 15631 _createRadioElement: function (name, checked) { 15632 15633 var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + 15634 name + '"' + (checked ? ' checked="checked"' : '') + '/>'; 15635 15636 var radioFragment = document.createElement('div'); 15637 radioFragment.innerHTML = radioHtml; 15638 15639 return radioFragment.firstChild; 15640 }, 15641 15642 _addItem: function (obj) { 15643 var label = document.createElement('label'), 15644 checked = this._map.hasLayer(obj.layer), 15645 input; 15646 15647 if (obj.overlay) { 15648 input = document.createElement('input'); 15649 input.type = 'checkbox'; 15650 input.className = 'leaflet-control-layers-selector'; 15651 input.defaultChecked = checked; 15652 } else { 15653 input = this._createRadioElement('leaflet-base-layers_' + stamp(this), checked); 15654 } 15655 15656 this._layerControlInputs.push(input); 15657 input.layerId = stamp(obj.layer); 15658 15659 on(input, 'click', this._onInputClick, this); 15660 15661 var name = document.createElement('span'); 15662 name.innerHTML = ' ' + obj.name; 15663 15664 // Helps from preventing layer control flicker when checkboxes are disabled 15665 // https://github.com/Leaflet/Leaflet/issues/2771 15666 var holder = document.createElement('div'); 15667 15668 label.appendChild(holder); 15669 holder.appendChild(input); 15670 holder.appendChild(name); 15671 15672 var container = obj.overlay ? this._overlaysList : this._baseLayersList; 15673 container.appendChild(label); 15674 15675 this._checkDisabledLayers(); 15676 return label; 15677 }, 15678 15679 _onInputClick: function () { 15680 var inputs = this._layerControlInputs, 15681 input, layer; 15682 var addedLayers = [], 15683 removedLayers = []; 15684 15685 this._handlingClick = true; 15686 15687 for (var i = inputs.length - 1; i >= 0; i--) { 15688 input = inputs[i]; 15689 layer = this._getLayer(input.layerId).layer; 15690 15691 if (input.checked) { 15692 addedLayers.push(layer); 15693 } else if (!input.checked) { 15694 removedLayers.push(layer); 15695 } 15696 } 15697 15698 // Bugfix issue 2318: Should remove all old layers before readding new ones 15699 for (i = 0; i < removedLayers.length; i++) { 15700 if (this._map.hasLayer(removedLayers[i])) { 15701 this._map.removeLayer(removedLayers[i]); 15702 } 15703 } 15704 for (i = 0; i < addedLayers.length; i++) { 15705 if (!this._map.hasLayer(addedLayers[i])) { 15706 this._map.addLayer(addedLayers[i]); 15707 } 15708 } 15709 15710 this._handlingClick = false; 15711 15712 this._refocusOnMap(); 15713 }, 15714 15715 _checkDisabledLayers: function () { 15716 var inputs = this._layerControlInputs, 15717 input, 15718 layer, 15719 zoom = this._map.getZoom(); 15720 15721 for (var i = inputs.length - 1; i >= 0; i--) { 15722 input = inputs[i]; 15723 layer = this._getLayer(input.layerId).layer; 15724 input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) || 15725 (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom); 15726 15727 } 15728 }, 15729 15730 _expandIfNotCollapsed: function () { 15731 if (this._map && !this.options.collapsed) { 15732 this.expand(); 15733 } 15734 return this; 15735 }, 15736 15737 _expand: function () { 15738 // Backward compatibility, remove me in 1.1. 15739 return this.expand(); 15740 }, 15741 15742 _collapse: function () { 15743 // Backward compatibility, remove me in 1.1. 15744 return this.collapse(); 15745 } 15746 15747}); 15748 15749 15750// @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options) 15751// Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation. 15752var layers = function (baseLayers, overlays, options) { 15753 return new Layers(baseLayers, overlays, options); 15754}; 15755 15756/* 15757 * @class Control.Zoom 15758 * @aka L.Control.Zoom 15759 * @inherits Control 15760 * 15761 * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`. 15762 */ 15763 15764var Zoom = Control.extend({ 15765 // @section 15766 // @aka Control.Zoom options 15767 options: { 15768 position: 'topleft', 15769 15770 // @option zoomInText: String = '+' 15771 // The text set on the 'zoom in' button. 15772 zoomInText: '+', 15773 15774 // @option zoomInTitle: String = 'Zoom in' 15775 // The title set on the 'zoom in' button. 15776 zoomInTitle: 'Zoom in', 15777 15778 // @option zoomOutText: String = '−' 15779 // The text set on the 'zoom out' button. 15780 zoomOutText: '−', 15781 15782 // @option zoomOutTitle: String = 'Zoom out' 15783 // The title set on the 'zoom out' button. 15784 zoomOutTitle: 'Zoom out' 15785 }, 15786 15787 onAdd: function (map) { 15788 var zoomName = 'leaflet-control-zoom', 15789 container = create$1('div', zoomName + ' leaflet-bar'), 15790 options = this.options; 15791 15792 this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle, 15793 zoomName + '-in', container, this._zoomIn); 15794 this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle, 15795 zoomName + '-out', container, this._zoomOut); 15796 15797 this._updateDisabled(); 15798 map.on('zoomend zoomlevelschange', this._updateDisabled, this); 15799 15800 return container; 15801 }, 15802 15803 onRemove: function (map) { 15804 map.off('zoomend zoomlevelschange', this._updateDisabled, this); 15805 }, 15806 15807 disable: function () { 15808 this._disabled = true; 15809 this._updateDisabled(); 15810 return this; 15811 }, 15812 15813 enable: function () { 15814 this._disabled = false; 15815 this._updateDisabled(); 15816 return this; 15817 }, 15818 15819 _zoomIn: function (e) { 15820 if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) { 15821 this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1)); 15822 } 15823 }, 15824 15825 _zoomOut: function (e) { 15826 if (!this._disabled && this._map._zoom > this._map.getMinZoom()) { 15827 this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1)); 15828 } 15829 }, 15830 15831 _createButton: function (html, title, className, container, fn) { 15832 var link = create$1('a', className, container); 15833 link.innerHTML = html; 15834 link.href = '#'; 15835 link.title = title; 15836 15837 /* 15838 * Will force screen readers like VoiceOver to read this as "Zoom in - button" 15839 */ 15840 link.setAttribute('role', 'button'); 15841 link.setAttribute('aria-label', title); 15842 15843 disableClickPropagation(link); 15844 on(link, 'click', stop); 15845 on(link, 'click', fn, this); 15846 on(link, 'click', this._refocusOnMap, this); 15847 15848 return link; 15849 }, 15850 15851 _updateDisabled: function () { 15852 var map = this._map, 15853 className = 'leaflet-disabled'; 15854 15855 removeClass(this._zoomInButton, className); 15856 removeClass(this._zoomOutButton, className); 15857 15858 if (this._disabled || map._zoom === map.getMinZoom()) { 15859 addClass(this._zoomOutButton, className); 15860 } 15861 if (this._disabled || map._zoom === map.getMaxZoom()) { 15862 addClass(this._zoomInButton, className); 15863 } 15864 } 15865}); 15866 15867// @namespace Map 15868// @section Control options 15869// @option zoomControl: Boolean = true 15870// Whether a [zoom control](#control-zoom) is added to the map by default. 15871Map.mergeOptions({ 15872 zoomControl: true 15873}); 15874 15875Map.addInitHook(function () { 15876 if (this.options.zoomControl) { 15877 // @section Controls 15878 // @property zoomControl: Control.Zoom 15879 // The default zoom control (only available if the 15880 // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map). 15881 this.zoomControl = new Zoom(); 15882 this.addControl(this.zoomControl); 15883 } 15884}); 15885 15886// @namespace Control.Zoom 15887// @factory L.control.zoom(options: Control.Zoom options) 15888// Creates a zoom control 15889var zoom = function (options) { 15890 return new Zoom(options); 15891}; 15892 15893/* 15894 * @class Control.Scale 15895 * @aka L.Control.Scale 15896 * @inherits Control 15897 * 15898 * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`. 15899 * 15900 * @example 15901 * 15902 * ```js 15903 * L.control.scale().addTo(map); 15904 * ``` 15905 */ 15906 15907var Scale = Control.extend({ 15908 // @section 15909 // @aka Control.Scale options 15910 options: { 15911 position: 'bottomleft', 15912 15913 // @option maxWidth: Number = 100 15914 // Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500). 15915 maxWidth: 100, 15916 15917 // @option metric: Boolean = True 15918 // Whether to show the metric scale line (m/km). 15919 metric: true, 15920 15921 // @option imperial: Boolean = True 15922 // Whether to show the imperial scale line (mi/ft). 15923 imperial: true 15924 15925 // @option updateWhenIdle: Boolean = false 15926 // If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)). 15927 }, 15928 15929 onAdd: function (map) { 15930 var className = 'leaflet-control-scale', 15931 container = create$1('div', className), 15932 options = this.options; 15933 15934 this._addScales(options, className + '-line', container); 15935 15936 map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this); 15937 map.whenReady(this._update, this); 15938 15939 return container; 15940 }, 15941 15942 onRemove: function (map) { 15943 map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this); 15944 }, 15945 15946 _addScales: function (options, className, container) { 15947 if (options.metric) { 15948 this._mScale = create$1('div', className, container); 15949 } 15950 if (options.imperial) { 15951 this._iScale = create$1('div', className, container); 15952 } 15953 }, 15954 15955 _update: function () { 15956 var map = this._map, 15957 y = map.getSize().y / 2; 15958 15959 var maxMeters = map.distance( 15960 map.containerPointToLatLng([0, y]), 15961 map.containerPointToLatLng([this.options.maxWidth, y])); 15962 15963 this._updateScales(maxMeters); 15964 }, 15965 15966 _updateScales: function (maxMeters) { 15967 if (this.options.metric && maxMeters) { 15968 this._updateMetric(maxMeters); 15969 } 15970 if (this.options.imperial && maxMeters) { 15971 this._updateImperial(maxMeters); 15972 } 15973 }, 15974 15975 _updateMetric: function (maxMeters) { 15976 var meters = this._getRoundNum(maxMeters), 15977 label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km'; 15978 15979 this._updateScale(this._mScale, label, meters / maxMeters); 15980 }, 15981 15982 _updateImperial: function (maxMeters) { 15983 var maxFeet = maxMeters * 3.2808399, 15984 maxMiles, miles, feet; 15985 15986 if (maxFeet > 5280) { 15987 maxMiles = maxFeet / 5280; 15988 miles = this._getRoundNum(maxMiles); 15989 this._updateScale(this._iScale, miles + ' mi', miles / maxMiles); 15990 15991 } else { 15992 feet = this._getRoundNum(maxFeet); 15993 this._updateScale(this._iScale, feet + ' ft', feet / maxFeet); 15994 } 15995 }, 15996 15997 _updateScale: function (scale, text, ratio) { 15998 scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px'; 15999 scale.innerHTML = text; 16000 }, 16001 16002 _getRoundNum: function (num) { 16003 var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1), 16004 d = num / pow10; 16005 16006 d = d >= 10 ? 10 : 16007 d >= 5 ? 5 : 16008 d >= 3 ? 3 : 16009 d >= 2 ? 2 : 1; 16010 16011 return pow10 * d; 16012 } 16013}); 16014 16015 16016// @factory L.control.scale(options?: Control.Scale options) 16017// Creates an scale control with the given options. 16018var scale = function (options) { 16019 return new Scale(options); 16020}; 16021 16022/* 16023 * @class Control.Attribution 16024 * @aka L.Control.Attribution 16025 * @inherits Control 16026 * 16027 * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control. 16028 */ 16029 16030var Attribution = Control.extend({ 16031 // @section 16032 // @aka Control.Attribution options 16033 options: { 16034 position: 'bottomright', 16035 16036 // @option prefix: String = 'Leaflet' 16037 // The HTML text shown before the attributions. Pass `false` to disable. 16038 prefix: '<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>' 16039 }, 16040 16041 initialize: function (options) { 16042 setOptions(this, options); 16043 16044 this._attributions = {}; 16045 }, 16046 16047 onAdd: function (map) { 16048 map.attributionControl = this; 16049 this._container = create$1('div', 'leaflet-control-attribution'); 16050 disableClickPropagation(this._container); 16051 16052 // TODO ugly, refactor 16053 for (var i in map._layers) { 16054 if (map._layers[i].getAttribution) { 16055 this.addAttribution(map._layers[i].getAttribution()); 16056 } 16057 } 16058 16059 this._update(); 16060 16061 return this._container; 16062 }, 16063 16064 // @method setPrefix(prefix: String): this 16065 // Sets the text before the attributions. 16066 setPrefix: function (prefix) { 16067 this.options.prefix = prefix; 16068 this._update(); 16069 return this; 16070 }, 16071 16072 // @method addAttribution(text: String): this 16073 // Adds an attribution text (e.g. `'Vector data © Mapbox'`). 16074 addAttribution: function (text) { 16075 if (!text) { return this; } 16076 16077 if (!this._attributions[text]) { 16078 this._attributions[text] = 0; 16079 } 16080 this._attributions[text]++; 16081 16082 this._update(); 16083 16084 return this; 16085 }, 16086 16087 // @method removeAttribution(text: String): this 16088 // Removes an attribution text. 16089 removeAttribution: function (text) { 16090 if (!text) { return this; } 16091 16092 if (this._attributions[text]) { 16093 this._attributions[text]--; 16094 this._update(); 16095 } 16096 16097 return this; 16098 }, 16099 16100 _update: function () { 16101 if (!this._map) { return; } 16102 16103 var attribs = []; 16104 16105 for (var i in this._attributions) { 16106 if (this._attributions[i]) { 16107 attribs.push(i); 16108 } 16109 } 16110 16111 var prefixAndAttribs = []; 16112 16113 if (this.options.prefix) { 16114 prefixAndAttribs.push(this.options.prefix); 16115 } 16116 if (attribs.length) { 16117 prefixAndAttribs.push(attribs.join(', ')); 16118 } 16119 16120 this._container.innerHTML = prefixAndAttribs.join(' | '); 16121 } 16122}); 16123 16124// @namespace Map 16125// @section Control options 16126// @option attributionControl: Boolean = true 16127// Whether a [attribution control](#control-attribution) is added to the map by default. 16128Map.mergeOptions({ 16129 attributionControl: true 16130}); 16131 16132Map.addInitHook(function () { 16133 if (this.options.attributionControl) { 16134 new Attribution().addTo(this); 16135 } 16136}); 16137 16138// @namespace Control.Attribution 16139// @factory L.control.attribution(options: Control.Attribution options) 16140// Creates an attribution control. 16141var attribution = function (options) { 16142 return new Attribution(options); 16143}; 16144 16145Control.Layers = Layers; 16146Control.Zoom = Zoom; 16147Control.Scale = Scale; 16148Control.Attribution = Attribution; 16149 16150control.layers = layers; 16151control.zoom = zoom; 16152control.scale = scale; 16153control.attribution = attribution; 16154 16155/* 16156 L.Handler is a base class for handler classes that are used internally to inject 16157 interaction features like dragging to classes like Map and Marker. 16158*/ 16159 16160// @class Handler 16161// @aka L.Handler 16162// Abstract class for map interaction handlers 16163 16164var Handler = Class.extend({ 16165 initialize: function (map) { 16166 this._map = map; 16167 }, 16168 16169 // @method enable(): this 16170 // Enables the handler 16171 enable: function () { 16172 if (this._enabled) { return this; } 16173 16174 this._enabled = true; 16175 this.addHooks(); 16176 return this; 16177 }, 16178 16179 // @method disable(): this 16180 // Disables the handler 16181 disable: function () { 16182 if (!this._enabled) { return this; } 16183 16184 this._enabled = false; 16185 this.removeHooks(); 16186 return this; 16187 }, 16188 16189 // @method enabled(): Boolean 16190 // Returns `true` if the handler is enabled 16191 enabled: function () { 16192 return !!this._enabled; 16193 } 16194 16195 // @section Extension methods 16196 // Classes inheriting from `Handler` must implement the two following methods: 16197 // @method addHooks() 16198 // Called when the handler is enabled, should add event hooks. 16199 // @method removeHooks() 16200 // Called when the handler is disabled, should remove the event hooks added previously. 16201}); 16202 16203// @section There is static function which can be called without instantiating L.Handler: 16204// @function addTo(map: Map, name: String): this 16205// Adds a new Handler to the given map with the given name. 16206Handler.addTo = function (map, name) { 16207 map.addHandler(name, this); 16208 return this; 16209}; 16210 16211var Mixin = {Events: Events}; 16212 16213/* 16214 * @class Draggable 16215 * @aka L.Draggable 16216 * @inherits Evented 16217 * 16218 * A class for making DOM elements draggable (including touch support). 16219 * Used internally for map and marker dragging. Only works for elements 16220 * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition). 16221 * 16222 * @example 16223 * ```js 16224 * var draggable = new L.Draggable(elementToDrag); 16225 * draggable.enable(); 16226 * ``` 16227 */ 16228 16229var START = touch ? 'touchstart mousedown' : 'mousedown'; 16230var END = { 16231 mousedown: 'mouseup', 16232 touchstart: 'touchend', 16233 pointerdown: 'touchend', 16234 MSPointerDown: 'touchend' 16235}; 16236var MOVE = { 16237 mousedown: 'mousemove', 16238 touchstart: 'touchmove', 16239 pointerdown: 'touchmove', 16240 MSPointerDown: 'touchmove' 16241}; 16242 16243 16244var Draggable = Evented.extend({ 16245 16246 options: { 16247 // @section 16248 // @aka Draggable options 16249 // @option clickTolerance: Number = 3 16250 // The max number of pixels a user can shift the mouse pointer during a click 16251 // for it to be considered a valid click (as opposed to a mouse drag). 16252 clickTolerance: 3 16253 }, 16254 16255 // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options) 16256 // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default). 16257 initialize: function (element, dragStartTarget, preventOutline$$1, options) { 16258 setOptions(this, options); 16259 16260 this._element = element; 16261 this._dragStartTarget = dragStartTarget || element; 16262 this._preventOutline = preventOutline$$1; 16263 }, 16264 16265 // @method enable() 16266 // Enables the dragging ability 16267 enable: function () { 16268 if (this._enabled) { return; } 16269 16270 on(this._dragStartTarget, START, this._onDown, this); 16271 16272 this._enabled = true; 16273 }, 16274 16275 // @method disable() 16276 // Disables the dragging ability 16277 disable: function () { 16278 if (!this._enabled) { return; } 16279 16280 // If we're currently dragging this draggable, 16281 // disabling it counts as first ending the drag. 16282 if (Draggable._dragging === this) { 16283 this.finishDrag(); 16284 } 16285 16286 off(this._dragStartTarget, START, this._onDown, this); 16287 16288 this._enabled = false; 16289 this._moved = false; 16290 }, 16291 16292 _onDown: function (e) { 16293 // Ignore simulated events, since we handle both touch and 16294 // mouse explicitly; otherwise we risk getting duplicates of 16295 // touch events, see #4315. 16296 // Also ignore the event if disabled; this happens in IE11 16297 // under some circumstances, see #3666. 16298 if (e._simulated || !this._enabled) { return; } 16299 16300 this._moved = false; 16301 16302 if (hasClass(this._element, 'leaflet-zoom-anim')) { return; } 16303 16304 if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; } 16305 Draggable._dragging = this; // Prevent dragging multiple objects at once. 16306 16307 if (this._preventOutline) { 16308 preventOutline(this._element); 16309 } 16310 16311 disableImageDrag(); 16312 disableTextSelection(); 16313 16314 if (this._moving) { return; } 16315 16316 // @event down: Event 16317 // Fired when a drag is about to start. 16318 this.fire('down'); 16319 16320 var first = e.touches ? e.touches[0] : e, 16321 sizedParent = getSizedParentNode(this._element); 16322 16323 this._startPoint = new Point(first.clientX, first.clientY); 16324 16325 // Cache the scale, so that we can continuously compensate for it during drag (_onMove). 16326 this._parentScale = getScale(sizedParent); 16327 16328 on(document, MOVE[e.type], this._onMove, this); 16329 on(document, END[e.type], this._onUp, this); 16330 }, 16331 16332 _onMove: function (e) { 16333 // Ignore simulated events, since we handle both touch and 16334 // mouse explicitly; otherwise we risk getting duplicates of 16335 // touch events, see #4315. 16336 // Also ignore the event if disabled; this happens in IE11 16337 // under some circumstances, see #3666. 16338 if (e._simulated || !this._enabled) { return; } 16339 16340 if (e.touches && e.touches.length > 1) { 16341 this._moved = true; 16342 return; 16343 } 16344 16345 var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e), 16346 offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint); 16347 16348 if (!offset.x && !offset.y) { return; } 16349 if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; } 16350 16351 // We assume that the parent container's position, border and scale do not change for the duration of the drag. 16352 // Therefore there is no need to account for the position and border (they are eliminated by the subtraction) 16353 // and we can use the cached value for the scale. 16354 offset.x /= this._parentScale.x; 16355 offset.y /= this._parentScale.y; 16356 16357 preventDefault(e); 16358 16359 if (!this._moved) { 16360 // @event dragstart: Event 16361 // Fired when a drag starts 16362 this.fire('dragstart'); 16363 16364 this._moved = true; 16365 this._startPos = getPosition(this._element).subtract(offset); 16366 16367 addClass(document.body, 'leaflet-dragging'); 16368 16369 this._lastTarget = e.target || e.srcElement; 16370 // IE and Edge do not give the <use> element, so fetch it 16371 // if necessary 16372 if ((window.SVGElementInstance) && (this._lastTarget instanceof SVGElementInstance)) { 16373 this._lastTarget = this._lastTarget.correspondingUseElement; 16374 } 16375 addClass(this._lastTarget, 'leaflet-drag-target'); 16376 } 16377 16378 this._newPos = this._startPos.add(offset); 16379 this._moving = true; 16380 16381 cancelAnimFrame(this._animRequest); 16382 this._lastEvent = e; 16383 this._animRequest = requestAnimFrame(this._updatePosition, this, true); 16384 }, 16385 16386 _updatePosition: function () { 16387 var e = {originalEvent: this._lastEvent}; 16388 16389 // @event predrag: Event 16390 // Fired continuously during dragging *before* each corresponding 16391 // update of the element's position. 16392 this.fire('predrag', e); 16393 setPosition(this._element, this._newPos); 16394 16395 // @event drag: Event 16396 // Fired continuously during dragging. 16397 this.fire('drag', e); 16398 }, 16399 16400 _onUp: function (e) { 16401 // Ignore simulated events, since we handle both touch and 16402 // mouse explicitly; otherwise we risk getting duplicates of 16403 // touch events, see #4315. 16404 // Also ignore the event if disabled; this happens in IE11 16405 // under some circumstances, see #3666. 16406 if (e._simulated || !this._enabled) { return; } 16407 this.finishDrag(); 16408 }, 16409 16410 finishDrag: function () { 16411 removeClass(document.body, 'leaflet-dragging'); 16412 16413 if (this._lastTarget) { 16414 removeClass(this._lastTarget, 'leaflet-drag-target'); 16415 this._lastTarget = null; 16416 } 16417 16418 for (var i in MOVE) { 16419 off(document, MOVE[i], this._onMove, this); 16420 off(document, END[i], this._onUp, this); 16421 } 16422 16423 enableImageDrag(); 16424 enableTextSelection(); 16425 16426 if (this._moved && this._moving) { 16427 // ensure drag is not fired after dragend 16428 cancelAnimFrame(this._animRequest); 16429 16430 // @event dragend: DragEndEvent 16431 // Fired when the drag ends. 16432 this.fire('dragend', { 16433 distance: this._newPos.distanceTo(this._startPos) 16434 }); 16435 } 16436 16437 this._moving = false; 16438 Draggable._dragging = false; 16439 } 16440 16441}); 16442 16443/* 16444 * @namespace LineUtil 16445 * 16446 * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast. 16447 */ 16448 16449// Simplify polyline with vertex reduction and Douglas-Peucker simplification. 16450// Improves rendering performance dramatically by lessening the number of points to draw. 16451 16452// @function simplify(points: Point[], tolerance: Number): Point[] 16453// Dramatically reduces the number of points in a polyline while retaining 16454// its shape and returns a new array of simplified points, using the 16455// [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm). 16456// Used for a huge performance boost when processing/displaying Leaflet polylines for 16457// each zoom level and also reducing visual noise. tolerance affects the amount of 16458// simplification (lesser value means higher quality but slower and with more points). 16459// Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/). 16460function simplify(points, tolerance) { 16461 if (!tolerance || !points.length) { 16462 return points.slice(); 16463 } 16464 16465 var sqTolerance = tolerance * tolerance; 16466 16467 // stage 1: vertex reduction 16468 points = _reducePoints(points, sqTolerance); 16469 16470 // stage 2: Douglas-Peucker simplification 16471 points = _simplifyDP(points, sqTolerance); 16472 16473 return points; 16474} 16475 16476// @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number 16477// Returns the distance between point `p` and segment `p1` to `p2`. 16478function pointToSegmentDistance(p, p1, p2) { 16479 return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true)); 16480} 16481 16482// @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number 16483// Returns the closest point from a point `p` on a segment `p1` to `p2`. 16484function closestPointOnSegment(p, p1, p2) { 16485 return _sqClosestPointOnSegment(p, p1, p2); 16486} 16487 16488// Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm 16489function _simplifyDP(points, sqTolerance) { 16490 16491 var len = points.length, 16492 ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array, 16493 markers = new ArrayConstructor(len); 16494 16495 markers[0] = markers[len - 1] = 1; 16496 16497 _simplifyDPStep(points, markers, sqTolerance, 0, len - 1); 16498 16499 var i, 16500 newPoints = []; 16501 16502 for (i = 0; i < len; i++) { 16503 if (markers[i]) { 16504 newPoints.push(points[i]); 16505 } 16506 } 16507 16508 return newPoints; 16509} 16510 16511function _simplifyDPStep(points, markers, sqTolerance, first, last) { 16512 16513 var maxSqDist = 0, 16514 index, i, sqDist; 16515 16516 for (i = first + 1; i <= last - 1; i++) { 16517 sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true); 16518 16519 if (sqDist > maxSqDist) { 16520 index = i; 16521 maxSqDist = sqDist; 16522 } 16523 } 16524 16525 if (maxSqDist > sqTolerance) { 16526 markers[index] = 1; 16527 16528 _simplifyDPStep(points, markers, sqTolerance, first, index); 16529 _simplifyDPStep(points, markers, sqTolerance, index, last); 16530 } 16531} 16532 16533// reduce points that are too close to each other to a single point 16534function _reducePoints(points, sqTolerance) { 16535 var reducedPoints = [points[0]]; 16536 16537 for (var i = 1, prev = 0, len = points.length; i < len; i++) { 16538 if (_sqDist(points[i], points[prev]) > sqTolerance) { 16539 reducedPoints.push(points[i]); 16540 prev = i; 16541 } 16542 } 16543 if (prev < len - 1) { 16544 reducedPoints.push(points[len - 1]); 16545 } 16546 return reducedPoints; 16547} 16548 16549var _lastCode; 16550 16551// @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean 16552// Clips the segment a to b by rectangular bounds with the 16553// [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm) 16554// (modifying the segment points directly!). Used by Leaflet to only show polyline 16555// points that are on the screen or near, increasing performance. 16556function clipSegment(a, b, bounds, useLastCode, round) { 16557 var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds), 16558 codeB = _getBitCode(b, bounds), 16559 16560 codeOut, p, newCode; 16561 16562 // save 2nd code to avoid calculating it on the next segment 16563 _lastCode = codeB; 16564 16565 while (true) { 16566 // if a,b is inside the clip window (trivial accept) 16567 if (!(codeA | codeB)) { 16568 return [a, b]; 16569 } 16570 16571 // if a,b is outside the clip window (trivial reject) 16572 if (codeA & codeB) { 16573 return false; 16574 } 16575 16576 // other cases 16577 codeOut = codeA || codeB; 16578 p = _getEdgeIntersection(a, b, codeOut, bounds, round); 16579 newCode = _getBitCode(p, bounds); 16580 16581 if (codeOut === codeA) { 16582 a = p; 16583 codeA = newCode; 16584 } else { 16585 b = p; 16586 codeB = newCode; 16587 } 16588 } 16589} 16590 16591function _getEdgeIntersection(a, b, code, bounds, round) { 16592 var dx = b.x - a.x, 16593 dy = b.y - a.y, 16594 min = bounds.min, 16595 max = bounds.max, 16596 x, y; 16597 16598 if (code & 8) { // top 16599 x = a.x + dx * (max.y - a.y) / dy; 16600 y = max.y; 16601 16602 } else if (code & 4) { // bottom 16603 x = a.x + dx * (min.y - a.y) / dy; 16604 y = min.y; 16605 16606 } else if (code & 2) { // right 16607 x = max.x; 16608 y = a.y + dy * (max.x - a.x) / dx; 16609 16610 } else if (code & 1) { // left 16611 x = min.x; 16612 y = a.y + dy * (min.x - a.x) / dx; 16613 } 16614 16615 return new Point(x, y, round); 16616} 16617 16618function _getBitCode(p, bounds) { 16619 var code = 0; 16620 16621 if (p.x < bounds.min.x) { // left 16622 code |= 1; 16623 } else if (p.x > bounds.max.x) { // right 16624 code |= 2; 16625 } 16626 16627 if (p.y < bounds.min.y) { // bottom 16628 code |= 4; 16629 } else if (p.y > bounds.max.y) { // top 16630 code |= 8; 16631 } 16632 16633 return code; 16634} 16635 16636// square distance (to avoid unnecessary Math.sqrt calls) 16637function _sqDist(p1, p2) { 16638 var dx = p2.x - p1.x, 16639 dy = p2.y - p1.y; 16640 return dx * dx + dy * dy; 16641} 16642 16643// return closest point on segment or distance to that point 16644function _sqClosestPointOnSegment(p, p1, p2, sqDist) { 16645 var x = p1.x, 16646 y = p1.y, 16647 dx = p2.x - x, 16648 dy = p2.y - y, 16649 dot = dx * dx + dy * dy, 16650 t; 16651 16652 if (dot > 0) { 16653 t = ((p.x - x) * dx + (p.y - y) * dy) / dot; 16654 16655 if (t > 1) { 16656 x = p2.x; 16657 y = p2.y; 16658 } else if (t > 0) { 16659 x += dx * t; 16660 y += dy * t; 16661 } 16662 } 16663 16664 dx = p.x - x; 16665 dy = p.y - y; 16666 16667 return sqDist ? dx * dx + dy * dy : new Point(x, y); 16668} 16669 16670 16671// @function isFlat(latlngs: LatLng[]): Boolean 16672// Returns true if `latlngs` is a flat array, false is nested. 16673function isFlat(latlngs) { 16674 return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined'); 16675} 16676 16677function _flat(latlngs) { 16678 console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.'); 16679 return isFlat(latlngs); 16680} 16681 16682 16683var LineUtil = (Object.freeze || Object)({ 16684 simplify: simplify, 16685 pointToSegmentDistance: pointToSegmentDistance, 16686 closestPointOnSegment: closestPointOnSegment, 16687 clipSegment: clipSegment, 16688 _getEdgeIntersection: _getEdgeIntersection, 16689 _getBitCode: _getBitCode, 16690 _sqClosestPointOnSegment: _sqClosestPointOnSegment, 16691 isFlat: isFlat, 16692 _flat: _flat 16693}); 16694 16695/* 16696 * @namespace PolyUtil 16697 * Various utility functions for polygon geometries. 16698 */ 16699 16700/* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[] 16701 * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)). 16702 * Used by Leaflet to only show polygon points that are on the screen or near, increasing 16703 * performance. Note that polygon points needs different algorithm for clipping 16704 * than polyline, so there's a separate method for it. 16705 */ 16706function clipPolygon(points, bounds, round) { 16707 var clippedPoints, 16708 edges = [1, 4, 2, 8], 16709 i, j, k, 16710 a, b, 16711 len, edge, p; 16712 16713 for (i = 0, len = points.length; i < len; i++) { 16714 points[i]._code = _getBitCode(points[i], bounds); 16715 } 16716 16717 // for each edge (left, bottom, right, top) 16718 for (k = 0; k < 4; k++) { 16719 edge = edges[k]; 16720 clippedPoints = []; 16721 16722 for (i = 0, len = points.length, j = len - 1; i < len; j = i++) { 16723 a = points[i]; 16724 b = points[j]; 16725 16726 // if a is inside the clip window 16727 if (!(a._code & edge)) { 16728 // if b is outside the clip window (a->b goes out of screen) 16729 if (b._code & edge) { 16730 p = _getEdgeIntersection(b, a, edge, bounds, round); 16731 p._code = _getBitCode(p, bounds); 16732 clippedPoints.push(p); 16733 } 16734 clippedPoints.push(a); 16735 16736 // else if b is inside the clip window (a->b enters the screen) 16737 } else if (!(b._code & edge)) { 16738 p = _getEdgeIntersection(b, a, edge, bounds, round); 16739 p._code = _getBitCode(p, bounds); 16740 clippedPoints.push(p); 16741 } 16742 } 16743 points = clippedPoints; 16744 } 16745 16746 return points; 16747} 16748 16749 16750var PolyUtil = (Object.freeze || Object)({ 16751 clipPolygon: clipPolygon 16752}); 16753 16754/* 16755 * @namespace Projection 16756 * @section 16757 * Leaflet comes with a set of already defined Projections out of the box: 16758 * 16759 * @projection L.Projection.LonLat 16760 * 16761 * Equirectangular, or Plate Carree projection â the most simple projection, 16762 * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as 16763 * latitude. Also suitable for flat worlds, e.g. game maps. Used by the 16764 * `EPSG:4326` and `Simple` CRS. 16765 */ 16766 16767var LonLat = { 16768 project: function (latlng) { 16769 return new Point(latlng.lng, latlng.lat); 16770 }, 16771 16772 unproject: function (point) { 16773 return new LatLng(point.y, point.x); 16774 }, 16775 16776 bounds: new Bounds([-180, -90], [180, 90]) 16777}; 16778 16779/* 16780 * @namespace Projection 16781 * @projection L.Projection.Mercator 16782 * 16783 * Elliptical Mercator projection â more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS. 16784 */ 16785 16786var Mercator = { 16787 R: 6378137, 16788 R_MINOR: 6356752.314245179, 16789 16790 bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]), 16791 16792 project: function (latlng) { 16793 var d = Math.PI / 180, 16794 r = this.R, 16795 y = latlng.lat * d, 16796 tmp = this.R_MINOR / r, 16797 e = Math.sqrt(1 - tmp * tmp), 16798 con = e * Math.sin(y); 16799 16800 var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2); 16801 y = -r * Math.log(Math.max(ts, 1E-10)); 16802 16803 return new Point(latlng.lng * d * r, y); 16804 }, 16805 16806 unproject: function (point) { 16807 var d = 180 / Math.PI, 16808 r = this.R, 16809 tmp = this.R_MINOR / r, 16810 e = Math.sqrt(1 - tmp * tmp), 16811 ts = Math.exp(-point.y / r), 16812 phi = Math.PI / 2 - 2 * Math.atan(ts); 16813 16814 for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) { 16815 con = e * Math.sin(phi); 16816 con = Math.pow((1 - con) / (1 + con), e / 2); 16817 dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi; 16818 phi += dphi; 16819 } 16820 16821 return new LatLng(phi * d, point.x * d / r); 16822 } 16823}; 16824 16825/* 16826 * @class Projection 16827 16828 * An object with methods for projecting geographical coordinates of the world onto 16829 * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection). 16830 16831 * @property bounds: Bounds 16832 * The bounds (specified in CRS units) where the projection is valid 16833 16834 * @method project(latlng: LatLng): Point 16835 * Projects geographical coordinates into a 2D point. 16836 * Only accepts actual `L.LatLng` instances, not arrays. 16837 16838 * @method unproject(point: Point): LatLng 16839 * The inverse of `project`. Projects a 2D point into a geographical location. 16840 * Only accepts actual `L.Point` instances, not arrays. 16841 16842 * Note that the projection instances do not inherit from Leafet's `Class` object, 16843 * and can't be instantiated. Also, new classes can't inherit from them, 16844 * and methods can't be added to them with the `include` function. 16845 16846 */ 16847 16848 16849 16850 16851var index = (Object.freeze || Object)({ 16852 LonLat: LonLat, 16853 Mercator: Mercator, 16854 SphericalMercator: SphericalMercator 16855}); 16856 16857/* 16858 * @namespace CRS 16859 * @crs L.CRS.EPSG3395 16860 * 16861 * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection. 16862 */ 16863var EPSG3395 = extend({}, Earth, { 16864 code: 'EPSG:3395', 16865 projection: Mercator, 16866 16867 transformation: (function () { 16868 var scale = 0.5 / (Math.PI * Mercator.R); 16869 return toTransformation(scale, 0.5, -scale, 0.5); 16870 }()) 16871}); 16872 16873/* 16874 * @namespace CRS 16875 * @crs L.CRS.EPSG4326 16876 * 16877 * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection. 16878 * 16879 * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic), 16880 * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer` 16881 * with this CRS, ensure that there are two 256x256 pixel tiles covering the 16882 * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90), 16883 * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set. 16884 */ 16885 16886var EPSG4326 = extend({}, Earth, { 16887 code: 'EPSG:4326', 16888 projection: LonLat, 16889 transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5) 16890}); 16891 16892/* 16893 * @namespace CRS 16894 * @crs L.CRS.Simple 16895 * 16896 * A simple CRS that maps longitude and latitude into `x` and `y` directly. 16897 * May be used for maps of flat surfaces (e.g. game maps). Note that the `y` 16898 * axis should still be inverted (going from bottom to top). `distance()` returns 16899 * simple euclidean distance. 16900 */ 16901 16902var Simple = extend({}, CRS, { 16903 projection: LonLat, 16904 transformation: toTransformation(1, 0, -1, 0), 16905 16906 scale: function (zoom) { 16907 return Math.pow(2, zoom); 16908 }, 16909 16910 zoom: function (scale) { 16911 return Math.log(scale) / Math.LN2; 16912 }, 16913 16914 distance: function (latlng1, latlng2) { 16915 var dx = latlng2.lng - latlng1.lng, 16916 dy = latlng2.lat - latlng1.lat; 16917 16918 return Math.sqrt(dx * dx + dy * dy); 16919 }, 16920 16921 infinite: true 16922}); 16923 16924CRS.Earth = Earth; 16925CRS.EPSG3395 = EPSG3395; 16926CRS.EPSG3857 = EPSG3857; 16927CRS.EPSG900913 = EPSG900913; 16928CRS.EPSG4326 = EPSG4326; 16929CRS.Simple = Simple; 16930 16931/* 16932 * @class Layer 16933 * @inherits Evented 16934 * @aka L.Layer 16935 * @aka ILayer 16936 * 16937 * A set of methods from the Layer base class that all Leaflet layers use. 16938 * Inherits all methods, options and events from `L.Evented`. 16939 * 16940 * @example 16941 * 16942 * ```js 16943 * var layer = L.marker(latlng).addTo(map); 16944 * layer.addTo(map); 16945 * layer.remove(); 16946 * ``` 16947 * 16948 * @event add: Event 16949 * Fired after the layer is added to a map 16950 * 16951 * @event remove: Event 16952 * Fired after the layer is removed from a map 16953 */ 16954 16955 16956var Layer = Evented.extend({ 16957 16958 // Classes extending `L.Layer` will inherit the following options: 16959 options: { 16960 // @option pane: String = 'overlayPane' 16961 // By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default. 16962 pane: 'overlayPane', 16963 16964 // @option attribution: String = null 16965 // String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers. 16966 attribution: null, 16967 16968 bubblingMouseEvents: true 16969 }, 16970 16971 /* @section 16972 * Classes extending `L.Layer` will inherit the following methods: 16973 * 16974 * @method addTo(map: Map|LayerGroup): this 16975 * Adds the layer to the given map or layer group. 16976 */ 16977 addTo: function (map) { 16978 map.addLayer(this); 16979 return this; 16980 }, 16981 16982 // @method remove: this 16983 // Removes the layer from the map it is currently active on. 16984 remove: function () { 16985 return this.removeFrom(this._map || this._mapToAdd); 16986 }, 16987 16988 // @method removeFrom(map: Map): this 16989 // Removes the layer from the given map 16990 removeFrom: function (obj) { 16991 if (obj) { 16992 obj.removeLayer(this); 16993 } 16994 return this; 16995 }, 16996 16997 // @method getPane(name? : String): HTMLElement 16998 // Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer. 16999 getPane: function (name) { 17000 return this._map.getPane(name ? (this.options[name] || name) : this.options.pane); 17001 }, 17002 17003 addInteractiveTarget: function (targetEl) { 17004 this._map._targets[stamp(targetEl)] = this; 17005 return this; 17006 }, 17007 17008 removeInteractiveTarget: function (targetEl) { 17009 delete this._map._targets[stamp(targetEl)]; 17010 return this; 17011 }, 17012 17013 // @method getAttribution: String 17014 // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution). 17015 getAttribution: function () { 17016 return this.options.attribution; 17017 }, 17018 17019 _layerAdd: function (e) { 17020 var map = e.target; 17021 17022 // check in case layer gets added and then removed before the map is ready 17023 if (!map.hasLayer(this)) { return; } 17024 17025 this._map = map; 17026 this._zoomAnimated = map._zoomAnimated; 17027 17028 if (this.getEvents) { 17029 var events = this.getEvents(); 17030 map.on(events, this); 17031 this.once('remove', function () { 17032 map.off(events, this); 17033 }, this); 17034 } 17035 17036 this.onAdd(map); 17037 17038 if (this.getAttribution && map.attributionControl) { 17039 map.attributionControl.addAttribution(this.getAttribution()); 17040 } 17041 17042 this.fire('add'); 17043 map.fire('layeradd', {layer: this}); 17044 } 17045}); 17046 17047/* @section Extension methods 17048 * @uninheritable 17049 * 17050 * Every layer should extend from `L.Layer` and (re-)implement the following methods. 17051 * 17052 * @method onAdd(map: Map): this 17053 * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer). 17054 * 17055 * @method onRemove(map: Map): this 17056 * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer). 17057 * 17058 * @method getEvents(): Object 17059 * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer. 17060 * 17061 * @method getAttribution(): String 17062 * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible. 17063 * 17064 * @method beforeAdd(map: Map): this 17065 * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only. 17066 */ 17067 17068 17069/* @namespace Map 17070 * @section Layer events 17071 * 17072 * @event layeradd: LayerEvent 17073 * Fired when a new layer is added to the map. 17074 * 17075 * @event layerremove: LayerEvent 17076 * Fired when some layer is removed from the map 17077 * 17078 * @section Methods for Layers and Controls 17079 */ 17080Map.include({ 17081 // @method addLayer(layer: Layer): this 17082 // Adds the given layer to the map 17083 addLayer: function (layer) { 17084 if (!layer._layerAdd) { 17085 throw new Error('The provided object is not a Layer.'); 17086 } 17087 17088 var id = stamp(layer); 17089 if (this._layers[id]) { return this; } 17090 this._layers[id] = layer; 17091 17092 layer._mapToAdd = this; 17093 17094 if (layer.beforeAdd) { 17095 layer.beforeAdd(this); 17096 } 17097 17098 this.whenReady(layer._layerAdd, layer); 17099 17100 return this; 17101 }, 17102 17103 // @method removeLayer(layer: Layer): this 17104 // Removes the given layer from the map. 17105 removeLayer: function (layer) { 17106 var id = stamp(layer); 17107 17108 if (!this._layers[id]) { return this; } 17109 17110 if (this._loaded) { 17111 layer.onRemove(this); 17112 } 17113 17114 if (layer.getAttribution && this.attributionControl) { 17115 this.attributionControl.removeAttribution(layer.getAttribution()); 17116 } 17117 17118 delete this._layers[id]; 17119 17120 if (this._loaded) { 17121 this.fire('layerremove', {layer: layer}); 17122 layer.fire('remove'); 17123 } 17124 17125 layer._map = layer._mapToAdd = null; 17126 17127 return this; 17128 }, 17129 17130 // @method hasLayer(layer: Layer): Boolean 17131 // Returns `true` if the given layer is currently added to the map 17132 hasLayer: function (layer) { 17133 return !!layer && (stamp(layer) in this._layers); 17134 }, 17135 17136 /* @method eachLayer(fn: Function, context?: Object): this 17137 * Iterates over the layers of the map, optionally specifying context of the iterator function. 17138 * ``` 17139 * map.eachLayer(function(layer){ 17140 * layer.bindPopup('Hello'); 17141 * }); 17142 * ``` 17143 */ 17144 eachLayer: function (method, context) { 17145 for (var i in this._layers) { 17146 method.call(context, this._layers[i]); 17147 } 17148 return this; 17149 }, 17150 17151 _addLayers: function (layers) { 17152 layers = layers ? (isArray(layers) ? layers : [layers]) : []; 17153 17154 for (var i = 0, len = layers.length; i < len; i++) { 17155 this.addLayer(layers[i]); 17156 } 17157 }, 17158 17159 _addZoomLimit: function (layer) { 17160 if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) { 17161 this._zoomBoundLayers[stamp(layer)] = layer; 17162 this._updateZoomLevels(); 17163 } 17164 }, 17165 17166 _removeZoomLimit: function (layer) { 17167 var id = stamp(layer); 17168 17169 if (this._zoomBoundLayers[id]) { 17170 delete this._zoomBoundLayers[id]; 17171 this._updateZoomLevels(); 17172 } 17173 }, 17174 17175 _updateZoomLevels: function () { 17176 var minZoom = Infinity, 17177 maxZoom = -Infinity, 17178 oldZoomSpan = this._getZoomSpan(); 17179 17180 for (var i in this._zoomBoundLayers) { 17181 var options = this._zoomBoundLayers[i].options; 17182 17183 minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom); 17184 maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom); 17185 } 17186 17187 this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom; 17188 this._layersMinZoom = minZoom === Infinity ? undefined : minZoom; 17189 17190 // @section Map state change events 17191 // @event zoomlevelschange: Event 17192 // Fired when the number of zoomlevels on the map is changed due 17193 // to adding or removing a layer. 17194 if (oldZoomSpan !== this._getZoomSpan()) { 17195 this.fire('zoomlevelschange'); 17196 } 17197 17198 if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) { 17199 this.setZoom(this._layersMaxZoom); 17200 } 17201 if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) { 17202 this.setZoom(this._layersMinZoom); 17203 } 17204 } 17205}); 17206 17207/* 17208 * @class LayerGroup 17209 * @aka L.LayerGroup 17210 * @inherits Layer 17211 * 17212 * Used to group several layers and handle them as one. If you add it to the map, 17213 * any layers added or removed from the group will be added/removed on the map as 17214 * well. Extends `Layer`. 17215 * 17216 * @example 17217 * 17218 * ```js 17219 * L.layerGroup([marker1, marker2]) 17220 * .addLayer(polyline) 17221 * .addTo(map); 17222 * ``` 17223 */ 17224 17225var LayerGroup = Layer.extend({ 17226 17227 initialize: function (layers, options) { 17228 setOptions(this, options); 17229 17230 this._layers = {}; 17231 17232 var i, len; 17233 17234 if (layers) { 17235 for (i = 0, len = layers.length; i < len; i++) { 17236 this.addLayer(layers[i]); 17237 } 17238 } 17239 }, 17240 17241 // @method addLayer(layer: Layer): this 17242 // Adds the given layer to the group. 17243 addLayer: function (layer) { 17244 var id = this.getLayerId(layer); 17245 17246 this._layers[id] = layer; 17247 17248 if (this._map) { 17249 this._map.addLayer(layer); 17250 } 17251 17252 return this; 17253 }, 17254 17255 // @method removeLayer(layer: Layer): this 17256 // Removes the given layer from the group. 17257 // @alternative 17258 // @method removeLayer(id: Number): this 17259 // Removes the layer with the given internal ID from the group. 17260 removeLayer: function (layer) { 17261 var id = layer in this._layers ? layer : this.getLayerId(layer); 17262 17263 if (this._map && this._layers[id]) { 17264 this._map.removeLayer(this._layers[id]); 17265 } 17266 17267 delete this._layers[id]; 17268 17269 return this; 17270 }, 17271 17272 // @method hasLayer(layer: Layer): Boolean 17273 // Returns `true` if the given layer is currently added to the group. 17274 // @alternative 17275 // @method hasLayer(id: Number): Boolean 17276 // Returns `true` if the given internal ID is currently added to the group. 17277 hasLayer: function (layer) { 17278 return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers); 17279 }, 17280 17281 // @method clearLayers(): this 17282 // Removes all the layers from the group. 17283 clearLayers: function () { 17284 return this.eachLayer(this.removeLayer, this); 17285 }, 17286 17287 // @method invoke(methodName: String, â¦): this 17288 // Calls `methodName` on every layer contained in this group, passing any 17289 // additional parameters. Has no effect if the layers contained do not 17290 // implement `methodName`. 17291 invoke: function (methodName) { 17292 var args = Array.prototype.slice.call(arguments, 1), 17293 i, layer; 17294 17295 for (i in this._layers) { 17296 layer = this._layers[i]; 17297 17298 if (layer[methodName]) { 17299 layer[methodName].apply(layer, args); 17300 } 17301 } 17302 17303 return this; 17304 }, 17305 17306 onAdd: function (map) { 17307 this.eachLayer(map.addLayer, map); 17308 }, 17309 17310 onRemove: function (map) { 17311 this.eachLayer(map.removeLayer, map); 17312 }, 17313 17314 // @method eachLayer(fn: Function, context?: Object): this 17315 // Iterates over the layers of the group, optionally specifying context of the iterator function. 17316 // ```js 17317 // group.eachLayer(function (layer) { 17318 // layer.bindPopup('Hello'); 17319 // }); 17320 // ``` 17321 eachLayer: function (method, context) { 17322 for (var i in this._layers) { 17323 method.call(context, this._layers[i]); 17324 } 17325 return this; 17326 }, 17327 17328 // @method getLayer(id: Number): Layer 17329 // Returns the layer with the given internal ID. 17330 getLayer: function (id) { 17331 return this._layers[id]; 17332 }, 17333 17334 // @method getLayers(): Layer[] 17335 // Returns an array of all the layers added to the group. 17336 getLayers: function () { 17337 var layers = []; 17338 this.eachLayer(layers.push, layers); 17339 return layers; 17340 }, 17341 17342 // @method setZIndex(zIndex: Number): this 17343 // Calls `setZIndex` on every layer contained in this group, passing the z-index. 17344 setZIndex: function (zIndex) { 17345 return this.invoke('setZIndex', zIndex); 17346 }, 17347 17348 // @method getLayerId(layer: Layer): Number 17349 // Returns the internal ID for a layer 17350 getLayerId: function (layer) { 17351 return stamp(layer); 17352 } 17353}); 17354 17355 17356// @factory L.layerGroup(layers?: Layer[], options?: Object) 17357// Create a layer group, optionally given an initial set of layers and an `options` object. 17358var layerGroup = function (layers, options) { 17359 return new LayerGroup(layers, options); 17360}; 17361 17362/* 17363 * @class FeatureGroup 17364 * @aka L.FeatureGroup 17365 * @inherits LayerGroup 17366 * 17367 * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers: 17368 * * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip)) 17369 * * Events are propagated to the `FeatureGroup`, so if the group has an event 17370 * handler, it will handle events from any of the layers. This includes mouse events 17371 * and custom events. 17372 * * Has `layeradd` and `layerremove` events 17373 * 17374 * @example 17375 * 17376 * ```js 17377 * L.featureGroup([marker1, marker2, polyline]) 17378 * .bindPopup('Hello world!') 17379 * .on('click', function() { alert('Clicked on a member of the group!'); }) 17380 * .addTo(map); 17381 * ``` 17382 */ 17383 17384var FeatureGroup = LayerGroup.extend({ 17385 17386 addLayer: function (layer) { 17387 if (this.hasLayer(layer)) { 17388 return this; 17389 } 17390 17391 layer.addEventParent(this); 17392 17393 LayerGroup.prototype.addLayer.call(this, layer); 17394 17395 // @event layeradd: LayerEvent 17396 // Fired when a layer is added to this `FeatureGroup` 17397 return this.fire('layeradd', {layer: layer}); 17398 }, 17399 17400 removeLayer: function (layer) { 17401 if (!this.hasLayer(layer)) { 17402 return this; 17403 } 17404 if (layer in this._layers) { 17405 layer = this._layers[layer]; 17406 } 17407 17408 layer.removeEventParent(this); 17409 17410 LayerGroup.prototype.removeLayer.call(this, layer); 17411 17412 // @event layerremove: LayerEvent 17413 // Fired when a layer is removed from this `FeatureGroup` 17414 return this.fire('layerremove', {layer: layer}); 17415 }, 17416 17417 // @method setStyle(style: Path options): this 17418 // Sets the given path options to each layer of the group that has a `setStyle` method. 17419 setStyle: function (style) { 17420 return this.invoke('setStyle', style); 17421 }, 17422 17423 // @method bringToFront(): this 17424 // Brings the layer group to the top of all other layers 17425 bringToFront: function () { 17426 return this.invoke('bringToFront'); 17427 }, 17428 17429 // @method bringToBack(): this 17430 // Brings the layer group to the back of all other layers 17431 bringToBack: function () { 17432 return this.invoke('bringToBack'); 17433 }, 17434 17435 // @method getBounds(): LatLngBounds 17436 // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children). 17437 getBounds: function () { 17438 var bounds = new LatLngBounds(); 17439 17440 for (var id in this._layers) { 17441 var layer = this._layers[id]; 17442 bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng()); 17443 } 17444 return bounds; 17445 } 17446}); 17447 17448// @factory L.featureGroup(layers: Layer[]) 17449// Create a feature group, optionally given an initial set of layers. 17450var featureGroup = function (layers) { 17451 return new FeatureGroup(layers); 17452}; 17453 17454/* 17455 * @class Icon 17456 * @aka L.Icon 17457 * 17458 * Represents an icon to provide when creating a marker. 17459 * 17460 * @example 17461 * 17462 * ```js 17463 * var myIcon = L.icon({ 17464 * iconUrl: 'my-icon.png', 17465 * iconRetinaUrl: '[email protected]', 17466 * iconSize: [38, 95], 17467 * iconAnchor: [22, 94], 17468 * popupAnchor: [-3, -76], 17469 * shadowUrl: 'my-icon-shadow.png', 17470 * shadowRetinaUrl: '[email protected]', 17471 * shadowSize: [68, 95], 17472 * shadowAnchor: [22, 94] 17473 * }); 17474 * 17475 * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); 17476 * ``` 17477 * 17478 * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default. 17479 * 17480 */ 17481 17482var Icon = Class.extend({ 17483 17484 /* @section 17485 * @aka Icon options 17486 * 17487 * @option iconUrl: String = null 17488 * **(required)** The URL to the icon image (absolute or relative to your script path). 17489 * 17490 * @option iconRetinaUrl: String = null 17491 * The URL to a retina sized version of the icon image (absolute or relative to your 17492 * script path). Used for Retina screen devices. 17493 * 17494 * @option iconSize: Point = null 17495 * Size of the icon image in pixels. 17496 * 17497 * @option iconAnchor: Point = null 17498 * The coordinates of the "tip" of the icon (relative to its top left corner). The icon 17499 * will be aligned so that this point is at the marker's geographical location. Centered 17500 * by default if size is specified, also can be set in CSS with negative margins. 17501 * 17502 * @option popupAnchor: Point = [0, 0] 17503 * The coordinates of the point from which popups will "open", relative to the icon anchor. 17504 * 17505 * @option tooltipAnchor: Point = [0, 0] 17506 * The coordinates of the point from which tooltips will "open", relative to the icon anchor. 17507 * 17508 * @option shadowUrl: String = null 17509 * The URL to the icon shadow image. If not specified, no shadow image will be created. 17510 * 17511 * @option shadowRetinaUrl: String = null 17512 * 17513 * @option shadowSize: Point = null 17514 * Size of the shadow image in pixels. 17515 * 17516 * @option shadowAnchor: Point = null 17517 * The coordinates of the "tip" of the shadow (relative to its top left corner) (the same 17518 * as iconAnchor if not specified). 17519 * 17520 * @option className: String = '' 17521 * A custom class name to assign to both icon and shadow images. Empty by default. 17522 */ 17523 17524 options: { 17525 popupAnchor: [0, 0], 17526 tooltipAnchor: [0, 0] 17527 }, 17528 17529 initialize: function (options) { 17530 setOptions(this, options); 17531 }, 17532 17533 // @method createIcon(oldIcon?: HTMLElement): HTMLElement 17534 // Called internally when the icon has to be shown, returns a `<img>` HTML element 17535 // styled according to the options. 17536 createIcon: function (oldIcon) { 17537 return this._createIcon('icon', oldIcon); 17538 }, 17539 17540 // @method createShadow(oldIcon?: HTMLElement): HTMLElement 17541 // As `createIcon`, but for the shadow beneath it. 17542 createShadow: function (oldIcon) { 17543 return this._createIcon('shadow', oldIcon); 17544 }, 17545 17546 _createIcon: function (name, oldIcon) { 17547 var src = this._getIconUrl(name); 17548 17549 if (!src) { 17550 if (name === 'icon') { 17551 throw new Error('iconUrl not set in Icon options (see the docs).'); 17552 } 17553 return null; 17554 } 17555 17556 var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null); 17557 this._setIconStyles(img, name); 17558 17559 return img; 17560 }, 17561 17562 _setIconStyles: function (img, name) { 17563 var options = this.options; 17564 var sizeOption = options[name + 'Size']; 17565 17566 if (typeof sizeOption === 'number') { 17567 sizeOption = [sizeOption, sizeOption]; 17568 } 17569 17570 var size = toPoint(sizeOption), 17571 anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor || 17572 size && size.divideBy(2, true)); 17573 17574 img.className = 'leaflet-marker-' + name + ' ' + (options.className || ''); 17575 17576 if (anchor) { 17577 img.style.marginLeft = (-anchor.x) + 'px'; 17578 img.style.marginTop = (-anchor.y) + 'px'; 17579 } 17580 17581 if (size) { 17582 img.style.width = size.x + 'px'; 17583 img.style.height = size.y + 'px'; 17584 } 17585 }, 17586 17587 _createImg: function (src, el) { 17588 el = el || document.createElement('img'); 17589 el.src = src; 17590 return el; 17591 }, 17592 17593 _getIconUrl: function (name) { 17594 return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url']; 17595 } 17596}); 17597 17598 17599// @factory L.icon(options: Icon options) 17600// Creates an icon instance with the given options. 17601function icon(options) { 17602 return new Icon(options); 17603} 17604 17605/* 17606 * @miniclass Icon.Default (Icon) 17607 * @aka L.Icon.Default 17608 * @section 17609 * 17610 * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when 17611 * no icon is specified. Points to the blue marker image distributed with Leaflet 17612 * releases. 17613 * 17614 * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options` 17615 * (which is a set of `Icon options`). 17616 * 17617 * If you want to _completely_ replace the default icon, override the 17618 * `L.Marker.prototype.options.icon` with your own icon instead. 17619 */ 17620 17621var IconDefault = Icon.extend({ 17622 17623 options: { 17624 iconUrl: 'marker-icon.png', 17625 iconRetinaUrl: 'marker-icon-2x.png', 17626 shadowUrl: 'marker-shadow.png', 17627 iconSize: [25, 41], 17628 iconAnchor: [12, 41], 17629 popupAnchor: [1, -34], 17630 tooltipAnchor: [16, -28], 17631 shadowSize: [41, 41] 17632 }, 17633 17634 _getIconUrl: function (name) { 17635 if (!IconDefault.imagePath) { // Deprecated, backwards-compatibility only 17636 IconDefault.imagePath = this._detectIconPath(); 17637 } 17638 17639 // @option imagePath: String 17640 // `Icon.Default` will try to auto-detect the location of the 17641 // blue icon images. If you are placing these images in a non-standard 17642 // way, set this option to point to the right path. 17643 return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name); 17644 }, 17645 17646 _detectIconPath: function () { 17647 var el = create$1('div', 'leaflet-default-icon-path', document.body); 17648 var path = getStyle(el, 'background-image') || 17649 getStyle(el, 'backgroundImage'); // IE8 17650 17651 document.body.removeChild(el); 17652 17653 if (path === null || path.indexOf('url') !== 0) { 17654 path = ''; 17655 } else { 17656 path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, ''); 17657 } 17658 17659 return path; 17660 } 17661}); 17662 17663/* 17664 * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable. 17665 */ 17666 17667 17668/* @namespace Marker 17669 * @section Interaction handlers 17670 * 17671 * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example: 17672 * 17673 * ```js 17674 * marker.dragging.disable(); 17675 * ``` 17676 * 17677 * @property dragging: Handler 17678 * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)). 17679 */ 17680 17681var MarkerDrag = Handler.extend({ 17682 initialize: function (marker) { 17683 this._marker = marker; 17684 }, 17685 17686 addHooks: function () { 17687 var icon = this._marker._icon; 17688 17689 if (!this._draggable) { 17690 this._draggable = new Draggable(icon, icon, true); 17691 } 17692 17693 this._draggable.on({ 17694 dragstart: this._onDragStart, 17695 predrag: this._onPreDrag, 17696 drag: this._onDrag, 17697 dragend: this._onDragEnd 17698 }, this).enable(); 17699 17700 addClass(icon, 'leaflet-marker-draggable'); 17701 }, 17702 17703 removeHooks: function () { 17704 this._draggable.off({ 17705 dragstart: this._onDragStart, 17706 predrag: this._onPreDrag, 17707 drag: this._onDrag, 17708 dragend: this._onDragEnd 17709 }, this).disable(); 17710 17711 if (this._marker._icon) { 17712 removeClass(this._marker._icon, 'leaflet-marker-draggable'); 17713 } 17714 }, 17715 17716 moved: function () { 17717 return this._draggable && this._draggable._moved; 17718 }, 17719 17720 _adjustPan: function (e) { 17721 var marker = this._marker, 17722 map = marker._map, 17723 speed = this._marker.options.autoPanSpeed, 17724 padding = this._marker.options.autoPanPadding, 17725 iconPos = getPosition(marker._icon), 17726 bounds = map.getPixelBounds(), 17727 origin = map.getPixelOrigin(); 17728 17729 var panBounds = toBounds( 17730 bounds.min._subtract(origin).add(padding), 17731 bounds.max._subtract(origin).subtract(padding) 17732 ); 17733 17734 if (!panBounds.contains(iconPos)) { 17735 // Compute incremental movement 17736 var movement = toPoint( 17737 (Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) - 17738 (Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x), 17739 17740 (Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) - 17741 (Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y) 17742 ).multiplyBy(speed); 17743 17744 map.panBy(movement, {animate: false}); 17745 17746 this._draggable._newPos._add(movement); 17747 this._draggable._startPos._add(movement); 17748 17749 setPosition(marker._icon, this._draggable._newPos); 17750 this._onDrag(e); 17751 17752 this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e)); 17753 } 17754 }, 17755 17756 _onDragStart: function () { 17757 // @section Dragging events 17758 // @event dragstart: Event 17759 // Fired when the user starts dragging the marker. 17760 17761 // @event movestart: Event 17762 // Fired when the marker starts moving (because of dragging). 17763 17764 this._oldLatLng = this._marker.getLatLng(); 17765 this._marker 17766 .closePopup() 17767 .fire('movestart') 17768 .fire('dragstart'); 17769 }, 17770 17771 _onPreDrag: function (e) { 17772 if (this._marker.options.autoPan) { 17773 cancelAnimFrame(this._panRequest); 17774 this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e)); 17775 } 17776 }, 17777 17778 _onDrag: function (e) { 17779 var marker = this._marker, 17780 shadow = marker._shadow, 17781 iconPos = getPosition(marker._icon), 17782 latlng = marker._map.layerPointToLatLng(iconPos); 17783 17784 // update shadow position 17785 if (shadow) { 17786 setPosition(shadow, iconPos); 17787 } 17788 17789 marker._latlng = latlng; 17790 e.latlng = latlng; 17791 e.oldLatLng = this._oldLatLng; 17792 17793 // @event drag: Event 17794 // Fired repeatedly while the user drags the marker. 17795 marker 17796 .fire('move', e) 17797 .fire('drag', e); 17798 }, 17799 17800 _onDragEnd: function (e) { 17801 // @event dragend: DragEndEvent 17802 // Fired when the user stops dragging the marker. 17803 17804 cancelAnimFrame(this._panRequest); 17805 17806 // @event moveend: Event 17807 // Fired when the marker stops moving (because of dragging). 17808 delete this._oldLatLng; 17809 this._marker 17810 .fire('moveend') 17811 .fire('dragend', e); 17812 } 17813}); 17814 17815/* 17816 * @class Marker 17817 * @inherits Interactive layer 17818 * @aka L.Marker 17819 * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`. 17820 * 17821 * @example 17822 * 17823 * ```js 17824 * L.marker([50.5, 30.5]).addTo(map); 17825 * ``` 17826 */ 17827 17828var Marker = Layer.extend({ 17829 17830 // @section 17831 // @aka Marker options 17832 options: { 17833 // @option icon: Icon = * 17834 // Icon instance to use for rendering the marker. 17835 // See [Icon documentation](#L.Icon) for details on how to customize the marker icon. 17836 // If not specified, a common instance of `L.Icon.Default` is used. 17837 icon: new IconDefault(), 17838 17839 // Option inherited from "Interactive layer" abstract class 17840 interactive: true, 17841 17842 // @option keyboard: Boolean = true 17843 // Whether the marker can be tabbed to with a keyboard and clicked by pressing enter. 17844 keyboard: true, 17845 17846 // @option title: String = '' 17847 // Text for the browser tooltip that appear on marker hover (no tooltip by default). 17848 title: '', 17849 17850 // @option alt: String = '' 17851 // Text for the `alt` attribute of the icon image (useful for accessibility). 17852 alt: '', 17853 17854 // @option zIndexOffset: Number = 0 17855 // By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively). 17856 zIndexOffset: 0, 17857 17858 // @option opacity: Number = 1.0 17859 // The opacity of the marker. 17860 opacity: 1, 17861 17862 // @option riseOnHover: Boolean = false 17863 // If `true`, the marker will get on top of others when you hover the mouse over it. 17864 riseOnHover: false, 17865 17866 // @option riseOffset: Number = 250 17867 // The z-index offset used for the `riseOnHover` feature. 17868 riseOffset: 250, 17869 17870 // @option pane: String = 'markerPane' 17871 // `Map pane` where the markers icon will be added. 17872 pane: 'markerPane', 17873 17874 // @option pane: String = 'shadowPane' 17875 // `Map pane` where the markers shadow will be added. 17876 shadowPane: 'shadowPane', 17877 17878 // @option bubblingMouseEvents: Boolean = false 17879 // When `true`, a mouse event on this marker will trigger the same event on the map 17880 // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used). 17881 bubblingMouseEvents: false, 17882 17883 // @section Draggable marker options 17884 // @option draggable: Boolean = false 17885 // Whether the marker is draggable with mouse/touch or not. 17886 draggable: false, 17887 17888 // @option autoPan: Boolean = false 17889 // Whether to pan the map when dragging this marker near its edge or not. 17890 autoPan: false, 17891 17892 // @option autoPanPadding: Point = Point(50, 50) 17893 // Distance (in pixels to the left/right and to the top/bottom) of the 17894 // map edge to start panning the map. 17895 autoPanPadding: [50, 50], 17896 17897 // @option autoPanSpeed: Number = 10 17898 // Number of pixels the map should pan by. 17899 autoPanSpeed: 10 17900 }, 17901 17902 /* @section 17903 * 17904 * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods: 17905 */ 17906 17907 initialize: function (latlng, options) { 17908 setOptions(this, options); 17909 this._latlng = toLatLng(latlng); 17910 }, 17911 17912 onAdd: function (map) { 17913 this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation; 17914 17915 if (this._zoomAnimated) { 17916 map.on('zoomanim', this._animateZoom, this); 17917 } 17918 17919 this._initIcon(); 17920 this.update(); 17921 }, 17922 17923 onRemove: function (map) { 17924 if (this.dragging && this.dragging.enabled()) { 17925 this.options.draggable = true; 17926 this.dragging.removeHooks(); 17927 } 17928 delete this.dragging; 17929 17930 if (this._zoomAnimated) { 17931 map.off('zoomanim', this._animateZoom, this); 17932 } 17933 17934 this._removeIcon(); 17935 this._removeShadow(); 17936 }, 17937 17938 getEvents: function () { 17939 return { 17940 zoom: this.update, 17941 viewreset: this.update 17942 }; 17943 }, 17944 17945 // @method getLatLng: LatLng 17946 // Returns the current geographical position of the marker. 17947 getLatLng: function () { 17948 return this._latlng; 17949 }, 17950 17951 // @method setLatLng(latlng: LatLng): this 17952 // Changes the marker position to the given point. 17953 setLatLng: function (latlng) { 17954 var oldLatLng = this._latlng; 17955 this._latlng = toLatLng(latlng); 17956 this.update(); 17957 17958 // @event move: Event 17959 // Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`. 17960 return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng}); 17961 }, 17962 17963 // @method setZIndexOffset(offset: Number): this 17964 // Changes the [zIndex offset](#marker-zindexoffset) of the marker. 17965 setZIndexOffset: function (offset) { 17966 this.options.zIndexOffset = offset; 17967 return this.update(); 17968 }, 17969 17970 // @method getIcon: Icon 17971 // Returns the current icon used by the marker 17972 getIcon: function () { 17973 return this.options.icon; 17974 }, 17975 17976 // @method setIcon(icon: Icon): this 17977 // Changes the marker icon. 17978 setIcon: function (icon) { 17979 17980 this.options.icon = icon; 17981 17982 if (this._map) { 17983 this._initIcon(); 17984 this.update(); 17985 } 17986 17987 if (this._popup) { 17988 this.bindPopup(this._popup, this._popup.options); 17989 } 17990 17991 return this; 17992 }, 17993 17994 getElement: function () { 17995 return this._icon; 17996 }, 17997 17998 update: function () { 17999 18000 if (this._icon && this._map) { 18001 var pos = this._map.latLngToLayerPoint(this._latlng).round(); 18002 this._setPos(pos); 18003 } 18004 18005 return this; 18006 }, 18007 18008 _initIcon: function () { 18009 var options = this.options, 18010 classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'); 18011 18012 var icon = options.icon.createIcon(this._icon), 18013 addIcon = false; 18014 18015 // if we're not reusing the icon, remove the old one and init new one 18016 if (icon !== this._icon) { 18017 if (this._icon) { 18018 this._removeIcon(); 18019 } 18020 addIcon = true; 18021 18022 if (options.title) { 18023 icon.title = options.title; 18024 } 18025 18026 if (icon.tagName === 'IMG') { 18027 icon.alt = options.alt || ''; 18028 } 18029 } 18030 18031 addClass(icon, classToAdd); 18032 18033 if (options.keyboard) { 18034 icon.tabIndex = '0'; 18035 } 18036 18037 this._icon = icon; 18038 18039 if (options.riseOnHover) { 18040 this.on({ 18041 mouseover: this._bringToFront, 18042 mouseout: this._resetZIndex 18043 }); 18044 } 18045 18046 var newShadow = options.icon.createShadow(this._shadow), 18047 addShadow = false; 18048 18049 if (newShadow !== this._shadow) { 18050 this._removeShadow(); 18051 addShadow = true; 18052 } 18053 18054 if (newShadow) { 18055 addClass(newShadow, classToAdd); 18056 newShadow.alt = ''; 18057 } 18058 this._shadow = newShadow; 18059 18060 18061 if (options.opacity < 1) { 18062 this._updateOpacity(); 18063 } 18064 18065 18066 if (addIcon) { 18067 this.getPane().appendChild(this._icon); 18068 } 18069 this._initInteraction(); 18070 if (newShadow && addShadow) { 18071 this.getPane(options.shadowPane).appendChild(this._shadow); 18072 } 18073 }, 18074 18075 _removeIcon: function () { 18076 if (this.options.riseOnHover) { 18077 this.off({ 18078 mouseover: this._bringToFront, 18079 mouseout: this._resetZIndex 18080 }); 18081 } 18082 18083 remove(this._icon); 18084 this.removeInteractiveTarget(this._icon); 18085 18086 this._icon = null; 18087 }, 18088 18089 _removeShadow: function () { 18090 if (this._shadow) { 18091 remove(this._shadow); 18092 } 18093 this._shadow = null; 18094 }, 18095 18096 _setPos: function (pos) { 18097 18098 if (this._icon) { 18099 setPosition(this._icon, pos); 18100 } 18101 18102 if (this._shadow) { 18103 setPosition(this._shadow, pos); 18104 } 18105 18106 this._zIndex = pos.y + this.options.zIndexOffset; 18107 18108 this._resetZIndex(); 18109 }, 18110 18111 _updateZIndex: function (offset) { 18112 if (this._icon) { 18113 this._icon.style.zIndex = this._zIndex + offset; 18114 } 18115 }, 18116 18117 _animateZoom: function (opt) { 18118 var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round(); 18119 18120 this._setPos(pos); 18121 }, 18122 18123 _initInteraction: function () { 18124 18125 if (!this.options.interactive) { return; } 18126 18127 addClass(this._icon, 'leaflet-interactive'); 18128 18129 this.addInteractiveTarget(this._icon); 18130 18131 if (MarkerDrag) { 18132 var draggable = this.options.draggable; 18133 if (this.dragging) { 18134 draggable = this.dragging.enabled(); 18135 this.dragging.disable(); 18136 } 18137 18138 this.dragging = new MarkerDrag(this); 18139 18140 if (draggable) { 18141 this.dragging.enable(); 18142 } 18143 } 18144 }, 18145 18146 // @method setOpacity(opacity: Number): this 18147 // Changes the opacity of the marker. 18148 setOpacity: function (opacity) { 18149 this.options.opacity = opacity; 18150 if (this._map) { 18151 this._updateOpacity(); 18152 } 18153 18154 return this; 18155 }, 18156 18157 _updateOpacity: function () { 18158 var opacity = this.options.opacity; 18159 18160 if (this._icon) { 18161 setOpacity(this._icon, opacity); 18162 } 18163 18164 if (this._shadow) { 18165 setOpacity(this._shadow, opacity); 18166 } 18167 }, 18168 18169 _bringToFront: function () { 18170 this._updateZIndex(this.options.riseOffset); 18171 }, 18172 18173 _resetZIndex: function () { 18174 this._updateZIndex(0); 18175 }, 18176 18177 _getPopupAnchor: function () { 18178 return this.options.icon.options.popupAnchor; 18179 }, 18180 18181 _getTooltipAnchor: function () { 18182 return this.options.icon.options.tooltipAnchor; 18183 } 18184}); 18185 18186 18187// factory L.marker(latlng: LatLng, options? : Marker options) 18188 18189// @factory L.marker(latlng: LatLng, options? : Marker options) 18190// Instantiates a Marker object given a geographical point and optionally an options object. 18191function marker(latlng, options) { 18192 return new Marker(latlng, options); 18193} 18194 18195/* 18196 * @class Path 18197 * @aka L.Path 18198 * @inherits Interactive layer 18199 * 18200 * An abstract class that contains options and constants shared between vector 18201 * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`. 18202 */ 18203 18204var Path = Layer.extend({ 18205 18206 // @section 18207 // @aka Path options 18208 options: { 18209 // @option stroke: Boolean = true 18210 // Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles. 18211 stroke: true, 18212 18213 // @option color: String = '#3388ff' 18214 // Stroke color 18215 color: '#3388ff', 18216 18217 // @option weight: Number = 3 18218 // Stroke width in pixels 18219 weight: 3, 18220 18221 // @option opacity: Number = 1.0 18222 // Stroke opacity 18223 opacity: 1, 18224 18225 // @option lineCap: String= 'round' 18226 // A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke. 18227 lineCap: 'round', 18228 18229 // @option lineJoin: String = 'round' 18230 // A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke. 18231 lineJoin: 'round', 18232 18233 // @option dashArray: String = null 18234 // A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility). 18235 dashArray: null, 18236 18237 // @option dashOffset: String = null 18238 // A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility). 18239 dashOffset: null, 18240 18241 // @option fill: Boolean = depends 18242 // Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles. 18243 fill: false, 18244 18245 // @option fillColor: String = * 18246 // Fill color. Defaults to the value of the [`color`](#path-color) option 18247 fillColor: null, 18248 18249 // @option fillOpacity: Number = 0.2 18250 // Fill opacity. 18251 fillOpacity: 0.2, 18252 18253 // @option fillRule: String = 'evenodd' 18254 // A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined. 18255 fillRule: 'evenodd', 18256 18257 // className: '', 18258 18259 // Option inherited from "Interactive layer" abstract class 18260 interactive: true, 18261 18262 // @option bubblingMouseEvents: Boolean = true 18263 // When `true`, a mouse event on this path will trigger the same event on the map 18264 // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used). 18265 bubblingMouseEvents: true 18266 }, 18267 18268 beforeAdd: function (map) { 18269 // Renderer is set here because we need to call renderer.getEvents 18270 // before this.getEvents. 18271 this._renderer = map.getRenderer(this); 18272 }, 18273 18274 onAdd: function () { 18275 this._renderer._initPath(this); 18276 this._reset(); 18277 this._renderer._addPath(this); 18278 }, 18279 18280 onRemove: function () { 18281 this._renderer._removePath(this); 18282 }, 18283 18284 // @method redraw(): this 18285 // Redraws the layer. Sometimes useful after you changed the coordinates that the path uses. 18286 redraw: function () { 18287 if (this._map) { 18288 this._renderer._updatePath(this); 18289 } 18290 return this; 18291 }, 18292 18293 // @method setStyle(style: Path options): this 18294 // Changes the appearance of a Path based on the options in the `Path options` object. 18295 setStyle: function (style) { 18296 setOptions(this, style); 18297 if (this._renderer) { 18298 this._renderer._updateStyle(this); 18299 if (this.options.stroke && style && style.hasOwnProperty('weight')) { 18300 this._updateBounds(); 18301 } 18302 } 18303 return this; 18304 }, 18305 18306 // @method bringToFront(): this 18307 // Brings the layer to the top of all path layers. 18308 bringToFront: function () { 18309 if (this._renderer) { 18310 this._renderer._bringToFront(this); 18311 } 18312 return this; 18313 }, 18314 18315 // @method bringToBack(): this 18316 // Brings the layer to the bottom of all path layers. 18317 bringToBack: function () { 18318 if (this._renderer) { 18319 this._renderer._bringToBack(this); 18320 } 18321 return this; 18322 }, 18323 18324 getElement: function () { 18325 return this._path; 18326 }, 18327 18328 _reset: function () { 18329 // defined in child classes 18330 this._project(); 18331 this._update(); 18332 }, 18333 18334 _clickTolerance: function () { 18335 // used when doing hit detection for Canvas layers 18336 return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance; 18337 } 18338}); 18339 18340/* 18341 * @class CircleMarker 18342 * @aka L.CircleMarker 18343 * @inherits Path 18344 * 18345 * A circle of a fixed size with radius specified in pixels. Extends `Path`. 18346 */ 18347 18348var CircleMarker = Path.extend({ 18349 18350 // @section 18351 // @aka CircleMarker options 18352 options: { 18353 fill: true, 18354 18355 // @option radius: Number = 10 18356 // Radius of the circle marker, in pixels 18357 radius: 10 18358 }, 18359 18360 initialize: function (latlng, options) { 18361 setOptions(this, options); 18362 this._latlng = toLatLng(latlng); 18363 this._radius = this.options.radius; 18364 }, 18365 18366 // @method setLatLng(latLng: LatLng): this 18367 // Sets the position of a circle marker to a new location. 18368 setLatLng: function (latlng) { 18369 var oldLatLng = this._latlng; 18370 this._latlng = toLatLng(latlng); 18371 this.redraw(); 18372 18373 // @event move: Event 18374 // Fired when the marker is moved via [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`. 18375 return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng}); 18376 }, 18377 18378 // @method getLatLng(): LatLng 18379 // Returns the current geographical position of the circle marker 18380 getLatLng: function () { 18381 return this._latlng; 18382 }, 18383 18384 // @method setRadius(radius: Number): this 18385 // Sets the radius of a circle marker. Units are in pixels. 18386 setRadius: function (radius) { 18387 this.options.radius = this._radius = radius; 18388 return this.redraw(); 18389 }, 18390 18391 // @method getRadius(): Number 18392 // Returns the current radius of the circle 18393 getRadius: function () { 18394 return this._radius; 18395 }, 18396 18397 setStyle : function (options) { 18398 var radius = options && options.radius || this._radius; 18399 Path.prototype.setStyle.call(this, options); 18400 this.setRadius(radius); 18401 return this; 18402 }, 18403 18404 _project: function () { 18405 this._point = this._map.latLngToLayerPoint(this._latlng); 18406 this._updateBounds(); 18407 }, 18408 18409 _updateBounds: function () { 18410 var r = this._radius, 18411 r2 = this._radiusY || r, 18412 w = this._clickTolerance(), 18413 p = [r + w, r2 + w]; 18414 this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p)); 18415 }, 18416 18417 _update: function () { 18418 if (this._map) { 18419 this._updatePath(); 18420 } 18421 }, 18422 18423 _updatePath: function () { 18424 this._renderer._updateCircle(this); 18425 }, 18426 18427 _empty: function () { 18428 return this._radius && !this._renderer._bounds.intersects(this._pxBounds); 18429 }, 18430 18431 // Needed by the `Canvas` renderer for interactivity 18432 _containsPoint: function (p) { 18433 return p.distanceTo(this._point) <= this._radius + this._clickTolerance(); 18434 } 18435}); 18436 18437 18438// @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options) 18439// Instantiates a circle marker object given a geographical point, and an optional options object. 18440function circleMarker(latlng, options) { 18441 return new CircleMarker(latlng, options); 18442} 18443 18444/* 18445 * @class Circle 18446 * @aka L.Circle 18447 * @inherits CircleMarker 18448 * 18449 * A class for drawing circle overlays on a map. Extends `CircleMarker`. 18450 * 18451 * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion). 18452 * 18453 * @example 18454 * 18455 * ```js 18456 * L.circle([50.5, 30.5], {radius: 200}).addTo(map); 18457 * ``` 18458 */ 18459 18460var Circle = CircleMarker.extend({ 18461 18462 initialize: function (latlng, options, legacyOptions) { 18463 if (typeof options === 'number') { 18464 // Backwards compatibility with 0.7.x factory (latlng, radius, options?) 18465 options = extend({}, legacyOptions, {radius: options}); 18466 } 18467 setOptions(this, options); 18468 this._latlng = toLatLng(latlng); 18469 18470 if (isNaN(this.options.radius)) { throw new Error('Circle radius cannot be NaN'); } 18471 18472 // @section 18473 // @aka Circle options 18474 // @option radius: Number; Radius of the circle, in meters. 18475 this._mRadius = this.options.radius; 18476 }, 18477 18478 // @method setRadius(radius: Number): this 18479 // Sets the radius of a circle. Units are in meters. 18480 setRadius: function (radius) { 18481 this._mRadius = radius; 18482 return this.redraw(); 18483 }, 18484 18485 // @method getRadius(): Number 18486 // Returns the current radius of a circle. Units are in meters. 18487 getRadius: function () { 18488 return this._mRadius; 18489 }, 18490 18491 // @method getBounds(): LatLngBounds 18492 // Returns the `LatLngBounds` of the path. 18493 getBounds: function () { 18494 var half = [this._radius, this._radiusY || this._radius]; 18495 18496 return new LatLngBounds( 18497 this._map.layerPointToLatLng(this._point.subtract(half)), 18498 this._map.layerPointToLatLng(this._point.add(half))); 18499 }, 18500 18501 setStyle: Path.prototype.setStyle, 18502 18503 _project: function () { 18504 18505 var lng = this._latlng.lng, 18506 lat = this._latlng.lat, 18507 map = this._map, 18508 crs = map.options.crs; 18509 18510 if (crs.distance === Earth.distance) { 18511 var d = Math.PI / 180, 18512 latR = (this._mRadius / Earth.R) / d, 18513 top = map.project([lat + latR, lng]), 18514 bottom = map.project([lat - latR, lng]), 18515 p = top.add(bottom).divideBy(2), 18516 lat2 = map.unproject(p).lat, 18517 lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) / 18518 (Math.cos(lat * d) * Math.cos(lat2 * d))) / d; 18519 18520 if (isNaN(lngR) || lngR === 0) { 18521 lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425 18522 } 18523 18524 this._point = p.subtract(map.getPixelOrigin()); 18525 this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x; 18526 this._radiusY = p.y - top.y; 18527 18528 } else { 18529 var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0])); 18530 18531 this._point = map.latLngToLayerPoint(this._latlng); 18532 this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x; 18533 } 18534 18535 this._updateBounds(); 18536 } 18537}); 18538 18539// @factory L.circle(latlng: LatLng, options?: Circle options) 18540// Instantiates a circle object given a geographical point, and an options object 18541// which contains the circle radius. 18542// @alternative 18543// @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options) 18544// Obsolete way of instantiating a circle, for compatibility with 0.7.x code. 18545// Do not use in new applications or plugins. 18546function circle(latlng, options, legacyOptions) { 18547 return new Circle(latlng, options, legacyOptions); 18548} 18549 18550/* 18551 * @class Polyline 18552 * @aka L.Polyline 18553 * @inherits Path 18554 * 18555 * A class for drawing polyline overlays on a map. Extends `Path`. 18556 * 18557 * @example 18558 * 18559 * ```js 18560 * // create a red polyline from an array of LatLng points 18561 * var latlngs = [ 18562 * [45.51, -122.68], 18563 * [37.77, -122.43], 18564 * [34.04, -118.2] 18565 * ]; 18566 * 18567 * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map); 18568 * 18569 * // zoom the map to the polyline 18570 * map.fitBounds(polyline.getBounds()); 18571 * ``` 18572 * 18573 * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape: 18574 * 18575 * ```js 18576 * // create a red polyline from an array of arrays of LatLng points 18577 * var latlngs = [ 18578 * [[45.51, -122.68], 18579 * [37.77, -122.43], 18580 * [34.04, -118.2]], 18581 * [[40.78, -73.91], 18582 * [41.83, -87.62], 18583 * [32.76, -96.72]] 18584 * ]; 18585 * ``` 18586 */ 18587 18588 18589var Polyline = Path.extend({ 18590 18591 // @section 18592 // @aka Polyline options 18593 options: { 18594 // @option smoothFactor: Number = 1.0 18595 // How much to simplify the polyline on each zoom level. More means 18596 // better performance and smoother look, and less means more accurate representation. 18597 smoothFactor: 1.0, 18598 18599 // @option noClip: Boolean = false 18600 // Disable polyline clipping. 18601 noClip: false 18602 }, 18603 18604 initialize: function (latlngs, options) { 18605 setOptions(this, options); 18606 this._setLatLngs(latlngs); 18607 }, 18608 18609 // @method getLatLngs(): LatLng[] 18610 // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline. 18611 getLatLngs: function () { 18612 return this._latlngs; 18613 }, 18614 18615 // @method setLatLngs(latlngs: LatLng[]): this 18616 // Replaces all the points in the polyline with the given array of geographical points. 18617 setLatLngs: function (latlngs) { 18618 this._setLatLngs(latlngs); 18619 return this.redraw(); 18620 }, 18621 18622 // @method isEmpty(): Boolean 18623 // Returns `true` if the Polyline has no LatLngs. 18624 isEmpty: function () { 18625 return !this._latlngs.length; 18626 }, 18627 18628 // @method closestLayerPoint(p: Point): Point 18629 // Returns the point closest to `p` on the Polyline. 18630 closestLayerPoint: function (p) { 18631 var minDistance = Infinity, 18632 minPoint = null, 18633 closest = _sqClosestPointOnSegment, 18634 p1, p2; 18635 18636 for (var j = 0, jLen = this._parts.length; j < jLen; j++) { 18637 var points = this._parts[j]; 18638 18639 for (var i = 1, len = points.length; i < len; i++) { 18640 p1 = points[i - 1]; 18641 p2 = points[i]; 18642 18643 var sqDist = closest(p, p1, p2, true); 18644 18645 if (sqDist < minDistance) { 18646 minDistance = sqDist; 18647 minPoint = closest(p, p1, p2); 18648 } 18649 } 18650 } 18651 if (minPoint) { 18652 minPoint.distance = Math.sqrt(minDistance); 18653 } 18654 return minPoint; 18655 }, 18656 18657 // @method getCenter(): LatLng 18658 // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline. 18659 getCenter: function () { 18660 // throws error when not yet added to map as this center calculation requires projected coordinates 18661 if (!this._map) { 18662 throw new Error('Must add layer to map before using getCenter()'); 18663 } 18664 18665 var i, halfDist, segDist, dist, p1, p2, ratio, 18666 points = this._rings[0], 18667 len = points.length; 18668 18669 if (!len) { return null; } 18670 18671 // polyline centroid algorithm; only uses the first ring if there are multiple 18672 18673 for (i = 0, halfDist = 0; i < len - 1; i++) { 18674 halfDist += points[i].distanceTo(points[i + 1]) / 2; 18675 } 18676 18677 // The line is so small in the current view that all points are on the same pixel. 18678 if (halfDist === 0) { 18679 return this._map.layerPointToLatLng(points[0]); 18680 } 18681 18682 for (i = 0, dist = 0; i < len - 1; i++) { 18683 p1 = points[i]; 18684 p2 = points[i + 1]; 18685 segDist = p1.distanceTo(p2); 18686 dist += segDist; 18687 18688 if (dist > halfDist) { 18689 ratio = (dist - halfDist) / segDist; 18690 return this._map.layerPointToLatLng([ 18691 p2.x - ratio * (p2.x - p1.x), 18692 p2.y - ratio * (p2.y - p1.y) 18693 ]); 18694 } 18695 } 18696 }, 18697 18698 // @method getBounds(): LatLngBounds 18699 // Returns the `LatLngBounds` of the path. 18700 getBounds: function () { 18701 return this._bounds; 18702 }, 18703 18704 // @method addLatLng(latlng: LatLng, latlngs? LatLng[]): this 18705 // Adds a given point to the polyline. By default, adds to the first ring of 18706 // the polyline in case of a multi-polyline, but can be overridden by passing 18707 // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)). 18708 addLatLng: function (latlng, latlngs) { 18709 latlngs = latlngs || this._defaultShape(); 18710 latlng = toLatLng(latlng); 18711 latlngs.push(latlng); 18712 this._bounds.extend(latlng); 18713 return this.redraw(); 18714 }, 18715 18716 _setLatLngs: function (latlngs) { 18717 this._bounds = new LatLngBounds(); 18718 this._latlngs = this._convertLatLngs(latlngs); 18719 }, 18720 18721 _defaultShape: function () { 18722 return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0]; 18723 }, 18724 18725 // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way 18726 _convertLatLngs: function (latlngs) { 18727 var result = [], 18728 flat = isFlat(latlngs); 18729 18730 for (var i = 0, len = latlngs.length; i < len; i++) { 18731 if (flat) { 18732 result[i] = toLatLng(latlngs[i]); 18733 this._bounds.extend(result[i]); 18734 } else { 18735 result[i] = this._convertLatLngs(latlngs[i]); 18736 } 18737 } 18738 18739 return result; 18740 }, 18741 18742 _project: function () { 18743 var pxBounds = new Bounds(); 18744 this._rings = []; 18745 this._projectLatlngs(this._latlngs, this._rings, pxBounds); 18746 18747 if (this._bounds.isValid() && pxBounds.isValid()) { 18748 this._rawPxBounds = pxBounds; 18749 this._updateBounds(); 18750 } 18751 }, 18752 18753 _updateBounds: function () { 18754 var w = this._clickTolerance(), 18755 p = new Point(w, w); 18756 this._pxBounds = new Bounds([ 18757 this._rawPxBounds.min.subtract(p), 18758 this._rawPxBounds.max.add(p) 18759 ]); 18760 }, 18761 18762 // recursively turns latlngs into a set of rings with projected coordinates 18763 _projectLatlngs: function (latlngs, result, projectedBounds) { 18764 var flat = latlngs[0] instanceof LatLng, 18765 len = latlngs.length, 18766 i, ring; 18767 18768 if (flat) { 18769 ring = []; 18770 for (i = 0; i < len; i++) { 18771 ring[i] = this._map.latLngToLayerPoint(latlngs[i]); 18772 projectedBounds.extend(ring[i]); 18773 } 18774 result.push(ring); 18775 } else { 18776 for (i = 0; i < len; i++) { 18777 this._projectLatlngs(latlngs[i], result, projectedBounds); 18778 } 18779 } 18780 }, 18781 18782 // clip polyline by renderer bounds so that we have less to render for performance 18783 _clipPoints: function () { 18784 var bounds = this._renderer._bounds; 18785 18786 this._parts = []; 18787 if (!this._pxBounds || !this._pxBounds.intersects(bounds)) { 18788 return; 18789 } 18790 18791 if (this.options.noClip) { 18792 this._parts = this._rings; 18793 return; 18794 } 18795 18796 var parts = this._parts, 18797 i, j, k, len, len2, segment, points; 18798 18799 for (i = 0, k = 0, len = this._rings.length; i < len; i++) { 18800 points = this._rings[i]; 18801 18802 for (j = 0, len2 = points.length; j < len2 - 1; j++) { 18803 segment = clipSegment(points[j], points[j + 1], bounds, j, true); 18804 18805 if (!segment) { continue; } 18806 18807 parts[k] = parts[k] || []; 18808 parts[k].push(segment[0]); 18809 18810 // if segment goes out of screen, or it's the last one, it's the end of the line part 18811 if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) { 18812 parts[k].push(segment[1]); 18813 k++; 18814 } 18815 } 18816 } 18817 }, 18818 18819 // simplify each clipped part of the polyline for performance 18820 _simplifyPoints: function () { 18821 var parts = this._parts, 18822 tolerance = this.options.smoothFactor; 18823 18824 for (var i = 0, len = parts.length; i < len; i++) { 18825 parts[i] = simplify(parts[i], tolerance); 18826 } 18827 }, 18828 18829 _update: function () { 18830 if (!this._map) { return; } 18831 18832 this._clipPoints(); 18833 this._simplifyPoints(); 18834 this._updatePath(); 18835 }, 18836 18837 _updatePath: function () { 18838 this._renderer._updatePoly(this); 18839 }, 18840 18841 // Needed by the `Canvas` renderer for interactivity 18842 _containsPoint: function (p, closed) { 18843 var i, j, k, len, len2, part, 18844 w = this._clickTolerance(); 18845 18846 if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; } 18847 18848 // hit detection for polylines 18849 for (i = 0, len = this._parts.length; i < len; i++) { 18850 part = this._parts[i]; 18851 18852 for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) { 18853 if (!closed && (j === 0)) { continue; } 18854 18855 if (pointToSegmentDistance(p, part[k], part[j]) <= w) { 18856 return true; 18857 } 18858 } 18859 } 18860 return false; 18861 } 18862}); 18863 18864// @factory L.polyline(latlngs: LatLng[], options?: Polyline options) 18865// Instantiates a polyline object given an array of geographical points and 18866// optionally an options object. You can create a `Polyline` object with 18867// multiple separate lines (`MultiPolyline`) by passing an array of arrays 18868// of geographic points. 18869function polyline(latlngs, options) { 18870 return new Polyline(latlngs, options); 18871} 18872 18873// Retrocompat. Allow plugins to support Leaflet versions before and after 1.1. 18874Polyline._flat = _flat; 18875 18876/* 18877 * @class Polygon 18878 * @aka L.Polygon 18879 * @inherits Polyline 18880 * 18881 * A class for drawing polygon overlays on a map. Extends `Polyline`. 18882 * 18883 * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one â it's better to filter out such points. 18884 * 18885 * 18886 * @example 18887 * 18888 * ```js 18889 * // create a red polygon from an array of LatLng points 18890 * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]]; 18891 * 18892 * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map); 18893 * 18894 * // zoom the map to the polygon 18895 * map.fitBounds(polygon.getBounds()); 18896 * ``` 18897 * 18898 * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape: 18899 * 18900 * ```js 18901 * var latlngs = [ 18902 * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring 18903 * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole 18904 * ]; 18905 * ``` 18906 * 18907 * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape. 18908 * 18909 * ```js 18910 * var latlngs = [ 18911 * [ // first polygon 18912 * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring 18913 * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole 18914 * ], 18915 * [ // second polygon 18916 * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]] 18917 * ] 18918 * ]; 18919 * ``` 18920 */ 18921 18922var Polygon = Polyline.extend({ 18923 18924 options: { 18925 fill: true 18926 }, 18927 18928 isEmpty: function () { 18929 return !this._latlngs.length || !this._latlngs[0].length; 18930 }, 18931 18932 getCenter: function () { 18933 // throws error when not yet added to map as this center calculation requires projected coordinates 18934 if (!this._map) { 18935 throw new Error('Must add layer to map before using getCenter()'); 18936 } 18937 18938 var i, j, p1, p2, f, area, x, y, center, 18939 points = this._rings[0], 18940 len = points.length; 18941 18942 if (!len) { return null; } 18943 18944 // polygon centroid algorithm; only uses the first ring if there are multiple 18945 18946 area = x = y = 0; 18947 18948 for (i = 0, j = len - 1; i < len; j = i++) { 18949 p1 = points[i]; 18950 p2 = points[j]; 18951 18952 f = p1.y * p2.x - p2.y * p1.x; 18953 x += (p1.x + p2.x) * f; 18954 y += (p1.y + p2.y) * f; 18955 area += f * 3; 18956 } 18957 18958 if (area === 0) { 18959 // Polygon is so small that all points are on same pixel. 18960 center = points[0]; 18961 } else { 18962 center = [x / area, y / area]; 18963 } 18964 return this._map.layerPointToLatLng(center); 18965 }, 18966 18967 _convertLatLngs: function (latlngs) { 18968 var result = Polyline.prototype._convertLatLngs.call(this, latlngs), 18969 len = result.length; 18970 18971 // remove last point if it equals first one 18972 if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) { 18973 result.pop(); 18974 } 18975 return result; 18976 }, 18977 18978 _setLatLngs: function (latlngs) { 18979 Polyline.prototype._setLatLngs.call(this, latlngs); 18980 if (isFlat(this._latlngs)) { 18981 this._latlngs = [this._latlngs]; 18982 } 18983 }, 18984 18985 _defaultShape: function () { 18986 return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0]; 18987 }, 18988 18989 _clipPoints: function () { 18990 // polygons need a different clipping algorithm so we redefine that 18991 18992 var bounds = this._renderer._bounds, 18993 w = this.options.weight, 18994 p = new Point(w, w); 18995 18996 // increase clip padding by stroke width to avoid stroke on clip edges 18997 bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p)); 18998 18999 this._parts = []; 19000 if (!this._pxBounds || !this._pxBounds.intersects(bounds)) { 19001 return; 19002 } 19003 19004 if (this.options.noClip) { 19005 this._parts = this._rings; 19006 return; 19007 } 19008 19009 for (var i = 0, len = this._rings.length, clipped; i < len; i++) { 19010 clipped = clipPolygon(this._rings[i], bounds, true); 19011 if (clipped.length) { 19012 this._parts.push(clipped); 19013 } 19014 } 19015 }, 19016 19017 _updatePath: function () { 19018 this._renderer._updatePoly(this, true); 19019 }, 19020 19021 // Needed by the `Canvas` renderer for interactivity 19022 _containsPoint: function (p) { 19023 var inside = false, 19024 part, p1, p2, i, j, k, len, len2; 19025 19026 if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; } 19027 19028 // ray casting algorithm for detecting if point is in polygon 19029 for (i = 0, len = this._parts.length; i < len; i++) { 19030 part = this._parts[i]; 19031 19032 for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) { 19033 p1 = part[j]; 19034 p2 = part[k]; 19035 19036 if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { 19037 inside = !inside; 19038 } 19039 } 19040 } 19041 19042 // also check if it's on polygon stroke 19043 return inside || Polyline.prototype._containsPoint.call(this, p, true); 19044 } 19045 19046}); 19047 19048 19049// @factory L.polygon(latlngs: LatLng[], options?: Polyline options) 19050function polygon(latlngs, options) { 19051 return new Polygon(latlngs, options); 19052} 19053 19054/* 19055 * @class GeoJSON 19056 * @aka L.GeoJSON 19057 * @inherits FeatureGroup 19058 * 19059 * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse 19060 * GeoJSON data and display it on the map. Extends `FeatureGroup`. 19061 * 19062 * @example 19063 * 19064 * ```js 19065 * L.geoJSON(data, { 19066 * style: function (feature) { 19067 * return {color: feature.properties.color}; 19068 * } 19069 * }).bindPopup(function (layer) { 19070 * return layer.feature.properties.description; 19071 * }).addTo(map); 19072 * ``` 19073 */ 19074 19075var GeoJSON = FeatureGroup.extend({ 19076 19077 /* @section 19078 * @aka GeoJSON options 19079 * 19080 * @option pointToLayer: Function = * 19081 * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally 19082 * called when data is added, passing the GeoJSON point feature and its `LatLng`. 19083 * The default is to spawn a default `Marker`: 19084 * ```js 19085 * function(geoJsonPoint, latlng) { 19086 * return L.marker(latlng); 19087 * } 19088 * ``` 19089 * 19090 * @option style: Function = * 19091 * A `Function` defining the `Path options` for styling GeoJSON lines and polygons, 19092 * called internally when data is added. 19093 * The default value is to not override any defaults: 19094 * ```js 19095 * function (geoJsonFeature) { 19096 * return {} 19097 * } 19098 * ``` 19099 * 19100 * @option onEachFeature: Function = * 19101 * A `Function` that will be called once for each created `Feature`, after it has 19102 * been created and styled. Useful for attaching events and popups to features. 19103 * The default is to do nothing with the newly created layers: 19104 * ```js 19105 * function (feature, layer) {} 19106 * ``` 19107 * 19108 * @option filter: Function = * 19109 * A `Function` that will be used to decide whether to include a feature or not. 19110 * The default is to include all features: 19111 * ```js 19112 * function (geoJsonFeature) { 19113 * return true; 19114 * } 19115 * ``` 19116 * Note: dynamically changing the `filter` option will have effect only on newly 19117 * added data. It will _not_ re-evaluate already included features. 19118 * 19119 * @option coordsToLatLng: Function = * 19120 * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s. 19121 * The default is the `coordsToLatLng` static method. 19122 * 19123 * @option markersInheritOptions: Boolean = false 19124 * Whether default Markers for "Point" type Features inherit from group options. 19125 */ 19126 19127 initialize: function (geojson, options) { 19128 setOptions(this, options); 19129 19130 this._layers = {}; 19131 19132 if (geojson) { 19133 this.addData(geojson); 19134 } 19135 }, 19136 19137 // @method addData( <GeoJSON> data ): this 19138 // Adds a GeoJSON object to the layer. 19139 addData: function (geojson) { 19140 var features = isArray(geojson) ? geojson : geojson.features, 19141 i, len, feature; 19142 19143 if (features) { 19144 for (i = 0, len = features.length; i < len; i++) { 19145 // only add this if geometry or geometries are set and not null 19146 feature = features[i]; 19147 if (feature.geometries || feature.geometry || feature.features || feature.coordinates) { 19148 this.addData(feature); 19149 } 19150 } 19151 return this; 19152 } 19153 19154 var options = this.options; 19155 19156 if (options.filter && !options.filter(geojson)) { return this; } 19157 19158 var layer = geometryToLayer(geojson, options); 19159 if (!layer) { 19160 return this; 19161 } 19162 layer.feature = asFeature(geojson); 19163 19164 layer.defaultOptions = layer.options; 19165 this.resetStyle(layer); 19166 19167 if (options.onEachFeature) { 19168 options.onEachFeature(geojson, layer); 19169 } 19170 19171 return this.addLayer(layer); 19172 }, 19173 19174 // @method resetStyle( <Path> layer? ): this 19175 // Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events. 19176 // If `layer` is omitted, the style of all features in the current layer is reset. 19177 resetStyle: function (layer) { 19178 if (layer === undefined) { 19179 return this.eachLayer(this.resetStyle, this); 19180 } 19181 // reset any custom styles 19182 layer.options = extend({}, layer.defaultOptions); 19183 this._setLayerStyle(layer, this.options.style); 19184 return this; 19185 }, 19186 19187 // @method setStyle( <Function> style ): this 19188 // Changes styles of GeoJSON vector layers with the given style function. 19189 setStyle: function (style) { 19190 return this.eachLayer(function (layer) { 19191 this._setLayerStyle(layer, style); 19192 }, this); 19193 }, 19194 19195 _setLayerStyle: function (layer, style) { 19196 if (layer.setStyle) { 19197 if (typeof style === 'function') { 19198 style = style(layer.feature); 19199 } 19200 layer.setStyle(style); 19201 } 19202 } 19203}); 19204 19205// @section 19206// There are several static functions which can be called without instantiating L.GeoJSON: 19207 19208// @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer 19209// Creates a `Layer` from a given GeoJSON feature. Can use a custom 19210// [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng) 19211// functions if provided as options. 19212function geometryToLayer(geojson, options) { 19213 19214 var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson, 19215 coords = geometry ? geometry.coordinates : null, 19216 layers = [], 19217 pointToLayer = options && options.pointToLayer, 19218 _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng, 19219 latlng, latlngs, i, len; 19220 19221 if (!coords && !geometry) { 19222 return null; 19223 } 19224 19225 switch (geometry.type) { 19226 case 'Point': 19227 latlng = _coordsToLatLng(coords); 19228 return _pointToLayer(pointToLayer, geojson, latlng, options); 19229 19230 case 'MultiPoint': 19231 for (i = 0, len = coords.length; i < len; i++) { 19232 latlng = _coordsToLatLng(coords[i]); 19233 layers.push(_pointToLayer(pointToLayer, geojson, latlng, options)); 19234 } 19235 return new FeatureGroup(layers); 19236 19237 case 'LineString': 19238 case 'MultiLineString': 19239 latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng); 19240 return new Polyline(latlngs, options); 19241 19242 case 'Polygon': 19243 case 'MultiPolygon': 19244 latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng); 19245 return new Polygon(latlngs, options); 19246 19247 case 'GeometryCollection': 19248 for (i = 0, len = geometry.geometries.length; i < len; i++) { 19249 var layer = geometryToLayer({ 19250 geometry: geometry.geometries[i], 19251 type: 'Feature', 19252 properties: geojson.properties 19253 }, options); 19254 19255 if (layer) { 19256 layers.push(layer); 19257 } 19258 } 19259 return new FeatureGroup(layers); 19260 19261 default: 19262 throw new Error('Invalid GeoJSON object.'); 19263 } 19264} 19265 19266function _pointToLayer(pointToLayerFn, geojson, latlng, options) { 19267 return pointToLayerFn ? 19268 pointToLayerFn(geojson, latlng) : 19269 new Marker(latlng, options && options.markersInheritOptions && options); 19270} 19271 19272// @function coordsToLatLng(coords: Array): LatLng 19273// Creates a `LatLng` object from an array of 2 numbers (longitude, latitude) 19274// or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points. 19275function coordsToLatLng(coords) { 19276 return new LatLng(coords[1], coords[0], coords[2]); 19277} 19278 19279// @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array 19280// Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array. 19281// `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). 19282// Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function. 19283function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) { 19284 var latlngs = []; 19285 19286 for (var i = 0, len = coords.length, latlng; i < len; i++) { 19287 latlng = levelsDeep ? 19288 coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) : 19289 (_coordsToLatLng || coordsToLatLng)(coords[i]); 19290 19291 latlngs.push(latlng); 19292 } 19293 19294 return latlngs; 19295} 19296 19297// @function latLngToCoords(latlng: LatLng, precision?: Number): Array 19298// Reverse of [`coordsToLatLng`](#geojson-coordstolatlng) 19299function latLngToCoords(latlng, precision) { 19300 precision = typeof precision === 'number' ? precision : 6; 19301 return latlng.alt !== undefined ? 19302 [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] : 19303 [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)]; 19304} 19305 19306// @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array 19307// Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs) 19308// `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default. 19309function latLngsToCoords(latlngs, levelsDeep, closed, precision) { 19310 var coords = []; 19311 19312 for (var i = 0, len = latlngs.length; i < len; i++) { 19313 coords.push(levelsDeep ? 19314 latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) : 19315 latLngToCoords(latlngs[i], precision)); 19316 } 19317 19318 if (!levelsDeep && closed) { 19319 coords.push(coords[0]); 19320 } 19321 19322 return coords; 19323} 19324 19325function getFeature(layer, newGeometry) { 19326 return layer.feature ? 19327 extend({}, layer.feature, {geometry: newGeometry}) : 19328 asFeature(newGeometry); 19329} 19330 19331// @function asFeature(geojson: Object): Object 19332// Normalize GeoJSON geometries/features into GeoJSON features. 19333function asFeature(geojson) { 19334 if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') { 19335 return geojson; 19336 } 19337 19338 return { 19339 type: 'Feature', 19340 properties: {}, 19341 geometry: geojson 19342 }; 19343} 19344 19345var PointToGeoJSON = { 19346 toGeoJSON: function (precision) { 19347 return getFeature(this, { 19348 type: 'Point', 19349 coordinates: latLngToCoords(this.getLatLng(), precision) 19350 }); 19351 } 19352}; 19353 19354// @namespace Marker 19355// @section Other methods 19356// @method toGeoJSON(precision?: Number): Object 19357// `precision` is the number of decimal places for coordinates. 19358// The default value is 6 places. 19359// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature). 19360Marker.include(PointToGeoJSON); 19361 19362// @namespace CircleMarker 19363// @method toGeoJSON(precision?: Number): Object 19364// `precision` is the number of decimal places for coordinates. 19365// The default value is 6 places. 19366// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature). 19367Circle.include(PointToGeoJSON); 19368CircleMarker.include(PointToGeoJSON); 19369 19370 19371// @namespace Polyline 19372// @method toGeoJSON(precision?: Number): Object 19373// `precision` is the number of decimal places for coordinates. 19374// The default value is 6 places. 19375// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature). 19376Polyline.include({ 19377 toGeoJSON: function (precision) { 19378 var multi = !isFlat(this._latlngs); 19379 19380 var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision); 19381 19382 return getFeature(this, { 19383 type: (multi ? 'Multi' : '') + 'LineString', 19384 coordinates: coords 19385 }); 19386 } 19387}); 19388 19389// @namespace Polygon 19390// @method toGeoJSON(precision?: Number): Object 19391// `precision` is the number of decimal places for coordinates. 19392// The default value is 6 places. 19393// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature). 19394Polygon.include({ 19395 toGeoJSON: function (precision) { 19396 var holes = !isFlat(this._latlngs), 19397 multi = holes && !isFlat(this._latlngs[0]); 19398 19399 var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision); 19400 19401 if (!holes) { 19402 coords = [coords]; 19403 } 19404 19405 return getFeature(this, { 19406 type: (multi ? 'Multi' : '') + 'Polygon', 19407 coordinates: coords 19408 }); 19409 } 19410}); 19411 19412 19413// @namespace LayerGroup 19414LayerGroup.include({ 19415 toMultiPoint: function (precision) { 19416 var coords = []; 19417 19418 this.eachLayer(function (layer) { 19419 coords.push(layer.toGeoJSON(precision).geometry.coordinates); 19420 }); 19421 19422 return getFeature(this, { 19423 type: 'MultiPoint', 19424 coordinates: coords 19425 }); 19426 }, 19427 19428 // @method toGeoJSON(precision?: Number): Object 19429 // `precision` is the number of decimal places for coordinates. 19430 // The default value is 6 places. 19431 // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`). 19432 toGeoJSON: function (precision) { 19433 19434 var type = this.feature && this.feature.geometry && this.feature.geometry.type; 19435 19436 if (type === 'MultiPoint') { 19437 return this.toMultiPoint(precision); 19438 } 19439 19440 var isGeometryCollection = type === 'GeometryCollection', 19441 jsons = []; 19442 19443 this.eachLayer(function (layer) { 19444 if (layer.toGeoJSON) { 19445 var json = layer.toGeoJSON(precision); 19446 if (isGeometryCollection) { 19447 jsons.push(json.geometry); 19448 } else { 19449 var feature = asFeature(json); 19450 // Squash nested feature collections 19451 if (feature.type === 'FeatureCollection') { 19452 jsons.push.apply(jsons, feature.features); 19453 } else { 19454 jsons.push(feature); 19455 } 19456 } 19457 } 19458 }); 19459 19460 if (isGeometryCollection) { 19461 return getFeature(this, { 19462 geometries: jsons, 19463 type: 'GeometryCollection' 19464 }); 19465 } 19466 19467 return { 19468 type: 'FeatureCollection', 19469 features: jsons 19470 }; 19471 } 19472}); 19473 19474// @namespace GeoJSON 19475// @factory L.geoJSON(geojson?: Object, options?: GeoJSON options) 19476// Creates a GeoJSON layer. Optionally accepts an object in 19477// [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map 19478// (you can alternatively add it later with `addData` method) and an `options` object. 19479function geoJSON(geojson, options) { 19480 return new GeoJSON(geojson, options); 19481} 19482 19483// Backward compatibility. 19484var geoJson = geoJSON; 19485 19486/* 19487 * @class ImageOverlay 19488 * @aka L.ImageOverlay 19489 * @inherits Interactive layer 19490 * 19491 * Used to load and display a single image over specific bounds of the map. Extends `Layer`. 19492 * 19493 * @example 19494 * 19495 * ```js 19496 * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg', 19497 * imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]]; 19498 * L.imageOverlay(imageUrl, imageBounds).addTo(map); 19499 * ``` 19500 */ 19501 19502var ImageOverlay = Layer.extend({ 19503 19504 // @section 19505 // @aka ImageOverlay options 19506 options: { 19507 // @option opacity: Number = 1.0 19508 // The opacity of the image overlay. 19509 opacity: 1, 19510 19511 // @option alt: String = '' 19512 // Text for the `alt` attribute of the image (useful for accessibility). 19513 alt: '', 19514 19515 // @option interactive: Boolean = false 19516 // If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered. 19517 interactive: false, 19518 19519 // @option crossOrigin: Boolean|String = false 19520 // Whether the crossOrigin attribute will be added to the image. 19521 // If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data. 19522 // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values. 19523 crossOrigin: false, 19524 19525 // @option errorOverlayUrl: String = '' 19526 // URL to the overlay image to show in place of the overlay that failed to load. 19527 errorOverlayUrl: '', 19528 19529 // @option zIndex: Number = 1 19530 // The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer. 19531 zIndex: 1, 19532 19533 // @option className: String = '' 19534 // A custom class name to assign to the image. Empty by default. 19535 className: '' 19536 }, 19537 19538 initialize: function (url, bounds, options) { // (String, LatLngBounds, Object) 19539 this._url = url; 19540 this._bounds = toLatLngBounds(bounds); 19541 19542 setOptions(this, options); 19543 }, 19544 19545 onAdd: function () { 19546 if (!this._image) { 19547 this._initImage(); 19548 19549 if (this.options.opacity < 1) { 19550 this._updateOpacity(); 19551 } 19552 } 19553 19554 if (this.options.interactive) { 19555 addClass(this._image, 'leaflet-interactive'); 19556 this.addInteractiveTarget(this._image); 19557 } 19558 19559 this.getPane().appendChild(this._image); 19560 this._reset(); 19561 }, 19562 19563 onRemove: function () { 19564 remove(this._image); 19565 if (this.options.interactive) { 19566 this.removeInteractiveTarget(this._image); 19567 } 19568 }, 19569 19570 // @method setOpacity(opacity: Number): this 19571 // Sets the opacity of the overlay. 19572 setOpacity: function (opacity) { 19573 this.options.opacity = opacity; 19574 19575 if (this._image) { 19576 this._updateOpacity(); 19577 } 19578 return this; 19579 }, 19580 19581 setStyle: function (styleOpts) { 19582 if (styleOpts.opacity) { 19583 this.setOpacity(styleOpts.opacity); 19584 } 19585 return this; 19586 }, 19587 19588 // @method bringToFront(): this 19589 // Brings the layer to the top of all overlays. 19590 bringToFront: function () { 19591 if (this._map) { 19592 toFront(this._image); 19593 } 19594 return this; 19595 }, 19596 19597 // @method bringToBack(): this 19598 // Brings the layer to the bottom of all overlays. 19599 bringToBack: function () { 19600 if (this._map) { 19601 toBack(this._image); 19602 } 19603 return this; 19604 }, 19605 19606 // @method setUrl(url: String): this 19607 // Changes the URL of the image. 19608 setUrl: function (url) { 19609 this._url = url; 19610 19611 if (this._image) { 19612 this._image.src = url; 19613 } 19614 return this; 19615 }, 19616 19617 // @method setBounds(bounds: LatLngBounds): this 19618 // Update the bounds that this ImageOverlay covers 19619 setBounds: function (bounds) { 19620 this._bounds = toLatLngBounds(bounds); 19621 19622 if (this._map) { 19623 this._reset(); 19624 } 19625 return this; 19626 }, 19627 19628 getEvents: function () { 19629 var events = { 19630 zoom: this._reset, 19631 viewreset: this._reset 19632 }; 19633 19634 if (this._zoomAnimated) { 19635 events.zoomanim = this._animateZoom; 19636 } 19637 19638 return events; 19639 }, 19640 19641 // @method setZIndex(value: Number): this 19642 // Changes the [zIndex](#imageoverlay-zindex) of the image overlay. 19643 setZIndex: function (value) { 19644 this.options.zIndex = value; 19645 this._updateZIndex(); 19646 return this; 19647 }, 19648 19649 // @method getBounds(): LatLngBounds 19650 // Get the bounds that this ImageOverlay covers 19651 getBounds: function () { 19652 return this._bounds; 19653 }, 19654 19655 // @method getElement(): HTMLElement 19656 // Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement) 19657 // used by this overlay. 19658 getElement: function () { 19659 return this._image; 19660 }, 19661 19662 _initImage: function () { 19663 var wasElementSupplied = this._url.tagName === 'IMG'; 19664 var img = this._image = wasElementSupplied ? this._url : create$1('img'); 19665 19666 addClass(img, 'leaflet-image-layer'); 19667 if (this._zoomAnimated) { addClass(img, 'leaflet-zoom-animated'); } 19668 if (this.options.className) { addClass(img, this.options.className); } 19669 19670 img.onselectstart = falseFn; 19671 img.onmousemove = falseFn; 19672 19673 // @event load: Event 19674 // Fired when the ImageOverlay layer has loaded its image 19675 img.onload = bind(this.fire, this, 'load'); 19676 img.onerror = bind(this._overlayOnError, this, 'error'); 19677 19678 if (this.options.crossOrigin || this.options.crossOrigin === '') { 19679 img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin; 19680 } 19681 19682 if (this.options.zIndex) { 19683 this._updateZIndex(); 19684 } 19685 19686 if (wasElementSupplied) { 19687 this._url = img.src; 19688 return; 19689 } 19690 19691 img.src = this._url; 19692 img.alt = this.options.alt; 19693 }, 19694 19695 _animateZoom: function (e) { 19696 var scale = this._map.getZoomScale(e.zoom), 19697 offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min; 19698 19699 setTransform(this._image, offset, scale); 19700 }, 19701 19702 _reset: function () { 19703 var image = this._image, 19704 bounds = new Bounds( 19705 this._map.latLngToLayerPoint(this._bounds.getNorthWest()), 19706 this._map.latLngToLayerPoint(this._bounds.getSouthEast())), 19707 size = bounds.getSize(); 19708 19709 setPosition(image, bounds.min); 19710 19711 image.style.width = size.x + 'px'; 19712 image.style.height = size.y + 'px'; 19713 }, 19714 19715 _updateOpacity: function () { 19716 setOpacity(this._image, this.options.opacity); 19717 }, 19718 19719 _updateZIndex: function () { 19720 if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) { 19721 this._image.style.zIndex = this.options.zIndex; 19722 } 19723 }, 19724 19725 _overlayOnError: function () { 19726 // @event error: Event 19727 // Fired when the ImageOverlay layer fails to load its image 19728 this.fire('error'); 19729 19730 var errorUrl = this.options.errorOverlayUrl; 19731 if (errorUrl && this._url !== errorUrl) { 19732 this._url = errorUrl; 19733 this._image.src = errorUrl; 19734 } 19735 } 19736}); 19737 19738// @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options) 19739// Instantiates an image overlay object given the URL of the image and the 19740// geographical bounds it is tied to. 19741var imageOverlay = function (url, bounds, options) { 19742 return new ImageOverlay(url, bounds, options); 19743}; 19744 19745/* 19746 * @class VideoOverlay 19747 * @aka L.VideoOverlay 19748 * @inherits ImageOverlay 19749 * 19750 * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`. 19751 * 19752 * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video) 19753 * HTML5 element. 19754 * 19755 * @example 19756 * 19757 * ```js 19758 * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm', 19759 * videoBounds = [[ 32, -130], [ 13, -100]]; 19760 * L.videoOverlay(videoUrl, videoBounds ).addTo(map); 19761 * ``` 19762 */ 19763 19764var VideoOverlay = ImageOverlay.extend({ 19765 19766 // @section 19767 // @aka VideoOverlay options 19768 options: { 19769 // @option autoplay: Boolean = true 19770 // Whether the video starts playing automatically when loaded. 19771 autoplay: true, 19772 19773 // @option loop: Boolean = true 19774 // Whether the video will loop back to the beginning when played. 19775 loop: true, 19776 19777 // @option keepAspectRatio: Boolean = true 19778 // Whether the video will save aspect ratio after the projection. 19779 // Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit 19780 keepAspectRatio: true 19781 }, 19782 19783 _initImage: function () { 19784 var wasElementSupplied = this._url.tagName === 'VIDEO'; 19785 var vid = this._image = wasElementSupplied ? this._url : create$1('video'); 19786 19787 addClass(vid, 'leaflet-image-layer'); 19788 if (this._zoomAnimated) { addClass(vid, 'leaflet-zoom-animated'); } 19789 if (this.options.className) { addClass(vid, this.options.className); } 19790 19791 vid.onselectstart = falseFn; 19792 vid.onmousemove = falseFn; 19793 19794 // @event load: Event 19795 // Fired when the video has finished loading the first frame 19796 vid.onloadeddata = bind(this.fire, this, 'load'); 19797 19798 if (wasElementSupplied) { 19799 var sourceElements = vid.getElementsByTagName('source'); 19800 var sources = []; 19801 for (var j = 0; j < sourceElements.length; j++) { 19802 sources.push(sourceElements[j].src); 19803 } 19804 19805 this._url = (sourceElements.length > 0) ? sources : [vid.src]; 19806 return; 19807 } 19808 19809 if (!isArray(this._url)) { this._url = [this._url]; } 19810 19811 if (!this.options.keepAspectRatio && vid.style.hasOwnProperty('objectFit')) { vid.style['objectFit'] = 'fill'; } 19812 vid.autoplay = !!this.options.autoplay; 19813 vid.loop = !!this.options.loop; 19814 for (var i = 0; i < this._url.length; i++) { 19815 var source = create$1('source'); 19816 source.src = this._url[i]; 19817 vid.appendChild(source); 19818 } 19819 } 19820 19821 // @method getElement(): HTMLVideoElement 19822 // Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement) 19823 // used by this overlay. 19824}); 19825 19826 19827// @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options) 19828// Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the 19829// geographical bounds it is tied to. 19830 19831function videoOverlay(video, bounds, options) { 19832 return new VideoOverlay(video, bounds, options); 19833} 19834 19835/* 19836 * @class SVGOverlay 19837 * @aka L.SVGOverlay 19838 * @inherits ImageOverlay 19839 * 19840 * Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends `ImageOverlay`. 19841 * 19842 * An SVG overlay uses the [`<svg>`](https://developer.mozilla.org/docs/Web/SVG/Element/svg) element. 19843 * 19844 * @example 19845 * 19846 * ```js 19847 * var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 19848 * svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg"); 19849 * svgElement.setAttribute('viewBox', "0 0 200 200"); 19850 * svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>'; 19851 * var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ]; 19852 * L.svgOverlay(svgElement, svgElementBounds).addTo(map); 19853 * ``` 19854 */ 19855 19856var SVGOverlay = ImageOverlay.extend({ 19857 _initImage: function () { 19858 var el = this._image = this._url; 19859 19860 addClass(el, 'leaflet-image-layer'); 19861 if (this._zoomAnimated) { addClass(el, 'leaflet-zoom-animated'); } 19862 if (this.options.className) { addClass(el, this.options.className); } 19863 19864 el.onselectstart = falseFn; 19865 el.onmousemove = falseFn; 19866 } 19867 19868 // @method getElement(): SVGElement 19869 // Returns the instance of [`SVGElement`](https://developer.mozilla.org/docs/Web/API/SVGElement) 19870 // used by this overlay. 19871}); 19872 19873 19874// @factory L.svgOverlay(svg: String|SVGElement, bounds: LatLngBounds, options?: SVGOverlay options) 19875// Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to. 19876// A viewBox attribute is required on the SVG element to zoom in and out properly. 19877 19878function svgOverlay(el, bounds, options) { 19879 return new SVGOverlay(el, bounds, options); 19880} 19881 19882/* 19883 * @class DivOverlay 19884 * @inherits Layer 19885 * @aka L.DivOverlay 19886 * Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins. 19887 */ 19888 19889// @namespace DivOverlay 19890var DivOverlay = Layer.extend({ 19891 19892 // @section 19893 // @aka DivOverlay options 19894 options: { 19895 // @option offset: Point = Point(0, 7) 19896 // The offset of the popup position. Useful to control the anchor 19897 // of the popup when opening it on some overlays. 19898 offset: [0, 7], 19899 19900 // @option className: String = '' 19901 // A custom CSS class name to assign to the popup. 19902 className: '', 19903 19904 // @option pane: String = 'popupPane' 19905 // `Map pane` where the popup will be added. 19906 pane: 'popupPane' 19907 }, 19908 19909 initialize: function (options, source) { 19910 setOptions(this, options); 19911 19912 this._source = source; 19913 }, 19914 19915 onAdd: function (map) { 19916 this._zoomAnimated = map._zoomAnimated; 19917 19918 if (!this._container) { 19919 this._initLayout(); 19920 } 19921 19922 if (map._fadeAnimated) { 19923 setOpacity(this._container, 0); 19924 } 19925 19926 clearTimeout(this._removeTimeout); 19927 this.getPane().appendChild(this._container); 19928 this.update(); 19929 19930 if (map._fadeAnimated) { 19931 setOpacity(this._container, 1); 19932 } 19933 19934 this.bringToFront(); 19935 }, 19936 19937 onRemove: function (map) { 19938 if (map._fadeAnimated) { 19939 setOpacity(this._container, 0); 19940 this._removeTimeout = setTimeout(bind(remove, undefined, this._container), 200); 19941 } else { 19942 remove(this._container); 19943 } 19944 }, 19945 19946 // @namespace Popup 19947 // @method getLatLng: LatLng 19948 // Returns the geographical point of popup. 19949 getLatLng: function () { 19950 return this._latlng; 19951 }, 19952 19953 // @method setLatLng(latlng: LatLng): this 19954 // Sets the geographical point where the popup will open. 19955 setLatLng: function (latlng) { 19956 this._latlng = toLatLng(latlng); 19957 if (this._map) { 19958 this._updatePosition(); 19959 this._adjustPan(); 19960 } 19961 return this; 19962 }, 19963 19964 // @method getContent: String|HTMLElement 19965 // Returns the content of the popup. 19966 getContent: function () { 19967 return this._content; 19968 }, 19969 19970 // @method setContent(htmlContent: String|HTMLElement|Function): this 19971 // Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a `String` or `HTMLElement` to be used in the popup. 19972 setContent: function (content) { 19973 this._content = content; 19974 this.update(); 19975 return this; 19976 }, 19977 19978 // @method getElement: String|HTMLElement 19979 // Alias for [getContent()](#popup-getcontent) 19980 getElement: function () { 19981 return this._container; 19982 }, 19983 19984 // @method update: null 19985 // Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded. 19986 update: function () { 19987 if (!this._map) { return; } 19988 19989 this._container.style.visibility = 'hidden'; 19990 19991 this._updateContent(); 19992 this._updateLayout(); 19993 this._updatePosition(); 19994 19995 this._container.style.visibility = ''; 19996 19997 this._adjustPan(); 19998 }, 19999 20000 getEvents: function () { 20001 var events = { 20002 zoom: this._updatePosition, 20003 viewreset: this._updatePosition 20004 }; 20005 20006 if (this._zoomAnimated) { 20007 events.zoomanim = this._animateZoom; 20008 } 20009 return events; 20010 }, 20011 20012 // @method isOpen: Boolean 20013 // Returns `true` when the popup is visible on the map. 20014 isOpen: function () { 20015 return !!this._map && this._map.hasLayer(this); 20016 }, 20017 20018 // @method bringToFront: this 20019 // Brings this popup in front of other popups (in the same map pane). 20020 bringToFront: function () { 20021 if (this._map) { 20022 toFront(this._container); 20023 } 20024 return this; 20025 }, 20026 20027 // @method bringToBack: this 20028 // Brings this popup to the back of other popups (in the same map pane). 20029 bringToBack: function () { 20030 if (this._map) { 20031 toBack(this._container); 20032 } 20033 return this; 20034 }, 20035 20036 _prepareOpen: function (parent, layer, latlng) { 20037 if (!(layer instanceof Layer)) { 20038 latlng = layer; 20039 layer = parent; 20040 } 20041 20042 if (layer instanceof FeatureGroup) { 20043 for (var id in parent._layers) { 20044 layer = parent._layers[id]; 20045 break; 20046 } 20047 } 20048 20049 if (!latlng) { 20050 if (layer.getCenter) { 20051 latlng = layer.getCenter(); 20052 } else if (layer.getLatLng) { 20053 latlng = layer.getLatLng(); 20054 } else { 20055 throw new Error('Unable to get source layer LatLng.'); 20056 } 20057 } 20058 20059 // set overlay source to this layer 20060 this._source = layer; 20061 20062 // update the overlay (content, layout, ect...) 20063 this.update(); 20064 20065 return latlng; 20066 }, 20067 20068 _updateContent: function () { 20069 if (!this._content) { return; } 20070 20071 var node = this._contentNode; 20072 var content = (typeof this._content === 'function') ? this._content(this._source || this) : this._content; 20073 20074 if (typeof content === 'string') { 20075 node.innerHTML = content; 20076 } else { 20077 while (node.hasChildNodes()) { 20078 node.removeChild(node.firstChild); 20079 } 20080 node.appendChild(content); 20081 } 20082 this.fire('contentupdate'); 20083 }, 20084 20085 _updatePosition: function () { 20086 if (!this._map) { return; } 20087 20088 var pos = this._map.latLngToLayerPoint(this._latlng), 20089 offset = toPoint(this.options.offset), 20090 anchor = this._getAnchor(); 20091 20092 if (this._zoomAnimated) { 20093 setPosition(this._container, pos.add(anchor)); 20094 } else { 20095 offset = offset.add(pos).add(anchor); 20096 } 20097 20098 var bottom = this._containerBottom = -offset.y, 20099 left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x; 20100 20101 // bottom position the popup in case the height of the popup changes (images loading etc) 20102 this._container.style.bottom = bottom + 'px'; 20103 this._container.style.left = left + 'px'; 20104 }, 20105 20106 _getAnchor: function () { 20107 return [0, 0]; 20108 } 20109 20110}); 20111 20112/* 20113 * @class Popup 20114 * @inherits DivOverlay 20115 * @aka L.Popup 20116 * Used to open popups in certain places of the map. Use [Map.openPopup](#map-openpopup) to 20117 * open popups while making sure that only one popup is open at one time 20118 * (recommended for usability), or use [Map.addLayer](#map-addlayer) to open as many as you want. 20119 * 20120 * @example 20121 * 20122 * If you want to just bind a popup to marker click and then open it, it's really easy: 20123 * 20124 * ```js 20125 * marker.bindPopup(popupContent).openPopup(); 20126 * ``` 20127 * Path overlays like polylines also have a `bindPopup` method. 20128 * Here's a more complicated way to open a popup on a map: 20129 * 20130 * ```js 20131 * var popup = L.popup() 20132 * .setLatLng(latlng) 20133 * .setContent('<p>Hello world!<br />This is a nice popup.</p>') 20134 * .openOn(map); 20135 * ``` 20136 */ 20137 20138 20139// @namespace Popup 20140var Popup = DivOverlay.extend({ 20141 20142 // @section 20143 // @aka Popup options 20144 options: { 20145 // @option maxWidth: Number = 300 20146 // Max width of the popup, in pixels. 20147 maxWidth: 300, 20148 20149 // @option minWidth: Number = 50 20150 // Min width of the popup, in pixels. 20151 minWidth: 50, 20152 20153 // @option maxHeight: Number = null 20154 // If set, creates a scrollable container of the given height 20155 // inside a popup if its content exceeds it. 20156 maxHeight: null, 20157 20158 // @option autoPan: Boolean = true 20159 // Set it to `false` if you don't want the map to do panning animation 20160 // to fit the opened popup. 20161 autoPan: true, 20162 20163 // @option autoPanPaddingTopLeft: Point = null 20164 // The margin between the popup and the top left corner of the map 20165 // view after autopanning was performed. 20166 autoPanPaddingTopLeft: null, 20167 20168 // @option autoPanPaddingBottomRight: Point = null 20169 // The margin between the popup and the bottom right corner of the map 20170 // view after autopanning was performed. 20171 autoPanPaddingBottomRight: null, 20172 20173 // @option autoPanPadding: Point = Point(5, 5) 20174 // Equivalent of setting both top left and bottom right autopan padding to the same value. 20175 autoPanPadding: [5, 5], 20176 20177 // @option keepInView: Boolean = false 20178 // Set it to `true` if you want to prevent users from panning the popup 20179 // off of the screen while it is open. 20180 keepInView: false, 20181 20182 // @option closeButton: Boolean = true 20183 // Controls the presence of a close button in the popup. 20184 closeButton: true, 20185 20186 // @option autoClose: Boolean = true 20187 // Set it to `false` if you want to override the default behavior of 20188 // the popup closing when another popup is opened. 20189 autoClose: true, 20190 20191 // @option closeOnEscapeKey: Boolean = true 20192 // Set it to `false` if you want to override the default behavior of 20193 // the ESC key for closing of the popup. 20194 closeOnEscapeKey: true, 20195 20196 // @option closeOnClick: Boolean = * 20197 // Set it if you want to override the default behavior of the popup closing when user clicks 20198 // on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option. 20199 20200 // @option className: String = '' 20201 // A custom CSS class name to assign to the popup. 20202 className: '' 20203 }, 20204 20205 // @namespace Popup 20206 // @method openOn(map: Map): this 20207 // Adds the popup to the map and closes the previous one. The same as `map.openPopup(popup)`. 20208 openOn: function (map) { 20209 map.openPopup(this); 20210 return this; 20211 }, 20212 20213 onAdd: function (map) { 20214 DivOverlay.prototype.onAdd.call(this, map); 20215 20216 // @namespace Map 20217 // @section Popup events 20218 // @event popupopen: PopupEvent 20219 // Fired when a popup is opened in the map 20220 map.fire('popupopen', {popup: this}); 20221 20222 if (this._source) { 20223 // @namespace Layer 20224 // @section Popup events 20225 // @event popupopen: PopupEvent 20226 // Fired when a popup bound to this layer is opened 20227 this._source.fire('popupopen', {popup: this}, true); 20228 // For non-path layers, we toggle the popup when clicking 20229 // again the layer, so prevent the map to reopen it. 20230 if (!(this._source instanceof Path)) { 20231 this._source.on('preclick', stopPropagation); 20232 } 20233 } 20234 }, 20235 20236 onRemove: function (map) { 20237 DivOverlay.prototype.onRemove.call(this, map); 20238 20239 // @namespace Map 20240 // @section Popup events 20241 // @event popupclose: PopupEvent 20242 // Fired when a popup in the map is closed 20243 map.fire('popupclose', {popup: this}); 20244 20245 if (this._source) { 20246 // @namespace Layer 20247 // @section Popup events 20248 // @event popupclose: PopupEvent 20249 // Fired when a popup bound to this layer is closed 20250 this._source.fire('popupclose', {popup: this}, true); 20251 if (!(this._source instanceof Path)) { 20252 this._source.off('preclick', stopPropagation); 20253 } 20254 } 20255 }, 20256 20257 getEvents: function () { 20258 var events = DivOverlay.prototype.getEvents.call(this); 20259 20260 if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) { 20261 events.preclick = this._close; 20262 } 20263 20264 if (this.options.keepInView) { 20265 events.moveend = this._adjustPan; 20266 } 20267 20268 return events; 20269 }, 20270 20271 _close: function () { 20272 if (this._map) { 20273 this._map.closePopup(this); 20274 } 20275 }, 20276 20277 _initLayout: function () { 20278 var prefix = 'leaflet-popup', 20279 container = this._container = create$1('div', 20280 prefix + ' ' + (this.options.className || '') + 20281 ' leaflet-zoom-animated'); 20282 20283 var wrapper = this._wrapper = create$1('div', prefix + '-content-wrapper', container); 20284 this._contentNode = create$1('div', prefix + '-content', wrapper); 20285 20286 disableClickPropagation(wrapper); 20287 disableScrollPropagation(this._contentNode); 20288 on(wrapper, 'contextmenu', stopPropagation); 20289 20290 this._tipContainer = create$1('div', prefix + '-tip-container', container); 20291 this._tip = create$1('div', prefix + '-tip', this._tipContainer); 20292 20293 if (this.options.closeButton) { 20294 var closeButton = this._closeButton = create$1('a', prefix + '-close-button', container); 20295 closeButton.href = '#close'; 20296 closeButton.innerHTML = '×'; 20297 20298 on(closeButton, 'click', this._onCloseButtonClick, this); 20299 } 20300 }, 20301 20302 _updateLayout: function () { 20303 var container = this._contentNode, 20304 style = container.style; 20305 20306 style.width = ''; 20307 style.whiteSpace = 'nowrap'; 20308 20309 var width = container.offsetWidth; 20310 width = Math.min(width, this.options.maxWidth); 20311 width = Math.max(width, this.options.minWidth); 20312 20313 style.width = (width + 1) + 'px'; 20314 style.whiteSpace = ''; 20315 20316 style.height = ''; 20317 20318 var height = container.offsetHeight, 20319 maxHeight = this.options.maxHeight, 20320 scrolledClass = 'leaflet-popup-scrolled'; 20321 20322 if (maxHeight && height > maxHeight) { 20323 style.height = maxHeight + 'px'; 20324 addClass(container, scrolledClass); 20325 } else { 20326 removeClass(container, scrolledClass); 20327 } 20328 20329 this._containerWidth = this._container.offsetWidth; 20330 }, 20331 20332 _animateZoom: function (e) { 20333 var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center), 20334 anchor = this._getAnchor(); 20335 setPosition(this._container, pos.add(anchor)); 20336 }, 20337 20338 _adjustPan: function () { 20339 if (!this.options.autoPan) { return; } 20340 if (this._map._panAnim) { this._map._panAnim.stop(); } 20341 20342 var map = this._map, 20343 marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0, 20344 containerHeight = this._container.offsetHeight + marginBottom, 20345 containerWidth = this._containerWidth, 20346 layerPos = new Point(this._containerLeft, -containerHeight - this._containerBottom); 20347 20348 layerPos._add(getPosition(this._container)); 20349 20350 var containerPos = map.layerPointToContainerPoint(layerPos), 20351 padding = toPoint(this.options.autoPanPadding), 20352 paddingTL = toPoint(this.options.autoPanPaddingTopLeft || padding), 20353 paddingBR = toPoint(this.options.autoPanPaddingBottomRight || padding), 20354 size = map.getSize(), 20355 dx = 0, 20356 dy = 0; 20357 20358 if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right 20359 dx = containerPos.x + containerWidth - size.x + paddingBR.x; 20360 } 20361 if (containerPos.x - dx - paddingTL.x < 0) { // left 20362 dx = containerPos.x - paddingTL.x; 20363 } 20364 if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom 20365 dy = containerPos.y + containerHeight - size.y + paddingBR.y; 20366 } 20367 if (containerPos.y - dy - paddingTL.y < 0) { // top 20368 dy = containerPos.y - paddingTL.y; 20369 } 20370 20371 // @namespace Map 20372 // @section Popup events 20373 // @event autopanstart: Event 20374 // Fired when the map starts autopanning when opening a popup. 20375 if (dx || dy) { 20376 map 20377 .fire('autopanstart') 20378 .panBy([dx, dy]); 20379 } 20380 }, 20381 20382 _onCloseButtonClick: function (e) { 20383 this._close(); 20384 stop(e); 20385 }, 20386 20387 _getAnchor: function () { 20388 // Where should we anchor the popup on the source layer? 20389 return toPoint(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]); 20390 } 20391 20392}); 20393 20394// @namespace Popup 20395// @factory L.popup(options?: Popup options, source?: Layer) 20396// Instantiates a `Popup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers. 20397var popup = function (options, source) { 20398 return new Popup(options, source); 20399}; 20400 20401 20402/* @namespace Map 20403 * @section Interaction Options 20404 * @option closePopupOnClick: Boolean = true 20405 * Set it to `false` if you don't want popups to close when user clicks the map. 20406 */ 20407Map.mergeOptions({ 20408 closePopupOnClick: true 20409}); 20410 20411 20412// @namespace Map 20413// @section Methods for Layers and Controls 20414Map.include({ 20415 // @method openPopup(popup: Popup): this 20416 // Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability). 20417 // @alternative 20418 // @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this 20419 // Creates a popup with the specified content and options and opens it in the given point on a map. 20420 openPopup: function (popup, latlng, options) { 20421 if (!(popup instanceof Popup)) { 20422 popup = new Popup(options).setContent(popup); 20423 } 20424 20425 if (latlng) { 20426 popup.setLatLng(latlng); 20427 } 20428 20429 if (this.hasLayer(popup)) { 20430 return this; 20431 } 20432 20433 if (this._popup && this._popup.options.autoClose) { 20434 this.closePopup(); 20435 } 20436 20437 this._popup = popup; 20438 return this.addLayer(popup); 20439 }, 20440 20441 // @method closePopup(popup?: Popup): this 20442 // Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one). 20443 closePopup: function (popup) { 20444 if (!popup || popup === this._popup) { 20445 popup = this._popup; 20446 this._popup = null; 20447 } 20448 if (popup) { 20449 this.removeLayer(popup); 20450 } 20451 return this; 20452 } 20453}); 20454 20455/* 20456 * @namespace Layer 20457 * @section Popup methods example 20458 * 20459 * All layers share a set of methods convenient for binding popups to it. 20460 * 20461 * ```js 20462 * var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map); 20463 * layer.openPopup(); 20464 * layer.closePopup(); 20465 * ``` 20466 * 20467 * Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened. 20468 */ 20469 20470// @section Popup methods 20471Layer.include({ 20472 20473 // @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this 20474 // Binds a popup to the layer with the passed `content` and sets up the 20475 // necessary event listeners. If a `Function` is passed it will receive 20476 // the layer as the first argument and should return a `String` or `HTMLElement`. 20477 bindPopup: function (content, options) { 20478 20479 if (content instanceof Popup) { 20480 setOptions(content, options); 20481 this._popup = content; 20482 content._source = this; 20483 } else { 20484 if (!this._popup || options) { 20485 this._popup = new Popup(options, this); 20486 } 20487 this._popup.setContent(content); 20488 } 20489 20490 if (!this._popupHandlersAdded) { 20491 this.on({ 20492 click: this._openPopup, 20493 keypress: this._onKeyPress, 20494 remove: this.closePopup, 20495 move: this._movePopup 20496 }); 20497 this._popupHandlersAdded = true; 20498 } 20499 20500 return this; 20501 }, 20502 20503 // @method unbindPopup(): this 20504 // Removes the popup previously bound with `bindPopup`. 20505 unbindPopup: function () { 20506 if (this._popup) { 20507 this.off({ 20508 click: this._openPopup, 20509 keypress: this._onKeyPress, 20510 remove: this.closePopup, 20511 move: this._movePopup 20512 }); 20513 this._popupHandlersAdded = false; 20514 this._popup = null; 20515 } 20516 return this; 20517 }, 20518 20519 // @method openPopup(latlng?: LatLng): this 20520 // Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed. 20521 openPopup: function (layer, latlng) { 20522 if (this._popup && this._map) { 20523 latlng = this._popup._prepareOpen(this, layer, latlng); 20524 20525 // open the popup on the map 20526 this._map.openPopup(this._popup, latlng); 20527 } 20528 20529 return this; 20530 }, 20531 20532 // @method closePopup(): this 20533 // Closes the popup bound to this layer if it is open. 20534 closePopup: function () { 20535 if (this._popup) { 20536 this._popup._close(); 20537 } 20538 return this; 20539 }, 20540 20541 // @method togglePopup(): this 20542 // Opens or closes the popup bound to this layer depending on its current state. 20543 togglePopup: function (target) { 20544 if (this._popup) { 20545 if (this._popup._map) { 20546 this.closePopup(); 20547 } else { 20548 this.openPopup(target); 20549 } 20550 } 20551 return this; 20552 }, 20553 20554 // @method isPopupOpen(): boolean 20555 // Returns `true` if the popup bound to this layer is currently open. 20556 isPopupOpen: function () { 20557 return (this._popup ? this._popup.isOpen() : false); 20558 }, 20559 20560 // @method setPopupContent(content: String|HTMLElement|Popup): this 20561 // Sets the content of the popup bound to this layer. 20562 setPopupContent: function (content) { 20563 if (this._popup) { 20564 this._popup.setContent(content); 20565 } 20566 return this; 20567 }, 20568 20569 // @method getPopup(): Popup 20570 // Returns the popup bound to this layer. 20571 getPopup: function () { 20572 return this._popup; 20573 }, 20574 20575 _openPopup: function (e) { 20576 var layer = e.layer || e.target; 20577 20578 if (!this._popup) { 20579 return; 20580 } 20581 20582 if (!this._map) { 20583 return; 20584 } 20585 20586 // prevent map click 20587 stop(e); 20588 20589 // if this inherits from Path its a vector and we can just 20590 // open the popup at the new location 20591 if (layer instanceof Path) { 20592 this.openPopup(e.layer || e.target, e.latlng); 20593 return; 20594 } 20595 20596 // otherwise treat it like a marker and figure out 20597 // if we should toggle it open/closed 20598 if (this._map.hasLayer(this._popup) && this._popup._source === layer) { 20599 this.closePopup(); 20600 } else { 20601 this.openPopup(layer, e.latlng); 20602 } 20603 }, 20604 20605 _movePopup: function (e) { 20606 this._popup.setLatLng(e.latlng); 20607 }, 20608 20609 _onKeyPress: function (e) { 20610 if (e.originalEvent.keyCode === 13) { 20611 this._openPopup(e); 20612 } 20613 } 20614}); 20615 20616/* 20617 * @class Tooltip 20618 * @inherits DivOverlay 20619 * @aka L.Tooltip 20620 * Used to display small texts on top of map layers. 20621 * 20622 * @example 20623 * 20624 * ```js 20625 * marker.bindTooltip("my tooltip text").openTooltip(); 20626 * ``` 20627 * Note about tooltip offset. Leaflet takes two options in consideration 20628 * for computing tooltip offsetting: 20629 * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip. 20630 * Add a positive x offset to move the tooltip to the right, and a positive y offset to 20631 * move it to the bottom. Negatives will move to the left and top. 20632 * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You 20633 * should adapt this value if you use a custom icon. 20634 */ 20635 20636 20637// @namespace Tooltip 20638var Tooltip = DivOverlay.extend({ 20639 20640 // @section 20641 // @aka Tooltip options 20642 options: { 20643 // @option pane: String = 'tooltipPane' 20644 // `Map pane` where the tooltip will be added. 20645 pane: 'tooltipPane', 20646 20647 // @option offset: Point = Point(0, 0) 20648 // Optional offset of the tooltip position. 20649 offset: [0, 0], 20650 20651 // @option direction: String = 'auto' 20652 // Direction where to open the tooltip. Possible values are: `right`, `left`, 20653 // `top`, `bottom`, `center`, `auto`. 20654 // `auto` will dynamically switch between `right` and `left` according to the tooltip 20655 // position on the map. 20656 direction: 'auto', 20657 20658 // @option permanent: Boolean = false 20659 // Whether to open the tooltip permanently or only on mouseover. 20660 permanent: false, 20661 20662 // @option sticky: Boolean = false 20663 // If true, the tooltip will follow the mouse instead of being fixed at the feature center. 20664 sticky: false, 20665 20666 // @option interactive: Boolean = false 20667 // If true, the tooltip will listen to the feature events. 20668 interactive: false, 20669 20670 // @option opacity: Number = 0.9 20671 // Tooltip container opacity. 20672 opacity: 0.9 20673 }, 20674 20675 onAdd: function (map) { 20676 DivOverlay.prototype.onAdd.call(this, map); 20677 this.setOpacity(this.options.opacity); 20678 20679 // @namespace Map 20680 // @section Tooltip events 20681 // @event tooltipopen: TooltipEvent 20682 // Fired when a tooltip is opened in the map. 20683 map.fire('tooltipopen', {tooltip: this}); 20684 20685 if (this._source) { 20686 // @namespace Layer 20687 // @section Tooltip events 20688 // @event tooltipopen: TooltipEvent 20689 // Fired when a tooltip bound to this layer is opened. 20690 this._source.fire('tooltipopen', {tooltip: this}, true); 20691 } 20692 }, 20693 20694 onRemove: function (map) { 20695 DivOverlay.prototype.onRemove.call(this, map); 20696 20697 // @namespace Map 20698 // @section Tooltip events 20699 // @event tooltipclose: TooltipEvent 20700 // Fired when a tooltip in the map is closed. 20701 map.fire('tooltipclose', {tooltip: this}); 20702 20703 if (this._source) { 20704 // @namespace Layer 20705 // @section Tooltip events 20706 // @event tooltipclose: TooltipEvent 20707 // Fired when a tooltip bound to this layer is closed. 20708 this._source.fire('tooltipclose', {tooltip: this}, true); 20709 } 20710 }, 20711 20712 getEvents: function () { 20713 var events = DivOverlay.prototype.getEvents.call(this); 20714 20715 if (touch && !this.options.permanent) { 20716 events.preclick = this._close; 20717 } 20718 20719 return events; 20720 }, 20721 20722 _close: function () { 20723 if (this._map) { 20724 this._map.closeTooltip(this); 20725 } 20726 }, 20727 20728 _initLayout: function () { 20729 var prefix = 'leaflet-tooltip', 20730 className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'); 20731 20732 this._contentNode = this._container = create$1('div', className); 20733 }, 20734 20735 _updateLayout: function () {}, 20736 20737 _adjustPan: function () {}, 20738 20739 _setPosition: function (pos) { 20740 var map = this._map, 20741 container = this._container, 20742 centerPoint = map.latLngToContainerPoint(map.getCenter()), 20743 tooltipPoint = map.layerPointToContainerPoint(pos), 20744 direction = this.options.direction, 20745 tooltipWidth = container.offsetWidth, 20746 tooltipHeight = container.offsetHeight, 20747 offset = toPoint(this.options.offset), 20748 anchor = this._getAnchor(); 20749 20750 if (direction === 'top') { 20751 pos = pos.add(toPoint(-tooltipWidth / 2 + offset.x, -tooltipHeight + offset.y + anchor.y, true)); 20752 } else if (direction === 'bottom') { 20753 pos = pos.subtract(toPoint(tooltipWidth / 2 - offset.x, -offset.y, true)); 20754 } else if (direction === 'center') { 20755 pos = pos.subtract(toPoint(tooltipWidth / 2 + offset.x, tooltipHeight / 2 - anchor.y + offset.y, true)); 20756 } else if (direction === 'right' || direction === 'auto' && tooltipPoint.x < centerPoint.x) { 20757 direction = 'right'; 20758 pos = pos.add(toPoint(offset.x + anchor.x, anchor.y - tooltipHeight / 2 + offset.y, true)); 20759 } else { 20760 direction = 'left'; 20761 pos = pos.subtract(toPoint(tooltipWidth + anchor.x - offset.x, tooltipHeight / 2 - anchor.y - offset.y, true)); 20762 } 20763 20764 removeClass(container, 'leaflet-tooltip-right'); 20765 removeClass(container, 'leaflet-tooltip-left'); 20766 removeClass(container, 'leaflet-tooltip-top'); 20767 removeClass(container, 'leaflet-tooltip-bottom'); 20768 addClass(container, 'leaflet-tooltip-' + direction); 20769 setPosition(container, pos); 20770 }, 20771 20772 _updatePosition: function () { 20773 var pos = this._map.latLngToLayerPoint(this._latlng); 20774 this._setPosition(pos); 20775 }, 20776 20777 setOpacity: function (opacity) { 20778 this.options.opacity = opacity; 20779 20780 if (this._container) { 20781 setOpacity(this._container, opacity); 20782 } 20783 }, 20784 20785 _animateZoom: function (e) { 20786 var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center); 20787 this._setPosition(pos); 20788 }, 20789 20790 _getAnchor: function () { 20791 // Where should we anchor the tooltip on the source layer? 20792 return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]); 20793 } 20794 20795}); 20796 20797// @namespace Tooltip 20798// @factory L.tooltip(options?: Tooltip options, source?: Layer) 20799// Instantiates a Tooltip object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers. 20800var tooltip = function (options, source) { 20801 return new Tooltip(options, source); 20802}; 20803 20804// @namespace Map 20805// @section Methods for Layers and Controls 20806Map.include({ 20807 20808 // @method openTooltip(tooltip: Tooltip): this 20809 // Opens the specified tooltip. 20810 // @alternative 20811 // @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this 20812 // Creates a tooltip with the specified content and options and open it. 20813 openTooltip: function (tooltip, latlng, options) { 20814 if (!(tooltip instanceof Tooltip)) { 20815 tooltip = new Tooltip(options).setContent(tooltip); 20816 } 20817 20818 if (latlng) { 20819 tooltip.setLatLng(latlng); 20820 } 20821 20822 if (this.hasLayer(tooltip)) { 20823 return this; 20824 } 20825 20826 return this.addLayer(tooltip); 20827 }, 20828 20829 // @method closeTooltip(tooltip?: Tooltip): this 20830 // Closes the tooltip given as parameter. 20831 closeTooltip: function (tooltip) { 20832 if (tooltip) { 20833 this.removeLayer(tooltip); 20834 } 20835 return this; 20836 } 20837 20838}); 20839 20840/* 20841 * @namespace Layer 20842 * @section Tooltip methods example 20843 * 20844 * All layers share a set of methods convenient for binding tooltips to it. 20845 * 20846 * ```js 20847 * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map); 20848 * layer.openTooltip(); 20849 * layer.closeTooltip(); 20850 * ``` 20851 */ 20852 20853// @section Tooltip methods 20854Layer.include({ 20855 20856 // @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this 20857 // Binds a tooltip to the layer with the passed `content` and sets up the 20858 // necessary event listeners. If a `Function` is passed it will receive 20859 // the layer as the first argument and should return a `String` or `HTMLElement`. 20860 bindTooltip: function (content, options) { 20861 20862 if (content instanceof Tooltip) { 20863 setOptions(content, options); 20864 this._tooltip = content; 20865 content._source = this; 20866 } else { 20867 if (!this._tooltip || options) { 20868 this._tooltip = new Tooltip(options, this); 20869 } 20870 this._tooltip.setContent(content); 20871 20872 } 20873 20874 this._initTooltipInteractions(); 20875 20876 if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) { 20877 this.openTooltip(); 20878 } 20879 20880 return this; 20881 }, 20882 20883 // @method unbindTooltip(): this 20884 // Removes the tooltip previously bound with `bindTooltip`. 20885 unbindTooltip: function () { 20886 if (this._tooltip) { 20887 this._initTooltipInteractions(true); 20888 this.closeTooltip(); 20889 this._tooltip = null; 20890 } 20891 return this; 20892 }, 20893 20894 _initTooltipInteractions: function (remove$$1) { 20895 if (!remove$$1 && this._tooltipHandlersAdded) { return; } 20896 var onOff = remove$$1 ? 'off' : 'on', 20897 events = { 20898 remove: this.closeTooltip, 20899 move: this._moveTooltip 20900 }; 20901 if (!this._tooltip.options.permanent) { 20902 events.mouseover = this._openTooltip; 20903 events.mouseout = this.closeTooltip; 20904 if (this._tooltip.options.sticky) { 20905 events.mousemove = this._moveTooltip; 20906 } 20907 if (touch) { 20908 events.click = this._openTooltip; 20909 } 20910 } else { 20911 events.add = this._openTooltip; 20912 } 20913 this[onOff](events); 20914 this._tooltipHandlersAdded = !remove$$1; 20915 }, 20916 20917 // @method openTooltip(latlng?: LatLng): this 20918 // Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed. 20919 openTooltip: function (layer, latlng) { 20920 if (this._tooltip && this._map) { 20921 latlng = this._tooltip._prepareOpen(this, layer, latlng); 20922 20923 // open the tooltip on the map 20924 this._map.openTooltip(this._tooltip, latlng); 20925 20926 // Tooltip container may not be defined if not permanent and never 20927 // opened. 20928 if (this._tooltip.options.interactive && this._tooltip._container) { 20929 addClass(this._tooltip._container, 'leaflet-clickable'); 20930 this.addInteractiveTarget(this._tooltip._container); 20931 } 20932 } 20933 20934 return this; 20935 }, 20936 20937 // @method closeTooltip(): this 20938 // Closes the tooltip bound to this layer if it is open. 20939 closeTooltip: function () { 20940 if (this._tooltip) { 20941 this._tooltip._close(); 20942 if (this._tooltip.options.interactive && this._tooltip._container) { 20943 removeClass(this._tooltip._container, 'leaflet-clickable'); 20944 this.removeInteractiveTarget(this._tooltip._container); 20945 } 20946 } 20947 return this; 20948 }, 20949 20950 // @method toggleTooltip(): this 20951 // Opens or closes the tooltip bound to this layer depending on its current state. 20952 toggleTooltip: function (target) { 20953 if (this._tooltip) { 20954 if (this._tooltip._map) { 20955 this.closeTooltip(); 20956 } else { 20957 this.openTooltip(target); 20958 } 20959 } 20960 return this; 20961 }, 20962 20963 // @method isTooltipOpen(): boolean 20964 // Returns `true` if the tooltip bound to this layer is currently open. 20965 isTooltipOpen: function () { 20966 return this._tooltip.isOpen(); 20967 }, 20968 20969 // @method setTooltipContent(content: String|HTMLElement|Tooltip): this 20970 // Sets the content of the tooltip bound to this layer. 20971 setTooltipContent: function (content) { 20972 if (this._tooltip) { 20973 this._tooltip.setContent(content); 20974 } 20975 return this; 20976 }, 20977 20978 // @method getTooltip(): Tooltip 20979 // Returns the tooltip bound to this layer. 20980 getTooltip: function () { 20981 return this._tooltip; 20982 }, 20983 20984 _openTooltip: function (e) { 20985 var layer = e.layer || e.target; 20986 20987 if (!this._tooltip || !this._map) { 20988 return; 20989 } 20990 this.openTooltip(layer, this._tooltip.options.sticky ? e.latlng : undefined); 20991 }, 20992 20993 _moveTooltip: function (e) { 20994 var latlng = e.latlng, containerPoint, layerPoint; 20995 if (this._tooltip.options.sticky && e.originalEvent) { 20996 containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent); 20997 layerPoint = this._map.containerPointToLayerPoint(containerPoint); 20998 latlng = this._map.layerPointToLatLng(layerPoint); 20999 } 21000 this._tooltip.setLatLng(latlng); 21001 } 21002}); 21003 21004/* 21005 * @class DivIcon 21006 * @aka L.DivIcon 21007 * @inherits Icon 21008 * 21009 * Represents a lightweight icon for markers that uses a simple `<div>` 21010 * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options. 21011 * 21012 * @example 21013 * ```js 21014 * var myIcon = L.divIcon({className: 'my-div-icon'}); 21015 * // you can set .my-div-icon styles in CSS 21016 * 21017 * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); 21018 * ``` 21019 * 21020 * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow. 21021 */ 21022 21023var DivIcon = Icon.extend({ 21024 options: { 21025 // @section 21026 // @aka DivIcon options 21027 iconSize: [12, 12], // also can be set through CSS 21028 21029 // iconAnchor: (Point), 21030 // popupAnchor: (Point), 21031 21032 // @option html: String|HTMLElement = '' 21033 // Custom HTML code to put inside the div element, empty by default. Alternatively, 21034 // an instance of `HTMLElement`. 21035 html: false, 21036 21037 // @option bgPos: Point = [0, 0] 21038 // Optional relative position of the background, in pixels 21039 bgPos: null, 21040 21041 className: 'leaflet-div-icon' 21042 }, 21043 21044 createIcon: function (oldIcon) { 21045 var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'), 21046 options = this.options; 21047 21048 if (options.html instanceof Element) { 21049 empty(div); 21050 div.appendChild(options.html); 21051 } else { 21052 div.innerHTML = options.html !== false ? options.html : ''; 21053 } 21054 21055 if (options.bgPos) { 21056 var bgPos = toPoint(options.bgPos); 21057 div.style.backgroundPosition = (-bgPos.x) + 'px ' + (-bgPos.y) + 'px'; 21058 } 21059 this._setIconStyles(div, 'icon'); 21060 21061 return div; 21062 }, 21063 21064 createShadow: function () { 21065 return null; 21066 } 21067}); 21068 21069// @factory L.divIcon(options: DivIcon options) 21070// Creates a `DivIcon` instance with the given options. 21071function divIcon(options) { 21072 return new DivIcon(options); 21073} 21074 21075Icon.Default = IconDefault; 21076 21077/* 21078 * @class GridLayer 21079 * @inherits Layer 21080 * @aka L.GridLayer 21081 * 21082 * Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces `TileLayer.Canvas`. 21083 * GridLayer can be extended to create a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will handle creating and animating these DOM elements for you. 21084 * 21085 * 21086 * @section Synchronous usage 21087 * @example 21088 * 21089 * To create a custom layer, extend GridLayer and implement the `createTile()` method, which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level) coordinates to draw your tile. 21090 * 21091 * ```js 21092 * var CanvasLayer = L.GridLayer.extend({ 21093 * createTile: function(coords){ 21094 * // create a <canvas> element for drawing 21095 * var tile = L.DomUtil.create('canvas', 'leaflet-tile'); 21096 * 21097 * // setup tile width and height according to the options 21098 * var size = this.getTileSize(); 21099 * tile.width = size.x; 21100 * tile.height = size.y; 21101 * 21102 * // get a canvas context and draw something on it using coords.x, coords.y and coords.z 21103 * var ctx = tile.getContext('2d'); 21104 * 21105 * // return the tile so it can be rendered on screen 21106 * return tile; 21107 * } 21108 * }); 21109 * ``` 21110 * 21111 * @section Asynchronous usage 21112 * @example 21113 * 21114 * Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the `done()` callback. 21115 * 21116 * ```js 21117 * var CanvasLayer = L.GridLayer.extend({ 21118 * createTile: function(coords, done){ 21119 * var error; 21120 * 21121 * // create a <canvas> element for drawing 21122 * var tile = L.DomUtil.create('canvas', 'leaflet-tile'); 21123 * 21124 * // setup tile width and height according to the options 21125 * var size = this.getTileSize(); 21126 * tile.width = size.x; 21127 * tile.height = size.y; 21128 * 21129 * // draw something asynchronously and pass the tile to the done() callback 21130 * setTimeout(function() { 21131 * done(error, tile); 21132 * }, 1000); 21133 * 21134 * return tile; 21135 * } 21136 * }); 21137 * ``` 21138 * 21139 * @section 21140 */ 21141 21142 21143var GridLayer = Layer.extend({ 21144 21145 // @section 21146 // @aka GridLayer options 21147 options: { 21148 // @option tileSize: Number|Point = 256 21149 // Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise. 21150 tileSize: 256, 21151 21152 // @option opacity: Number = 1.0 21153 // Opacity of the tiles. Can be used in the `createTile()` function. 21154 opacity: 1, 21155 21156 // @option updateWhenIdle: Boolean = (depends) 21157 // Load new tiles only when panning ends. 21158 // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation. 21159 // `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the 21160 // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers. 21161 updateWhenIdle: mobile, 21162 21163 // @option updateWhenZooming: Boolean = true 21164 // By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends. 21165 updateWhenZooming: true, 21166 21167 // @option updateInterval: Number = 200 21168 // Tiles will not update more than once every `updateInterval` milliseconds when panning. 21169 updateInterval: 200, 21170 21171 // @option zIndex: Number = 1 21172 // The explicit zIndex of the tile layer. 21173 zIndex: 1, 21174 21175 // @option bounds: LatLngBounds = undefined 21176 // If set, tiles will only be loaded inside the set `LatLngBounds`. 21177 bounds: null, 21178 21179 // @option minZoom: Number = 0 21180 // The minimum zoom level down to which this layer will be displayed (inclusive). 21181 minZoom: 0, 21182 21183 // @option maxZoom: Number = undefined 21184 // The maximum zoom level up to which this layer will be displayed (inclusive). 21185 maxZoom: undefined, 21186 21187 // @option maxNativeZoom: Number = undefined 21188 // Maximum zoom number the tile source has available. If it is specified, 21189 // the tiles on all zoom levels higher than `maxNativeZoom` will be loaded 21190 // from `maxNativeZoom` level and auto-scaled. 21191 maxNativeZoom: undefined, 21192 21193 // @option minNativeZoom: Number = undefined 21194 // Minimum zoom number the tile source has available. If it is specified, 21195 // the tiles on all zoom levels lower than `minNativeZoom` will be loaded 21196 // from `minNativeZoom` level and auto-scaled. 21197 minNativeZoom: undefined, 21198 21199 // @option noWrap: Boolean = false 21200 // Whether the layer is wrapped around the antimeridian. If `true`, the 21201 // GridLayer will only be displayed once at low zoom levels. Has no 21202 // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used 21203 // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting 21204 // tiles outside the CRS limits. 21205 noWrap: false, 21206 21207 // @option pane: String = 'tilePane' 21208 // `Map pane` where the grid layer will be added. 21209 pane: 'tilePane', 21210 21211 // @option className: String = '' 21212 // A custom class name to assign to the tile layer. Empty by default. 21213 className: '', 21214 21215 // @option keepBuffer: Number = 2 21216 // When panning the map, keep this many rows and columns of tiles before unloading them. 21217 keepBuffer: 2 21218 }, 21219 21220 initialize: function (options) { 21221 setOptions(this, options); 21222 }, 21223 21224 onAdd: function () { 21225 this._initContainer(); 21226 21227 this._levels = {}; 21228 this._tiles = {}; 21229 21230 this._resetView(); 21231 this._update(); 21232 }, 21233 21234 beforeAdd: function (map) { 21235 map._addZoomLimit(this); 21236 }, 21237 21238 onRemove: function (map) { 21239 this._removeAllTiles(); 21240 remove(this._container); 21241 map._removeZoomLimit(this); 21242 this._container = null; 21243 this._tileZoom = undefined; 21244 }, 21245 21246 // @method bringToFront: this 21247 // Brings the tile layer to the top of all tile layers. 21248 bringToFront: function () { 21249 if (this._map) { 21250 toFront(this._container); 21251 this._setAutoZIndex(Math.max); 21252 } 21253 return this; 21254 }, 21255 21256 // @method bringToBack: this 21257 // Brings the tile layer to the bottom of all tile layers. 21258 bringToBack: function () { 21259 if (this._map) { 21260 toBack(this._container); 21261 this._setAutoZIndex(Math.min); 21262 } 21263 return this; 21264 }, 21265 21266 // @method getContainer: HTMLElement 21267 // Returns the HTML element that contains the tiles for this layer. 21268 getContainer: function () { 21269 return this._container; 21270 }, 21271 21272 // @method setOpacity(opacity: Number): this 21273 // Changes the [opacity](#gridlayer-opacity) of the grid layer. 21274 setOpacity: function (opacity) { 21275 this.options.opacity = opacity; 21276 this._updateOpacity(); 21277 return this; 21278 }, 21279 21280 // @method setZIndex(zIndex: Number): this 21281 // Changes the [zIndex](#gridlayer-zindex) of the grid layer. 21282 setZIndex: function (zIndex) { 21283 this.options.zIndex = zIndex; 21284 this._updateZIndex(); 21285 21286 return this; 21287 }, 21288 21289 // @method isLoading: Boolean 21290 // Returns `true` if any tile in the grid layer has not finished loading. 21291 isLoading: function () { 21292 return this._loading; 21293 }, 21294 21295 // @method redraw: this 21296 // Causes the layer to clear all the tiles and request them again. 21297 redraw: function () { 21298 if (this._map) { 21299 this._removeAllTiles(); 21300 this._update(); 21301 } 21302 return this; 21303 }, 21304 21305 getEvents: function () { 21306 var events = { 21307 viewprereset: this._invalidateAll, 21308 viewreset: this._resetView, 21309 zoom: this._resetView, 21310 moveend: this._onMoveEnd 21311 }; 21312 21313 if (!this.options.updateWhenIdle) { 21314 // update tiles on move, but not more often than once per given interval 21315 if (!this._onMove) { 21316 this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this); 21317 } 21318 21319 events.move = this._onMove; 21320 } 21321 21322 if (this._zoomAnimated) { 21323 events.zoomanim = this._animateZoom; 21324 } 21325 21326 return events; 21327 }, 21328 21329 // @section Extension methods 21330 // Layers extending `GridLayer` shall reimplement the following method. 21331 // @method createTile(coords: Object, done?: Function): HTMLElement 21332 // Called only internally, must be overridden by classes extending `GridLayer`. 21333 // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback 21334 // is specified, it must be called when the tile has finished loading and drawing. 21335 createTile: function () { 21336 return document.createElement('div'); 21337 }, 21338 21339 // @section 21340 // @method getTileSize: Point 21341 // Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method. 21342 getTileSize: function () { 21343 var s = this.options.tileSize; 21344 return s instanceof Point ? s : new Point(s, s); 21345 }, 21346 21347 _updateZIndex: function () { 21348 if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) { 21349 this._container.style.zIndex = this.options.zIndex; 21350 } 21351 }, 21352 21353 _setAutoZIndex: function (compare) { 21354 // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back) 21355 21356 var layers = this.getPane().children, 21357 edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min 21358 21359 for (var i = 0, len = layers.length, zIndex; i < len; i++) { 21360 21361 zIndex = layers[i].style.zIndex; 21362 21363 if (layers[i] !== this._container && zIndex) { 21364 edgeZIndex = compare(edgeZIndex, +zIndex); 21365 } 21366 } 21367 21368 if (isFinite(edgeZIndex)) { 21369 this.options.zIndex = edgeZIndex + compare(-1, 1); 21370 this._updateZIndex(); 21371 } 21372 }, 21373 21374 _updateOpacity: function () { 21375 if (!this._map) { return; } 21376 21377 // IE doesn't inherit filter opacity properly, so we're forced to set it on tiles 21378 if (ielt9) { return; } 21379 21380 setOpacity(this._container, this.options.opacity); 21381 21382 var now = +new Date(), 21383 nextFrame = false, 21384 willPrune = false; 21385 21386 for (var key in this._tiles) { 21387 var tile = this._tiles[key]; 21388 if (!tile.current || !tile.loaded) { continue; } 21389 21390 var fade = Math.min(1, (now - tile.loaded) / 200); 21391 21392 setOpacity(tile.el, fade); 21393 if (fade < 1) { 21394 nextFrame = true; 21395 } else { 21396 if (tile.active) { 21397 willPrune = true; 21398 } else { 21399 this._onOpaqueTile(tile); 21400 } 21401 tile.active = true; 21402 } 21403 } 21404 21405 if (willPrune && !this._noPrune) { this._pruneTiles(); } 21406 21407 if (nextFrame) { 21408 cancelAnimFrame(this._fadeFrame); 21409 this._fadeFrame = requestAnimFrame(this._updateOpacity, this); 21410 } 21411 }, 21412 21413 _onOpaqueTile: falseFn, 21414 21415 _initContainer: function () { 21416 if (this._container) { return; } 21417 21418 this._container = create$1('div', 'leaflet-layer ' + (this.options.className || '')); 21419 this._updateZIndex(); 21420 21421 if (this.options.opacity < 1) { 21422 this._updateOpacity(); 21423 } 21424 21425 this.getPane().appendChild(this._container); 21426 }, 21427 21428 _updateLevels: function () { 21429 21430 var zoom = this._tileZoom, 21431 maxZoom = this.options.maxZoom; 21432 21433 if (zoom === undefined) { return undefined; } 21434 21435 for (var z in this._levels) { 21436 if (this._levels[z].el.children.length || z === zoom) { 21437 this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z); 21438 this._onUpdateLevel(z); 21439 } else { 21440 remove(this._levels[z].el); 21441 this._removeTilesAtZoom(z); 21442 this._onRemoveLevel(z); 21443 delete this._levels[z]; 21444 } 21445 } 21446 21447 var level = this._levels[zoom], 21448 map = this._map; 21449 21450 if (!level) { 21451 level = this._levels[zoom] = {}; 21452 21453 level.el = create$1('div', 'leaflet-tile-container leaflet-zoom-animated', this._container); 21454 level.el.style.zIndex = maxZoom; 21455 21456 level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round(); 21457 level.zoom = zoom; 21458 21459 this._setZoomTransform(level, map.getCenter(), map.getZoom()); 21460 21461 // force the browser to consider the newly added element for transition 21462 falseFn(level.el.offsetWidth); 21463 21464 this._onCreateLevel(level); 21465 } 21466 21467 this._level = level; 21468 21469 return level; 21470 }, 21471 21472 _onUpdateLevel: falseFn, 21473 21474 _onRemoveLevel: falseFn, 21475 21476 _onCreateLevel: falseFn, 21477 21478 _pruneTiles: function () { 21479 if (!this._map) { 21480 return; 21481 } 21482 21483 var key, tile; 21484 21485 var zoom = this._map.getZoom(); 21486 if (zoom > this.options.maxZoom || 21487 zoom < this.options.minZoom) { 21488 this._removeAllTiles(); 21489 return; 21490 } 21491 21492 for (key in this._tiles) { 21493 tile = this._tiles[key]; 21494 tile.retain = tile.current; 21495 } 21496 21497 for (key in this._tiles) { 21498 tile = this._tiles[key]; 21499 if (tile.current && !tile.active) { 21500 var coords = tile.coords; 21501 if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) { 21502 this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2); 21503 } 21504 } 21505 } 21506 21507 for (key in this._tiles) { 21508 if (!this._tiles[key].retain) { 21509 this._removeTile(key); 21510 } 21511 } 21512 }, 21513 21514 _removeTilesAtZoom: function (zoom) { 21515 for (var key in this._tiles) { 21516 if (this._tiles[key].coords.z !== zoom) { 21517 continue; 21518 } 21519 this._removeTile(key); 21520 } 21521 }, 21522 21523 _removeAllTiles: function () { 21524 for (var key in this._tiles) { 21525 this._removeTile(key); 21526 } 21527 }, 21528 21529 _invalidateAll: function () { 21530 for (var z in this._levels) { 21531 remove(this._levels[z].el); 21532 this._onRemoveLevel(z); 21533 delete this._levels[z]; 21534 } 21535 this._removeAllTiles(); 21536 21537 this._tileZoom = undefined; 21538 }, 21539 21540 _retainParent: function (x, y, z, minZoom) { 21541 var x2 = Math.floor(x / 2), 21542 y2 = Math.floor(y / 2), 21543 z2 = z - 1, 21544 coords2 = new Point(+x2, +y2); 21545 coords2.z = +z2; 21546 21547 var key = this._tileCoordsToKey(coords2), 21548 tile = this._tiles[key]; 21549 21550 if (tile && tile.active) { 21551 tile.retain = true; 21552 return true; 21553 21554 } else if (tile && tile.loaded) { 21555 tile.retain = true; 21556 } 21557 21558 if (z2 > minZoom) { 21559 return this._retainParent(x2, y2, z2, minZoom); 21560 } 21561 21562 return false; 21563 }, 21564 21565 _retainChildren: function (x, y, z, maxZoom) { 21566 21567 for (var i = 2 * x; i < 2 * x + 2; i++) { 21568 for (var j = 2 * y; j < 2 * y + 2; j++) { 21569 21570 var coords = new Point(i, j); 21571 coords.z = z + 1; 21572 21573 var key = this._tileCoordsToKey(coords), 21574 tile = this._tiles[key]; 21575 21576 if (tile && tile.active) { 21577 tile.retain = true; 21578 continue; 21579 21580 } else if (tile && tile.loaded) { 21581 tile.retain = true; 21582 } 21583 21584 if (z + 1 < maxZoom) { 21585 this._retainChildren(i, j, z + 1, maxZoom); 21586 } 21587 } 21588 } 21589 }, 21590 21591 _resetView: function (e) { 21592 var animating = e && (e.pinch || e.flyTo); 21593 this._setView(this._map.getCenter(), this._map.getZoom(), animating, animating); 21594 }, 21595 21596 _animateZoom: function (e) { 21597 this._setView(e.center, e.zoom, true, e.noUpdate); 21598 }, 21599 21600 _clampZoom: function (zoom) { 21601 var options = this.options; 21602 21603 if (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) { 21604 return options.minNativeZoom; 21605 } 21606 21607 if (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) { 21608 return options.maxNativeZoom; 21609 } 21610 21611 return zoom; 21612 }, 21613 21614 _setView: function (center, zoom, noPrune, noUpdate) { 21615 var tileZoom = this._clampZoom(Math.round(zoom)); 21616 if ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) || 21617 (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) { 21618 tileZoom = undefined; 21619 } 21620 21621 var tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom); 21622 21623 if (!noUpdate || tileZoomChanged) { 21624 21625 this._tileZoom = tileZoom; 21626 21627 if (this._abortLoading) { 21628 this._abortLoading(); 21629 } 21630 21631 this._updateLevels(); 21632 this._resetGrid(); 21633 21634 if (tileZoom !== undefined) { 21635 this._update(center); 21636 } 21637 21638 if (!noPrune) { 21639 this._pruneTiles(); 21640 } 21641 21642 // Flag to prevent _updateOpacity from pruning tiles during 21643 // a zoom anim or a pinch gesture 21644 this._noPrune = !!noPrune; 21645 } 21646 21647 this._setZoomTransforms(center, zoom); 21648 }, 21649 21650 _setZoomTransforms: function (center, zoom) { 21651 for (var i in this._levels) { 21652 this._setZoomTransform(this._levels[i], center, zoom); 21653 } 21654 }, 21655 21656 _setZoomTransform: function (level, center, zoom) { 21657 var scale = this._map.getZoomScale(zoom, level.zoom), 21658 translate = level.origin.multiplyBy(scale) 21659 .subtract(this._map._getNewPixelOrigin(center, zoom)).round(); 21660 21661 if (any3d) { 21662 setTransform(level.el, translate, scale); 21663 } else { 21664 setPosition(level.el, translate); 21665 } 21666 }, 21667 21668 _resetGrid: function () { 21669 var map = this._map, 21670 crs = map.options.crs, 21671 tileSize = this._tileSize = this.getTileSize(), 21672 tileZoom = this._tileZoom; 21673 21674 var bounds = this._map.getPixelWorldBounds(this._tileZoom); 21675 if (bounds) { 21676 this._globalTileRange = this._pxBoundsToTileRange(bounds); 21677 } 21678 21679 this._wrapX = crs.wrapLng && !this.options.noWrap && [ 21680 Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x), 21681 Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y) 21682 ]; 21683 this._wrapY = crs.wrapLat && !this.options.noWrap && [ 21684 Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x), 21685 Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y) 21686 ]; 21687 }, 21688 21689 _onMoveEnd: function () { 21690 if (!this._map || this._map._animatingZoom) { return; } 21691 21692 this._update(); 21693 }, 21694 21695 _getTiledPixelBounds: function (center) { 21696 var map = this._map, 21697 mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(), 21698 scale = map.getZoomScale(mapZoom, this._tileZoom), 21699 pixelCenter = map.project(center, this._tileZoom).floor(), 21700 halfSize = map.getSize().divideBy(scale * 2); 21701 21702 return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize)); 21703 }, 21704 21705 // Private method to load tiles in the grid's active zoom level according to map bounds 21706 _update: function (center) { 21707 var map = this._map; 21708 if (!map) { return; } 21709 var zoom = this._clampZoom(map.getZoom()); 21710 21711 if (center === undefined) { center = map.getCenter(); } 21712 if (this._tileZoom === undefined) { return; } // if out of minzoom/maxzoom 21713 21714 var pixelBounds = this._getTiledPixelBounds(center), 21715 tileRange = this._pxBoundsToTileRange(pixelBounds), 21716 tileCenter = tileRange.getCenter(), 21717 queue = [], 21718 margin = this.options.keepBuffer, 21719 noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]), 21720 tileRange.getTopRight().add([margin, -margin])); 21721 21722 // Sanity check: panic if the tile range contains Infinity somewhere. 21723 if (!(isFinite(tileRange.min.x) && 21724 isFinite(tileRange.min.y) && 21725 isFinite(tileRange.max.x) && 21726 isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); } 21727 21728 for (var key in this._tiles) { 21729 var c = this._tiles[key].coords; 21730 if (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) { 21731 this._tiles[key].current = false; 21732 } 21733 } 21734 21735 // _update just loads more tiles. If the tile zoom level differs too much 21736 // from the map's, let _setView reset levels and prune old tiles. 21737 if (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; } 21738 21739 // create a queue of coordinates to load tiles from 21740 for (var j = tileRange.min.y; j <= tileRange.max.y; j++) { 21741 for (var i = tileRange.min.x; i <= tileRange.max.x; i++) { 21742 var coords = new Point(i, j); 21743 coords.z = this._tileZoom; 21744 21745 if (!this._isValidTile(coords)) { continue; } 21746 21747 var tile = this._tiles[this._tileCoordsToKey(coords)]; 21748 if (tile) { 21749 tile.current = true; 21750 } else { 21751 queue.push(coords); 21752 } 21753 } 21754 } 21755 21756 // sort tile queue to load tiles in order of their distance to center 21757 queue.sort(function (a, b) { 21758 return a.distanceTo(tileCenter) - b.distanceTo(tileCenter); 21759 }); 21760 21761 if (queue.length !== 0) { 21762 // if it's the first batch of tiles to load 21763 if (!this._loading) { 21764 this._loading = true; 21765 // @event loading: Event 21766 // Fired when the grid layer starts loading tiles. 21767 this.fire('loading'); 21768 } 21769 21770 // create DOM fragment to append tiles in one batch 21771 var fragment = document.createDocumentFragment(); 21772 21773 for (i = 0; i < queue.length; i++) { 21774 this._addTile(queue[i], fragment); 21775 } 21776 21777 this._level.el.appendChild(fragment); 21778 } 21779 }, 21780 21781 _isValidTile: function (coords) { 21782 var crs = this._map.options.crs; 21783 21784 if (!crs.infinite) { 21785 // don't load tile if it's out of bounds and not wrapped 21786 var bounds = this._globalTileRange; 21787 if ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) || 21788 (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; } 21789 } 21790 21791 if (!this.options.bounds) { return true; } 21792 21793 // don't load tile if it doesn't intersect the bounds in options 21794 var tileBounds = this._tileCoordsToBounds(coords); 21795 return toLatLngBounds(this.options.bounds).overlaps(tileBounds); 21796 }, 21797 21798 _keyToBounds: function (key) { 21799 return this._tileCoordsToBounds(this._keyToTileCoords(key)); 21800 }, 21801 21802 _tileCoordsToNwSe: function (coords) { 21803 var map = this._map, 21804 tileSize = this.getTileSize(), 21805 nwPoint = coords.scaleBy(tileSize), 21806 sePoint = nwPoint.add(tileSize), 21807 nw = map.unproject(nwPoint, coords.z), 21808 se = map.unproject(sePoint, coords.z); 21809 return [nw, se]; 21810 }, 21811 21812 // converts tile coordinates to its geographical bounds 21813 _tileCoordsToBounds: function (coords) { 21814 var bp = this._tileCoordsToNwSe(coords), 21815 bounds = new LatLngBounds(bp[0], bp[1]); 21816 21817 if (!this.options.noWrap) { 21818 bounds = this._map.wrapLatLngBounds(bounds); 21819 } 21820 return bounds; 21821 }, 21822 // converts tile coordinates to key for the tile cache 21823 _tileCoordsToKey: function (coords) { 21824 return coords.x + ':' + coords.y + ':' + coords.z; 21825 }, 21826 21827 // converts tile cache key to coordinates 21828 _keyToTileCoords: function (key) { 21829 var k = key.split(':'), 21830 coords = new Point(+k[0], +k[1]); 21831 coords.z = +k[2]; 21832 return coords; 21833 }, 21834 21835 _removeTile: function (key) { 21836 var tile = this._tiles[key]; 21837 if (!tile) { return; } 21838 21839 remove(tile.el); 21840 21841 delete this._tiles[key]; 21842 21843 // @event tileunload: TileEvent 21844 // Fired when a tile is removed (e.g. when a tile goes off the screen). 21845 this.fire('tileunload', { 21846 tile: tile.el, 21847 coords: this._keyToTileCoords(key) 21848 }); 21849 }, 21850 21851 _initTile: function (tile) { 21852 addClass(tile, 'leaflet-tile'); 21853 21854 var tileSize = this.getTileSize(); 21855 tile.style.width = tileSize.x + 'px'; 21856 tile.style.height = tileSize.y + 'px'; 21857 21858 tile.onselectstart = falseFn; 21859 tile.onmousemove = falseFn; 21860 21861 // update opacity on tiles in IE7-8 because of filter inheritance problems 21862 if (ielt9 && this.options.opacity < 1) { 21863 setOpacity(tile, this.options.opacity); 21864 } 21865 21866 // without this hack, tiles disappear after zoom on Chrome for Android 21867 // https://github.com/Leaflet/Leaflet/issues/2078 21868 if (android && !android23) { 21869 tile.style.WebkitBackfaceVisibility = 'hidden'; 21870 } 21871 }, 21872 21873 _addTile: function (coords, container) { 21874 var tilePos = this._getTilePos(coords), 21875 key = this._tileCoordsToKey(coords); 21876 21877 var tile = this.createTile(this._wrapCoords(coords), bind(this._tileReady, this, coords)); 21878 21879 this._initTile(tile); 21880 21881 // if createTile is defined with a second argument ("done" callback), 21882 // we know that tile is async and will be ready later; otherwise 21883 if (this.createTile.length < 2) { 21884 // mark tile as ready, but delay one frame for opacity animation to happen 21885 requestAnimFrame(bind(this._tileReady, this, coords, null, tile)); 21886 } 21887 21888 setPosition(tile, tilePos); 21889 21890 // save tile in cache 21891 this._tiles[key] = { 21892 el: tile, 21893 coords: coords, 21894 current: true 21895 }; 21896 21897 container.appendChild(tile); 21898 // @event tileloadstart: TileEvent 21899 // Fired when a tile is requested and starts loading. 21900 this.fire('tileloadstart', { 21901 tile: tile, 21902 coords: coords 21903 }); 21904 }, 21905 21906 _tileReady: function (coords, err, tile) { 21907 if (err) { 21908 // @event tileerror: TileErrorEvent 21909 // Fired when there is an error loading a tile. 21910 this.fire('tileerror', { 21911 error: err, 21912 tile: tile, 21913 coords: coords 21914 }); 21915 } 21916 21917 var key = this._tileCoordsToKey(coords); 21918 21919 tile = this._tiles[key]; 21920 if (!tile) { return; } 21921 21922 tile.loaded = +new Date(); 21923 if (this._map._fadeAnimated) { 21924 setOpacity(tile.el, 0); 21925 cancelAnimFrame(this._fadeFrame); 21926 this._fadeFrame = requestAnimFrame(this._updateOpacity, this); 21927 } else { 21928 tile.active = true; 21929 this._pruneTiles(); 21930 } 21931 21932 if (!err) { 21933 addClass(tile.el, 'leaflet-tile-loaded'); 21934 21935 // @event tileload: TileEvent 21936 // Fired when a tile loads. 21937 this.fire('tileload', { 21938 tile: tile.el, 21939 coords: coords 21940 }); 21941 } 21942 21943 if (this._noTilesToLoad()) { 21944 this._loading = false; 21945 // @event load: Event 21946 // Fired when the grid layer loaded all visible tiles. 21947 this.fire('load'); 21948 21949 if (ielt9 || !this._map._fadeAnimated) { 21950 requestAnimFrame(this._pruneTiles, this); 21951 } else { 21952 // Wait a bit more than 0.2 secs (the duration of the tile fade-in) 21953 // to trigger a pruning. 21954 setTimeout(bind(this._pruneTiles, this), 250); 21955 } 21956 } 21957 }, 21958 21959 _getTilePos: function (coords) { 21960 return coords.scaleBy(this.getTileSize()).subtract(this._level.origin); 21961 }, 21962 21963 _wrapCoords: function (coords) { 21964 var newCoords = new Point( 21965 this._wrapX ? wrapNum(coords.x, this._wrapX) : coords.x, 21966 this._wrapY ? wrapNum(coords.y, this._wrapY) : coords.y); 21967 newCoords.z = coords.z; 21968 return newCoords; 21969 }, 21970 21971 _pxBoundsToTileRange: function (bounds) { 21972 var tileSize = this.getTileSize(); 21973 return new Bounds( 21974 bounds.min.unscaleBy(tileSize).floor(), 21975 bounds.max.unscaleBy(tileSize).ceil().subtract([1, 1])); 21976 }, 21977 21978 _noTilesToLoad: function () { 21979 for (var key in this._tiles) { 21980 if (!this._tiles[key].loaded) { return false; } 21981 } 21982 return true; 21983 } 21984}); 21985 21986// @factory L.gridLayer(options?: GridLayer options) 21987// Creates a new instance of GridLayer with the supplied options. 21988function gridLayer(options) { 21989 return new GridLayer(options); 21990} 21991 21992/* 21993 * @class TileLayer 21994 * @inherits GridLayer 21995 * @aka L.TileLayer 21996 * Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`. 21997 * 21998 * @example 21999 * 22000 * ```js 22001 * L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map); 22002 * ``` 22003 * 22004 * @section URL template 22005 * @example 22006 * 22007 * A string of the following form: 22008 * 22009 * ``` 22010 * 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png' 22011 * ``` 22012 * 22013 * `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; `a`, `b` or `c` by default, can be omitted), `{z}` â zoom level, `{x}` and `{y}` â tile coordinates. `{r}` can be used to add "@2x" to the URL to load retina tiles. 22014 * 22015 * You can use custom keys in the template, which will be [evaluated](#util-template) from TileLayer options, like this: 22016 * 22017 * ``` 22018 * L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'}); 22019 * ``` 22020 */ 22021 22022 22023var TileLayer = GridLayer.extend({ 22024 22025 // @section 22026 // @aka TileLayer options 22027 options: { 22028 // @option minZoom: Number = 0 22029 // The minimum zoom level down to which this layer will be displayed (inclusive). 22030 minZoom: 0, 22031 22032 // @option maxZoom: Number = 18 22033 // The maximum zoom level up to which this layer will be displayed (inclusive). 22034 maxZoom: 18, 22035 22036 // @option subdomains: String|String[] = 'abc' 22037 // Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings. 22038 subdomains: 'abc', 22039 22040 // @option errorTileUrl: String = '' 22041 // URL to the tile image to show in place of the tile that failed to load. 22042 errorTileUrl: '', 22043 22044 // @option zoomOffset: Number = 0 22045 // The zoom number used in tile URLs will be offset with this value. 22046 zoomOffset: 0, 22047 22048 // @option tms: Boolean = false 22049 // If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services). 22050 tms: false, 22051 22052 // @option zoomReverse: Boolean = false 22053 // If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`) 22054 zoomReverse: false, 22055 22056 // @option detectRetina: Boolean = false 22057 // If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution. 22058 detectRetina: false, 22059 22060 // @option crossOrigin: Boolean|String = false 22061 // Whether the crossOrigin attribute will be added to the tiles. 22062 // If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data. 22063 // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values. 22064 crossOrigin: false 22065 }, 22066 22067 initialize: function (url, options) { 22068 22069 this._url = url; 22070 22071 options = setOptions(this, options); 22072 22073 // detecting retina displays, adjusting tileSize and zoom levels 22074 if (options.detectRetina && retina && options.maxZoom > 0) { 22075 22076 options.tileSize = Math.floor(options.tileSize / 2); 22077 22078 if (!options.zoomReverse) { 22079 options.zoomOffset++; 22080 options.maxZoom--; 22081 } else { 22082 options.zoomOffset--; 22083 options.minZoom++; 22084 } 22085 22086 options.minZoom = Math.max(0, options.minZoom); 22087 } 22088 22089 if (typeof options.subdomains === 'string') { 22090 options.subdomains = options.subdomains.split(''); 22091 } 22092 22093 // for https://github.com/Leaflet/Leaflet/issues/137 22094 if (!android) { 22095 this.on('tileunload', this._onTileRemove); 22096 } 22097 }, 22098 22099 // @method setUrl(url: String, noRedraw?: Boolean): this 22100 // Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`). 22101 // If the URL does not change, the layer will not be redrawn unless 22102 // the noRedraw parameter is set to false. 22103 setUrl: function (url, noRedraw) { 22104 if (this._url === url && noRedraw === undefined) { 22105 noRedraw = true; 22106 } 22107 22108 this._url = url; 22109 22110 if (!noRedraw) { 22111 this.redraw(); 22112 } 22113 return this; 22114 }, 22115 22116 // @method createTile(coords: Object, done?: Function): HTMLElement 22117 // Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile) 22118 // to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done` 22119 // callback is called when the tile has been loaded. 22120 createTile: function (coords, done) { 22121 var tile = document.createElement('img'); 22122 22123 on(tile, 'load', bind(this._tileOnLoad, this, done, tile)); 22124 on(tile, 'error', bind(this._tileOnError, this, done, tile)); 22125 22126 if (this.options.crossOrigin || this.options.crossOrigin === '') { 22127 tile.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin; 22128 } 22129 22130 /* 22131 Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons 22132 http://www.w3.org/TR/WCAG20-TECHS/H67 22133 */ 22134 tile.alt = ''; 22135 22136 /* 22137 Set role="presentation" to force screen readers to ignore this 22138 https://www.w3.org/TR/wai-aria/roles#textalternativecomputation 22139 */ 22140 tile.setAttribute('role', 'presentation'); 22141 22142 tile.src = this.getTileUrl(coords); 22143 22144 return tile; 22145 }, 22146 22147 // @section Extension methods 22148 // @uninheritable 22149 // Layers extending `TileLayer` might reimplement the following method. 22150 // @method getTileUrl(coords: Object): String 22151 // Called only internally, returns the URL for a tile given its coordinates. 22152 // Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes. 22153 getTileUrl: function (coords) { 22154 var data = { 22155 r: retina ? '@2x' : '', 22156 s: this._getSubdomain(coords), 22157 x: coords.x, 22158 y: coords.y, 22159 z: this._getZoomForUrl() 22160 }; 22161 if (this._map && !this._map.options.crs.infinite) { 22162 var invertedY = this._globalTileRange.max.y - coords.y; 22163 if (this.options.tms) { 22164 data['y'] = invertedY; 22165 } 22166 data['-y'] = invertedY; 22167 } 22168 22169 return template(this._url, extend(data, this.options)); 22170 }, 22171 22172 _tileOnLoad: function (done, tile) { 22173 // For https://github.com/Leaflet/Leaflet/issues/3332 22174 if (ielt9) { 22175 setTimeout(bind(done, this, null, tile), 0); 22176 } else { 22177 done(null, tile); 22178 } 22179 }, 22180 22181 _tileOnError: function (done, tile, e) { 22182 var errorUrl = this.options.errorTileUrl; 22183 if (errorUrl && tile.getAttribute('src') !== errorUrl) { 22184 tile.src = errorUrl; 22185 } 22186 done(e, tile); 22187 }, 22188 22189 _onTileRemove: function (e) { 22190 e.tile.onload = null; 22191 }, 22192 22193 _getZoomForUrl: function () { 22194 var zoom = this._tileZoom, 22195 maxZoom = this.options.maxZoom, 22196 zoomReverse = this.options.zoomReverse, 22197 zoomOffset = this.options.zoomOffset; 22198 22199 if (zoomReverse) { 22200 zoom = maxZoom - zoom; 22201 } 22202 22203 return zoom + zoomOffset; 22204 }, 22205 22206 _getSubdomain: function (tilePoint) { 22207 var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length; 22208 return this.options.subdomains[index]; 22209 }, 22210 22211 // stops loading all tiles in the background layer 22212 _abortLoading: function () { 22213 var i, tile; 22214 for (i in this._tiles) { 22215 if (this._tiles[i].coords.z !== this._tileZoom) { 22216 tile = this._tiles[i].el; 22217 22218 tile.onload = falseFn; 22219 tile.onerror = falseFn; 22220 22221 if (!tile.complete) { 22222 tile.src = emptyImageUrl; 22223 remove(tile); 22224 delete this._tiles[i]; 22225 } 22226 } 22227 } 22228 }, 22229 22230 _removeTile: function (key) { 22231 var tile = this._tiles[key]; 22232 if (!tile) { return; } 22233 22234 // Cancels any pending http requests associated with the tile 22235 // unless we're on Android's stock browser, 22236 // see https://github.com/Leaflet/Leaflet/issues/137 22237 if (!androidStock) { 22238 tile.el.setAttribute('src', emptyImageUrl); 22239 } 22240 22241 return GridLayer.prototype._removeTile.call(this, key); 22242 }, 22243 22244 _tileReady: function (coords, err, tile) { 22245 if (!this._map || (tile && tile.getAttribute('src') === emptyImageUrl)) { 22246 return; 22247 } 22248 22249 return GridLayer.prototype._tileReady.call(this, coords, err, tile); 22250 } 22251}); 22252 22253 22254// @factory L.tilelayer(urlTemplate: String, options?: TileLayer options) 22255// Instantiates a tile layer object given a `URL template` and optionally an options object. 22256 22257function tileLayer(url, options) { 22258 return new TileLayer(url, options); 22259} 22260 22261/* 22262 * @class TileLayer.WMS 22263 * @inherits TileLayer 22264 * @aka L.TileLayer.WMS 22265 * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services as tile layers on the map. Extends `TileLayer`. 22266 * 22267 * @example 22268 * 22269 * ```js 22270 * var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", { 22271 * layers: 'nexrad-n0r-900913', 22272 * format: 'image/png', 22273 * transparent: true, 22274 * attribution: "Weather data © 2012 IEM Nexrad" 22275 * }); 22276 * ``` 22277 */ 22278 22279var TileLayerWMS = TileLayer.extend({ 22280 22281 // @section 22282 // @aka TileLayer.WMS options 22283 // If any custom options not documented here are used, they will be sent to the 22284 // WMS server as extra parameters in each request URL. This can be useful for 22285 // [non-standard vendor WMS parameters](http://docs.geoserver.org/stable/en/user/services/wms/vendor.html). 22286 defaultWmsParams: { 22287 service: 'WMS', 22288 request: 'GetMap', 22289 22290 // @option layers: String = '' 22291 // **(required)** Comma-separated list of WMS layers to show. 22292 layers: '', 22293 22294 // @option styles: String = '' 22295 // Comma-separated list of WMS styles. 22296 styles: '', 22297 22298 // @option format: String = 'image/jpeg' 22299 // WMS image format (use `'image/png'` for layers with transparency). 22300 format: 'image/jpeg', 22301 22302 // @option transparent: Boolean = false 22303 // If `true`, the WMS service will return images with transparency. 22304 transparent: false, 22305 22306 // @option version: String = '1.1.1' 22307 // Version of the WMS service to use 22308 version: '1.1.1' 22309 }, 22310 22311 options: { 22312 // @option crs: CRS = null 22313 // Coordinate Reference System to use for the WMS requests, defaults to 22314 // map CRS. Don't change this if you're not sure what it means. 22315 crs: null, 22316 22317 // @option uppercase: Boolean = false 22318 // If `true`, WMS request parameter keys will be uppercase. 22319 uppercase: false 22320 }, 22321 22322 initialize: function (url, options) { 22323 22324 this._url = url; 22325 22326 var wmsParams = extend({}, this.defaultWmsParams); 22327 22328 // all keys that are not TileLayer options go to WMS params 22329 for (var i in options) { 22330 if (!(i in this.options)) { 22331 wmsParams[i] = options[i]; 22332 } 22333 } 22334 22335 options = setOptions(this, options); 22336 22337 var realRetina = options.detectRetina && retina ? 2 : 1; 22338 var tileSize = this.getTileSize(); 22339 wmsParams.width = tileSize.x * realRetina; 22340 wmsParams.height = tileSize.y * realRetina; 22341 22342 this.wmsParams = wmsParams; 22343 }, 22344 22345 onAdd: function (map) { 22346 22347 this._crs = this.options.crs || map.options.crs; 22348 this._wmsVersion = parseFloat(this.wmsParams.version); 22349 22350 var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs'; 22351 this.wmsParams[projectionKey] = this._crs.code; 22352 22353 TileLayer.prototype.onAdd.call(this, map); 22354 }, 22355 22356 getTileUrl: function (coords) { 22357 22358 var tileBounds = this._tileCoordsToNwSe(coords), 22359 crs = this._crs, 22360 bounds = toBounds(crs.project(tileBounds[0]), crs.project(tileBounds[1])), 22361 min = bounds.min, 22362 max = bounds.max, 22363 bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ? 22364 [min.y, min.x, max.y, max.x] : 22365 [min.x, min.y, max.x, max.y]).join(','), 22366 url = TileLayer.prototype.getTileUrl.call(this, coords); 22367 return url + 22368 getParamString(this.wmsParams, url, this.options.uppercase) + 22369 (this.options.uppercase ? '&BBOX=' : '&bbox=') + bbox; 22370 }, 22371 22372 // @method setParams(params: Object, noRedraw?: Boolean): this 22373 // Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true). 22374 setParams: function (params, noRedraw) { 22375 22376 extend(this.wmsParams, params); 22377 22378 if (!noRedraw) { 22379 this.redraw(); 22380 } 22381 22382 return this; 22383 } 22384}); 22385 22386 22387// @factory L.tileLayer.wms(baseUrl: String, options: TileLayer.WMS options) 22388// Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object. 22389function tileLayerWMS(url, options) { 22390 return new TileLayerWMS(url, options); 22391} 22392 22393TileLayer.WMS = TileLayerWMS; 22394tileLayer.wms = tileLayerWMS; 22395 22396/* 22397 * @class Renderer 22398 * @inherits Layer 22399 * @aka L.Renderer 22400 * 22401 * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the 22402 * DOM container of the renderer, its bounds, and its zoom animation. 22403 * 22404 * A `Renderer` works as an implicit layer group for all `Path`s - the renderer 22405 * itself can be added or removed to the map. All paths use a renderer, which can 22406 * be implicit (the map will decide the type of renderer and use it automatically) 22407 * or explicit (using the [`renderer`](#path-renderer) option of the path). 22408 * 22409 * Do not use this class directly, use `SVG` and `Canvas` instead. 22410 * 22411 * @event update: Event 22412 * Fired when the renderer updates its bounds, center and zoom, for example when 22413 * its map has moved 22414 */ 22415 22416var Renderer = Layer.extend({ 22417 22418 // @section 22419 // @aka Renderer options 22420 options: { 22421 // @option padding: Number = 0.1 22422 // How much to extend the clip area around the map view (relative to its size) 22423 // e.g. 0.1 would be 10% of map view in each direction 22424 padding: 0.1, 22425 22426 // @option tolerance: Number = 0 22427 // How much to extend click tolerance round a path/object on the map 22428 tolerance : 0 22429 }, 22430 22431 initialize: function (options) { 22432 setOptions(this, options); 22433 stamp(this); 22434 this._layers = this._layers || {}; 22435 }, 22436 22437 onAdd: function () { 22438 if (!this._container) { 22439 this._initContainer(); // defined by renderer implementations 22440 22441 if (this._zoomAnimated) { 22442 addClass(this._container, 'leaflet-zoom-animated'); 22443 } 22444 } 22445 22446 this.getPane().appendChild(this._container); 22447 this._update(); 22448 this.on('update', this._updatePaths, this); 22449 }, 22450 22451 onRemove: function () { 22452 this.off('update', this._updatePaths, this); 22453 this._destroyContainer(); 22454 }, 22455 22456 getEvents: function () { 22457 var events = { 22458 viewreset: this._reset, 22459 zoom: this._onZoom, 22460 moveend: this._update, 22461 zoomend: this._onZoomEnd 22462 }; 22463 if (this._zoomAnimated) { 22464 events.zoomanim = this._onAnimZoom; 22465 } 22466 return events; 22467 }, 22468 22469 _onAnimZoom: function (ev) { 22470 this._updateTransform(ev.center, ev.zoom); 22471 }, 22472 22473 _onZoom: function () { 22474 this._updateTransform(this._map.getCenter(), this._map.getZoom()); 22475 }, 22476 22477 _updateTransform: function (center, zoom) { 22478 var scale = this._map.getZoomScale(zoom, this._zoom), 22479 position = getPosition(this._container), 22480 viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding), 22481 currentCenterPoint = this._map.project(this._center, zoom), 22482 destCenterPoint = this._map.project(center, zoom), 22483 centerOffset = destCenterPoint.subtract(currentCenterPoint), 22484 22485 topLeftOffset = viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset); 22486 22487 if (any3d) { 22488 setTransform(this._container, topLeftOffset, scale); 22489 } else { 22490 setPosition(this._container, topLeftOffset); 22491 } 22492 }, 22493 22494 _reset: function () { 22495 this._update(); 22496 this._updateTransform(this._center, this._zoom); 22497 22498 for (var id in this._layers) { 22499 this._layers[id]._reset(); 22500 } 22501 }, 22502 22503 _onZoomEnd: function () { 22504 for (var id in this._layers) { 22505 this._layers[id]._project(); 22506 } 22507 }, 22508 22509 _updatePaths: function () { 22510 for (var id in this._layers) { 22511 this._layers[id]._update(); 22512 } 22513 }, 22514 22515 _update: function () { 22516 // Update pixel bounds of renderer container (for positioning/sizing/clipping later) 22517 // Subclasses are responsible of firing the 'update' event. 22518 var p = this.options.padding, 22519 size = this._map.getSize(), 22520 min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round(); 22521 22522 this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round()); 22523 22524 this._center = this._map.getCenter(); 22525 this._zoom = this._map.getZoom(); 22526 } 22527}); 22528 22529/* 22530 * @class Canvas 22531 * @inherits Renderer 22532 * @aka L.Canvas 22533 * 22534 * Allows vector layers to be displayed with [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API). 22535 * Inherits `Renderer`. 22536 * 22537 * Due to [technical limitations](http://caniuse.com/#search=canvas), Canvas is not 22538 * available in all web browsers, notably IE8, and overlapping geometries might 22539 * not display properly in some edge cases. 22540 * 22541 * @example 22542 * 22543 * Use Canvas by default for all paths in the map: 22544 * 22545 * ```js 22546 * var map = L.map('map', { 22547 * renderer: L.canvas() 22548 * }); 22549 * ``` 22550 * 22551 * Use a Canvas renderer with extra padding for specific vector geometries: 22552 * 22553 * ```js 22554 * var map = L.map('map'); 22555 * var myRenderer = L.canvas({ padding: 0.5 }); 22556 * var line = L.polyline( coordinates, { renderer: myRenderer } ); 22557 * var circle = L.circle( center, { renderer: myRenderer } ); 22558 * ``` 22559 */ 22560 22561var Canvas = Renderer.extend({ 22562 getEvents: function () { 22563 var events = Renderer.prototype.getEvents.call(this); 22564 events.viewprereset = this._onViewPreReset; 22565 return events; 22566 }, 22567 22568 _onViewPreReset: function () { 22569 // Set a flag so that a viewprereset+moveend+viewreset only updates&redraws once 22570 this._postponeUpdatePaths = true; 22571 }, 22572 22573 onAdd: function () { 22574 Renderer.prototype.onAdd.call(this); 22575 22576 // Redraw vectors since canvas is cleared upon removal, 22577 // in case of removing the renderer itself from the map. 22578 this._draw(); 22579 }, 22580 22581 _initContainer: function () { 22582 var container = this._container = document.createElement('canvas'); 22583 22584 on(container, 'mousemove', this._onMouseMove, this); 22585 on(container, 'click dblclick mousedown mouseup contextmenu', this._onClick, this); 22586 on(container, 'mouseout', this._handleMouseOut, this); 22587 22588 this._ctx = container.getContext('2d'); 22589 }, 22590 22591 _destroyContainer: function () { 22592 cancelAnimFrame(this._redrawRequest); 22593 delete this._ctx; 22594 remove(this._container); 22595 off(this._container); 22596 delete this._container; 22597 }, 22598 22599 _updatePaths: function () { 22600 if (this._postponeUpdatePaths) { return; } 22601 22602 var layer; 22603 this._redrawBounds = null; 22604 for (var id in this._layers) { 22605 layer = this._layers[id]; 22606 layer._update(); 22607 } 22608 this._redraw(); 22609 }, 22610 22611 _update: function () { 22612 if (this._map._animatingZoom && this._bounds) { return; } 22613 22614 Renderer.prototype._update.call(this); 22615 22616 var b = this._bounds, 22617 container = this._container, 22618 size = b.getSize(), 22619 m = retina ? 2 : 1; 22620 22621 setPosition(container, b.min); 22622 22623 // set canvas size (also clearing it); use double size on retina 22624 container.width = m * size.x; 22625 container.height = m * size.y; 22626 container.style.width = size.x + 'px'; 22627 container.style.height = size.y + 'px'; 22628 22629 if (retina) { 22630 this._ctx.scale(2, 2); 22631 } 22632 22633 // translate so we use the same path coordinates after canvas element moves 22634 this._ctx.translate(-b.min.x, -b.min.y); 22635 22636 // Tell paths to redraw themselves 22637 this.fire('update'); 22638 }, 22639 22640 _reset: function () { 22641 Renderer.prototype._reset.call(this); 22642 22643 if (this._postponeUpdatePaths) { 22644 this._postponeUpdatePaths = false; 22645 this._updatePaths(); 22646 } 22647 }, 22648 22649 _initPath: function (layer) { 22650 this._updateDashArray(layer); 22651 this._layers[stamp(layer)] = layer; 22652 22653 var order = layer._order = { 22654 layer: layer, 22655 prev: this._drawLast, 22656 next: null 22657 }; 22658 if (this._drawLast) { this._drawLast.next = order; } 22659 this._drawLast = order; 22660 this._drawFirst = this._drawFirst || this._drawLast; 22661 }, 22662 22663 _addPath: function (layer) { 22664 this._requestRedraw(layer); 22665 }, 22666 22667 _removePath: function (layer) { 22668 var order = layer._order; 22669 var next = order.next; 22670 var prev = order.prev; 22671 22672 if (next) { 22673 next.prev = prev; 22674 } else { 22675 this._drawLast = prev; 22676 } 22677 if (prev) { 22678 prev.next = next; 22679 } else { 22680 this._drawFirst = next; 22681 } 22682 22683 delete layer._order; 22684 22685 delete this._layers[stamp(layer)]; 22686 22687 this._requestRedraw(layer); 22688 }, 22689 22690 _updatePath: function (layer) { 22691 // Redraw the union of the layer's old pixel 22692 // bounds and the new pixel bounds. 22693 this._extendRedrawBounds(layer); 22694 layer._project(); 22695 layer._update(); 22696 // The redraw will extend the redraw bounds 22697 // with the new pixel bounds. 22698 this._requestRedraw(layer); 22699 }, 22700 22701 _updateStyle: function (layer) { 22702 this._updateDashArray(layer); 22703 this._requestRedraw(layer); 22704 }, 22705 22706 _updateDashArray: function (layer) { 22707 if (typeof layer.options.dashArray === 'string') { 22708 var parts = layer.options.dashArray.split(/[, ]+/), 22709 dashArray = [], 22710 dashValue, 22711 i; 22712 for (i = 0; i < parts.length; i++) { 22713 dashValue = Number(parts[i]); 22714 // Ignore dash array containing invalid lengths 22715 if (isNaN(dashValue)) { return; } 22716 dashArray.push(dashValue); 22717 } 22718 layer.options._dashArray = dashArray; 22719 } else { 22720 layer.options._dashArray = layer.options.dashArray; 22721 } 22722 }, 22723 22724 _requestRedraw: function (layer) { 22725 if (!this._map) { return; } 22726 22727 this._extendRedrawBounds(layer); 22728 this._redrawRequest = this._redrawRequest || requestAnimFrame(this._redraw, this); 22729 }, 22730 22731 _extendRedrawBounds: function (layer) { 22732 if (layer._pxBounds) { 22733 var padding = (layer.options.weight || 0) + 1; 22734 this._redrawBounds = this._redrawBounds || new Bounds(); 22735 this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding])); 22736 this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding])); 22737 } 22738 }, 22739 22740 _redraw: function () { 22741 this._redrawRequest = null; 22742 22743 if (this._redrawBounds) { 22744 this._redrawBounds.min._floor(); 22745 this._redrawBounds.max._ceil(); 22746 } 22747 22748 this._clear(); // clear layers in redraw bounds 22749 this._draw(); // draw layers 22750 22751 this._redrawBounds = null; 22752 }, 22753 22754 _clear: function () { 22755 var bounds = this._redrawBounds; 22756 if (bounds) { 22757 var size = bounds.getSize(); 22758 this._ctx.clearRect(bounds.min.x, bounds.min.y, size.x, size.y); 22759 } else { 22760 this._ctx.clearRect(0, 0, this._container.width, this._container.height); 22761 } 22762 }, 22763 22764 _draw: function () { 22765 var layer, bounds = this._redrawBounds; 22766 this._ctx.save(); 22767 if (bounds) { 22768 var size = bounds.getSize(); 22769 this._ctx.beginPath(); 22770 this._ctx.rect(bounds.min.x, bounds.min.y, size.x, size.y); 22771 this._ctx.clip(); 22772 } 22773 22774 this._drawing = true; 22775 22776 for (var order = this._drawFirst; order; order = order.next) { 22777 layer = order.layer; 22778 if (!bounds || (layer._pxBounds && layer._pxBounds.intersects(bounds))) { 22779 layer._updatePath(); 22780 } 22781 } 22782 22783 this._drawing = false; 22784 22785 this._ctx.restore(); // Restore state before clipping. 22786 }, 22787 22788 _updatePoly: function (layer, closed) { 22789 if (!this._drawing) { return; } 22790 22791 var i, j, len2, p, 22792 parts = layer._parts, 22793 len = parts.length, 22794 ctx = this._ctx; 22795 22796 if (!len) { return; } 22797 22798 ctx.beginPath(); 22799 22800 for (i = 0; i < len; i++) { 22801 for (j = 0, len2 = parts[i].length; j < len2; j++) { 22802 p = parts[i][j]; 22803 ctx[j ? 'lineTo' : 'moveTo'](p.x, p.y); 22804 } 22805 if (closed) { 22806 ctx.closePath(); 22807 } 22808 } 22809 22810 this._fillStroke(ctx, layer); 22811 22812 // TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature 22813 }, 22814 22815 _updateCircle: function (layer) { 22816 22817 if (!this._drawing || layer._empty()) { return; } 22818 22819 var p = layer._point, 22820 ctx = this._ctx, 22821 r = Math.max(Math.round(layer._radius), 1), 22822 s = (Math.max(Math.round(layer._radiusY), 1) || r) / r; 22823 22824 if (s !== 1) { 22825 ctx.save(); 22826 ctx.scale(1, s); 22827 } 22828 22829 ctx.beginPath(); 22830 ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false); 22831 22832 if (s !== 1) { 22833 ctx.restore(); 22834 } 22835 22836 this._fillStroke(ctx, layer); 22837 }, 22838 22839 _fillStroke: function (ctx, layer) { 22840 var options = layer.options; 22841 22842 if (options.fill) { 22843 ctx.globalAlpha = options.fillOpacity; 22844 ctx.fillStyle = options.fillColor || options.color; 22845 ctx.fill(options.fillRule || 'evenodd'); 22846 } 22847 22848 if (options.stroke && options.weight !== 0) { 22849 if (ctx.setLineDash) { 22850 ctx.setLineDash(layer.options && layer.options._dashArray || []); 22851 } 22852 ctx.globalAlpha = options.opacity; 22853 ctx.lineWidth = options.weight; 22854 ctx.strokeStyle = options.color; 22855 ctx.lineCap = options.lineCap; 22856 ctx.lineJoin = options.lineJoin; 22857 ctx.stroke(); 22858 } 22859 }, 22860 22861 // Canvas obviously doesn't have mouse events for individual drawn objects, 22862 // so we emulate that by calculating what's under the mouse on mousemove/click manually 22863 22864 _onClick: function (e) { 22865 var point = this._map.mouseEventToLayerPoint(e), layer, clickedLayer; 22866 22867 for (var order = this._drawFirst; order; order = order.next) { 22868 layer = order.layer; 22869 if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) { 22870 clickedLayer = layer; 22871 } 22872 } 22873 if (clickedLayer) { 22874 fakeStop(e); 22875 this._fireEvent([clickedLayer], e); 22876 } 22877 }, 22878 22879 _onMouseMove: function (e) { 22880 if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) { return; } 22881 22882 var point = this._map.mouseEventToLayerPoint(e); 22883 this._handleMouseHover(e, point); 22884 }, 22885 22886 22887 _handleMouseOut: function (e) { 22888 var layer = this._hoveredLayer; 22889 if (layer) { 22890 // if we're leaving the layer, fire mouseout 22891 removeClass(this._container, 'leaflet-interactive'); 22892 this._fireEvent([layer], e, 'mouseout'); 22893 this._hoveredLayer = null; 22894 this._mouseHoverThrottled = false; 22895 } 22896 }, 22897 22898 _handleMouseHover: function (e, point) { 22899 if (this._mouseHoverThrottled) { 22900 return; 22901 } 22902 22903 var layer, candidateHoveredLayer; 22904 22905 for (var order = this._drawFirst; order; order = order.next) { 22906 layer = order.layer; 22907 if (layer.options.interactive && layer._containsPoint(point)) { 22908 candidateHoveredLayer = layer; 22909 } 22910 } 22911 22912 if (candidateHoveredLayer !== this._hoveredLayer) { 22913 this._handleMouseOut(e); 22914 22915 if (candidateHoveredLayer) { 22916 addClass(this._container, 'leaflet-interactive'); // change cursor 22917 this._fireEvent([candidateHoveredLayer], e, 'mouseover'); 22918 this._hoveredLayer = candidateHoveredLayer; 22919 } 22920 } 22921 22922 if (this._hoveredLayer) { 22923 this._fireEvent([this._hoveredLayer], e); 22924 } 22925 22926 this._mouseHoverThrottled = true; 22927 setTimeout(L.bind(function () { 22928 this._mouseHoverThrottled = false; 22929 }, this), 32); 22930 }, 22931 22932 _fireEvent: function (layers, e, type) { 22933 this._map._fireDOMEvent(e, type || e.type, layers); 22934 }, 22935 22936 _bringToFront: function (layer) { 22937 var order = layer._order; 22938 22939 if (!order) { return; } 22940 22941 var next = order.next; 22942 var prev = order.prev; 22943 22944 if (next) { 22945 next.prev = prev; 22946 } else { 22947 // Already last 22948 return; 22949 } 22950 if (prev) { 22951 prev.next = next; 22952 } else if (next) { 22953 // Update first entry unless this is the 22954 // single entry 22955 this._drawFirst = next; 22956 } 22957 22958 order.prev = this._drawLast; 22959 this._drawLast.next = order; 22960 22961 order.next = null; 22962 this._drawLast = order; 22963 22964 this._requestRedraw(layer); 22965 }, 22966 22967 _bringToBack: function (layer) { 22968 var order = layer._order; 22969 22970 if (!order) { return; } 22971 22972 var next = order.next; 22973 var prev = order.prev; 22974 22975 if (prev) { 22976 prev.next = next; 22977 } else { 22978 // Already first 22979 return; 22980 } 22981 if (next) { 22982 next.prev = prev; 22983 } else if (prev) { 22984 // Update last entry unless this is the 22985 // single entry 22986 this._drawLast = prev; 22987 } 22988 22989 order.prev = null; 22990 22991 order.next = this._drawFirst; 22992 this._drawFirst.prev = order; 22993 this._drawFirst = order; 22994 22995 this._requestRedraw(layer); 22996 } 22997}); 22998 22999// @factory L.canvas(options?: Renderer options) 23000// Creates a Canvas renderer with the given options. 23001function canvas$1(options) { 23002 return canvas ? new Canvas(options) : null; 23003} 23004 23005/* 23006 * Thanks to Dmitry Baranovsky and his Raphael library for inspiration! 23007 */ 23008 23009 23010var vmlCreate = (function () { 23011 try { 23012 document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml'); 23013 return function (name) { 23014 return document.createElement('<lvml:' + name + ' class="lvml">'); 23015 }; 23016 } catch (e) { 23017 return function (name) { 23018 return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">'); 23019 }; 23020 } 23021})(); 23022 23023 23024/* 23025 * @class SVG 23026 * 23027 * 23028 * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility 23029 * with old versions of Internet Explorer. 23030 */ 23031 23032// mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences 23033var vmlMixin = { 23034 23035 _initContainer: function () { 23036 this._container = create$1('div', 'leaflet-vml-container'); 23037 }, 23038 23039 _update: function () { 23040 if (this._map._animatingZoom) { return; } 23041 Renderer.prototype._update.call(this); 23042 this.fire('update'); 23043 }, 23044 23045 _initPath: function (layer) { 23046 var container = layer._container = vmlCreate('shape'); 23047 23048 addClass(container, 'leaflet-vml-shape ' + (this.options.className || '')); 23049 23050 container.coordsize = '1 1'; 23051 23052 layer._path = vmlCreate('path'); 23053 container.appendChild(layer._path); 23054 23055 this._updateStyle(layer); 23056 this._layers[stamp(layer)] = layer; 23057 }, 23058 23059 _addPath: function (layer) { 23060 var container = layer._container; 23061 this._container.appendChild(container); 23062 23063 if (layer.options.interactive) { 23064 layer.addInteractiveTarget(container); 23065 } 23066 }, 23067 23068 _removePath: function (layer) { 23069 var container = layer._container; 23070 remove(container); 23071 layer.removeInteractiveTarget(container); 23072 delete this._layers[stamp(layer)]; 23073 }, 23074 23075 _updateStyle: function (layer) { 23076 var stroke = layer._stroke, 23077 fill = layer._fill, 23078 options = layer.options, 23079 container = layer._container; 23080 23081 container.stroked = !!options.stroke; 23082 container.filled = !!options.fill; 23083 23084 if (options.stroke) { 23085 if (!stroke) { 23086 stroke = layer._stroke = vmlCreate('stroke'); 23087 } 23088 container.appendChild(stroke); 23089 stroke.weight = options.weight + 'px'; 23090 stroke.color = options.color; 23091 stroke.opacity = options.opacity; 23092 23093 if (options.dashArray) { 23094 stroke.dashStyle = isArray(options.dashArray) ? 23095 options.dashArray.join(' ') : 23096 options.dashArray.replace(/( *, *)/g, ' '); 23097 } else { 23098 stroke.dashStyle = ''; 23099 } 23100 stroke.endcap = options.lineCap.replace('butt', 'flat'); 23101 stroke.joinstyle = options.lineJoin; 23102 23103 } else if (stroke) { 23104 container.removeChild(stroke); 23105 layer._stroke = null; 23106 } 23107 23108 if (options.fill) { 23109 if (!fill) { 23110 fill = layer._fill = vmlCreate('fill'); 23111 } 23112 container.appendChild(fill); 23113 fill.color = options.fillColor || options.color; 23114 fill.opacity = options.fillOpacity; 23115 23116 } else if (fill) { 23117 container.removeChild(fill); 23118 layer._fill = null; 23119 } 23120 }, 23121 23122 _updateCircle: function (layer) { 23123 var p = layer._point.round(), 23124 r = Math.round(layer._radius), 23125 r2 = Math.round(layer._radiusY || r); 23126 23127 this._setPath(layer, layer._empty() ? 'M0 0' : 23128 'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + (65535 * 360)); 23129 }, 23130 23131 _setPath: function (layer, path) { 23132 layer._path.v = path; 23133 }, 23134 23135 _bringToFront: function (layer) { 23136 toFront(layer._container); 23137 }, 23138 23139 _bringToBack: function (layer) { 23140 toBack(layer._container); 23141 } 23142}; 23143 23144var create$2 = vml ? vmlCreate : svgCreate; 23145 23146/* 23147 * @class SVG 23148 * @inherits Renderer 23149 * @aka L.SVG 23150 * 23151 * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG). 23152 * Inherits `Renderer`. 23153 * 23154 * Due to [technical limitations](http://caniuse.com/#search=svg), SVG is not 23155 * available in all web browsers, notably Android 2.x and 3.x. 23156 * 23157 * Although SVG is not available on IE7 and IE8, these browsers support 23158 * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language) 23159 * (a now deprecated technology), and the SVG renderer will fall back to VML in 23160 * this case. 23161 * 23162 * @example 23163 * 23164 * Use SVG by default for all paths in the map: 23165 * 23166 * ```js 23167 * var map = L.map('map', { 23168 * renderer: L.svg() 23169 * }); 23170 * ``` 23171 * 23172 * Use a SVG renderer with extra padding for specific vector geometries: 23173 * 23174 * ```js 23175 * var map = L.map('map'); 23176 * var myRenderer = L.svg({ padding: 0.5 }); 23177 * var line = L.polyline( coordinates, { renderer: myRenderer } ); 23178 * var circle = L.circle( center, { renderer: myRenderer } ); 23179 * ``` 23180 */ 23181 23182var SVG = Renderer.extend({ 23183 23184 getEvents: function () { 23185 var events = Renderer.prototype.getEvents.call(this); 23186 events.zoomstart = this._onZoomStart; 23187 return events; 23188 }, 23189 23190 _initContainer: function () { 23191 this._container = create$2('svg'); 23192 23193 // makes it possible to click through svg root; we'll reset it back in individual paths 23194 this._container.setAttribute('pointer-events', 'none'); 23195 23196 this._rootGroup = create$2('g'); 23197 this._container.appendChild(this._rootGroup); 23198 }, 23199 23200 _destroyContainer: function () { 23201 remove(this._container); 23202 off(this._container); 23203 delete this._container; 23204 delete this._rootGroup; 23205 delete this._svgSize; 23206 }, 23207 23208 _onZoomStart: function () { 23209 // Drag-then-pinch interactions might mess up the center and zoom. 23210 // In this case, the easiest way to prevent this is re-do the renderer 23211 // bounds and padding when the zooming starts. 23212 this._update(); 23213 }, 23214 23215 _update: function () { 23216 if (this._map._animatingZoom && this._bounds) { return; } 23217 23218 Renderer.prototype._update.call(this); 23219 23220 var b = this._bounds, 23221 size = b.getSize(), 23222 container = this._container; 23223 23224 // set size of svg-container if changed 23225 if (!this._svgSize || !this._svgSize.equals(size)) { 23226 this._svgSize = size; 23227 container.setAttribute('width', size.x); 23228 container.setAttribute('height', size.y); 23229 } 23230 23231 // movement: update container viewBox so that we don't have to change coordinates of individual layers 23232 setPosition(container, b.min); 23233 container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' ')); 23234 23235 this.fire('update'); 23236 }, 23237 23238 // methods below are called by vector layers implementations 23239 23240 _initPath: function (layer) { 23241 var path = layer._path = create$2('path'); 23242 23243 // @namespace Path 23244 // @option className: String = null 23245 // Custom class name set on an element. Only for SVG renderer. 23246 if (layer.options.className) { 23247 addClass(path, layer.options.className); 23248 } 23249 23250 if (layer.options.interactive) { 23251 addClass(path, 'leaflet-interactive'); 23252 } 23253 23254 this._updateStyle(layer); 23255 this._layers[stamp(layer)] = layer; 23256 }, 23257 23258 _addPath: function (layer) { 23259 if (!this._rootGroup) { this._initContainer(); } 23260 this._rootGroup.appendChild(layer._path); 23261 layer.addInteractiveTarget(layer._path); 23262 }, 23263 23264 _removePath: function (layer) { 23265 remove(layer._path); 23266 layer.removeInteractiveTarget(layer._path); 23267 delete this._layers[stamp(layer)]; 23268 }, 23269 23270 _updatePath: function (layer) { 23271 layer._project(); 23272 layer._update(); 23273 }, 23274 23275 _updateStyle: function (layer) { 23276 var path = layer._path, 23277 options = layer.options; 23278 23279 if (!path) { return; } 23280 23281 if (options.stroke) { 23282 path.setAttribute('stroke', options.color); 23283 path.setAttribute('stroke-opacity', options.opacity); 23284 path.setAttribute('stroke-width', options.weight); 23285 path.setAttribute('stroke-linecap', options.lineCap); 23286 path.setAttribute('stroke-linejoin', options.lineJoin); 23287 23288 if (options.dashArray) { 23289 path.setAttribute('stroke-dasharray', options.dashArray); 23290 } else { 23291 path.removeAttribute('stroke-dasharray'); 23292 } 23293 23294 if (options.dashOffset) { 23295 path.setAttribute('stroke-dashoffset', options.dashOffset); 23296 } else { 23297 path.removeAttribute('stroke-dashoffset'); 23298 } 23299 } else { 23300 path.setAttribute('stroke', 'none'); 23301 } 23302 23303 if (options.fill) { 23304 path.setAttribute('fill', options.fillColor || options.color); 23305 path.setAttribute('fill-opacity', options.fillOpacity); 23306 path.setAttribute('fill-rule', options.fillRule || 'evenodd'); 23307 } else { 23308 path.setAttribute('fill', 'none'); 23309 } 23310 }, 23311 23312 _updatePoly: function (layer, closed) { 23313 this._setPath(layer, pointsToPath(layer._parts, closed)); 23314 }, 23315 23316 _updateCircle: function (layer) { 23317 var p = layer._point, 23318 r = Math.max(Math.round(layer._radius), 1), 23319 r2 = Math.max(Math.round(layer._radiusY), 1) || r, 23320 arc = 'a' + r + ',' + r2 + ' 0 1,0 '; 23321 23322 // drawing a circle with two half-arcs 23323 var d = layer._empty() ? 'M0 0' : 23324 'M' + (p.x - r) + ',' + p.y + 23325 arc + (r * 2) + ',0 ' + 23326 arc + (-r * 2) + ',0 '; 23327 23328 this._setPath(layer, d); 23329 }, 23330 23331 _setPath: function (layer, path) { 23332 layer._path.setAttribute('d', path); 23333 }, 23334 23335 // SVG does not have the concept of zIndex so we resort to changing the DOM order of elements 23336 _bringToFront: function (layer) { 23337 toFront(layer._path); 23338 }, 23339 23340 _bringToBack: function (layer) { 23341 toBack(layer._path); 23342 } 23343}); 23344 23345if (vml) { 23346 SVG.include(vmlMixin); 23347} 23348 23349// @namespace SVG 23350// @factory L.svg(options?: Renderer options) 23351// Creates a SVG renderer with the given options. 23352function svg$1(options) { 23353 return svg || vml ? new SVG(options) : null; 23354} 23355 23356Map.include({ 23357 // @namespace Map; @method getRenderer(layer: Path): Renderer 23358 // Returns the instance of `Renderer` that should be used to render the given 23359 // `Path`. It will ensure that the `renderer` options of the map and paths 23360 // are respected, and that the renderers do exist on the map. 23361 getRenderer: function (layer) { 23362 // @namespace Path; @option renderer: Renderer 23363 // Use this specific instance of `Renderer` for this path. Takes 23364 // precedence over the map's [default renderer](#map-renderer). 23365 var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer; 23366 23367 if (!renderer) { 23368 renderer = this._renderer = this._createRenderer(); 23369 } 23370 23371 if (!this.hasLayer(renderer)) { 23372 this.addLayer(renderer); 23373 } 23374 return renderer; 23375 }, 23376 23377 _getPaneRenderer: function (name) { 23378 if (name === 'overlayPane' || name === undefined) { 23379 return false; 23380 } 23381 23382 var renderer = this._paneRenderers[name]; 23383 if (renderer === undefined) { 23384 renderer = this._createRenderer({pane: name}); 23385 this._paneRenderers[name] = renderer; 23386 } 23387 return renderer; 23388 }, 23389 23390 _createRenderer: function (options) { 23391 // @namespace Map; @option preferCanvas: Boolean = false 23392 // Whether `Path`s should be rendered on a `Canvas` renderer. 23393 // By default, all `Path`s are rendered in a `SVG` renderer. 23394 return (this.options.preferCanvas && canvas$1(options)) || svg$1(options); 23395 } 23396}); 23397 23398/* 23399 * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object. 23400 */ 23401 23402/* 23403 * @class Rectangle 23404 * @aka L.Rectangle 23405 * @inherits Polygon 23406 * 23407 * A class for drawing rectangle overlays on a map. Extends `Polygon`. 23408 * 23409 * @example 23410 * 23411 * ```js 23412 * // define rectangle geographical bounds 23413 * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]]; 23414 * 23415 * // create an orange rectangle 23416 * L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map); 23417 * 23418 * // zoom the map to the rectangle bounds 23419 * map.fitBounds(bounds); 23420 * ``` 23421 * 23422 */ 23423 23424 23425var Rectangle = Polygon.extend({ 23426 initialize: function (latLngBounds, options) { 23427 Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options); 23428 }, 23429 23430 // @method setBounds(latLngBounds: LatLngBounds): this 23431 // Redraws the rectangle with the passed bounds. 23432 setBounds: function (latLngBounds) { 23433 return this.setLatLngs(this._boundsToLatLngs(latLngBounds)); 23434 }, 23435 23436 _boundsToLatLngs: function (latLngBounds) { 23437 latLngBounds = toLatLngBounds(latLngBounds); 23438 return [ 23439 latLngBounds.getSouthWest(), 23440 latLngBounds.getNorthWest(), 23441 latLngBounds.getNorthEast(), 23442 latLngBounds.getSouthEast() 23443 ]; 23444 } 23445}); 23446 23447 23448// @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options) 23449function rectangle(latLngBounds, options) { 23450 return new Rectangle(latLngBounds, options); 23451} 23452 23453SVG.create = create$2; 23454SVG.pointsToPath = pointsToPath; 23455 23456GeoJSON.geometryToLayer = geometryToLayer; 23457GeoJSON.coordsToLatLng = coordsToLatLng; 23458GeoJSON.coordsToLatLngs = coordsToLatLngs; 23459GeoJSON.latLngToCoords = latLngToCoords; 23460GeoJSON.latLngsToCoords = latLngsToCoords; 23461GeoJSON.getFeature = getFeature; 23462GeoJSON.asFeature = asFeature; 23463 23464/* 23465 * L.Handler.BoxZoom is used to add shift-drag zoom interaction to the map 23466 * (zoom to a selected bounding box), enabled by default. 23467 */ 23468 23469// @namespace Map 23470// @section Interaction Options 23471Map.mergeOptions({ 23472 // @option boxZoom: Boolean = true 23473 // Whether the map can be zoomed to a rectangular area specified by 23474 // dragging the mouse while pressing the shift key. 23475 boxZoom: true 23476}); 23477 23478var BoxZoom = Handler.extend({ 23479 initialize: function (map) { 23480 this._map = map; 23481 this._container = map._container; 23482 this._pane = map._panes.overlayPane; 23483 this._resetStateTimeout = 0; 23484 map.on('unload', this._destroy, this); 23485 }, 23486 23487 addHooks: function () { 23488 on(this._container, 'mousedown', this._onMouseDown, this); 23489 }, 23490 23491 removeHooks: function () { 23492 off(this._container, 'mousedown', this._onMouseDown, this); 23493 }, 23494 23495 moved: function () { 23496 return this._moved; 23497 }, 23498 23499 _destroy: function () { 23500 remove(this._pane); 23501 delete this._pane; 23502 }, 23503 23504 _resetState: function () { 23505 this._resetStateTimeout = 0; 23506 this._moved = false; 23507 }, 23508 23509 _clearDeferredResetState: function () { 23510 if (this._resetStateTimeout !== 0) { 23511 clearTimeout(this._resetStateTimeout); 23512 this._resetStateTimeout = 0; 23513 } 23514 }, 23515 23516 _onMouseDown: function (e) { 23517 if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; } 23518 23519 // Clear the deferred resetState if it hasn't executed yet, otherwise it 23520 // will interrupt the interaction and orphan a box element in the container. 23521 this._clearDeferredResetState(); 23522 this._resetState(); 23523 23524 disableTextSelection(); 23525 disableImageDrag(); 23526 23527 this._startPoint = this._map.mouseEventToContainerPoint(e); 23528 23529 on(document, { 23530 contextmenu: stop, 23531 mousemove: this._onMouseMove, 23532 mouseup: this._onMouseUp, 23533 keydown: this._onKeyDown 23534 }, this); 23535 }, 23536 23537 _onMouseMove: function (e) { 23538 if (!this._moved) { 23539 this._moved = true; 23540 23541 this._box = create$1('div', 'leaflet-zoom-box', this._container); 23542 addClass(this._container, 'leaflet-crosshair'); 23543 23544 this._map.fire('boxzoomstart'); 23545 } 23546 23547 this._point = this._map.mouseEventToContainerPoint(e); 23548 23549 var bounds = new Bounds(this._point, this._startPoint), 23550 size = bounds.getSize(); 23551 23552 setPosition(this._box, bounds.min); 23553 23554 this._box.style.width = size.x + 'px'; 23555 this._box.style.height = size.y + 'px'; 23556 }, 23557 23558 _finish: function () { 23559 if (this._moved) { 23560 remove(this._box); 23561 removeClass(this._container, 'leaflet-crosshair'); 23562 } 23563 23564 enableTextSelection(); 23565 enableImageDrag(); 23566 23567 off(document, { 23568 contextmenu: stop, 23569 mousemove: this._onMouseMove, 23570 mouseup: this._onMouseUp, 23571 keydown: this._onKeyDown 23572 }, this); 23573 }, 23574 23575 _onMouseUp: function (e) { 23576 if ((e.which !== 1) && (e.button !== 1)) { return; } 23577 23578 this._finish(); 23579 23580 if (!this._moved) { return; } 23581 // Postpone to next JS tick so internal click event handling 23582 // still see it as "moved". 23583 this._clearDeferredResetState(); 23584 this._resetStateTimeout = setTimeout(bind(this._resetState, this), 0); 23585 23586 var bounds = new LatLngBounds( 23587 this._map.containerPointToLatLng(this._startPoint), 23588 this._map.containerPointToLatLng(this._point)); 23589 23590 this._map 23591 .fitBounds(bounds) 23592 .fire('boxzoomend', {boxZoomBounds: bounds}); 23593 }, 23594 23595 _onKeyDown: function (e) { 23596 if (e.keyCode === 27) { 23597 this._finish(); 23598 } 23599 } 23600}); 23601 23602// @section Handlers 23603// @property boxZoom: Handler 23604// Box (shift-drag with mouse) zoom handler. 23605Map.addInitHook('addHandler', 'boxZoom', BoxZoom); 23606 23607/* 23608 * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default. 23609 */ 23610 23611// @namespace Map 23612// @section Interaction Options 23613 23614Map.mergeOptions({ 23615 // @option doubleClickZoom: Boolean|String = true 23616 // Whether the map can be zoomed in by double clicking on it and 23617 // zoomed out by double clicking while holding shift. If passed 23618 // `'center'`, double-click zoom will zoom to the center of the 23619 // view regardless of where the mouse was. 23620 doubleClickZoom: true 23621}); 23622 23623var DoubleClickZoom = Handler.extend({ 23624 addHooks: function () { 23625 this._map.on('dblclick', this._onDoubleClick, this); 23626 }, 23627 23628 removeHooks: function () { 23629 this._map.off('dblclick', this._onDoubleClick, this); 23630 }, 23631 23632 _onDoubleClick: function (e) { 23633 var map = this._map, 23634 oldZoom = map.getZoom(), 23635 delta = map.options.zoomDelta, 23636 zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta; 23637 23638 if (map.options.doubleClickZoom === 'center') { 23639 map.setZoom(zoom); 23640 } else { 23641 map.setZoomAround(e.containerPoint, zoom); 23642 } 23643 } 23644}); 23645 23646// @section Handlers 23647// 23648// Map properties include interaction handlers that allow you to control 23649// interaction behavior in runtime, enabling or disabling certain features such 23650// as dragging or touch zoom (see `Handler` methods). For example: 23651// 23652// ```js 23653// map.doubleClickZoom.disable(); 23654// ``` 23655// 23656// @property doubleClickZoom: Handler 23657// Double click zoom handler. 23658Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom); 23659 23660/* 23661 * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default. 23662 */ 23663 23664// @namespace Map 23665// @section Interaction Options 23666Map.mergeOptions({ 23667 // @option dragging: Boolean = true 23668 // Whether the map be draggable with mouse/touch or not. 23669 dragging: true, 23670 23671 // @section Panning Inertia Options 23672 // @option inertia: Boolean = * 23673 // If enabled, panning of the map will have an inertia effect where 23674 // the map builds momentum while dragging and continues moving in 23675 // the same direction for some time. Feels especially nice on touch 23676 // devices. Enabled by default unless running on old Android devices. 23677 inertia: !android23, 23678 23679 // @option inertiaDeceleration: Number = 3000 23680 // The rate with which the inertial movement slows down, in pixels/second². 23681 inertiaDeceleration: 3400, // px/s^2 23682 23683 // @option inertiaMaxSpeed: Number = Infinity 23684 // Max speed of the inertial movement, in pixels/second. 23685 inertiaMaxSpeed: Infinity, // px/s 23686 23687 // @option easeLinearity: Number = 0.2 23688 easeLinearity: 0.2, 23689 23690 // TODO refactor, move to CRS 23691 // @option worldCopyJump: Boolean = false 23692 // With this option enabled, the map tracks when you pan to another "copy" 23693 // of the world and seamlessly jumps to the original one so that all overlays 23694 // like markers and vector layers are still visible. 23695 worldCopyJump: false, 23696 23697 // @option maxBoundsViscosity: Number = 0.0 23698 // If `maxBounds` is set, this option will control how solid the bounds 23699 // are when dragging the map around. The default value of `0.0` allows the 23700 // user to drag outside the bounds at normal speed, higher values will 23701 // slow down map dragging outside bounds, and `1.0` makes the bounds fully 23702 // solid, preventing the user from dragging outside the bounds. 23703 maxBoundsViscosity: 0.0 23704}); 23705 23706var Drag = Handler.extend({ 23707 addHooks: function () { 23708 if (!this._draggable) { 23709 var map = this._map; 23710 23711 this._draggable = new Draggable(map._mapPane, map._container); 23712 23713 this._draggable.on({ 23714 dragstart: this._onDragStart, 23715 drag: this._onDrag, 23716 dragend: this._onDragEnd 23717 }, this); 23718 23719 this._draggable.on('predrag', this._onPreDragLimit, this); 23720 if (map.options.worldCopyJump) { 23721 this._draggable.on('predrag', this._onPreDragWrap, this); 23722 map.on('zoomend', this._onZoomEnd, this); 23723 23724 map.whenReady(this._onZoomEnd, this); 23725 } 23726 } 23727 addClass(this._map._container, 'leaflet-grab leaflet-touch-drag'); 23728 this._draggable.enable(); 23729 this._positions = []; 23730 this._times = []; 23731 }, 23732 23733 removeHooks: function () { 23734 removeClass(this._map._container, 'leaflet-grab'); 23735 removeClass(this._map._container, 'leaflet-touch-drag'); 23736 this._draggable.disable(); 23737 }, 23738 23739 moved: function () { 23740 return this._draggable && this._draggable._moved; 23741 }, 23742 23743 moving: function () { 23744 return this._draggable && this._draggable._moving; 23745 }, 23746 23747 _onDragStart: function () { 23748 var map = this._map; 23749 23750 map._stop(); 23751 if (this._map.options.maxBounds && this._map.options.maxBoundsViscosity) { 23752 var bounds = toLatLngBounds(this._map.options.maxBounds); 23753 23754 this._offsetLimit = toBounds( 23755 this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1), 23756 this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1) 23757 .add(this._map.getSize())); 23758 23759 this._viscosity = Math.min(1.0, Math.max(0.0, this._map.options.maxBoundsViscosity)); 23760 } else { 23761 this._offsetLimit = null; 23762 } 23763 23764 map 23765 .fire('movestart') 23766 .fire('dragstart'); 23767 23768 if (map.options.inertia) { 23769 this._positions = []; 23770 this._times = []; 23771 } 23772 }, 23773 23774 _onDrag: function (e) { 23775 if (this._map.options.inertia) { 23776 var time = this._lastTime = +new Date(), 23777 pos = this._lastPos = this._draggable._absPos || this._draggable._newPos; 23778 23779 this._positions.push(pos); 23780 this._times.push(time); 23781 23782 this._prunePositions(time); 23783 } 23784 23785 this._map 23786 .fire('move', e) 23787 .fire('drag', e); 23788 }, 23789 23790 _prunePositions: function (time) { 23791 while (this._positions.length > 1 && time - this._times[0] > 50) { 23792 this._positions.shift(); 23793 this._times.shift(); 23794 } 23795 }, 23796 23797 _onZoomEnd: function () { 23798 var pxCenter = this._map.getSize().divideBy(2), 23799 pxWorldCenter = this._map.latLngToLayerPoint([0, 0]); 23800 23801 this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x; 23802 this._worldWidth = this._map.getPixelWorldBounds().getSize().x; 23803 }, 23804 23805 _viscousLimit: function (value, threshold) { 23806 return value - (value - threshold) * this._viscosity; 23807 }, 23808 23809 _onPreDragLimit: function () { 23810 if (!this._viscosity || !this._offsetLimit) { return; } 23811 23812 var offset = this._draggable._newPos.subtract(this._draggable._startPos); 23813 23814 var limit = this._offsetLimit; 23815 if (offset.x < limit.min.x) { offset.x = this._viscousLimit(offset.x, limit.min.x); } 23816 if (offset.y < limit.min.y) { offset.y = this._viscousLimit(offset.y, limit.min.y); } 23817 if (offset.x > limit.max.x) { offset.x = this._viscousLimit(offset.x, limit.max.x); } 23818 if (offset.y > limit.max.y) { offset.y = this._viscousLimit(offset.y, limit.max.y); } 23819 23820 this._draggable._newPos = this._draggable._startPos.add(offset); 23821 }, 23822 23823 _onPreDragWrap: function () { 23824 // TODO refactor to be able to adjust map pane position after zoom 23825 var worldWidth = this._worldWidth, 23826 halfWidth = Math.round(worldWidth / 2), 23827 dx = this._initialWorldOffset, 23828 x = this._draggable._newPos.x, 23829 newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx, 23830 newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx, 23831 newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2; 23832 23833 this._draggable._absPos = this._draggable._newPos.clone(); 23834 this._draggable._newPos.x = newX; 23835 }, 23836 23837 _onDragEnd: function (e) { 23838 var map = this._map, 23839 options = map.options, 23840 23841 noInertia = !options.inertia || this._times.length < 2; 23842 23843 map.fire('dragend', e); 23844 23845 if (noInertia) { 23846 map.fire('moveend'); 23847 23848 } else { 23849 this._prunePositions(+new Date()); 23850 23851 var direction = this._lastPos.subtract(this._positions[0]), 23852 duration = (this._lastTime - this._times[0]) / 1000, 23853 ease = options.easeLinearity, 23854 23855 speedVector = direction.multiplyBy(ease / duration), 23856 speed = speedVector.distanceTo([0, 0]), 23857 23858 limitedSpeed = Math.min(options.inertiaMaxSpeed, speed), 23859 limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed), 23860 23861 decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease), 23862 offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round(); 23863 23864 if (!offset.x && !offset.y) { 23865 map.fire('moveend'); 23866 23867 } else { 23868 offset = map._limitOffset(offset, map.options.maxBounds); 23869 23870 requestAnimFrame(function () { 23871 map.panBy(offset, { 23872 duration: decelerationDuration, 23873 easeLinearity: ease, 23874 noMoveStart: true, 23875 animate: true 23876 }); 23877 }); 23878 } 23879 } 23880 } 23881}); 23882 23883// @section Handlers 23884// @property dragging: Handler 23885// Map dragging handler (by both mouse and touch). 23886Map.addInitHook('addHandler', 'dragging', Drag); 23887 23888/* 23889 * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default. 23890 */ 23891 23892// @namespace Map 23893// @section Keyboard Navigation Options 23894Map.mergeOptions({ 23895 // @option keyboard: Boolean = true 23896 // Makes the map focusable and allows users to navigate the map with keyboard 23897 // arrows and `+`/`-` keys. 23898 keyboard: true, 23899 23900 // @option keyboardPanDelta: Number = 80 23901 // Amount of pixels to pan when pressing an arrow key. 23902 keyboardPanDelta: 80 23903}); 23904 23905var Keyboard = Handler.extend({ 23906 23907 keyCodes: { 23908 left: [37], 23909 right: [39], 23910 down: [40], 23911 up: [38], 23912 zoomIn: [187, 107, 61, 171], 23913 zoomOut: [189, 109, 54, 173] 23914 }, 23915 23916 initialize: function (map) { 23917 this._map = map; 23918 23919 this._setPanDelta(map.options.keyboardPanDelta); 23920 this._setZoomDelta(map.options.zoomDelta); 23921 }, 23922 23923 addHooks: function () { 23924 var container = this._map._container; 23925 23926 // make the container focusable by tabbing 23927 if (container.tabIndex <= 0) { 23928 container.tabIndex = '0'; 23929 } 23930 23931 on(container, { 23932 focus: this._onFocus, 23933 blur: this._onBlur, 23934 mousedown: this._onMouseDown 23935 }, this); 23936 23937 this._map.on({ 23938 focus: this._addHooks, 23939 blur: this._removeHooks 23940 }, this); 23941 }, 23942 23943 removeHooks: function () { 23944 this._removeHooks(); 23945 23946 off(this._map._container, { 23947 focus: this._onFocus, 23948 blur: this._onBlur, 23949 mousedown: this._onMouseDown 23950 }, this); 23951 23952 this._map.off({ 23953 focus: this._addHooks, 23954 blur: this._removeHooks 23955 }, this); 23956 }, 23957 23958 _onMouseDown: function () { 23959 if (this._focused) { return; } 23960 23961 var body = document.body, 23962 docEl = document.documentElement, 23963 top = body.scrollTop || docEl.scrollTop, 23964 left = body.scrollLeft || docEl.scrollLeft; 23965 23966 this._map._container.focus(); 23967 23968 window.scrollTo(left, top); 23969 }, 23970 23971 _onFocus: function () { 23972 this._focused = true; 23973 this._map.fire('focus'); 23974 }, 23975 23976 _onBlur: function () { 23977 this._focused = false; 23978 this._map.fire('blur'); 23979 }, 23980 23981 _setPanDelta: function (panDelta) { 23982 var keys = this._panKeys = {}, 23983 codes = this.keyCodes, 23984 i, len; 23985 23986 for (i = 0, len = codes.left.length; i < len; i++) { 23987 keys[codes.left[i]] = [-1 * panDelta, 0]; 23988 } 23989 for (i = 0, len = codes.right.length; i < len; i++) { 23990 keys[codes.right[i]] = [panDelta, 0]; 23991 } 23992 for (i = 0, len = codes.down.length; i < len; i++) { 23993 keys[codes.down[i]] = [0, panDelta]; 23994 } 23995 for (i = 0, len = codes.up.length; i < len; i++) { 23996 keys[codes.up[i]] = [0, -1 * panDelta]; 23997 } 23998 }, 23999 24000 _setZoomDelta: function (zoomDelta) { 24001 var keys = this._zoomKeys = {}, 24002 codes = this.keyCodes, 24003 i, len; 24004 24005 for (i = 0, len = codes.zoomIn.length; i < len; i++) { 24006 keys[codes.zoomIn[i]] = zoomDelta; 24007 } 24008 for (i = 0, len = codes.zoomOut.length; i < len; i++) { 24009 keys[codes.zoomOut[i]] = -zoomDelta; 24010 } 24011 }, 24012 24013 _addHooks: function () { 24014 on(document, 'keydown', this._onKeyDown, this); 24015 }, 24016 24017 _removeHooks: function () { 24018 off(document, 'keydown', this._onKeyDown, this); 24019 }, 24020 24021 _onKeyDown: function (e) { 24022 if (e.altKey || e.ctrlKey || e.metaKey) { return; } 24023 24024 var key = e.keyCode, 24025 map = this._map, 24026 offset; 24027 24028 if (key in this._panKeys) { 24029 if (!map._panAnim || !map._panAnim._inProgress) { 24030 offset = this._panKeys[key]; 24031 if (e.shiftKey) { 24032 offset = toPoint(offset).multiplyBy(3); 24033 } 24034 24035 map.panBy(offset); 24036 24037 if (map.options.maxBounds) { 24038 map.panInsideBounds(map.options.maxBounds); 24039 } 24040 } 24041 } else if (key in this._zoomKeys) { 24042 map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]); 24043 24044 } else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) { 24045 map.closePopup(); 24046 24047 } else { 24048 return; 24049 } 24050 24051 stop(e); 24052 } 24053}); 24054 24055// @section Handlers 24056// @section Handlers 24057// @property keyboard: Handler 24058// Keyboard navigation handler. 24059Map.addInitHook('addHandler', 'keyboard', Keyboard); 24060 24061/* 24062 * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map. 24063 */ 24064 24065// @namespace Map 24066// @section Interaction Options 24067Map.mergeOptions({ 24068 // @section Mousewheel options 24069 // @option scrollWheelZoom: Boolean|String = true 24070 // Whether the map can be zoomed by using the mouse wheel. If passed `'center'`, 24071 // it will zoom to the center of the view regardless of where the mouse was. 24072 scrollWheelZoom: true, 24073 24074 // @option wheelDebounceTime: Number = 40 24075 // Limits the rate at which a wheel can fire (in milliseconds). By default 24076 // user can't zoom via wheel more often than once per 40 ms. 24077 wheelDebounceTime: 40, 24078 24079 // @option wheelPxPerZoomLevel: Number = 60 24080 // How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta)) 24081 // mean a change of one full zoom level. Smaller values will make wheel-zooming 24082 // faster (and vice versa). 24083 wheelPxPerZoomLevel: 60 24084}); 24085 24086var ScrollWheelZoom = Handler.extend({ 24087 addHooks: function () { 24088 on(this._map._container, 'mousewheel', this._onWheelScroll, this); 24089 24090 this._delta = 0; 24091 }, 24092 24093 removeHooks: function () { 24094 off(this._map._container, 'mousewheel', this._onWheelScroll, this); 24095 }, 24096 24097 _onWheelScroll: function (e) { 24098 var delta = getWheelDelta(e); 24099 24100 var debounce = this._map.options.wheelDebounceTime; 24101 24102 this._delta += delta; 24103 this._lastMousePos = this._map.mouseEventToContainerPoint(e); 24104 24105 if (!this._startTime) { 24106 this._startTime = +new Date(); 24107 } 24108 24109 var left = Math.max(debounce - (+new Date() - this._startTime), 0); 24110 24111 clearTimeout(this._timer); 24112 this._timer = setTimeout(bind(this._performZoom, this), left); 24113 24114 stop(e); 24115 }, 24116 24117 _performZoom: function () { 24118 var map = this._map, 24119 zoom = map.getZoom(), 24120 snap = this._map.options.zoomSnap || 0; 24121 24122 map._stop(); // stop panning and fly animations if any 24123 24124 // map the delta with a sigmoid function to -4..4 range leaning on -1..1 24125 var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4), 24126 d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2, 24127 d4 = snap ? Math.ceil(d3 / snap) * snap : d3, 24128 delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom; 24129 24130 this._delta = 0; 24131 this._startTime = null; 24132 24133 if (!delta) { return; } 24134 24135 if (map.options.scrollWheelZoom === 'center') { 24136 map.setZoom(zoom + delta); 24137 } else { 24138 map.setZoomAround(this._lastMousePos, zoom + delta); 24139 } 24140 } 24141}); 24142 24143// @section Handlers 24144// @property scrollWheelZoom: Handler 24145// Scroll wheel zoom handler. 24146Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom); 24147 24148/* 24149 * L.Map.Tap is used to enable mobile hacks like quick taps and long hold. 24150 */ 24151 24152// @namespace Map 24153// @section Interaction Options 24154Map.mergeOptions({ 24155 // @section Touch interaction options 24156 // @option tap: Boolean = true 24157 // Enables mobile hacks for supporting instant taps (fixing 200ms click 24158 // delay on iOS/Android) and touch holds (fired as `contextmenu` events). 24159 tap: true, 24160 24161 // @option tapTolerance: Number = 15 24162 // The max number of pixels a user can shift his finger during touch 24163 // for it to be considered a valid tap. 24164 tapTolerance: 15 24165}); 24166 24167var Tap = Handler.extend({ 24168 addHooks: function () { 24169 on(this._map._container, 'touchstart', this._onDown, this); 24170 }, 24171 24172 removeHooks: function () { 24173 off(this._map._container, 'touchstart', this._onDown, this); 24174 }, 24175 24176 _onDown: function (e) { 24177 if (!e.touches) { return; } 24178 24179 preventDefault(e); 24180 24181 this._fireClick = true; 24182 24183 // don't simulate click or track longpress if more than 1 touch 24184 if (e.touches.length > 1) { 24185 this._fireClick = false; 24186 clearTimeout(this._holdTimeout); 24187 return; 24188 } 24189 24190 var first = e.touches[0], 24191 el = first.target; 24192 24193 this._startPos = this._newPos = new Point(first.clientX, first.clientY); 24194 24195 // if touching a link, highlight it 24196 if (el.tagName && el.tagName.toLowerCase() === 'a') { 24197 addClass(el, 'leaflet-active'); 24198 } 24199 24200 // simulate long hold but setting a timeout 24201 this._holdTimeout = setTimeout(bind(function () { 24202 if (this._isTapValid()) { 24203 this._fireClick = false; 24204 this._onUp(); 24205 this._simulateEvent('contextmenu', first); 24206 } 24207 }, this), 1000); 24208 24209 this._simulateEvent('mousedown', first); 24210 24211 on(document, { 24212 touchmove: this._onMove, 24213 touchend: this._onUp 24214 }, this); 24215 }, 24216 24217 _onUp: function (e) { 24218 clearTimeout(this._holdTimeout); 24219 24220 off(document, { 24221 touchmove: this._onMove, 24222 touchend: this._onUp 24223 }, this); 24224 24225 if (this._fireClick && e && e.changedTouches) { 24226 24227 var first = e.changedTouches[0], 24228 el = first.target; 24229 24230 if (el && el.tagName && el.tagName.toLowerCase() === 'a') { 24231 removeClass(el, 'leaflet-active'); 24232 } 24233 24234 this._simulateEvent('mouseup', first); 24235 24236 // simulate click if the touch didn't move too much 24237 if (this._isTapValid()) { 24238 this._simulateEvent('click', first); 24239 } 24240 } 24241 }, 24242 24243 _isTapValid: function () { 24244 return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance; 24245 }, 24246 24247 _onMove: function (e) { 24248 var first = e.touches[0]; 24249 this._newPos = new Point(first.clientX, first.clientY); 24250 this._simulateEvent('mousemove', first); 24251 }, 24252 24253 _simulateEvent: function (type, e) { 24254 var simulatedEvent = document.createEvent('MouseEvents'); 24255 24256 simulatedEvent._simulated = true; 24257 e.target._simulatedClick = true; 24258 24259 simulatedEvent.initMouseEvent( 24260 type, true, true, window, 1, 24261 e.screenX, e.screenY, 24262 e.clientX, e.clientY, 24263 false, false, false, false, 0, null); 24264 24265 e.target.dispatchEvent(simulatedEvent); 24266 } 24267}); 24268 24269// @section Handlers 24270// @property tap: Handler 24271// Mobile touch hacks (quick tap and touch hold) handler. 24272if (touch && !pointer) { 24273 Map.addInitHook('addHandler', 'tap', Tap); 24274} 24275 24276/* 24277 * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers. 24278 */ 24279 24280// @namespace Map 24281// @section Interaction Options 24282Map.mergeOptions({ 24283 // @section Touch interaction options 24284 // @option touchZoom: Boolean|String = * 24285 // Whether the map can be zoomed by touch-dragging with two fingers. If 24286 // passed `'center'`, it will zoom to the center of the view regardless of 24287 // where the touch events (fingers) were. Enabled for touch-capable web 24288 // browsers except for old Androids. 24289 touchZoom: touch && !android23, 24290 24291 // @option bounceAtZoomLimits: Boolean = true 24292 // Set it to false if you don't want the map to zoom beyond min/max zoom 24293 // and then bounce back when pinch-zooming. 24294 bounceAtZoomLimits: true 24295}); 24296 24297var TouchZoom = Handler.extend({ 24298 addHooks: function () { 24299 addClass(this._map._container, 'leaflet-touch-zoom'); 24300 on(this._map._container, 'touchstart', this._onTouchStart, this); 24301 }, 24302 24303 removeHooks: function () { 24304 removeClass(this._map._container, 'leaflet-touch-zoom'); 24305 off(this._map._container, 'touchstart', this._onTouchStart, this); 24306 }, 24307 24308 _onTouchStart: function (e) { 24309 var map = this._map; 24310 if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; } 24311 24312 var p1 = map.mouseEventToContainerPoint(e.touches[0]), 24313 p2 = map.mouseEventToContainerPoint(e.touches[1]); 24314 24315 this._centerPoint = map.getSize()._divideBy(2); 24316 this._startLatLng = map.containerPointToLatLng(this._centerPoint); 24317 if (map.options.touchZoom !== 'center') { 24318 this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2)); 24319 } 24320 24321 this._startDist = p1.distanceTo(p2); 24322 this._startZoom = map.getZoom(); 24323 24324 this._moved = false; 24325 this._zooming = true; 24326 24327 map._stop(); 24328 24329 on(document, 'touchmove', this._onTouchMove, this); 24330 on(document, 'touchend', this._onTouchEnd, this); 24331 24332 preventDefault(e); 24333 }, 24334 24335 _onTouchMove: function (e) { 24336 if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; } 24337 24338 var map = this._map, 24339 p1 = map.mouseEventToContainerPoint(e.touches[0]), 24340 p2 = map.mouseEventToContainerPoint(e.touches[1]), 24341 scale = p1.distanceTo(p2) / this._startDist; 24342 24343 this._zoom = map.getScaleZoom(scale, this._startZoom); 24344 24345 if (!map.options.bounceAtZoomLimits && ( 24346 (this._zoom < map.getMinZoom() && scale < 1) || 24347 (this._zoom > map.getMaxZoom() && scale > 1))) { 24348 this._zoom = map._limitZoom(this._zoom); 24349 } 24350 24351 if (map.options.touchZoom === 'center') { 24352 this._center = this._startLatLng; 24353 if (scale === 1) { return; } 24354 } else { 24355 // Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng 24356 var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint); 24357 if (scale === 1 && delta.x === 0 && delta.y === 0) { return; } 24358 this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom); 24359 } 24360 24361 if (!this._moved) { 24362 map._moveStart(true, false); 24363 this._moved = true; 24364 } 24365 24366 cancelAnimFrame(this._animRequest); 24367 24368 var moveFn = bind(map._move, map, this._center, this._zoom, {pinch: true, round: false}); 24369 this._animRequest = requestAnimFrame(moveFn, this, true); 24370 24371 preventDefault(e); 24372 }, 24373 24374 _onTouchEnd: function () { 24375 if (!this._moved || !this._zooming) { 24376 this._zooming = false; 24377 return; 24378 } 24379 24380 this._zooming = false; 24381 cancelAnimFrame(this._animRequest); 24382 24383 off(document, 'touchmove', this._onTouchMove); 24384 off(document, 'touchend', this._onTouchEnd); 24385 24386 // Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate. 24387 if (this._map.options.zoomAnimation) { 24388 this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap); 24389 } else { 24390 this._map._resetView(this._center, this._map._limitZoom(this._zoom)); 24391 } 24392 } 24393}); 24394 24395// @section Handlers 24396// @property touchZoom: Handler 24397// Touch zoom handler. 24398Map.addInitHook('addHandler', 'touchZoom', TouchZoom); 24399 24400Map.BoxZoom = BoxZoom; 24401Map.DoubleClickZoom = DoubleClickZoom; 24402Map.Drag = Drag; 24403Map.Keyboard = Keyboard; 24404Map.ScrollWheelZoom = ScrollWheelZoom; 24405Map.Tap = Tap; 24406Map.TouchZoom = TouchZoom; 24407 24408Object.freeze = freeze; 24409 24410exports.version = version; 24411exports.Control = Control; 24412exports.control = control; 24413exports.Browser = Browser; 24414exports.Evented = Evented; 24415exports.Mixin = Mixin; 24416exports.Util = Util; 24417exports.Class = Class; 24418exports.Handler = Handler; 24419exports.extend = extend; 24420exports.bind = bind; 24421exports.stamp = stamp; 24422exports.setOptions = setOptions; 24423exports.DomEvent = DomEvent; 24424exports.DomUtil = DomUtil; 24425exports.PosAnimation = PosAnimation; 24426exports.Draggable = Draggable; 24427exports.LineUtil = LineUtil; 24428exports.PolyUtil = PolyUtil; 24429exports.Point = Point; 24430exports.point = toPoint; 24431exports.Bounds = Bounds; 24432exports.bounds = toBounds; 24433exports.Transformation = Transformation; 24434exports.transformation = toTransformation; 24435exports.Projection = index; 24436exports.LatLng = LatLng; 24437exports.latLng = toLatLng; 24438exports.LatLngBounds = LatLngBounds; 24439exports.latLngBounds = toLatLngBounds; 24440exports.CRS = CRS; 24441exports.GeoJSON = GeoJSON; 24442exports.geoJSON = geoJSON; 24443exports.geoJson = geoJson; 24444exports.Layer = Layer; 24445exports.LayerGroup = LayerGroup; 24446exports.layerGroup = layerGroup; 24447exports.FeatureGroup = FeatureGroup; 24448exports.featureGroup = featureGroup; 24449exports.ImageOverlay = ImageOverlay; 24450exports.imageOverlay = imageOverlay; 24451exports.VideoOverlay = VideoOverlay; 24452exports.videoOverlay = videoOverlay; 24453exports.SVGOverlay = SVGOverlay; 24454exports.svgOverlay = svgOverlay; 24455exports.DivOverlay = DivOverlay; 24456exports.Popup = Popup; 24457exports.popup = popup; 24458exports.Tooltip = Tooltip; 24459exports.tooltip = tooltip; 24460exports.Icon = Icon; 24461exports.icon = icon; 24462exports.DivIcon = DivIcon; 24463exports.divIcon = divIcon; 24464exports.Marker = Marker; 24465exports.marker = marker; 24466exports.TileLayer = TileLayer; 24467exports.tileLayer = tileLayer; 24468exports.GridLayer = GridLayer; 24469exports.gridLayer = gridLayer; 24470exports.SVG = SVG; 24471exports.svg = svg$1; 24472exports.Renderer = Renderer; 24473exports.Canvas = Canvas; 24474exports.canvas = canvas$1; 24475exports.Path = Path; 24476exports.CircleMarker = CircleMarker; 24477exports.circleMarker = circleMarker; 24478exports.Circle = Circle; 24479exports.circle = circle; 24480exports.Polyline = Polyline; 24481exports.polyline = polyline; 24482exports.Polygon = Polygon; 24483exports.polygon = polygon; 24484exports.Rectangle = Rectangle; 24485exports.rectangle = rectangle; 24486exports.Map = Map; 24487exports.map = createMap; 24488 24489var oldL = window.L; 24490exports.noConflict = function() { 24491 window.L = oldL; 24492 return this; 24493} 24494 24495// Always export us to window global (see #2364) 24496window.L = exports; 24497 24498}))); 24499//# sourceMappingURL=leaflet-src.js.map 24500 24501 24502/***/ }), 24503
vendor: 21,693 bytes, lines 24504-25265
24504/***/ "./node_modules/mgrs/mgrs.js": 24505/*!***********************************!*\ 24506 !*** ./node_modules/mgrs/mgrs.js ***! 24507 \***********************************/ 24508/*! exports provided: default, forward, inverse, toPoint */ 24509/***/ (function(module, __webpack_exports__, __webpack_require__) { 24510 24511"use strict"; 24512__webpack_require__.r(__webpack_exports__); 24513/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 24514/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 24515/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPoint", function() { return toPoint; }); 24516 24517 24518 24519/** 24520 * UTM zones are grouped, and assigned to one of a group of 6 24521 * sets. 24522 * 24523 * {int} @private 24524 */ 24525var NUM_100K_SETS = 6; 24526 24527/** 24528 * The column letters (for easting) of the lower left value, per 24529 * set. 24530 * 24531 * {string} @private 24532 */ 24533var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS'; 24534 24535/** 24536 * The row letters (for northing) of the lower left value, per 24537 * set. 24538 * 24539 * {string} @private 24540 */ 24541var SET_ORIGIN_ROW_LETTERS = 'AFAFAF'; 24542 24543var A = 65; // A 24544var I = 73; // I 24545var O = 79; // O 24546var V = 86; // V 24547var Z = 90; // Z 24548/* harmony default export */ __webpack_exports__["default"] = ({ 24549 forward: forward, 24550 inverse: inverse, 24551 toPoint: toPoint 24552}); 24553/** 24554 * Conversion of lat/lon to MGRS. 24555 * 24556 * @param {object} ll Object literal with lat and lon properties on a 24557 * WGS84 ellipsoid. 24558 * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for 24559 * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5. 24560 * @return {string} the MGRS string for the given location and accuracy. 24561 */ 24562function forward(ll, accuracy) { 24563 accuracy = accuracy || 5; // default accuracy 1m 24564 return encode(LLtoUTM({ 24565 lat: ll[1], 24566 lon: ll[0] 24567 }), accuracy); 24568}; 24569 24570/** 24571 * Conversion of MGRS to lat/lon. 24572 * 24573 * @param {string} mgrs MGRS string. 24574 * @return {array} An array with left (longitude), bottom (latitude), right 24575 * (longitude) and top (latitude) values in WGS84, representing the 24576 * bounding box for the provided MGRS reference. 24577 */ 24578function inverse(mgrs) { 24579 var bbox = UTMtoLL(decode(mgrs.toUpperCase())); 24580 if (bbox.lat && bbox.lon) { 24581 return [bbox.lon, bbox.lat, bbox.lon, bbox.lat]; 24582 } 24583 return [bbox.left, bbox.bottom, bbox.right, bbox.top]; 24584}; 24585 24586function toPoint(mgrs) { 24587 var bbox = UTMtoLL(decode(mgrs.toUpperCase())); 24588 if (bbox.lat && bbox.lon) { 24589 return [bbox.lon, bbox.lat]; 24590 } 24591 return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2]; 24592}; 24593/** 24594 * Conversion from degrees to radians. 24595 * 24596 * @private 24597 * @param {number} deg the angle in degrees. 24598 * @return {number} the angle in radians. 24599 */ 24600function degToRad(deg) { 24601 return (deg * (Math.PI / 180.0)); 24602} 24603 24604/** 24605 * Conversion from radians to degrees. 24606 * 24607 * @private 24608 * @param {number} rad the angle in radians. 24609 * @return {number} the angle in degrees. 24610 */ 24611function radToDeg(rad) { 24612 return (180.0 * (rad / Math.PI)); 24613} 24614 24615/** 24616 * Converts a set of Longitude and Latitude co-ordinates to UTM 24617 * using the WGS84 ellipsoid. 24618 * 24619 * @private 24620 * @param {object} ll Object literal with lat and lon properties 24621 * representing the WGS84 coordinate to be converted. 24622 * @return {object} Object literal containing the UTM value with easting, 24623 * northing, zoneNumber and zoneLetter properties, and an optional 24624 * accuracy property in digits. Returns null if the conversion failed. 24625 */ 24626function LLtoUTM(ll) { 24627 var Lat = ll.lat; 24628 var Long = ll.lon; 24629 var a = 6378137.0; //ellip.radius; 24630 var eccSquared = 0.00669438; //ellip.eccsq; 24631 var k0 = 0.9996; 24632 var LongOrigin; 24633 var eccPrimeSquared; 24634 var N, T, C, A, M; 24635 var LatRad = degToRad(Lat); 24636 var LongRad = degToRad(Long); 24637 var LongOriginRad; 24638 var ZoneNumber; 24639 // (int) 24640 ZoneNumber = Math.floor((Long + 180) / 6) + 1; 24641 24642 //Make sure the longitude 180.00 is in Zone 60 24643 if (Long === 180) { 24644 ZoneNumber = 60; 24645 } 24646 24647 // Special zone for Norway 24648 if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) { 24649 ZoneNumber = 32; 24650 } 24651 24652 // Special zones for Svalbard 24653 if (Lat >= 72.0 && Lat < 84.0) { 24654 if (Long >= 0.0 && Long < 9.0) { 24655 ZoneNumber = 31; 24656 } 24657 else if (Long >= 9.0 && Long < 21.0) { 24658 ZoneNumber = 33; 24659 } 24660 else if (Long >= 21.0 && Long < 33.0) { 24661 ZoneNumber = 35; 24662 } 24663 else if (Long >= 33.0 && Long < 42.0) { 24664 ZoneNumber = 37; 24665 } 24666 } 24667 24668 LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin 24669 // in middle of 24670 // zone 24671 LongOriginRad = degToRad(LongOrigin); 24672 24673 eccPrimeSquared = (eccSquared) / (1 - eccSquared); 24674 24675 N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad)); 24676 T = Math.tan(LatRad) * Math.tan(LatRad); 24677 C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad); 24678 A = Math.cos(LatRad) * (LongRad - LongOriginRad); 24679 24680 M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad)); 24681 24682 var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0); 24683 24684 var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0))); 24685 if (Lat < 0.0) { 24686 UTMNorthing += 10000000.0; //10000000 meter offset for 24687 // southern hemisphere 24688 } 24689 24690 return { 24691 northing: Math.round(UTMNorthing), 24692 easting: Math.round(UTMEasting), 24693 zoneNumber: ZoneNumber, 24694 zoneLetter: getLetterDesignator(Lat) 24695 }; 24696} 24697 24698/** 24699 * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience 24700 * class where the Zone can be specified as a single string eg."60N" which 24701 * is then broken down into the ZoneNumber and ZoneLetter. 24702 * 24703 * @private 24704 * @param {object} utm An object literal with northing, easting, zoneNumber 24705 * and zoneLetter properties. If an optional accuracy property is 24706 * provided (in meters), a bounding box will be returned instead of 24707 * latitude and longitude. 24708 * @return {object} An object literal containing either lat and lon values 24709 * (if no accuracy was provided), or top, right, bottom and left values 24710 * for the bounding box calculated according to the provided accuracy. 24711 * Returns null if the conversion failed. 24712 */ 24713function UTMtoLL(utm) { 24714 24715 var UTMNorthing = utm.northing; 24716 var UTMEasting = utm.easting; 24717 var zoneLetter = utm.zoneLetter; 24718 var zoneNumber = utm.zoneNumber; 24719 // check the ZoneNummber is valid 24720 if (zoneNumber < 0 || zoneNumber > 60) { 24721 return null; 24722 } 24723 24724 var k0 = 0.9996; 24725 var a = 6378137.0; //ellip.radius; 24726 var eccSquared = 0.00669438; //ellip.eccsq; 24727 var eccPrimeSquared; 24728 var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared)); 24729 var N1, T1, C1, R1, D, M; 24730 var LongOrigin; 24731 var mu, phi1Rad; 24732 24733 // remove 500,000 meter offset for longitude 24734 var x = UTMEasting - 500000.0; 24735 var y = UTMNorthing; 24736 24737 // We must know somehow if we are in the Northern or Southern 24738 // hemisphere, this is the only time we use the letter So even 24739 // if the Zone letter isn't exactly correct it should indicate 24740 // the hemisphere correctly 24741 if (zoneLetter < 'N') { 24742 y -= 10000000.0; // remove 10,000,000 meter offset used 24743 // for southern hemisphere 24744 } 24745 24746 // There are 60 zones with zone 1 being at West -180 to -174 24747 LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin 24748 // in middle of 24749 // zone 24750 24751 eccPrimeSquared = (eccSquared) / (1 - eccSquared); 24752 24753 M = y / k0; 24754 mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256)); 24755 24756 phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu); 24757 // double phi1 = ProjMath.radToDeg(phi1Rad); 24758 24759 N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad)); 24760 T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad); 24761 C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad); 24762 R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5); 24763 D = x / (N1 * k0); 24764 24765 var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720); 24766 lat = radToDeg(lat); 24767 24768 var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad); 24769 lon = LongOrigin + radToDeg(lon); 24770 24771 var result; 24772 if (utm.accuracy) { 24773 var topRight = UTMtoLL({ 24774 northing: utm.northing + utm.accuracy, 24775 easting: utm.easting + utm.accuracy, 24776 zoneLetter: utm.zoneLetter, 24777 zoneNumber: utm.zoneNumber 24778 }); 24779 result = { 24780 top: topRight.lat, 24781 right: topRight.lon, 24782 bottom: lat, 24783 left: lon 24784 }; 24785 } 24786 else { 24787 result = { 24788 lat: lat, 24789 lon: lon 24790 }; 24791 } 24792 return result; 24793} 24794 24795/** 24796 * Calculates the MGRS letter designator for the given latitude. 24797 * 24798 * @private 24799 * @param {number} lat The latitude in WGS84 to get the letter designator 24800 * for. 24801 * @return {char} The letter designator. 24802 */ 24803function getLetterDesignator(lat) { 24804 //This is here as an error flag to show that the Latitude is 24805 //outside MGRS limits 24806 var LetterDesignator = 'Z'; 24807 24808 if ((84 >= lat) && (lat >= 72)) { 24809 LetterDesignator = 'X'; 24810 } 24811 else if ((72 > lat) && (lat >= 64)) { 24812 LetterDesignator = 'W'; 24813 } 24814 else if ((64 > lat) && (lat >= 56)) { 24815 LetterDesignator = 'V'; 24816 } 24817 else if ((56 > lat) && (lat >= 48)) { 24818 LetterDesignator = 'U'; 24819 } 24820 else if ((48 > lat) && (lat >= 40)) { 24821 LetterDesignator = 'T'; 24822 } 24823 else if ((40 > lat) && (lat >= 32)) { 24824 LetterDesignator = 'S'; 24825 } 24826 else if ((32 > lat) && (lat >= 24)) { 24827 LetterDesignator = 'R'; 24828 } 24829 else if ((24 > lat) && (lat >= 16)) { 24830 LetterDesignator = 'Q'; 24831 } 24832 else if ((16 > lat) && (lat >= 8)) { 24833 LetterDesignator = 'P'; 24834 } 24835 else if ((8 > lat) && (lat >= 0)) { 24836 LetterDesignator = 'N'; 24837 } 24838 else if ((0 > lat) && (lat >= -8)) { 24839 LetterDesignator = 'M'; 24840 } 24841 else if ((-8 > lat) && (lat >= -16)) { 24842 LetterDesignator = 'L'; 24843 } 24844 else if ((-16 > lat) && (lat >= -24)) { 24845 LetterDesignator = 'K'; 24846 } 24847 else if ((-24 > lat) && (lat >= -32)) { 24848 LetterDesignator = 'J'; 24849 } 24850 else if ((-32 > lat) && (lat >= -40)) { 24851 LetterDesignator = 'H'; 24852 } 24853 else if ((-40 > lat) && (lat >= -48)) { 24854 LetterDesignator = 'G'; 24855 } 24856 else if ((-48 > lat) && (lat >= -56)) { 24857 LetterDesignator = 'F'; 24858 } 24859 else if ((-56 > lat) && (lat >= -64)) { 24860 LetterDesignator = 'E'; 24861 } 24862 else if ((-64 > lat) && (lat >= -72)) { 24863 LetterDesignator = 'D'; 24864 } 24865 else if ((-72 > lat) && (lat >= -80)) { 24866 LetterDesignator = 'C'; 24867 } 24868 return LetterDesignator; 24869} 24870 24871/** 24872 * Encodes a UTM location as MGRS string. 24873 * 24874 * @private 24875 * @param {object} utm An object literal with easting, northing, 24876 * zoneLetter, zoneNumber 24877 * @param {number} accuracy Accuracy in digits (1-5). 24878 * @return {string} MGRS string for the given UTM location. 24879 */ 24880function encode(utm, accuracy) { 24881 // prepend with leading zeroes 24882 var seasting = "00000" + utm.easting, 24883 snorthing = "00000" + utm.northing; 24884 24885 return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy); 24886} 24887 24888/** 24889 * Get the two letter 100k designator for a given UTM easting, 24890 * northing and zone number value. 24891 * 24892 * @private 24893 * @param {number} easting 24894 * @param {number} northing 24895 * @param {number} zoneNumber 24896 * @return the two letter 100k designator for the given UTM location. 24897 */ 24898function get100kID(easting, northing, zoneNumber) { 24899 var setParm = get100kSetForZone(zoneNumber); 24900 var setColumn = Math.floor(easting / 100000); 24901 var setRow = Math.floor(northing / 100000) % 20; 24902 return getLetter100kID(setColumn, setRow, setParm); 24903} 24904 24905/** 24906 * Given a UTM zone number, figure out the MGRS 100K set it is in. 24907 * 24908 * @private 24909 * @param {number} i An UTM zone number. 24910 * @return {number} the 100k set the UTM zone is in. 24911 */ 24912function get100kSetForZone(i) { 24913 var setParm = i % NUM_100K_SETS; 24914 if (setParm === 0) { 24915 setParm = NUM_100K_SETS; 24916 } 24917 24918 return setParm; 24919} 24920 24921/** 24922 * Get the two-letter MGRS 100k designator given information 24923 * translated from the UTM northing, easting and zone number. 24924 * 24925 * @private 24926 * @param {number} column the column index as it relates to the MGRS 24927 * 100k set spreadsheet, created from the UTM easting. 24928 * Values are 1-8. 24929 * @param {number} row the row index as it relates to the MGRS 100k set 24930 * spreadsheet, created from the UTM northing value. Values 24931 * are from 0-19. 24932 * @param {number} parm the set block, as it relates to the MGRS 100k set 24933 * spreadsheet, created from the UTM zone. Values are from 24934 * 1-60. 24935 * @return two letter MGRS 100k code. 24936 */ 24937function getLetter100kID(column, row, parm) { 24938 // colOrigin and rowOrigin are the letters at the origin of the set 24939 var index = parm - 1; 24940 var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index); 24941 var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index); 24942 24943 // colInt and rowInt are the letters to build to return 24944 var colInt = colOrigin + column - 1; 24945 var rowInt = rowOrigin + row; 24946 var rollover = false; 24947 24948 if (colInt > Z) { 24949 colInt = colInt - Z + A - 1; 24950 rollover = true; 24951 } 24952 24953 if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) { 24954 colInt++; 24955 } 24956 24957 if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) { 24958 colInt++; 24959 24960 if (colInt === I) { 24961 colInt++; 24962 } 24963 } 24964 24965 if (colInt > Z) { 24966 colInt = colInt - Z + A - 1; 24967 } 24968 24969 if (rowInt > V) { 24970 rowInt = rowInt - V + A - 1; 24971 rollover = true; 24972 } 24973 else { 24974 rollover = false; 24975 } 24976 24977 if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) { 24978 rowInt++; 24979 } 24980 24981 if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) { 24982 rowInt++; 24983 24984 if (rowInt === I) { 24985 rowInt++; 24986 } 24987 } 24988 24989 if (rowInt > V) { 24990 rowInt = rowInt - V + A - 1; 24991 } 24992 24993 var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt); 24994 return twoLetter; 24995} 24996 24997/** 24998 * Decode the UTM parameters from a MGRS string. 24999 * 25000 * @private 25001 * @param {string} mgrsString an UPPERCASE coordinate string is expected. 25002 * @return {object} An object literal with easting, northing, zoneLetter, 25003 * zoneNumber and accuracy (in meters) properties. 25004 */ 25005function decode(mgrsString) { 25006 25007 if (mgrsString && mgrsString.length === 0) { 25008 throw ("MGRSPoint coverting from nothing"); 25009 } 25010 25011 var length = mgrsString.length; 25012 25013 var hunK = null; 25014 var sb = ""; 25015 var testChar; 25016 var i = 0; 25017 25018 // get Zone number 25019 while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) { 25020 if (i >= 2) { 25021 throw ("MGRSPoint bad conversion from: " + mgrsString); 25022 } 25023 sb += testChar; 25024 i++; 25025 } 25026 25027 var zoneNumber = parseInt(sb, 10); 25028 25029 if (i === 0 || i + 3 > length) { 25030 // A good MGRS string has to be 4-5 digits long, 25031 // ##AAA/#AAA at least. 25032 throw ("MGRSPoint bad conversion from: " + mgrsString); 25033 } 25034 25035 var zoneLetter = mgrsString.charAt(i++); 25036 25037 // Should we check the zone letter here? Why not. 25038 if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') { 25039 throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString); 25040 } 25041 25042 hunK = mgrsString.substring(i, i += 2); 25043 25044 var set = get100kSetForZone(zoneNumber); 25045 25046 var east100k = getEastingFromChar(hunK.charAt(0), set); 25047 var north100k = getNorthingFromChar(hunK.charAt(1), set); 25048 25049 // We have a bug where the northing may be 2000000 too low. 25050 // How 25051 // do we know when to roll over? 25052 25053 while (north100k < getMinNorthing(zoneLetter)) { 25054 north100k += 2000000; 25055 } 25056 25057 // calculate the char index for easting/northing separator 25058 var remainder = length - i; 25059 25060 if (remainder % 2 !== 0) { 25061 throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString); 25062 } 25063 25064 var sep = remainder / 2; 25065 25066 var sepEasting = 0.0; 25067 var sepNorthing = 0.0; 25068 var accuracyBonus, sepEastingString, sepNorthingString, easting, northing; 25069 if (sep > 0) { 25070 accuracyBonus = 100000.0 / Math.pow(10, sep); 25071 sepEastingString = mgrsString.substring(i, i + sep); 25072 sepEasting = parseFloat(sepEastingString) * accuracyBonus; 25073 sepNorthingString = mgrsString.substring(i + sep); 25074 sepNorthing = parseFloat(sepNorthingString) * accuracyBonus; 25075 } 25076 25077 easting = sepEasting + east100k; 25078 northing = sepNorthing + north100k; 25079 25080 return { 25081 easting: easting, 25082 northing: northing, 25083 zoneLetter: zoneLetter, 25084 zoneNumber: zoneNumber, 25085 accuracy: accuracyBonus 25086 }; 25087} 25088 25089/** 25090 * Given the first letter from a two-letter MGRS 100k zone, and given the 25091 * MGRS table set for the zone number, figure out the easting value that 25092 * should be added to the other, secondary easting value. 25093 * 25094 * @private 25095 * @param {char} e The first letter from a two-letter MGRS 100´k zone. 25096 * @param {number} set The MGRS table set for the zone number. 25097 * @return {number} The easting value for the given letter and set. 25098 */ 25099function getEastingFromChar(e, set) { 25100 // colOrigin is the letter at the origin of the set for the 25101 // column 25102 var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1); 25103 var eastingValue = 100000.0; 25104 var rewindMarker = false; 25105 25106 while (curCol !== e.charCodeAt(0)) { 25107 curCol++; 25108 if (curCol === I) { 25109 curCol++; 25110 } 25111 if (curCol === O) { 25112 curCol++; 25113 } 25114 if (curCol > Z) { 25115 if (rewindMarker) { 25116 throw ("Bad character: " + e); 25117 } 25118 curCol = A; 25119 rewindMarker = true; 25120 } 25121 eastingValue += 100000.0; 25122 } 25123 25124 return eastingValue; 25125} 25126 25127/** 25128 * Given the second letter from a two-letter MGRS 100k zone, and given the 25129 * MGRS table set for the zone number, figure out the northing value that 25130 * should be added to the other, secondary northing value. You have to 25131 * remember that Northings are determined from the equator, and the vertical 25132 * cycle of letters mean a 2000000 additional northing meters. This happens 25133 * approx. every 18 degrees of latitude. This method does *NOT* count any 25134 * additional northings. You have to figure out how many 2000000 meters need 25135 * to be added for the zone letter of the MGRS coordinate. 25136 * 25137 * @private 25138 * @param {char} n Second letter of the MGRS 100k zone 25139 * @param {number} set The MGRS table set number, which is dependent on the 25140 * UTM zone number. 25141 * @return {number} The northing value for the given letter and set. 25142 */ 25143function getNorthingFromChar(n, set) { 25144 25145 if (n > 'V') { 25146 throw ("MGRSPoint given invalid Northing " + n); 25147 } 25148 25149 // rowOrigin is the letter at the origin of the set for the 25150 // column 25151 var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1); 25152 var northingValue = 0.0; 25153 var rewindMarker = false; 25154 25155 while (curRow !== n.charCodeAt(0)) { 25156 curRow++; 25157 if (curRow === I) { 25158 curRow++; 25159 } 25160 if (curRow === O) { 25161 curRow++; 25162 } 25163 // fixing a bug making whole application hang in this loop 25164 // when 'n' is a wrong character 25165 if (curRow > V) { 25166 if (rewindMarker) { // making sure that this loop ends 25167 throw ("Bad character: " + n); 25168 } 25169 curRow = A; 25170 rewindMarker = true; 25171 } 25172 northingValue += 100000.0; 25173 } 25174 25175 return northingValue; 25176} 25177 25178/** 25179 * The function getMinNorthing returns the minimum northing value of a MGRS 25180 * zone. 25181 * 25182 * Ported from Geotrans' c Lattitude_Band_Value structure table. 25183 * 25184 * @private 25185 * @param {char} zoneLetter The MGRS zone to get the min northing for. 25186 * @return {number} 25187 */ 25188function getMinNorthing(zoneLetter) { 25189 var northing; 25190 switch (zoneLetter) { 25191 case 'C': 25192 northing = 1100000.0; 25193 break; 25194 case 'D': 25195 northing = 2000000.0; 25196 break; 25197 case 'E': 25198 northing = 2800000.0; 25199 break; 25200 case 'F': 25201 northing = 3700000.0; 25202 break; 25203 case 'G': 25204 northing = 4600000.0; 25205 break; 25206 case 'H': 25207 northing = 5500000.0; 25208 break; 25209 case 'J': 25210 northing = 6400000.0; 25211 break; 25212 case 'K': 25213 northing = 7300000.0; 25214 break; 25215 case 'L': 25216 northing = 8200000.0; 25217 break; 25218 case 'M': 25219 northing = 9100000.0; 25220 break; 25221 case 'N': 25222 northing = 0.0; 25223 break; 25224 case 'P': 25225 northing = 800000.0; 25226 break; 25227 case 'Q': 25228 northing = 1700000.0; 25229 break; 25230 case 'R': 25231 northing = 2600000.0; 25232 break; 25233 case 'S': 25234 northing = 3500000.0; 25235 break; 25236 case 'T': 25237 northing = 4400000.0; 25238 break; 25239 case 'U': 25240 northing = 5300000.0; 25241 break; 25242 case 'V': 25243 northing = 6200000.0; 25244 break; 25245 case 'W': 25246 northing = 7000000.0; 25247 break; 25248 case 'X': 25249 northing = 7900000.0; 25250 break; 25251 default: 25252 northing = -1.0; 25253 } 25254 if (northing >= 0.0) { 25255 return northing; 25256 } 25257 else { 25258 throw ("Invalid zone letter: " + zoneLetter); 25259 } 25260 25261} 25262 25263 25264/***/ }), 25265
vendor: 5,681 bytes, lines 25266-25460
25266/***/ "./node_modules/process/browser.js": 25267/*!*****************************************!*\ 25268 !*** ./node_modules/process/browser.js ***! 25269 \*****************************************/ 25270/*! no static exports found */ 25271/***/ (function(module, exports) { 25272 25273// shim for using process in browser 25274var process = module.exports = {}; 25275 25276// cached from whatever global is present so that test runners that stub it 25277// don't break things. But we need to wrap it in a try catch in case it is 25278// wrapped in strict mode code which doesn't define any globals. It's inside a 25279// function because try/catches deoptimize in certain engines. 25280 25281var cachedSetTimeout; 25282var cachedClearTimeout; 25283 25284function defaultSetTimout() { 25285 throw new Error('setTimeout has not been defined'); 25286} 25287function defaultClearTimeout () { 25288 throw new Error('clearTimeout has not been defined'); 25289} 25290(function () { 25291 try { 25292 if (typeof setTimeout === 'function') { 25293 cachedSetTimeout = setTimeout; 25294 } else { 25295 cachedSetTimeout = defaultSetTimout; 25296 } 25297 } catch (e) { 25298 cachedSetTimeout = defaultSetTimout; 25299 } 25300 try { 25301 if (typeof clearTimeout === 'function') { 25302 cachedClearTimeout = clearTimeout; 25303 } else { 25304 cachedClearTimeout = defaultClearTimeout; 25305 } 25306 } catch (e) { 25307 cachedClearTimeout = defaultClearTimeout; 25308 } 25309} ()) 25310function runTimeout(fun) { 25311 if (cachedSetTimeout === setTimeout) { 25312 //normal enviroments in sane situations 25313 return setTimeout(fun, 0); 25314 } 25315 // if setTimeout wasn't available but was latter defined 25316 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 25317 cachedSetTimeout = setTimeout; 25318 return setTimeout(fun, 0); 25319 } 25320 try { 25321 // when when somebody has screwed with setTimeout but no I.E. maddness 25322 return cachedSetTimeout(fun, 0); 25323 } catch(e){ 25324 try { 25325 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 25326 return cachedSetTimeout.call(null, fun, 0); 25327 } catch(e){ 25328 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 25329 return cachedSetTimeout.call(this, fun, 0); 25330 } 25331 } 25332 25333 25334} 25335function runClearTimeout(marker) { 25336 if (cachedClearTimeout === clearTimeout) { 25337 //normal enviroments in sane situations 25338 return clearTimeout(marker); 25339 } 25340 // if clearTimeout wasn't available but was latter defined 25341 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 25342 cachedClearTimeout = clearTimeout; 25343 return clearTimeout(marker); 25344 } 25345 try { 25346 // when when somebody has screwed with setTimeout but no I.E. maddness 25347 return cachedClearTimeout(marker); 25348 } catch (e){ 25349 try { 25350 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 25351 return cachedClearTimeout.call(null, marker); 25352 } catch (e){ 25353 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 25354 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 25355 return cachedClearTimeout.call(this, marker); 25356 } 25357 } 25358 25359 25360 25361} 25362var queue = []; 25363var draining = false; 25364var currentQueue; 25365var queueIndex = -1; 25366 25367function cleanUpNextTick() { 25368 if (!draining || !currentQueue) { 25369 return; 25370 } 25371 draining = false; 25372 if (currentQueue.length) { 25373 queue = currentQueue.concat(queue); 25374 } else { 25375 queueIndex = -1; 25376 } 25377 if (queue.length) { 25378 drainQueue(); 25379 } 25380} 25381 25382function drainQueue() { 25383 if (draining) { 25384 return; 25385 } 25386 var timeout = runTimeout(cleanUpNextTick); 25387 draining = true; 25388 25389 var len = queue.length; 25390 while(len) { 25391 currentQueue = queue; 25392 queue = []; 25393 while (++queueIndex < len) { 25394 if (currentQueue) { 25395 currentQueue[queueIndex].run(); 25396 } 25397 } 25398 queueIndex = -1; 25399 len = queue.length; 25400 } 25401 currentQueue = null; 25402 draining = false; 25403 runClearTimeout(timeout); 25404} 25405 25406process.nextTick = function (fun) { 25407 var args = new Array(arguments.length - 1); 25408 if (arguments.length > 1) { 25409 for (var i = 1; i < arguments.length; i++) { 25410 args[i - 1] = arguments[i]; 25411 } 25412 } 25413 queue.push(new Item(fun, args)); 25414 if (queue.length === 1 && !draining) { 25415 runTimeout(drainQueue); 25416 } 25417}; 25418 25419// v8 likes predictible objects 25420function Item(fun, array) { 25421 this.fun = fun; 25422 this.array = array; 25423} 25424Item.prototype.run = function () { 25425 this.fun.apply(null, this.array); 25426}; 25427process.title = 'browser'; 25428process.browser = true; 25429process.env = {}; 25430process.argv = []; 25431process.version = ''; // empty string to avoid regexp issues 25432process.versions = {}; 25433 25434function noop() {} 25435 25436process.on = noop; 25437process.addListener = noop; 25438process.once = noop; 25439process.off = noop; 25440process.removeListener = noop; 25441process.removeAllListeners = noop; 25442process.emit = noop; 25443process.prependListener = noop; 25444process.prependOnceListener = noop; 25445 25446process.listeners = function (name) { return [] } 25447 25448process.binding = function (name) { 25449 throw new Error('process.binding is not supported'); 25450}; 25451 25452process.cwd = function () { return '/' }; 25453process.chdir = function (dir) { 25454 throw new Error('process.chdir is not supported'); 25455}; 25456process.umask = function() { return 0; }; 25457 25458 25459/***/ }), 25460
vendor: 1,476 bytes, lines 25461-25508
25461/***/ "./node_modules/proj4/lib/Point.js": 25462/*!*****************************************!*\ 25463 !*** ./node_modules/proj4/lib/Point.js ***! 25464 \*****************************************/ 25465/*! exports provided: default */ 25466/***/ (function(module, __webpack_exports__, __webpack_require__) { 25467 25468"use strict"; 25469__webpack_require__.r(__webpack_exports__); 25470/* harmony import */ var mgrs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mgrs */ "./node_modules/mgrs/mgrs.js"); 25471 25472 25473function Point(x, y, z) { 25474 if (!(this instanceof Point)) { 25475 return new Point(x, y, z); 25476 } 25477 if (Array.isArray(x)) { 25478 this.x = x[0]; 25479 this.y = x[1]; 25480 this.z = x[2] || 0.0; 25481 } else if(typeof x === 'object') { 25482 this.x = x.x; 25483 this.y = x.y; 25484 this.z = x.z || 0.0; 25485 } else if (typeof x === 'string' && typeof y === 'undefined') { 25486 var coords = x.split(','); 25487 this.x = parseFloat(coords[0], 10); 25488 this.y = parseFloat(coords[1], 10); 25489 this.z = parseFloat(coords[2], 10) || 0.0; 25490 } else { 25491 this.x = x; 25492 this.y = y; 25493 this.z = z || 0.0; 25494 } 25495 console.warn('proj4.Point will be removed in version 3, use proj4.toPoint'); 25496} 25497 25498Point.fromMGRS = function(mgrsStr) { 25499 return new Point(Object(mgrs__WEBPACK_IMPORTED_MODULE_0__["toPoint"])(mgrsStr)); 25500}; 25501Point.prototype.toMGRS = function(accuracy) { 25502 return Object(mgrs__WEBPACK_IMPORTED_MODULE_0__["forward"])([this.x, this.y], accuracy); 25503}; 25504/* harmony default export */ __webpack_exports__["default"] = (Point); 25505 25506 25507/***/ }), 25508
vendor: 4,047 bytes, lines 25509-25601
25509/***/ "./node_modules/proj4/lib/Proj.js": 25510/*!****************************************!*\ 25511 !*** ./node_modules/proj4/lib/Proj.js ***! 25512 \****************************************/ 25513/*! exports provided: default */ 25514/***/ (function(module, __webpack_exports__, __webpack_require__) { 25515 25516"use strict"; 25517__webpack_require__.r(__webpack_exports__); 25518/* harmony import */ var _parseCode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parseCode */ "./node_modules/proj4/lib/parseCode.js"); 25519/* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extend */ "./node_modules/proj4/lib/extend.js"); 25520/* harmony import */ var _projections__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./projections */ "./node_modules/proj4/lib/projections.js"); 25521/* harmony import */ var _deriveConstants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./deriveConstants */ "./node_modules/proj4/lib/deriveConstants.js"); 25522/* harmony import */ var _constants_Datum__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants/Datum */ "./node_modules/proj4/lib/constants/Datum.js"); 25523/* harmony import */ var _datum__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./datum */ "./node_modules/proj4/lib/datum.js"); 25524/* harmony import */ var _match__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./match */ "./node_modules/proj4/lib/match.js"); 25525/* harmony import */ var _nadgrid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./nadgrid */ "./node_modules/proj4/lib/nadgrid.js"); 25526 25527 25528 25529 25530 25531 25532 25533 25534 25535function Projection(srsCode,callback) { 25536 if (!(this instanceof Projection)) { 25537 return new Projection(srsCode); 25538 } 25539 callback = callback || function(error){ 25540 if(error){ 25541 throw error; 25542 } 25543 }; 25544 var json = Object(_parseCode__WEBPACK_IMPORTED_MODULE_0__["default"])(srsCode); 25545 if(typeof json !== 'object'){ 25546 callback(srsCode); 25547 return; 25548 } 25549 var ourProj = Projection.projections.get(json.projName); 25550 if(!ourProj){ 25551 callback(srsCode); 25552 return; 25553 } 25554 if (json.datumCode && json.datumCode !== 'none') { 25555 var datumDef = Object(_match__WEBPACK_IMPORTED_MODULE_6__["default"])(_constants_Datum__WEBPACK_IMPORTED_MODULE_4__["default"], json.datumCode); 25556 if (datumDef) { 25557 json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null; 25558 json.ellps = datumDef.ellipse; 25559 json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode; 25560 } 25561 } 25562 json.k0 = json.k0 || 1.0; 25563 json.axis = json.axis || 'enu'; 25564 json.ellps = json.ellps || 'wgs84'; 25565 var sphere_ = Object(_deriveConstants__WEBPACK_IMPORTED_MODULE_3__["sphere"])(json.a, json.b, json.rf, json.ellps, json.sphere); 25566 var ecc = Object(_deriveConstants__WEBPACK_IMPORTED_MODULE_3__["eccentricity"])(sphere_.a, sphere_.b, sphere_.rf, json.R_A); 25567 var nadgrids = Object(_nadgrid__WEBPACK_IMPORTED_MODULE_7__["getNadgrids"])(json.nadgrids); 25568 var datumObj = json.datum || Object(_datum__WEBPACK_IMPORTED_MODULE_5__["default"])(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2, 25569 nadgrids); 25570 25571 Object(_extend__WEBPACK_IMPORTED_MODULE_1__["default"])(this, json); // transfer everything over from the projection because we don't know what we'll need 25572 Object(_extend__WEBPACK_IMPORTED_MODULE_1__["default"])(this, ourProj); // transfer all the methods from the projection 25573 25574 // copy the 4 things over we calulated in deriveConstants.sphere 25575 this.a = sphere_.a; 25576 this.b = sphere_.b; 25577 this.rf = sphere_.rf; 25578 this.sphere = sphere_.sphere; 25579 25580 // copy the 3 things we calculated in deriveConstants.eccentricity 25581 this.es = ecc.es; 25582 this.e = ecc.e; 25583 this.ep2 = ecc.ep2; 25584 25585 // add in the datum object 25586 this.datum = datumObj; 25587 25588 // init the projection 25589 this.init(); 25590 25591 // legecy callback from back in the day when it went to spatialreference.org 25592 callback(null, this); 25593 25594} 25595Projection.projections = _projections__WEBPACK_IMPORTED_MODULE_2__["default"]; 25596Projection.projections.start(); 25597/* harmony default export */ __webpack_exports__["default"] = (Projection); 25598 25599 25600/***/ }), 25601
vendor: 1,561 bytes, lines 25602-25675
25602/***/ "./node_modules/proj4/lib/adjust_axis.js": 25603/*!***********************************************!*\ 25604 !*** ./node_modules/proj4/lib/adjust_axis.js ***! 25605 \***********************************************/ 25606/*! exports provided: default */ 25607/***/ (function(module, __webpack_exports__, __webpack_require__) { 25608 25609"use strict"; 25610__webpack_require__.r(__webpack_exports__); 25611/* harmony default export */ __webpack_exports__["default"] = (function(crs, denorm, point) { 25612 var xin = point.x, 25613 yin = point.y, 25614 zin = point.z || 0.0; 25615 var v, t, i; 25616 var out = {}; 25617 for (i = 0; i < 3; i++) { 25618 if (denorm && i === 2 && point.z === undefined) { 25619 continue; 25620 } 25621 if (i === 0) { 25622 v = xin; 25623 if ("ew".indexOf(crs.axis[i]) !== -1) { 25624 t = 'x'; 25625 } else { 25626 t = 'y'; 25627 } 25628 25629 } 25630 else if (i === 1) { 25631 v = yin; 25632 if ("ns".indexOf(crs.axis[i]) !== -1) { 25633 t = 'y'; 25634 } else { 25635 t = 'x'; 25636 } 25637 } 25638 else { 25639 v = zin; 25640 t = 'z'; 25641 } 25642 switch (crs.axis[i]) { 25643 case 'e': 25644 out[t] = v; 25645 break; 25646 case 'w': 25647 out[t] = -v; 25648 break; 25649 case 'n': 25650 out[t] = v; 25651 break; 25652 case 's': 25653 out[t] = -v; 25654 break; 25655 case 'u': 25656 if (point[t] !== undefined) { 25657 out.z = v; 25658 } 25659 break; 25660 case 'd': 25661 if (point[t] !== undefined) { 25662 out.z = -v; 25663 } 25664 break; 25665 default: 25666 //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName); 25667 return null; 25668 } 25669 } 25670 return out; 25671}); 25672 25673 25674/***/ }), 25675
vendor: 840 bytes, lines 25676-25703
25676/***/ "./node_modules/proj4/lib/checkSanity.js": 25677/*!***********************************************!*\ 25678 !*** ./node_modules/proj4/lib/checkSanity.js ***! 25679 \***********************************************/ 25680/*! exports provided: default */ 25681/***/ (function(module, __webpack_exports__, __webpack_require__) { 25682 25683"use strict"; 25684__webpack_require__.r(__webpack_exports__); 25685/* harmony default export */ __webpack_exports__["default"] = (function (point) { 25686 checkCoord(point.x); 25687 checkCoord(point.y); 25688}); 25689function checkCoord(num) { 25690 if (typeof Number.isFinite === 'function') { 25691 if (Number.isFinite(num)) { 25692 return; 25693 } 25694 throw new TypeError('coordinates must be finite numbers'); 25695 } 25696 if (typeof num !== 'number' || num !== num || !isFinite(num)) { 25697 throw new TypeError('coordinates must be finite numbers'); 25698 } 25699} 25700 25701 25702/***/ }), 25703
vendor: 963 bytes, lines 25704-25724
25704/***/ "./node_modules/proj4/lib/common/adjust_lat.js": 25705/*!*****************************************************!*\ 25706 !*** ./node_modules/proj4/lib/common/adjust_lat.js ***! 25707 \*****************************************************/ 25708/*! exports provided: default */ 25709/***/ (function(module, __webpack_exports__, __webpack_require__) { 25710 25711"use strict"; 25712__webpack_require__.r(__webpack_exports__); 25713/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 25714/* harmony import */ var _sign__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sign */ "./node_modules/proj4/lib/common/sign.js"); 25715 25716 25717 25718/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25719 return (Math.abs(x) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]) ? x : (x - (Object(_sign__WEBPACK_IMPORTED_MODULE_1__["default"])(x) * Math.PI)); 25720}); 25721 25722 25723/***/ }), 25724
vendor: 1,010 bytes, lines 25725-25746
25725/***/ "./node_modules/proj4/lib/common/adjust_lon.js": 25726/*!*****************************************************!*\ 25727 !*** ./node_modules/proj4/lib/common/adjust_lon.js ***! 25728 \*****************************************************/ 25729/*! exports provided: default */ 25730/***/ (function(module, __webpack_exports__, __webpack_require__) { 25731 25732"use strict"; 25733__webpack_require__.r(__webpack_exports__); 25734/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 25735/* harmony import */ var _sign__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sign */ "./node_modules/proj4/lib/common/sign.js"); 25736 25737 25738 25739 25740/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25741 return (Math.abs(x) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]) ? x : (x - (Object(_sign__WEBPACK_IMPORTED_MODULE_1__["default"])(x) * _constants_values__WEBPACK_IMPORTED_MODULE_0__["TWO_PI"])); 25742}); 25743 25744 25745/***/ }), 25746
vendor: 912 bytes, lines 25747-25774
25747/***/ "./node_modules/proj4/lib/common/adjust_zone.js": 25748/*!******************************************************!*\ 25749 !*** ./node_modules/proj4/lib/common/adjust_zone.js ***! 25750 \******************************************************/ 25751/*! exports provided: default */ 25752/***/ (function(module, __webpack_exports__, __webpack_require__) { 25753 25754"use strict"; 25755__webpack_require__.r(__webpack_exports__); 25756/* harmony import */ var _adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 25757 25758 25759/* harmony default export */ __webpack_exports__["default"] = (function(zone, lon) { 25760 if (zone === undefined) { 25761 zone = Math.floor((Object(_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon) + Math.PI) * 30 / Math.PI) + 1; 25762 25763 if (zone < 0) { 25764 return 0; 25765 } else if (zone > 60) { 25766 return 60; 25767 } 25768 } 25769 return zone; 25770}); 25771 25772 25773/***/ }), 25774
vendor: 955 bytes, lines 25775-25798
25775/***/ "./node_modules/proj4/lib/common/asinhy.js": 25776/*!*************************************************!*\ 25777 !*** ./node_modules/proj4/lib/common/asinhy.js ***! 25778 \*************************************************/ 25779/*! exports provided: default */ 25780/***/ (function(module, __webpack_exports__, __webpack_require__) { 25781 25782"use strict"; 25783__webpack_require__.r(__webpack_exports__); 25784/* harmony import */ var _hypot__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hypot */ "./node_modules/proj4/lib/common/hypot.js"); 25785/* harmony import */ var _log1py__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./log1py */ "./node_modules/proj4/lib/common/log1py.js"); 25786 25787 25788 25789/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25790 var y = Math.abs(x); 25791 y = Object(_log1py__WEBPACK_IMPORTED_MODULE_1__["default"])(y * (1 + y / (Object(_hypot__WEBPACK_IMPORTED_MODULE_0__["default"])(1, y) + 1))); 25792 25793 return x < 0 ? -y : y; 25794}); 25795 25796 25797/***/ }), 25798
vendor: 542 bytes, lines 25799-25816
25799/***/ "./node_modules/proj4/lib/common/asinz.js": 25800/*!************************************************!*\ 25801 !*** ./node_modules/proj4/lib/common/asinz.js ***! 25802 \************************************************/ 25803/*! exports provided: default */ 25804/***/ (function(module, __webpack_exports__, __webpack_require__) { 25805 25806"use strict"; 25807__webpack_require__.r(__webpack_exports__); 25808/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25809 if (Math.abs(x) > 1) { 25810 x = (x > 1) ? 1 : -1; 25811 } 25812 return Math.asin(x); 25813}); 25814 25815/***/ }), 25816
vendor: 693 bytes, lines 25817-25844
25817/***/ "./node_modules/proj4/lib/common/clens.js": 25818/*!************************************************!*\ 25819 !*** ./node_modules/proj4/lib/common/clens.js ***! 25820 \************************************************/ 25821/*! exports provided: default */ 25822/***/ (function(module, __webpack_exports__, __webpack_require__) { 25823 25824"use strict"; 25825__webpack_require__.r(__webpack_exports__); 25826/* harmony default export */ __webpack_exports__["default"] = (function(pp, arg_r) { 25827 var r = 2 * Math.cos(arg_r); 25828 var i = pp.length - 1; 25829 var hr1 = pp[i]; 25830 var hr2 = 0; 25831 var hr; 25832 25833 while (--i >= 0) { 25834 hr = -hr2 + r * hr1 + pp[i]; 25835 hr2 = hr1; 25836 hr1 = hr; 25837 } 25838 25839 return Math.sin(arg_r) * hr; 25840}); 25841 25842 25843/***/ }), 25844
vendor: 1,474 bytes, lines 25845-25891
25845/***/ "./node_modules/proj4/lib/common/clens_cmplx.js": 25846/*!******************************************************!*\ 25847 !*** ./node_modules/proj4/lib/common/clens_cmplx.js ***! 25848 \******************************************************/ 25849/*! exports provided: default */ 25850/***/ (function(module, __webpack_exports__, __webpack_require__) { 25851 25852"use strict"; 25853__webpack_require__.r(__webpack_exports__); 25854/* harmony import */ var _sinh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sinh */ "./node_modules/proj4/lib/common/sinh.js"); 25855/* harmony import */ var _cosh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cosh */ "./node_modules/proj4/lib/common/cosh.js"); 25856 25857 25858 25859/* harmony default export */ __webpack_exports__["default"] = (function(pp, arg_r, arg_i) { 25860 var sin_arg_r = Math.sin(arg_r); 25861 var cos_arg_r = Math.cos(arg_r); 25862 var sinh_arg_i = Object(_sinh__WEBPACK_IMPORTED_MODULE_0__["default"])(arg_i); 25863 var cosh_arg_i = Object(_cosh__WEBPACK_IMPORTED_MODULE_1__["default"])(arg_i); 25864 var r = 2 * cos_arg_r * cosh_arg_i; 25865 var i = -2 * sin_arg_r * sinh_arg_i; 25866 var j = pp.length - 1; 25867 var hr = pp[j]; 25868 var hi1 = 0; 25869 var hr1 = 0; 25870 var hi = 0; 25871 var hr2; 25872 var hi2; 25873 25874 while (--j >= 0) { 25875 hr2 = hr1; 25876 hi2 = hi1; 25877 hr1 = hr; 25878 hi1 = hi; 25879 hr = -hr2 + r * hr1 - i * hi1 + pp[j]; 25880 hi = -hi2 + i * hr1 + r * hi1; 25881 } 25882 25883 r = sin_arg_r * cosh_arg_i; 25884 i = cos_arg_r * sinh_arg_i; 25885 25886 return [r * hr - i * hi, r * hi + i * hr]; 25887}); 25888 25889 25890/***/ }), 25891
vendor: 518 bytes, lines 25892-25908
25892/***/ "./node_modules/proj4/lib/common/cosh.js": 25893/*!***********************************************!*\ 25894 !*** ./node_modules/proj4/lib/common/cosh.js ***! 25895 \***********************************************/ 25896/*! exports provided: default */ 25897/***/ (function(module, __webpack_exports__, __webpack_require__) { 25898 25899"use strict"; 25900__webpack_require__.r(__webpack_exports__); 25901/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25902 var r = Math.exp(x); 25903 r = (r + 1 / r) / 2; 25904 return r; 25905}); 25906 25907/***/ }), 25908
vendor: 517 bytes, lines 25909-25923
25909/***/ "./node_modules/proj4/lib/common/e0fn.js": 25910/*!***********************************************!*\ 25911 !*** ./node_modules/proj4/lib/common/e0fn.js ***! 25912 \***********************************************/ 25913/*! exports provided: default */ 25914/***/ (function(module, __webpack_exports__, __webpack_require__) { 25915 25916"use strict"; 25917__webpack_require__.r(__webpack_exports__); 25918/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25919 return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x))); 25920}); 25921 25922/***/ }), 25923
vendor: 519 bytes, lines 25924-25938
25924/***/ "./node_modules/proj4/lib/common/e1fn.js": 25925/*!***********************************************!*\ 25926 !*** ./node_modules/proj4/lib/common/e1fn.js ***! 25927 \***********************************************/ 25928/*! exports provided: default */ 25929/***/ (function(module, __webpack_exports__, __webpack_require__) { 25930 25931"use strict"; 25932__webpack_require__.r(__webpack_exports__); 25933/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25934 return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x))); 25935}); 25936 25937/***/ }), 25938
vendor: 508 bytes, lines 25939-25953
25939/***/ "./node_modules/proj4/lib/common/e2fn.js": 25940/*!***********************************************!*\ 25941 !*** ./node_modules/proj4/lib/common/e2fn.js ***! 25942 \***********************************************/ 25943/*! exports provided: default */ 25944/***/ (function(module, __webpack_exports__, __webpack_require__) { 25945 25946"use strict"; 25947__webpack_require__.r(__webpack_exports__); 25948/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25949 return (0.05859375 * x * x * (1 + 0.75 * x)); 25950}); 25951 25952/***/ }), 25953
vendor: 496 bytes, lines 25954-25968
25954/***/ "./node_modules/proj4/lib/common/e3fn.js": 25955/*!***********************************************!*\ 25956 !*** ./node_modules/proj4/lib/common/e3fn.js ***! 25957 \***********************************************/ 25958/*! exports provided: default */ 25959/***/ (function(module, __webpack_exports__, __webpack_require__) { 25960 25961"use strict"; 25962__webpack_require__.r(__webpack_exports__); 25963/* harmony default export */ __webpack_exports__["default"] = (function(x) { 25964 return (x * x * x * (35 / 3072)); 25965}); 25966 25967/***/ }), 25968
vendor: 529 bytes, lines 25969-25984
25969/***/ "./node_modules/proj4/lib/common/gN.js": 25970/*!*********************************************!*\ 25971 !*** ./node_modules/proj4/lib/common/gN.js ***! 25972 \*********************************************/ 25973/*! exports provided: default */ 25974/***/ (function(module, __webpack_exports__, __webpack_require__) { 25975 25976"use strict"; 25977__webpack_require__.r(__webpack_exports__); 25978/* harmony default export */ __webpack_exports__["default"] = (function(a, e, sinphi) { 25979 var temp = e * sinphi; 25980 return a / Math.sqrt(1 - temp * temp); 25981}); 25982 25983/***/ }), 25984
vendor: 690 bytes, lines 25985-26012
25985/***/ "./node_modules/proj4/lib/common/gatg.js": 25986/*!***********************************************!*\ 25987 !*** ./node_modules/proj4/lib/common/gatg.js ***! 25988 \***********************************************/ 25989/*! exports provided: default */ 25990/***/ (function(module, __webpack_exports__, __webpack_require__) { 25991 25992"use strict"; 25993__webpack_require__.r(__webpack_exports__); 25994/* harmony default export */ __webpack_exports__["default"] = (function(pp, B) { 25995 var cos_2B = 2 * Math.cos(2 * B); 25996 var i = pp.length - 1; 25997 var h1 = pp[i]; 25998 var h2 = 0; 25999 var h; 26000 26001 while (--i >= 0) { 26002 h = -h2 + cos_2B * h1 + pp[i]; 26003 h2 = h1; 26004 h1 = h; 26005 } 26006 26007 return (B + h * Math.sin(2 * B)); 26008}); 26009 26010 26011/***/ }), 26012
vendor: 617 bytes, lines 26013-26033
26013/***/ "./node_modules/proj4/lib/common/hypot.js": 26014/*!************************************************!*\ 26015 !*** ./node_modules/proj4/lib/common/hypot.js ***! 26016 \************************************************/ 26017/*! exports provided: default */ 26018/***/ (function(module, __webpack_exports__, __webpack_require__) { 26019 26020"use strict"; 26021__webpack_require__.r(__webpack_exports__); 26022/* harmony default export */ __webpack_exports__["default"] = (function(x, y) { 26023 x = Math.abs(x); 26024 y = Math.abs(y); 26025 var a = Math.max(x, y); 26026 var b = Math.min(x, y) / (a ? a : 1); 26027 26028 return a * Math.sqrt(1 + Math.pow(b, 2)); 26029}); 26030 26031 26032/***/ }), 26033
vendor: 937 bytes, lines 26034-26061
26034/***/ "./node_modules/proj4/lib/common/imlfn.js": 26035/*!************************************************!*\ 26036 !*** ./node_modules/proj4/lib/common/imlfn.js ***! 26037 \************************************************/ 26038/*! exports provided: default */ 26039/***/ (function(module, __webpack_exports__, __webpack_require__) { 26040 26041"use strict"; 26042__webpack_require__.r(__webpack_exports__); 26043/* harmony default export */ __webpack_exports__["default"] = (function(ml, e0, e1, e2, e3) { 26044 var phi; 26045 var dphi; 26046 26047 phi = ml / e0; 26048 for (var i = 0; i < 15; i++) { 26049 dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi)); 26050 phi += dphi; 26051 if (Math.abs(dphi) <= 0.0000000001) { 26052 return phi; 26053 } 26054 } 26055 26056 //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations"); 26057 return NaN; 26058}); 26059 26060/***/ }), 26061
vendor: 1,573 bytes, lines 26062-26107
26062/***/ "./node_modules/proj4/lib/common/iqsfnz.js": 26063/*!*************************************************!*\ 26064 !*** ./node_modules/proj4/lib/common/iqsfnz.js ***! 26065 \*************************************************/ 26066/*! exports provided: default */ 26067/***/ (function(module, __webpack_exports__, __webpack_require__) { 26068 26069"use strict"; 26070__webpack_require__.r(__webpack_exports__); 26071/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 26072 26073 26074/* harmony default export */ __webpack_exports__["default"] = (function(eccent, q) { 26075 var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent)); 26076 if (Math.abs(Math.abs(q) - temp) < 1.0E-6) { 26077 if (q < 0) { 26078 return (-1 * _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]); 26079 } 26080 else { 26081 return _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 26082 } 26083 } 26084 //var phi = 0.5* q/(1-eccent*eccent); 26085 var phi = Math.asin(0.5 * q); 26086 var dphi; 26087 var sin_phi; 26088 var cos_phi; 26089 var con; 26090 for (var i = 0; i < 30; i++) { 26091 sin_phi = Math.sin(phi); 26092 cos_phi = Math.cos(phi); 26093 con = eccent * sin_phi; 26094 dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con))); 26095 phi += dphi; 26096 if (Math.abs(dphi) <= 0.0000000001) { 26097 return phi; 26098 } 26099 } 26100 26101 //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations"); 26102 return NaN; 26103}); 26104 26105 26106/***/ }), 26107
vendor: 548 bytes, lines 26108-26126
26108/***/ "./node_modules/proj4/lib/common/log1py.js": 26109/*!*************************************************!*\ 26110 !*** ./node_modules/proj4/lib/common/log1py.js ***! 26111 \*************************************************/ 26112/*! exports provided: default */ 26113/***/ (function(module, __webpack_exports__, __webpack_require__) { 26114 26115"use strict"; 26116__webpack_require__.r(__webpack_exports__); 26117/* harmony default export */ __webpack_exports__["default"] = (function(x) { 26118 var y = 1 + x; 26119 var z = y - 1; 26120 26121 return z === 0 ? x : x * Math.log(y) / z; 26122}); 26123 26124 26125/***/ }), 26126
vendor: 574 bytes, lines 26127-26141
26127/***/ "./node_modules/proj4/lib/common/mlfn.js": 26128/*!***********************************************!*\ 26129 !*** ./node_modules/proj4/lib/common/mlfn.js ***! 26130 \***********************************************/ 26131/*! exports provided: default */ 26132/***/ (function(module, __webpack_exports__, __webpack_require__) { 26133 26134"use strict"; 26135__webpack_require__.r(__webpack_exports__); 26136/* harmony default export */ __webpack_exports__["default"] = (function(e0, e1, e2, e3, phi) { 26137 return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi)); 26138}); 26139 26140/***/ }), 26141
vendor: 560 bytes, lines 26142-26157
26142/***/ "./node_modules/proj4/lib/common/msfnz.js": 26143/*!************************************************!*\ 26144 !*** ./node_modules/proj4/lib/common/msfnz.js ***! 26145 \************************************************/ 26146/*! exports provided: default */ 26147/***/ (function(module, __webpack_exports__, __webpack_require__) { 26148 26149"use strict"; 26150__webpack_require__.r(__webpack_exports__); 26151/* harmony default export */ __webpack_exports__["default"] = (function(eccent, sinphi, cosphi) { 26152 var con = eccent * sinphi; 26153 return cosphi / (Math.sqrt(1 - con * con)); 26154}); 26155 26156/***/ }), 26157
vendor: 1,140 bytes, lines 26158-26188
26158/***/ "./node_modules/proj4/lib/common/phi2z.js": 26159/*!************************************************!*\ 26160 !*** ./node_modules/proj4/lib/common/phi2z.js ***! 26161 \************************************************/ 26162/*! exports provided: default */ 26163/***/ (function(module, __webpack_exports__, __webpack_require__) { 26164 26165"use strict"; 26166__webpack_require__.r(__webpack_exports__); 26167/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 26168 26169 26170/* harmony default export */ __webpack_exports__["default"] = (function(eccent, ts) { 26171 var eccnth = 0.5 * eccent; 26172 var con, dphi; 26173 var phi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - 2 * Math.atan(ts); 26174 for (var i = 0; i <= 15; i++) { 26175 con = eccent * Math.sin(phi); 26176 dphi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi; 26177 phi += dphi; 26178 if (Math.abs(dphi) <= 0.0000000001) { 26179 return phi; 26180 } 26181 } 26182 //console.log("phi2z has NoConvergence"); 26183 return -9999; 26184}); 26185 26186 26187/***/ }), 26188
vendor: 1,051 bytes, lines 26189-26224
26189/***/ "./node_modules/proj4/lib/common/pj_enfn.js": 26190/*!**************************************************!*\ 26191 !*** ./node_modules/proj4/lib/common/pj_enfn.js ***! 26192 \**************************************************/ 26193/*! exports provided: default */ 26194/***/ (function(module, __webpack_exports__, __webpack_require__) { 26195 26196"use strict"; 26197__webpack_require__.r(__webpack_exports__); 26198var C00 = 1; 26199var C02 = 0.25; 26200var C04 = 0.046875; 26201var C06 = 0.01953125; 26202var C08 = 0.01068115234375; 26203var C22 = 0.75; 26204var C44 = 0.46875; 26205var C46 = 0.01302083333333333333; 26206var C48 = 0.00712076822916666666; 26207var C66 = 0.36458333333333333333; 26208var C68 = 0.00569661458333333333; 26209var C88 = 0.3076171875; 26210 26211/* harmony default export */ __webpack_exports__["default"] = (function(es) { 26212 var en = []; 26213 en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08))); 26214 en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08))); 26215 var t = es * es; 26216 en[2] = t * (C44 - es * (C46 + es * C48)); 26217 t *= es; 26218 en[3] = t * (C66 - es * C68); 26219 en[4] = t * es * C88; 26220 return en; 26221}); 26222 26223/***/ }), 26224
vendor: 1,427 bytes, lines 26225-26261
26225/***/ "./node_modules/proj4/lib/common/pj_inv_mlfn.js": 26226/*!******************************************************!*\ 26227 !*** ./node_modules/proj4/lib/common/pj_inv_mlfn.js ***! 26228 \******************************************************/ 26229/*! exports provided: default */ 26230/***/ (function(module, __webpack_exports__, __webpack_require__) { 26231 26232"use strict"; 26233__webpack_require__.r(__webpack_exports__); 26234/* harmony import */ var _pj_mlfn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pj_mlfn */ "./node_modules/proj4/lib/common/pj_mlfn.js"); 26235/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 26236 26237 26238 26239var MAX_ITER = 20; 26240 26241/* harmony default export */ __webpack_exports__["default"] = (function(arg, es, en) { 26242 var k = 1 / (1 - es); 26243 var phi = arg; 26244 for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */ 26245 var s = Math.sin(phi); 26246 var t = 1 - es * s * s; 26247 //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg; 26248 //phi -= t * (t * Math.sqrt(t)) * k; 26249 t = (Object(_pj_mlfn__WEBPACK_IMPORTED_MODULE_0__["default"])(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k; 26250 phi -= t; 26251 if (Math.abs(t) < _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 26252 return phi; 26253 } 26254 } 26255 //..reportError("cass:pj_inv_mlfn: Convergence error"); 26256 return phi; 26257}); 26258 26259 26260/***/ }), 26261
vendor: 612 bytes, lines 26262-26278
26262/***/ "./node_modules/proj4/lib/common/pj_mlfn.js": 26263/*!**************************************************!*\ 26264 !*** ./node_modules/proj4/lib/common/pj_mlfn.js ***! 26265 \**************************************************/ 26266/*! exports provided: default */ 26267/***/ (function(module, __webpack_exports__, __webpack_require__) { 26268 26269"use strict"; 26270__webpack_require__.r(__webpack_exports__); 26271/* harmony default export */ __webpack_exports__["default"] = (function(phi, sphi, cphi, en) { 26272 cphi *= sphi; 26273 sphi *= sphi; 26274 return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4])))); 26275}); 26276 26277/***/ }), 26278
vendor: 698 bytes, lines 26279-26300
26279/***/ "./node_modules/proj4/lib/common/qsfnz.js": 26280/*!************************************************!*\ 26281 !*** ./node_modules/proj4/lib/common/qsfnz.js ***! 26282 \************************************************/ 26283/*! exports provided: default */ 26284/***/ (function(module, __webpack_exports__, __webpack_require__) { 26285 26286"use strict"; 26287__webpack_require__.r(__webpack_exports__); 26288/* harmony default export */ __webpack_exports__["default"] = (function(eccent, sinphi) { 26289 var con; 26290 if (eccent > 1.0e-7) { 26291 con = eccent * sinphi; 26292 return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con)))); 26293 } 26294 else { 26295 return (2 * sinphi); 26296 } 26297}); 26298 26299/***/ }), 26300
vendor: 483 bytes, lines 26301-26315
26301/***/ "./node_modules/proj4/lib/common/sign.js": 26302/*!***********************************************!*\ 26303 !*** ./node_modules/proj4/lib/common/sign.js ***! 26304 \***********************************************/ 26305/*! exports provided: default */ 26306/***/ (function(module, __webpack_exports__, __webpack_require__) { 26307 26308"use strict"; 26309__webpack_require__.r(__webpack_exports__); 26310/* harmony default export */ __webpack_exports__["default"] = (function(x) { 26311 return x<0 ? -1 : 1; 26312}); 26313 26314/***/ }), 26315
vendor: 518 bytes, lines 26316-26332
26316/***/ "./node_modules/proj4/lib/common/sinh.js": 26317/*!***********************************************!*\ 26318 !*** ./node_modules/proj4/lib/common/sinh.js ***! 26319 \***********************************************/ 26320/*! exports provided: default */ 26321/***/ (function(module, __webpack_exports__, __webpack_require__) { 26322 26323"use strict"; 26324__webpack_require__.r(__webpack_exports__); 26325/* harmony default export */ __webpack_exports__["default"] = (function(x) { 26326 var r = Math.exp(x); 26327 r = (r - 1 / r) / 2; 26328 return r; 26329}); 26330 26331/***/ }), 26332
vendor: 522 bytes, lines 26333-26347
26333/***/ "./node_modules/proj4/lib/common/srat.js": 26334/*!***********************************************!*\ 26335 !*** ./node_modules/proj4/lib/common/srat.js ***! 26336 \***********************************************/ 26337/*! exports provided: default */ 26338/***/ (function(module, __webpack_exports__, __webpack_require__) { 26339 26340"use strict"; 26341__webpack_require__.r(__webpack_exports__); 26342/* harmony default export */ __webpack_exports__["default"] = (function(esinp, exp) { 26343 return (Math.pow((1 - esinp) / (1 + esinp), exp)); 26344}); 26345 26346/***/ }), 26347
vendor: 642 bytes, lines 26348-26372
26348/***/ "./node_modules/proj4/lib/common/toPoint.js": 26349/*!**************************************************!*\ 26350 !*** ./node_modules/proj4/lib/common/toPoint.js ***! 26351 \**************************************************/ 26352/*! exports provided: default */ 26353/***/ (function(module, __webpack_exports__, __webpack_require__) { 26354 26355"use strict"; 26356__webpack_require__.r(__webpack_exports__); 26357/* harmony default export */ __webpack_exports__["default"] = (function (array){ 26358 var out = { 26359 x: array[0], 26360 y: array[1] 26361 }; 26362 if (array.length>2) { 26363 out.z = array[2]; 26364 } 26365 if (array.length>3) { 26366 out.m = array[3]; 26367 } 26368 return out; 26369}); 26370 26371/***/ }), 26372
vendor: 858 bytes, lines 26373-26394
26373/***/ "./node_modules/proj4/lib/common/tsfnz.js": 26374/*!************************************************!*\ 26375 !*** ./node_modules/proj4/lib/common/tsfnz.js ***! 26376 \************************************************/ 26377/*! exports provided: default */ 26378/***/ (function(module, __webpack_exports__, __webpack_require__) { 26379 26380"use strict"; 26381__webpack_require__.r(__webpack_exports__); 26382/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 26383 26384 26385/* harmony default export */ __webpack_exports__["default"] = (function(eccent, phi, sinphi) { 26386 var con = eccent * sinphi; 26387 var com = 0.5 * eccent; 26388 con = Math.pow(((1 - con) / (1 + con)), com); 26389 return (Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - phi)) / con); 26390}); 26391 26392 26393/***/ }), 26394
vendor: 2,564 bytes, lines 26395-26511
26395/***/ "./node_modules/proj4/lib/constants/Datum.js": 26396/*!***************************************************!*\ 26397 !*** ./node_modules/proj4/lib/constants/Datum.js ***! 26398 \***************************************************/ 26399/*! exports provided: default */ 26400/***/ (function(module, __webpack_exports__, __webpack_require__) { 26401 26402"use strict"; 26403__webpack_require__.r(__webpack_exports__); 26404/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return exports; }); 26405var exports = {}; 26406 26407exports.wgs84 = { 26408 towgs84: "0,0,0", 26409 ellipse: "WGS84", 26410 datumName: "WGS84" 26411}; 26412 26413exports.ch1903 = { 26414 towgs84: "674.374,15.056,405.346", 26415 ellipse: "bessel", 26416 datumName: "swiss" 26417}; 26418 26419exports.ggrs87 = { 26420 towgs84: "-199.87,74.79,246.62", 26421 ellipse: "GRS80", 26422 datumName: "Greek_Geodetic_Reference_System_1987" 26423}; 26424 26425exports.nad83 = { 26426 towgs84: "0,0,0", 26427 ellipse: "GRS80", 26428 datumName: "North_American_Datum_1983" 26429}; 26430 26431exports.nad27 = { 26432 nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", 26433 ellipse: "clrk66", 26434 datumName: "North_American_Datum_1927" 26435}; 26436 26437exports.potsdam = { 26438 towgs84: "606.0,23.0,413.0", 26439 ellipse: "bessel", 26440 datumName: "Potsdam Rauenberg 1950 DHDN" 26441}; 26442 26443exports.carthage = { 26444 towgs84: "-263.0,6.0,431.0", 26445 ellipse: "clark80", 26446 datumName: "Carthage 1934 Tunisia" 26447}; 26448 26449exports.hermannskogel = { 26450 towgs84: "653.0,-212.0,449.0", 26451 ellipse: "bessel", 26452 datumName: "Hermannskogel" 26453}; 26454 26455exports.osni52 = { 26456 towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", 26457 ellipse: "airy", 26458 datumName: "Irish National" 26459}; 26460 26461exports.ire65 = { 26462 towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", 26463 ellipse: "mod_airy", 26464 datumName: "Ireland 1965" 26465}; 26466 26467exports.rassadiran = { 26468 towgs84: "-133.63,-157.5,-158.62", 26469 ellipse: "intl", 26470 datumName: "Rassadiran" 26471}; 26472 26473exports.nzgd49 = { 26474 towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", 26475 ellipse: "intl", 26476 datumName: "New Zealand Geodetic Datum 1949" 26477}; 26478 26479exports.osgb36 = { 26480 towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", 26481 ellipse: "airy", 26482 datumName: "Airy 1830" 26483}; 26484 26485exports.s_jtsk = { 26486 towgs84: "589,76,480", 26487 ellipse: 'bessel', 26488 datumName: 'S-JTSK (Ferro)' 26489}; 26490 26491exports.beduaram = { 26492 towgs84: '-106,-87,188', 26493 ellipse: 'clrk80', 26494 datumName: 'Beduaram' 26495}; 26496 26497exports.gunung_segara = { 26498 towgs84: '-403,684,41', 26499 ellipse: 'bessel', 26500 datumName: 'Gunung Segara Jakarta' 26501}; 26502 26503exports.rnb72 = { 26504 towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1", 26505 ellipse: "intl", 26506 datumName: "Reseau National Belge 1972" 26507}; 26508 26509 26510/***/ }), 26511
vendor: 4,506 bytes, lines 26512-26785
26512/***/ "./node_modules/proj4/lib/constants/Ellipsoid.js": 26513/*!*******************************************************!*\ 26514 !*** ./node_modules/proj4/lib/constants/Ellipsoid.js ***! 26515 \*******************************************************/ 26516/*! exports provided: default, WGS84 */ 26517/***/ (function(module, __webpack_exports__, __webpack_require__) { 26518 26519"use strict"; 26520__webpack_require__.r(__webpack_exports__); 26521/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return exports; }); 26522/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WGS84", function() { return WGS84; }); 26523var exports = {}; 26524 26525exports.MERIT = { 26526 a: 6378137.0, 26527 rf: 298.257, 26528 ellipseName: "MERIT 1983" 26529}; 26530 26531exports.SGS85 = { 26532 a: 6378136.0, 26533 rf: 298.257, 26534 ellipseName: "Soviet Geodetic System 85" 26535}; 26536 26537exports.GRS80 = { 26538 a: 6378137.0, 26539 rf: 298.257222101, 26540 ellipseName: "GRS 1980(IUGG, 1980)" 26541}; 26542 26543exports.IAU76 = { 26544 a: 6378140.0, 26545 rf: 298.257, 26546 ellipseName: "IAU 1976" 26547}; 26548 26549exports.airy = { 26550 a: 6377563.396, 26551 b: 6356256.910, 26552 ellipseName: "Airy 1830" 26553}; 26554 26555exports.APL4 = { 26556 a: 6378137, 26557 rf: 298.25, 26558 ellipseName: "Appl. Physics. 1965" 26559}; 26560 26561exports.NWL9D = { 26562 a: 6378145.0, 26563 rf: 298.25, 26564 ellipseName: "Naval Weapons Lab., 1965" 26565}; 26566 26567exports.mod_airy = { 26568 a: 6377340.189, 26569 b: 6356034.446, 26570 ellipseName: "Modified Airy" 26571}; 26572 26573exports.andrae = { 26574 a: 6377104.43, 26575 rf: 300.0, 26576 ellipseName: "Andrae 1876 (Den., Iclnd.)" 26577}; 26578 26579exports.aust_SA = { 26580 a: 6378160.0, 26581 rf: 298.25, 26582 ellipseName: "Australian Natl & S. Amer. 1969" 26583}; 26584 26585exports.GRS67 = { 26586 a: 6378160.0, 26587 rf: 298.2471674270, 26588 ellipseName: "GRS 67(IUGG 1967)" 26589}; 26590 26591exports.bessel = { 26592 a: 6377397.155, 26593 rf: 299.1528128, 26594 ellipseName: "Bessel 1841" 26595}; 26596 26597exports.bess_nam = { 26598 a: 6377483.865, 26599 rf: 299.1528128, 26600 ellipseName: "Bessel 1841 (Namibia)" 26601}; 26602 26603exports.clrk66 = { 26604 a: 6378206.4, 26605 b: 6356583.8, 26606 ellipseName: "Clarke 1866" 26607}; 26608 26609exports.clrk80 = { 26610 a: 6378249.145, 26611 rf: 293.4663, 26612 ellipseName: "Clarke 1880 mod." 26613}; 26614 26615exports.clrk58 = { 26616 a: 6378293.645208759, 26617 rf: 294.2606763692654, 26618 ellipseName: "Clarke 1858" 26619}; 26620 26621exports.CPM = { 26622 a: 6375738.7, 26623 rf: 334.29, 26624 ellipseName: "Comm. des Poids et Mesures 1799" 26625}; 26626 26627exports.delmbr = { 26628 a: 6376428.0, 26629 rf: 311.5, 26630 ellipseName: "Delambre 1810 (Belgium)" 26631}; 26632 26633exports.engelis = { 26634 a: 6378136.05, 26635 rf: 298.2566, 26636 ellipseName: "Engelis 1985" 26637}; 26638 26639exports.evrst30 = { 26640 a: 6377276.345, 26641 rf: 300.8017, 26642 ellipseName: "Everest 1830" 26643}; 26644 26645exports.evrst48 = { 26646 a: 6377304.063, 26647 rf: 300.8017, 26648 ellipseName: "Everest 1948" 26649}; 26650 26651exports.evrst56 = { 26652 a: 6377301.243, 26653 rf: 300.8017, 26654 ellipseName: "Everest 1956" 26655}; 26656 26657exports.evrst69 = { 26658 a: 6377295.664, 26659 rf: 300.8017, 26660 ellipseName: "Everest 1969" 26661}; 26662 26663exports.evrstSS = { 26664 a: 6377298.556, 26665 rf: 300.8017, 26666 ellipseName: "Everest (Sabah & Sarawak)" 26667}; 26668 26669exports.fschr60 = { 26670 a: 6378166.0, 26671 rf: 298.3, 26672 ellipseName: "Fischer (Mercury Datum) 1960" 26673}; 26674 26675exports.fschr60m = { 26676 a: 6378155.0, 26677 rf: 298.3, 26678 ellipseName: "Fischer 1960" 26679}; 26680 26681exports.fschr68 = { 26682 a: 6378150.0, 26683 rf: 298.3, 26684 ellipseName: "Fischer 1968" 26685}; 26686 26687exports.helmert = { 26688 a: 6378200.0, 26689 rf: 298.3, 26690 ellipseName: "Helmert 1906" 26691}; 26692 26693exports.hough = { 26694 a: 6378270.0, 26695 rf: 297.0, 26696 ellipseName: "Hough" 26697}; 26698 26699exports.intl = { 26700 a: 6378388.0, 26701 rf: 297.0, 26702 ellipseName: "International 1909 (Hayford)" 26703}; 26704 26705exports.kaula = { 26706 a: 6378163.0, 26707 rf: 298.24, 26708 ellipseName: "Kaula 1961" 26709}; 26710 26711exports.lerch = { 26712 a: 6378139.0, 26713 rf: 298.257, 26714 ellipseName: "Lerch 1979" 26715}; 26716 26717exports.mprts = { 26718 a: 6397300.0, 26719 rf: 191.0, 26720 ellipseName: "Maupertius 1738" 26721}; 26722 26723exports.new_intl = { 26724 a: 6378157.5, 26725 b: 6356772.2, 26726 ellipseName: "New International 1967" 26727}; 26728 26729exports.plessis = { 26730 a: 6376523.0, 26731 rf: 6355863.0, 26732 ellipseName: "Plessis 1817 (France)" 26733}; 26734 26735exports.krass = { 26736 a: 6378245.0, 26737 rf: 298.3, 26738 ellipseName: "Krassovsky, 1942" 26739}; 26740 26741exports.SEasia = { 26742 a: 6378155.0, 26743 b: 6356773.3205, 26744 ellipseName: "Southeast Asia" 26745}; 26746 26747exports.walbeck = { 26748 a: 6376896.0, 26749 b: 6355834.8467, 26750 ellipseName: "Walbeck" 26751}; 26752 26753exports.WGS60 = { 26754 a: 6378165.0, 26755 rf: 298.3, 26756 ellipseName: "WGS 60" 26757}; 26758 26759exports.WGS66 = { 26760 a: 6378145.0, 26761 rf: 298.25, 26762 ellipseName: "WGS 66" 26763}; 26764 26765exports.WGS7 = { 26766 a: 6378135.0, 26767 rf: 298.26, 26768 ellipseName: "WGS 72" 26769}; 26770 26771var WGS84 = exports.WGS84 = { 26772 a: 6378137.0, 26773 rf: 298.257223563, 26774 ellipseName: "WGS 84" 26775}; 26776 26777exports.sphere = { 26778 a: 6370997.0, 26779 b: 6370997.0, 26780 ellipseName: "Normal Sphere (r=6370997)" 26781}; 26782 26783 26784/***/ }), 26785
vendor: 1,218 bytes, lines 26786-26815
26786/***/ "./node_modules/proj4/lib/constants/PrimeMeridian.js": 26787/*!***********************************************************!*\ 26788 !*** ./node_modules/proj4/lib/constants/PrimeMeridian.js ***! 26789 \***********************************************************/ 26790/*! exports provided: default */ 26791/***/ (function(module, __webpack_exports__, __webpack_require__) { 26792 26793"use strict"; 26794__webpack_require__.r(__webpack_exports__); 26795/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return exports; }); 26796var exports = {}; 26797 26798 26799exports.greenwich = 0.0; //"0dE", 26800exports.lisbon = -9.131906111111; //"9d07'54.862\"W", 26801exports.paris = 2.337229166667; //"2d20'14.025\"E", 26802exports.bogota = -74.080916666667; //"74d04'51.3\"W", 26803exports.madrid = -3.687938888889; //"3d41'16.58\"W", 26804exports.rome = 12.452333333333; //"12d27'8.4\"E", 26805exports.bern = 7.439583333333; //"7d26'22.5\"E", 26806exports.jakarta = 106.807719444444; //"106d48'27.79\"E", 26807exports.ferro = -17.666666666667; //"17d40'W", 26808exports.brussels = 4.367975; //"4d22'4.71\"E", 26809exports.stockholm = 18.058277777778; //"18d3'29.8\"E", 26810exports.athens = 23.7163375; //"23d42'58.815\"E", 26811exports.oslo = 10.722916666667; //"10d43'22.5\"E" 26812 26813 26814/***/ }), 26815
vendor: 526 bytes, lines 26816-26832
26816/***/ "./node_modules/proj4/lib/constants/units.js": 26817/*!***************************************************!*\ 26818 !*** ./node_modules/proj4/lib/constants/units.js ***! 26819 \***************************************************/ 26820/*! exports provided: default */ 26821/***/ (function(module, __webpack_exports__, __webpack_require__) { 26822 26823"use strict"; 26824__webpack_require__.r(__webpack_exports__); 26825/* harmony default export */ __webpack_exports__["default"] = ({ 26826 ft: {to_meter: 0.3048}, 26827 'us-ft': {to_meter: 1200 / 3937} 26828}); 26829 26830 26831/***/ }), 26832
vendor: 4,064 bytes, lines 26833-26893
26833/***/ "./node_modules/proj4/lib/constants/values.js": 26834/*!****************************************************!*\ 26835 !*** ./node_modules/proj4/lib/constants/values.js ***! 26836 \****************************************************/ 26837/*! exports provided: PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT, PJD_WGS84, PJD_NODATUM, SRS_WGS84_SEMIMAJOR, SRS_WGS84_SEMIMINOR, SRS_WGS84_ESQUARED, SEC_TO_RAD, HALF_PI, SIXTH, RA4, RA6, EPSLN, D2R, R2D, FORTPI, TWO_PI, SPI */ 26838/***/ (function(module, __webpack_exports__, __webpack_require__) { 26839 26840"use strict"; 26841__webpack_require__.r(__webpack_exports__); 26842/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PJD_3PARAM", function() { return PJD_3PARAM; }); 26843/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PJD_7PARAM", function() { return PJD_7PARAM; }); 26844/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PJD_GRIDSHIFT", function() { return PJD_GRIDSHIFT; }); 26845/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PJD_WGS84", function() { return PJD_WGS84; }); 26846/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PJD_NODATUM", function() { return PJD_NODATUM; }); 26847/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SRS_WGS84_SEMIMAJOR", function() { return SRS_WGS84_SEMIMAJOR; }); 26848/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SRS_WGS84_SEMIMINOR", function() { return SRS_WGS84_SEMIMINOR; }); 26849/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SRS_WGS84_ESQUARED", function() { return SRS_WGS84_ESQUARED; }); 26850/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SEC_TO_RAD", function() { return SEC_TO_RAD; }); 26851/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HALF_PI", function() { return HALF_PI; }); 26852/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SIXTH", function() { return SIXTH; }); 26853/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RA4", function() { return RA4; }); 26854/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RA6", function() { return RA6; }); 26855/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EPSLN", function() { return EPSLN; }); 26856/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D2R", function() { return D2R; }); 26857/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R2D", function() { return R2D; }); 26858/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FORTPI", function() { return FORTPI; }); 26859/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TWO_PI", function() { return TWO_PI; }); 26860/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPI", function() { return SPI; }); 26861var PJD_3PARAM = 1; 26862var PJD_7PARAM = 2; 26863var PJD_GRIDSHIFT = 3; 26864var PJD_WGS84 = 4; // WGS84 or equivalent 26865var PJD_NODATUM = 5; // WGS84 or equivalent 26866var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms 26867var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms 26868var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms 26869var SEC_TO_RAD = 4.84813681109535993589914102357e-6; 26870var HALF_PI = Math.PI/2; 26871// ellipoid pj_set_ell.c 26872var SIXTH = 0.1666666666666666667; 26873/* 1/6 */ 26874var RA4 = 0.04722222222222222222; 26875/* 17/360 */ 26876var RA6 = 0.02215608465608465608; 26877var EPSLN = 1.0e-10; 26878// you'd think you could use Number.EPSILON above but that makes 26879// Mollweide get into an infinate loop. 26880 26881var D2R = 0.01745329251994329577; 26882var R2D = 57.29577951308232088; 26883var FORTPI = Math.PI/4; 26884var TWO_PI = Math.PI * 2; 26885// SPI is slightly greater than Math.PI, so values that exceed the -180..180 26886// degree range by a tiny amount don't get wrapped. This prevents points that 26887// have drifted from their original location along the 180th meridian (due to 26888// floating point error) from changing their sign. 26889var SPI = 3.14159265359; 26890 26891 26892/***/ }), 26893
vendor: 3,230 bytes, lines 26894-26993
26894/***/ "./node_modules/proj4/lib/core.js": 26895/*!****************************************!*\ 26896 !*** ./node_modules/proj4/lib/core.js ***! 26897 \****************************************/ 26898/*! exports provided: default */ 26899/***/ (function(module, __webpack_exports__, __webpack_require__) { 26900 26901"use strict"; 26902__webpack_require__.r(__webpack_exports__); 26903/* harmony import */ var _Proj__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Proj */ "./node_modules/proj4/lib/Proj.js"); 26904/* harmony import */ var _transform__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transform */ "./node_modules/proj4/lib/transform.js"); 26905 26906 26907var wgs84 = Object(_Proj__WEBPACK_IMPORTED_MODULE_0__["default"])('WGS84'); 26908 26909function transformer(from, to, coords) { 26910 var transformedArray, out, keys; 26911 if (Array.isArray(coords)) { 26912 transformedArray = Object(_transform__WEBPACK_IMPORTED_MODULE_1__["default"])(from, to, coords) || {x: NaN, y: NaN}; 26913 if (coords.length > 2) { 26914 if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) { 26915 if (typeof transformedArray.z === 'number') { 26916 return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3)); 26917 } else { 26918 return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3)); 26919 } 26920 } else { 26921 return [transformedArray.x, transformedArray.y].concat(coords.splice(2)); 26922 } 26923 } else { 26924 return [transformedArray.x, transformedArray.y]; 26925 } 26926 } else { 26927 out = Object(_transform__WEBPACK_IMPORTED_MODULE_1__["default"])(from, to, coords); 26928 keys = Object.keys(coords); 26929 if (keys.length === 2) { 26930 return out; 26931 } 26932 keys.forEach(function (key) { 26933 if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) { 26934 if (key === 'x' || key === 'y' || key === 'z') { 26935 return; 26936 } 26937 } else { 26938 if (key === 'x' || key === 'y') { 26939 return; 26940 } 26941 } 26942 out[key] = coords[key]; 26943 }); 26944 return out; 26945 } 26946} 26947 26948function checkProj(item) { 26949 if (item instanceof _Proj__WEBPACK_IMPORTED_MODULE_0__["default"]) { 26950 return item; 26951 } 26952 if (item.oProj) { 26953 return item.oProj; 26954 } 26955 return Object(_Proj__WEBPACK_IMPORTED_MODULE_0__["default"])(item); 26956} 26957 26958function proj4(fromProj, toProj, coord) { 26959 fromProj = checkProj(fromProj); 26960 var single = false; 26961 var obj; 26962 if (typeof toProj === 'undefined') { 26963 toProj = fromProj; 26964 fromProj = wgs84; 26965 single = true; 26966 } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) { 26967 coord = toProj; 26968 toProj = fromProj; 26969 fromProj = wgs84; 26970 single = true; 26971 } 26972 toProj = checkProj(toProj); 26973 if (coord) { 26974 return transformer(fromProj, toProj, coord); 26975 } else { 26976 obj = { 26977 forward: function (coords) { 26978 return transformer(fromProj, toProj, coords); 26979 }, 26980 inverse: function (coords) { 26981 return transformer(toProj, fromProj, coords); 26982 } 26983 }; 26984 if (single) { 26985 obj.oProj = toProj; 26986 } 26987 return obj; 26988 } 26989} 26990/* harmony default export */ __webpack_exports__["default"] = (proj4); 26991 26992/***/ }), 26993
vendor: 2,050 bytes, lines 26994-27046
26994/***/ "./node_modules/proj4/lib/datum.js": 26995/*!*****************************************!*\ 26996 !*** ./node_modules/proj4/lib/datum.js ***! 26997 \*****************************************/ 26998/*! exports provided: default */ 26999/***/ (function(module, __webpack_exports__, __webpack_require__) { 27000 27001"use strict"; 27002__webpack_require__.r(__webpack_exports__); 27003/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/values */ "./node_modules/proj4/lib/constants/values.js"); 27004 27005 27006function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) { 27007 var out = {}; 27008 27009 if (datumCode === undefined || datumCode === 'none') { 27010 out.datum_type = _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_NODATUM"]; 27011 } else { 27012 out.datum_type = _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_WGS84"]; 27013 } 27014 27015 if (datum_params) { 27016 out.datum_params = datum_params.map(parseFloat); 27017 if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) { 27018 out.datum_type = _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"]; 27019 } 27020 if (out.datum_params.length > 3) { 27021 if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) { 27022 out.datum_type = _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]; 27023 out.datum_params[3] *= _constants_values__WEBPACK_IMPORTED_MODULE_0__["SEC_TO_RAD"]; 27024 out.datum_params[4] *= _constants_values__WEBPACK_IMPORTED_MODULE_0__["SEC_TO_RAD"]; 27025 out.datum_params[5] *= _constants_values__WEBPACK_IMPORTED_MODULE_0__["SEC_TO_RAD"]; 27026 out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0; 27027 } 27028 } 27029 } 27030 27031 if (nadgrids) { 27032 out.datum_type = _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_GRIDSHIFT"]; 27033 out.grids = nadgrids; 27034 } 27035 out.a = a; //datum object also uses these values 27036 out.b = b; 27037 out.es = es; 27038 out.ep2 = ep2; 27039 return out; 27040} 27041 27042/* harmony default export */ __webpack_exports__["default"] = (datum); 27043 27044 27045/***/ }), 27046
vendor: 10,564 bytes, lines 27047-27310
27047/***/ "./node_modules/proj4/lib/datumUtils.js": 27048/*!**********************************************!*\ 27049 !*** ./node_modules/proj4/lib/datumUtils.js ***! 27050 \**********************************************/ 27051/*! exports provided: compareDatums, geodeticToGeocentric, geocentricToGeodetic, geocentricToWgs84, geocentricFromWgs84 */ 27052/***/ (function(module, __webpack_exports__, __webpack_require__) { 27053 27054"use strict"; 27055__webpack_require__.r(__webpack_exports__); 27056/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareDatums", function() { return compareDatums; }); 27057/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geodeticToGeocentric", function() { return geodeticToGeocentric; }); 27058/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geocentricToGeodetic", function() { return geocentricToGeodetic; }); 27059/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geocentricToWgs84", function() { return geocentricToWgs84; }); 27060/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geocentricFromWgs84", function() { return geocentricFromWgs84; }); 27061/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/values */ "./node_modules/proj4/lib/constants/values.js"); 27062 27063 27064function compareDatums(source, dest) { 27065 if (source.datum_type !== dest.datum_type) { 27066 return false; // false, datums are not equal 27067 } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) { 27068 // the tolerance for es is to ensure that GRS80 and WGS84 27069 // are considered identical 27070 return false; 27071 } else if (source.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"]) { 27072 return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]); 27073 } else if (source.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]) { 27074 return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]); 27075 } else { 27076 return true; // datums are equal 27077 } 27078} // cs_compare_datums() 27079 27080/* 27081 * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates 27082 * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z), 27083 * according to the current ellipsoid parameters. 27084 * 27085 * Latitude : Geodetic latitude in radians (input) 27086 * Longitude : Geodetic longitude in radians (input) 27087 * Height : Geodetic height, in meters (input) 27088 * X : Calculated Geocentric X coordinate, in meters (output) 27089 * Y : Calculated Geocentric Y coordinate, in meters (output) 27090 * Z : Calculated Geocentric Z coordinate, in meters (output) 27091 * 27092 */ 27093function geodeticToGeocentric(p, es, a) { 27094 var Longitude = p.x; 27095 var Latitude = p.y; 27096 var Height = p.z ? p.z : 0; //Z value not always supplied 27097 27098 var Rn; /* Earth radius at location */ 27099 var Sin_Lat; /* Math.sin(Latitude) */ 27100 var Sin2_Lat; /* Square of Math.sin(Latitude) */ 27101 var Cos_Lat; /* Math.cos(Latitude) */ 27102 27103 /* 27104 ** Don't blow up if Latitude is just a little out of the value 27105 ** range as it may just be a rounding issue. Also removed longitude 27106 ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001. 27107 */ 27108 if (Latitude < -_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] && Latitude > -1.001 * _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]) { 27109 Latitude = -_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 27110 } else if (Latitude > _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] && Latitude < 1.001 * _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]) { 27111 Latitude = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 27112 } else if (Latitude < -_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]) { 27113 /* Latitude out of range */ 27114 //..reportError('geocent:lat out of range:' + Latitude); 27115 return { x: -Infinity, y: -Infinity, z: p.z }; 27116 } else if (Latitude > _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]) { 27117 /* Latitude out of range */ 27118 return { x: Infinity, y: Infinity, z: p.z }; 27119 } 27120 27121 if (Longitude > Math.PI) { 27122 Longitude -= (2 * Math.PI); 27123 } 27124 Sin_Lat = Math.sin(Latitude); 27125 Cos_Lat = Math.cos(Latitude); 27126 Sin2_Lat = Sin_Lat * Sin_Lat; 27127 Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat)); 27128 return { 27129 x: (Rn + Height) * Cos_Lat * Math.cos(Longitude), 27130 y: (Rn + Height) * Cos_Lat * Math.sin(Longitude), 27131 z: ((Rn * (1 - es)) + Height) * Sin_Lat 27132 }; 27133} // cs_geodetic_to_geocentric() 27134 27135function geocentricToGeodetic(p, es, a, b) { 27136 /* local defintions and variables */ 27137 /* end-criterium of loop, accuracy of sin(Latitude) */ 27138 var genau = 1e-12; 27139 var genau2 = (genau * genau); 27140 var maxiter = 30; 27141 27142 var P; /* distance between semi-minor axis and location */ 27143 var RR; /* distance between center and location */ 27144 var CT; /* sin of geocentric latitude */ 27145 var ST; /* cos of geocentric latitude */ 27146 var RX; 27147 var RK; 27148 var RN; /* Earth radius at location */ 27149 var CPHI0; /* cos of start or old geodetic latitude in iterations */ 27150 var SPHI0; /* sin of start or old geodetic latitude in iterations */ 27151 var CPHI; /* cos of searched geodetic latitude */ 27152 var SPHI; /* sin of searched geodetic latitude */ 27153 var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */ 27154 var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */ 27155 27156 var X = p.x; 27157 var Y = p.y; 27158 var Z = p.z ? p.z : 0.0; //Z value not always supplied 27159 var Longitude; 27160 var Latitude; 27161 var Height; 27162 27163 P = Math.sqrt(X * X + Y * Y); 27164 RR = Math.sqrt(X * X + Y * Y + Z * Z); 27165 27166 /* special cases for latitude and longitude */ 27167 if (P / a < genau) { 27168 27169 /* special case, if P=0. (X=0., Y=0.) */ 27170 Longitude = 0.0; 27171 27172 /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis 27173 * of ellipsoid (=center of mass), Latitude becomes PI/2 */ 27174 if (RR / a < genau) { 27175 Latitude = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 27176 Height = -b; 27177 return { 27178 x: p.x, 27179 y: p.y, 27180 z: p.z 27181 }; 27182 } 27183 } else { 27184 /* ellipsoidal (geodetic) longitude 27185 * interval: -PI < Longitude <= +PI */ 27186 Longitude = Math.atan2(Y, X); 27187 } 27188 27189 /* -------------------------------------------------------------- 27190 * Following iterative algorithm was developped by 27191 * "Institut for Erdmessung", University of Hannover, July 1988. 27192 * Internet: www.ife.uni-hannover.de 27193 * Iterative computation of CPHI,SPHI and Height. 27194 * Iteration of CPHI and SPHI to 10**-12 radian resp. 27195 * 2*10**-7 arcsec. 27196 * -------------------------------------------------------------- 27197 */ 27198 CT = Z / RR; 27199 ST = P / RR; 27200 RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST); 27201 CPHI0 = ST * (1.0 - es) * RX; 27202 SPHI0 = CT * RX; 27203 iter = 0; 27204 27205 /* loop to find sin(Latitude) resp. Latitude 27206 * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */ 27207 do { 27208 iter++; 27209 RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0); 27210 27211 /* ellipsoidal (geodetic) height */ 27212 Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0); 27213 27214 RK = es * RN / (RN + Height); 27215 RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST); 27216 CPHI = ST * (1.0 - RK) * RX; 27217 SPHI = CT * RX; 27218 SDPHI = SPHI * CPHI0 - CPHI * SPHI0; 27219 CPHI0 = CPHI; 27220 SPHI0 = SPHI; 27221 } 27222 while (SDPHI * SDPHI > genau2 && iter < maxiter); 27223 27224 /* ellipsoidal (geodetic) latitude */ 27225 Latitude = Math.atan(SPHI / Math.abs(CPHI)); 27226 return { 27227 x: Longitude, 27228 y: Latitude, 27229 z: Height 27230 }; 27231} // cs_geocentric_to_geodetic() 27232 27233/****************************************************************/ 27234// pj_geocentic_to_wgs84( p ) 27235// p = point to transform in geocentric coordinates (x,y,z) 27236 27237 27238/** point object, nothing fancy, just allows values to be 27239 passed back and forth by reference rather than by value. 27240 Other point classes may be used as long as they have 27241 x and y properties, which will get modified in the transform method. 27242*/ 27243function geocentricToWgs84(p, datum_type, datum_params) { 27244 27245 if (datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"]) { 27246 // if( x[io] === HUGE_VAL ) 27247 // continue; 27248 return { 27249 x: p.x + datum_params[0], 27250 y: p.y + datum_params[1], 27251 z: p.z + datum_params[2], 27252 }; 27253 } else if (datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]) { 27254 var Dx_BF = datum_params[0]; 27255 var Dy_BF = datum_params[1]; 27256 var Dz_BF = datum_params[2]; 27257 var Rx_BF = datum_params[3]; 27258 var Ry_BF = datum_params[4]; 27259 var Rz_BF = datum_params[5]; 27260 var M_BF = datum_params[6]; 27261 // if( x[io] === HUGE_VAL ) 27262 // continue; 27263 return { 27264 x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF, 27265 y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF, 27266 z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF 27267 }; 27268 } 27269} // cs_geocentric_to_wgs84 27270 27271/****************************************************************/ 27272// pj_geocentic_from_wgs84() 27273// coordinate system definition, 27274// point to transform in geocentric coordinates (x,y,z) 27275function geocentricFromWgs84(p, datum_type, datum_params) { 27276 27277 if (datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"]) { 27278 //if( x[io] === HUGE_VAL ) 27279 // continue; 27280 return { 27281 x: p.x - datum_params[0], 27282 y: p.y - datum_params[1], 27283 z: p.z - datum_params[2], 27284 }; 27285 27286 } else if (datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]) { 27287 var Dx_BF = datum_params[0]; 27288 var Dy_BF = datum_params[1]; 27289 var Dz_BF = datum_params[2]; 27290 var Rx_BF = datum_params[3]; 27291 var Ry_BF = datum_params[4]; 27292 var Rz_BF = datum_params[5]; 27293 var M_BF = datum_params[6]; 27294 var x_tmp = (p.x - Dx_BF) / M_BF; 27295 var y_tmp = (p.y - Dy_BF) / M_BF; 27296 var z_tmp = (p.z - Dz_BF) / M_BF; 27297 //if( x[io] === HUGE_VAL ) 27298 // continue; 27299 27300 return { 27301 x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp, 27302 y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp, 27303 z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp 27304 }; 27305 } //cs_geocentric_from_wgs84() 27306} 27307 27308 27309/***/ }), 27310
vendor: 7,836 bytes, lines 27311-27511
27311/***/ "./node_modules/proj4/lib/datum_transform.js": 27312/*!***************************************************!*\ 27313 !*** ./node_modules/proj4/lib/datum_transform.js ***! 27314 \***************************************************/ 27315/*! exports provided: default, applyGridShift */ 27316/***/ (function(module, __webpack_exports__, __webpack_require__) { 27317 27318"use strict"; 27319__webpack_require__.r(__webpack_exports__); 27320/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyGridShift", function() { return applyGridShift; }); 27321/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/values */ "./node_modules/proj4/lib/constants/values.js"); 27322/* harmony import */ var _datumUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./datumUtils */ "./node_modules/proj4/lib/datumUtils.js"); 27323/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 27324 27325 27326 27327 27328function checkParams(type) { 27329 return (type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"] || type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]); 27330} 27331 27332/* harmony default export */ __webpack_exports__["default"] = (function(source, dest, point) { 27333 // Short cut if the datums are identical. 27334 if (Object(_datumUtils__WEBPACK_IMPORTED_MODULE_1__["compareDatums"])(source, dest)) { 27335 return point; // in this case, zero is sucess, 27336 // whereas cs_compare_datums returns 1 to indicate TRUE 27337 // confusing, should fix this 27338 } 27339 27340 // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest 27341 if (source.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_NODATUM"] || dest.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_NODATUM"]) { 27342 return point; 27343 } 27344 27345 // If this datum requires grid shifts, then apply it to geodetic coordinates. 27346 var source_a = source.a; 27347 var source_es = source.es; 27348 if (source.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_GRIDSHIFT"]) { 27349 var gridShiftCode = applyGridShift(source, false, point); 27350 if (gridShiftCode !== 0) { 27351 return undefined; 27352 } 27353 source_a = _constants_values__WEBPACK_IMPORTED_MODULE_0__["SRS_WGS84_SEMIMAJOR"]; 27354 source_es = _constants_values__WEBPACK_IMPORTED_MODULE_0__["SRS_WGS84_ESQUARED"]; 27355 } 27356 27357 var dest_a = dest.a; 27358 var dest_b = dest.b; 27359 var dest_es = dest.es; 27360 if (dest.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_GRIDSHIFT"]) { 27361 dest_a = _constants_values__WEBPACK_IMPORTED_MODULE_0__["SRS_WGS84_SEMIMAJOR"]; 27362 dest_b = _constants_values__WEBPACK_IMPORTED_MODULE_0__["SRS_WGS84_SEMIMINOR"]; 27363 dest_es = _constants_values__WEBPACK_IMPORTED_MODULE_0__["SRS_WGS84_ESQUARED"]; 27364 } 27365 27366 // Do we need to go through geocentric coordinates? 27367 if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) { 27368 return point; 27369 } 27370 27371 // Convert to geocentric coordinates. 27372 point = Object(_datumUtils__WEBPACK_IMPORTED_MODULE_1__["geodeticToGeocentric"])(point, source_es, source_a); 27373 // Convert between datums 27374 if (checkParams(source.datum_type)) { 27375 point = Object(_datumUtils__WEBPACK_IMPORTED_MODULE_1__["geocentricToWgs84"])(point, source.datum_type, source.datum_params); 27376 } 27377 if (checkParams(dest.datum_type)) { 27378 point = Object(_datumUtils__WEBPACK_IMPORTED_MODULE_1__["geocentricFromWgs84"])(point, dest.datum_type, dest.datum_params); 27379 } 27380 point = Object(_datumUtils__WEBPACK_IMPORTED_MODULE_1__["geocentricToGeodetic"])(point, dest_es, dest_a, dest_b); 27381 27382 if (dest.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_GRIDSHIFT"]) { 27383 var destGridShiftResult = applyGridShift(dest, true, point); 27384 if (destGridShiftResult !== 0) { 27385 return undefined; 27386 } 27387 } 27388 27389 return point; 27390}); 27391 27392function applyGridShift(source, inverse, point) { 27393 if (source.grids === null || source.grids.length === 0) { 27394 console.log('Grid shift grids not found'); 27395 return -1; 27396 } 27397 var input = {x: -point.x, y: point.y}; 27398 var output = {x: Number.NaN, y: Number.NaN}; 27399 var onlyMandatoryGrids = false; 27400 var attemptedGrids = []; 27401 for (var i = 0; i < source.grids.length; i++) { 27402 var grid = source.grids[i]; 27403 attemptedGrids.push(grid.name); 27404 if (grid.isNull) { 27405 output = input; 27406 break; 27407 } 27408 onlyMandatoryGrids = grid.mandatory; 27409 if (grid.grid === null) { 27410 if (grid.mandatory) { 27411 console.log("Unable to find mandatory grid '" + grid.name + "'"); 27412 return -1; 27413 } 27414 continue; 27415 } 27416 var subgrid = grid.grid.subgrids[0]; 27417 // skip tables that don't match our point at all 27418 var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0; 27419 var minX = subgrid.ll[0] - epsilon; 27420 var minY = subgrid.ll[1] - epsilon; 27421 var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon; 27422 var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon; 27423 if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) { 27424 continue; 27425 } 27426 output = applySubgridShift(input, inverse, subgrid); 27427 if (!isNaN(output.x)) { 27428 break; 27429 } 27430 } 27431 if (isNaN(output.x)) { 27432 console.log("Failed to find a grid shift table for location '"+ 27433 -input.x * _constants_values__WEBPACK_IMPORTED_MODULE_0__["R2D"] + " " + input.y * _constants_values__WEBPACK_IMPORTED_MODULE_0__["R2D"] + " tried: '" + attemptedGrids + "'"); 27434 return -1; 27435 } 27436 point.x = -output.x; 27437 point.y = output.y; 27438 return 0; 27439} 27440 27441function applySubgridShift(pin, inverse, ct) { 27442 var val = {x: Number.NaN, y: Number.NaN}; 27443 if (isNaN(pin.x)) { return val; } 27444 var tb = {x: pin.x, y: pin.y}; 27445 tb.x -= ct.ll[0]; 27446 tb.y -= ct.ll[1]; 27447 tb.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__["default"])(tb.x - Math.PI) + Math.PI; 27448 var t = nadInterpolate(tb, ct); 27449 if (inverse) { 27450 if (isNaN(t.x)) { 27451 return val; 27452 } 27453 t.x = tb.x - t.x; 27454 t.y = tb.y - t.y; 27455 var i = 9, tol = 1e-12; 27456 var dif, del; 27457 do { 27458 del = nadInterpolate(t, ct); 27459 if (isNaN(del.x)) { 27460 console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation."); 27461 break; 27462 } 27463 dif = {x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y)}; 27464 t.x += dif.x; 27465 t.y += dif.y; 27466 } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol); 27467 if (i < 0) { 27468 console.log("Inverse grid shift iterator failed to converge."); 27469 return val; 27470 } 27471 val.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__["default"])(t.x + ct.ll[0]); 27472 val.y = t.y + ct.ll[1]; 27473 } else { 27474 if (!isNaN(t.x)) { 27475 val.x = pin.x + t.x; 27476 val.y = pin.y + t.y; 27477 } 27478 } 27479 return val; 27480} 27481 27482function nadInterpolate(pin, ct) { 27483 var t = {x: pin.x / ct.del[0], y: pin.y / ct.del[1]}; 27484 var indx = {x: Math.floor(t.x), y: Math.floor(t.y)}; 27485 var frct = {x: t.x - 1.0 * indx.x, y: t.y - 1.0 * indx.y}; 27486 var val= {x: Number.NaN, y: Number.NaN}; 27487 var inx; 27488 if (indx.x < 0 || indx.x >= ct.lim[0]) { 27489 return val; 27490 } 27491 if (indx.y < 0 || indx.y >= ct.lim[1]) { 27492 return val; 27493 } 27494 inx = (indx.y * ct.lim[0]) + indx.x; 27495 var f00 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]}; 27496 inx++; 27497 var f10= {x: ct.cvs[inx][0], y: ct.cvs[inx][1]}; 27498 inx += ct.lim[0]; 27499 var f11 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]}; 27500 inx--; 27501 var f01 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]}; 27502 var m11 = frct.x * frct.y, m10 = frct.x * (1.0 - frct.y), 27503 m00 = (1.0 - frct.x) * (1.0 - frct.y), m01 = (1.0 - frct.x) * frct.y; 27504 val.x = (m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x); 27505 val.y = (m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y); 27506 return val; 27507} 27508 27509 27510/***/ }), 27511
vendor: 2,029 bytes, lines 27512-27582
27512/***/ "./node_modules/proj4/lib/defs.js": 27513/*!****************************************!*\ 27514 !*** ./node_modules/proj4/lib/defs.js ***! 27515 \****************************************/ 27516/*! exports provided: default */ 27517/***/ (function(module, __webpack_exports__, __webpack_require__) { 27518 27519"use strict"; 27520__webpack_require__.r(__webpack_exports__); 27521/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./global */ "./node_modules/proj4/lib/global.js"); 27522/* harmony import */ var _projString__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./projString */ "./node_modules/proj4/lib/projString.js"); 27523/* harmony import */ var wkt_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wkt-parser */ "./node_modules/wkt-parser/index.js"); 27524 27525 27526 27527 27528function defs(name) { 27529 /*global console*/ 27530 var that = this; 27531 if (arguments.length === 2) { 27532 var def = arguments[1]; 27533 if (typeof def === 'string') { 27534 if (def.charAt(0) === '+') { 27535 defs[name] = Object(_projString__WEBPACK_IMPORTED_MODULE_1__["default"])(arguments[1]); 27536 } 27537 else { 27538 defs[name] = Object(wkt_parser__WEBPACK_IMPORTED_MODULE_2__["default"])(arguments[1]); 27539 } 27540 } else { 27541 defs[name] = def; 27542 } 27543 } 27544 else if (arguments.length === 1) { 27545 if (Array.isArray(name)) { 27546 return name.map(function(v) { 27547 if (Array.isArray(v)) { 27548 defs.apply(that, v); 27549 } 27550 else { 27551 defs(v); 27552 } 27553 }); 27554 } 27555 else if (typeof name === 'string') { 27556 if (name in defs) { 27557 return defs[name]; 27558 } 27559 } 27560 else if ('EPSG' in name) { 27561 defs['EPSG:' + name.EPSG] = name; 27562 } 27563 else if ('ESRI' in name) { 27564 defs['ESRI:' + name.ESRI] = name; 27565 } 27566 else if ('IAU2000' in name) { 27567 defs['IAU2000:' + name.IAU2000] = name; 27568 } 27569 else { 27570 console.log(name); 27571 } 27572 return; 27573 } 27574 27575 27576} 27577Object(_global__WEBPACK_IMPORTED_MODULE_0__["default"])(defs); 27578/* harmony default export */ __webpack_exports__["default"] = (defs); 27579 27580 27581/***/ }), 27582
vendor: 2,349 bytes, lines 27583-27648
27583/***/ "./node_modules/proj4/lib/deriveConstants.js": 27584/*!***************************************************!*\ 27585 !*** ./node_modules/proj4/lib/deriveConstants.js ***! 27586 \***************************************************/ 27587/*! exports provided: eccentricity, sphere */ 27588/***/ (function(module, __webpack_exports__, __webpack_require__) { 27589 27590"use strict"; 27591__webpack_require__.r(__webpack_exports__); 27592/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "eccentricity", function() { return eccentricity; }); 27593/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sphere", function() { return sphere; }); 27594/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/values */ "./node_modules/proj4/lib/constants/values.js"); 27595/* harmony import */ var _constants_Ellipsoid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants/Ellipsoid */ "./node_modules/proj4/lib/constants/Ellipsoid.js"); 27596/* harmony import */ var _match__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./match */ "./node_modules/proj4/lib/match.js"); 27597 27598 27599 27600 27601function eccentricity(a, b, rf, R_A) { 27602 var a2 = a * a; // used in geocentric 27603 var b2 = b * b; // used in geocentric 27604 var es = (a2 - b2) / a2; // e ^ 2 27605 var e = 0; 27606 if (R_A) { 27607 a *= 1 - es * (_constants_values__WEBPACK_IMPORTED_MODULE_0__["SIXTH"] + es * (_constants_values__WEBPACK_IMPORTED_MODULE_0__["RA4"] + es * _constants_values__WEBPACK_IMPORTED_MODULE_0__["RA6"])); 27608 a2 = a * a; 27609 es = 0; 27610 } else { 27611 e = Math.sqrt(es); // eccentricity 27612 } 27613 var ep2 = (a2 - b2) / b2; // used in geocentric 27614 return { 27615 es: es, 27616 e: e, 27617 ep2: ep2 27618 }; 27619} 27620function sphere(a, b, rf, ellps, sphere) { 27621 if (!a) { // do we have an ellipsoid? 27622 var ellipse = Object(_match__WEBPACK_IMPORTED_MODULE_2__["default"])(_constants_Ellipsoid__WEBPACK_IMPORTED_MODULE_1__["default"], ellps); 27623 if (!ellipse) { 27624 ellipse = _constants_Ellipsoid__WEBPACK_IMPORTED_MODULE_1__["WGS84"]; 27625 } 27626 a = ellipse.a; 27627 b = ellipse.b; 27628 rf = ellipse.rf; 27629 } 27630 27631 if (rf && !b) { 27632 b = (1.0 - 1.0 / rf) * a; 27633 } 27634 if (rf === 0 || Math.abs(a - b) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 27635 sphere = true; 27636 b = a; 27637 } 27638 return { 27639 a: a, 27640 b: b, 27641 rf: rf, 27642 sphere: sphere 27643 }; 27644} 27645 27646 27647/***/ }), 27648
vendor: 721 bytes, lines 27649-27675
27649/***/ "./node_modules/proj4/lib/extend.js": 27650/*!******************************************!*\ 27651 !*** ./node_modules/proj4/lib/extend.js ***! 27652 \******************************************/ 27653/*! exports provided: default */ 27654/***/ (function(module, __webpack_exports__, __webpack_require__) { 27655 27656"use strict"; 27657__webpack_require__.r(__webpack_exports__); 27658/* harmony default export */ __webpack_exports__["default"] = (function(destination, source) { 27659 destination = destination || {}; 27660 var value, property; 27661 if (!source) { 27662 return destination; 27663 } 27664 for (property in source) { 27665 value = source[property]; 27666 if (value !== undefined) { 27667 destination[property] = value; 27668 } 27669 } 27670 return destination; 27671}); 27672 27673 27674/***/ }), 27675
vendor: 1,101 bytes, lines 27676-27699
27676/***/ "./node_modules/proj4/lib/global.js": 27677/*!******************************************!*\ 27678 !*** ./node_modules/proj4/lib/global.js ***! 27679 \******************************************/ 27680/*! exports provided: default */ 27681/***/ (function(module, __webpack_exports__, __webpack_require__) { 27682 27683"use strict"; 27684__webpack_require__.r(__webpack_exports__); 27685/* harmony default export */ __webpack_exports__["default"] = (function(defs) { 27686 defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"); 27687 defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"); 27688 defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"); 27689 27690 defs.WGS84 = defs['EPSG:4326']; 27691 defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857 27692 defs.GOOGLE = defs['EPSG:3857']; 27693 defs['EPSG:900913'] = defs['EPSG:3857']; 27694 defs['EPSG:102113'] = defs['EPSG:3857']; 27695}); 27696 27697 27698/***/ }), 27699
vendor: 2,832 bytes, lines 27700-27743
27700/***/ "./node_modules/proj4/lib/index.js": 27701/*!*****************************************!*\ 27702 !*** ./node_modules/proj4/lib/index.js ***! 27703 \*****************************************/ 27704/*! exports provided: default */ 27705/***/ (function(module, __webpack_exports__, __webpack_require__) { 27706 27707"use strict"; 27708__webpack_require__.r(__webpack_exports__); 27709/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core */ "./node_modules/proj4/lib/core.js"); 27710/* harmony import */ var _Proj__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Proj */ "./node_modules/proj4/lib/Proj.js"); 27711/* harmony import */ var _Point__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Point */ "./node_modules/proj4/lib/Point.js"); 27712/* harmony import */ var _common_toPoint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./common/toPoint */ "./node_modules/proj4/lib/common/toPoint.js"); 27713/* harmony import */ var _defs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defs */ "./node_modules/proj4/lib/defs.js"); 27714/* harmony import */ var _nadgrid__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nadgrid */ "./node_modules/proj4/lib/nadgrid.js"); 27715/* harmony import */ var _transform__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transform */ "./node_modules/proj4/lib/transform.js"); 27716/* harmony import */ var mgrs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! mgrs */ "./node_modules/mgrs/mgrs.js"); 27717/* harmony import */ var _projs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../projs */ "./node_modules/proj4/projs.js"); 27718 27719 27720 27721 27722 27723 27724 27725 27726 27727 27728_core__WEBPACK_IMPORTED_MODULE_0__["default"].defaultDatum = 'WGS84'; //default datum 27729_core__WEBPACK_IMPORTED_MODULE_0__["default"].Proj = _Proj__WEBPACK_IMPORTED_MODULE_1__["default"]; 27730_core__WEBPACK_IMPORTED_MODULE_0__["default"].WGS84 = new _core__WEBPACK_IMPORTED_MODULE_0__["default"].Proj('WGS84'); 27731_core__WEBPACK_IMPORTED_MODULE_0__["default"].Point = _Point__WEBPACK_IMPORTED_MODULE_2__["default"]; 27732_core__WEBPACK_IMPORTED_MODULE_0__["default"].toPoint = _common_toPoint__WEBPACK_IMPORTED_MODULE_3__["default"]; 27733_core__WEBPACK_IMPORTED_MODULE_0__["default"].defs = _defs__WEBPACK_IMPORTED_MODULE_4__["default"]; 27734_core__WEBPACK_IMPORTED_MODULE_0__["default"].nadgrid = _nadgrid__WEBPACK_IMPORTED_MODULE_5__["default"]; 27735_core__WEBPACK_IMPORTED_MODULE_0__["default"].transform = _transform__WEBPACK_IMPORTED_MODULE_6__["default"]; 27736_core__WEBPACK_IMPORTED_MODULE_0__["default"].mgrs = mgrs__WEBPACK_IMPORTED_MODULE_7__["default"]; 27737_core__WEBPACK_IMPORTED_MODULE_0__["default"].version = '__VERSION__'; 27738Object(_projs__WEBPACK_IMPORTED_MODULE_8__["default"])(_core__WEBPACK_IMPORTED_MODULE_0__["default"]); 27739/* harmony default export */ __webpack_exports__["default"] = (_core__WEBPACK_IMPORTED_MODULE_0__["default"]); 27740 27741 27742/***/ }), 27743
vendor: 901 bytes, lines 27744-27774
27744/***/ "./node_modules/proj4/lib/match.js": 27745/*!*****************************************!*\ 27746 !*** ./node_modules/proj4/lib/match.js ***! 27747 \*****************************************/ 27748/*! exports provided: default */ 27749/***/ (function(module, __webpack_exports__, __webpack_require__) { 27750 27751"use strict"; 27752__webpack_require__.r(__webpack_exports__); 27753/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return match; }); 27754var ignoredChar = /[\s_\-\/\(\)]/g; 27755function match(obj, key) { 27756 if (obj[key]) { 27757 return obj[key]; 27758 } 27759 var keys = Object.keys(obj); 27760 var lkey = key.toLowerCase().replace(ignoredChar, ''); 27761 var i = -1; 27762 var testkey, processedKey; 27763 while (++i < keys.length) { 27764 testkey = keys[i]; 27765 processedKey = testkey.toLowerCase().replace(ignoredChar, ''); 27766 if (processedKey === lkey) { 27767 return obj[testkey]; 27768 } 27769 } 27770} 27771 27772 27773/***/ }), 27774
vendor: 5,764 bytes, lines 27775-27931
27775/***/ "./node_modules/proj4/lib/nadgrid.js": 27776/*!*******************************************!*\ 27777 !*** ./node_modules/proj4/lib/nadgrid.js ***! 27778 \*******************************************/ 27779/*! exports provided: default, getNadgrids */ 27780/***/ (function(module, __webpack_exports__, __webpack_require__) { 27781 27782"use strict"; 27783__webpack_require__.r(__webpack_exports__); 27784/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return nadgrid; }); 27785/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNadgrids", function() { return getNadgrids; }); 27786/** 27787 * Resources for details of NTv2 file formats: 27788 * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf 27789 * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm 27790 */ 27791 27792var loadedNadgrids = {}; 27793 27794/** 27795 * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file 27796 * as an ArrayBuffer. 27797 */ 27798function nadgrid(key, data) { 27799 var view = new DataView(data); 27800 var isLittleEndian = detectLittleEndian(view); 27801 var header = readHeader(view, isLittleEndian); 27802 if (header.nSubgrids > 1) { 27803 console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored'); 27804 } 27805 var subgrids = readSubgrids(view, header, isLittleEndian); 27806 var nadgrid = {header: header, subgrids: subgrids}; 27807 loadedNadgrids[key] = nadgrid; 27808 return nadgrid; 27809} 27810 27811/** 27812 * Given a proj4 value for nadgrids, return an array of loaded grids 27813 */ 27814function getNadgrids(nadgrids) { 27815 // Format details: http://proj.maptools.org/gen_parms.html 27816 if (nadgrids === undefined) { return null; } 27817 var grids = nadgrids.split(','); 27818 return grids.map(parseNadgridString); 27819} 27820 27821function parseNadgridString(value) { 27822 if (value.length === 0) { 27823 return null; 27824 } 27825 var optional = value[0] === '@'; 27826 if (optional) { 27827 value = value.slice(1); 27828 } 27829 if (value === 'null') { 27830 return {name: 'null', mandatory: !optional, grid: null, isNull: true}; 27831 } 27832 return { 27833 name: value, 27834 mandatory: !optional, 27835 grid: loadedNadgrids[value] || null, 27836 isNull: false 27837 }; 27838} 27839 27840function secondsToRadians(seconds) { 27841 return (seconds / 3600) * Math.PI / 180; 27842} 27843 27844function detectLittleEndian(view) { 27845 var nFields = view.getInt32(8, false); 27846 if (nFields === 11) { 27847 return false; 27848 } 27849 nFields = view.getInt32(8, true); 27850 if (nFields !== 11) { 27851 console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian'); 27852 } 27853 return true; 27854} 27855 27856function readHeader(view, isLittleEndian) { 27857 return { 27858 nFields: view.getInt32(8, isLittleEndian), 27859 nSubgridFields: view.getInt32(24, isLittleEndian), 27860 nSubgrids: view.getInt32(40, isLittleEndian), 27861 shiftType: decodeString(view, 56, 56 + 8).trim(), 27862 fromSemiMajorAxis: view.getFloat64(120, isLittleEndian), 27863 fromSemiMinorAxis: view.getFloat64(136, isLittleEndian), 27864 toSemiMajorAxis: view.getFloat64(152, isLittleEndian), 27865 toSemiMinorAxis: view.getFloat64(168, isLittleEndian), 27866 }; 27867} 27868 27869function decodeString(view, start, end) { 27870 return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end))); 27871} 27872 27873function readSubgrids(view, header, isLittleEndian) { 27874 var gridOffset = 176; 27875 var grids = []; 27876 for (var i = 0; i < header.nSubgrids; i++) { 27877 var subHeader = readGridHeader(view, gridOffset, isLittleEndian); 27878 var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian); 27879 var lngColumnCount = Math.round( 27880 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval); 27881 var latColumnCount = Math.round( 27882 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval); 27883 // Proj4 operates on radians whereas the coordinates are in seconds in the grid 27884 grids.push({ 27885 ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)], 27886 del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)], 27887 lim: [lngColumnCount, latColumnCount], 27888 count: subHeader.gridNodeCount, 27889 cvs: mapNodes(nodes) 27890 }); 27891 } 27892 return grids; 27893} 27894 27895function mapNodes(nodes) { 27896 return nodes.map(function (r) {return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];}); 27897} 27898 27899function readGridHeader(view, offset, isLittleEndian) { 27900 return { 27901 name: decodeString(view, offset + 8, offset + 16).trim(), 27902 parent: decodeString(view, offset + 24, offset + 24 + 8).trim(), 27903 lowerLatitude: view.getFloat64(offset + 72, isLittleEndian), 27904 upperLatitude: view.getFloat64(offset + 88, isLittleEndian), 27905 lowerLongitude: view.getFloat64(offset + 104, isLittleEndian), 27906 upperLongitude: view.getFloat64(offset + 120, isLittleEndian), 27907 latitudeInterval: view.getFloat64(offset + 136, isLittleEndian), 27908 longitudeInterval: view.getFloat64(offset + 152, isLittleEndian), 27909 gridNodeCount: view.getInt32(offset + 168, isLittleEndian) 27910 }; 27911} 27912 27913function readGridNodes(view, offset, gridHeader, isLittleEndian) { 27914 var nodesOffset = offset + 176; 27915 var gridRecordLength = 16; 27916 var gridShiftRecords = []; 27917 for (var i = 0; i < gridHeader.gridNodeCount; i++) { 27918 var record = { 27919 latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian), 27920 longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian), 27921 latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian), 27922 longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian), 27923 }; 27924 gridShiftRecords.push(record); 27925 } 27926 return gridShiftRecords; 27927} 27928 27929 27930/***/ }), 27931
vendor: 2,863 bytes, lines 27932-28010
27932/***/ "./node_modules/proj4/lib/parseCode.js": 27933/*!*********************************************!*\ 27934 !*** ./node_modules/proj4/lib/parseCode.js ***! 27935 \*********************************************/ 27936/*! exports provided: default */ 27937/***/ (function(module, __webpack_exports__, __webpack_require__) { 27938 27939"use strict"; 27940__webpack_require__.r(__webpack_exports__); 27941/* harmony import */ var _defs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defs */ "./node_modules/proj4/lib/defs.js"); 27942/* harmony import */ var wkt_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wkt-parser */ "./node_modules/wkt-parser/index.js"); 27943/* harmony import */ var _projString__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./projString */ "./node_modules/proj4/lib/projString.js"); 27944/* harmony import */ var _match__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./match */ "./node_modules/proj4/lib/match.js"); 27945 27946 27947 27948 27949function testObj(code){ 27950 return typeof code === 'string'; 27951} 27952function testDef(code){ 27953 return code in _defs__WEBPACK_IMPORTED_MODULE_0__["default"]; 27954} 27955var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS']; 27956function testWKT(code){ 27957 return codeWords.some(function (word) { 27958 return code.indexOf(word) > -1; 27959 }); 27960} 27961var codes = ['3857', '900913', '3785', '102113']; 27962function checkMercator(item) { 27963 var auth = Object(_match__WEBPACK_IMPORTED_MODULE_3__["default"])(item, 'authority'); 27964 if (!auth) { 27965 return; 27966 } 27967 var code = Object(_match__WEBPACK_IMPORTED_MODULE_3__["default"])(auth, 'epsg'); 27968 return code && codes.indexOf(code) > -1; 27969} 27970function checkProjStr(item) { 27971 var ext = Object(_match__WEBPACK_IMPORTED_MODULE_3__["default"])(item, 'extension'); 27972 if (!ext) { 27973 return; 27974 } 27975 return Object(_match__WEBPACK_IMPORTED_MODULE_3__["default"])(ext, 'proj4'); 27976} 27977function testProj(code){ 27978 return code[0] === '+'; 27979} 27980function parse(code){ 27981 if (testObj(code)) { 27982 //check to see if this is a WKT string 27983 if (testDef(code)) { 27984 return _defs__WEBPACK_IMPORTED_MODULE_0__["default"][code]; 27985 } 27986 if (testWKT(code)) { 27987 var out = Object(wkt_parser__WEBPACK_IMPORTED_MODULE_1__["default"])(code); 27988 // test of spetial case, due to this being a very common and often malformed 27989 if (checkMercator(out)) { 27990 return _defs__WEBPACK_IMPORTED_MODULE_0__["default"]['EPSG:3857']; 27991 } 27992 var maybeProjStr = checkProjStr(out); 27993 if (maybeProjStr) { 27994 return Object(_projString__WEBPACK_IMPORTED_MODULE_2__["default"])(maybeProjStr); 27995 } 27996 return out; 27997 } 27998 if (testProj(code)) { 27999 return Object(_projString__WEBPACK_IMPORTED_MODULE_2__["default"])(code); 28000 } 28001 }else{ 28002 return code; 28003 } 28004} 28005 28006/* harmony default export */ __webpack_exports__["default"] = (parse); 28007 28008 28009/***/ }), 28010
vendor: 4,928 bytes, lines 28011-28165
28011/***/ "./node_modules/proj4/lib/projString.js": 28012/*!**********************************************!*\ 28013 !*** ./node_modules/proj4/lib/projString.js ***! 28014 \**********************************************/ 28015/*! exports provided: default */ 28016/***/ (function(module, __webpack_exports__, __webpack_require__) { 28017 28018"use strict"; 28019__webpack_require__.r(__webpack_exports__); 28020/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/values */ "./node_modules/proj4/lib/constants/values.js"); 28021/* harmony import */ var _constants_PrimeMeridian__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants/PrimeMeridian */ "./node_modules/proj4/lib/constants/PrimeMeridian.js"); 28022/* harmony import */ var _constants_units__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants/units */ "./node_modules/proj4/lib/constants/units.js"); 28023/* harmony import */ var _match__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./match */ "./node_modules/proj4/lib/match.js"); 28024 28025 28026 28027 28028 28029/* harmony default export */ __webpack_exports__["default"] = (function(defData) { 28030 var self = {}; 28031 var paramObj = defData.split('+').map(function(v) { 28032 return v.trim(); 28033 }).filter(function(a) { 28034 return a; 28035 }).reduce(function(p, a) { 28036 var split = a.split('='); 28037 split.push(true); 28038 p[split[0].toLowerCase()] = split[1]; 28039 return p; 28040 }, {}); 28041 var paramName, paramVal, paramOutname; 28042 var params = { 28043 proj: 'projName', 28044 datum: 'datumCode', 28045 rf: function(v) { 28046 self.rf = parseFloat(v); 28047 }, 28048 lat_0: function(v) { 28049 self.lat0 = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28050 }, 28051 lat_1: function(v) { 28052 self.lat1 = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28053 }, 28054 lat_2: function(v) { 28055 self.lat2 = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28056 }, 28057 lat_ts: function(v) { 28058 self.lat_ts = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28059 }, 28060 lon_0: function(v) { 28061 self.long0 = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28062 }, 28063 lon_1: function(v) { 28064 self.long1 = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28065 }, 28066 lon_2: function(v) { 28067 self.long2 = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28068 }, 28069 alpha: function(v) { 28070 self.alpha = parseFloat(v) * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28071 }, 28072 lonc: function(v) { 28073 self.longc = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28074 }, 28075 x_0: function(v) { 28076 self.x0 = parseFloat(v); 28077 }, 28078 y_0: function(v) { 28079 self.y0 = parseFloat(v); 28080 }, 28081 k_0: function(v) { 28082 self.k0 = parseFloat(v); 28083 }, 28084 k: function(v) { 28085 self.k0 = parseFloat(v); 28086 }, 28087 a: function(v) { 28088 self.a = parseFloat(v); 28089 }, 28090 b: function(v) { 28091 self.b = parseFloat(v); 28092 }, 28093 r_a: function() { 28094 self.R_A = true; 28095 }, 28096 zone: function(v) { 28097 self.zone = parseInt(v, 10); 28098 }, 28099 south: function() { 28100 self.utmSouth = true; 28101 }, 28102 towgs84: function(v) { 28103 self.datum_params = v.split(",").map(function(a) { 28104 return parseFloat(a); 28105 }); 28106 }, 28107 to_meter: function(v) { 28108 self.to_meter = parseFloat(v); 28109 }, 28110 units: function(v) { 28111 self.units = v; 28112 var unit = Object(_match__WEBPACK_IMPORTED_MODULE_3__["default"])(_constants_units__WEBPACK_IMPORTED_MODULE_2__["default"], v); 28113 if (unit) { 28114 self.to_meter = unit.to_meter; 28115 } 28116 }, 28117 from_greenwich: function(v) { 28118 self.from_greenwich = v * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28119 }, 28120 pm: function(v) { 28121 var pm = Object(_match__WEBPACK_IMPORTED_MODULE_3__["default"])(_constants_PrimeMeridian__WEBPACK_IMPORTED_MODULE_1__["default"], v); 28122 self.from_greenwich = (pm ? pm : parseFloat(v)) * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 28123 }, 28124 nadgrids: function(v) { 28125 if (v === '@null') { 28126 self.datumCode = 'none'; 28127 } 28128 else { 28129 self.nadgrids = v; 28130 } 28131 }, 28132 axis: function(v) { 28133 var legalAxis = "ewnsud"; 28134 if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) { 28135 self.axis = v; 28136 } 28137 }, 28138 approx: function() { 28139 self.approx = true; 28140 } 28141 }; 28142 for (paramName in paramObj) { 28143 paramVal = paramObj[paramName]; 28144 if (paramName in params) { 28145 paramOutname = params[paramName]; 28146 if (typeof paramOutname === 'function') { 28147 paramOutname(paramVal); 28148 } 28149 else { 28150 self[paramOutname] = paramVal; 28151 } 28152 } 28153 else { 28154 self[paramName] = paramVal; 28155 } 28156 } 28157 if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){ 28158 self.datumCode = self.datumCode.toLowerCase(); 28159 } 28160 return self; 28161}); 28162 28163 28164/***/ }), 28165
vendor: 1,830 bytes, lines 28166-28222
28166/***/ "./node_modules/proj4/lib/projections.js": 28167/*!***********************************************!*\ 28168 !*** ./node_modules/proj4/lib/projections.js ***! 28169 \***********************************************/ 28170/*! exports provided: add, get, start, default */ 28171/***/ (function(module, __webpack_exports__, __webpack_require__) { 28172 28173"use strict"; 28174__webpack_require__.r(__webpack_exports__); 28175/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); 28176/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; }); 28177/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "start", function() { return start; }); 28178/* harmony import */ var _projections_merc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./projections/merc */ "./node_modules/proj4/lib/projections/merc.js"); 28179/* harmony import */ var _projections_longlat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./projections/longlat */ "./node_modules/proj4/lib/projections/longlat.js"); 28180 28181 28182var projs = [_projections_merc__WEBPACK_IMPORTED_MODULE_0__["default"], _projections_longlat__WEBPACK_IMPORTED_MODULE_1__["default"]]; 28183var names = {}; 28184var projStore = []; 28185 28186function add(proj, i) { 28187 var len = projStore.length; 28188 if (!proj.names) { 28189 console.log(i); 28190 return true; 28191 } 28192 projStore[len] = proj; 28193 proj.names.forEach(function(n) { 28194 names[n.toLowerCase()] = len; 28195 }); 28196 return this; 28197} 28198 28199 28200 28201function get(name) { 28202 if (!name) { 28203 return false; 28204 } 28205 var n = name.toLowerCase(); 28206 if (typeof names[n] !== 'undefined' && projStore[names[n]]) { 28207 return projStore[names[n]]; 28208 } 28209} 28210 28211function start() { 28212 projs.forEach(add); 28213} 28214/* harmony default export */ __webpack_exports__["default"] = ({ 28215 start: start, 28216 add: add, 28217 get: get 28218}); 28219 28220 28221/***/ }), 28222
vendor: 5,713 bytes, lines 28223-28374
28223/***/ "./node_modules/proj4/lib/projections/aea.js": 28224/*!***************************************************!*\ 28225 !*** ./node_modules/proj4/lib/projections/aea.js ***! 28226 \***************************************************/ 28227/*! exports provided: init, forward, inverse, phi1z, names, default */ 28228/***/ (function(module, __webpack_exports__, __webpack_require__) { 28229 28230"use strict"; 28231__webpack_require__.r(__webpack_exports__); 28232/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 28233/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 28234/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 28235/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "phi1z", function() { return phi1z; }); 28236/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 28237/* harmony import */ var _common_msfnz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/msfnz */ "./node_modules/proj4/lib/common/msfnz.js"); 28238/* harmony import */ var _common_qsfnz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/qsfnz */ "./node_modules/proj4/lib/common/qsfnz.js"); 28239/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 28240/* harmony import */ var _common_asinz__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/asinz */ "./node_modules/proj4/lib/common/asinz.js"); 28241/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 28242 28243 28244 28245 28246 28247 28248function init() { 28249 28250 if (Math.abs(this.lat1 + this.lat2) < _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"]) { 28251 return; 28252 } 28253 this.temp = this.b / this.a; 28254 this.es = 1 - Math.pow(this.temp, 2); 28255 this.e3 = Math.sqrt(this.es); 28256 28257 this.sin_po = Math.sin(this.lat1); 28258 this.cos_po = Math.cos(this.lat1); 28259 this.t1 = this.sin_po; 28260 this.con = this.sin_po; 28261 this.ms1 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e3, this.sin_po, this.cos_po); 28262 this.qs1 = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e3, this.sin_po, this.cos_po); 28263 28264 this.sin_po = Math.sin(this.lat2); 28265 this.cos_po = Math.cos(this.lat2); 28266 this.t2 = this.sin_po; 28267 this.ms2 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e3, this.sin_po, this.cos_po); 28268 this.qs2 = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e3, this.sin_po, this.cos_po); 28269 28270 this.sin_po = Math.sin(this.lat0); 28271 this.cos_po = Math.cos(this.lat0); 28272 this.t3 = this.sin_po; 28273 this.qs0 = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e3, this.sin_po, this.cos_po); 28274 28275 if (Math.abs(this.lat1 - this.lat2) > _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"]) { 28276 this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1); 28277 } 28278 else { 28279 this.ns0 = this.con; 28280 } 28281 this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1; 28282 this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0; 28283} 28284 28285/* Albers Conical Equal Area forward equations--mapping lat,long to x,y 28286 -------------------------------------------------------------------*/ 28287function forward(p) { 28288 28289 var lon = p.x; 28290 var lat = p.y; 28291 28292 this.sin_phi = Math.sin(lat); 28293 this.cos_phi = Math.cos(lat); 28294 28295 var qs = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e3, this.sin_phi, this.cos_phi); 28296 var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0; 28297 var theta = this.ns0 * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__["default"])(lon - this.long0); 28298 var x = rh1 * Math.sin(theta) + this.x0; 28299 var y = this.rh - rh1 * Math.cos(theta) + this.y0; 28300 28301 p.x = x; 28302 p.y = y; 28303 return p; 28304} 28305 28306function inverse(p) { 28307 var rh1, qs, con, theta, lon, lat; 28308 28309 p.x -= this.x0; 28310 p.y = this.rh - p.y + this.y0; 28311 if (this.ns0 >= 0) { 28312 rh1 = Math.sqrt(p.x * p.x + p.y * p.y); 28313 con = 1; 28314 } 28315 else { 28316 rh1 = -Math.sqrt(p.x * p.x + p.y * p.y); 28317 con = -1; 28318 } 28319 theta = 0; 28320 if (rh1 !== 0) { 28321 theta = Math.atan2(con * p.x, con * p.y); 28322 } 28323 con = rh1 * this.ns0 / this.a; 28324 if (this.sphere) { 28325 lat = Math.asin((this.c - con * con) / (2 * this.ns0)); 28326 } 28327 else { 28328 qs = (this.c - con * con) / this.ns0; 28329 lat = this.phi1z(this.e3, qs); 28330 } 28331 28332 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__["default"])(theta / this.ns0 + this.long0); 28333 p.x = lon; 28334 p.y = lat; 28335 return p; 28336} 28337 28338/* Function to compute phi1, the latitude for the inverse of the 28339 Albers Conical Equal-Area projection. 28340-------------------------------------------*/ 28341function phi1z(eccent, qs) { 28342 var sinphi, cosphi, con, com, dphi; 28343 var phi = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_3__["default"])(0.5 * qs); 28344 if (eccent < _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"]) { 28345 return phi; 28346 } 28347 28348 var eccnts = eccent * eccent; 28349 for (var i = 1; i <= 25; i++) { 28350 sinphi = Math.sin(phi); 28351 cosphi = Math.cos(phi); 28352 con = eccent * sinphi; 28353 com = 1 - con * con; 28354 dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con))); 28355 phi = phi + dphi; 28356 if (Math.abs(dphi) <= 1e-7) { 28357 return phi; 28358 } 28359 } 28360 return null; 28361} 28362 28363var names = ["Albers_Conic_Equal_Area", "Albers", "aea"]; 28364/* harmony default export */ __webpack_exports__["default"] = ({ 28365 init: init, 28366 forward: forward, 28367 inverse: inverse, 28368 names: names, 28369 phi1z: phi1z 28370}); 28371 28372 28373/***/ }), 28374
vendor: 11,323 bytes, lines 28375-28609
28375/***/ "./node_modules/proj4/lib/projections/aeqd.js": 28376/*!****************************************************!*\ 28377 !*** ./node_modules/proj4/lib/projections/aeqd.js ***! 28378 \****************************************************/ 28379/*! exports provided: init, forward, inverse, names, default */ 28380/***/ (function(module, __webpack_exports__, __webpack_require__) { 28381 28382"use strict"; 28383__webpack_require__.r(__webpack_exports__); 28384/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 28385/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 28386/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 28387/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 28388/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 28389/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 28390/* harmony import */ var _common_mlfn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/mlfn */ "./node_modules/proj4/lib/common/mlfn.js"); 28391/* harmony import */ var _common_e0fn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/e0fn */ "./node_modules/proj4/lib/common/e0fn.js"); 28392/* harmony import */ var _common_e1fn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/e1fn */ "./node_modules/proj4/lib/common/e1fn.js"); 28393/* harmony import */ var _common_e2fn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/e2fn */ "./node_modules/proj4/lib/common/e2fn.js"); 28394/* harmony import */ var _common_e3fn__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/e3fn */ "./node_modules/proj4/lib/common/e3fn.js"); 28395/* harmony import */ var _common_gN__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/gN */ "./node_modules/proj4/lib/common/gN.js"); 28396/* harmony import */ var _common_asinz__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/asinz */ "./node_modules/proj4/lib/common/asinz.js"); 28397/* harmony import */ var _common_imlfn__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../common/imlfn */ "./node_modules/proj4/lib/common/imlfn.js"); 28398 28399 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412function init() { 28413 this.sin_p12 = Math.sin(this.lat0); 28414 this.cos_p12 = Math.cos(this.lat0); 28415} 28416 28417function forward(p) { 28418 var lon = p.x; 28419 var lat = p.y; 28420 var sinphi = Math.sin(p.y); 28421 var cosphi = Math.cos(p.y); 28422 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 28423 var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5; 28424 if (this.sphere) { 28425 if (Math.abs(this.sin_p12 - 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28426 //North Pole case 28427 p.x = this.x0 + this.a * (_constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"] - lat) * Math.sin(dlon); 28428 p.y = this.y0 - this.a * (_constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"] - lat) * Math.cos(dlon); 28429 return p; 28430 } 28431 else if (Math.abs(this.sin_p12 + 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28432 //South Pole case 28433 p.x = this.x0 + this.a * (_constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"] + lat) * Math.sin(dlon); 28434 p.y = this.y0 + this.a * (_constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"] + lat) * Math.cos(dlon); 28435 return p; 28436 } 28437 else { 28438 //default case 28439 cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon); 28440 c = Math.acos(cos_c); 28441 kp = c ? c / Math.sin(c) : 1; 28442 p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon); 28443 p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon)); 28444 return p; 28445 } 28446 } 28447 else { 28448 e0 = Object(_common_e0fn__WEBPACK_IMPORTED_MODULE_3__["default"])(this.es); 28449 e1 = Object(_common_e1fn__WEBPACK_IMPORTED_MODULE_4__["default"])(this.es); 28450 e2 = Object(_common_e2fn__WEBPACK_IMPORTED_MODULE_5__["default"])(this.es); 28451 e3 = Object(_common_e3fn__WEBPACK_IMPORTED_MODULE_6__["default"])(this.es); 28452 if (Math.abs(this.sin_p12 - 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28453 //North Pole case 28454 Mlp = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(e0, e1, e2, e3, _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]); 28455 Ml = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(e0, e1, e2, e3, lat); 28456 p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon); 28457 p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon); 28458 return p; 28459 } 28460 else if (Math.abs(this.sin_p12 + 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28461 //South Pole case 28462 Mlp = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(e0, e1, e2, e3, _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]); 28463 Ml = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(e0, e1, e2, e3, lat); 28464 p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon); 28465 p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon); 28466 return p; 28467 } 28468 else { 28469 //Default case 28470 tanphi = sinphi / cosphi; 28471 Nl1 = Object(_common_gN__WEBPACK_IMPORTED_MODULE_7__["default"])(this.a, this.e, this.sin_p12); 28472 Nl = Object(_common_gN__WEBPACK_IMPORTED_MODULE_7__["default"])(this.a, this.e, sinphi); 28473 psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi)); 28474 Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon)); 28475 if (Az === 0) { 28476 s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi)); 28477 } 28478 else if (Math.abs(Math.abs(Az) - Math.PI) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28479 s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi)); 28480 } 28481 else { 28482 s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az)); 28483 } 28484 G = this.e * this.sin_p12 / Math.sqrt(1 - this.es); 28485 H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es); 28486 GH = G * H; 28487 Hs = H * H; 28488 s2 = s * s; 28489 s3 = s2 * s; 28490 s4 = s3 * s; 28491 s5 = s4 * s; 28492 c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH); 28493 p.x = this.x0 + c * Math.sin(Az); 28494 p.y = this.y0 + c * Math.cos(Az); 28495 return p; 28496 } 28497 } 28498 28499 28500} 28501 28502function inverse(p) { 28503 p.x -= this.x0; 28504 p.y -= this.y0; 28505 var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi; 28506 if (this.sphere) { 28507 rh = Math.sqrt(p.x * p.x + p.y * p.y); 28508 if (rh > (2 * _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"] * this.a)) { 28509 return; 28510 } 28511 z = rh / this.a; 28512 28513 sinz = Math.sin(z); 28514 cosz = Math.cos(z); 28515 28516 lon = this.long0; 28517 if (Math.abs(rh) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28518 lat = this.lat0; 28519 } 28520 else { 28521 lat = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_8__["default"])(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh); 28522 con = Math.abs(this.lat0) - _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]; 28523 if (Math.abs(con) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28524 if (this.lat0 >= 0) { 28525 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.atan2(p.x, - p.y)); 28526 } 28527 else { 28528 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 - Math.atan2(-p.x, p.y)); 28529 } 28530 } 28531 else { 28532 /*con = cosz - this.sin_p12 * Math.sin(lat); 28533 if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) { 28534 //no-op, just keep the lon value as is 28535 } else { 28536 var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh)); 28537 lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh))); 28538 }*/ 28539 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz)); 28540 } 28541 } 28542 28543 p.x = lon; 28544 p.y = lat; 28545 return p; 28546 } 28547 else { 28548 e0 = Object(_common_e0fn__WEBPACK_IMPORTED_MODULE_3__["default"])(this.es); 28549 e1 = Object(_common_e1fn__WEBPACK_IMPORTED_MODULE_4__["default"])(this.es); 28550 e2 = Object(_common_e2fn__WEBPACK_IMPORTED_MODULE_5__["default"])(this.es); 28551 e3 = Object(_common_e3fn__WEBPACK_IMPORTED_MODULE_6__["default"])(this.es); 28552 if (Math.abs(this.sin_p12 - 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28553 //North pole case 28554 Mlp = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(e0, e1, e2, e3, _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]); 28555 rh = Math.sqrt(p.x * p.x + p.y * p.y); 28556 M = Mlp - rh; 28557 lat = Object(_common_imlfn__WEBPACK_IMPORTED_MODULE_9__["default"])(M / this.a, e0, e1, e2, e3); 28558 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.atan2(p.x, - 1 * p.y)); 28559 p.x = lon; 28560 p.y = lat; 28561 return p; 28562 } 28563 else if (Math.abs(this.sin_p12 + 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 28564 //South pole case 28565 Mlp = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(e0, e1, e2, e3, _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]); 28566 rh = Math.sqrt(p.x * p.x + p.y * p.y); 28567 M = rh - Mlp; 28568 28569 lat = Object(_common_imlfn__WEBPACK_IMPORTED_MODULE_9__["default"])(M / this.a, e0, e1, e2, e3); 28570 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.atan2(p.x, p.y)); 28571 p.x = lon; 28572 p.y = lat; 28573 return p; 28574 } 28575 else { 28576 //default case 28577 rh = Math.sqrt(p.x * p.x + p.y * p.y); 28578 Az = Math.atan2(p.x, p.y); 28579 N1 = Object(_common_gN__WEBPACK_IMPORTED_MODULE_7__["default"])(this.a, this.e, this.sin_p12); 28580 cosAz = Math.cos(Az); 28581 tmp = this.e * this.cos_p12 * cosAz; 28582 A = -tmp * tmp / (1 - this.es); 28583 B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es); 28584 D = rh / N1; 28585 Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24; 28586 F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6; 28587 psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz); 28588 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi))); 28589 sinpsi = Math.sin(psi); 28590 lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es)); 28591 p.x = lon; 28592 p.y = lat; 28593 return p; 28594 } 28595 } 28596 28597} 28598 28599var names = ["Azimuthal_Equidistant", "aeqd"]; 28600/* harmony default export */ __webpack_exports__["default"] = ({ 28601 init: init, 28602 forward: forward, 28603 inverse: inverse, 28604 names: names 28605}); 28606 28607 28608/***/ }), 28609
vendor: 5,880 bytes, lines 28610-28744
28610/***/ "./node_modules/proj4/lib/projections/cass.js": 28611/*!****************************************************!*\ 28612 !*** ./node_modules/proj4/lib/projections/cass.js ***! 28613 \****************************************************/ 28614/*! exports provided: init, forward, inverse, names, default */ 28615/***/ (function(module, __webpack_exports__, __webpack_require__) { 28616 28617"use strict"; 28618__webpack_require__.r(__webpack_exports__); 28619/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 28620/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 28621/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 28622/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 28623/* harmony import */ var _common_mlfn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/mlfn */ "./node_modules/proj4/lib/common/mlfn.js"); 28624/* harmony import */ var _common_e0fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/e0fn */ "./node_modules/proj4/lib/common/e0fn.js"); 28625/* harmony import */ var _common_e1fn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/e1fn */ "./node_modules/proj4/lib/common/e1fn.js"); 28626/* harmony import */ var _common_e2fn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/e2fn */ "./node_modules/proj4/lib/common/e2fn.js"); 28627/* harmony import */ var _common_e3fn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/e3fn */ "./node_modules/proj4/lib/common/e3fn.js"); 28628/* harmony import */ var _common_gN__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/gN */ "./node_modules/proj4/lib/common/gN.js"); 28629/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 28630/* harmony import */ var _common_adjust_lat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/adjust_lat */ "./node_modules/proj4/lib/common/adjust_lat.js"); 28631/* harmony import */ var _common_imlfn__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/imlfn */ "./node_modules/proj4/lib/common/imlfn.js"); 28632/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 28633 28634 28635 28636 28637 28638 28639 28640 28641 28642 28643 28644function init() { 28645 if (!this.sphere) { 28646 this.e0 = Object(_common_e0fn__WEBPACK_IMPORTED_MODULE_1__["default"])(this.es); 28647 this.e1 = Object(_common_e1fn__WEBPACK_IMPORTED_MODULE_2__["default"])(this.es); 28648 this.e2 = Object(_common_e2fn__WEBPACK_IMPORTED_MODULE_3__["default"])(this.es); 28649 this.e3 = Object(_common_e3fn__WEBPACK_IMPORTED_MODULE_4__["default"])(this.es); 28650 this.ml0 = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e0, this.e1, this.e2, this.e3, this.lat0); 28651 } 28652} 28653 28654/* Cassini forward equations--mapping lat,long to x,y 28655 -----------------------------------------------------------------------*/ 28656function forward(p) { 28657 28658 /* Forward equations 28659 -----------------*/ 28660 var x, y; 28661 var lam = p.x; 28662 var phi = p.y; 28663 lam = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__["default"])(lam - this.long0); 28664 28665 if (this.sphere) { 28666 x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam)); 28667 y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0); 28668 } 28669 else { 28670 //ellipsoid 28671 var sinphi = Math.sin(phi); 28672 var cosphi = Math.cos(phi); 28673 var nl = Object(_common_gN__WEBPACK_IMPORTED_MODULE_5__["default"])(this.a, this.e, sinphi); 28674 var tl = Math.tan(phi) * Math.tan(phi); 28675 var al = lam * Math.cos(phi); 28676 var asq = al * al; 28677 var cl = this.es * cosphi * cosphi / (1 - this.es); 28678 var ml = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e0, this.e1, this.e2, this.e3, phi); 28679 28680 x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120)); 28681 y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24); 28682 28683 28684 } 28685 28686 p.x = x + this.x0; 28687 p.y = y + this.y0; 28688 return p; 28689} 28690 28691/* Inverse equations 28692 -----------------*/ 28693function inverse(p) { 28694 p.x -= this.x0; 28695 p.y -= this.y0; 28696 var x = p.x / this.a; 28697 var y = p.y / this.a; 28698 var phi, lam; 28699 28700 if (this.sphere) { 28701 var dd = y + this.lat0; 28702 phi = Math.asin(Math.sin(dd) * Math.cos(x)); 28703 lam = Math.atan2(Math.tan(x), Math.cos(dd)); 28704 } 28705 else { 28706 /* ellipsoid */ 28707 var ml1 = this.ml0 / this.a + y; 28708 var phi1 = Object(_common_imlfn__WEBPACK_IMPORTED_MODULE_8__["default"])(ml1, this.e0, this.e1, this.e2, this.e3); 28709 if (Math.abs(Math.abs(phi1) - _constants_values__WEBPACK_IMPORTED_MODULE_9__["HALF_PI"]) <= _constants_values__WEBPACK_IMPORTED_MODULE_9__["EPSLN"]) { 28710 p.x = this.long0; 28711 p.y = _constants_values__WEBPACK_IMPORTED_MODULE_9__["HALF_PI"]; 28712 if (y < 0) { 28713 p.y *= -1; 28714 } 28715 return p; 28716 } 28717 var nl1 = Object(_common_gN__WEBPACK_IMPORTED_MODULE_5__["default"])(this.a, this.e, Math.sin(phi1)); 28718 28719 var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es); 28720 var tl1 = Math.pow(Math.tan(phi1), 2); 28721 var dl = x * this.a / nl1; 28722 var dsq = dl * dl; 28723 phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24); 28724 lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1); 28725 28726 } 28727 28728 p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__["default"])(lam + this.long0); 28729 p.y = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_7__["default"])(phi); 28730 return p; 28731 28732} 28733 28734var names = ["Cassini", "Cassini_Soldner", "cass"]; 28735/* harmony default export */ __webpack_exports__["default"] = ({ 28736 init: init, 28737 forward: forward, 28738 inverse: inverse, 28739 names: names 28740}); 28741 28742 28743/***/ }), 28744
vendor: 3,538 bytes, lines 28745-28835
28745/***/ "./node_modules/proj4/lib/projections/cea.js": 28746/*!***************************************************!*\ 28747 !*** ./node_modules/proj4/lib/projections/cea.js ***! 28748 \***************************************************/ 28749/*! exports provided: init, forward, inverse, names, default */ 28750/***/ (function(module, __webpack_exports__, __webpack_require__) { 28751 28752"use strict"; 28753__webpack_require__.r(__webpack_exports__); 28754/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 28755/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 28756/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 28757/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 28758/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 28759/* harmony import */ var _common_qsfnz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/qsfnz */ "./node_modules/proj4/lib/common/qsfnz.js"); 28760/* harmony import */ var _common_msfnz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/msfnz */ "./node_modules/proj4/lib/common/msfnz.js"); 28761/* harmony import */ var _common_iqsfnz__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/iqsfnz */ "./node_modules/proj4/lib/common/iqsfnz.js"); 28762 28763 28764 28765 28766 28767/* 28768 reference: 28769 "Cartographic Projection Procedures for the UNIX Environment- 28770 A User's Manual" by Gerald I. Evenden, 28771 USGS Open File Report 90-284and Release 4 Interim Reports (2003) 28772*/ 28773function init() { 28774 //no-op 28775 if (!this.sphere) { 28776 this.k0 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_2__["default"])(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)); 28777 } 28778} 28779 28780/* Cylindrical Equal Area forward equations--mapping lat,long to x,y 28781 ------------------------------------------------------------*/ 28782function forward(p) { 28783 var lon = p.x; 28784 var lat = p.y; 28785 var x, y; 28786 /* Forward equations 28787 -----------------*/ 28788 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 28789 if (this.sphere) { 28790 x = this.x0 + this.a * dlon * Math.cos(this.lat_ts); 28791 y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts); 28792 } 28793 else { 28794 var qs = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, Math.sin(lat)); 28795 x = this.x0 + this.a * this.k0 * dlon; 28796 y = this.y0 + this.a * qs * 0.5 / this.k0; 28797 } 28798 28799 p.x = x; 28800 p.y = y; 28801 return p; 28802} 28803 28804/* Cylindrical Equal Area inverse equations--mapping x,y to lat/long 28805 ------------------------------------------------------------*/ 28806function inverse(p) { 28807 p.x -= this.x0; 28808 p.y -= this.y0; 28809 var lon, lat; 28810 28811 if (this.sphere) { 28812 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts)); 28813 lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts)); 28814 } 28815 else { 28816 lat = Object(_common_iqsfnz__WEBPACK_IMPORTED_MODULE_3__["default"])(this.e, 2 * p.y * this.k0 / this.a); 28817 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + p.x / (this.a * this.k0)); 28818 } 28819 28820 p.x = lon; 28821 p.y = lat; 28822 return p; 28823} 28824 28825var names = ["cea"]; 28826/* harmony default export */ __webpack_exports__["default"] = ({ 28827 init: init, 28828 forward: forward, 28829 inverse: inverse, 28830 names: names 28831}); 28832 28833 28834/***/ }), 28835
vendor: 2,611 bytes, lines 28836-28902
28836/***/ "./node_modules/proj4/lib/projections/eqc.js": 28837/*!***************************************************!*\ 28838 !*** ./node_modules/proj4/lib/projections/eqc.js ***! 28839 \***************************************************/ 28840/*! exports provided: init, forward, inverse, names, default */ 28841/***/ (function(module, __webpack_exports__, __webpack_require__) { 28842 28843"use strict"; 28844__webpack_require__.r(__webpack_exports__); 28845/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 28846/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 28847/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 28848/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 28849/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 28850/* harmony import */ var _common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/adjust_lat */ "./node_modules/proj4/lib/common/adjust_lat.js"); 28851 28852 28853 28854function init() { 28855 28856 this.x0 = this.x0 || 0; 28857 this.y0 = this.y0 || 0; 28858 this.lat0 = this.lat0 || 0; 28859 this.long0 = this.long0 || 0; 28860 this.lat_ts = this.lat_ts || 0; 28861 this.title = this.title || "Equidistant Cylindrical (Plate Carre)"; 28862 28863 this.rc = Math.cos(this.lat_ts); 28864} 28865 28866// forward equations--mapping lat,long to x,y 28867// ----------------------------------------------------------------- 28868function forward(p) { 28869 28870 var lon = p.x; 28871 var lat = p.y; 28872 28873 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 28874 var dlat = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__["default"])(lat - this.lat0); 28875 p.x = this.x0 + (this.a * dlon * this.rc); 28876 p.y = this.y0 + (this.a * dlat); 28877 return p; 28878} 28879 28880// inverse equations--mapping x,y to lat/long 28881// ----------------------------------------------------------------- 28882function inverse(p) { 28883 28884 var x = p.x; 28885 var y = p.y; 28886 28887 p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + ((x - this.x0) / (this.a * this.rc))); 28888 p.y = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__["default"])(this.lat0 + ((y - this.y0) / (this.a))); 28889 return p; 28890} 28891 28892var names = ["Equirectangular", "Equidistant_Cylindrical", "eqc"]; 28893/* harmony default export */ __webpack_exports__["default"] = ({ 28894 init: init, 28895 forward: forward, 28896 inverse: inverse, 28897 names: names 28898}); 28899 28900 28901/***/ }), 28902
vendor: 6,215 bytes, lines 28903-29046
28903/***/ "./node_modules/proj4/lib/projections/eqdc.js": 28904/*!****************************************************!*\ 28905 !*** ./node_modules/proj4/lib/projections/eqdc.js ***! 28906 \****************************************************/ 28907/*! exports provided: init, forward, inverse, names, default */ 28908/***/ (function(module, __webpack_exports__, __webpack_require__) { 28909 28910"use strict"; 28911__webpack_require__.r(__webpack_exports__); 28912/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 28913/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 28914/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 28915/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 28916/* harmony import */ var _common_e0fn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/e0fn */ "./node_modules/proj4/lib/common/e0fn.js"); 28917/* harmony import */ var _common_e1fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/e1fn */ "./node_modules/proj4/lib/common/e1fn.js"); 28918/* harmony import */ var _common_e2fn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/e2fn */ "./node_modules/proj4/lib/common/e2fn.js"); 28919/* harmony import */ var _common_e3fn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/e3fn */ "./node_modules/proj4/lib/common/e3fn.js"); 28920/* harmony import */ var _common_msfnz__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/msfnz */ "./node_modules/proj4/lib/common/msfnz.js"); 28921/* harmony import */ var _common_mlfn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/mlfn */ "./node_modules/proj4/lib/common/mlfn.js"); 28922/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 28923/* harmony import */ var _common_adjust_lat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/adjust_lat */ "./node_modules/proj4/lib/common/adjust_lat.js"); 28924/* harmony import */ var _common_imlfn__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/imlfn */ "./node_modules/proj4/lib/common/imlfn.js"); 28925/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 28926 28927 28928 28929 28930 28931 28932 28933 28934 28935 28936 28937function init() { 28938 28939 /* Place parameters in static storage for common use 28940 -------------------------------------------------*/ 28941 // Standard Parallels cannot be equal and on opposite sides of the equator 28942 if (Math.abs(this.lat1 + this.lat2) < _constants_values__WEBPACK_IMPORTED_MODULE_9__["EPSLN"]) { 28943 return; 28944 } 28945 this.lat2 = this.lat2 || this.lat1; 28946 this.temp = this.b / this.a; 28947 this.es = 1 - Math.pow(this.temp, 2); 28948 this.e = Math.sqrt(this.es); 28949 this.e0 = Object(_common_e0fn__WEBPACK_IMPORTED_MODULE_0__["default"])(this.es); 28950 this.e1 = Object(_common_e1fn__WEBPACK_IMPORTED_MODULE_1__["default"])(this.es); 28951 this.e2 = Object(_common_e2fn__WEBPACK_IMPORTED_MODULE_2__["default"])(this.es); 28952 this.e3 = Object(_common_e3fn__WEBPACK_IMPORTED_MODULE_3__["default"])(this.es); 28953 28954 this.sinphi = Math.sin(this.lat1); 28955 this.cosphi = Math.cos(this.lat1); 28956 28957 this.ms1 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_4__["default"])(this.e, this.sinphi, this.cosphi); 28958 this.ml1 = Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_5__["default"])(this.e0, this.e1, this.e2, this.e3, this.lat1); 28959 28960 if (Math.abs(this.lat1 - this.lat2) < _constants_values__WEBPACK_IMPORTED_MODULE_9__["EPSLN"]) { 28961 this.ns = this.sinphi; 28962 } 28963 else { 28964 this.sinphi = Math.sin(this.lat2); 28965 this.cosphi = Math.cos(this.lat2); 28966 this.ms2 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_4__["default"])(this.e, this.sinphi, this.cosphi); 28967 this.ml2 = Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_5__["default"])(this.e0, this.e1, this.e2, this.e3, this.lat2); 28968 this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1); 28969 } 28970 this.g = this.ml1 + this.ms1 / this.ns; 28971 this.ml0 = Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_5__["default"])(this.e0, this.e1, this.e2, this.e3, this.lat0); 28972 this.rh = this.a * (this.g - this.ml0); 28973} 28974 28975/* Equidistant Conic forward equations--mapping lat,long to x,y 28976 -----------------------------------------------------------*/ 28977function forward(p) { 28978 var lon = p.x; 28979 var lat = p.y; 28980 var rh1; 28981 28982 /* Forward equations 28983 -----------------*/ 28984 if (this.sphere) { 28985 rh1 = this.a * (this.g - lat); 28986 } 28987 else { 28988 var ml = Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_5__["default"])(this.e0, this.e1, this.e2, this.e3, lat); 28989 rh1 = this.a * (this.g - ml); 28990 } 28991 var theta = this.ns * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__["default"])(lon - this.long0); 28992 var x = this.x0 + rh1 * Math.sin(theta); 28993 var y = this.y0 + this.rh - rh1 * Math.cos(theta); 28994 p.x = x; 28995 p.y = y; 28996 return p; 28997} 28998 28999/* Inverse equations 29000 -----------------*/ 29001function inverse(p) { 29002 p.x -= this.x0; 29003 p.y = this.rh - p.y + this.y0; 29004 var con, rh1, lat, lon; 29005 if (this.ns >= 0) { 29006 rh1 = Math.sqrt(p.x * p.x + p.y * p.y); 29007 con = 1; 29008 } 29009 else { 29010 rh1 = -Math.sqrt(p.x * p.x + p.y * p.y); 29011 con = -1; 29012 } 29013 var theta = 0; 29014 if (rh1 !== 0) { 29015 theta = Math.atan2(con * p.x, con * p.y); 29016 } 29017 29018 if (this.sphere) { 29019 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__["default"])(this.long0 + theta / this.ns); 29020 lat = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_7__["default"])(this.g - rh1 / this.a); 29021 p.x = lon; 29022 p.y = lat; 29023 return p; 29024 } 29025 else { 29026 var ml = this.g - rh1 / this.a; 29027 lat = Object(_common_imlfn__WEBPACK_IMPORTED_MODULE_8__["default"])(ml, this.e0, this.e1, this.e2, this.e3); 29028 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_6__["default"])(this.long0 + theta / this.ns); 29029 p.x = lon; 29030 p.y = lat; 29031 return p; 29032 } 29033 29034} 29035 29036var names = ["Equidistant_Conic", "eqdc"]; 29037/* harmony default export */ __webpack_exports__["default"] = ({ 29038 init: init, 29039 forward: forward, 29040 inverse: inverse, 29041 names: names 29042}); 29043 29044 29045/***/ }), 29046
vendor: 8,033 bytes, lines 29047-29243
29047/***/ "./node_modules/proj4/lib/projections/etmerc.js": 29048/*!******************************************************!*\ 29049 !*** ./node_modules/proj4/lib/projections/etmerc.js ***! 29050 \******************************************************/ 29051/*! exports provided: init, forward, inverse, names, default */ 29052/***/ (function(module, __webpack_exports__, __webpack_require__) { 29053 29054"use strict"; 29055__webpack_require__.r(__webpack_exports__); 29056/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29057/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29058/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29059/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29060/* harmony import */ var _projections_tmerc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../projections/tmerc */ "./node_modules/proj4/lib/projections/tmerc.js"); 29061/* harmony import */ var _common_sinh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/sinh */ "./node_modules/proj4/lib/common/sinh.js"); 29062/* harmony import */ var _common_hypot__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hypot */ "./node_modules/proj4/lib/common/hypot.js"); 29063/* harmony import */ var _common_asinhy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/asinhy */ "./node_modules/proj4/lib/common/asinhy.js"); 29064/* harmony import */ var _common_gatg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/gatg */ "./node_modules/proj4/lib/common/gatg.js"); 29065/* harmony import */ var _common_clens__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/clens */ "./node_modules/proj4/lib/common/clens.js"); 29066/* harmony import */ var _common_clens_cmplx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/clens_cmplx */ "./node_modules/proj4/lib/common/clens_cmplx.js"); 29067/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 29068// Heavily based on this etmerc projection implementation 29069// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js 29070 29071 29072 29073 29074 29075 29076 29077 29078 29079 29080function init() { 29081 if (!this.approx && (isNaN(this.es) || this.es <= 0)) { 29082 throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.'); 29083 } 29084 if (this.approx) { 29085 // When '+approx' is set, use tmerc instead 29086 _projections_tmerc__WEBPACK_IMPORTED_MODULE_0__["default"].init.apply(this); 29087 this.forward = _projections_tmerc__WEBPACK_IMPORTED_MODULE_0__["default"].forward; 29088 this.inverse = _projections_tmerc__WEBPACK_IMPORTED_MODULE_0__["default"].inverse; 29089 } 29090 29091 this.x0 = this.x0 !== undefined ? this.x0 : 0; 29092 this.y0 = this.y0 !== undefined ? this.y0 : 0; 29093 this.long0 = this.long0 !== undefined ? this.long0 : 0; 29094 this.lat0 = this.lat0 !== undefined ? this.lat0 : 0; 29095 29096 this.cgb = []; 29097 this.cbg = []; 29098 this.utg = []; 29099 this.gtu = []; 29100 29101 var f = this.es / (1 + Math.sqrt(1 - this.es)); 29102 var n = f / (2 - f); 29103 var np = n; 29104 29105 this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 )))))); 29106 this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725)))))); 29107 29108 np = np * n; 29109 this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945))))); 29110 this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945))))); 29111 29112 np = np * n; 29113 this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835)))); 29114 this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835)))); 29115 29116 np = np * n; 29117 this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175))); 29118 this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175))); 29119 29120 np = np * n; 29121 this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237)); 29122 this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185)); 29123 29124 np = np * n; 29125 this.cgb[5] = np * (601676 / 22275); 29126 this.cbg[5] = np * (444337 / 155925); 29127 29128 np = Math.pow(n, 2); 29129 this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256))); 29130 29131 this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800)))))); 29132 this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800)))))); 29133 29134 this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720))))); 29135 this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360))))); 29136 29137 np = np * n; 29138 this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 )))); 29139 this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440)))); 29140 29141 np = np * n; 29142 this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600))); 29143 this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600))); 29144 29145 np = np * n; 29146 this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680)); 29147 this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840)); 29148 29149 np = np * n; 29150 this.utg[5] = np * (-20648693 / 638668800); 29151 this.gtu[5] = np * (212378941 / 319334400); 29152 29153 var Z = Object(_common_gatg__WEBPACK_IMPORTED_MODULE_4__["default"])(this.cbg, this.lat0); 29154 this.Zb = -this.Qn * (Z + Object(_common_clens__WEBPACK_IMPORTED_MODULE_5__["default"])(this.gtu, 2 * Z)); 29155} 29156 29157function forward(p) { 29158 var Ce = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_7__["default"])(p.x - this.long0); 29159 var Cn = p.y; 29160 29161 Cn = Object(_common_gatg__WEBPACK_IMPORTED_MODULE_4__["default"])(this.cbg, Cn); 29162 var sin_Cn = Math.sin(Cn); 29163 var cos_Cn = Math.cos(Cn); 29164 var sin_Ce = Math.sin(Ce); 29165 var cos_Ce = Math.cos(Ce); 29166 29167 Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn); 29168 Ce = Math.atan2(sin_Ce * cos_Cn, Object(_common_hypot__WEBPACK_IMPORTED_MODULE_2__["default"])(sin_Cn, cos_Cn * cos_Ce)); 29169 Ce = Object(_common_asinhy__WEBPACK_IMPORTED_MODULE_3__["default"])(Math.tan(Ce)); 29170 29171 var tmp = Object(_common_clens_cmplx__WEBPACK_IMPORTED_MODULE_6__["default"])(this.gtu, 2 * Cn, 2 * Ce); 29172 29173 Cn = Cn + tmp[0]; 29174 Ce = Ce + tmp[1]; 29175 29176 var x; 29177 var y; 29178 29179 if (Math.abs(Ce) <= 2.623395162778) { 29180 x = this.a * (this.Qn * Ce) + this.x0; 29181 y = this.a * (this.Qn * Cn + this.Zb) + this.y0; 29182 } 29183 else { 29184 x = Infinity; 29185 y = Infinity; 29186 } 29187 29188 p.x = x; 29189 p.y = y; 29190 29191 return p; 29192} 29193 29194function inverse(p) { 29195 var Ce = (p.x - this.x0) * (1 / this.a); 29196 var Cn = (p.y - this.y0) * (1 / this.a); 29197 29198 Cn = (Cn - this.Zb) / this.Qn; 29199 Ce = Ce / this.Qn; 29200 29201 var lon; 29202 var lat; 29203 29204 if (Math.abs(Ce) <= 2.623395162778) { 29205 var tmp = Object(_common_clens_cmplx__WEBPACK_IMPORTED_MODULE_6__["default"])(this.utg, 2 * Cn, 2 * Ce); 29206 29207 Cn = Cn + tmp[0]; 29208 Ce = Ce + tmp[1]; 29209 Ce = Math.atan(Object(_common_sinh__WEBPACK_IMPORTED_MODULE_1__["default"])(Ce)); 29210 29211 var sin_Cn = Math.sin(Cn); 29212 var cos_Cn = Math.cos(Cn); 29213 var sin_Ce = Math.sin(Ce); 29214 var cos_Ce = Math.cos(Ce); 29215 29216 Cn = Math.atan2(sin_Cn * cos_Ce, Object(_common_hypot__WEBPACK_IMPORTED_MODULE_2__["default"])(sin_Ce, cos_Ce * cos_Cn)); 29217 Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn); 29218 29219 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_7__["default"])(Ce + this.long0); 29220 lat = Object(_common_gatg__WEBPACK_IMPORTED_MODULE_4__["default"])(this.cgb, Cn); 29221 } 29222 else { 29223 lon = Infinity; 29224 lat = Infinity; 29225 } 29226 29227 p.x = lon; 29228 p.y = lat; 29229 29230 return p; 29231} 29232 29233var names = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"]; 29234/* harmony default export */ __webpack_exports__["default"] = ({ 29235 init: init, 29236 forward: forward, 29237 inverse: inverse, 29238 names: names 29239}); 29240 29241 29242/***/ }), 29243
vendor: 3,024 bytes, lines 29244-29314
29244/***/ "./node_modules/proj4/lib/projections/gauss.js": 29245/*!*****************************************************!*\ 29246 !*** ./node_modules/proj4/lib/projections/gauss.js ***! 29247 \*****************************************************/ 29248/*! exports provided: init, forward, inverse, names, default */ 29249/***/ (function(module, __webpack_exports__, __webpack_require__) { 29250 29251"use strict"; 29252__webpack_require__.r(__webpack_exports__); 29253/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29254/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29255/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29256/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29257/* harmony import */ var _common_srat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/srat */ "./node_modules/proj4/lib/common/srat.js"); 29258/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 29259 29260var MAX_ITER = 20; 29261 29262 29263function init() { 29264 var sphi = Math.sin(this.lat0); 29265 var cphi = Math.cos(this.lat0); 29266 cphi *= cphi; 29267 this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi); 29268 this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es)); 29269 this.phic0 = Math.asin(sphi / this.C); 29270 this.ratexp = 0.5 * this.C * this.e; 29271 this.K = Math.tan(0.5 * this.phic0 + _constants_values__WEBPACK_IMPORTED_MODULE_1__["FORTPI"]) / (Math.pow(Math.tan(0.5 * this.lat0 + _constants_values__WEBPACK_IMPORTED_MODULE_1__["FORTPI"]), this.C) * Object(_common_srat__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e * sphi, this.ratexp)); 29272} 29273 29274function forward(p) { 29275 var lon = p.x; 29276 var lat = p.y; 29277 29278 p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + _constants_values__WEBPACK_IMPORTED_MODULE_1__["FORTPI"]), this.C) * Object(_common_srat__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e * Math.sin(lat), this.ratexp)) - _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]; 29279 p.x = this.C * lon; 29280 return p; 29281} 29282 29283function inverse(p) { 29284 var DEL_TOL = 1e-14; 29285 var lon = p.x / this.C; 29286 var lat = p.y; 29287 var num = Math.pow(Math.tan(0.5 * lat + _constants_values__WEBPACK_IMPORTED_MODULE_1__["FORTPI"]) / this.K, 1 / this.C); 29288 for (var i = MAX_ITER; i > 0; --i) { 29289 lat = 2 * Math.atan(num * Object(_common_srat__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e * Math.sin(p.y), - 0.5 * this.e)) - _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]; 29290 if (Math.abs(lat - p.y) < DEL_TOL) { 29291 break; 29292 } 29293 p.y = lat; 29294 } 29295 /* convergence failed */ 29296 if (!i) { 29297 return null; 29298 } 29299 p.x = lon; 29300 p.y = lat; 29301 return p; 29302} 29303 29304var names = ["gauss"]; 29305/* harmony default export */ __webpack_exports__["default"] = ({ 29306 init: init, 29307 forward: forward, 29308 inverse: inverse, 29309 names: names 29310}); 29311 29312 29313/***/ }), 29314
vendor: 1,631 bytes, lines 29315-29355
29315/***/ "./node_modules/proj4/lib/projections/geocent.js": 29316/*!*******************************************************!*\ 29317 !*** ./node_modules/proj4/lib/projections/geocent.js ***! 29318 \*******************************************************/ 29319/*! exports provided: init, forward, inverse, names, default */ 29320/***/ (function(module, __webpack_exports__, __webpack_require__) { 29321 29322"use strict"; 29323__webpack_require__.r(__webpack_exports__); 29324/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29325/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29326/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29327/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29328/* harmony import */ var _datumUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../datumUtils */ "./node_modules/proj4/lib/datumUtils.js"); 29329 29330 29331function init() { 29332 this.name = 'geocent'; 29333 29334} 29335 29336function forward(p) { 29337 var point = Object(_datumUtils__WEBPACK_IMPORTED_MODULE_0__["geodeticToGeocentric"])(p, this.es, this.a); 29338 return point; 29339} 29340 29341function inverse(p) { 29342 var point = Object(_datumUtils__WEBPACK_IMPORTED_MODULE_0__["geocentricToGeodetic"])(p, this.es, this.a, this.b); 29343 return point; 29344} 29345 29346var names = ["Geocentric", 'geocentric', "geocent", "Geocent"]; 29347/* harmony default export */ __webpack_exports__["default"] = ({ 29348 init: init, 29349 forward: forward, 29350 inverse: inverse, 29351 names: names 29352}); 29353 29354/***/ }), 29355
vendor: 4,281 bytes, lines 29356-29479
29356/***/ "./node_modules/proj4/lib/projections/gnom.js": 29357/*!****************************************************!*\ 29358 !*** ./node_modules/proj4/lib/projections/gnom.js ***! 29359 \****************************************************/ 29360/*! exports provided: init, forward, inverse, names, default */ 29361/***/ (function(module, __webpack_exports__, __webpack_require__) { 29362 29363"use strict"; 29364__webpack_require__.r(__webpack_exports__); 29365/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29366/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29367/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29368/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29369/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 29370/* harmony import */ var _common_asinz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/asinz */ "./node_modules/proj4/lib/common/asinz.js"); 29371/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 29372 29373 29374 29375 29376/* 29377 reference: 29378 Wolfram Mathworld "Gnomonic Projection" 29379 http://mathworld.wolfram.com/GnomonicProjection.html 29380 Accessed: 12th November 2009 29381 */ 29382function init() { 29383 29384 /* Place parameters in static storage for common use 29385 -------------------------------------------------*/ 29386 this.sin_p14 = Math.sin(this.lat0); 29387 this.cos_p14 = Math.cos(this.lat0); 29388 // Approximation for projecting points to the horizon (infinity) 29389 this.infinity_dist = 1000 * this.a; 29390 this.rc = 1; 29391} 29392 29393/* Gnomonic forward equations--mapping lat,long to x,y 29394 ---------------------------------------------------*/ 29395function forward(p) { 29396 var sinphi, cosphi; /* sin and cos value */ 29397 var dlon; /* delta longitude value */ 29398 var coslon; /* cos of longitude */ 29399 var ksp; /* scale factor */ 29400 var g; 29401 var x, y; 29402 var lon = p.x; 29403 var lat = p.y; 29404 /* Forward equations 29405 -----------------*/ 29406 dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 29407 29408 sinphi = Math.sin(lat); 29409 cosphi = Math.cos(lat); 29410 29411 coslon = Math.cos(dlon); 29412 g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon; 29413 ksp = 1; 29414 if ((g > 0) || (Math.abs(g) <= _constants_values__WEBPACK_IMPORTED_MODULE_2__["EPSLN"])) { 29415 x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g; 29416 y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g; 29417 } 29418 else { 29419 29420 // Point is in the opposing hemisphere and is unprojectable 29421 // We still need to return a reasonable point, so we project 29422 // to infinity, on a bearing 29423 // equivalent to the northern hemisphere equivalent 29424 // This is a reasonable approximation for short shapes and lines that 29425 // straddle the horizon. 29426 29427 x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon); 29428 y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon); 29429 29430 } 29431 p.x = x; 29432 p.y = y; 29433 return p; 29434} 29435 29436function inverse(p) { 29437 var rh; /* Rho */ 29438 var sinc, cosc; 29439 var c; 29440 var lon, lat; 29441 29442 /* Inverse equations 29443 -----------------*/ 29444 p.x = (p.x - this.x0) / this.a; 29445 p.y = (p.y - this.y0) / this.a; 29446 29447 p.x /= this.k0; 29448 p.y /= this.k0; 29449 29450 if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) { 29451 c = Math.atan2(rh, this.rc); 29452 sinc = Math.sin(c); 29453 cosc = Math.cos(c); 29454 29455 lat = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_1__["default"])(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh); 29456 lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc); 29457 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + lon); 29458 } 29459 else { 29460 lat = this.phic0; 29461 lon = 0; 29462 } 29463 29464 p.x = lon; 29465 p.y = lat; 29466 return p; 29467} 29468 29469var names = ["gnom"]; 29470/* harmony default export */ __webpack_exports__["default"] = ({ 29471 init: init, 29472 forward: forward, 29473 inverse: inverse, 29474 names: names 29475}); 29476 29477 29478/***/ }), 29479
vendor: 4,493 bytes, lines 29480-29603
29480/***/ "./node_modules/proj4/lib/projections/krovak.js": 29481/*!******************************************************!*\ 29482 !*** ./node_modules/proj4/lib/projections/krovak.js ***! 29483 \******************************************************/ 29484/*! exports provided: init, forward, inverse, names, default */ 29485/***/ (function(module, __webpack_exports__, __webpack_require__) { 29486 29487"use strict"; 29488__webpack_require__.r(__webpack_exports__); 29489/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29490/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29491/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29492/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29493/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 29494 29495 29496function init() { 29497 this.a = 6377397.155; 29498 this.es = 0.006674372230614; 29499 this.e = Math.sqrt(this.es); 29500 if (!this.lat0) { 29501 this.lat0 = 0.863937979737193; 29502 } 29503 if (!this.long0) { 29504 this.long0 = 0.7417649320975901 - 0.308341501185665; 29505 } 29506 /* if scale not set default to 0.9999 */ 29507 if (!this.k0) { 29508 this.k0 = 0.9999; 29509 } 29510 this.s45 = 0.785398163397448; /* 45 */ 29511 this.s90 = 2 * this.s45; 29512 this.fi0 = this.lat0; 29513 this.e2 = this.es; 29514 this.e = Math.sqrt(this.e2); 29515 this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2)); 29516 this.uq = 1.04216856380474; 29517 this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa); 29518 this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2); 29519 this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g; 29520 this.k1 = this.k0; 29521 this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2)); 29522 this.s0 = 1.37008346281555; 29523 this.n = Math.sin(this.s0); 29524 this.ro0 = this.k1 * this.n0 / Math.tan(this.s0); 29525 this.ad = this.s90 - this.uq; 29526} 29527 29528/* ellipsoid */ 29529/* calculate xy from lat/lon */ 29530/* Constants, identical to inverse transform function */ 29531function forward(p) { 29532 var gfi, u, deltav, s, d, eps, ro; 29533 var lon = p.x; 29534 var lat = p.y; 29535 var delta_lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 29536 /* Transformation */ 29537 gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2)); 29538 u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45); 29539 deltav = -delta_lon * this.alfa; 29540 s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav)); 29541 d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s)); 29542 eps = this.n * d; 29543 ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n); 29544 p.y = ro * Math.cos(eps) / 1; 29545 p.x = ro * Math.sin(eps) / 1; 29546 29547 if (!this.czech) { 29548 p.y *= -1; 29549 p.x *= -1; 29550 } 29551 return (p); 29552} 29553 29554/* calculate lat/lon from xy */ 29555function inverse(p) { 29556 var u, deltav, s, d, eps, ro, fi1; 29557 var ok; 29558 29559 /* Transformation */ 29560 /* revert y, x*/ 29561 var tmp = p.x; 29562 p.x = p.y; 29563 p.y = tmp; 29564 if (!this.czech) { 29565 p.y *= -1; 29566 p.x *= -1; 29567 } 29568 ro = Math.sqrt(p.x * p.x + p.y * p.y); 29569 eps = Math.atan2(p.y, p.x); 29570 d = eps / Math.sin(this.s0); 29571 s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45); 29572 u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d)); 29573 deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u)); 29574 p.x = this.long0 - deltav / this.alfa; 29575 fi1 = u; 29576 ok = 0; 29577 var iter = 0; 29578 do { 29579 p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45); 29580 if (Math.abs(fi1 - p.y) < 0.0000000001) { 29581 ok = 1; 29582 } 29583 fi1 = p.y; 29584 iter += 1; 29585 } while (ok === 0 && iter < 15); 29586 if (iter >= 15) { 29587 return null; 29588 } 29589 29590 return (p); 29591} 29592 29593var names = ["Krovak", "krovak"]; 29594/* harmony default export */ __webpack_exports__["default"] = ({ 29595 init: init, 29596 forward: forward, 29597 inverse: inverse, 29598 names: names 29599}); 29600 29601 29602/***/ }), 29603
vendor: 10,329 bytes, lines 29604-29925
29604/***/ "./node_modules/proj4/lib/projections/laea.js": 29605/*!****************************************************!*\ 29606 !*** ./node_modules/proj4/lib/projections/laea.js ***! 29607 \****************************************************/ 29608/*! exports provided: S_POLE, N_POLE, EQUIT, OBLIQ, init, forward, inverse, names, default */ 29609/***/ (function(module, __webpack_exports__, __webpack_require__) { 29610 29611"use strict"; 29612__webpack_require__.r(__webpack_exports__); 29613/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S_POLE", function() { return S_POLE; }); 29614/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N_POLE", function() { return N_POLE; }); 29615/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EQUIT", function() { return EQUIT; }); 29616/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OBLIQ", function() { return OBLIQ; }); 29617/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29618/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29619/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29620/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29621/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 29622/* harmony import */ var _common_qsfnz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/qsfnz */ "./node_modules/proj4/lib/common/qsfnz.js"); 29623/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 29624 29625 29626 29627 29628 29629 29630/* 29631 reference 29632 "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, 29633 The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 29634 */ 29635 29636var S_POLE = 1; 29637 29638var N_POLE = 2; 29639var EQUIT = 3; 29640var OBLIQ = 4; 29641 29642/* Initialize the Lambert Azimuthal Equal Area projection 29643 ------------------------------------------------------*/ 29644function init() { 29645 var t = Math.abs(this.lat0); 29646 if (Math.abs(t - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 29647 this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE; 29648 } 29649 else if (Math.abs(t) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 29650 this.mode = this.EQUIT; 29651 } 29652 else { 29653 this.mode = this.OBLIQ; 29654 } 29655 if (this.es > 0) { 29656 var sinphi; 29657 29658 this.qp = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, 1); 29659 this.mmf = 0.5 / (1 - this.es); 29660 this.apa = authset(this.es); 29661 switch (this.mode) { 29662 case this.N_POLE: 29663 this.dd = 1; 29664 break; 29665 case this.S_POLE: 29666 this.dd = 1; 29667 break; 29668 case this.EQUIT: 29669 this.rq = Math.sqrt(0.5 * this.qp); 29670 this.dd = 1 / this.rq; 29671 this.xmf = 1; 29672 this.ymf = 0.5 * this.qp; 29673 break; 29674 case this.OBLIQ: 29675 this.rq = Math.sqrt(0.5 * this.qp); 29676 sinphi = Math.sin(this.lat0); 29677 this.sinb1 = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, sinphi) / this.qp; 29678 this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1); 29679 this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1); 29680 this.ymf = (this.xmf = this.rq) / this.dd; 29681 this.xmf *= this.dd; 29682 break; 29683 } 29684 } 29685 else { 29686 if (this.mode === this.OBLIQ) { 29687 this.sinph0 = Math.sin(this.lat0); 29688 this.cosph0 = Math.cos(this.lat0); 29689 } 29690 } 29691} 29692 29693/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y 29694 -----------------------------------------------------------------------*/ 29695function forward(p) { 29696 29697 /* Forward equations 29698 -----------------*/ 29699 var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi; 29700 var lam = p.x; 29701 var phi = p.y; 29702 29703 lam = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__["default"])(lam - this.long0); 29704 if (this.sphere) { 29705 sinphi = Math.sin(phi); 29706 cosphi = Math.cos(phi); 29707 coslam = Math.cos(lam); 29708 if (this.mode === this.OBLIQ || this.mode === this.EQUIT) { 29709 y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam; 29710 if (y <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 29711 return null; 29712 } 29713 y = Math.sqrt(2 / y); 29714 x = y * cosphi * Math.sin(lam); 29715 y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam; 29716 } 29717 else if (this.mode === this.N_POLE || this.mode === this.S_POLE) { 29718 if (this.mode === this.N_POLE) { 29719 coslam = -coslam; 29720 } 29721 if (Math.abs(phi + this.lat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 29722 return null; 29723 } 29724 y = _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] - phi * 0.5; 29725 y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y)); 29726 x = y * Math.sin(lam); 29727 y *= coslam; 29728 } 29729 } 29730 else { 29731 sinb = 0; 29732 cosb = 0; 29733 b = 0; 29734 coslam = Math.cos(lam); 29735 sinlam = Math.sin(lam); 29736 sinphi = Math.sin(phi); 29737 q = Object(_common_qsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, sinphi); 29738 if (this.mode === this.OBLIQ || this.mode === this.EQUIT) { 29739 sinb = q / this.qp; 29740 cosb = Math.sqrt(1 - sinb * sinb); 29741 } 29742 switch (this.mode) { 29743 case this.OBLIQ: 29744 b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam; 29745 break; 29746 case this.EQUIT: 29747 b = 1 + cosb * coslam; 29748 break; 29749 case this.N_POLE: 29750 b = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + phi; 29751 q = this.qp - q; 29752 break; 29753 case this.S_POLE: 29754 b = phi - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 29755 q = this.qp + q; 29756 break; 29757 } 29758 if (Math.abs(b) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 29759 return null; 29760 } 29761 switch (this.mode) { 29762 case this.OBLIQ: 29763 case this.EQUIT: 29764 b = Math.sqrt(2 / b); 29765 if (this.mode === this.OBLIQ) { 29766 y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam); 29767 } 29768 else { 29769 y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf; 29770 } 29771 x = this.xmf * b * cosb * sinlam; 29772 break; 29773 case this.N_POLE: 29774 case this.S_POLE: 29775 if (q >= 0) { 29776 x = (b = Math.sqrt(q)) * sinlam; 29777 y = coslam * ((this.mode === this.S_POLE) ? b : -b); 29778 } 29779 else { 29780 x = y = 0; 29781 } 29782 break; 29783 } 29784 } 29785 29786 p.x = this.a * x + this.x0; 29787 p.y = this.a * y + this.y0; 29788 return p; 29789} 29790 29791/* Inverse equations 29792 -----------------*/ 29793function inverse(p) { 29794 p.x -= this.x0; 29795 p.y -= this.y0; 29796 var x = p.x / this.a; 29797 var y = p.y / this.a; 29798 var lam, phi, cCe, sCe, q, rho, ab; 29799 if (this.sphere) { 29800 var cosz = 0, 29801 rh, sinz = 0; 29802 29803 rh = Math.sqrt(x * x + y * y); 29804 phi = rh * 0.5; 29805 if (phi > 1) { 29806 return null; 29807 } 29808 phi = 2 * Math.asin(phi); 29809 if (this.mode === this.OBLIQ || this.mode === this.EQUIT) { 29810 sinz = Math.sin(phi); 29811 cosz = Math.cos(phi); 29812 } 29813 switch (this.mode) { 29814 case this.EQUIT: 29815 phi = (Math.abs(rh) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) ? 0 : Math.asin(y * sinz / rh); 29816 x *= sinz; 29817 y = cosz * rh; 29818 break; 29819 case this.OBLIQ: 29820 phi = (Math.abs(rh) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh); 29821 x *= sinz * this.cosph0; 29822 y = (cosz - Math.sin(phi) * this.sinph0) * rh; 29823 break; 29824 case this.N_POLE: 29825 y = -y; 29826 phi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - phi; 29827 break; 29828 case this.S_POLE: 29829 phi -= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 29830 break; 29831 } 29832 lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y); 29833 } 29834 else { 29835 ab = 0; 29836 if (this.mode === this.OBLIQ || this.mode === this.EQUIT) { 29837 x /= this.dd; 29838 y *= this.dd; 29839 rho = Math.sqrt(x * x + y * y); 29840 if (rho < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 29841 p.x = this.long0; 29842 p.y = this.lat0; 29843 return p; 29844 } 29845 sCe = 2 * Math.asin(0.5 * rho / this.rq); 29846 cCe = Math.cos(sCe); 29847 x *= (sCe = Math.sin(sCe)); 29848 if (this.mode === this.OBLIQ) { 29849 ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho; 29850 q = this.qp * ab; 29851 y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe; 29852 } 29853 else { 29854 ab = y * sCe / rho; 29855 q = this.qp * ab; 29856 y = rho * cCe; 29857 } 29858 } 29859 else if (this.mode === this.N_POLE || this.mode === this.S_POLE) { 29860 if (this.mode === this.N_POLE) { 29861 y = -y; 29862 } 29863 q = (x * x + y * y); 29864 if (!q) { 29865 p.x = this.long0; 29866 p.y = this.lat0; 29867 return p; 29868 } 29869 ab = 1 - q / this.qp; 29870 if (this.mode === this.S_POLE) { 29871 ab = -ab; 29872 } 29873 } 29874 lam = Math.atan2(x, y); 29875 phi = authlat(Math.asin(ab), this.apa); 29876 } 29877 29878 p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_2__["default"])(this.long0 + lam); 29879 p.y = phi; 29880 return p; 29881} 29882 29883/* determine latitude from authalic latitude */ 29884var P00 = 0.33333333333333333333; 29885 29886var P01 = 0.17222222222222222222; 29887var P02 = 0.10257936507936507936; 29888var P10 = 0.06388888888888888888; 29889var P11 = 0.06640211640211640211; 29890var P20 = 0.01641501294219154443; 29891 29892function authset(es) { 29893 var t; 29894 var APA = []; 29895 APA[0] = es * P00; 29896 t = es * es; 29897 APA[0] += t * P01; 29898 APA[1] = t * P10; 29899 t *= es; 29900 APA[0] += t * P02; 29901 APA[1] += t * P11; 29902 APA[2] = t * P20; 29903 return APA; 29904} 29905 29906function authlat(beta, APA) { 29907 var t = beta + beta; 29908 return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t)); 29909} 29910 29911var names = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"]; 29912/* harmony default export */ __webpack_exports__["default"] = ({ 29913 init: init, 29914 forward: forward, 29915 inverse: inverse, 29916 names: names, 29917 S_POLE: S_POLE, 29918 N_POLE: N_POLE, 29919 EQUIT: EQUIT, 29920 OBLIQ: OBLIQ 29921}); 29922 29923 29924/***/ }), 29925
vendor: 6,553 bytes, lines 29926-30087
29926/***/ "./node_modules/proj4/lib/projections/lcc.js": 29927/*!***************************************************!*\ 29928 !*** ./node_modules/proj4/lib/projections/lcc.js ***! 29929 \***************************************************/ 29930/*! exports provided: init, forward, inverse, names, default */ 29931/***/ (function(module, __webpack_exports__, __webpack_require__) { 29932 29933"use strict"; 29934__webpack_require__.r(__webpack_exports__); 29935/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 29936/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 29937/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 29938/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 29939/* harmony import */ var _common_msfnz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/msfnz */ "./node_modules/proj4/lib/common/msfnz.js"); 29940/* harmony import */ var _common_tsfnz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/tsfnz */ "./node_modules/proj4/lib/common/tsfnz.js"); 29941/* harmony import */ var _common_sign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/sign */ "./node_modules/proj4/lib/common/sign.js"); 29942/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 29943/* harmony import */ var _common_phi2z__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/phi2z */ "./node_modules/proj4/lib/common/phi2z.js"); 29944/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 29945 29946 29947 29948 29949 29950 29951function init() { 29952 29953 // array of: r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north 29954 //double c_lat; /* center latitude */ 29955 //double c_lon; /* center longitude */ 29956 //double lat1; /* first standard parallel */ 29957 //double lat2; /* second standard parallel */ 29958 //double r_maj; /* major axis */ 29959 //double r_min; /* minor axis */ 29960 //double false_east; /* x offset in meters */ 29961 //double false_north; /* y offset in meters */ 29962 29963 if (!this.lat2) { 29964 this.lat2 = this.lat1; 29965 } //if lat2 is not defined 29966 if (!this.k0) { 29967 this.k0 = 1; 29968 } 29969 this.x0 = this.x0 || 0; 29970 this.y0 = this.y0 || 0; 29971 // Standard Parallels cannot be equal and on opposite sides of the equator 29972 if (Math.abs(this.lat1 + this.lat2) < _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]) { 29973 return; 29974 } 29975 29976 var temp = this.b / this.a; 29977 this.e = Math.sqrt(1 - temp * temp); 29978 29979 var sin1 = Math.sin(this.lat1); 29980 var cos1 = Math.cos(this.lat1); 29981 var ms1 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, sin1, cos1); 29982 var ts1 = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, this.lat1, sin1); 29983 29984 var sin2 = Math.sin(this.lat2); 29985 var cos2 = Math.cos(this.lat2); 29986 var ms2 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, sin2, cos2); 29987 var ts2 = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, this.lat2, sin2); 29988 29989 var ts0 = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, this.lat0, Math.sin(this.lat0)); 29990 29991 if (Math.abs(this.lat1 - this.lat2) > _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]) { 29992 this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2); 29993 } 29994 else { 29995 this.ns = sin1; 29996 } 29997 if (isNaN(this.ns)) { 29998 this.ns = sin1; 29999 } 30000 this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns)); 30001 this.rh = this.a * this.f0 * Math.pow(ts0, this.ns); 30002 if (!this.title) { 30003 this.title = "Lambert Conformal Conic"; 30004 } 30005} 30006 30007// Lambert Conformal conic forward equations--mapping lat,long to x,y 30008// ----------------------------------------------------------------- 30009function forward(p) { 30010 30011 var lon = p.x; 30012 var lat = p.y; 30013 30014 // singular cases : 30015 if (Math.abs(2 * Math.abs(lat) - Math.PI) <= _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]) { 30016 lat = Object(_common_sign__WEBPACK_IMPORTED_MODULE_2__["default"])(lat) * (_constants_values__WEBPACK_IMPORTED_MODULE_5__["HALF_PI"] - 2 * _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]); 30017 } 30018 30019 var con = Math.abs(Math.abs(lat) - _constants_values__WEBPACK_IMPORTED_MODULE_5__["HALF_PI"]); 30020 var ts, rh1; 30021 if (con > _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]) { 30022 ts = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_1__["default"])(this.e, lat, Math.sin(lat)); 30023 rh1 = this.a * this.f0 * Math.pow(ts, this.ns); 30024 } 30025 else { 30026 con = lat * this.ns; 30027 if (con <= 0) { 30028 return null; 30029 } 30030 rh1 = 0; 30031 } 30032 var theta = this.ns * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__["default"])(lon - this.long0); 30033 p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0; 30034 p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0; 30035 30036 return p; 30037} 30038 30039// Lambert Conformal Conic inverse equations--mapping x,y to lat/long 30040// ----------------------------------------------------------------- 30041function inverse(p) { 30042 30043 var rh1, con, ts; 30044 var lat, lon; 30045 var x = (p.x - this.x0) / this.k0; 30046 var y = (this.rh - (p.y - this.y0) / this.k0); 30047 if (this.ns > 0) { 30048 rh1 = Math.sqrt(x * x + y * y); 30049 con = 1; 30050 } 30051 else { 30052 rh1 = -Math.sqrt(x * x + y * y); 30053 con = -1; 30054 } 30055 var theta = 0; 30056 if (rh1 !== 0) { 30057 theta = Math.atan2((con * x), (con * y)); 30058 } 30059 if ((rh1 !== 0) || (this.ns > 0)) { 30060 con = 1 / this.ns; 30061 ts = Math.pow((rh1 / (this.a * this.f0)), con); 30062 lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__["default"])(this.e, ts); 30063 if (lat === -9999) { 30064 return null; 30065 } 30066 } 30067 else { 30068 lat = -_constants_values__WEBPACK_IMPORTED_MODULE_5__["HALF_PI"]; 30069 } 30070 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__["default"])(theta / this.ns + this.long0); 30071 30072 p.x = lon; 30073 p.y = lat; 30074 return p; 30075} 30076 30077var names = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"]; 30078/* harmony default export */ __webpack_exports__["default"] = ({ 30079 init: init, 30080 forward: forward, 30081 inverse: inverse, 30082 names: names 30083}); 30084 30085 30086/***/ }), 30087
vendor: 1,168 bytes, lines 30088-30120
30088/***/ "./node_modules/proj4/lib/projections/longlat.js": 30089/*!*******************************************************!*\ 30090 !*** ./node_modules/proj4/lib/projections/longlat.js ***! 30091 \*******************************************************/ 30092/*! exports provided: init, forward, inverse, names, default */ 30093/***/ (function(module, __webpack_exports__, __webpack_require__) { 30094 30095"use strict"; 30096__webpack_require__.r(__webpack_exports__); 30097/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30098/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return identity; }); 30099/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return identity; }); 30100/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30101function init() { 30102 //no-op for longlat 30103} 30104 30105function identity(pt) { 30106 return pt; 30107} 30108 30109 30110var names = ["longlat", "identity"]; 30111/* harmony default export */ __webpack_exports__["default"] = ({ 30112 init: init, 30113 forward: identity, 30114 inverse: identity, 30115 names: names 30116}); 30117 30118 30119/***/ }), 30120
vendor: 4,591 bytes, lines 30121-30242
30121/***/ "./node_modules/proj4/lib/projections/merc.js": 30122/*!****************************************************!*\ 30123 !*** ./node_modules/proj4/lib/projections/merc.js ***! 30124 \****************************************************/ 30125/*! exports provided: init, forward, inverse, names, default */ 30126/***/ (function(module, __webpack_exports__, __webpack_require__) { 30127 30128"use strict"; 30129__webpack_require__.r(__webpack_exports__); 30130/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30131/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30132/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30133/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30134/* harmony import */ var _common_msfnz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/msfnz */ "./node_modules/proj4/lib/common/msfnz.js"); 30135/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 30136/* harmony import */ var _common_tsfnz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/tsfnz */ "./node_modules/proj4/lib/common/tsfnz.js"); 30137/* harmony import */ var _common_phi2z__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/phi2z */ "./node_modules/proj4/lib/common/phi2z.js"); 30138/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 30139 30140 30141 30142 30143 30144 30145function init() { 30146 var con = this.b / this.a; 30147 this.es = 1 - con * con; 30148 if(!('x0' in this)){ 30149 this.x0 = 0; 30150 } 30151 if(!('y0' in this)){ 30152 this.y0 = 0; 30153 } 30154 this.e = Math.sqrt(this.es); 30155 if (this.lat_ts) { 30156 if (this.sphere) { 30157 this.k0 = Math.cos(this.lat_ts); 30158 } 30159 else { 30160 this.k0 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)); 30161 } 30162 } 30163 else { 30164 if (!this.k0) { 30165 if (this.k) { 30166 this.k0 = this.k; 30167 } 30168 else { 30169 this.k0 = 1; 30170 } 30171 } 30172 } 30173} 30174 30175/* Mercator forward equations--mapping lat,long to x,y 30176 --------------------------------------------------*/ 30177 30178function forward(p) { 30179 var lon = p.x; 30180 var lat = p.y; 30181 // convert to radians 30182 if (lat * _constants_values__WEBPACK_IMPORTED_MODULE_4__["R2D"] > 90 && lat * _constants_values__WEBPACK_IMPORTED_MODULE_4__["R2D"] < -90 && lon * _constants_values__WEBPACK_IMPORTED_MODULE_4__["R2D"] > 180 && lon * _constants_values__WEBPACK_IMPORTED_MODULE_4__["R2D"] < -180) { 30183 return null; 30184 } 30185 30186 var x, y; 30187 if (Math.abs(Math.abs(lat) - _constants_values__WEBPACK_IMPORTED_MODULE_4__["HALF_PI"]) <= _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"]) { 30188 return null; 30189 } 30190 else { 30191 if (this.sphere) { 30192 x = this.x0 + this.a * this.k0 * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(lon - this.long0); 30193 y = this.y0 + this.a * this.k0 * Math.log(Math.tan(_constants_values__WEBPACK_IMPORTED_MODULE_4__["FORTPI"] + 0.5 * lat)); 30194 } 30195 else { 30196 var sinphi = Math.sin(lat); 30197 var ts = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_2__["default"])(this.e, lat, sinphi); 30198 x = this.x0 + this.a * this.k0 * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(lon - this.long0); 30199 y = this.y0 - this.a * this.k0 * Math.log(ts); 30200 } 30201 p.x = x; 30202 p.y = y; 30203 return p; 30204 } 30205} 30206 30207/* Mercator inverse equations--mapping x,y to lat/long 30208 --------------------------------------------------*/ 30209function inverse(p) { 30210 30211 var x = p.x - this.x0; 30212 var y = p.y - this.y0; 30213 var lon, lat; 30214 30215 if (this.sphere) { 30216 lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__["HALF_PI"] - 2 * Math.atan(Math.exp(-y / (this.a * this.k0))); 30217 } 30218 else { 30219 var ts = Math.exp(-y / (this.a * this.k0)); 30220 lat = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_3__["default"])(this.e, ts); 30221 if (lat === -9999) { 30222 return null; 30223 } 30224 } 30225 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(this.long0 + x / (this.a * this.k0)); 30226 30227 p.x = lon; 30228 p.y = lat; 30229 return p; 30230} 30231 30232var names = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"]; 30233/* harmony default export */ __webpack_exports__["default"] = ({ 30234 init: init, 30235 forward: forward, 30236 inverse: inverse, 30237 names: names 30238}); 30239 30240 30241/***/ }), 30242
vendor: 2,459 bytes, lines 30243-30312
30243/***/ "./node_modules/proj4/lib/projections/mill.js": 30244/*!****************************************************!*\ 30245 !*** ./node_modules/proj4/lib/projections/mill.js ***! 30246 \****************************************************/ 30247/*! exports provided: init, forward, inverse, names, default */ 30248/***/ (function(module, __webpack_exports__, __webpack_require__) { 30249 30250"use strict"; 30251__webpack_require__.r(__webpack_exports__); 30252/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30253/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30254/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30255/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30256/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 30257 30258 30259/* 30260 reference 30261 "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, 30262 The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 30263 */ 30264 30265 30266/* Initialize the Miller Cylindrical projection 30267 -------------------------------------------*/ 30268function init() { 30269 //no-op 30270} 30271 30272/* Miller Cylindrical forward equations--mapping lat,long to x,y 30273 ------------------------------------------------------------*/ 30274function forward(p) { 30275 var lon = p.x; 30276 var lat = p.y; 30277 /* Forward equations 30278 -----------------*/ 30279 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 30280 var x = this.x0 + this.a * dlon; 30281 var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25; 30282 30283 p.x = x; 30284 p.y = y; 30285 return p; 30286} 30287 30288/* Miller Cylindrical inverse equations--mapping x,y to lat/long 30289 ------------------------------------------------------------*/ 30290function inverse(p) { 30291 p.x -= this.x0; 30292 p.y -= this.y0; 30293 30294 var lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + p.x / this.a); 30295 var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4); 30296 30297 p.x = lon; 30298 p.y = lat; 30299 return p; 30300} 30301 30302var names = ["Miller_Cylindrical", "mill"]; 30303/* harmony default export */ __webpack_exports__["default"] = ({ 30304 init: init, 30305 forward: forward, 30306 inverse: inverse, 30307 names: names 30308}); 30309 30310 30311/***/ }), 30312
vendor: 3,601 bytes, lines 30313-30414
30313/***/ "./node_modules/proj4/lib/projections/moll.js": 30314/*!****************************************************!*\ 30315 !*** ./node_modules/proj4/lib/projections/moll.js ***! 30316 \****************************************************/ 30317/*! exports provided: init, forward, inverse, names, default */ 30318/***/ (function(module, __webpack_exports__, __webpack_require__) { 30319 30320"use strict"; 30321__webpack_require__.r(__webpack_exports__); 30322/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30323/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30324/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30325/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30326/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 30327/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 30328 30329function init() {} 30330 30331/* Mollweide forward equations--mapping lat,long to x,y 30332 ----------------------------------------------------*/ 30333function forward(p) { 30334 30335 /* Forward equations 30336 -----------------*/ 30337 var lon = p.x; 30338 var lat = p.y; 30339 30340 var delta_lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 30341 var theta = lat; 30342 var con = Math.PI * Math.sin(lat); 30343 30344 /* Iterate using the Newton-Raphson method to find theta 30345 -----------------------------------------------------*/ 30346 while (true) { 30347 var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta)); 30348 theta += delta_theta; 30349 if (Math.abs(delta_theta) < _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 30350 break; 30351 } 30352 } 30353 theta /= 2; 30354 30355 /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting" 30356 this is done here because of precision problems with "cos(theta)" 30357 --------------------------------------------------------------------------*/ 30358 if (Math.PI / 2 - Math.abs(lat) < _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 30359 delta_lon = 0; 30360 } 30361 var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0; 30362 var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0; 30363 30364 p.x = x; 30365 p.y = y; 30366 return p; 30367} 30368 30369function inverse(p) { 30370 var theta; 30371 var arg; 30372 30373 /* Inverse equations 30374 -----------------*/ 30375 p.x -= this.x0; 30376 p.y -= this.y0; 30377 arg = p.y / (1.4142135623731 * this.a); 30378 30379 /* Because of division by zero problems, 'arg' can not be 1. Therefore 30380 a number very close to one is used instead. 30381 -------------------------------------------------------------------*/ 30382 if (Math.abs(arg) > 0.999999999999) { 30383 arg = 0.999999999999; 30384 } 30385 theta = Math.asin(arg); 30386 var lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta)))); 30387 if (lon < (-Math.PI)) { 30388 lon = -Math.PI; 30389 } 30390 if (lon > Math.PI) { 30391 lon = Math.PI; 30392 } 30393 arg = (2 * theta + Math.sin(2 * theta)) / Math.PI; 30394 if (Math.abs(arg) > 1) { 30395 arg = 1; 30396 } 30397 var lat = Math.asin(arg); 30398 30399 p.x = lon; 30400 p.y = lat; 30401 return p; 30402} 30403 30404var names = ["Mollweide", "moll"]; 30405/* harmony default export */ __webpack_exports__["default"] = ({ 30406 init: init, 30407 forward: forward, 30408 inverse: inverse, 30409 names: names 30410}); 30411 30412 30413/***/ }), 30414
vendor: 7,274 bytes, lines 30415-30659
30415/***/ "./node_modules/proj4/lib/projections/nzmg.js": 30416/*!****************************************************!*\ 30417 !*** ./node_modules/proj4/lib/projections/nzmg.js ***! 30418 \****************************************************/ 30419/*! exports provided: iterations, init, forward, inverse, names, default */ 30420/***/ (function(module, __webpack_exports__, __webpack_require__) { 30421 30422"use strict"; 30423__webpack_require__.r(__webpack_exports__); 30424/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iterations", function() { return iterations; }); 30425/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30426/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30427/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30428/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30429/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 30430 30431 30432/* 30433 reference 30434 Department of Land and Survey Technical Circular 1973/32 30435 http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf 30436 OSG Technical Report 4.1 30437 http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf 30438 */ 30439 30440/** 30441 * iterations: Number of iterations to refine inverse transform. 30442 * 0 -> km accuracy 30443 * 1 -> m accuracy -- suitable for most mapping applications 30444 * 2 -> mm accuracy 30445 */ 30446var iterations = 1; 30447 30448function init() { 30449 this.A = []; 30450 this.A[1] = 0.6399175073; 30451 this.A[2] = -0.1358797613; 30452 this.A[3] = 0.063294409; 30453 this.A[4] = -0.02526853; 30454 this.A[5] = 0.0117879; 30455 this.A[6] = -0.0055161; 30456 this.A[7] = 0.0026906; 30457 this.A[8] = -0.001333; 30458 this.A[9] = 0.00067; 30459 this.A[10] = -0.00034; 30460 30461 this.B_re = []; 30462 this.B_im = []; 30463 this.B_re[1] = 0.7557853228; 30464 this.B_im[1] = 0; 30465 this.B_re[2] = 0.249204646; 30466 this.B_im[2] = 0.003371507; 30467 this.B_re[3] = -0.001541739; 30468 this.B_im[3] = 0.041058560; 30469 this.B_re[4] = -0.10162907; 30470 this.B_im[4] = 0.01727609; 30471 this.B_re[5] = -0.26623489; 30472 this.B_im[5] = -0.36249218; 30473 this.B_re[6] = -0.6870983; 30474 this.B_im[6] = -1.1651967; 30475 30476 this.C_re = []; 30477 this.C_im = []; 30478 this.C_re[1] = 1.3231270439; 30479 this.C_im[1] = 0; 30480 this.C_re[2] = -0.577245789; 30481 this.C_im[2] = -0.007809598; 30482 this.C_re[3] = 0.508307513; 30483 this.C_im[3] = -0.112208952; 30484 this.C_re[4] = -0.15094762; 30485 this.C_im[4] = 0.18200602; 30486 this.C_re[5] = 1.01418179; 30487 this.C_im[5] = 1.64497696; 30488 this.C_re[6] = 1.9660549; 30489 this.C_im[6] = 2.5127645; 30490 30491 this.D = []; 30492 this.D[1] = 1.5627014243; 30493 this.D[2] = 0.5185406398; 30494 this.D[3] = -0.03333098; 30495 this.D[4] = -0.1052906; 30496 this.D[5] = -0.0368594; 30497 this.D[6] = 0.007317; 30498 this.D[7] = 0.01220; 30499 this.D[8] = 0.00394; 30500 this.D[9] = -0.0013; 30501} 30502 30503/** 30504 New Zealand Map Grid Forward - long/lat to x/y 30505 long/lat in radians 30506 */ 30507function forward(p) { 30508 var n; 30509 var lon = p.x; 30510 var lat = p.y; 30511 30512 var delta_lat = lat - this.lat0; 30513 var delta_lon = lon - this.long0; 30514 30515 // 1. Calculate d_phi and d_psi ... // and d_lambda 30516 // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians. 30517 var d_phi = delta_lat / _constants_values__WEBPACK_IMPORTED_MODULE_0__["SEC_TO_RAD"] * 1E-5; 30518 var d_lambda = delta_lon; 30519 var d_phi_n = 1; // d_phi^0 30520 30521 var d_psi = 0; 30522 for (n = 1; n <= 10; n++) { 30523 d_phi_n = d_phi_n * d_phi; 30524 d_psi = d_psi + this.A[n] * d_phi_n; 30525 } 30526 30527 // 2. Calculate theta 30528 var th_re = d_psi; 30529 var th_im = d_lambda; 30530 30531 // 3. Calculate z 30532 var th_n_re = 1; 30533 var th_n_im = 0; // theta^0 30534 var th_n_re1; 30535 var th_n_im1; 30536 30537 var z_re = 0; 30538 var z_im = 0; 30539 for (n = 1; n <= 6; n++) { 30540 th_n_re1 = th_n_re * th_re - th_n_im * th_im; 30541 th_n_im1 = th_n_im * th_re + th_n_re * th_im; 30542 th_n_re = th_n_re1; 30543 th_n_im = th_n_im1; 30544 z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im; 30545 z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im; 30546 } 30547 30548 // 4. Calculate easting and northing 30549 p.x = (z_im * this.a) + this.x0; 30550 p.y = (z_re * this.a) + this.y0; 30551 30552 return p; 30553} 30554 30555/** 30556 New Zealand Map Grid Inverse - x/y to long/lat 30557 */ 30558function inverse(p) { 30559 var n; 30560 var x = p.x; 30561 var y = p.y; 30562 30563 var delta_x = x - this.x0; 30564 var delta_y = y - this.y0; 30565 30566 // 1. Calculate z 30567 var z_re = delta_y / this.a; 30568 var z_im = delta_x / this.a; 30569 30570 // 2a. Calculate theta - first approximation gives km accuracy 30571 var z_n_re = 1; 30572 var z_n_im = 0; // z^0 30573 var z_n_re1; 30574 var z_n_im1; 30575 30576 var th_re = 0; 30577 var th_im = 0; 30578 for (n = 1; n <= 6; n++) { 30579 z_n_re1 = z_n_re * z_re - z_n_im * z_im; 30580 z_n_im1 = z_n_im * z_re + z_n_re * z_im; 30581 z_n_re = z_n_re1; 30582 z_n_im = z_n_im1; 30583 th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im; 30584 th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im; 30585 } 30586 30587 // 2b. Iterate to refine the accuracy of the calculation 30588 // 0 iterations gives km accuracy 30589 // 1 iteration gives m accuracy -- good enough for most mapping applications 30590 // 2 iterations bives mm accuracy 30591 for (var i = 0; i < this.iterations; i++) { 30592 var th_n_re = th_re; 30593 var th_n_im = th_im; 30594 var th_n_re1; 30595 var th_n_im1; 30596 30597 var num_re = z_re; 30598 var num_im = z_im; 30599 for (n = 2; n <= 6; n++) { 30600 th_n_re1 = th_n_re * th_re - th_n_im * th_im; 30601 th_n_im1 = th_n_im * th_re + th_n_re * th_im; 30602 th_n_re = th_n_re1; 30603 th_n_im = th_n_im1; 30604 num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im); 30605 num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im); 30606 } 30607 30608 th_n_re = 1; 30609 th_n_im = 0; 30610 var den_re = this.B_re[1]; 30611 var den_im = this.B_im[1]; 30612 for (n = 2; n <= 6; n++) { 30613 th_n_re1 = th_n_re * th_re - th_n_im * th_im; 30614 th_n_im1 = th_n_im * th_re + th_n_re * th_im; 30615 th_n_re = th_n_re1; 30616 th_n_im = th_n_im1; 30617 den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im); 30618 den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im); 30619 } 30620 30621 // Complex division 30622 var den2 = den_re * den_re + den_im * den_im; 30623 th_re = (num_re * den_re + num_im * den_im) / den2; 30624 th_im = (num_im * den_re - num_re * den_im) / den2; 30625 } 30626 30627 // 3. Calculate d_phi ... // and d_lambda 30628 var d_psi = th_re; 30629 var d_lambda = th_im; 30630 var d_psi_n = 1; // d_psi^0 30631 30632 var d_phi = 0; 30633 for (n = 1; n <= 9; n++) { 30634 d_psi_n = d_psi_n * d_psi; 30635 d_phi = d_phi + this.D[n] * d_psi_n; 30636 } 30637 30638 // 4. Calculate latitude and longitude 30639 // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians. 30640 var lat = this.lat0 + (d_phi * _constants_values__WEBPACK_IMPORTED_MODULE_0__["SEC_TO_RAD"] * 1E5); 30641 var lon = this.long0 + d_lambda; 30642 30643 p.x = lon; 30644 p.y = lat; 30645 30646 return p; 30647} 30648 30649var names = ["New_Zealand_Map_Grid", "nzmg"]; 30650/* harmony default export */ __webpack_exports__["default"] = ({ 30651 init: init, 30652 forward: forward, 30653 inverse: inverse, 30654 names: names 30655}); 30656 30657 30658/***/ }), 30659
vendor: 7,780 bytes, lines 30660-30851
30660/***/ "./node_modules/proj4/lib/projections/omerc.js": 30661/*!*****************************************************!*\ 30662 !*** ./node_modules/proj4/lib/projections/omerc.js ***! 30663 \*****************************************************/ 30664/*! exports provided: init, forward, inverse, names, default */ 30665/***/ (function(module, __webpack_exports__, __webpack_require__) { 30666 30667"use strict"; 30668__webpack_require__.r(__webpack_exports__); 30669/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30670/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30671/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30672/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30673/* harmony import */ var _common_tsfnz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/tsfnz */ "./node_modules/proj4/lib/common/tsfnz.js"); 30674/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 30675/* harmony import */ var _common_phi2z__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/phi2z */ "./node_modules/proj4/lib/common/phi2z.js"); 30676/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 30677 30678 30679 30680 30681 30682/* Initialize the Oblique Mercator projection 30683 ------------------------------------------*/ 30684function init() { 30685 this.no_off = this.no_off || false; 30686 this.no_rot = this.no_rot || false; 30687 30688 if (isNaN(this.k0)) { 30689 this.k0 = 1; 30690 } 30691 var sinlat = Math.sin(this.lat0); 30692 var coslat = Math.cos(this.lat0); 30693 var con = this.e * sinlat; 30694 30695 this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(coslat, 4)); 30696 this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - con * con); 30697 var t0 = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, this.lat0, sinlat); 30698 var dl = this.bl / coslat * Math.sqrt((1 - this.es) / (1 - con * con)); 30699 if (dl * dl < 1) { 30700 dl = 1; 30701 } 30702 var fl; 30703 var gl; 30704 if (!isNaN(this.longc)) { 30705 //Central point and azimuth method 30706 30707 if (this.lat0 >= 0) { 30708 fl = dl + Math.sqrt(dl * dl - 1); 30709 } 30710 else { 30711 fl = dl - Math.sqrt(dl * dl - 1); 30712 } 30713 this.el = fl * Math.pow(t0, this.bl); 30714 gl = 0.5 * (fl - 1 / fl); 30715 this.gamma0 = Math.asin(Math.sin(this.alpha) / dl); 30716 this.long0 = this.longc - Math.asin(gl * Math.tan(this.gamma0)) / this.bl; 30717 30718 } 30719 else { 30720 //2 points method 30721 var t1 = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, this.lat1, Math.sin(this.lat1)); 30722 var t2 = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, this.lat2, Math.sin(this.lat2)); 30723 if (this.lat0 >= 0) { 30724 this.el = (dl + Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl); 30725 } 30726 else { 30727 this.el = (dl - Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl); 30728 } 30729 var hl = Math.pow(t1, this.bl); 30730 var ll = Math.pow(t2, this.bl); 30731 fl = this.el / hl; 30732 gl = 0.5 * (fl - 1 / fl); 30733 var jl = (this.el * this.el - ll * hl) / (this.el * this.el + ll * hl); 30734 var pl = (ll - hl) / (ll + hl); 30735 var dlon12 = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(this.long1 - this.long2); 30736 this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(jl * Math.tan(0.5 * this.bl * (dlon12)) / pl) / this.bl; 30737 this.long0 = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(this.long0); 30738 var dlon10 = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(this.long1 - this.long0); 30739 this.gamma0 = Math.atan(Math.sin(this.bl * (dlon10)) / gl); 30740 this.alpha = Math.asin(dl * Math.sin(this.gamma0)); 30741 } 30742 30743 if (this.no_off) { 30744 this.uc = 0; 30745 } 30746 else { 30747 if (this.lat0 >= 0) { 30748 this.uc = this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha)); 30749 } 30750 else { 30751 this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha)); 30752 } 30753 } 30754 30755} 30756 30757/* Oblique Mercator forward equations--mapping lat,long to x,y 30758 ----------------------------------------------------------*/ 30759function forward(p) { 30760 var lon = p.x; 30761 var lat = p.y; 30762 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(lon - this.long0); 30763 var us, vs; 30764 var con; 30765 if (Math.abs(Math.abs(lat) - _constants_values__WEBPACK_IMPORTED_MODULE_3__["HALF_PI"]) <= _constants_values__WEBPACK_IMPORTED_MODULE_3__["EPSLN"]) { 30766 if (lat > 0) { 30767 con = -1; 30768 } 30769 else { 30770 con = 1; 30771 } 30772 vs = this.al / this.bl * Math.log(Math.tan(_constants_values__WEBPACK_IMPORTED_MODULE_3__["FORTPI"] + con * this.gamma0 * 0.5)); 30773 us = -1 * con * _constants_values__WEBPACK_IMPORTED_MODULE_3__["HALF_PI"] * this.al / this.bl; 30774 } 30775 else { 30776 var t = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_0__["default"])(this.e, lat, Math.sin(lat)); 30777 var ql = this.el / Math.pow(t, this.bl); 30778 var sl = 0.5 * (ql - 1 / ql); 30779 var tl = 0.5 * (ql + 1 / ql); 30780 var vl = Math.sin(this.bl * (dlon)); 30781 var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl; 30782 if (Math.abs(Math.abs(ul) - 1) <= _constants_values__WEBPACK_IMPORTED_MODULE_3__["EPSLN"]) { 30783 vs = Number.POSITIVE_INFINITY; 30784 } 30785 else { 30786 vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl; 30787 } 30788 if (Math.abs(Math.cos(this.bl * (dlon))) <= _constants_values__WEBPACK_IMPORTED_MODULE_3__["EPSLN"]) { 30789 us = this.al * this.bl * (dlon); 30790 } 30791 else { 30792 us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl; 30793 } 30794 } 30795 30796 if (this.no_rot) { 30797 p.x = this.x0 + us; 30798 p.y = this.y0 + vs; 30799 } 30800 else { 30801 30802 us -= this.uc; 30803 p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha); 30804 p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha); 30805 } 30806 return p; 30807} 30808 30809function inverse(p) { 30810 var us, vs; 30811 if (this.no_rot) { 30812 vs = p.y - this.y0; 30813 us = p.x - this.x0; 30814 } 30815 else { 30816 vs = (p.x - this.x0) * Math.cos(this.alpha) - (p.y - this.y0) * Math.sin(this.alpha); 30817 us = (p.y - this.y0) * Math.cos(this.alpha) + (p.x - this.x0) * Math.sin(this.alpha); 30818 us += this.uc; 30819 } 30820 var qp = Math.exp(-1 * this.bl * vs / this.al); 30821 var sp = 0.5 * (qp - 1 / qp); 30822 var tp = 0.5 * (qp + 1 / qp); 30823 var vp = Math.sin(this.bl * us / this.al); 30824 var up = (vp * Math.cos(this.gamma0) + sp * Math.sin(this.gamma0)) / tp; 30825 var ts = Math.pow(this.el / Math.sqrt((1 + up) / (1 - up)), 1 / this.bl); 30826 if (Math.abs(up - 1) < _constants_values__WEBPACK_IMPORTED_MODULE_3__["EPSLN"]) { 30827 p.x = this.long0; 30828 p.y = _constants_values__WEBPACK_IMPORTED_MODULE_3__["HALF_PI"]; 30829 } 30830 else if (Math.abs(up + 1) < _constants_values__WEBPACK_IMPORTED_MODULE_3__["EPSLN"]) { 30831 p.x = this.long0; 30832 p.y = -1 * _constants_values__WEBPACK_IMPORTED_MODULE_3__["HALF_PI"]; 30833 } 30834 else { 30835 p.y = Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_2__["default"])(this.e, ts); 30836 p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(this.long0 - Math.atan2(sp * Math.cos(this.gamma0) - vp * Math.sin(this.gamma0), Math.cos(this.bl * us / this.al)) / this.bl); 30837 } 30838 return p; 30839} 30840 30841var names = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"]; 30842/* harmony default export */ __webpack_exports__["default"] = ({ 30843 init: init, 30844 forward: forward, 30845 inverse: inverse, 30846 names: names 30847}); 30848 30849 30850/***/ }), 30851
vendor: 4,200 bytes, lines 30852-30962
30852/***/ "./node_modules/proj4/lib/projections/ortho.js": 30853/*!*****************************************************!*\ 30854 !*** ./node_modules/proj4/lib/projections/ortho.js ***! 30855 \*****************************************************/ 30856/*! exports provided: init, forward, inverse, names, default */ 30857/***/ (function(module, __webpack_exports__, __webpack_require__) { 30858 30859"use strict"; 30860__webpack_require__.r(__webpack_exports__); 30861/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30862/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30863/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30864/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30865/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 30866/* harmony import */ var _common_asinz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/asinz */ "./node_modules/proj4/lib/common/asinz.js"); 30867/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 30868 30869 30870 30871 30872function init() { 30873 //double temp; /* temporary variable */ 30874 30875 /* Place parameters in static storage for common use 30876 -------------------------------------------------*/ 30877 this.sin_p14 = Math.sin(this.lat0); 30878 this.cos_p14 = Math.cos(this.lat0); 30879} 30880 30881/* Orthographic forward equations--mapping lat,long to x,y 30882 ---------------------------------------------------*/ 30883function forward(p) { 30884 var sinphi, cosphi; /* sin and cos value */ 30885 var dlon; /* delta longitude value */ 30886 var coslon; /* cos of longitude */ 30887 var ksp; /* scale factor */ 30888 var g, x, y; 30889 var lon = p.x; 30890 var lat = p.y; 30891 /* Forward equations 30892 -----------------*/ 30893 dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 30894 30895 sinphi = Math.sin(lat); 30896 cosphi = Math.cos(lat); 30897 30898 coslon = Math.cos(dlon); 30899 g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon; 30900 ksp = 1; 30901 if ((g > 0) || (Math.abs(g) <= _constants_values__WEBPACK_IMPORTED_MODULE_2__["EPSLN"])) { 30902 x = this.a * ksp * cosphi * Math.sin(dlon); 30903 y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon); 30904 } 30905 p.x = x; 30906 p.y = y; 30907 return p; 30908} 30909 30910function inverse(p) { 30911 var rh; /* height above ellipsoid */ 30912 var z; /* angle */ 30913 var sinz, cosz; /* sin of z and cos of z */ 30914 var con; 30915 var lon, lat; 30916 /* Inverse equations 30917 -----------------*/ 30918 p.x -= this.x0; 30919 p.y -= this.y0; 30920 rh = Math.sqrt(p.x * p.x + p.y * p.y); 30921 z = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_1__["default"])(rh / this.a); 30922 30923 sinz = Math.sin(z); 30924 cosz = Math.cos(z); 30925 30926 lon = this.long0; 30927 if (Math.abs(rh) <= _constants_values__WEBPACK_IMPORTED_MODULE_2__["EPSLN"]) { 30928 lat = this.lat0; 30929 p.x = lon; 30930 p.y = lat; 30931 return p; 30932 } 30933 lat = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_1__["default"])(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh); 30934 con = Math.abs(this.lat0) - _constants_values__WEBPACK_IMPORTED_MODULE_2__["HALF_PI"]; 30935 if (Math.abs(con) <= _constants_values__WEBPACK_IMPORTED_MODULE_2__["EPSLN"]) { 30936 if (this.lat0 >= 0) { 30937 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.atan2(p.x, - p.y)); 30938 } 30939 else { 30940 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 - Math.atan2(-p.x, p.y)); 30941 } 30942 p.x = lon; 30943 p.y = lat; 30944 return p; 30945 } 30946 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz)); 30947 p.x = lon; 30948 p.y = lat; 30949 return p; 30950} 30951 30952var names = ["ortho"]; 30953/* harmony default export */ __webpack_exports__["default"] = ({ 30954 init: init, 30955 forward: forward, 30956 inverse: inverse, 30957 names: names 30958}); 30959 30960 30961/***/ }), 30962
vendor: 7,152 bytes, lines 30963-31123
30963/***/ "./node_modules/proj4/lib/projections/poly.js": 30964/*!****************************************************!*\ 30965 !*** ./node_modules/proj4/lib/projections/poly.js ***! 30966 \****************************************************/ 30967/*! exports provided: init, forward, inverse, names, default */ 30968/***/ (function(module, __webpack_exports__, __webpack_require__) { 30969 30970"use strict"; 30971__webpack_require__.r(__webpack_exports__); 30972/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 30973/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 30974/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 30975/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 30976/* harmony import */ var _common_e0fn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/e0fn */ "./node_modules/proj4/lib/common/e0fn.js"); 30977/* harmony import */ var _common_e1fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/e1fn */ "./node_modules/proj4/lib/common/e1fn.js"); 30978/* harmony import */ var _common_e2fn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/e2fn */ "./node_modules/proj4/lib/common/e2fn.js"); 30979/* harmony import */ var _common_e3fn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/e3fn */ "./node_modules/proj4/lib/common/e3fn.js"); 30980/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 30981/* harmony import */ var _common_adjust_lat__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/adjust_lat */ "./node_modules/proj4/lib/common/adjust_lat.js"); 30982/* harmony import */ var _common_mlfn__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/mlfn */ "./node_modules/proj4/lib/common/mlfn.js"); 30983/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 30984/* harmony import */ var _common_gN__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/gN */ "./node_modules/proj4/lib/common/gN.js"); 30985 30986 30987 30988 30989 30990 30991 30992 30993 30994 30995var MAX_ITER = 20; 30996 30997function init() { 30998 /* Place parameters in static storage for common use 30999 -------------------------------------------------*/ 31000 this.temp = this.b / this.a; 31001 this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles 31002 this.e = Math.sqrt(this.es); 31003 this.e0 = Object(_common_e0fn__WEBPACK_IMPORTED_MODULE_0__["default"])(this.es); 31004 this.e1 = Object(_common_e1fn__WEBPACK_IMPORTED_MODULE_1__["default"])(this.es); 31005 this.e2 = Object(_common_e2fn__WEBPACK_IMPORTED_MODULE_2__["default"])(this.es); 31006 this.e3 = Object(_common_e3fn__WEBPACK_IMPORTED_MODULE_3__["default"])(this.es); 31007 this.ml0 = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_6__["default"])(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas 31008} 31009 31010/* Polyconic forward equations--mapping lat,long to x,y 31011 ---------------------------------------------------*/ 31012function forward(p) { 31013 var lon = p.x; 31014 var lat = p.y; 31015 var x, y, el; 31016 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_4__["default"])(lon - this.long0); 31017 el = dlon * Math.sin(lat); 31018 if (this.sphere) { 31019 if (Math.abs(lat) <= _constants_values__WEBPACK_IMPORTED_MODULE_7__["EPSLN"]) { 31020 x = this.a * dlon; 31021 y = -1 * this.a * this.lat0; 31022 } 31023 else { 31024 x = this.a * Math.sin(el) / Math.tan(lat); 31025 y = this.a * (Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_5__["default"])(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat)); 31026 } 31027 } 31028 else { 31029 if (Math.abs(lat) <= _constants_values__WEBPACK_IMPORTED_MODULE_7__["EPSLN"]) { 31030 x = this.a * dlon; 31031 y = -1 * this.ml0; 31032 } 31033 else { 31034 var nl = Object(_common_gN__WEBPACK_IMPORTED_MODULE_8__["default"])(this.a, this.e, Math.sin(lat)) / Math.tan(lat); 31035 x = nl * Math.sin(el); 31036 y = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_6__["default"])(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el)); 31037 } 31038 31039 } 31040 p.x = x + this.x0; 31041 p.y = y + this.y0; 31042 return p; 31043} 31044 31045/* Inverse equations 31046 -----------------*/ 31047function inverse(p) { 31048 var lon, lat, x, y, i; 31049 var al, bl; 31050 var phi, dphi; 31051 x = p.x - this.x0; 31052 y = p.y - this.y0; 31053 31054 if (this.sphere) { 31055 if (Math.abs(y + this.a * this.lat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_7__["EPSLN"]) { 31056 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_4__["default"])(x / this.a + this.long0); 31057 lat = 0; 31058 } 31059 else { 31060 al = this.lat0 + y / this.a; 31061 bl = x * x / this.a / this.a + al * al; 31062 phi = al; 31063 var tanphi; 31064 for (i = MAX_ITER; i; --i) { 31065 tanphi = Math.tan(phi); 31066 dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1); 31067 phi += dphi; 31068 if (Math.abs(dphi) <= _constants_values__WEBPACK_IMPORTED_MODULE_7__["EPSLN"]) { 31069 lat = phi; 31070 break; 31071 } 31072 } 31073 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_4__["default"])(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat)); 31074 } 31075 } 31076 else { 31077 if (Math.abs(y + this.ml0) <= _constants_values__WEBPACK_IMPORTED_MODULE_7__["EPSLN"]) { 31078 lat = 0; 31079 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_4__["default"])(this.long0 + x / this.a); 31080 } 31081 else { 31082 31083 al = (this.ml0 + y) / this.a; 31084 bl = x * x / this.a / this.a + al * al; 31085 phi = al; 31086 var cl, mln, mlnp, ma; 31087 var con; 31088 for (i = MAX_ITER; i; --i) { 31089 con = this.e * Math.sin(phi); 31090 cl = Math.sqrt(1 - con * con) * Math.tan(phi); 31091 mln = this.a * Object(_common_mlfn__WEBPACK_IMPORTED_MODULE_6__["default"])(this.e0, this.e1, this.e2, this.e3, phi); 31092 mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi); 31093 ma = mln / this.a; 31094 dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp); 31095 phi -= dphi; 31096 if (Math.abs(dphi) <= _constants_values__WEBPACK_IMPORTED_MODULE_7__["EPSLN"]) { 31097 lat = phi; 31098 break; 31099 } 31100 } 31101 31102 //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0); 31103 cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat); 31104 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_4__["default"])(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat)); 31105 } 31106 } 31107 31108 p.x = lon; 31109 p.y = lat; 31110 return p; 31111} 31112 31113var names = ["Polyconic", "poly"]; 31114/* harmony default export */ __webpack_exports__["default"] = ({ 31115 init: init, 31116 forward: forward, 31117 inverse: inverse, 31118 names: names 31119}); 31120 31121 31122/***/ }), 31123
vendor: 16,183 bytes, lines 31124-31509
31124/***/ "./node_modules/proj4/lib/projections/qsc.js": 31125/*!***************************************************!*\ 31126 !*** ./node_modules/proj4/lib/projections/qsc.js ***! 31127 \***************************************************/ 31128/*! exports provided: init, forward, inverse, names, default */ 31129/***/ (function(module, __webpack_exports__, __webpack_require__) { 31130 31131"use strict"; 31132__webpack_require__.r(__webpack_exports__); 31133/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 31134/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 31135/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 31136/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 31137/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 31138// QSC projection rewritten from the original PROJ4 31139// https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c 31140 31141 31142 31143/* constants */ 31144var FACE_ENUM = { 31145 FRONT: 1, 31146 RIGHT: 2, 31147 BACK: 3, 31148 LEFT: 4, 31149 TOP: 5, 31150 BOTTOM: 6 31151}; 31152 31153var AREA_ENUM = { 31154 AREA_0: 1, 31155 AREA_1: 2, 31156 AREA_2: 3, 31157 AREA_3: 4 31158}; 31159 31160function init() { 31161 31162 this.x0 = this.x0 || 0; 31163 this.y0 = this.y0 || 0; 31164 this.lat0 = this.lat0 || 0; 31165 this.long0 = this.long0 || 0; 31166 this.lat_ts = this.lat_ts || 0; 31167 this.title = this.title || "Quadrilateralized Spherical Cube"; 31168 31169 /* Determine the cube face from the center of projection. */ 31170 if (this.lat0 >= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] / 2.0) { 31171 this.face = FACE_ENUM.TOP; 31172 } else if (this.lat0 <= -(_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] / 2.0)) { 31173 this.face = FACE_ENUM.BOTTOM; 31174 } else if (Math.abs(this.long0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31175 this.face = FACE_ENUM.FRONT; 31176 } else if (Math.abs(this.long0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31177 this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT; 31178 } else { 31179 this.face = FACE_ENUM.BACK; 31180 } 31181 31182 /* Fill in useful values for the ellipsoid <-> sphere shift 31183 * described in [LK12]. */ 31184 if (this.es !== 0) { 31185 this.one_minus_f = 1 - (this.a - this.b) / this.a; 31186 this.one_minus_f_squared = this.one_minus_f * this.one_minus_f; 31187 } 31188} 31189 31190// QSC forward equations--mapping lat,long to x,y 31191// ----------------------------------------------------------------- 31192function forward(p) { 31193 var xy = {x: 0, y: 0}; 31194 var lat, lon; 31195 var theta, phi; 31196 var t, mu; 31197 /* nu; */ 31198 var area = {value: 0}; 31199 31200 // move lon according to projection's lon 31201 p.x -= this.long0; 31202 31203 /* Convert the geodetic latitude to a geocentric latitude. 31204 * This corresponds to the shift from the ellipsoid to the sphere 31205 * described in [LK12]. */ 31206 if (this.es !== 0) {//if (P->es != 0) { 31207 lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y)); 31208 } else { 31209 lat = p.y; 31210 } 31211 31212 /* Convert the input lat, lon into theta, phi as used by QSC. 31213 * This depends on the cube face and the area on it. 31214 * For the top and bottom face, we can compute theta and phi 31215 * directly from phi, lam. For the other faces, we must use 31216 * unit sphere cartesian coordinates as an intermediate step. */ 31217 lon = p.x; //lon = lp.lam; 31218 if (this.face === FACE_ENUM.TOP) { 31219 phi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - lat; 31220 if (lon >= _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] && lon <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31221 area.value = AREA_ENUM.AREA_0; 31222 theta = lon - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31223 } else if (lon > _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] || lon <= -(_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"])) { 31224 area.value = AREA_ENUM.AREA_1; 31225 theta = (lon > 0.0 ? lon - _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] : lon + _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31226 } else if (lon > -(_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) && lon <= -_constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31227 area.value = AREA_ENUM.AREA_2; 31228 theta = lon + _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31229 } else { 31230 area.value = AREA_ENUM.AREA_3; 31231 theta = lon; 31232 } 31233 } else if (this.face === FACE_ENUM.BOTTOM) { 31234 phi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + lat; 31235 if (lon >= _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] && lon <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31236 area.value = AREA_ENUM.AREA_0; 31237 theta = -lon + _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31238 } else if (lon < _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] && lon >= -_constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31239 area.value = AREA_ENUM.AREA_1; 31240 theta = -lon; 31241 } else if (lon < -_constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] && lon >= -(_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"])) { 31242 area.value = AREA_ENUM.AREA_2; 31243 theta = -lon - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31244 } else { 31245 area.value = AREA_ENUM.AREA_3; 31246 theta = (lon > 0.0 ? -lon + _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] : -lon - _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31247 } 31248 } else { 31249 var q, r, s; 31250 var sinlat, coslat; 31251 var sinlon, coslon; 31252 31253 if (this.face === FACE_ENUM.RIGHT) { 31254 lon = qsc_shift_lon_origin(lon, +_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]); 31255 } else if (this.face === FACE_ENUM.BACK) { 31256 lon = qsc_shift_lon_origin(lon, +_constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31257 } else if (this.face === FACE_ENUM.LEFT) { 31258 lon = qsc_shift_lon_origin(lon, -_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]); 31259 } 31260 sinlat = Math.sin(lat); 31261 coslat = Math.cos(lat); 31262 sinlon = Math.sin(lon); 31263 coslon = Math.cos(lon); 31264 q = coslat * coslon; 31265 r = coslat * sinlon; 31266 s = sinlat; 31267 31268 if (this.face === FACE_ENUM.FRONT) { 31269 phi = Math.acos(q); 31270 theta = qsc_fwd_equat_face_theta(phi, s, r, area); 31271 } else if (this.face === FACE_ENUM.RIGHT) { 31272 phi = Math.acos(r); 31273 theta = qsc_fwd_equat_face_theta(phi, s, -q, area); 31274 } else if (this.face === FACE_ENUM.BACK) { 31275 phi = Math.acos(-q); 31276 theta = qsc_fwd_equat_face_theta(phi, s, -r, area); 31277 } else if (this.face === FACE_ENUM.LEFT) { 31278 phi = Math.acos(-r); 31279 theta = qsc_fwd_equat_face_theta(phi, s, q, area); 31280 } else { 31281 /* Impossible */ 31282 phi = theta = 0; 31283 area.value = AREA_ENUM.AREA_0; 31284 } 31285 } 31286 31287 /* Compute mu and nu for the area of definition. 31288 * For mu, see Eq. (3-21) in [OL76], but note the typos: 31289 * compare with Eq. (3-14). For nu, see Eq. (3-38). */ 31290 mu = Math.atan((12 / _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]) * (theta + Math.acos(Math.sin(theta) * Math.cos(_constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"])) - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"])); 31291 t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta))))); 31292 31293 /* Apply the result to the real area. */ 31294 if (area.value === AREA_ENUM.AREA_1) { 31295 mu += _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31296 } else if (area.value === AREA_ENUM.AREA_2) { 31297 mu += _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]; 31298 } else if (area.value === AREA_ENUM.AREA_3) { 31299 mu += 1.5 * _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]; 31300 } 31301 31302 /* Now compute x, y from mu and nu */ 31303 xy.x = t * Math.cos(mu); 31304 xy.y = t * Math.sin(mu); 31305 xy.x = xy.x * this.a + this.x0; 31306 xy.y = xy.y * this.a + this.y0; 31307 31308 p.x = xy.x; 31309 p.y = xy.y; 31310 return p; 31311} 31312 31313// QSC inverse equations--mapping x,y to lat/long 31314// ----------------------------------------------------------------- 31315function inverse(p) { 31316 var lp = {lam: 0, phi: 0}; 31317 var mu, nu, cosmu, tannu; 31318 var tantheta, theta, cosphi, phi; 31319 var t; 31320 var area = {value: 0}; 31321 31322 /* de-offset */ 31323 p.x = (p.x - this.x0) / this.a; 31324 p.y = (p.y - this.y0) / this.a; 31325 31326 /* Convert the input x, y to the mu and nu angles as used by QSC. 31327 * This depends on the area of the cube face. */ 31328 nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y)); 31329 mu = Math.atan2(p.y, p.x); 31330 if (p.x >= 0.0 && p.x >= Math.abs(p.y)) { 31331 area.value = AREA_ENUM.AREA_0; 31332 } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) { 31333 area.value = AREA_ENUM.AREA_1; 31334 mu -= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31335 } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) { 31336 area.value = AREA_ENUM.AREA_2; 31337 mu = (mu < 0.0 ? mu + _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] : mu - _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31338 } else { 31339 area.value = AREA_ENUM.AREA_3; 31340 mu += _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31341 } 31342 31343 /* Compute phi and theta for the area of definition. 31344 * The inverse projection is not described in the original paper, but some 31345 * good hints can be found here (as of 2011-12-14): 31346 * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302 31347 * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */ 31348 t = (_constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] / 12) * Math.tan(mu); 31349 tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2))); 31350 theta = Math.atan(tantheta); 31351 cosmu = Math.cos(mu); 31352 tannu = Math.tan(nu); 31353 cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta)))); 31354 if (cosphi < -1) { 31355 cosphi = -1; 31356 } else if (cosphi > +1) { 31357 cosphi = +1; 31358 } 31359 31360 /* Apply the result to the real area on the cube face. 31361 * For the top and bottom face, we can compute phi and lam directly. 31362 * For the other faces, we must use unit sphere cartesian coordinates 31363 * as an intermediate step. */ 31364 if (this.face === FACE_ENUM.TOP) { 31365 phi = Math.acos(cosphi); 31366 lp.phi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] - phi; 31367 if (area.value === AREA_ENUM.AREA_0) { 31368 lp.lam = theta + _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31369 } else if (area.value === AREA_ENUM.AREA_1) { 31370 lp.lam = (theta < 0.0 ? theta + _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] : theta - _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31371 } else if (area.value === AREA_ENUM.AREA_2) { 31372 lp.lam = theta - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31373 } else /* area.value == AREA_ENUM.AREA_3 */ { 31374 lp.lam = theta; 31375 } 31376 } else if (this.face === FACE_ENUM.BOTTOM) { 31377 phi = Math.acos(cosphi); 31378 lp.phi = phi - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31379 if (area.value === AREA_ENUM.AREA_0) { 31380 lp.lam = -theta + _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31381 } else if (area.value === AREA_ENUM.AREA_1) { 31382 lp.lam = -theta; 31383 } else if (area.value === AREA_ENUM.AREA_2) { 31384 lp.lam = -theta - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31385 } else /* area.value == AREA_ENUM.AREA_3 */ { 31386 lp.lam = (theta < 0.0 ? -theta - _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] : -theta + _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31387 } 31388 } else { 31389 /* Compute phi and lam via cartesian unit sphere coordinates. */ 31390 var q, r, s; 31391 q = cosphi; 31392 t = q * q; 31393 if (t >= 1) { 31394 s = 0; 31395 } else { 31396 s = Math.sqrt(1 - t) * Math.sin(theta); 31397 } 31398 t += s * s; 31399 if (t >= 1) { 31400 r = 0; 31401 } else { 31402 r = Math.sqrt(1 - t); 31403 } 31404 /* Rotate q,r,s into the correct area. */ 31405 if (area.value === AREA_ENUM.AREA_1) { 31406 t = r; 31407 r = -s; 31408 s = t; 31409 } else if (area.value === AREA_ENUM.AREA_2) { 31410 r = -r; 31411 s = -s; 31412 } else if (area.value === AREA_ENUM.AREA_3) { 31413 t = r; 31414 r = s; 31415 s = -t; 31416 } 31417 /* Rotate q,r,s into the correct cube face. */ 31418 if (this.face === FACE_ENUM.RIGHT) { 31419 t = q; 31420 q = -r; 31421 r = t; 31422 } else if (this.face === FACE_ENUM.BACK) { 31423 q = -q; 31424 r = -r; 31425 } else if (this.face === FACE_ENUM.LEFT) { 31426 t = q; 31427 q = r; 31428 r = -t; 31429 } 31430 /* Now compute phi and lam from the unit sphere coordinates. */ 31431 lp.phi = Math.acos(-s) - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31432 lp.lam = Math.atan2(r, q); 31433 if (this.face === FACE_ENUM.RIGHT) { 31434 lp.lam = qsc_shift_lon_origin(lp.lam, -_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]); 31435 } else if (this.face === FACE_ENUM.BACK) { 31436 lp.lam = qsc_shift_lon_origin(lp.lam, -_constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31437 } else if (this.face === FACE_ENUM.LEFT) { 31438 lp.lam = qsc_shift_lon_origin(lp.lam, +_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]); 31439 } 31440 } 31441 31442 /* Apply the shift from the sphere to the ellipsoid as described 31443 * in [LK12]. */ 31444 if (this.es !== 0) { 31445 var invert_sign; 31446 var tanphi, xa; 31447 invert_sign = (lp.phi < 0 ? 1 : 0); 31448 tanphi = Math.tan(lp.phi); 31449 xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared); 31450 lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa)); 31451 if (invert_sign) { 31452 lp.phi = -lp.phi; 31453 } 31454 } 31455 31456 lp.lam += this.long0; 31457 p.x = lp.lam; 31458 p.y = lp.phi; 31459 return p; 31460} 31461 31462/* Helper function for forward projection: compute the theta angle 31463 * and determine the area number. */ 31464function qsc_fwd_equat_face_theta(phi, y, x, area) { 31465 var theta; 31466 if (phi < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 31467 area.value = AREA_ENUM.AREA_0; 31468 theta = 0.0; 31469 } else { 31470 theta = Math.atan2(y, x); 31471 if (Math.abs(theta) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31472 area.value = AREA_ENUM.AREA_0; 31473 } else if (theta > _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] && theta <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"]) { 31474 area.value = AREA_ENUM.AREA_1; 31475 theta -= _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31476 } else if (theta > _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"] || theta <= -(_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + _constants_values__WEBPACK_IMPORTED_MODULE_0__["FORTPI"])) { 31477 area.value = AREA_ENUM.AREA_2; 31478 theta = (theta >= 0.0 ? theta - _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"] : theta + _constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]); 31479 } else { 31480 area.value = AREA_ENUM.AREA_3; 31481 theta += _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31482 } 31483 } 31484 return theta; 31485} 31486 31487/* Helper function: shift the longitude. */ 31488function qsc_shift_lon_origin(lon, offset) { 31489 var slon = lon + offset; 31490 if (slon < -_constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]) { 31491 slon += _constants_values__WEBPACK_IMPORTED_MODULE_0__["TWO_PI"]; 31492 } else if (slon > +_constants_values__WEBPACK_IMPORTED_MODULE_0__["SPI"]) { 31493 slon -= _constants_values__WEBPACK_IMPORTED_MODULE_0__["TWO_PI"]; 31494 } 31495 return slon; 31496} 31497 31498var names = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"]; 31499/* harmony default export */ __webpack_exports__["default"] = ({ 31500 init: init, 31501 forward: forward, 31502 inverse: inverse, 31503 names: names 31504}); 31505 31506 31507 31508/***/ }), 31509
vendor: 6,538 bytes, lines 31510-31689
31510/***/ "./node_modules/proj4/lib/projections/robin.js": 31511/*!*****************************************************!*\ 31512 !*** ./node_modules/proj4/lib/projections/robin.js ***! 31513 \*****************************************************/ 31514/*! exports provided: init, forward, inverse, names, default */ 31515/***/ (function(module, __webpack_exports__, __webpack_require__) { 31516 31517"use strict"; 31518__webpack_require__.r(__webpack_exports__); 31519/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 31520/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 31521/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 31522/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 31523/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 31524/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 31525// Robinson projection 31526// Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c 31527// Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039 31528 31529 31530 31531 31532var COEFS_X = [ 31533 [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06], 31534 [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06], 31535 [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07], 31536 [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06], 31537 [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06], 31538 [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08], 31539 [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06], 31540 [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06], 31541 [0.9216, -0.00467746, -0.00010457, 4.81243e-06], 31542 [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06], 31543 [0.8679, -0.00609363, -0.000113898, 3.32484e-06], 31544 [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07], 31545 [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07], 31546 [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06], 31547 [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06], 31548 [0.6732, -0.00986209, -0.000199569, 1.91974e-05], 31549 [0.6213, -0.010418, 8.83923e-05, 6.24051e-06], 31550 [0.5722, -0.00906601, 0.000182, 6.24051e-06], 31551 [0.5322, -0.00677797, 0.000275608, 6.24051e-06] 31552]; 31553 31554var COEFS_Y = [ 31555 [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11], 31556 [0.0620, 0.0124, -1.26793e-09, 4.22642e-10], 31557 [0.1240, 0.0124, 5.07171e-09, -1.60604e-09], 31558 [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09], 31559 [0.2480, 0.0124002, 7.10039e-08, -2.24e-08], 31560 [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08], 31561 [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07], 31562 [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07], 31563 [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07], 31564 [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07], 31565 [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07], 31566 [0.6769, 0.011713, -3.20223e-05, -5.16405e-07], 31567 [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07], 31568 [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06], 31569 [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09], 31570 [0.8936, 0.00969686, -6.4636e-05, -8.547e-06], 31571 [0.9394, 0.00840947, -0.000192841, -4.2106e-06], 31572 [0.9761, 0.00616527, -0.000256, -4.2106e-06], 31573 [1.0000, 0.00328947, -0.000319159, -4.2106e-06] 31574]; 31575 31576var FXC = 0.8487; 31577var FYC = 1.3523; 31578var C1 = _constants_values__WEBPACK_IMPORTED_MODULE_0__["R2D"]/5; // rad to 5-degree interval 31579var RC1 = 1/C1; 31580var NODES = 18; 31581 31582var poly3_val = function(coefs, x) { 31583 return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3])); 31584}; 31585 31586var poly3_der = function(coefs, x) { 31587 return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]); 31588}; 31589 31590function newton_rapshon(f_df, start, max_err, iters) { 31591 var x = start; 31592 for (; iters; --iters) { 31593 var upd = f_df(x); 31594 x -= upd; 31595 if (Math.abs(upd) < max_err) { 31596 break; 31597 } 31598 } 31599 return x; 31600} 31601 31602function init() { 31603 this.x0 = this.x0 || 0; 31604 this.y0 = this.y0 || 0; 31605 this.long0 = this.long0 || 0; 31606 this.es = 0; 31607 this.title = this.title || "Robinson"; 31608} 31609 31610function forward(ll) { 31611 var lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(ll.x - this.long0); 31612 31613 var dphi = Math.abs(ll.y); 31614 var i = Math.floor(dphi * C1); 31615 if (i < 0) { 31616 i = 0; 31617 } else if (i >= NODES) { 31618 i = NODES - 1; 31619 } 31620 dphi = _constants_values__WEBPACK_IMPORTED_MODULE_0__["R2D"] * (dphi - RC1 * i); 31621 var xy = { 31622 x: poly3_val(COEFS_X[i], dphi) * lon, 31623 y: poly3_val(COEFS_Y[i], dphi) 31624 }; 31625 if (ll.y < 0) { 31626 xy.y = -xy.y; 31627 } 31628 31629 xy.x = xy.x * this.a * FXC + this.x0; 31630 xy.y = xy.y * this.a * FYC + this.y0; 31631 return xy; 31632} 31633 31634function inverse(xy) { 31635 var ll = { 31636 x: (xy.x - this.x0) / (this.a * FXC), 31637 y: Math.abs(xy.y - this.y0) / (this.a * FYC) 31638 }; 31639 31640 if (ll.y >= 1) { // pathologic case 31641 ll.x /= COEFS_X[NODES][0]; 31642 ll.y = xy.y < 0 ? -_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] : _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31643 } else { 31644 // find table interval 31645 var i = Math.floor(ll.y * NODES); 31646 if (i < 0) { 31647 i = 0; 31648 } else if (i >= NODES) { 31649 i = NODES - 1; 31650 } 31651 for (;;) { 31652 if (COEFS_Y[i][0] > ll.y) { 31653 --i; 31654 } else if (COEFS_Y[i+1][0] <= ll.y) { 31655 ++i; 31656 } else { 31657 break; 31658 } 31659 } 31660 // linear interpolation in 5 degree interval 31661 var coefs = COEFS_Y[i]; 31662 var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]); 31663 // find t so that poly3_val(coefs, t) = ll.y 31664 t = newton_rapshon(function(x) { 31665 return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x); 31666 }, t, _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"], 100); 31667 31668 ll.x /= poly3_val(COEFS_X[i], t); 31669 ll.y = (5 * i + t) * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 31670 if (xy.y < 0) { 31671 ll.y = -ll.y; 31672 } 31673 } 31674 31675 ll.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(ll.x + this.long0); 31676 return ll; 31677} 31678 31679var names = ["Robinson", "robin"]; 31680/* harmony default export */ __webpack_exports__["default"] = ({ 31681 init: init, 31682 forward: forward, 31683 inverse: inverse, 31684 names: names 31685}); 31686 31687 31688/***/ }), 31689
vendor: 5,169 bytes, lines 31690-31828
31690/***/ "./node_modules/proj4/lib/projections/sinu.js": 31691/*!****************************************************!*\ 31692 !*** ./node_modules/proj4/lib/projections/sinu.js ***! 31693 \****************************************************/ 31694/*! exports provided: init, forward, inverse, names, default */ 31695/***/ (function(module, __webpack_exports__, __webpack_require__) { 31696 31697"use strict"; 31698__webpack_require__.r(__webpack_exports__); 31699/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 31700/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 31701/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 31702/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 31703/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 31704/* harmony import */ var _common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/adjust_lat */ "./node_modules/proj4/lib/common/adjust_lat.js"); 31705/* harmony import */ var _common_pj_enfn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/pj_enfn */ "./node_modules/proj4/lib/common/pj_enfn.js"); 31706/* harmony import */ var _common_pj_mlfn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/pj_mlfn */ "./node_modules/proj4/lib/common/pj_mlfn.js"); 31707/* harmony import */ var _common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/pj_inv_mlfn */ "./node_modules/proj4/lib/common/pj_inv_mlfn.js"); 31708/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 31709/* harmony import */ var _common_asinz__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/asinz */ "./node_modules/proj4/lib/common/asinz.js"); 31710 31711 31712 31713var MAX_ITER = 20; 31714 31715 31716 31717 31718 31719 31720 31721function init() { 31722 /* Place parameters in static storage for common use 31723 -------------------------------------------------*/ 31724 31725 31726 if (!this.sphere) { 31727 this.en = Object(_common_pj_enfn__WEBPACK_IMPORTED_MODULE_2__["default"])(this.es); 31728 } 31729 else { 31730 this.n = 1; 31731 this.m = 0; 31732 this.es = 0; 31733 this.C_y = Math.sqrt((this.m + 1) / this.n); 31734 this.C_x = this.C_y / (this.m + 1); 31735 } 31736 31737} 31738 31739/* Sinusoidal forward equations--mapping lat,long to x,y 31740 -----------------------------------------------------*/ 31741function forward(p) { 31742 var x, y; 31743 var lon = p.x; 31744 var lat = p.y; 31745 /* Forward equations 31746 -----------------*/ 31747 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 31748 31749 if (this.sphere) { 31750 if (!this.m) { 31751 lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat; 31752 } 31753 else { 31754 var k = this.n * Math.sin(lat); 31755 for (var i = MAX_ITER; i; --i) { 31756 var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat)); 31757 lat -= V; 31758 if (Math.abs(V) < _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]) { 31759 break; 31760 } 31761 } 31762 } 31763 x = this.a * this.C_x * lon * (this.m + Math.cos(lat)); 31764 y = this.a * this.C_y * lat; 31765 31766 } 31767 else { 31768 31769 var s = Math.sin(lat); 31770 var c = Math.cos(lat); 31771 y = this.a * Object(_common_pj_mlfn__WEBPACK_IMPORTED_MODULE_3__["default"])(lat, s, c, this.en); 31772 x = this.a * lon * c / Math.sqrt(1 - this.es * s * s); 31773 } 31774 31775 p.x = x; 31776 p.y = y; 31777 return p; 31778} 31779 31780function inverse(p) { 31781 var lat, temp, lon, s; 31782 31783 p.x -= this.x0; 31784 lon = p.x / this.a; 31785 p.y -= this.y0; 31786 lat = p.y / this.a; 31787 31788 if (this.sphere) { 31789 lat /= this.C_y; 31790 lon = lon / (this.C_x * (this.m + Math.cos(lat))); 31791 if (this.m) { 31792 lat = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_6__["default"])((this.m * lat + Math.sin(lat)) / this.n); 31793 } 31794 else if (this.n !== 1) { 31795 lat = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_6__["default"])(Math.sin(lat) / this.n); 31796 } 31797 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon + this.long0); 31798 lat = Object(_common_adjust_lat__WEBPACK_IMPORTED_MODULE_1__["default"])(lat); 31799 } 31800 else { 31801 lat = Object(_common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_4__["default"])(p.y / this.a, this.es, this.en); 31802 s = Math.abs(lat); 31803 if (s < _constants_values__WEBPACK_IMPORTED_MODULE_5__["HALF_PI"]) { 31804 s = Math.sin(lat); 31805 temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat)); 31806 //temp = this.long0 + p.x / (this.a * Math.cos(lat)); 31807 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(temp); 31808 } 31809 else if ((s - _constants_values__WEBPACK_IMPORTED_MODULE_5__["EPSLN"]) < _constants_values__WEBPACK_IMPORTED_MODULE_5__["HALF_PI"]) { 31810 lon = this.long0; 31811 } 31812 } 31813 p.x = lon; 31814 p.y = lat; 31815 return p; 31816} 31817 31818var names = ["Sinusoidal", "sinu"]; 31819/* harmony default export */ __webpack_exports__["default"] = ({ 31820 init: init, 31821 forward: forward, 31822 inverse: inverse, 31823 names: names 31824}); 31825 31826 31827/***/ }), 31828
vendor: 3,875 bytes, lines 31829-31931
31829/***/ "./node_modules/proj4/lib/projections/somerc.js": 31830/*!******************************************************!*\ 31831 !*** ./node_modules/proj4/lib/projections/somerc.js ***! 31832 \******************************************************/ 31833/*! exports provided: init, forward, inverse, names, default */ 31834/***/ (function(module, __webpack_exports__, __webpack_require__) { 31835 31836"use strict"; 31837__webpack_require__.r(__webpack_exports__); 31838/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 31839/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 31840/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 31841/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 31842/* 31843 references: 31844 Formules et constantes pour le Calcul pour la 31845 projection cylindrique conforme à axe oblique et pour la transformation entre 31846 des systèmes de référence. 31847 http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf 31848 */ 31849 31850function init() { 31851 var phy0 = this.lat0; 31852 this.lambda0 = this.long0; 31853 var sinPhy0 = Math.sin(phy0); 31854 var semiMajorAxis = this.a; 31855 var invF = this.rf; 31856 var flattening = 1 / invF; 31857 var e2 = 2 * flattening - Math.pow(flattening, 2); 31858 var e = this.e = Math.sqrt(e2); 31859 this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2)); 31860 this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4)); 31861 this.b0 = Math.asin(sinPhy0 / this.alpha); 31862 var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2)); 31863 var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2)); 31864 var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0)); 31865 this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3; 31866} 31867 31868function forward(p) { 31869 var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2)); 31870 var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y))); 31871 var S = -this.alpha * (Sa1 + Sa2) + this.K; 31872 31873 // spheric latitude 31874 var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4); 31875 31876 // spheric longitude 31877 var I = this.alpha * (p.x - this.lambda0); 31878 31879 // psoeudo equatorial rotation 31880 var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I))); 31881 31882 var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I)); 31883 31884 p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0; 31885 p.x = this.R * rotI + this.x0; 31886 return p; 31887} 31888 31889function inverse(p) { 31890 var Y = p.x - this.x0; 31891 var X = p.y - this.y0; 31892 31893 var rotI = Y / this.R; 31894 var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4); 31895 31896 var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI)); 31897 var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB))); 31898 31899 var lambda = this.lambda0 + I / this.alpha; 31900 31901 var S = 0; 31902 var phy = b; 31903 var prevPhy = -1000; 31904 var iteration = 0; 31905 while (Math.abs(phy - prevPhy) > 0.0000001) { 31906 if (++iteration > 20) { 31907 //...reportError("omercFwdInfinity"); 31908 return; 31909 } 31910 //S = Math.log(Math.tan(Math.PI / 4 + phy / 2)); 31911 S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2)); 31912 prevPhy = phy; 31913 phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2; 31914 } 31915 31916 p.x = lambda; 31917 p.y = phy; 31918 return p; 31919} 31920 31921var names = ["somerc"]; 31922/* harmony default export */ __webpack_exports__["default"] = ({ 31923 init: init, 31924 forward: forward, 31925 inverse: inverse, 31926 names: names 31927}); 31928 31929 31930/***/ }), 31931
vendor: 8,785 bytes, lines 31932-32129
31932/***/ "./node_modules/proj4/lib/projections/stere.js": 31933/*!*****************************************************!*\ 31934 !*** ./node_modules/proj4/lib/projections/stere.js ***! 31935 \*****************************************************/ 31936/*! exports provided: ssfn_, init, forward, inverse, names, default */ 31937/***/ (function(module, __webpack_exports__, __webpack_require__) { 31938 31939"use strict"; 31940__webpack_require__.r(__webpack_exports__); 31941/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ssfn_", function() { return ssfn_; }); 31942/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 31943/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 31944/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 31945/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 31946/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 31947/* harmony import */ var _common_sign__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/sign */ "./node_modules/proj4/lib/common/sign.js"); 31948/* harmony import */ var _common_msfnz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/msfnz */ "./node_modules/proj4/lib/common/msfnz.js"); 31949/* harmony import */ var _common_tsfnz__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/tsfnz */ "./node_modules/proj4/lib/common/tsfnz.js"); 31950/* harmony import */ var _common_phi2z__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/phi2z */ "./node_modules/proj4/lib/common/phi2z.js"); 31951/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 31952 31953 31954 31955 31956 31957 31958 31959 31960function ssfn_(phit, sinphi, eccen) { 31961 sinphi *= eccen; 31962 return (Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen)); 31963} 31964 31965function init() { 31966 this.coslat0 = Math.cos(this.lat0); 31967 this.sinlat0 = Math.sin(this.lat0); 31968 if (this.sphere) { 31969 if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 31970 this.k0 = 0.5 * (1 + Object(_common_sign__WEBPACK_IMPORTED_MODULE_1__["default"])(this.lat0) * Math.sin(this.lat_ts)); 31971 } 31972 } 31973 else { 31974 if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 31975 if (this.lat0 > 0) { 31976 //North pole 31977 //trace('stere:north pole'); 31978 this.con = 1; 31979 } 31980 else { 31981 //South pole 31982 //trace('stere:south pole'); 31983 this.con = -1; 31984 } 31985 } 31986 this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e)); 31987 if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 31988 this.k0 = 0.5 * this.cons * Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_2__["default"])(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_3__["default"])(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts)); 31989 } 31990 this.ms1 = Object(_common_msfnz__WEBPACK_IMPORTED_MODULE_2__["default"])(this.e, this.sinlat0, this.coslat0); 31991 this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 31992 this.cosX0 = Math.cos(this.X0); 31993 this.sinX0 = Math.sin(this.X0); 31994 } 31995} 31996 31997// Stereographic forward equations--mapping lat,long to x,y 31998function forward(p) { 31999 var lon = p.x; 32000 var lat = p.y; 32001 var sinlat = Math.sin(lat); 32002 var coslat = Math.cos(lat); 32003 var A, X, sinX, cosX, ts, rh; 32004 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__["default"])(lon - this.long0); 32005 32006 if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"] && Math.abs(lat + this.lat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32007 //case of the origine point 32008 //trace('stere:this is the origin point'); 32009 p.x = NaN; 32010 p.y = NaN; 32011 return p; 32012 } 32013 if (this.sphere) { 32014 //trace('stere:sphere case'); 32015 A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon)); 32016 p.x = this.a * A * coslat * Math.sin(dlon) + this.x0; 32017 p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0; 32018 return p; 32019 } 32020 else { 32021 X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"]; 32022 cosX = Math.cos(X); 32023 sinX = Math.sin(X); 32024 if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32025 ts = Object(_common_tsfnz__WEBPACK_IMPORTED_MODULE_3__["default"])(this.e, lat * this.con, this.con * sinlat); 32026 rh = 2 * this.a * this.k0 * ts / this.cons; 32027 p.x = this.x0 + rh * Math.sin(lon - this.long0); 32028 p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0); 32029 //trace(p.toString()); 32030 return p; 32031 } 32032 else if (Math.abs(this.sinlat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32033 //Eq 32034 //trace('stere:equateur'); 32035 A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon)); 32036 p.y = A * sinX; 32037 } 32038 else { 32039 //other case 32040 //trace('stere:normal case'); 32041 A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon))); 32042 p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0; 32043 } 32044 p.x = A * cosX * Math.sin(dlon) + this.x0; 32045 } 32046 //trace(p.toString()); 32047 return p; 32048} 32049 32050//* Stereographic inverse equations--mapping x,y to lat/long 32051function inverse(p) { 32052 p.x -= this.x0; 32053 p.y -= this.y0; 32054 var lon, lat, ts, ce, Chi; 32055 var rh = Math.sqrt(p.x * p.x + p.y * p.y); 32056 if (this.sphere) { 32057 var c = 2 * Math.atan(rh / (2 * this.a * this.k0)); 32058 lon = this.long0; 32059 lat = this.lat0; 32060 if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32061 p.x = lon; 32062 p.y = lat; 32063 return p; 32064 } 32065 lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh); 32066 if (Math.abs(this.coslat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32067 if (this.lat0 > 0) { 32068 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__["default"])(this.long0 + Math.atan2(p.x, - 1 * p.y)); 32069 } 32070 else { 32071 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__["default"])(this.long0 + Math.atan2(p.x, p.y)); 32072 } 32073 } 32074 else { 32075 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__["default"])(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c))); 32076 } 32077 p.x = lon; 32078 p.y = lat; 32079 return p; 32080 } 32081 else { 32082 if (Math.abs(this.coslat0) <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32083 if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32084 lat = this.lat0; 32085 lon = this.long0; 32086 p.x = lon; 32087 p.y = lat; 32088 //trace(p.toString()); 32089 return p; 32090 } 32091 p.x *= this.con; 32092 p.y *= this.con; 32093 ts = rh * this.cons / (2 * this.a * this.k0); 32094 lat = this.con * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__["default"])(this.e, ts); 32095 lon = this.con * Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__["default"])(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y)); 32096 } 32097 else { 32098 ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1)); 32099 lon = this.long0; 32100 if (rh <= _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32101 Chi = this.X0; 32102 } 32103 else { 32104 Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh); 32105 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_5__["default"])(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce))); 32106 } 32107 lat = -1 * Object(_common_phi2z__WEBPACK_IMPORTED_MODULE_4__["default"])(this.e, Math.tan(0.5 * (_constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"] + Chi))); 32108 } 32109 } 32110 p.x = lon; 32111 p.y = lat; 32112 32113 //trace(p.toString()); 32114 return p; 32115 32116} 32117 32118var names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"]; 32119/* harmony default export */ __webpack_exports__["default"] = ({ 32120 init: init, 32121 forward: forward, 32122 inverse: inverse, 32123 names: names, 32124 ssfn_: ssfn_ 32125}); 32126 32127 32128/***/ }), 32129
vendor: 3,083 bytes, lines 32130-32212
32130/***/ "./node_modules/proj4/lib/projections/sterea.js": 32131/*!******************************************************!*\ 32132 !*** ./node_modules/proj4/lib/projections/sterea.js ***! 32133 \******************************************************/ 32134/*! exports provided: init, forward, inverse, names, default */ 32135/***/ (function(module, __webpack_exports__, __webpack_require__) { 32136 32137"use strict"; 32138__webpack_require__.r(__webpack_exports__); 32139/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 32140/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 32141/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 32142/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 32143/* harmony import */ var _gauss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./gauss */ "./node_modules/proj4/lib/projections/gauss.js"); 32144/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 32145 32146 32147 32148function init() { 32149 _gauss__WEBPACK_IMPORTED_MODULE_0__["default"].init.apply(this); 32150 if (!this.rc) { 32151 return; 32152 } 32153 this.sinc0 = Math.sin(this.phic0); 32154 this.cosc0 = Math.cos(this.phic0); 32155 this.R2 = 2 * this.rc; 32156 if (!this.title) { 32157 this.title = "Oblique Stereographic Alternative"; 32158 } 32159} 32160 32161function forward(p) { 32162 var sinc, cosc, cosl, k; 32163 p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(p.x - this.long0); 32164 _gauss__WEBPACK_IMPORTED_MODULE_0__["default"].forward.apply(this, [p]); 32165 sinc = Math.sin(p.y); 32166 cosc = Math.cos(p.y); 32167 cosl = Math.cos(p.x); 32168 k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl); 32169 p.x = k * cosc * Math.sin(p.x); 32170 p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl); 32171 p.x = this.a * p.x + this.x0; 32172 p.y = this.a * p.y + this.y0; 32173 return p; 32174} 32175 32176function inverse(p) { 32177 var sinc, cosc, lon, lat, rho; 32178 p.x = (p.x - this.x0) / this.a; 32179 p.y = (p.y - this.y0) / this.a; 32180 32181 p.x /= this.k0; 32182 p.y /= this.k0; 32183 if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) { 32184 var c = 2 * Math.atan2(rho, this.R2); 32185 sinc = Math.sin(c); 32186 cosc = Math.cos(c); 32187 lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho); 32188 lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc); 32189 } 32190 else { 32191 lat = this.phic0; 32192 lon = 0; 32193 } 32194 32195 p.x = lon; 32196 p.y = lat; 32197 _gauss__WEBPACK_IMPORTED_MODULE_0__["default"].inverse.apply(this, [p]); 32198 p.x = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_1__["default"])(p.x + this.long0); 32199 return p; 32200} 32201 32202var names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"]; 32203/* harmony default export */ __webpack_exports__["default"] = ({ 32204 init: init, 32205 forward: forward, 32206 inverse: inverse, 32207 names: names 32208}); 32209 32210 32211/***/ }), 32212
vendor: 6,945 bytes, lines 32213-32408
32213/***/ "./node_modules/proj4/lib/projections/tmerc.js": 32214/*!*****************************************************!*\ 32215 !*** ./node_modules/proj4/lib/projections/tmerc.js ***! 32216 \*****************************************************/ 32217/*! exports provided: init, forward, inverse, names, default */ 32218/***/ (function(module, __webpack_exports__, __webpack_require__) { 32219 32220"use strict"; 32221__webpack_require__.r(__webpack_exports__); 32222/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 32223/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 32224/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 32225/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 32226/* harmony import */ var _common_pj_enfn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/pj_enfn */ "./node_modules/proj4/lib/common/pj_enfn.js"); 32227/* harmony import */ var _common_pj_mlfn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/pj_mlfn */ "./node_modules/proj4/lib/common/pj_mlfn.js"); 32228/* harmony import */ var _common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/pj_inv_mlfn */ "./node_modules/proj4/lib/common/pj_inv_mlfn.js"); 32229/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 32230/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 32231/* harmony import */ var _common_sign__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/sign */ "./node_modules/proj4/lib/common/sign.js"); 32232// Heavily based on this tmerc projection implementation 32233// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js 32234 32235 32236 32237 32238 32239 32240 32241 32242 32243function init() { 32244 this.x0 = this.x0 !== undefined ? this.x0 : 0; 32245 this.y0 = this.y0 !== undefined ? this.y0 : 0; 32246 this.long0 = this.long0 !== undefined ? this.long0 : 0; 32247 this.lat0 = this.lat0 !== undefined ? this.lat0 : 0; 32248 32249 if (this.es) { 32250 this.en = Object(_common_pj_enfn__WEBPACK_IMPORTED_MODULE_0__["default"])(this.es); 32251 this.ml0 = Object(_common_pj_mlfn__WEBPACK_IMPORTED_MODULE_1__["default"])(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en); 32252 } 32253} 32254 32255/** 32256 Transverse Mercator Forward - long/lat to x/y 32257 long/lat in radians 32258 */ 32259function forward(p) { 32260 var lon = p.x; 32261 var lat = p.y; 32262 32263 var delta_lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__["default"])(lon - this.long0); 32264 var con; 32265 var x, y; 32266 var sin_phi = Math.sin(lat); 32267 var cos_phi = Math.cos(lat); 32268 32269 if (!this.es) { 32270 var b = cos_phi * Math.sin(delta_lon); 32271 32272 if ((Math.abs(Math.abs(b) - 1)) < _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"]) { 32273 return (93); 32274 } 32275 else { 32276 x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0; 32277 y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2)); 32278 b = Math.abs(y); 32279 32280 if (b >= 1) { 32281 if ((b - 1) > _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"]) { 32282 return (93); 32283 } 32284 else { 32285 y = 0; 32286 } 32287 } 32288 else { 32289 y = Math.acos(y); 32290 } 32291 32292 if (lat < 0) { 32293 y = -y; 32294 } 32295 32296 y = this.a * this.k0 * (y - this.lat0) + this.y0; 32297 } 32298 } 32299 else { 32300 var al = cos_phi * delta_lon; 32301 var als = Math.pow(al, 2); 32302 var c = this.ep2 * Math.pow(cos_phi, 2); 32303 var cs = Math.pow(c, 2); 32304 var tq = Math.abs(cos_phi) > _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"] ? Math.tan(lat) : 0; 32305 var t = Math.pow(tq, 2); 32306 var ts = Math.pow(t, 2); 32307 con = 1 - this.es * Math.pow(sin_phi, 2); 32308 al = al / Math.sqrt(con); 32309 var ml = Object(_common_pj_mlfn__WEBPACK_IMPORTED_MODULE_1__["default"])(lat, sin_phi, cos_phi, this.en); 32310 32311 x = this.a * (this.k0 * al * (1 + 32312 als / 6 * (1 - t + c + 32313 als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c + 32314 als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) + 32315 this.x0; 32316 32317 y = this.a * (this.k0 * (ml - this.ml0 + 32318 sin_phi * delta_lon * al / 2 * (1 + 32319 als / 12 * (5 - t + 9 * c + 4 * cs + 32320 als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c + 32321 als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) + 32322 this.y0; 32323 } 32324 32325 p.x = x; 32326 p.y = y; 32327 32328 return p; 32329} 32330 32331/** 32332 Transverse Mercator Inverse - x/y to long/lat 32333 */ 32334function inverse(p) { 32335 var con, phi; 32336 var lat, lon; 32337 var x = (p.x - this.x0) * (1 / this.a); 32338 var y = (p.y - this.y0) * (1 / this.a); 32339 32340 if (!this.es) { 32341 var f = Math.exp(x / this.k0); 32342 var g = 0.5 * (f - 1 / f); 32343 var temp = this.lat0 + y / this.k0; 32344 var h = Math.cos(temp); 32345 con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2))); 32346 lat = Math.asin(con); 32347 32348 if (y < 0) { 32349 lat = -lat; 32350 } 32351 32352 if ((g === 0) && (h === 0)) { 32353 lon = 0; 32354 } 32355 else { 32356 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__["default"])(Math.atan2(g, h) + this.long0); 32357 } 32358 } 32359 else { // ellipsoidal form 32360 con = this.ml0 + y / this.k0; 32361 phi = Object(_common_pj_inv_mlfn__WEBPACK_IMPORTED_MODULE_2__["default"])(con, this.es, this.en); 32362 32363 if (Math.abs(phi) < _constants_values__WEBPACK_IMPORTED_MODULE_4__["HALF_PI"]) { 32364 var sin_phi = Math.sin(phi); 32365 var cos_phi = Math.cos(phi); 32366 var tan_phi = Math.abs(cos_phi) > _constants_values__WEBPACK_IMPORTED_MODULE_4__["EPSLN"] ? Math.tan(phi) : 0; 32367 var c = this.ep2 * Math.pow(cos_phi, 2); 32368 var cs = Math.pow(c, 2); 32369 var t = Math.pow(tan_phi, 2); 32370 var ts = Math.pow(t, 2); 32371 con = 1 - this.es * Math.pow(sin_phi, 2); 32372 var d = x * Math.sqrt(con) / this.k0; 32373 var ds = Math.pow(d, 2); 32374 con = con * tan_phi; 32375 32376 lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 - 32377 ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs - 32378 ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c - 32379 ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t)))); 32380 32381 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_3__["default"])(this.long0 + (d * (1 - 32382 ds / 6 * (1 + 2 * t + c - 32383 ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c - 32384 ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi)); 32385 } 32386 else { 32387 lat = _constants_values__WEBPACK_IMPORTED_MODULE_4__["HALF_PI"] * Object(_common_sign__WEBPACK_IMPORTED_MODULE_5__["default"])(y); 32388 lon = 0; 32389 } 32390 } 32391 32392 p.x = lon; 32393 p.y = lat; 32394 32395 return p; 32396} 32397 32398var names = ["Fast_Transverse_Mercator", "Fast Transverse Mercator"]; 32399/* harmony default export */ __webpack_exports__["default"] = ({ 32400 init: init, 32401 forward: forward, 32402 inverse: inverse, 32403 names: names 32404}); 32405 32406 32407/***/ }), 32408
vendor: 5,665 bytes, lines 32409-32596
32409/***/ "./node_modules/proj4/lib/projections/tpers.js": 32410/*!*****************************************************!*\ 32411 !*** ./node_modules/proj4/lib/projections/tpers.js ***! 32412 \*****************************************************/ 32413/*! exports provided: init, forward, inverse, names, default */ 32414/***/ (function(module, __webpack_exports__, __webpack_require__) { 32415 32416"use strict"; 32417__webpack_require__.r(__webpack_exports__); 32418/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 32419/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 32420/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 32421/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 32422/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 32423/* harmony import */ var _common_hypot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hypot */ "./node_modules/proj4/lib/common/hypot.js"); 32424 32425var mode = { 32426 N_POLE: 0, 32427 S_POLE: 1, 32428 EQUIT: 2, 32429 OBLIQ: 3 32430}; 32431 32432 32433 32434 32435var params = { 32436 h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7 32437 azi: { def: 0, num: true, degrees: true }, // default is North 32438 tilt: { def: 0, num: true, degrees: true }, // default is Nadir 32439 long0: { def: 0, num: true }, // default is Greenwich, conversion to rad is automatic 32440 lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic 32441}; 32442 32443function init() { 32444 Object.keys(params).forEach(function (p) { 32445 if (typeof this[p] === "undefined") { 32446 this[p] = params[p].def; 32447 } else if (params[p].num && isNaN(this[p])) { 32448 throw new Error("Invalid parameter value, must be numeric " + p + " = " + this[p]); 32449 } else if (params[p].num) { 32450 this[p] = parseFloat(this[p]); 32451 } 32452 if (params[p].degrees) { 32453 this[p] = this[p] * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"]; 32454 } 32455 }.bind(this)); 32456 32457 if (Math.abs((Math.abs(this.lat0) - _constants_values__WEBPACK_IMPORTED_MODULE_0__["HALF_PI"])) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32458 this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE; 32459 } else if (Math.abs(this.lat0) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32460 this.mode = mode.EQUIT; 32461 } else { 32462 this.mode = mode.OBLIQ; 32463 this.sinph0 = Math.sin(this.lat0); 32464 this.cosph0 = Math.cos(this.lat0); 32465 } 32466 32467 this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius 32468 32469 if (this.pn1 <= 0 || this.pn1 > 1e10) { 32470 throw new Error("Invalid height"); 32471 } 32472 32473 this.p = 1 + this.pn1; 32474 this.rp = 1 / this.p; 32475 this.h1 = 1 / this.pn1; 32476 this.pfact = (this.p + 1) * this.h1; 32477 this.es = 0; 32478 32479 var omega = this.tilt; 32480 var gamma = this.azi; 32481 this.cg = Math.cos(gamma); 32482 this.sg = Math.sin(gamma); 32483 this.cw = Math.cos(omega); 32484 this.sw = Math.sin(omega); 32485} 32486 32487function forward(p) { 32488 p.x -= this.long0; 32489 var sinphi = Math.sin(p.y); 32490 var cosphi = Math.cos(p.y); 32491 var coslam = Math.cos(p.x); 32492 var x, y; 32493 switch (this.mode) { 32494 case mode.OBLIQ: 32495 y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam; 32496 break; 32497 case mode.EQUIT: 32498 y = cosphi * coslam; 32499 break; 32500 case mode.S_POLE: 32501 y = -sinphi; 32502 break; 32503 case mode.N_POLE: 32504 y = sinphi; 32505 break; 32506 } 32507 y = this.pn1 / (this.p - y); 32508 x = y * cosphi * Math.sin(p.x); 32509 32510 switch (this.mode) { 32511 case mode.OBLIQ: 32512 y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam; 32513 break; 32514 case mode.EQUIT: 32515 y *= sinphi; 32516 break; 32517 case mode.N_POLE: 32518 y *= -(cosphi * coslam); 32519 break; 32520 case mode.S_POLE: 32521 y *= cosphi * coslam; 32522 break; 32523 } 32524 32525 // Tilt 32526 var yt, ba; 32527 yt = y * this.cg + x * this.sg; 32528 ba = 1 / (yt * this.sw * this.h1 + this.cw); 32529 x = (x * this.cg - y * this.sg) * this.cw * ba; 32530 y = yt * ba; 32531 32532 p.x = x * this.a; 32533 p.y = y * this.a; 32534 return p; 32535} 32536 32537function inverse(p) { 32538 p.x /= this.a; 32539 p.y /= this.a; 32540 var r = { x: p.x, y: p.y }; 32541 32542 // Un-Tilt 32543 var bm, bq, yt; 32544 yt = 1 / (this.pn1 - p.y * this.sw); 32545 bm = this.pn1 * p.x * yt; 32546 bq = this.pn1 * p.y * this.cw * yt; 32547 p.x = bm * this.cg + bq * this.sg; 32548 p.y = bq * this.cg - bm * this.sg; 32549 32550 var rh = Object(_common_hypot__WEBPACK_IMPORTED_MODULE_1__["default"])(p.x, p.y); 32551 if (Math.abs(rh) < _constants_values__WEBPACK_IMPORTED_MODULE_0__["EPSLN"]) { 32552 r.x = 0; 32553 r.y = p.y; 32554 } else { 32555 var cosz, sinz; 32556 sinz = 1 - rh * rh * this.pfact; 32557 sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1); 32558 cosz = Math.sqrt(1 - sinz * sinz); 32559 switch (this.mode) { 32560 case mode.OBLIQ: 32561 r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh); 32562 p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh; 32563 p.x *= sinz * this.cosph0; 32564 break; 32565 case mode.EQUIT: 32566 r.y = Math.asin(p.y * sinz / rh); 32567 p.y = cosz * rh; 32568 p.x *= sinz; 32569 break; 32570 case mode.N_POLE: 32571 r.y = Math.asin(cosz); 32572 p.y = -p.y; 32573 break; 32574 case mode.S_POLE: 32575 r.y = -Math.asin(cosz); 32576 break; 32577 } 32578 r.x = Math.atan2(p.x, p.y); 32579 } 32580 32581 p.x = r.x + this.long0; 32582 p.y = r.y; 32583 return p; 32584} 32585 32586var names = ["Tilted_Perspective", "tpers"]; 32587/* harmony default export */ __webpack_exports__["default"] = ({ 32588 init: init, 32589 forward: forward, 32590 inverse: inverse, 32591 names: names 32592}); 32593 32594 32595/***/ }), 32596
vendor: 2,096 bytes, lines 32597-32643
32597/***/ "./node_modules/proj4/lib/projections/utm.js": 32598/*!***************************************************!*\ 32599 !*** ./node_modules/proj4/lib/projections/utm.js ***! 32600 \***************************************************/ 32601/*! exports provided: dependsOn, init, names, default */ 32602/***/ (function(module, __webpack_exports__, __webpack_require__) { 32603 32604"use strict"; 32605__webpack_require__.r(__webpack_exports__); 32606/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dependsOn", function() { return dependsOn; }); 32607/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 32608/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 32609/* harmony import */ var _common_adjust_zone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_zone */ "./node_modules/proj4/lib/common/adjust_zone.js"); 32610/* harmony import */ var _etmerc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./etmerc */ "./node_modules/proj4/lib/projections/etmerc.js"); 32611/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 32612 32613 32614var dependsOn = 'etmerc'; 32615 32616 32617 32618function init() { 32619 var zone = Object(_common_adjust_zone__WEBPACK_IMPORTED_MODULE_0__["default"])(this.zone, this.long0); 32620 if (zone === undefined) { 32621 throw new Error('unknown utm zone'); 32622 } 32623 this.lat0 = 0; 32624 this.long0 = ((6 * Math.abs(zone)) - 183) * _constants_values__WEBPACK_IMPORTED_MODULE_2__["D2R"]; 32625 this.x0 = 500000; 32626 this.y0 = this.utmSouth ? 10000000 : 0; 32627 this.k0 = 0.9996; 32628 32629 _etmerc__WEBPACK_IMPORTED_MODULE_1__["default"].init.apply(this); 32630 this.forward = _etmerc__WEBPACK_IMPORTED_MODULE_1__["default"].forward; 32631 this.inverse = _etmerc__WEBPACK_IMPORTED_MODULE_1__["default"].inverse; 32632} 32633 32634var names = ["Universal Transverse Mercator System", "utm"]; 32635/* harmony default export */ __webpack_exports__["default"] = ({ 32636 init: init, 32637 names: names, 32638 dependsOn: dependsOn 32639}); 32640 32641 32642/***/ }), 32643
vendor: 4,925 bytes, lines 32644-32792
32644/***/ "./node_modules/proj4/lib/projections/vandg.js": 32645/*!*****************************************************!*\ 32646 !*** ./node_modules/proj4/lib/projections/vandg.js ***! 32647 \*****************************************************/ 32648/*! exports provided: init, forward, inverse, names, default */ 32649/***/ (function(module, __webpack_exports__, __webpack_require__) { 32650 32651"use strict"; 32652__webpack_require__.r(__webpack_exports__); 32653/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); 32654/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forward", function() { return forward; }); 32655/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inverse", function() { return inverse; }); 32656/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "names", function() { return names; }); 32657/* harmony import */ var _common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/adjust_lon */ "./node_modules/proj4/lib/common/adjust_lon.js"); 32658/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/values */ "./node_modules/proj4/lib/constants/values.js"); 32659/* harmony import */ var _common_asinz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/asinz */ "./node_modules/proj4/lib/common/asinz.js"); 32660 32661 32662 32663 32664 32665 32666/* Initialize the Van Der Grinten projection 32667 ----------------------------------------*/ 32668function init() { 32669 //this.R = 6370997; //Radius of earth 32670 this.R = this.a; 32671} 32672 32673function forward(p) { 32674 32675 var lon = p.x; 32676 var lat = p.y; 32677 32678 /* Forward equations 32679 -----------------*/ 32680 var dlon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(lon - this.long0); 32681 var x, y; 32682 32683 if (Math.abs(lat) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 32684 x = this.x0 + this.R * dlon; 32685 y = this.y0; 32686 } 32687 var theta = Object(_common_asinz__WEBPACK_IMPORTED_MODULE_2__["default"])(2 * Math.abs(lat / Math.PI)); 32688 if ((Math.abs(dlon) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) || (Math.abs(Math.abs(lat) - _constants_values__WEBPACK_IMPORTED_MODULE_1__["HALF_PI"]) <= _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"])) { 32689 x = this.x0; 32690 if (lat >= 0) { 32691 y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta); 32692 } 32693 else { 32694 y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta); 32695 } 32696 // return(OK); 32697 } 32698 var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI)); 32699 var asq = al * al; 32700 var sinth = Math.sin(theta); 32701 var costh = Math.cos(theta); 32702 32703 var g = costh / (sinth + costh - 1); 32704 var gsq = g * g; 32705 var m = g * (2 / sinth - 1); 32706 var msq = m * m; 32707 var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq); 32708 if (dlon < 0) { 32709 con = -con; 32710 } 32711 x = this.x0 + con; 32712 //con = Math.abs(con / (Math.PI * this.R)); 32713 var q = asq + g; 32714 con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq); 32715 if (lat >= 0) { 32716 //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con); 32717 y = this.y0 + con; 32718 } 32719 else { 32720 //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con); 32721 y = this.y0 - con; 32722 } 32723 p.x = x; 32724 p.y = y; 32725 return p; 32726} 32727 32728/* Van Der Grinten inverse equations--mapping x,y to lat/long 32729 ---------------------------------------------------------*/ 32730function inverse(p) { 32731 var lon, lat; 32732 var xx, yy, xys, c1, c2, c3; 32733 var a1; 32734 var m1; 32735 var con; 32736 var th1; 32737 var d; 32738 32739 /* inverse equations 32740 -----------------*/ 32741 p.x -= this.x0; 32742 p.y -= this.y0; 32743 con = Math.PI * this.R; 32744 xx = p.x / con; 32745 yy = p.y / con; 32746 xys = xx * xx + yy * yy; 32747 c1 = -Math.abs(yy) * (1 + xys); 32748 c2 = c1 - 2 * yy * yy + xx * xx; 32749 c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys; 32750 d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27; 32751 a1 = (c1 - c2 * c2 / 3 / c3) / c3; 32752 m1 = 2 * Math.sqrt(-a1 / 3); 32753 con = ((3 * d) / a1) / m1; 32754 if (Math.abs(con) > 1) { 32755 if (con >= 0) { 32756 con = 1; 32757 } 32758 else { 32759 con = -1; 32760 } 32761 } 32762 th1 = Math.acos(con) / 3; 32763 if (p.y >= 0) { 32764 lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI; 32765 } 32766 else { 32767 lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI; 32768 } 32769 32770 if (Math.abs(xx) < _constants_values__WEBPACK_IMPORTED_MODULE_1__["EPSLN"]) { 32771 lon = this.long0; 32772 } 32773 else { 32774 lon = Object(_common_adjust_lon__WEBPACK_IMPORTED_MODULE_0__["default"])(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx); 32775 } 32776 32777 p.x = lon; 32778 p.y = lat; 32779 return p; 32780} 32781 32782var names = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"]; 32783/* harmony default export */ __webpack_exports__["default"] = ({ 32784 init: init, 32785 forward: forward, 32786 inverse: inverse, 32787 names: names 32788}); 32789 32790 32791/***/ }), 32792
vendor: 4,340 bytes, lines 32793-32904
32793/***/ "./node_modules/proj4/lib/transform.js": 32794/*!*********************************************!*\ 32795 !*** ./node_modules/proj4/lib/transform.js ***! 32796 \*********************************************/ 32797/*! exports provided: default */ 32798/***/ (function(module, __webpack_exports__, __webpack_require__) { 32799 32800"use strict"; 32801__webpack_require__.r(__webpack_exports__); 32802/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return transform; }); 32803/* harmony import */ var _constants_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants/values */ "./node_modules/proj4/lib/constants/values.js"); 32804/* harmony import */ var _datum_transform__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./datum_transform */ "./node_modules/proj4/lib/datum_transform.js"); 32805/* harmony import */ var _adjust_axis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./adjust_axis */ "./node_modules/proj4/lib/adjust_axis.js"); 32806/* harmony import */ var _Proj__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Proj */ "./node_modules/proj4/lib/Proj.js"); 32807/* harmony import */ var _common_toPoint__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./common/toPoint */ "./node_modules/proj4/lib/common/toPoint.js"); 32808/* harmony import */ var _checkSanity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./checkSanity */ "./node_modules/proj4/lib/checkSanity.js"); 32809 32810 32811 32812 32813 32814 32815 32816function checkNotWGS(source, dest) { 32817 return ((source.datum.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"] || source.datum.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_3PARAM"] || dest.datum.datum_type === _constants_values__WEBPACK_IMPORTED_MODULE_0__["PJD_7PARAM"]) && source.datumCode !== 'WGS84'); 32818} 32819 32820function transform(source, dest, point) { 32821 var wgs84; 32822 if (Array.isArray(point)) { 32823 point = Object(_common_toPoint__WEBPACK_IMPORTED_MODULE_4__["default"])(point); 32824 } 32825 Object(_checkSanity__WEBPACK_IMPORTED_MODULE_5__["default"])(point); 32826 // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84 32827 if (source.datum && dest.datum && checkNotWGS(source, dest)) { 32828 wgs84 = new _Proj__WEBPACK_IMPORTED_MODULE_3__["default"]('WGS84'); 32829 point = transform(source, wgs84, point); 32830 source = wgs84; 32831 } 32832 // DGR, 2010/11/12 32833 if (source.axis !== 'enu') { 32834 point = Object(_adjust_axis__WEBPACK_IMPORTED_MODULE_2__["default"])(source, false, point); 32835 } 32836 // Transform source points to long/lat, if they aren't already. 32837 if (source.projName === 'longlat') { 32838 point = { 32839 x: point.x * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"], 32840 y: point.y * _constants_values__WEBPACK_IMPORTED_MODULE_0__["D2R"], 32841 z: point.z || 0 32842 }; 32843 } else { 32844 if (source.to_meter) { 32845 point = { 32846 x: point.x * source.to_meter, 32847 y: point.y * source.to_meter, 32848 z: point.z || 0 32849 }; 32850 } 32851 point = source.inverse(point); // Convert Cartesian to longlat 32852 if (!point) { 32853 return; 32854 } 32855 } 32856 // Adjust for the prime meridian if necessary 32857 if (source.from_greenwich) { 32858 point.x += source.from_greenwich; 32859 } 32860 32861 // Convert datums if needed, and if possible. 32862 point = Object(_datum_transform__WEBPACK_IMPORTED_MODULE_1__["default"])(source.datum, dest.datum, point); 32863 if (!point) { 32864 return; 32865 } 32866 32867 // Adjust for the prime meridian if necessary 32868 if (dest.from_greenwich) { 32869 point = { 32870 x: point.x - dest.from_greenwich, 32871 y: point.y, 32872 z: point.z || 0 32873 }; 32874 } 32875 32876 if (dest.projName === 'longlat') { 32877 // convert radians to decimal degrees 32878 point = { 32879 x: point.x * _constants_values__WEBPACK_IMPORTED_MODULE_0__["R2D"], 32880 y: point.y * _constants_values__WEBPACK_IMPORTED_MODULE_0__["R2D"], 32881 z: point.z || 0 32882 }; 32883 } else { // else project 32884 point = dest.forward(point); 32885 if (dest.to_meter) { 32886 point = { 32887 x: point.x / dest.to_meter, 32888 y: point.y / dest.to_meter, 32889 z: point.z || 0 32890 }; 32891 } 32892 } 32893 32894 // DGR, 2010/11/12 32895 if (dest.axis !== 'enu') { 32896 return Object(_adjust_axis__WEBPACK_IMPORTED_MODULE_2__["default"])(dest, true, point); 32897 } 32898 32899 return point; 32900} 32901 32902 32903/***/ }), 32904
vendor: 8,095 bytes, lines 32905-33002
32905/***/ "./node_modules/proj4/projs.js": 32906/*!*************************************!*\ 32907 !*** ./node_modules/proj4/projs.js ***! 32908 \*************************************/ 32909/*! exports provided: default */ 32910/***/ (function(module, __webpack_exports__, __webpack_require__) { 32911 32912"use strict"; 32913__webpack_require__.r(__webpack_exports__); 32914/* harmony import */ var _lib_projections_tmerc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/projections/tmerc */ "./node_modules/proj4/lib/projections/tmerc.js"); 32915/* harmony import */ var _lib_projections_etmerc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/projections/etmerc */ "./node_modules/proj4/lib/projections/etmerc.js"); 32916/* harmony import */ var _lib_projections_utm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/projections/utm */ "./node_modules/proj4/lib/projections/utm.js"); 32917/* harmony import */ var _lib_projections_sterea__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/projections/sterea */ "./node_modules/proj4/lib/projections/sterea.js"); 32918/* harmony import */ var _lib_projections_stere__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/projections/stere */ "./node_modules/proj4/lib/projections/stere.js"); 32919/* harmony import */ var _lib_projections_somerc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/projections/somerc */ "./node_modules/proj4/lib/projections/somerc.js"); 32920/* harmony import */ var _lib_projections_omerc__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/projections/omerc */ "./node_modules/proj4/lib/projections/omerc.js"); 32921/* harmony import */ var _lib_projections_lcc__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/projections/lcc */ "./node_modules/proj4/lib/projections/lcc.js"); 32922/* harmony import */ var _lib_projections_krovak__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lib/projections/krovak */ "./node_modules/proj4/lib/projections/krovak.js"); 32923/* harmony import */ var _lib_projections_cass__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lib/projections/cass */ "./node_modules/proj4/lib/projections/cass.js"); 32924/* harmony import */ var _lib_projections_laea__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./lib/projections/laea */ "./node_modules/proj4/lib/projections/laea.js"); 32925/* harmony import */ var _lib_projections_aea__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./lib/projections/aea */ "./node_modules/proj4/lib/projections/aea.js"); 32926/* harmony import */ var _lib_projections_gnom__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./lib/projections/gnom */ "./node_modules/proj4/lib/projections/gnom.js"); 32927/* harmony import */ var _lib_projections_cea__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./lib/projections/cea */ "./node_modules/proj4/lib/projections/cea.js"); 32928/* harmony import */ var _lib_projections_eqc__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./lib/projections/eqc */ "./node_modules/proj4/lib/projections/eqc.js"); 32929/* harmony import */ var _lib_projections_poly__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./lib/projections/poly */ "./node_modules/proj4/lib/projections/poly.js"); 32930/* harmony import */ var _lib_projections_nzmg__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./lib/projections/nzmg */ "./node_modules/proj4/lib/projections/nzmg.js"); 32931/* harmony import */ var _lib_projections_mill__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./lib/projections/mill */ "./node_modules/proj4/lib/projections/mill.js"); 32932/* harmony import */ var _lib_projections_sinu__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./lib/projections/sinu */ "./node_modules/proj4/lib/projections/sinu.js"); 32933/* harmony import */ var _lib_projections_moll__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./lib/projections/moll */ "./node_modules/proj4/lib/projections/moll.js"); 32934/* harmony import */ var _lib_projections_eqdc__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./lib/projections/eqdc */ "./node_modules/proj4/lib/projections/eqdc.js"); 32935/* harmony import */ var _lib_projections_vandg__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./lib/projections/vandg */ "./node_modules/proj4/lib/projections/vandg.js"); 32936/* harmony import */ var _lib_projections_aeqd__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./lib/projections/aeqd */ "./node_modules/proj4/lib/projections/aeqd.js"); 32937/* harmony import */ var _lib_projections_ortho__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./lib/projections/ortho */ "./node_modules/proj4/lib/projections/ortho.js"); 32938/* harmony import */ var _lib_projections_qsc__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./lib/projections/qsc */ "./node_modules/proj4/lib/projections/qsc.js"); 32939/* harmony import */ var _lib_projections_robin__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./lib/projections/robin */ "./node_modules/proj4/lib/projections/robin.js"); 32940/* harmony import */ var _lib_projections_geocent__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./lib/projections/geocent */ "./node_modules/proj4/lib/projections/geocent.js"); 32941/* harmony import */ var _lib_projections_tpers__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./lib/projections/tpers */ "./node_modules/proj4/lib/projections/tpers.js"); 32942 32943 32944 32945 32946 32947 32948 32949 32950 32951 32952 32953 32954 32955 32956 32957 32958 32959 32960 32961 32962 32963 32964 32965 32966 32967 32968 32969 32970/* harmony default export */ __webpack_exports__["default"] = (function(proj4){ 32971 proj4.Proj.projections.add(_lib_projections_tmerc__WEBPACK_IMPORTED_MODULE_0__["default"]); 32972 proj4.Proj.projections.add(_lib_projections_etmerc__WEBPACK_IMPORTED_MODULE_1__["default"]); 32973 proj4.Proj.projections.add(_lib_projections_utm__WEBPACK_IMPORTED_MODULE_2__["default"]); 32974 proj4.Proj.projections.add(_lib_projections_sterea__WEBPACK_IMPORTED_MODULE_3__["default"]); 32975 proj4.Proj.projections.add(_lib_projections_stere__WEBPACK_IMPORTED_MODULE_4__["default"]); 32976 proj4.Proj.projections.add(_lib_projections_somerc__WEBPACK_IMPORTED_MODULE_5__["default"]); 32977 proj4.Proj.projections.add(_lib_projections_omerc__WEBPACK_IMPORTED_MODULE_6__["default"]); 32978 proj4.Proj.projections.add(_lib_projections_lcc__WEBPACK_IMPORTED_MODULE_7__["default"]); 32979 proj4.Proj.projections.add(_lib_projections_krovak__WEBPACK_IMPORTED_MODULE_8__["default"]); 32980 proj4.Proj.projections.add(_lib_projections_cass__WEBPACK_IMPORTED_MODULE_9__["default"]); 32981 proj4.Proj.projections.add(_lib_projections_laea__WEBPACK_IMPORTED_MODULE_10__["default"]); 32982 proj4.Proj.projections.add(_lib_projections_aea__WEBPACK_IMPORTED_MODULE_11__["default"]); 32983 proj4.Proj.projections.add(_lib_projections_gnom__WEBPACK_IMPORTED_MODULE_12__["default"]); 32984 proj4.Proj.projections.add(_lib_projections_cea__WEBPACK_IMPORTED_MODULE_13__["default"]); 32985 proj4.Proj.projections.add(_lib_projections_eqc__WEBPACK_IMPORTED_MODULE_14__["default"]); 32986 proj4.Proj.projections.add(_lib_projections_poly__WEBPACK_IMPORTED_MODULE_15__["default"]); 32987 proj4.Proj.projections.add(_lib_projections_nzmg__WEBPACK_IMPORTED_MODULE_16__["default"]); 32988 proj4.Proj.projections.add(_lib_projections_mill__WEBPACK_IMPORTED_MODULE_17__["default"]); 32989 proj4.Proj.projections.add(_lib_projections_sinu__WEBPACK_IMPORTED_MODULE_18__["default"]); 32990 proj4.Proj.projections.add(_lib_projections_moll__WEBPACK_IMPORTED_MODULE_19__["default"]); 32991 proj4.Proj.projections.add(_lib_projections_eqdc__WEBPACK_IMPORTED_MODULE_20__["default"]); 32992 proj4.Proj.projections.add(_lib_projections_vandg__WEBPACK_IMPORTED_MODULE_21__["default"]); 32993 proj4.Proj.projections.add(_lib_projections_aeqd__WEBPACK_IMPORTED_MODULE_22__["default"]); 32994 proj4.Proj.projections.add(_lib_projections_ortho__WEBPACK_IMPORTED_MODULE_23__["default"]); 32995 proj4.Proj.projections.add(_lib_projections_qsc__WEBPACK_IMPORTED_MODULE_24__["default"]); 32996 proj4.Proj.projections.add(_lib_projections_robin__WEBPACK_IMPORTED_MODULE_25__["default"]); 32997 proj4.Proj.projections.add(_lib_projections_geocent__WEBPACK_IMPORTED_MODULE_26__["default"]); 32998 proj4.Proj.projections.add(_lib_projections_tpers__WEBPACK_IMPORTED_MODULE_27__["default"]); 32999}); 33000 33001/***/ }), 33002
vendor: 7,990 bytes, lines 33003-33278
33003/***/ "./node_modules/proj4leaflet/src/proj4leaflet.js": 33004/*!*******************************************************!*\ 33005 !*** ./node_modules/proj4leaflet/src/proj4leaflet.js ***! 33006 \*******************************************************/ 33007/*! no static exports found */ 33008/***/ (function(module, exports, __webpack_require__) { 33009 33010var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (factory) { 33011 var L, proj4; 33012 if (true) { 33013 // AMD 33014 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"), __webpack_require__(/*! proj4 */ "./node_modules/proj4/lib/index.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 33015 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 33016 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 33017 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 33018 } else {} 33019}(function (L, proj4) { 33020 if (proj4.__esModule && proj4.default) { 33021 // If proj4 was bundled as an ES6 module, unwrap it to get 33022 // to the actual main proj4 object. 33023 // See discussion in https://github.com/kartena/Proj4Leaflet/pull/147 33024 proj4 = proj4.default; 33025 } 33026 33027 L.Proj = {}; 33028 33029 L.Proj._isProj4Obj = function(a) { 33030 return (typeof a.inverse !== 'undefined' && 33031 typeof a.forward !== 'undefined'); 33032 }; 33033 33034 L.Proj.Projection = L.Class.extend({ 33035 initialize: function(code, def, bounds) { 33036 var isP4 = L.Proj._isProj4Obj(code); 33037 this._proj = isP4 ? code : this._projFromCodeDef(code, def); 33038 this.bounds = isP4 ? def : bounds; 33039 }, 33040 33041 project: function (latlng) { 33042 var point = this._proj.forward([latlng.lng, latlng.lat]); 33043 return new L.Point(point[0], point[1]); 33044 }, 33045 33046 unproject: function (point, unbounded) { 33047 var point2 = this._proj.inverse([point.x, point.y]); 33048 return new L.LatLng(point2[1], point2[0], unbounded); 33049 }, 33050 33051 _projFromCodeDef: function(code, def) { 33052 if (def) { 33053 proj4.defs(code, def); 33054 } else if (proj4.defs[code] === undefined) { 33055 var urn = code.split(':'); 33056 if (urn.length > 3) { 33057 code = urn[urn.length - 3] + ':' + urn[urn.length - 1]; 33058 } 33059 if (proj4.defs[code] === undefined) { 33060 throw 'No projection definition for code ' + code; 33061 } 33062 } 33063 33064 return proj4(code); 33065 } 33066 }); 33067 33068 L.Proj.CRS = L.Class.extend({ 33069 includes: L.CRS, 33070 33071 options: { 33072 transformation: new L.Transformation(1, 0, -1, 0) 33073 }, 33074 33075 initialize: function(a, b, c) { 33076 var code, 33077 proj, 33078 def, 33079 options; 33080 33081 if (L.Proj._isProj4Obj(a)) { 33082 proj = a; 33083 code = proj.srsCode; 33084 options = b || {}; 33085 33086 this.projection = new L.Proj.Projection(proj, options.bounds); 33087 } else { 33088 code = a; 33089 def = b; 33090 options = c || {}; 33091 this.projection = new L.Proj.Projection(code, def, options.bounds); 33092 } 33093 33094 L.Util.setOptions(this, options); 33095 this.code = code; 33096 this.transformation = this.options.transformation; 33097 33098 if (this.options.origin) { 33099 this.transformation = 33100 new L.Transformation(1, -this.options.origin[0], 33101 -1, this.options.origin[1]); 33102 } 33103 33104 if (this.options.scales) { 33105 this._scales = this.options.scales; 33106 } else if (this.options.resolutions) { 33107 this._scales = []; 33108 for (var i = this.options.resolutions.length - 1; i >= 0; i--) { 33109 if (this.options.resolutions[i]) { 33110 this._scales[i] = 1 / this.options.resolutions[i]; 33111 } 33112 } 33113 } 33114 33115 this.infinite = !this.options.bounds; 33116 33117 }, 33118 33119 scale: function(zoom) { 33120 var iZoom = Math.floor(zoom), 33121 baseScale, 33122 nextScale, 33123 scaleDiff, 33124 zDiff; 33125 if (zoom === iZoom) { 33126 return this._scales[zoom]; 33127 } else { 33128 // Non-integer zoom, interpolate 33129 baseScale = this._scales[iZoom]; 33130 nextScale = this._scales[iZoom + 1]; 33131 scaleDiff = nextScale - baseScale; 33132 zDiff = (zoom - iZoom); 33133 return baseScale + scaleDiff * zDiff; 33134 } 33135 }, 33136 33137 zoom: function(scale) { 33138 // Find closest number in this._scales, down 33139 var downScale = this._closestElement(this._scales, scale), 33140 downZoom = this._scales.indexOf(downScale), 33141 nextScale, 33142 nextZoom, 33143 scaleDiff; 33144 // Check if scale is downScale => return array index 33145 if (scale === downScale) { 33146 return downZoom; 33147 } 33148 if (downScale === undefined) { 33149 return -Infinity; 33150 } 33151 // Interpolate 33152 nextZoom = downZoom + 1; 33153 nextScale = this._scales[nextZoom]; 33154 if (nextScale === undefined) { 33155 return Infinity; 33156 } 33157 scaleDiff = nextScale - downScale; 33158 return (scale - downScale) / scaleDiff + downZoom; 33159 }, 33160 33161 distance: L.CRS.Earth.distance, 33162 33163 R: L.CRS.Earth.R, 33164 33165 /* Get the closest lowest element in an array */ 33166 _closestElement: function(array, element) { 33167 var low; 33168 for (var i = array.length; i--;) { 33169 if (array[i] <= element && (low === undefined || low < array[i])) { 33170 low = array[i]; 33171 } 33172 } 33173 return low; 33174 } 33175 }); 33176 33177 L.Proj.GeoJSON = L.GeoJSON.extend({ 33178 initialize: function(geojson, options) { 33179 this._callLevel = 0; 33180 L.GeoJSON.prototype.initialize.call(this, geojson, options); 33181 }, 33182 33183 addData: function(geojson) { 33184 var crs; 33185 33186 if (geojson) { 33187 if (geojson.crs && geojson.crs.type === 'name') { 33188 crs = new L.Proj.CRS(geojson.crs.properties.name); 33189 } else if (geojson.crs && geojson.crs.type) { 33190 crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code); 33191 } 33192 33193 if (crs !== undefined) { 33194 this.options.coordsToLatLng = function(coords) { 33195 var point = L.point(coords[0], coords[1]); 33196 return crs.projection.unproject(point); 33197 }; 33198 } 33199 } 33200 33201 // Base class' addData might call us recursively, but 33202 // CRS shouldn't be cleared in that case, since CRS applies 33203 // to the whole GeoJSON, inluding sub-features. 33204 this._callLevel++; 33205 try { 33206 L.GeoJSON.prototype.addData.call(this, geojson); 33207 } finally { 33208 this._callLevel--; 33209 if (this._callLevel === 0) { 33210 delete this.options.coordsToLatLng; 33211 } 33212 } 33213 } 33214 }); 33215 33216 L.Proj.geoJson = function(geojson, options) { 33217 return new L.Proj.GeoJSON(geojson, options); 33218 }; 33219 33220 L.Proj.ImageOverlay = L.ImageOverlay.extend({ 33221 initialize: function (url, bounds, options) { 33222 L.ImageOverlay.prototype.initialize.call(this, url, null, options); 33223 this._projectedBounds = bounds; 33224 }, 33225 33226 // Danger ahead: Overriding internal methods in Leaflet. 33227 // Decided to do this rather than making a copy of L.ImageOverlay 33228 // and doing very tiny modifications to it. 33229 // Future will tell if this was wise or not. 33230 _animateZoom: function (event) { 33231 var scale = this._map.getZoomScale(event.zoom); 33232 var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y); 33233 var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center); 33234 33235 L.DomUtil.setTransform(this._image, offset, scale); 33236 }, 33237 33238 _reset: function () { 33239 var zoom = this._map.getZoom(); 33240 var pixelOrigin = this._map.getPixelOrigin(); 33241 var bounds = L.bounds( 33242 this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin), 33243 this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin) 33244 ); 33245 var size = bounds.getSize(); 33246 33247 L.DomUtil.setPosition(this._image, bounds.min); 33248 this._image.style.width = size.x + 'px'; 33249 this._image.style.height = size.y + 'px'; 33250 }, 33251 33252 _projectedToNewLayerPoint: function (point, zoom, center) { 33253 var viewHalf = this._map.getSize()._divideBy(2); 33254 var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round(); 33255 var topLeft = newTopLeft.add(this._map._getMapPanePos()); 33256 33257 return this._transform(point, zoom)._subtract(topLeft); 33258 }, 33259 33260 _transform: function (point, zoom) { 33261 var crs = this._map.options.crs; 33262 var transformation = crs.transformation; 33263 var scale = crs.scale(zoom); 33264 33265 return transformation.transform(point, scale); 33266 } 33267 }); 33268 33269 L.Proj.imageOverlay = function (url, bounds, options) { 33270 return new L.Proj.ImageOverlay(url, bounds, options); 33271 }; 33272 33273 return L.Proj; 33274})); 33275 33276 33277/***/ }), 33278
vendor: 6,481 bytes, lines 33279-33486
33279/***/ "./node_modules/wkt-parser/index.js": 33280/*!******************************************!*\ 33281 !*** ./node_modules/wkt-parser/index.js ***! 33282 \******************************************/ 33283/*! exports provided: default */ 33284/***/ (function(module, __webpack_exports__, __webpack_require__) { 33285 33286"use strict"; 33287__webpack_require__.r(__webpack_exports__); 33288/* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parser */ "./node_modules/wkt-parser/parser.js"); 33289/* harmony import */ var _process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./process */ "./node_modules/wkt-parser/process.js"); 33290var D2R = 0.01745329251994329577; 33291 33292 33293 33294 33295 33296function rename(obj, params) { 33297 var outName = params[0]; 33298 var inName = params[1]; 33299 if (!(outName in obj) && (inName in obj)) { 33300 obj[outName] = obj[inName]; 33301 if (params.length === 3) { 33302 obj[outName] = params[2](obj[outName]); 33303 } 33304 } 33305} 33306 33307function d2r(input) { 33308 return input * D2R; 33309} 33310 33311function cleanWKT(wkt) { 33312 if (wkt.type === 'GEOGCS') { 33313 wkt.projName = 'longlat'; 33314 } else if (wkt.type === 'LOCAL_CS') { 33315 wkt.projName = 'identity'; 33316 wkt.local = true; 33317 } else { 33318 if (typeof wkt.PROJECTION === 'object') { 33319 wkt.projName = Object.keys(wkt.PROJECTION)[0]; 33320 } else { 33321 wkt.projName = wkt.PROJECTION; 33322 } 33323 } 33324 if (wkt.AXIS) { 33325 var axisOrder = ''; 33326 for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) { 33327 var axis = wkt.AXIS[i]; 33328 var descriptor = axis[0].toLowerCase(); 33329 if (descriptor.indexOf('north') !== -1) { 33330 axisOrder += 'n'; 33331 } else if (descriptor.indexOf('south') !== -1) { 33332 axisOrder += 's'; 33333 } else if (descriptor.indexOf('east') !== -1) { 33334 axisOrder += 'e'; 33335 } else if (descriptor.indexOf('west') !== -1) { 33336 axisOrder += 'w'; 33337 } 33338 } 33339 if (axisOrder.length === 2) { 33340 axisOrder += 'u'; 33341 } 33342 if (axisOrder.length === 3) { 33343 wkt.axis = axisOrder; 33344 } 33345 } 33346 if (wkt.UNIT) { 33347 wkt.units = wkt.UNIT.name.toLowerCase(); 33348 if (wkt.units === 'metre') { 33349 wkt.units = 'meter'; 33350 } 33351 if (wkt.UNIT.convert) { 33352 if (wkt.type === 'GEOGCS') { 33353 if (wkt.DATUM && wkt.DATUM.SPHEROID) { 33354 wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a; 33355 } 33356 } else { 33357 wkt.to_meter = wkt.UNIT.convert; 33358 } 33359 } 33360 } 33361 var geogcs = wkt.GEOGCS; 33362 if (wkt.type === 'GEOGCS') { 33363 geogcs = wkt; 33364 } 33365 if (geogcs) { 33366 //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){ 33367 // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R; 33368 //} 33369 if (geogcs.DATUM) { 33370 wkt.datumCode = geogcs.DATUM.name.toLowerCase(); 33371 } else { 33372 wkt.datumCode = geogcs.name.toLowerCase(); 33373 } 33374 if (wkt.datumCode.slice(0, 2) === 'd_') { 33375 wkt.datumCode = wkt.datumCode.slice(2); 33376 } 33377 if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') { 33378 wkt.datumCode = 'nzgd49'; 33379 } 33380 if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') { 33381 if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') { 33382 wkt.sphere = true; 33383 } 33384 wkt.datumCode = 'wgs84'; 33385 } 33386 if (wkt.datumCode.slice(-6) === '_ferro') { 33387 wkt.datumCode = wkt.datumCode.slice(0, - 6); 33388 } 33389 if (wkt.datumCode.slice(-8) === '_jakarta') { 33390 wkt.datumCode = wkt.datumCode.slice(0, - 8); 33391 } 33392 if (~wkt.datumCode.indexOf('belge')) { 33393 wkt.datumCode = 'rnb72'; 33394 } 33395 if (geogcs.DATUM && geogcs.DATUM.SPHEROID) { 33396 wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk'); 33397 if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') { 33398 wkt.ellps = 'intl'; 33399 } 33400 33401 wkt.a = geogcs.DATUM.SPHEROID.a; 33402 wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10); 33403 } 33404 33405 if (geogcs.DATUM && geogcs.DATUM.TOWGS84) { 33406 wkt.datum_params = geogcs.DATUM.TOWGS84; 33407 } 33408 if (~wkt.datumCode.indexOf('osgb_1936')) { 33409 wkt.datumCode = 'osgb36'; 33410 } 33411 if (~wkt.datumCode.indexOf('osni_1952')) { 33412 wkt.datumCode = 'osni52'; 33413 } 33414 if (~wkt.datumCode.indexOf('tm65') 33415 || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) { 33416 wkt.datumCode = 'ire65'; 33417 } 33418 if (wkt.datumCode === 'ch1903+') { 33419 wkt.datumCode = 'ch1903'; 33420 } 33421 if (~wkt.datumCode.indexOf('israel')) { 33422 wkt.datumCode = 'isr93'; 33423 } 33424 } 33425 if (wkt.b && !isFinite(wkt.b)) { 33426 wkt.b = wkt.a; 33427 } 33428 33429 function toMeter(input) { 33430 var ratio = wkt.to_meter || 1; 33431 return input * ratio; 33432 } 33433 var renamer = function(a) { 33434 return rename(wkt, a); 33435 }; 33436 var list = [ 33437 ['standard_parallel_1', 'Standard_Parallel_1'], 33438 ['standard_parallel_2', 'Standard_Parallel_2'], 33439 ['false_easting', 'False_Easting'], 33440 ['false_northing', 'False_Northing'], 33441 ['central_meridian', 'Central_Meridian'], 33442 ['latitude_of_origin', 'Latitude_Of_Origin'], 33443 ['latitude_of_origin', 'Central_Parallel'], 33444 ['scale_factor', 'Scale_Factor'], 33445 ['k0', 'scale_factor'], 33446 ['latitude_of_center', 'Latitude_Of_Center'], 33447 ['latitude_of_center', 'Latitude_of_center'], 33448 ['lat0', 'latitude_of_center', d2r], 33449 ['longitude_of_center', 'Longitude_Of_Center'], 33450 ['longitude_of_center', 'Longitude_of_center'], 33451 ['longc', 'longitude_of_center', d2r], 33452 ['x0', 'false_easting', toMeter], 33453 ['y0', 'false_northing', toMeter], 33454 ['long0', 'central_meridian', d2r], 33455 ['lat0', 'latitude_of_origin', d2r], 33456 ['lat0', 'standard_parallel_1', d2r], 33457 ['lat1', 'standard_parallel_1', d2r], 33458 ['lat2', 'standard_parallel_2', d2r], 33459 ['azimuth', 'Azimuth'], 33460 ['alpha', 'azimuth', d2r], 33461 ['srsCode', 'name'] 33462 ]; 33463 list.forEach(renamer); 33464 if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) { 33465 wkt.long0 = wkt.longc; 33466 } 33467 if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) { 33468 wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90); 33469 wkt.lat_ts = wkt.lat1; 33470 } 33471} 33472/* harmony default export */ __webpack_exports__["default"] = (function(wkt) { 33473 var lisp = Object(_parser__WEBPACK_IMPORTED_MODULE_0__["default"])(wkt); 33474 var type = lisp.shift(); 33475 var name = lisp.shift(); 33476 lisp.unshift(['name', name]); 33477 lisp.unshift(['type', type]); 33478 var obj = {}; 33479 Object(_process__WEBPACK_IMPORTED_MODULE_1__["sExpr"])(lisp, obj); 33480 cleanWKT(obj); 33481 return obj; 33482}); 33483 33484 33485/***/ }), 33486
vendor: 4,273 bytes, lines 33487-33668
33487/***/ "./node_modules/wkt-parser/parser.js": 33488/*!*******************************************!*\ 33489 !*** ./node_modules/wkt-parser/parser.js ***! 33490 \*******************************************/ 33491/*! exports provided: default */ 33492/***/ (function(module, __webpack_exports__, __webpack_require__) { 33493 33494"use strict"; 33495__webpack_require__.r(__webpack_exports__); 33496/* harmony default export */ __webpack_exports__["default"] = (parseString); 33497 33498var NEUTRAL = 1; 33499var KEYWORD = 2; 33500var NUMBER = 3; 33501var QUOTED = 4; 33502var AFTERQUOTE = 5; 33503var ENDED = -1; 33504var whitespace = /\s/; 33505var latin = /[A-Za-z]/; 33506var keyword = /[A-Za-z84]/; 33507var endThings = /[,\]]/; 33508var digets = /[\d\.E\-\+]/; 33509// const ignoredChar = /[\s_\-\/\(\)]/g; 33510function Parser(text) { 33511 if (typeof text !== 'string') { 33512 throw new Error('not a string'); 33513 } 33514 this.text = text.trim(); 33515 this.level = 0; 33516 this.place = 0; 33517 this.root = null; 33518 this.stack = []; 33519 this.currentObject = null; 33520 this.state = NEUTRAL; 33521} 33522Parser.prototype.readCharicter = function() { 33523 var char = this.text[this.place++]; 33524 if (this.state !== QUOTED) { 33525 while (whitespace.test(char)) { 33526 if (this.place >= this.text.length) { 33527 return; 33528 } 33529 char = this.text[this.place++]; 33530 } 33531 } 33532 switch (this.state) { 33533 case NEUTRAL: 33534 return this.neutral(char); 33535 case KEYWORD: 33536 return this.keyword(char) 33537 case QUOTED: 33538 return this.quoted(char); 33539 case AFTERQUOTE: 33540 return this.afterquote(char); 33541 case NUMBER: 33542 return this.number(char); 33543 case ENDED: 33544 return; 33545 } 33546}; 33547Parser.prototype.afterquote = function(char) { 33548 if (char === '"') { 33549 this.word += '"'; 33550 this.state = QUOTED; 33551 return; 33552 } 33553 if (endThings.test(char)) { 33554 this.word = this.word.trim(); 33555 this.afterItem(char); 33556 return; 33557 } 33558 throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place); 33559}; 33560Parser.prototype.afterItem = function(char) { 33561 if (char === ',') { 33562 if (this.word !== null) { 33563 this.currentObject.push(this.word); 33564 } 33565 this.word = null; 33566 this.state = NEUTRAL; 33567 return; 33568 } 33569 if (char === ']') { 33570 this.level--; 33571 if (this.word !== null) { 33572 this.currentObject.push(this.word); 33573 this.word = null; 33574 } 33575 this.state = NEUTRAL; 33576 this.currentObject = this.stack.pop(); 33577 if (!this.currentObject) { 33578 this.state = ENDED; 33579 } 33580 33581 return; 33582 } 33583}; 33584Parser.prototype.number = function(char) { 33585 if (digets.test(char)) { 33586 this.word += char; 33587 return; 33588 } 33589 if (endThings.test(char)) { 33590 this.word = parseFloat(this.word); 33591 this.afterItem(char); 33592 return; 33593 } 33594 throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place); 33595}; 33596Parser.prototype.quoted = function(char) { 33597 if (char === '"') { 33598 this.state = AFTERQUOTE; 33599 return; 33600 } 33601 this.word += char; 33602 return; 33603}; 33604Parser.prototype.keyword = function(char) { 33605 if (keyword.test(char)) { 33606 this.word += char; 33607 return; 33608 } 33609 if (char === '[') { 33610 var newObjects = []; 33611 newObjects.push(this.word); 33612 this.level++; 33613 if (this.root === null) { 33614 this.root = newObjects; 33615 } else { 33616 this.currentObject.push(newObjects); 33617 } 33618 this.stack.push(this.currentObject); 33619 this.currentObject = newObjects; 33620 this.state = NEUTRAL; 33621 return; 33622 } 33623 if (endThings.test(char)) { 33624 this.afterItem(char); 33625 return; 33626 } 33627 throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place); 33628}; 33629Parser.prototype.neutral = function(char) { 33630 if (latin.test(char)) { 33631 this.word = char; 33632 this.state = KEYWORD; 33633 return; 33634 } 33635 if (char === '"') { 33636 this.word = ''; 33637 this.state = QUOTED; 33638 return; 33639 } 33640 if (digets.test(char)) { 33641 this.word = char; 33642 this.state = NUMBER; 33643 return; 33644 } 33645 if (endThings.test(char)) { 33646 this.afterItem(char); 33647 return; 33648 } 33649 throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place); 33650}; 33651Parser.prototype.output = function() { 33652 while (this.place < this.text.length) { 33653 this.readCharicter(); 33654 } 33655 if (this.state === ENDED) { 33656 return this.root; 33657 } 33658 throw new Error('unable to parse string "' +this.text + '". State is ' + this.state); 33659}; 33660 33661function parseString(txt) { 33662 var parser = new Parser(txt); 33663 return parser.output(); 33664} 33665 33666 33667/***/ }), 33668
vendor: 2,548 bytes, lines 33669-33795
33669/***/ "./node_modules/wkt-parser/process.js": 33670/*!********************************************!*\ 33671 !*** ./node_modules/wkt-parser/process.js ***! 33672 \********************************************/ 33673/*! exports provided: sExpr */ 33674/***/ (function(module, __webpack_exports__, __webpack_require__) { 33675 33676"use strict"; 33677__webpack_require__.r(__webpack_exports__); 33678/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sExpr", function() { return sExpr; }); 33679 33680 33681function mapit(obj, key, value) { 33682 if (Array.isArray(key)) { 33683 value.unshift(key); 33684 key = null; 33685 } 33686 var thing = key ? {} : obj; 33687 33688 var out = value.reduce(function(newObj, item) { 33689 sExpr(item, newObj); 33690 return newObj 33691 }, thing); 33692 if (key) { 33693 obj[key] = out; 33694 } 33695} 33696 33697function sExpr(v, obj) { 33698 if (!Array.isArray(v)) { 33699 obj[v] = true; 33700 return; 33701 } 33702 var key = v.shift(); 33703 if (key === 'PARAMETER') { 33704 key = v.shift(); 33705 } 33706 if (v.length === 1) { 33707 if (Array.isArray(v[0])) { 33708 obj[key] = {}; 33709 sExpr(v[0], obj[key]); 33710 return; 33711 } 33712 obj[key] = v[0]; 33713 return; 33714 } 33715 if (!v.length) { 33716 obj[key] = true; 33717 return; 33718 } 33719 if (key === 'TOWGS84') { 33720 obj[key] = v; 33721 return; 33722 } 33723 if (key === 'AXIS') { 33724 if (!(key in obj)) { 33725 obj[key] = []; 33726 } 33727 obj[key].push(v); 33728 return; 33729 } 33730 if (!Array.isArray(key)) { 33731 obj[key] = {}; 33732 } 33733 33734 var i; 33735 switch (key) { 33736 case 'UNIT': 33737 case 'PRIMEM': 33738 case 'VERT_DATUM': 33739 obj[key] = { 33740 name: v[0].toLowerCase(), 33741 convert: v[1] 33742 }; 33743 if (v.length === 3) { 33744 sExpr(v[2], obj[key]); 33745 } 33746 return; 33747 case 'SPHEROID': 33748 case 'ELLIPSOID': 33749 obj[key] = { 33750 name: v[0], 33751 a: v[1], 33752 rf: v[2] 33753 }; 33754 if (v.length === 4) { 33755 sExpr(v[3], obj[key]); 33756 } 33757 return; 33758 case 'PROJECTEDCRS': 33759 case 'PROJCRS': 33760 case 'GEOGCS': 33761 case 'GEOCCS': 33762 case 'PROJCS': 33763 case 'LOCAL_CS': 33764 case 'GEODCRS': 33765 case 'GEODETICCRS': 33766 case 'GEODETICDATUM': 33767 case 'EDATUM': 33768 case 'ENGINEERINGDATUM': 33769 case 'VERT_CS': 33770 case 'VERTCRS': 33771 case 'VERTICALCRS': 33772 case 'COMPD_CS': 33773 case 'COMPOUNDCRS': 33774 case 'ENGINEERINGCRS': 33775 case 'ENGCRS': 33776 case 'FITTED_CS': 33777 case 'LOCAL_DATUM': 33778 case 'DATUM': 33779 v[0] = ['name', v[0]]; 33780 mapit(obj, key, v); 33781 return; 33782 default: 33783 i = -1; 33784 while (++i < v.length) { 33785 if (!Array.isArray(v[i])) { 33786 return sExpr(v, obj[key]); 33787 } 33788 } 33789 return mapit(obj, key, v); 33790 } 33791} 33792 33793 33794/***/ }), 33795
33796/***/ "./themes/user/reinos_maps/src/js/core.js": 33797/*!************************************************!*\ 33798 !*** ./themes/user/reinos_maps/src/js/core.js ***! 33799 \************************************************/ 33800/*! exports provided: ReinosMaps */ 33801/***/ (function(module, __webpack_exports__, __webpack_require__) { 33802 33803"use strict"; 33804__webpack_require__.r(__webpack_exports__); 33805/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReinosMaps", function() { return ReinosMaps; }); 33806/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 33807function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 33808 33809function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 33810 33811function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 33812 33813function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 33814 33815 33816var ReinosMaps = /*#__PURE__*/function () { 33817 function ReinosMaps() { 33818 _classCallCheck(this, ReinosMaps); 33819 33820 _defineProperty(this, "author_url", 'https://addons.reinos.nl/maps/'); 33821 33822 _defineProperty(this, "def", { 33823 lat: 34.5133, 33824 lng: -94.1629, 33825 circle: { 33826 'fit_circle': true, 33827 'stroke_color': '#BBD8E9', 33828 'stroke_opacity': 1, 33829 'stroke_weight': 3, 33830 'fill_color': '#BBD8E9', 33831 'fill_opacity': 0.6, 33832 'radius': 1000 33833 } 33834 }); 33835 33836 _defineProperty(this, "maps", new Map()); 33837 33838 _defineProperty(this, "positions", ['topleft', 'topright', 'bottomleft', 'bottomright']); 33839 33840 _defineProperty(this, "_firedEvents", {}); 33841 33842 _defineProperty(this, "latlngs", new Set()); 33843 33844 _defineProperty(this, "markers", new Map()); 33845 33846 _defineProperty(this, "polygons", new Map()); 33847 33848 _defineProperty(this, "polylines", new Map()); 33849 33850 _defineProperty(this, "rectangles", new Map()); 33851 33852 _defineProperty(this, "circles", new Map()); 33853 33854 _defineProperty(this, "apiLog", new Set()); 33855 33856 _defineProperty(this, "crs", _utils__WEBPACK_IMPORTED_MODULE_0__["crsCollection"]); 33857 33858 _defineProperty(this, "_geojson", { 33859 style: {} 33860 }); 33861 33862 _defineProperty(this, "leaflet", window.L); 33863 } 33864 33865 _createClass(ReinosMaps, [{ 33866 key: "setConfig", 33867 value: function setConfig() { 33868 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 33869 var _options$version = options.version; 33870 this.version = _options$version === void 0 ? '0.0.0' : _options$version; 33871 this.api_path = options.api_path; 33872 this.theme_path = options.theme_path; 33873 var _options$dev_mode = options.dev_mode; 33874 this.isDevMode = _options$dev_mode === void 0 ? false : _options$dev_mode; 33875 this.isDevMode = this.isDevMode === '1' || location.hash === '#maps_debug'; 33876 } 33877 }]); 33878 33879 return ReinosMaps; 33880}(); 33881 33882/***/ }), 33883
33884/***/ "./themes/user/reinos_maps/src/js/index.js": 33885/*!*************************************************!*\ 33886 !*** ./themes/user/reinos_maps/src/js/index.js ***! 33887 \*************************************************/ 33888/*! no exports provided */ 33889/***/ (function(module, __webpack_exports__, __webpack_require__) { 33890 33891"use strict"; 33892__webpack_require__.r(__webpack_exports__); 33893/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core */ "./themes/user/reinos_maps/src/js/core.js"); 33894/* harmony import */ var _maps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./maps */ "./themes/user/reinos_maps/src/js/maps/index.js"); 33895 33896 33897window.REINOS_MAPS = new _core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"](); 33898 33899/***/ }), 33900
33901/***/ "./themes/user/reinos_maps/src/js/libs/leaflet-kml.js": 33902/*!************************************************************!*\ 33903 !*** ./themes/user/reinos_maps/src/js/libs/leaflet-kml.js ***! 33904 \************************************************************/ 33905/*! no exports provided */ 33906/***/ (function(module, __webpack_exports__, __webpack_require__) { 33907 33908"use strict"; 33909__webpack_require__.r(__webpack_exports__); 33910/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 33911/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 33912/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 33913/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__); 33914 33915 33916leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KML = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.FeatureGroup.extend({ 33917 options: {}, 33918 initialize: function initialize(kml, options) { 33919 leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Util.setOptions(this, options); 33920 this._kml = kml; 33921 this._layers = {}; 33922 33923 if (kml) { 33924 this.addKML(kml, options); 33925 } 33926 }, 33927 loadXML: function loadXML(url, cb, options) { 33928 if (options === undefined) { 33929 options = this.options; 33930 } 33931 33932 axios__WEBPACK_IMPORTED_MODULE_1___default.a.get(url, { 33933 responseType: 'xml' 33934 }).then(function (response) { 33935 cb(response.request.responseXML, options); 33936 }); 33937 }, 33938 addKML: function addKML(url, options) { 33939 var _this = this; 33940 33941 var cb = function cb(gpx, options) { 33942 _this._addKML(gpx, options); 33943 }; 33944 33945 this.loadXML(url, cb, options); 33946 }, 33947 _addKML: function _addKML(xml) { 33948 var layers = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KML.parseKML(xml); 33949 33950 if (!layers || !layers.length) { 33951 return; 33952 } 33953 33954 for (var i = 0; i < layers.length; i++) { 33955 this.fire('addlayer', { 33956 layer: layers[i] 33957 }); 33958 this.addLayer(layers[i]); 33959 } 33960 33961 this.latLngs = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KML.getLatLngs(xml); 33962 this.fire('loaded'); 33963 }, 33964 latLngs: [] 33965}); 33966leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Util.extend(leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KML, { 33967 parseKML: function parseKML(xml) { 33968 var style = this.parseStyle(xml); 33969 var el = xml.getElementsByTagName('Folder'); 33970 var layers = []; 33971 var l; 33972 33973 for (var i = 0; i < el.length; i++) { 33974 if (!this._check_folder(el[i])) { 33975 continue; 33976 } 33977 33978 l = this.parseFolder(el[i], style); 33979 33980 if (l) { 33981 layers.push(l); 33982 } 33983 } 33984 33985 el = xml.getElementsByTagName('Placemark'); 33986 33987 for (var j = 0; j < el.length; j++) { 33988 if (!this._check_folder(el[j])) { 33989 continue; 33990 } 33991 33992 l = this.parsePlacemark(el[j], xml, style); 33993 33994 if (l) { 33995 layers.push(l); 33996 } 33997 } 33998 33999 return layers; 34000 }, 34001 // Return false if e's first parent Folder is not [folder] 34002 // - returns true if no parent Folders 34003 _check_folder: function _check_folder(e, folder) { 34004 e = e.parentElement; 34005 34006 while (e && e.tagName !== 'Folder') { 34007 e = e.parentElement; 34008 } 34009 34010 return !e || e === folder; 34011 }, 34012 parseStyle: function parseStyle(xml) { 34013 var style = {}; 34014 var sl = xml.getElementsByTagName('Style'); //for (var i = 0; i < sl.length; i++) { 34015 34016 var attributes = { 34017 color: true, 34018 width: true, 34019 Icon: true, 34020 href: true, 34021 hotSpot: true 34022 }; 34023 34024 function _parse(xml) { 34025 var options = {}; 34026 34027 for (var i = 0; i < xml.childNodes.length; i++) { 34028 var e = xml.childNodes[i]; 34029 var key = e.tagName; 34030 34031 if (!attributes[key]) { 34032 continue; 34033 } 34034 34035 if (key === 'hotSpot') { 34036 for (var j = 0; j < e.attributes.length; j++) { 34037 options[e.attributes[j].name] = e.attributes[j].nodeValue; 34038 } 34039 } else { 34040 var value = e.childNodes[0].nodeValue; 34041 34042 if (key === 'color') { 34043 options.opacity = parseInt(value.substring(0, 2), 16) / 25
340435.0; 34044 options.color = '#' + value.substring(2, 8); 34045 } else if (key === 'width') { 34046 options.weight = value; 34047 } else if (key === 'Icon') { 34048 var ioptions = _parse(e); 34049 34050 if (ioptions.href) { 34051 options.href = ioptions.href; 34052 } 34053 } else if (key === 'href') { 34054 options.href = value; 34055 } 34056 } 34057 } 34058 34059 return options; 34060 } 34061 34062 for (var i = 0; i < sl.length; i++) { 34063 var e = sl[i]; 34064 var el = void 0; 34065 var options = {}, 34066 poptions = {}, 34067 ioptions = {}; 34068 el = e.getElementsByTagName('LineStyle'); 34069 34070 if (el && el[0]) { 34071 options = _parse(el[0]); 34072 } 34073 34074 el = e.getElementsByTagName('PolyStyle'); 34075 34076 if (el && el[0]) { 34077 poptions = _parse(el[0]); 34078 } 34079 34080 if (poptions.color) { 34081 options.fillColor = poptions.color; 34082 } 34083 34084 if (poptions.opacity) { 34085 options.fillOpacity = poptions.opacity; 34086 } 34087 34088 el = e.getElementsByTagName('IconStyle'); 34089 34090 if (el && el[0]) { 34091 ioptions = _parse(el[0]); 34092 } 34093 34094 if (ioptions.href) { 34095 // save anchor info until the image is loaded 34096 options.icon = new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KMLIcon({ 34097 iconUrl: ioptions.href, 34098 shadowUrl: null, 34099 iconAnchorRef: { 34100 x: ioptions.x, 34101 y: ioptions.y 34102 }, 34103 iconAnchorType: { 34104 x: ioptions.xunits, 34105 y: ioptions.yunits 34106 } 34107 }); 34108 } 34109 34110 style['#' + e.getAttribute('id')] = options; 34111 } 34112 34113 return style; 34114 }, 34115 parseFolder: function parseFolder(xml, style) { 34116 var el; 34117 var layers = []; 34118 var l; 34119 el = xml.getElementsByTagName('Folder'); 34120 34121 for (var i = 0; i < el.length; i++) { 34122 if (!this._check_folder(el[i], xml)) { 34123 continue; 34124 } 34125 34126 l = this.parseFolder(el[i], style); 34127 34128 if (l) { 34129 layers.push(l); 34130 } 34131 } 34132 34133 el = xml.getElementsByTagName('Placemark'); 34134 34135 for (var j = 0; j < el.length; j++) { 34136 if (!this._check_folder(el[j], xml)) { 34137 continue; 34138 } 34139 34140 l = this.parsePlacemark(el[j], xml, style); 34141 34142 if (l) { 34143 layers.push(l); 34144 } 34145 } 34146 34147 if (!layers.length) { 34148 return; 34149 } 34150 34151 if (layers.length === 1) { 34152 return layers[0]; 34153 } 34154 34155 return new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.FeatureGroup(layers); 34156 }, 34157 parsePlacemark: function parsePlacemark(place, xml, style) { 34158 var i, j, el; 34159 var options = {}; 34160 el = place.getElementsByTagName('styleUrl'); 34161 34162 for (i = 0; i < el.length; i++) { 34163 var url = el[i].childNodes[0].nodeValue; 34164 34165 for (var a in style[url]) { 34166 options[a] = style[url][a]; 34167 } 34168 } 34169 34170 var layers = []; 34171 var parse = ['LineString', 'Polygon', 'Point']; 34172 34173 for (j in parse) { 34174 var tag = parse[j]; 34175 el = place.getElementsByTagName(tag); 34176 34177 for (i = 0; i < el.length; i++) { 34178 var l = this['parse' + tag](el[i], xml, options); 34179 34180 if (l) { 34181 layers.push(l); 34182 } 34183 } 34184 } 34185 34186 if (!layers.length) { 34187 return; 34188 } 34189 34190 var layer = layers[0]; 34191 34192 if (layers.length > 1) { 34193 layer = new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.FeatureGroup(layers); 34194 } 34195 34196 var name, 34197 descr = ''; 34198 el = place.getElementsByTagName('name'); 34199 34200 if (el.length) { 34201 name = el[0].childNodes[0].nodeValue; 34202 } 34203 34204 el = place.getElementsByTagName('description'); 34205 34206 for (i = 0; i < el.length; i++) { 34207 for (j = 0; j < el[i].childNodes.length; j++) { 34208 descr = descr + el[i].childNodes[j].nodeValue; 34209 } 34210 } 34211 34212 if (name) { 34213 layer.bindPopup('<h2>' + name + '</h2>' + descr); 34214 } 34215 34216 return layer; 34217 }, 34218 parseCoords: function parseCoords(xml) { 34219 var el = xml.getElementsByTagName('coordinates'); 34220 return this._read_coords(el[0]); 34221 }, 34222 parseLineString: function parseLineString(line, xml, options) { 34223 var coords = this.parseCoords(line); 34224 34225 if (!coords.length) { 34226 return; 34227 } 34228 34229 return new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Polyline(coords, options); 34230 }, 34231 parsePoint: function parsePoint(line, xml, options) { 34232 var el = line.getElementsByTagName('coordinates'); 34233 34234 if (!el.length) { 34235 return; 34236 } 34237 34238 var ll = el[0].childNodes[0].nodeValue.split(','); 34239 return new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KMLMarker(new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.LatLng(ll[1], ll[0]), options); 34240 },
34241 parsePolygon: function parsePolygon(line, xml, options) { 34242 var el, 34243 inner = [], 34244 coords; 34245 var polys = []; 34246 el = line.getElementsByTagName('outerBoundaryIs'); 34247 34248 for (var i = 0; i < el.length; i++) { 34249 coords = this.parseCoords(el[i]); 34250 34251 if (coords) { 34252 polys.push(coords); 34253 } 34254 } 34255 34256 el = line.getElementsByTagName('innerBoundaryIs'); 34257 34258 for (var _i = 0; _i < el.length; _i++) { 34259 coords = this.parseCoords(el[_i]); 34260 34261 if (coords) { 34262 inner.push(coords); 34263 } 34264 } 34265 34266 if (!polys.length) { 34267 return; 34268 } 34269 34270 if (options.fillColor) { 34271 options.fill = true; 34272 } 34273 34274 if (polys.length === 1) { 34275 return new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Polygon(polys.concat(inner), options); 34276 } 34277 34278 return new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.MultiPolygon(polys, options); 34279 }, 34280 getLatLngs: function getLatLngs(xml) { 34281 var el = xml.getElementsByTagName('coordinates'); 34282 var coords = []; 34283 34284 for (var j = 0; j < el.length; j++) { 34285 // text might span many childnodes 34286 coords = coords.concat(this._read_coords(el[j])); 34287 } 34288 34289 return coords; 34290 }, 34291 _read_coords: function _read_coords(el) { 34292 var text = '', 34293 coords = []; 34294 34295 for (var i = 0; i < el.childNodes.length; i++) { 34296 text = text + el.childNodes[i].nodeValue; 34297 } 34298 34299 text = text.split(/[\s\n]+/); 34300 34301 for (var _i2 = 0; _i2 < text.length; _i2++) { 34302 var ll = text[_i2].split(','); 34303 34304 if (ll.length < 2) { 34305 continue; 34306 } 34307 34308 coords.push(new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.LatLng(ll[1], ll[0])); 34309 } 34310 34311 return coords; 34312 } 34313}); 34314leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KMLIcon = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.extend({ 34315 createIcon: function createIcon() { 34316 var img = this._createIcon('icon'); 34317 34318 img.onload = function () { 34319 var i = new Image(); 34320 i.src = this.src; 34321 this.style.width = i.width + 'px'; 34322 this.style.height = i.height + 'px'; 34323 34324 if (this.anchorType.x === 'UNITS_FRACTION' || this.anchorType.x === 'fraction') { 34325 img.style.marginLeft = -this.anchor.x * i.width + 'px'; 34326 } 34327 34328 if (this.anchorType.y === 'UNITS_FRACTION' || this.anchorType.x === 'fraction') { 34329 img.style.marginTop = -(1 - this.anchor.y) * i.height + 'px'; 34330 } 34331 34332 this.style.display = ''; 34333 }; 34334 34335 return img; 34336 }, 34337 _setIconStyles: function _setIconStyles(img, name) { 34338 leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.prototype._setIconStyles.apply(this, [img, name]); // save anchor information to the image 34339 34340 34341 img.anchor = this.options.iconAnchorRef; 34342 img.anchorType = this.options.iconAnchorType; 34343 } 34344}); 34345leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KMLMarker = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Marker.extend({ 34346 options: { 34347 icon: new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KMLIcon.Default() 34348 } 34349}); 34350 34351/***/ }), 34352
34353/***/ "./themes/user/reinos_maps/src/js/maps/addTiles.js": 34354/*!*********************************************************!*\ 34355 !*** ./themes/user/reinos_maps/src/js/maps/addTiles.js ***! 34356 \*********************************************************/ 34357/*! no exports provided */ 34358/***/ (function(module, __webpack_exports__, __webpack_require__) { 34359 34360"use strict"; 34361__webpack_require__.r(__webpack_exports__); 34362/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 34363/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 34364/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_1__); 34365/* harmony import */ var leaflet_gridlayer_googlemutant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! leaflet.gridlayer.googlemutant */ "./node_modules/leaflet.gridlayer.googlemutant/Leaflet.GoogleMutant.js"); 34366/* harmony import */ var leaflet_gridlayer_googlemutant__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(leaflet_gridlayer_googlemutant__WEBPACK_IMPORTED_MODULE_2__); 34367/* harmony import */ var leaflet_mapkitmutant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! leaflet.mapkitmutant */ "./node_modules/leaflet.mapkitmutant/Leaflet.MapkitMutant.js"); 34368/* harmony import */ var leaflet_mapkitmutant__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(leaflet_mapkitmutant__WEBPACK_IMPORTED_MODULE_3__); 34369/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 34370/* harmony import */ var _tiles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tiles */ "./themes/user/reinos_maps/src/js/maps/tiles/index.js"); 34371 34372 34373 34374 34375 34376 34377 34378_core__WEBPACK_IMPORTED_MODULE_4__["ReinosMaps"].prototype.addTiles = function (map, tilesObject, google_styled_map, tile_control_position) { 34379 // decode back 34380 tilesObject = JSON.parse(Object(_utils__WEBPACK_IMPORTED_MODULE_0__["base64Decode"])(tilesObject)); 34381 google_styled_map = google_styled_map || null; 34382 tile_control_position = tile_control_position || 'topright'; 34383 var tiles = {}; 34384 tilesObject.forEach(function (tile, index) { 34385 var tileLayer = {}; 34386 34387 if (tile.name.match('google')) { 34388 tileLayer = Object(_tiles__WEBPACK_IMPORTED_MODULE_5__["addGoogleTile"])(tile, google_styled_map); 34389 } else if (tile.name.match('apple')) { 34390 tileLayer = Object(_tiles__WEBPACK_IMPORTED_MODULE_5__["addAppleMapsTile"])(tile); 34391 } else { 34392 tile.options['apikey'] = tile.api_key; 34393 tileLayer = Object(_tiles__WEBPACK_IMPORTED_MODULE_5__["addTile"])(tile); 34394 } 34395 34396 if (index === 0) { 34397 var minZoom = map.raw_options.min_zoom ? map.raw_options.min_zoom : tileLayer.options.minZoom; 34398 var maxZoom = map.raw_options.max_zoom ? map.raw_options.max_zoom : tileLayer.options.maxZoom; 34399 map.map.addLayer(tileLayer); 34400 map.map.setMinZoom(minZoom); 34401 map.map.setMaxZoom(maxZoom); 34402 } 34403 34404 tiles[tileLayer.label] = tileLayer; 34405 }); //save the tiles 34406 34407 map.tiles = tiles; 34408 map.tilesPosition = Object.keys(tiles).map(function (tileName) { 34409 return tileName; 34410 }); //add the tiles layers as a group if there are more then 1 34411 34412 map.tileControl = null; 34413 34414 if (tilesObject.length > 1) { 34415 map.tileControl = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.control.layers(tiles, {}, { 34416 position: tile_control_position 34417 }).addTo(map.map); 34418 map.map.on('baselayerchange', function (e) { 34419 var minZoom = map.raw_options.min_zoom ? map.raw_options.min_zoom : e.layer.options.minZoom; 34420 var maxZoom = map.raw_options.max_zoom ? map.raw_options.max_zoom : e.layer.options.maxZoom; 34421 map.map.setMinZoom(minZoom); 34422 map.map.setMaxZoom(maxZoom); 34423 }); 34424 } 34425}; 34426 34427/***/ }), 34428
vendor: 4,410 bytes, lines 34429-34463
34429/***/ "./themes/user/reinos_maps/src/js/maps/api/api.js": 34430/*!********************************************************!*\ 34431 !*** ./themes/user/reinos_maps/src/js/maps/api/api.js ***! 34432 \********************************************************/ 34433/*! no exports provided */ 34434/***/ (function(module, __webpack_exports__, __webpack_require__) { 34435 34436"use strict"; 34437__webpack_require__.r(__webpack_exports__); 34438/* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./map */ "./themes/user/reinos_maps/src/js/maps/api/map/index.js"); 34439/* harmony import */ var _marker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./marker */ "./themes/user/reinos_maps/src/js/maps/api/marker/index.js"); 34440/* harmony import */ var _circle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./circle */ "./themes/user/reinos_maps/src/js/maps/api/circle/index.js"); 34441/* harmony import */ var _rectangle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rectangle */ "./themes/user/reinos_maps/src/js/maps/api/rectangle/index.js"); 34442/* harmony import */ var _polygon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./polygon */ "./themes/user/reinos_maps/src/js/maps/api/polygon/index.js"); 34443/* harmony import */ var _polyline__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./polyline */ "./themes/user/reinos_maps/src/js/maps/api/polyline/index.js"); 34444/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils */ "./themes/user/reinos_maps/src/js/maps/api/utils/index.js"); 34445/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 34446/* harmony import */ var _map_zoomOut__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./map/zoomOut */ "./themes/user/reinos_maps/src/js/maps/api/map/zoomOut.js"); 34447/* harmony import */ var _map_zoomIn__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./map/zoomIn */ "./themes/user/reinos_maps/src/js/maps/api/map/zoomIn.js"); 34448/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 34449function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 34450 34451function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 34452 34453function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 34454 34455function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 34456 34457function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 34458 34459function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 34460 34461function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 34462 34463function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); }
34463 else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 34464 34465function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 34466 34467 34468 34469 34470 34471 34472 34473 34474 34475 34476 34477 34478 34479_core__WEBPACK_IMPORTED_MODULE_7__["ReinosMaps"].prototype.api = function (type, options, callback) { 34480 var self = this; //no type 34481 34482 if (type === '') { 34483 Object(_utils__WEBPACK_IMPORTED_MODULE_10__["throwError"])('Type not defined'); 34484 return false; 34485 } //options 34486 34487 34488 options = _objectSpread({ 34489 mapID: '', 34490 key: '' 34491 }, options); 34492 Object.entries(options).forEach(function (_ref) { 34493 var _ref2 = _slicedToArray(_ref, 2), 34494 index = _ref2[0], 34495 v = _ref2[1]; 34496 34497 if (typeof v === 'string' && v.match('function:')) { 34498 var value = v; 34499 34500 options[index] = function () { 34501 eval(value.replace('function:', '')); 34502 }; 34503 } 34504 }); //set the vars 34505 34506 var mapID; 34507 var map; //set a default return value 34508 34509 var __returnValue; //set the mapID 34510 34511 34512 if (options.mapID !== '') { 34513 //set the mapID 34514 mapID = options.mapID; //delete options.mapID; 34515 //get the map 34516 34517 map = self.getMap(mapID); 34518 } //default callback function 34519 34520 34521 var executeCallback = function executeCallback(callback) { 34522 if (typeof callback === 'function') { 34523 callback(); 34524 } 34525 }; // log API Call in DEV mode 34526 34527 34528 if (self.isDevMode) { 34529 var stack = new Error(); 34530 self.apiLog.add({ 34531 method: type, 34532 options: _objectSpread({}, options), 34533 mapId: mapID, 34534 mapExists: !!map, 34535 code: "REINOS.api('".concat(type, "', ").concat(JSON.stringify(_objectSpread({}, options)), ")"), 34536 stack: stack.stack 34537 }); 34538 } //what do we do 34539 34540 34541 switch (type) { 34542 //------------------------------------------------------------------------ 34543 // Global map api 34544 //------------------------------------------------------------------------ 34545 // refresh the map 34546 case 'refresh': 34547 case 'redraw': 34548 Object(_map__WEBPACK_IMPORTED_MODULE_0__["apiRefresh"])(map); 34549 break; 34550 // set Zoom level 34551 34552 case 'setZoom': 34553 //is there a map 34554 Object(_map__WEBPACK_IMPORTED_MODULE_0__["apiSetZoom"])(map, options); 34555 break; 34556 // ZoomOut 34557 34558 case 'zoomOut': 34559 //is there a map 34560 Object(_map_zoomOut__WEBPACK_IMPORTED_MODULE_8__["apiZoomOut"])(map, options); 34561 break; 34562 // ZoomOut 34563 34564 case 'zoomIn': 34565 //is there a map 34566 Object(_map_zoomIn__WEBPACK_IMPORTED_MODULE_9__["apiZoomIn"])(map, options); 34567 break; 34568 // set Zoom level 34569 34570 case 'fitMap': 34571 //is there a map 34572 Object(_map__WEBPACK_IMPORTED_MODULE_0__["apiFitMap"])(map, options); 34573 break; 34574 // Center a map 34575 34576 case 'center': 34577 //is there a map 34578 Object(_map__WEBPACK_IMPORTED_MODULE_0__["apiCenter"])(map, options); 34579 break; 34580 // Get the map object 34581 34582 case 'getMap': 34583 //is there a map 34584 if (map) { 34585 __returnValue = map; 34586 } 34587 34588 break; 34589 // Get the map object 34590 34591 case 'removeMap': 34592 __returnValue = Object(_map__WEBPACK_IMPORTED_MODULE_0__["apiRemoveMap"])(map, options); 34593 break; 34594 // Update a map with new settings 34595 34596 case 'updateMap': 34597 Object(_map__WEBPACK_IMPORTED_MODULE_0__["apiUpdateMap"])(map, options); 34598 break; 34599 //------------------------------------------------------------------------ 34600 // End Global map api 34601 //------------------------------------------------------------------------ 34602 //------------------------------------------------------------------------ 34603 // Marker api 34604 //------------------------------------------------------------------------ 34605 // add Marker, and return the marker numbers 34606 34607 case 'addMarker': 34608 //is there a map 34609 __returnValue = Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiAddMarker"])(map, options, mapID); 34610 break; 34611 // Update a marker 34612 34613 case 'updateMarker': 34614 __returnValue = Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiUpdateMarker"])(map, options, mapID); 34615 break; 34616 //Get the marker array 34617 34618 case 'getAllMarkers': 34619 __returnValue = self.markers; 34620 break; 34621 //Get the marker array 34622 34623 case 'getMarkers': 34624 __returnValue = self.markers[mapID]; 34625 break; 34626 // Get the marker 34627 34628 case 'getMarker': 34629 __returnValue = Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiGetMarker"])(map, options, mapID); 34630 break; 34631 //remove marker 34632 34633 case 'removeMarker': 34634 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiRemoveMarker"])(map, options, mapID); 34635 break; 34636 // hide existing Marker 34637 34638 case 'hideMarker': 34639 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiHideMarker"])(map, options, mapID); 34640 break; 34641 // show existing Marker 34642 34643 case 'showMarker': 34644 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiShowMarker"])(map, options, mapID); 34645 break; 34646 // Remove all markers 34647 34648 case 'removeMarkers': 34649 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiRemoveMarkers"])(map, mapID); 34650 break; 34651 // Hide all markers 34652 34653 case 'hideMarkers': 34654 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiHideMarkers"])(map, mapID); 34655 break; 34656 // Show all markers 34657 34658 case 'showMarkers': 34659 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiShowMarkers"])(map, mapID); 34660 break; 34661 //marker click 34662 34663 case 'markerClick': 34664 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiMarkerClick"])(map, options, mapID); 34665 break;
34666 //Open Marker Popup 34667 34668 case 'openMarkerPopup': 34669 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiOpenMarkerPopup"])(options, mapID); 34670 break; 34671 //Open Marker Popup 34672 34673 case 'closeMarkerPopup': 34674 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiCloseMarkerPopup"])(options, mapID); 34675 break; 34676 //Open Marker Popup 34677 34678 case 'toggleMarkerPopup': 34679 Object(_marker__WEBPACK_IMPORTED_MODULE_1__["apiToggleMarkerPopup"])(options, mapID); 34680 break; 34681 //------------------------------------------------------------------------ 34682 // End Marker api 34683 //------------------------------------------------------------------------ 34684 //------------------------------------------------------------------------ 34685 // Layers 34686 //------------------------------------------------------------------------ 34687 // Add a layer 34688 // case 'addLayer': 34689 // //is there a map 34690 // if(map) { 34691 // if(options.layerName != undefined) { 34692 // map.addLayer(options.layerName); 34693 // } 34694 // } 34695 // break; 34696 // Remove a layer 34697 // case 'removeLayer': 34698 // //is there a map 34699 // if(map) { 34700 // if(options.layerName != undefined) { 34701 // map.removeLayer(options.layerName); 34702 // } 34703 // } 34704 // break; 34705 //------------------------------------------------------------------------ 34706 // End layers 34707 //------------------------------------------------------------------------ 34708 //------------------------------------------------------------------------ 34709 // Circle api 34710 //------------------------------------------------------------------------ 34711 // Create a circle 34712 34713 case 'addCircle': 34714 __returnValue = Object(_circle__WEBPACK_IMPORTED_MODULE_2__["apiAddCircle"])(map, options, mapID); 34715 break; 34716 // Get the polygon 34717 34718 case 'getCircle': 34719 __returnValue = Object(_circle__WEBPACK_IMPORTED_MODULE_2__["apiGetCircle"])(map, options, mapID); 34720 break; 34721 // update a polygon 34722 34723 case 'updateCircle': 34724 Object(_circle__WEBPACK_IMPORTED_MODULE_2__["apiUpdateCircle"])(map, options, mapID); 34725 break; 34726 //remove polygon 34727 34728 case 'removeCircle': 34729 Object(_circle__WEBPACK_IMPORTED_MODULE_2__["apiRemoveCircle"])(map, options, mapID); 34730 break; 34731 //------------------------------------------------------------------------ 34732 // End circle api 34733 //------------------------------------------------------------------------ 34734 //------------------------------------------------------------------------ 34735 // Rectangle api 34736 //------------------------------------------------------------------------ 34737 // Create a Rectangle 34738 34739 case 'addRectangle': 34740 __returnValue = Object(_rectangle__WEBPACK_IMPORTED_MODULE_3__["apiAddRectangle"])(map, options, mapID); 34741 break; 34742 // Get the polygon 34743 34744 case 'getRectangle': 34745 __returnValue = Object(_rectangle__WEBPACK_IMPORTED_MODULE_3__["apiGetRectangle"])(map, options, mapID); 34746 break; 34747 // update a polygon 34748 34749 case 'updateRectangle': 34750 Object(_rectangle__WEBPACK_IMPORTED_MODULE_3__["apiUpdateRectangle"])(map, options, mapID); 34751 break; 34752 //remove polygon 34753 34754 case 'removeRectangle': 34755 Object(_rectangle__WEBPACK_IMPORTED_MODULE_3__["apiRemoveRectangle"])(map, options, mapID); 34756 break; 34757 //------------------------------------------------------------------------ 34758 // End rectangle api 34759 //------------------------------------------------------------------------ 34760 //------------------------------------------------------------------------ 34761 // Polygon api 34762 //------------------------------------------------------------------------ 34763 // Create a Polygon 34764 34765 case 'addPolygon': 34766 __returnValue = Object(_polygon__WEBPACK_IMPORTED_MODULE_4__["apiAddPolygon"])(map, options, mapID); 34767 break; 34768 // Get the polygon 34769 34770 case 'getPolygon': 34771 __returnValue = Object(_polygon__WEBPACK_IMPORTED_MODULE_4__["apiGetPolygon"])(map, options, mapID); 34772 break; 34773 // update a polygon 34774 34775 case 'updatePolygon': 34776 Object(_polygon__WEBPACK_IMPORTED_MODULE_4__["apiUpdatePolygon"])(map, options, mapID); 34777 break; 34778 //remove polygon 34779 34780 case 'removePolygon': 34781 Object(_polygon__WEBPACK_IMPORTED_MODULE_4__["apiRemovePolygon"])(map, options, mapID); 34782 break; 34783 //------------------------------------------------------------------------ 34784 // End polygon api 34785 //------------------------------------------------------------------------ 34786 //------------------------------------------------------------------------ 34787 // Polyline api 34788 //------------------------------------------------------------------------ 34789 // Create a Polyline 34790 34791 case 'addPolyline': 34792 __returnValue = Object(_polyline__WEBPACK_IMPORTED_MODULE_5__["apiAddPolyline"])(map, options, mapID); 34793 break; 34794 // Get the polyline 34795 34796 case 'getPolyline': 34797 __returnValue = Object(_polyline__WEBPACK_IMPORTED_MODULE_5__["apiGetPolyline"])(map, options, mapID); 34798 break; 34799 // Get the polyline 34800 34801 case 'updatePolyline': 34802 Object(_polyline__WEBPACK_IMPORTED_MODULE_5__["apiUpdatePolyline"])(map, options, mapID); 34803 break; 34804 //remove marker 34805 34806 case 'removePolyline': 34807 Object(_polyline__WEBPACK_IMPORTED_MODULE_5__["apiRemovePolyline"])(map, options, mapID); 34808 break; 34809 //------------------------------------------------------------------------ 34810 // End polyline api 34811 //------------------------------------------------------------------------ 34812 //------------------------------------------------------------------------
34813 // geoJson api 34814 //------------------------------------------------------------------------ 34815 34816 case 'addGeojson': 34817 Object(_utils__WEBPACK_IMPORTED_MODULE_6__["apiAddGeoJson"])(map, options); 34818 break; 34819 //------------------------------------------------------------------------ 34820 // END geoJson api 34821 //------------------------------------------------------------------------ 34822 //------------------------------------------------------------------------ 34823 // KML 34824 //------------------------------------------------------------------------ 34825 34826 case 'addKml': 34827 Object(_utils__WEBPACK_IMPORTED_MODULE_6__["apiAddKml"])(map, options); 34828 break; 34829 //------------------------------------------------------------------------ 34830 // KML 34831 //------------------------------------------------------------------------ 34832 //------------------------------------------------------------------------ 34833 // Geolocation api, only working for SSL sites 34834 //------------------------------------------------------------------------ 34835 34836 case 'geolocation': 34837 Object(_utils__WEBPACK_IMPORTED_MODULE_6__["apiGeoLocation"])(options); 34838 break; 34839 //------------------------------------------------------------------------ 34840 // Geocode api 34841 //------------------------------------------------------------------------ 34842 // 34843 // Geocode using the API way to cache all addresses 34844 34845 case 'geocode': 34846 Object(_utils__WEBPACK_IMPORTED_MODULE_6__["apiGeocode"])(options); 34847 break; 34848 //------------------------------------------------------------------------ 34849 // End geocode api 34850 //------------------------------------------------------------------------ 34851 34852 default: 34853 Object(_utils__WEBPACK_IMPORTED_MODULE_10__["throwError"])("unknown method: \"".concat(type, "\"")); 34854 break; 34855 } 34856 34857 executeCallback(callback); 34858 return __returnValue; 34859}; // aliases 34860 34861 34862_core__WEBPACK_IMPORTED_MODULE_7__["ReinosMaps"].prototype.trigger = _core__WEBPACK_IMPORTED_MODULE_7__["ReinosMaps"].prototype.api; 34863_core__WEBPACK_IMPORTED_MODULE_7__["ReinosMaps"].prototype.triggerEvent = _core__WEBPACK_IMPORTED_MODULE_7__["ReinosMaps"].prototype.api; 34864 34865/***/ }), 34866
34867/***/ "./themes/user/reinos_maps/src/js/maps/api/circle/addCircle.js": 34868/*!*********************************************************************!*\ 34869 !*** ./themes/user/reinos_maps/src/js/maps/api/circle/addCircle.js ***! 34870 \*********************************************************************/ 34871/*! exports provided: apiAddCircle */ 34872/***/ (function(module, __webpack_exports__, __webpack_require__) { 34873 34874"use strict"; 34875__webpack_require__.r(__webpack_exports__); 34876/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddCircle", function() { return apiAddCircle; }); 34877/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 34878/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 34879/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 34880function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 34881 34882function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 34883 34884function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 34885 34886 34887 34888var apiAddCircle = function apiAddCircle(map, options, mapID) { 34889 // eslint-disable-next-line 34890 var self = REINOS_MAPS; 34891 34892 if (map) { 34893 //merge default settings with given settings 34894 options = _objectSpread({ 34895 'radius': 0, 34896 'stroke': true, 34897 'color': '#3388ff', 34898 'weight': 3, 34899 'opacity': 1.0, 34900 'fill': true, 34901 'fillColor': '#3388ff', 34902 'fillOpacity': 0.2, 34903 'className': 'maps_circle', 34904 'tooltip': {}, 34905 popup: {} 34906 }, options); 34907 34908 var _catchEvents = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["catchEvents"])(options), 34909 events = _catchEvents.events, 34910 optionsWithoutEvents = _catchEvents.options; 34911 34912 options = optionsWithoutEvents; //set the user options 34913 34914 var userOptions = _objectSpread({}, options); 34915 34916 var popupOptions = options.popup; 34917 delete options.popup; //add bound 34918 34919 map.bounds.circles.push([options.lat, options.lng]); //reset the tooltip options 34920 34921 var tooltipOptions = options.tooltip; 34922 delete options.tooltip; //set the keys 34923 34924 var keys = typeof options.keys === 'string' ? options.keys : ''; //add circle to the map 34925 34926 var new_circle = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.circle([options.lat, options.lng], options).addTo(map.map); //custom property and method to handle the userOptions 34927 34928 new_circle.userOptions = userOptions; 34929 34930 new_circle.setUserOptions = function (newUserOptions) { 34931 this.userOptions = _objectSpread(_objectSpread({}, this.userOptions), newUserOptions); 34932 }; //set the tooltip 34933 34934 34935 self.addTooltip(tooltipOptions, new_circle); // assign the events to the feature 34936 34937 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["executeEvent"])(events, new_circle); //init the popup 34938 34939 new_circle = self.initPopup(new_circle, popupOptions); //save to the cache 34940 34941 var __returnValue = self.saveCircle(mapID, new_circle, keys); //fit map 34942 34943 34944 self.fitBounds(map); 34945 return __returnValue; 34946 } 34947}; 34948 34949/***/ }), 34950
34951/***/ "./themes/user/reinos_maps/src/js/maps/api/circle/getCircle.js": 34952/*!*********************************************************************!*\ 34953 !*** ./themes/user/reinos_maps/src/js/maps/api/circle/getCircle.js ***! 34954 \*********************************************************************/ 34955/*! exports provided: apiGetCircle */ 34956/***/ (function(module, __webpack_exports__, __webpack_require__) { 34957 34958"use strict"; 34959__webpack_require__.r(__webpack_exports__); 34960/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetCircle", function() { return apiGetCircle; }); 34961var apiGetCircle = function apiGetCircle(map, options, mapID) { 34962 // eslint-disable-next-line 34963 var self = REINOS_MAPS; 34964 var circle = self.searchCircle(mapID, options.key); //is there a map 34965 34966 if (map && circle !== undefined) { 34967 return circle; 34968 } 34969}; 34970 34971/***/ }), 34972
34973/***/ "./themes/user/reinos_maps/src/js/maps/api/circle/index.js": 34974/*!*****************************************************************!*\ 34975 !*** ./themes/user/reinos_maps/src/js/maps/api/circle/index.js ***! 34976 \*****************************************************************/ 34977/*! exports provided: apiAddCircle, apiGetCircle, apiUpdateCircle, apiRemoveCircle */ 34978/***/ (function(module, __webpack_exports__, __webpack_require__) { 34979 34980"use strict"; 34981__webpack_require__.r(__webpack_exports__); 34982/* harmony import */ var _addCircle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addCircle */ "./themes/user/reinos_maps/src/js/maps/api/circle/addCircle.js"); 34983/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddCircle", function() { return _addCircle__WEBPACK_IMPORTED_MODULE_0__["apiAddCircle"]; }); 34984 34985/* harmony import */ var _getCircle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getCircle */ "./themes/user/reinos_maps/src/js/maps/api/circle/getCircle.js"); 34986/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGetCircle", function() { return _getCircle__WEBPACK_IMPORTED_MODULE_1__["apiGetCircle"]; }); 34987 34988/* harmony import */ var _updateCircle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./updateCircle */ "./themes/user/reinos_maps/src/js/maps/api/circle/updateCircle.js"); 34989/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiUpdateCircle", function() { return _updateCircle__WEBPACK_IMPORTED_MODULE_2__["apiUpdateCircle"]; }); 34990 34991/* harmony import */ var _removeCircle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./removeCircle */ "./themes/user/reinos_maps/src/js/maps/api/circle/removeCircle.js"); 34992/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemoveCircle", function() { return _removeCircle__WEBPACK_IMPORTED_MODULE_3__["apiRemoveCircle"]; }); 34993 34994 34995 34996 34997 34998 34999/***/ }), 35000
35001/***/ "./themes/user/reinos_maps/src/js/maps/api/circle/removeCircle.js": 35002/*!************************************************************************!*\ 35003 !*** ./themes/user/reinos_maps/src/js/maps/api/circle/removeCircle.js ***! 35004 \************************************************************************/ 35005/*! exports provided: apiRemoveCircle */ 35006/***/ (function(module, __webpack_exports__, __webpack_require__) { 35007 35008"use strict"; 35009__webpack_require__.r(__webpack_exports__); 35010/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemoveCircle", function() { return apiRemoveCircle; }); 35011var apiRemoveCircle = function apiRemoveCircle(map, options, mapID) { 35012 // eslint-disable-next-line 35013 var self = REINOS_MAPS; 35014 var circle = self.searchCircle(mapID, options.key); //is there a map 35015 35016 if (map && circle !== undefined) { 35017 // remove from map 35018 circle.remove(); //remove from the cache 35019 35020 self.removeCircle(mapID, options.key); //remove from the bounds 35021 35022 map.bounds.circles = map.bounds.circles.filter(function (value) { 35023 return circle.getLatLng().lat !== value[0] && circle.getLatLng().lng !== value[1]; 35024 }); 35025 } 35026}; 35027 35028/***/ }), 35029
35030/***/ "./themes/user/reinos_maps/src/js/maps/api/circle/updateCircle.js": 35031/*!************************************************************************!*\ 35032 !*** ./themes/user/reinos_maps/src/js/maps/api/circle/updateCircle.js ***! 35033 \************************************************************************/ 35034/*! exports provided: apiUpdateCircle */ 35035/***/ (function(module, __webpack_exports__, __webpack_require__) { 35036 35037"use strict"; 35038__webpack_require__.r(__webpack_exports__); 35039/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUpdateCircle", function() { return apiUpdateCircle; }); 35040/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 35041 35042var apiUpdateCircle = function apiUpdateCircle(map, options, mapID) { 35043 // eslint-disable-next-line 35044 var self = REINOS_MAPS; 35045 var circle = self.searchCircle(mapID, options.key); //is there a map 35046 35047 if (map && circle !== undefined) { 35048 //remove key 35049 delete options.key; //set the new user options 35050 35051 circle.setUserOptions(options); //update tooltip 35052 35053 if (options.tooltip !== undefined) { 35054 //set the tooltip 35055 self.updateTooltip(options.tooltip, circle); 35056 delete options.tooltip; 35057 } //if latlngs is found in the options, use that for redraw the line 35058 35059 35060 if (typeof options.latlng !== 'undefined') { 35061 circle.setLatLng(options.latlngs); 35062 delete options.latlng; 35063 } //update radius 35064 35065 35066 if (typeof options.radius !== 'undefined') { 35067 circle.setRadius(options.radius); 35068 delete options.radius; 35069 } //set the new options 35070 35071 35072 circle.setStyle(options); //set the popup content 35073 35074 if (options.popup !== undefined && options.popup.popupContent !== undefined) { 35075 if (circle.getPopup() === undefined) { 35076 //init the popup 35077 circle = self.initPopup(circle, options.popup); 35078 } else { 35079 var decodedContent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["decodeContent"])(options.popup.popupContent); 35080 circle.getPopup().setContent(decodedContent); 35081 } 35082 35083 delete options.popup.popupContent; 35084 } 35085 35086 return circle; 35087 } 35088}; 35089 35090/***/ }), 35091
35092/***/ "./themes/user/reinos_maps/src/js/maps/api/index.js": 35093/*!**********************************************************!*\ 35094 !*** ./themes/user/reinos_maps/src/js/maps/api/index.js ***! 35095 \**********************************************************/ 35096/*! no exports provided */ 35097/***/ (function(module, __webpack_exports__, __webpack_require__) { 35098 35099"use strict"; 35100__webpack_require__.r(__webpack_exports__); 35101/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./api */ "./themes/user/reinos_maps/src/js/maps/api/api.js"); 35102 35103 35104/***/ }), 35105
35106/***/ "./themes/user/reinos_maps/src/js/maps/api/map/center.js": 35107/*!***************************************************************!*\ 35108 !*** ./themes/user/reinos_maps/src/js/maps/api/map/center.js ***! 35109 \***************************************************************/ 35110/*! exports provided: apiCenter */ 35111/***/ (function(module, __webpack_exports__, __webpack_require__) { 35112 35113"use strict"; 35114__webpack_require__.r(__webpack_exports__); 35115/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiCenter", function() { return apiCenter; }); 35116/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 35117/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 35118 35119var apiCenter = function apiCenter(map, options) { 35120 if (map) { 35121 map.map.panTo(new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.LatLng(options.lat, options.lng)); 35122 } 35123}; 35124 35125/***/ }), 35126
35127/***/ "./themes/user/reinos_maps/src/js/maps/api/map/fitMap.js": 35128/*!***************************************************************!*\ 35129 !*** ./themes/user/reinos_maps/src/js/maps/api/map/fitMap.js ***! 35130 \***************************************************************/ 35131/*! exports provided: apiFitMap */ 35132/***/ (function(module, __webpack_exports__, __webpack_require__) { 35133 35134"use strict"; 35135__webpack_require__.r(__webpack_exports__); 35136/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiFitMap", function() { return apiFitMap; }); 35137function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 35138 35139function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 35140 35141function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 35142 35143var apiFitMap = function apiFitMap(map, options) { 35144 if (map) { 35145 options.type = options.type || ''; 35146 35147 switch (options.type) { 35148 case 'markers': 35149 case 'marker': 35150 map.map.fitBounds(map.bounds.markers); 35151 break; 35152 35153 case 'circle': 35154 case 'circles': 35155 map.map.fitBounds(map.bounds.circles); 35156 break; 35157 35158 case 'rectangle': 35159 case 'rectangles': 35160 map.map.fitBounds(map.bounds.rectangles); 35161 break; 35162 35163 case 'polylines': 35164 case 'polyline': 35165 case 'route': //routes are infact polylines 35166 35167 case 'routes': 35168 //routes are infact polylines 35169 map.map.fitBounds(map.bounds.polylines); 35170 break; 35171 35172 case 'polygons': 35173 case 'polygon': 35174 map.map.fitBounds(map.bounds.polygons); 35175 break; 35176 35177 default: 35178 map.map.fitBounds(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, map.bounds.markers), map.bounds.circles), map.bounds.rectangles), map.bounds.polylines), map.bounds.polygons)); 35179 break; 35180 } 35181 } 35182}; 35183 35184/***/ }), 35185
35186/***/ "./themes/user/reinos_maps/src/js/maps/api/map/index.js": 35187/*!**************************************************************!*\ 35188 !*** ./themes/user/reinos_maps/src/js/maps/api/map/index.js ***! 35189 \**************************************************************/ 35190/*! exports provided: apiCenter, apiFitMap, apiRefresh, apiRemoveMap, apiSetZoom, apiUpdateMap */ 35191/***/ (function(module, __webpack_exports__, __webpack_require__) { 35192 35193"use strict"; 35194__webpack_require__.r(__webpack_exports__); 35195/* harmony import */ var _center__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./center */ "./themes/user/reinos_maps/src/js/maps/api/map/center.js"); 35196/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiCenter", function() { return _center__WEBPACK_IMPORTED_MODULE_0__["apiCenter"]; }); 35197 35198/* harmony import */ var _fitMap__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fitMap */ "./themes/user/reinos_maps/src/js/maps/api/map/fitMap.js"); 35199/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiFitMap", function() { return _fitMap__WEBPACK_IMPORTED_MODULE_1__["apiFitMap"]; }); 35200 35201/* harmony import */ var _refresh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./refresh */ "./themes/user/reinos_maps/src/js/maps/api/map/refresh.js"); 35202/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRefresh", function() { return _refresh__WEBPACK_IMPORTED_MODULE_2__["apiRefresh"]; }); 35203 35204/* harmony import */ var _removeMap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./removeMap */ "./themes/user/reinos_maps/src/js/maps/api/map/removeMap.js"); 35205/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemoveMap", function() { return _removeMap__WEBPACK_IMPORTED_MODULE_3__["apiRemoveMap"]; }); 35206 35207/* harmony import */ var _setZoom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./setZoom */ "./themes/user/reinos_maps/src/js/maps/api/map/setZoom.js"); 35208/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiSetZoom", function() { return _setZoom__WEBPACK_IMPORTED_MODULE_4__["apiSetZoom"]; }); 35209 35210/* harmony import */ var _updateMap__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./updateMap */ "./themes/user/reinos_maps/src/js/maps/api/map/updateMap.js"); 35211/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiUpdateMap", function() { return _updateMap__WEBPACK_IMPORTED_MODULE_5__["apiUpdateMap"]; }); 35212 35213 35214 35215 35216 35217 35218 35219 35220/***/ }), 35221
35222/***/ "./themes/user/reinos_maps/src/js/maps/api/map/refresh.js": 35223/*!****************************************************************!*\ 35224 !*** ./themes/user/reinos_maps/src/js/maps/api/map/refresh.js ***! 35225 \****************************************************************/ 35226/*! exports provided: apiRefresh */ 35227/***/ (function(module, __webpack_exports__, __webpack_require__) { 35228 35229"use strict"; 35230__webpack_require__.r(__webpack_exports__); 35231/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRefresh", function() { return apiRefresh; }); 35232var apiRefresh = function apiRefresh(map) { 35233 if (map) { 35234 map.map.invalidateSize(); 35235 } 35236}; 35237 35238/***/ }), 35239
35240/***/ "./themes/user/reinos_maps/src/js/maps/api/map/removeMap.js": 35241/*!******************************************************************!*\ 35242 !*** ./themes/user/reinos_maps/src/js/maps/api/map/removeMap.js ***! 35243 \******************************************************************/ 35244/*! exports provided: apiRemoveMap */ 35245/***/ (function(module, __webpack_exports__, __webpack_require__) { 35246 35247"use strict"; 35248__webpack_require__.r(__webpack_exports__); 35249/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemoveMap", function() { return apiRemoveMap; }); 35250var apiRemoveMap = function apiRemoveMap(map, options) { 35251 // eslint-disable-next-line 35252 var self = REINOS_MAPS; 35253 35254 if (map) { 35255 self.maps["delete"](options.mapID); 35256 self.polygons["delete"](options.mapID); 35257 self.polylines["delete"](options.mapID); 35258 self.rectangles["delete"](options.mapID); 35259 self.circles["delete"](options.mapID); 35260 self.markers["delete"](options.mapID); 35261 return map; 35262 } 35263}; 35264 35265/***/ }), 35266
35267/***/ "./themes/user/reinos_maps/src/js/maps/api/map/setZoom.js": 35268/*!****************************************************************!*\ 35269 !*** ./themes/user/reinos_maps/src/js/maps/api/map/setZoom.js ***! 35270 \****************************************************************/ 35271/*! exports provided: apiSetZoom */ 35272/***/ (function(module, __webpack_exports__, __webpack_require__) { 35273 35274"use strict"; 35275__webpack_require__.r(__webpack_exports__); 35276/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiSetZoom", function() { return apiSetZoom; }); 35277var apiSetZoom = function apiSetZoom(map, options) { 35278 if (map) { 35279 if (options.zoom !== undefined) { 35280 map.map.setZoom(options.zoom); 35281 map.raw_options.zoom = options.zoom; 35282 } 35283 } 35284}; 35285 35286/***/ }), 35287
35288/***/ "./themes/user/reinos_maps/src/js/maps/api/map/updateMap.js": 35289/*!******************************************************************!*\ 35290 !*** ./themes/user/reinos_maps/src/js/maps/api/map/updateMap.js ***! 35291 \******************************************************************/ 35292/*! exports provided: apiUpdateMap */ 35293/***/ (function(module, __webpack_exports__, __webpack_require__) { 35294 35295"use strict"; 35296__webpack_require__.r(__webpack_exports__); 35297/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUpdateMap", function() { return apiUpdateMap; }); 35298/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 35299/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 35300/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_1__); 35301/* harmony import */ var domtastic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! domtastic */ "./node_modules/domtastic/src/index.js"); 35302 35303 35304 35305var apiUpdateMap = function apiUpdateMap(map, options) { 35306 // eslint-disable-next-line 35307 var self = REINOS_MAPS; 35308 35309 if (map) { 35310 if (options.center !== undefined) { 35311 var center = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["base64Decode"])(options.center); 35312 center = center.split(',');
35313 map.map.setView([center[0], center[1]]); 35314 map.raw_options.center = options.center; 35315 delete options.center; 35316 } 35317 35318 if (options.zoom !== undefined) { 35319 map.map.setZoom(options.zoom); 35320 map.raw_options.zoom = options.zoom; 35321 delete options.zoom; 35322 } 35323 35324 if (options.max_zoom) { 35325 map.map.setMaxZoom(options.max_zoom); 35326 map.raw_options.max_zoom = options.max_zoom; 35327 delete options.max_zoom; 35328 } 35329 35330 if (options.scroll_wheel) { 35331 if (Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.scroll_wheel)) { 35332 map.map.scrollWheelZoom.enable(); 35333 } else { 35334 map.map.scrollWheelZoom.disable(); 35335 } 35336 35337 map.raw_options.scroll_wheel = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.scroll_wheel); 35338 delete options.scroll_wheel; 35339 } 35340 35341 if (options.zoom_control) { 35342 if (Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.zoom_control)) { 35343 map.map.zoomControl.enable(); 35344 } else { 35345 map.map.zoomControl.disable(); 35346 } 35347 35348 map.raw_options.zoom_control = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.zoom_control); 35349 delete options.zoomControl; 35350 } 35351 35352 if (options.zoom_control_position) { 35353 if (self.positions.indexOf(options.zoom_control_position) !== -1) { 35354 map.map.zoomControl.setPosition(options.zoom_control_position); 35355 map.raw_options.zoom_control_position = options.zoom_control_position; 35356 delete options.zoom_control_position; 35357 } 35358 } 35359 35360 if (options.scale_control) { 35361 if (Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.scale_control) && map.scaleControl === null) { 35362 map.scaleControl = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.control.scale({ 35363 position: map.raw_options.scale_control_position 35364 }).addTo(map.map); 35365 } else if (!Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.scale_control) && map.scaleControl !== null) { 35366 map.scaleControl.remove(); 35367 map.scaleControl = null; 35368 } 35369 35370 map.raw_options.scale_control = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["strToBool"])(options.scale_control); 35371 delete options.scale_control; 35372 } 35373 35374 if (options.scale_control_position) { 35375 if (map.scaleControl !== null) { 35376 map.scaleControl.setPosition(options.scale_control_position); 35377 } 35378 35379 map.raw_options.scale_control_position = options.scale_control_position; 35380 delete options.scale_control_position; 35381 } 35382 35383 if (options.overlay_html) { 35384 self.updateOverlay(map, { 35385 overlay_html: options.overlay_html, 35386 overlay_position: options.overlay_position 35387 }); 35388 map.raw_options.overlay_html = options.overlay_html; 35389 map.raw_options.overlay_position = options.overlay_position; 35390 delete options.overlay_html; 35391 delete options.overlay_position; 35392 } //update the widths 35393 35394 35395 if (options.height || options.width) { 35396 //get the container 35397 var $container = Object(domtastic__WEBPACK_IMPORTED_MODULE_2__["default"])(map.map.getContainer()); //update width 35398 35399 if (options.width) { 35400 $container.css('width', options.width); 35401 } //update height 35402 35403 35404 if (options.height) { 35405 $container.css('height', options.height); 35406 } //redraw the map 35407 35408 35409 map.map.invalidateSize(); 35410 } 35411 35412 if (options.tiles && options.tiles !== '' && options.tiles !== null) { 35413 //remove the current ones 35414 Object.values(map.tiles).forEach(function (tile) { 35415 return tile.remove(); 35416 }); //remove the controlTile if needed 35417 35418 if (map.tileControl !== null) { 35419 map.tileControl.remove(); 35420 } //add the new ones 35421 35422 35423 self.addTiles(map, options.tiles); 35424 } 35425 } 35426}; 35427 35428/***/ }), 35429
35430/***/ "./themes/user/reinos_maps/src/js/maps/api/map/zoomIn.js": 35431/*!***************************************************************!*\ 35432 !*** ./themes/user/reinos_maps/src/js/maps/api/map/zoomIn.js ***! 35433 \***************************************************************/ 35434/*! exports provided: apiZoomIn */ 35435/***/ (function(module, __webpack_exports__, __webpack_require__) { 35436 35437"use strict"; 35438__webpack_require__.r(__webpack_exports__); 35439/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiZoomIn", function() { return apiZoomIn; }); 35440var apiZoomIn = function apiZoomIn(map) { 35441 if (map) { 35442 map.map.zoomIn(); 35443 } 35444}; 35445 35446/***/ }), 35447
35448/***/ "./themes/user/reinos_maps/src/js/maps/api/map/zoomOut.js": 35449/*!****************************************************************!*\ 35450 !*** ./themes/user/reinos_maps/src/js/maps/api/map/zoomOut.js ***! 35451 \****************************************************************/ 35452/*! exports provided: apiZoomOut */ 35453/***/ (function(module, __webpack_exports__, __webpack_require__) { 35454 35455"use strict"; 35456__webpack_require__.r(__webpack_exports__); 35457/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiZoomOut", function() { return apiZoomOut; }); 35458var apiZoomOut = function apiZoomOut(map) { 35459 if (map) { 35460 map.map.zoomOut(); 35461 } 35462}; 35463 35464/***/ }), 35465
35466/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/addMarker.js": 35467/*!*********************************************************************!*\ 35468 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/addMarker.js ***! 35469 \*********************************************************************/ 35470/*! exports provided: apiAddMarker */ 35471/***/ (function(module, __webpack_exports__, __webpack_require__) { 35472 35473"use strict"; 35474__webpack_require__.r(__webpack_exports__); 35475/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddMarker", function() { return apiAddMarker; }); 35476/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 35477/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 35478/* harmony import */ var leaflet_icon_glyph__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet.icon.glyph */ "./node_modules/leaflet.icon.glyph/Leaflet.Icon.Glyph.js"); 35479/* harmony import */ var leaflet_icon_glyph__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet_icon_glyph__WEBPACK_IMPORTED_MODULE_1__); 35480/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 35481function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 35482 35483function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 35484 35485function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 35486 35487function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 35488 35489function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 35490 35491function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 35492 35493function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 35494 35495function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 35496 35497function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 35498 35499 35500 35501 35502var apiAddMarker = function apiAddMarker(map, options, mapID) { 35503 // eslint-disable-next-line 35504 var self = REINOS_MAPS; 35505 35506 if (map) { 35507 //merge default settings with given settings 35508 options = _objectSpread({ 35509 //defaults 35510 'icon': null, 35511 'shadow': null, 35512 'draggable': false, 35513 'autoPan': false, 35514 'autoPanPadding': leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.point(50, 50), 35515 //'autoPanSpeed': 10, 35516 'keyboard': true, 35517 'title': '', 35518 'alt': '', 35519 'zIndexOffset': 0, 35520 'opacity': 1, 35521 'riseOnHover': false, 35522 'riseOffset': 250, 35523 'pane': 'markerPane', 35524 'bubblingMouseEvents': false, 35525 'tooltip': {}, 35526 'glyph': {}, 35527 'assign': {}, 35528 //bounce options from https://github.com/maximeh/leaflet.bouncemarker 35529 // 'bounceOnAdd' : false, 35530 //other 35531 'lat': null, 35532 'lng': null, 35533 'fitBounds': true, 35534 popup: {} 35535 }, options); //check for for a valid latlng 35536 35537 if (options.lat === null || options.lat === '' || options.lng === null || options.lng === '') { 35538 console.error('Maps Error: Lat and/or Lng coordinate is invali
35538d'); 35539 return; 35540 } 35541 35542 var _catchEvents = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["catchEvents"])(options), 35543 events = _catchEvents.events, 35544 optionsWithoutEvents = _catchEvents.options; 35545 35546 options = optionsWithoutEvents; //set the user options 35547 35548 var userOptions = _objectSpread({}, options); 35549 35550 var popupOptions = options.popup; 35551 delete options.popup; //set the assign data for assign to the marker object 35552 35553 var assignData = options.assign; 35554 delete options.assign; //reset the tooltip options 35555 35556 var tooltipOptions = options.tooltip; 35557 delete options.tooltip; //set the default options from the default object 35558 35559 var iconDefault = _objectSpread({}, leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.Default.prototype.options); //reset some values 35560 35561 35562 iconDefault.iconUrl = null; 35563 iconDefault.iconRetinaUrl = null; 35564 iconDefault.shadowUrl = null; //merge default icon settings with given settings 35565 35566 options.icon = _objectSpread(_objectSpread({}, iconDefault), options.icon); //check if we need to use the default icon? of if Glyph icon is enabled 35567 35568 if (options.glyph.enabled !== undefined && options.glyph.enabled) { 35569 options.icon = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.icon.glyph({ 35570 prefix: options.glyph.prefix, 35571 glyph: options.glyph.name, 35572 className: options.glyph.className, 35573 glyphColor: options.glyph.color, 35574 iconUrl: self.theme_path + 'dist/images/glyph-marker-icon.svg' 35575 }); 35576 } else if (options.icon.iconUrl === null || options.icon.iconUrl === '') { 35577 //remove the default icon 35578 delete options.icon.iconUrl; 35579 delete options.icon.iconRetinaUrl; 35580 delete options.icon.shadowUrl; // //set some defaults to the default icon 35581 35582 leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.Default.prototype.options = _objectSpread(_objectSpread({}, leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.Default.prototype.options), options.icon); //init the default icon 35583 35584 options.icon = new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.Default(); 35585 } else { 35586 options.icon = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.icon(options.icon); 35587 } //get the keys 35588 35589 35590 var keys = typeof options.keys === 'string' ? options.keys : ''; //init a marker class 35591 35592 var marker = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.marker([options.lat, options.lng], options); //assign the assignData to the marker 35593 35594 Object.entries(assignData).forEach(function (_ref) { 35595 var _ref2 = _slicedToArray(_ref, 2), 35596 key = _ref2[0], 35597 val = _ref2[1]; 35598 35599 if (marker.extra === undefined) { 35600 marker.extra = {}; 35601 } //set the data 35602 35603 35604 marker['extra'][key] = val; 35605 }); //custom property and method to handle the userOptions 35606 35607 marker.userOptions = userOptions; 35608 35609 marker.setUserOptions = function (newUserOptions) { 35610 this.userOptions = _objectSpread(_objectSpread({}, this.userOptions), newUserOptions); 35611 }; //set the tooltip 35612 35613 35614 self.addTooltip(tooltipOptions, marker); // assign the events to the feature 35615 35616 Object(_utils__WEBPACK_IMPORTED_MODULE_2__["executeEvent"])(events, marker); //check if we have to deal with a marker cluster? 35617 35618 if (map.marker_cluster.enabled) { 35619 map.marker_cluster.markers.addLayer(marker); 35620 map.map.addLayer(map.marker_cluster.markers); 35621 } else { 35622 marker.addTo(map.map); 35623 } //add bound 35624 35625 35626 map.bounds.markers.push([marker.getLatLng().lat, marker.getLatLng().lng]); //init the popup 35627 35628 marker = self.initPopup(marker, popupOptions); 35629 self.saveMarker(mapID, marker, keys); //fit map 35630 35631 if (options.fitBounds) { 35632 self.fitBounds(map); 35633 } //open by default? 35634 35635 35636 if (typeof options.open_by_default === 'boolean' && options.open_by_default) { 35637 marker.openPopup(); 35638 } //callback 35639 35640 35641 if (options.callback && typeof options.callback === 'function') { 35642 setTimeout(function () { 35643 options.callback(); 35644 }, 200); 35645 } 35646 35647 return marker; 35648 } 35649}; 35650 35651/***/ }), 35652
35653/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/closeMarkerPopup.js": 35654/*!****************************************************************************!*\ 35655 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/closeMarkerPopup.js ***! 35656 \****************************************************************************/ 35657/*! exports provided: apiCloseMarkerPopup */ 35658/***/ (function(module, __webpack_exports__, __webpack_require__) { 35659 35660"use strict"; 35661__webpack_require__.r(__webpack_exports__); 35662/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiCloseMarkerPopup", function() { return apiCloseMarkerPopup; }); 35663var apiCloseMarkerPopup = function apiCloseMarkerPopup(options, mapID) { 35664 // eslint-disable-next-line 35665 var self = REINOS_MAPS; 35666 var marker = self.searchMarker(mapID, options.key); //close infoWindow 35667 35668 if (marker !== undefined) { 35669 marker.closePopup(); 35670 } 35671}; 35672 35673/***/ }), 35674
35675/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/getMarker.js": 35676/*!*********************************************************************!*\ 35677 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/getMarker.js ***! 35678 \*********************************************************************/ 35679/*! exports provided: apiGetMarker */ 35680/***/ (function(module, __webpack_exports__, __webpack_require__) { 35681 35682"use strict"; 35683__webpack_require__.r(__webpack_exports__); 35684/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetMarker", function() { return apiGetMarker; }); 35685var apiGetMarker = function apiGetMarker(map, options, mapID) { 35686 // eslint-disable-next-line 35687 var self = REINOS_MAPS; 35688 var marker; 35689 35690 if (options.multiple !== undefined && options.multiple) { 35691 marker = self.searchMarker(mapID, options.key, true); 35692 } else { 35693 marker = self.searchMarker(mapID, options.key); 35694 } //is there a map 35695 35696 35697 if (map && marker !== undefined) { 35698 //remove from map 35699 return marker; 35700 } 35701}; 35702 35703/***/ }), 35704
35705/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/hideMarker.js": 35706/*!**********************************************************************!*\ 35707 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/hideMarker.js ***! 35708 \**********************************************************************/ 35709/*! exports provided: apiHideMarker */ 35710/***/ (function(module, __webpack_exports__, __webpack_require__) { 35711 35712"use strict"; 35713__webpack_require__.r(__webpack_exports__); 35714/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiHideMarker", function() { return apiHideMarker; }); 35715var apiHideMarker = function apiHideMarker(map, options, mapID) { 35716 // eslint-disable-next-line 35717 var self = REINOS_MAPS; 35718 var marker = self.searchMarker(mapID, options.key); //is there a map 35719 35720 if (map && marker !== undefined) { 35721 marker.closePopup(); 35722 marker.closeTooltip(); 35723 marker._icon.style.display = 'none'; 35724 marker._shadow.style.display = 'none'; 35725 } 35726}; 35727 35728/***/ }), 35729
35730/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/hideMarkers.js": 35731/*!***********************************************************************!*\ 35732 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/hideMarkers.js ***! 35733 \***********************************************************************/ 35734/*! exports provided: apiHideMarkers */ 35735/***/ (function(module, __webpack_exports__, __webpack_require__) { 35736 35737"use strict"; 35738__webpack_require__.r(__webpack_exports__); 35739/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiHideMarkers", function() { return apiHideMarkers; }); 35740var apiHideMarkers = function apiHideMarkers(map, mapID) { 35741 // eslint-disable-next-line 35742 var self = REINOS_MAPS; 35743 var cachedMarkers = self.markers.get(mapID); 35744 35745 if (map && cachedMarkers !== undefined) { 35746 cachedMarkers.forEach(function (_ref) { 35747 var marker = _ref.marker; 35748 //remove from map 35749 marker.closePopup(); 35750 marker.closeTooltip(); 35751 marker._icon.style.display = 'none'; 35752 marker._shadow.style.display = 'none'; 35753 }); 35754 } 35755}; 35756 35757/***/ }), 35758
35759/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/index.js": 35760/*!*****************************************************************!*\ 35761 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/index.js ***! 35762 \*****************************************************************/ 35763/*! exports provided: apiAddMarker, apiCloseMarkerPopup, apiGetMarker, apiHideMarker, apiHideMarkers, apiMarkerClick, apiOpenMarkerPopup, apiRemoveMarker, apiRemoveMarkers, apiShowMarker, apiShowMarkers, apiToggleMarkerPopup, apiUpdateMarker */ 35764/***/ (function(module, __webpack_exports__, __webpack_require__) { 35765 35766"use strict"; 35767__webpack_require__.r(__webpack_exports__); 35768/* harmony import */ var _addMarker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addMarker */ "./themes/user/reinos_maps/src/js/maps/api/marker/addMarker.js"); 35769/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddMarker", function() { return _addMarker__WEBPACK_IMPORTED_MODULE_0__["apiAddMarker"]; }); 35770 35771/* harmony import */ var _closeMarkerPopup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./closeMarkerPopup */ "./themes/user/reinos_maps/src/js/maps/api/marker/closeMarkerPopup.js"); 35772/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiCloseMarkerPopup", function() { return _closeMarkerPopup__WEBPACK_IMPORTED_MODULE_1__["apiCloseMarkerPopup"]; }); 35773 35774/* harmony import */ var _getMarker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getMarker */ "./themes/user/reinos_maps/src/js/maps/api/marker/getMarker.js"); 35775/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGetMarker", function() { return _getMarker__WEBPACK_IMPORTED_MODULE_2__["apiGetMarker"]; }); 35776 35777/* harmony import */ var _hideMarker__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hideMarker */ "./themes/user/reinos_maps/src/js/maps/api/marker/hideMarker.js"); 35778/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiHideMarker", function() { return _hideMarker__WEBPACK_IMPORTED_MODULE_3__["apiHideMarker"]; }); 35779 35780/* harmony import */ var _hideMarkers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hideMarkers */ "./themes/user/reinos_maps/src/js/maps/api/marker/hideMarkers.js"); 35781/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiHideMarkers", function() { return _hideMarkers__WEBPACK_IMPORTED_MODULE_4__["apiHideMarkers"]; }); 35782 35783/* harmony import */ var _markerClick__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./markerClick */ "./themes/user/reinos_maps/src/js/maps/api/marker/markerClick.js"); 35784/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiMarkerClick", function() { return _markerClick__WEBPACK_IMPORTED_MODULE_5__["apiMarkerClick"]; }); 35785 35786/* harmony import */ var _openMarkerPopup__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./openMarkerPopup */ "./themes/user/reinos_maps/src/js/maps/api/marker/openMarkerPopup.js"); 35787/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiOpenMarkerPopup", function() { return _openMarkerPopup__WEBPACK_IMPORTED_MODULE_6__["apiOpenMarkerPopup"]; }); 35788 35789/* harmony import */ var _removeMarker__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./removeMarker */ "./themes/user/reinos_maps/src/js/maps/api/marker/removeMarker.js"); 35790/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemoveMarker", function() { return _removeMarker__WEBPACK_IMPORTED_MODULE_7__["apiRemoveMarker"]; }); 35791 35792/* harmony import */ var _removeMarkers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./removeMarkers */ "./themes/user/reinos_maps/src/js/maps/api/marker/removeMarkers.js"); 35793/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemoveMarkers", function() { return _removeMarkers__WEBPACK_IMPORTED_MODULE_8__["apiRemoveMarkers"]; }); 35794 35795/* harmony import */ var _showMarker__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./showMarker */ "./themes/user/reinos_maps/src/js/maps/api/marker/showMarker.js"); 35796/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiShowMarker", function() { return _showMarker__WEBPACK_IMPORTED_MODULE_9__["apiShowMarker"]; }); 35797 35798/* harmony import */ var _showMarkers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./showMarkers */ "./themes/user/reinos_maps/src/js/maps/api/marker/showMarkers.js"); 35799/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiShowMarkers", function() { return _showMarkers__WEBPACK_IMPORTED_MODULE_10__["apiShowMarkers"]; }); 35800 35801/* harmony import */ var _toggleMarkerPopup__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./toggleMarkerPopup */ "./themes/user/reinos_maps/src/js/maps/api/marker/toggleMarkerPopup.js"); 35802/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiToggleMarkerPopup", function() { return _toggleMarkerPopup__WEBPACK_IMPORTED_MODULE_11__["apiToggleMarkerPopup"]; }); 35803 35804/* harmony import */ var _updateMarker__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./updateMarker */ "./themes/user/reinos_maps/src/js/maps/api/marker/updateMarker.js"); 35805/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiUpdateMarker", function() { return _updateMarker__WEBPACK_IMPORTED_MODULE_12__["apiUpdateMarker"]; }); 35806 35807 35808 35809 35810 35811 35812 35813 35814 35815 35816 35817 35818 35819 35820 35821/***/ }), 35822
35823/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/markerClick.js": 35824/*!***********************************************************************!*\ 35825 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/markerClick.js ***! 35826 \***********************************************************************/ 35827/*! exports provided: apiMarkerClick */ 35828/***/ (function(module, __webpack_exports__, __webpack_require__) { 35829 35830"use strict"; 35831__webpack_require__.r(__webpack_exports__); 35832/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiMarkerClick", function() { return apiMarkerClick; }); 35833var apiMarkerClick = function apiMarkerClick(map, options, mapID) { 35834 // eslint-disable-next-line 35835 var self = REINOS_MAPS; 35836 var marker = self.searchMarker(mapID, options.key); //trigger the click 35837 35838 if (marker !== undefined) { 35839 //trigger 35840 marker.fire('click'); //callback 35841 35842 if (typeof options.callback === 'function') { 35843 options.callback(map.map, marker); 35844 } 35845 } 35846}; 35847 35848/***/ }), 35849
35850/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/openMarkerPopup.js": 35851/*!***************************************************************************!*\ 35852 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/openMarkerPopup.js ***! 35853 \***************************************************************************/ 35854/*! exports provided: apiOpenMarkerPopup */ 35855/***/ (function(module, __webpack_exports__, __webpack_require__) { 35856 35857"use strict"; 35858__webpack_require__.r(__webpack_exports__); 35859/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiOpenMarkerPopup", function() { return apiOpenMarkerPopup; }); 35860var apiOpenMarkerPopup = function apiOpenMarkerPopup(options, mapID) { 35861 // eslint-disable-next-line 35862 var self = REINOS_MAPS; 35863 var marker = self.searchMarker(mapID, options.key); //close infoWindow 35864 35865 if (marker !== undefined) { 35866 marker.openPopup(); 35867 } 35868}; 35869 35870/***/ }), 35871
35872/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/removeMarker.js": 35873/*!************************************************************************!*\ 35874 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/removeMarker.js ***! 35875 \************************************************************************/ 35876/*! exports provided: apiRemoveMarker */ 35877/***/ (function(module, __webpack_exports__, __webpack_require__) { 35878 35879"use strict"; 35880__webpack_require__.r(__webpack_exports__); 35881/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemoveMarker", function() { return apiRemoveMarker; }); 35882var apiRemoveMarker = function apiRemoveMarker(map, options, mapID) { 35883 // eslint-disable-next-line 35884 var self = REINOS_MAPS; 35885 var marker = self.searchMarker(mapID, options.key); 35886 35887 if (map && marker !== undefined) { 35888 //remove the marker 35889 map.map.removeLayer(marker); //remove from the cache 35890 35891 self.removeMarker(mapID, options.key); //also removing from the cluster if needed 35892 35893 if (map.marker_cluster.enabled) { 35894 map.marker_cluster.markers.removeLayer(marker); 35895 } //remove from the bounds 35896 35897 35898 map.bounds.markers = map.bounds.markers.filter(function (value) { 35899 return marker.getLatLng().lat !== value[0] && marker.getLatLng().lng !== value[1]; 35900 }); 35901 } 35902}; 35903 35904/***/ }), 35905
35906/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/removeMarkers.js": 35907/*!*************************************************************************!*\ 35908 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/removeMarkers.js ***! 35909 \*************************************************************************/ 35910/*! exports provided: apiRemoveMarkers */ 35911/***/ (function(module, __webpack_exports__, __webpack_require__) { 35912 35913"use strict"; 35914__webpack_require__.r(__webpack_exports__); 35915/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemoveMarkers", function() { return apiRemoveMarkers; }); 35916var apiRemoveMarkers = function apiRemoveMarkers(map, mapID) { 35917 // eslint-disable-next-line 35918 var self = REINOS_MAPS; 35919 var cachedMarkers = self.markers.get(mapID); 35920 35921 if (map && cachedMarkers !== undefined) { 35922 //remove markers 35923 cachedMarkers.forEach(function (_ref) { 35924 var marker = _ref.marker; 35925 return map.map.removeLayer(marker); 35926 }); //also removing from the cluster if needed 35927 35928 if (map.marker_cluster.enabled) { 35929 map.marker_cluster.markers.clearLayers(); 35930 } //reset marker cache 35931 35932 35933 self.markers.set(mapID, []); //reset the marker bounds 35934 35935 map.bounds.markers = []; 35936 } 35937}; 35938 35939/***/ }), 35940
35941/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/showMarker.js": 35942/*!**********************************************************************!*\ 35943 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/showMarker.js ***! 35944 \**********************************************************************/ 35945/*! exports provided: apiShowMarker */ 35946/***/ (function(module, __webpack_exports__, __webpack_require__) { 35947 35948"use strict"; 35949__webpack_require__.r(__webpack_exports__); 35950/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiShowMarker", function() { return apiShowMarker; }); 35951var apiShowMarker = function apiShowMarker(map, options, mapID) { 35952 // eslint-disable-next-line 35953 var self = REINOS_MAPS; 35954 var marker = self.searchMarker(mapID, options.key); 35955 35956 if (map && marker !== undefined) { 35957 marker._icon.style.display = 'block'; 35958 marker._shadow.style.display = 'block'; 35959 } 35960}; 35961 35962/***/ }), 35963
35964/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/showMarkers.js": 35965/*!***********************************************************************!*\ 35966 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/showMarkers.js ***! 35967 \***********************************************************************/ 35968/*! exports provided: apiShowMarkers */ 35969/***/ (function(module, __webpack_exports__, __webpack_require__) { 35970 35971"use strict"; 35972__webpack_require__.r(__webpack_exports__); 35973/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiShowMarkers", function() { return apiShowMarkers; }); 35974var apiShowMarkers = function apiShowMarkers(map, mapID) { 35975 // eslint-disable-next-line 35976 var self = REINOS_MAPS; 35977 var cachedMarkers = self.markers.get(mapID); 35978 35979 if (map && cachedMarkers !== undefined) { 35980 cachedMarkers.forEach(function (_ref) { 35981 var marker = _ref.marker; 35982 marker._icon.style.display = 'block'; 35983 marker._icon.style.display = 'block'; 35984 }); 35985 } 35986}; 35987 35988/***/ }), 35989
35990/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/toggleMarkerPopup.js": 35991/*!*****************************************************************************!*\ 35992 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/toggleMarkerPopup.js ***! 35993 \*****************************************************************************/ 35994/*! exports provided: apiToggleMarkerPopup */ 35995/***/ (function(module, __webpack_exports__, __webpack_require__) { 35996 35997"use strict"; 35998__webpack_require__.r(__webpack_exports__); 35999/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiToggleMarkerPopup", function() { return apiToggleMarkerPopup; }); 36000var apiToggleMarkerPopup = function apiToggleMarkerPopup(options, mapID) { 36001 // eslint-disable-next-line 36002 var self = REINOS_MAPS; 36003 var marker = self.searchMarker(mapID, options.key); //close infoWindow 36004 36005 if (marker !== undefined) { 36006 marker.togglePopup(); 36007 } 36008}; 36009 36010/***/ }), 36011
36012/***/ "./themes/user/reinos_maps/src/js/maps/api/marker/updateMarker.js": 36013/*!************************************************************************!*\ 36014 !*** ./themes/user/reinos_maps/src/js/maps/api/marker/updateMarker.js ***! 36015 \************************************************************************/ 36016/*! exports provided: apiUpdateMarker */ 36017/***/ (function(module, __webpack_exports__, __webpack_require__) { 36018 36019"use strict"; 36020__webpack_require__.r(__webpack_exports__); 36021/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUpdateMarker", function() { return apiUpdateMarker; }); 36022/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 36023/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 36024/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36025function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 36026 36027function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 36028 36029function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 36030 36031 36032 36033var apiUpdateMarker = function apiUpdateMarker(map, options, mapID) { 36034 // eslint-disable-next-line 36035 var self = REINOS_MAPS; 36036 var marker = self.searchMarker(mapID, options.key); //is there a map 36037 36038 if (map && marker !== undefined) { 36039 //remove key 36040 delete options.key; //set the new user options 36041 36042 marker.setUserOptions(options); //update the icon 36043 36044 if (options.icon !== undefined) { 36045 options.icon = _objectSpread({ 36046 //defaults 36047 'iconUrl': null, 36048 'iconSize': null, 36049 'className': '' 36050 }, options.icon); //empty icon, fallback to the default one 36051 36052 if (options.icon.iconUrl !== '') { 36053 marker.setIcon(leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.icon(options.icon)); 36054 } else { 36055 marker.setIcon(new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.Icon.Default()); 36056 } 36057 36058 delete options.icon; 36059 } //update tooltip 36060 36061 36062 if (options.tooltip !== undefined) { 36063 //set the tooltip 36064 self.updateTooltip(options.tooltip, marker); 36065 delete options.tooltip; 36066 } //set the popup content 36067 36068 36069 if (options.popup !== undefined && options.popup.popupContent !== undefined) { 36070 if (marker.getPopup() === undefined) { 36071 //init the popup 36072 marker = self.initPopup(marker, options.popup); 36073 } else { 36074 var decodedContent = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["decodeContent"])(options.popup.popupContent); 36075 marker.getPopup().setContent(decodedContent); 36076 } 36077 36078 delete options.popup.popupContent; 36079 } 36080 36081 return marker; 36082 } 36083}; 36084 36085/***/ }), 36086
36087/***/ "./themes/user/reinos_maps/src/js/maps/api/polygon/addPolygon.js": 36088/*!***********************************************************************!*\ 36089 !*** ./themes/user/reinos_maps/src/js/maps/api/polygon/addPolygon.js ***! 36090 \***********************************************************************/ 36091/*! exports provided: apiAddPolygon */ 36092/***/ (function(module, __webpack_exports__, __webpack_require__) { 36093 36094"use strict"; 36095__webpack_require__.r(__webpack_exports__); 36096/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddPolygon", function() { return apiAddPolygon; }); 36097/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 36098/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 36099/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36100function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 36101 36102function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 36103 36104function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 36105 36106 36107 36108var apiAddPolygon = function apiAddPolygon(map, options, mapID) { 36109 // eslint-disable-next-line 36110 var self = REINOS_MAPS; 36111 36112 if (map) { 36113 //merge default settings with given settings 36114 options = _objectSpread({ 36115 'stroke': true, 36116 'color': '#3388ff', 36117 'weight': 3, 36118 'opacity': 1.0, 36119 'fill': true, 36120 'fillColor': '#3388ff', 36121 'fillOpacity': 0.2, 36122 'className': 'maps_rectangle', 36123 'tooltip': {}, 36124 popup: {} 36125 }, options); 36126 36127 var _catchEvents = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["catchEvents"])(options), 36128 events = _catchEvents.events, 36129 optionsWithoutEvents = _catchEvents.options; 36130 36131 options = optionsWithoutEvents; //set the user options 36132 36133 var userOptions = _objectSpread({}, options); 36134 36135 var popupOptions = options.popup; 36136 delete options.popup; //reset the tooltip options 36137 36138 var tooltipOptions = options.tooltip; 36139 delete options.tooltip; 36140 var latlngs = options.latlngs; 36141 delete options.latlngs; //add bound 36142 36143 latlngs.forEach(function (latlng) { 36144 return map.bounds.polygons.push([latlng[0], latlng[1]]); 36145 }); 36146 var keys = typeof options.keys == 'string' ? options.keys : ''; 36147 var new_polygon = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.polygon(latlngs, options).addTo(map.map); //custom property and method to handle the userOptions 36148 36149 new_polygon.userOptions = userOptions; 36150 36151 new_polygon.setUserOptions = function (newUserOptions) { 36152 this.userOptions = _objectSpread(_objectSpread({}, this.userOptions), newUserOptions); 36153 }; //set the tooltip 36154 36155 36156 self.addTooltip(tooltipOptions, new_polygon); // assign the events to the feature 36157 36158 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["executeEvent"])(events, new_polygon); //init the popup 36159 36160 new_polygon = self.initPopup(new_polygon, popupOptions); //set the return value 36161 36162 var __returnValue = self.savePolygon(mapID, new_polygon, keys); //fit map 36163 36164 36165 self.fitBounds(map); 36166 return __returnValue; 36167 } 36168}; 36169 36170/***/ }), 36171
36172/***/ "./themes/user/reinos_maps/src/js/maps/api/polygon/getPolygon.js": 36173/*!***********************************************************************!*\ 36174 !*** ./themes/user/reinos_maps/src/js/maps/api/polygon/getPolygon.js ***! 36175 \***********************************************************************/ 36176/*! exports provided: apiGetPolygon */ 36177/***/ (function(module, __webpack_exports__, __webpack_require__) { 36178 36179"use strict"; 36180__webpack_require__.r(__webpack_exports__); 36181/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetPolygon", function() { return apiGetPolygon; }); 36182var apiGetPolygon = function apiGetPolygon(map, options, mapID) { 36183 // eslint-disable-next-line 36184 var self = REINOS_MAPS; //get the marker 36185 36186 var polygon = self.searchPolygon(mapID, options.key); //is there a map 36187 36188 if (map && polygon !== undefined) { 36189 return polygon; 36190 } 36191}; 36192 36193/***/ }), 36194
36195/***/ "./themes/user/reinos_maps/src/js/maps/api/polygon/index.js": 36196/*!******************************************************************!*\ 36197 !*** ./themes/user/reinos_maps/src/js/maps/api/polygon/index.js ***! 36198 \******************************************************************/ 36199/*! exports provided: apiAddPolygon, apiGetPolygon, apiUpdatePolygon, apiRemovePolygon */ 36200/***/ (function(module, __webpack_exports__, __webpack_require__) { 36201 36202"use strict"; 36203__webpack_require__.r(__webpack_exports__); 36204/* harmony import */ var _addPolygon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addPolygon */ "./themes/user/reinos_maps/src/js/maps/api/polygon/addPolygon.js"); 36205/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddPolygon", function() { return _addPolygon__WEBPACK_IMPORTED_MODULE_0__["apiAddPolygon"]; }); 36206 36207/* harmony import */ var _getPolygon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getPolygon */ "./themes/user/reinos_maps/src/js/maps/api/polygon/getPolygon.js"); 36208/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGetPolygon", function() { return _getPolygon__WEBPACK_IMPORTED_MODULE_1__["apiGetPolygon"]; }); 36209 36210/* harmony import */ var _updatePolygon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./updatePolygon */ "./themes/user/reinos_maps/src/js/maps/api/polygon/updatePolygon.js"); 36211/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiUpdatePolygon", function() { return _updatePolygon__WEBPACK_IMPORTED_MODULE_2__["apiUpdatePolygon"]; }); 36212 36213/* harmony import */ var _removePolygon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./removePolygon */ "./themes/user/reinos_maps/src/js/maps/api/polygon/removePolygon.js"); 36214/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemovePolygon", function() { return _removePolygon__WEBPACK_IMPORTED_MODULE_3__["apiRemovePolygon"]; }); 36215 36216 36217 36218 36219 36220 36221/***/ }), 36222
36223/***/ "./themes/user/reinos_maps/src/js/maps/api/polygon/removePolygon.js": 36224/*!**************************************************************************!*\ 36225 !*** ./themes/user/reinos_maps/src/js/maps/api/polygon/removePolygon.js ***! 36226 \**************************************************************************/ 36227/*! exports provided: apiRemovePolygon */ 36228/***/ (function(module, __webpack_exports__, __webpack_require__) { 36229 36230"use strict"; 36231__webpack_require__.r(__webpack_exports__); 36232/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemovePolygon", function() { return apiRemovePolygon; }); 36233var apiRemovePolygon = function apiRemovePolygon(map, options, mapID) { 36234 // eslint-disable-next-line 36235 var self = REINOS_MAPS; 36236 var polygon = self.searchPolygon(mapID, options.key); 36237 36238 if (map && polygon !== undefined) { 36239 polygon.remove(); //remove from the cache 36240 36241 self.removePolygon(mapID, options.key); 36242 polygon.getLatLngs().forEach(function (latlngs) { 36243 latlngs.forEach(function (latlng) { 36244 map.bounds.polygons = map.bounds.polygons.filter(function (val) { 36245 return val[0] !== latlng.lat && val[1] !== latlng.lng; 36246 }); 36247 }); 36248 }); 36249 } 36250}; 36251 36252/***/ }), 36253
36254/***/ "./themes/user/reinos_maps/src/js/maps/api/polygon/updatePolygon.js": 36255/*!**************************************************************************!*\ 36256 !*** ./themes/user/reinos_maps/src/js/maps/api/polygon/updatePolygon.js ***! 36257 \**************************************************************************/ 36258/*! exports provided: apiUpdatePolygon */ 36259/***/ (function(module, __webpack_exports__, __webpack_require__) { 36260 36261"use strict"; 36262__webpack_require__.r(__webpack_exports__); 36263/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUpdatePolygon", function() { return apiUpdatePolygon; }); 36264/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36265 36266var apiUpdatePolygon = function apiUpdatePolygon(map, options, mapID) { 36267 // eslint-disable-next-line 36268 var self = REINOS_MAPS; 36269 var polygon = self.searchPolygon(mapID, options.key); 36270 36271 if (map && polygon !== undefined) { 36272 //remove key 36273 delete options.key; //set the new user options 36274 36275 polygon.setUserOptions(options); //update tooltip 36276 36277 if (options.tooltip !== undefined) { 36278 //set the tooltip 36279 self.updateTooltip(options.tooltip, polygon); 36280 delete options.tooltip; 36281 } //if latlngs is found in the options, use that for redraw the line 36282 36283 36284 if (typeof options.latlngs !== 'undefined') { 36285 polygon.setLatLngs(options.latlngs); 36286 delete options.latlngs; 36287 } //set the new options 36288 36289 36290 polygon.setStyle(options); //set the popup content 36291 36292 if (options.popup !== undefined && options.popup.popupContent !== undefined) { 36293 if (polygon.getPopup() === undefined) { 36294 //init the popup 36295 polygon = self.initPopup(polygon, options.popup); 36296 } else { 36297 var decodedContent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["decodeContent"])(options.popup.popupContent); 36298 polygon.getPopup().setContent(decodedContent); 36299 } 36300 36301 delete options.popup.popupContent; 36302 } 36303 36304 return polygon; 36305 } 36306}; 36307 36308/***/ }), 36309
36310/***/ "./themes/user/reinos_maps/src/js/maps/api/polyline/addPolyline.js": 36311/*!*************************************************************************!*\ 36312 !*** ./themes/user/reinos_maps/src/js/maps/api/polyline/addPolyline.js ***! 36313 \*************************************************************************/ 36314/*! exports provided: apiAddPolyline */ 36315/***/ (function(module, __webpack_exports__, __webpack_require__) { 36316 36317"use strict"; 36318__webpack_require__.r(__webpack_exports__); 36319/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddPolyline", function() { return apiAddPolyline; }); 36320/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 36321/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 36322/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36323function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 36324 36325function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 36326 36327function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 36328 36329 36330 36331var apiAddPolyline = function apiAddPolyline(map, options, mapID) { 36332 // eslint-disable-next-line 36333 var self = REINOS_MAPS; 36334 36335 if (map) { 36336 //merge default settings with given settings 36337 options = _objectSpread({ 36338 'stroke': true, 36339 'color': '#3388ff', 36340 'weight': 3, 36341 'opacity': 1.0, 36342 'className': 'maps_rectangle', 36343 'tooltip': {}, 36344 popup: {} 36345 }, options); 36346 36347 var _catchEvents = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["catchEvents"])(options), 36348 events = _catchEvents.events, 36349 optionsWithoutEvents = _catchEvents.options; 36350 36351 options = optionsWithoutEvents; //set the user options 36352 36353 var userOptions = _objectSpread({}, options); 36354 36355 var popupOptions = options.popup; 36356 delete options.popup; //reset the tooltip options 36357 36358 var tooltipOptions = options.tooltip; 36359 delete options.tooltip; 36360 var latlngs = options.latlngs; 36361 delete options.latlngs; //add bound 36362 36363 latlngs.forEach(function (v) { 36364 return map.bounds.polylines.push([v[0], v[1]]); 36365 }); 36366 var keys = typeof options.keys === 'string' ? options.keys : ''; 36367 var new_polyline = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.polyline(latlngs, options).addTo(map.map); //custom property and method to handle the userOptions 36368 36369 new_polyline.userOptions = userOptions; 36370 36371 new_polyline.setUserOptions = function (newUserOptions) { 36372 this.userOptions = _objectSpread(_objectSpread({}, this.userOptions), newUserOptions); 36373 }; //set the tooltip 36374 36375 36376 self.addTooltip(tooltipOptions, new_polyline); // assign the events to the feature 36377 36378 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["executeEvent"])(events, new_polyline); //init the popup 36379 36380 new_polyline = self.initPopup(new_polyline, popupOptions); //set the return value 36381 36382 var __returnValue = self.savePolyline(mapID, new_polyline, keys); //fit map 36383 36384 36385 self.fitBounds(map); 36386 return __returnValue; 36387 } 36388}; 36389 36390/***/ }), 36391
36392/***/ "./themes/user/reinos_maps/src/js/maps/api/polyline/getPolyline.js": 36393/*!*************************************************************************!*\ 36394 !*** ./themes/user/reinos_maps/src/js/maps/api/polyline/getPolyline.js ***! 36395 \*************************************************************************/ 36396/*! exports provided: apiGetPolyline */ 36397/***/ (function(module, __webpack_exports__, __webpack_require__) { 36398 36399"use strict"; 36400__webpack_require__.r(__webpack_exports__); 36401/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetPolyline", function() { return apiGetPolyline; }); 36402var apiGetPolyline = function apiGetPolyline(map, options, mapID) { 36403 // eslint-disable-next-line 36404 var self = REINOS_MAPS; 36405 var polyline = self.searchPolyline(mapID, options.key); 36406 36407 if (map && polyline !== undefined) { 36408 return polyline; 36409 } 36410}; 36411 36412/***/ }), 36413
36414/***/ "./themes/user/reinos_maps/src/js/maps/api/polyline/index.js": 36415/*!*******************************************************************!*\ 36416 !*** ./themes/user/reinos_maps/src/js/maps/api/polyline/index.js ***! 36417 \*******************************************************************/ 36418/*! exports provided: apiAddPolyline, apiGetPolyline, apiUpdatePolyline, apiRemovePolyline */ 36419/***/ (function(module, __webpack_exports__, __webpack_require__) { 36420 36421"use strict"; 36422__webpack_require__.r(__webpack_exports__); 36423/* harmony import */ var _addPolyline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addPolyline */ "./themes/user/reinos_maps/src/js/maps/api/polyline/addPolyline.js"); 36424/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddPolyline", function() { return _addPolyline__WEBPACK_IMPORTED_MODULE_0__["apiAddPolyline"]; }); 36425 36426/* harmony import */ var _getPolyline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getPolyline */ "./themes/user/reinos_maps/src/js/maps/api/polyline/getPolyline.js"); 36427/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGetPolyline", function() { return _getPolyline__WEBPACK_IMPORTED_MODULE_1__["apiGetPolyline"]; }); 36428 36429/* harmony import */ var _updatePolyline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./updatePolyline */ "./themes/user/reinos_maps/src/js/maps/api/polyline/updatePolyline.js"); 36430/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiUpdatePolyline", function() { return _updatePolyline__WEBPACK_IMPORTED_MODULE_2__["apiUpdatePolyline"]; }); 36431 36432/* harmony import */ var _removePolyline__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./removePolyline */ "./themes/user/reinos_maps/src/js/maps/api/polyline/removePolyline.js"); 36433/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemovePolyline", function() { return _removePolyline__WEBPACK_IMPORTED_MODULE_3__["apiRemovePolyline"]; }); 36434 36435 36436 36437 36438 36439 36440/***/ }), 36441
36442/***/ "./themes/user/reinos_maps/src/js/maps/api/polyline/removePolyline.js": 36443/*!****************************************************************************!*\ 36444 !*** ./themes/user/reinos_maps/src/js/maps/api/polyline/removePolyline.js ***! 36445 \****************************************************************************/ 36446/*! exports provided: apiRemovePolyline */ 36447/***/ (function(module, __webpack_exports__, __webpack_require__) { 36448 36449"use strict"; 36450__webpack_require__.r(__webpack_exports__); 36451/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemovePolyline", function() { return apiRemovePolyline; }); 36452var apiRemovePolyline = function apiRemovePolyline(map, options, mapID) { 36453 // eslint-disable-next-line 36454 var self = REINOS_MAPS; 36455 var polyline = self.searchPolyline(mapID, options.key); 36456 36457 if (map && polyline !== undefined) { 36458 polyline.remove(); //remove from the cache 36459 36460 self.removePolyline(mapID, options.key); //rebuild the bounds 36461 36462 polyline.getLatLngs().forEach(function (latlng) { 36463 map.bounds.polylines = map.bounds.polylines.filter(function (val) { 36464 return val[0] !== latlng.lat && val[1] !== latlng.lng; 36465 }); 36466 }); 36467 } 36468}; 36469 36470/***/ }), 36471
36472/***/ "./themes/user/reinos_maps/src/js/maps/api/polyline/updatePolyline.js": 36473/*!****************************************************************************!*\ 36474 !*** ./themes/user/reinos_maps/src/js/maps/api/polyline/updatePolyline.js ***! 36475 \****************************************************************************/ 36476/*! exports provided: apiUpdatePolyline */ 36477/***/ (function(module, __webpack_exports__, __webpack_require__) { 36478 36479"use strict"; 36480__webpack_require__.r(__webpack_exports__); 36481/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUpdatePolyline", function() { return apiUpdatePolyline; }); 36482/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36483 36484var apiUpdatePolyline = function apiUpdatePolyline(map, options, mapID) { 36485 // eslint-disable-next-line 36486 var self = REINOS_MAPS; 36487 var polyline = self.searchPolyline(mapID, options.key); 36488 36489 if (map && polyline !== undefined) { 36490 //remove key 36491 delete options.key; //set the new user options 36492 36493 polyline.setUserOptions(options); //update tooltip 36494 36495 if (options.tooltip !== undefined) { 36496 //set the tooltip 36497 self.updateTooltip(options.tooltip, polyline); 36498 delete options.tooltip; 36499 } //if latlngs is found in the options, use that for redraw the line 36500 36501 36502 if (typeof options.latlngs !== 'undefined') { 36503 polyline.setLatLngs(options.latlngs); 36504 delete options.latlngs; 36505 } //set the new options 36506 36507 36508 polyline.setStyle(options); //set the popup content 36509 36510 if (options.popup !== undefined && options.popup.popupContent !== undefined) { 36511 if (polyline.getPopup() === undefined) { 36512 //init the popup 36513 polyline = self.initPopup(polyline, options.popup); 36514 } else { 36515 var decodedContent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["decodeContent"])(options.popup.popupContent); 36516 polyline.getPopup().setContent(decodedContent); 36517 } 36518 36519 delete options.popup.popupContent; 36520 } 36521 36522 return polyline; 36523 } 36524}; 36525 36526/***/ }), 36527
36528/***/ "./themes/user/reinos_maps/src/js/maps/api/rectangle/addRectangle.js": 36529/*!***************************************************************************!*\ 36530 !*** ./themes/user/reinos_maps/src/js/maps/api/rectangle/addRectangle.js ***! 36531 \***************************************************************************/ 36532/*! exports provided: apiAddRectangle */ 36533/***/ (function(module, __webpack_exports__, __webpack_require__) { 36534 36535"use strict"; 36536__webpack_require__.r(__webpack_exports__); 36537/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddRectangle", function() { return apiAddRectangle; }); 36538/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 36539/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 36540/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36541function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 36542 36543function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 36544 36545function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 36546 36547 36548 36549var apiAddRectangle = function apiAddRectangle(map, options, mapID) { 36550 // eslint-disable-next-line 36551 var self = REINOS_MAPS; 36552 36553 if (map) { 36554 //merge default settings with given settings 36555 options = _objectSpread({ 36556 'stroke': true, 36557 'color': '#3388ff', 36558 'weight': 3, 36559 'opacity': 1.0, 36560 'fill': true, 36561 'fillColor': '#3388ff', 36562 'fillOpacity': 0.2, 36563 'className': 'maps_rectangle', 36564 'tooltip': {}, 36565 popup: {} 36566 }, options); 36567 36568 var _catchEvents = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["catchEvents"])(options), 36569 events = _catchEvents.events, 36570 optionsWithoutEvents = _catchEvents.options; 36571 36572 options = optionsWithoutEvents; //set the user options 36573 36574 var userOptions = _objectSpread({}, options); 36575 36576 var popupOptions = options.popup; 36577 delete options.popup; //reset the tooltip options 36578 36579 var tooltipOptions = options.tooltip; 36580 delete options.tooltip; 36581 var bounds = options.bounds; 36582 delete options.bounds; //add bound 36583 36584 map.bounds.rectangles.push([bounds[0][0], bounds[0][1]], [bounds[1][0], bounds[1][1]]); 36585 var keys = typeof options.keys === 'string' ? options.keys : ''; 36586 var new_rectangle = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.rectangle(bounds, options).addTo(map.map); //custom property and method to handle the userOptions 36587 36588 new_rectangle.userOptions = userOptions; 36589 36590 new_rectangle.setUserOptions = function (newUserOptions) { 36591 this.userOptions = _objectSpread(_objectSpread({}, this.userOptions), newUserOptions); 36592 }; //set the tooltip 36593 36594 36595 self.addTooltip(tooltipOptions, new_rectangle); // assign the events to the feature 36596 36597 Object(_utils__WEBPACK_IMPORTED_MODULE_1__["executeEvent"])(events, new_rectangle); //init the popup 36598 36599 new_rectangle = self.initPopup(new_rectangle, popupOptions); //set the return value 36600 36601 var __returnValue = self.saveRectangle(mapID, new_rectangle, keys); //fit map 36602 36603 36604 self.fitBounds(map); 36605 return __returnValue; 36606 } 36607}; 36608 36609/***/ }), 36610
36611/***/ "./themes/user/reinos_maps/src/js/maps/api/rectangle/getRectangle.js": 36612/*!***************************************************************************!*\ 36613 !*** ./themes/user/reinos_maps/src/js/maps/api/rectangle/getRectangle.js ***! 36614 \***************************************************************************/ 36615/*! exports provided: apiGetRectangle */ 36616/***/ (function(module, __webpack_exports__, __webpack_require__) { 36617 36618"use strict"; 36619__webpack_require__.r(__webpack_exports__); 36620/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGetRectangle", function() { return apiGetRectangle; }); 36621var apiGetRectangle = function apiGetRectangle(map, options, mapID) { 36622 // eslint-disable-next-line 36623 var self = REINOS_MAPS; 36624 var rectangle = self.searchRectangle(mapID, options.key); //is there a map 36625 36626 if (map && rectangle !== undefined) { 36627 return rectangle; 36628 } 36629}; 36630 36631/***/ }), 36632
36633/***/ "./themes/user/reinos_maps/src/js/maps/api/rectangle/index.js": 36634/*!********************************************************************!*\ 36635 !*** ./themes/user/reinos_maps/src/js/maps/api/rectangle/index.js ***! 36636 \********************************************************************/ 36637/*! exports provided: apiAddRectangle, apiGetRectangle, apiUpdateRectangle, apiRemoveRectangle */ 36638/***/ (function(module, __webpack_exports__, __webpack_require__) { 36639 36640"use strict"; 36641__webpack_require__.r(__webpack_exports__); 36642/* harmony import */ var _addRectangle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addRectangle */ "./themes/user/reinos_maps/src/js/maps/api/rectangle/addRectangle.js"); 36643/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddRectangle", function() { return _addRectangle__WEBPACK_IMPORTED_MODULE_0__["apiAddRectangle"]; }); 36644 36645/* harmony import */ var _getRectangle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getRectangle */ "./themes/user/reinos_maps/src/js/maps/api/rectangle/getRectangle.js"); 36646/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGetRectangle", function() { return _getRectangle__WEBPACK_IMPORTED_MODULE_1__["apiGetRectangle"]; }); 36647 36648/* harmony import */ var _updateRectangle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./updateRectangle */ "./themes/user/reinos_maps/src/js/maps/api/rectangle/updateRectangle.js"); 36649/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiUpdateRectangle", function() { return _updateRectangle__WEBPACK_IMPORTED_MODULE_2__["apiUpdateRectangle"]; }); 36650 36651/* harmony import */ var _removeRectangle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./removeRectangle */ "./themes/user/reinos_maps/src/js/maps/api/rectangle/removeRectangle.js"); 36652/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiRemoveRectangle", function() { return _removeRectangle__WEBPACK_IMPORTED_MODULE_3__["apiRemoveRectangle"]; }); 36653 36654 36655 36656 36657 36658 36659/***/ }), 36660
36661/***/ "./themes/user/reinos_maps/src/js/maps/api/rectangle/removeRectangle.js": 36662/*!******************************************************************************!*\ 36663 !*** ./themes/user/reinos_maps/src/js/maps/api/rectangle/removeRectangle.js ***! 36664 \******************************************************************************/ 36665/*! exports provided: apiRemoveRectangle */ 36666/***/ (function(module, __webpack_exports__, __webpack_require__) { 36667 36668"use strict"; 36669__webpack_require__.r(__webpack_exports__); 36670/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiRemoveRectangle", function() { return apiRemoveRectangle; }); 36671var apiRemoveRectangle = function apiRemoveRectangle(map, options, mapID) { 36672 // eslint-disable-next-line 36673 var self = REINOS_MAPS; 36674 var rectangle = self.searchRectangle(mapID, options.key); //is there a map 36675 36676 if (map && rectangle !== undefined) { 36677 rectangle.remove(); //remove from the cache 36678 36679 self.removeRectangle(mapID, options.key); //remove from the bounds 36680 36681 var northEast = rectangle.getBounds().getNorthEast();
36682 var southWest = rectangle.getBounds().getSouthWest(); 36683 map.bounds.rectangles = map.bounds.rectangles.filter(function (value) { 36684 return northEast.lat !== value[0] && northEast.lng !== value[1] || southWest.lat !== value[0] && southWest.lng !== value[1]; 36685 }); 36686 } 36687}; 36688 36689/***/ }), 36690
36691/***/ "./themes/user/reinos_maps/src/js/maps/api/rectangle/updateRectangle.js": 36692/*!******************************************************************************!*\ 36693 !*** ./themes/user/reinos_maps/src/js/maps/api/rectangle/updateRectangle.js ***! 36694 \******************************************************************************/ 36695/*! exports provided: apiUpdateRectangle */ 36696/***/ (function(module, __webpack_exports__, __webpack_require__) { 36697 36698"use strict"; 36699__webpack_require__.r(__webpack_exports__); 36700/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiUpdateRectangle", function() { return apiUpdateRectangle; }); 36701/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36702 36703var apiUpdateRectangle = function apiUpdateRectangle(map, options, mapID) { 36704 // eslint-disable-next-line 36705 var self = REINOS_MAPS; 36706 var rectangle = self.searchRectangle(mapID, options.key); //is there a map 36707 36708 if (map && rectangle !== undefined) { 36709 //remove key 36710 delete options.key; //set the new user options 36711 36712 rectangle.setUserOptions(options); //update tooltip 36713 36714 if (options.tooltip !== undefined) { 36715 //set the tooltip 36716 self.updateTooltip(options.tooltip, rectangle); 36717 delete options.tooltip; 36718 } //if latlngs is found in the options, use that for redraw the line 36719 36720 36721 if (typeof options.latlngs !== 'undefined') { 36722 rectangle.setLatLngs(options.latlngs); 36723 delete options.latlngs; 36724 } //set the new options 36725 36726 36727 rectangle.setStyle(options); //set the popup content 36728 36729 if (options.popup !== undefined && options.popup.popupContent !== undefined) { 36730 if (rectangle.getPopup() === undefined) { 36731 //init the popup 36732 rectangle = self.initPopup(rectangle, options.popup); 36733 } else { 36734 var decodedContent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["decodeContent"])(options.popup.popupContent); 36735 rectangle.getPopup().setContent(decodedContent); 36736 } 36737 36738 delete options.popup.popupContent; 36739 } 36740 36741 return rectangle; 36742 } 36743}; 36744 36745/***/ }), 36746
36747/***/ "./themes/user/reinos_maps/src/js/maps/api/utils/addGeoJson.js": 36748/*!*********************************************************************!*\ 36749 !*** ./themes/user/reinos_maps/src/js/maps/api/utils/addGeoJson.js ***! 36750 \*********************************************************************/ 36751/*! exports provided: apiAddGeoJson */ 36752/***/ (function(module, __webpack_exports__, __webpack_require__) { 36753 36754"use strict"; 36755__webpack_require__.r(__webpack_exports__); 36756/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddGeoJson", function() { return apiAddGeoJson; }); 36757/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 36758/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 36759 36760var apiAddGeoJson = function apiAddGeoJson(map, options) { 36761 // eslint-disable-next-line 36762 var self = REINOS_MAPS; 36763 36764 if (map) { 36765 //is there a dynamic given function for the styling? 36766 36767 /* 36768 REINOS_MAPS.setGeoJsonStyle(function(feature) { 36769 switch (feature.properties.party) { 36770 case 'Republican': return {color: "#ff0000"}; 36771 case 'Democrat': return {color: "#0000ff"}; 36772 }); 36773 */ 36774 if (typeof self._geojson.style === 'function') { 36775 options.style = self._geojson.style; 36776 } //call the geoJson function 36777 36778 36779 leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.geoJSON(options.json, { 36780 style: options.style, 36781 onEachFeature: function onEachFeature(feature, layer) { 36782 //enable the popup 36783 if (feature.properties && feature.properties.popupContent) { 36784 layer.bindPopup(feature.properties.popupContent); 36785 } //enable the tooltip 36786 36787 36788 if (feature.properties && feature.properties.name) { 36789 layer.bindTooltip(feature.properties.name); 36790 } //save the bounds 36791 36792 36793 if (typeof layer.getLatLngs === 'function') { 36794 layer.getLatLngs().flat().forEach(function (location) { 36795 map.bounds.geojson.push([location.lat, location.lng]); 36796 }); 36797 } else { 36798 var location = layer.getLatLng(); 36799 map.bounds.geojson.push([location.lat, location.lng]); 36800 } 36801 } 36802 }).addTo(map.map); //fit map 36803 36804 self.fitBounds(map); 36805 } 36806}; 36807 36808/***/ }), 36809
36810/***/ "./themes/user/reinos_maps/src/js/maps/api/utils/addKml.js": 36811/*!*****************************************************************!*\ 36812 !*** ./themes/user/reinos_maps/src/js/maps/api/utils/addKml.js ***! 36813 \*****************************************************************/ 36814/*! exports provided: apiAddKml */ 36815/***/ (function(module, __webpack_exports__, __webpack_require__) { 36816 36817"use strict"; 36818__webpack_require__.r(__webpack_exports__); 36819/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiAddKml", function() { return apiAddKml; }); 36820/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 36821/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 36822/* harmony import */ var _libs_leaflet_kml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../libs/leaflet-kml */ "./themes/user/reinos_maps/src/js/libs/leaflet-kml.js"); 36823 36824 36825var apiAddKml = function apiAddKml(map, options) { 36826 var kmlLayer = new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.KML(options.url); 36827 kmlLayer.on('loaded', function (e) { 36828 map.map.fitBounds(e.target.getBounds()); 36829 }); 36830 map.map.addLayer(kmlLayer); 36831}; 36832 36833/***/ }), 36834
36835/***/ "./themes/user/reinos_maps/src/js/maps/api/utils/geoLocation.js": 36836/*!**********************************************************************!*\ 36837 !*** ./themes/user/reinos_maps/src/js/maps/api/utils/geoLocation.js ***! 36838 \**********************************************************************/ 36839/*! exports provided: apiGeoLocation */ 36840/***/ (function(module, __webpack_exports__, __webpack_require__) { 36841 36842"use strict"; 36843__webpack_require__.r(__webpack_exports__); 36844/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGeoLocation", function() { return apiGeoLocation; }); 36845var _this = undefined; 36846 36847var apiGeoLocation = function apiGeoLocation(options) { 36848 _this.geolocate({ 36849 success: function success(pos) { 36850 if (typeof options.callback === 'function') { 36851 options.callback(pos); 36852 } 36853 } 36854 }); 36855}; 36856 36857/***/ }), 36858
36859/***/ "./themes/user/reinos_maps/src/js/maps/api/utils/geocode.js": 36860/*!******************************************************************!*\ 36861 !*** ./themes/user/reinos_maps/src/js/maps/api/utils/geocode.js ***! 36862 \******************************************************************/ 36863/*! exports provided: apiGeocode */ 36864/***/ (function(module, __webpack_exports__, __webpack_require__) { 36865 36866"use strict"; 36867__webpack_require__.r(__webpack_exports__); 36868/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apiGeocode", function() { return apiGeocode; }); 36869/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 36870 36871 36872var search = function search(type, options, baseUrl) { 36873 var sessionKey = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["createUUID"])(); 36874 return fetch("".concat(baseUrl, "&type=").concat(type), { 36875 method: 'post', 36876 headers: { 36877 'Content-Type': 'application/x-www-form-urlencoded' 36878 }, 36879 body: "input=".concat(options[type]) 36880 }).then(function (res) { 36881 return res.json(); 36882 }).then(function (result) { 36883 if (options.callback && typeof options.callback === 'function') { 36884 options.callback(result, type, sessionKey); 36885 } 36886 }); 36887}; 36888 36889var apiGeocode = function apiGeocode(options) { 36890 if (options.latlng !== undefined) { 36891 search('latlng', options, window.REINOS_MAPS.api_path); 36892 } 36893 36894 if (options.address !== undefined) { 36895 search('address', options, window.REINOS_MAPS.api_path); 36896 } 36897 36898 if (options.ip !== undefined) { 36899 search('ip', options, window.REINOS_MAPS.api_path); 36900 } 36901}; 36902 36903/***/ }), 36904
36905/***/ "./themes/user/reinos_maps/src/js/maps/api/utils/index.js": 36906/*!****************************************************************!*\ 36907 !*** ./themes/user/reinos_maps/src/js/maps/api/utils/index.js ***! 36908 \****************************************************************/ 36909/*! exports provided: apiAddGeoJson, apiAddKml, apiGeoLocation, apiGeocode */ 36910/***/ (function(module, __webpack_exports__, __webpack_require__) { 36911 36912"use strict"; 36913__webpack_require__.r(__webpack_exports__); 36914/* harmony import */ var _addGeoJson__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addGeoJson */ "./themes/user/reinos_maps/src/js/maps/api/utils/addGeoJson.js"); 36915/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddGeoJson", function() { return _addGeoJson__WEBPACK_IMPORTED_MODULE_0__["apiAddGeoJson"]; }); 36916 36917/* harmony import */ var _addKml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./addKml */ "./themes/user/reinos_maps/src/js/maps/api/utils/addKml.js"); 36918/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiAddKml", function() { return _addKml__WEBPACK_IMPORTED_MODULE_1__["apiAddKml"]; }); 36919 36920/* harmony import */ var _geoLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./geoLocation */ "./themes/user/reinos_maps/src/js/maps/api/utils/geoLocation.js"); 36921/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGeoLocation", function() { return _geoLocation__WEBPACK_IMPORTED_MODULE_2__["apiGeoLocation"]; }); 36922 36923/* harmony import */ var _geocode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./geocode */ "./themes/user/reinos_maps/src/js/maps/api/utils/geocode.js"); 36924/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "apiGeocode", function() { return _geocode__WEBPACK_IMPORTED_MODULE_3__["apiGeocode"]; }); 36925 36926 36927 36928 36929 36930 36931/***/ }), 36932
36933/***/ "./themes/user/reinos_maps/src/js/maps/events.js": 36934/*!*******************************************************!*\ 36935 !*** ./themes/user/reinos_maps/src/js/maps/events.js ***! 36936 \*******************************************************/ 36937/*! no exports provided */ 36938/***/ (function(module, __webpack_exports__, __webpack_require__) { 36939 36940"use strict"; 36941__webpack_require__.r(__webpack_exports__); 36942/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 36943function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 36944 36945function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 36946 36947function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 36948 36949function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 36950 36951 36952 36953var Event = /*#__PURE__*/function () { 36954 function Event() { 36955 _classCallCheck(this, Event); 36956 36957 _defineProperty(this, "queue", {}); 36958 36959 _defineProperty(this, "fired", []); 36960 } 36961 36962 _createClass(Event, [{ 36963 key: "fire", 36964 value: function fire(event) { 36965 var queue = this.queue[event]; 36966 36967 if (typeof queue === 'undefined') { 36968 return; 36969 } 36970 36971 while (queue.length) { 36972 queue.shift()(); 36973 } 36974 36975 this.fired[event] = true; 36976 } 36977 }, { 36978 key: "on", 36979 value: function on(event, callback) { 36980 if (this.fired[event] === true) { 36981 return callback(); 36982 } 36983 36984 if (typeof this.queue[event] === 'undefined') { 36985 this.queue[event] = []; 36986 } 36987 36988 this.queue[event].push(callback); 36989 } 36990 }]); 36991 36992 return Event; 36993}(); 36994 36995var _event = new Event(); // Expose the events 36996 36997 36998_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.on = function (event, callback) { 36999 _event.on(event, callback); 37000}; 37001 37002_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.fire = function (event) { 37003 _event.fire(event); 37004}; 37005 37006/***/ }), 37007
37008/***/ "./themes/user/reinos_maps/src/js/maps/feature/index.js": 37009/*!**************************************************************!*\ 37010 !*** ./themes/user/reinos_maps/src/js/maps/feature/index.js ***! 37011 \**************************************************************/ 37012/*! no exports provided */ 37013/***/ (function(module, __webpack_exports__, __webpack_require__) { 37014 37015"use strict"; 37016__webpack_require__.r(__webpack_exports__); 37017/* harmony import */ var _removeFeature__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./removeFeature */ "./themes/user/reinos_maps/src/js/maps/feature/removeFeature.js"); 37018/* harmony import */ var _saveFeature__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./saveFeature */ "./themes/user/reinos_maps/src/js/maps/feature/saveFeature.js"); 37019/* harmony import */ var _searchFeature__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./searchFeature */ "./themes/user/reinos_maps/src/js/maps/feature/searchFeature.js"); 37020 37021 37022 37023 37024/***/ }), 37025
vendor: 4,120 bytes, lines 37026-37075
37026/***/ "./themes/user/reinos_maps/src/js/maps/feature/removeFeature.js": 37027/*!**********************************************************************!*\ 37028 !*** ./themes/user/reinos_maps/src/js/maps/feature/removeFeature.js ***! 37029 \**********************************************************************/ 37030/*! no exports provided */ 37031/***/ (function(module, __webpack_exports__, __webpack_require__) { 37032 37033"use strict"; 37034__webpack_require__.r(__webpack_exports__); 37035/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37036function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 37037 37038function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 37039 37040function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 37041 37042function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 37043 37044function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } 37045 37046function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 37047 37048function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 37049 37050//---------------------------------------------- 37051//remove single marker 37052//---------------------------------------------- 37053 37054 37055_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removeMarker = function (mapID, key) { 37056 return this.removeFeature(mapID, 'marker', key); 37057}; 37058 37059_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removeCircle = function (mapID, key) { 37060 return this.removeFeature(mapID, 'circle', key); 37061}; 37062 37063_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removeRectangle = function (mapID, key) { 37064 return this.removeFeature(mapID, 'rectangle', key); 37065}; 37066 37067_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removePolyline = function (mapID, key) { 37068 return this.removeFeature(mapID, 'polyline', key); 37069}; 37070 37071_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removePolygon = function (mapID, key) { 37072 return this.removeFeature(mapID, 'polygon', key); 37073}; 37074 37075_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removeFeature = function (mapID, typeKey,
37075key) { 37076 var self = this; // Make it singular or plural 37077 37078 var singularTypeKey = typeKey.replace(/s$/, ''); 37079 var pluralTypeKey = singularTypeKey.slice() + 's'; 37080 var cachedItems = self[pluralTypeKey].get(mapID); 37081 37082 if (cachedItems !== undefined) { 37083 var _iterator = _createForOfIteratorHelper(cachedItems.entries()), 37084 _step; 37085 37086 try { 37087 for (_iterator.s(); !(_step = _iterator.n()).done;) { 37088 var _step$value = _slicedToArray(_step.value, 2), 37089 index = _step$value[0], 37090 item = _step$value[1]; 37091 37092 if (item.keys.has(key)) { 37093 // Remove the item 37094 cachedItems.splice(index, 1); // update the number 37095 37096 cachedItems = cachedItems.map(function (cachedItem) { 37097 cachedItem[singularTypeKey]["".concat(singularTypeKey, "Number")] = cachedItems.length; 37098 return cachedItem; 37099 }); // update the list of items 37100 37101 self[pluralTypeKey].set(mapID, cachedItems); // remove latlng from the cached Set() 37102 37103 if (singularTypeKey === 'marker') { 37104 var latlng = "".concat(item[singularTypeKey].getLatLng().lat, ",").concat(item[singularTypeKey].getLatLng().lng); 37105 self.latlngs["delete"](latlng); 37106 } 37107 } 37108 } 37109 } catch (err) { 37110 _iterator.e(err); 37111 } finally { 37112 _iterator.f(); 37113 } 37114 } 37115}; 37116 37117/***/ }), 37118
37119/***/ "./themes/user/reinos_maps/src/js/maps/feature/saveFeature.js": 37120/*!********************************************************************!*\ 37121 !*** ./themes/user/reinos_maps/src/js/maps/feature/saveFeature.js ***! 37122 \********************************************************************/ 37123/*! no exports provided */ 37124/***/ (function(module, __webpack_exports__, __webpack_require__) { 37125 37126"use strict"; 37127__webpack_require__.r(__webpack_exports__); 37128/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 37129/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37130function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 37131 37132//---------------------------------------------- 37133//save single marker 37134//---------------------------------------------- 37135 37136 37137 37138_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.saveMarker = function (mapID, marker, keys) { 37139 return this.saveFeature(mapID, 'marker', marker, keys); 37140}; 37141 37142_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.saveCircle = function (mapID, circle, keys) { 37143 return this.saveFeature(mapID, 'circle', circle, keys); 37144}; 37145 37146_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.saveRectangle = function (mapID, rectangle, keys) { 37147 return this.saveFeature(mapID, 'rectangle', rectangle, keys); 37148}; 37149 37150_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.savePolyline = function (mapID, polyline, keys) { 37151 return this.saveFeature(mapID, 'polyline', polyline, keys); 37152}; 37153 37154_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.savePolygon = function (mapID, polygon, keys) { 37155 return this.saveFeature(mapID, 'polygon', polygon, keys); 37156}; 37157 37158_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.saveFeature = function (mapID, typeKey, featureItem, keys) { 37159 var self = this; // Make it singular or plural 37160 37161 var singularTypeKey = typeKey.replace(/s$/, ''); 37162 var pluralTypeKey = singularTypeKey.slice() + 's'; 37163 var cachedItems = self[pluralTypeKey].get(mapID); 37164 37165 if (cachedItems === undefined) { 37166 cachedItems = []; 37167 self[pluralTypeKey].set(mapID, cachedItems); 37168 } //set markerNumber 37169 37170 37171 featureItem["".concat(singularTypeKey, "Number")] = cachedItems.length + 1; //set the uuid 37172 37173 featureItem["".concat(singularTypeKey, "UUID")] = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["createUUID"])(); //set the search keys 37174 37175 var searchKeys = new Set([featureItem["".concat(singularTypeKey, "Number")], featureItem["".concat(singularTypeKey, "UUID")]]); //add the extra keys 37176 37177 if (typeof keys === 'string') { 37178 var _keys = keys.split(':'); 37179 37180 _keys.forEach(function (_key) { 37181 _key = _key.trim(); 37182 searchKeys.add(_key); 37183 searchKeys.add(_key.toLowerCase()); 37184 searchKeys.add(Object(_utils__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(_key, ' ', '_')); 37185 searchKeys.add(Object(_utils__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(_key, ' ', '_').toLowerCase()); 37186 searchKeys.add(Object(_utils__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(_key, ' ', '-')); 37187 searchKeys.add(Object(_utils__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(_key, ' ', '-').toLowerCase()); 37188 }); 37189 } //set the arrays 37190 37191 37192 cachedItems.push(_defineProperty({ 37193 keys: searchKeys 37194 }, singularTypeKey, featureItem)); // save the markers 37195 37196 self[pluralTypeKey].set(mapID, cachedItems); //update latlngs collection 37197 37198 if (singularTypeKey === 'marker') { 37199 var latlng = "".concat(featureItem.getLatLng().lat, ",").concat(featureItem.getLatLng().lng); 37200 self.latlngs.add(latlng); 37201 } 37202 37203 return featureItem; 37204}; 37205 37206/***/ }), 37207
37208/***/ "./themes/user/reinos_maps/src/js/maps/feature/searchFeature.js": 37209/*!**********************************************************************!*\ 37210 !*** ./themes/user/reinos_maps/src/js/maps/feature/searchFeature.js ***! 37211 \**********************************************************************/ 37212/*! no exports provided */ 37213/***/ (function(module, __webpack_exports__, __webpack_require__) { 37214 37215"use strict"; 37216__webpack_require__.r(__webpack_exports__); 37217/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37218function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } 37219 37220function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 37221 37222function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 37223 37224//---------------------------------------------- 37225//set the markers to the arrays 37226//---------------------------------------------- 37227 37228 37229_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.searchMarker = function (mapID, key, multiple) { 37230 return this.searchFeature(mapID, 'marker', key, multiple); 37231}; 37232 37233_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.searchCircle = function (mapID, key, multiple) { 37234 return this.searchFeature(mapID, 'circle', key, multiple); 37235}; 37236 37237_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.searchRectangle = function (mapID, key, multiple) { 37238 return this.searchFeature(mapID, 'rectangle', key, multiple); 37239}; 37240 37241_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.searchPolyline = function (mapID, key, multiple) { 37242 return this.searchFeature(mapID, 'polyline', key, multiple); 37243}; 37244 37245_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.searchPolygon = function (mapID, key, multiple) { 37246 return this.searchFeature(mapID, 'polygon', key, multiple); 37247}; 37248 37249_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.searchFeature = function (mapID, typeKey, key, multiple) { 37250 multiple = multiple || false; 37251 var self = this; 37252 var returnItems = []; // Make it singular or plural 37253 37254 var singularTypeKey = typeKey.replace(/s$/, ''); 37255 var pluralTypeKey = singularTypeKey.slice() + 's'; //loop over the markers 37256 37257 var cachedItems = self[pluralTypeKey].get(mapID); 37258 37259 if (cachedItems !== undefined) { 37260 var _iterator = _createForOfIteratorHelper(cachedItems), 37261 _step; 37262 37263 try { 37264 for (_iterator.s(); !(_step = _iterator.n()).done;) { 37265 var cachedItem = _step.value; 37266 37267 if (cachedItem.keys.has(key)) { 37268 returnItems.push(cachedItem[singularTypeKey]); 37269 37270 if (!multiple) { 37271 break; 37272 } 37273 } 37274 } 37275 } catch (err) { 37276 _iterator.e(err); 37277 } finally { 37278 _iterator.f(); 37279 } 37280 } 37281 37282 if (!multiple) { 37283 return returnItems.shift(); 37284 } 37285 37286 return returnItems; 37287}; 37288 37289/***/ }), 37290
37291/***/ "./themes/user/reinos_maps/src/js/maps/fitBounds.js": 37292/*!**********************************************************!*\ 37293 !*** ./themes/user/reinos_maps/src/js/maps/fitBounds.js ***! 37294 \**********************************************************/ 37295/*! no exports provided */ 37296/***/ (function(module, __webpack_exports__, __webpack_require__) { 37297 37298"use strict"; 37299__webpack_require__.r(__webpack_exports__); 37300/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 37301function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 37302 37303function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 37304 37305function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 37306 37307function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } 37308 37309function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 37310 37311function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 37312 37313//Fit the Bounds 37314 37315 37316_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.fitBounds = function (map) { 37317 var allBounds = []; 37318 37319 if (map.fit.markers) { 37320 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.markers)); 37321 } 37322 37323 if (map.fit.circles) { 37324 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.circles)); 37325 } 37326 37327 if (map.fit.rectangles) { 37328 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.rectangles)); 37329 } 37330 37331 if (map.fit.polylines) { 37332 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.polylines)); 37333 } 37334 37335 if (map.fit.polygons) { 37336 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.polygons)); 37337 } 37338 37339 if (map.fit.geojson) { 37340 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.geojson)); 37341 } //routes are polylines, so fit the bounds on that 37342 37343 37344 if (map.fit.routes) { 37345 allBounds = [].concat(_toConsumableArray(allBounds), _toConsumableArray(map.bounds.polylines)); 37346 } 37347 37348 if (allBounds.length > 0) { 37349 map.map.fitBounds(allBounds); 37350 37351 if (map.fit.forceZoomOut > 0) { 37352 map.map.zoomOut(map.fit.forceZoomOut); 37353 } 37354 } 37355}; 37356 37357/***/ }), 37358
37359/***/ "./themes/user/reinos_maps/src/js/maps/geolocate.js": 37360/*!**********************************************************!*\ 37361 !*** ./themes/user/reinos_maps/src/js/maps/geolocate.js ***! 37362 \**********************************************************/ 37363/*! no exports provided */ 37364/***/ (function(module, __webpack_exports__, __webpack_require__) { 37365 37366"use strict"; 37367__webpack_require__.r(__webpack_exports__); 37368/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 37369//---------------------------------------------- 37370// GeoLocate function 37371//---------------------------------------------- 37372 37373 37374_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.geolocate = function (options) { 37375 var complete_callback = options.always || options.complete; 37376 37377 var error_callback = options.error || function () {}; 37378 37379 var success_callback = options.success || function () {}; 37380 37381 if (navigator.geolocation) { 37382 navigator.geolocation.getCurrentPosition(function (position) { 37383 success_callback(position); 37384 37385 if (complete_callback) { 37386 complete_callback(); 37387 } 37388 }, function (error) { 37389 error_callback(error); 37390 37391 if (complete_callback) { 37392 complete_callback(); 37393 } 37394 }, options.options); 37395 } else { 37396 if (complete_callback) { 37397 complete_callback(); 37398 } 37399 } 37400}; 37401 37402/***/ }), 37403
37404/***/ "./themes/user/reinos_maps/src/js/maps/index.js": 37405/*!******************************************************!*\ 37406 !*** ./themes/user/reinos_maps/src/js/maps/index.js ***! 37407 \******************************************************/ 37408/*! no exports provided */ 37409/***/ (function(module, __webpack_exports__, __webpack_require__) { 37410 37411"use strict"; 37412__webpack_require__.r(__webpack_exports__); 37413/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./api */ "./themes/user/reinos_maps/src/js/maps/api/index.js"); 37414/* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./map */ "./themes/user/reinos_maps/src/js/maps/map/index.js"); 37415/* harmony import */ var _mapData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapData */ "./themes/user/reinos_maps/src/js/maps/mapData/index.js"); 37416/* harmony import */ var _feature__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./feature */ "./themes/user/reinos_maps/src/js/maps/feature/index.js"); 37417/* harmony import */ var _overlay__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./overlay */ "./themes/user/reinos_maps/src/js/maps/overlay/index.js"); 37418/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tooltip */ "./themes/user/reinos_maps/src/js/maps/tooltip/index.js"); 37419/* harmony import */ var _addTiles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./addTiles */ "./themes/user/reinos_maps/src/js/maps/addTiles.js"); 37420/* harmony import */ var _fitBounds__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fitBounds */ "./themes/user/reinos_maps/src/js/maps/fitBounds.js"); 37421/* harmony import */ var _geolocate__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./geolocate */ "./themes/user/reinos_maps/src/js/maps/geolocate.js"); 37422/* harmony import */ var _initPopup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./initPopup */ "./themes/user/reinos_maps/src/js/maps/initPopup.js"); 37423/* harmony import */ var _ready__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ready */ "./themes/user/reinos_maps/src/js/maps/ready.js"); 37424/* harmony import */ var _setGeoJsonStyle__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./setGeoJsonStyle */ "./themes/user/reinos_maps/src/js/maps/setGeoJsonStyle.js"); 37425/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./events */ "./themes/user/reinos_maps/src/js/maps/events.js"); 37426/* harmony import */ var _reverseLatLngArray__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./reverseLatLngArray */ "./themes/user/reinos_maps/src/js/maps/reverseLatLngArray.js"); 37427/* harmony import */ var _reParseLatLngArray__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./reParseLatLngArray */ "./themes/user/reinos_maps/src/js/maps/reParseLatLngArray.js"); 37428 37429 37430 37431 37432 37433 37434 37435 37436 37437 37438 37439 37440 37441 37442 37443 37444/***/ }), 37445
37446/***/ "./themes/user/reinos_maps/src/js/maps/initPopup.js": 37447/*!**********************************************************!*\ 37448 !*** ./themes/user/reinos_maps/src/js/maps/initPopup.js ***! 37449 \**********************************************************/ 37450/*! no exports provided */ 37451/***/ (function(module, __webpack_exports__, __webpack_require__) { 37452 37453"use strict"; 37454__webpack_require__.r(__webpack_exports__); 37455/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 37456/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 37457/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 37458/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 37459function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 37460 37461function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 37462 37463function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 37464 37465 37466 37467 37468 37469_core__WEBPACK_IMPORTED_MODULE_1__["ReinosMaps"].prototype.initPopup = function (feature, popupOptions) { 37470 //merge default settings with given settings 37471 popupOptions = _objectSpread({ 37472 //Popup default 37473 'maxWidth': '300', 37474 'minWidth': '50', 37475 'maxHeight': null, 37476 'autoPan': true, 37477 'autoPanPaddingTopLeft': null, 37478 'autoPanPaddingBottomRight': null, 37479 'autoPanPadding': [5, 5], 37480 'keepInView': false, 37481 'closeButton': true, 37482 'autoClose': true, 37483 'closeOnEscapeKey': true, 37484 'closeOnClick': '*', 37485 'className': '', 37486 'popupContent': '' 37487 }, popupOptions); //convert, if the content is base64 encoded 37488 37489 popupOptions.popupContent = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["decodeContent"])(popupOptions.popupContent); //add popup to the feature if there is any content 37490 37491 if (popupOptions.popupContent && popupOptions.popupContent !== '') { 37492 var popup = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.popup(popupOptions).setContent(popupOptions.popupContent); 37493 feature.bindPopup(popup); 37494 } 37495 37496 return feature; 37497}; 37498 37499/***/ }), 37500
37501/***/ "./themes/user/reinos_maps/src/js/maps/map/getMap.js": 37502/*!***********************************************************!*\ 37503 !*** ./themes/user/reinos_maps/src/js/maps/map/getMap.js ***! 37504 \***********************************************************/ 37505/*! no exports provided */ 37506/***/ (function(module, __webpack_exports__, __webpack_require__) { 37507 37508"use strict"; 37509__webpack_require__.r(__webpack_exports__); 37510/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37511 37512 37513_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.getMap = function (id) { 37514 var cachedMap = this.maps.get(id); 37515 37516 if (cachedMap !== undefined) { 37517 return cachedMap; 37518 } 37519 37520 return false; 37521}; 37522 37523/***/ }), 37524
37525/***/ "./themes/user/reinos_maps/src/js/maps/map/index.js": 37526/*!**********************************************************!*\ 37527 !*** ./themes/user/reinos_maps/src/js/maps/map/index.js ***! 37528 \**********************************************************/ 37529/*! no exports provided */ 37530/***/ (function(module, __webpack_exports__, __webpack_require__) { 37531 37532"use strict"; 37533__webpack_require__.r(__webpack_exports__); 37534/* harmony import */ var _getMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getMap */ "./themes/user/reinos_maps/src/js/maps/map/getMap.js"); 37535/* harmony import */ var _setMap__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setMap */ "./themes/user/reinos_maps/src/js/maps/map/setMap.js"); 37536 37537 37538 37539/***/ }), 37540
37541/***/ "./themes/user/reinos_maps/src/js/maps/map/setMap.js": 37542/*!***********************************************************!*\ 37543 !*** ./themes/user/reinos_maps/src/js/maps/map/setMap.js ***! 37544 \***********************************************************/ 37545/*! no exports provided */ 37546/***/ (function(module, __webpack_exports__, __webpack_require__) { 37547 37548"use strict"; 37549__webpack_require__.r(__webpack_exports__); 37550/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 37551/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 37552/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_1__); 37553/* harmony import */ var leaflet_openweathermap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! leaflet-openweathermap */ "./node_modules/leaflet-openweathermap/leaflet-openweathermap.js"); 37554/* harmony import */ var leaflet_openweathermap__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(leaflet_openweathermap__WEBPACK_IMPORTED_MODULE_2__); 37555/* harmony import */ var leaflet_pegman_leaflet_pegman__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! leaflet-pegman/leaflet-pegman */ "./node_modules/leaflet-pegman/leaflet-pegman.js"); 37556/* harmony import */ var leaflet_pegman_leaflet_pegman__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(leaflet_pegman_leaflet_pegman__WEBPACK_IMPORTED_MODULE_3__); 37557/* harmony import */ var leaflet_markercluster__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! leaflet.markercluster */ "./node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js"); 37558/* harmony import */ var leaflet_markercluster__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(leaflet_markercluster__WEBPACK_IMPORTED_MODULE_4__); 37559/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37560function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 37561 37562function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 37563 37564function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 37565 37566 37567 37568 37569 37570 37571 37572 37573_core__WEBPACK_IMPORTED_MODULE_5__["ReinosMaps"].prototype.setMap = function (options) { 37574 //merge default settings with given settings 37575 options = _objectSpread({ 37576 'selector': '', 37577 'tiles': '', 37578 'tile_control_position': '', 37579 'zoom': '', 37580 'max_zoom': null, 37581 'min_zoom': null, 37582 'zoom_control': true, 37583 'zoom_control_position': '', 37584 'center': '', 37585 'width': '', 37586 'height': '', 37587 'scroll_wheel': true, 37588 'scale_control': true, 37589 'scale_control_position': '', 37590 'google_styled_map': '', 37591 'marker_cluster': {}, 37592 'fit_map': {}, 37593 'focus_current_location': false, 37594 'gesture_handling': true, 37595 'weather': {}, 37596 'googleStreetview': false, 37597 'crs': 'default' 37598 }, options); 37599 var self = this; 37600 37601 var raw_options = _objectSpread({}, options); 37602 37603 var map = {}; //default vars 37604 37605 var lat = self.def.lat; 37606 var lng = self.def.lng; // remove the # from the selector 37607 37608 options.selector = options.selector.replace('#', ''); //turn back the address, input_address and latlng 37609 37610 options.center = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["base64Decode"])(options.center); 37611 options.center = options.center.toString(); //override center by setting the center or zoom level 37612 37613 if (options.center !== undefined && options.center !== '') { 37614 options.center = options.center.split(','); 37615 37616 if (options.center.length === 1) { 37617 options.center = options.center[0].split('|'); 37618 } 37619 37620 var center = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["arrayToLatLng"])(Object(_utils__WEBPACK_IMPORTED_MODULE_0__["cleanArray"])([options.center])); 37621 lat = center[0].lat; 37622 lng = center[0].lng; 37623 } //set the width for the div 37624 37625 37626 var element = document.getElementById(options.selector); 37627 element.style.width = options.width; 37628 element.style.height = options.height; // set the zoom 37629 37630 var zoomOptions = {}; 37631 37632 if (options.min_zoom !== null) { 37633 zoomOptions.minZoom = options.min_zoom; 37634 } 37635 37636 if (options.max_zoom !== null) { 37637 zoomOptions.maxZoom = options.max_zoom; 37638 } //fire up the map 37639 37640 37641 map.map = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.map(options.selector, _objectSpread(_objectSpread({ 37642 crs: self.crs.get(options.crs), 37643 center: [lat, lng] 37644 }, zoomOptions), {}, { 37645 zoom: options.zoom, 37646 zoomControl: options.zoom_control, 37647 scrollWheelZoom: options.scroll_wheel, 37648 gestureHandling: options.gesture_handling 37649 })); //save the raw options 37650 37651 map.raw_options = raw_options; //set the positions of the zoom control 37652 37653 if (options.zoom_control) { 37654 map.map.zoomControl.setPosition(options.zoom_control_position); 37655 } 37656 37657 map.scaleControl = null; 37658 37659 if (options.scale_control) { 37660 map.scaleControl = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.control.scale({ 37661 position: options.scale_control_position 37662 }).addTo(map.map); 37663 } 37664 37665 self.addTiles(map, options.tiles, options.google_styled_map, options.tile_control_position); //init weather layers 37666 37667 map.weatherLayers = {}; 37668 37669 if (options.weather.layers.length > 0) {
37670 options.weather.layers.forEach(function (value) { 37671 //create the layer 37672 if (typeof leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.OWM[value.name] === 'function') { 37673 map.weatherLayers[value.name] = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.OWM[value.name].call(null, { 37674 showLegend: value.legend, 37675 opacity: value.opacity, 37676 appId: Object(_utils__WEBPACK_IMPORTED_MODULE_0__["base64Decode"])(options.weather.api) 37677 }); 37678 } //add the layer 37679 37680 37681 map.map.addLayer(map.weatherLayers[value.name]); 37682 }); 37683 } //focus on the users current location 37684 37685 37686 if (options.focus_current_location) { 37687 self.geolocate({ 37688 success: function success(pos) { 37689 map.map.panTo([pos.coords.latitude, pos.coords.longitude]); 37690 } 37691 }); 37692 } 37693 37694 if (options.googleStreetview) { 37695 var pegmanControl = new leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.Control.Pegman({ 37696 position: 'bottomright', 37697 // position of control inside the map 37698 theme: 'leaflet-pegman-v3-default' // or "leaflet-pegman-v3-small" 37699 37700 }); 37701 pegmanControl.addTo(map.map); 37702 } //save the marker cluster data 37703 37704 37705 map.marker_cluster = options.marker_cluster; //init the cluster class if needed 37706 37707 if (options.marker_cluster.enabled) { 37708 map.marker_cluster.markers = leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.markerClusterGroup({ 37709 showCoverageOnHover: map.marker_cluster.showCoverageOnHover, 37710 zoomToBoundsOnClick: map.marker_cluster.zoomToBoundsOnClick, 37711 spiderfyOnMaxZoom: map.marker_cluster.spiderfyOnMaxZoom, 37712 removeOutsideVisibleBounds: map.marker_cluster.removeOutsideVisibleBounds 37713 }); 37714 } // bound stuff, will handle by the API 37715 37716 37717 map.bounds = {}; 37718 map.bounds.routes = []; //routes are infact polylines 37719 37720 map.bounds.markers = []; 37721 map.bounds.circles = []; 37722 map.bounds.rectangles = []; 37723 map.bounds.polylines = []; 37724 map.bounds.polygons = []; 37725 map.bounds.geojson = []; //set the fit 37726 37727 map.fit = {}; 37728 map.fit.routes = options.fit_map.routes; //routes are infact polylines 37729 37730 map.fit.markers = options.fit_map.markers; 37731 map.fit.circles = options.fit_map.circles; 37732 map.fit.rectangles = options.fit_map.rectangles; 37733 map.fit.polylines = options.fit_map.polylines; 37734 map.fit.polygons = options.fit_map.polygons; 37735 map.fit.geojson = options.fit_map.geojson; 37736 map.fit.forceZoomOut = options.fit_map.forceZoomOut; //Add google like overlay 37737 37738 self.addOverlay(map, options); //save to the global object 37739 37740 self.maps.set(options.selector, map); //callback function when all things is ready 37741 37742 setTimeout(function () { 37743 return self.fire('maps.ready'); 37744 }, 500); 37745}; 37746 37747/***/ }), 37748
37749/***/ "./themes/user/reinos_maps/src/js/maps/mapData/index.js": 37750/*!**************************************************************!*\ 37751 !*** ./themes/user/reinos_maps/src/js/maps/mapData/index.js ***! 37752 \**************************************************************/ 37753/*! no exports provided */ 37754/***/ (function(module, __webpack_exports__, __webpack_require__) { 37755 37756"use strict"; 37757__webpack_require__.r(__webpack_exports__); 37758/* harmony import */ var _prepareMapData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./prepareMapData */ "./themes/user/reinos_maps/src/js/maps/mapData/prepareMapData.js"); 37759/* harmony import */ var _runPreparedMapData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./runPreparedMapData */ "./themes/user/reinos_maps/src/js/maps/mapData/runPreparedMapData.js"); 37760 37761 37762 37763/***/ }), 37764
37765/***/ "./themes/user/reinos_maps/src/js/maps/mapData/prepareMapData.js": 37766/*!***********************************************************************!*\ 37767 !*** ./themes/user/reinos_maps/src/js/maps/mapData/prepareMapData.js ***! 37768 \***********************************************************************/ 37769/*! no exports provided */ 37770/***/ (function(module, __webpack_exports__, __webpack_require__) { 37771 37772"use strict"; 37773__webpack_require__.r(__webpack_exports__); 37774/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37775//---------------------------------------------- 37776//save marker data to the prepare array 37777//---------------------------------------------- 37778 37779 37780_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.prepareMapData = function (type, data) { 37781 var self = this; //prepare holders, we save the data first to this array so we can do a bulk add 37782 37783 if (self._prepareMapData === undefined) { 37784 this._prepareMapData = {}; 37785 } //check the type name and make sure we add a S to the end 37786 // if(type.slice(-1) !== 's') { 37787 // type = type + 's'; 37788 // } 37789 //make sure we have a defined object 37790 37791 37792 if (self._prepareMapData[type] === undefined) { 37793 self._prepareMapData[type] = []; 37794 } //save it 37795 37796 37797 self._prepareMapData[type].push(data); 37798}; 37799 37800/***/ }), 37801
37802/***/ "./themes/user/reinos_maps/src/js/maps/mapData/runPreparedMapData.js": 37803/*!***************************************************************************!*\ 37804 !*** ./themes/user/reinos_maps/src/js/maps/mapData/runPreparedMapData.js ***! 37805 \***************************************************************************/ 37806/*! no exports provided */ 37807/***/ (function(module, __webpack_exports__, __webpack_require__) { 37808 37809"use strict"; 37810__webpack_require__.r(__webpack_exports__); 37811/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37812function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 37813 37814function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 37815 37816function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 37817 37818function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 37819 37820function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 37821 37822function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 37823 37824//---------------------------------------------- 37825//run through the saved prepared markers to add them to the map 37826//---------------------------------------------- 37827 37828 37829_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.runPreparedMapData = function (typeMapData) { 37830 var self = this; 37831 var prepareMapData = {}; //if we call this function with a type, just run that one 37832 37833 if (typeMapData !== undefined && self._prepareMapData[typeMapData] !== undefined) { 37834 //get the data for the specific type 37835 prepareMapData[typeMapData] = self._prepareMapData[typeMapData]; //no result, run through all of the prepared items 37836 } else { 37837 prepareMapData = self._prepareMapData; 37838 } //loop over the types 37839 37840 37841 Object.entries(prepareMapData).forEach(function (_ref) { 37842 var _ref2 = _slicedToArray(_ref, 2), 37843 type = _ref2[0], 37844 data = _ref2[1]; 37845 37846 //run the beforeReady event 37847 if (self._firedEvents[type] === undefined) { 37848 self._firedEvents[type + '.beforeReady'] = true; 37849 self.fire(type + '.beforeReady'); 37850 } //any result in the array 37851 37852 37853 if (data.length > 0) { 37854 //the method name should be have a uppercase 37855 var method = 'add' + type.charAt(0).toUpperCase() + type.slice(1); //make sure if we have an ending S, we remove it 37856 37857 if (method.slice(-1) === 's') { 37858 method = method.slice(0, -1); 37859 } //get the first one and delete it from the root array 37860 37861 37862 var mapData = data.shift(); //call the api 37863 37864 self.api(method, mapData, function () { 37865 // in the callback we call again, so we can loop over all the data objects 37866 self.runPreparedMapData(type); 37867 }); //no result, run the callback for the ready.type 37868 } else { 37869 //make sure we call it only once 37870 if (self._firedEvents[type] === undefined) { 37871 self._firedEvents[type + '.ready'] = true; 37872 setTimeout(function () { 37873 return self.fire(type + '.ready'); 37874 }, 100); 37875 } 37876 } 37877 }); 37878}; 37879 37880/***/ }), 37881
37882/***/ "./themes/user/reinos_maps/src/js/maps/overlay/addOverlay.js": 37883/*!*******************************************************************!*\ 37884 !*** ./themes/user/reinos_maps/src/js/maps/overlay/addOverlay.js ***! 37885 \*******************************************************************/ 37886/*! no exports provided */ 37887/***/ (function(module, __webpack_exports__, __webpack_require__) { 37888 37889"use strict"; 37890__webpack_require__.r(__webpack_exports__); 37891/* harmony import */ var _utils_replaceAll__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/replaceAll */ "./themes/user/reinos_maps/src/js/utils/replaceAll.js"); 37892/* harmony import */ var _utils_setInfowindowUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/setInfowindowUrl */ "./themes/user/reinos_maps/src/js/utils/setInfowindowUrl.js"); 37893/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 37894/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_2__); 37895/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37896/* harmony import */ var domtastic__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! domtastic */ "./node_modules/domtastic/src/index.js"); 37897 37898 37899 37900 37901 //---------------------------------------------- 37902//add a google like overlay like the iframe 37903//---------------------------------------------- 37904 37905_core__WEBPACK_IMPORTED_MODULE_3__["ReinosMaps"].prototype.addOverlay = function (map, options) { 37906 var latlng; 37907 var marker_object; //default 37908 37909 map.overlay = {}; 37910 map.overlay.enabled = false; 37911 map.overlay.position = options.overlay_position !== '' ? options.overlay_position : 'left'; 37912 map.overlay.html = options.overlay_html !== '' ? options.overlay_html : ''; //do the checks 37913 37914 if (options.latlng !== undefined && options.latlng[0] !== undefined) { 37915 latlng = options.latlng[0].split(','); 37916 marker_object = leaflet__WEBPACK_IMPORTED_MODULE_2___default.a.latLng(latlng[0], latlng[1]); 37917 map.overlay.html = Object(_utils_replaceAll__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(map.overlay.html, '[route_to_url]', Object(_utils_setInfowindowUrl__WEBPACK_IMPORTED_MODULE_1__["setInfoWindowUrl"])(marker_object, 'route_to')); 37918 map.overlay.html = Object(_utils_replaceAll__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(map.overlay.html, '[route_from_url]', Object(_utils_setInfowindowUrl__WEBPACK_IMPORTED_MODULE_1__["setInfoWindowUrl"])(marker_object, 'route_from')); 37919 map.overlay.html = Object(_utils_replaceAll__WEBPACK_IMPORTED_MODULE_0__["replaceAll"])(map.overlay.html, '[map_url]', Object(_utils_setInfowindowUrl__WEBPACK_IMPORTED_MODULE_1__["setInfoWindowUrl"])(marker_object, 'map')); 37920 } 37921 37922 if (map.overlay.html !== '') { 37923 if (Object(domtastic__WEBPACK_IMPORTED_MODULE_4__["default"])(options.selector).find('#custom_maps_overlay').length === 0) { 37924 var style = "margin: 10px;\n padding: 1px;\n -webkit-box-shadow: rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px;\n box-shadow: rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px;\n border-top-left-radius: 2px;\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px;\n border-bottom-left-radius: 2px;\n background-color: white;"; 37925 var html = "\n <div class=\"google-like-overlay-position\" style=\"z-index:999;position: absolute; ".concat(map.overlay.position, ": 0; top: 0;\">\n <div style=\"").concat(style, "\" id=\"custom_maps_overlay\">\n <div style=\"padding:5px;\" class=\"place-card google-like-overlay-content place-card-large\">").concat(map.overlay.html, "</div>\n </div>\n </div>"); 37926 Object(domtastic__WEBPACK_IMPORTED_MODULE_4__["default"])(map.raw_options.selector).prepend(html); 37927 } 37928 37929 map.overlay.enabled = true; 37930 } 37931}; 37932 37933/***/ }), 37934
37935/***/ "./themes/user/reinos_maps/src/js/maps/overlay/index.js": 37936/*!**************************************************************!*\ 37937 !*** ./themes/user/reinos_maps/src/js/maps/overlay/index.js ***! 37938 \**************************************************************/ 37939/*! no exports provided */ 37940/***/ (function(module, __webpack_exports__, __webpack_require__) { 37941 37942"use strict"; 37943__webpack_require__.r(__webpack_exports__); 37944/* harmony import */ var _addOverlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addOverlay */ "./themes/user/reinos_maps/src/js/maps/overlay/addOverlay.js"); 37945/* harmony import */ var _removeOverlay__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./removeOverlay */ "./themes/user/reinos_maps/src/js/maps/overlay/removeOverlay.js"); 37946/* harmony import */ var _updateOverlay__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./updateOverlay */ "./themes/user/reinos_maps/src/js/maps/overlay/updateOverlay.js"); 37947 37948 37949 37950 37951/***/ }), 37952
37953/***/ "./themes/user/reinos_maps/src/js/maps/overlay/removeOverlay.js": 37954/*!**********************************************************************!*\ 37955 !*** ./themes/user/reinos_maps/src/js/maps/overlay/removeOverlay.js ***! 37956 \**********************************************************************/ 37957/*! no exports provided */ 37958/***/ (function(module, __webpack_exports__, __webpack_require__) { 37959 37960"use strict"; 37961__webpack_require__.r(__webpack_exports__); 37962/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37963/* harmony import */ var domtastic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! domtastic */ "./node_modules/domtastic/src/index.js"); 37964//---------------------------------------------- 37965//remove a google like overlay like the iframe 37966//---------------------------------------------- 37967 37968 37969 37970_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.removeOverlay = function (map, options) { 37971 map.overlay.enabled = false; 37972 map.overlay.position = 'left'; 37973 map.overlay.html = ''; 37974 Object(domtastic__WEBPACK_IMPORTED_MODULE_1__["default"])(options.selector).find('#custom_maps_overlay').remove(); 37975}; 37976 37977/***/ }), 37978
37979/***/ "./themes/user/reinos_maps/src/js/maps/overlay/updateOverlay.js": 37980/*!**********************************************************************!*\ 37981 !*** ./themes/user/reinos_maps/src/js/maps/overlay/updateOverlay.js ***! 37982 \**********************************************************************/ 37983/*! no exports provided */ 37984/***/ (function(module, __webpack_exports__, __webpack_require__) { 37985 37986"use strict"; 37987__webpack_require__.r(__webpack_exports__); 37988/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 37989/* harmony import */ var domtastic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! domtastic */ "./node_modules/domtastic/src/index.js"); 37990//---------------------------------------------- 37991//update a google like overlay like the iframe 37992//---------------------------------------------- 37993 37994 37995 37996_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.updateOverlay = function (map, options) { 37997 var self = this; //default 37998 37999 map.overlay = map.overlay || {}; 38000 map.overlay.enabled = !!map.overlay.enabled; 38001 map.overlay.position = options.overlay_position !== '' ? options.overlay_position : map.overlay.position; 38002 map.overlay.html = options.overlay_html !== '' ? options.overlay_html : map.overlay.html; //no overlay? 38003 38004 if (Object(domtastic__WEBPACK_IMPORTED_MODULE_1__["default"])(map.raw_options.selector).find('.google-like-overlay-position').length === 0) { 38005 self.addOverlay(map, options); 38006 } 38007 38008 if (map.overlay.html !== undefined) { 38009 if (map.overlay.html === '') { 38010 self.removeOverlay(map, options); 38011 } else { 38012 Object(domtastic__WEBPACK_IMPORTED_MODULE_1__["default"])(map.raw_options.selector).find('.google-like-overlay-content').html(map.overlay.html); 38013 } 38014 } 38015 38016 if (map.overlay.position !== undefined) { 38017 Object(domtastic__WEBPACK_IMPORTED_MODULE_1__["default"])(map.raw_options.selector).find('.google-like-overlay-position').css('left', '').css('right', ''); 38018 Object(domtastic__WEBPACK_IMPORTED_MODULE_1__["default"])(map.raw_options.selector).find('.google-like-overlay-position').css(map.overlay.position, '0px'); 38019 } 38020}; 38021 38022/***/ }), 38023
38024/***/ "./themes/user/reinos_maps/src/js/maps/reParseLatLngArray.js": 38025/*!*******************************************************************!*\ 38026 !*** ./themes/user/reinos_maps/src/js/maps/reParseLatLngArray.js ***! 38027 \*******************************************************************/ 38028/*! no exports provided */ 38029/***/ (function(module, __webpack_exports__, __webpack_require__) { 38030 38031"use strict"; 38032__webpack_require__.r(__webpack_exports__); 38033/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 38034/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 38035 38036 38037 38038_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.reParseLatLngArray = function (array) { 38039 return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["reParseLatLngArray"])(array); 38040}; 38041 38042/***/ }), 38043
38044/***/ "./themes/user/reinos_maps/src/js/maps/ready.js": 38045/*!******************************************************!*\ 38046 !*** ./themes/user/reinos_maps/src/js/maps/ready.js ***! 38047 \******************************************************/ 38048/*! no exports provided */ 38049/***/ (function(module, __webpack_exports__, __webpack_require__) { 38050 38051"use strict"; 38052__webpack_require__.r(__webpack_exports__); 38053/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 38054//ready function, when this file is totally ready 38055 38056 38057_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.ready = function (callback) { 38058 this.on('maps.ready', callback); 38059}; 38060 38061/***/ }), 38062
38063/***/ "./themes/user/reinos_maps/src/js/maps/reverseLatLngArray.js": 38064/*!*******************************************************************!*\ 38065 !*** ./themes/user/reinos_maps/src/js/maps/reverseLatLngArray.js ***! 38066 \*******************************************************************/ 38067/*! no exports provided */ 38068/***/ (function(module, __webpack_exports__, __webpack_require__) { 38069 38070"use strict"; 38071__webpack_require__.r(__webpack_exports__); 38072/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 38073/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 38074//set the geoJSON style 38075 38076 38077 38078_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.reverseLatLngArray = function (array) { 38079 return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["reverseLatLngArray"])(array); 38080}; 38081 38082/***/ }), 38083
38084/***/ "./themes/user/reinos_maps/src/js/maps/setGeoJsonStyle.js": 38085/*!****************************************************************!*\ 38086 !*** ./themes/user/reinos_maps/src/js/maps/setGeoJsonStyle.js ***! 38087 \****************************************************************/ 38088/*! no exports provided */ 38089/***/ (function(module, __webpack_exports__, __webpack_require__) { 38090 38091"use strict"; 38092__webpack_require__.r(__webpack_exports__); 38093/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ "./themes/user/reinos_maps/src/js/core.js"); 38094//set the geoJSON style 38095 38096 38097_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.setGeoJsonStyle = function (style) { 38098 if (typeof style === 'function') { 38099 this._geojson.style = style; 38100 } else { 38101 throw new Error('Given parameter for style is not a function'); 38102 } 38103}; 38104 38105/***/ }), 38106
38107/***/ "./themes/user/reinos_maps/src/js/maps/tiles/appleMaps.js": 38108/*!****************************************************************!*\ 38109 !*** ./themes/user/reinos_maps/src/js/maps/tiles/appleMaps.js ***! 38110 \****************************************************************/ 38111/*! exports provided: addAppleMapsTile */ 38112/***/ (function(module, __webpack_exports__, __webpack_require__) { 38113 38114"use strict"; 38115__webpack_require__.r(__webpack_exports__); 38116/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAppleMapsTile", function() { return addAppleMapsTile; }); 38117/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 38118/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 38119/* harmony import */ var leaflet_mapkitmutant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet.mapkitmutant */ "./node_modules/leaflet.mapkitmutant/Leaflet.MapkitMutant.js"); 38120/* harmony import */ var leaflet_mapkitmutant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet_mapkitmutant__WEBPACK_IMPORTED_MODULE_1__); 38121/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./themes/user/reinos_maps/src/js/utils/index.js"); 38122 38123 38124 38125var addAppleMapsTile = function addAppleMapsTile(tile) { 38126 if (tile.api_key === '') { 38127 Object(_utils__WEBPACK_IMPORTED_MODULE_2__["throwError"])('Missing Api Key. Please enter a correct API Key in your Maps cp.'); 38128 } 38129 38130 var tileLayer = new leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.MapkitMutant({ 38131 type: tile.name.replace('apple_maps_', ''), 38132 authorizationCallback: function authorizationCallback(done) { 38133 done(tile.api_key); 38134 }, 38135 language: 'en', 38136 debugRectangle: false 38137 }); 38138 tileLayer.name = tile.name; 38139 tileLayer.label = tile.label || tile.name; 38140 return tileLayer; 38141}; 38142 38143/***/ }), 38144
38145/***/ "./themes/user/reinos_maps/src/js/maps/tiles/default.js": 38146/*!**************************************************************!*\ 38147 !*** ./themes/user/reinos_maps/src/js/maps/tiles/default.js ***! 38148 \**************************************************************/ 38149/*! exports provided: addTile */ 38150/***/ (function(module, __webpack_exports__, __webpack_require__) { 38151 38152"use strict"; 38153__webpack_require__.r(__webpack_exports__); 38154/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTile", function() { return addTile; }); 38155/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 38156/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 38157 38158var addTile = function addTile(tile) { 38159 var options = tile.options || {}; 38160 var url = tile.url || ''; 38161 var tileLayer = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.tileLayer(url, options); 38162 tileLayer.name = tile.name; 38163 tileLayer.label = tile.label || tile.name; 38164 return tileLayer; 38165}; 38166 38167/***/ }), 38168
38169/***/ "./themes/user/reinos_maps/src/js/maps/tiles/googleMaps.js": 38170/*!*****************************************************************!*\ 38171 !*** ./themes/user/reinos_maps/src/js/maps/tiles/googleMaps.js ***! 38172 \*****************************************************************/ 38173/*! exports provided: addGoogleTile */ 38174/***/ (function(module, __webpack_exports__, __webpack_require__) { 38175 38176"use strict"; 38177__webpack_require__.r(__webpack_exports__); 38178/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGoogleTile", function() { return addGoogleTile; }); 38179/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 38180/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 38181/* harmony import */ var leaflet_gridlayer_googlemutant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet.gridlayer.googlemutant */ "./node_modules/leaflet.gridlayer.googlemutant/Leaflet.GoogleMutant.js"); 38182/* harmony import */ var leaflet_gridlayer_googlemutant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet_gridlayer_googlemutant__WEBPACK_IMPORTED_MODULE_1__); 38183 38184 38185var addGoogleTile = function addGoogleTile(tile, googleStyledMap) { 38186 var tileLayer = leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.gridLayer.googleMutant({ 38187 type: tile.name.replace('google_maps_', ''), 38188 styles: googleStyledMap 38189 }); 38190 tileLayer.name = tile.name; 38191 tileLayer.label = tile.label || tile.name; 38192 return tileLayer; 38193}; 38194 38195/***/ }), 38196
38197/***/ "./themes/user/reinos_maps/src/js/maps/tiles/index.js": 38198/*!************************************************************!*\ 38199 !*** ./themes/user/reinos_maps/src/js/maps/tiles/index.js ***! 38200 \************************************************************/ 38201/*! exports provided: addAppleMapsTile, addTile, addGoogleTile */ 38202/***/ (function(module, __webpack_exports__, __webpack_require__) { 38203 38204"use strict"; 38205__webpack_require__.r(__webpack_exports__); 38206/* harmony import */ var _appleMaps__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./appleMaps */ "./themes/user/reinos_maps/src/js/maps/tiles/appleMaps.js"); 38207/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addAppleMapsTile", function() { return _appleMaps__WEBPACK_IMPORTED_MODULE_0__["addAppleMapsTile"]; }); 38208 38209/* harmony import */ var _default__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./default */ "./themes/user/reinos_maps/src/js/maps/tiles/default.js"); 38210/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addTile", function() { return _default__WEBPACK_IMPORTED_MODULE_1__["addTile"]; }); 38211 38212/* harmony import */ var _googleMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./googleMaps */ "./themes/user/reinos_maps/src/js/maps/tiles/googleMaps.js"); 38213/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addGoogleTile", function() { return _googleMaps__WEBPACK_IMPORTED_MODULE_2__["addGoogleTile"]; }); 38214 38215 38216 38217 38218 38219/***/ }), 38220
38221/***/ "./themes/user/reinos_maps/src/js/maps/tooltip/addTooltip.js": 38222/*!*******************************************************************!*\ 38223 !*** ./themes/user/reinos_maps/src/js/maps/tooltip/addTooltip.js ***! 38224 \*******************************************************************/ 38225/*! no exports provided */ 38226/***/ (function(module, __webpack_exports__, __webpack_require__) { 38227 38228"use strict"; 38229__webpack_require__.r(__webpack_exports__); 38230/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 38231function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 38232 38233function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 38234 38235function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 38236 38237//---------------------------------------------- 38238//add and update an tooltip 38239//---------------------------------------------- 38240 38241 38242_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.addTooltip = function (options, feature) { 38243 //merge default icon settings with given settings 38244 options = _objectSpread({ 38245 //defaults 38246 'direction': 'auto', 38247 'permanent': false, 38248 'sticky': false, 38249 'content': '' 38250 }, options); //set the tooltip 38251 38252 if (options.content && options.content !== '') { 38253 var content = options.content; 38254 delete options.content; 38255 feature.bindTooltip(content, options); 38256 } else { 38257 feature.unbindTooltip(); 38258 } 38259}; 38260 38261/***/ }), 38262
38263/***/ "./themes/user/reinos_maps/src/js/maps/tooltip/index.js": 38264/*!**************************************************************!*\ 38265 !*** ./themes/user/reinos_maps/src/js/maps/tooltip/index.js ***! 38266 \**************************************************************/ 38267/*! no exports provided */ 38268/***/ (function(module, __webpack_exports__, __webpack_require__) { 38269 38270"use strict"; 38271__webpack_require__.r(__webpack_exports__); 38272/* harmony import */ var _addTooltip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addTooltip */ "./themes/user/reinos_maps/src/js/maps/tooltip/addTooltip.js"); 38273/* harmony import */ var _updateTooltip__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./updateTooltip */ "./themes/user/reinos_maps/src/js/maps/tooltip/updateTooltip.js"); 38274 38275 38276 38277/***/ }), 38278
38279/***/ "./themes/user/reinos_maps/src/js/maps/tooltip/updateTooltip.js": 38280/*!**********************************************************************!*\ 38281 !*** ./themes/user/reinos_maps/src/js/maps/tooltip/updateTooltip.js ***! 38282 \**********************************************************************/ 38283/*! no exports provided */ 38284/***/ (function(module, __webpack_exports__, __webpack_require__) { 38285 38286"use strict"; 38287__webpack_require__.r(__webpack_exports__); 38288/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core */ "./themes/user/reinos_maps/src/js/core.js"); 38289// update a tooltip 38290 38291 38292_core__WEBPACK_IMPORTED_MODULE_0__["ReinosMaps"].prototype.updateTooltip = function (options, feature) { 38293 this.addTooltip(options, feature); 38294}; 38295 38296/***/ }), 38297
vendor: 2,456 bytes, lines 38298-38324
38298/***/ "./themes/user/reinos_maps/src/js/utils/arrayToLatLng.js": 38299/*!***************************************************************!*\ 38300 !*** ./themes/user/reinos_maps/src/js/utils/arrayToLatLng.js ***! 38301 \***************************************************************/ 38302/*! exports provided: arrayToLatLng */ 38303/***/ (function(module, __webpack_exports__, __webpack_require__) { 38304 38305"use strict"; 38306__webpack_require__.r(__webpack_exports__); 38307/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayToLatLng", function() { return arrayToLatLng; }); 38308/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 38309/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__); 38310function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 38311 38312function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 38313 38314function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 38315 38316function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 38317 38318function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 38319 38320function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 38321 38322 38323var arrayToLatLng = function arrayToLatLng(coords) { 38324 var new_coords = [];
38325 Object.entries(coords).forEach(function (_ref) { 38326 var _ref2 = _slicedToArray(_ref, 2), 38327 val = _ref2[1]; 38328 38329 if (typeof val === 'string') { 38330 val = val.split(','); 38331 } 38332 38333 var lat = parseFloat(val[0].trim()); 38334 var lng = parseFloat(val[1].trim()); 38335 new_coords.push(leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.latLng(lat, lng)); 38336 }); 38337 return new_coords; 38338}; 38339 38340/***/ }), 38341
38342/***/ "./themes/user/reinos_maps/src/js/utils/base64.js": 38343/*!********************************************************!*\ 38344 !*** ./themes/user/reinos_maps/src/js/utils/base64.js ***! 38345 \********************************************************/ 38346/*! exports provided: base64Decode, base64Encode */ 38347/***/ (function(module, __webpack_exports__, __webpack_require__) { 38348 38349"use strict"; 38350__webpack_require__.r(__webpack_exports__); 38351/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "base64Decode", function() { return base64Decode; }); 38352/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "base64Encode", function() { return base64Encode; }); 38353/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-base64 */ "./node_modules/js-base64/base64.mjs"); 38354 38355var base64Decode = function base64Decode(string) { 38356 return Object(js_base64__WEBPACK_IMPORTED_MODULE_0__["decode"])(string); 38357}; 38358var base64Encode = function base64Encode(string) { 38359 return Object(js_base64__WEBPACK_IMPORTED_MODULE_0__["encode"])(string); 38360}; 38361 38362/***/ }), 38363
38364/***/ "./themes/user/reinos_maps/src/js/utils/catchEvents.js": 38365/*!*************************************************************!*\ 38366 !*** ./themes/user/reinos_maps/src/js/utils/catchEvents.js ***! 38367 \*************************************************************/ 38368/*! exports provided: catchEvents, executeEvent */ 38369/***/ (function(module, __webpack_exports__, __webpack_require__) { 38370 38371"use strict"; 38372__webpack_require__.r(__webpack_exports__); 38373/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "catchEvents", function() { return catchEvents; }); 38374/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "executeEvent", function() { return executeEvent; }); 38375function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 38376 38377function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 38378 38379function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 38380 38381function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 38382 38383function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 38384 38385function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 38386 38387/** 38388 * Catch events and return them. But also return the options without the events back 38389 * 38390 * @param options 38391 * @returns {{options, events: *[]}} 38392 */ 38393function catchEvents(options) { 38394 var events = []; 38395 Object.entries(options).forEach(function (_ref) { 38396 var _ref2 = _slicedToArray(_ref, 2), 38397 index = _ref2[0], 38398 v = _ref2[1]; 38399 38400 if (typeof v === 'string' && index.match('event_')) { 38401 events.push({ 38402 name: index.replace('event_', ''), 38403 value: v 38404 }); 38405 delete options[index]; 38406 } 38407 }); 38408 return { 38409 events: events, 38410 options: options 38411 }; 38412} 38413function executeEvent(events, feature) { 38414 //add events from the option array 38415 events.forEach(function (event) {
38416 feature.on(event.name, function () { 38417 //because we get the data as string, we need eval() 38418 eval(event.value); 38419 }); 38420 }); 38421} 38422 38423/***/ }), 38424
38425/***/ "./themes/user/reinos_maps/src/js/utils/cleanArray.js": 38426/*!************************************************************!*\ 38427 !*** ./themes/user/reinos_maps/src/js/utils/cleanArray.js ***! 38428 \************************************************************/ 38429/*! exports provided: cleanArray */ 38430/***/ (function(module, __webpack_exports__, __webpack_require__) { 38431 38432"use strict"; 38433__webpack_require__.r(__webpack_exports__); 38434/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanArray", function() { return cleanArray; }); 38435var cleanArray = function cleanArray(arr) { 38436 return arr.filter(function (v) { 38437 return v !== ''; 38438 }); 38439}; 38440 38441/***/ }), 38442
38443/***/ "./themes/user/reinos_maps/src/js/utils/createUuid.js": 38444/*!************************************************************!*\ 38445 !*** ./themes/user/reinos_maps/src/js/utils/createUuid.js ***! 38446 \************************************************************/ 38447/*! exports provided: createUUID */ 38448/***/ (function(module, __webpack_exports__, __webpack_require__) { 38449 38450"use strict"; 38451__webpack_require__.r(__webpack_exports__); 38452/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUUID", function() { return createUUID; }); 38453var createUUID = function createUUID() { 38454 // http://www.ietf.org/rfc/rfc4122.txt 38455 var s = []; 38456 var hexDigits = '0123456789abcdef'; 38457 38458 for (var i = 0; i < 36; i++) { 38459 s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); 38460 } 38461 38462 s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010 38463 38464 s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 38465 38466 s[8] = s[13] = s[18] = s[23] = '-'; 38467 return s.join(''); 38468}; 38469 38470/***/ }), 38471
38472/***/ "./themes/user/reinos_maps/src/js/utils/crs.js": 38473/*!*****************************************************!*\ 38474 !*** ./themes/user/reinos_maps/src/js/utils/crs.js ***! 38475 \*****************************************************/ 38476/*! exports provided: crsCollection */ 38477/***/ (function(module, __webpack_exports__, __webpack_require__) { 38478 38479"use strict"; 38480__webpack_require__.r(__webpack_exports__); 38481/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "crsCollection", function() { return crsCollection; }); 38482/* harmony import */ var proj4leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! proj4leaflet */ "./node_modules/proj4leaflet/src/proj4leaflet.js"); 38483/* harmony import */ var proj4leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(proj4leaflet__WEBPACK_IMPORTED_MODULE_0__); 38484/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); 38485/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_1__); 38486 38487 38488var crsCollection = new Map(); // This is the important task, where we set the map projection to EPSG:3006 38489 38490crsCollection.set('EPSG:3006', new proj4leaflet__WEBPACK_IMPORTED_MODULE_0___default.a.CRS('EPSG:3006', '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', { 38491 resolutions: [4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8], 38492 origin: [-1200000.000000, 8500000.000000], 38493 bounds: leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.bounds([-1200000.000000, 8500000.000000], [4305696.000000, 2994304.000000]) 38494})); 38495crsCollection.set('default', leaflet__WEBPACK_IMPORTED_MODULE_1___default.a.CRS.EPSG3857); 38496 38497/***/ }), 38498
38499/***/ "./themes/user/reinos_maps/src/js/utils/decodeContent.js": 38500/*!***************************************************************!*\ 38501 !*** ./themes/user/reinos_maps/src/js/utils/decodeContent.js ***! 38502 \***************************************************************/ 38503/*! exports provided: decodeContent */ 38504/***/ (function(module, __webpack_exports__, __webpack_require__) { 38505 38506"use strict"; 38507__webpack_require__.r(__webpack_exports__); 38508/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeContent", function() { return decodeContent; }); 38509/* harmony import */ var _base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base64 */ "./themes/user/reinos_maps/src/js/utils/base64.js"); 38510 38511function decodeContent(content) { 38512 //convert, if the content is base64 encoded 38513 var isBase64Encoded = content && content.startsWith('base64:'); 38514 return isBase64Encoded ? Object(_base64__WEBPACK_IMPORTED_MODULE_0__["base64Decode"])(content.replace('base64:', '')) : content; 38515} 38516 38517/***/ }), 38518
38519/***/ "./themes/user/reinos_maps/src/js/utils/index.js": 38520/*!*******************************************************!*\ 38521 !*** ./themes/user/reinos_maps/src/js/utils/index.js ***! 38522 \*******************************************************/ 38523/*! exports provided: arrayToLatLng, base64Decode, base64Encode, cleanArray, createUUID, parseToJsArray, removeEmptyProps, replaceAll, setInfoWindowUrl, strToBool, uniqueArray, reverseLatLngArray, reParseLatLngArray, throwError, crsCollection, decodeContent, catchEvents, executeEvent */ 38524/***/ (function(module, __webpack_exports__, __webpack_require__) { 38525 38526"use strict"; 38527__webpack_require__.r(__webpack_exports__); 38528/* harmony import */ var _arrayToLatLng__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayToLatLng */ "./themes/user/reinos_maps/src/js/utils/arrayToLatLng.js"); 38529/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "arrayToLatLng", function() { return _arrayToLatLng__WEBPACK_IMPORTED_MODULE_0__["arrayToLatLng"]; }); 38530 38531/* harmony import */ var _base64__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base64 */ "./themes/user/reinos_maps/src/js/utils/base64.js"); 38532/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "base64Decode", function() { return _base64__WEBPACK_IMPORTED_MODULE_1__["base64Decode"]; }); 38533 38534/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "base64Encode", function() { return _base64__WEBPACK_IMPORTED_MODULE_1__["base64Encode"]; }); 38535 38536/* harmony import */ var _cleanArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cleanArray */ "./themes/user/reinos_maps/src/js/utils/cleanArray.js"); 38537/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cleanArray", function() { return _cleanArray__WEBPACK_IMPORTED_MODULE_2__["cleanArray"]; }); 38538 38539/* harmony import */ var _createUuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./createUuid */ "./themes/user/reinos_maps/src/js/utils/createUuid.js"); 38540/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createUUID", function() { return _createUuid__WEBPACK_IMPORTED_MODULE_3__["createUUID"]; }); 38541 38542/* harmony import */ var _parseToJsArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./parseToJsArray */ "./themes/user/reinos_maps/src/js/utils/parseToJsArray.js"); 38543/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseToJsArray", function() { return _parseToJsArray__WEBPACK_IMPORTED_MODULE_4__["parseToJsArray"]; }); 38544 38545/* harmony import */ var _removeEmptyProps__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./removeEmptyProps */ "./themes/user/reinos_maps/src/js/utils/removeEmptyProps.js"); 38546/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeEmptyProps", function() { return _removeEmptyProps__WEBPACK_IMPORTED_MODULE_5__["removeEmptyProps"]; }); 38547 38548/* harmony import */ var _replaceAll__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./replaceAll */ "./themes/user/reinos_maps/src/js/utils/replaceAll.js"); 38549/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "replaceAll", function() { return _replaceAll__WEBPACK_IMPORTED_MODULE_6__["replaceAll"]; }); 38550 38551/* harmony import */ var _setInfowindowUrl__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./setInfowindowUrl */ "./themes/user/reinos_maps/src/js/utils/setInfowindowUrl.js"); 38552/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setInfoWindowUrl", function() { return _setInfowindowUrl__WEBPACK_IMPORTED_MODULE_7__["setInfoWindowUrl"]; }); 38553 38554/* harmony import */ var _strToBool__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./strToBool */ "./themes/user/reinos_maps/src/js/utils/strToBool.js"); 38555/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "strToBool", function() { return _strToBool__WEBPACK_IMPORTED_MODULE_8__["strToBool"]; }); 38556 38557/* harmony import */ var _uniqueArray__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./uniqueArray */ "./themes/user/reinos_maps/src/js/utils/uniqueArray.js"); 38558/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uniqueArray", function() { return _uniqueArray__WEBPACK_IMPORTED_MODULE_9__["uniqueArray"]; }); 38559 38560/* harmony import */ var _reverseLatLngArray__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./reverseLatLngArray */ "./themes/user/reinos_maps/src/js/utils/reverseLatLngArray.js"); 38561/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reverseLatLngArray", function() { return _reverseLatLngArray__WEBPACK_IMPORTED_MODULE_10__["reverseLatLngArray"]; }); 38562 38563/* harmony import */ var _reParseLatLngArray__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./reParseLatLngArray */ "./themes/user/reinos_maps/src/js/utils/reParseLatLngArray.js"); 38564/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reParseLatLngArray", function() { return _reParseLatLngArray__WEBPACK_IMPORTED_MODULE_11__["reParseLatLngArray"]; }); 38565 38566/* harmony import */ var _throwError__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./throwError */ "./themes/user/reinos_maps/src/js/utils/throwError.js"); 38567/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwError", function() { return _throwError__WEBPACK_IMPORTED_MODULE_12__["throwError"]; }); 38568 38569/* harmony import */ var _crs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./crs */ "./themes/user/reinos_maps/src/js/utils/crs.js"); 38570/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "crsCollection", function() { return _crs__WEBPACK_IMPORTED_MODULE_13__["crsCollection"]; }); 38571 38572/* harmony import */ var _decodeContent__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./decodeContent */ "./themes/user/reinos_maps/src/js/utils/decodeContent.js"); 38573/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "decodeContent", function() { return _decodeContent__WEBPACK_IMPORTED_MODULE_14__["decodeContent"]; }); 38574 38575/* harmony import */ var _catchEvents__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./catchEvents */ "./themes/user/reinos_maps/src/js/utils/catchEvents.js"); 38576/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "catchEvents", function() { return _catchEvents__WEBPACK_IMPORTED_MODULE_15__["catchEvents"]; }); 38577 38578/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "executeEvent", function() { return _catchEvents__WEBPACK_IMPORTED_MODULE_15__["executeEvent"]; }); 38579 38580 38581 38582 38583 38584 38585 38586 38587 38588 38589 38590 38591 38592 38593 38594 38595 38596 38597/***/ }), 38598
38599/***/ "./themes/user/reinos_maps/src/js/utils/parseToJsArray.js": 38600/*!****************************************************************!*\ 38601 !*** ./themes/user/reinos_maps/src/js/utils/parseToJsArray.js ***! 38602 \****************************************************************/ 38603/*! exports provided: parseToJsArray */ 38604/***/ (function(module, __webpack_exports__, __webpack_require__) { 38605 38606"use strict"; 38607__webpack_require__.r(__webpack_exports__); 38608/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseToJsArray", function() { return parseToJsArray; }); 38609/* harmony import */ var _removeEmptyProps__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./removeEmptyProps */ "./themes/user/reinos_maps/src/js/utils/removeEmptyProps.js"); 38610/* harmony import */ var _base64__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base64 */ "./themes/user/reinos_maps/src/js/utils/base64.js"); 38611 38612 38613var parseToJsArray = function parseToJsArray(string, split) { 38614 string = Object(_base64__WEBPACK_IMPORTED_MODULE_1__["base64Decode"])(string); 38615 38616 if (typeof string === 'string' && string !== '' && string === '[]') { 38617 // disabled because some language give error on this 38618 // russia for example 38619 // https://devot-ee.com/add-ons/support/gmaps/viewthread/15970 38620 // string = decodeURIComponent(escape(string)); 38621 if (split || split === undefined) { 38622 return Object(_removeEmptyProps__WEBPACK_IMPORTED_MODULE_0__["removeEmptyProps"])(string.split('|')); 38623 } else { 38624 return string; 38625 } 38626 } 38627 38628 return ''; 38629}; 38630 38631/***/ }), 38632
38633/***/ "./themes/user/reinos_maps/src/js/utils/reParseLatLngArray.js": 38634/*!********************************************************************!*\ 38635 !*** ./themes/user/reinos_maps/src/js/utils/reParseLatLngArray.js ***! 38636 \********************************************************************/ 38637/*! exports provided: reParseLatLngArray */ 38638/***/ (function(module, __webpack_exports__, __webpack_require__) { 38639 38640"use strict"; 38641__webpack_require__.r(__webpack_exports__); 38642/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reParseLatLngArray", function() { return reParseLatLngArray; }); 38643var reParseLatLngArray = function reParseLatLngArray(array) { 38644 var points = []; 38645 array.forEach(function (val) { 38646 return points.push([parseFloat(val[0]), parseFloat(val[1])]); 38647 }); 38648 return points; 38649}; 38650 38651/***/ }), 38652
vendor: 2,912 bytes, lines 38653-38693
38653/***/ "./themes/user/reinos_maps/src/js/utils/removeEmptyProps.js": 38654/*!******************************************************************!*\ 38655 !*** ./themes/user/reinos_maps/src/js/utils/removeEmptyProps.js ***! 38656 \******************************************************************/ 38657/*! exports provided: removeEmptyProps */ 38658/***/ (function(module, __webpack_exports__, __webpack_require__) { 38659 38660"use strict"; 38661__webpack_require__.r(__webpack_exports__); 38662/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeEmptyProps", function() { return removeEmptyProps; }); 38663function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 38664 38665function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 38666 38667function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 38668 38669function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 38670 38671function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 38672 38673function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 38674 38675function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 38676 38677var removeEmptyProps = function removeEmptyProps(obj) { 38678 return Object.fromEntries(Object.entries(obj).filter(function (_ref) { 38679 var _ref2 = _slicedToArray(_ref, 2), 38680 v = _ref2[1]; 38681 38682 return v != null; 38683 }).map(function (_ref3) { 38684 var _ref4 = _slicedToArray(_ref3, 2), 38685 k = _ref4[0], 38686 v = _ref4[1]; 38687 38688 return _typeof(v) === 'object' ? [k, removeEmptyProps(v)] : [k, v]; 38689 })); 38690}; 38691 38692/***/ }), 38693
38694/***/ "./themes/user/reinos_maps/src/js/utils/replaceAll.js": 38695/*!************************************************************!*\ 38696 !*** ./themes/user/reinos_maps/src/js/utils/replaceAll.js ***! 38697 \************************************************************/ 38698/*! exports provided: replaceAll */ 38699/***/ (function(module, __webpack_exports__, __webpack_require__) { 38700 38701"use strict"; 38702__webpack_require__.r(__webpack_exports__); 38703/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "replaceAll", function() { return replaceAll; }); 38704var replaceAll = function replaceAll(str, search, replace) { 38705 return str.split(search).join(replace); 38706}; 38707 38708/***/ }), 38709
38710/***/ "./themes/user/reinos_maps/src/js/utils/reverseLatLngArray.js": 38711/*!********************************************************************!*\ 38712 !*** ./themes/user/reinos_maps/src/js/utils/reverseLatLngArray.js ***! 38713 \********************************************************************/ 38714/*! exports provided: reverseLatLngArray */ 38715/***/ (function(module, __webpack_exports__, __webpack_require__) { 38716 38717"use strict"; 38718__webpack_require__.r(__webpack_exports__); 38719/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reverseLatLngArray", function() { return reverseLatLngArray; }); 38720var reverseLatLngArray = function reverseLatLngArray(array) { 38721 var points = []; 38722 array.forEach(function (val) { 38723 return points.push([parseFloat(val[1]), parseFloat(val[0])]); 38724 }); 38725 return points; 38726}; 38727 38728/***/ }), 38729
38730/***/ "./themes/user/reinos_maps/src/js/utils/setInfowindowUrl.js": 38731/*!******************************************************************!*\ 38732 !*** ./themes/user/reinos_maps/src/js/utils/setInfowindowUrl.js ***! 38733 \******************************************************************/ 38734/*! exports provided: setInfoWindowUrl */ 38735/***/ (function(module, __webpack_exports__, __webpack_require__) { 38736 38737"use strict"; 38738__webpack_require__.r(__webpack_exports__); 38739/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setInfoWindowUrl", function() { return setInfoWindowUrl; }); 38740var setInfoWindowUrl = function setInfoWindowUrl(marker_object, type) { 38741 var url = ''; 38742 38743 if (marker_object !== undefined) { 38744 switch (type) { 38745 case 'route_to': 38746 url = 'https://maps.google.com/maps?daddr=' + marker_object.lat() + ',' + marker_object.lng(); //http://maps.google.com/maps?saddr=start&daddr=end 38747 38748 break; 38749 38750 case 'route_from': 38751 url = 'https://maps.google.com/maps?saddr=' + marker_object.lat() + ',' + marker_object.lng(); //http://maps.google.com/maps?saddr=start&daddr=end 38752 38753 break; 38754 38755 default: 38756 case 'map': 38757 url = 'https://maps.google.com/maps?q=' + marker_object.lat() + ',' + marker_object.lng(); //https://maps.google.com/maps?q= 38758 38759 break; 38760 } 38761 } 38762 38763 return url; 38764}; 38765 38766/***/ }), 38767
38768/***/ "./themes/user/reinos_maps/src/js/utils/strToBool.js": 38769/*!***********************************************************!*\ 38770 !*** ./themes/user/reinos_maps/src/js/utils/strToBool.js ***! 38771 \***********************************************************/ 38772/*! exports provided: strToBool */ 38773/***/ (function(module, __webpack_exports__, __webpack_require__) { 38774 38775"use strict"; 38776__webpack_require__.r(__webpack_exports__); 38777/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strToBool", function() { return strToBool; }); 38778var strToBool = function strToBool(s) { 38779 var regex = /^\s*(true|1|on)\s*$/i; 38780 return regex.test(s); 38781}; 38782 38783/***/ }), 38784
38785/***/ "./themes/user/reinos_maps/src/js/utils/throwError.js": 38786/*!************************************************************!*\ 38787 !*** ./themes/user/reinos_maps/src/js/utils/throwError.js ***! 38788 \************************************************************/ 38789/*! exports provided: throwError */ 38790/***/ (function(module, __webpack_exports__, __webpack_require__) { 38791 38792"use strict"; 38793__webpack_require__.r(__webpack_exports__); 38794/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwError", function() { return throwError; }); 38795var throwError = function throwError(message) { 38796 return console.error("REINOS_MAPS: ".concat(message)); 38797}; 38798 38799/***/ }), 38800
38801/***/ "./themes/user/reinos_maps/src/js/utils/uniqueArray.js": 38802/*!*************************************************************!*\ 38803 !*** ./themes/user/reinos_maps/src/js/utils/uniqueArray.js ***! 38804 \*************************************************************/ 38805/*! exports provided: uniqueArray */ 38806/***/ (function(module, __webpack_exports__, __webpack_require__) { 38807 38808"use strict"; 38809__webpack_require__.r(__webpack_exports__); 38810/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueArray", function() { return uniqueArray; }); 38811var uniqueArray = function uniqueArray(array) { 38812 return array.filter(function (item, index) { 38813 return array.indexOf(item) === index; 38814 }); 38815}; 38816 38817/***/ }), 38818
38819/***/ "./themes/user/reinos_maps/src/style/index.scss": 38820/*!******************************************************!*\ 38821 !*** ./themes/user/reinos_maps/src/style/index.scss ***! 38822 \******************************************************/ 38823/*! exports provided: default */ 38824/***/ (function(module, __webpack_exports__, __webpack_require__) { 38825 38826"use strict"; 38827__webpack_require__.r(__webpack_exports__); 38828/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.p + "maps.bundle.css"); 38829 38830/***/ })
38830, 38831 38832/***/ 0: 38833/*!******************************************************************************************************!*\ 38834 !*** multi ./themes/user/reinos_maps/src/js/index.js ./themes/user/reinos_maps/src/style/index.scss ***! 38835 \******************************************************************************************************/ 38836/*! no static exports found */ 38837/***/ (function(module, exports, __webpack_require__) { 38838 38839__webpack_require__(/*! ./themes/user/reinos_maps/src/js/index.js */"./themes/user/reinos_maps/src/js/index.js"); 38840module.exports = __webpack_require__(/*! ./themes/user/reinos_maps/src/style/index.scss */"./themes/user/reinos_maps/src/style/index.scss"); 38841 38842 38843/***/ }) 38844 38845/******/ }); 38846//# sourceMappingURL=maps.development.bundle.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.