Class: Scene

Scene

new Scene()

A 3D scene class is a container for all 3D graphic objects and states, usually not directly created as a scene, but implicitly created by Widgets.

Details of contextOptions parameter:

The default values are: {webgl: {alpha: false, depth: true, stencil: false, antialia: true, premultifiedAlpha: true, preservedDrawingBuffer: false, fail IfMajorPerformance Caveat: false}, alloverTextureFilter Animated: true}

The WebGL attribute corresponds to the WebGLContextAttributes object used to create a WebGL environment.

WebGL.alpha defaults to false, which can improve performance compared to the standard WebGL default of true.

Other WebGL attributes match the default WebGL values of WebGLContextAttributes.

AllowTextureFilter Anisotropic defaults to true, which allows for anisotropic texture filtering when WebGL extensions are supported. Setting it to false can improve performance, but it can damage visual quality, especially for horizontal views.

Name Type Default Description
options.canvas Canvas

HTML canvas element used to create scenes.

options.contextOptions Object optional

Environment and WebGL creation properties, see above for details.

options.creditContainer Element optional

HTML element used to display service description information.

options.mapProjection MapProjection new GeographicProjection() optional

Map projection used in 2D and Columbus view modes.

options.orderIndependentTranslucency Boolean true optional

If this option is set to true and supported by the device, order independent semi transparency will be used.

options.scene3DOnly Boolean false optional

If this is set to true, it will optimize memory usage and performance in 3D mode, but prohibit the use of 2D or Columbus view features.

options.terrainExaggeration Number 1.0 optional

A scalar used to exaggerate terrain. Please note that setting terrain exaggeration will not modify any other data.

options.shadows Boolean false optional

Determine whether the shadow is formed by the projection of the sun.

options.mapMode2D MapMode2D MapMode2D.INFINITE_SCROLL optional

Determine whether the two-dimensional map is rotatable or can scroll infinitely in the horizontal direction.

See:
Throws:

Options need to specify options and options.canvas.

Type
DeveloperError
Example
// Create a scene.
var viewer = new SuperMap3D.Viewer('Container');
var scene = viewer.scene;

Members

backgroundColorColor

The background color is only visible when there is no skybox, that is, when Scene # skyBox is undefined.

Default Value:
Color.BLACK
See:

bloomEffectBloomEffect

Obtain the flood effect of the scene, including flood intensity values, flood brightness thresholds, etc.

readonly cameraCamera

Retrieve the camera object of the current scene.

readonly canvasElement

Retrieve the canvas element bound to the scene.

readonly clampToHeightSupportedBoolean

If the Scene # clampToHeight and Scene # clampToHeightMostDetailed functions are supported, return true.

See:

colorCorrection

Create color correction object

customRequestHeadersObject

Custom request header

debugShowFrustumPlanesBoolean

This attribute is for debugging purposes only and cannot be used in formal production environments.

When true, draw a contour to display the boundaries of the camera cone.

Default Value:
false

debugShowFrustumsBoolean

This attribute is only used for debugging and not for production. When true, draw a contour line to display the range of the camera's viewing cone.

Default Value:
false

depthOfFieldEffectDepthOfFieldEffect

Obtain the depth of field effect of the scene.

readonly drawingBufferHeightNumber

GL draws the buffer height.

See:

readonly drawingBufferWidthNumber

GL draws the buffer width.

See:

enableCompositorBoolean

Get or set whether to draw the scene as an image. When turned off, drawing directly to the color buffer produces better visual effects, but some analysis functions are not available. The default value is true.

enableOcclude

Is occlusion removal enabled in the current scene.

Default Value:
true

readonly envMapIntensityNumber

Get or set the intensity of PBR material ambient light map.

Default Value:
1.0

eyeSeparationNumber

Eye distance is measured in meters and is suitable for Cardboard or WebVR.

focalLengthNumber

The focal length used for Cardboard or WebVR.

fogFog

Get altitude fog.

frustumToleranceNumber

Set cone tolerance value, default value is 0.0, maximum value is 0.5

Default Value:
0.0

gammaNumber

Get or set the gamma value of the layer to adjust the color.

Default Value:
2.2

globeGlobe

Retrieve Earth objects.

globeSplitPositionCartesian2

Set or retrieve the position of the rolling shutter in the current scene, with valid values ranging from 0.0 to 1.0

