Class: Globe

Globe

new Globe(ellipsoid)

The rendered Earth in the scene, including terrain (Globe#terrainProvider) and imagery layers (Globe#imageryLayers).

Name Type Default Description
ellipsoid Ellipsoid Ellipsoid.WGS84 optional

Determines the size and shape of the Earth.

Members

atmosphereBrightnessShiftNumber

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

atmosphereHueShiftNumber

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

atmosphereSaturationShiftNumber

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

backFaceCullingBoolean

Whether to cull back-facing terrain. Set this to false when viewing terrain from below the surface.

Default Value:
true

baseColorColor

Gets the base color of the Earth (when no imagery is available).

clippingPlanesClippingPlaneCollection

A property specifying a ClippingPlaneCollection used to selectively disable rendering on the outside of each plane.

clippingTypeNumber

Sets the type of terrain clipping (excavation). Default is to excavate the interior.

Default Value:
ClippingType.KeepOutside

cullEnabledBoolean

Gets or sets the culling state of the globe surface (whether to cull back faces, default true for single-sided rendering).

depthTestAgainstTerrainBoolean

If billboards/polylines/labels have depth test enabled against the terrain surface, they will not be occluded.

Default Value:
true

dynamicAtmosphereLightingBoolean

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

Default Value:
true

dynamicAtmosphereLightingFromSunBoolean

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

ellipsoidEllipsoid

Gets the geometric ellipsoid object describing the Earth.

enableLightingBoolean

Enables lighting the Earth using the sun as a light source.

Default Value:
false

excavationBottomTextureUrlString

Used for terrain excavation texture setting, bottom texture path. If set to undefined or null, no texture is used.

excavationSideTextureUrlString

Used for terrain excavation texture setting, side texture path. If set to undefined or null, no texture is used. Texture image resolution must be a power of two.

fillHighlightColorColor

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

globeAlphaNumber

Obtain or set the transparency of the Earth's surface.

HypsometricSettingHypsometricSetting

Earth hypsometric tinting (used for flood analysis, simulating contour surfaces, terrain trends, etc.).

See:

imageryLayersImageryLayerCollection

Gets the collection of imagery layers.

readonly imageryLayersUpdatedEventEvent

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

imageryLodToleranceNumber

The number of tiles that must be exceeded to switch to a finer imagery layer.

Default Value:
16

lightingFadeInDistanceNumber

Distance of lighting attenuation. This only takes effect when enableLighting is true.

Default Value:
20000000.0

lightingFadeOutDistanceNumber

This parameter only takes effect when enableLighting is true.

Default Value:
10000000.0

loadingDescendantLimitNumber

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

materialMaterial

Obtain or set the material of the Earth's surface.

maximumScreenSpaceErrorNumber

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

Default Value:
2

nightFadeInDistanceNumber

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

Default Value:
50000000.0

nightFadeOutDistanceNumber

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

Default Value:
10000000.0

oceanNormalMapUrlString

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

preloadAncestorsBoolean

Gets or sets a value indicating whether to preload the parent of a rendered tile. Setting this to true optimizes the zoom-in experience and provides more detail for newly exposed areas when panning. The downside is it requires loading more tiles.

Default Value:
true

preloadSiblingsBoolean

Gets or sets a value indicating whether to preload siblings of rendered tiles. Setting this to true causes tiles with the same parent as the 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

shadowsShadowMode

Determines whether the Earth casts or receives shadows from each light source. Setting the Earth to cast shadows may impact performance as the terrain is re-rendered from the light's perspective. Currently only terrain in view casts shadows. By default, the Earth does not cast shadows.

Default Value:
ShadowMode.RECEIVE_ONLY

showBoolean

Determines whether to show the Earth.

Default Value:
true

showExcavationSideboolean

Whether to show the sides of excavated terrain. Default is true.

Default Value:
true

showGroundAtmosphereBoolean

Whether to show the ground atmosphere.

Default Value:
true

showSkirtsBoolean

Whether to show terrain skirts. Terrain skirts are geometry extending downwards from a tile's edges used to hide seams between neighboring tiles. It may be desirable to hide terrain skirts if terrain is translucent or when viewing terrain from below the surface.

Default Value:
true

showWaterEffectBoolean

If the animated wave effect is displayed in areas covered by water on Earth, it is correct; Otherwise, it's fake. If terrainProvider does not provide a water area mask, this property is ignored. If the wave animation effect is displayed in an area covered by water on Earth, it is true; Otherwise, it is false. If the terrain provider does not provide a water area mask, this attribute will be ignored.

Default Value:
true

SlopeSettingObject

Obtain or set the slope direction of the Earth. (Note: This interface is not recommended, it is recommended to use the Globe # addSlopeRgion method.). )

splitDirectionCartesian2

Roller blind direction: horizontal (1,0) to shield the left side, (-1,0) to shield the right side; Or vertically (0,1) shield below, (0,1) shield above.

swipeEnabledBoolean

Gets or sets whether to enable the swipe function.

swipeRegionBoundingRectangle

Gets or sets the quadrilateral region for the swipe.

terrainProviderTerrainProvider

Gets or sets the terrain provider for the globe.

readonly terrainProviderChangedEvent

Gets the event triggered when the globe's terrain provider changes.

tileCacheSizeNumber

The size of the terrain tile cache, expressed in number of tiles. Any additional tiles beyond this number will be released as long as they are not needed for rendering this frame. Larger numbers consume more memory but show detail faster, e.g., when zooming in and out.

Default Value:
100

readonly tileLoadedEventEvent

Gets an event that's raised when a surface tile is loaded and ready to be rendered.

readonly tilesLoadedBoolean

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.

translucencyGlobeTranslucency

Properties for controlling globe translucency.

Methods

addExcavationRegion(){Boolean}

Adds a terrain excavation area.

Name Type Description
options.position Array

Location information of the excavation area.

options.name String

Name of the excavation area. (Unique)

options.height String

Excavation depth underground.

options.transparent Boolean

Whether the surface is transparent.

options.textureWrap TextureWrap

Specifies the texture wrapping mode for excavation texture. Default value is SuperMap3D.TextureWrap.REPEAT.

Returns:
Type Description
Boolean Boolean, returns true for success, false for failure.
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 :SuperMap3D.TextureWrap.REPEAT // Repeat texture
        textureWrap :SuperMap3D.TextureWrap.CLAMP_TO_EDGE // Do not repeat texture (stretch to edge)
    });

