From b0c2d0721bc7e1ae8762139bf1134b58bdca794a Mon Sep 17 00:00:00 2001 From: Philipp Wambach Date: Thu, 10 Oct 2019 16:56:02 +0200 Subject: [PATCH] feat(cesium): use static image provider (#140) --- src/scripts/components/globe/globe.styl | 3 +++ src/scripts/components/globe/globe.tsx | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/scripts/components/globe/globe.styl b/src/scripts/components/globe/globe.styl index 01866693b..33776a676 100644 --- a/src/scripts/components/globe/globe.styl +++ b/src/scripts/components/globe/globe.styl @@ -1,3 +1,6 @@ +:global(.cesium-viewer-bottom) + display: none + .globe flex-grow: 1 flex-basis: 50% diff --git a/src/scripts/components/globe/globe.tsx b/src/scripts/components/globe/globe.tsx index 81a41578c..08ce57bc1 100644 --- a/src/scripts/components/globe/globe.tsx +++ b/src/scripts/components/globe/globe.tsx @@ -12,9 +12,18 @@ import 'cesium/Build/Cesium/Cesium'; import styles from './globe.styl'; -// set global base url const Cesium = window.Cesium; +// set global base url Cesium.buildModuleUrl.setBaseUrl('./cesium/'); +// we do not use cesium ion tile server +// @ts-ignore +Cesium.Ion.defaultAccessToken = ''; +// create default imagery provider +// @ts-ignore +const tileUrl = window.Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII'); +const imageryProvider = window.Cesium.createTileMapServiceImageryProvider({ + url: tileUrl +}); interface Props { active: boolean; @@ -43,7 +52,12 @@ const Globe: FunctionComponent = ({ return () => {}; } - const scopedViewer = new Cesium.Viewer(ref.current, config.globe.options); + // create cesium viewer + const options = { + ...config.globe.options, + imageryProvider + }; + const scopedViewer = new Cesium.Viewer(ref.current, options); // save viewer reference setViewer(scopedViewer);