lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
function addViewSettings(terria, initSources) {
  const cameraExtent = terria.currentViewer.getCurrentExtent();

  // Add an init source with the camera position.
  const initialCamera = {
    west: CesiumMath.toDegrees(cameraExtent.west),
    south: CesiumMath.toDegrees(cameraExtent.south),
    east: CesiumMath.toDegrees(cameraExtent.east),
    north: CesiumMath.toDegrees(cameraExtent.north)
  };

  if (defined(terria.cesium)) {
    const cesiumCamera = terria.cesium.scene.camera;
    initialCamera.position = cesiumCamera.positionWC;
    initialCamera.direction = cesiumCamera.directionWC;
    initialCamera.up = cesiumCamera.upWC;
  }

  const homeCamera = {
    west: CesiumMath.toDegrees(terria.homeView.rectangle.west),
    south: CesiumMath.toDegrees(terria.homeView.rectangle.south),
    east: CesiumMath.toDegrees(terria.homeView.rectangle.east),
    north: CesiumMath.toDegrees(terria.homeView.rectangle.north),
    position: terria.homeView.position,
    direction: terria.homeView.direction,
    up: terria.homeView.up
  };

  const time = {
    dayNumber: terria.clock.currentTime.dayNumber,
    secondsOfDay: terria.clock.currentTime.secondsOfDay
  };

  let viewerMode;
  switch (terria.viewerMode) {
    case ViewerMode.CesiumTerrain:
      viewerMode = "3d";
      break;
    case ViewerMode.CesiumEllipsoid:
      viewerMode = "3dSmooth";
      break;
    case ViewerMode.Leaflet:
      viewerMode = "2d";
      break;
  }

  const terriaSettings = {
    initialCamera: initialCamera,
    homeCamera: homeCamera,
    baseMapName: terria.baseMap.name,
    viewerMode: viewerMode,
    currentTime: time
  };
  if (terria.showSplitter) {
    terriaSettings.showSplitter = terria.showSplitter;
    terriaSettings.splitPosition = terria.splitPosition;
  }
  initSources.push(terriaSettings);
}
function addViewSettings(terria, initSources) {
  const cameraExtent = terria.currentViewer.getCurrentExtent();

  // Add an init source with the camera position.
  const initialCamera = {
    west: CesiumMath.toDegrees(cameraExtent.west),
    south: CesiumMath.toDegrees(cameraExtent.south),
    east: CesiumMath.toDegrees(cameraExtent.east),
    north: CesiumMath.toDegrees(cameraExtent.north)
  };

  if (defined(terria.cesium)) {
    const cesiumCamera = terria.cesium.scene.camera;
    initialCamera.position = cesiumCamera.positionWC;
    initialCamera.direction = cesiumCamera.directionWC;
    initialCamera.up = cesiumCamera.upWC;
  }

  const homeCamera = {
    west: CesiumMath.toDegrees(terria.homeView.rectangle.west),
    south: CesiumMath.toDegrees(terria.homeView.rectangle.south),
    east: CesiumMath.toDegrees(terria.homeView.rectangle.east),
    north: CesiumMath.toDegrees(terria.homeView.rectangle.north),
    position: terria.homeView.position,
    direction: terria.homeView.direction,
    up: terria.homeView.up
  };

  const time = {
    dayNumber: terria.clock.currentTime.dayNumber,
    secondsOfDay: terria.clock.currentTime.secondsOfDay
  };

  let viewerMode;
  switch (terria.viewerMode) {
    case ViewerMode.CesiumTerrain:
      viewerMode = "3d";
      break;
    case ViewerMode.CesiumEllipsoid:
      viewerMode = "3dSmooth";
      break;
    case ViewerMode.Leaflet:
      viewerMode = "2d";
      break;
  }

  const terriaSettings = {
    initialCamera: initialCamera,
    homeCamera: homeCamera,
    baseMapName: terria.baseMap.name,
    viewerMode: viewerMode,
    currentTime: time
  };
  if (terria.showSplitter) {
    terriaSettings.showSplitter = terria.showSplitter;
    terriaSettings.splitPosition = terria.splitPosition;
  }
  initSources.push(terriaSettings);
}
function addViewSettings ( terria , initSources ) { const cameraExtent = terria . currentViewer . getCurrentExtent ( ) ; // Add an init source with the camera position. const initialCamera = { west : CesiumMath . toDegrees ( cameraExtent . west ) , south : CesiumMath . toDegrees ( cameraExtent . south ) , east : CesiumMath . toDegrees ( cameraExtent . east ) , north : CesiumMath . toDegrees ( cameraExtent . north ) } ; if ( defined ( terria . cesium ) ) { const cesiumCamera = terria . cesium . scene . camera ; initialCamera . position = cesiumCamera . positionWC ; initialCamera . direction = cesiumCamera . directionWC ; initialCamera . up = cesiumCamera . upWC ; } const homeCamera = { west : CesiumMath . toDegrees ( terria . homeView . rectangle . west ) , south : CesiumMath . toDegrees ( terria . homeView . rectangle . south ) , east : CesiumMath . toDegrees ( terria . homeView . rectangle . east ) , north : CesiumMath . toDegrees ( terria . homeView . rectangle . north ) , position : terria . homeView . position , direction : terria . homeView . direction , up : terria . homeView . up } ; const time = { dayNumber : terria . clock . currentTime . dayNumber , secondsOfDay : terria . clock . currentTime . secondsOfDay } ; let viewerMode ; switch ( terria . viewerMode ) { case ViewerMode . CesiumTerrain : viewerMode = "3d" ; break ; case ViewerMode . CesiumEllipsoid : viewerMode = "3dSmooth" ; break ; case ViewerMode . Leaflet : viewerMode = "2d" ; break ; } const terriaSettings = { initialCamera : initialCamera , homeCamera : homeCamera , baseMapName : terria . baseMap . name , viewerMode : viewerMode , currentTime : time } ; if ( terria . showSplitter ) { terriaSettings . showSplitter = terria . showSplitter ; terriaSettings . splitPosition = terria . splitPosition ; } initSources . push ( terriaSettings ) ; }
Adds the details of the current view to the init sources.
@private
Adds the details of the current view to the init sources .