new Cesium.CesiumWidget(container, options)

包含 NT 0 场景的部件 .
Name Type Description
container Element | string The DOM element or ID that will contain the widget.
options object optional 下列属性的对象 :
Name Type Default Description
clock Clock new Clock() optional The clock to use to control current time.
shouldAnimate boolean false optional NT+0 real NT+1 如果时钟在默认情况下试图提前模拟时间,则 NT+2 false NT+3 否则.
ellipsoid Ellipsoid Ellipsoid.default optional The default ellipsoid.
baseLayer ImageryLayer | false ImageryLayer.fromWorldImagery() optional The bottommost imagery layer applied to the globe. If set to false, no imagery provider will be added.
terrainProvider TerrainProvider new EllipsoidTerrainProvider(options.ellipsoid) optional The terrain provider.
terrain Terrain optional A terrain object which handles asynchronous terrain provider. Can only specify if options.terrainProvider is undefined.
skyBox SkyBox | false optional 用来制造星星的天盒 当使用 未定义 和 WGS84 椭圆时,使用默认星等. 如果设置为 NT 3 false NT 4 ,则不会添加天盒,太阳或月球.
skyAtmosphere SkyAtmosphere | false optional 蓝色的天空 和地球四肢周围的光芒 在使用默认椭圆时启用 。 设定为 NT 0 假 NT 1 关机.
sceneMode SceneMode SceneMode.SCENE3D optional The initial scene mode.
scene3DOnly boolean false optional When true, each geometry instance will only be rendered in 3D to save GPU memory.
orderIndependentTranslucency boolean true optional If true and the configuration supports it, use order independent translucency.
mapProjection MapProjection new GeographicProjection(options.ellipsoid) optional The map projection to use in 2D and Columbus View modes.
globe Globe | false new Globe(options.ellipsoid) optional The globe to use in the scene. If set to false, no globe will be added and the sky atmosphere will be hidden by default.
useDefaultRenderLoop boolean true optional True if this widget should control the render loop, false otherwise.
useBrowserRecommendedResolution boolean true optional If true, render at the browser's recommended resolution and ignore window.devicePixelRatio.
targetFrameRate number optional 使用默认渲染环时的目标帧率 .
showRenderLoopErrors boolean true optional If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.
automaticallyTrackDataSourceClocks boolean true optional If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently.
contextOptions ContextOptions optional Context and WebGL creation properties passed to Scene.
creditContainer Element | string optional 包含 CreditDisplay 的 DOM 元素或ID. 如果没有具体说明,则加上贷项 到部件本身的底部.
creditViewport Element | string optional 将包含由 CreditDisplay 所创建的信用弹出 的 DOM 元素或 ID 。 如果不指定, 它会出现在部件上 .
dataSources DataSourceCollection new DataSourceCollection() optional The collection of data sources visualized by the widget. If this parameter is provided, 该实例被假定为呼叫者拥有,当部件被销毁时不会被销毁.
shadows boolean false optional Determines if shadows are cast by light sources.
terrainShadows ShadowMode ShadowMode.RECEIVE_ONLY optional Determines if the terrain casts or receives shadows from light sources.
mapMode2D MapMode2D MapMode2D.INFINITE_SCROLL optional Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.
blurActiveElementOnCanvasFocus boolean true optional If true, the active element will blur when the widget's canvas is clicked. Setting this to false is useful for cases when the canvas is clicked only for retrieving position or an entity data without actually meaning to set the canvas to be the active element.
requestRenderMode boolean false optional If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using Scene#requestRender to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See Improving Performance with Explicit Rendering.
maximumRenderTimeChange number 0.0 optional If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See Improving Performance with Explicit Rendering.
msaaSamples number 4 optional If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.
Throws:
  • DeveloperError : Element with id "container" does not exist in the document.
Example:
// For each example, include a link to CesiumWidget.css stylesheet in HTML head,
// and in the body, include: <div id="cesiumContainer"></div>

// Widget with no terrain and default Bing Maps imagery provider.
const widget = new Cesium.CesiumWidget("cesiumContainer");

