@vcmap/core 6.3.0-rc.3 → 6.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/build/postinstall.js +16 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +10 -1
- package/dist/src/featureProvider/abstractFeatureProvider.d.ts +8 -0
- package/dist/src/featureProvider/abstractFeatureProvider.js +10 -0
- package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
- package/dist/src/featureProvider/jsonAttributeProvider.d.ts +2 -1
- package/dist/src/featureProvider/jsonAttributeProvider.js +5 -2
- package/dist/src/featureProvider/jsonAttributeProvider.js.map +1 -1
- package/dist/src/featureProvider/mapboxFeatureProvider.d.ts +18 -0
- package/dist/src/featureProvider/mapboxFeatureProvider.js +49 -0
- package/dist/src/featureProvider/mapboxFeatureProvider.js.map +1 -0
- package/dist/src/featureProvider/wmsFeatureProvider.d.ts +11 -0
- package/dist/src/featureProvider/wmsFeatureProvider.js +19 -8
- package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
- package/dist/src/interaction/eventHandler.js +3 -1
- package/dist/src/interaction/eventHandler.js.map +1 -1
- package/dist/src/interaction/featureAtPixelInteraction.js +5 -0
- package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
- package/dist/src/interaction/featureProviderInteraction.d.ts +10 -1
- package/dist/src/interaction/featureProviderInteraction.js +19 -3
- package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
- package/dist/src/layer/cesium/mapboxStyleCesiumImpl.d.ts +25 -0
- package/dist/src/layer/cesium/mapboxStyleCesiumImpl.js +58 -0
- package/dist/src/layer/cesium/mapboxStyleCesiumImpl.js.map +1 -0
- package/dist/src/layer/cesium/mapboxStyleImageryProvider.d.ts +26 -0
- package/dist/src/layer/cesium/mapboxStyleImageryProvider.js +147 -0
- package/dist/src/layer/cesium/mapboxStyleImageryProvider.js.map +1 -0
- package/dist/src/layer/cesium/vectorTileImageryProvider.d.ts +1 -1
- package/dist/src/layer/cesium/vectorTileImageryProvider.js.map +1 -1
- package/dist/src/layer/mapboxStyleLayer.d.ts +55 -0
- package/dist/src/layer/mapboxStyleLayer.js +176 -0
- package/dist/src/layer/mapboxStyleLayer.js.map +1 -0
- package/dist/src/layer/openlayers/layerOpenlayersImpl.d.ts +3 -4
- package/dist/src/layer/openlayers/layerOpenlayersImpl.js +11 -3
- package/dist/src/layer/openlayers/layerOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/mapboxStyleOpenlayersImpl.d.ts +15 -0
- package/dist/src/layer/openlayers/mapboxStyleOpenlayersImpl.js +49 -0
- package/dist/src/layer/openlayers/mapboxStyleOpenlayersImpl.js.map +1 -0
- package/dist/src/map/baseCesiumMap.d.ts +17 -0
- package/dist/src/map/baseCesiumMap.js +36 -0
- package/dist/src/map/baseCesiumMap.js.map +1 -1
- package/dist/src/map/baseOLMap.d.ts +6 -4
- package/dist/src/map/baseOLMap.js +3 -2
- package/dist/src/map/baseOLMap.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +3 -3
- package/dist/src/map/cesiumMap.js +2 -3
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/map/panoramaMap.d.ts +2 -2
- package/dist/src/map/panoramaMap.js +1 -2
- package/dist/src/map/panoramaMap.js.map +1 -1
- package/dist/src/map/vcsMap.d.ts +3 -3
- package/dist/src/map/vcsMap.js +11 -3
- package/dist/src/map/vcsMap.js.map +1 -1
- package/index.ts +2 -0
- package/package.json +4 -3
- package/src/featureProvider/abstractFeatureProvider.ts +12 -0
- package/src/featureProvider/jsonAttributeProvider.ts +10 -2
- package/src/featureProvider/mapboxFeatureProvider.ts +74 -0
- package/src/featureProvider/wmsFeatureProvider.ts +29 -8
- package/src/interaction/eventHandler.ts +3 -1
- package/src/interaction/featureAtPixelInteraction.ts +5 -0
- package/src/interaction/featureProviderInteraction.ts +37 -8
- package/src/layer/cesium/mapboxStyleCesiumImpl.ts +95 -0
- package/src/layer/cesium/mapboxStyleImageryProvider.ts +214 -0
- package/src/layer/cesium/vectorTileImageryProvider.ts +2 -1
- package/src/layer/mapboxStyleLayer.ts +244 -0
- package/src/layer/openlayers/layerOpenlayersImpl.ts +21 -10
- package/src/layer/openlayers/mapboxStyleOpenlayersImpl.ts +68 -0
- package/src/map/baseCesiumMap.ts +57 -0
- package/src/map/baseOLMap.ts +16 -14
- package/src/map/cesiumMap.ts +7 -6
- package/src/map/panoramaMap.ts +3 -3
- package/src/map/vcsMap.ts +16 -10
- package/src/ol/ol.d.ts +10 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type LayerGroup from 'ol/layer/Group.js';
|
|
2
|
+
import { SplitDirection } from '@vcmap-cesium/engine';
|
|
3
|
+
import { unByKey } from 'ol/Observable.js';
|
|
4
|
+
import type { EventsKey } from 'ol/events.js';
|
|
5
|
+
import type OpenlayersMap from '../../map/openlayersMap.js';
|
|
6
|
+
import type { MapboxStyleLayerImplementationOptions } from '../cesium/mapboxStyleCesiumImpl.js';
|
|
7
|
+
import type { OLLayerLike } from '../../map/baseOLMap.js';
|
|
8
|
+
import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
|
|
9
|
+
|
|
10
|
+
class MapboxVectorTileOpenlayersImpl extends LayerOpenlayersImpl {
|
|
11
|
+
static get className(): string {
|
|
12
|
+
return 'MapboxVectorTileOpenlayersImpl';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private _styledMapboxLayerGroup: LayerGroup;
|
|
16
|
+
|
|
17
|
+
private _removeChildLayerListeners: (() => void) | null = null;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
map: OpenlayersMap,
|
|
21
|
+
options: MapboxStyleLayerImplementationOptions,
|
|
22
|
+
) {
|
|
23
|
+
super(map, options);
|
|
24
|
+
this._styledMapboxLayerGroup = options.styledMapboxLayerGroup;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getOLLayer(): OLLayerLike {
|
|
28
|
+
return this._styledMapboxLayerGroup as OLLayerLike;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
updateSplitDirection(splitDirection: SplitDirection): void {
|
|
32
|
+
this.splitDirection = splitDirection;
|
|
33
|
+
if (this.initialized) {
|
|
34
|
+
this._removeChildLayerListeners?.();
|
|
35
|
+
this._removeChildLayerListeners = null;
|
|
36
|
+
|
|
37
|
+
if (splitDirection !== SplitDirection.NONE) {
|
|
38
|
+
const childLayers = this._styledMapboxLayerGroup.getLayersArray();
|
|
39
|
+
const listenerKeys: EventsKey[] = [];
|
|
40
|
+
childLayers.forEach((layer) => {
|
|
41
|
+
listenerKeys.push(
|
|
42
|
+
layer.on('prerender', this._splitPreRender.bind(this)),
|
|
43
|
+
);
|
|
44
|
+
listenerKeys.push(
|
|
45
|
+
layer.on('postrender', this._splitPostReder.bind(this)),
|
|
46
|
+
);
|
|
47
|
+
layer.changed();
|
|
48
|
+
});
|
|
49
|
+
this._removeChildLayerListeners = (): void => {
|
|
50
|
+
unByKey(listenerKeys);
|
|
51
|
+
};
|
|
52
|
+
} else {
|
|
53
|
+
const childLayers = this._styledMapboxLayerGroup.getLayersArray();
|
|
54
|
+
childLayers.forEach((layer) => {
|
|
55
|
+
layer.changed();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
destroy(): void {
|
|
62
|
+
this._removeChildLayerListeners?.();
|
|
63
|
+
this._removeChildLayerListeners = null;
|
|
64
|
+
super.destroy();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default MapboxVectorTileOpenlayersImpl;
|
package/src/map/baseCesiumMap.ts
CHANGED
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
ScreenSpaceEventType,
|
|
22
22
|
type TerrainProvider,
|
|
23
23
|
} from '@vcmap-cesium/engine';
|
|
24
|
+
import { parseBoolean } from '@vcsuite/parsers';
|
|
24
25
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
26
|
+
import type { VcsMapOptions } from './vcsMap.js';
|
|
25
27
|
import VcsMap from './vcsMap.js';
|
|
26
28
|
import type Layer from '../layer/layer.js';
|
|
27
29
|
import type LayerCollection from '../util/layerCollection.js';
|
|
@@ -36,6 +38,13 @@ import Projection from '../util/projection.js';
|
|
|
36
38
|
|
|
37
39
|
RequestScheduler.maximumRequestsPerServer = 12;
|
|
38
40
|
|
|
41
|
+
export type BaseCesiumMapOptions = VcsMapOptions & {
|
|
42
|
+
/**
|
|
43
|
+
* If true, ancestors will be preloaded
|
|
44
|
+
*/
|
|
45
|
+
preloadAncestors?: boolean;
|
|
46
|
+
};
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
49
|
* Ensures, a primitive/imageryLayer/entity is part of a collection and placed at the correct location
|
|
41
50
|
* @param cesiumCollection
|
|
@@ -148,18 +157,48 @@ export default class BaseCesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
148
157
|
return 'BaseCesiumMap';
|
|
149
158
|
}
|
|
150
159
|
|
|
160
|
+
static getDefaultOptions(): BaseCesiumMapOptions {
|
|
161
|
+
return {
|
|
162
|
+
...VcsMap.getDefaultOptions(),
|
|
163
|
+
preloadAncestors: false,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
151
167
|
protected _cesiumWidget: CesiumWidget | null = null;
|
|
152
168
|
|
|
153
169
|
protected _terrainProvider: TerrainProvider | null | undefined = null;
|
|
154
170
|
|
|
155
171
|
private _screenSpaceListener: (() => void) | undefined;
|
|
156
172
|
|
|
173
|
+
private _preloadAncestors = false;
|
|
174
|
+
|
|
157
175
|
screenSpaceEventHandler: ScreenSpaceEventHandler | null = null;
|
|
158
176
|
|
|
159
177
|
defaultTerrainProvider: TerrainProvider | null = null;
|
|
160
178
|
|
|
161
179
|
protected _listeners: (() => void)[] = [];
|
|
162
180
|
|
|
181
|
+
constructor(options: BaseCesiumMapOptions) {
|
|
182
|
+
const defaultOptions = BaseCesiumMap.getDefaultOptions();
|
|
183
|
+
super({ ...defaultOptions, ...options });
|
|
184
|
+
|
|
185
|
+
this._preloadAncestors = parseBoolean(
|
|
186
|
+
options.preloadAncestors,
|
|
187
|
+
defaultOptions.preloadAncestors,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
get preloadAncestors(): boolean {
|
|
192
|
+
return this._preloadAncestors;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
set preloadAncestors(value: boolean) {
|
|
196
|
+
this._preloadAncestors = value;
|
|
197
|
+
if (this._cesiumWidget) {
|
|
198
|
+
this._cesiumWidget.scene.globe.preloadAncestors = value;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
163
202
|
get terrainProvider(): TerrainProvider | null | undefined {
|
|
164
203
|
return this._terrainProvider;
|
|
165
204
|
}
|
|
@@ -185,6 +224,7 @@ export default class BaseCesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
185
224
|
),
|
|
186
225
|
);
|
|
187
226
|
|
|
227
|
+
this._cesiumWidget.scene.globe.preloadAncestors = this.preloadAncestors;
|
|
188
228
|
this._cesiumWidget.scene.frameState.creditDisplay.update = (): void => {};
|
|
189
229
|
this._cesiumWidget.scene.frameState.creditDisplay.beginFrame =
|
|
190
230
|
(): void => {};
|
|
@@ -453,6 +493,13 @@ export default class BaseCesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
453
493
|
return this._cesiumWidget?.scene;
|
|
454
494
|
}
|
|
455
495
|
|
|
496
|
+
/**
|
|
497
|
+
* defines whether ancestors are preloaded or not
|
|
498
|
+
*/
|
|
499
|
+
setPreloadAncestors(value: boolean): void {
|
|
500
|
+
this.preloadAncestors = value;
|
|
501
|
+
}
|
|
502
|
+
|
|
456
503
|
protected _indexChangedOnVisualization(vis: CesiumVisualisationType): void {
|
|
457
504
|
if (vis instanceof PrimitiveCollection) {
|
|
458
505
|
indexChangedOnPrimitive(
|
|
@@ -579,6 +626,16 @@ export default class BaseCesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
579
626
|
}
|
|
580
627
|
}
|
|
581
628
|
|
|
629
|
+
toJSON(
|
|
630
|
+
defaultOptions = BaseCesiumMap.getDefaultOptions(),
|
|
631
|
+
): BaseCesiumMapOptions {
|
|
632
|
+
const config: BaseCesiumMapOptions = super.toJSON(defaultOptions);
|
|
633
|
+
if (this.preloadAncestors !== defaultOptions.preloadAncestors) {
|
|
634
|
+
config.preloadAncestors = this.preloadAncestors;
|
|
635
|
+
}
|
|
636
|
+
return config;
|
|
637
|
+
}
|
|
638
|
+
|
|
582
639
|
override destroy(): void {
|
|
583
640
|
this._listeners.forEach((cb) => {
|
|
584
641
|
cb();
|
package/src/map/baseOLMap.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Cartesian2 } from '@vcmap-cesium/engine';
|
|
2
2
|
import { unByKey } from 'ol/Observable.js';
|
|
3
3
|
import OLMap from 'ol/Map.js';
|
|
4
|
+
import type OLLayer from 'ol/layer/Layer.js';
|
|
5
|
+
import type OLLayerGroup from 'ol/layer/Group.js';
|
|
4
6
|
import { defaults as defaultInteractions } from 'ol/interaction.js';
|
|
5
7
|
import type { Collection as OLCollection, MapBrowserEvent } from 'ol';
|
|
6
|
-
import type { Layer as OLLayer } from 'ol/layer.js';
|
|
7
8
|
import type { EventsKey } from 'ol/events.js';
|
|
8
9
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
9
|
-
|
|
10
10
|
import VcsMap from './vcsMap.js';
|
|
11
11
|
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
12
12
|
import {
|
|
@@ -20,22 +20,24 @@ import type Layer from '../layer/layer.js';
|
|
|
20
20
|
import type { DisableMapControlOptions } from '../util/mapCollection.js';
|
|
21
21
|
import { vectorClusterGroupName } from '../vectorCluster/vectorClusterSymbols.js';
|
|
22
22
|
|
|
23
|
+
export type OLLayerLike = OLLayer | OLLayerGroup;
|
|
24
|
+
|
|
23
25
|
function ensureLayerInCollection(
|
|
24
|
-
layers: OLCollection<
|
|
25
|
-
layer:
|
|
26
|
+
layers: OLCollection<OLLayerLike>,
|
|
27
|
+
layer: OLLayerLike,
|
|
26
28
|
layerCollection: LayerCollection,
|
|
27
29
|
): void {
|
|
28
30
|
const sortedVectorClusterGroups = [
|
|
29
31
|
...layerCollection.vectorClusterGroups,
|
|
30
32
|
].sort((a, b) => a.zIndex - b.zIndex);
|
|
31
33
|
|
|
32
|
-
const getIndexOfOlLayer = (olL:
|
|
34
|
+
const getIndexOfOlLayer = (olL: OLLayerLike): number => {
|
|
33
35
|
let layerIndex;
|
|
34
36
|
let clusterIndex = 0;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const clusterName = (olL as OLLayer)[vectorClusterGroupName];
|
|
38
|
+
if (clusterName) {
|
|
39
|
+
const clusterGroup =
|
|
40
|
+
layerCollection.vectorClusterGroups.getByKey(clusterName)!;
|
|
39
41
|
layerIndex = layerCollection.findIndex(
|
|
40
42
|
(l) => l.zIndex > clusterGroup.zIndex,
|
|
41
43
|
);
|
|
@@ -90,7 +92,7 @@ function getPointerKeyType(button?: number): PointerKeyType {
|
|
|
90
92
|
/**
|
|
91
93
|
* @group Map
|
|
92
94
|
*/
|
|
93
|
-
class BaseOLMap extends VcsMap<
|
|
95
|
+
class BaseOLMap extends VcsMap<OLLayerLike> {
|
|
94
96
|
static get className(): string {
|
|
95
97
|
return 'BaseOLMap';
|
|
96
98
|
}
|
|
@@ -214,7 +216,7 @@ class BaseOLMap extends VcsMap<OLLayer> {
|
|
|
214
216
|
const layers = (this._olMap as OLMap).getLayers();
|
|
215
217
|
layers.remove(olLayer);
|
|
216
218
|
ensureLayerInCollection(
|
|
217
|
-
layers as OLCollection<
|
|
219
|
+
layers as OLCollection<OLLayerLike>,
|
|
218
220
|
olLayer,
|
|
219
221
|
this.layerCollection,
|
|
220
222
|
);
|
|
@@ -226,11 +228,11 @@ class BaseOLMap extends VcsMap<OLLayer> {
|
|
|
226
228
|
* Internal API for registering representations.
|
|
227
229
|
* @param olLayer
|
|
228
230
|
*/
|
|
229
|
-
addOLLayer(olLayer:
|
|
231
|
+
addOLLayer(olLayer: OLLayerLike): void {
|
|
230
232
|
if (this.validateVisualization(olLayer)) {
|
|
231
233
|
this.addVisualization(olLayer);
|
|
232
234
|
ensureLayerInCollection(
|
|
233
|
-
(this._olMap as OLMap).getLayers() as OLCollection<
|
|
235
|
+
(this._olMap as OLMap).getLayers() as OLCollection<OLLayerLike>,
|
|
234
236
|
olLayer,
|
|
235
237
|
this.layerCollection,
|
|
236
238
|
);
|
|
@@ -240,7 +242,7 @@ class BaseOLMap extends VcsMap<OLLayer> {
|
|
|
240
242
|
/**
|
|
241
243
|
* Internal API for deregistering representations.
|
|
242
244
|
*/
|
|
243
|
-
removeOLLayer(olLayer:
|
|
245
|
+
removeOLLayer(olLayer: OLLayerLike): void {
|
|
244
246
|
this.removeVisualization(olLayer);
|
|
245
247
|
if (this._olMap) {
|
|
246
248
|
this._olMap.getLayers().remove(olLayer);
|
package/src/map/cesiumMap.ts
CHANGED
|
@@ -29,7 +29,11 @@ import {
|
|
|
29
29
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
30
30
|
import { check, maybe } from '@vcsuite/check';
|
|
31
31
|
import { parseBoolean, parseInteger, parseNumber } from '@vcsuite/parsers';
|
|
32
|
-
import
|
|
32
|
+
import type {
|
|
33
|
+
BaseCesiumMapOptions,
|
|
34
|
+
CesiumVisualisationType,
|
|
35
|
+
} from './baseCesiumMap.js';
|
|
36
|
+
import BaseCesiumMap from './baseCesiumMap.js';
|
|
33
37
|
import type Viewpoint from '../util/viewpoint.js';
|
|
34
38
|
import Projection, { mercatorProjection } from '../util/projection.js';
|
|
35
39
|
import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
|
|
@@ -41,9 +45,6 @@ import type LayerCollection from '../util/layerCollection.js';
|
|
|
41
45
|
import VcsEvent from '../vcsEvent.js';
|
|
42
46
|
import type { DisableMapControlOptions } from '../util/mapCollection.js';
|
|
43
47
|
import { vectorClusterGroupName } from '../vectorCluster/vectorClusterSymbols.js';
|
|
44
|
-
import BaseCesiumMap, {
|
|
45
|
-
type CesiumVisualisationType,
|
|
46
|
-
} from './baseCesiumMap.js';
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* @param dataSourceCollection
|
|
@@ -120,7 +121,7 @@ function indexChangedOnDataSource(
|
|
|
120
121
|
);
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
export type CesiumMapOptions =
|
|
124
|
+
export type CesiumMapOptions = BaseCesiumMapOptions & {
|
|
124
125
|
/**
|
|
125
126
|
* if true, lighting will be activated.
|
|
126
127
|
*/
|
|
@@ -203,7 +204,7 @@ class CesiumMap extends BaseCesiumMap {
|
|
|
203
204
|
|
|
204
205
|
static getDefaultOptions(): CesiumMapOptions {
|
|
205
206
|
return {
|
|
206
|
-
...
|
|
207
|
+
...BaseCesiumMap.getDefaultOptions(),
|
|
207
208
|
enableLightning: true,
|
|
208
209
|
tileCacheSize: 1,
|
|
209
210
|
webGLaa: false,
|
package/src/map/panoramaMap.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Math as CesiumMath,
|
|
7
7
|
} from '@vcmap-cesium/engine';
|
|
8
8
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
9
|
-
import VcsMap, { type VcsMapOptions } from './vcsMap.js';
|
|
10
9
|
import type { PanoramaImage } from '../panorama/panoramaImage.js';
|
|
11
10
|
import { mapClassRegistry } from '../classRegistry.js';
|
|
12
11
|
import type { PanoramaImageView } from '../panorama/panoramaImageView.js';
|
|
@@ -19,9 +18,10 @@ import Projection from '../util/projection.js';
|
|
|
19
18
|
import { defaultCursorColor } from '../panorama/panoramaTileMaterial.js';
|
|
20
19
|
import LayerState from '../layer/layerState.js';
|
|
21
20
|
import type PanoramaDatasetLayer from '../layer/panoramaDatasetLayer.js';
|
|
21
|
+
import type { BaseCesiumMapOptions } from './baseCesiumMap.js';
|
|
22
22
|
import BaseCesiumMap from './baseCesiumMap.js';
|
|
23
23
|
|
|
24
|
-
export type PanoramaMapOptions =
|
|
24
|
+
export type PanoramaMapOptions = BaseCesiumMapOptions & {
|
|
25
25
|
/**
|
|
26
26
|
* Css color string to use for the overlay NaN color.
|
|
27
27
|
*/
|
|
@@ -43,7 +43,7 @@ export default class PanoramaMap extends BaseCesiumMap {
|
|
|
43
43
|
|
|
44
44
|
static getDefaultOptions(): PanoramaMapOptions {
|
|
45
45
|
return {
|
|
46
|
-
...
|
|
46
|
+
...BaseCesiumMap.getDefaultOptions(),
|
|
47
47
|
overlayNaNColor: 'rgba(255, 0, 0, 1)',
|
|
48
48
|
cursorColor: defaultCursorColor,
|
|
49
49
|
fallbackToCurrentMap: false,
|
package/src/map/vcsMap.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { getLogger as getLoggerByName } from '@vcsuite/logger';
|
|
|
3
3
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
5
|
import type { MapEvent as OLMapEvent } from 'ol';
|
|
6
|
-
import type
|
|
6
|
+
import type OLLayer from 'ol/layer/Layer.js';
|
|
7
|
+
import OLLayerGroup from 'ol/layer/Group.js';
|
|
7
8
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
8
|
-
|
|
9
9
|
import { check, is, maybe, oneOf } from '@vcsuite/check';
|
|
10
10
|
import type { VcsObjectOptions } from '../vcsObject.js';
|
|
11
11
|
import VcsObject from '../vcsObject.js';
|
|
@@ -19,6 +19,7 @@ import type Viewpoint from '../util/viewpoint.js';
|
|
|
19
19
|
import type Layer from '../layer/layer.js';
|
|
20
20
|
import type { MapEvent } from '../interaction/abstractInteraction.js';
|
|
21
21
|
import type { DisableMapControlOptions } from '../util/mapCollection.js';
|
|
22
|
+
import type { OLLayerLike } from './baseOLMap.js';
|
|
22
23
|
import type VectorClusterGroup from '../vectorCluster/vectorClusterGroup.js';
|
|
23
24
|
import { vectorClusterGroupName } from '../vectorCluster/vectorClusterSymbols.js';
|
|
24
25
|
import type { CesiumVisualisationType } from './baseCesiumMap.js';
|
|
@@ -50,11 +51,11 @@ export type VcsMapOptions = VcsObjectOptions & {
|
|
|
50
51
|
layerTypes?: string[];
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
export type VisualisationType = CesiumVisualisationType |
|
|
54
|
+
export type VisualisationType = CesiumVisualisationType | OLLayerLike;
|
|
54
55
|
|
|
55
56
|
export type VcsMapRenderEvent<V extends VisualisationType> = {
|
|
56
57
|
map: VcsMap;
|
|
57
|
-
originalEvent: V extends
|
|
58
|
+
originalEvent: V extends OLLayerLike ? OLMapEvent : CesiumMapEvent;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
/**
|
|
@@ -421,18 +422,23 @@ class VcsMap<
|
|
|
421
422
|
[vcsLayerName]?: string;
|
|
422
423
|
[vectorClusterGroupName]?: string;
|
|
423
424
|
} {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
425
|
+
if (Object.hasOwn(item, vectorClusterGroupName)) {
|
|
426
|
+
if (item instanceof OLLayerGroup) {
|
|
427
|
+
return false;
|
|
428
|
+
} else {
|
|
429
|
+
const vectorCluster = (item as OLLayer)[vectorClusterGroupName];
|
|
430
|
+
if (vectorCluster) {
|
|
431
|
+
return this.layerCollection.vectorClusterGroups.hasKey(
|
|
432
|
+
vectorCluster,
|
|
433
|
+
) as boolean;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
429
436
|
}
|
|
430
437
|
const layerName = item[vcsLayerName];
|
|
431
438
|
if (layerName == null) {
|
|
432
439
|
this.getLogger().warning('item is missing vcsLayerName symbol');
|
|
433
440
|
return false;
|
|
434
441
|
}
|
|
435
|
-
|
|
436
442
|
return this.layerCollection.hasKey(layerName) as boolean;
|
|
437
443
|
}
|
|
438
444
|
|
package/src/ol/ol.d.ts
CHANGED
|
@@ -26,7 +26,11 @@ import type {
|
|
|
26
26
|
panoramaFeature,
|
|
27
27
|
primitives,
|
|
28
28
|
} from '../layer/vectorSymbols.js';
|
|
29
|
-
import type {
|
|
29
|
+
import type {
|
|
30
|
+
allowPicking,
|
|
31
|
+
i3sData,
|
|
32
|
+
vcsLayerName,
|
|
33
|
+
} from '../layer/layerSymbols.js';
|
|
30
34
|
import type {
|
|
31
35
|
isProvidedFeature,
|
|
32
36
|
isProvidedClusterFeature,
|
|
@@ -164,8 +168,13 @@ declare module 'ol/style.js' {
|
|
|
164
168
|
declare module 'ol/layer.js' {
|
|
165
169
|
interface Layer {
|
|
166
170
|
[vcsLayerName]: string;
|
|
171
|
+
[allowPicking]?: boolean;
|
|
167
172
|
[vectorClusterGroupName]?: string;
|
|
168
173
|
}
|
|
174
|
+
|
|
175
|
+
interface Group {
|
|
176
|
+
[vcsLayerName]: string;
|
|
177
|
+
}
|
|
169
178
|
}
|
|
170
179
|
|
|
171
180
|
declare module 'ol/source.js' {
|