@nextgis/ngw-map 1.19.2 → 2.0.0-alpha.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.
@@ -1,656 +1,742 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.19.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 2.0.0-alpha.0; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
+ import { getIcon } from '@nextgis/icons';
5
+ import { NgwKit, fetchNgwLayerItem, fetchNgwLayerItems, fetchNgwLayerFeature, fetchNgwLayerFeatureCollection, fetchIdentifyItem, fetchIdentifyGeoJson, createNgwLayerAdapter, fetchNgwExtent, sendIdentifyRequest, getCompanyLogo, getIdentifyItems, createIdentifyItem } from '@nextgis/ngw-kit';
4
6
  import { deepmerge, deprecatedWarn, defined, isObject, getIdentifyRadius } from '@nextgis/utils';
5
7
  import { getDefaultControls, WebMap } from '@nextgis/webmap';
6
8
  export * from '@nextgis/webmap';
7
- import { NgwKit, createNgwLayerAdapter, fetchNgwLayerItem, fetchNgwLayerItems, fetchNgwLayerFeature, fetchNgwLayerFeatureCollection, fetchIdentifyItem, fetchIdentifyGeoJson, fetchNgwExtent, sendIdentifyRequest, getCompanyLogo, getIdentifyItems, createIdentifyItem } from '@nextgis/ngw-kit';
8
- import { getIcon } from '@nextgis/icons';
9
9
  import NgwConnector from '@nextgis/ngw-connector';
10
10
  import { QmsKit } from '@nextgis/qms-kit';
11
11
 
12
+ var __defProp$2 = Object.defineProperty;
13
+ var __defProps$2 = Object.defineProperties;
14
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
15
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
16
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
17
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
18
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
+ var __spreadValues$2 = (a, b) => {
20
+ for (var prop in b || (b = {}))
21
+ if (__hasOwnProp$2.call(b, prop))
22
+ __defNormalProp$2(a, prop, b[prop]);
23
+ if (__getOwnPropSymbols$2)
24
+ for (var prop of __getOwnPropSymbols$2(b)) {
25
+ if (__propIsEnum$2.call(b, prop))
26
+ __defNormalProp$2(a, prop, b[prop]);
27
+ }
28
+ return a;
29
+ };
30
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
12
31
  function appendNgwResources(options, resource, defOptions, overwriteOptions) {
13
- if (typeof resource === 'number' || typeof resource === 'string') {
14
- resource = Number(resource);
15
- options.push({
16
- ...defOptions,
17
- resource,
18
- });
19
- }
20
- else if (Array.isArray(resource)) {
21
- const [resourceId, id] = resource;
22
- options.push({
23
- ...defOptions,
24
- resource: resourceId,
25
- id,
26
- ...overwriteOptions,
27
- });
28
- }
29
- else if (typeof resource === 'object') {
30
- options.push({ ...defOptions, ...resource, ...overwriteOptions });
31
- }
32
+ if (typeof resource === "number" || typeof resource === "string") {
33
+ resource = Number(resource);
34
+ options.push(__spreadProps$2(__spreadValues$2({}, defOptions), {
35
+ resource
36
+ }));
37
+ } else if (Array.isArray(resource)) {
38
+ const [resourceId, id] = resource;
39
+ options.push(__spreadValues$2(__spreadProps$2(__spreadValues$2({}, defOptions), {
40
+ resource: resourceId,
41
+ id
42
+ }), overwriteOptions));
43
+ } else if (typeof resource === "object") {
44
+ options.push(__spreadValues$2(__spreadValues$2(__spreadValues$2({}, defOptions), resource), overwriteOptions));
45
+ }
32
46
  }
33
47
 
48
+ var __defProp$1 = Object.defineProperty;
49
+ var __defProps$1 = Object.defineProperties;
50
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
51
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
52
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
53
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
54
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
55
+ var __spreadValues$1 = (a, b) => {
56
+ for (var prop in b || (b = {}))
57
+ if (__hasOwnProp$1.call(b, prop))
58
+ __defNormalProp$1(a, prop, b[prop]);
59
+ if (__getOwnPropSymbols$1)
60
+ for (var prop of __getOwnPropSymbols$1(b)) {
61
+ if (__propIsEnum$1.call(b, prop))
62
+ __defNormalProp$1(a, prop, b[prop]);
63
+ }
64
+ return a;
65
+ };
66
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
34
67
  const OPTIONS = {
35
- target: 'map',
36
- baseUrl: '',
37
- whitlabel: false,
38
- controls: getDefaultControls(),
39
- controlsOptions: {
40
- ZOOM: { position: 'top-left' },
41
- ATTRIBUTION: {
42
- position: 'bottom-right',
43
- customAttribution: [
44
- '<a href="https://nextgis.com" target="_blank">©NextGIS</a>',
45
- ],
46
- },
47
- },
48
- pixelRadius: 10,
68
+ target: "map",
69
+ baseUrl: "",
70
+ whitlabel: false,
71
+ controls: getDefaultControls(),
72
+ controlsOptions: {
73
+ ZOOM: { position: "top-left" },
74
+ ATTRIBUTION: {
75
+ position: "bottom-right",
76
+ customAttribution: [
77
+ '<a href="https://nextgis.com" target="_blank">\xA9NextGIS</a>'
78
+ ]
79
+ }
80
+ },
81
+ pixelRadius: 10
49
82
  };
