new Cesium.Scene(options)

用于所有 3D 图形对象的容器, 并状态在 NT% 0 虚拟场景中 。 一般来说, 场景不是直接创建的;而是由 CesiumWidget 默认创建的.
Name Type Description
options object 下列属性的对象 :
Name Type Default Description
canvas HTMLCanvasElement The HTML canvas element to create the scene for.
contextOptions ContextOptions optional 上下文和 NT 0 创建属性.
creditContainer Element optional The HTML element in which the credits will be displayed. If not specified, a credit container will be created and added as a sibling of the canvas.
creditViewport Element optional The HTML element in which to display the credit popup. If not specified, the viewport will be added as a sibling of the canvas.
ellipsoid Ellipsoid Ellipsoid.default optional The default ellipsoid. If not specified, the default ellipsoid is used.
mapProjection MapProjection new GeographicProjection(options.ellipsoid) optional The map projection to use in 2D and Columbus View modes.
orderIndependentTranslucency boolean true optional If true and the configuration supports it, use order independent translucency.
scene3DOnly boolean false optional If true, optimizes memory use and performance for 3D mode but disables the ability to use 2D or Columbus View.
shadows boolean false optional Determines if shadows are cast by light sources.
mapMode2D MapMode2D MapMode2D.INFINITE_SCROLL optional Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.
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.
depthPlaneEllipsoidOffset number 0.0 optional 调整深程图,处理椭圆零高度以下的渲染工艺.
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:
Example:
// Create scene without anisotropic texture filtering
const scene = new Cesium.Scene({
  canvas : canvas,
  contextOptions : {
    allowTextureFilterAnisotropic : false
  }
});
See:

Members

static Cesium.Scene.defaultLogDepthBuffer

Use this to set the default value for Scene#logarithmicDepthBuffer in newly constructed Scenes 此属性依赖于对碎片深度的支持 .

_enableEdgeVisibility : boolean

是否启用 3D 牌的边缘可见度渲染 . 启用时, 创建具有多个渲染目标的帧缓冲器 用于先进的边缘探测和能见度技术.
Default Value: false

atmosphere : Atmosphere

用于影响3D平板和模型渲染的大气照明效果的设置. 这一点是不可混淆的 Scene#skyAtmosphere which is responsible for rendering the sky.

backgroundColor : Color

The background color, which is only visible if there is no sky box, i.e., Scene#skyBox is undefined.
Default Value: Color.BLACK
See:

readonly camera : Camera

获取或设置相机.

readonly cameraUnderground : boolean

摄影机是否在地球下面.
Default Value: false

readonly canvas : HTMLCanvasElement

获取此场景绑定的画布元素 .

readonly clampToHeightSupported : boolean

Returns true if the Scene#clampToHeight and Scene#clampToHeightMostDetailed functions are supported.
See:

completeMorphOnUserInput : boolean

确定是否立即完成 用户输入的场景过渡动画.
Default Value: true

debugCommandFilter : function|undefined

这种财产只用于调试;不用于生产.

决定命令执行的函数 。 如下所示:, the function receives the command's owner as an argument, and returns a boolean indicating if the 命令应当执行.

默认为 NT 0 undefine NT 1 ,表示所有命令都已执行.

Default Value: undefined
Example:
// Do not execute any commands.
scene.debugCommandFilter = function(command) {
    return false;
};

// Execute only the billboard's commands.  That is, only draw the billboard.
const billboards = new Cesium.BillboardCollection();
scene.debugCommandFilter = function(command) {
    return command.owner === billboards;
};

readonly debugFrustumStatistics : object|undefined

这种财产只用于调试;不用于生产.

When Scene.debugShowFrustums is true, this contains 属性,其中包含每个节点执行命令数的统计. totalCommands is the total number of commands executed, ignoring 重叠。 #NT##0 commands InFrustums NT###1 是一个有次数的阵列 命令被冗余执行, e.g .,有多少命令与两个或两个重复 three frustums.

Default Value: undefined