// Widget with ion imagery and Cesium World Terrain.
const widget2 = new Cesium.CesiumWidget("cesiumContainer", {
    baseLayer: Cesium.ImageryLayer.fromWorldTerrain(),
    terrain: Cesium.Terrain.fromWorldTerrain()
    skyBox: new Cesium.SkyBox({
      sources: {
        positiveX: "stars/TychoSkymapII.t3_08192x04096_80_px.jpg",
        negativeX: "stars/TychoSkymapII.t3_08192x04096_80_mx.jpg",
        positiveY: "stars/TychoSkymapII.t3_08192x04096_80_py.jpg",
        negativeY: "stars/TychoSkymapII.t3_08192x04096_80_my.jpg",
        positiveZ: "stars/TychoSkymapII.t3_08192x04096_80_pz.jpg",
        negativeZ: "stars/TychoSkymapII.t3_08192x04096_80_mz.jpg"
      }
    }),
    // Show Columbus View map with Web Mercator projection
    sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
    mapProjection: new Cesium.WebMercatorProjection()
});
Demo:

Members

allowDataSourcesToSuspendAnimation : boolean

获取或设定数据源是否可以暂时暂停 动画,以避免向用户显示不完整的图片. 例如,如果同步原始物正在处理中 背景,在几何学准备好之前,时钟不会前进.

readonly camera : Camera

获取相机.

readonly canvas : HTMLCanvasElement

得到画布.

readonly clock : Clock

得到的钟.

clockTrackedDataSource : DataSource

获取或设置数据源以跟踪部件的时钟 .

readonly container : Element

得到母容器.

readonly creditContainer : Element

得到信用集装箱.

creditDisplay : CreditDisplay

管理要在屏幕和灯盒中显示的信用列表.

readonly creditViewport : Element

获取信用视图

readonly dataSourceDisplay : DataSourceDisplay

Gets the display used for DataSource visualization.

readonly dataSources : DataSourceCollection

Gets the set of DataSource instances to be visualized.

readonly ellipsoid : Ellipsoid

获取场景的默认椭圆 .

readonly entities : EntityCollection

获得不与特定数据源绑定的实体的收集. 这是 [ dataSourceDisplay.defaultDataSource.entities ] CesiumWidget#dataSourceDisplay 的捷径.

readonly imageryLayers : ImageryLayerCollection

获得将在全球渲染的图像层的集合 .

resolutionScale : number

获取或设置渲染分辨率的缩放因子。 小于1.0的值可以改进 在功率较低的设备上进行性能,而数值大于1.0的则在较高时进行性能 然后缩小范围,从而提高视觉的忠诚度. 例如,如果部件的大小为 640x480, 则该值为 0. 5 将会使场景在 320x240 进行渲染,然后在设置时放大 它到2.0将会使场景在1280x960上渲染,然后缩放.
Default Value: 1.0

readonly scene : Scene

得到场景.

readonly screenSpaceEventHandler : ScreenSpaceEventHandler

获得屏幕空间事件处理器.

targetFrameRate : number

当 NT 0 us DefaultRenderLoop NT 1 时获取或设定部件的目标帧率 没错 如果未定义, 浏览器请求的 AnimationFrame 执行 确定帧率。 如果定义,此值必须大于 0 。 更高值 动画 框架的实施不会产生任何效果.

terrainProvider : TerrainProvider

提供地球表面几何的地形提供者.

trackedEntity : Entity|undefined

获取或设置正在由相机跟踪的 NT 0 实例 .

readonly trackedEntityChanged : Event

获取跟踪实体改变时提起的事件.

useBrowserRecommendedResolution : boolean

布尔旗表示是否使用浏览器推荐的分辨率 . 如果真实, 浏览器的设备像素比被忽略, 并使用1.0 代替, 基于 NT 0 像素而不是设备像素的有效渲染. 这可以改善 在像素密度高的功率较低的设备上运行。 当虚假时, 渲染 will be in device pixels. CesiumWidget#resolutionScale will still take effect whether 这个旗帜是真实的还是假的.
Default Value: true

useDefaultRenderLoop : boolean

