1. Roam
1.1. 初始化 new Roam(options, geomap)
路径漫游(自动漫游)
Param | Type | Default | Description |
---|---|---|---|
options | Object |
包含以下参数的Object对象: |
|
[options.pitch] | Number |
5 |
漫游时的俯仰角,单位为度; |
[options.roll] | Number |
0 |
漫游时的翻滚角,单位为度; |
[options.positions] | Array.<Number> |
[] |
[lon1, lat1, height1, lon2, lat2, height2]/ [lon1, lat2, lon1, lat2],经纬度单位为度,高度单位为米; |
[options.positionWithHeight] | Boolean |
false |
坐标数组是否带有高程; |
[options.height] | Array |
1.2 |
漫游路径高度小于等于0位置的修正高度;当设置该参数为-9999时使用未修正的真实高度; |
[options.playSpeed] | Array |
1 |
漫游播放速度; |
[options.requestAnimationFrameCallback] | Array |
动画请求更新事件回调函数; |
|
[options.completeCallback] | function |
路径漫游结束的回调函数; |
|
[options.frameCallback] | function |
路径漫游每一帧的回调函数; |
|
geomap | Object |
geomap对象。 |
Example
var geomap = new BOSGeo.Roam({
positions: [121.3559, 31.4611, 250.9, 121.356, 31.4592, 250.3],
positionWithHeight: true,
}, geomap);
1.2. 属性
属性名 | Type | Default | Description |
---|---|---|---|
playSpeed | Number | 1 | 播放速度 |
currentFrame | Number | 0 | 当前帧 |
currentTime | Number | 0 | 当前时间 |
1.3. 方法
1.3.1. roam.start([distanceThreshold], [switchDirectionTime])
开始路径漫游
Param | Type | Default | Description |
---|---|---|---|
[distanceThreshold] | Number |
0.3 |
当漫游路径两点间距离小于该值时忽略第二个点,为0(m)时则保留所有点,单位为米。 |
[switchDirectionTime] | Number |
0.7 |
相机飞向下一点切换方向的时间,单位为秒。 |
Example
roam.start();
1.3.2. roam.pause()
暂停路径漫游
Example
roam.pause();
1.3.3. roam.continue()
继续路径漫游
Example
roam.continue();
1.3.4. roam.stop()
停止路径漫游
Example
roam.stop();
1.3.5. roam.update(positions)
更新漫游路径坐标
Param | Type | Description |
---|---|---|
positions | Array.<Number> |
经纬度(度)和高程(米)组成的数组 |
Example
let newPositions = [116.38957932, 39.90649715, 0, 116.38957293215105, 39.90652696401454, 1.2, 116.39125252362987, 39.906547534047625, 1.2, 116.39271428804453, 39.90659525673602, 1.2, 116.39271602, 39.90661012, 0];
autoRoam.update(newPositions);
1.3.6. roam.videoRecordExport([name], type)
漫游视频录制导出,Roam类初始化需要设置options.videoExportAble 为true,即录制漫游视频。
Param | Type | Default | Description |
---|---|---|---|
[name] | String |
'roam' |
名称 |
type | String |
mp4 |
下载视频文件后缀类型,支持'mp4'、'avi',默认为'mp4'。 |
Example
roam.videoRecordExport('roam', 'mp4');