addExtractRegion()

Display effect of terrain excavation extraction.

Name Type Description
options.name String

The name of the excavation area.

options.position Array

Terrain excavation area.

options.height Number

Terrain excavation depth.

options.transparent Boolean

Whether the edge is transparent, default: false.

options.extractHeight Number

Terrain excavation extraction height, default: 100.

options.granularity Number

The precision of terrain excavation. Smaller values result in higher precision. Default: 1.

Example
viewer.scene.globe.addExtractRegion({
 name:'ggg',
 position:positions,
 height:50,
 transparent:transparent,
 extractHeight:200,
 granularity:100,
 });

addImageryClipRegions()

Imagery clipping.

Name Type Description
options.position Array

Clipping region

options.layers Array

Imagery layers involved in clipping

options.name String

The name (key value) of the clipping region

addModifyRegion(){Boolean}

Adds a terrain modification area. (Input 3D vector polygon data to flatten undulating terrain to match the height of the 3D polygon).

Name Type Description
options.position Array

Location information of the modification area.

options.name String

Name of the modification area.

options.createSide Boolean

Whether to create side faces (applicable for terrain cut). Default true.

Returns:
Type Description
Boolean Success returns true, failure returns false.
Example
var pts = [lon1,lat1,h1,lon2,lat2,h2,lon3,lat3,h3];
viewer.scene.globe.addModifyRegion({
        name : 'test',
        position : pts,
        createSide : true
    });

addSlopeRegion(options){Boolean}

Add slope direction analysis area

Name Type Description
options Object

The modified region parameter object includes the following properties:

Name Type Description
name String

Slope analysis area name

slopeSetting SlopeSetting

Modify regional location information

analysisMode Number

Analysis mode

Returns:
Type Description
Boolean Success returns true, failure returns false

clearClipGeometry()

Remove the terrain and excavate through the model.

clearCustomClipBox()

Clear custom clipping surface

computeSurfaceArea(polygonGeometry, ellipsoid, slice){number}

Calculates the ground area.

Name Type Description
polygonGeometry Object

An object of the PolygonGeometry class used to determine the area measurement extent.

ellipsoid Ellipsoid

Ellipsoid. The ellipsoid used for calculating the ground area, default is the WGS84 ellipsoid.

slice Number optional

Split granularity. Supports user-defined granularity for polygon splitting. If not set, the granularity is determined based on the polygon's extent.

Returns:
Type Description
number Ground area within the extent of the PolygonGeometry object.
Example
var ellipsoid = SuperMap3D.Ellipsoid.WGS84;
var area = scene.globe.computeSurfaceArea(polygonGeometry, ellipsoid, 10);

computeSurfaceDistance(polylineGeometry, ellipsoid){number}

Calculates the ground distance.

Name Type Description
polylineGeometry Object

An object of the PolylineGeometry class used to determine the distance measurement extent.

ellipsoid Ellipsoid

Ellipsoid. The ellipsoid used for calculating the ground distance, default is the WGS84 ellipsoid.

Returns:
Type Description
number Ground distance corresponding to the PolylineGeometry object.
Example
var ellipsoid = SuperMap3D.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. 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 shown in the example.

See:
Throws:

The object has been destroyed, i.e. destroy() has been called.

Type
DeveloperError
Returns:
Type Description
undefined
Example
globe = globe && globe.destroy();