debugShowCommands : boolean

这种财产只用于调试;不用于生产.

当 NT 0 真 NT 1 时,命令会随机遮蔽. 这个有用 以了解场景或模型的哪些部分 并可从批量处理中受益.

Default Value: false

debugShowDepthFrustum : number

这种财产只用于调试;不用于生产.

显示显示深度信息 .

Default Value: 1

debugShowFramesPerSecond : boolean

这种财产只用于调试;不用于生产.

每秒显示帧,每帧之间显示时间.

Default Value: false

debugShowFrustumPlanes : boolean

这种财产只用于调试;不用于生产.

当 NT##0 真 NT 1 时,绘制大纲以显示相机frustums的边界

Default Value: false

debugShowFrustums : boolean

这种财产只用于调试;不用于生产.

当 NT 0 true NT 1 时,命令根据它们的花纹进行遮蔽 重叠。 最近的十字架上的命令是红色的,命令在 最近的是绿色,最远处的命令是 蓝色 如果一个命令重叠了多个 frustum, 颜色组件 are combined, e.g., a command overlapping the first two frustums is tinted yellow.

Default Value: false

readonly drawingBufferHeight : number

基础 GL 上下文的绘图缓冲度 .
See:

readonly drawingBufferWidth : number

基础 GL 语境的绘图 BufferWidth .
See:

readonly ellipsoid : Ellipsoid

椭圆形. 如果没有指定,则使用默认椭圆.

eyeSeparation : number

与纸板或WebVR使用的眼睛分离距离以米计.

farToNearRatio : number

使用普通深度缓冲时,多裂缝的远近比.

这个值用于为多裂纹的每个节点创建近和远的值. 只用这个 when Scene#logarithmicDepthBuffer is false. When logarithmicDepthBuffer is true, use Scene#logarithmicDepthFarToNearRatio.

Default Value: 1000.0

focalLength : number

使用纸板或WebVR时使用的焦距.

fog : Fog

将大气层合并到远离相机的几何上进行视野查看. 允许额外 通过减少几何和发送地形请求来改进性能. Disbaled by default if an ellipsoid other than WGS84 is used.

gamma : number

伽玛校正所用的值. 这只用于高动态范围的渲染.
Default Value: 2.2

globe : Globe

获取或设置深度测试椭圆.

readonly groundPrimitives : PrimitiveCollection

获得地面原始物的收集.

highDynamicRange : boolean

是否使用高动态范围渲染 .
Default Value: false

readonly highDynamicRangeSupported : boolean

是否支持高动态范围渲染 .
Default Value: true

readonly id : string

获取此场景的唯一标识符 .

readonly imageryLayers : ImageryLayerCollection

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

invertClassification : boolean

当 NT 0 false NT 1 时,3D平板将正常渲染. 当 NT 2 真 NT 3 时,分类的3D梯形几何将正常和 unclassified 3D Tile geometry will render with the color multiplied by Scene#invertClassificationColor.
Default Value: false

invertClassificationColor : Color

The highlight color of unclassified 3D Tile geometry when Scene#invertClassification is true. 当颜色的alpha小于1.0时,3D梯的未分类部分不会与3D NT %2 的分类位置正确混合 当颜色的α小于1.0时,WEBGL 深度 纹理和EXT frag 深度 NT 0 扩展必须是 NT 3
Default Value: Color.WHITE

readonly invertClassificationSupported : boolean

如果支持 {NT}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.
See:

readonly lastRenderTime : JulianDate|undefined

得到了模拟时间 当场景最后一次渲染。 返回 NT 0 未定义 NT 1 如果现场尚未显示.

light : Light

光源为荫. 默认为来自太阳的方向光.

logarithmicDepthBuffer : boolean

是否使用对数深度缓冲 。 启用这个选项可以减少多裂缝中的节点, 提高业绩。 此属性依赖于对碎片深度的支持 .

logarithmicDepthFarToNearRatio : number

使用对数深度缓冲时,多裂缝的远近比.