readonly groundPrimitivesPrimitiveCollection

Get a collection of all sticker elements.

hdrEnabled

Is HDR enabled in the current scene.

Default Value:
false

highDynamicRangeBoolean

Whether to use high-quality dynamic range for rendering.

Default Value:
true

highDynamicRangeSupportedBoolean

Is high-quality dynamic range supported for rendering.

Default Value:
true

readonly idString

Get the ID of the current scene.

readonly imageryLayersImageryLayerCollection

Retrieve the collection of image layers for the current scene.

imagerySplitPositionNumber

Set or retrieve the position of the image separator for the current scene.

invertClassificationBoolean

When false, 3D Tiles will render normally. When true, classified 3D Tile geometry will be rendered normally, while unclassified 3D Tile geometry will be rendered by multiplying the color by Scene # invertClassityColor.

Default Value:
false

invertClassificationColorColor

When Scene # intrortClassification is true, the highlight color of unclassified 3D Tile geometry.

When the alpha value of the color is less than 1.0, the unclassified portion of the 3D tiles will not blend correctly with the classified position of the 3D tiles.

Similarly, when the alpha value of a color is less than 1.0, WEBGL_depth_texture and EXT_frag_depth WebGL extensions must be supported.

Default Value:
Color.WHITE

readonly invertClassificationSupportedBoolean

If the Scene # intrortClassification function is supported, return true.

See:

readonly lastRenderTimeJulianDate

Get the simulation time of the last rendering of the scene. If the scene has not been rendered yet, return undefined.

readonly layersLayers

Retrieve the collection of 3D tile layers for the current scene.

lightSourceLightSource

Retrieve the light sources in the current scene.

localSceneGeoCenterCartographic

Get and set the geographic coordinates of the scene center point used when using a local coordinate system scene. This interface is designed to address the issue of inaccurate calculation of solar illumination and shadows when using local coordinate system data in Columbus view due to the lack of clear geographic coordinates. Attention: If it is not a local coordinate system scene, please do not set this interface.

logarithmicDepthBufferBoolean

Get or set whether to use logarithmic depth buffer. When set to true, fewer truncated cones will be used in the mixed multi truncated cone. For details, please refer to the instructions on Cesium's official website.

mapMode2DBoolean

Determine whether the 2D map can be rotated or scrolled infinitely in the horizontal direction.

readonly mapProjectionMapProjection

Obtain map projection objects for 2D or Columbus View mode, default to latitude and longitude projection.

Default Value:
new GeographicProjection()

maximumRenderTimeChangeNumber

If Scene # requestRenderMode is true, this value defines the maximum simulation time variation allowed before requesting rendering. A low value will increase the number of frames rendered, while a high value will decrease the number of frames rendered. If it is undefined, the change in simulation time will never request rendering. This value will affect the rendering speed of changes in the scene, such as lighting, entity attribute updates, and animation.

Default Value:
0.5
See:
  • Scene#requestRenderMode

minimumDisableDepthTestDistanceNumber

Prohibit depth testing of bulletin boards, labels, and point objects by setting the camera angle distance. For example, to prevent cutting terrain data, setting the distance to 0 will keep the depth test valid, while setting the distance to less than 0 will render the depth test invalid. Modify distance values by setting the disableDepthTestDistance property on bulletin boards, labels, and point objects.

Default Value:
0.0

modeSceneMode

Get the mode of the current scene.

Default Value:
SceneMode.SCENE3D

moonMoon

The Moon

Default Value:
undefined

multiViewportModeNumber

Get or set the multi viewport mode of the current scene, with a default single viewport

Default Value:
0

overlapDisplayOptionsObject

Set avoidance parameters for layers. The parameters that can be set are: allowIconWithTextDisplay, which sets whether to enable the icon layer to follow the text layer for avoidance. The default is true

pickPointCartesian3

开启顶点捕捉后,捕捉到的顶点坐标(世界坐标)。

pickPointEnabledBoolean

Enable vertex capture function, default to false, set to true to enable capture.

pickPointIntervalNumber

Set the time interval for point cloud capture.

Default Value:
200

readonly pickPositionSupportedBoolean

Does depth picking support (depth texture).

pickTranslucentDepthBoolean

