Skip to content

Commit

Permalink
feat(gallery-layer-type): add basic viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
mrMetalWood committed Aug 28, 2020
1 parent 811cf12 commit 7ab79da
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 16 deletions.
3 changes: 3 additions & 0 deletions data/gdal-colors/colors-ozone_profile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3.0 0 188 254 255
0.0 0 0 0 255
nv 0 0 0 0
8 changes: 8 additions & 0 deletions data/layers-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,5 +415,13 @@
"roll": 0
}
}
},
"ozone.ozone_profile": {
"colorMap": "custom",
"timeFormat": {
"year": "numeric",
"month": "long",
"day": "numeric"
}
}
}
19 changes: 19 additions & 0 deletions src/scripts/components/main/gallery/gallery.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@require '../../../../variables.styl'

.gallery
position: relative
flex-grow: 1
flex-basis: 50%
width: 100%
height: 100%

.galleryItem
box-sizing: border-box
padding: emCalc(100px)
width: 100%
height: 100%

.galleryImage
width: 100%
height: 100%
object-fit: contain
20 changes: 20 additions & 0 deletions src/scripts/components/main/gallery/gallery.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, {FunctionComponent} from 'react';

import styles from './gallery.styl';
import {GlobeImageLayerData} from '../../../types/globe-image-layer-data';

interface Props {
imageLayer: GlobeImageLayerData | null;
}

const Gallery: FunctionComponent<Props> = ({imageLayer}) => {
return (
<div className={styles.gallery}>
<div className={styles.galleryItem}>
<img className={styles.galleryImage} src={imageLayer?.url} />
</div>
</div>
);
};

export default Gallery;
41 changes: 25 additions & 16 deletions src/scripts/components/main/globes/globes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {projectionSelector} from '../../../selectors/globe/projection';
import {flyToSelector} from '../../../selectors/fly-to';
import setGlobeViewAction from '../../../actions/set-globe-view';
import Globe from '../globe/globe';
import Gallery from '../gallery/gallery';
import LayerLegend from '../../layers/layer-legend/layer-legend';
import {getImageLayerData} from '../../../libs/get-image-layer-data';
import {State} from '../../../reducers';
Expand All @@ -23,6 +24,7 @@ import {globeSpinningSelector} from '../../../selectors/globe/spinning';

import {GlobeView} from '../../../types/globe-view';
import {Marker} from '../../../types/marker-type';
import {LayerType} from '../../../types/globe-layer-type';

import styles from './globes.styl';
import setGlobeSpinningAction from '../../../actions/set-globe-spinning';
Expand Down Expand Up @@ -104,22 +106,29 @@ const Globes: FunctionComponent<Props> = ({backgroundColor, markers = []}) => {
isCompare={true}
/>
)}
<Globe
markers={markers}
backgroundColor={backgroundColor}
active={isMainActive}
view={currentView}
projectionState={projectionState}
imageLayer={mainImageLayer}
basemap={mainLayerDetails?.basemap || null}
spinning={globeSpinning}
flyTo={flyTo}
onMouseEnter={() => setIsMainActive(true)}
onTouchStart={() => setIsMainActive(true)}
onChange={onChangeHandler}
onMoveEnd={onMoveEndHandler}
onMouseDown={onMouseDownHandler}
/>

{mainLayerDetails?.type === LayerType.Gallery && (
<Gallery imageLayer={mainImageLayer} />
)}

{mainLayerDetails?.type !== LayerType.Gallery && (
<Globe
markers={markers}
backgroundColor={backgroundColor}
active={isMainActive}
view={currentView}
projectionState={projectionState}
imageLayer={mainImageLayer}
basemap={mainLayerDetails?.basemap || null}
spinning={globeSpinning}
flyTo={flyTo}
onMouseEnter={() => setIsMainActive(true)}
onTouchStart={() => setIsMainActive(true)}
onChange={onChangeHandler}
onMoveEnd={onMoveEndHandler}
onMouseDown={onMouseDownHandler}
/>
)}

{compareLayer && (
<Globe
Expand Down
Binary file added storage/legend-images/ozone_profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7ab79da

Please sign in to comment.