getHeight(cartographic){Number|undefined}

Gets the height at the specified longitude and latitude.

Name Type Description
cartographic Cartographic

Longitude and latitude values.

Returns:
Type Description
Number | undefined Height value.

getSlopeDirectionValue(cartographic){Number|undefined}

Gets the terrain slope direction. Input coordinates in radians, result is in degrees with 0 being north.

Name Type Description
cartographic Cartographic

Longitude and latitude.

Returns:
Type Description
Number | undefined Slope direction.

getSlopeRegion(name){Object|undefined}

Retrieve the specified slope direction analysis area object based on its name

Name Type Description
name String

Region Name

Returns:
Type Description
Object | undefined If it exists, return the specified area object; if it does not exist, return undefined;

getSlopeValue(cartographic){Number|undefined}

Gets the terrain slope value.

Name Type Description
cartographic Cartographic

Longitude and latitude.

Returns:
Type Description
Number | undefined Slope value.

getVisibleTiles(){Array}

Gets visible tiles.

Returns:
Type Description
Array List of objects with properties x, y, level.

isDestroyed(){Boolean}

If the object has been destroyed, return true; Otherwise, return false. If the object has been destroyed, it should not be used; Calling any function other than isDestroyed will result in a Developer Error exception.

See:
Returns:
Type Description
Boolean If the object has been destroyed, it is true; Otherwise, it is false.

pick(Ray, Scene, result){Cartesian3|undefined}

Gets the intersection point between a ray and the Earth (the ray must be in 3D world coordinates).

Name Type Description
Ray Number

Ray, used for camera testing.

Scene Object

Scene objects.

result Cartesian3 optional

3D spatial coordinates, used to store the result.

Returns:
Type Description
Cartesian3 | undefined If they intersect, returns the 3D spatial coordinates of the intersection point.
Example
// Find the intersection with the Earth using a screen-space pixel and the camera's ray.
var ray = viewer.camera.getPickRay(windowCoordinates);
var intersection = globe.pick(ray, scene);

removeAllExcavationRegion()

Remove all excavation faces

Example
viewer.scene.globe.removeAllExcavationRegion();

removeAllExtractRegion()

Removes all excavation areas and extracted parts.

Example
viewer.scene.globe.removeAllExtractRegion();

removeAllModifyRegion()

Remove all terrain modified areas

Example
viewer.scene.globe.removeAllModifyRegion();

removeAllSlopeRegion(){Boolean}

Remove all slope orientation analysis area objects

Returns:
Type Description
Boolean Return true for successful removal and false for failed removal.

removeExcavationRegion(name)

Remove the terrain excavation area with the specified name

Name Type Description
name String

Name of terrain excavation area

removeExtractRegion(name)

Removes the current terrain excavation area and extracted part.

Name Type Description
name String

Names of terrain excavation and extraction areas

Example
viewer.scene.globe.removeExtractRegion();

removeImageryClipRegion(name, layers)

Removes clipping region

Name Type Description
name String

The name (key value) of the clipping region.

layers Array

Imagery layers involved in clipping.

removeModifyRegion(name)

Remove the terrain modification area with the specified name

Name Type Description
name String

Name of terrain modification area

removePBRMaterial()

Remove PBR material.

removeSlopeRegion(name){Boolean}

Remove the specified slope analysis area object based on its name

Name Type Description
name String

Region Name

Returns:
Type Description
Boolean Return true for successful removal and false for failed removal.

setClipGeometry(options){Boolean}

Add terrain through model excavation

Name Type Description
options Object

The terrain model excavation parameter object includes the following attributes:

Name Type Description
geometry geometry

model

scene String

scene

Returns:
Type Description
Boolean Success returns true, failure returns false
Example
var geoCylinder = new SuperMap3D.GeoBox(400.0, 400.0, 10000.0);
    geoCylinder.geoPosition = positon;
    viewer.scene.globe.setClipGeometry({
        geometry:geoCylinder,
        scene:scene
    });

setCustomClipBox(options){Boolean}

Add custom clipping surface

Name Type Description
options Object

The cutting surface parameters include the following properties:

Name Type Description
dimensions Cartesian3

Crop the length, width, and height of the box

position Cartesian3

Box cutting 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

Clipping line color.

clipMode String

Crop modes, including cropping within the plane, cropping outside the plane, and only retaining?

Throws:

options and options.dimensions and options.position are required.

Type
DeveloperError
Returns:
Type Description
Boolean Boolean returns true for success and false for failure

setPBRMaterialFromJSON(jsonPath)

Add terrain PBR material.

Name Type Description
jsonPath String

File address for pbr material

setPolygonOffset(polyOffsetFactor, polyOffsetUnits)

Sets the terrain polygon offset factor and offset constant.

Name Type Description
polyOffsetFactor Number

Offset factor, default is 0.

polyOffsetUnits Number

Offset constant, default is 0.