# new RouteAnimationTool(vieweropt, optionsopt)
路径漫游工具(支持实例化多个工具)
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
viewer |
Cesium.Viewer | null | 场景视图,详见Cesium.Viewer |
options |
Object | {} | 额外初始化参数 |
path |
RouteAnimationPath | new RouteAnimationPath() | 路径漫游路径对象 |
label |
RouteAnimationLabel | new RouteAnimationLabel() | 路径漫游标牌对象 |
model |
RouteAnimationModel | new RouteAnimationModel() | 路径漫游模型对象 |
control |
RouteAnimationControl | new RouteAnimationControl() | 路径漫游控制对象 |
perspective |
RouteAnimationPerspective | new NormalPerspective() | 路径漫游视角对象 |
请参考以下示例:
1、模型沿地形漫游
示例
// 参考示例:
http://192.168.82.91:8086/#/modules/cesium/analyse/commonAnalyse/path-roaming
// ES5引入方式
const { RouteAnimationTool } = zondy.cesium
// ES6引入方式
import { RouteAnimationTool } from "@mapgis/webclient-cesium-plugin"
// 1 构造漫游路径数组,单位为笛卡尔3
const pathPositions = [...]
// 2 定义漫游工具对象
animationTool = new RouteAnimationTool(viewer, {
//类型指定为routes
path: new RouteAnimationPath({
positions: pathPositions,
speeds: [5],
}),
...
})
// 3 开始漫游
animationTool.start()
// 4 暂停漫游
animationTool.pause()
// 5 继续漫游
animationTool.play()
// 6 结束漫游
animationTool.stop()
