@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.
Files changed (81) 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/cesiumTilesetLayer.d.ts +0 -5
  15. package/dist/src/layer/cesiumTilesetLayer.js +0 -10
  16. package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
  17. package/dist/src/layer/featureVisibility.d.ts +2 -2
  18. package/dist/src/layer/featureVisibility.js +3 -2
  19. package/dist/src/layer/featureVisibility.js.map +1 -1
  20. package/dist/src/layer/vectorLayer.d.ts +1 -0
  21. package/dist/src/layer/vectorLayer.js.map +1 -1
  22. package/dist/src/layer/vectorProperties.js +12 -0
  23. package/dist/src/layer/vectorProperties.js.map +1 -1
  24. package/dist/src/map/cesiumMap.d.ts +14 -0
  25. package/dist/src/map/cesiumMap.js +23 -1
  26. package/dist/src/map/cesiumMap.js.map +1 -1
  27. package/dist/src/util/editor/createFeatureSession.js +7 -0
  28. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  29. package/dist/src/util/editor/editFeaturesSession.js +1 -6
  30. package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
  31. package/dist/src/util/editor/editGeometrySession.js +15 -1
  32. package/dist/src/util/editor/editGeometrySession.js.map +1 -1
  33. package/dist/src/util/editor/editorHelpers.d.ts +1 -0
  34. package/dist/src/util/editor/editorHelpers.js +5 -0
  35. package/dist/src/util/editor/editorHelpers.js.map +1 -1
  36. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -1
  37. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
  38. package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
  39. package/dist/src/util/featureconverter/arcToCesium.js +2 -2
  40. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  41. package/dist/src/util/featureconverter/convert.d.ts +1 -1
  42. package/dist/src/util/featureconverter/convert.js +13 -13
  43. package/dist/src/util/featureconverter/convert.js.map +1 -1
  44. package/dist/src/util/featureconverter/featureconverterHelper.js +1 -1
  45. package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
  46. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +2 -2
  47. package/dist/src/util/featureconverter/lineStringToCesium.js +6 -6
  48. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  49. package/dist/src/util/featureconverter/pointHelpers.d.ts +4 -4
  50. package/dist/src/util/featureconverter/pointHelpers.js +30 -21
  51. package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
  52. package/dist/src/util/featureconverter/pointToCesium.d.ts +1 -1
  53. package/dist/src/util/featureconverter/pointToCesium.js +5 -5
  54. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  55. package/dist/src/util/featureconverter/polygonToCesium.d.ts +2 -2
  56. package/dist/src/util/featureconverter/polygonToCesium.js +13 -4
  57. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  58. package/package.json +3 -3
  59. package/src/cesium/cesium.d.ts +5 -1
  60. package/src/interaction/featureProviderInteraction.ts +10 -8
  61. package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +57 -4
  62. package/src/layer/cesium/rasterLayerCesiumImpl.ts +4 -0
  63. package/src/layer/cesium/vectorCesiumImpl.ts +17 -15
  64. package/src/layer/cesium/vectorContext.ts +46 -33
  65. package/src/layer/cesiumTilesetLayer.ts +0 -21
  66. package/src/layer/featureVisibility.ts +3 -11
  67. package/src/layer/vectorLayer.ts +5 -0
  68. package/src/layer/vectorProperties.ts +18 -3
  69. package/src/map/cesiumMap.ts +37 -1
  70. package/src/util/editor/createFeatureSession.ts +8 -0
  71. package/src/util/editor/editFeaturesSession.ts +1 -7
  72. package/src/util/editor/editGeometrySession.ts +17 -1
  73. package/src/util/editor/editorHelpers.ts +6 -0
  74. package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +11 -1
  75. package/src/util/featureconverter/arcToCesium.ts +3 -3
  76. package/src/util/featureconverter/convert.ts +50 -32
  77. package/src/util/featureconverter/featureconverterHelper.ts +5 -1
  78. package/src/util/featureconverter/lineStringToCesium.ts +38 -36
  79. package/src/util/featureconverter/pointHelpers.ts +166 -144
  80. package/src/util/featureconverter/pointToCesium.ts +8 -8
  81. package/src/util/featureconverter/polygonToCesium.ts +16 -1
@@ -609,7 +609,11 @@ export function addPrimitivesToContext(
609
609
  );
610
610
  } else {
611
611
  lineGeometries.push(
612
- ...geometryFactory.createLineGeometries(geometryOptions, style),
612
+ ...geometryFactory.createLineGeometries(
613
+ geometryOptions,
614
+ style,
615
+ heightInfo.groundLevel,
616
+ ),
613
617
  );
614
618
  }