When true, it supports using a depth buffer to pick semi transparent geometric shapes. Scene # useDepthPicking must also be true and support picking depth buffers. When used, performance may decrease, and for semi transparent geometric shapes, additional drawing commands will be called to write depth.

Default Value:
true
Example
// picking the position of a translucent primitive
viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
     var pickedFeature = viewer.scene.pick(movement.position);
     if (!SuperMap3D.defined(pickedFeature)) {
         // nothing picked
         return;
     }
     viewer.scene.render();
     var worldPosition = viewer.scene.pickPosition(movement.position);
}, SuperMap3D.ScreenSpaceEventType.LEFT_CLICK);

postProcessStagesPostProcessStageCollection

The post-processing effect applied to the final rendering.

readonly postRenderEvent

Retrieve the event at the end of each frame rendering in the current scene, and listen for it to trigger at the end of each frame rendering.

See:

readonly postUpdateEvent

Get the events that will be triggered after the scene is updated or rendered. The callback function for subscribing to this event will receive the scene instance as the first parameter and the current time as the second parameter.

See:

readonly preRenderEvent

Retrieve the events before rendering each frame of the current scene and listen for them to trigger before rendering each frame.

See:

readonly preUpdateEvent

Get the events that will be triggered before the scene is updated or rendered. The callback function for subscribing to this event will receive the scene instance as the first parameter and the current time as the second parameter.

See:

readonly primitivesPrimitiveCollection

Get a collection of all graphic elements.

rasterVectorCollectionObject

Get real-time gridded objects.

readonly sampleHeightSupportedBoolean

Return true when the Scene # sampleHeight and Scene # sampleHeightMostDetailed functions are supported.

See:

scanEffectScanEffect

Obtain the scanning line effect of the scene.

sceneSnappingManagerSceneSnappingManager

获取捕捉管理器实例,通过该实例访问 tolerance、result等属性。

Example
scene.snappingManager.tolerance= 300;
scene.snappingManager.enabled = true;

readonly screenSpaceCameraControllerScreenSpaceCameraController

Retrieve the camera operation object of the current scene.

shadowMapShadowMap

Shadow mapping in the scene. When enabled, models, elements, and the Earth can cast and receive shadows. By default, the light source for shadow maps is the sun.

showCalloutBoolean

Get or set whether to display the traction line

skyAtmosphereSkyAtmosphere

atmosphere

Default Value:
undefined

skyBoxSkyBox

SkyBox

Default Value:
undefined

readonly spatialGridSpatialGrid

Retrieve spatial grid objects

specularEnvironmentMapsString

The URL of the KTX file containing ambient light maps and mipmaps for image-based PBR model illumination.

readonly specularEnvironmentMapsSupportedBoolean

Return true if mirror environment mapping is supported.

See:

sphericalHarmonicCoefficientsArray.<Cartesian3>

The spherical harmonic coefficient of PBR model illumination based on images.

ssaoEffectSSAOEffect

Obtain the ambient occlusion effect of the scene.

style3DBoolean

Get or set style

sunSun

sun

Default Value:
undefined

sunColorCartesian3

Get or set the scattered color from sunlight

Default Value:
Cartesian3(1.8, 1.85, 2.0)

sunlightAnalysisSunlightAnalysis

Obtain sunlight analysis

terrainProviderTerrainProvider

Retrieve or set the terrain service provider object for the current scene.

readonly terrainProviderChangedEvent

Obtain the current scene terrain service provider change event.

toneMappingEnabled

Is toneMapping enabled in the current scene.

readonly toneMappingExposureNumber

Get or set the overall brightness of the PBR material model.

Default Value:
1.0

readonly underGlobeUnderGlobe

Get the underground ball.

undergroundDepthNumber

Get or set the depth of the underground scene, default to 1000 meters (unit: meter)

undergroundModeBoolean

Get or set whether to enable underground scenes

Default Value:
false

underWaterEffectUnderWaterEffect

Get scene underwater effect setting class

Example
var underWaterEffect= scene.underWaterEffect;
underWaterEffect.show = true;

useDepthPickingBoolean

When true, it means that the pick depth buffer is enabled

Default Value:
true

vectorTileMapOrderInImagerLayersNumber

Set the display order between MVT and image maps, ranging from 0 to the number of image map collections. Set to 0, mvt is displayed at the bottom layer of all images; Set to Infinity, mvt is displayed on the top layer of all images.

