Class: Globe

Globe

new Globe(ellipsoid)

场景中渲染的地球,包括地形 (Globe#terrainProvider) 和影像图层(Globe#imageryLayers)

Name Type Default Description
ellipsoid Ellipsoid Ellipsoid.WGS84 可选

确定地球的大小和形状

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

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

clippingPlanesClippingPlaneCollection

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

clippingTypeNumber

设置地形裁剪(开挖)的类型。默认为开挖内部区域。

Default Value:
ClippingType.KeepOutside

cullEnabledBoolean

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

depthTestAgainstTerrainBoolean

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

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

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

enableLightingBoolean

启用以太阳为光源照亮地球。

Default Value:
false

excavationBottomTextureUrlString

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

excavationSideTextureUrlString

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

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

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

HypsometricSettingObject

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

See:

imageryLayersImageryLayerCollection

获取影像图层集合。

readonly imageryLayersUpdatedEventEvent

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

imageryLodToleranceNumber

影像切换精细层必须大于的块数

Default Value:
16

lightingFadeInDistanceNumber

照明恢复的距离。这只在 enablellighting true时生效。

Default Value:
20000000.0

lightingFadeOutDistanceNumber

enableLightingtrue时,该参数才生效。

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

获取或者设置地球表面的材质。

maximumScreenSpaceErrorNumber

用于驱动细节级细化的最大屏幕空间误差。较高的值将提供更好的性能,但较低的视觉质量。

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

获取或设置一个值,该值指示是否应该预加载已呈现瓦片的父级。将此设置为true可优化放大体验,并在平移时提供新曝光区域的更多细节。缺点是它需要加载更多的瓦片。

Default Value:
true

preloadSiblingsBoolean

获取或设置一个值,该值指示是否应该预加载所呈现瓦片的同级。将此设置为true会导致加载与渲染瓦片具有相同父元素的瓦片,即使它们被剔除。将此设置为true可能会以加载更多瓦片为代价提供更好的平移体验。

Default Value:
true

shadowsShadowMode

决定地球从每个光源投射阴影还是接收阴影。将地球设置为投射阴影可能会影响性能,因为地形会从光源的角度重新渲染。目前只有在视图中的地形才会投射阴影。默认情况下,地球不会投射阴影。

Default Value:
ShadowMode.RECEIVE_ONLY

showBoolean

决定是否显示地球。

Default Value:
true

showExcavationSideboolean

是否显示开挖地形的侧边,默认是true。

Default Value:
true

showGroundAtmosphereBoolean

是否显示地面大气层。

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

如果在地球上被水覆盖的地区显示出动画的波浪效果,则是正确的;否则,假的。如果terrainProvider不提供水域掩码,则忽略此属性。如果在地球被水覆盖的区域显示波浪动画效果,则为 true;否则为 false。 如果地形提供程序没有提供水域掩码,此属性将被忽略。

Default Value:
true

SlopeSettingObject

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

spatialReferenceSpatialReference

获取地球的空间参考

splitDirectionCartesian2

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

swipeEnabledBoolean

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

swipeRegionBoundingRectangle

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

terrainProviderTerrainProvider

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

readonly terrainProviderChangedEvent

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

tileCacheSizeNumber

地形瓦片的大小,以瓦片数表示。任何超过这个数量的额外贴图都将被释放,只要它们不需要渲染这个帧。更大的数字会消耗更多的内存,但会更快地显示细节,例如,在缩小和缩小时。

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}

添加地形开挖区域。

Name Type Description
options.position Array

开挖区域位置信息。

options.name String

开挖区域名称。(唯一)

options.height String

开挖地下深度。

options.transparent Boolean

地表是否透明。

options.textureWrap TextureWrap

用于指定开挖纹理的贴图方式,默认值为SuperMap3D.TextureWrap.REPEAT。

Returns:
Type Description
Boolean 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 :SuperMap3D.TextureWrap.REPEAT // 重复贴图
        textureWrap :SuperMap3D.TextureWrap.CLAMP_TO_EDGE // 不重复贴图(拉伸到边缘贴图)
    });

addExtractRegion()

地形开挖抽出显示效果。

Name Type Description
options.name String

该开挖区域的名称。

options.position Array

地形开挖区域。

options.height Number

地形开挖深度。

options.transparent Boolean

封边是否透明,默认值:false。

options.extractHeight Number

地形开挖抽出高度,默认值:100。

options.granularity Number

地形开挖精度,越小越精确,默认值:1。

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

addImageryClipRegions()

影像裁剪。

Name Type Description
options.position Array

裁剪区域

options.layers Array

参与裁剪的影像图层

options.name String

该裁剪区域的name(key值)

addModifyRegion(){Boolean}

添加地形修改区域。(传入三维矢量面数据,将高低起伏的地形处理为与三维面高度一致的效果)

Name Type Description
options.position Array

修改区域位置信息。

options.name String

修改区域名称。

options.createSide Boolean

是否创建侧边(适用于地形挖方)默认值true。