这个值用于为多裂纹的每个节点创建近和远的值. 只用这个 when Scene#logarithmicDepthBuffer is true. When logarithmicDepthBuffer is false, use Scene#farToNearRatio.

Default Value: 1e9

readonly mapMode2D : MapMode2D

确定2D映射是可旋转的还是可以无限地向水平方向滚动.

readonly mapProjection : MapProjection

获取地图投影在 2D 和 哥伦布 View 模式中使用 .
Default Value: new GeographicProjection()

readonly maximumAliasedLineWidth : number

最大异名的行宽,以像素为单位,由此 NT 0 执行支持. 至少会有一个.
See:
  • glGet with ALIASED_LINE_WIDTH_RANGE.

readonly maximumCubeMapSize : number

立方体地图一个边缘的最大像素长度,由此 NT 0 执行支持. 将至少16.
See:
  • glGet with GL_MAX_CUBE_MAP_TEXTURE_SIZE.

maximumRenderTimeChange : number

If Scene#requestRenderMode is true, this value defines the maximum change in 允许在请求渲染前使用模拟时间。 数值较低者会增加帧数 和更高的数值减少了帧数。 如果 NT 0 未定义 NT 1 ,则更改为 模拟时间永远不会要求一个渲染. 此值会影响场景变化的渲染率,如照明,实体属性更新, and animations.
Default Value: 0.0
See:

minimumDisableDepthTestDistance : number

关闭广告牌、标签和点的深度测试的相机距离 例如,防止对地形进行剪切。 设置为零时, 深度测试应始终 适用。 当低于零时,就不应该进行深度测试. 设置禁用深度测试 广告牌、标签或点的属性将超过此值.
Default Value: 0.0

mode : SceneMode

获取或设置当前场景模式.
Default Value: SceneMode.SCENE3D

moon : Moon|undefined

~Moon ~
Default Value: undefined

morphComplete : Event

事件引发场景过渡完成.
Default Value: Event()

morphStart : Event

该事件在场景过渡的开始点燃.
Default Value: Event()

morphTime : number

2D/Columbus View和3D之间的当前形态过渡时间, 0.0为2D或哥伦布视图,1.0为3D.
Default Value: 1.0

msaaSamples : number

多样抗异形的样本率(值大于1允许 MSAA ).
Default Value: 4

readonly msaaSupported : boolean

如果 NT 0 的上下文支持 NT 1 真 NT 2 ,则返回 NT 1 真 NT 0 2 .

nearToFarDistance2D : number

确定2D中多裂缝每个裂缝以米计的统一深度大小。 如果原始或模型关闭 表面显示Z战斗,减少 这会消除文物,但降低性能。 打开 另一方面,增加这个会提高性能,但可能在接近表面的原始人中引起z战.
Default Value: 1.75e6

readonly orderIndependentTranslucency : boolean

获取场景是否启用了独立的透明命令 . 请注意,这只反映了最初的施工选择,而且有 其它可能阻止 NT 0 在给定的系统配置上运行的因素.

readonly pickPositionSupported : boolean

Returns true if the Scene#pickPosition function is supported.
See:

pickTranslucentDepth : boolean

When true, enables picking translucent geometry using the depth buffer. Note that Scene#useDepthPicking must also be true for enabling this to work.

启用时性能下降。 有额外的绘图呼叫要写入深度 translucent geometry.

Default Value: false
Example:
// picking the position of a translucent primitive
viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
     const pickedFeature = viewer.scene.pick(movement.position);
     if (!Cesium.defined(pickedFeature)) {
         // nothing picked
         return;
     }
     const worldPosition = viewer.scene.pickPosition(movement.position);
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

postProcessStages : PostProcessStageCollection

处理后的效果适用于最后渲染.

readonly postRender : Event

获得场景完成后立即提起的事件. 事件订阅者 receive the Scene instance as the first parameter and the current time as the second parameter.
See:

readonly postUpdate : Event

获得场景更新后和场景渲染前将立即提起的事件. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.
See:

