OMBuilding()

建筑类 里面有两份数据,一个是building的数据,一份是存放在 scene.buildings 中的 buildingIndex 数据

new OMBuilding()

Methods

findData(query, config) → {thenable}

针对全建筑的数据检索
Parameters:
Name Type Description
query object | function 查询条件({key: value}), 或返回 boolean 的一个方法
config object
Properties
Name Type Attributes Default Description
multi boolean <optional>
false 是否为多选方式
recursive boolean <optional>
true 是否在当前结点未检索到时,继续向下检索
floors Array.<int> <optional>
null 检索的楼层, 默认为null,即为所有的楼层
Returns:
thenable - thenable对象

findPath(from, to, optionsopt) → {thenable}

本建筑中的路径规划
Parameters:
Name Type Attributes Description
from object {floorNumber:, point}
Properties
Name Type Description
floorNumber int 起点的楼层编号
point RoadPoint | Vector3 | string | Array.<float> | Object 起点的位置坐标, 可以为多种参数类型, 如: RoadPint, Vector3, [x, y, z], {x:, y:, z:}
to object {floorNumber:, point}
Properties
Name Type Description
floorNumber int 终点的楼层编号
point RoadPoint | Vector3 | string | Array.<float> | Object 终点的位置坐标, 可以为多种参数类型, 如: RoadPint, Vector3, [x, y, z], {x:, y:, z:}
options object <optional>
路径计算中的一些参数
Returns:
thenable - 返回的是一个thenalble对象路径规划的结果 [{floorNumber:, lines: [], vectors: []}, ...]
Example
from: {
	floorNumber: 1
	point:           // roadPoint | vector | string(roadPointID)
}

building.findPath(from, to).then(res => {})

focusFloors(floors) → {thenable}

设置聚焦楼层
Parameters:
Name Type Description
floors int | Array.<int> 聚焦楼层的floorNumber, 支持多楼层
Returns:
thenable

getFloorByFloorNumber(floorNumber) → {Promise}

通过FloorNumber得到Floor对象, 如果当前楼层数据未加载, 会自动加载
Parameters:
Name Type Description
floorNumber int 楼层编号
Returns:
Promise - thenable 对象, 参考为 OMFloor对象
Example
building.getFloorByFloorNumber(1).then(floor => {});   

getFloorIndex(floor) → {object}

得到floor对应的 floorIndex 数据
Parameters:
Name Type Description
floor OMFloor OMFloor 对象
Returns:
object - floorIndex

getFloors(floorsopt) → {thenable}

加载此建筑中全部或部分的楼层对象
Parameters:
Name Type Attributes Default Description
floors Array.<int> <optional>
null 要加载的楼层floorNumbers数组, 如: [1,2,3] 如果为空则加载本建筑所有楼层的数据
Returns:
thenable - 返回一个thenable对象, 参数为所加载的楼层对象数组

getNodeByID(nid) → {thenable}

通过node ID 得到对应的OMNode对象
Parameters:
Name Type Description
nid string OMNode's ID
Returns:
thenable - thenable对象
Example
building.getNodeByID('2es12220c3426sh4').then(node => {console.log(node)})

getOMScene() → {OMScene}

得到此建筑所在的 omScene 对象
Returns:
OMScene - omScene 对象

keywordsFind(config) → {thenable}

关键词搜索
Parameters:
Name Type Description
config
Returns:
thenable - thenable 对象
Example
building.keywordsFind(['内', '室']).then(res => console.log(res))

locateFloors(options)

显示多层时, 将楼层移动画指定的位置
Parameters:
Name Type Description
options number | object 楼层间距值或者显示多楼层时的一些参数, 如楼层之间的间距,动画时间等
Properties
Name Type Attributes Default Description
floorSpace float <optional>
多楼层之间的间距, 相邻楼层之间的距离
animate boolean <optional>
是否开启动画过度
delay float <optional>
88 每层动画的延时(ms)
duration float <optional>
600 动画的时长(ms)
easing boolean <optional>
'backout'
Returns:

remove()

覆盖 node.remove(children) 方法,此方法只是将自身移除 并移除 omScene.data.building中的数据

removeFloor(floor) → {null}

移除一层floor
Parameters:
Name Type Description
floor OMFloor OMFloor对象
Returns:
null

toIndoor() → {null}

手动进入室内
Returns:
null

toOutdoor()

手动的进入室外场景

viewFloors(floorNumbers, options) → {thenable}

设置某个或某些楼层
Parameters:
Name Type Description
floorNumbers int | Array.<int> | null | 'all' 设置可见的楼层单个或数组, 如果值 null或'all' 时, 即显示建筑中的所有楼层
options object 显示多楼层时的一些参数, 如楼层之间的间距,动画时间等
Properties
Name Type Attributes Default Description
floorSpace float <optional>
多楼层之间的间距, 相邻楼层之间的距离
animate boolean <optional>
是否开启动画过度
delay float <optional>
88 每层动画的延时(ms)
duration float <optional>
600 动画的时长(ms)
Returns:
thenable