Skip to content

Commit

Permalink
fix(globe): fix tiles layer temporary for presentation (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach authored Dec 6, 2019
1 parent ffc846f commit e2fd577
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
23 changes: 18 additions & 5 deletions src/scripts/components/globe/globe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,27 @@ const Globe: FunctionComponent<Props> = ({
if (url) {
const imageProvider =
layerType === 'tiles'
? window.Cesium.createTileMapServiceImageryProvider({
url
? new Cesium.UrlTemplateImageryProvider({
url,
tilingScheme: new Cesium.GeographicTilingScheme(),
minimumLevel: 0,
maximumLevel: 3,
tileWidth: 270,
tileHeight: 270
})
: new Cesium.SingleTileImageryProvider({url});
// @ts-ignore
window.imageryProvider = imageProvider;

imageProvider.readyPromise.then(() => {
viewer.scene.imageryLayers.addImageryProvider(imageProvider);
const newLayer = viewer.scene.imageryLayers.addImageryProvider(
imageProvider
);
// @ts-ignore
newLayer.minificationFilter = Cesium.TextureMinificationFilter.NEAREST;
// @ts-ignore
newLayer.magnificationFilter =
// @ts-ignore
Cesium.TextureMagnificationFilter.NEAREST;

// remove and destroy old layer if exists
// we do not clean it up in the useEffect clean function because we want
// to wait until the new layer is ready to prevent flickering
Expand Down
10 changes: 5 additions & 5 deletions src/scripts/config/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const globeState: GlobeState = {
projection: GlobeProjection.Sphere,
view: {
position: {
height: 14484862,
latitude: 0.659017,
longitude: 0.002816
height: 25003000,
latitude: 21.5,
longitude: -0.32
},
orientation: {
heading: 0,
heading: 360,
pitch: -90,
roll: 0
}
Expand All @@ -25,7 +25,7 @@ export default {
layer:
'https://storage.googleapis.com/esa-cfs-storage/layers/{id}/metadata.json',
layerTiles:
'https://storage.googleapis.com/esa-cfs-tiles/test/{id}/{timeIndex}',
'https://storage.googleapis.com/esa-cfs-tiles/test/{id}/{timeIndex}/{z}/{y}/{x}.png',
layerSingleImage:
'https://storage.googleapis.com/esa-cfs-tiles/test/{id}/{timeIndex}.jpg',
stories:
Expand Down

0 comments on commit e2fd577

Please sign in to comment.