@vcmap/core 5.0.0-rc.37 → 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.
Files changed (74) hide show
  1. package/dist/src/interaction/featureProviderInteraction.js +4 -2
  2. package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
  3. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +1 -0
  4. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js +50 -3
  5. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
  6. package/dist/src/layer/cesium/rasterLayerCesiumImpl.js +4 -0
  7. package/dist/src/layer/cesium/rasterLayerCesiumImpl.js.map +1 -1
  8. package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +1 -1
  9. package/dist/src/layer/cesium/vectorCesiumImpl.js +17 -15
  10. package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
  11. package/dist/src/layer/cesium/vectorContext.d.ts +1 -0
  12. package/dist/src/layer/cesium/vectorContext.js +17 -5
  13. package/dist/src/layer/cesium/vectorContext.js.map +1 -1
  14. package/dist/src/layer/featureVisibility.d.ts +2 -2
  15. package/dist/src/layer/featureVisibility.js +3 -2
  16. package/dist/src/layer/featureVisibility.js.map +1 -1
  17. package/dist/src/layer/vectorLayer.d.ts +1 -0
  18. package/dist/src/layer/vectorLayer.js.map +1 -1
  19. package/dist/src/map/cesiumMap.d.ts +6 -0
  20. package/dist/src/map/cesiumMap.js +4 -1
  21. package/dist/src/map/cesiumMap.js.map +1 -1
  22. package/dist/src/util/editor/createFeatureSession.js +7 -0
  23. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  24. package/dist/src/util/editor/editFeaturesSession.js +1 -6
  25. package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
  26. package/dist/src/util/editor/editGeometrySession.js +15 -1
  27. package/dist/src/util/editor/editGeometrySession.js.map +1 -1
  28. package/dist/src/util/editor/editorHelpers.d.ts +1 -0
  29. package/dist/src/util/editor/editorHelpers.js +5 -0
  30. package/dist/src/util/editor/editorHelpers.js.map +1 -1
  31. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -1
  32. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
  33. package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
  34. package/dist/src/util/featureconverter/arcToCesium.js +2 -2
  35. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  36. package/dist/src/util/featureconverter/convert.d.ts +1 -1
  37. package/dist/src/util/featureconverter/convert.js +13 -13
  38. package/dist/src/util/featureconverter/convert.js.map +1 -1
  39. package/dist/src/util/featureconverter/featureconverterHelper.js +1 -1
  40. package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
  41. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +2 -2
  42. package/dist/src/util/featureconverter/lineStringToCesium.js +6 -6
  43. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  44. package/dist/src/util/featureconverter/pointHelpers.d.ts +4 -4
  45. package/dist/src/util/featureconverter/pointHelpers.js +30 -21
  46. package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
  47. package/dist/src/util/featureconverter/pointToCesium.d.ts +1 -1
  48. package/dist/src/util/featureconverter/pointToCesium.js +5 -5
  49. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  50. package/dist/src/util/featureconverter/polygonToCesium.d.ts +2 -2
  51. package/dist/src/util/featureconverter/polygonToCesium.js +13 -4
  52. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  53. package/package.json +3 -3
  54. package/src/cesium/cesium.d.ts +5 -1
  55. package/src/interaction/featureProviderInteraction.ts +10 -8
  56. package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +57 -4
  57. package/src/layer/cesium/rasterLayerCesiumImpl.ts +4 -0
  58. package/src/layer/cesium/vectorCesiumImpl.ts +17 -15
  59. package/src/layer/cesium/vectorContext.ts +46 -33
  60. package/src/layer/featureVisibility.ts +3 -11
  61. package/src/layer/vectorLayer.ts +5 -0
  62. package/src/map/cesiumMap.ts +12 -1
  63. package/src/util/editor/createFeatureSession.ts +8 -0
  64. package/src/util/editor/editFeaturesSession.ts +1 -7
  65. package/src/util/editor/editGeometrySession.ts +17 -1
  66. package/src/util/editor/editorHelpers.ts +6 -0
  67. package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +11 -1
  68. package/src/util/featureconverter/arcToCesium.ts +3 -3
  69. package/src/util/featureconverter/convert.ts +50 -32
  70. package/src/util/featureconverter/featureconverterHelper.ts +5 -1
  71. package/src/util/featureconverter/lineStringToCesium.ts +38 -36
  72. package/src/util/featureconverter/pointHelpers.ts +166 -144
  73. package/src/util/featureconverter/pointToCesium.ts +8 -8
  74. package/src/util/featureconverter/polygonToCesium.ts +16 -1
