chbim-time-axis-v2 0.0.17 → 0.0.18
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/README.md
CHANGED
|
@@ -216,6 +216,66 @@ interface InstantTask extends GanttTask {
|
|
|
216
216
|
}
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
+
## 🎥 ViewportRoam (视角漫游)
|
|
220
|
+
|
|
221
|
+
组件包内置了一个 `ViewportRoam` 工具类,用于在 Cesium 中实现平滑的视角漫游,支持位置、偏航角(heading)、俯仰角(pitch)和翻滚角(roll)的插值动画。
|
|
222
|
+
|
|
223
|
+
### 1. 导入与定义
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
import { ViewportRoam, type RoamPoint } from "chbim-time-axis-v2";
|
|
227
|
+
|
|
228
|
+
// 漫游点数据结构
|
|
229
|
+
interface RoamPoint {
|
|
230
|
+
id: number | string;
|
|
231
|
+
time: string; // ISO8601 时间字符串
|
|
232
|
+
lng: number; // 经度
|
|
233
|
+
lat: number; // 纬度
|
|
234
|
+
alt: number; // 高度
|
|
235
|
+
heading: number; // 偏航角 (度)
|
|
236
|
+
pitch: number; // 俯仰角 (度)
|
|
237
|
+
roll?: number; // 翻滚角 (度),可选
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### 2. 使用示例
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
// 1. 准备漫游数据
|
|
245
|
+
const roamData: RoamPoint[] = [
|
|
246
|
+
{
|
|
247
|
+
id: 1,
|
|
248
|
+
time: "2023-01-01T10:00:00Z",
|
|
249
|
+
lng: 120.123,
|
|
250
|
+
lat: 30.456,
|
|
251
|
+
alt: 100,
|
|
252
|
+
heading: 0,
|
|
253
|
+
pitch: -45,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: 2,
|
|
257
|
+
time: "2023-01-01T10:01:00Z",
|
|
258
|
+
lng: 120.124,
|
|
259
|
+
lat: 30.457,
|
|
260
|
+
alt: 120,
|
|
261
|
+
heading: 90,
|
|
262
|
+
pitch: -30,
|
|
263
|
+
},
|
|
264
|
+
];
|
|
265
|
+
|
|
266
|
+
// 2. 初始化漫游控制器
|
|
267
|
+
const roamController = new ViewportRoam(viewer, roamData);
|
|
268
|
+
|
|
269
|
+
// 3. 开始漫游 (将自动监听时钟 tick 事件并更新相机)
|
|
270
|
+
roamController.start();
|
|
271
|
+
|
|
272
|
+
// 4. 停止漫游
|
|
273
|
+
// roamController.stop();
|
|
274
|
+
|
|
275
|
+
// 5. 销毁 (组件卸载时调用)
|
|
276
|
+
// roamController.destroy();
|
|
277
|
+
```
|
|
278
|
+
|
|
219
279
|
## ⚙️ 组件 API
|
|
220
280
|
|
|
221
281
|
### Props (属性)
|
package/package.json
CHANGED
|
File without changes
|