Skip to content

Commit

Permalink
✨ wo #43: switch the animation according to the selected simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
helllth committed Jul 4, 2020
1 parent 4527b67 commit ca5d65c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/components/starkregen/VectorFieldAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class VectorFieldAnimation extends MapLayer {

const bbox = this.props.bbox;
//BBOX=7.1954778,51.2743996,7.2046701,51.2703213
let url_u = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/u84.tif&FORMAT=text/raster.asc`;
let url_v = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/v84.tif&FORMAT=text/raster.asc`;
let url_u = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/${this
.props.layerPrefix}u84.tif&FORMAT=text/raster.asc`;
let url_v = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/${this
.props.layerPrefix}v84.tif&FORMAT=text/raster.asc`;

var urls = [ url_u, url_v ];
console.log('VFA: ', urls);
Expand Down Expand Up @@ -69,7 +71,11 @@ class VectorFieldAnimation extends MapLayer {
this.leafletElement.timer.stop();
}
}
super.componentWillUnmount();
try {
super.componentWillUnmount();
} catch (e) {
console.log('could be already unmounted');
}
}

superComponentDidMount() {
Expand All @@ -88,8 +94,10 @@ class VectorFieldAnimation extends MapLayer {
const bbox = getBBoxForBounds(bounds);

//BBOX=7.1954778,51.2743996,7.2046701,51.2703213
let url_u = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/u84.tif&FORMAT=text/raster.asc`;
let url_v = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/v84.tif&FORMAT=text/raster.asc`;
let url_u = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/${this
.props.layerPrefix}u84.tif&FORMAT=text/raster.asc`;
let url_v = `${service}/gdalProcessor?REQUEST=translate&SRS=EPSG:4326&BBOX=${bbox[0]},${bbox[1]},${bbox[2]},${bbox[3]}&LAYERS=docs/regen/${this
.props.layerPrefix}v84.tif&FORMAT=text/raster.asc`;

var urls = [ url_u, url_v ];
if (this.leafletElement.url_u === url_u && this.leafletElement.url_v === url_v) {
Expand Down
7 changes: 7 additions & 0 deletions src/containers/Starkregen.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,18 @@ export class Starkregen_ extends React.Component {
'.' +
// JSON.stringify(currentBBox) +
// '.' +
this.props.starkregen.selectedSimulation +
'.' +
JSON.stringify(
this.props.match.params.layers ||
this.props.starkregen.backgrounds[validBackgroundIndex].layerkey
)
}
layerPrefix={
this.props.starkregen.simulations[
this.props.starkregen.selectedSimulation
].animation
}
bbox={currentBBox}
settings={vectorFieldAnimationSettings}
/>
Expand Down
4 changes: 4 additions & 0 deletions src/redux/modules/starkregen.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const initialState = {
simulations: [
{
layer: 'R102:50md',
animation: '',
name: 'Stärke 6',
title: 'Starkregen SRI 6 (38,5 l/m² in 2h)',
icon: 'bar-chart',
Expand All @@ -40,6 +41,7 @@ export const initialState = {
},
{
layer: 'R102:100md',
animation: 'S7_',
name: 'Stärke 7',
icon: 'bar-chart',
title: 'Starkregen SRI 7 (42 l/m² in 2h)',
Expand All @@ -48,6 +50,7 @@ export const initialState = {
},
{
layer: 'R102:90md',
animation: 'S10_',
name: 'Stärke 10',
icon: 'bitbucket',
title: 'Starkregen SRI 10 (90 l/m² in 1h)',
Expand All @@ -56,6 +59,7 @@ export const initialState = {
},
{
layer: 'R102:SRmd',
animation: 'S29.05.2018_',
name: '29.05.18',
icon: 'calendar',
title: 'Regen vom 29.05.2018 (SRI 11)',
Expand Down

0 comments on commit ca5d65c

Please sign in to comment.