Appearance
Core (ge3d Core)
This is the ge3d class for initializing the Earth. All objects on the map are managed by it.
Constructor
ts
new ge3d.Core(id, options): CoreParameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Cesium.Viewer | div container id or pre-constructed Viewer object. (If you have already initialized a Viewer object with Cesium, you can directly pass in the Viewer object, which allows ge3d to be used in the middle of a project) |
| options | Object | Parameters for Scene and base map configuration |
Options
scene
Initialize view angle and scene configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| center | Object | - | Initial view angle |
| center.lat | Number | 28 | Latitude |
| center.lng | Number | 36 | Longitude |
| center.alt | Number | 45187 | Altitude |
| center.heading | Number | 0 | Heading angle |
| center.pitch | Number | -45 | Pitch angle |
| animation | Boolean | true | Whether to create animation widget, bottom left corner instrument |
| timeline | Boolean | false | Whether to display timeline control |
| fullscreenButton | Boolean | true | Bottom right corner fullscreen button |
| vrButton | Boolean | true | Bottom right corner VR virtual reality button |
| geocoder | Boolean | true | Whether to display place name search control |
| sceneModePicker | Boolean | true | Whether to display projection mode control |
| homeButton | Boolean | true | Return to default view button |
| navigationHelpButton | Boolean | true | Whether to display help information control |
| navigationInstructionsInitiallyVisible | Boolean | true | Whether to automatically display before user explicitly clicks button |
| infoBox | Boolean | true | Whether to display information after clicking elements |
| selectionIndicator | Boolean | true | Whether to display green box when selecting models |
| shouldAnimate | Boolean | true | true if clock should try to advance simulation time by default, false otherwise. This option takes precedence over setting Viewer#clockViewModel |
| showRenderLoopErrors | Boolean | true | Whether to display error popup information |
| baseLayerPicker | Boolean | false | Map base layer |
baseImages
Base map configuration array
| Parameter | Type | Description |
|---|---|---|
| id | String | Layer ID |
| name | String | Layer name |
| type | String | Layer type (such as "google", "tdt") |
| layer | String | Layer type (such as "img_d") |
| show | Boolean | Whether to display |
terrain
Terrain configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| type | String | "ion" | Terrain type |
| show | Boolean | true | Whether to enable terrain |
Example
ts
const core = new ge3d.Core("cesiumContainer", { //cesiumContainer container id
"scene": {
//Initial view angle
center: { "lat": 28, "lng": 36, "alt": 45187, "heading": 0, "pitch": -45 },
animation: true, // Whether to create animation widget, bottom left corner instrument
timeline: false, // Whether to display timeline control
fullscreenButton: true, // Bottom right corner fullscreen button
vrButton: true, // Bottom right corner VR virtual reality button
geocoder: true, // Whether to display place name search control
sceneModePicker: true, // Whether to display projection mode control
homeButton: true, // Return to default view button
navigationHelpButton: true, // Whether to display help information control
navigationInstructionsInitiallyVisible: true, // Whether to automatically display before user explicitly clicks button
infoBox: true, // Whether to display information after clicking elements
selectionIndicator: true, // Whether to display green box when selecting models
shouldAnimate: true, //true if clock should try to advance simulation time by default, false otherwise. This option takes precedence over setting Viewer#clockViewModel.
showRenderLoopErrors: true, // Whether to display error popup information
baseLayerPicker: false, // Map base layer
},
"baseImages": [
{
"id": 'googleLayerId',
"name": "Google Imagery",
"type": "google",
"layer": "img_d",
"show": false
},
{
"id": 'tdtLayerId',
"name": "Tianditu Imagery",
"type": "tdt",
"layer": "img_d",
//Apply Tianditu
"show": true
},
],
//Enable terrain
terrain: {
'type': 'ion',
"show": true,
},
});Properties
| Property | Type | Description |
|---|---|---|
| basemap | String | Get or set the currently displayed base map, can pass layer id or name when setting |
| camera | Cesium.Camera | Get camera |
| canvas | HTMLCanvasElement | Get Canvas |
| cesiumWidget | Cesium.CesiumWidget | Get CesiumWidget |
| clock | Cesium.Clock | Get clock |
| container | HTMLElement | Get map DOM container |
| controls | Object | Get pre-constructed control objects passed in from config.json |
| dataSources | Cesium.DataSourceCollection | Get the collection of DataSource instances to be visualized |
| featureLayer | Object | Default bound layer, convenient for simple scenarios |
| fixedLight | Boolean | Whether to fix lighting, true: can avoid inconsistent brightness of gltf, 3dtiles models over time |
| hasTerrain | Boolean | Whether terrain is enabled |
| imageryLayers | Cesium.ImageryLayerCollection | Get the collection of ImageryLayer image layers to be rendered on Earth |
| lang | String | Language used (such as Chinese, English, etc.) |
| level | Number | Get current map level (approximate), generally 0-21 levels |
| mouseEvent | Object | Get mouse event controller |
| onlyPickModelPosition | Boolean | Whether to only pick points on models |
| scene | Cesium.Scene | Get scene |
| trackedEntity | Cesium.Entity | Get or set the Entity instance that the camera is currently tracking |
| viewer | Cesium.Viewer | The Cesium native Viewer object corresponding to the map |