Default Value:
Infinity

vectorTilesMapSettingVectorTilesMapSetting

Global settings of MVT map

volumetricCloudsVolumetricClouds

Get or set volume cloud. (WebGPU is currently not supported)

walkingModeNumber

Get or set camera mode.

Default Value:
WalkingMode.NONE
See:

readonly waterReflectionDistinctQualityNumber

Get or set the clarity of water surface reflection, the smaller the value, the more blurry the reflection.

Default Value:
5.0

Methods

addFieldLayer(url){Promise}

Add a field data layer based on the URL path.

Name Type Description
url String

The URL path of the field data.

Returns:
Type Description
Promise Return to the FieldLayer3D field data layer and asynchronously create field layer objects.
Example
var promise =  viewer.scene.addFieldLayer("../data.nc");
 SuperMap3D.when(promise,function(fieldLayer){
       fieldLayer.particleVelocityFieldEffect.velocityScale = 100.0;
       fieldLayer.particleVelocityFieldEffect.particleSize = 2;
       fieldLayer.particleVelocityFieldEffect.paricleCountPerDegree = 1.5;
       scene.primitives.add(fieldLayer);
       fieldLayer.particleVelocityFieldEffect.colorTable = colorTable;
       var options = {
        longitude:'lon',
        latitude:'lat',
        uwnd:'uwnd',
        vwnd:'uwnd'
     }
      fieldLayer.NetCDFData = options;
	})

addLayerService(url, sceneName, layerName)

Add scene layer service.

Name Type Description
url String

The URL path of the layer service.

sceneName String

Scene name.

layerName String

Layer name.

addLightSource(lightSource){Scene}

Add a light source.

Name Type Description
lightSource LightSource

Light source.

Returns:
Type Description
Scene The scene after adding a point light source.

addS3MGroupLayer(url, options, index){Promise}

Add S3M grouping layer.

Name Type Description
url String

The address of the configuration file published in iServer.

options Object

The required attribute objects for the layer.

index Number

Indexes.

Returns:
Type Description
Promise Return promise to load object asynchronously

addS3MTilesLayerByScp(url, options, index){Promise.<S3MTilesLayer>}

Add 3D tile layers (S3M, S3MB).

Name Type Description
url String

The address of the configuration file published in iServer.

options Object

图层配置选项

Name Type Default Description
subdomains Array

Used for subdomains, such as ['t1 ','t2'].

name String

Specify the layer name.

bounds Rectangle Rectangle.MAX_VALUE optional

The geographical range of the layer is set to global by default

cullEnabled Boolean false optional

Whether to remove the back, default is not to remove, that is, double-sided rendering.

index Number

Indexes.

Returns:
Type Description
Promise.<S3MTilesLayer> Return promise to load object asynchronously
Example
var promise = scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-zj/rest/realspace/datas/zj/config', {name : 'base'});
promise.then(function(layer){
    layer.visible = false;
});

// Subdomain usage
var config = {
      subdomainConfig: {
         urlScheme: "http://{s}.supermap.com:8090/iserver/services/3D-BIM/rest/realspace",
         subdomains: ['t1', 't2']
     },
     name: "BIM"
 };
var promise = scene.addS3MTilesLayerByScp('http://localhost:8090/iserver/services/3D-BIM/rest/realspace/datas/BIM/config', config);

addVectorTilesLayer()

Add vector tile layer service. To ensure the stability of the version, the MVT layer created using this interface still maintains its original usage and implementation method, but does not support the newly added interface in VectorTileMap. It is recommended to use the new implementation method addVectorTilesMap. Support the addition of vector tile services and rest map services with tileFeatures and style.

Name Type Default Description
options.url String

Suitable for generating MVT data through SuperMap desktop software and publishing it as a REST style map service through iServer, only the service address needs to be provided.

options.layer String

Layer name, applicable to third-party WMTS services.

options.canvasWidth Number optional

Texture edge length used to draw vectors. The default is 512, the larger the size, the finer it is, and the smaller the size, the higher the performance.

options.tileWidth String

Tile width, suitable for third-party WMTS services.

options.tileHeight String

Tile height, suitable for third-party WMTS services.

options.format String 'mvt' optional

Applicable to WMTS services published by third parties.