Returns:
Type Description
Boolean 成功返回true,失败返回false。
Example
var pts = [lon1,lat1,h1,lon2,lat2,h2,lon3,lat3,h3];
viewer.scene.globe.addModifyRegion({
        name : 'test',
        position : pts,
    });

clearClipGeometry()

移除地形通过模型开挖。

clearCustomClipBox()

清除自定义裁剪面

computeSurfaceArea(polygonGeometry, ellipsoid, slice){number}

计算贴地面积。

Name Type Description
polygonGeometry Object

polygonGeometry类中的对象,用于确定面积量算的范围

ellipsoid Ellipsoid

椭球。即计算贴地面积时所采用的椭球,默认值为WGS84椭球

slice Number 可选

拆分粒度。支持用户自定义多边形拆分的粒度,若不设置则根据多边形的范围设置粒度

Returns:
Type Description
number PolygonGeometry对象范围内的贴地面积
Example
var ellipsoid = SuperMap3D.Ellipsoid.WGS84;
var area = scene.globe.computeSurfaceArea(polygonGeometry, ellipsoid, 10);

computeSurfaceDistance(polylineGeometry, ellipsoid){number}

计算贴地距离。

Name Type Description
polylineGeometry Object

polylineGeometry类中的对象,用于确定距离量算的范围。

ellipsoid Ellipsoid

椭球。即计算贴地距离时所采用的椭球体,默认值为WGS84椭球。

Returns:
Type Description
number PolylineGeometry对象对应的贴地距离
Example
var ellipsoid = SuperMap3D.Ellipsoid.WGS84;
var distance = scene.globe.computeSurfaceDistance(polylineGeometry,ellipsoid);

destroy(){undefined}

销毁该对象持有的 WebGL 资源。 销毁对象可以确定性地释放 WebGL 资源,而不是依赖垃圾回收器来销毁该对象。 一旦对象被销毁,就不应再使用;调用 isDestroyed 以外的任何函数都将导致 DeveloperError 异常。 因此,请按照示例中的方法将返回值(undefined)赋值给对象。

See:
Throws:

该对象已被销毁,即 destroy() 被调用。

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

getHeight(cartographic){Number|undefined}

获取经纬度对应的高度。

Name Type Description
cartographic Cartographic

经纬度值。

Returns:
Type Description
Number | undefined 高度值。

getSlopeDirectionValue(cartographic){Number|undefined}

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

Name Type Description
cartographic Cartographic

经纬度。

Returns:
Type Description
Number | undefined 坡度方向。

getSlopeValue(cartographic){Number|undefined}

获取地形坡度值。

Name Type Description
cartographic Cartographic

经纬度。

Returns:
Type Description
Number | undefined 坡度值。

getVisibleTiles(){Array}

获取可见瓦片。

Returns:
Type Description
Array 对象列表,其中对象的属性为x、y、level

isDestroyed(){Boolean}

如果该对象已被销毁,则返回 true;否则返回 false。 如果该对象已被销毁,则不应使用;调用 isDestroyed 以外的任何函数都将导致 DeveloperError 异常。

See:
Returns:
Type Description
Boolean 如果该对象已被销毁,则为 true;否则为 false。

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

获取射线和地球的交点(射线必须是三维地理坐标)。

Name Type Description
Ray Number

射线,用于相机测试。

Scene Object

场景对象。

result Cartesian3 可选

三维空间坐标,用于保存结果。

Returns:
Type Description
Cartesian3 | undefined 如果不相交,返回交点的三维空间坐标。
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();

removeExcavationRegion(name)

移除指定名称的地形开挖区域

Name Type Description
name String

地形开挖区域的名称

removeExtractRegion(name)

移除地形当前开挖区域和抽出部分。

Name Type Description
name String

地形开挖和抽出区域的名称

Example
viewer.scene.globe.removeExtractRegion();

removeImageryClipRegion(name, layers)

移除裁剪区域

Name Type Description
name String

该裁剪区域的name(key值)。

layers Array

参与裁剪的影像图层。

removeModifyRegion(name)

移除指定名称的地形修改区域

Name Type Description
name String

地形修改区域的名称

removePBRMaterial()

移除PBR材质。

setClipGeometry(options){Boolean}

添加地形通过模型开挖

Name Type Description
options Object

地形模型开挖参数对象包含以下属性:

Name Type Description
geometry geometry

模型

scene String

场景

Returns:
Type Description
Boolean 成功返回true,失败返回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}

添加自定义裁剪面

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

裁剪模式,包括裁剪平面内、裁剪平面外、只保留�?

Throws:

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

Type
DeveloperError
Returns:
Type Description
Boolean bool 成功返回true,失败返回false

setPBRMaterialFromJSON(jsonPath)

添加地形PBR材质。

Name Type Description
jsonPath String

pbr材质的文件地址

setPolygonOffset(polyOffsetFactor, polyOffsetUnits)

设置地形多边形偏移缩放因子和偏移常量。

Name Type Description
polyOffsetFactor Number

偏移缩放因子,默认为0。

polyOffsetUnits Number

偏移常量,默认为0。