MainControl

MainControl

主控器,初始化三维场景

Constructor

new MainControl(container, configFileUrl)

Parameters:
Name Type Description
container Element | String 将容纳Viewer的HTML DOM 元素或ID。
configFileUrl String 将请求JSON配置文件的路径。

Members

(readonly) environment :Environment

获取场景环境控制器。
Type:

(readonly) mapLayers :MapLayerCollection

获取地图图层集合。
Type:

(readonly) plotDoc :PlotDoc

获取标绘文档。
Type:

(readonly) popups :Popups

获取弹出框实例对象。
Type:

(readonly) sceneEffects :SceneEffects

获取场景特效控制器。
Type:

(readonly) terrainLayer :TerrainLayer

获取地形图层。
Type:

(readonly) tilesetLayers :ThreeDTilesetLayerCollection

获取Cesium3DTileset图层集合。
Type:

trackedMark :Mark

Default Value:
  • undefined
获取或设置相机当前跟踪的标绘实例。
Type:

(readonly) trackedMarkChanged :Event

获取被跟踪标会实例更改时引发的事件。
Type:
  • Event

(readonly) vectorLayers :VectorLayerCollection

获取矢量图层集合。
Type:

(readonly) viewer :Cesium.Viewer

Cesium原生可视化器。
Type:
  • Cesium.Viewer

(readonly) weather :Weather

获取天气特效控制器。
Type:

(readonly) widgetsControl :WidgetsControl

获取界面部件控制器。
Type:

Methods

destroy()

销毁主控器实例对象

disableFullScreen()

关闭全屏

enableFullScreen(elementopt)

开启全屏。
Parameters:
Name Type Attributes Description
element Object <optional>
将被置于全屏模式的HTML元素,若未设置,默认为body元素。

flyTo(target, optionsopt) → {Promise.<Boolean>}

将相机以飞行姿态切换到提供的Mark、MapLayer、VectorLayer、Cesium3DTileset或TimeDynamicPointCloud等目标对象。 如果目标对象仍然在加载过程中,则此方法将等待目标对象准备好后再执行飞行。

偏移量是在以包围球中心为中心的当地东北向上参考坐标系中的偏航角/俯仰角/范围(heading/pitch/range)。 偏航角和俯仰角是在当地的东北向上(east-north-up)参考系中确定的。 范围是到中心的距离。如果范围为零,则计算范围使整个包围球可见。

Parameters:
Name Type Attributes Description
target Mark | MapLayer | VectorLayer | Cesium3DTileset | TimeDynamicPointCloud Mark、MapLayer、VectorLayer、Cesium3DTileset或TimeDynamicPointCloud等目标对象
options Object <optional>
具有以下属性的对象:
Properties
Name Type Attributes Default Description
duration Number <optional>
3.0 飞行时间,以秒为单位。
maximumHeight Number <optional>
飞行中的最高高度。
offset Cesium.HeadingPitchRange <optional>
在当地的东北向上参考系中,从实体中心的偏移量。
Returns:
飞行成功时,promise被解析为true;如果目标对象未在场景中可视化或飞行取消,promise被解析为false。
Type
Promise.<Boolean>

flyToLocation(options)

将相机从当前位置切换到新位置。
Parameters:
Name Type Description
options Object 位置和朝向。此对象拥有以下属性:
Properties
Name Type Attributes Description
longitude Number 经度。
latitude Number 纬度。
height Number 高度。
heading Number <optional>
偏航角。
pitch Number <optional>
俯仰角。
roll Number <optional>
翻滚角。

getSceneScreenshot()

场景出图

setViewRange(positionOrientation)

设置视图初始位置和朝向。
Parameters:
Name Type Description
positionOrientation Object 位置和朝向,包含以下属性:
Properties
Name Type Description
longitude Number 经度,单位为角度。
latitude Number 纬度,单位为角度。
altitude Number 高度,单位为角度。
heading Number 偏航角,单位为角度。
pitch Number 俯仰角,单位为角度。
roll Number 翻滚角,单位为角度。

startRotation(periodopt)

启动地球自转。
Parameters:
Name Type Attributes Default Description
period Number <optional>
60 环绕周期,单位为秒。

stopRotation()

停止地球自转

zoomTo(target, offsetopt) → {Promise.<Boolean>}

设置相机查看提供的Mark、MapLayer、VectorLayer、Cesium3DTileset或TimeDynamicPointCloud等目标对象。 如果目标对象仍然在加载过程中,则此方法将等待目标对象准备好后再执行缩放。

偏移量是在以包围球中心为中心的当地东北向上参考坐标系中的偏航角/俯仰角/范围(heading/pitch/range)。 偏航角和俯仰角是在当地的东北向上(east-north-up)参考系中确定的。 范围是到中心的距离。如果范围为零,则计算范围使整个包围球可见。

Parameters:
Name Type Attributes Description
target Mark | MapLayer | VectorLayer | Cesium3DTileset | TimeDynamicPointCloud Mark、MapLayer、VectorLayer、Cesium3DTileset或TimeDynamicPointCloud等目标对象
offset Cesium.HeadingPitchRange <optional>
在本地东北方向上的参考系中,从实体中心的偏移量。
Returns:
缩放成功时,promise被解析为true;如果实体未在场景中可视化或缩放取消,promise被解析为false。
Type
Promise.<Boolean>