Globe

new Cesium.Globe(ellipsoid)

场景中渲染的地球,包括地形 (Globe#terrainProvider) 和影像图层(Globe#imageryLayers)
Name Type Default Description
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 确定地球的大小和形状

Members

baseColor : Color

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

clippingType : Number

设置地形裁剪(开挖)的类型。默认为开挖内部区域。
Default Value: ClippingType.KeepOutside

cullEnabled : Boolean

获取或设置球皮单双面渲染状态(是否剔除背面,默认为否,即单面渲染)。

depthTestAgainstTerrain : Boolean

如果布告板/折线/标签等针对地形表面开启深度检测,则不会被遮挡。
Default Value: true

ellipsoid : Ellipsoid

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

enableLighting : Boolean

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

excavationBottomTextureUrl : String

用于地形开挖纹理设置,底面纹理路径。如果设置为undefined或者null,则不使用贴图。

excavationSideTextureUrl : String

用于地形开挖纹理设置,侧面纹理路径。如果设置为undefined或者null,则不使用贴图。 纹理图片的分辨率必须为2的N次方。

globeAlpha : Number

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

HypsometricSetting : Object

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

imageryLayers : ImageryLayerCollection

获取影像图层集合。

imageryLodTolerance : Number

影像切换精细层必须大于的块数
Default Value: 16

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

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

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

showExcavationSide : boolean

是否显示开挖地形的侧边,默认是true。
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 : BoundingRectangle

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

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

tileCacheSizeForMVT : Number

The size of the MVT 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 地表是否透明。
textureWrap TextureWrap 用于指定开挖纹理的贴图方式,默认值为Cesium.TextureWrap.REPEAT。
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
                textureWrap :Cesium.TextureWrap.REPEAT // 重复贴图
                textureWrap :Cesium.TextureWrap.CLAMP_TO_EDGE // 不重复贴图(拉伸到边缘贴图)
            });

addExtractRegion(options)

地形开挖抽出显示效果
Name Type Description
options Object 地形开挖抽出参数包含以下属性:
Name Type Description
name String 该开挖区域的名称
position Array 地形开挖区域
height Number 地形开挖深度
transparent Boolean 封边是否透明,默认值:false
extractHeight Number 地形开挖抽出高度,默认值:100
granularity Number 地形开挖精度,越小越精确,默认值:1
Example:
viewer.scene.globe.addExtractRegion({
 name:'ggg',
 position:positions,
 height:50,
 transparent:transparent,
 extractHeight:200
 });

addImageryClipRegions(options)

影像裁剪
Name Type Description
options Object 影像裁剪参数包含以下属性:
Name Type Description
position Array 裁剪区域
layers Array 参与裁剪的影像图层
name String 该裁剪区域的name(key值)

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, ellipsoid, slice)number

计算贴地面积。
Name Type Description
polygonGeometry Object polygonGeometry类中的对象,用于确定面积量算的范围
ellipsoid Ellipsoid 椭球。即计算贴地面积时所采用的椭球,默认值为WGS84椭球
slice Number optional 拆分粒度。支持用户自定义多边形拆分的粒度,若不设置则根据多边形的范围设置粒度
Returns:
PolygonGeometry对象范围内的贴地面积
Example:
var ellipsoid = Cesium.Ellipsoid.WGS84;
var area = scene.globe.computeSurfaceArea(polygonGeometry, ellipsoid, 10);

computeSurfaceDistance(polylineGeometry, ellipsoid)number

计算贴地距离。
Name Type Description
polylineGeometry Object polylineGeometry类中的对象,用于确定距离量算的范围
ellipsoid Ellipsoid 椭球。即计算贴地距离时所采用的椭球体,默认值为WGS84椭球
Returns:
PolylineGeometry对象对应的贴地距离
Example:
var ellipsoid = Cesium.Ellipsoid.WGS84;
var distance = scene.globe.computeSurfaceDistance(polylineGeometry,ellipsoid);

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:
高度值。

getSlopeDirectionValue()slopeDirection

获取地形坡度方向,传入弧度坐标,返回的结果以正北为0度。
Returns:
坡度方向

getSlopeValue()slopeValue

获取地形坡度值
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();

removeAllExtractRegion()

移除所有开挖区域和抽出部分
Example:
viewer.scene.globe.removeAllExtractRegion();

removeAllModifyRegion()

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

removeExtractRegion()

移除地形当前开挖区域和抽出部分
Example:
viewer.scene.globe.removeExtractRegion();

removeImageryClipRegion(name, layers)

移除裁剪区域
Name Type Description
name String 该裁剪区域的name(key值)
layers Array 参与裁剪的影像图层

removePBRMaterial()

用于移除PBR材质。

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 裁剪线颜色。
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。