options.tilematrxset String

Tile matrix set name, applicable to third-party WMTS services.

options.maximumLevel Number optional

The maximum level of data. Applicable to WMTS services published by third parties, calculated by default based on service parameters.

options.minimumLevel Number optional

The minimum level of data. Applicable to WMTS services published by third parties, calculated by default based on service parameters.

options.mapboxStyle Object optional

The mapBox style used.

options.maximumTerrainLevel Number optional

The maximum terrain layer number allowed to load MVT layers (if not defined, all layers will be loaded).

options.minimumTerrainLevel Number optional

Allow loading of the minimum terrain layer number for MVT layers (if not defined, all layers will be loaded).

options.simplifyTolerance Number optional

Coordinate tolerance for geometric simplification, measured in tile coordinate system, with a range of 0-4096. The larger the value, the more severe the simplification. It defaults to 0 and is not simplified.

options.viewer Object optional

Set the Earth to be added to

See:
Example
// Load vector tile service
var layer = scene.addVectorTilesLayer({
    url:"http:// localhost:8090/iserver/services/map-mvt-test/....../maps/test" // map service
});
// Load a REST map service that has tileFeature and a style
var layer = scene.addVectorTilesLayer({
    url:"http:// localhost:8090/iserver/services/map-test/rest/maps/test/tileFeature" // map service
});

addVectorTilesMap()

Create a new vector tile map.

Name Type Default Description
options.url String

Suitable for generating MVT data through SuperMap desktop software and publishing it as a REST style map service through iServer, only the service address needs to be provided.

options.layer String

Layer name, applicable to third-party WMTS services.

options.canvasWidth Number optional

Texture edge length used to draw vectors. The default is 512, the larger the size, the finer it is, and the smaller the size, the higher the performance.

options.tileWidth String

Tile width, suitable for third-party WMTS services.

options.tileHeight String

Tile height, suitable for third-party WMTS services.

options.format String 'mvt' optional

Applicable to WMTS services published by third parties.

options.tilematrxset String

Tile matrix set name, applicable to third-party WMTS services.

options.maximumLevel Number optional

The maximum level of data. Applicable to WMTS services published by third parties, calculated by default based on service parameters.

options.minimumLevel Number optional

The minimum level of data. Applicable to WMTS services published by third parties, calculated by default based on service parameters.

options.mapboxStyle Object optional

The mapBox style used.

options.maximumTerrainLevel Number optional

The maximum terrain layer number allowed to load MVT layers (if not defined, all layers will be loaded).

options.minimumTerrainLevel Number optional

Allow loading of the minimum terrain layer number for MVT layers (if not defined, all layers will be loaded).

options.labelScaleByDistance Number optional

Set the text to scale with distance.

options.customRequestHeaders Object optional

Set custom request headers.

options.realtime Boolean optional

Set whether to real-time rasterize.

options.swipeEnabled Boolean optional

Set whether it is a roller blind.

options.swipeRegion Object optional

Set up the rolling shutter area.

options.billboardMode BillboardMode optional

Set text label style.

options.labelDepthTestEnabled Boolean optional

Used to control whether MVT text/icons undergo depth detection. Default to true, enabling depth detection; otherwise, disabling depth detection.

options.viewer Object optional

Set the Earth to be added to

options.localIdeographFontFamily Boolean optional

Used to set the default font for MVT text annotation.

options.subdomains Array | String

Multiple subdomains. When the input parameter is Array, it supports loading multiple subdomains. When the input parameter is String, only a single subdomain loading is supported.

options.crs string

Currently supports loading third-party coordinate systems EPSG: 4490, EPSG: 3857, default value EPSG: 4490.

See:

addVoxelGridLayer(url){Promise}

Add body source grid layer

Name Type Description
url String

Data URL

Returns:
Type Description
Promise Return to the VoxelGridLayer3D field layer and create objects asynchronously
Example
var promise =  viewer.scene.addVoxelGridLayer("../data.nc");
 Promise.resolve(promise).then(function(VoxelGridLayer){

	})

cartesianToCanvasCoordinates(position, result){Cartesian2}

Convert 3D spatial coordinates to canvas coordinates (window coordinates).

Name Type Description
position Cartesian3

Three dimensional spatial coordinates.

result Cartesian2 optional

Window coordinates, used to save results.

