@elastic/ems-client 7.14.0 → 8.0.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/CHANGELOG.md +24 -0
- package/package.json +2 -2
- package/src/ems_client.ts +66 -74
- package/src/file_layer.ts +1 -2
- package/src/index.ts +1 -1
- package/src/tms_service.ts +46 -54
- package/target/index.d.ts +1 -1
- package/target/node/ems_client.js +11 -10
- package/target/node/file_layer.js +4 -5
- package/target/node/index.js +10 -4
- package/target/web/ems_client.js +29 -21
- package/target/web/file_layer.js +4 -5
- package/target/web/index.js +1 -1
- package/target/web/tms_service.js +4 -4
- package/test/ems_client_util.ts +4 -4
- package/api-extractor.json +0 -364
- package/etc/ems-client.api.md +0 -154
- package/target/umd/ems_client.js +0 -780
- package/target/umd/ems_service.js +0 -125
- package/target/umd/file_layer.js +0 -158
- package/target/umd/index.js +0 -43
- package/target/umd/origin.js +0 -44
- package/target/umd/tms_service.js +0 -775
- package/target/umd/utils.js +0 -61
|
@@ -1,775 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "@babel/runtime/regenerator", "@babel/runtime/helpers/asyncToGenerator", "@babel/runtime/helpers/classCallCheck", "@babel/runtime/helpers/createClass", "@babel/runtime/helpers/assertThisInitialized", "@babel/runtime/helpers/possibleConstructorReturn", "@babel/runtime/helpers/getPrototypeOf", "@babel/runtime/helpers/inherits", "@babel/runtime/helpers/defineProperty", "lodash", "./ems_service"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("@babel/runtime/regenerator"), require("@babel/runtime/helpers/asyncToGenerator"), require("@babel/runtime/helpers/classCallCheck"), require("@babel/runtime/helpers/createClass"), require("@babel/runtime/helpers/assertThisInitialized"), require("@babel/runtime/helpers/possibleConstructorReturn"), require("@babel/runtime/helpers/getPrototypeOf"), require("@babel/runtime/helpers/inherits"), require("@babel/runtime/helpers/defineProperty"), require("lodash"), require("./ems_service"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.regenerator, global.asyncToGenerator, global.classCallCheck, global.createClass, global.assertThisInitialized, global.possibleConstructorReturn, global.getPrototypeOf, global.inherits, global.defineProperty, global.lodash, global.ems_service);
|
|
11
|
-
global.tms_service = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _regenerator, _asyncToGenerator2, _classCallCheck2, _createClass2, _assertThisInitialized2, _possibleConstructorReturn2, _getPrototypeOf2, _inherits2, _defineProperty2, _lodash, _ems_service) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
19
|
-
value: true
|
|
20
|
-
});
|
|
21
|
-
_exports.TMSService = void 0;
|
|
22
|
-
_regenerator = _interopRequireDefault(_regenerator);
|
|
23
|
-
_asyncToGenerator2 = _interopRequireDefault(_asyncToGenerator2);
|
|
24
|
-
_classCallCheck2 = _interopRequireDefault(_classCallCheck2);
|
|
25
|
-
_createClass2 = _interopRequireDefault(_createClass2);
|
|
26
|
-
_assertThisInitialized2 = _interopRequireDefault(_assertThisInitialized2);
|
|
27
|
-
_possibleConstructorReturn2 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
28
|
-
_getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf2);
|
|
29
|
-
_inherits2 = _interopRequireDefault(_inherits2);
|
|
30
|
-
_defineProperty2 = _interopRequireDefault(_defineProperty2);
|
|
31
|
-
_lodash = _interopRequireDefault(_lodash);
|
|
32
|
-
|
|
33
|
-
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { 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 it, 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; } } }; }
|
|
34
|
-
|
|
35
|
-
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); }
|
|
36
|
-
|
|
37
|
-
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; }
|
|
38
|
-
|
|
39
|
-
function 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; }
|
|
40
|
-
|
|
41
|
-
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) { (0, _defineProperty2["default"])(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; }
|
|
42
|
-
|
|
43
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
44
|
-
|
|
45
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
46
|
-
|
|
47
|
-
var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
48
|
-
(0, _inherits2["default"])(TMSService, _AbstractEmsService);
|
|
49
|
-
|
|
50
|
-
var _super = _createSuper(TMSService);
|
|
51
|
-
|
|
52
|
-
function TMSService(config, emsClient, proxyPath) {
|
|
53
|
-
var _this;
|
|
54
|
-
|
|
55
|
-
(0, _classCallCheck2["default"])(this, TMSService);
|
|
56
|
-
_this = _super.call(this, config, emsClient, proxyPath);
|
|
57
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_config", void 0);
|
|
58
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_getRasterStyleJson", _lodash["default"].once( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
59
|
-
var rasterUrl, url;
|
|
60
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
61
|
-
while (1) {
|
|
62
|
-
switch (_context.prev = _context.next) {
|
|
63
|
-
case 0:
|
|
64
|
-
rasterUrl = _this._getStyleUrlForLocale('raster');
|
|
65
|
-
|
|
66
|
-
if (!rasterUrl) {
|
|
67
|
-
_context.next = 6;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
url = _this._proxyPath + _this._getAbsoluteUrl(rasterUrl);
|
|
72
|
-
return _context.abrupt("return", _this._emsClient.getManifest(_this._emsClient.extendUrlWithParams(url)));
|
|
73
|
-
|
|
74
|
-
case 6:
|
|
75
|
-
return _context.abrupt("return");
|
|
76
|
-
|
|
77
|
-
case 7:
|
|
78
|
-
case "end":
|
|
79
|
-
return _context.stop();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, _callee);
|
|
83
|
-
}))));
|
|
84
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_getVectorStyleJsonRaw", _lodash["default"].once( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
85
|
-
var vectorUrl, url, vectorJson;
|
|
86
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
87
|
-
while (1) {
|
|
88
|
-
switch (_context2.prev = _context2.next) {
|
|
89
|
-
case 0:
|
|
90
|
-
vectorUrl = _this._getStyleUrlForLocale('vector');
|
|
91
|
-
|
|
92
|
-
if (!vectorUrl) {
|
|
93
|
-
_context2.next = 9;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
url = _this._proxyPath + _this._getAbsoluteUrl(vectorUrl);
|
|
98
|
-
_context2.next = 5;
|
|
99
|
-
return _this._emsClient.getManifest(_this._emsClient.extendUrlWithParams(url));
|
|
100
|
-
|
|
101
|
-
case 5:
|
|
102
|
-
vectorJson = _context2.sent;
|
|
103
|
-
return _context2.abrupt("return", _objectSpread({}, vectorJson));
|
|
104
|
-
|
|
105
|
-
case 9:
|
|
106
|
-
return _context2.abrupt("return");
|
|
107
|
-
|
|
108
|
-
case 10:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context2.stop();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, _callee2);
|
|
114
|
-
}))));
|
|
115
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_getVectorStyleJsonInlined", _lodash["default"].once( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
116
|
-
var vectorJson, inlinedSources, sources, _iterator, _step, _sourceName, url, sourceUrl, extendedUrl, sourceJson, extendedTileUrls, htmlAttribution;
|
|
117
|
-
|
|
118
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
119
|
-
while (1) {
|
|
120
|
-
switch (_context3.prev = _context3.next) {
|
|
121
|
-
case 0:
|
|
122
|
-
_context3.next = 2;
|
|
123
|
-
return _this._getVectorStyleJsonRaw();
|
|
124
|
-
|
|
125
|
-
case 2:
|
|
126
|
-
vectorJson = _context3.sent;
|
|
127
|
-
|
|
128
|
-
if (!vectorJson) {
|
|
129
|
-
_context3.next = 46;
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
inlinedSources = {};
|
|
134
|
-
sources = vectorJson.sources;
|
|
135
|
-
_iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(sources));
|
|
136
|
-
_context3.prev = 7;
|
|
137
|
-
|
|
138
|
-
_iterator.s();
|
|
139
|
-
|
|
140
|
-
case 9:
|
|
141
|
-
if ((_step = _iterator.n()).done) {
|
|
142
|
-
_context3.next = 24;
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
_sourceName = _step.value;
|
|
147
|
-
url = sources[_sourceName].url;
|
|
148
|
-
sourceUrl = _this._proxyPath + _this._getAbsoluteUrl(url);
|
|
149
|
-
extendedUrl = _this._emsClient.extendUrlWithParams(sourceUrl);
|
|
150
|
-
_context3.next = 16;
|
|
151
|
-
return _this._emsClient.getManifest(extendedUrl);
|
|
152
|
-
|
|
153
|
-
case 16:
|
|
154
|
-
sourceJson = _context3.sent;
|
|
155
|
-
extendedTileUrls = sourceJson.tiles.map(function (tileUrl) {
|
|
156
|
-
var url = _this._proxyPath + _this._getAbsoluteUrl(tileUrl);
|
|
157
|
-
|
|
158
|
-
return _this._emsClient.extendUrlWithParams(url);
|
|
159
|
-
}); // Override the attribution in the sources with the localized attribution
|
|
160
|
-
|
|
161
|
-
_context3.next = 20;
|
|
162
|
-
return _this.getHTMLAttribution();
|
|
163
|
-
|
|
164
|
-
case 20:
|
|
165
|
-
htmlAttribution = _context3.sent;
|
|
166
|
-
inlinedSources[_sourceName] = _objectSpread({}, sourceJson, {
|
|
167
|
-
type: 'vector',
|
|
168
|
-
attribution: htmlAttribution,
|
|
169
|
-
tiles: extendedTileUrls
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
case 22:
|
|
173
|
-
_context3.next = 9;
|
|
174
|
-
break;
|
|
175
|
-
|
|
176
|
-
case 24:
|
|
177
|
-
_context3.next = 29;
|
|
178
|
-
break;
|
|
179
|
-
|
|
180
|
-
case 26:
|
|
181
|
-
_context3.prev = 26;
|
|
182
|
-
_context3.t0 = _context3["catch"](7);
|
|
183
|
-
|
|
184
|
-
_iterator.e(_context3.t0);
|
|
185
|
-
|
|
186
|
-
case 29:
|
|
187
|
-
_context3.prev = 29;
|
|
188
|
-
|
|
189
|
-
_iterator.f();
|
|
190
|
-
|
|
191
|
-
return _context3.finish(29);
|
|
192
|
-
|
|
193
|
-
case 32:
|
|
194
|
-
_context3.t1 = _objectSpread;
|
|
195
|
-
_context3.t2 = {};
|
|
196
|
-
_context3.t3 = vectorJson;
|
|
197
|
-
_context3.t4 = inlinedSources;
|
|
198
|
-
_context3.next = 38;
|
|
199
|
-
return _this._getSpriteSheetRootPath();
|
|
200
|
-
|
|
201
|
-
case 38:
|
|
202
|
-
_context3.t5 = _context3.sent;
|
|
203
|
-
_context3.next = 41;
|
|
204
|
-
return _this._getUrlTemplateForGlyphs();
|
|
205
|
-
|
|
206
|
-
case 41:
|
|
207
|
-
_context3.t6 = _context3.sent;
|
|
208
|
-
_context3.t7 = {
|
|
209
|
-
sources: _context3.t4,
|
|
210
|
-
sprite: _context3.t5,
|
|
211
|
-
glyphs: _context3.t6
|
|
212
|
-
};
|
|
213
|
-
return _context3.abrupt("return", (0, _context3.t1)(_context3.t2, _context3.t3, _context3.t7));
|
|
214
|
-
|
|
215
|
-
case 46:
|
|
216
|
-
return _context3.abrupt("return");
|
|
217
|
-
|
|
218
|
-
case 47:
|
|
219
|
-
case "end":
|
|
220
|
-
return _context3.stop();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}, _callee3, null, [[7, 26, 29, 32]]);
|
|
224
|
-
}))));
|
|
225
|
-
_this._config = config;
|
|
226
|
-
return _this;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
(0, _createClass2["default"])(TMSService, [{
|
|
230
|
-
key: "getDefaultRasterStyle",
|
|
231
|
-
value: function () {
|
|
232
|
-
var _getDefaultRasterStyle = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
233
|
-
var _this2 = this;
|
|
234
|
-
|
|
235
|
-
var tileJson, tiles;
|
|
236
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
237
|
-
while (1) {
|
|
238
|
-
switch (_context4.prev = _context4.next) {
|
|
239
|
-
case 0:
|
|
240
|
-
_context4.next = 2;
|
|
241
|
-
return this._getRasterStyleJson();
|
|
242
|
-
|
|
243
|
-
case 2:
|
|
244
|
-
tileJson = _context4.sent;
|
|
245
|
-
|
|
246
|
-
if (!tileJson) {
|
|
247
|
-
_context4.next = 8;
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
tiles = tileJson.tiles.map(function (tile) {
|
|
252
|
-
return _this2._proxyPath + _this2._getAbsoluteUrl(tile);
|
|
253
|
-
});
|
|
254
|
-
return _context4.abrupt("return", _objectSpread({}, tileJson, {}, {
|
|
255
|
-
tiles: tiles
|
|
256
|
-
}));
|
|
257
|
-
|
|
258
|
-
case 8:
|
|
259
|
-
return _context4.abrupt("return");
|
|
260
|
-
|
|
261
|
-
case 9:
|
|
262
|
-
case "end":
|
|
263
|
-
return _context4.stop();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}, _callee4, this);
|
|
267
|
-
}));
|
|
268
|
-
|
|
269
|
-
function getDefaultRasterStyle() {
|
|
270
|
-
return _getDefaultRasterStyle.apply(this, arguments);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return getDefaultRasterStyle;
|
|
274
|
-
}()
|
|
275
|
-
}, {
|
|
276
|
-
key: "getUrlTemplate",
|
|
277
|
-
value: function () {
|
|
278
|
-
var _getUrlTemplate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
279
|
-
var tileJson, directUrl;
|
|
280
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
281
|
-
while (1) {
|
|
282
|
-
switch (_context5.prev = _context5.next) {
|
|
283
|
-
case 0:
|
|
284
|
-
_context5.next = 2;
|
|
285
|
-
return this._getRasterStyleJson();
|
|
286
|
-
|
|
287
|
-
case 2:
|
|
288
|
-
tileJson = _context5.sent;
|
|
289
|
-
|
|
290
|
-
if (!tileJson) {
|
|
291
|
-
_context5.next = 8;
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
directUrl = this._proxyPath + this._getAbsoluteUrl(tileJson.tiles[0]);
|
|
296
|
-
return _context5.abrupt("return", this._emsClient.extendUrlWithParams(directUrl));
|
|
297
|
-
|
|
298
|
-
case 8:
|
|
299
|
-
return _context5.abrupt("return", '');
|
|
300
|
-
|
|
301
|
-
case 9:
|
|
302
|
-
case "end":
|
|
303
|
-
return _context5.stop();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}, _callee5, this);
|
|
307
|
-
}));
|
|
308
|
-
|
|
309
|
-
function getUrlTemplate() {
|
|
310
|
-
return _getUrlTemplate.apply(this, arguments);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return getUrlTemplate;
|
|
314
|
-
}()
|
|
315
|
-
}, {
|
|
316
|
-
key: "getUrlTemplateForVector",
|
|
317
|
-
value: function () {
|
|
318
|
-
var _getUrlTemplateForVector = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(sourceId) {
|
|
319
|
-
var tileJson, directUrl;
|
|
320
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
321
|
-
while (1) {
|
|
322
|
-
switch (_context6.prev = _context6.next) {
|
|
323
|
-
case 0:
|
|
324
|
-
_context6.next = 2;
|
|
325
|
-
return this._getVectorStyleJsonInlined();
|
|
326
|
-
|
|
327
|
-
case 2:
|
|
328
|
-
tileJson = _context6.sent;
|
|
329
|
-
|
|
330
|
-
if (tileJson) {
|
|
331
|
-
_context6.next = 5;
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return _context6.abrupt("return", '');
|
|
336
|
-
|
|
337
|
-
case 5:
|
|
338
|
-
if (!(tileJson.sources[sourceId] && tileJson.sources[sourceId].tiles)) {
|
|
339
|
-
_context6.next = 10;
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
directUrl = this._proxyPath + this._getAbsoluteUrl(tileJson.sources[sourceId].tiles[0]);
|
|
344
|
-
return _context6.abrupt("return", this._emsClient.extendUrlWithParams(directUrl));
|
|
345
|
-
|
|
346
|
-
case 10:
|
|
347
|
-
return _context6.abrupt("return", '');
|
|
348
|
-
|
|
349
|
-
case 11:
|
|
350
|
-
case "end":
|
|
351
|
-
return _context6.stop();
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}, _callee6, this);
|
|
355
|
-
}));
|
|
356
|
-
|
|
357
|
-
function getUrlTemplateForVector(_x) {
|
|
358
|
-
return _getUrlTemplateForVector.apply(this, arguments);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
return getUrlTemplateForVector;
|
|
362
|
-
}()
|
|
363
|
-
}, {
|
|
364
|
-
key: "getVectorStyleSheet",
|
|
365
|
-
value: function () {
|
|
366
|
-
var _getVectorStyleSheet = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
367
|
-
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
368
|
-
while (1) {
|
|
369
|
-
switch (_context7.prev = _context7.next) {
|
|
370
|
-
case 0:
|
|
371
|
-
_context7.next = 2;
|
|
372
|
-
return this._getVectorStyleJsonInlined();
|
|
373
|
-
|
|
374
|
-
case 2:
|
|
375
|
-
return _context7.abrupt("return", _context7.sent);
|
|
376
|
-
|
|
377
|
-
case 3:
|
|
378
|
-
case "end":
|
|
379
|
-
return _context7.stop();
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}, _callee7, this);
|
|
383
|
-
}));
|
|
384
|
-
|
|
385
|
-
function getVectorStyleSheet() {
|
|
386
|
-
return _getVectorStyleSheet.apply(this, arguments);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
return getVectorStyleSheet;
|
|
390
|
-
}()
|
|
391
|
-
}, {
|
|
392
|
-
key: "getVectorStyleSheetRaw",
|
|
393
|
-
value: function () {
|
|
394
|
-
var _getVectorStyleSheetRaw = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
395
|
-
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
396
|
-
while (1) {
|
|
397
|
-
switch (_context8.prev = _context8.next) {
|
|
398
|
-
case 0:
|
|
399
|
-
_context8.next = 2;
|
|
400
|
-
return this._getVectorStyleJsonRaw();
|
|
401
|
-
|
|
402
|
-
case 2:
|
|
403
|
-
return _context8.abrupt("return", _context8.sent);
|
|
404
|
-
|
|
405
|
-
case 3:
|
|
406
|
-
case "end":
|
|
407
|
-
return _context8.stop();
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}, _callee8, this);
|
|
411
|
-
}));
|
|
412
|
-
|
|
413
|
-
function getVectorStyleSheetRaw() {
|
|
414
|
-
return _getVectorStyleSheetRaw.apply(this, arguments);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
return getVectorStyleSheetRaw;
|
|
418
|
-
}()
|
|
419
|
-
}, {
|
|
420
|
-
key: "getSpriteSheetMeta",
|
|
421
|
-
value: function () {
|
|
422
|
-
var _getSpriteSheetMeta = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
423
|
-
var isRetina,
|
|
424
|
-
metaUrl,
|
|
425
|
-
spritePngs,
|
|
426
|
-
metaUrlExtended,
|
|
427
|
-
jsonMeta,
|
|
428
|
-
_args9 = arguments;
|
|
429
|
-
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
430
|
-
while (1) {
|
|
431
|
-
switch (_context9.prev = _context9.next) {
|
|
432
|
-
case 0:
|
|
433
|
-
isRetina = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
434
|
-
_context9.next = 3;
|
|
435
|
-
return this.getSpriteSheetJsonPath(isRetina);
|
|
436
|
-
|
|
437
|
-
case 3:
|
|
438
|
-
metaUrl = _context9.sent;
|
|
439
|
-
_context9.next = 6;
|
|
440
|
-
return this.getSpriteSheetPngPath(isRetina);
|
|
441
|
-
|
|
442
|
-
case 6:
|
|
443
|
-
spritePngs = _context9.sent;
|
|
444
|
-
|
|
445
|
-
if (!(metaUrl && spritePngs)) {
|
|
446
|
-
_context9.next = 15;
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
metaUrlExtended = this._emsClient.extendUrlWithParams(metaUrl);
|
|
451
|
-
_context9.next = 11;
|
|
452
|
-
return this._emsClient.getManifest(metaUrlExtended);
|
|
453
|
-
|
|
454
|
-
case 11:
|
|
455
|
-
jsonMeta = _context9.sent;
|
|
456
|
-
return _context9.abrupt("return", {
|
|
457
|
-
png: spritePngs,
|
|
458
|
-
json: jsonMeta
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
case 15:
|
|
462
|
-
return _context9.abrupt("return");
|
|
463
|
-
|
|
464
|
-
case 16:
|
|
465
|
-
case "end":
|
|
466
|
-
return _context9.stop();
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}, _callee9, this);
|
|
470
|
-
}));
|
|
471
|
-
|
|
472
|
-
function getSpriteSheetMeta() {
|
|
473
|
-
return _getSpriteSheetMeta.apply(this, arguments);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
return getSpriteSheetMeta;
|
|
477
|
-
}()
|
|
478
|
-
}, {
|
|
479
|
-
key: "getSpriteSheetJsonPath",
|
|
480
|
-
value: function () {
|
|
481
|
-
var _getSpriteSheetJsonPath = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
482
|
-
var isRetina,
|
|
483
|
-
spriteSheetRootPath,
|
|
484
|
-
suffix,
|
|
485
|
-
_args10 = arguments;
|
|
486
|
-
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
487
|
-
while (1) {
|
|
488
|
-
switch (_context10.prev = _context10.next) {
|
|
489
|
-
case 0:
|
|
490
|
-
isRetina = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : false;
|
|
491
|
-
_context10.next = 3;
|
|
492
|
-
return this._getSpriteSheetRootPath();
|
|
493
|
-
|
|
494
|
-
case 3:
|
|
495
|
-
spriteSheetRootPath = _context10.sent;
|
|
496
|
-
|
|
497
|
-
if (!spriteSheetRootPath) {
|
|
498
|
-
_context10.next = 9;
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
suffix = isRetina ? '@2x' : '';
|
|
503
|
-
return _context10.abrupt("return", spriteSheetRootPath + suffix + '.json');
|
|
504
|
-
|
|
505
|
-
case 9:
|
|
506
|
-
return _context10.abrupt("return", '');
|
|
507
|
-
|
|
508
|
-
case 10:
|
|
509
|
-
case "end":
|
|
510
|
-
return _context10.stop();
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}, _callee10, this);
|
|
514
|
-
}));
|
|
515
|
-
|
|
516
|
-
function getSpriteSheetJsonPath() {
|
|
517
|
-
return _getSpriteSheetJsonPath.apply(this, arguments);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
return getSpriteSheetJsonPath;
|
|
521
|
-
}()
|
|
522
|
-
}, {
|
|
523
|
-
key: "getSpriteSheetPngPath",
|
|
524
|
-
value: function () {
|
|
525
|
-
var _getSpriteSheetPngPath = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
526
|
-
var isRetina,
|
|
527
|
-
spriteSheetRootPath,
|
|
528
|
-
suffix,
|
|
529
|
-
_args11 = arguments;
|
|
530
|
-
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
531
|
-
while (1) {
|
|
532
|
-
switch (_context11.prev = _context11.next) {
|
|
533
|
-
case 0:
|
|
534
|
-
isRetina = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : false;
|
|
535
|
-
_context11.next = 3;
|
|
536
|
-
return this._getSpriteSheetRootPath();
|
|
537
|
-
|
|
538
|
-
case 3:
|
|
539
|
-
spriteSheetRootPath = _context11.sent;
|
|
540
|
-
|
|
541
|
-
if (!spriteSheetRootPath) {
|
|
542
|
-
_context11.next = 9;
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
suffix = isRetina ? '@2x' : '';
|
|
547
|
-
return _context11.abrupt("return", spriteSheetRootPath + suffix + '.png');
|
|
548
|
-
|
|
549
|
-
case 9:
|
|
550
|
-
return _context11.abrupt("return", '');
|
|
551
|
-
|
|
552
|
-
case 10:
|
|
553
|
-
case "end":
|
|
554
|
-
return _context11.stop();
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
}, _callee11, this);
|
|
558
|
-
}));
|
|
559
|
-
|
|
560
|
-
function getSpriteSheetPngPath() {
|
|
561
|
-
return _getSpriteSheetPngPath.apply(this, arguments);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return getSpriteSheetPngPath;
|
|
565
|
-
}()
|
|
566
|
-
}, {
|
|
567
|
-
key: "getDisplayName",
|
|
568
|
-
value: function getDisplayName() {
|
|
569
|
-
return this._emsClient.getValueInLanguage(this._config.name);
|
|
570
|
-
}
|
|
571
|
-
}, {
|
|
572
|
-
key: "getMinZoom",
|
|
573
|
-
value: function () {
|
|
574
|
-
var _getMinZoom = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
575
|
-
var tileJson;
|
|
576
|
-
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
577
|
-
while (1) {
|
|
578
|
-
switch (_context12.prev = _context12.next) {
|
|
579
|
-
case 0:
|
|
580
|
-
_context12.next = 2;
|
|
581
|
-
return this._getRasterStyleJson();
|
|
582
|
-
|
|
583
|
-
case 2:
|
|
584
|
-
tileJson = _context12.sent;
|
|
585
|
-
|
|
586
|
-
if (!tileJson) {
|
|
587
|
-
_context12.next = 7;
|
|
588
|
-
break;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
return _context12.abrupt("return", tileJson.minzoom);
|
|
592
|
-
|
|
593
|
-
case 7:
|
|
594
|
-
return _context12.abrupt("return");
|
|
595
|
-
|
|
596
|
-
case 8:
|
|
597
|
-
case "end":
|
|
598
|
-
return _context12.stop();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}, _callee12, this);
|
|
602
|
-
}));
|
|
603
|
-
|
|
604
|
-
function getMinZoom() {
|
|
605
|
-
return _getMinZoom.apply(this, arguments);
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
return getMinZoom;
|
|
609
|
-
}()
|
|
610
|
-
}, {
|
|
611
|
-
key: "getMaxZoom",
|
|
612
|
-
value: function () {
|
|
613
|
-
var _getMaxZoom = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
614
|
-
var tileJson;
|
|
615
|
-
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
616
|
-
while (1) {
|
|
617
|
-
switch (_context13.prev = _context13.next) {
|
|
618
|
-
case 0:
|
|
619
|
-
_context13.next = 2;
|
|
620
|
-
return this._getRasterStyleJson();
|
|
621
|
-
|
|
622
|
-
case 2:
|
|
623
|
-
tileJson = _context13.sent;
|
|
624
|
-
|
|
625
|
-
if (!tileJson) {
|
|
626
|
-
_context13.next = 7;
|
|
627
|
-
break;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
return _context13.abrupt("return", tileJson.maxzoom);
|
|
631
|
-
|
|
632
|
-
case 7:
|
|
633
|
-
return _context13.abrupt("return");
|
|
634
|
-
|
|
635
|
-
case 8:
|
|
636
|
-
case "end":
|
|
637
|
-
return _context13.stop();
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}, _callee13, this);
|
|
641
|
-
}));
|
|
642
|
-
|
|
643
|
-
function getMaxZoom() {
|
|
644
|
-
return _getMaxZoom.apply(this, arguments);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
return getMaxZoom;
|
|
648
|
-
}()
|
|
649
|
-
}, {
|
|
650
|
-
key: "getId",
|
|
651
|
-
value: function getId() {
|
|
652
|
-
return this._config.id;
|
|
653
|
-
}
|
|
654
|
-
}, {
|
|
655
|
-
key: "hasId",
|
|
656
|
-
value: function hasId(id) {
|
|
657
|
-
return this._config.id === id;
|
|
658
|
-
}
|
|
659
|
-
}, {
|
|
660
|
-
key: "getApiUrl",
|
|
661
|
-
value: function getApiUrl() {
|
|
662
|
-
return this._emsClient.getTileApiUrl();
|
|
663
|
-
}
|
|
664
|
-
}, {
|
|
665
|
-
key: "_getStyleUrlForLocale",
|
|
666
|
-
value: function _getStyleUrlForLocale(formatType) {
|
|
667
|
-
var vectorFormats = this._getFormats(formatType, this._emsClient.getLocale());
|
|
668
|
-
|
|
669
|
-
if (!vectorFormats.length) {
|
|
670
|
-
//fallback to default locale
|
|
671
|
-
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
if (!vectorFormats.length) {
|
|
675
|
-
// eslint-disable-next-line max-len
|
|
676
|
-
throw new Error("Cannot find ".concat(formatType, " tile layer for locale ").concat(this._emsClient.getLocale(), " or ").concat(this._emsClient.getDefaultLocale()));
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
var defaultStyle = vectorFormats[0];
|
|
680
|
-
|
|
681
|
-
if (defaultStyle && defaultStyle.hasOwnProperty('url')) {
|
|
682
|
-
return defaultStyle.url;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}, {
|
|
686
|
-
key: "_getFormats",
|
|
687
|
-
value: function _getFormats(formatType, locale) {
|
|
688
|
-
return this._config.formats.filter(function (format) {
|
|
689
|
-
return format.locale === locale && format.format === formatType;
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
}, {
|
|
693
|
-
key: "_getSpriteSheetRootPath",
|
|
694
|
-
value: function () {
|
|
695
|
-
var _getSpriteSheetRootPath2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
696
|
-
var vectorStyleJson;
|
|
697
|
-
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
698
|
-
while (1) {
|
|
699
|
-
switch (_context14.prev = _context14.next) {
|
|
700
|
-
case 0:
|
|
701
|
-
_context14.next = 2;
|
|
702
|
-
return this._getVectorStyleJsonRaw();
|
|
703
|
-
|
|
704
|
-
case 2:
|
|
705
|
-
vectorStyleJson = _context14.sent;
|
|
706
|
-
|
|
707
|
-
if (!vectorStyleJson) {
|
|
708
|
-
_context14.next = 7;
|
|
709
|
-
break;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
return _context14.abrupt("return", this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.sprite));
|
|
713
|
-
|
|
714
|
-
case 7:
|
|
715
|
-
return _context14.abrupt("return", '');
|
|
716
|
-
|
|
717
|
-
case 8:
|
|
718
|
-
case "end":
|
|
719
|
-
return _context14.stop();
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}, _callee14, this);
|
|
723
|
-
}));
|
|
724
|
-
|
|
725
|
-
function _getSpriteSheetRootPath() {
|
|
726
|
-
return _getSpriteSheetRootPath2.apply(this, arguments);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
return _getSpriteSheetRootPath;
|
|
730
|
-
}()
|
|
731
|
-
}, {
|
|
732
|
-
key: "_getUrlTemplateForGlyphs",
|
|
733
|
-
value: function () {
|
|
734
|
-
var _getUrlTemplateForGlyphs2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
|
|
735
|
-
var vectorStyleJson;
|
|
736
|
-
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
737
|
-
while (1) {
|
|
738
|
-
switch (_context15.prev = _context15.next) {
|
|
739
|
-
case 0:
|
|
740
|
-
_context15.next = 2;
|
|
741
|
-
return this._getVectorStyleJsonRaw();
|
|
742
|
-
|
|
743
|
-
case 2:
|
|
744
|
-
vectorStyleJson = _context15.sent;
|
|
745
|
-
|
|
746
|
-
if (!vectorStyleJson) {
|
|
747
|
-
_context15.next = 7;
|
|
748
|
-
break;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
return _context15.abrupt("return", this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.glyphs));
|
|
752
|
-
|
|
753
|
-
case 7:
|
|
754
|
-
return _context15.abrupt("return", '');
|
|
755
|
-
|
|
756
|
-
case 8:
|
|
757
|
-
case "end":
|
|
758
|
-
return _context15.stop();
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}, _callee15, this);
|
|
762
|
-
}));
|
|
763
|
-
|
|
764
|
-
function _getUrlTemplateForGlyphs() {
|
|
765
|
-
return _getUrlTemplateForGlyphs2.apply(this, arguments);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
return _getUrlTemplateForGlyphs;
|
|
769
|
-
}()
|
|
770
|
-
}]);
|
|
771
|
-
return TMSService;
|
|
772
|
-
}(_ems_service.AbstractEmsService);
|
|
773
|
-
|
|
774
|
-
_exports.TMSService = TMSService;
|
|
775
|
-
});
|