获取或设定此部件是否控制渲染循环 . 如果选中的话, 部件将使用请求动画 框架为 执行部件的渲染和调整大小,以及驱动 模拟时钟. 如果设定为虚假,则必须手动调用 作为自定义的一部分, NT 0 调整 NT 1 , NT 2 放弃 NT 3 方法 render loop. If an error occurs during rendering, Scene's -NT+0+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 事件将会被提起, 而此财产 将变成假的。 必须回到真实的状态 继续做 错误发生后.

Methods

destroy()

摧毁部件。 如果永久调用, 应该调用 从布局中删除部件 .

flyTo(target, options)Promise.<boolean>

将相机悬挂到所提供的实体、实体或数据源. 如果数据源仍在装入过程中,或者可视化还在装入, 这种方法在进行飞行前等待数据准备好. -NT=0=- 翻译: 页:1. 标题和投球角度在局部的东-北上参考框中定义. 标题是Y轴的角度,向x轴增加。 皮奇是Xy飞机的旋转 正投篮 角度在飞机上方。 负投球角度位于飞机下方. 范围是中心距离. 如果范围是 0, 将计算一个范围, 使整个边框为 NT% 1 NT 0 在2D中,必须有一个上下视图. 摄像头会放在目标上方 上面的高处 目标将是范围。 该标题将由抵消部分确定。 如果标题不能是 由冲抵确定,标题为 NT
Name Type Description
target Entity | Array.<Entity> | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promise.<(Entity|Array.<Entity>|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|VoxelPrimitive)> 实体、 实体数组、 实体收集、 数据源、 NT % 0 、 点云或图像层。 您也可以将一个承诺传递给前述类型之一.
options object optional 下列属性的对象 :
Name Type Default Description
duration number 3.0 optional The duration of the flight in seconds.
maximumHeight number optional 飞行高峰的最高高度.
offset HeadingPitchRange optional 与以目标为中心的地方东北参照框架内的目标相抵.
Returns:
如果飞行成功或失实,如果目标目前未在现场可视化或飞行取消,则确定为真实的 Promise . // TODO :清理实体提到

isDestroyed()boolean

Returns:
如果物体已被销毁, 则真实无误 .

render()

播映场景. 此函数自动调用 除非 NT 0 use DefaultRenderLoop NT 1 被设定为虚假;

resize()

更新画布大小、相机宽度比和视图大小. 除非 NT 0 use DefaultRenderLoop NT 1 被设定为虚假.

showErrorPanel(title, message, error)

向用户显示一个包含标题和一个较长错误消息的错误面板, 可用“确定”按钮解析。 此面板自动显示 当出现渲染循环错误时, 如果显示RenderLoopErrors在 部件已构建 .
Name Type Description
title string 在错误面板上显示的标题 。 此字符串被解释为文本 .
message string optional 在详细错误信息之前显示一个有帮助的,面向用户的信息. 此字符串被解释为 HTML .
error string optional The error to be displayed on the error panel. This string is formatted using formatError and then displayed as text.

zoomTo(target, offset)Promise.<boolean>

同步设置相机以查看所提供的实体,实体或数据源. 如果数据源仍在装入过程中,或者可视化还在装入, 此方法等待数据准备好后再进行缩放. -NT=0=- 翻译: 页:1. 标题和投球角度在局部的东-北上参考框中定义. 标题是Y轴的角度,向x轴增加。 皮奇是Xy飞机的旋转 正投篮 角度在飞机上方。 负投球角度位于飞机下方. 范围是中心距离. 如果范围是 0, 将计算一个范围, 使整个边框为 NT% 1 NT 0 在2D中,必须有一个上下视图. 摄像头会放在目标上方 上面的高处 目标将是范围。 该标题将由抵消部分确定。 如果标题不能是 由冲抵确定,标题为 NT
Name Type Description
target Entity | Array.<Entity> | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promise.<(Entity|Array.<Entity>|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|VoxelPrimitive)> 实体、 实体数组、 实体收集、 数据源、 NT % 0 、 点云或图像层。 您也可以将一个承诺传递给前述类型之一.
offset HeadingPitchRange optional 由当地东北参照框架的实体中心抵消.
Returns:
如果缩放成功或虚假,如果目标目前未在现场可视化,或者缩放被取消,则解析为真实的 NT++0 .
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.