50
83
  function prepareWebMapOptions(options) {
51
- const kits = [new QmsKit()];
52
- if (options.starterKits) {
53
- options.starterKits.forEach((x) => {
54
- kits.push(x);
55
- });
56
- }
57
- if (!options.connector) {
58
- options.connector = new NgwConnector({
59
- baseUrl: options.baseUrl || '',
60
- auth: options.auth,
61
- });
62
- }
63
- else if (options.connector) {
64
- options.baseUrl = options.connector.options.baseUrl;
65
- }
66
- options = deepmerge(OPTIONS, options);
67
- if (!options.center && !options.bounds) {
68
- options.bounds = [-179, -90, 180, 90];
69
- // options.maxBounds = options.bounds;
70
- }
71
- if (options.connector) {
72
- kits.push(new NgwKit({
73
- connector: options.connector,
74
- auth: options.auth,
75
- }));
76
- }
77
- options = {
78
- ...options,
79
- starterKits: kits,
80
- create: false,
81
- };
82
- return options;
84
+ const kits = [new QmsKit()];
85
+ if (options.starterKits) {
86
+ options.starterKits.forEach((x) => {
87
+ kits.push(x);
88
+ });
89
+ }
90
+ if (!options.connector) {
91
+ options.connector = new NgwConnector({
92
+ baseUrl: options.baseUrl || "",
93
+ auth: options.auth
94
+ });
95
+ } else if (options.connector) {
96
+ options.baseUrl = options.connector.options.baseUrl;
97
+ }
98
+ options = deepmerge(OPTIONS, options);
99
+ if (!options.center && !options.bounds) {
100
+ options.bounds = [-179, -90, 180, 90];
101
+ }
102
+ if (options.connector) {
103
+ kits.push(
104
+ new NgwKit({
105
+ connector: options.connector,
106
+ auth: options.auth
107
+ })
108
+ );
109
+ }
110
+ options = __spreadProps$1(__spreadValues$1({}, options), {
111
+ starterKits: kits,
112
+ create: false
113
+ });
114
+ return options;
83
115
  }
84
116
 