readonly preRender : Event

获得场景更新后和场景制作前即将提起的事件. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.
See:

readonly preUpdate : Event

获得在现场更新或渲染前将提起的事件. 事件订阅者 receive the Scene instance as the first parameter and the current time as the second parameter.
See:

readonly primitives : PrimitiveCollection

获得原始人集.

readonly renderError : Event

Gets the event that will be raised when an error is thrown inside the render function. Scene 实例和抛出的错误是传递给事件处理器的唯一两个参数. 默认情况下, 错误不会在此事件升起后重排, 但可以通过设置更改 the rethrowRenderErrors property.

requestRenderMode : boolean

当 NT 0 true NT 1 ,渲染一个帧只有在场景内的变化决定需要时才会发生. Enabling improves performance of the application, but requires using Scene#requestRender 以此模式创建新框架。 在许多情况下,这在作出修改后是必要的 到现场在 NT 0 的其他地方.
Default Value: false
See:

rethrowRenderErrors : boolean

发生在 NT 0 Delder NT 1 的例外总是被抓住,以便提高 renderError event. If this property is true, the error is rethrown after the event is raised. If this property is false, the render function 通常在升起事件后返回.
Default Value: false

readonly sampleHeightSupported : boolean

Returns true if the Scene#sampleHeight and Scene#sampleHeightMostDetailed functions are supported.
See:

readonly scene3DOnly : boolean

获得场景是否优化仅用于3D观看.

readonly screenSpaceCameraController : ScreenSpaceCameraController

获取控制器进行相机输入处理.

shadowMap : ShadowMap

场景光源的影子地图. 如果启用,模型、原始物和地球可能会投影并接收阴影.

skyAtmosphere : SkyAtmosphere|undefined

环绕全球的天空气氛.
Default Value: undefined

skyBox : SkyBox|undefined

The SkyBox used to draw the stars.
Default Value: undefined
See:

specularEnvironmentMaps : string

The url to the KTX2 file containing the specular environment map and convoluted mipmaps for image-based lighting of PBR models.

readonly specularEnvironmentMapsSupported : boolean

Returns true if specular environment maps are supported.
See:

sphericalHarmonicCoefficients : Array.<Cartesian3>

视像照明的球形谐波系数 NT 0 型号.

splitPosition : number

获取或设置在视图端口内的拆分器位置. 有效值在0.0至1.0之间.

sun : Sun|undefined

The Sun.
Default Value: undefined

sunBloom : boolean

启用时在太阳上使用开花过滤器 .
Default Value: true

terrainProvider : TerrainProvider

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

readonly terrainProviderChanged : Event

获得一个在地形提供者被改变时提升的事件

useDepthPicking : boolean

当 NT 0 real NT 1 时,允许使用深度缓冲器进行采样.
Default Value: true

useWebVR : boolean

当 NT 0 real NT 1 时,将场景分为两个视点,对左右双眼有视线. 用于纸板和WebVR.
Default Value: false

verticalExaggeration : number

场景的垂直夸张. 当设置为1.0时,不应用夸张.
Default Value: 1.0

verticalExaggerationRelativeHeight : number

垂直夸大场景的参考高度. 设定为0.0时,相对于椭圆表面应用夸张.
Default Value: 0.0

Methods

cartesianToCanvasCoordinates(position, result)Cartesian2|undefined

-NT=0=0========================================================================================================================================================================================================================================================= 这通常用于放置 HTML 元素与场景中的物体位于同一屏幕位置.
Name Type Description
position Cartesian3 笛卡尔座标中的位置.
result Cartesian2 optional 可选对象返回转换为画布坐标的输入位置 .
Returns:
未提供修改的结果参数或新的 NT% 0 实例 。 如果输入位置位于椭圆形中心附近,则可能是 unguide .
Example:
// Output the canvas position of longitude/latitude (0, 0) every time the mouse moves.
const scene = widget.scene;
const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
    console.log(scene.cartesianToCanvasCoordinates(position));
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

