@vcmap/core 5.2.0 → 5.3.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/map/vcsMap.d.ts +1 -0
- package/dist/src/map/vcsMap.js +3 -0
- package/dist/src/map/vcsMap.js.map +1 -1
- package/dist/src/util/displayQuality/displayQuality.d.ts +79 -0
- package/dist/src/util/displayQuality/displayQuality.js +232 -0
- package/dist/src/util/displayQuality/displayQuality.js.map +1 -0
- package/dist/src/vcsApp.d.ts +10 -1
- package/dist/src/vcsApp.js +78 -20
- package/dist/src/vcsApp.js.map +1 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js +2 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
- package/index.ts +5 -0
- package/package.json +1 -1
- package/src/map/vcsMap.ts +6 -0
- package/src/util/displayQuality/displayQuality.ts +304 -0
- package/src/vcsApp.ts +91 -23
package/src/vcsApp.ts
CHANGED
|
@@ -50,6 +50,7 @@ import FlightInstance, {
|
|
|
50
50
|
FlightInstanceOptions,
|
|
51
51
|
} from './util/flight/flightInstance.js';
|
|
52
52
|
import FlightCollection from './util/flight/flightCollection.js';
|
|
53
|
+
import DisplayQuality from './util/displayQuality/displayQuality.js';
|
|
53
54
|
|
|
54
55
|
function getLogger(): Logger {
|
|
55
56
|
return getLoggerByName('init');
|
|
@@ -120,9 +121,19 @@ class VcsApp {
|
|
|
120
121
|
|
|
121
122
|
private _categories: CategoryCollection;
|
|
122
123
|
|
|
124
|
+
private _displayQuality: DisplayQuality;
|
|
125
|
+
|
|
123
126
|
private _destroyed: VcsEvent<void>;
|
|
124
127
|
|
|
125
|
-
private
|
|
128
|
+
private _moduleMutationChain: {
|
|
129
|
+
running: boolean;
|
|
130
|
+
items: Array<{
|
|
131
|
+
moduleId: string;
|
|
132
|
+
mutation: () => Promise<void>;
|
|
133
|
+
resolve: () => void;
|
|
134
|
+
reject: (reason?: any) => void;
|
|
135
|
+
}>;
|
|
136
|
+
};
|
|
126
137
|
|
|
127
138
|
private _categoryItemClassRegistry: OverrideClassRegistry<Ctor<any>>;
|
|
128
139
|
|
|
@@ -215,8 +226,9 @@ class VcsApp {
|
|
|
215
226
|
categoryClassRegistry,
|
|
216
227
|
);
|
|
217
228
|
this._categories = new CategoryCollection(this);
|
|
229
|
+
this._displayQuality = new DisplayQuality(this);
|
|
218
230
|
this._destroyed = new VcsEvent();
|
|
219
|
-
this.
|
|
231
|
+
this._moduleMutationChain = { running: false, items: [] };
|
|
220
232
|
this._categoryItemClassRegistry = new OverrideClassRegistry(
|
|
221
233
|
new ClassRegistry(),
|
|
222
234
|
);
|
|
@@ -295,6 +307,10 @@ class VcsApp {
|
|
|
295
307
|
return this._flights;
|
|
296
308
|
}
|
|
297
309
|
|
|
310
|
+
get displayQuality(): DisplayQuality {
|
|
311
|
+
return this._displayQuality;
|
|
312
|
+
}
|
|
313
|
+
|
|
298
314
|
get destroyed(): VcsEvent<void> {
|
|
299
315
|
return this._destroyed;
|
|
300
316
|
}
|
|
@@ -402,12 +418,13 @@ class VcsApp {
|
|
|
402
418
|
config.startingObliqueCollectionName,
|
|
403
419
|
);
|
|
404
420
|
if (startingObliqueCollection) {
|
|
405
|
-
|
|
406
|
-
.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
421
|
+
await Promise.all(
|
|
422
|
+
[...this._maps]
|
|
423
|
+
.filter((m) => m instanceof ObliqueMap)
|
|
424
|
+
.map((m) => {
|
|
425
|
+
return (m as ObliqueMap).setCollection(startingObliqueCollection);
|
|
426
|
+
}),
|
|
427
|
+
);
|
|
411
428
|
}
|
|
412
429
|
}
|
|
413
430
|
|
|
@@ -427,20 +444,61 @@ class VcsApp {
|
|
|
427
444
|
}
|
|
428
445
|
}
|
|
429
446
|
|
|
430
|
-
|
|
447
|
+
/**
|
|
448
|
+
* When adding multiple modules, adding of previous modules are awaited.
|
|
449
|
+
* If an invalid module is added an error is thrown and already added items of invalid module are removed.
|
|
450
|
+
* @param module
|
|
451
|
+
*/
|
|
452
|
+
async addModule(module: VcsModule): Promise<void> {
|
|
431
453
|
check(module, VcsModule);
|
|
432
454
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
455
|
+
const mutation = async (): Promise<void> => {
|
|
456
|
+
try {
|
|
457
|
+
if (this._modules.hasKey(module._id)) {
|
|
458
|
+
getLogger().info(`module with id ${module._id} already loaded`);
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
438
461
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
462
|
+
await this._parseModule(module);
|
|
463
|
+
await this._setModuleState(module);
|
|
464
|
+
this._modules.add(module);
|
|
465
|
+
} catch (err) {
|
|
466
|
+
await this._removeModule(module._id);
|
|
467
|
+
throw err;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
return new Promise((resolve, reject) => {
|
|
471
|
+
this._moduleMutationChain.items.push({
|
|
472
|
+
moduleId: module._id,
|
|
473
|
+
mutation,
|
|
474
|
+
resolve,
|
|
475
|
+
reject,
|
|
476
|
+
});
|
|
477
|
+
this._startModuleMutationChain();
|
|
442
478
|
});
|
|
443
|
-
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
_startModuleMutationChain(): void {
|
|
482
|
+
if (!this._moduleMutationChain.running) {
|
|
483
|
+
const item = this._moduleMutationChain.items.shift();
|
|
484
|
+
if (item) {
|
|
485
|
+
try {
|
|
486
|
+
this._moduleMutationChain.running = true;
|
|
487
|
+
item
|
|
488
|
+
.mutation()
|
|
489
|
+
.then(() => item.resolve())
|
|
490
|
+
.catch((err) => item.reject(err))
|
|
491
|
+
.finally(() => {
|
|
492
|
+
this._moduleMutationChain.running = false;
|
|
493
|
+
this._startModuleMutationChain();
|
|
494
|
+
});
|
|
495
|
+
} catch (err) {
|
|
496
|
+
item.reject(err);
|
|
497
|
+
this._moduleMutationChain.running = false;
|
|
498
|
+
this._startModuleMutationChain();
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
444
502
|
}
|
|
445
503
|
|
|
446
504
|
serializeModule(moduleId: string): VcsModuleConfig {
|
|
@@ -503,8 +561,8 @@ class VcsApp {
|
|
|
503
561
|
]);
|
|
504
562
|
}
|
|
505
563
|
|
|
506
|
-
removeModule(moduleId: string): Promise<void> {
|
|
507
|
-
|
|
564
|
+
async removeModule(moduleId: string): Promise<void> {
|
|
565
|
+
const mutation = async (): Promise<void> => {
|
|
508
566
|
const module = this._modules.getByKey(moduleId);
|
|
509
567
|
if (!module) {
|
|
510
568
|
getLogger().info(`module with id ${moduleId} has already been removed`);
|
|
@@ -512,16 +570,25 @@ class VcsApp {
|
|
|
512
570
|
}
|
|
513
571
|
await this._removeModule(moduleId);
|
|
514
572
|
this._modules.remove(module);
|
|
573
|
+
};
|
|
574
|
+
return new Promise((resolve, reject) => {
|
|
575
|
+
this._moduleMutationChain.items.push({
|
|
576
|
+
moduleId,
|
|
577
|
+
mutation,
|
|
578
|
+
resolve,
|
|
579
|
+
reject,
|
|
580
|
+
});
|
|
581
|
+
this._startModuleMutationChain();
|
|
515
582
|
});
|
|
516
|
-
|
|
517
|
-
return this._moduleMutationPromise;
|
|
518
583
|
}
|
|
519
584
|
|
|
520
585
|
/**
|
|
521
586
|
* Destroys the app and all its collections, their content and ui managers.
|
|
522
587
|
*/
|
|
523
588
|
destroy(): void {
|
|
524
|
-
|
|
589
|
+
this._moduleMutationChain.running = false;
|
|
590
|
+
this._moduleMutationChain.items.splice(0);
|
|
591
|
+
Object.defineProperty(this, '_moduleMutationChain', {
|
|
525
592
|
get() {
|
|
526
593
|
throw new Error('VcsApp was destroyed');
|
|
527
594
|
},
|
|
@@ -542,6 +609,7 @@ class VcsApp {
|
|
|
542
609
|
this._categoryItemClassRegistry.destroy();
|
|
543
610
|
this._tileProviderClassRegistry.destroy();
|
|
544
611
|
this._featureProviderClassRegistry.destroy();
|
|
612
|
+
this._displayQuality.destroy();
|
|
545
613
|
this.destroyed.raiseEvent();
|
|
546
614
|
this.destroyed.destroy();
|
|
547
615
|
this.localeChanged.destroy();
|