85
- /**
86
- * Base class containing the logic of interaction WebMap with NextGIS services.
87
- *
88
- * @example
89
- * ```javascript
90
- * import { NgwMap } from '@nextgis/ngw-map';
91
- * import MapAdapter from '@nextgis/leaflet-map-adapter';
92
- * // styles are not included in the leaflet-map-adapter
93
- * import 'leaflet/dist/leaflet.css';
94
- *
95
- * const ngwMap = new NgwMap({
96
- * mapAdapter: new MapAdapter(),
97
- * target: 'map',
98
- * qmsId: 448,
99
- * baseUrl: 'https://demo.nextgis.com',
100
- * webmapId: 3985
101
- * });
102
- * ```
103
- */
104
- class NgwMap extends WebMap {
105
- constructor(options) {
106
- super(prepareWebMapOptions(options));
107
- this.emitter = new EventEmitter();
108
- this._ngwLayers = {};
109
- this._promises = {
110
- select: [],
111
- identify: [],
112
- };
113
- if (options.connector) {
114
- this.connector = options.connector;
115
- }
116
- this._createWebMap().then(() => {
117
- const container = this.getContainer();
118
- if (container) {
119
- container.classList.add('ngw-map-container');
120
- }
121
- if (this.options.whitlabel) {
122
- this._whiteLabel();
117
+ var __defProp = Object.defineProperty;
118
+ var __defProps = Object.defineProperties;
119
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
120
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
121
+ var __getProtoOf = Object.getPrototypeOf;
122
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
123
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
124
+ var __reflectGet = Reflect.get;
125
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
126
+ var __spreadValues = (a, b) => {
127
+ for (var prop in b || (b = {}))
128
+ if (__hasOwnProp.call(b, prop))
129
+ __defNormalProp(a, prop, b[prop]);
130
+ if (__getOwnPropSymbols)
131
+ for (var prop of __getOwnPropSymbols(b)) {
132
+ if (__propIsEnum.call(b, prop))
133
+ __defNormalProp(a, prop, b[prop]);
134
+ }
135
+ return a;
136
+ };
137
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
138
+ var __publicField = (obj, key, value) => {
139
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
140
+ return value;
141
+ };
142
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
143
+ var __async$1 = (__this, __arguments, generator) => {
144
+ return new Promise((resolve, reject) => {
145
+ var fulfilled = (value) => {
146
+ try {
147
+ step(generator.next(value));
148
+ } catch (e) {
149
+ reject(e);
150
+ }
151
+ };
152
+ var rejected = (value) => {
153
+ try {
154
+ step(generator.throw(value));
155
+ } catch (e) {
156
+ reject(e);
157
+ }
158
+ };
159
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
160
+ step((generator = generator.apply(__this, __arguments)).next());
161
+ });
162
+ };
163
+ const _NgwMap = class _NgwMap extends WebMap {
164
+ constructor(options) {
165
+ super(prepareWebMapOptions(options));
166
+ __publicField(this, "emitter", new EventEmitter());
167
+ __publicField(this, "connector");
168
+ __publicField(this, "_ngwLayers", {});
169
+ __publicField(this, "$$selectFromNgwRaster");
170
+ __publicField(this, "$$selectFromNgwVector");
171
+ __publicField(this, "_promises", {
172
+ select: [],
173
+ identify: []
174
+ });
175
+ if (options.connector) {
176
+ this.connector = options.connector;
177
+ }
178
+ this._createWebMap().then(() => {
179
+ const container = this.getContainer();
180
+ if (container) {
181
+ container.classList.add("ngw-map-container");
182
+ }
183
+ if (this.options.whitlabel) {
184
+ this._whiteLabel();
185
+ }
186
+ });
187
+ }
188
+ /**
189
+ * Organized addition to the map design and controls elements,
190
+ * calling `control.onAdd(this.webMap.mapAdapter)`
191
+ * @param control - object with onAdd and onRemove methods
192
+ * or a string value indicating the name of the control installed in the map adapter
193
+ * @param position - position relative to the map angles
194
+ * @param options - initialization parameters if the control is set as a string value
195
+ *
196
+ * @example
197
+ * ```javascript
198
+ * ngwMap.addControl(new CustomControl(), 'bottom-left');
199
+ * ngwMap.addControl('ZOOM', 'top-right')
200
+ * ```
201
+ */
202
+ addControl(controlDef, position, options) {
203
+ return __async$1(this, null, function* () {
204
+ yield this.onLoad("controls:create");
205
+ return __superGet(_NgwMap.prototype, this, "addControl").call(this, controlDef, position, options);
206
+ });
207
+ }
208
+ /**
209
+ * Add any (style, vector, webmap) NGW layer by resource definition.
210
+ * @param options - set layer identification parameters and render method.
211
+ *
212
+ * @example
213
+ * ```javascript
214
+ * // Add raster layer resourceId is the style of 4004 layer
215
+ * ngwMap.addNgwLayer({ resource: 4005 });
216
+ * // Add vector data from layer GEOJSON source
217
+ * ngwMap.addNgwLayer({
218
+ * resource: 4038,
219
+ * adapter: 'GEOJSON',
220
+ * adapterOptions: { paint: { color: 'red' } }
221
+ * });
222
+ * ```
223
+ */
224
+ addNgwLayer(options) {
225
+ return __async$1(this, null, function* () {
226
+ yield this.onMapLoad();
227
+ const { keyname, resourceId } = options;
228
+ if (keyname || resourceId !== void 0) {
229
+ deprecatedWarn(
230
+ "set `resource` options instead of `keyname` or `resourceId`"
231
+ );
232
+ }
233
+ const resource = options.resource;
234
+ if (!keyname && !resourceId && !resource) {
235
+ throw new Error(
236
+ "resource, resourceId or keyname is required parameter to add NGW layer"
237
+ );
238
+ }
239
+ if (defined(this.options.baseUrl)) {
240
+ try {
241
+ if (defined(this.options.setViewDelay)) {
242
+ options.adapterOptions = options.adapterOptions || {};
243
+ if (!defined(options.adapterOptions.setViewDelay)) {
244
+ options.adapterOptions.setViewDelay = this.options.setViewDelay;
123
245
  }
124
- });
125
- }
126
- /**
127
- * Organized addition to the map design and controls elements,
128
- * calling `control.onAdd(this.webMap.mapAdapter)`
129
- * @param control - object with onAdd and onRemove methods
130
- * or a string value indicating the name of the control installed in the map adapter
131
- * @param position - position relative to the map angles
132
- * @param options - initialization parameters if the control is set as a string value
133
- *
134
- * @example
135
- * ```javascript
136
- * ngwMap.addControl(new CustomControl(), 'bottom-left');
137
- * ngwMap.addControl('ZOOM', 'top-right')
138
- * ```
139
- */
140
- async addControl(controlDef, position, options) {
141
- await this.onLoad('controls:create');
142
- return super.addControl(controlDef, position, options);
143
- }
144
- /**
145
- * Add any (style, vector, webmap) NGW layer by resource definition.
146
- * @param options - set layer identification parameters and render method.
147
- *
148
- * @example
149
- * ```javascript
150
- * // Add raster layer resourceId is the style of 4004 layer
151
- * ngwMap.addNgwLayer({ resource: 4005 });
152
- * // Add vector data from layer GEOJSON source
153
- * ngwMap.addNgwLayer({
154
- * resource: 4038,
155
- * adapter: 'GEOJSON',
156
- * adapterOptions: { paint: { color: 'red' } }
157
- * });
158
- * ```
159
- */
160
- async addNgwLayer(options) {
161
- await this.onMapLoad();
162
- // @ts-ignore for backward compatibility
163
- const { keyname, resourceId } = options;
164
- if (keyname || resourceId !== undefined) {
165
- deprecatedWarn('set `resource` options instead of `keyname` or `resourceId`');
166
- }
167
- const resource = options.resource;
168
- if (!keyname && !resourceId && !resource) {
169
- throw new Error('resource, resourceId or keyname is required parameter to add NGW layer');
170
- }
171
- if (defined(this.options.baseUrl)) {
172
- try {
173
- if (defined(this.options.setViewDelay)) {
174
- options.adapterOptions = options.adapterOptions || {};
175
- if (!defined(options.adapterOptions.setViewDelay)) {
176
- options.adapterOptions.setViewDelay = this.options.setViewDelay;
177
- }
178
- }
179
- const adapter = createNgwLayerAdapter(options, this, this.connector);
180
- const adapterOpts = {
181
- visibility: true,
182
- // TODO: do not merge options, use only `adapterOptions`
183
- ...options,
184
- ...options.adapterOptions,
185
- };
186
- const layer = (await this.addLayer(adapter, adapterOpts));
187
- const id = layer && this.getLayerId(layer);
188
- if (layer && id) {
189
- this._ngwLayers[id] = { layer, resourceId: layer.resourceId };
190
- layer.options.name =
191
- layer.options.name ||
192
- (layer.item && layer.item.resource.display_name);
193
- if (layer.options.baselayer) {
194
- const visibleLayerBaseLayer = this.getActiveBaseLayer();
195
- if (visibleLayerBaseLayer) {
196
- return layer;
197
- }
198
- }
199
- }
246
+ }
247
+ const adapter = createNgwLayerAdapter(options, this, this.connector);
248
+ const adapterOpts = __spreadValues(__spreadValues({
249
+ visibility: true
250
+ }, options), options.adapterOptions);
251
+ const layer = yield this.addLayer(
252
+ adapter,
253
+ adapterOpts
254
+ );
255
+ const id = layer && this.getLayerId(layer);
256
+ if (layer && id) {
257
+ this._ngwLayers[id] = { layer, resourceId: layer.resourceId };
258
+ layer.options.name = layer.options.name || layer.item && layer.item.resource.display_name;
259
+ if (layer.options.baselayer) {
260
+ const visibleLayerBaseLayer = this.getActiveBaseLayer();
261
+ if (visibleLayerBaseLayer) {
200
262
  return layer;
263
+ }
201
264
  }
202
- catch (er) {
203
- const resId = isObject(resource) && 'id' in resource
204
- ? resource.id
205
- : keyname || resourceId || resource;
206
- console.error(`Can't add NGW layer ${resId}.`, er);
207
- }
208
- }
209
- }
210
- /**
211
- * Pans and zooms the map to the initial position specified in the options
212
- */
213
- fit() {
214
- const { center, zoom, bounds } = this.options;
215
- if (center) {
216
- this.setCenter(center);
217
- if (zoom) {
218
- this.setZoom(zoom);
219
- }
220
- }
221
- else if (bounds) {
222
- this.fitBounds(bounds);
223
- }
224
- }
225
- fetchNgwLayerItem(options) {
226
- return fetchNgwLayerItem({
227
- connector: this.connector,
228
- ...options,
229
- });
230
- }
231
- fetchNgwLayerItems(options) {
232
- return fetchNgwLayerItems({
233
- connector: this.connector,
234
- ...options,
235
- });
236
- }
237
- fetchNgwLayerFeature(options) {
238
- return fetchNgwLayerFeature({
239
- connector: this.connector,
240
- ...options,
241
- });
242
- }
243
- fetchNgwLayerFeatures(options) {
244
- return fetchNgwLayerFeatureCollection({
245
- connector: this.connector,
246
- ...options,
247
- });
248
- }
249
- fetchIdentifyItem(identify, requestOptions) {
250
- const promise = fetchIdentifyItem({
251
- identify,
252
- connector: this.connector,
253
- requestOptions,
254
- // multiple,
255
- });
256
- this._addPromise('identify', promise);
257
- return promise;
258
- }
259
- fetchIdentifyGeoJson(identify, multiple = false) {
260
- const promise = fetchIdentifyGeoJson({
261
- identify,
262
- connector: this.connector,
263
- multiple,
264
- });
265
- if (promise && 'then' in promise) {
266
- this._addPromise('identify', promise);
267
- return promise;
268
- }
269
- else {
270
- return CancelablePromise.resolve(promise);
271
- }
272
- }
273
- /**
274
- * @deprecated use {@link fetchIdentifyGeoJson} instead
275
- */
276
- getIdentifyGeoJson(identify, multiple = false) {
277
- return this.fetchIdentifyGeoJson(identify, multiple);
278
- }
279
- async getNgwLayers() {
280
- await this.onLoad();
281
- return this._ngwLayers;
282
- }
283
- async getNgwLayerByResourceId(id) {
284
- for (const n in this._ngwLayers) {
285
- const mem = this._ngwLayers[n];
286
- if (mem.resourceId === id) {
287
- return mem && mem.layer;
288
- }
289
- else if (mem.layer.getIdentificationIds) {
290
- const ids = await mem.layer.getIdentificationIds();
291
- if (ids && ids.some((x) => x === id)) {
292
- return mem.layer;
293
- }
294
- }
295
- if (mem.layer.getDependLayers) {
296
- const dependLayers = mem.layer.getDependLayers();
297
- const dependFit = dependLayers.find((x) => {
298
- return x.item && x.item.parentId === id;
299
- });
300
- if (dependFit) {
301
- return dependFit.layer;
302
- }
303
- }
304
- }
305
- }
306
- /**
307
- * Move map to layer. If the layer is NGW resource, extent will be received from the server
308
- *
309
- * @example
310
- * ```javascript
311
- * const ngwLayer = ngwMap.addNgwLayer({ id: 'ngw_layer_name', resource: 4005 });
312
- * ngwMap.fitLayer(ngwLayer);
313
- * ngwMap.fitLayer('ngw_layer_name');
314
- * ```
315
- */
316
- async fitLayer(layerDef, options) {
317
- let id;
318
- if (typeof layerDef === 'string' || typeof layerDef === 'number') {
319
- id = String(id);
320
- }
321
- else {
322
- id = layerDef.id;
323
- }
324
- const ngwLayer = id && this._ngwLayers[id];
325
- if (ngwLayer) {
326
- if (ngwLayer.layer.getBounds) {
327
- const bounds = await ngwLayer.layer.getBounds();
328
- if (bounds) {
329
- this.fitBounds(bounds, options);
330
- }
331
- }
332
- else {
333
- let item;
334
- if (ngwLayer.layer.item) {
335
- item = ngwLayer.layer.item;
336
- }
337
- else {
338
- const resourceId = ngwLayer.resourceId;
339
- item = await this.connector.getResource(resourceId);
340
- }
341
- if (item) {
342
- fetchNgwExtent({
343
- resourceId: item.resource.id,
344
- connector: this.connector,
345
- }).then((extent) => {
346
- if (extent) {
347
- this.fitBounds(extent, options);
348
- }
349
- });
350
- }
351
- }
352
- }
353
- else {
354
- super.fitLayer(typeof layerDef === 'number' ? String(layerDef) : layerDef, options);
355
- }
356
- }
357
- /** @deprecated use {@link fitLayer} instead */
358
- async zoomToLayer(layerDef) {
359
- return this.fitLayer(layerDef);
360
- }
361
- onLoad(event = 'ngw-map:create') {
362
- return super.onLoad(event);
363
- }
364
- removeLayer(layerDef) {
365
- const layer = this.getLayer(layerDef);
366
- if (layer) {
367
- const layerId = this.getLayerId(layer);
368
- if (layerId) {
369
- delete this._ngwLayers[layerId];
370
- }
371
- super.removeLayer(layer);
372
- }
373
- }
374
- enableSelection() {
375
- if (!this.$$selectFromNgwRaster) {
376
- this.$$selectFromNgwRaster = (ev) => {
377
- const count = this._getSelectListenersCount();
378
- if (count) {
379
- this.selectFromNgwRaster(ev);
380
- }
381
- };
382
- this.$$selectFromNgwVector = (ev) => {
383
- const count = this._getSelectListenersCount();
384
- if (count) {
385
- this._selectFromNgwVector(ev);
386
- }
387
- };
388
- this.emitter.on('click', this.$$selectFromNgwRaster);
389
- this.emitter.on('layer:click', this.$$selectFromNgwVector);
390
- }
391
- }
392
- disableSelection() {
393
- if (this.$$selectFromNgwRaster) {
394
- this.emitter.removeListener('click', this.$$selectFromNgwRaster);
395
- this.$$selectFromNgwRaster = undefined;
396
- }
397
- if (this.$$selectFromNgwVector) {
398
- this.emitter.removeListener('layer:click', this.$$selectFromNgwVector);
399
- this.$$selectFromNgwVector = undefined;
400
- }
401
- }
402
- /**
403
- * @deprecated use {@link fetchNgwLayerItem} instead
404
- */
405
- getNgwLayerItem(options) {
406
- return this.fetchNgwLayerItem(options);
407
- }
408
- /**
409
- * @deprecated use {@link fetchNgwLayerItems} instead
410
- */
411
- getNgwLayerItems(options) {
412
- return this.fetchNgwLayerItems(options);
413
- }
414
- /**
415
- * @deprecated use {@link fetchNgwLayerFeature} instead
416
- */
417
- getNgwLayerFeature(options) {
418
- return this.fetchNgwLayerFeature(options);
419
- }
420
- /**
421
- * @deprecated use {@link fetchNgwLayerFeatures} instead
422
- */
423
- getNgwLayerFeatures(options) {
424
- return this.fetchNgwLayerFeatures(options);
425
- }
426
- /** @deprecated use {@link cancelPromises} instead */
427
- cancelPromise(...args) {
428
- this.cancelPromises(...args);
429
- }
430
- cancelPromises(...args) {
431
- if (!args.length) {
432
- args = Object.keys(this._promises);
433
- }
434
- args.forEach((name) => {
435
- const group = this._promises[name];
436
- if (group) {
437
- group.forEach((x) => x.cancel());
438
- this._promises[name] = [];
439
- }
440
- });
441
- }
442
- async selectFromNgwRaster(ev) {
443
- var _a;
444
- this._emitStatusEvent('ngw:preselect');
445
- const promises = [];
446
- const layers = Object.values(this._ngwLayers);
447
- layers.sort((a, b) => {
448
- if (a.layer.order && b.layer.order) {
449
- return b.layer.order - a.layer.order;
450
- }
451
- return 1;
265
+ }
266
+ return layer;
267
+ } catch (er) {
268
+ const resId = isObject(resource) && "id" in resource ? resource.id : keyname || resourceId || resource;
269
+ console.error(`Can't add NGW layer ${resId}.`, er);
270
+ }
271
+ }
272
+ });
273
+ }
274
+ /**
275
+ * Pans and zooms the map to the initial position specified in the options
276
+ */
277
+ fit() {
278
+ const { center, zoom, bounds } = this.options;
279
+ if (center) {
280
+ this.setCenter(center);
281
+ if (zoom) {
282
+ this.setZoom(zoom);
283
+ }
284
+ } else if (bounds) {
285
+ this.fitBounds(bounds);
286
+ }
287
+ }
288
+ fetchNgwLayerItem(options) {
289
+ return fetchNgwLayerItem(__spreadValues({
290
+ connector: this.connector
291
+ }, options));
292
+ }
293
+ fetchNgwLayerItems(options) {
294
+ return fetchNgwLayerItems(__spreadValues({
295
+ connector: this.connector
296
+ }, options));
297
+ }
298
+ fetchNgwLayerFeature(options) {
299
+ return fetchNgwLayerFeature(__spreadValues({
300
+ connector: this.connector
301
+ }, options));
302
+ }
303
+ fetchNgwLayerFeatures(options) {
304
+ return fetchNgwLayerFeatureCollection(__spreadValues({
305
+ connector: this.connector
306
+ }, options));
307
+ }
308
+ fetchIdentifyItem(identify, requestOptions) {
309
+ const promise = fetchIdentifyItem({
310
+ identify,
311
+ connector: this.connector,
312
+ requestOptions
313
+ // multiple,
314
+ });
315
+ this._addPromise("identify", promise);
316
+ return promise;
317
+ }
318
+ fetchIdentifyGeoJson(identify, multiple = false) {
319
+ const promise = fetchIdentifyGeoJson({
320
+ identify,
321
+ connector: this.connector,
322
+ multiple
323
+ });
324
+ if (promise && "then" in promise) {
325
+ this._addPromise("identify", promise);
326
+ return promise;
327
+ } else {
328
+ return CancelablePromise.resolve(promise);
329
+ }
330
+ }
331
+ /**
332
+ * @deprecated use {@link fetchIdentifyGeoJson} instead
333
+ */
334
+ getIdentifyGeoJson(identify, multiple = false) {
335
+ return this.fetchIdentifyGeoJson(identify, multiple);
336
+ }
337
+ getNgwLayers() {
338
+ return __async$1(this, null, function* () {
339
+ yield this.onLoad();
340
+ return this._ngwLayers;
341
+ });
342
+ }
343
+ getNgwLayerByResourceId(id) {
344
+ return __async$1(this, null, function* () {
345
+ for (const n in this._ngwLayers) {
346
+ const mem = this._ngwLayers[n];
347
+ if (mem.resourceId === id) {
348
+ return mem && mem.layer;
349
+ } else if (mem.layer.getIdentificationIds) {
350
+ const ids = yield mem.layer.getIdentificationIds();
351
+ if (ids && ids.some((x) => x === id)) {
352
+ return mem.layer;
353
+ }
354
+ }
355
+ if (mem.layer.getDependLayers) {
356
+ const dependLayers = mem.layer.getDependLayers();
357
+ const dependFit = dependLayers.find((x) => {
358
+ return x.item && x.item.parentId === id;
359
+ });
360
+ if (dependFit) {
361
+ return dependFit.layer;
362
+ }
363
+ }
364
+ }
365
+ });
366
+ }
367
+ /**
368
+ * Move map to layer. If the layer is NGW resource, extent will be received from the server
369
+ *
370
+ * @example
371
+ * ```javascript
372
+ * const ngwLayer = ngwMap.addNgwLayer({ id: 'ngw_layer_name', resource: 4005 });
373
+ * ngwMap.fitLayer(ngwLayer);
374
+ * ngwMap.fitLayer('ngw_layer_name');
375
+ * ```
376
+ */
377
+ fitLayer(layerDef, options) {
378
+ return __async$1(this, null, function* () {
379
+ let id;
380
+ if (typeof layerDef === "string" || typeof layerDef === "number") {
381
+ id = String(id);
382
+ } else {
383
+ id = layerDef.id;
384
+ }
385
+ const ngwLayer = id && this._ngwLayers[id];
386
+ if (ngwLayer) {
387
+ if (ngwLayer.layer.getBounds) {
388
+ const bounds = yield ngwLayer.layer.getBounds();
389
+ if (bounds) {
390
+ this.fitBounds(bounds, options);
391
+ }
392
+ } else {
393
+ let item;
394
+ if (ngwLayer.layer.item) {
395
+ item = ngwLayer.layer.item;
396
+ } else {
397
+ const resourceId = ngwLayer.resourceId;
398
+ item = yield this.connector.getResource(resourceId);
399
+ }
400
+ if (item) {
401
+ fetchNgwExtent({
402
+ resourceId: item.resource.id,
403
+ connector: this.connector
404
+ }).then((extent) => {
405
+ if (extent) {
406
+ this.fitBounds(extent, options);
407
+ }
408
+ });
409
+ }
410
+ }
411
+ } else {
412
+ __superGet(_NgwMap.prototype, this, "fitLayer").call(
413
+ this,
414
+ typeof layerDef === "number" ? String(layerDef) : layerDef,
415
+ options
416
+ );
417
+ }
418
+ });
419
+ }
420
+ /** @deprecated use {@link fitLayer} instead */
421
+ zoomToLayer(layerDef) {
422
+ return __async$1(this, null, function* () {
423
+ return this.fitLayer(layerDef);
424
+ });
425
+ }
426
+ onLoad(event = "ngw-map:create") {
427
+ return super.onLoad(event);
428
+ }
429
+ removeLayer(layerDef) {
430
+ const layer = this.getLayer(layerDef);
431
+ if (layer) {
432
+ const layerId = this.getLayerId(layer);
433
+ if (layerId) {
434
+ delete this._ngwLayers[layerId];
435
+ }
436
+ super.removeLayer(layer);
437
+ }
438
+ }
439
+ enableSelection() {
440
+ if (!this.$$selectFromNgwRaster) {
441
+ this.$$selectFromNgwRaster = (ev) => {
442
+ const count = this._getSelectListenersCount();
443
+ if (count) {
444
+ this.selectFromNgwRaster(ev);
445
+ }
446
+ };
447
+ this.$$selectFromNgwVector = (ev) => {
448
+ const count = this._getSelectListenersCount();
449
+ if (count) {
450
+ this._selectFromNgwVector(ev);
451
+ }
452
+ };
453
+ this.emitter.on("click", this.$$selectFromNgwRaster);
454
+ this.emitter.on("layer:click", this.$$selectFromNgwVector);
455
+ }
456
+ }
457
+ disableSelection() {
458
+ if (this.$$selectFromNgwRaster) {
459
+ this.emitter.removeListener("click", this.$$selectFromNgwRaster);
460
+ this.$$selectFromNgwRaster = void 0;
461
+ }
462
+ if (this.$$selectFromNgwVector) {
463
+ this.emitter.removeListener("layer:click", this.$$selectFromNgwVector);
464
+ this.$$selectFromNgwVector = void 0;
465
+ }
466
+ }
467
+ /**
468
+ * @deprecated use {@link fetchNgwLayerItem} instead
469
+ */
470
+ getNgwLayerItem(options) {
471
+ return this.fetchNgwLayerItem(options);
472
+ }
473
+ /**
474
+ * @deprecated use {@link fetchNgwLayerItems} instead
475
+ */
476
+ getNgwLayerItems(options) {
477
+ return this.fetchNgwLayerItems(options);
478
+ }
479
+ /**
480
+ * @deprecated use {@link fetchNgwLayerFeature} instead
481
+ */
482
+ getNgwLayerFeature(options) {
483
+ return this.fetchNgwLayerFeature(options);
484
+ }
485
+ /**
486
+ * @deprecated use {@link fetchNgwLayerFeatures} instead
487
+ */
488
+ getNgwLayerFeatures(options) {
489
+ return this.fetchNgwLayerFeatures(options);
490
+ }
491
+ /** @deprecated use {@link cancelPromises} instead */
492
+ cancelPromise(...args) {
493
+ this.cancelPromises(...args);
494
+ }
495
+ cancelPromises(...args) {
496
+ if (!args.length) {
497
+ args = Object.keys(this._promises);
498
+ }
499
+ args.forEach((name) => {
500
+ const group = this._promises[name];
501
+ if (group) {
502
+ group.forEach((x) => x.cancel());
503
+ this._promises[name] = [];
504
+ }
505
+ });
506
+ }
507
+ selectFromNgwRaster(ev) {
508
+ return __async$1(this, null, function* () {
509
+ var _a;
510
+ this._emitStatusEvent("ngw:preselect");
511
+ const promises = [];
512
+ const layers = Object.values(this._ngwLayers);
513
+ layers.sort((a, b) => {
514
+ if (a.layer.order && b.layer.order) {
515
+ return b.layer.order - a.layer.order;
516
+ }
517
+ return 1;
518
+ });
519
+ for (const l of layers) {
520
+ const layer = l.layer;
521
+ const identFunc = typeof layer.getIdentificationIds === "function" ? layer.getIdentificationIds : false;
522
+ const interactive = (_a = layer.options.interactive) != null ? _a : true;
523
+ if (identFunc && layer.options.selectable && interactive && this.isLayerVisible(layer)) {
524
+ promises.push(identFunc.call(layer));
525
+ }
526
+ }
527
+ const getIdsPromise = Promise.all(promises);
528
+ const getIds = yield getIdsPromise;
529
+ const ids = [];
530
+ for (const x of getIds) {
531
+ if (x) {
532
+ ids.push(...x);
533
+ }
534
+ }
535
+ if (!ids.length) {
536
+ this._emitStatusEvent("ngw:select", null);
537
+ return;
538
+ }
539
+ const pixelRadius = this.options.pixelRadius || 10;
540
+ const center = this.getCenter();
541
+ let zoom = this.getZoom();
542
+ zoom = zoom !== void 0 ? zoom : 20;
543
+ if (!center || !zoom) {
544
+ this._emitStatusEvent("ngw:select", null);
545
+ return;
546
+ }
547
+ const radius = getIdentifyRadius(center, zoom, pixelRadius);
548
+ const selectPromise = sendIdentifyRequest(ev, {
549
+ layers: ids,
550
+ connector: this.connector,
551
+ radius
552
+ }).then((resp) => {
553
+ const identify = __spreadProps(__spreadValues({}, resp), {
554
+ resources: ids,
555
+ sourceType: "raster",
556
+ event: ev
452
557
  });
453
- for (const l of layers) {
454
- const layer = l.layer;
455
- const identFunc = typeof layer.getIdentificationIds === 'function'
456
- ? layer.getIdentificationIds
457
- : false;
458
- const interactive = (_a = layer.options.interactive) !== null && _a !== void 0 ? _a : true;
459
- if (identFunc &&
460
- layer.options.selectable &&
461
- interactive &&
462
- this.isLayerVisible(layer)) {
463
- promises.push(identFunc.call(layer));
464
- }
465
- }
466
- const getIdsPromise = Promise.all(promises);
467
- const getIds = await getIdsPromise;
468
- const ids = [];
469
- for (const x of getIds) {
470
- if (x) {
471
- ids.push(...x);
472
- }
473
- }
474
- if (!ids.length) {
475
- this._emitStatusEvent('ngw:select', null);
476
- return;
477
- }
478
- const pixelRadius = this.options.pixelRadius || 10;
479
- const center = this.getCenter();
480
- let zoom = this.getZoom();
481
- zoom = zoom !== undefined ? zoom : 20;
482
- if (!center || !zoom) {
483
- this._emitStatusEvent('ngw:select', null);
484
- return;
485
- }
486
- const radius = getIdentifyRadius(center, zoom, pixelRadius);
487
- const selectPromise = sendIdentifyRequest(ev, {
488
- layers: ids,
489
- connector: this.connector,
490
- radius,
491
- }).then((resp) => {
492
- const identify = {
493
- ...resp,
494
- resources: ids,
495
- sourceType: 'raster',
496
- event: ev,
497
- };
498
- const identifyEvent = this._prepareToIdentify(identify);
499
- this._emitStatusEvent('ngw:select', identifyEvent);
500
- return identifyEvent;
558
+ const identifyEvent = this._prepareToIdentify(identify);
559
+ this._emitStatusEvent("ngw:select", identifyEvent);
560
+ return identifyEvent;
561
+ });
562
+ this._addPromise("select", selectPromise);
563
+ return selectPromise;
564
+ });
565
+ }
566
+ _addPromise(groupName, promise) {
567
+ const group = this._promises[groupName];
568
+ if (group && group.indexOf(promise) === -1) {
569
+ const removeFromGroup = () => {
570
+ const index = group.indexOf(promise);
571
+ if (index !== -1) {
572
+ group.splice(index, 1);
573
+ }
574
+ };
575
+ promise.then(removeFromGroup);
576
+ promise.catch(removeFromGroup);
577
+ group.push(promise);
578
+ }
579
+ }
580
+ _isFitFromResource() {
581
+ const params = this._initMapState;
582
+ if (params.zoom && params.center) {
583
+ return false;
584
+ }
585
+ return true;
586
+ }
587
+ _createWebMap() {
588
+ return __async$1(this, null, function* () {
589
+ yield this.create();
590
+ if (this.options.qmsId) {
591
+ this._addQmsBaseLayer();
592
+ }
593
+ if (this.options.osm) {
594
+ this._addOsmBaseLayer();
595
+ }
596
+ const resources = [];
597
+ const layerFitAllowed = this._isFitFromResource();
598
+ if (this.options.webmapId) {
599
+ appendNgwResources(resources, this.options.webmapId, {
600
+ fit: layerFitAllowed
501
601
  });
502
- this._addPromise('select', selectPromise);
503
- return selectPromise;
504
- }
505
- _addPromise(groupName, promise) {
506
- const group = this._promises[groupName];
507
- if (group && group.indexOf(promise) === -1) {
508
- const removeFromGroup = () => {
509
- const index = group.indexOf(promise);
510
- if (index !== -1) {
511
- group.splice(index, 1);
512
- }
513
- };
514
- promise.then(removeFromGroup);
515
- promise.catch(removeFromGroup);
516
- group.push(promise);
517
- }
518
- }
519
- _isFitFromResource() {
520
- const params = this._initMapState;
521
- if (params.zoom && params.center) {
522
- return false;
523
- }
524
- return true;
525
- }
526
- async _createWebMap() {
527
- await this.create();
528
- if (this.options.qmsId) {
529
- this._addQmsBaseLayer();
530
- }
531
- if (this.options.osm) {
532
- this._addOsmBaseLayer();
533
- }
534
- const resources = [];
535
- const layerFitAllowed = this._isFitFromResource();
536
- if (this.options.webmapId) {
537
- appendNgwResources(resources, this.options.webmapId, {
538
- fit: layerFitAllowed,
539
- });
540
- }
541
- if (this.options.resources && Array.isArray(this.options.resources)) {
542
- for (const x of this.options.resources) {
543
- const overwriteOptions = {};
544
- if (!layerFitAllowed) {
545
- overwriteOptions.fit = false;
546
- }
547
- appendNgwResources(resources, x, {}, overwriteOptions);
548
- }
549
- }
550
- for (const r of resources) {
551
- try {
552
- await this.addNgwLayer(r);
553
- }
554
- catch (er) {
555
- console.warn(er);
556
- }
557
- }
558
- this._emitStatusEvent('ngw-map:create', this);
559
- this.enableSelection();
560
- }
561
- _addOsmBaseLayer() {
562
- this.addBaseLayer('OSM');
563
- }
564
- _addQmsBaseLayer() {
565
- let qmsId;
566
- let qmsLayerName;
567
- if (Array.isArray(this.options.qmsId)) {
568
- qmsId = this.options.qmsId[0];
569
- qmsLayerName = this.options.qmsId[1];
570
- }
571
- else {
572
- qmsId = Number(this.options.qmsId);
573
- }
574
- const qmsLayerOptions = {
575
- qmsId,
602
+ }
603
+ if (this.options.resources && Array.isArray(this.options.resources)) {
604
+ for (const x of this.options.resources) {
605
+ const overwriteOptions = {};
606
+ if (!layerFitAllowed) {
607
+ overwriteOptions.fit = false;
608
+ }
609
+ appendNgwResources(resources, x, {}, overwriteOptions);
610
+ }
611
+ }
612
+ for (const r of resources) {
613
+ try {
614
+ yield this.addNgwLayer(r);
615
+ } catch (er) {
616
+ console.warn(er);
617
+ }
618
+ }
619
+ this._emitStatusEvent("ngw-map:create", this);
620
+ this.enableSelection();
621
+ });
622
+ }
623
+ _addOsmBaseLayer() {
624
+ this.addBaseLayer("OSM");
625
+ }
626
+ _addQmsBaseLayer() {
627
+ let qmsId;
628
+ let qmsLayerName;
629
+ if (Array.isArray(this.options.qmsId)) {
630
+ qmsId = this.options.qmsId[0];
631
+ qmsLayerName = this.options.qmsId[1];
632
+ } else {
633
+ qmsId = Number(this.options.qmsId);
634
+ }
635
+ const qmsLayerOptions = {
636
+ qmsId
637
+ };
638
+ if (qmsLayerName) {
639
+ qmsLayerOptions.id = qmsLayerName;
640
+ }
641
+ this.addBaseLayer("QMS", qmsLayerOptions);
642
+ }
643
+ _selectFromNgwVector(ev) {
644
+ const layer = ev.layer;
645
+ const selectable = layer.options.selectable && this.isLayerVisible(layer);
646
+ if (!selectable) {
647
+ return void 0;
648
+ }
649
+ const id = layer.item && layer.item.resource.id;
650
+ const feature = ev.feature;
651
+ if (id !== void 0 && feature) {
652
+ const featureId = feature.id;
653
+ if (featureId) {
654
+ const identifyFeature = {
655
+ id: Number(featureId),
656
+ fields: feature.properties || {},
657
+ label: `#${id}`,
658
+ layerId: Number(id),
659
+ parent: "",
660
+ geom: feature.geometry
576
661
  };
577
- if (qmsLayerName) {
578
- qmsLayerOptions.id = qmsLayerName;
579
- }
580
- this.addBaseLayer('QMS', qmsLayerOptions);
581
- }
582
- _selectFromNgwVector(ev) {
583
- const layer = ev.layer;
584
- const selectable = layer.options.selectable && this.isLayerVisible(layer);
585
- if (!selectable) {
586
- return undefined;
587
- }
588
- // Item property means layer is NgwResource
589
- const id = layer.item && layer.item.resource.id;
590
- const feature = ev.feature;
591
- if (id !== undefined && feature) {
592
- const featureId = feature.id;
593
- if (featureId) {
594
- const identifyFeature = {
595
- id: Number(featureId),
596
- fields: feature.properties || {},
597
- label: `#${id}`,
598
- layerId: Number(id),
599
- parent: '',
600
- geom: feature.geometry,
601
- };
602
- const items = {
603
- featureCount: 1,
604
- features: [identifyFeature],
605
- };
606
- const identify = {
607
- featureCount: 1,
608
- [id]: items,
609
- };
610
- this._emitStatusEvent('ngw:select', this._prepareToIdentify({
611
- ...identify,
612
- resources: [id],
613
- sourceType: 'vector',
614
- }));
615
- return identify;
616
- }
617
- }
618
- }
619
- _prepareToIdentify(identify) {
620
- const getIdentifyItems_ = () => {
621
- return getIdentifyItems(identify, true).map((x) => {
622
- return createIdentifyItem({
623
- feature: x.feature,
624
- connector: this.connector,
625
- });
626
- });
662
+ const items = {
663
+ featureCount: 1,
664
+ features: [identifyFeature]
627
665
  };
628
- return {
629
- ...identify,
630
- getIdentifyItems: getIdentifyItems_,
666
+ const identify = {
667
+ featureCount: 1,
668
+ [id]: items
631
669
  };
632
- }
633
- _getSelectListenersCount() {
634
- return this.emitter.listenerCount('ngw:select');
635
- }
636
- async _whiteLabel() {
637
- const container = this.getContainer();
638
- if (container) {
639
- const logo = await getCompanyLogo(this.connector, this.options.companyLogoOptions);
640
- if (logo) {
641
- container.appendChild(logo);
642
- }
643
- }
644
- }
645
- }
646
- NgwMap.getIcon = getIcon;
670
+ this._emitStatusEvent(
671
+ "ngw:select",
672
+ this._prepareToIdentify(__spreadProps(__spreadValues({}, identify), {
673
+ resources: [id],
674
+ sourceType: "vector"
675
+ }))
676
+ );
677
+ return identify;
678
+ }
679
+ }
680
+ }
681
+ _prepareToIdentify(identify) {
682
+ const getIdentifyItems_ = () => {
683
+ return getIdentifyItems(identify, true).map((x) => {
684
+ return createIdentifyItem({
685
+ feature: x.feature,
686
+ connector: this.connector
687
+ });
688
+ });
689
+ };
690
+ return __spreadProps(__spreadValues({}, identify), {
691
+ getIdentifyItems: getIdentifyItems_
692
+ });
693
+ }
694
+ _getSelectListenersCount() {
695
+ return this.emitter.listenerCount("ngw:select");
696
+ }
697
+ _whiteLabel() {
698
+ return __async$1(this, null, function* () {
699
+ const container = this.getContainer();
700
+ if (container) {
701
+ const logo = yield getCompanyLogo(
702
+ this.connector,
703
+ this.options.companyLogoOptions
704
+ );
705
+ if (logo) {
706
+ container.appendChild(logo);
707
+ }
708
+ }
709
+ });
710
+ }
711
+ };
712
+ __publicField(_NgwMap, "getIcon", getIcon);
713
+ let NgwMap = _NgwMap;
647
714
 
648
- /**
649
- * @module ngw-map
650
- */
651
- async function createNgwMap(options) {
715
+ var __async = (__this, __arguments, generator) => {
716
+ return new Promise((resolve, reject) => {
717
+ var fulfilled = (value) => {
718
+ try {
719
+ step(generator.next(value));
720
+ } catch (e) {
721
+ reject(e);
722
+ }
723
+ };
724
+ var rejected = (value) => {
725
+ try {
726
+ step(generator.throw(value));
727
+ } catch (e) {
728
+ reject(e);
729
+ }
730
+ };
731
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
732
+ step((generator = generator.apply(__this, __arguments)).next());
733
+ });
734
+ };
735
+ function createNgwMap(options) {
736
+ return __async(this, null, function* () {
652
737
  const ngwMap = new NgwMap(options);
653
738
  return ngwMap.onLoad();
739
+ });
654
740
  }
655
741
 
656
742
  export { NgwMap, createNgwMap };