easy-three-utils 0.0.365 → 0.0.367
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/assets/image/fastForward.png +0 -0
- package/cesium/assets/image/rewind.png +0 -0
- package/cesium/components/react/SunshineLine/index.tsx +2 -3
- package/cesium/components/react/Timeline/index.module.less +19 -6
- package/cesium/components/react/Timeline/index.tsx +79 -42
- package/cesium/config/cesium.config.ts +8 -6
- package/cesium/glsl/viewable.ts +2 -2
- package/cesium/index.ts +16 -14
- package/cesium/utils/index.ts +4 -0
- package/cesium/utils/useCustomCollection.ts +2 -0
- package/cesium/utils/useHeatmap.ts +179 -0
- package/cesium/utils/usePath.d.ts +51 -0
- package/cesium/utils/usePath.js +1 -0
- package/cesium/utils/usePlot.d.ts +1 -0
- package/cesium/utils/usePlot.js +1 -1
- package/package.json +1 -1
- package/cesium/utils/lib/heatmap.js +0 -701
- package/cesium/utils/usePath.ts +0 -89
package/cesium/utils/usePath.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium'
|
|
2
|
-
|
|
3
|
-
export enum EMovementType {
|
|
4
|
-
SPEED = 'speed',
|
|
5
|
-
TIME = 'time'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export enum EControlAction {
|
|
9
|
-
PLAY = 'play',
|
|
10
|
-
PAUSE = 'pause'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IPathType {
|
|
14
|
-
modelParams: {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
url: string;
|
|
18
|
-
};
|
|
19
|
-
path: {
|
|
20
|
-
duration: number;
|
|
21
|
-
point: Cesium.Cartesian3;
|
|
22
|
-
speed: number;
|
|
23
|
-
}[];
|
|
24
|
-
movementType: EMovementType;
|
|
25
|
-
totalDuration: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const usePath = () => {
|
|
29
|
-
|
|
30
|
-
const playAnimation = (viewer: Cesium.Viewer, path: IPathType[]) => {
|
|
31
|
-
const startTime = Cesium.JulianDate.fromDate(new Date())
|
|
32
|
-
|
|
33
|
-
path.forEach(item => {
|
|
34
|
-
const property = new Cesium.SampledPositionProperty();
|
|
35
|
-
item.totalDuration = 0
|
|
36
|
-
|
|
37
|
-
item.path.forEach((value, i) => {
|
|
38
|
-
if (i === 0) {
|
|
39
|
-
property.addSample(Cesium.JulianDate.addSeconds(startTime, 0, new Cesium.JulianDate()), value.point);
|
|
40
|
-
}
|
|
41
|
-
if (i > 0) {
|
|
42
|
-
const distance = Cesium.Cartesian3.distance(item.path[i - 1].point, value.point).toFixed();
|
|
43
|
-
if (item.movementType === EMovementType.SPEED) {
|
|
44
|
-
const time = Number(distance) / value.speed
|
|
45
|
-
item.totalDuration = item.totalDuration + time
|
|
46
|
-
property.addSample(Cesium.JulianDate.addSeconds(startTime, item.totalDuration, new Cesium.JulianDate()), value.point);
|
|
47
|
-
} else if (item.movementType === EMovementType.TIME) {
|
|
48
|
-
item.totalDuration = item.totalDuration + Number(value.duration)
|
|
49
|
-
property.addSample(Cesium.JulianDate.addSeconds(startTime, item.totalDuration, new Cesium.JulianDate()), value.point);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (i === item.path.length - 1) {
|
|
53
|
-
property.addSample(Cesium.JulianDate.fromDate(new Date(2099, 12, 31)), value.point);
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
if (item.path.length) {
|
|
58
|
-
viewer.entities.removeById(item.modelParams.id)
|
|
59
|
-
viewer.entities.add({
|
|
60
|
-
id: item.modelParams.id,
|
|
61
|
-
name: item.modelParams.name,
|
|
62
|
-
position: property,
|
|
63
|
-
orientation: new Cesium.VelocityOrientationProperty(property),
|
|
64
|
-
model: {
|
|
65
|
-
uri: item.modelParams.url,
|
|
66
|
-
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
path.sort((pre, cur) => cur.totalDuration - pre.totalDuration)
|
|
73
|
-
|
|
74
|
-
viewer.clock.startTime = startTime.clone();
|
|
75
|
-
viewer.clock.stopTime = Cesium.JulianDate.addSeconds(startTime, path[0].totalDuration, new Cesium.JulianDate())
|
|
76
|
-
|
|
77
|
-
viewer.clock.currentTime = startTime.clone();
|
|
78
|
-
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
|
|
79
|
-
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
playAnimation,
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
usePath
|
|
89
|
-
}
|