2. Loading Scene Services |
In the previous section, we’ve implemented to load a default scene. But it is not enough for the practical applications, where we need to load the actual data.
Data on the client mainly comes from the server, so in this section, we show the example about getting the needed scene from the server to explain how to load the scene and all the layers in the scene, in the next section we will show how to open a specified layer in the scene.
In the 3D system, a scene is equivalent to a map in the 2D system, and a layer in the scene is equivalent to a layer of a map in the 2D system. The main task of the 3D scene class (Scene) is to load the 2D and 3D map data. the 3D scene class (Scene) can be used to load the 3D layers (Layer3D) and terrain layers (TerrainLayer). A 3D scene object can contain multiple layers with Layer3D types and terrain layers TerrainLayer, which are managed by the 3D layer set and the terrain layer set TerrainLayers respectively.
In this section we describe how to use the 3D scene class (Scene) to load the scene services on the server.
Interface | Description | |
---|---|---|
camera | Gets or sets the camera object of the current scene, and a camera is equivalent to a view point. | |
currentScale | Gets the scale of the current scene. | |
flyingOperator | Obtains the fly operation object of the current scene. This attribute is primarily used to set the fly status of the scene, specify the fly direction to the next scene, control the fly pattern and animation. | |
layer3Ds | Obtains the 3D layer set object. | |
name | Gets or sets the name of the scene. | |
sceneOption | Obtains the set of the visibility of the various interface elements in the scene, such as the longitude and latitude graticule, the atmosphere, etc. | |
screenLayer3D | Obtains the screen layer in the scene. | |
terrainExaggeration | Gets or sets the proportion of the terrain exaggeration which stretches the height of the terrain in a certain proportion. | |
terrainLayers | Obtains the terrain layer set in the 3D scene. | |
trackingLayer3D | Obtains the tracking layer in the scene. |
Interface | Description | |
---|---|---|
close | Closes all layers in the current scene which has been loaded in the 3D scene. | |
findSelection3Ds | Finds the selection sets of the layers in the current 3D scene. This method returns the arrays of the Selection3D class objects, each Selection3D class object corresponds to all object sets which have been selected in a layer in the 3D scene, if no object is selected, the array is empty. | |
getAverageFPS | Obtains the average number of frames to render the current scene. | |
open | Opens a specified scene and all layers in the scene. when loading a specified scene, you need to load the environment variables at the same time, such as ambient light, background light, terrain exaggeration factor, camera, fog, sky, atmosphere, longitude and latitude lines, etc., and the layer data in the scene. | |
refresh | Refreshes the 3D scene. | |
resetTerrain | Resets the terrain layer. you need to call this function to refresh the terrain display when the terrain layers are added, deleted or set to be visible or invisible. | |
save | Saves the current scene configuration as an XML file in GML standard, and uploads to the server. | |
setRefreshRaster | Sets whether the real-time rasterization is refreshed. If there are display problems for the raster data in 3D system, this function can be called to refresh the display of raster data only. | |
viewEntire | Zooms the 3D map scene to full extent. |
Interface | Description | |
---|---|---|
count | Obtains the total number of the scene services in the scene list. | |
item | Obtains the scene service information with the specified scene index number (Nember type) or name (String type) in the scene list. | |
serverAddress | Obtains the server addresses which provide the scene service list. |
Interface | Description | |
---|---|---|
load | Obtains all lists of the scenes services. | |
removeAll | Removes all scene service information in the scene service list. |
JavaScript | |
---|---|
<!--the information window--> |
JavaScript | |
---|---|
|
JavaScript | |
---|---|
|
JavaScript | |
---|---|
|
JavaScript | |
---|---|
|
Figure 1 Open the scene
Figure 2 the various layers in the scene