@vcmap/core 5.0.0-rc.22 → 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 +34 -0
- package/package.json +1 -1
- package/src/featureProvider/wmsFeatureProvider.js +1 -1
- package/src/layer/wmsHelpers.js +2 -0
- package/src/map/baseOLMap.js +12 -6
- package/src/map/cesiumMap.js +22 -31
- package/src/map/openlayersMap.js +6 -5
- package/src/map/vcsMap.js +22 -0
- package/src/util/mapCollection.js +25 -0
- package/tests/unit/helpers/cesiumHelpers.js +3 -1
package/index.d.ts
CHANGED
|
@@ -5002,6 +5002,10 @@ export class BaseOLMap extends VcsMap {
|
|
|
5002
5002
|
* When setting the layer colleciton, the destroyLayerCollection flag is automatically set to false.
|
|
5003
5003
|
*/
|
|
5004
5004
|
layerCollection: LayerCollection;
|
|
5005
|
+
/**
|
|
5006
|
+
* An event raised on the maps post render
|
|
5007
|
+
*/
|
|
5008
|
+
readonly postRender: VcsEvent<VcsMapRenderEvent>;
|
|
5005
5009
|
/**
|
|
5006
5010
|
* unique Name
|
|
5007
5011
|
*/
|
|
@@ -5088,6 +5092,11 @@ export interface CesiumMapOptions extends VcsMapOptions {
|
|
|
5088
5092
|
globeColor?: string | undefined;
|
|
5089
5093
|
}
|
|
5090
5094
|
|
|
5095
|
+
export interface CesiumMapEvent {
|
|
5096
|
+
scene: import("@vcmap/cesium").Scene;
|
|
5097
|
+
time: import("@vcmap/cesium").JulianDate;
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5091
5100
|
/**
|
|
5092
5101
|
* Cesium Globe Map Class (3D map)
|
|
5093
5102
|
*/
|
|
@@ -5248,6 +5257,10 @@ export class CesiumMap extends VcsMap {
|
|
|
5248
5257
|
* When setting the layer colleciton, the destroyLayerCollection flag is automatically set to false.
|
|
5249
5258
|
*/
|
|
5250
5259
|
layerCollection: LayerCollection;
|
|
5260
|
+
/**
|
|
5261
|
+
* An event raised on the maps post render
|
|
5262
|
+
*/
|
|
5263
|
+
readonly postRender: VcsEvent<VcsMapRenderEvent>;
|
|
5251
5264
|
/**
|
|
5252
5265
|
* unique Name
|
|
5253
5266
|
*/
|
|
@@ -5354,6 +5367,10 @@ export class ObliqueMap extends BaseOLMap {
|
|
|
5354
5367
|
* When setting the layer colleciton, the destroyLayerCollection flag is automatically set to false.
|
|
5355
5368
|
*/
|
|
5356
5369
|
layerCollection: LayerCollection;
|
|
5370
|
+
/**
|
|
5371
|
+
* An event raised on the maps post render
|
|
5372
|
+
*/
|
|
5373
|
+
readonly postRender: VcsEvent<VcsMapRenderEvent>;
|
|
5357
5374
|
/**
|
|
5358
5375
|
* unique Name
|
|
5359
5376
|
*/
|
|
@@ -5426,6 +5443,10 @@ export class OpenlayersMap extends BaseOLMap {
|
|
|
5426
5443
|
* When setting the layer colleciton, the destroyLayerCollection flag is automatically set to false.
|
|
5427
5444
|
*/
|
|
5428
5445
|
layerCollection: LayerCollection;
|
|
5446
|
+
/**
|
|
5447
|
+
* An event raised on the maps post render
|
|
5448
|
+
*/
|
|
5449
|
+
readonly postRender: VcsEvent<VcsMapRenderEvent>;
|
|
5429
5450
|
/**
|
|
5430
5451
|
* unique Name
|
|
5431
5452
|
*/
|
|
@@ -5460,6 +5481,11 @@ export interface ClickPosition {
|
|
|
5460
5481
|
exactPosition?: boolean | undefined;
|
|
5461
5482
|
}
|
|
5462
5483
|
|
|
5484
|
+
export interface VcsMapRenderEvent {
|
|
5485
|
+
map: VcsMap;
|
|
5486
|
+
originalEvent: import("ol").MapEvent | CesiumMapEvent;
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5463
5489
|
/**
|
|
5464
5490
|
* Map Base Class, each different map is derived from this abstract base class.
|
|
5465
5491
|
*/
|
|
@@ -5507,6 +5533,10 @@ export class VcsMap extends VcsObject {
|
|
|
5507
5533
|
*/
|
|
5508
5534
|
readonly target: HTMLElement | null;
|
|
5509
5535
|
layerCollection: any;
|
|
5536
|
+
/**
|
|
5537
|
+
* An event raised on the maps post render
|
|
5538
|
+
*/
|
|
5539
|
+
readonly postRender: VcsEvent<VcsMapRenderEvent>;
|
|
5510
5540
|
/**
|
|
5511
5541
|
* Determines whether this map can show this viewpoint. Returns true in any other map then {@link Oblique}
|
|
5512
5542
|
*/
|
|
@@ -7562,6 +7592,10 @@ export class MapCollection extends Collection<VcsMap> {
|
|
|
7562
7592
|
* Set split screen for these maps.
|
|
7563
7593
|
*/
|
|
7564
7594
|
splitScreen: any;
|
|
7595
|
+
/**
|
|
7596
|
+
* Raised on the active maps post render event
|
|
7597
|
+
*/
|
|
7598
|
+
readonly postRender: VcsEvent<VcsMapRenderEvent>;
|
|
7565
7599
|
/**
|
|
7566
7600
|
* Adds a map to the collection. This will set the collections target, {@link SplitScreen}
|
|
7567
7601
|
* and the collections {@link LayerCollection} on the map.
|
package/package.json
CHANGED
|
@@ -61,7 +61,7 @@ export function getFormat(responseType, options = {}) {
|
|
|
61
61
|
if (responseType === 'application/vnd.ogc.gml') {
|
|
62
62
|
return new GML2(options);
|
|
63
63
|
}
|
|
64
|
-
if (responseType === 'application/vnd.ogc.gml/3.1.1') {
|
|
64
|
+
if (responseType === 'application/vnd.ogc.gml/3.1.1' || responseType === 'text/xml; subtype=gml/3.1.1') {
|
|
65
65
|
return new GML3(options);
|
|
66
66
|
}
|
|
67
67
|
return null;
|
package/src/layer/wmsHelpers.js
CHANGED
package/src/map/baseOLMap.js
CHANGED
|
@@ -128,7 +128,6 @@ class BaseOLMap extends VcsMap {
|
|
|
128
128
|
}),
|
|
129
129
|
target: this.mapElement,
|
|
130
130
|
});
|
|
131
|
-
|
|
132
131
|
// @ts-ignore
|
|
133
132
|
const pointerDownListener = /** @type {import("ol/events").EventsKey} */ (this.olMap.on('pointerdown', (event) => {
|
|
134
133
|
this._raisePointerInteraction(
|
|
@@ -143,11 +142,18 @@ class BaseOLMap extends VcsMap {
|
|
|
143
142
|
PointerEventType.UP,
|
|
144
143
|
);
|
|
145
144
|
}));
|
|
146
|
-
|
|
147
|
-
const pointerMoveListener = /** @type {import("ol/events").EventsKey} */ (this.olMap
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
|
|
146
|
+
const pointerMoveListener = /** @type {import("ol/events").EventsKey} */ (this.olMap
|
|
147
|
+
.on('pointermove', (event) => {
|
|
148
|
+
this._raisePointerInteraction(event, PointerEventType.MOVE);
|
|
149
|
+
}));
|
|
150
|
+
|
|
151
|
+
const postRenderListener = /** @type {import("ol/events").EventsKey} */ (this.olMap
|
|
152
|
+
.on('postrender', (originalEvent) => {
|
|
153
|
+
this.postRender.raiseEvent({ map: this, originalEvent });
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
this._olListeners.push(pointerDownListener, pointerUpListener, pointerMoveListener, postRenderListener);
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
|
package/src/map/cesiumMap.js
CHANGED
|
@@ -50,6 +50,12 @@ import { mapClassRegistry } from '../classRegistry.js';
|
|
|
50
50
|
* @api
|
|
51
51
|
*/
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {Object} CesiumMapEvent
|
|
55
|
+
* @property {import("@vcmap/cesium").Scene} scene
|
|
56
|
+
* @property {import("@vcmap/cesium").JulianDate} time
|
|
57
|
+
*/
|
|
58
|
+
|
|
53
59
|
/**
|
|
54
60
|
* Ensures, a primitive/imageryLayer/entity is part of a collection and placed at the correct location
|
|
55
61
|
* @param {import("@vcmap/cesium").PrimitiveCollection|import("@vcmap/cesium").ImageryLayerCollection} cesiumCollection
|
|
@@ -315,21 +321,11 @@ class CesiumMap extends VcsMap {
|
|
|
315
321
|
* @private
|
|
316
322
|
*/
|
|
317
323
|
this._cameraLimiterOptions = options.cameraLimiter || defaultOptions.cameraLimiter;
|
|
318
|
-
/**
|
|
319
|
-
* @type {Function}
|
|
320
|
-
* @private
|
|
321
|
-
*/
|
|
322
|
-
this._terrainProviderChangedListener = null;
|
|
323
324
|
/**
|
|
324
325
|
* @type {Function}
|
|
325
326
|
* @private
|
|
326
327
|
*/
|
|
327
328
|
this._preUpdateListener = null;
|
|
328
|
-
/**
|
|
329
|
-
* @type {Function}
|
|
330
|
-
* @private
|
|
331
|
-
*/
|
|
332
|
-
this._clockTickListener = null;
|
|
333
329
|
/**
|
|
334
330
|
* @type {Function}
|
|
335
331
|
* @private
|
|
@@ -337,10 +333,10 @@ class CesiumMap extends VcsMap {
|
|
|
337
333
|
this._clockSyncListener = null;
|
|
338
334
|
|
|
339
335
|
/**
|
|
340
|
-
* @type {
|
|
336
|
+
* @type {Array<function():void>}
|
|
341
337
|
* @private
|
|
342
338
|
*/
|
|
343
|
-
this.
|
|
339
|
+
this._listeners = [];
|
|
344
340
|
|
|
345
341
|
/**
|
|
346
342
|
* @type {boolean}
|
|
@@ -513,11 +509,11 @@ class CesiumMap extends VcsMap {
|
|
|
513
509
|
|
|
514
510
|
const { clock } = this._cesiumWidget;
|
|
515
511
|
clock.shouldAnimate = true;
|
|
516
|
-
this.
|
|
512
|
+
this._listeners.push(clock.onTick.addEventListener(() => {
|
|
517
513
|
this.dataSourceDisplayClock.tick();
|
|
518
514
|
const time = this.dataSourceDisplayClock.currentTime;
|
|
519
515
|
this.dataSourceDisplay.update(time);
|
|
520
|
-
});
|
|
516
|
+
}));
|
|
521
517
|
|
|
522
518
|
// deactivate cesium Requestthrottling let the browser manage that
|
|
523
519
|
// RequestScheduler.throttleRequests = false;
|
|
@@ -556,8 +552,12 @@ class CesiumMap extends VcsMap {
|
|
|
556
552
|
|
|
557
553
|
this.defaultTerrainProvider = this._cesiumWidget.scene.terrainProvider;
|
|
558
554
|
this._terrainProvider = this.defaultTerrainProvider;
|
|
559
|
-
this.
|
|
560
|
-
|
|
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
|
+
}));
|
|
561
561
|
if (this._debug) {
|
|
562
562
|
this._setDebug();
|
|
563
563
|
}
|
|
@@ -880,10 +880,9 @@ class CesiumMap extends VcsMap {
|
|
|
880
880
|
visualizersCallback,
|
|
881
881
|
});
|
|
882
882
|
|
|
883
|
-
this.
|
|
884
|
-
this.
|
|
885
|
-
|
|
886
|
-
});
|
|
883
|
+
this._listeners.push(this._cesiumWidget.clock.onTick.addEventListener((clock) => {
|
|
884
|
+
this._clusterDataSourceDisplay.update(clock.currentTime);
|
|
885
|
+
}));
|
|
887
886
|
|
|
888
887
|
return dataSourceCollection;
|
|
889
888
|
}
|
|
@@ -1132,17 +1131,12 @@ class CesiumMap extends VcsMap {
|
|
|
1132
1131
|
this.screenSpaceEventHandler.destroy();
|
|
1133
1132
|
this.screenSpaceEventHandler = null;
|
|
1134
1133
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
}
|
|
1134
|
+
this._listeners.forEach((cb) => { cb(); });
|
|
1135
|
+
this._listeners = [];
|
|
1136
|
+
|
|
1139
1137
|
this._terrainProvider = null;
|
|
1140
1138
|
this.defaultTerrainProvider = null;
|
|
1141
1139
|
|
|
1142
|
-
if (this._clockTickListener) {
|
|
1143
|
-
this._clockTickListener();
|
|
1144
|
-
this._clockTickListener = null;
|
|
1145
|
-
}
|
|
1146
1140
|
|
|
1147
1141
|
if (this._clockSyncListener) {
|
|
1148
1142
|
this._clockSyncListener();
|
|
@@ -1157,9 +1151,6 @@ class CesiumMap extends VcsMap {
|
|
|
1157
1151
|
if (this._cameraLimiter) {
|
|
1158
1152
|
this._cameraLimiter = null;
|
|
1159
1153
|
}
|
|
1160
|
-
if (this._removeClusterClockTickListener) {
|
|
1161
|
-
this._removeClusterClockTickListener();
|
|
1162
|
-
}
|
|
1163
1154
|
|
|
1164
1155
|
[...this.layerCollection].forEach((l) => { l.removedFromMap(this); });
|
|
1165
1156
|
|
package/src/map/openlayersMap.js
CHANGED
|
@@ -117,8 +117,9 @@ class OpenlayersMap extends BaseOLMap {
|
|
|
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
|
*/
|
|
@@ -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
|
|
|
@@ -143,6 +143,16 @@ class MapCollection extends Collection {
|
|
|
143
143
|
* @private
|
|
144
144
|
*/
|
|
145
145
|
this._mapPointerListeners = [];
|
|
146
|
+
/**
|
|
147
|
+
* @type {VcsEvent<VcsMapRenderEvent>}
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
this._postRender = new VcsEvent();
|
|
151
|
+
/**
|
|
152
|
+
* @type {function():void}
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
this._postRenderListener = () => {};
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
/**
|
|
@@ -205,6 +215,15 @@ class MapCollection extends Collection {
|
|
|
205
215
|
});
|
|
206
216
|
}
|
|
207
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Raised on the active maps post render event
|
|
220
|
+
* @type {VcsEvent<VcsMapRenderEvent>}
|
|
221
|
+
* @readonly
|
|
222
|
+
*/
|
|
223
|
+
get postRender() {
|
|
224
|
+
return this._postRender;
|
|
225
|
+
}
|
|
226
|
+
|
|
208
227
|
/**
|
|
209
228
|
* Adds a map to the collection. This will set the collections target, {@link SplitScreen}
|
|
210
229
|
* and the collections {@link LayerCollection} on the map.
|
|
@@ -231,6 +250,8 @@ class MapCollection extends Collection {
|
|
|
231
250
|
*/
|
|
232
251
|
_remove(map) {
|
|
233
252
|
if (this._activeMap === map) {
|
|
253
|
+
this._postRenderListener();
|
|
254
|
+
this._postRenderListener = () => {};
|
|
234
255
|
this._cachedViewpoint = map.getViewpointSync();
|
|
235
256
|
if (this._target) {
|
|
236
257
|
const mapClassName = this._activeMap.className.split('.').pop();
|
|
@@ -380,6 +401,10 @@ class MapCollection extends Collection {
|
|
|
380
401
|
|
|
381
402
|
this.clippingObjectManager.mapActivated(map);
|
|
382
403
|
this._splitScreen.mapActivated(map);
|
|
404
|
+
this._postRenderListener();
|
|
405
|
+
this._postRenderListener = this._activeMap.postRender.addEventListener((event) => {
|
|
406
|
+
this.postRender.raiseEvent(event);
|
|
407
|
+
});
|
|
383
408
|
this.mapActivated.raiseEvent(map);
|
|
384
409
|
return Promise.resolve();
|
|
385
410
|
}
|