@elastic/ems-client 8.3.2 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ci/jobs/defaults.yml +2 -2
- package/CHANGELOG.md +10 -0
- package/package.json +4 -4
- package/src/ems_client.ts +1 -2
- package/src/index.ts +1 -0
- package/src/tms_service.ts +12 -5
- package/src/utils.ts +1 -1
- package/target/index.d.ts +1 -0
- package/target/node/ems_client.js +17 -89
- package/target/node/ems_service.js +4 -18
- package/target/node/file_layer.js +7 -56
- package/target/node/index.js +8 -4
- package/target/node/tms_service.js +21 -90
- package/target/node/utils.js +7 -14
- package/target/tms_service.d.ts +2 -2
- package/target/web/ems_client.js +48 -160
- package/target/web/ems_service.js +8 -23
- package/target/web/file_layer.js +15 -68
- package/target/web/index.js +3 -1
- package/target/web/tms_service.js +70 -241
- package/target/web/utils.js +8 -17
- package/test/ems_client_colour.test.ts +62 -1
|
@@ -1,63 +1,42 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
-
|
|
5
3
|
function _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."); }
|
|
6
|
-
|
|
7
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
6
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { 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 = it.call(o); }, 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; } } }; }
|
|
12
|
-
|
|
13
7
|
function _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); }
|
|
14
|
-
|
|
15
8
|
function _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; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
function _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; }
|
|
20
|
-
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
21
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
22
|
-
|
|
23
13
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
-
|
|
25
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
32
|
-
|
|
33
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
34
|
-
|
|
15
|
+
function _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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
36
|
-
|
|
37
20
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
38
|
-
|
|
39
21
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
40
|
-
|
|
41
22
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
42
|
-
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
function
|
|
46
|
-
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
47
27
|
/*
|
|
48
28
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
49
29
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
50
30
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
51
31
|
* 2.0.
|
|
52
32
|
*/
|
|
33
|
+
|
|
53
34
|
import _ from 'lodash';
|
|
54
35
|
import { AbstractEmsService } from './ems_service';
|
|
55
36
|
import { colorizeColor } from './utils';
|
|
56
37
|
export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
57
38
|
_inherits(TMSService, _AbstractEmsService);
|
|
58
|
-
|
|
59
39
|
var _super = _createSuper(TMSService);
|
|
60
|
-
|
|
61
40
|
/*
|
|
62
41
|
List of supported languages with labels and OMT codes extracted
|
|
63
42
|
from https://openmaptiles.org/languages
|
|
@@ -68,34 +47,27 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
68
47
|
/*
|
|
69
48
|
Suggested default operations for the different EMS styles
|
|
70
49
|
*/
|
|
50
|
+
|
|
71
51
|
function TMSService(config, emsClient, proxyPath) {
|
|
72
52
|
var _this;
|
|
73
|
-
|
|
74
53
|
_classCallCheck(this, TMSService);
|
|
75
|
-
|
|
76
54
|
_this = _super.call(this, config, emsClient, proxyPath);
|
|
77
|
-
|
|
78
55
|
_defineProperty(_assertThisInitialized(_this), "_config", void 0);
|
|
79
|
-
|
|
80
|
-
_defineProperty(_assertThisInitialized(_this), "_getRasterStyleJson", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "_getRasterStyleJson", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
81
57
|
var rasterUrl, url;
|
|
82
|
-
return
|
|
58
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
59
|
while (1) {
|
|
84
60
|
switch (_context.prev = _context.next) {
|
|
85
61
|
case 0:
|
|
86
62
|
rasterUrl = _this._getStyleUrlForLocale('raster');
|
|
87
|
-
|
|
88
63
|
if (!rasterUrl) {
|
|
89
64
|
_context.next = 6;
|
|
90
65
|
break;
|
|
91
66
|
}
|
|
92
|
-
|
|
93
67
|
url = _this._proxyPath + _this._getAbsoluteUrl(rasterUrl);
|
|
94
68
|
return _context.abrupt("return", _this._emsClient.getManifest(_this._emsClient.extendUrlWithParams(url)));
|
|
95
|
-
|
|
96
69
|
case 6:
|
|
97
70
|
return _context.abrupt("return");
|
|
98
|
-
|
|
99
71
|
case 7:
|
|
100
72
|
case "end":
|
|
101
73
|
return _context.stop();
|
|
@@ -103,31 +75,25 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
103
75
|
}
|
|
104
76
|
}, _callee);
|
|
105
77
|
}))));
|
|
106
|
-
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonRaw", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonRaw", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
108
79
|
var vectorUrl, url, vectorJson;
|
|
109
|
-
return
|
|
80
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
110
81
|
while (1) {
|
|
111
82
|
switch (_context2.prev = _context2.next) {
|
|
112
83
|
case 0:
|
|
113
84
|
vectorUrl = _this._getStyleUrlForLocale('vector');
|
|
114
|
-
|
|
115
85
|
if (!vectorUrl) {
|
|
116
86
|
_context2.next = 9;
|
|
117
87
|
break;
|
|
118
88
|
}
|
|
119
|
-
|
|
120
89
|
url = _this._proxyPath + _this._getAbsoluteUrl(vectorUrl);
|
|
121
90
|
_context2.next = 5;
|
|
122
91
|
return _this._emsClient.getManifest(_this._emsClient.extendUrlWithParams(url));
|
|
123
|
-
|
|
124
92
|
case 5:
|
|
125
93
|
vectorJson = _context2.sent;
|
|
126
94
|
return _context2.abrupt("return", _objectSpread({}, vectorJson));
|
|
127
|
-
|
|
128
95
|
case 9:
|
|
129
96
|
return _context2.abrupt("return");
|
|
130
|
-
|
|
131
97
|
case 10:
|
|
132
98
|
case "end":
|
|
133
99
|
return _context2.stop();
|
|
@@ -135,84 +101,64 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
135
101
|
}
|
|
136
102
|
}, _callee2);
|
|
137
103
|
}))));
|
|
138
|
-
|
|
139
|
-
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonInlined", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
104
|
+
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonInlined", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
140
105
|
var vectorJson, inlinedSources, sources, _iterator, _step, _sourceName, url, _sourceJson$tiles, sourceUrl, extendedUrl, sourceJson, tiles;
|
|
141
|
-
|
|
142
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
106
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
143
107
|
while (1) {
|
|
144
108
|
switch (_context3.prev = _context3.next) {
|
|
145
109
|
case 0:
|
|
146
110
|
_context3.next = 2;
|
|
147
111
|
return _this._getVectorStyleJsonRaw();
|
|
148
|
-
|
|
149
112
|
case 2:
|
|
150
113
|
vectorJson = _context3.sent;
|
|
151
|
-
|
|
152
114
|
if (!vectorJson) {
|
|
153
115
|
_context3.next = 44;
|
|
154
116
|
break;
|
|
155
117
|
}
|
|
156
|
-
|
|
157
118
|
inlinedSources = {};
|
|
158
119
|
sources = vectorJson.sources;
|
|
159
120
|
_iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(sources));
|
|
160
121
|
_context3.prev = 7;
|
|
161
|
-
|
|
162
122
|
_iterator.s();
|
|
163
|
-
|
|
164
123
|
case 9:
|
|
165
124
|
if ((_step = _iterator.n()).done) {
|
|
166
125
|
_context3.next = 22;
|
|
167
126
|
break;
|
|
168
127
|
}
|
|
169
|
-
|
|
170
128
|
_sourceName = _step.value;
|
|
171
129
|
url = sources[_sourceName].url;
|
|
172
|
-
|
|
173
130
|
if (!url) {
|
|
174
131
|
_context3.next = 20;
|
|
175
132
|
break;
|
|
176
133
|
}
|
|
177
|
-
|
|
178
134
|
sourceUrl = _this._proxyPath + _this._getAbsoluteUrl(url);
|
|
179
135
|
extendedUrl = _this._emsClient.extendUrlWithParams(sourceUrl);
|
|
180
136
|
_context3.next = 17;
|
|
181
137
|
return _this._emsClient.getManifest(extendedUrl);
|
|
182
|
-
|
|
183
138
|
case 17:
|
|
184
139
|
sourceJson = _context3.sent;
|
|
185
140
|
tiles = sourceJson === null || sourceJson === void 0 ? void 0 : (_sourceJson$tiles = sourceJson.tiles) === null || _sourceJson$tiles === void 0 ? void 0 : _sourceJson$tiles.map(function (tileUrl) {
|
|
186
141
|
var directUrl = _this._proxyPath + _this._getAbsoluteUrl(tileUrl);
|
|
187
|
-
|
|
188
142
|
return _this._emsClient.extendUrlWithParams(directUrl);
|
|
189
143
|
});
|
|
190
144
|
inlinedSources[_sourceName] = _objectSpread(_objectSpread({}, sourceJson), {}, {
|
|
191
145
|
type: 'vector',
|
|
192
146
|
tiles: tiles
|
|
193
147
|
});
|
|
194
|
-
|
|
195
148
|
case 20:
|
|
196
149
|
_context3.next = 9;
|
|
197
150
|
break;
|
|
198
|
-
|
|
199
151
|
case 22:
|
|
200
152
|
_context3.next = 27;
|
|
201
153
|
break;
|
|
202
|
-
|
|
203
154
|
case 24:
|
|
204
155
|
_context3.prev = 24;
|
|
205
156
|
_context3.t0 = _context3["catch"](7);
|
|
206
|
-
|
|
207
157
|
_iterator.e(_context3.t0);
|
|
208
|
-
|
|
209
158
|
case 27:
|
|
210
159
|
_context3.prev = 27;
|
|
211
|
-
|
|
212
160
|
_iterator.f();
|
|
213
|
-
|
|
214
161
|
return _context3.finish(27);
|
|
215
|
-
|
|
216
162
|
case 30:
|
|
217
163
|
_context3.t1 = _objectSpread;
|
|
218
164
|
_context3.t2 = _objectSpread({}, vectorJson);
|
|
@@ -220,12 +166,10 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
220
166
|
_context3.t4 = inlinedSources;
|
|
221
167
|
_context3.next = 36;
|
|
222
168
|
return _this._getSpriteSheetRootPath();
|
|
223
|
-
|
|
224
169
|
case 36:
|
|
225
170
|
_context3.t5 = _context3.sent;
|
|
226
171
|
_context3.next = 39;
|
|
227
172
|
return _this._getUrlTemplateForGlyphs();
|
|
228
|
-
|
|
229
173
|
case 39:
|
|
230
174
|
_context3.t6 = _context3.sent;
|
|
231
175
|
_context3.t7 = {
|
|
@@ -234,10 +178,8 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
234
178
|
glyphs: _context3.t6
|
|
235
179
|
};
|
|
236
180
|
return _context3.abrupt("return", (0, _context3.t1)(_context3.t2, _context3.t3, _context3.t7));
|
|
237
|
-
|
|
238
181
|
case 44:
|
|
239
182
|
return _context3.abrupt("return");
|
|
240
|
-
|
|
241
183
|
case 45:
|
|
242
184
|
case "end":
|
|
243
185
|
return _context3.stop();
|
|
@@ -245,48 +187,40 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
245
187
|
}
|
|
246
188
|
}, _callee3, null, [[7, 24, 27, 30]]);
|
|
247
189
|
}))));
|
|
248
|
-
|
|
249
190
|
_this._config = config;
|
|
250
191
|
return _this;
|
|
251
192
|
}
|
|
193
|
+
|
|
252
194
|
/*
|
|
253
195
|
This method returns an array of objects with the layers and the new
|
|
254
196
|
layout['text-field'] to apply using map.setLayoutProperty
|
|
255
197
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
198
|
_createClass(TMSService, [{
|
|
259
199
|
key: "getDefaultRasterStyle",
|
|
260
200
|
value: function () {
|
|
261
|
-
var _getDefaultRasterStyle = _asyncToGenerator( /*#__PURE__*/
|
|
201
|
+
var _getDefaultRasterStyle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
262
202
|
var _this2 = this;
|
|
263
|
-
|
|
264
203
|
var tileJson, tiles;
|
|
265
|
-
return
|
|
204
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
266
205
|
while (1) {
|
|
267
206
|
switch (_context4.prev = _context4.next) {
|
|
268
207
|
case 0:
|
|
269
208
|
_context4.next = 2;
|
|
270
209
|
return this._getRasterStyleJson();
|
|
271
|
-
|
|
272
210
|
case 2:
|
|
273
211
|
tileJson = _context4.sent;
|
|
274
|
-
|
|
275
212
|
if (!tileJson) {
|
|
276
213
|
_context4.next = 8;
|
|
277
214
|
break;
|
|
278
215
|
}
|
|
279
|
-
|
|
280
216
|
tiles = tileJson.tiles.map(function (tile) {
|
|
281
217
|
return _this2._proxyPath + _this2._getAbsoluteUrl(tile);
|
|
282
218
|
});
|
|
283
219
|
return _context4.abrupt("return", _objectSpread(_objectSpread({}, tileJson), {
|
|
284
220
|
tiles: tiles
|
|
285
221
|
}));
|
|
286
|
-
|
|
287
222
|
case 8:
|
|
288
223
|
return _context4.abrupt("return");
|
|
289
|
-
|
|
290
224
|
case 9:
|
|
291
225
|
case "end":
|
|
292
226
|
return _context4.stop();
|
|
@@ -294,39 +228,32 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
294
228
|
}
|
|
295
229
|
}, _callee4, this);
|
|
296
230
|
}));
|
|
297
|
-
|
|
298
231
|
function getDefaultRasterStyle() {
|
|
299
232
|
return _getDefaultRasterStyle.apply(this, arguments);
|
|
300
233
|
}
|
|
301
|
-
|
|
302
234
|
return getDefaultRasterStyle;
|
|
303
235
|
}()
|
|
304
236
|
}, {
|
|
305
237
|
key: "getUrlTemplate",
|
|
306
238
|
value: function () {
|
|
307
|
-
var _getUrlTemplate = _asyncToGenerator( /*#__PURE__*/
|
|
239
|
+
var _getUrlTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
308
240
|
var tileJson, directUrl;
|
|
309
|
-
return
|
|
241
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
310
242
|
while (1) {
|
|
311
243
|
switch (_context5.prev = _context5.next) {
|
|
312
244
|
case 0:
|
|
313
245
|
_context5.next = 2;
|
|
314
246
|
return this._getRasterStyleJson();
|
|
315
|
-
|
|
316
247
|
case 2:
|
|
317
248
|
tileJson = _context5.sent;
|
|
318
|
-
|
|
319
249
|
if (!tileJson) {
|
|
320
250
|
_context5.next = 8;
|
|
321
251
|
break;
|
|
322
252
|
}
|
|
323
|
-
|
|
324
253
|
directUrl = this._proxyPath + this._getAbsoluteUrl(tileJson.tiles[0]);
|
|
325
254
|
return _context5.abrupt("return", this._emsClient.extendUrlWithParams(directUrl));
|
|
326
|
-
|
|
327
255
|
case 8:
|
|
328
256
|
return _context5.abrupt("return", '');
|
|
329
|
-
|
|
330
257
|
case 9:
|
|
331
258
|
case "end":
|
|
332
259
|
return _context5.stop();
|
|
@@ -334,42 +261,34 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
334
261
|
}
|
|
335
262
|
}, _callee5, this);
|
|
336
263
|
}));
|
|
337
|
-
|
|
338
264
|
function getUrlTemplate() {
|
|
339
265
|
return _getUrlTemplate.apply(this, arguments);
|
|
340
266
|
}
|
|
341
|
-
|
|
342
267
|
return getUrlTemplate;
|
|
343
268
|
}()
|
|
344
269
|
}, {
|
|
345
270
|
key: "getUrlTemplateForVector",
|
|
346
271
|
value: function () {
|
|
347
|
-
var _getUrlTemplateForVector = _asyncToGenerator( /*#__PURE__*/
|
|
272
|
+
var _getUrlTemplateForVector = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(sourceId) {
|
|
348
273
|
var _tileJson$sources$sou, _tileJson$sources$sou2;
|
|
349
|
-
|
|
350
274
|
var tileJson, url, directUrl;
|
|
351
|
-
return
|
|
275
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
352
276
|
while (1) {
|
|
353
277
|
switch (_context6.prev = _context6.next) {
|
|
354
278
|
case 0:
|
|
355
279
|
_context6.next = 2;
|
|
356
280
|
return this._getVectorStyleJsonInlined();
|
|
357
|
-
|
|
358
281
|
case 2:
|
|
359
282
|
tileJson = _context6.sent;
|
|
360
283
|
url = tileJson === null || tileJson === void 0 ? void 0 : (_tileJson$sources$sou = tileJson.sources[sourceId]) === null || _tileJson$sources$sou === void 0 ? void 0 : (_tileJson$sources$sou2 = _tileJson$sources$sou.tiles) === null || _tileJson$sources$sou2 === void 0 ? void 0 : _tileJson$sources$sou2.pop();
|
|
361
|
-
|
|
362
284
|
if (!url) {
|
|
363
285
|
_context6.next = 9;
|
|
364
286
|
break;
|
|
365
287
|
}
|
|
366
|
-
|
|
367
288
|
directUrl = this._proxyPath + this._getAbsoluteUrl(url);
|
|
368
289
|
return _context6.abrupt("return", this._emsClient.extendUrlWithParams(directUrl));
|
|
369
|
-
|
|
370
290
|
case 9:
|
|
371
291
|
return _context6.abrupt("return", '');
|
|
372
|
-
|
|
373
292
|
case 10:
|
|
374
293
|
case "end":
|
|
375
294
|
return _context6.stop();
|
|
@@ -377,27 +296,23 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
377
296
|
}
|
|
378
297
|
}, _callee6, this);
|
|
379
298
|
}));
|
|
380
|
-
|
|
381
299
|
function getUrlTemplateForVector(_x) {
|
|
382
300
|
return _getUrlTemplateForVector.apply(this, arguments);
|
|
383
301
|
}
|
|
384
|
-
|
|
385
302
|
return getUrlTemplateForVector;
|
|
386
303
|
}()
|
|
387
304
|
}, {
|
|
388
305
|
key: "getVectorStyleSheet",
|
|
389
306
|
value: function () {
|
|
390
|
-
var _getVectorStyleSheet = _asyncToGenerator( /*#__PURE__*/
|
|
391
|
-
return
|
|
307
|
+
var _getVectorStyleSheet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
308
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
392
309
|
while (1) {
|
|
393
310
|
switch (_context7.prev = _context7.next) {
|
|
394
311
|
case 0:
|
|
395
312
|
_context7.next = 2;
|
|
396
313
|
return this._getVectorStyleJsonInlined();
|
|
397
|
-
|
|
398
314
|
case 2:
|
|
399
315
|
return _context7.abrupt("return", _context7.sent);
|
|
400
|
-
|
|
401
316
|
case 3:
|
|
402
317
|
case "end":
|
|
403
318
|
return _context7.stop();
|
|
@@ -405,27 +320,23 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
405
320
|
}
|
|
406
321
|
}, _callee7, this);
|
|
407
322
|
}));
|
|
408
|
-
|
|
409
323
|
function getVectorStyleSheet() {
|
|
410
324
|
return _getVectorStyleSheet.apply(this, arguments);
|
|
411
325
|
}
|
|
412
|
-
|
|
413
326
|
return getVectorStyleSheet;
|
|
414
327
|
}()
|
|
415
328
|
}, {
|
|
416
329
|
key: "getVectorStyleSheetRaw",
|
|
417
330
|
value: function () {
|
|
418
|
-
var _getVectorStyleSheetRaw = _asyncToGenerator( /*#__PURE__*/
|
|
419
|
-
return
|
|
331
|
+
var _getVectorStyleSheetRaw = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
332
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
420
333
|
while (1) {
|
|
421
334
|
switch (_context8.prev = _context8.next) {
|
|
422
335
|
case 0:
|
|
423
336
|
_context8.next = 2;
|
|
424
337
|
return this._getVectorStyleJsonRaw();
|
|
425
|
-
|
|
426
338
|
case 2:
|
|
427
339
|
return _context8.abrupt("return", _context8.sent);
|
|
428
|
-
|
|
429
340
|
case 3:
|
|
430
341
|
case "end":
|
|
431
342
|
return _context8.stop();
|
|
@@ -433,58 +344,49 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
433
344
|
}
|
|
434
345
|
}, _callee8, this);
|
|
435
346
|
}));
|
|
436
|
-
|
|
437
347
|
function getVectorStyleSheetRaw() {
|
|
438
348
|
return _getVectorStyleSheetRaw.apply(this, arguments);
|
|
439
349
|
}
|
|
440
|
-
|
|
441
350
|
return getVectorStyleSheetRaw;
|
|
442
351
|
}()
|
|
443
352
|
}, {
|
|
444
353
|
key: "getSpriteSheetMeta",
|
|
445
354
|
value: function () {
|
|
446
|
-
var _getSpriteSheetMeta = _asyncToGenerator( /*#__PURE__*/
|
|
355
|
+
var _getSpriteSheetMeta = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
447
356
|
var isRetina,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
return
|
|
357
|
+
metaUrl,
|
|
358
|
+
spritePngs,
|
|
359
|
+
metaUrlExtended,
|
|
360
|
+
jsonMeta,
|
|
361
|
+
_args9 = arguments;
|
|
362
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
454
363
|
while (1) {
|
|
455
364
|
switch (_context9.prev = _context9.next) {
|
|
456
365
|
case 0:
|
|
457
366
|
isRetina = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
458
367
|
_context9.next = 3;
|
|
459
368
|
return this.getSpriteSheetJsonPath(isRetina);
|
|
460
|
-
|
|
461
369
|
case 3:
|
|
462
370
|
metaUrl = _context9.sent;
|
|
463
371
|
_context9.next = 6;
|
|
464
372
|
return this.getSpriteSheetPngPath(isRetina);
|
|
465
|
-
|
|
466
373
|
case 6:
|
|
467
374
|
spritePngs = _context9.sent;
|
|
468
|
-
|
|
469
375
|
if (!(metaUrl && spritePngs)) {
|
|
470
376
|
_context9.next = 15;
|
|
471
377
|
break;
|
|
472
378
|
}
|
|
473
|
-
|
|
474
379
|
metaUrlExtended = this._emsClient.extendUrlWithParams(metaUrl);
|
|
475
380
|
_context9.next = 11;
|
|
476
381
|
return this._emsClient.getManifest(metaUrlExtended);
|
|
477
|
-
|
|
478
382
|
case 11:
|
|
479
383
|
jsonMeta = _context9.sent;
|
|
480
384
|
return _context9.abrupt("return", {
|
|
481
385
|
png: spritePngs,
|
|
482
386
|
json: jsonMeta
|
|
483
387
|
});
|
|
484
|
-
|
|
485
388
|
case 15:
|
|
486
389
|
return _context9.abrupt("return");
|
|
487
|
-
|
|
488
390
|
case 16:
|
|
489
391
|
case "end":
|
|
490
392
|
return _context9.stop();
|
|
@@ -492,43 +394,36 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
492
394
|
}
|
|
493
395
|
}, _callee9, this);
|
|
494
396
|
}));
|
|
495
|
-
|
|
496
397
|
function getSpriteSheetMeta() {
|
|
497
398
|
return _getSpriteSheetMeta.apply(this, arguments);
|
|
498
399
|
}
|
|
499
|
-
|
|
500
400
|
return getSpriteSheetMeta;
|
|
501
401
|
}()
|
|
502
402
|
}, {
|
|
503
403
|
key: "getSpriteSheetJsonPath",
|
|
504
404
|
value: function () {
|
|
505
|
-
var _getSpriteSheetJsonPath = _asyncToGenerator( /*#__PURE__*/
|
|
405
|
+
var _getSpriteSheetJsonPath = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
506
406
|
var isRetina,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return
|
|
407
|
+
spriteSheetRootPath,
|
|
408
|
+
suffix,
|
|
409
|
+
_args10 = arguments;
|
|
410
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
511
411
|
while (1) {
|
|
512
412
|
switch (_context10.prev = _context10.next) {
|
|
513
413
|
case 0:
|
|
514
414
|
isRetina = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : false;
|
|
515
415
|
_context10.next = 3;
|
|
516
416
|
return this._getSpriteSheetRootPath();
|
|
517
|
-
|
|
518
417
|
case 3:
|
|
519
418
|
spriteSheetRootPath = _context10.sent;
|
|
520
|
-
|
|
521
419
|
if (!spriteSheetRootPath) {
|
|
522
420
|
_context10.next = 9;
|
|
523
421
|
break;
|
|
524
422
|
}
|
|
525
|
-
|
|
526
423
|
suffix = isRetina ? '@2x' : '';
|
|
527
424
|
return _context10.abrupt("return", spriteSheetRootPath + suffix + '.json');
|
|
528
|
-
|
|
529
425
|
case 9:
|
|
530
426
|
return _context10.abrupt("return", '');
|
|
531
|
-
|
|
532
427
|
case 10:
|
|
533
428
|
case "end":
|
|
534
429
|
return _context10.stop();
|
|
@@ -536,43 +431,36 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
536
431
|
}
|
|
537
432
|
}, _callee10, this);
|
|
538
433
|
}));
|
|
539
|
-
|
|
540
434
|
function getSpriteSheetJsonPath() {
|
|
541
435
|
return _getSpriteSheetJsonPath.apply(this, arguments);
|
|
542
436
|
}
|
|
543
|
-
|
|
544
437
|
return getSpriteSheetJsonPath;
|
|
545
438
|
}()
|
|
546
439
|
}, {
|
|
547
440
|
key: "getSpriteSheetPngPath",
|
|
548
441
|
value: function () {
|
|
549
|
-
var _getSpriteSheetPngPath = _asyncToGenerator( /*#__PURE__*/
|
|
442
|
+
var _getSpriteSheetPngPath = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
550
443
|
var isRetina,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return
|
|
444
|
+
spriteSheetRootPath,
|
|
445
|
+
suffix,
|
|
446
|
+
_args11 = arguments;
|
|
447
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
555
448
|
while (1) {
|
|
556
449
|
switch (_context11.prev = _context11.next) {
|
|
557
450
|
case 0:
|
|
558
451
|
isRetina = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : false;
|
|
559
452
|
_context11.next = 3;
|
|
560
453
|
return this._getSpriteSheetRootPath();
|
|
561
|
-
|
|
562
454
|
case 3:
|
|
563
455
|
spriteSheetRootPath = _context11.sent;
|
|
564
|
-
|
|
565
456
|
if (!spriteSheetRootPath) {
|
|
566
457
|
_context11.next = 9;
|
|
567
458
|
break;
|
|
568
459
|
}
|
|
569
|
-
|
|
570
460
|
suffix = isRetina ? '@2x' : '';
|
|
571
461
|
return _context11.abrupt("return", spriteSheetRootPath + suffix + '.png');
|
|
572
|
-
|
|
573
462
|
case 9:
|
|
574
463
|
return _context11.abrupt("return", '');
|
|
575
|
-
|
|
576
464
|
case 10:
|
|
577
465
|
case "end":
|
|
578
466
|
return _context11.stop();
|
|
@@ -580,11 +468,9 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
580
468
|
}
|
|
581
469
|
}, _callee11, this);
|
|
582
470
|
}));
|
|
583
|
-
|
|
584
471
|
function getSpriteSheetPngPath() {
|
|
585
472
|
return _getSpriteSheetPngPath.apply(this, arguments);
|
|
586
473
|
}
|
|
587
|
-
|
|
588
474
|
return getSpriteSheetPngPath;
|
|
589
475
|
}()
|
|
590
476
|
}, {
|
|
@@ -595,15 +481,14 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
595
481
|
}, {
|
|
596
482
|
key: "getMinZoom",
|
|
597
483
|
value: function () {
|
|
598
|
-
var _getMinZoom = _asyncToGenerator( /*#__PURE__*/
|
|
484
|
+
var _getMinZoom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
599
485
|
var format,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
486
|
+
_ref4,
|
|
487
|
+
sources,
|
|
488
|
+
_ref6,
|
|
489
|
+
minzoom,
|
|
490
|
+
_args12 = arguments;
|
|
491
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
607
492
|
while (1) {
|
|
608
493
|
switch (_context12.prev = _context12.next) {
|
|
609
494
|
case 0:
|
|
@@ -611,23 +496,18 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
611
496
|
_context12.t0 = format;
|
|
612
497
|
_context12.next = _context12.t0 === 'vector' ? 4 : _context12.t0 === 'raster' ? 12 : 20;
|
|
613
498
|
break;
|
|
614
|
-
|
|
615
499
|
case 4:
|
|
616
500
|
_context12.next = 6;
|
|
617
501
|
return this._getVectorStyleJsonInlined();
|
|
618
|
-
|
|
619
502
|
case 6:
|
|
620
503
|
_context12.t1 = _context12.sent;
|
|
621
|
-
|
|
622
504
|
if (_context12.t1) {
|
|
623
505
|
_context12.next = 9;
|
|
624
506
|
break;
|
|
625
507
|
}
|
|
626
|
-
|
|
627
508
|
_context12.t1 = {
|
|
628
509
|
sources: {}
|
|
629
510
|
};
|
|
630
|
-
|
|
631
511
|
case 9:
|
|
632
512
|
_ref4 = _context12.t1;
|
|
633
513
|
sources = _ref4.sources;
|
|
@@ -637,29 +517,22 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
637
517
|
}).filter(function (minzoom) {
|
|
638
518
|
return Number.isFinite(minzoom);
|
|
639
519
|
}))));
|
|
640
|
-
|
|
641
520
|
case 12:
|
|
642
521
|
_context12.next = 14;
|
|
643
522
|
return this._getRasterStyleJson();
|
|
644
|
-
|
|
645
523
|
case 14:
|
|
646
524
|
_context12.t2 = _context12.sent;
|
|
647
|
-
|
|
648
525
|
if (_context12.t2) {
|
|
649
526
|
_context12.next = 17;
|
|
650
527
|
break;
|
|
651
528
|
}
|
|
652
|
-
|
|
653
529
|
_context12.t2 = {};
|
|
654
|
-
|
|
655
530
|
case 17:
|
|
656
531
|
_ref6 = _context12.t2;
|
|
657
532
|
minzoom = _ref6.minzoom;
|
|
658
533
|
return _context12.abrupt("return", minzoom);
|
|
659
|
-
|
|
660
534
|
case 20:
|
|
661
535
|
return _context12.abrupt("return");
|
|
662
|
-
|
|
663
536
|
case 21:
|
|
664
537
|
case "end":
|
|
665
538
|
return _context12.stop();
|
|
@@ -667,25 +540,22 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
667
540
|
}
|
|
668
541
|
}, _callee12, this);
|
|
669
542
|
}));
|
|
670
|
-
|
|
671
543
|
function getMinZoom() {
|
|
672
544
|
return _getMinZoom.apply(this, arguments);
|
|
673
545
|
}
|
|
674
|
-
|
|
675
546
|
return getMinZoom;
|
|
676
547
|
}()
|
|
677
548
|
}, {
|
|
678
549
|
key: "getMaxZoom",
|
|
679
550
|
value: function () {
|
|
680
|
-
var _getMaxZoom = _asyncToGenerator( /*#__PURE__*/
|
|
551
|
+
var _getMaxZoom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
681
552
|
var format,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
553
|
+
_ref7,
|
|
554
|
+
sources,
|
|
555
|
+
_ref9,
|
|
556
|
+
maxzoom,
|
|
557
|
+
_args13 = arguments;
|
|
558
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
689
559
|
while (1) {
|
|
690
560
|
switch (_context13.prev = _context13.next) {
|
|
691
561
|
case 0:
|
|
@@ -693,23 +563,18 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
693
563
|
_context13.t0 = format;
|
|
694
564
|
_context13.next = _context13.t0 === 'vector' ? 4 : _context13.t0 === 'raster' ? 12 : 20;
|
|
695
565
|
break;
|
|
696
|
-
|
|
697
566
|
case 4:
|
|
698
567
|
_context13.next = 6;
|
|
699
568
|
return this._getVectorStyleJsonInlined();
|
|
700
|
-
|
|
701
569
|
case 6:
|
|
702
570
|
_context13.t1 = _context13.sent;
|
|
703
|
-
|
|
704
571
|
if (_context13.t1) {
|
|
705
572
|
_context13.next = 9;
|
|
706
573
|
break;
|
|
707
574
|
}
|
|
708
|
-
|
|
709
575
|
_context13.t1 = {
|
|
710
576
|
sources: {}
|
|
711
577
|
};
|
|
712
|
-
|
|
713
578
|
case 9:
|
|
714
579
|
_ref7 = _context13.t1;
|
|
715
580
|
sources = _ref7.sources;
|
|
@@ -719,29 +584,22 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
719
584
|
}).filter(function (maxzoom) {
|
|
720
585
|
return Number.isFinite(maxzoom);
|
|
721
586
|
}))));
|
|
722
|
-
|
|
723
587
|
case 12:
|
|
724
588
|
_context13.next = 14;
|
|
725
589
|
return this._getRasterStyleJson();
|
|
726
|
-
|
|
727
590
|
case 14:
|
|
728
591
|
_context13.t2 = _context13.sent;
|
|
729
|
-
|
|
730
592
|
if (_context13.t2) {
|
|
731
593
|
_context13.next = 17;
|
|
732
594
|
break;
|
|
733
595
|
}
|
|
734
|
-
|
|
735
596
|
_context13.t2 = {};
|
|
736
|
-
|
|
737
597
|
case 17:
|
|
738
598
|
_ref9 = _context13.t2;
|
|
739
599
|
maxzoom = _ref9.maxzoom;
|
|
740
600
|
return _context13.abrupt("return", maxzoom);
|
|
741
|
-
|
|
742
601
|
case 20:
|
|
743
602
|
return _context13.abrupt("return");
|
|
744
|
-
|
|
745
603
|
case 21:
|
|
746
604
|
case "end":
|
|
747
605
|
return _context13.stop();
|
|
@@ -749,11 +607,9 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
749
607
|
}
|
|
750
608
|
}, _callee13, this);
|
|
751
609
|
}));
|
|
752
|
-
|
|
753
610
|
function getMaxZoom() {
|
|
754
611
|
return _getMaxZoom.apply(this, arguments);
|
|
755
612
|
}
|
|
756
|
-
|
|
757
613
|
return getMaxZoom;
|
|
758
614
|
}()
|
|
759
615
|
}, {
|
|
@@ -775,19 +631,15 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
775
631
|
key: "_getStyleUrlForLocale",
|
|
776
632
|
value: function _getStyleUrlForLocale(formatType) {
|
|
777
633
|
var vectorFormats = this._getFormats(formatType, this._emsClient.getLocale());
|
|
778
|
-
|
|
779
634
|
if (!vectorFormats.length) {
|
|
780
635
|
//fallback to default locale
|
|
781
636
|
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
782
637
|
}
|
|
783
|
-
|
|
784
638
|
if (!vectorFormats.length) {
|
|
785
639
|
// eslint-disable-next-line max-len
|
|
786
640
|
throw new Error("Cannot find ".concat(formatType, " tile layer for locale ").concat(this._emsClient.getLocale(), " or ").concat(this._emsClient.getDefaultLocale()));
|
|
787
641
|
}
|
|
788
|
-
|
|
789
642
|
var defaultStyle = vectorFormats[0];
|
|
790
|
-
|
|
791
643
|
if (defaultStyle && defaultStyle.hasOwnProperty('url')) {
|
|
792
644
|
return defaultStyle.url;
|
|
793
645
|
}
|
|
@@ -802,28 +654,23 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
802
654
|
}, {
|
|
803
655
|
key: "_getSpriteSheetRootPath",
|
|
804
656
|
value: function () {
|
|
805
|
-
var _getSpriteSheetRootPath2 = _asyncToGenerator( /*#__PURE__*/
|
|
657
|
+
var _getSpriteSheetRootPath2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
806
658
|
var vectorStyleJson;
|
|
807
|
-
return
|
|
659
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
808
660
|
while (1) {
|
|
809
661
|
switch (_context14.prev = _context14.next) {
|
|
810
662
|
case 0:
|
|
811
663
|
_context14.next = 2;
|
|
812
664
|
return this._getVectorStyleJsonRaw();
|
|
813
|
-
|
|
814
665
|
case 2:
|
|
815
666
|
vectorStyleJson = _context14.sent;
|
|
816
|
-
|
|
817
667
|
if (!(vectorStyleJson !== null && vectorStyleJson !== void 0 && vectorStyleJson.sprite)) {
|
|
818
668
|
_context14.next = 7;
|
|
819
669
|
break;
|
|
820
670
|
}
|
|
821
|
-
|
|
822
671
|
return _context14.abrupt("return", this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.sprite));
|
|
823
|
-
|
|
824
672
|
case 7:
|
|
825
673
|
return _context14.abrupt("return", '');
|
|
826
|
-
|
|
827
674
|
case 8:
|
|
828
675
|
case "end":
|
|
829
676
|
return _context14.stop();
|
|
@@ -831,38 +678,31 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
831
678
|
}
|
|
832
679
|
}, _callee14, this);
|
|
833
680
|
}));
|
|
834
|
-
|
|
835
681
|
function _getSpriteSheetRootPath() {
|
|
836
682
|
return _getSpriteSheetRootPath2.apply(this, arguments);
|
|
837
683
|
}
|
|
838
|
-
|
|
839
684
|
return _getSpriteSheetRootPath;
|
|
840
685
|
}()
|
|
841
686
|
}, {
|
|
842
687
|
key: "_getUrlTemplateForGlyphs",
|
|
843
688
|
value: function () {
|
|
844
|
-
var _getUrlTemplateForGlyphs2 = _asyncToGenerator( /*#__PURE__*/
|
|
689
|
+
var _getUrlTemplateForGlyphs2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
845
690
|
var vectorStyleJson;
|
|
846
|
-
return
|
|
691
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
847
692
|
while (1) {
|
|
848
693
|
switch (_context15.prev = _context15.next) {
|
|
849
694
|
case 0:
|
|
850
695
|
_context15.next = 2;
|
|
851
696
|
return this._getVectorStyleJsonRaw();
|
|
852
|
-
|
|
853
697
|
case 2:
|
|
854
698
|
vectorStyleJson = _context15.sent;
|
|
855
|
-
|
|
856
699
|
if (!(vectorStyleJson !== null && vectorStyleJson !== void 0 && vectorStyleJson.glyphs)) {
|
|
857
700
|
_context15.next = 7;
|
|
858
701
|
break;
|
|
859
702
|
}
|
|
860
|
-
|
|
861
703
|
return _context15.abrupt("return", this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.glyphs));
|
|
862
|
-
|
|
863
704
|
case 7:
|
|
864
705
|
return _context15.abrupt("return", '');
|
|
865
|
-
|
|
866
706
|
case 8:
|
|
867
707
|
case "end":
|
|
868
708
|
return _context15.stop();
|
|
@@ -870,11 +710,9 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
870
710
|
}
|
|
871
711
|
}, _callee15, this);
|
|
872
712
|
}));
|
|
873
|
-
|
|
874
713
|
function _getUrlTemplateForGlyphs() {
|
|
875
714
|
return _getUrlTemplateForGlyphs2.apply(this, arguments);
|
|
876
715
|
}
|
|
877
|
-
|
|
878
716
|
return _getUrlTemplateForGlyphs;
|
|
879
717
|
}()
|
|
880
718
|
}], [{
|
|
@@ -883,33 +721,28 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
883
721
|
var supportedLang = this.SupportedLanguages.find(function (l) {
|
|
884
722
|
return l.key === lang;
|
|
885
723
|
});
|
|
886
|
-
|
|
887
724
|
if (layer.type === 'symbol' && layer.layout !== undefined && supportedLang !== undefined) {
|
|
888
725
|
var omtLang = supportedLang.omt;
|
|
889
726
|
var textField = layer.layout['text-field'];
|
|
890
|
-
|
|
891
727
|
if (textField && typeof textField === 'string') {
|
|
892
728
|
return TMSService._getTextField(textField, omtLang);
|
|
893
729
|
}
|
|
894
730
|
}
|
|
895
|
-
|
|
896
731
|
return;
|
|
897
732
|
}
|
|
733
|
+
|
|
898
734
|
/*
|
|
899
735
|
This method returns an array of objects per layer, containing a list of
|
|
900
736
|
properties with new colors to apply using map.setPaintProperty
|
|
901
737
|
*/
|
|
902
|
-
|
|
903
738
|
}, {
|
|
904
739
|
key: "transformColorProperties",
|
|
905
740
|
value: function transformColorProperties(layer, color, operation, percentage) {
|
|
906
741
|
if (['background', 'fill', 'line', 'symbol'].indexOf(layer.type) !== -1 && layer.paint) {
|
|
907
742
|
var paint = layer.paint;
|
|
908
|
-
|
|
909
743
|
if (layer.type === 'symbol' && Object.keys(paint).length === 0) {
|
|
910
744
|
paint['text-color'] = 'rgb(0,0,0)';
|
|
911
745
|
}
|
|
912
|
-
|
|
913
746
|
var types = Object.keys(paint).filter(function (key) {
|
|
914
747
|
return ['background-color', 'circle-color', 'circle-stroke-color', 'fill-color', 'fill-extrusion-color', 'fill-outline-color', 'icon-color', 'icon-halo-color', 'line-color', 'text-color', 'text-halo-color'].indexOf(key) !== -1;
|
|
915
748
|
});
|
|
@@ -917,7 +750,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
917
750
|
var paintColor = paint[type];
|
|
918
751
|
return {
|
|
919
752
|
property: type,
|
|
920
|
-
color: paintColor ? colorizeColor(paintColor, color, operation, percentage) : paintColor
|
|
753
|
+
color: paintColor && color ? colorizeColor(paintColor, color, operation, percentage) : paintColor
|
|
921
754
|
};
|
|
922
755
|
});
|
|
923
756
|
} else {
|
|
@@ -929,23 +762,20 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
929
762
|
value: function _getTextField(label, lang) {
|
|
930
763
|
// Capture {name:xx} labels
|
|
931
764
|
var labelMatch = label.match(/\{name([:_])(.{2})\}/);
|
|
932
|
-
|
|
933
765
|
if (labelMatch && labelMatch[1] != lang) {
|
|
934
766
|
// Only apply if the languages are different
|
|
935
767
|
return ['coalesce', ['get', "name:".concat(lang)], ['get', "name".concat(labelMatch[1]).concat(labelMatch[2])]];
|
|
936
768
|
} else if (label.includes('latin') && label.includes('nonlatin')) {
|
|
937
769
|
// Capture the common pattern {name:latin}\n{name:nonlatin}
|
|
938
770
|
return ['coalesce', ['get', "name:".concat(lang)], ['concat', ['get', 'name:latin'], '\n', ['get', 'name:nonlatin']]];
|
|
939
|
-
}
|
|
940
|
-
|
|
771
|
+
}
|
|
941
772
|
|
|
773
|
+
// If no case is found, return the input label
|
|
942
774
|
return label;
|
|
943
775
|
}
|
|
944
776
|
}]);
|
|
945
|
-
|
|
946
777
|
return TMSService;
|
|
947
778
|
}(AbstractEmsService);
|
|
948
|
-
|
|
949
779
|
_defineProperty(TMSService, "SupportedLanguages", [{
|
|
950
780
|
key: 'ar',
|
|
951
781
|
omt: 'ar'
|
|
@@ -1124,7 +954,6 @@ _defineProperty(TMSService, "SupportedLanguages", [{
|
|
|
1124
954
|
key: 'zh-cn',
|
|
1125
955
|
omt: 'zh'
|
|
1126
956
|
}]);
|
|
1127
|
-
|
|
1128
957
|
_defineProperty(TMSService, "colorOperationDefaults", [{
|
|
1129
958
|
style: 'road_map',
|
|
1130
959
|
operation: 'mix',
|