Returns:
Type Description
Cartesian2 Window coordinates.
Example
// Output the window coordinates with longitude and latitude (0,0) as the mouse moves.
var scene = widget.scene;
var ellipsoid = scene.globe.ellipsoid;
var position = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0);
var handler = new SuperMap3D.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
    console.log(scene.cartesianToCanvasCoordinates(position));
}, SuperMap3D.ScreenSpaceEventType.MOUSE_MOVE);

clampToHeight(cartesian, objectsToExclude, width, result){Cartesian3}

Limit the given Cartesian position to the scene geometry along the normal of the earth's surface. Returns a fixed position, and if there is no scene geometry to fix it, returns undefined. Can be used to restrict objects to spheres, 3D tiles, or primitives in the scene.

This function only limits the rendered spherical tiles and 3D tiles in the current view. Restrict all other primitives, regardless of their visibility.

Name Type Default Description
cartesian Cartesian3

Cartesian Cartesian location.

objectsToExclude Array.<Object> optional

Unrestricted list of primitive, solid, or 3D tile features.

width Number 0.1 optional

The width of an intersection, measured in meters.

result Cartesian3 optional

An optional object used to return the restricted position.

See:
Throws:
  • ClampToHeight is only supported in 3D mode.

    Type
    DeveloperError
  • ClampToHeight requires depth texture support. Check clawToHeightSupported.

    Type
    DeveloperError
Returns:
Type Description
Cartesian3 If no new Cartesian3 instance is provided, use the modified result parameters. If there is no scene geometry to constrain, this may be undefined.
Example
// Clamp an entity to the underlying scene geometry
var position = entity.position.getValue(SuperMap3D.JulianDate.now());
entity.position = viewer.scene.clampToHeight(position);

clampToHeightMostDetailed(cartesians, objectsToExclude, width){Promise.<Array.<Cartesian3>>}

Start asynchronous Scene # clampToHeight query to find the Cartesian3 position array, using the maximum refinement level of the 3D tile set in the scene. Return the promise parsed upon completion of the query. Each position is modified in place. If the position cannot be constrained due to the inability to sample geometry at that location or other errors, the elements in the array will be set to undefined.

Name Type Default Description
cartesians Array.<Cartesian3>

Update the position of Cartesians with restricted location.

objectsToExclude Array.<Object> optional

Unrestricted list of primitive, solid, or 3D tile features.

width Number 0.1 optional

The width of an intersection, measured in meters.

See:
Throws:
  • ClampToHeightMostDetailed only supports 3D mode.

    Type
    DeveloperError
  • ClampToHeightMostDetailed requires deep texture support. Check clawToHeightSupported.

    Type
    DeveloperError
