Globe

new Cesium.Globe(ellipsoid)

The globe rendered in the scene, including its terrain (Globe#terrainProvider) and imagery layers (Globe#imageryLayers). Access the globe using Scene#globe.
Name Type Default Description
ellipsoid Ellipsoid Ellipsoid.WGS84 optional Determines the size and shape of the globe.

Members

atmosphereBrightnessShift : Number

The brightness shift to apply to the atmosphere. Defaults to 0.0 (no shift). A brightness shift of -1.0 is complete darkness, which will let space show through.
Default Value: 0.0

atmosphereHueShift : Number

The hue shift to apply to the atmosphere. Defaults to 0.0 (no shift). A hue shift of 1.0 indicates a complete rotation of the hues available.
Default Value: 0.0

atmosphereLightIntensity : Number

The intensity of the light that is used for computing the ground atmosphere color.
Default Value: 10.0

atmosphereMieAnisotropy : Number

The anisotropy of the medium to consider for Mie scattering.

Valid values are between -1.0 and 1.0.

Default Value: 0.9

atmosphereMieCoefficient : Cartesian3

The Mie scattering coefficient used in the atmospheric scattering equations for the ground atmosphere.
Default Value: Cartesian3(21e-6, 21e-6, 21e-6)

atmosphereMieScaleHeight : Number

The Mie scale height used in the atmospheric scattering equations for the ground atmosphere, in meters.
Default Value: 3200.0

atmosphereRayleighCoefficient : Cartesian3

The Rayleigh scattering coefficient used in the atmospheric scattering equations for the ground atmosphere.
Default Value: Cartesian3(5.5e-6, 13.0e-6, 28.4e-6)

atmosphereRayleighScaleHeight : Number

The Rayleigh scale height used in the atmospheric scattering equations for the ground atmosphere, in meters.
Default Value: 10000.0

atmosphereSaturationShift : Number

The saturation shift to apply to the atmosphere. Defaults to 0.0 (no shift). A saturation shift of -1.0 is monochrome.
Default Value: 0.0

backFaceCulling : Boolean

Whether to cull back-facing terrain. Back faces are not culled when the camera is underground or translucency is enabled.
Default Value: true
Gets or sets the color of the globe when no imagery is available.

cartographicLimitRectangle : Rectangle

A property specifying a Rectangle used to limit globe rendering to a cartographic area. Defaults to the maximum extent of cartographic coordinates.
Default Value: Rectangle.MAX_VALUE
A property specifying a ClippingPlaneCollection used to selectively disable rendering on the outside of each plane.

depthTestAgainstTerrain : Boolean

True if primitives such as billboards, polylines, labels, etc. should be depth-tested against the terrain surface, or false if such primitives should always be drawn on top of terrain unless they're on the opposite side of the globe. The disadvantage of depth testing primitives against terrain is that slight numerical noise or terrain level-of-detail switched can sometimes make a primitive that should be on the surface disappear underneath it.
Default Value: false

dynamicAtmosphereLighting : Boolean

Enable dynamic lighting effects on atmosphere and fog. This only takes effect when enableLighting is true.
Default Value: true

dynamicAtmosphereLightingFromSun : Boolean

Whether dynamic atmosphere lighting uses the sun direction instead of the scene's light direction. This only takes effect when enableLighting and dynamicAtmosphereLighting are true.
Default Value: false
Gets an ellipsoid describing the shape of this globe.

enableLighting : Boolean

Enable lighting the globe with the scene's light source.
Default Value: false

fillHighlightColor : Color

The color to use to highlight terrain fill tiles. If undefined, fill tiles are not highlighted at all. The alpha value is used to alpha blend with the tile's actual color. Because terrain fill tiles do not represent the actual terrain surface, it may be useful in some applications to indicate visually that they are not to be trusted.
Default Value: undefined
Gets the collection of image layers that will be rendered on this globe.

readonly imageryLayersUpdatedEvent : Event

Gets an event that's raised when an imagery layer is added, shown, hidden, moved, or removed.

lambertDiffuseMultiplier : Number

A multiplier to adjust terrain lambert lighting. This number is multiplied by the result of czm_getLambertDiffuse in GlobeFS.glsl. This only takes effect when enableLighting is true.
Default Value: 0.9

lightingFadeInDistance : Number

The distance where lighting resumes. This only takes effect when enableLighting or showGroundAtmosphere is true.
Default Value: 20000000.0

lightingFadeOutDistance : Number

The distance where everything becomes lit. This only takes effect when enableLighting or showGroundAtmosphere is true.
Default Value: 10000000.0

loadingDescendantLimit : Number

Gets or sets the number of loading descendant tiles that is considered "too many". If a tile has too many loading descendants, that tile will be loaded and rendered before any of its descendants are loaded and rendered. This means more feedback for the user that something is happening at the cost of a longer overall load time. Setting this to 0 will cause each tile level to be loaded successively, significantly increasing load time. Setting it to a large number (e.g. 1000) will minimize the number of tiles that are loaded but tend to make detail appear all at once after a long wait.
Default Value: 20

material : Material|undefined

Gets or sets the material appearance of the Globe. This can be one of several built-in Material objects or a custom material, scripted with Fabric.

maximumScreenSpaceError : Number

The maximum screen-space error used to drive level-of-detail refinement. Higher values will provide better performance but lower visual quality.
Default Value: 2

nightFadeInDistance : Number

The distance where the darkness of night from the ground atmosphere fades in to an unlit ground atmosphere. This only takes effect when showGroundAtmosphere, enableLighting, and dynamicAtmosphereLighting are true.
Default Value: 50000000.0

nightFadeOutDistance : Number

The distance where the darkness of night from the ground atmosphere fades out to a lit ground atmosphere. This only takes effect when showGroundAtmosphere, enableLighting, and dynamicAtmosphereLighting are true.
Default Value: 10000000.0

oceanNormalMapUrl : String

The normal map to use for rendering waves in the ocean. Setting this property will only have an effect if the configured terrain provider includes a water mask.
Default Value: buildModuleUrl('Assets/Textures/waterNormalsSmall.jpg')

preloadAncestors : Boolean

Gets or sets a value indicating whether the ancestors of rendered tiles should be preloaded. Setting this to true optimizes the zoom-out experience and provides more detail in newly-exposed areas when panning. The down side is that it requires loading more tiles.
Default Value: true

preloadSiblings : Boolean

Gets or sets a value indicating whether the siblings of rendered tiles should be preloaded. Setting this to true causes tiles with the same parent as a rendered tile to be loaded, even if they are culled. Setting this to true may provide a better panning experience at the cost of loading more tiles.
Default Value: false
Determines whether the globe casts or receives shadows from light sources. Setting the globe to cast shadows may impact performance since the terrain is rendered again from the light's perspective. Currently only terrain that is in view casts shadows. By default the globe does not cast shadows.
Default Value: ShadowMode.RECEIVE_ONLY

show : Boolean

Determines if the globe will be shown.
Default Value: true

showGroundAtmosphere : Boolean

Enable the ground atmosphere, which is drawn over the globe when viewed from a distance between lightingFadeInDistance and lightingFadeOutDistance.
Default Value: true

showSkirts : Boolean

Whether to show terrain skirts. Terrain skirts are geometry extending downwards from a tile's edges used to hide seams between neighboring tiles. Skirts are always hidden when the camera is underground or translucency is enabled.
Default Value: true

showWaterEffect : Boolean

True if an animated wave effect should be shown in areas of the globe covered by water; otherwise, false. This property is ignored if the terrainProvider does not provide a water mask.
Default Value: true

terrainExaggeration : Number

A scalar used to exaggerate the terrain. Defaults to 1.0 (no exaggeration). A value of 2.0 scales the terrain by 2x. A value of 0.0 makes the terrain completely flat. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
Default Value: 1.0

terrainExaggerationRelativeHeight : Number

The height from which terrain is exaggerated. Defaults to 0.0 (scaled relative to ellipsoid surface). Terrain that is above this height will scale upwards and terrain that is below this height will scale downwards. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid. If Globe#terrainExaggeration is 1.0 this value will have no effect.
Default Value: 0.0
The terrain provider providing surface geometry for this globe.

readonly terrainProviderChanged : Event

Gets an event that's raised when the terrain provider is changed

tileCacheSize : Number

The size of the terrain tile cache, expressed as a number of tiles. Any additional tiles beyond this number will be freed, as long as they aren't needed for rendering this frame. A larger number will consume more memory but will show detail faster when, for example, zooming out and then back in.
Default Value: 100

tileLoadProgressEvent : Event

Gets an event that's raised when the length of the tile load queue has changed since the last render frame. When the load queue is empty, all terrain and imagery for the current view have been loaded. The event passes the new length of the tile load queue.

readonly tilesLoaded : Boolean

Returns true when the tile load queue is empty, false otherwise. When the load queue is empty, all terrain and imagery for the current view have been loaded.
Properties for controlling globe translucency.

undergroundColor : Color

The color to render the back side of the globe when the camera is underground or the globe is translucent, blended with the globe color based on the camera's distance.

To disable underground coloring, set undergroundColor to undefined.
Default Value: Color.BLACK
See:

undergroundColorAlphaByDistance : NearFarScalar

Gets or sets the near and far distance for blending Globe#undergroundColor with the globe color. The alpha will interpolate between the NearFarScalar#nearValue and NearFarScalar#farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far. Outside of these ranges the alpha remains clamped to the nearest bound. If undefined, the underground color will not be blended with the globe color.

When the camera is above the ellipsoid the distance is computed from the nearest point on the ellipsoid instead of the camera's position.
See:

Methods

addExcavationRegion(options)

图层开挖
Name Type Description
options Object optional 选项有以下属性
Name Type Default Description
name Object optional 开挖区域名称,定义且不可为空值
boundary Array optional 开挖边界,为Cartesian3数组,单位为世界坐标,坐标不闭合
digdepth Number optional 以开挖边界的最低点为基准面定义的下挖深度,默认设置开挖深度为10米
samplecount Number optional 开挖边的分割采样高程点个数,默认30
sideImage String 'buildModuleUrl("Assets/Images/DigBody.jpg")' optional 侧面图像地址url
bottomImage String 'buildModuleUrl("Assets/Images/DigBottom.jpg")' optional 底面面图像地址url
Throws:
  • RuntimeError : name为undefined或者boundary边界范围至少要有3个顶点,坐标为世界坐标.

addExtractRegion(options)Boolean

添加拉伸区域
Name Type Description
options Object optional options具有如下属性
Name Type Default Description
id String optional 拉升区域标记
positions Array.<Cartesian3> optional 抬升区域边界的世界坐标,非闭合。
boundaryHeight Number 10.0 optional 抬升地形的边界面拉伸高度
granularity Number 1.0 optional 细分程度
extractHeight Number 100.0 optional 抬升的高度
createBoundaryGeom Boolean true optional 是否创建边界几何对象
samplecount Number 30.0 optional 开挖边的分割采样高程点个数,默认30
sideImage String 'buildModuleUrl("Assets/Images/DigBody.jpg")' optional 侧面图像地址url,仅对operationType=EXCAVATE有效
bottomImage String 'buildModuleUrl("Assets/Images/DigBottom.jpg")' optional 底面面图像地址url,仅对operationType=EXCAVATE有效
Returns:

addRegionOpetation(options)Object

添加区域操作
Name Type Description
options Object optional options具有如下属性
Name Type Default Description
id String | Number optional 操作ID
positions Array.<Cartesian3> optional 区域顶点坐标
operationType RegionOperationType optional 区域操作类型
operateInner Boolean optional 区域操作内部还是外部
enabled Boolean optional 区域操作是否起作用
flatenHight Number optional 压平高度,仅对operationType=FLATTEN起作用
maskColor Color optional 遮罩颜色,仅对operationType=MASKING起作用
createDigGeom Boolean true optional 是否创建开挖几何对象,仅对operationType=MASKING起作用
digdepth Number optional 以开挖边界的最低点为基准面定义的下挖深度,默认设置开挖深度为10米,仅对operationType=EXCAVATE有效
offsetHeight Number 0.0 optional 以开挖边界的最低点为基准面定义的下挖深度,默认设置开挖深度为10米,仅对operationType=EXCAVATE有效
samplecount Number optional 开挖边的分割采样高程点个数,默认30,仅对operationType=EXCAVATE有效
sideImage String 'buildModuleUrl("Assets/Images/DigBody.jpg")' optional 侧面图像地址url,仅对operationType=EXCAVATE有效
bottomImage String 'buildModuleUrl("Assets/Images/DigBottom.jpg")' optional 底面面图像地址url,仅对operationType=EXCAVATE有效
Returns:

clearCustomClipState()

清除自定义裁剪面
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

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:
globe = globe && globe.destroy();
See:

getHeight(cartographic)Number|undefined

Get the height of the surface at a given cartographic.
Name Type Description
cartographic Cartographic The cartographic for which to find the height.
Returns:
The height of the cartographic or undefined if it could not be found.

isDestroyed()Boolean

Returns true if this object was destroyed; otherwise, false.

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:

pick(ray, scene, result)Cartesian3|undefined

Find an intersection between a ray and the globe surface that was rendered. The ray must be given in world coordinates.
Name Type Description
ray Ray The ray to test for intersection.
scene Scene The scene.
result Cartesian3 optional The object onto which to store the result.
Returns:
The intersection or undefined if none was found.
Example:
// find intersection of ray through a pixel and the globe
const ray = viewer.camera.getPickRay(windowCoordinates);
const intersection = globe.pick(ray, scene);

removeAllExcavationRegion()

移除所有开挖区域

removeAllExtractRegion()

移除所有区域抬升

removeAllRegionOpetation()

移除所有区域操作

removeExcavationRegion(name)

移除指定名称开挖区域
Name Type Description
name String 指定区域的名称

removeExtractRegion(regionKey)

移除指定区域抬升索引
Name Type Description
regionKey String 索引

removeRegionOpetationById(id)Boolean

根据ID移除反区域操作
Name Type Description
id String | Number
Returns:
是否移除成功

setCustomClipBox(boxOption, styleOption)

设置自定义裁剪盒
Name Type Description
boxOption Object 对象具有如下属性:
Name Type Default Description
dimensions Cartesian3 optional 裁剪盒的长宽高,单位:米.
center Cartesian3 optional 裁剪盒的中心点,世界坐标.
heading Number 0.0 optional 裁剪盒绕z轴旋转角度,单位:度.
pitch Number 0.0 optional 裁剪盒绕x轴旋转角度,单位:度.
roll Number 0.0 optional 裁剪盒绕y轴旋转角度,单位:度.
clipInner Boolean true optional 当为true时,表示裁剪盒子内部,否则裁剪盒子外部.
styleOption Object 对象具有如下属性:
Name Type Description
edgeWidth Number optional 裁剪面线的宽度,默认值为1.0.
edgeColor Color optional 裁剪面线的颜色,默认值为Color.WHITE.

setCustomClipDistance(value)

设置裁剪距离,该距离为通过setCustomClipPlane方法设置的裁剪面的距离
Name Type Description
value Number 裁剪距离,单位为米

setCustomClipPlane(firstPos, secondPos, thirdPos, styleOption)

设置自定义裁剪面
Name Type Description
firstPos Cartesian3 optional 裁剪面上第一点,单位为世界坐标.
secondPos Cartesian3 optional 裁剪面上第二点,单位为世界坐标.
thirdPos Cartesian3 optional 裁剪面上第三点,单位为世界坐标.
styleOption Object optional 对象具有如下属性:
Name Type Description
edgeWidth Number optional 裁剪面线的宽度,默认值为1.0.
edgeColor Color optional 裁剪面线的颜色,默认值为Color.WHITE.
Throws:
  • RuntimeError : firstPos,secondPos,thirdPos参数时必需参数,且其类型为 Cartesian3.
Example:
layer.setCustomClipPlane(firstPos, secondPos, thirdPos);
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.