Skip to content

Commit

Permalink
Merge branch 'feature/100-adaptation-scenarios' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
p-a-s-c-a-l committed Jul 23, 2020
2 parents e18d2fb + 5be0571 commit 5f44a65
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 90 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "clarity-map-component",
"version": "2.6.0",
"version": "2.7.0",
"private": true,
"license": "LGPL",
"dependencies": {
"@turf/boolean-within": "latest",
"browserslist": "^4.11.0",
"csis-helpers-js": "git://github.com/clarity-h2020/csis-helpers-js.git#semver:^0.6.0",
"handlebars": "^4.7.3",
"browserslist": "^4.13.0",
"csis-helpers-js": "git://github.com/clarity-h2020/csis-helpers-js.git#semver:^0.6.4",
"handlebars": "^4.7.6",
"history": "^4.10.1",
"leaflet": "^1.6.0",
"leaflet-draw": "^1.0.4",
Expand All @@ -16,19 +16,19 @@
"leaflet.nontiledlayer": "^1.0.8",
"leaflet.sync": "^0.2.4",
"leaflet.wms": "^0.2.0",
"loglevel": "^1.6.7",
"loglevel": "^1.6.8",
"prop-types": "latest",
"query-string": "^6.11.1",
"query-string": "^6.13.1",
"react": "^16.13.1",
"react-compound-slider": "^2.5.0",
"react-dom": "^16.13.1",
"react-leaflet": "^2.6.3",
"react-leaflet": "^2.7.0",
"react-leaflet-draw": "^0.19.0",
"react-leaflet-grouped-layer-control": "git://github.com/clarity-h2020/react-leaflet-grouped-layer-control.git#semver:^0.1.1",
"react-router-dom": "^5.1.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"turf": "latest",
"wicket": "^1.3.5",
"wicket": "^1.3.6",
"xml-js": "^1.6.11"
},
"resolutions": {
Expand Down Expand Up @@ -62,7 +62,7 @@
},
"devDependencies": {
"babel-polyfill": "^6.26.0",
"react-styleguidist": "^11.0.4",
"serve": "^11.3.0"
"react-styleguidist": "^11.0.8",
"serve": "^11.3.2"
}
}
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class App extends React.Component {
<Route exact path={`${process.env.PUBLIC_URL}/SynchronisedHazardLocalEffectsMap/`} render={(props) => <HazardLocalEffectsMap {...props} isSynchronised={true} />} />
<Route exact path={`${process.env.PUBLIC_URL}/SynchronisedRiskAndImpactMap/`} render={(props) => <RiskAndImpactMap {...props} isSynchronised={true} />} />
<Route exact path={`${process.env.PUBLIC_URL}/SynchronisedVulnerabilityMap/`} render={(props) => <VulnerabilityMap {...props} isSynchronised={true} />} />
<Route exact path={`${process.env.PUBLIC_URL}/AdaptationOptionsAppraisalMap/`} render={(props) => <RiskAndImpactMap {...props} isSynchronised={true} showAdaptationScenario={true}/>} />

<Route exact path={process.env.PUBLIC_URL} component={GenericMap} />
</Switch>
Expand Down
9 changes: 6 additions & 3 deletions src/components/GenericMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import log from 'loglevel';

import LeafletMap from './commons/LeafletMap';
import BasicMap from './commons/BasicMap';
import BasicMap from "./commons/BasicMap";

// yes, order of imports do matter
import 'leaflet.sync';
Expand Down Expand Up @@ -64,6 +64,7 @@ export default class GenericMap extends BasicMap {

if (this.props.isSynchronised === true) {
log.info('rendering two sychronised maps: ' + this.props.isSynchronised);

return (<>
<LeafletMap
loading={this.state.loading}
Expand All @@ -74,7 +75,8 @@ export default class GenericMap extends BasicMap {
exclusiveGroups={this.state.exclusiveGroups}
mapId={'synchronisedMapA'}
ref={(mapComponent) => (this.mapComponentA = mapComponent)}
fly='true'
fly={true}
showAdaptationScenario={false}
/>
<LeafletMap
loading={this.state.loading}
Expand All @@ -85,7 +87,8 @@ export default class GenericMap extends BasicMap {
exclusiveGroups={this.state.exclusiveGroups}
mapId={'synchronisedMapB'}
ref={(mapComponent) => (this.mapComponentB = mapComponent)}
fly='false'
fly={false}
showAdaptationScenario={true}
/>
</>);
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/components/commons/BasicMap.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { CSISHelpers, CSISRemoteHelpers } from 'csis-helpers-js';
import log from 'loglevel';
import PropTypes from 'prop-types';
import queryString from 'query-string';
import React from 'react';
import turf from 'turf';
import Wkt from 'wicket';
import queryString from 'query-string';
import log from 'loglevel';
import { CSISRemoteHelpers, CSISHelpers } from 'csis-helpers-js';

import logo from './../../logo.svg';
import './../../App.css';
import logo from './../../logo.svg';


log.enableAll();

Expand Down
11 changes: 9 additions & 2 deletions src/components/commons/LeafletMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,14 @@ export default class LeafletMap extends React.Component {
getUrl(name) {
for (var i = 0; i < this.props.overlays.length; i++) {
if (this.props.overlays[i].name === name) {
return this.props.overlays[i].url;

// hacketyhack
if(this.props.showAdaptationScenario) {
log.debug(`changing URL parameter of layer ${name} to STUDY_VARIANT='ADAPTATION-01'`);
return this.props.overlays[i].url.replace("STUDY_VARIANT='BASELINE'","STUDY_VARIANT='ADAPTATION-01'");
} else {
return this.props.overlays[i].url;
}
}
}

Expand Down Expand Up @@ -410,7 +417,7 @@ export default class LeafletMap extends React.Component {
const identify = true;
layerArray.unshift(
<WMSLayer
key={overlay.name}
key={`${overlay.name}_${this.props.showAdaptationScenario}`}
layers={this.getLayers(overlay.name)}
url={this.getUrl(overlay.name)}
transparent="true"
Expand Down
Loading

0 comments on commit 5f44a65

Please sign in to comment.