new WebScene()
| Name | Type | Description |
|---|---|---|
options.authoringApp |
String |
Generate the app name for webScene |
options.authoringAppVersion |
String |
optional
Generate the app version number for webScene |
Methods
-
static toJSON(options){Object}
-
Save a WebScene object as JSON and return it
Name Type Description optionsObject Save parameters
Name Type Default Description webSceneWebScene The webScene object to be saved. Required
templateboolean false optional Do you want to save as a template
Returns:
Type Description Object Return the current scene information. Examples
// Save the webscene and return the result const currentWebScene = viewer.webScene; SuperMap3D.WebScene.toJSON({ webScene: currentWebScene, });// Save the webscene template and return the result const currentWebScene = viewer.webScene; SuperMap3D.WebScene.toJSON({ webScene: currentWebScene, template : true }); -
static toJSONAndDownload(options){undefined}
-
Save a WebScene object as JSON and download it locally
Name Type Description optionsObject Save parameters
Name Type Default Description webSceneWebScene The webScene object to be saved. Required
nameString optional Name of the saved JSON file
templateboolean false optional Do you want to save as a template
Returns:
Type Description undefined undefined Examples
// Save the webscene to a JSON file named 'test' and download it const currentWebScene = viewer.webScene; SuperMap3D.WebScene.toJSONAndDownload({ webScene: currentWebScene, name: "test", });// Save the webscene template to a JSON file named 'testTemplate' and download it const currentWebScene = viewer.webScene; SuperMap3D.WebScene.toJSONAndDownload({ webScene: currentWebScene, name: "testTemplate", template : true }); -
fromJSON()
-
Read the JSON file of WebScene. Apply the settings in the WebScene file to the scene
Example
// Read a JSON file and set it to WebScene. // fileStream is the file stream read by FileReader const jsonObj = JSON.parse(fileStream); const currentWebScene = viewer.webScene; currentWebScene.fromJSON(jsonObj);