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

Gets or sets the single-sided rendering state of the ball.

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

ellipsoid : Ellipsoid

Get a geometric ellipsoid object that describes the Earth.

enableLighting : Boolean

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

globeAlpha : Number

Gets or sets the transparency of the Earth's surface.

HypsometricSetting : Object

Earth layering and coloring (for submerged analysis, simulation contours, topography, etc.).
See:

imageryLayers : ImageryLayerCollection

Get a collection of image layers.

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

Gets or sets the material of the earth's surface. 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

Gets or sets the slope of the earth.

splitDirection : Cartesian2

Set or obtain the direction of the roller blind: horizontal roller blind (1,0) or vertical roller blind (0,1)

terrainProvider : TerrainProvider

Get or set the terrain service provider for the Earth.

readonlyterrainProviderChanged : Event

Get the event changed by the terrain service provider and trigger the event when the earth's terrain service provider changes.

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

Add a terrain excavation area.
Name Type Description
options Object The terrain excavation parameters contain the following properties:
Name Type Description
position Array Excavation area location information.
name String Excavation area name.
height String Excavate the underground depth.
transparent Boolean Whether the surface is transparent.
Returns:
Bool returns true if successful, and false returns if it fails.
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

Add a terrain modification area.
Name Type Description
options Object The Modify Region Parameter object contains the following properties:
Name Type Description
position Array Modify the location information.
name String Modify the zone name.
Returns:
Returns true if successful, false returns false.
Example:
var pts = [lon1,lat1,h1,lon2,lat2,h2,lon3,lat3,h3];
viewer.scene.globe.addModifyRegion({
				name : 'test',
				position : pts,
			});

clearCustomClipBox()

Clear the custom crop faces.

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

Get the height corresponding to the latitude and longitude.
Name Type Description
Cartographic Number Latitude and longitude values.
Returns:
Height value.

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

Obtain the intersection of the ray and the Earth (the ray must be a three-dimensional world coordinate).
Name Type Description
Ray Number Ray, used for camera testing.
Scene Object Scene object.
result Cartesian3 optional 3D space coordinates for saving results.
Returns:
If they do not intersect, return the three-dimensional coordinates of the intersection.
Example:
// Find the intersection of the Earth and the Earth through a pixel of the screen space and the camera.
var ray = viewer.camera.getPickRay(windowCoordinates);
var intersection = globe.pick(ray, scene);

removeAllExcavationRegion()

Remove all excavation faces.
Example:
viewer.scene.globe.removeAllExcavationRegion();

removeAllModifyRegion()

Remove all terrain modified areas.
Example:
viewer.scene.globe.removeAllModifyRegion();

setCustomClipBox(options)Boolean

Add a custom clipping face.
Name Type Description
options Object The crop face parameters contain the following properties:
Name Type Description
dimensions Cartesian3 Cut the length and width of the box.
position Cartesian3 The box cuts the center position.
heading Number Crop the heading angle of the box.
pitch Number Crop the pitch angle of the box.
roll Number Crop the roll angle of the box.
clipLineColor Color Crop line color.
clipMode String Crop mode, including cropping plane, cropping plane, and only retaining lines.
Returns:
Bool returns true if successful, and false returns if it fails.
Throws:
  • DeveloperError : options and options.dimensions and options.position are required.

setPolygonOffset(polyOffsetFactor, polyOffsetUnits)

Set the terrain polygon offset scale factor and offset constant.
Name Type Description
polyOffsetFactor Number Offset scaling factor, default is 0.
polyOffsetUnits Number Offset constant, default is 0.