@vcmap/core 5.0.0-rc.36 → 5.0.0-rc.38
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/src/category/category.js +2 -4
- package/dist/src/category/category.js.map +1 -1
- package/dist/src/interaction/featureProviderInteraction.js +4 -2
- package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +1 -0
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js +50 -3
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/openStreetMapCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/openStreetMapCesiumImpl.js +2 -2
- package/dist/src/layer/cesium/openStreetMapCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/singleImageCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/singleImageCesiumImpl.js +2 -3
- package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/tmsCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/tmsCesiumImpl.js +2 -3
- package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/vectorCesiumImpl.js +17 -15
- package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorContext.d.ts +1 -0
- package/dist/src/layer/cesium/vectorContext.js +17 -5
- package/dist/src/layer/cesium/vectorContext.js.map +1 -1
- package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js +2 -3
- package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/wmsCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/wmsCesiumImpl.js +1 -1
- package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/wmtsCesiumImpl.d.ts +1 -1
- package/dist/src/layer/cesium/wmtsCesiumImpl.js +1 -1
- package/dist/src/layer/cesium/wmtsCesiumImpl.js.map +1 -1
- package/dist/src/layer/featureVisibility.d.ts +2 -2
- package/dist/src/layer/featureVisibility.js +3 -2
- package/dist/src/layer/featureVisibility.js.map +1 -1
- package/dist/src/layer/layer.d.ts +10 -0
- package/dist/src/layer/layer.js +10 -0
- package/dist/src/layer/layer.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +1 -0
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/layer/vectorProperties.d.ts +12 -0
- package/dist/src/layer/vectorProperties.js +134 -0
- package/dist/src/layer/vectorProperties.js.map +1 -1
- package/dist/src/layer/wfsLayer.d.ts +5 -0
- package/dist/src/layer/wfsLayer.js +13 -3
- package/dist/src/layer/wfsLayer.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +6 -0
- package/dist/src/map/cesiumMap.js +4 -1
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/oblique/obliqueCollection.d.ts +4 -3
- package/dist/src/oblique/obliqueCollection.js +9 -5
- package/dist/src/oblique/obliqueCollection.js.map +1 -1
- package/dist/src/style/styleHelpers.d.ts +2 -0
- package/dist/src/style/styleHelpers.js +9 -0
- package/dist/src/style/styleHelpers.js.map +1 -1
- package/dist/src/style/vectorStyleItem.d.ts +1 -1
- package/dist/src/util/editor/createFeatureSession.js +7 -0
- package/dist/src/util/editor/createFeatureSession.js.map +1 -1
- package/dist/src/util/editor/editFeaturesSession.js +13 -1
- package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
- package/dist/src/util/editor/editGeometrySession.js +15 -1
- package/dist/src/util/editor/editGeometrySession.js.map +1 -1
- package/dist/src/util/editor/editorHelpers.d.ts +2 -1
- package/dist/src/util/editor/editorHelpers.js +5 -0
- package/dist/src/util/editor/editorHelpers.js.map +1 -1
- package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -1
- package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/mapInteractionController.d.ts +1 -0
- package/dist/src/util/editor/interactions/mapInteractionController.js +3 -0
- package/dist/src/util/editor/interactions/mapInteractionController.js.map +1 -1
- package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
- package/dist/src/util/featureconverter/arcToCesium.js +2 -2
- package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/convert.d.ts +1 -1
- package/dist/src/util/featureconverter/convert.js +13 -13
- package/dist/src/util/featureconverter/convert.js.map +1 -1
- package/dist/src/util/featureconverter/featureconverterHelper.js +1 -1
- package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
- package/dist/src/util/featureconverter/lineStringToCesium.d.ts +2 -2
- package/dist/src/util/featureconverter/lineStringToCesium.js +6 -6
- package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/pointHelpers.d.ts +4 -4
- package/dist/src/util/featureconverter/pointHelpers.js +34 -23
- package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
- package/dist/src/util/featureconverter/pointToCesium.d.ts +1 -1
- package/dist/src/util/featureconverter/pointToCesium.js +11 -5
- package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/polygonToCesium.d.ts +2 -2
- package/dist/src/util/featureconverter/polygonToCesium.js +13 -4
- package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
- package/dist/src/vcsApp.d.ts +13 -1
- package/dist/src/vcsApp.js +22 -11
- package/dist/src/vcsApp.js.map +1 -1
- package/dist/src/vcsModule.d.ts +4 -0
- package/dist/src/vcsModule.js +12 -5
- package/dist/src/vcsModule.js.map +1 -1
- package/package.json +3 -3
- package/src/category/category.ts +2 -5
- package/src/cesium/cesium.d.ts +5 -1
- package/src/interaction/featureProviderInteraction.ts +10 -8
- package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +58 -5
- package/src/layer/cesium/openStreetMapCesiumImpl.ts +9 -7
- package/src/layer/cesium/rasterLayerCesiumImpl.ts +7 -3
- package/src/layer/cesium/singleImageCesiumImpl.ts +6 -4
- package/src/layer/cesium/tmsCesiumImpl.ts +5 -3
- package/src/layer/cesium/vectorCesiumImpl.ts +17 -15
- package/src/layer/cesium/vectorContext.ts +46 -33
- package/src/layer/cesium/vectorRasterTileCesiumImpl.ts +8 -7
- package/src/layer/cesium/wmsCesiumImpl.ts +4 -2
- package/src/layer/cesium/wmtsCesiumImpl.ts +4 -2
- package/src/layer/featureVisibility.ts +3 -11
- package/src/layer/layer.ts +19 -0
- package/src/layer/vectorLayer.ts +5 -0
- package/src/layer/vectorProperties.ts +191 -0
- package/src/layer/wfsLayer.ts +21 -6
- package/src/map/cesiumMap.ts +12 -1
- package/src/oblique/obliqueCollection.ts +10 -9
- package/src/style/styleHelpers.ts +11 -0
- package/src/style/vectorStyleItem.ts +1 -1
- package/src/util/editor/createFeatureSession.ts +8 -0
- package/src/util/editor/editFeaturesSession.ts +17 -1
- package/src/util/editor/editGeometrySession.ts +17 -1
- package/src/util/editor/editorHelpers.ts +9 -1
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +11 -1
- package/src/util/editor/interactions/mapInteractionController.ts +4 -0
- package/src/util/featureconverter/arcToCesium.ts +3 -3
- package/src/util/featureconverter/convert.ts +50 -32
- package/src/util/featureconverter/featureconverterHelper.ts +5 -1
- package/src/util/featureconverter/lineStringToCesium.ts +38 -36
- package/src/util/featureconverter/pointHelpers.ts +167 -140
- package/src/util/featureconverter/pointToCesium.ts +15 -8
- package/src/util/featureconverter/polygonToCesium.ts +16 -1
- package/src/vcsApp.ts +35 -15
- package/src/vcsModule.ts +16 -5
|
@@ -301,6 +301,8 @@ class VectorContext implements CesiumVectorContext {
|
|
|
301
301
|
|
|
302
302
|
featureToLabelMap: Map<Feature, Array<Label>> = new Map();
|
|
303
303
|
|
|
304
|
+
features: Set<Feature> = new Set();
|
|
305
|
+
|
|
304
306
|
splitDirection: SplitDirection;
|
|
305
307
|
|
|
306
308
|
private _rootCollection: PrimitiveCollection;
|
|
@@ -346,14 +348,16 @@ class VectorContext implements CesiumVectorContext {
|
|
|
346
348
|
feature: Feature,
|
|
347
349
|
allowPicking = false,
|
|
348
350
|
): void {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
351
|
+
if (this.features.has(feature)) {
|
|
352
|
+
addPrimitiveToContext(
|
|
353
|
+
primitives,
|
|
354
|
+
feature,
|
|
355
|
+
allowPicking,
|
|
356
|
+
this.primitives,
|
|
357
|
+
this.featureToPrimitiveMap,
|
|
358
|
+
this.splitDirection,
|
|
359
|
+
);
|
|
360
|
+
}
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
addScaledPrimitives(
|
|
@@ -367,15 +371,17 @@ class VectorContext implements CesiumVectorContext {
|
|
|
367
371
|
feature: Feature,
|
|
368
372
|
allowPicking = false,
|
|
369
373
|
): void {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
374
|
+
if (this.features.has(feature)) {
|
|
375
|
+
addPrimitiveToContext(
|
|
376
|
+
primitives,
|
|
377
|
+
feature,
|
|
378
|
+
allowPicking,
|
|
379
|
+
this.scaledPrimitives,
|
|
380
|
+
this.featureToScaledPrimitiveMap,
|
|
381
|
+
this.splitDirection,
|
|
382
|
+
);
|
|
383
|
+
this._scaledDirty.value = true;
|
|
384
|
+
}
|
|
379
385
|
}
|
|
380
386
|
|
|
381
387
|
addBillboards(
|
|
@@ -383,14 +389,16 @@ class VectorContext implements CesiumVectorContext {
|
|
|
383
389
|
feature: Feature,
|
|
384
390
|
allowPicking = false,
|
|
385
391
|
): void {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
if (this.features.has(feature)) {
|
|
393
|
+
addPrimitiveToContext(
|
|
394
|
+
billboardOptions,
|
|
395
|
+
feature,
|
|
396
|
+
allowPicking,
|
|
397
|
+
this.billboards,
|
|
398
|
+
this.featureToBillboardMap,
|
|
399
|
+
this.splitDirection,
|
|
400
|
+
);
|
|
401
|
+
}
|
|
394
402
|
}
|
|
395
403
|
|
|
396
404
|
addLabels(
|
|
@@ -398,20 +406,23 @@ class VectorContext implements CesiumVectorContext {
|
|
|
398
406
|
feature: Feature,
|
|
399
407
|
allowPicking = false,
|
|
400
408
|
): void {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
+
if (this.features.has(feature)) {
|
|
410
|
+
addPrimitiveToContext(
|
|
411
|
+
labelOptions,
|
|
412
|
+
feature,
|
|
413
|
+
allowPicking,
|
|
414
|
+
this.labels,
|
|
415
|
+
this.featureToLabelMap,
|
|
416
|
+
this.splitDirection,
|
|
417
|
+
);
|
|
418
|
+
}
|
|
409
419
|
}
|
|
410
420
|
|
|
411
421
|
/**
|
|
412
422
|
* @param feature
|
|
413
423
|
*/
|
|
414
424
|
removeFeature(feature: Feature): void {
|
|
425
|
+
this.features.delete(feature);
|
|
415
426
|
removeFeatureFromMap(feature, this.featureToPrimitiveMap, this.primitives);
|
|
416
427
|
this._scaledDirty.value = removeFeatureFromMap(
|
|
417
428
|
feature,
|
|
@@ -472,6 +483,7 @@ class VectorContext implements CesiumVectorContext {
|
|
|
472
483
|
this.featureToPrimitiveMap.clear();
|
|
473
484
|
this._scaledDirty.value = this.featureToScaledPrimitiveMap.size > 0;
|
|
474
485
|
this.featureToScaledPrimitiveMap.clear();
|
|
486
|
+
this.features.clear();
|
|
475
487
|
}
|
|
476
488
|
|
|
477
489
|
/**
|
|
@@ -490,6 +502,7 @@ class VectorContext implements CesiumVectorContext {
|
|
|
490
502
|
this.featureToBillboardMap.clear();
|
|
491
503
|
this.featureToLabelMap.clear();
|
|
492
504
|
this.featureToPrimitiveMap.clear();
|
|
505
|
+
this.features.clear();
|
|
493
506
|
this.featureToScaledPrimitiveMap.clear();
|
|
494
507
|
this._postRenderListener();
|
|
495
508
|
}
|
|
@@ -43,7 +43,7 @@ class VectorRasterTileCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
43
43
|
this.tileSize = options.tileSize;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
getCesiumLayer(): CesiumImageryLayer {
|
|
46
|
+
getCesiumLayer(): Promise<CesiumImageryLayer> {
|
|
47
47
|
this.imageryProvider = new VectorTileImageryProvider({
|
|
48
48
|
tileProvider: this.tileProvider,
|
|
49
49
|
tileSize: this.tileSize,
|
|
@@ -64,13 +64,14 @@ class VectorRasterTileCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
64
64
|
extent[3],
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
return Promise.resolve(
|
|
68
|
+
new CesiumImageryLayer(
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
this.imageryProvider,
|
|
72
|
+
layerOptions,
|
|
73
|
+
),
|
|
72
74
|
);
|
|
73
|
-
return imageryLayer;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -32,7 +32,7 @@ class WmsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
32
32
|
this.tileSize = options.tileSize;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
getCesiumLayer(): CesiumImageryLayer {
|
|
35
|
+
getCesiumLayer(): Promise<CesiumImageryLayer> {
|
|
36
36
|
const parameters = { ...this.parameters };
|
|
37
37
|
if (this.highResolution) {
|
|
38
38
|
parameters.width = String(this.tileSize[0] * 2);
|
|
@@ -68,7 +68,9 @@ class WmsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
68
68
|
alpha: this.opacity,
|
|
69
69
|
splitDirection: this.splitDirection,
|
|
70
70
|
};
|
|
71
|
-
return
|
|
71
|
+
return Promise.resolve(
|
|
72
|
+
new CesiumImageryLayer(imageryProvider, layerOptions),
|
|
73
|
+
);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -47,7 +47,7 @@ class WmtsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
47
47
|
this.matrixIds = options.matrixIds;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
getCesiumLayer(): CesiumImageryLayer {
|
|
50
|
+
getCesiumLayer(): Promise<CesiumImageryLayer> {
|
|
51
51
|
const currentUrl = this.url as string;
|
|
52
52
|
// This is a bug in Cesium, they cant cope with {Layer} placeholder..
|
|
53
53
|
const url =
|
|
@@ -85,7 +85,9 @@ class WmtsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
85
85
|
alpha: this.opacity,
|
|
86
86
|
splitDirection: this.splitDirection,
|
|
87
87
|
};
|
|
88
|
-
return
|
|
88
|
+
return Promise.resolve(
|
|
89
|
+
new CesiumImageryLayer(imageryProvider, layerOptions),
|
|
90
|
+
);
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
|
|
@@ -105,6 +105,7 @@ export function resetOriginalStyle(feature: HighlightableFeature): void {
|
|
|
105
105
|
if (!(feature[globalHidden] || feature[hidden] || feature[highlighted])) {
|
|
106
106
|
const style = feature[originalStyle];
|
|
107
107
|
if (
|
|
108
|
+
style &&
|
|
108
109
|
(feature instanceof Cesium3DTileFeature ||
|
|
109
110
|
feature instanceof Cesium3DTilePointFeature) &&
|
|
110
111
|
featureExists(feature)
|
|
@@ -383,21 +384,12 @@ class FeatureVisibility {
|
|
|
383
384
|
|
|
384
385
|
hasHiddenFeature(
|
|
385
386
|
id: string | number,
|
|
386
|
-
feature:
|
|
387
|
-
| import('ol').Feature<import('ol/geom/Geometry.js').default>
|
|
388
|
-
| import('@vcmap-cesium/engine').Cesium3DTileFeature
|
|
389
|
-
| import('@vcmap-cesium/engine').Entity,
|
|
387
|
+
feature: HighlightableFeature,
|
|
390
388
|
): boolean {
|
|
391
389
|
return this.hiddenObjects[id] && this.hiddenObjects[id].has(feature);
|
|
392
390
|
}
|
|
393
391
|
|
|
394
|
-
addHiddenFeature(
|
|
395
|
-
id: string | number,
|
|
396
|
-
feature:
|
|
397
|
-
| import('ol').Feature<import('ol/geom/Geometry.js').default>
|
|
398
|
-
| import('@vcmap-cesium/engine').Cesium3DTileFeature
|
|
399
|
-
| import('@vcmap-cesium/engine').Entity,
|
|
400
|
-
): void {
|
|
392
|
+
addHiddenFeature(id: string | number, feature: HighlightableFeature): void {
|
|
401
393
|
if (this.hiddenObjects[id]) {
|
|
402
394
|
cacheOriginalStyle(feature);
|
|
403
395
|
this.hiddenObjects[id].add(feature);
|
package/src/layer/layer.ts
CHANGED
|
@@ -44,6 +44,12 @@ export type LayerOptions = VcsObjectOptions & {
|
|
|
44
44
|
*/
|
|
45
45
|
hiddenObjectIds?: string[];
|
|
46
46
|
copyright?: CopyrightOptions;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Optional Id to synchronize with the vcPublisher Datasources. This can also be used to track a connection
|
|
50
|
+
* to other sources of data.
|
|
51
|
+
*/
|
|
52
|
+
datasourceId?: string;
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
export type LayerImplementationOptions = {
|
|
@@ -75,6 +81,7 @@ class Layer<
|
|
|
75
81
|
url: undefined,
|
|
76
82
|
hiddenObjectIds: [],
|
|
77
83
|
copyright: undefined,
|
|
84
|
+
datasourceId: undefined,
|
|
78
85
|
};
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -138,6 +145,12 @@ class Layer<
|
|
|
138
145
|
|
|
139
146
|
private _locale: string;
|
|
140
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Optional Id to synchronize with the vcPublisher Datasources. This can also be used to track a connection
|
|
150
|
+
* to other sources of data.
|
|
151
|
+
*/
|
|
152
|
+
datasourceId?: string;
|
|
153
|
+
|
|
141
154
|
constructor(options: LayerOptions) {
|
|
142
155
|
super(options);
|
|
143
156
|
const defaultOptions = Layer.getDefaultOptions();
|
|
@@ -193,6 +206,8 @@ class Layer<
|
|
|
193
206
|
this.featureProvider = undefined;
|
|
194
207
|
|
|
195
208
|
this._locale = 'en';
|
|
209
|
+
|
|
210
|
+
this.datasourceId = options.datasourceId || defaultOptions.datasourceId;
|
|
196
211
|
}
|
|
197
212
|
|
|
198
213
|
/**
|
|
@@ -633,6 +648,10 @@ class Layer<
|
|
|
633
648
|
config.copyright = { ...this.copyright };
|
|
634
649
|
}
|
|
635
650
|
|
|
651
|
+
if (this.datasourceId !== defaultOptions.datasourceId) {
|
|
652
|
+
config.datasourceId = this.datasourceId;
|
|
653
|
+
}
|
|
654
|
+
|
|
636
655
|
return config;
|
|
637
656
|
}
|
|
638
657
|
|
package/src/layer/vectorLayer.ts
CHANGED
|
@@ -101,6 +101,11 @@ export type VectorGeometryFactoryType = {
|
|
|
101
101
|
style: Style,
|
|
102
102
|
): GroundPolylineGeometry[];
|
|
103
103
|
createLineGeometries(obj: unknown, style: Style): PolylineGeometry[];
|
|
104
|
+
createLineGeometries(
|
|
105
|
+
obj: unknown,
|
|
106
|
+
style: Style,
|
|
107
|
+
groundLevel?: number,
|
|
108
|
+
): PolylineGeometry[];
|
|
104
109
|
};
|
|
105
110
|
|
|
106
111
|
export type VectorHeightInfo = {
|
|
@@ -1279,6 +1279,197 @@ class VectorProperties {
|
|
|
1279
1279
|
return values;
|
|
1280
1280
|
}
|
|
1281
1281
|
|
|
1282
|
+
/**
|
|
1283
|
+
* The common vector properties for the input features.
|
|
1284
|
+
* @param features Features for which the vector property values should be returned.
|
|
1285
|
+
* @returns The common vector properties for the features. When a/all feature(s) does not has a property set, the layer or, if not set, the default value is returned. If features have different values for a property, the property key is not added to the returned obeject.
|
|
1286
|
+
*/
|
|
1287
|
+
getValuesForFeatures(features: Feature[]): VectorPropertiesOptions {
|
|
1288
|
+
const values: VectorPropertiesOptions = {};
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Checks if all the values of the array are equal using fast-deep-equal.
|
|
1292
|
+
* @param propertyValues An array of values for a specific property from different features.
|
|
1293
|
+
* @returns Whether all values are equal.
|
|
1294
|
+
*/
|
|
1295
|
+
function isAllEqual<T extends string | number | boolean | number[]>(
|
|
1296
|
+
propertyValues: (T | undefined)[],
|
|
1297
|
+
): boolean {
|
|
1298
|
+
return propertyValues.every((curr, index, array) => {
|
|
1299
|
+
if (index === 0) {
|
|
1300
|
+
return true;
|
|
1301
|
+
}
|
|
1302
|
+
return deepEqual(curr, array[0]);
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
const altitudeModeValues = features.map((f) => this.getAltitudeMode(f));
|
|
1307
|
+
if (isAllEqual(altitudeModeValues)) {
|
|
1308
|
+
values.altitudeMode = getAltitudeModeOptions(altitudeModeValues[0]);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
const allowPickingValues = features.map((f) => this.getAllowPicking(f));
|
|
1312
|
+
if (isAllEqual(allowPickingValues)) {
|
|
1313
|
+
values.allowPicking = allowPickingValues[0];
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
const classificationTypeValues = features.map((f) =>
|
|
1317
|
+
this.getClassificationType(f),
|
|
1318
|
+
);
|
|
1319
|
+
if (isAllEqual(classificationTypeValues)) {
|
|
1320
|
+
values.classificationType = getClassificationTypeOptions(
|
|
1321
|
+
classificationTypeValues[0],
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
const scaleByDistanceValues = features.map((f) =>
|
|
1326
|
+
getNearFarValueOptions(this.getScaleByDistance(f)),
|
|
1327
|
+
);
|
|
1328
|
+
if (isAllEqual(scaleByDistanceValues)) {
|
|
1329
|
+
values.scaleByDistance = scaleByDistanceValues[0];
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
const eyeOffsetValues = features.map((f) =>
|
|
1333
|
+
getCartesian3Options(this.getEyeOffset(f)),
|
|
1334
|
+
);
|
|
1335
|
+
if (isAllEqual(eyeOffsetValues)) {
|
|
1336
|
+
values.eyeOffset = eyeOffsetValues[0];
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
const heightAboveGroundValues = features.map((f) =>
|
|
1340
|
+
this.getHeightAboveGround(f),
|
|
1341
|
+
);
|
|
1342
|
+
if (isAllEqual(heightAboveGroundValues)) {
|
|
1343
|
+
values.heightAboveGround = heightAboveGroundValues[0];
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
const skirtValues = features.map((f) => this.getSkirt(f));
|
|
1347
|
+
if (isAllEqual(skirtValues)) {
|
|
1348
|
+
values.skirt = skirtValues[0];
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
const groundLevelValues = features.map((f) => this.getGroundLevel(f));
|
|
1352
|
+
if (isAllEqual(groundLevelValues)) {
|
|
1353
|
+
values.groundLevel = groundLevelValues[0];
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
const extrudedHeightValues = features.map((f) => this.getExtrudedHeight(f));
|
|
1357
|
+
if (isAllEqual(extrudedHeightValues)) {
|
|
1358
|
+
values.extrudedHeight = extrudedHeightValues[0];
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
const storeysAboveGroundValues = features.map((f) =>
|
|
1362
|
+
this.getStoreysAboveGround(f),
|
|
1363
|
+
);
|
|
1364
|
+
if (isAllEqual(storeysAboveGroundValues)) {
|
|
1365
|
+
values.storeysAboveGround = storeysAboveGroundValues[0];
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
const storeysBelowGroundValues = features.map((f) =>
|
|
1369
|
+
this.getStoreysBelowGround(f),
|
|
1370
|
+
);
|
|
1371
|
+
if (isAllEqual(storeysBelowGroundValues)) {
|
|
1372
|
+
values.storeysBelowGround = storeysBelowGroundValues[0];
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
const storeyHeightsAboveGroundValues = features.map((f) =>
|
|
1376
|
+
this.getStoreyHeightsAboveGround(f),
|
|
1377
|
+
);
|
|
1378
|
+
if (isAllEqual(storeyHeightsAboveGroundValues)) {
|
|
1379
|
+
values.storeyHeightsAboveGround = storeyHeightsAboveGroundValues[0];
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
const storeyHeightsBelowGroundValues = features.map((f) =>
|
|
1383
|
+
this.getStoreyHeightsBelowGround(f),
|
|
1384
|
+
);
|
|
1385
|
+
if (isAllEqual(storeyHeightsBelowGroundValues)) {
|
|
1386
|
+
values.storeyHeightsBelowGround = storeyHeightsBelowGroundValues[0];
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
const modelUrlValues = features.map((f) => this.getModelUrl(f));
|
|
1390
|
+
if (isAllEqual(modelUrlValues)) {
|
|
1391
|
+
values.modelUrl = modelUrlValues[0];
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
const modelScaleXValues = features.map((f) => this.getModelScaleX(f));
|
|
1395
|
+
if (isAllEqual(modelScaleXValues)) {
|
|
1396
|
+
values.modelScaleX = modelScaleXValues[0];
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
const modelScaleYValues = features.map((f) => this.getModelScaleY(f));
|
|
1400
|
+
if (isAllEqual(modelScaleYValues)) {
|
|
1401
|
+
values.modelScaleY = modelScaleYValues[0];
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
const modelScaleZValues = features.map((f) => this.getModelScaleZ(f));
|
|
1405
|
+
if (isAllEqual(modelScaleZValues)) {
|
|
1406
|
+
values.modelScaleZ = modelScaleZValues[0];
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
const modelHeadingValues = features.map((f) => this.getModelHeading(f));
|
|
1410
|
+
if (isAllEqual(modelHeadingValues)) {
|
|
1411
|
+
values.modelHeading = modelHeadingValues[0];
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
const modelPitchValues = features.map((f) => this.getModelPitch(f));
|
|
1415
|
+
if (isAllEqual(modelPitchValues)) {
|
|
1416
|
+
values.modelPitch = modelPitchValues[0];
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
const modelRollValues = features.map((f) => this.getModelRoll(f));
|
|
1420
|
+
if (isAllEqual(modelRollValues)) {
|
|
1421
|
+
values.modelRoll = modelRollValues[0];
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
const baseUrlValues = features.map((f) => this.getBaseUrl(f));
|
|
1425
|
+
if (isAllEqual(baseUrlValues)) {
|
|
1426
|
+
values.baseUrl = baseUrlValues[0];
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
return values;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* Sets vector property options on a array of features. When a property equals the value that is returned from the getter of the VectorProperties instance, the property is unset from the feature(s).
|
|
1434
|
+
* @param options The vector property options to be set on the features.
|
|
1435
|
+
* @param features The features to set the vector property options on.
|
|
1436
|
+
*/
|
|
1437
|
+
setValuesForFeatures(
|
|
1438
|
+
options: VectorPropertiesOptions,
|
|
1439
|
+
features: Feature[],
|
|
1440
|
+
): void {
|
|
1441
|
+
const layerValues = this.getValues();
|
|
1442
|
+
|
|
1443
|
+
type UpdateConfig<
|
|
1444
|
+
T extends keyof VectorPropertiesOptions = keyof VectorPropertiesOptions,
|
|
1445
|
+
> = {
|
|
1446
|
+
key: T;
|
|
1447
|
+
set: boolean;
|
|
1448
|
+
value: VectorPropertiesOptions[T];
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
const updates: UpdateConfig[] = [];
|
|
1452
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
1453
|
+
const keyCast = key as keyof VectorPropertiesOptions;
|
|
1454
|
+
updates.push({
|
|
1455
|
+
key: keyCast,
|
|
1456
|
+
value,
|
|
1457
|
+
set: !deepEqual(value, layerValues[keyCast]),
|
|
1458
|
+
});
|
|
1459
|
+
});
|
|
1460
|
+
|
|
1461
|
+
features.forEach((f) => {
|
|
1462
|
+
updates.forEach(({ key, set, value }) => {
|
|
1463
|
+
const propertyName = `olcs_${key}`;
|
|
1464
|
+
if (set) {
|
|
1465
|
+
f.set(propertyName, value);
|
|
1466
|
+
} else {
|
|
1467
|
+
f.unset(propertyName);
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1282
1473
|
// XXX ugly design, this does NOT return a VcsMeta (missing version) but is missued to get config objects too often to change
|
|
1283
1474
|
getVcsMeta(
|
|
1284
1475
|
defaultOptions?: VectorPropertiesOptions,
|
package/src/layer/wfsLayer.ts
CHANGED
|
@@ -2,7 +2,7 @@ import WFSFormat from 'ol/format/WFS.js';
|
|
|
2
2
|
import VectorLayer, { VectorOptions } from './vectorLayer.js';
|
|
3
3
|
import Projection from '../util/projection.js';
|
|
4
4
|
import { layerClassRegistry } from '../classRegistry.js';
|
|
5
|
-
import {
|
|
5
|
+
import { requestUrl } from '../util/fetch.js';
|
|
6
6
|
|
|
7
7
|
export type WFSOptions = VectorOptions & {
|
|
8
8
|
/**
|
|
@@ -18,6 +18,11 @@ export type WFSOptions = VectorOptions & {
|
|
|
18
18
|
* additional config for [ol/format/WFS/writeGetFeature]{@link https://openlayers.org/en/latest/apidoc/ol.format.WFS.html} excluding featureType, featureNS and featurePrefix
|
|
19
19
|
*/
|
|
20
20
|
getFeatureOptions?: Record<string, unknown>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Version of the WFS Service, will be forwarded to the openlayers WFS Format.
|
|
24
|
+
*/
|
|
25
|
+
version?: string;
|
|
21
26
|
};
|
|
22
27
|
|
|
23
28
|
/**
|
|
@@ -34,6 +39,8 @@ class WFSLayer extends VectorLayer {
|
|
|
34
39
|
|
|
35
40
|
featurePrefix: string;
|
|
36
41
|
|
|
42
|
+
version: string | undefined;
|
|
43
|
+
|
|
37
44
|
getFeaturesOptions: Record<string, unknown>;
|
|
38
45
|
|
|
39
46
|
wfsFormat: WFSFormat;
|
|
@@ -47,6 +54,7 @@ class WFSLayer extends VectorLayer {
|
|
|
47
54
|
featureNS: '',
|
|
48
55
|
featurePrefix: '',
|
|
49
56
|
getFeatureOptions: {},
|
|
57
|
+
version: undefined,
|
|
50
58
|
};
|
|
51
59
|
}
|
|
52
60
|
|
|
@@ -70,10 +78,11 @@ class WFSLayer extends VectorLayer {
|
|
|
70
78
|
this.featureNS = options.featureNS;
|
|
71
79
|
this.featurePrefix = options.featurePrefix;
|
|
72
80
|
this.getFeaturesOptions = options.getFeatureOptions || {};
|
|
73
|
-
|
|
81
|
+
this.version = options.version;
|
|
74
82
|
this.wfsFormat = new WFSFormat({
|
|
75
83
|
featureNS: this.featureNS,
|
|
76
84
|
featureType: this.featureType,
|
|
85
|
+
version: this.version,
|
|
77
86
|
});
|
|
78
87
|
|
|
79
88
|
this._dataFetchedPromise = null;
|
|
@@ -87,6 +96,11 @@ class WFSLayer extends VectorLayer {
|
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
async reload(): Promise<void> {
|
|
99
|
+
this.wfsFormat = new WFSFormat({
|
|
100
|
+
featureNS: this.featureNS,
|
|
101
|
+
featureType: this.featureType,
|
|
102
|
+
version: this.version,
|
|
103
|
+
});
|
|
90
104
|
if (this._dataFetchedPromise) {
|
|
91
105
|
this.removeAllFeatures();
|
|
92
106
|
this._dataFetchedPromise = null;
|
|
@@ -111,14 +125,15 @@ class WFSLayer extends VectorLayer {
|
|
|
111
125
|
...this.getFeaturesOptions,
|
|
112
126
|
});
|
|
113
127
|
const postData = new XMLSerializer().serializeToString(requestDocument);
|
|
114
|
-
this._dataFetchedPromise =
|
|
128
|
+
this._dataFetchedPromise = requestUrl(this.url, {
|
|
115
129
|
method: 'POST',
|
|
116
130
|
headers: {
|
|
117
131
|
'Content-Type': 'application/text+xml',
|
|
118
132
|
},
|
|
119
|
-
body:
|
|
133
|
+
body: postData,
|
|
120
134
|
})
|
|
121
|
-
.then((
|
|
135
|
+
.then((response) => response.text())
|
|
136
|
+
.then((data) => this._parseWFSData(data))
|
|
122
137
|
.catch((err) => {
|
|
123
138
|
this.getLogger().info(
|
|
124
139
|
`Could not send request for loading layer content (${String(err)})`,
|
|
@@ -132,7 +147,7 @@ class WFSLayer extends VectorLayer {
|
|
|
132
147
|
return Promise.reject(new Error('missing url in WFSLayer layer'));
|
|
133
148
|
}
|
|
134
149
|
|
|
135
|
-
private _parseWFSData(obj:
|
|
150
|
+
private _parseWFSData(obj: string): void {
|
|
136
151
|
const features = this.wfsFormat.readFeatures(obj);
|
|
137
152
|
this.addFeatures(features);
|
|
138
153
|
}
|
package/src/map/cesiumMap.ts
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
41
41
|
|
|
42
42
|
import { checkMaybe } from '@vcsuite/check';
|
|
43
|
-
import { parseBoolean, parseInteger } from '@vcsuite/parsers';
|
|
43
|
+
import { parseBoolean, parseInteger, parseNumber } from '@vcsuite/parsers';
|
|
44
44
|
import VcsMap, { type VcsMapOptions } from './vcsMap.js';
|
|
45
45
|
import Viewpoint from '../util/viewpoint.js';
|
|
46
46
|
import Projection, { mercatorProjection } from '../util/projection.js';
|
|
@@ -80,6 +80,12 @@ export type CesiumMapOptions = VcsMapOptions & {
|
|
|
80
80
|
* This is a global Setting for all VCMap Instances on the same page.
|
|
81
81
|
*/
|
|
82
82
|
useOriginalCesiumShader?: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* changes the default Cesium Sunlight Intensity (default is 3.0)
|
|
86
|
+
* Cesium Default is 2.0
|
|
87
|
+
*/
|
|
88
|
+
lightIntensity?: number;
|
|
83
89
|
};
|
|
84
90
|
|
|
85
91
|
export type CesiumMapEvent = {
|
|
@@ -344,6 +350,8 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
344
350
|
|
|
345
351
|
private _useOriginalCesiumShader: boolean;
|
|
346
352
|
|
|
353
|
+
private _lightIntensity: number;
|
|
354
|
+
|
|
347
355
|
constructor(options: CesiumMapOptions) {
|
|
348
356
|
super(options);
|
|
349
357
|
|
|
@@ -403,6 +411,8 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
403
411
|
this._listeners = [];
|
|
404
412
|
|
|
405
413
|
this._lastEventFrameNumber = null;
|
|
414
|
+
|
|
415
|
+
this._lightIntensity = parseNumber(options.lightIntensity, 3.0);
|
|
406
416
|
}
|
|
407
417
|
|
|
408
418
|
get splitPosition(): number {
|
|
@@ -653,6 +663,7 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
653
663
|
this._cesiumWidget.scene.highDynamicRange = false;
|
|
654
664
|
// this._cesiumWidget.scene.logarithmicDepthBuffer = false; // TODO observe this
|
|
655
665
|
this._cesiumWidget.scene.splitPosition = this.splitPosition;
|
|
666
|
+
this._cesiumWidget.scene.light.intensity = this._lightIntensity;
|
|
656
667
|
|
|
657
668
|
this._cesiumWidget.scene.globe.enableLighting = this.enableLightning;
|
|
658
669
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseInteger, parseNumber } from '@vcsuite/parsers';
|
|
2
2
|
import RBush from 'rbush';
|
|
3
3
|
import knn from 'rbush-knn';
|
|
4
4
|
import { getTransform } from 'ol/proj.js';
|
|
@@ -72,7 +72,7 @@ export type ObliqueCollectionOptions = VcsObjectOptions & {
|
|
|
72
72
|
minZoom?: number;
|
|
73
73
|
scaleFactor?: number;
|
|
74
74
|
hideLevels?: number;
|
|
75
|
-
|
|
75
|
+
datasourceId?: string;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export type ObliqueImageRbushItem = {
|
|
@@ -132,7 +132,7 @@ class ObliqueCollection extends VcsObject {
|
|
|
132
132
|
scaleFactor: 4,
|
|
133
133
|
dataSets: undefined,
|
|
134
134
|
hideLevels: 0,
|
|
135
|
-
|
|
135
|
+
datasourceId: undefined,
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -172,9 +172,10 @@ class ObliqueCollection extends VcsObject {
|
|
|
172
172
|
private _loadingPromise: Promise<void> | undefined = undefined;
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
|
-
*
|
|
175
|
+
* Optional Id to synchronize with the vcPublisher Datasources. This can also be used to track a connection
|
|
176
|
+
* to other sources of data.
|
|
176
177
|
*/
|
|
177
|
-
|
|
178
|
+
datasourceId?: string;
|
|
178
179
|
|
|
179
180
|
/**
|
|
180
181
|
* @param options
|
|
@@ -196,10 +197,7 @@ class ObliqueCollection extends VcsObject {
|
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
this.
|
|
200
|
-
options.activeOnStartup,
|
|
201
|
-
defaultOptions.activeOnStartup,
|
|
202
|
-
);
|
|
200
|
+
this.datasourceId = options.datasourceId || defaultOptions.datasourceId;
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
get dataSets(): ObliqueDataSet[] {
|
|
@@ -622,6 +620,9 @@ class ObliqueCollection extends VcsObject {
|
|
|
622
620
|
if (this.viewOptions.hideLevels !== defaultOptions.hideLevels) {
|
|
623
621
|
config.hideLevels = this.viewOptions.hideLevels;
|
|
624
622
|
}
|
|
623
|
+
if (this.datasourceId !== defaultOptions.datasourceId) {
|
|
624
|
+
config.datasourceId = this.datasourceId;
|
|
625
|
+
}
|
|
625
626
|
|
|
626
627
|
if (this.dataSets.length > 0) {
|
|
627
628
|
config.dataSets = this.dataSets.map((d) => d.toJSON());
|