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

baseColor : Color

获取地球的基础颜色(当没有影像可用时)。

cullEnabled : Boolean

获取或设置球皮单双面渲染状态。

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: true

ellipsoid : Ellipsoid

获取描述地球的几何椭球体对象。

enableLighting : Boolean

Enable lighting the globe with the sun as a light source.
Default Value: false

globeAlpha : Number

获取或者设置地球表面的透明度。

HypsometricSetting : Object

地球分层设色(用于淹没分析、模拟等高线面、地形地貌走势等)。
See:

imageryLayers : ImageryLayerCollection

获取影像图层集合。

lightingFadeInDistance : Number

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

lightingFadeOutDistance : Number

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

material : Material

获取或者设置地球表面的材质。 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

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')

shadows : ShadowMode

Determines whether the globe casts or receives shadows from each light source. 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

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

SlopeSetting : Object

获取或者设置地球坡度坡向。

splitDirection : Cartesian2

卷帘方向:横向(1,0)屏蔽左侧,(-1, 0)屏蔽右侧;或者纵向(0,1)屏蔽下方,(0, -1)屏蔽上方

swipeEnabled : Boolean

获取或者设置是否开启卷帘功能。

swipeRegion : Rectangle

获取或者设置卷帘的四边形区域。

terrainProvider : TerrainProvider

获取或者设置地球的地形服务提供者。

readonlyterrainProviderChanged : Event

获取地形服务提供者改变的事件,当地球的地形服务提供者变化时触发该事件。

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

Methods

addExcavationRegion(options)Boolean

添加地形开挖区域。
Name Type Description
options Object 地形开挖参数包含以下属性:
Name Type Description
position Array 开挖区域位置信息。
name String 开挖区域名称。
height String 开挖地下深度。
transparent Boolean 地表是否透明。
Returns:
bool 成功返回true,失败返回false。
Example:
var pts = [lon1,lat1,h1,lon2,lat2,h2,lon3,lat3,h3];
viewer.scene.globe.addExcavationRegion({
                name : 'test' ,
                position : pts,
                height : 100,
                transparent : false
            });

addModifyRegion(options)Boolean

添加地形修改区域。
Name Type Description
options Object 修改区域参数对象包含以下属性:
Name Type Description
position Array 修改区域位置信息。
name String 修改区域名称。
Returns:
成功返回true,失败返回false。
Example:
var pts = [lon1,lat1,h1,lon2,lat2,h2,lon3,lat3,h3];
viewer.scene.globe.addModifyRegion({
				name : 'test',
				position : pts,
			});

clearCustomClipBox()

清除自定义裁剪面。

computeSurfaceArea(polygonGeometry)number

计算贴地面积。
Name Type Description
polygonGeometry Object polygonGeometry类中的对象,用于确定面积量算的范围
Returns:
PolygonGeometry对象范围内的贴地面积
Example:
var area = scene.globe.computeSurfaceArea(polygonGeometry);

computeSurfaceDistance(polylineGeometry)number

计算贴地距离。
Name Type Description
polylineGeometry Object polylineGeometry类中的对象,用于确定距离量算的范围
Returns:
PolylineGeometry对象对应的贴地距离
Example:
var distance = scene.globe.computeSurfaceDistance(polylineGeometry);

destroy()undefined

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.
Returns:
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
globe = globe && globe.destroy();
See:

getHeight(Cartographic)Number|undefined

获取经纬度对应的高度。
Name Type Description
Cartographic Number 经纬度值。
Returns:
高度值。

getVisibleTiles()Array

获取可见切片。
Returns:
对象列表,其中对象的属性为x、y、level

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

获取射线和地球的交点(射线必须是三维世界坐标)。
Name Type Description
Ray Number 射线,用于相机测试。
Scene Object 场景对象。
result Cartesian3 optional 三维空间坐标,用于保存结果。
Returns:
如果不相交,返回交点的三维空间坐标。
Example:
// 通过屏幕空间的一个像素和相机的射线查找和地球的交点。
var ray = viewer.camera.getPickRay(windowCoordinates);
var intersection = globe.pick(ray, scene);

removeAllExcavationRegion()

移除所有开挖面。
Example:
viewer.scene.globe.removeAllExcavationRegion();

removeAllModifyRegion()

移除所有地形修改的区域。
Example:
viewer.scene.globe.removeAllModifyRegion();

setCustomClipBox(options)Boolean

添加自定义裁剪面。
Name Type Description
options Object 裁剪面参数包含以下属性:
Name Type Description
dimensions Cartesian3 裁剪box的长宽高。
position Cartesian3 box裁剪中心位置。
heading Number 裁剪box的heading角度。
pitch Number 裁剪box的pitch角度。
roll Number 裁剪box的roll角度。
clipLineColor Color 裁剪线颜色。
clipMode String 裁剪模式,包括裁剪平面内、裁剪平面外、只保留线。
Returns:
bool 成功返回true,失败返回false。
Throws:
  • DeveloperError : options and options.dimensions and options.position are required.

setPolygonOffset(polyOffsetFactor, polyOffsetUnits)

设置地形多边形偏移缩放因子和偏移常量。
Name Type Description
polyOffsetFactor Number 偏移缩放因子,默认为0。
polyOffsetUnits Number 偏移常量,默认为0。