easy-three-utils 0.0.334 → 0.0.335
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/cesium/config/cesium.config.ts +1 -1
- package/cesium/index.ts +14 -7
- package/package.json +1 -1
package/cesium/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as Cesium from 'cesium'
|
|
2
|
-
import
|
|
3
|
-
import * as dict from './config/cesium.dict'
|
|
2
|
+
import * as cesiumConfigDict from './config/cesium.dict'
|
|
4
3
|
|
|
5
4
|
import * as hooks from './utils'
|
|
6
5
|
|
|
@@ -17,6 +16,11 @@ type TCesiumUtilsType = {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
let viewer: Cesium.Viewer;
|
|
19
|
+
let config;
|
|
20
|
+
|
|
21
|
+
const defineCesiumConfig = (cesiumConfig) => {
|
|
22
|
+
config = cesiumConfig
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
const useCesium = () => {
|
|
22
26
|
|
|
@@ -59,18 +63,18 @@ const useCesium = () => {
|
|
|
59
63
|
viewer.scene.globe.shadows = Cesium.ShadowMode.ENABLED
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
if (config.imagery.status ===
|
|
66
|
+
if (config.imagery.status === cesiumConfigDict.EImageryStatus.ENABLEDOFFLINE) {
|
|
63
67
|
viewer.imageryLayers.get(0).show = false
|
|
64
68
|
const imageryProvider = new Cesium.WebMapTileServiceImageryProvider(config.imagery.config)
|
|
65
69
|
viewer.imageryLayers.addImageryProvider(imageryProvider)
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
if (config.terrain.status ===
|
|
72
|
+
if (config.terrain.status === cesiumConfigDict.ETerrainStatus.ENABLEDLINE) {
|
|
69
73
|
viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
|
|
70
74
|
requestVertexNormals: true,
|
|
71
75
|
requestWaterMask: true
|
|
72
76
|
})
|
|
73
|
-
} else if (config.terrain.status ===
|
|
77
|
+
} else if (config.terrain.status === cesiumConfigDict.ETerrainStatus.ENABLEDOFFLINE) {
|
|
74
78
|
viewer.imageryLayers.get(0).show = false
|
|
75
79
|
const terrainProvider = Cesium.CesiumTerrainProvider.fromUrl(config.terrain.config.url)
|
|
76
80
|
viewer.terrainProvider = await terrainProvider
|
|
@@ -85,7 +89,7 @@ const useCesium = () => {
|
|
|
85
89
|
const weather = hooks.useWeather(viewer)
|
|
86
90
|
const measure = hooks.useMeasure(viewer)
|
|
87
91
|
|
|
88
|
-
if (config.controllerStyle ===
|
|
92
|
+
if (config.controllerStyle === cesiumConfigDict.EControllerStyle.THREE) {
|
|
89
93
|
updateController(viewer)
|
|
90
94
|
}
|
|
91
95
|
|
|
@@ -271,7 +275,10 @@ const useCesium = () => {
|
|
|
271
275
|
export {
|
|
272
276
|
useCesium,
|
|
273
277
|
|
|
274
|
-
viewer
|
|
278
|
+
viewer,
|
|
279
|
+
|
|
280
|
+
defineCesiumConfig,
|
|
281
|
+
cesiumConfigDict
|
|
275
282
|
}
|
|
276
283
|
|
|
277
284
|
export type {
|