Returns:
Type Description
Promise.<Array.<Cartesian3>> After the query is completed, parse the Promise to the provided location list.
Example
var cartesians = [
    entities[0].position.getValue(SuperMap3D.JulianDate.now()),
    entities[1].position.getValue(SuperMap3D.JulianDate.now())
];
var promise = viewer.scene.clampToHeightMostDetailed(cartesians);
promise.then(function(updatedCartesians) {
    entities[0].position = updatedCartesians[0];
    entities[1].position = updatedCartesians[1];
}

destroy()

Destroy the WebGL resources held by this object. Destroying objects allows for deterministic release of WebGL resources, rather than relying on garbage collectors to destroy the object. Once an object is destroyed, it should no longer be used; Calling any function other than isDestroyed will result in a Developers Error exception. Therefore, assign the return value (undefined) to the object, as shown in the example.

See:
Throws:

This object was destroyed, i.e., destroy() was called.

Type
DeveloperError
Example
scene = scene && scene.destroy();

getCompressedTextureFormatSupported(format){boolean}

Does the current scene support texture compression format.

Name Type Description
format String

Texture format. Format name or WebGL extension. For example: s3tc or WEBGL_compressed _texture_st3tc.

Returns:
Type Description
boolean Is this format supported.

getHeight(lon, lat){Number}

Obtain the corresponding height based on latitude and longitude coordinates.

Name Type Description
lon Number

经度坐标,单位:度。

lat Number

纬度坐标,单位:度。

Returns:
Type Description
Number Height value, unit: meter.

getPickRectIDs(){Array}

Retrieve the selected ID. The returned object array contains a layer ID (layerID) and a selected object ID (ids) for each object

Returns:
Type Description
Array ID array

getPickRectIDsAsync(){Array}

Asynchronous retrieval of selected ID. Returns an array of objects, each containing a layer ID (layerID) and a selected object ID (ids)

Returns:
Type Description
Array ID array

getVectorTilesMap(name){Layer}

Retrieve a vector tile map based on the specified name.

Name Type Description
name String

Name of vector tile map

Returns:
Type Description
Layer Obtained map

getViewport(windowPosition){BoundingRectangle}

Obtain the current scene viewport based on the window coordinates.

Name Type Description
windowPosition Cartesian2

Window coordinates.

Returns:
Type Description
BoundingRectangle Viewport.

isDestroyed(){Boolean}

When the object has been destroyed, return true; otherwise, return false. If this object was destroyed, it should not be used; calling any function other thanisDestroyed will result in a DeveloperError exception.

See:
Returns:
Type Description
Boolean true if this object was destroyed; otherwise, false.

open(url, sceneName){Promise}

Open all layers under the iServer scene service.

Name Type Default Description
url String

Service URL.

sceneName String

There are multiple scenes in the workspace, and scene names need to be specified; Set to undefined, the first one will be opened by default.

options.subdomains Array

Used for subdomains, such as ['t1 ','t2'].

options.autoSetView Boolean true optional

Whether to automatically locate the scene

Returns:
Type Description
Promise Return promise to load object asynchronously
Example
var promise = scene.open('http://localhost:8090/iserver/services/3D-BIM3/rest/realspace');
promise.then(function(layers){});

// Subdomain and non-automatic positioning usage
var promise = scene.open('http://{s}.supermap.com:8090/iserver/services/3D-BIM3/rest/realspace',undefined,{
    subdomains: ['t1', 't2'],// Subdomain
    autoSetView : false      // Do not auto-position
});
promise.then(function(layers){});

outputSceneToFile(){Promise}

Output the current scene with Base64 encoding

Name Type Description
options.resolutionScale Number optional

当前画布分辨率宽高的倍数,默认为1,如果大于1(仅支持整数),最终出图的分辨率为宽高的resolutionScale * resolutionScale倍,超过当前设备支持的最大分辨率则以设备最大分辨率出图

options.progressCallback function optional

The callback function for plotting progress, with parameters of plotting progress percentage, from 0 to 100

Returns:
Type Description
Promise Asynchronous objects with Base64 encoding
Example
var promise =  scene.outputSceneToFile({
      resolutionScale : 4
  });
  Promise.resolve(promise).then(function(base64data){
     $("#ID").css("background","url(" + base64data +")");
   })

parsePBRFromJson()

Analyze PBR material parameters.

Example
scene.parsePBRFromJson(urls);
var conditions=[
['${id}<=80',0],
['${id}<=90',1],
['${id}<=100',2],
];

pick(windowPosition, width, height){Object}

Scene picking returns the first primitive object corresponding to the window position in the scene. If there are no objects at that position, it returns undefined.

Name Type Default Description
windowPosition Cartesian2

Window coordinates.

width Number 3 optional

Pick the width of the rectangle.

height Number 3 optional

Pick the height of the rectangle.

Throws:

WindowPosition is undefined.

Type
DeveloperError
Returns:
Type Description
Object The picked graphic object.
Example
// On mouse over, color the feature yellow.
handler.setInputAction(function(movement) {
    var feature = scene.pick(movement.endPosition);
    if (feature instanceof SuperMap3D.Cesium3DTileFeature) {
        feature.color = SuperMap3D.Color.YELLOW;
    }
}, SuperMap3D.ScreenSpaceEventType.MOUSE_MOVE);

pickNormal(windowPosition){Cartesian3}

Used to pick normals, input screen coordinates, and return normals. Combining the selected offset can achieve the effect of offsetting along the normal direction.

Name Type Description
windowPosition Cartesian2

Window coordinates to perform picking on. The picked screen coordinates.

Returns:
Type Description
Cartesian3 Normal. The picked up normal vector; If the picked model is not an S3M model, return undefined.

pickNormalAsync(windowPosition){Promise.<Cartesian3>}

Used to pick normals, input screen coordinates, and return normals. Combining the selected offset can achieve the effect of offsetting along the normal direction.

Name Type Description
windowPosition Cartesian2

Window coordinates to perform picking on. The picked screen coordinates.

Returns:
Type Description
Promise.<Cartesian3> Normal. The picked up normal vector; If the picked model is not an S3M model, return undefined.

pickPosition(windowPosition, result){Cartesian3}

Position picking, based on the window coordinates, picks the corresponding position from the depth buffer of the scene and returns Cartesian coordinates, requiring support for depth textures.

Name Type Description
windowPosition Cartesian2

Window coordinates.

result Cartesian3 optional

Cartesian coordinates, save the returned result.

Throws:

Picking from depth textures is not supported, please check pickPositionSupported. 2D is not supported. Orthogonal projection matrices are irreversible.

Type
DeveloperError
Returns:
Type Description
Cartesian3 Return the corresponding Cartesian coordinates (three-dimensional geographic coordinates).

pickRect(startPoint, endPoint)

Frame Select

Name Type Description
startPoint Object

Select the starting point of the box.

endPoint Object

Box the termination point.

removeLightSource(lightSource){Scene}

Remove the light source.

Name Type Description
lightSource LightSource

Light source.

Returns:
Type Description
Scene The scene after adding the light source.

removeVectorTilesMap(name){Boolean}

Remove vector tile map by specified name.

Name Type Description
name String

Specify the name of the vector tile map to be removed.

Returns:
Type Description
Boolean Whether the removal was successful.

sampleHeight(position, objectsToExclude, width){Number}

Returns the height of the scene geometry at the given projection position. If there is no scene geometry for height sampling, returns an undefined value. The height of the input position will be ignored. Can be used to restrict objects to the Earth, 3D tiles, or primitives in the scene.

This function only samples the height of the rendered Earth tiles and 3D tiles in the current view. Regardless of whether other primitives are visible or not, their heights will be sampled.

Name Type Default Description
position Cartographic

Map projection position for sampling height.

objectsToExclude Array.<Object> optional

A list of primitive, solid, or 3D tile features that are not highly sampled.

width Number 0.1 optional

The width of an intersection, measured in meters.

See:
Throws:
  • sampleHeight is only supported in 3D mode.

    Type
    DeveloperError
  • sampleHeight requires depth texture support. Check sampleHeightSupported.

    Type
    DeveloperError
Returns:
Type Description
Number Height. If there is no scene geometry for height sampling, it may not be defined.
Example
var position = new SuperMap3D.Cartographic(-1.31968, 0.698874);
var height = viewer.scene.sampleHeight(position);
console.log(height);

sampleHeightMostDetailed(positions, objectsToExclude, width){Promise.<Array.<Number>>}

Start asynchronous Scene # sampleHeight query to retrieve the Cartographic position array, using the maximum refinement level of the 3D tile set in the scene. The height of the input position is ignored. Return the promise parsed upon completion of the query. The height of each point is modified on-site. If the height cannot be determined due to the inability to sample geometry at that location or other errors, set the height to undefined.

Name Type Default Description
positions Array.<Cartographic>

Map projection position that needs to be updated with sampling height.

objectsToExclude Array.<Object> optional

A list of primitive, solid, or 3D tile features that are not highly sampled.

width Number 0.1 optional

The width of an intersection, measured in meters.

See:
Throws:
  • SampleHeightMostDetailed only supports 3D mode.

    Type
    DeveloperError
  • SampleHeightMostDetailed requires depth texture support. Please check sampleHeightSupported.

    Type
    DeveloperError
Returns:
Type Description
Promise.<Array.<Number>> After the query is completed, parse the promise to the provided location list.
Example
var positions = [
    new SuperMap3D.Cartographic(-1.31968, 0.69887),
    new SuperMap3D.Cartographic(-1.10489, 0.83923)
];
var promise = viewer.scene.sampleHeightMostDetailed(positions);
promise.then(function(updatedPosition) {
    // positions[0].height and positions[1].height have been updated.
    // updatedPositions is just a reference to positions.
}

deprecated setVectorTilesLayersControl(control, level)

Name Type Description
control Boolean

Whether to control the display level of MVT.

level Number

The total number of levels displayed from the current perspective, from near to far. For example, if set to 3, only the first three layers closest to the camera will be displayed, and the fourth layer and beyond will not be displayed.