@vcmap/core 5.0.0-rc.21 → 5.0.0-rc.23
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/index.d.ts +263 -24
- package/index.js +13 -4
- package/package.json +2 -2
- package/src/category/appBackedCategory.js +3 -3
- package/src/context.js +2 -2
- package/src/featureProvider/wmsFeatureProvider.js +1 -1
- package/src/layer/cesium/dataSourceCesiumImpl.js +1 -1
- package/src/layer/cesium/x3dmHelper.js +1 -1
- package/src/layer/cesiumTilesetLayer.js +0 -5
- package/src/layer/wmsHelpers.js +2 -0
- package/src/map/baseOLMap.js +12 -6
- package/src/map/cesiumMap.js +32 -44
- package/src/map/obliqueMap.js +19 -19
- package/src/map/openlayersMap.js +15 -14
- package/src/map/vcsMap.js +31 -9
- package/src/oblique/obliqueProvider.js +2 -2
- package/src/style/declarativeStyleItem.js +2 -8
- package/src/util/editor/editGeometrySession.js +401 -0
- package/src/util/editor/editorHelpers.js +109 -0
- package/src/util/editor/editorSessionHelpers.js +1 -2
- package/src/util/editor/editorSymbols.js +10 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +133 -0
- package/src/util/editor/interactions/insertVertexInteraction.js +92 -0
- package/src/util/editor/interactions/mapInteractionController.js +99 -0
- package/src/util/editor/interactions/removeVertexInteraction.js +39 -0
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +95 -0
- package/src/util/editor/interactions/translateVertexInteraction.js +61 -0
- package/src/util/mapCollection.js +39 -14
- package/src/util/math.js +9 -0
- package/src/util/splitScreen.js +1 -1
- package/src/util/viewpoint.js +16 -16
- package/src/vcsApp.js +15 -15
- package/src/vcsAppContextHelpers.js +6 -6
- package/tests/unit/helpers/cesiumHelpers.js +6 -5
- package/tests/unit/helpers/obliqueHelpers.js +5 -5
package/src/map/cesiumMap.js
CHANGED
|
@@ -27,13 +27,12 @@ import {
|
|
|
27
27
|
KeyboardEventModifier,
|
|
28
28
|
ScreenSpaceEventType,
|
|
29
29
|
Cesium3DTileset,
|
|
30
|
-
ExperimentalFeatures,
|
|
31
30
|
} from '@vcmap/cesium';
|
|
32
31
|
|
|
33
32
|
import { check, checkMaybe } from '@vcsuite/check';
|
|
34
33
|
import { parseBoolean, parseInteger } from '@vcsuite/parsers';
|
|
35
34
|
import VcsMap from './vcsMap.js';
|
|
36
|
-
import
|
|
35
|
+
import Viewpoint from '../util/viewpoint.js';
|
|
37
36
|
import Projection, { mercatorProjection } from '../util/projection.js';
|
|
38
37
|
import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
|
|
39
38
|
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
@@ -51,6 +50,12 @@ import { mapClassRegistry } from '../classRegistry.js';
|
|
|
51
50
|
* @api
|
|
52
51
|
*/
|
|
53
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {Object} CesiumMapEvent
|
|
55
|
+
* @property {import("@vcmap/cesium").Scene} scene
|
|
56
|
+
* @property {import("@vcmap/cesium").JulianDate} time
|
|
57
|
+
*/
|
|
58
|
+
|
|
54
59
|
/**
|
|
55
60
|
* Ensures, a primitive/imageryLayer/entity is part of a collection and placed at the correct location
|
|
56
61
|
* @param {import("@vcmap/cesium").PrimitiveCollection|import("@vcmap/cesium").ImageryLayerCollection} cesiumCollection
|
|
@@ -197,8 +202,6 @@ function setDebugOnVisualizations(visualizations, debug) {
|
|
|
197
202
|
});
|
|
198
203
|
}
|
|
199
204
|
|
|
200
|
-
ExperimentalFeatures.enableModelExperimental = false; // TODO check on release
|
|
201
|
-
|
|
202
205
|
/**
|
|
203
206
|
* Cesium Globe Map Class (3D map)
|
|
204
207
|
* @class
|
|
@@ -318,21 +321,11 @@ class CesiumMap extends VcsMap {
|
|
|
318
321
|
* @private
|
|
319
322
|
*/
|
|
320
323
|
this._cameraLimiterOptions = options.cameraLimiter || defaultOptions.cameraLimiter;
|
|
321
|
-
/**
|
|
322
|
-
* @type {Function}
|
|
323
|
-
* @private
|
|
324
|
-
*/
|
|
325
|
-
this._terrainProviderChangedListener = null;
|
|
326
324
|
/**
|
|
327
325
|
* @type {Function}
|
|
328
326
|
* @private
|
|
329
327
|
*/
|
|
330
328
|
this._preUpdateListener = null;
|
|
331
|
-
/**
|
|
332
|
-
* @type {Function}
|
|
333
|
-
* @private
|
|
334
|
-
*/
|
|
335
|
-
this._clockTickListener = null;
|
|
336
329
|
/**
|
|
337
330
|
* @type {Function}
|
|
338
331
|
* @private
|
|
@@ -340,10 +333,10 @@ class CesiumMap extends VcsMap {
|
|
|
340
333
|
this._clockSyncListener = null;
|
|
341
334
|
|
|
342
335
|
/**
|
|
343
|
-
* @type {
|
|
336
|
+
* @type {Array<function():void>}
|
|
344
337
|
* @private
|
|
345
338
|
*/
|
|
346
|
-
this.
|
|
339
|
+
this._listeners = [];
|
|
347
340
|
|
|
348
341
|
/**
|
|
349
342
|
* @type {boolean}
|
|
@@ -516,11 +509,11 @@ class CesiumMap extends VcsMap {
|
|
|
516
509
|
|
|
517
510
|
const { clock } = this._cesiumWidget;
|
|
518
511
|
clock.shouldAnimate = true;
|
|
519
|
-
this.
|
|
512
|
+
this._listeners.push(clock.onTick.addEventListener(() => {
|
|
520
513
|
this.dataSourceDisplayClock.tick();
|
|
521
514
|
const time = this.dataSourceDisplayClock.currentTime;
|
|
522
515
|
this.dataSourceDisplay.update(time);
|
|
523
|
-
});
|
|
516
|
+
}));
|
|
524
517
|
|
|
525
518
|
// deactivate cesium Requestthrottling let the browser manage that
|
|
526
519
|
// RequestScheduler.throttleRequests = false;
|
|
@@ -531,7 +524,7 @@ class CesiumMap extends VcsMap {
|
|
|
531
524
|
this._cesiumWidget.scene.globe.depthTestAgainstTerrain = true;
|
|
532
525
|
this._cesiumWidget.scene.highDynamicRange = false;
|
|
533
526
|
// this._cesiumWidget.scene.logarithmicDepthBuffer = false; // TODO observe this
|
|
534
|
-
this._cesiumWidget.scene.
|
|
527
|
+
this._cesiumWidget.scene.splitPosition = 0.5;
|
|
535
528
|
|
|
536
529
|
this._cesiumWidget.scene.globe.enableLighting = this.enableLightning;
|
|
537
530
|
|
|
@@ -559,8 +552,12 @@ class CesiumMap extends VcsMap {
|
|
|
559
552
|
|
|
560
553
|
this.defaultTerrainProvider = this._cesiumWidget.scene.terrainProvider;
|
|
561
554
|
this._terrainProvider = this.defaultTerrainProvider;
|
|
562
|
-
this.
|
|
563
|
-
|
|
555
|
+
this._listeners.push(this._cesiumWidget.scene.terrainProviderChanged
|
|
556
|
+
.addEventListener(this._terrainProviderChanged.bind(this)));
|
|
557
|
+
|
|
558
|
+
this._listeners.push(this._cesiumWidget.scene.postRender.addEventListener((eventScene, time) => {
|
|
559
|
+
this.postRender.raiseEvent({ map: this, originalEvent: { scene: eventScene, time } });
|
|
560
|
+
}));
|
|
564
561
|
if (this._debug) {
|
|
565
562
|
this._setDebug();
|
|
566
563
|
}
|
|
@@ -612,17 +609,17 @@ class CesiumMap extends VcsMap {
|
|
|
612
609
|
|
|
613
610
|
/**
|
|
614
611
|
* @inheritDoc
|
|
615
|
-
* @returns {Promise<null|
|
|
612
|
+
* @returns {Promise<null|Viewpoint>}
|
|
616
613
|
*/
|
|
617
|
-
async
|
|
618
|
-
return this.
|
|
614
|
+
async getViewpoint() {
|
|
615
|
+
return this.getViewpointSync();
|
|
619
616
|
}
|
|
620
617
|
|
|
621
618
|
/**
|
|
622
619
|
* @inheritDoc
|
|
623
|
-
* @returns {
|
|
620
|
+
* @returns {Viewpoint|null}
|
|
624
621
|
*/
|
|
625
|
-
|
|
622
|
+
getViewpointSync() {
|
|
626
623
|
if (!this._cesiumWidget || !this._cesiumWidget.scene || !this.target) {
|
|
627
624
|
return null;
|
|
628
625
|
}
|
|
@@ -648,7 +645,7 @@ class CesiumMap extends VcsMap {
|
|
|
648
645
|
CesiumMath.toDegrees(cameraPositionCartographic.latitude),
|
|
649
646
|
cameraPositionCartographic.height,
|
|
650
647
|
];
|
|
651
|
-
return new
|
|
648
|
+
return new Viewpoint({
|
|
652
649
|
groundPosition,
|
|
653
650
|
cameraPosition,
|
|
654
651
|
distance,
|
|
@@ -659,12 +656,12 @@ class CesiumMap extends VcsMap {
|
|
|
659
656
|
}
|
|
660
657
|
|
|
661
658
|
/**
|
|
662
|
-
* @param {
|
|
659
|
+
* @param {Viewpoint} viewpoint
|
|
663
660
|
* @param {number=} optMaximumHeight
|
|
664
661
|
* @returns {Promise<void>}
|
|
665
662
|
* @inheritDoc
|
|
666
663
|
*/
|
|
667
|
-
async
|
|
664
|
+
async gotoViewpoint(viewpoint, optMaximumHeight) {
|
|
668
665
|
if (this.movementDisabled || !viewpoint.isValid()) {
|
|
669
666
|
return;
|
|
670
667
|
}
|
|
@@ -883,10 +880,9 @@ class CesiumMap extends VcsMap {
|
|
|
883
880
|
visualizersCallback,
|
|
884
881
|
});
|
|
885
882
|
|
|
886
|
-
this.
|
|
887
|
-
this.
|
|
888
|
-
|
|
889
|
-
});
|
|
883
|
+
this._listeners.push(this._cesiumWidget.clock.onTick.addEventListener((clock) => {
|
|
884
|
+
this._clusterDataSourceDisplay.update(clock.currentTime);
|
|
885
|
+
}));
|
|
890
886
|
|
|
891
887
|
return dataSourceCollection;
|
|
892
888
|
}
|
|
@@ -1135,17 +1131,12 @@ class CesiumMap extends VcsMap {
|
|
|
1135
1131
|
this.screenSpaceEventHandler.destroy();
|
|
1136
1132
|
this.screenSpaceEventHandler = null;
|
|
1137
1133
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1134
|
+
this._listeners.forEach((cb) => { cb(); });
|
|
1135
|
+
this._listeners = [];
|
|
1136
|
+
|
|
1142
1137
|
this._terrainProvider = null;
|
|
1143
1138
|
this.defaultTerrainProvider = null;
|
|
1144
1139
|
|
|
1145
|
-
if (this._clockTickListener) {
|
|
1146
|
-
this._clockTickListener();
|
|
1147
|
-
this._clockTickListener = null;
|
|
1148
|
-
}
|
|
1149
1140
|
|
|
1150
1141
|
if (this._clockSyncListener) {
|
|
1151
1142
|
this._clockSyncListener();
|
|
@@ -1160,9 +1151,6 @@ class CesiumMap extends VcsMap {
|
|
|
1160
1151
|
if (this._cameraLimiter) {
|
|
1161
1152
|
this._cameraLimiter = null;
|
|
1162
1153
|
}
|
|
1163
|
-
if (this._removeClusterClockTickListener) {
|
|
1164
|
-
this._removeClusterClockTickListener();
|
|
1165
|
-
}
|
|
1166
1154
|
|
|
1167
1155
|
[...this.layerCollection].forEach((l) => { l.removedFromMap(this); });
|
|
1168
1156
|
|
package/src/map/obliqueMap.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parseBoolean, parseNumber } from '@vcsuite/parsers';
|
|
|
5
5
|
import Extent from '../util/extent.js';
|
|
6
6
|
import { mercatorProjection, wgs84Projection } from '../util/projection.js';
|
|
7
7
|
import { getResolutionOptions, getZoom } from '../layer/oblique/obliqueHelpers.js';
|
|
8
|
-
import
|
|
8
|
+
import Viewpoint from '../util/viewpoint.js';
|
|
9
9
|
import BaseOLMap from './baseOLMap.js';
|
|
10
10
|
import VcsMap from './vcsMap.js';
|
|
11
11
|
import VcsEvent from '../vcsEvent.js';
|
|
@@ -42,10 +42,10 @@ const defaultCollection = new DefaultObliqueCollection();
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* returns the direction which matches the heading of the viewpoint
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {Viewpoint} viewpoint
|
|
46
46
|
* @returns {import("@vcmap/core").ObliqueViewDirection}
|
|
47
47
|
*/
|
|
48
|
-
export function
|
|
48
|
+
export function getViewDirectionFromViewpoint(viewpoint) {
|
|
49
49
|
const { heading } = viewpoint;
|
|
50
50
|
let direction = ViewDirection.NORTH;
|
|
51
51
|
if (heading >= 45 && heading < 135) {
|
|
@@ -59,7 +59,7 @@ export function getViewDirectionFromViewPoint(viewpoint) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {Viewpoint} viewpoint
|
|
63
63
|
* @returns {import("ol/coordinate").Coordinate}
|
|
64
64
|
* @private
|
|
65
65
|
*/
|
|
@@ -254,14 +254,14 @@ class ObliqueMap extends BaseOLMap {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* @param {
|
|
257
|
+
* @param {Viewpoint} viewpoint
|
|
258
258
|
* @returns {Promise<boolean>}
|
|
259
259
|
* @api
|
|
260
260
|
*/
|
|
261
261
|
async canShowViewpoint(viewpoint) {
|
|
262
262
|
await this.initialize();
|
|
263
263
|
if (this.collection) {
|
|
264
|
-
const viewDirection =
|
|
264
|
+
const viewDirection = getViewDirectionFromViewpoint(viewpoint);
|
|
265
265
|
const mercatorCoordinates = getMercatorViewpointCenter(viewpoint);
|
|
266
266
|
return this.collection.hasImageAtCoordinate(mercatorCoordinates, viewDirection);
|
|
267
267
|
}
|
|
@@ -305,7 +305,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
305
305
|
/**
|
|
306
306
|
* Sets a new oblique collection
|
|
307
307
|
* @param {ObliqueCollection} obliqueCollection
|
|
308
|
-
* @param {
|
|
308
|
+
* @param {Viewpoint=} viewpoint
|
|
309
309
|
* @returns {Promise<void>}
|
|
310
310
|
* @api
|
|
311
311
|
*/
|
|
@@ -331,7 +331,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
331
331
|
/**
|
|
332
332
|
* Sets a new oblique collection
|
|
333
333
|
* @param {ObliqueCollection} obliqueCollection
|
|
334
|
-
* @param {
|
|
334
|
+
* @param {Viewpoint=} viewpoint
|
|
335
335
|
* @returns {Promise<void>}
|
|
336
336
|
* @private
|
|
337
337
|
*/
|
|
@@ -342,14 +342,14 @@ class ObliqueMap extends BaseOLMap {
|
|
|
342
342
|
this._setCollection(defaultCollection);
|
|
343
343
|
});
|
|
344
344
|
await obliqueCollection.load();
|
|
345
|
-
const vp = viewpoint || await this.
|
|
345
|
+
const vp = viewpoint || await this.getViewpoint();
|
|
346
346
|
if (this._loadingCollection !== obliqueCollection) {
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
349
|
this._obliqueProvider.setCollection(obliqueCollection);
|
|
350
350
|
this.collectionChanged.raiseEvent(obliqueCollection);
|
|
351
351
|
if (vp) {
|
|
352
|
-
await this.
|
|
352
|
+
await this.gotoViewpoint(vp);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
|
|
@@ -372,10 +372,10 @@ class ObliqueMap extends BaseOLMap {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
/**
|
|
375
|
-
* @returns {Promise<
|
|
375
|
+
* @returns {Promise<Viewpoint|null>}
|
|
376
376
|
* @inheritDoc
|
|
377
377
|
*/
|
|
378
|
-
async
|
|
378
|
+
async getViewpoint() {
|
|
379
379
|
const image = this.currentImage;
|
|
380
380
|
if (!image) {
|
|
381
381
|
return null;
|
|
@@ -393,9 +393,9 @@ class ObliqueMap extends BaseOLMap {
|
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* @inheritDoc
|
|
396
|
-
* @returns {
|
|
396
|
+
* @returns {Viewpoint|null}
|
|
397
397
|
*/
|
|
398
|
-
|
|
398
|
+
getViewpointSync() {
|
|
399
399
|
const image = this.currentImage;
|
|
400
400
|
if (!image) {
|
|
401
401
|
return null;
|
|
@@ -416,7 +416,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
416
416
|
|
|
417
417
|
/**
|
|
418
418
|
* @param {import("ol/coordinate").Coordinate} groundPosition
|
|
419
|
-
* @returns {
|
|
419
|
+
* @returns {Viewpoint}
|
|
420
420
|
* @private
|
|
421
421
|
*/
|
|
422
422
|
_computeViewpointInternal(groundPosition) {
|
|
@@ -432,7 +432,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
432
432
|
const avgHeight = groundPosition[2] || image.averageHeight;
|
|
433
433
|
const cameraHeight = height + avgHeight;
|
|
434
434
|
|
|
435
|
-
return new
|
|
435
|
+
return new Viewpoint({
|
|
436
436
|
cameraPosition: [groundPosition[0], groundPosition[1], cameraHeight],
|
|
437
437
|
groundPosition,
|
|
438
438
|
heading: defaultHeadings[image.viewDirection],
|
|
@@ -443,16 +443,16 @@ class ObliqueMap extends BaseOLMap {
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
/**
|
|
446
|
-
* @param {
|
|
446
|
+
* @param {Viewpoint} viewpoint
|
|
447
447
|
* @returns {Promise<void>}
|
|
448
448
|
* @inheritDoc
|
|
449
449
|
*/
|
|
450
|
-
async
|
|
450
|
+
async gotoViewpoint(viewpoint) {
|
|
451
451
|
if (this.movementDisabled || !this._obliqueProvider || !viewpoint.isValid()) {
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
const viewDirection =
|
|
455
|
+
const viewDirection = getViewDirectionFromViewpoint(viewpoint);
|
|
456
456
|
const mercatorCoordinates = getMercatorViewpointCenter(viewpoint);
|
|
457
457
|
const { distance } = viewpoint;
|
|
458
458
|
await this._obliqueProvider.setView(mercatorCoordinates, viewDirection);
|
package/src/map/openlayersMap.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getTransform } from 'ol/proj.js';
|
|
|
4
4
|
import { inAndOut } from 'ol/easing.js';
|
|
5
5
|
import { boundingExtent, containsXY } from 'ol/extent.js';
|
|
6
6
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
7
|
-
import
|
|
7
|
+
import Viewpoint from '../util/viewpoint.js';
|
|
8
8
|
import BaseOLMap from './baseOLMap.js';
|
|
9
9
|
import VcsMap from './vcsMap.js';
|
|
10
10
|
import { mapClassRegistry } from '../classRegistry.js';
|
|
@@ -65,17 +65,17 @@ class OpenlayersMap extends BaseOLMap {
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @inheritDoc
|
|
68
|
-
* @returns {Promise<
|
|
68
|
+
* @returns {Promise<Viewpoint>}
|
|
69
69
|
*/
|
|
70
|
-
async
|
|
71
|
-
return this.
|
|
70
|
+
async getViewpoint() {
|
|
71
|
+
return this.getViewpointSync();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* @inheritDoc
|
|
76
|
-
* @returns {
|
|
76
|
+
* @returns {Viewpoint}
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
getViewpointSync() {
|
|
79
79
|
const view = this.olMap.getView();
|
|
80
80
|
const coord = view.getCenter();
|
|
81
81
|
const toLatLon = getTransform(view.getProjection(), 'EPSG:4326');
|
|
@@ -100,7 +100,7 @@ class OpenlayersMap extends BaseOLMap {
|
|
|
100
100
|
// don't add 0;
|
|
101
101
|
const groundPosition = latlon; // .concat([0]);
|
|
102
102
|
const pitch = -90;
|
|
103
|
-
return new
|
|
103
|
+
return new Viewpoint({
|
|
104
104
|
groundPosition,
|
|
105
105
|
pitch,
|
|
106
106
|
heading,
|
|
@@ -109,16 +109,17 @@ class OpenlayersMap extends BaseOLMap {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* @param {
|
|
112
|
+
* @param {Viewpoint} viewpoint
|
|
113
113
|
* @returns {Promise<void>}
|
|
114
114
|
* @inheritDoc
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
gotoViewpoint(viewpoint) {
|
|
117
117
|
if (this.movementDisabled || !viewpoint.isValid()) {
|
|
118
118
|
return Promise.resolve();
|
|
119
119
|
}
|
|
120
|
+
let { heading } = viewpoint;
|
|
120
121
|
if (this.fixedNorthOrientation) {
|
|
121
|
-
|
|
122
|
+
heading = 0;
|
|
122
123
|
}
|
|
123
124
|
const view = this.olMap.getView();
|
|
124
125
|
const fromLatLon = getTransform('EPSG:4326', view.getProjection());
|
|
@@ -148,8 +149,8 @@ class OpenlayersMap extends BaseOLMap {
|
|
|
148
149
|
|
|
149
150
|
if (viewpoint.animate) {
|
|
150
151
|
let rotation = 0;
|
|
151
|
-
if (!this.fixedNorthOrientation &&
|
|
152
|
-
rotation = -CesiumMath.toRadians(
|
|
152
|
+
if (!this.fixedNorthOrientation && heading != null) {
|
|
153
|
+
rotation = -CesiumMath.toRadians(heading);
|
|
153
154
|
}
|
|
154
155
|
return new Promise((resolve) => {
|
|
155
156
|
view.animate({
|
|
@@ -163,8 +164,8 @@ class OpenlayersMap extends BaseOLMap {
|
|
|
163
164
|
} else {
|
|
164
165
|
view.setCenter(center);
|
|
165
166
|
view.setResolution(resolution);
|
|
166
|
-
if (!this.fixedNorthOrientation &&
|
|
167
|
-
view.setRotation(-CesiumMath.toRadians(
|
|
167
|
+
if (!this.fixedNorthOrientation && heading != null) {
|
|
168
|
+
view.setRotation(-CesiumMath.toRadians(heading));
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
return Promise.resolve();
|
package/src/map/vcsMap.js
CHANGED
|
@@ -31,6 +31,12 @@ import { mapClassRegistry } from '../classRegistry.js';
|
|
|
31
31
|
* @api stable
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {Object} VcsMapRenderEvent
|
|
36
|
+
* @property {VcsMap} map
|
|
37
|
+
* @property {import("ol").MapEvent|CesiumMapEvent} originalEvent
|
|
38
|
+
*/
|
|
39
|
+
|
|
34
40
|
/**
|
|
35
41
|
* @type {Object}
|
|
36
42
|
*/
|
|
@@ -152,6 +158,12 @@ class VcsMap extends VcsObject {
|
|
|
152
158
|
* @api
|
|
153
159
|
*/
|
|
154
160
|
this.splitScreen = null;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @type {VcsEvent<VcsMapRenderEvent>}
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
this._postRender = new VcsEvent();
|
|
155
167
|
}
|
|
156
168
|
|
|
157
169
|
/**
|
|
@@ -217,6 +229,15 @@ class VcsMap extends VcsObject {
|
|
|
217
229
|
this._setLayerCollectionListeners();
|
|
218
230
|
}
|
|
219
231
|
|
|
232
|
+
/**
|
|
233
|
+
* An event raised on the maps post render
|
|
234
|
+
* @type {VcsEvent<VcsMapRenderEvent>}
|
|
235
|
+
* @readonly
|
|
236
|
+
*/
|
|
237
|
+
get postRender() {
|
|
238
|
+
return this._postRender;
|
|
239
|
+
}
|
|
240
|
+
|
|
220
241
|
/**
|
|
221
242
|
* @private
|
|
222
243
|
*/
|
|
@@ -240,7 +261,7 @@ class VcsMap extends VcsObject {
|
|
|
240
261
|
|
|
241
262
|
/**
|
|
242
263
|
* Determines whether this map can show this viewpoint. Returns true in any other map then {@link Oblique}
|
|
243
|
-
* @param {import("@vcmap/core").
|
|
264
|
+
* @param {import("@vcmap/core").Viewpoint} viewpoint
|
|
244
265
|
* @returns {Promise<boolean>}
|
|
245
266
|
* @api
|
|
246
267
|
*/
|
|
@@ -407,7 +428,7 @@ class VcsMap extends VcsObject {
|
|
|
407
428
|
}
|
|
408
429
|
|
|
409
430
|
/**
|
|
410
|
-
* prevent all movement, including navigation controls,
|
|
431
|
+
* prevent all movement, including navigation controls, gotoViewpoint & setting of oblique images
|
|
411
432
|
* @param {boolean} prevent
|
|
412
433
|
* @api
|
|
413
434
|
*/
|
|
@@ -417,14 +438,14 @@ class VcsMap extends VcsObject {
|
|
|
417
438
|
|
|
418
439
|
/**
|
|
419
440
|
* sets the view to the given viewpoint
|
|
420
|
-
* @param {import("@vcmap/core").
|
|
441
|
+
* @param {import("@vcmap/core").Viewpoint} viewpoint
|
|
421
442
|
* @param {number=} optMaximumHeight during animation (can be used to get rid of the bunny hop)
|
|
422
|
-
*
|
|
443
|
+
* gotoViewpoint
|
|
423
444
|
* @returns {Promise<void>}
|
|
424
445
|
* @api stable
|
|
425
446
|
*/
|
|
426
447
|
// eslint-disable-next-line no-unused-vars,class-methods-use-this
|
|
427
|
-
|
|
448
|
+
gotoViewpoint(viewpoint, optMaximumHeight) {
|
|
428
449
|
return Promise.resolve();
|
|
429
450
|
}
|
|
430
451
|
|
|
@@ -432,20 +453,20 @@ class VcsMap extends VcsObject {
|
|
|
432
453
|
/**
|
|
433
454
|
* Returns the most precise viewpoint possible in ObliqueMap.
|
|
434
455
|
* @api
|
|
435
|
-
* @returns {Promise<import("@vcmap/core").
|
|
456
|
+
* @returns {Promise<import("@vcmap/core").Viewpoint|null>}
|
|
436
457
|
*/
|
|
437
458
|
// eslint-disable-next-line class-methods-use-this
|
|
438
|
-
async
|
|
459
|
+
async getViewpoint() {
|
|
439
460
|
return null;
|
|
440
461
|
}
|
|
441
462
|
|
|
442
463
|
/**
|
|
443
464
|
* Returns an approximate viewpoint in ObliqueMap, not requesting terrain.
|
|
444
465
|
* @api
|
|
445
|
-
* @returns {import("@vcmap/core").
|
|
466
|
+
* @returns {import("@vcmap/core").Viewpoint|null}
|
|
446
467
|
*/
|
|
447
468
|
// eslint-disable-next-line class-methods-use-this
|
|
448
|
-
|
|
469
|
+
getViewpointSync() {
|
|
449
470
|
return null;
|
|
450
471
|
}
|
|
451
472
|
|
|
@@ -523,6 +544,7 @@ class VcsMap extends VcsObject {
|
|
|
523
544
|
this.pointerInteractionEvent = null;
|
|
524
545
|
}
|
|
525
546
|
this._layerCollection = null;
|
|
547
|
+
this._postRender.destroy();
|
|
526
548
|
}
|
|
527
549
|
}
|
|
528
550
|
|
|
@@ -10,7 +10,7 @@ import VcsEvent from '../vcsEvent.js';
|
|
|
10
10
|
import { isDefaultImageSymbol } from './defaultObliqueCollection.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @typedef {Object}
|
|
13
|
+
* @typedef {Object} ObliqueViewpoint
|
|
14
14
|
* @property {import("ol/coordinate").Coordinate} center - in mercator
|
|
15
15
|
* @property {number} zoom
|
|
16
16
|
* @property {import("@vcmap/core").ObliqueViewDirection} direction
|
|
@@ -399,7 +399,7 @@ class ObliqueProvider {
|
|
|
399
399
|
|
|
400
400
|
/**
|
|
401
401
|
* Returns a viewpoint for the currently set view.
|
|
402
|
-
* @returns {Promise<
|
|
402
|
+
* @returns {Promise<ObliqueViewpoint>}
|
|
403
403
|
* @api
|
|
404
404
|
*/
|
|
405
405
|
async getView() {
|
|
@@ -142,12 +142,8 @@ class DeclarativeStyleItem extends StyleItem {
|
|
|
142
142
|
toJSON() {
|
|
143
143
|
const config = /** @type {DeclarativeStyleItemOptions} */ (super.toJSON());
|
|
144
144
|
|
|
145
|
-
const styleOptions = this.cesiumStyle.ready ?
|
|
146
|
-
this.cesiumStyle.style :
|
|
147
|
-
this.styleOptions;
|
|
148
|
-
|
|
149
145
|
config.declarativeStyle = Object.fromEntries(
|
|
150
|
-
Object.entries(
|
|
146
|
+
Object.entries(this.cesiumStyle.style)
|
|
151
147
|
.filter(([, value]) => value != null)
|
|
152
148
|
.map(([key, value]) => {
|
|
153
149
|
if (is(value, Boolean)) {
|
|
@@ -181,9 +177,7 @@ class DeclarativeStyleItem extends StyleItem {
|
|
|
181
177
|
*/
|
|
182
178
|
assign(styleItem) {
|
|
183
179
|
super.assign(styleItem);
|
|
184
|
-
this._styleOptions = styleItem.cesiumStyle.
|
|
185
|
-
styleItem.cesiumStyle.style :
|
|
186
|
-
styleItem.styleOptions;
|
|
180
|
+
this._styleOptions = styleItem.cesiumStyle.style;
|
|
187
181
|
|
|
188
182
|
this.cesiumStyle = new Cesium3DTileStyle(this._styleOptions);
|
|
189
183
|
return this;
|