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
-
获取地球的基础颜色(当没有影像可用时)。
-
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
-
ellipsoid : Ellipsoid
-
获取描述地球的几何椭球体对象。
-
Enable lighting the globe with the sun as a light source.
-
Default Value:
false
-
获取或者设置地球表面的透明度。
-
地球分层设色(用于淹没分析、模拟等高线面、地形地貌走势等)。
See:
-
imageryLayers : ImageryLayerCollection
-
获取影像图层集合。
-
The distance where lighting resumes. This only takes effect when
enableLighting
istrue
.-
Default Value:
9000000.0
-
The distance where everything becomes lit. This only takes effect when
enableLighting
istrue
.-
Default Value:
6500000.0
-
material : Material
-
获取或者设置地球表面的材质。 Fabric.
-
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
-
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
-
Determines if the globe will be shown.
-
Default Value:
true
-
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
-
获取或者设置地球坡度坡向。
-
terrainProvider : TerrainProvider
-
获取或者设置地球的地形服务提供者。
-
readonlyterrainProviderChanged : Event
-
获取地形服务提供者改变的事件,当地球的地形服务提供者变化时触发该事件。
-
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
-
添加地形开挖区域。
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 });
-
添加地形修改区域。
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, });
-
清除自定义裁剪面。
-
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 thanisDestroyed
will result in aDeveloperError
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:
-
-
获取经纬度对应的高度。
Name Type Description Cartographic
Number 经纬度值。 Returns:
高度值。 -
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in aDeveloperError
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);
-
移除所有开挖面。
Example:
viewer.scene.globe.removeAllExcavationRegion();
-
移除所有地形修改的区域。
Example:
viewer.scene.globe.removeAllModifyRegion();
-
添加自定义裁剪面。
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.
-
-
设置地形多边形偏移缩放因子和偏移常量。
Name Type Description polyOffsetFactor
Number 偏移缩放因子,默认为0。 polyOffsetUnits
Number 偏移常量,默认为0。