Class: FMFirstPersonControl

FMFirstPersonControl

FMfirstPersonControl 控制器管理类,属于 fengmap.plugin.first.min.js

new fengmap.FMFirstPersonControl(options)

Name Type Description
options Object

参数集合

Name Type Description
camera Ojbect

第一人称相机参数

Name Type Description
viewHeight number

视高,单位:米,默认值:1.7

zoom number

当使用第一人称相机时,期望看到哪个级别的数据。默认值21。即:看到的内容与第三人称zoom为21时可看到的一致。

floorViewPoints Object

所属楼层和建筑的第一人称默认位置和角度

Name Type Description
heading number

全局第一人称相机水平角度,默认 0,即朝北

tilt number

全局第一人称相机俯仰角度,默认 0,即平视

x number

全局x坐标

y number

全局y坐标

height number

全局相对于所属楼层地面的高度,单位:米,默认 0

buildings Array

所属楼层的第一人称默认位置和角度

buildings[].level number

楼层

buildings[].x number

x坐标

buildings[].y number

y坐标

buildings[].height number

相对于所属楼层地面的高度,单位:米,默认 0

buildings[].buildingID string

建筑ID, 默认 null

buildings[].heading number

第一人称相机水平角度,默认 0,即朝北

buildings[].tilt number

第一人称相机俯仰角度,默认 0,即平视

defaultBuildingID string

相机默认所在的建筑ID, 默认 null,即当前(主)地图

rejectExternalModel Object

示例:{typeIDs: [...],FIDs: [...]},限制进入模型内部的typeID或者FID的集合,默认[],即没有需要限制进入模型内部的元素。 getTargetViewPoint() 方法返回位置不会进入其内部,只会到他们的最大外边界处。

Members

readonlyisEnabled

Properties:
Name Type Description
isEnabled bool

是否开启第一人称相机

Methods

disable()

禁用第一人称控制器

enable(buildingID)

开启第一人称控制器

Name Type Description
buildingID string

建筑ID, 默认null

enterBuilding(options)

进入建筑

Name Type Description
options json

参数集合

Name Type Description
buildingID String

建筑ID

isHideOutBuilding boolean

是否隐藏园区地图,默认为false

finish function

完成回调函数

exitBuilding(options)

退出建筑

Name Type Description
options json

参数集合

Name Type Description
finish function

完成回调函数

getTargetViewPoint(options){Object}

根据地图坐标点, 计算移动的目标位置和角度, 会避开镂空区域

Name Type Description
options Object

地图点击内容

Name Type Description
coords Object

地图坐标信息

Name Type Description
x number

地图x

y number

地图y

height number

相对于所属楼层的位置

targets Object

地图拾取内容

Returns:
Name Type Description
result Object 返回内容
Name Type Description
x number 位置x坐标
y number 位置y坐标
height number 相对于所属楼层的位置
heading number 水平角度
tilt number 俯仰角度

getViewPoint(){Object}

获取当前的相机位置

Returns:
Name Type Description
options Object
Name Type Description
x number 地图x坐标
y number 地图y坐标
height number 相对于所属楼层的位置
heading number 水平角度
tilt number 俯仰角度

moveTo(options)

设置位置

Name Type Description
options Object

参数

Name Type Description
x number

地图x坐标, 必填

y number

地图y坐标, 必填

height number

相对于所属楼层的位置

animate boolean

true 开启动画 false 关闭动画, 选填,默认 true

duration number

移动到指定位置所用的时间( 秒), 选填, 默认0.5

finish function

移动完成事件, 选填

rotateTo(options)

设置偏航角度

Name Type Description
options Object

参数

Name Type Description
heading number

偏航角度

animate boolean

true 开启动画 false 关闭动画, 选填,默认 true

duration number

移动到指定位置所用的时间( 秒), 选填, 默认0.5

finish function

移动完成事件, 选填

tiltTo(options)

设置俯仰角度

Name Type Description
options Object

参数

Name Type Description
tilt number

俯仰角

animate boolean

true 开启动画 false 关闭动画, 选填,默认 true

duration number

移动到指定位置所用的时间( 秒), 选填, 默认0.5

finish function

移动完成事件, 选填