View

LM. View

地图视图,将html页面元素作为地图容器显示地图。LM.Map

Members

(readonly) background :LM.Map

Description:
  • 视图中的背景颜色。

视图中的背景颜色。

Type:

(readonly) heading :LM.Map

Description:
  • 视图中的地图方位。

视图中的地图方位。

Type:

(readonly) height :number

Description:
  • 视图高。

视图高。

Type:
  • number

(readonly) interaction :LM.Interaction

Description:
  • 获取交互操作控制器.

获取交互操作控制器.

Type:

(readonly) map :LM.Map

Description:
  • 视图显示的地图。

视图显示的地图。

Type:

(readonly) mode :number

Description:
  • 视图模式。

视图模式。

Type:
  • number

(readonly) pitch :LM.Map

Description:
  • 视图中的地图倾角。

视图中的地图倾角。

Type:

(readonly) position :LM.Map

Description:
  • 视图中心的地图位置。

视图中心的地图位置。

Type:

(readonly) scale :number

Description:
  • 获取当前的地图比例尺。

获取当前的地图比例尺。

Type:
  • number

(readonly) width :number

Description:
  • 视图宽。

视图宽。

Type:
  • number

(readonly) zoom :number

Description:
  • 获取当前地图的显示级别。

获取当前地图的显示级别。

Type:
  • number

Methods

fit(objects)

Description:
  • 调整地图内容显示尺寸适配到视图。

Parameters:
Name Type Description
objects array.<(LM.Floor|LM.Layer)>

楼层或者图层集合。支持无参数调用,适配全图范围。

moveTo(options)

Description:
  • 移动地图中心点。

Parameters:
Name Type Description
options object
Properties
Name Type Description
position object

目标位置。

Properties
Name Type Description
level number

目标位置楼层级别。

x number

目标位置X坐标。

y number

目标位置Y坐标。

z number

目标位置Z坐标。

animation object

动画参数,未设置时无动画效果。

Properties
Name Type Description
duration number

动画持续时间ms。

times number

动画次数,未设置为1。

interval number

动画间隔ms,次数大于1时生效。

interpolation LM.Interpolation

插值方式,未设置为LINEAR。

finish function

动画执行完成回调方法。

off(mark)

Description:
  • 解除事件监听。

Parameters:
Name Type Description
mark string

事件标记,支持“click”-点击。

options.callback function

事件触发回调。

on(mark)

Description:
  • 事件监听。

Parameters:
Name Type Description
mark string

事件标记,支持“pick”-单击拾取,“change”-显示状态变化,只返回变化的属性,可能有“mode、display、position、heading、pitch”。

options.callback function

事件触发回调,返回事件内容。

resize()

Description:
  • 调整视图大小。

rotateTo(options)

Description:
  • 旋转地图。

Parameters:
Name Type Description
options object
Properties
Name Type Description
heading number

方位角度,0~360。

animation object

动画参数,未设置时无动画效果。

Properties
Name Type Description
duration number

动画持续时间ms。

times number

动画次数,未设置为1。

interval number

动画间隔ms,次数大于1时生效。

callback function

动画执行过程中的回调方法,返回方位角度。

finish function

动画执行完成回调方法。

scaleTo(options)

Description:
  • 设置地图比例尺。

Parameters:
Name Type Description
options object
Properties
Name Type Description
scale number

地图比例尺,0.55~295829355.45。

animation object

动画参数,未设置时无动画效果。

Properties
Name Type Description
duration number

动画持续时间ms。

times number

动画次数,未设置为1。

interval number

动画间隔ms,次数大于1时生效。

callback function

动画执行过程中的回调方法,返回方位角度。

finish function

动画执行完成回调方法。

setBackground(background)

Description:
  • 设置背景颜色.

Parameters:
Name Type Description
background object

背景颜色。

Properties
Name Type Description
color string

背景颜色,例如'#FF0000'。

opacity number

背景不透明度。

setDisplay(levels)

Description:
  • 设置可见楼层。

Parameters:
Name Type Description
levels array.<number>

楼层级别数组。

setMode(mode)

Description:
  • 设置显示模式.

Parameters:
Name Type Description
mode LM.ViewMode

显示模式。

tiltTo(options)

Description:
  • 倾斜地图。

Parameters:
Name Type Description
options object
Properties
Name Type Description
pitch number

倾斜角度,0~90。

animation object

动画参数,未设置时无动画效果。

Properties
Name Type Description
duration number

动画持续时间ms。

times number

动画次数,未设置为1。

interval number

动画间隔ms,次数大于1时生效。

callback function

动画执行过程中的回调方法,返回方位角度。

finish function

动画执行完成回调方法。

zoomTo(options)

Description:
  • 缩放地图。

Parameters:
Name Type Description
options object
Properties
Name Type Description
zoom number

缩放级别,1~30。

animation object

动画参数,未设置时无动画效果。

Properties
Name Type Description
duration number

动画持续时间ms。

times number

动画次数,未设置为1。

interval number

动画间隔ms,次数大于1时生效。

callback function

动画执行过程中的回调方法,返回方位角度。

finish function

动画执行完成回调方法。