Skip to content

Commit

Permalink
feat(cesium): use static image provider (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach committed Oct 10, 2019
1 parent c834ad3 commit b0c2d07
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/scripts/components/globe/globe.styl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
:global(.cesium-viewer-bottom)
display: none

.globe
flex-grow: 1
flex-basis: 50%
Expand Down
18 changes: 16 additions & 2 deletions src/scripts/components/globe/globe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,7 +52,12 @@ const Globe: FunctionComponent<Props> = ({
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);
Expand Down

0 comments on commit b0c2d07

Please sign in to comment.