clampToHeight(cartesian, objectsToExclude, width, result)Cartesian3|undefined

将给定的笛卡尔位置固定在大地表平面正常的场景几何上. 返回 如果没有场景几何可以夹住,则夹住位置或 NT 0 未定义 NT 1 . 可能用来夹住 地球的物体 3D平面 或场景中的原始人.

此函数只抓住当前视图中渲染的地球牌和三维牌。 粘贴到 所有其它原始人,不管他们的能见度如何.

Name Type Default Description
cartesian Cartesian3 笛卡尔的位置.
objectsToExclude Array.<object> optional 列出原始物,实体,或三维梯状物特征,以不受夹击.
width number 0.1 optional Width of the intersection volume in meters.
result Cartesian3 optional 可选对象返回夹住的位置 .
Returns:
未提供修改的结果参数或新的 NT% 0 实例 。 如果没有场景几何来夹住的话, 这可能是 NT 1 未定义 NT 2 .
Throws:
  • DeveloperError : clampToHeight is only supported in 3D mode.
  • DeveloperError : clampToHeight requires depth texture support. Check clampToHeightSupported.
Example:
// Clamp an entity to the underlying scene geometry
const position = entity.position.getValue(Cesium.JulianDate.now());
entity.position = viewer.scene.clampToHeight(position);
See:

clampToHeightMostDetailed(cartesians, objectsToExclude, width)Promise.<Array.<(Cartesian3|undefined)>>

Initiates an asynchronous Scene#clampToHeight query for an array of Cartesian3 positions 使用场景中3D 梯形的最大细节级别. 返回一个承诺,当 查询完成。 每个职位都有修改。 如果一个位置由于没有几何而不能被夹住 可以在那个位置进行采样,或者发生另一个错误,数组中的元素被设定为未定义.
Name Type Default Description
cartesians Array.<Cartesian3> 笛卡尔的姿势要用夹住的姿势更新.
objectsToExclude Array.<object> optional 列出原始物,实体,或三维梯状物特征,以不受夹击.
width number 0.1 optional Width of the intersection volume in meters.
Returns:
A promise that resolves to the provided list of positions when the query has completed. Positions may become undefined if they cannot be clamped.
Throws:
  • DeveloperError : clampToHeightMostDetailed is only supported in 3D mode.
  • DeveloperError : clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.
