Skip to content

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): Core

Parameters

ParameterTypeDescription
idstring | Cesium.Viewerdiv 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)
optionsObjectParameters for Scene and base map configuration

Options

scene

Initialize view angle and scene configuration

ParameterTypeDefaultDescription
centerObject-Initial view angle
center.latNumber28Latitude
center.lngNumber36Longitude
center.altNumber45187Altitude
center.headingNumber0Heading angle
center.pitchNumber-45Pitch angle
animationBooleantrueWhether to create animation widget, bottom left corner instrument
timelineBooleanfalseWhether to display timeline control
fullscreenButtonBooleantrueBottom right corner fullscreen button
vrButtonBooleantrueBottom right corner VR virtual reality button
geocoderBooleantrueWhether to display place name search control
sceneModePickerBooleantrueWhether to display projection mode control
homeButtonBooleantrueReturn to default view button
navigationHelpButtonBooleantrueWhether to display help information control
navigationInstructionsInitiallyVisibleBooleantrueWhether to automatically display before user explicitly clicks button
infoBoxBooleantrueWhether to display information after clicking elements
selectionIndicatorBooleantrueWhether to display green box when selecting models
shouldAnimateBooleantruetrue if clock should try to advance simulation time by default, false otherwise. This option takes precedence over setting Viewer#clockViewModel
showRenderLoopErrorsBooleantrueWhether to display error popup information
baseLayerPickerBooleanfalseMap base layer

baseImages

Base map configuration array

ParameterTypeDescription
idStringLayer ID
nameStringLayer name
typeStringLayer type (such as "google", "tdt")
layerStringLayer type (such as "img_d")
showBooleanWhether to display

terrain

Terrain configuration

ParameterTypeDefaultDescription
typeString"ion"Terrain type
showBooleantrueWhether 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

PropertyTypeDescription
basemapStringGet or set the currently displayed base map, can pass layer id or name when setting
cameraCesium.CameraGet camera
canvasHTMLCanvasElementGet Canvas
cesiumWidgetCesium.CesiumWidgetGet CesiumWidget
clockCesium.ClockGet clock
containerHTMLElementGet map DOM container
controlsObjectGet pre-constructed control objects passed in from config.json
dataSourcesCesium.DataSourceCollectionGet the collection of DataSource instances to be visualized
featureLayerObjectDefault bound layer, convenient for simple scenarios
fixedLightBooleanWhether to fix lighting, true: can avoid inconsistent brightness of gltf, 3dtiles models over time
hasTerrainBooleanWhether terrain is enabled
imageryLayersCesium.ImageryLayerCollectionGet the collection of ImageryLayer image layers to be rendered on Earth
langStringLanguage used (such as Chinese, English, etc.)
levelNumberGet current map level (approximate), generally 0-21 levels
mouseEventObjectGet mouse event controller
onlyPickModelPositionBooleanWhether to only pick points on models
sceneCesium.SceneGet scene
trackedEntityCesium.EntityGet or set the Entity instance that the camera is currently tracking
viewerCesium.ViewerThe Cesium native Viewer object corresponding to the map