@vcmap/core 5.1.1 → 5.1.3
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/cesium.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/category/category.js.map +1 -1
- package/dist/src/style/declarativeStyleItem.d.ts +1 -1
- package/dist/src/style/modelFill.d.ts +6 -0
- package/dist/src/style/modelFill.js +13 -0
- package/dist/src/style/modelFill.js.map +1 -0
- package/dist/src/style/styleFactory.js +1 -1
- package/dist/src/style/styleFactory.js.map +1 -1
- package/dist/src/style/vectorStyleItem.d.ts +7 -2
- package/dist/src/style/vectorStyleItem.js +6 -2
- package/dist/src/style/vectorStyleItem.js.map +1 -1
- package/dist/src/util/clipping/clippingObject.d.ts +1 -1
- package/dist/src/util/clipping/clippingObject.js +11 -8
- package/dist/src/util/clipping/clippingObject.js.map +1 -1
- package/dist/src/util/clipping/clippingObjectManager.js +3 -3
- package/dist/src/util/clipping/clippingObjectManager.js.map +1 -1
- package/dist/src/util/editor/editGeometrySession.js +6 -10
- package/dist/src/util/editor/editGeometrySession.js.map +1 -1
- package/dist/src/util/editor/interactions/translateVertexInteraction.d.ts +3 -1
- package/dist/src/util/editor/interactions/translateVertexInteraction.js +5 -1
- package/dist/src/util/editor/interactions/translateVertexInteraction.js.map +1 -1
- package/dist/src/util/editor/selectFeaturesSession.js +3 -2
- package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
- package/dist/src/util/featureconverter/pointHelpers.d.ts +1 -1
- package/dist/src/util/featureconverter/pointHelpers.js +12 -1
- package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
- package/dist/src/util/featureconverter/pointToCesium.js +2 -2
- package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
- package/dist/src/util/flight/flightAnchor.js +1 -1
- package/dist/src/util/flight/flightAnchor.js.map +1 -1
- package/dist/src/util/flight/flightPlayer.js +28 -10
- package/dist/src/util/flight/flightPlayer.js.map +1 -1
- package/dist/tests/unit/helpers/cesiumHelpers.d.ts +4 -46
- package/dist/tests/unit/helpers/cesiumHelpers.js +3 -0
- package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
- package/dist/tests/unit/helpers/terrain/terrainData.d.ts +2 -2
- package/dist/tests/unit/helpers/terrain/terrainData.js +1 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/category/category.ts +1 -1
- package/src/cesium/cesium.d.ts +1 -0
- package/src/style/declarativeStyleItem.ts +1 -1
- package/src/style/modelFill.ts +15 -0
- package/src/style/styleFactory.ts +1 -1
- package/src/style/vectorStyleItem.ts +14 -4
- package/src/util/clipping/clippingObject.ts +12 -11
- package/src/util/clipping/clippingObjectManager.ts +7 -5
- package/src/util/editor/editGeometrySession.ts +6 -10
- package/src/util/editor/interactions/translateVertexInteraction.ts +7 -1
- package/src/util/editor/selectFeaturesSession.ts +3 -2
- package/src/util/featureconverter/pointHelpers.ts +13 -0
- package/src/util/featureconverter/pointToCesium.ts +2 -0
- package/src/util/flight/flightAnchor.ts +1 -1
- package/src/util/flight/flightPlayer.ts +42 -16
|
@@ -31,7 +31,7 @@ export function setTerrainServer(scope) {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* @param {Scope} scope
|
|
34
|
-
* @returns {Promise<cesium/CesiumTerrainProvider>}
|
|
34
|
+
* @returns {Promise<import("@vcmap-cesium/engine").CesiumTerrainProvider>}
|
|
35
35
|
*/
|
|
36
36
|
export async function getTerrainProvider(scope) {
|
|
37
37
|
setTerrainServer(scope);
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/src/category/category.ts
CHANGED
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
} from '../classRegistry.js';
|
|
21
21
|
import OverrideClassRegistry from '../overrideClassRegistry.js';
|
|
22
22
|
import VcsEvent from '../vcsEvent.js';
|
|
23
|
-
import type VectorStyleItem from '../style/vectorStyleItem.js';
|
|
24
23
|
import type VcsApp from '../vcsApp.js';
|
|
25
24
|
import { markVolatile } from '../vcsModule.js';
|
|
25
|
+
import type VectorStyleItem from '../style/vectorStyleItem.js';
|
|
26
26
|
|
|
27
27
|
export type CategoryOptions<T extends VcsObject | object> = VcsObjectOptions & {
|
|
28
28
|
title?: string;
|
package/src/cesium/cesium.d.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fill } from 'ol/style.js';
|
|
2
|
+
|
|
3
|
+
class ModelFill extends Fill {
|
|
4
|
+
static fromFill(fill: Fill): ModelFill {
|
|
5
|
+
return new ModelFill({ color: fill.getColor() });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
toFill(result?: Fill): Fill {
|
|
9
|
+
const fill = result ?? new Fill();
|
|
10
|
+
fill.setColor(this.getColor());
|
|
11
|
+
return fill;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default ModelFill;
|
|
@@ -27,7 +27,7 @@ export function getStyleOrDefaultStyle(
|
|
|
27
27
|
styleItem instanceof VectorStyleItem &&
|
|
28
28
|
defaultStyle instanceof VectorStyleItem
|
|
29
29
|
) {
|
|
30
|
-
return defaultStyle.assign(styleItem);
|
|
30
|
+
return styleItem.assign(defaultStyle.clone().assign(styleItem));
|
|
31
31
|
}
|
|
32
32
|
return styleItem;
|
|
33
33
|
}
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { getShapeFromOptions } from './shapesCategory.js';
|
|
34
34
|
import { styleClassRegistry } from '../classRegistry.js';
|
|
35
35
|
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
36
|
+
import ModelFill from './modelFill.js';
|
|
36
37
|
|
|
37
38
|
export type ColorType = OLColor | OLColorLike;
|
|
38
39
|
export type VectorStyleItemPattern = {
|
|
@@ -45,6 +46,12 @@ export type VectorStyleItemPattern = {
|
|
|
45
46
|
export type VectorStyleItemFill = {
|
|
46
47
|
color: ColorType;
|
|
47
48
|
pattern?: VectorStyleItemPattern;
|
|
49
|
+
type?: 'fill' | 'modelFill';
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type VectorStyleItemStroke = {
|
|
53
|
+
width?: number;
|
|
54
|
+
color?: ColorType;
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
export type VectorStyleItemImage = {
|
|
@@ -87,7 +94,7 @@ export enum OlcsGeometryType {
|
|
|
87
94
|
|
|
88
95
|
export type VectorStyleItemOptions = StyleItemOptions & {
|
|
89
96
|
fill?: VectorStyleItemFill | false;
|
|
90
|
-
stroke?: StrokeOptions | false;
|
|
97
|
+
stroke?: StrokeOptions | VectorStyleItemStroke | false;
|
|
91
98
|
image?: VectorStyleItemImage | false;
|
|
92
99
|
text?: VectorStyleItemText;
|
|
93
100
|
label?: string;
|
|
@@ -104,7 +111,7 @@ export const vectorStyleSymbol: unique symbol = Symbol('VcsVectorStyleItem');
|
|
|
104
111
|
* @group Style
|
|
105
112
|
*/
|
|
106
113
|
class VectorStyleItem extends StyleItem {
|
|
107
|
-
static get className():
|
|
114
|
+
static get className(): 'VectorStyleItem' {
|
|
108
115
|
return 'VectorStyleItem';
|
|
109
116
|
}
|
|
110
117
|
|
|
@@ -171,7 +178,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
171
178
|
});
|
|
172
179
|
|
|
173
180
|
if (options.fill) {
|
|
174
|
-
this._fillOptions = options.fill;
|
|
181
|
+
this._fillOptions = structuredClone(options.fill);
|
|
175
182
|
this._setFill();
|
|
176
183
|
} else {
|
|
177
184
|
this.updateCesiumStyle();
|
|
@@ -446,7 +453,10 @@ class VectorStyleItem extends StyleItem {
|
|
|
446
453
|
if (this._fill) {
|
|
447
454
|
this._fill.setColor(color);
|
|
448
455
|
} else {
|
|
449
|
-
this._fill =
|
|
456
|
+
this._fill =
|
|
457
|
+
this._fillOptions?.type === 'modelFill'
|
|
458
|
+
? new ModelFill({ color })
|
|
459
|
+
: new Fill({ color });
|
|
450
460
|
this._style.setFill(this._fill);
|
|
451
461
|
}
|
|
452
462
|
|
|
@@ -14,9 +14,10 @@ import { getLogger as getLoggerByName, type Logger } from '@vcsuite/logger';
|
|
|
14
14
|
import CesiumMap from '../../map/cesiumMap.js';
|
|
15
15
|
import VcsEvent from '../../vcsEvent.js';
|
|
16
16
|
import LayerCollection from '../layerCollection.js';
|
|
17
|
-
import
|
|
17
|
+
import FeatureStoreLayer from '../../layer/featureStoreLayer.js';
|
|
18
18
|
import type VcsMap from '../../map/vcsMap.js';
|
|
19
19
|
import type Layer from '../../layer/layer.js';
|
|
20
|
+
import CesiumTilesetLayer from '../../layer/cesiumTilesetLayer.js';
|
|
20
21
|
|
|
21
22
|
export type ClippingObjectEntityOption = {
|
|
22
23
|
layerName: string;
|
|
@@ -83,7 +84,8 @@ class ClippingObject {
|
|
|
83
84
|
*/
|
|
84
85
|
clippingPlaneUpdated = new VcsEvent<void>();
|
|
85
86
|
|
|
86
|
-
private
|
|
87
|
+
private _cachedLayers: Set<FeatureStoreLayer | CesiumTilesetLayer> =
|
|
88
|
+
new Set();
|
|
87
89
|
|
|
88
90
|
private _activeMap: VcsMap | null = null;
|
|
89
91
|
|
|
@@ -231,14 +233,13 @@ class ClippingObject {
|
|
|
231
233
|
}
|
|
232
234
|
} else if (
|
|
233
235
|
this.layerNames.includes(layer.name) &&
|
|
234
|
-
layer
|
|
236
|
+
(layer instanceof FeatureStoreLayer ||
|
|
237
|
+
layer instanceof CesiumTilesetLayer)
|
|
235
238
|
) {
|
|
236
239
|
if (layer.active) {
|
|
237
|
-
this.
|
|
238
|
-
} else if (
|
|
239
|
-
this.
|
|
240
|
-
) {
|
|
241
|
-
this._cachedFeatureStoreLayers.delete(layer as FeatureStoreLayer);
|
|
240
|
+
this._cachedLayers.add(layer);
|
|
241
|
+
} else if (this._cachedLayers.has(layer)) {
|
|
242
|
+
this._cachedLayers.delete(layer);
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
245
|
}
|
|
@@ -259,11 +260,11 @@ class ClippingObject {
|
|
|
259
260
|
this.targetsUpdated.raiseEvent();
|
|
260
261
|
}
|
|
261
262
|
|
|
262
|
-
if (this.
|
|
263
|
-
this.
|
|
263
|
+
if (this._cachedLayers.size > 0) {
|
|
264
|
+
this._cachedLayers.forEach((layer) => {
|
|
264
265
|
this.handleLayerChanged(layer);
|
|
265
266
|
});
|
|
266
|
-
this.
|
|
267
|
+
this._cachedLayers.clear();
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
this._activeMap = map;
|
|
@@ -109,13 +109,14 @@ class ClippingObjectManager {
|
|
|
109
109
|
if (this.hasClippingObject(clippingObject)) {
|
|
110
110
|
throw new Error('ClippingObject already managed, remove it first');
|
|
111
111
|
}
|
|
112
|
-
clippingObject.setLayerCollection(this._layerCollection);
|
|
113
|
-
|
|
114
|
-
this._defaultClippingObjects.add(clippingObject);
|
|
115
112
|
if (this._activeMap instanceof CesiumMap) {
|
|
116
113
|
clippingObject.handleMapChanged(this._activeMap);
|
|
117
114
|
}
|
|
118
115
|
|
|
116
|
+
clippingObject.setLayerCollection(this._layerCollection);
|
|
117
|
+
|
|
118
|
+
this._defaultClippingObjects.add(clippingObject);
|
|
119
|
+
|
|
119
120
|
this._listenersMap.set(clippingObject, [
|
|
120
121
|
clippingObject.targetsUpdated.addEventListener(this._update.bind(this)),
|
|
121
122
|
clippingObject.clippingPlaneUpdated.addEventListener(
|
|
@@ -181,11 +182,12 @@ class ClippingObjectManager {
|
|
|
181
182
|
this._exclusiveRemovedCb = removedCb;
|
|
182
183
|
this._exclusiveClippingObjects = clippingObjects;
|
|
183
184
|
this._exclusiveClippingObjects.forEach((clippingObject) => {
|
|
184
|
-
clippingObject.setLayerCollection(this._layerCollection);
|
|
185
|
-
|
|
186
185
|
if (this._activeMap instanceof CesiumMap) {
|
|
187
186
|
clippingObject.handleMapChanged(this._activeMap);
|
|
188
187
|
}
|
|
188
|
+
|
|
189
|
+
clippingObject.setLayerCollection(this._layerCollection);
|
|
190
|
+
|
|
189
191
|
this._listenersMap.set(clippingObject, [
|
|
190
192
|
clippingObject.targetsUpdated.addEventListener(this._update.bind(this)),
|
|
191
193
|
clippingObject.clippingPlaneUpdated.addEventListener(
|
|
@@ -81,7 +81,7 @@ function createEditLineStringGeometryInteraction(
|
|
|
81
81
|
vertices.map((f) => f.getGeometry()!.getCoordinates()),
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
|
-
const translateVertex = new TranslateVertexInteraction();
|
|
84
|
+
const translateVertex = new TranslateVertexInteraction(feature);
|
|
85
85
|
translateVertex.vertexChanged.addEventListener(resetGeometry);
|
|
86
86
|
|
|
87
87
|
const insertVertex = new InsertVertexInteraction(feature, geometry);
|
|
@@ -130,7 +130,7 @@ function createEditCircleGeometryInteraction(
|
|
|
130
130
|
.map((c) => createVertex(c, olcsProps));
|
|
131
131
|
scratchLayer.addFeatures(vertices);
|
|
132
132
|
|
|
133
|
-
const translateVertex = new TranslateVertexInteraction();
|
|
133
|
+
const translateVertex = new TranslateVertexInteraction(feature);
|
|
134
134
|
let suspend = false;
|
|
135
135
|
translateVertex.vertexChanged.addEventListener((vertex) => {
|
|
136
136
|
suspend = true;
|
|
@@ -181,7 +181,7 @@ function createEditBBoxGeometryInteraction(
|
|
|
181
181
|
|
|
182
182
|
scratchLayer.addFeatures(vertices);
|
|
183
183
|
let suspend = false;
|
|
184
|
-
const translateVertex = new TranslateVertexInteraction();
|
|
184
|
+
const translateVertex = new TranslateVertexInteraction(feature);
|
|
185
185
|
translateVertex.vertexChanged.addEventListener((vertex) => {
|
|
186
186
|
const vertexIndex = vertices.indexOf(vertex);
|
|
187
187
|
const originIndex = modulo(vertexIndex + 2, 4);
|
|
@@ -268,7 +268,7 @@ function createEditSimplePolygonInteraction(
|
|
|
268
268
|
]); // update actual geometry, since linear ring is a clone and not a ref
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
-
const translateVertex = new TranslateVertexInteraction();
|
|
271
|
+
const translateVertex = new TranslateVertexInteraction(feature);
|
|
272
272
|
translateVertex.vertexChanged.addEventListener(resetGeometry);
|
|
273
273
|
|
|
274
274
|
const insertVertex = new InsertVertexInteraction(feature, linearRing);
|
|
@@ -318,13 +318,11 @@ function createEditPointInteraction(
|
|
|
318
318
|
layer.featureVisibility.hideObjects(featureIdArray);
|
|
319
319
|
vertex[createSync] = true;
|
|
320
320
|
scratchLayer.addFeatures([vertex]);
|
|
321
|
-
const translateVertex = new TranslateVertexInteraction();
|
|
321
|
+
const translateVertex = new TranslateVertexInteraction(feature);
|
|
322
322
|
let suspend = false;
|
|
323
323
|
translateVertex.vertexChanged.addEventListener(() => {
|
|
324
324
|
suspend = true;
|
|
325
|
-
|
|
326
|
-
.getGeometry()!
|
|
327
|
-
.setCoordinates(vertex.getGeometry()!.getCoordinates());
|
|
325
|
+
geometry.setCoordinates(vertex.getGeometry()!.getCoordinates());
|
|
328
326
|
suspend = false;
|
|
329
327
|
});
|
|
330
328
|
|
|
@@ -425,7 +423,6 @@ function startEditGeometrySession(
|
|
|
425
423
|
if (!geometryIsValid(currentFeature.getGeometry())) {
|
|
426
424
|
layer.removeFeaturesById([currentFeature.getId() as string | number]);
|
|
427
425
|
}
|
|
428
|
-
currentFeature.unset('olcs_allowPicking');
|
|
429
426
|
}
|
|
430
427
|
currentFeature = null;
|
|
431
428
|
altitudeModeChanged();
|
|
@@ -488,7 +485,6 @@ function startEditGeometrySession(
|
|
|
488
485
|
|
|
489
486
|
if (currentInteractionSet) {
|
|
490
487
|
interactionChain.addInteraction(currentInteractionSet.interactionChain);
|
|
491
|
-
currentFeature.set('olcs_allowPicking', false);
|
|
492
488
|
altitudeModeChanged();
|
|
493
489
|
} else {
|
|
494
490
|
getLogger('EditGeometrySession').warning(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Feature from 'ol/Feature.js';
|
|
1
2
|
import AbstractInteraction, {
|
|
2
3
|
EventAfterEventHandler,
|
|
3
4
|
} from '../../../interaction/abstractInteraction.js';
|
|
@@ -16,8 +17,11 @@ class TranslateVertexInteraction extends AbstractInteraction {
|
|
|
16
17
|
|
|
17
18
|
private _vertex: Vertex | null = null;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
private _feature: Feature;
|
|
21
|
+
|
|
22
|
+
constructor(feature: Feature) {
|
|
20
23
|
super(EventType.DRAGEVENTS);
|
|
24
|
+
this._feature = feature;
|
|
21
25
|
this.setActive();
|
|
22
26
|
}
|
|
23
27
|
|
|
@@ -28,6 +32,7 @@ class TranslateVertexInteraction extends AbstractInteraction {
|
|
|
28
32
|
|
|
29
33
|
if (event.type & EventType.DRAGEND) {
|
|
30
34
|
this._vertex.unset('olcs_allowPicking');
|
|
35
|
+
this._feature.unset('olcs_allowPicking');
|
|
31
36
|
this._vertex.setStyle(undefined);
|
|
32
37
|
this._vertex = null;
|
|
33
38
|
}
|
|
@@ -39,6 +44,7 @@ class TranslateVertexInteraction extends AbstractInteraction {
|
|
|
39
44
|
) {
|
|
40
45
|
this._vertex = event.feature as Vertex;
|
|
41
46
|
this._vertex.set('olcs_allowPicking', false);
|
|
47
|
+
this._feature.set('olcs_allowPicking', false);
|
|
42
48
|
this._vertex.setStyle(emptyStyle);
|
|
43
49
|
event.stopPropagation = true;
|
|
44
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { check, ofEnum } from '@vcsuite/check';
|
|
2
|
-
import { Circle,
|
|
2
|
+
import { Circle, Style, Stroke } from 'ol/style.js';
|
|
3
3
|
import type { Feature } from 'ol/index.js';
|
|
4
4
|
import { createSync } from '../../layer/vectorSymbols.js';
|
|
5
5
|
import {
|
|
@@ -19,6 +19,7 @@ import type VectorLayer from '../../layer/vectorLayer.js';
|
|
|
19
19
|
import type VcsApp from '../../vcsApp.js';
|
|
20
20
|
import type VcsMap from '../../map/vcsMap.js';
|
|
21
21
|
import { type HighlightStyleType } from '../../layer/featureVisibility.js';
|
|
22
|
+
import ModelFill from '../../style/modelFill.js';
|
|
22
23
|
|
|
23
24
|
type SelectionHighlightManager = {
|
|
24
25
|
highlightedFeatures: Feature[];
|
|
@@ -104,7 +105,7 @@ function createHighlightManager(
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
export function getDefaultHighlightStyle(): Style {
|
|
107
|
-
const fill = new
|
|
108
|
+
const fill = new ModelFill({ color: 'rgba(76,175,80,0.2)' });
|
|
108
109
|
const stroke = new Stroke({ color: '#4CAF50', width: 2 });
|
|
109
110
|
|
|
110
111
|
return new Style({
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
import type { Feature } from 'ol/index.js';
|
|
29
29
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
30
30
|
import { RegularShape, type Style } from 'ol/style.js';
|
|
31
|
+
import { asColorLike } from 'ol/colorlike.js';
|
|
31
32
|
import { createSync } from '../../layer/vectorSymbols.js';
|
|
32
33
|
import VectorProperties, {
|
|
33
34
|
PrimitiveOptionsType,
|
|
@@ -37,6 +38,7 @@ import VectorProperties, {
|
|
|
37
38
|
VectorPropertiesPrimitiveOptions,
|
|
38
39
|
} from '../../layer/vectorProperties.js';
|
|
39
40
|
import { getCesiumColor } from '../../style/styleHelpers.js';
|
|
41
|
+
import ModelFill from '../../style/modelFill.js';
|
|
40
42
|
|
|
41
43
|
function makeOffsetAutoScalePrimitive(
|
|
42
44
|
primitive: Primitive | Model,
|
|
@@ -124,6 +126,7 @@ export async function getModelOptions(
|
|
|
124
126
|
positions: Cartesian3[],
|
|
125
127
|
vectorProperties: VectorProperties,
|
|
126
128
|
scene: Scene,
|
|
129
|
+
style?: Style,
|
|
127
130
|
): Promise<null | {
|
|
128
131
|
primitives: Model[];
|
|
129
132
|
options: VectorPropertiesModelOptions;
|
|
@@ -139,6 +142,15 @@ export async function getModelOptions(
|
|
|
139
142
|
options.roll,
|
|
140
143
|
);
|
|
141
144
|
const allowPicking = vectorProperties.getAllowPicking(feature);
|
|
145
|
+
const fill = style?.getFill();
|
|
146
|
+
let color: Color | undefined;
|
|
147
|
+
if (fill instanceof ModelFill) {
|
|
148
|
+
const olColor = fill.getColor();
|
|
149
|
+
if (olColor) {
|
|
150
|
+
color = Color.fromCssColorString(asColorLike(olColor) as string);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
142
154
|
const primitives = await Promise.all(
|
|
143
155
|
positions.map(async (position, index) => {
|
|
144
156
|
const modelMatrix = Matrix4.multiply(
|
|
@@ -154,6 +166,7 @@ export async function getModelOptions(
|
|
|
154
166
|
url: options.url,
|
|
155
167
|
modelMatrix,
|
|
156
168
|
allowPicking,
|
|
169
|
+
color,
|
|
157
170
|
...additionalModelOptions,
|
|
158
171
|
});
|
|
159
172
|
|
|
@@ -301,6 +301,7 @@ export default async function pointToCesium(
|
|
|
301
301
|
positions,
|
|
302
302
|
vectorProperties,
|
|
303
303
|
scene,
|
|
304
|
+
style,
|
|
304
305
|
);
|
|
305
306
|
} else if (feature.get('olcs_primitiveOptions')) {
|
|
306
307
|
modelOrPrimitiveOptions = await getPrimitiveOptions(
|
|
@@ -319,6 +320,7 @@ export default async function pointToCesium(
|
|
|
319
320
|
positions,
|
|
320
321
|
vectorProperties,
|
|
321
322
|
scene,
|
|
323
|
+
style,
|
|
322
324
|
)) ??
|
|
323
325
|
(await getPrimitiveOptions(
|
|
324
326
|
feature,
|
|
@@ -147,7 +147,7 @@ export function anchorFromGeojsonFeature(
|
|
|
147
147
|
): FlightAnchor | undefined {
|
|
148
148
|
const options = {
|
|
149
149
|
...feature.properties,
|
|
150
|
-
name: String(feature.id)
|
|
150
|
+
name: feature.id ? String(feature.id) : uuidv4(),
|
|
151
151
|
coordinate: feature.geometry.coordinates,
|
|
152
152
|
};
|
|
153
153
|
if (isOptions(options)) {
|
|
@@ -138,6 +138,27 @@ export async function createFlightPlayer(
|
|
|
138
138
|
}),
|
|
139
139
|
];
|
|
140
140
|
|
|
141
|
+
const getView = (
|
|
142
|
+
time: number,
|
|
143
|
+
):
|
|
144
|
+
| {
|
|
145
|
+
destination: Cartesian3;
|
|
146
|
+
orientation: HeadingPitchRoll;
|
|
147
|
+
}
|
|
148
|
+
| undefined => {
|
|
149
|
+
if (destinationSpline && quaternionSpline) {
|
|
150
|
+
return {
|
|
151
|
+
destination: destinationSpline.evaluate(time) as Cartesian3,
|
|
152
|
+
orientation: HeadingPitchRoll.fromQuaternion(
|
|
153
|
+
quaternionSpline.evaluate(time),
|
|
154
|
+
),
|
|
155
|
+
};
|
|
156
|
+
} else {
|
|
157
|
+
getLogger('FlightPlayer').error('cannot evaluate spline');
|
|
158
|
+
}
|
|
159
|
+
return undefined;
|
|
160
|
+
};
|
|
161
|
+
|
|
141
162
|
const cesiumPostRender = (scene: Scene): void => {
|
|
142
163
|
const time = Date.now() / 1000;
|
|
143
164
|
if (!clock.currentSystemTime) {
|
|
@@ -170,13 +191,11 @@ export async function createFlightPlayer(
|
|
|
170
191
|
}
|
|
171
192
|
}
|
|
172
193
|
|
|
173
|
-
const view =
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
};
|
|
179
|
-
scene.camera.setView(view);
|
|
194
|
+
const view = getView(clock.currentTime);
|
|
195
|
+
if (view) {
|
|
196
|
+
scene.camera.setView(view);
|
|
197
|
+
}
|
|
198
|
+
|
|
180
199
|
if (playerState === 'playing') {
|
|
181
200
|
if (screenSpaceCameraController) {
|
|
182
201
|
screenSpaceCameraController.enableInputs = false;
|
|
@@ -185,6 +204,12 @@ export async function createFlightPlayer(
|
|
|
185
204
|
};
|
|
186
205
|
|
|
187
206
|
const play = (): void => {
|
|
207
|
+
if (!instance.isValid()) {
|
|
208
|
+
getLogger('FlightPlayer').error(
|
|
209
|
+
`cannot play invalid flight ${instance.name}`,
|
|
210
|
+
);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
188
213
|
if (playerState === 'playing') {
|
|
189
214
|
return;
|
|
190
215
|
}
|
|
@@ -215,6 +240,12 @@ export async function createFlightPlayer(
|
|
|
215
240
|
};
|
|
216
241
|
|
|
217
242
|
const goToTime = (time: number): void => {
|
|
243
|
+
if (!instance.isValid()) {
|
|
244
|
+
getLogger('FlightPlayer').error(
|
|
245
|
+
`cannot goToTime of invalid flight ${instance.name}`,
|
|
246
|
+
);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
218
249
|
if (time > clock.endTime) {
|
|
219
250
|
getLogger('FlightPlayer').warning(`time: ${time} out of range`);
|
|
220
251
|
return;
|
|
@@ -222,15 +253,10 @@ export async function createFlightPlayer(
|
|
|
222
253
|
clock.currentTime = time;
|
|
223
254
|
clock.currentSystemTime = undefined;
|
|
224
255
|
if (playerState !== 'playing') {
|
|
225
|
-
const view =
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
orientation: HeadingPitchRoll.fromQuaternion(
|
|
230
|
-
quaternionSpline!.evaluate(clock.currentTime),
|
|
231
|
-
),
|
|
232
|
-
};
|
|
233
|
-
cesiumMap.getScene()?.camera.setView(view);
|
|
256
|
+
const view = getView(clock.currentTime);
|
|
257
|
+
if (view) {
|
|
258
|
+
cesiumMap.getScene()?.camera.setView(view);
|
|
259
|
+
}
|
|
234
260
|
}
|
|
235
261
|
};
|
|
236
262
|
const destroyed = new VcsEvent<void>();
|