English中文

SceneModePicker

new Cesium.SceneModePicker(container, scene, duration)

SceneModePicker 是一个用于在场景模式之间切换的单按钮小部件;展开状态如左图所示。只要使用指定的场景来执行更改,场景模式的编程切换就会自动反映在小部件中。 The SceneModePicker is a single button widget for switching between scene modes; shown to the left in its expanded state. Programatic switching of scene modes will be automatically reflected in the widget as long as the specified Scene is used to perform the change.


名称 Name 类型 Type 默认值 Default 说明 Description
container Element | string 将包含小部件的 DOM 元素或 ID。 The DOM element or ID that will contain the widget.
scene Scene 要使用的场景实例。 The Scene instance to use.
duration number 2.0 可选 optional 场景转换所需的时间(以秒为单位)。 The time, in seconds, it takes for the scene to transition.
抛出: Throws:
  • DeveloperError :文档中不存在 ID 为“container”的元素。 : Element with id "container" does not exist in the document.
示例: Example:
// In HTML head, include a link to the SceneModePicker.css stylesheet,
// and in the body, include: <div id="sceneModePickerContainer"></div>
// Note: This code assumes you already have a Scene instance.

const sceneModePicker = new Cesium.SceneModePicker('sceneModePickerContainer', scene);

成员 Members

获取父容器。 Gets the parent container.
获取视图模型。 Gets the view model.

方法 Methods

销毁小部件。如果从布局中永久删除小部件,则应调用。 Destroys the widget. Should be called if permanently removing the widget from layout.
返回: Returns:
如果对象已被销毁,则为 true,否则为 false。 true if the object has been destroyed, false otherwise.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.