615
619
  }
@@ -48,7 +48,7 @@ function getArrowOptions(
48
48
  };
49
49
  }
50
50
 
51
- export function addArrowsToContext(
51
+ export async function addArrowsToContext(
52
52
  feature: Feature,
53
53
  style: ArrowStyle,
54
54
  validGeometries: LineString[],
@@ -56,7 +56,7 @@ export function addArrowsToContext(
56
56
  scene: Scene,
57
57
  lineGeometryFactory: VectorGeometryFactoryType,
58
58
  context: CesiumVectorContext,
59
- ): void {
59
+ ): Promise<void> {
60
60
  if (style.end === ArrowEnd.NONE || !style.primitiveOptions?.geometryOptions) {
61
61
  return;
62
62
  }
@@ -88,39 +88,41 @@ export function addArrowsToContext(
88
88
  const usedStyle = style.getOlcsStyle();
89
89
  const allowPicking = vectorProperties.getAllowPicking(feature);
90
90
 
91
- arrowOptions.forEach((arrowOption) => {
92
- const arrowFeature = new Feature({
93
- ...feature.getProperties(),
94
- olcs_primitiveOptions: style.primitiveOptions,
95
- olcs_modelHeading: arrowOption.heading,
96
- olcs_modelPitch: arrowOption.pitch,
97
- geometry: new Point(arrowOption.location),
98
- olcs_modelAutoScale: true,
99
- });
91
+ await Promise.all(
92
+ arrowOptions.map(async (arrowOption) => {
93
+ const arrowFeature = new Feature({
94
+ ...feature.getProperties(),
95
+ olcs_primitiveOptions: style.primitiveOptions,
96
+ olcs_modelHeading: arrowOption.heading,
97
+ olcs_modelPitch: arrowOption.pitch,
98
+ geometry: new Point(arrowOption.location),
99
+ olcs_modelAutoScale: true,
100
+ });
100
101
 
101
- const wgs84Position = Projection.mercatorToWgs84(arrowOption.location);
102
- const cartesianLocation = Cartesian3.fromDegrees(
103
- wgs84Position[0],
104
- wgs84Position[1],
105
- wgs84Position[2],
106
- );
107
- const primitiveOptions = getPrimitiveOptions(
108
- arrowFeature,
109
- usedStyle,
110
- [wgs84Position],
111
- [cartesianLocation],
112
- vectorProperties,
113
- scene,
114
- );
115
-
116
- if (primitiveOptions?.primitives) {
117
- context.addScaledPrimitives(
118
- primitiveOptions.primitives,
119
- feature,
120
- allowPicking,
102
+ const wgs84Position = Projection.mercatorToWgs84(arrowOption.location);
103
+ const cartesianLocation = Cartesian3.fromDegrees(
104
+ wgs84Position[0],
105
+ wgs84Position[1],
106
+ wgs84Position[2],
121
107
  );
122
- }
123
- });
108
+ const primitiveOptions = await getPrimitiveOptions(
109
+ arrowFeature,
110
+ usedStyle,
111
+ [wgs84Position],
112
+ [cartesianLocation],
113
+ vectorProperties,
114
+ scene,
115
+ );
116
+
117
+ if (primitiveOptions?.primitives) {
118
+ context.addScaledPrimitives(
119
+ primitiveOptions.primitives,
120
+ feature,
121
+ allowPicking,
122
+ );
123
+ }
124
+ }),
125
+ );
124
126
  }
125
127
 
126
128
  export type LineGeometryOptions = { positions: Cartesian3[] };
@@ -266,14 +268,14 @@ export function validateLineString(lineString: LineString): boolean {
266
268
  * @param scene
267
269
  * @param context
268
270
  */
269
- export default function lineStringToCesium(
271
+ export default async function lineStringToCesium(
270
272
  feature: Feature,
271
273
  style: Style,
272
274
  geometries: LineString[],
273
275
  vectorProperties: VectorProperties,
274
276
  scene: Scene,
275
277
  context: CesiumVectorContext,
276
- ): void {
278
+ ): Promise<void> {
277
279
  if (!style.getFill() && !style.getStroke()) {
278
280
  return;
279
281
  }
@@ -291,7 +293,7 @@ export default function lineStringToCesium(
291
293
  context,
292
294
  );
293
295
  if (style instanceof ArrowStyle) {
294
- addArrowsToContext(
296
+ await addArrowsToContext(
295
297
  feature,
296
298
  style,
297
299
  validGeometries,
@@ -118,13 +118,16 @@ async function placePrimitiveOnTerrain(
118
118
  .catch(() => {});
119
119
  }
120
120
 
121
- export function getModelOptions(
121
+ export async function getModelOptions(
122
122
  feature: Feature,
123
123
  wgs84Positions: Coordinate[],
124
124
  positions: Cartesian3[],
125
125
  vectorProperties: VectorProperties,
126
126
  scene: Scene,
127
- ): null | { primitives: Model[]; options: VectorPropertiesModelOptions } {
127
+ ): Promise<null | {
128
+ primitives: Model[];
129
+ options: VectorPropertiesModelOptions;
130
+ }> {
128
131
  const options = vectorProperties.getModel(feature);
129
132
  if (!options) {
130
133
  return null;
@@ -136,43 +139,52 @@ export function getModelOptions(
136
139
  options.roll,
137
140
  );
138
141
  const allowPicking = vectorProperties.getAllowPicking(feature);
139
- const primitives = positions.map((position, index) => {
140
- const modelMatrix = Matrix4.multiply(
141
- Transforms.headingPitchRollToFixedFrame(position, headingPitchRoll),
142
- Matrix4.fromScale(scale),
143
- new Matrix4(),
144
- );
142
+ const primitives = await Promise.all(
143
+ positions.map(async (position, index) => {
144
+ const modelMatrix = Matrix4.multiply(
145
+ Transforms.headingPitchRollToFixedFrame(position, headingPitchRoll),
146
+ Matrix4.fromScale(scale),
147
+ new Matrix4(),
148
+ );
145
149
 
146
- const additionalModelOptions = vectorProperties.getModelOptions(feature);
147
- const heightReference = vectorProperties.getAltitudeMode(feature);
148
- const model = Model.fromGltf({
149
- asynchronous: !feature[createSync],
150
- url: options.url,
151
- modelMatrix,
152
- allowPicking,
153
- ...additionalModelOptions,
154
- });
150
+ const additionalModelOptions = vectorProperties.getModelOptions(feature);
151
+ const heightReference = vectorProperties.getAltitudeMode(feature);
152
+ const model = await Model.fromGltfAsync({
153
+ asynchronous: !feature[createSync],
154
+ url: options.url,
155
+ modelMatrix,
156
+ allowPicking,
157
+ ...additionalModelOptions,
158
+ });
155
159
 
156
- if (
157
- wgs84Positions[index][2] == null ||
158
- heightReference === HeightReference.CLAMP_TO_GROUND
159
- ) {
160
- // eslint-disable-next-line no-void
161
- void placePrimitiveOnTerrain(model, position, scene);
162
- }
160
+ if (
161
+ wgs84Positions[index][2] == null ||
162
+ heightReference === HeightReference.CLAMP_TO_GROUND
163
+ ) {
164
+ await placePrimitiveOnTerrain(model, position, scene);
165
+ }
163
166
 
164
- // eslint-disable-next-line no-void
165
- void model.readyPromise.then(() => {
166
- model.activeAnimations.addAll({
167
- loop: ModelAnimationLoop.REPEAT,
168
- });
169
- });
167
+ const activateAnimations = (): void => {
168
+ model.activeAnimations.addAll({
169
+ loop: ModelAnimationLoop.REPEAT,
170
+ });
171
+ };
170
172
 
171
- if (options.autoScale && !Cartesian3.ONE.equals(scale)) {
172
- makeScaledAutoScalePrimitive(model, scale);
173
- }
174
- return model;
175
- });
173
+ if (model.ready) {
174
+ activateAnimations();
175
+ } else {
176
+ const listener = model.readyEvent.addEventListener(() => {
177
+ listener();
178
+ activateAnimations();
179
+ });
180
+ }
181
+
182
+ if (options.autoScale && !Cartesian3.ONE.equals(scale)) {
183
+ makeScaledAutoScalePrimitive(model, scale);
184
+ }
185
+ return model;
186
+ }),
187
+ );
176
188
 
177
189
  return {
178
190
  primitives,
@@ -237,14 +249,17 @@ function getGeometryInstanceFromOptions(
237
249
  return null;
238
250
  }
239
251
 
240
- export function getPrimitiveOptions(
252
+ export async function getPrimitiveOptions(
241
253
  feature: Feature,
242
254
  style: Style,
243
255
  wgs84Positions: Coordinate[],
244
256
  positions: Cartesian3[],
245
257
  vectorProperties: VectorProperties,
246
258
  scene: Scene,
247
- ): null | { primitives: Primitive[]; options: VectorPropertiesPrimitive } {
259
+ ): Promise<null | {
260
+ primitives: Primitive[];
261
+ options: VectorPropertiesPrimitive;
262
+ }> {
248
263
  const options = vectorProperties.getPrimitive(feature);
249
264
  if (!options) {
250
265
  return null;
@@ -281,127 +296,134 @@ export function getPrimitiveOptions(
281
296
  options.roll,
282
297
  );
283
298
  const allowPicking = vectorProperties.getAllowPicking(feature);
299
+ const heightReference = vectorProperties.getAltitudeMode(feature);
284
300
 
285
- const primitives = positions.flatMap((position, index) => {
286
- const geometryModelMatrix = Matrix4.fromScale(scale);
287
- let offset: Cartesian3 | undefined;
288
- if (options.primitiveOptions.offset?.length === 3) {
289
- offset = Cartesian3.fromArray(options.primitiveOptions.offset);
290
- Matrix4.setTranslation(
291
- geometryModelMatrix,
292
- Cartesian3.multiplyComponents(offset, scale, new Cartesian3()),
293
- geometryModelMatrix,
301
+ const primitives = await Promise.all(
302
+ positions.map(async (position, index) => {
303
+ const geometryModelMatrix = Matrix4.fromScale(scale);
304
+ let offset: Cartesian3 | undefined;
305
+ if (options.primitiveOptions.offset?.length === 3) {
306
+ offset = Cartesian3.fromArray(options.primitiveOptions.offset);
307
+ Matrix4.setTranslation(
308
+ geometryModelMatrix,
309
+ Cartesian3.multiplyComponents(offset, scale, new Cartesian3()),
310
+ geometryModelMatrix,
311
+ );
312
+ }
313
+ const transform = Transforms.headingPitchRollToFixedFrame(
314
+ position,
315
+ headingPitchRoll,
294
316
  );
295
- }
296
- const transform = Transforms.headingPitchRollToFixedFrame(
297
- position,
298
- headingPitchRoll,
299
- );
300
- const modelMatrix = Matrix4.multiply(
301
- transform,
302
- geometryModelMatrix,
303
- new Matrix4(),
304
- );
305
-
306
- let depthFail;
307
- if (options.primitiveOptions.depthFailColor) {
308
- const depthFailColor = getCesiumColor(
309
- options.primitiveOptions.depthFailColor,
310
- [255, 255, 255, 0.4],
317
+ const modelMatrix = Matrix4.multiply(
318
+ transform,
319
+ geometryModelMatrix,
320
+ new Matrix4(),
311
321
  );
312
- depthFail = new MaterialAppearance({
313
- translucent: depthFailColor.alpha < 1,
314
- material: Material.fromType('Color', {
315
- color: depthFailColor,
316
- }),
317
- });
318
- }
319
-
320
- const createPrimitive = (
321
- translucent: boolean,
322
- geometryInstances: (GeometryInstance | null)[],
323
- depthFailAppearance?: MaterialAppearance,
324
- ): Primitive => {
325
- const primitive = new Primitive({
326
- asynchronous: !feature[createSync],
327
- geometryInstances: geometryInstances.filter(
328
- (g) => g,
329
- ) as GeometryInstance[],
330
- modelMatrix,
331
- appearance: new PerInstanceColorAppearance({
332
- translucent,
333
- flat: true,
334
- }),
335
- depthFailAppearance,
336
- allowPicking,
337
- ...options.primitiveOptions.additionalOptions,
338
- });
339
322
 
340
- if (!wgs84Positions[index][2]) {
341
- // eslint-disable-next-line no-void
342
- void placePrimitiveOnTerrain(primitive, position, scene, offset).then(
343
- () => {
344
- Transforms.headingPitchRollToFixedFrame(
345
- position,
346
- headingPitchRoll,
347
- undefined,
348
- undefined,
349
- transform,
350
- ); // update transform for usage in offset auto scale
351
- },
323
+ let depthFail;
324
+ if (options.primitiveOptions.depthFailColor) {
325
+ const depthFailColor = getCesiumColor(
326
+ options.primitiveOptions.depthFailColor,
327
+ [255, 255, 255, 0.4],
352
328
  );
329
+ depthFail = new MaterialAppearance({
330
+ translucent: depthFailColor.alpha < 1,
331
+ material: Material.fromType('Color', {
332
+ color: depthFailColor,
333
+ }),
334
+ });
353
335
  }
354
336
 
355
- if (options.autoScale) {
356
- if (offset) {
357
- makeOffsetAutoScalePrimitive(primitive, transform, scale, offset);
358
- } else if (!Cartesian3.ONE.equals(scale)) {
359
- makeScaledAutoScalePrimitive(primitive, scale);
337
+ const createPrimitive = async (
338
+ translucent: boolean,
339
+ geometryInstances: (GeometryInstance | null)[],
340
+ depthFailAppearance?: MaterialAppearance,
341
+ ): Promise<Primitive> => {
342
+ const primitive = new Primitive({
343
+ asynchronous: !feature[createSync],
344
+ geometryInstances: geometryInstances.filter(
345
+ (g) => g,
346
+ ) as GeometryInstance[],
347
+ modelMatrix,
348
+ appearance: new PerInstanceColorAppearance({
349
+ translucent,
350
+ flat: true,
351
+ }),
352
+ depthFailAppearance,
353
+ allowPicking,
354
+ ...options.primitiveOptions.additionalOptions,
355
+ });
356
+
357
+ if (
358
+ wgs84Positions[index][2] == null ||
359
+ heightReference === HeightReference.CLAMP_TO_GROUND
360
+ ) {
361
+ await placePrimitiveOnTerrain(primitive, position, scene, offset);
362
+ Transforms.headingPitchRollToFixedFrame(
363
+ position,
364
+ headingPitchRoll,
365
+ undefined,
366
+ undefined,
367
+ transform,
368
+ ); // update transform for usage in offset auto scale
360
369
  }
361
- }
362
- return primitive;
363
- };
364
370
 
365
- const fillAndOutline = [];
366
- if (fillColor) {
367
- fillAndOutline.push(
368
- createPrimitive(
369
- fillColor.alpha < 1 || !!depthFail,
370
- [getGeometryInstanceFromOptions(options.primitiveOptions, fillColor)],
371
- depthFail,
372
- ),
373
- );
374
- } else if (depthFail) {
375
- const transparent = Color.TRANSPARENT;
376
- fillAndOutline.push(
377
- createPrimitive(
378
- true,
379
- [
371
+ if (options.autoScale) {
372
+ if (offset) {
373
+ makeOffsetAutoScalePrimitive(primitive, transform, scale, offset);
374
+ } else if (!Cartesian3.ONE.equals(scale)) {
375
+ makeScaledAutoScalePrimitive(primitive, scale);
376
+ }
377
+ }
378
+ return primitive;
379
+ };
380
+
381
+ const fillAndOutline = [];
382
+ if (fillColor) {
383
+ fillAndOutline.push(
384
+ createPrimitive(
385
+ fillColor.alpha < 1 || !!depthFail,
386
+ [
387
+ getGeometryInstanceFromOptions(
388
+ options.primitiveOptions,
389
+ fillColor,
390
+ ),
391
+ ],
392
+ depthFail,
393
+ ),
394
+ );
395
+ } else if (depthFail) {
396
+ const transparent = Color.TRANSPARENT;
397
+ fillAndOutline.push(
398
+ createPrimitive(
399
+ true,
400
+ [
401
+ getGeometryInstanceFromOptions(
402
+ options.primitiveOptions,
403
+ transparent,
404
+ ),
405
+ ],
406
+ depthFail,
407
+ ),
408
+ );
409
+ }
410
+ if (strokeColor) {
411
+ fillAndOutline.push(
412
+ createPrimitive(strokeColor.alpha < 1 || !!depthFail, [
380
413
  getGeometryInstanceFromOptions(
381
414
  options.primitiveOptions,
382
- transparent,
415
+ strokeColor,
416
+ true,
383
417
  ),
384
- ],
385
- depthFail,
386
- ),
387
- );
388
- }
389
- if (strokeColor) {
390
- fillAndOutline.push(
391
- createPrimitive(strokeColor.alpha < 1 || !!depthFail, [
392
- getGeometryInstanceFromOptions(
393
- options.primitiveOptions,
394
- strokeColor,
395
- true,
396
- ),
397
- ]),
398
- );
399
- }
400
- return fillAndOutline;
401
- });
418
+ ]),
419
+ );
420
+ }
421
+ return Promise.all(fillAndOutline);
422
+ }),
423
+ );
402
424
 
403
425
  return {
404
- primitives,
426
+ primitives: primitives.flatMap((p) => p),
405
427
  options,
406
428
  };
407
429
  }
@@ -271,14 +271,14 @@ export function getLineGeometries(
271
271
  return lineGeometries;
272
272
  }
273
273
 
274
- export default function pointToCesium(
274
+ export default async function pointToCesium(
275
275
  feature: Feature,
276
276
  style: Style,
277
277
  geometries: Point[],
278
278
  vectorProperties: VectorProperties,
279
279
  scene: Scene,
280
280
  context: CesiumVectorContext,
281
- ): void {
281
+ ): Promise<void> {
282
282
  if (!style.getImage() && !(style.getText() && style.getText().getText())) {
283
283
  return;
284
284
  }
@@ -301,7 +301,7 @@ export default function pointToCesium(
301
301
 
302
302
  let modelOrPrimitiveOptions = null;
303
303
  if (feature.get('olcs_modelUrl')) {
304
- modelOrPrimitiveOptions = getModelOptions(
304
+ modelOrPrimitiveOptions = await getModelOptions(
305
305
  feature,
306
306
  wgs84Positions,
307
307
  positions,
@@ -309,7 +309,7 @@ export default function pointToCesium(
309
309
  scene,
310
310
  );
311
311
  } else if (feature.get('olcs_primitiveOptions')) {
312
- modelOrPrimitiveOptions = getPrimitiveOptions(
312
+ modelOrPrimitiveOptions = await getPrimitiveOptions(
313
313
  feature,
314
314
  style,
315
315
  wgs84Positions,
@@ -319,21 +319,21 @@ export default function pointToCesium(
319
319
  );
320
320
  } else {
321
321
  modelOrPrimitiveOptions =
322
- getModelOptions(
322
+ (await getModelOptions(
323
323
  feature,
324
324
  wgs84Positions,
325
325
  positions,
326
326
  vectorProperties,
327
327
  scene,
328
- ) ??
329
- getPrimitiveOptions(
328
+ )) ??
329
+ (await getPrimitiveOptions(
330
330
  feature,
331
331
  style,
332
332
  wgs84Positions,
333
333
  positions,
334
334
  vectorProperties,
335
335
  scene,
336
- );
336
+ ));
337
337
  }
338
338
 
339
339
  if (heightInfo.extruded && style.getStroke()) {
@@ -7,6 +7,7 @@ import {
7
7
  PolygonHierarchy,
8
8
  PolylineGeometry,
9
9
  type Scene,
10
+ Cartographic,
10
11
  } from '@vcmap-cesium/engine';
11
12
  import type { Style } from 'ol/style.js';
12
13
  import type { Polygon } from 'ol/geom.js';
@@ -73,19 +74,32 @@ export function createFillGeometries(
73
74
  export function getLineGeometryOptions(
74
75
  options: PolygonGeometryOptions,
75
76
  style: Style,
77
+ groundLevel?: number,
76
78
  ): PolylineGeometryOptions[] {
77
79
  const width = parseNumber(style.getStroke().getWidth(), 1.0);
78
80
  const geometryOptions: PolylineGeometryOptions[] = [];
81
+
79
82
  geometryOptions.push({
80
83
  positions: options.polygonHierarchy.positions,
81
84
  width,
82
85
  });
86
+
83
87
  options.polygonHierarchy.holes.forEach((polygonHierarchy) => {
84
88
  geometryOptions.push({
85
89
  positions: polygonHierarchy.positions,
86
90
  width,
87
91
  });
88
92
  });
93
+
94
+ if (groundLevel) {
95
+ geometryOptions.forEach((polylineOptions) => {
96
+ polylineOptions.positions = polylineOptions.positions.map((c) => {
97
+ const geographic = Cartographic.fromCartesian(c);
98
+ geographic.height = groundLevel;
99
+ return Cartographic.toCartesian(geographic);
100
+ });
101
+ });
102
+ }
89
103
  return geometryOptions;
90
104
  }
91
105
 
@@ -100,8 +114,9 @@ export function createGroundLineGeometries(
100
114
  export function createLineGeometries(
101
115
  options: PolygonGeometryOptions,
102
116
  style: Style,
117
+ groundLevel?: number,
103
118
  ): PolylineGeometry[] {
104
- return getLineGeometryOptions(options, style).map((option) => {
119
+ return getLineGeometryOptions(options, style, groundLevel).map((option) => {
105
120
  return new PolylineGeometry(option);
106
121
  });
107
122
  }