@@ -22,14 +22,16 @@ class FeatureProviderInteraction extends AbstractInteraction {
22
22
  // eslint-disable-next-line class-methods-use-this
23
23
  async pipe(event: InteractionEvent): Promise<InteractionEvent> {
24
24
  if (!event.feature) {
25
- const layersWithProvider = [...event.map.layerCollection].filter((l) => {
26
- return (
27
- l.featureProvider &&
28
- l.active &&
29
- l.isSupported(event.map) &&
30
- l.featureProvider.isSupported(event.map)
31
- );
32
- });
25
+ const layersWithProvider = [...event.map.layerCollection]
26
+ .filter((l) => {
27
+ return (
28
+ l.featureProvider &&
29
+ l.active &&
30
+ l.isSupported(event.map) &&
31
+ l.featureProvider.isSupported(event.map)
32
+ );
33
+ })
34
+ .reverse();
33
35
 
34
36
  if (layersWithProvider.length > 0) {
35
37
  const resolution = event.map.getCurrentResolution(
@@ -16,6 +16,9 @@ import type { Coordinate } from 'ol/coordinate.js';
16
16
  import LayerImplementation from '../layerImplementation.js';
17
17
  import { vcsLayerName } from '../layerSymbols.js';
18
18
  import FeatureVisibility, {
19
+ hideFeature,
20
+ HighlightableFeature,
21
+ highlightFeature,
19
22
  originalStyle,
20
23
  updateOriginalStyle,
21
24
  } from '../featureVisibility.js';
@@ -34,6 +37,10 @@ export const cesiumTilesetLastUpdated: unique symbol = Symbol(
34
37
  'cesiumTilesetLastUpdated',
35
38
  );
36
39
 
40
+ export const updateFeatureOverride: unique symbol = Symbol(
41
+ 'updateFeatureOverride',
42
+ );
43
+
37
44
  export function getExtentFromTileset(
38
45
  cesium3DTileset?: Cesium3DTileset,
39
46
  ): OLExtent {
@@ -120,11 +127,15 @@ class CesiumTilesetCesiumImpl
120
127
 
121
128
  async initialize(): Promise<void> {
122
129
  if (!this._initializedPromise) {
123
- this._initializedPromise = Cesium3DTileset.fromUrl(
124
- this.url as string,
125
- this.tilesetOptions,
126
- );
130
+ this._initializedPromise = Cesium3DTileset.fromUrl(this.url as string, {
131
+ ...this.tilesetOptions,
132
+ show: false, // show is handled by activate
133
+ });
127
134
  this.cesium3DTileset = await this._initializedPromise;
135
+ if (this.isDestroyed) {
136
+ this.cesium3DTileset.destroy();
137
+ return;
138
+ }
128
139
  if (this.tilesetProperties) {
129
140
  this.tilesetProperties.forEach(({ key, value }) => {
130
141
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -138,6 +149,8 @@ class CesiumTilesetCesiumImpl
138
149
  );
139
150
  this.cesium3DTileset.tileUnload.addEventListener((tile: Cesium3DTile) => {
140
151
  delete tile[cesiumTilesetLastUpdated];
152
+ delete tile.content[cesiumTilesetLastUpdated];
153
+ delete tile.content[updateFeatureOverride];
141
154
  });
142
155
 
143
156
  this._originalOrigin = Cartesian3.clone(
@@ -277,7 +290,14 @@ class CesiumTilesetCesiumImpl
277
290
  (this.globalHider?.lastUpdated ?? 0) ||
278
291
  content[cesiumTilesetLastUpdated] < this._styleLastUpdated
279
292
  ) {
293
+ // content[updateFeatureOverride]?.reset();
294
+ delete content[updateFeatureOverride];
280
295
  const batchSize = content.featuresLength;
296
+ const featureOverride = {
297
+ hideLocal: [] as [string, HighlightableFeature][],
298
+ hideGlobal: [] as [string, HighlightableFeature][],
299
+ highlight: [] as [string, HighlightableFeature][],
300
+ };
281
301
  for (let batchId = 0; batchId < batchSize; batchId++) {
282
302
  const feature = content.getFeature(batchId);
283
303
  if (feature) {
@@ -286,11 +306,14 @@ class CesiumTilesetCesiumImpl
286
306
  id = `${content.url}${batchId}`;
287
307
  }
288
308
 
309
+ let shouldUpdateOriginalStyle = true;
289
310
  if (
290
311
  this.featureVisibility.highlightedObjects[id] &&
291
312
  !this.featureVisibility.hasHighlightFeature(id, feature)
292
313
  ) {
293
314
  this.featureVisibility.addHighlightFeature(id, feature);
315
+ featureOverride.highlight.push([id, feature]);
316
+ shouldUpdateOriginalStyle = false;
294
317
  }
295
318
 
296
319
  if (
@@ -298,6 +321,7 @@ class CesiumTilesetCesiumImpl
298
321
  !this.featureVisibility.hasHiddenFeature(id, feature)
299
322
  ) {
300
323
  this.featureVisibility.addHiddenFeature(id, feature);
324
+ featureOverride.hideLocal.push([id, feature]);
301
325
  }
302
326
 
303
327
  if (
@@ -305,9 +329,11 @@ class CesiumTilesetCesiumImpl
305
329
  !this.globalHider?.hasFeature(id, feature)
306
330
  ) {
307
331
  this.globalHider?.addFeature(id, feature);
332
+ featureOverride.hideGlobal.push([id, feature]);
308
333
  }
309
334
 
310
335
  if (
336
+ shouldUpdateOriginalStyle &&
311
337
  this._styleLastUpdated > (content[cesiumTilesetLastUpdated] ?? 0) &&
312
338
  feature[originalStyle] // can only be a color for cesium, so no check for undefined required
313
339
  ) {
@@ -315,7 +341,34 @@ class CesiumTilesetCesiumImpl
315
341
  }
316
342
  }
317
343
  }
344
+ if (
345
+ featureOverride.hideLocal.length > 0 ||
346
+ featureOverride.hideGlobal.length > 0 ||
347
+ featureOverride.highlight.length > 0
348
+ ) {
349
+ content[updateFeatureOverride] = (): void => {
350
+ featureOverride.hideGlobal.forEach(([id, feature]) => {
351
+ if (this.globalHider?.hasFeature(id, feature)) {
352
+ hideFeature(feature);
353
+ }
354
+ });
355
+
356
+ featureOverride.hideLocal.forEach(([id, feature]) => {
357
+ if (this.featureVisibility.hasHiddenFeature(id, feature)) {
358
+ hideFeature(feature);
359
+ }
360
+ });
361
+
362
+ featureOverride.highlight.forEach(([id, feature]) => {
363
+ if (this.featureVisibility.hasHighlightFeature(id, feature)) {
364
+ highlightFeature(feature);
365
+ }
366
+ });
367
+ };
368
+ }
318
369
  content[cesiumTilesetLastUpdated] = Date.now();
370
+ } else {
371
+ content[updateFeatureOverride]?.();
319
372
  }
320
373
  }
321
374
 
@@ -44,6 +44,10 @@ class RasterLayerCesiumImpl
44
44
  async initialize(): Promise<void> {
45
45
  if (!this.initialized) {
46
46
  this.cesiumLayer = await this.getCesiumLayer();
47
+ if (this.isDestroyed) {
48
+ this.cesiumLayer.destroy();
49
+ return Promise.resolve();
50
+ }
47
51
  this.cesiumLayer[vcsLayerName] = this.name;
48
52
  this.cesiumLayer.show = false;
49
53
  this.map.addImageryLayer(this.cesiumLayer);
@@ -78,7 +78,8 @@ class VectorCesiumImpl
78
78
  private _addListeners(): void {
79
79
  this._olListeners.push(
80
80
  this.source.on('addfeature', (event) => {
81
- this._addFeature(event.feature as Feature);
81
+ // eslint-disable-next-line no-void
82
+ void this._addFeature(event.feature as Feature);
82
83
  }),
83
84
  );
84
85
 
@@ -90,7 +91,8 @@ class VectorCesiumImpl
90
91
 
91
92
  this._olListeners.push(
92
93
  this.source.on('changefeature', (event) => {
93
- this._featureChanged(event.feature as Feature);
94
+ // eslint-disable-next-line no-void
95
+ void this._featureChanged(event.feature as Feature);
94
96
  }),
95
97
  );
96
98
 
@@ -115,7 +117,7 @@ class VectorCesiumImpl
115
117
  if (!this.initialized) {
116
118
  this._scene = this.map.getScene();
117
119
  this._addListeners();
118
- this._addFeatures(this.source.getFeatures());
120
+ await this._addFeatures(this.source.getFeatures());
119
121
  await this._setupContext(this.map);
120
122
  }
121
123
  await super.initialize();
@@ -124,20 +126,19 @@ class VectorCesiumImpl
124
126
  }
125
127
  }
126
128
 
127
- private _addFeatures(features: Feature[]): void {
129
+ private async _addFeatures(features: Feature[]): Promise<void> {
128
130
  // TODO we should make this non-blocking to better handle larger data sets check in RIWA Impl
129
- features.forEach((f) => {
130
- this._addFeature(f);
131
- });
131
+ await Promise.allSettled(features.map((f) => this._addFeature(f)));
132
132
  }
133
133
 
134
134
  /**
135
135
  * converts a feature and adds the associated primitives to the collection of primitives
136
136
  */
137
- private _addFeature(feature: Feature): void {
137
+ private async _addFeature(feature: Feature): Promise<void> {
138
138
  if (this.active) {
139
139
  // XXX cluster check here? or on init?
140
- convert(
140
+ this._context!.features.add(feature);
141
+ await convert(
141
142
  feature,
142
143
  this.style.style,
143
144
  this.vectorProperties,
@@ -152,9 +153,9 @@ class VectorCesiumImpl
152
153
  /**
153
154
  * Forces a complete re-render of all features.
154
155
  */
155
- refresh(): void {
156
+ async refresh(): Promise<void> {
156
157
  this._context?.clear();
157
- this._addFeatures(this.source.getFeatures());
158
+ await this._addFeatures(this.source.getFeatures());
158
159
  }
159
160
 
160
161
  /**
@@ -168,10 +169,10 @@ class VectorCesiumImpl
168
169
  /**
169
170
  * called when a features property have changed
170
171
  */
171
- private _featureChanged(feature: Feature): void {
172
+ private async _featureChanged(feature: Feature): Promise<void> {
172
173
  const cache = this._context!.createFeatureCache(feature);
173
174
  this._featureToAdd.delete(feature);
174
- this._addFeature(feature);
175
+ await this._addFeature(feature);
175
176
  this._context!.clearFeatureCache(cache);
176
177
  }
177
178
 
@@ -179,7 +180,7 @@ class VectorCesiumImpl
179
180
  if (!this.active) {
180
181
  await super.activate();
181
182
  if (this.active) {
182
- this._addFeatures([...this._featureToAdd]);
183
+ await this._addFeatures([...this._featureToAdd]);
183
184
  this._featureToAdd.clear();
184
185
  this._rootCollection.show = true;
185
186
  if (this._featureVisibilityListeners.length === 0) {
@@ -208,7 +209,8 @@ class VectorCesiumImpl
208
209
  if (this.initialized && !silent) {
209
210
  const features = this.source.getFeatures().filter((f) => !f.getStyle());
210
211
  features.forEach((f) => {
211
- this._featureChanged(f);
212
+ // eslint-disable-next-line no-void
213
+ void this._featureChanged(f);
212
214
  });
213
215
  }
214
216
  }
@@ -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
- addPrimitiveToContext(
350
- primitives,
351
- feature,
352
- allowPicking,
353
- this.primitives,
354
- this.featureToPrimitiveMap,
355
- this.splitDirection,
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
- addPrimitiveToContext(
371
- primitives,
372
- feature,
373
- allowPicking,
374
- this.scaledPrimitives,
375
- this.featureToScaledPrimitiveMap,
376
- this.splitDirection,
377
- );
378
- this._scaledDirty.value = true;
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
- addPrimitiveToContext(
387
- billboardOptions,
388
- feature,
389
- allowPicking,
390
- this.billboards,
391
- this.featureToBillboardMap,
392
- this.splitDirection,
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
- addPrimitiveToContext(
402
- labelOptions,
403
- feature,
404
- allowPicking,
405
- this.labels,
406
- this.featureToLabelMap,
407
- this.splitDirection,
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
  }
@@ -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);
@@ -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 = {
@@ -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
 
@@ -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();
@@ -40,6 +40,12 @@ export interface SelectFeatureInteraction {
40
40
  hasFeatureId(id: string): boolean;
41
41
  }
42
42
 
43
+ export const geometryChangeKeys = [
44
+ 'olcs_altitudeMode',
45
+ 'olcs_groundLevel',
46
+ 'olcs_heightAboveGround',
47
+ ];
48
+
43
49
  /**
44
50
  * @param coordinate
45
51
  */
@@ -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: 'pointer', // fa pencil
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,