@vcmap/core 5.0.0-rc.37 → 5.0.0-rc.39
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/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/rasterLayerCesiumImpl.js +4 -0
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.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/cesiumTilesetLayer.d.ts +0 -5
- package/dist/src/layer/cesiumTilesetLayer.js +0 -10
- package/dist/src/layer/cesiumTilesetLayer.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/vectorLayer.d.ts +1 -0
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/layer/vectorProperties.js +12 -0
- package/dist/src/layer/vectorProperties.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +14 -0
- package/dist/src/map/cesiumMap.js +23 -1
- package/dist/src/map/cesiumMap.js.map +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 +1 -6
- 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 +1 -0
- 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/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 +30 -21
- 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 +5 -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/package.json +3 -3
- package/src/cesium/cesium.d.ts +5 -1
- package/src/interaction/featureProviderInteraction.ts +10 -8
- package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +57 -4
- package/src/layer/cesium/rasterLayerCesiumImpl.ts +4 -0
- package/src/layer/cesium/vectorCesiumImpl.ts +17 -15
- package/src/layer/cesium/vectorContext.ts +46 -33
- package/src/layer/cesiumTilesetLayer.ts +0 -21
- package/src/layer/featureVisibility.ts +3 -11
- package/src/layer/vectorLayer.ts +5 -0
- package/src/layer/vectorProperties.ts +18 -3
- package/src/map/cesiumMap.ts +37 -1
- package/src/util/editor/createFeatureSession.ts +8 -0
- package/src/util/editor/editFeaturesSession.ts +1 -7
- package/src/util/editor/editGeometrySession.ts +17 -1
- package/src/util/editor/editorHelpers.ts +6 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +11 -1
- 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 +166 -144
- package/src/util/featureconverter/pointToCesium.ts +8 -8
- package/src/util/featureconverter/polygonToCesium.ts +16 -1
|
@@ -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
|
}
|
|
@@ -30,10 +30,6 @@ export type CesiumTilesetOptions = LayerOptions & {
|
|
|
30
30
|
* relates inversely to the depth over which the layer is activated
|
|
31
31
|
*/
|
|
32
32
|
screenSpaceErrorMobile?: number;
|
|
33
|
-
/**
|
|
34
|
-
* sets the cesium maximumMemoryUsage Parameter (Is when the cached tiles exceed this value cesium starts to clear the cached tiles)
|
|
35
|
-
*/
|
|
36
|
-
maximumMemoryUsage?: number;
|
|
37
33
|
tilesetOptions?: object;
|
|
38
34
|
highlightStyle?: VectorStyleItem | VectorStyleItemOptions;
|
|
39
35
|
featureVisibility?: FeatureVisibility;
|
|
@@ -71,7 +67,6 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
|
|
|
71
67
|
highlightStyle: undefined,
|
|
72
68
|
screenSpaceError: 16,
|
|
73
69
|
screenSpaceErrorMobile: 32,
|
|
74
|
-
maximumMemoryUsage: 16,
|
|
75
70
|
tilesetOptions: {},
|
|
76
71
|
offset: undefined,
|
|
77
72
|
};
|
|
@@ -83,8 +78,6 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
|
|
|
83
78
|
|
|
84
79
|
screenSpaceErrorMobile: number;
|
|
85
80
|
|
|
86
|
-
maximumMemoryUsage: number;
|
|
87
|
-
|
|
88
81
|
tilesetOptions: Record<string, unknown>;
|
|
89
82
|
|
|
90
83
|
private _modelMatrix: Matrix4 | undefined;
|
|
@@ -119,11 +112,6 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
|
|
|
119
112
|
defaultOptions.screenSpaceErrorMobile,
|
|
120
113
|
);
|
|
121
114
|
|
|
122
|
-
this.maximumMemoryUsage = parseInteger(
|
|
123
|
-
options.maximumMemoryUsage,
|
|
124
|
-
defaultOptions.maximumMemoryUsage,
|
|
125
|
-
);
|
|
126
|
-
|
|
127
115
|
const tilesetOptions =
|
|
128
116
|
options.tilesetOptions || defaultOptions.tilesetOptions;
|
|
129
117
|
|
|
@@ -131,7 +119,6 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
|
|
|
131
119
|
maximumScreenSpaceError: isMobile()
|
|
132
120
|
? this.screenSpaceErrorMobile
|
|
133
121
|
: this.screenSpaceError,
|
|
134
|
-
maximumMemoryUsage: this.maximumMemoryUsage,
|
|
135
122
|
...tilesetOptions,
|
|
136
123
|
};
|
|
137
124
|
|
|
@@ -245,10 +232,6 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
|
|
|
245
232
|
config.screenSpaceErrorMobile = this.screenSpaceErrorMobile;
|
|
246
233
|
}
|
|
247
234
|
|
|
248
|
-
if (this.maximumMemoryUsage !== defaultOptions.maximumMemoryUsage) {
|
|
249
|
-
config.maximumMemoryUsage = this.maximumMemoryUsage;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
235
|
const tilesetOptions: Record<string, unknown> = { ...this.tilesetOptions };
|
|
253
236
|
|
|
254
237
|
const usedScreenSpaceError = isMobile()
|
|
@@ -258,10 +241,6 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
|
|
|
258
241
|
delete tilesetOptions.maximumScreenSpaceError;
|
|
259
242
|
}
|
|
260
243
|
|
|
261
|
-
if (tilesetOptions.maximumMemoryUsage === this.maximumMemoryUsage) {
|
|
262
|
-
delete tilesetOptions.maximumMemoryUsage;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
244
|
if (Object.keys(tilesetOptions).length > 0) {
|
|
266
245
|
config.tilesetOptions = tilesetOptions;
|
|
267
246
|
}
|
|
@@ -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/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 = {
|
|
@@ -1292,9 +1292,9 @@ class VectorProperties {
|
|
|
1292
1292
|
* @param propertyValues An array of values for a specific property from different features.
|
|
1293
1293
|
* @returns Whether all values are equal.
|
|
1294
1294
|
*/
|
|
1295
|
-
function isAllEqual<
|
|
1296
|
-
|
|
1297
|
-
): boolean {
|
|
1295
|
+
function isAllEqual<
|
|
1296
|
+
T extends string | number | boolean | number[] | Record<string, unknown>,
|
|
1297
|
+
>(propertyValues: (T | undefined)[]): boolean {
|
|
1298
1298
|
return propertyValues.every((curr, index, array) => {
|
|
1299
1299
|
if (index === 0) {
|
|
1300
1300
|
return true;
|
|
@@ -1421,6 +1421,21 @@ class VectorProperties {
|
|
|
1421
1421
|
values.modelRoll = modelRollValues[0];
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
|
+
const modelAutoScale = features.map((f) => this.getModelAutoScale(f));
|
|
1425
|
+
if (isAllEqual(modelAutoScale)) {
|
|
1426
|
+
values.modelAutoScale = modelAutoScale[0];
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
const modelOptions = features.map((f) => this.getModelOptions(f));
|
|
1430
|
+
if (isAllEqual(modelOptions)) {
|
|
1431
|
+
values.modelOptions = modelOptions[0];
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
const primitiveOptions = features.map((f) => this.getPrimitiveOptions(f));
|
|
1435
|
+
if (isAllEqual(primitiveOptions)) {
|
|
1436
|
+
values.primitiveOptions = primitiveOptions[0];
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1424
1439
|
const baseUrlValues = features.map((f) => this.getBaseUrl(f));
|
|
1425
1440
|
if (isAllEqual(baseUrlValues)) {
|
|
1426
1441
|
values.baseUrl = baseUrlValues[0];
|
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 = {
|
|
@@ -287,6 +293,7 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
287
293
|
cameraLimiter: undefined,
|
|
288
294
|
globeColor: '#3f47cc',
|
|
289
295
|
useOriginalCesiumShader: false,
|
|
296
|
+
lightIntensity: 3.0,
|
|
290
297
|
};
|
|
291
298
|
}
|
|
292
299
|
|
|
@@ -344,6 +351,8 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
344
351
|
|
|
345
352
|
private _useOriginalCesiumShader: boolean;
|
|
346
353
|
|
|
354
|
+
private _lightIntensity: number;
|
|
355
|
+
|
|
347
356
|
constructor(options: CesiumMapOptions) {
|
|
348
357
|
super(options);
|
|
349
358
|
|
|
@@ -403,6 +412,28 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
403
412
|
this._listeners = [];
|
|
404
413
|
|
|
405
414
|
this._lastEventFrameNumber = null;
|
|
415
|
+
|
|
416
|
+
this._lightIntensity = parseNumber(
|
|
417
|
+
options.lightIntensity,
|
|
418
|
+
defaultOptions.lightIntensity,
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* returns the light Intensity, see Cesium https://cesium.com/learn/cesiumjs/ref-doc/SunLight.html?classFilter=sunlight#intensity
|
|
424
|
+
*/
|
|
425
|
+
get lightIntensity(): number {
|
|
426
|
+
return this._lightIntensity;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* sets the light Intensity, see Cesium https://cesium.com/learn/cesiumjs/ref-doc/SunLight.html?classFilter=sunlight#intensity
|
|
431
|
+
*/
|
|
432
|
+
set lightIntensity(intensity: number) {
|
|
433
|
+
this._lightIntensity = intensity;
|
|
434
|
+
if (this.initialized && this._cesiumWidget) {
|
|
435
|
+
this._cesiumWidget.scene.light.intensity = intensity;
|
|
436
|
+
}
|
|
406
437
|
}
|
|
407
438
|
|
|
408
439
|
get splitPosition(): number {
|
|
@@ -653,6 +684,7 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
653
684
|
this._cesiumWidget.scene.highDynamicRange = false;
|
|
654
685
|
// this._cesiumWidget.scene.logarithmicDepthBuffer = false; // TODO observe this
|
|
655
686
|
this._cesiumWidget.scene.splitPosition = this.splitPosition;
|
|
687
|
+
this._cesiumWidget.scene.light.intensity = this._lightIntensity;
|
|
656
688
|
|
|
657
689
|
this._cesiumWidget.scene.globe.enableLighting = this.enableLightning;
|
|
658
690
|
|
|
@@ -1290,6 +1322,10 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
1290
1322
|
config.cameraLimiter = this._cameraLimiterOptions;
|
|
1291
1323
|
}
|
|
1292
1324
|
|
|
1325
|
+
if (this._lightIntensity !== defaultOptions.lightIntensity) {
|
|
1326
|
+
config.lightIntensity = this._lightIntensity;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1293
1329
|
return config;
|
|
1294
1330
|
}
|
|
1295
1331
|
|
|
@@ -19,6 +19,7 @@ import VectorLayer from '../../layer/vectorLayer.js';
|
|
|
19
19
|
import { createSync } from '../../layer/vectorSymbols.js';
|
|
20
20
|
import geometryIsValid from './validateGeoemetry.js';
|
|
21
21
|
import ObliqueMap from '../../map/obliqueMap.js';
|
|
22
|
+
import { cursorMap } from './interactions/editGeometryMouseOverInteraction.js';
|
|
22
23
|
|
|
23
24
|
export type CreateFeatureSession<T extends GeometryType> = EditorSession & {
|
|
24
25
|
geometryType: T;
|
|
@@ -200,8 +201,15 @@ function startCreateFeatureSession<T extends GeometryType>(
|
|
|
200
201
|
});
|
|
201
202
|
setupActiveMap();
|
|
202
203
|
|
|
204
|
+
if (app.maps.target) {
|
|
205
|
+
app.maps.target.style.cursor = cursorMap.edit;
|
|
206
|
+
}
|
|
207
|
+
|
|
203
208
|
const stop = (): void => {
|
|
204
209
|
isStopped = true; // setting stopped true immediately, to prevent the recreation of the interaction chain on finished
|
|
210
|
+
if (app.maps.target) {
|
|
211
|
+
app.maps.target.style.cursor = cursorMap.auto;
|
|
212
|
+
}
|
|
205
213
|
mapChangedListener();
|
|
206
214
|
obliqueImageChangedListener();
|
|
207
215
|
if (currentInteraction) {
|
|
@@ -28,7 +28,7 @@ import ScaleInteraction from './transformation/scaleInteraction.js';
|
|
|
28
28
|
import { obliqueGeometry } from '../../layer/vectorSymbols.js';
|
|
29
29
|
import ExtrudeInteraction from './transformation/extrudeInteraction.js';
|
|
30
30
|
import ObliqueMap from '../../map/obliqueMap.js';
|
|
31
|
-
import { ensureFeatureAbsolute } from './editorHelpers.js';
|
|
31
|
+
import { ensureFeatureAbsolute, geometryChangeKeys } from './editorHelpers.js';
|
|
32
32
|
import CesiumMap from '../../map/cesiumMap.js';
|
|
33
33
|
import EnsureHandlerSelectionInteraction from './interactions/ensureHandlerSelectionInteraction.js';
|
|
34
34
|
import EditFeaturesMouseOverInteraction from './interactions/editFeaturesMouseOverInteraction.js';
|
|
@@ -92,12 +92,6 @@ export type EditFeaturesSession = EditorSession & {
|
|
|
92
92
|
features: Feature[];
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
const geometryChangeKeys = [
|
|
96
|
-
'olcs_altitudeMode',
|
|
97
|
-
'olcs_groundLevel',
|
|
98
|
-
'olcs_heightAboveGround',
|
|
99
|
-
];
|
|
100
|
-
|
|
101
95
|
/**
|
|
102
96
|
* Creates an editor session to select, translate, rotate & scale the feature on a given layer
|
|
103
97
|
* @param app
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
LinearRing,
|
|
10
10
|
Geometry,
|
|
11
11
|
} from 'ol/geom.js';
|
|
12
|
+
import { EventsKey } from 'ol/events.js';
|
|
12
13
|
import {
|
|
13
14
|
EditorSession,
|
|
14
15
|
GeometryType,
|
|
@@ -20,7 +21,7 @@ import InteractionChain from '../../interaction/interactionChain.js';
|
|
|
20
21
|
import VcsEvent from '../../vcsEvent.js';
|
|
21
22
|
import TranslateVertexInteraction from './interactions/translateVertexInteraction.js';
|
|
22
23
|
import RemoveVertexInteraction from './interactions/removeVertexInteraction.js';
|
|
23
|
-
import { createVertex } from './editorHelpers.js';
|
|
24
|
+
import { createVertex, geometryChangeKeys } from './editorHelpers.js';
|
|
24
25
|
import InsertVertexInteraction from './interactions/insertVertexInteraction.js';
|
|
25
26
|
import EditGeometryMouseOverInteraction from './interactions/editGeometryMouseOverInteraction.js';
|
|
26
27
|
import { cartesian2DDistance, modulo } from '../math.js';
|
|
@@ -362,18 +363,30 @@ function startEditGeometrySession(
|
|
|
362
363
|
currentFeature = null;
|
|
363
364
|
};
|
|
364
365
|
|
|
366
|
+
let featureListener: EventsKey | undefined;
|
|
367
|
+
|
|
365
368
|
/**
|
|
366
369
|
* Creates an interaction set from an edit geometry interaction. If the geometry of the feature is not supported a message is logged.
|
|
367
370
|
* @param {Feature} feature The feature to be edited.
|
|
368
371
|
*/
|
|
369
372
|
function createCurrentInteractionSet(feature?: Feature): void {
|
|
370
373
|
destroyCurrentInteractionSet();
|
|
374
|
+
if (featureListener) {
|
|
375
|
+
unByKey(featureListener);
|
|
376
|
+
}
|
|
371
377
|
if (feature) {
|
|
378
|
+
featureListener = feature.on('propertychange', ({ key }) => {
|
|
379
|
+
if (geometryChangeKeys.includes(key)) {
|
|
380
|
+
createCurrentInteractionSet(feature);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
372
383
|
currentFeature = feature;
|
|
373
384
|
currentFeature[createSync] = true;
|
|
374
385
|
const geometry =
|
|
375
386
|
feature[obliqueGeometry] ?? (feature.getGeometry() as Geometry);
|
|
376
387
|
const geometryType = geometry.getType();
|
|
388
|
+
scratchLayer.vectorProperties.altitudeMode =
|
|
389
|
+
layer.vectorProperties.getAltitudeMode(feature);
|
|
377
390
|
if (geometryType === GeometryType.Polygon) {
|
|
378
391
|
if (geometry.get('_vcsGeomType') === GeometryType.BBox) {
|
|
379
392
|
currentInteractionSet = createEditBBoxGeometryInteraction(
|
|
@@ -427,6 +440,9 @@ function startEditGeometrySession(
|
|
|
427
440
|
|
|
428
441
|
const stop = (): void => {
|
|
429
442
|
app.layers.remove(scratchLayer);
|
|
443
|
+
if (featureListener) {
|
|
444
|
+
unByKey(featureListener);
|
|
445
|
+
}
|
|
430
446
|
mapActivatedListener();
|
|
431
447
|
mapInteractionController.reset();
|
|
432
448
|
mouseOverInteraction.reset();
|
|
@@ -8,6 +8,14 @@ import {
|
|
|
8
8
|
} from '../../../interaction/interactionType.js';
|
|
9
9
|
import { Vertex } from '../editorHelpers.js';
|
|
10
10
|
|
|
11
|
+
const pointerSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 19 19">
|
|
12
|
+
<g id="pen">
|
|
13
|
+
<path d=" M 14.744 18.702 L 12.814 16.772 L 16.773 12.814 L 18.703 14.744 C 19.099 15.159 19.099 15.812 18.703 16.228 L 16.228 18.702 C 15.813 19.097 15.16 19.097 14.744 18.702 Z M 3.959 0.002 L 15.635 11.679 L 11.678 15.637 L 0 3.962 L 0 0.002 L 3.959 0.002 Z " fill="rgb(0,0,0)"/>
|
|
14
|
+
<path d=" M 0.75 0.846 L 3.641 0.846 L 14.532 11.768 L 11.641 14.659 L 0.75 3.581 L 0.75 0.846 Z " fill="rgb(255,255,255)"/>
|
|
15
|
+
<path d=" M 16.75 14.018 L 18.242 15.511 L 15.414 18.339 L 13.881 16.805 L 16.75 14.018 Z " fill="rgb(255,255,255)"/>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>`;
|
|
18
|
+
|
|
11
19
|
export const cursorMap = {
|
|
12
20
|
// TODO these can now be designed custom. IE11 no linger required
|
|
13
21
|
auto: 'auto',
|
|
@@ -16,7 +24,9 @@ export const cursorMap = {
|
|
|
16
24
|
rotate: 'crosshair',
|
|
17
25
|
translate: 'move',
|
|
18
26
|
select: 'pointer',
|
|
19
|
-
edit:
|
|
27
|
+
edit: `url("data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
|
28
|
+
pointerSvg,
|
|
29
|
+
)}"), pointer`, // fa pencil
|
|
20
30
|
translateVertex: 'move', // fa-stack pointer-move
|
|
21
31
|
removeVertex: 'no-drop', // fa-stack pencil-minus
|
|
22
32
|
insertVertex: 'cell', // fa-stack pencil-plus
|
|
@@ -86,14 +86,14 @@ function getGeometryFactory(
|
|
|
86
86
|
/**
|
|
87
87
|
* converts a linestring with an ArcStyle to a a cesium primitive
|
|
88
88
|
*/
|
|
89
|
-
export default function arcToCesium(
|
|
89
|
+
export default async function arcToCesium(
|
|
90
90
|
feature: Feature,
|
|
91
91
|
style: ArcStyle,
|
|
92
92
|
geometries: LineString[],
|
|
93
93
|
vectorProperties: VectorProperties,
|
|
94
94
|
scene: Scene,
|
|
95
95
|
context: CesiumVectorContext,
|
|
96
|
-
): void {
|
|
96
|
+
): Promise<void> {
|
|
97
97
|
if (!style.getFill() && !style.getStroke()) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
@@ -114,7 +114,7 @@ export default function arcToCesium(
|
|
|
114
114
|
arcGeometryFactory,
|
|
115
115
|
context,
|
|
116
116
|
);
|
|
117
|
-
addArrowsToContext(
|
|
117
|
+
await addArrowsToContext(
|
|
118
118
|
feature,
|
|
119
119
|
style,
|
|
120
120
|
validGeometries,
|
|
@@ -21,16 +21,23 @@ import ArcStyle, { featureArcStruct } from '../../style/arcStyle.js';
|
|
|
21
21
|
import type VectorProperties from '../../layer/vectorProperties.js';
|
|
22
22
|
import type { CesiumVectorContext } from '../../layer/cesium/vectorContext.js';
|
|
23
23
|
|
|
24
|
-
function convertGeometry(
|
|
24
|
+
async function convertGeometry(
|
|
25
25
|
feature: Feature,
|
|
26
26
|
geometry: Geometry,
|
|
27
27
|
style: Style,
|
|
28
28
|
vectorProperties: VectorProperties,
|
|
29
29
|
scene: Scene,
|
|
30
30
|
context: CesiumVectorContext,
|
|
31
|
-
): void {
|
|
31
|
+
): Promise<void> {
|
|
32
32
|
if (geometry instanceof Point) {
|
|
33
|
-
pointToCesium(
|
|
33
|
+
await pointToCesium(
|
|
34
|
+
feature,
|
|
35
|
+
style,
|
|
36
|
+
[geometry],
|
|
37
|
+
vectorProperties,
|
|
38
|
+
scene,
|
|
39
|
+
context,
|
|
40
|
+
);
|
|
34
41
|
} else if (geometry instanceof Polygon) {
|
|
35
42
|
polygonToCesium(
|
|
36
43
|
feature,
|
|
@@ -42,9 +49,16 @@ function convertGeometry(
|
|
|
42
49
|
);
|
|
43
50
|
} else if (geometry instanceof LineString) {
|
|
44
51
|
if (style instanceof ArcStyle && feature[featureArcStruct]?.coordinates) {
|
|
45
|
-
arcToCesium(
|
|
52
|
+
await arcToCesium(
|
|
53
|
+
feature,
|
|
54
|
+
style,
|
|
55
|
+
[geometry],
|
|
56
|
+
vectorProperties,
|
|
57
|
+
scene,
|
|
58
|
+
context,
|
|
59
|
+
);
|
|
46
60
|
} else {
|
|
47
|
-
lineStringToCesium(
|
|
61
|
+
await lineStringToCesium(
|
|
48
62
|
feature,
|
|
49
63
|
style,
|
|
50
64
|
[geometry],
|
|
@@ -63,7 +77,7 @@ function convertGeometry(
|
|
|
63
77
|
context,
|
|
64
78
|
);
|
|
65
79
|
} else if (geometry instanceof MultiPoint) {
|
|
66
|
-
pointToCesium(
|
|
80
|
+
await pointToCesium(
|
|
67
81
|
feature,
|
|
68
82
|
style,
|
|
69
83
|
geometry.getPoints(),
|
|
@@ -81,7 +95,7 @@ function convertGeometry(
|
|
|
81
95
|
context,
|
|
82
96
|
);
|
|
83
97
|
} else if (geometry instanceof MultiLineString) {
|
|
84
|
-
lineStringToCesium(
|
|
98
|
+
await lineStringToCesium(
|
|
85
99
|
feature,
|
|
86
100
|
style,
|
|
87
101
|
geometry.getLineStrings(),
|
|
@@ -90,16 +104,18 @@ function convertGeometry(
|
|
|
90
104
|
context,
|
|
91
105
|
);
|
|
92
106
|
} else if (geometry instanceof GeometryCollection) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
await Promise.all(
|
|
108
|
+
geometry.getGeometries().map(async (currentGeometry) => {
|
|
109
|
+
await convertGeometry(
|
|
110
|
+
feature,
|
|
111
|
+
currentGeometry,
|
|
112
|
+
style,
|
|
113
|
+
vectorProperties,
|
|
114
|
+
scene,
|
|
115
|
+
context,
|
|
116
|
+
);
|
|
117
|
+
}),
|
|
118
|
+
);
|
|
103
119
|
}
|
|
104
120
|
}
|
|
105
121
|
|
|
@@ -136,25 +152,27 @@ export function getStylesArray(
|
|
|
136
152
|
* @param context
|
|
137
153
|
* @param scene
|
|
138
154
|
*/
|
|
139
|
-
export default function convert(
|
|
155
|
+
export default async function convert(
|
|
140
156
|
feature: Feature,
|
|
141
157
|
style: StyleLike,
|
|
142
158
|
vectorProperties: VectorProperties,
|
|
143
159
|
context: CesiumVectorContext,
|
|
144
160
|
scene: Scene,
|
|
145
|
-
): void {
|
|
161
|
+
): Promise<void> {
|
|
146
162
|
const styles = getStylesArray(feature.getStyle() || style, feature, 0);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
await Promise.all(
|
|
164
|
+
styles.map(async (currentStyle) => {
|
|
165
|
+
const geometry = currentStyle.getGeometryFunction()(feature) as Geometry;
|
|
166
|
+
if (geometry) {
|
|
167
|
+
await convertGeometry(
|
|
168
|
+
feature,
|
|
169
|
+
geometry,
|
|
170
|
+
currentStyle,
|
|
171
|
+
vectorProperties,
|
|
172
|
+
scene,
|
|
173
|
+
context,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}),
|
|
177
|
+
);
|
|
160
178
|
}
|