SceneM3D

SceneM3D

一个M3D类型场景的抽象描述,场景即渲染2D数据、3D模型的虚拟画板. 所有的需要渲染的数据、模型对象都将作为子对象存储在这个场景中

Constructor

new SceneM3D(options)

Description:
  • 创建一个M3D场景对象

Parameters:

Name Type Description
options SceneM3D.ConstructorOptions

实例化M3D场景所需的参数对象

Members

(readonly) context :m3d.SceneM3D.context

获取WebGL上下文,相当于“cavas.getContext('webgl2')”

Type:
  • m3d.SceneM3D.context

(readonly) id :string

Description:
  • 获取当前场景的ID

获取当前场景的ID

Type:
  • string

(readonly) layerManager :LayerManager

Description:
  • 获取当前场景的图层管理器

获取当前场景的图层管理器

Type:

Methods

destroy()

Description:
  • 销毁场景,释放相关的资源占用

(async) flyTo(options)

Description:
  • 以动画的方式,将相机飞行至特定的位置

Parameters:

Name Type Description
options Array.<SceneM3D.FlyToOptions>

一个数组,可包多个飞行目标位置及动画控制参数对象

getMonomerBuildingType(enableOpen, duration, callback) → {Object}

Description:
  • 获取单体化建筑所属类型方法

Parameters:

Name Type Description
enableOpen boolean
duration number
callback function
Returns:
Object -

返回单体化建筑模型的类型

hideGlobe()

Description:
  • 隐藏地球实体

hideSurroundings()

Description:
  • 隐藏周围环境

openSurroundings()

Description:
  • 打开周围环境

setProperty(options)

Description:
  • 设置场景的属性

Parameters:

Name Type Description
options SceneM3D.SceneProperty

一个描述场景属性参数的对象

showGlobe()

Description:
  • 显示地球实体

showMonomerBuilding(options)

Description:
  • 显示周围环境

Parameters:

Name Type Description
options Object

Type Definitions

ConstructorOptions

Description:
  • 创建并初始化一个M3D场景(SceneM3D)实例所需的参数

Properties:
Name Type Description
id string

引擎的ID,必须是一个全局唯一的字符串

sceneType SceneType

场景类型

showGlobe boolean

是否显示地球

active boolean

默认是否激活当前场景

创建并初始化一个M3D场景(SceneM3D)实例所需的参数

Type:
  • Object

FlyToOptions

Description:
  • 飞行的目标位置及动画控制参数

Properties:
Name Type Description
position Array.<number>

目标位置,一个[lng, lat, height]格式的数组

heading number

相机沿着Z轴旋转,设置当前的角度(单位:度)

pitch number

相机沿着Y轴旋转,设置当前的角度(单位:度)

duration number

飞行时间

飞行的目标位置及动画控制参数

Type:
  • Object

SceneProperty

Description:
  • 场景(Scene)对象的属性参数

Properties:
Name Type Description
width string

场景的宽度,单位为像素,或者设置为百分比的形式,如“100%”

height string

场景的高度,单位为像素,或者设置为百分比的形式,如“100%”

Array.<number> | string

场景的背景颜色

场景(Scene)对象的属性参数

Type:
  • Object