Example:
const cartesians = [
    entities[0].position.getValue(Cesium.JulianDate.now()),
    entities[1].position.getValue(Cesium.JulianDate.now())
];
const promise = viewer.scene.clampToHeightMostDetailed(cartesians);
promise.then(function(updatedCartesians) {
    entities[0].position = updatedCartesians[0];
    entities[1].position = updatedCartesians[1];
}
See:

completeMorph()

即时完成主动过渡.

destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic 释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
scene = scene && scene.destroy();
See:

drillPick(windowPosition, limit, width, height)Array.<any>

Returns a list of objects, each containing a primitive property, for all primitives at 特定窗口坐标位置。 其他属性也可根据下列情况确定: 类型原始,可用于进一步识别所选对象。 原始人进入 名单由他们在现场的视觉顺序(前向后)排序.
Name Type Default Description
windowPosition Cartesian2 要执行的窗口坐标 .
limit number optional 如果供应,在收集了这么多采样后,停止钻探.
width number 3 optional Width of the pick rectangle.
height number 3 optional Height of the pick rectangle.
Returns:
一组物体,每个都包含一个被选中的原始人.
Throws:
Example:
const pickedObjects = scene.drillPick(new Cesium.Cartesian2(100.0, 200.0));
See:

getCompressedTextureFormatSupported(format)boolean

确定是否支持压缩的纹理格式.
Name Type Description
format string The texture format. May be the name of the format or the WebGL extension name, e.g. s3tc or WEBGL_compressed_texture_s3tc.
Returns:
是否支持格式 .

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 .

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
true if this object was destroyed; otherwise, false.
See:

morphTo2D(duration)

同步将场景转换为2D.
Name Type Default Description
duration number 2.0 optional 过渡动画完成的时间,以秒计.

morphTo3D(duration)

同步将场景转换为3D.
Name Type Default Description
duration number 2.0 optional 过渡动画完成的时间,以秒计.

morphToColumbusView(duration)

同步向哥伦布景区过渡.
Name Type Default Description
duration number 2.0 optional 过渡动画完成的时间,以秒计.

pick(windowPosition, width, height)object|undefined

返回带有 NT 0 primitive NT 1 的包含场景中第一个(顶部)原始属性的对象 在一个特定的窗口坐标上,或者如果位置上什么都没有,则在 NT 0 未定义 NT 1 。 其他财产可能 可能根据原始对象的类型来设定,并可用于进一步识别所选对象.

When a feature of a 3D Tiles tileset is picked, pick returns a Cesium3DTileFeature object.

Name Type Default Description
windowPosition Cartesian2 Window coordinates to perform picking on.
width number 3 optional Width of the pick rectangle.
height number 3 optional Height of the pick rectangle.
Returns:
Object containing the picked primitive or undefined if nothing is at the location.
Example:
// On mouse over, color the feature yellow.
handler.setInputAction(function(movement) {
    const feature = scene.pick(movement.endPosition);
    if (feature instanceof Cesium.Cesium3DTileFeature) {
        feature.color = Cesium.Color.YELLOW;
    }
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

pickAsync(windowPosition, width, height)Promise.<(Object|undefined)>

Performs the same operation as Scene.pick but asynchonosly without blocking the main render thread. 需要使用回转的 WebGL2 .
Name Type Default Description
windowPosition Cartesian2 Window coordinates to perform picking on.
width number 3 optional Width of the pick rectangle.
height number 3 optional Height of the pick rectangle.
Returns:
Object containing the picked primitive or undefined if nothing is at the location.
Example:
// On mouse over, color the feature yellow.
handler.setInputAction(function(movement) {
    const feature = scene.pickAsync(movement.endPosition).then(function(feature) {
       if (feature instanceof Cesium.Cesium3DTileFeature) {
           feature.color = Cesium.Color.YELLOW;
       }
    });
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
See:

pickMetadata(windowPosition, schemaId, className, propertyName)MetadataValue|undefined

在给定窗口位置选择元数据值 .
Name Type Description
windowPosition Cartesian2 要执行的窗口坐标 .
schemaId string | undefined 用于选择值的元数据计划的ID from. If this is undefined, then it will pick the values from the object 符合给定的类名和财产名的, 不论计划编号.
className string 要选择的元数据类名称 values from
propertyName string 要选择的元数据属性名称 values from
Returns:
元数据值, 或 NT 0 未定义 NT 1 何时 在指定位置找不到匹配的元数据
Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

pickMetadataSchema(windowPosition)MetadataSchema|undefined

在给定位置选择对象元数据的计划
Name Type Description
windowPosition Cartesian2 要执行的窗口坐标 .
Returns:
The metadata schema, or undefined if there is no object with 在给定位置上关联元数据.
Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

pickPosition(windowPosition, result)Cartesian3

返回从深度缓冲和窗口位置重建的笛卡尔位置.

从2D的深度缓冲器重建的位置可能与那些稍有不同 重建于3D和哥伦布景区. 这是因为分配的不同 透视和正图投影的深度值.

Set Scene#pickTranslucentDepth to true to include the depth of 半透明原始人;否则,这基本上是通过半透明原始人采摘的.

Name Type Description
windowPosition Cartesian2 要执行的窗口坐标 .
result Cartesian3 optional 用于恢复结果的对象.
Returns:
笛卡尔的位置.
Throws:
  • DeveloperError : Picking from the depth buffer is not supported. Check pickPositionSupported.

pickVoxel(windowPosition, width, height)VoxelCell|undefined

Returns a VoxelCell for the voxel sample rendered at a particular window coordinate, 如果该位置没有调色器 .
Name Type Default Description
windowPosition Cartesian2 Window coordinates to perform picking on.
width number 3 optional Width of the pick rectangle.
height number 3 optional Height of the pick rectangle.
Returns:
Information about the voxel cell rendered at the picked position or undefined if no voxel is rendered at that position.
Example:
On left click, report the value of the "color" property at that voxel sample.
handler.setInputAction(function(movement) {
  const voxelCell = scene.pickVoxel(movement.position);
  if (defined(voxelCell)) {
    console.log(voxelCell.getProperty("color"));
  }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

render(time)

更新和渲染现场。 通常不需要调用此函数 直接因为 CesiumWidget 将自动完成.
Name Type Description
time JulianDate optional 模拟时间.

requestRender()

Requests a new rendered frame when Scene#requestRenderMode is set to true. The render rate will not exceed the CesiumWidget#targetFrameRate.
See:

sampleHeight(position, objectsToExclude, width)number|undefined

Returns the height of scene geometry at the given cartographic position or undefined if there was no 场景几何到样本高度。 输入位置的高度被忽略. 可能用于夹住对象到 地球,三维梯,或原始人 在现场.

此函数仅从当前视图中渲染的地球牌和三维牌的高度样本 。 样本高度 来自其他原始人 不管他们的能见度.

Name Type Default Description
position Cartographic 绘图位置来取样高度.
objectsToExclude Array.<object> optional 列出原始物,实体,或3D梯状物特征列表,不从中取样高度.
width number 0.1 optional Width of the intersection volume in meters.
Returns:
高处. 如果没有场景几何来取样高度的话, 这可能是 NT 0 undefined NT 1 .
Throws:
  • DeveloperError : sampleHeight is only supported in 3D mode.
  • DeveloperError : sampleHeight requires depth texture support. Check sampleHeightSupported.
Example:
const position = new Cesium.Cartographic(-1.31968, 0.698874);
const height = viewer.scene.sampleHeight(position);
console.log(height);
See:

sampleHeightMostDetailed(positions, objectsToExclude, width)Promise.<Array.<(Cartographic|undefined)>>

Initiates an asynchronous Scene#sampleHeight query for an array of Cartographic positions 使用场景中3D 梯形的最大细节级别. 输入位置的高度被忽略. 返回一个在查询完成后解决的许诺 。 每点高度都会被修改到位. 如果一个高度不能确定,因为无法在该地点取样,或者发生另一个错误, 高度设置为 NT 0 未定义 NT 1 .
Name Type Default Description
positions Array.<Cartographic> 以取样高度更新的制图位置.
objectsToExclude Array.<object> optional 列出原始物,实体,或3D梯状物特征列表,不从中取样高度.
width number 0.1 optional Width of the intersection volume in meters.
Returns:
A promise that resolves to the provided list of positions when the query has completed. Positions may become undefined if the height cannot be determined.
Throws:
  • DeveloperError : sampleHeightMostDetailed is only supported in 3D mode.
  • DeveloperError : sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.
Example:
const positions = [
    new Cesium.Cartographic(-1.31968, 0.69887),
    new Cesium.Cartographic(-1.10489, 0.83923)
];
const promise = viewer.scene.sampleHeightMostDetailed(positions);
promise.then(function(updatedPosition) {
    // positions[0].height and positions[1].height have been updated.
    // updatedPositions is just a reference to positions.
}
See:

setTerrain(terrain)Terrain

更新提供地球表面几何的地形 .
Name Type Description
terrain Terrain 地形提供者 Aync 帮助器
Returns:
地形 地形提供者 Aync 帮助器
Examples:
// Use Cesium World Terrain
scene.setTerrain(Cesium.Terrain.fromWorldTerrain());
// Use a custom terrain provider
const terrain = new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl("https://myTestTerrain.com"));
scene.setTerrain(terrain);

terrain.errorEvent.addEventListener(error => {
  alert(`Encountered an error while creating terrain! ${error}`);
});
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.