@eeacms/volto-arcgis-block 0.1.91 → 0.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/src/components/MapViewer/HotspotWidget.jsx +460 -0
- package/src/components/MapViewer/MapViewer.jsx +29 -2
- package/src/components/MapViewer/MenuWidget.jsx +60 -18
- package/src/components/MapViewer/config.js +1 -0
- package/src/components/MapViewer/css/ArcgisMap.css +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [0.1.92](https://github.com/eea/volto-arcgis-block/compare/0.1.91...0.1.92) - 2 February 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-1581. Hotspot widget first version. [masanchez85 - [`f053c16`](https://github.com/eea/volto-arcgis-block/commit/f053c16bcadd8ff327b3317bd7efee6b21526a6d)]
|
|
12
|
+
- CLMS-1668. Hotspot filter v1 [masanchez85 - [`ca16275`](https://github.com/eea/volto-arcgis-block/commit/ca162750ea9d6627fccde99cb3d1caef1fd3fa26)]
|
|
7
13
|
### [0.1.91](https://github.com/eea/volto-arcgis-block/compare/0.1.90...0.1.91) - 27 January 2023
|
|
8
14
|
|
|
9
15
|
#### :hammer_and_wrench: Others
|
|
@@ -331,10 +337,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
331
337
|
#### :hammer_and_wrench: Others
|
|
332
338
|
|
|
333
339
|
- Merge pull request #148 from eea/develop [KCarpinteroBM - [`24266fb`](https://github.com/eea/volto-arcgis-block/commit/24266fb3a0c1662d22ae0529dc1d5a25c711cf97)]
|
|
340
|
+
- Revert "[JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`f751f69`](https://github.com/eea/volto-arcgis-block/commit/f751f69f652f0340ae55af6a4dab89d6bdc80906)]
|
|
334
341
|
- Revert "Revert "Mapviewer menu and map viewer options persistence"" [Mikel Larreategi - [`ad6e440`](https://github.com/eea/volto-arcgis-block/commit/ad6e440cdc160cffb1e86e1b26e501dbe648476c)]
|
|
335
342
|
- Revert "code coverage removal" [Mikel Larreategi - [`376f2d1`](https://github.com/eea/volto-arcgis-block/commit/376f2d1cd6e4e5110b3b63d5114af1bcfebe094b)]
|
|
336
343
|
- Revert "Update cypress.json" [Mikel Larreategi - [`43d01a0`](https://github.com/eea/volto-arcgis-block/commit/43d01a0a95a58ef5215c6cbf18223ca30a11b9cc)]
|
|
337
344
|
- Revert "Update cypress.json" [Mikel Larreategi - [`054c4ae`](https://github.com/eea/volto-arcgis-block/commit/054c4ae1767e1f26e6ec7e96a0e26a9711f29f04)]
|
|
345
|
+
- Revert "revert [JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`64ab56e`](https://github.com/eea/volto-arcgis-block/commit/64ab56e0f1f8dddc26f26039509a028e34653e64)]
|
|
346
|
+
- revert [JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967 [Mikel Larreategi - [`85ee194`](https://github.com/eea/volto-arcgis-block/commit/85ee1941e029df2b7dc910bf75231c75ffeca8c2)]
|
|
338
347
|
- Update cypress.json [KCarpinteroBM - [`be285ff`](https://github.com/eea/volto-arcgis-block/commit/be285fff0c53e06a0180d5318cce81195eabcf80)]
|
|
339
348
|
- Update cypress.json [KCarpinteroBM - [`a7f2118`](https://github.com/eea/volto-arcgis-block/commit/a7f2118acb7b048b4cef85aa9663c2244a1c9ca0)]
|
|
340
349
|
- linting fix [KCarpinteroBM - [`27e969a`](https://github.com/eea/volto-arcgis-block/commit/27e969a7a411fd4646e0e742ce846efc0d79703e)]
|
|
@@ -394,6 +403,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
394
403
|
- UX improvements [rodriama - [`151dc4b`](https://github.com/eea/volto-arcgis-block/commit/151dc4b02d0a73fdd66de9d594620ac0fa5f1dbf)]
|
|
395
404
|
- deleted failing tests [KCarpinteroBM - [`ddaa9e6`](https://github.com/eea/volto-arcgis-block/commit/ddaa9e6f06db6960a4c214d3be2420c48b26715d)]
|
|
396
405
|
- cleaning unnecessary files [KCarpinteroBM - [`2c02199`](https://github.com/eea/volto-arcgis-block/commit/2c021990912beb02b603a1de89aecd62e0063769)]
|
|
406
|
+
- Reverting to Automated release 0.1.39 [KCarpinteroBM - [`fb9f317`](https://github.com/eea/volto-arcgis-block/commit/fb9f3176ccdea18fceb329eaac13ced0566ee648)]
|
|
397
407
|
- commands added [KCarpinteroBM - [`049e60b`](https://github.com/eea/volto-arcgis-block/commit/049e60b7d124d1c05abd0b2775b510795f4ed59f)]
|
|
398
408
|
- Mapviewer testing implementation [KCarpinteroBM - [`0103002`](https://github.com/eea/volto-arcgis-block/commit/0103002869eea108e16e3b5ff2e77a725dcc7c4b)]
|
|
399
409
|
### [0.1.39](https://github.com/eea/volto-arcgis-block/compare/0.1.38...0.1.39) - 24 March 2022
|
|
@@ -413,6 +423,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
413
423
|
- ESLint fix [rodriama - [`75dae9b`](https://github.com/eea/volto-arcgis-block/commit/75dae9b5bba18ab6d9624f6c99714b4bd2179003)]
|
|
414
424
|
- Remove section title [rodriama - [`ece860e`](https://github.com/eea/volto-arcgis-block/commit/ece860eae3519c7e611abac16e8d53c9a9408b34)]
|
|
415
425
|
- Es-Lint [manuelmartinezbilbomatica - [`39d8d11`](https://github.com/eea/volto-arcgis-block/commit/39d8d11b9096fd603df8510c119d2e12817415d6)]
|
|
426
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`bf9f683`](https://github.com/eea/volto-arcgis-block/commit/bf9f683dd35a9edb4cfd9111affcb8f8edbeae89)]
|
|
416
427
|
- FEAT: Parser Time implemented [manuelmartinezbilbomatica - [`689c99e`](https://github.com/eea/volto-arcgis-block/commit/689c99e55221fee6c7c7fafc4ab95ae7a646d3dd)]
|
|
417
428
|
### [0.1.38](https://github.com/eea/volto-arcgis-block/compare/0.1.37...0.1.38) - 18 March 2022
|
|
418
429
|
|
|
@@ -507,6 +518,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
507
518
|
- ESLint fix [rodriama - [`5fd3772`](https://github.com/eea/volto-arcgis-block/commit/5fd3772f197a3a380067962a5638dbf901a4624e)]
|
|
508
519
|
- Pixel info [rodriama - [`1ccef39`](https://github.com/eea/volto-arcgis-block/commit/1ccef39a9adcc3ee94655c77a5a166b613600a08)]
|
|
509
520
|
- NUTS bug fix [rodriama - [`37fe7f3`](https://github.com/eea/volto-arcgis-block/commit/37fe7f3fad2c005e3b7c234b3b0564d5df92fa8c)]
|
|
521
|
+
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`ea5af8b`](https://github.com/eea/volto-arcgis-block/commit/ea5af8b02a5f2ee25b9b0be67cf3792bbbe84ed7)]
|
|
510
522
|
### [0.1.23](https://github.com/eea/volto-arcgis-block/compare/0.1.22...0.1.23) - 17 December 2021
|
|
511
523
|
|
|
512
524
|
#### :hammer_and_wrench: Others
|
|
@@ -751,6 +763,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
751
763
|
- Trying to delay ArcGIS modules load [gonzalezsd - [`ff16985`](https://github.com/eea/volto-arcgis-block/commit/ff169858e42d30bfcacc423ffc27762bb9ef05a4)]
|
|
752
764
|
- Run bootstrap to fix files [valentinab25 - [`236893f`](https://github.com/eea/volto-arcgis-block/commit/236893f03314eb638b7667f81b1f91491a98ee17)]
|
|
753
765
|
- fix git_name [valentinab25 - [`c7806c3`](https://github.com/eea/volto-arcgis-block/commit/c7806c312964425dc23e5d4c6973de8b81ddaeac)]
|
|
766
|
+
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`e3afb51`](https://github.com/eea/volto-arcgis-block/commit/e3afb515dda459ee03e2b5d4b56465d2d4ad1503)]
|
|
754
767
|
- Trying to change imports [gonzalezsd - [`d83d7e2`](https://github.com/eea/volto-arcgis-block/commit/d83d7e2f68da4b2a284735847f93c0763a7e13b6)]
|
|
755
768
|
- default design [bipoza - [`88fbe0b`](https://github.com/eea/volto-arcgis-block/commit/88fbe0b2bc73e732e2993324a567f53902e85506)]
|
|
756
769
|
- cleanup of unused code [bipoza - [`b167677`](https://github.com/eea/volto-arcgis-block/commit/b1676771f637f056cad50cb0bc186f2ea79e8517)]
|
package/package.json
CHANGED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import React, { createRef } from 'react';
|
|
2
|
+
import { loadModules } from 'esri-loader';
|
|
3
|
+
|
|
4
|
+
var WMSLayer;
|
|
5
|
+
|
|
6
|
+
class HotspotWidget extends React.Component {
|
|
7
|
+
/**
|
|
8
|
+
* Creator of the Hotspot widget class
|
|
9
|
+
* @param {*} props
|
|
10
|
+
*/
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
//We create a reference to a DOM element to be mounted
|
|
14
|
+
this.container = createRef();
|
|
15
|
+
//Initially, we set the state of the component to
|
|
16
|
+
//not be showing the basemap panel
|
|
17
|
+
this.state = {
|
|
18
|
+
showMapMenu: false,
|
|
19
|
+
avtiveLayers: sessionStorage.checkedLayers,
|
|
20
|
+
};
|
|
21
|
+
this.menuClass =
|
|
22
|
+
'esri-icon-filter esri-widget--button esri-widget esri-interactive';
|
|
23
|
+
this.dataKlc_code = null;
|
|
24
|
+
this.esriLayer_lcc = null;
|
|
25
|
+
this.esriLayer_lc = null;
|
|
26
|
+
this.subscribedLayers = sessionStorage;
|
|
27
|
+
this.checkedLayers = this.props.layers
|
|
28
|
+
? this.props.layers.checkedLayers
|
|
29
|
+
: '';
|
|
30
|
+
this.dataJSONNames = [];
|
|
31
|
+
this.klcHighlightsArray = [];
|
|
32
|
+
this.renderPresentLandCover = this.renderPresentLandCover.bind(this);
|
|
33
|
+
this.renderLandCoverChange = this.renderLandCoverChange.bind(this);
|
|
34
|
+
this.getLayerParameters = this.getLayerParameters.bind(this);
|
|
35
|
+
this.getKLCNames = this.getKLCNames.bind(this);
|
|
36
|
+
this.layerModelInit = this.layerModelInit.bind(this);
|
|
37
|
+
this.handleApplyFilter = this.handleApplyFilter.bind(this);
|
|
38
|
+
this.getLayerParameters();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
loader() {
|
|
42
|
+
return loadModules(['esri/layers/WMSLayer']).then(([_WMSLayer]) => {
|
|
43
|
+
WMSLayer = _WMSLayer;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
layerModelInit() {
|
|
48
|
+
const serviceUrl =
|
|
49
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/wms';
|
|
50
|
+
|
|
51
|
+
this.esriLayer_lcc = new WMSLayer({
|
|
52
|
+
url: serviceUrl,
|
|
53
|
+
// featureInfoFormat: "text/html",
|
|
54
|
+
customLayerParameters: {},
|
|
55
|
+
sublayers: [
|
|
56
|
+
// LAND COVER CHANGE DATASET ________________________________________________________________________________________________________________
|
|
57
|
+
{
|
|
58
|
+
name: 'all_lcc_a_pol',
|
|
59
|
+
legendUrl:
|
|
60
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=all_lcc_a_pol',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
this.esriLayer_lc = new WMSLayer({
|
|
65
|
+
url: serviceUrl,
|
|
66
|
+
// featureInfoFormat: "text/html",
|
|
67
|
+
customLayerParameters: {},
|
|
68
|
+
sublayers: [
|
|
69
|
+
// PRESENT LAND COVER DATASET ________________________________________________________________________________________________________________
|
|
70
|
+
{
|
|
71
|
+
name: 'all_lcc_a_pol',
|
|
72
|
+
legendUrl:
|
|
73
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=all_lcc_a_pol',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
handleApplyFilter(typeFilter) {
|
|
80
|
+
if (this.props.selectedLayers) {
|
|
81
|
+
var currentLcckey = Object.keys(this.props.selectedLayers).find((e) =>
|
|
82
|
+
e.includes('all_lcc'),
|
|
83
|
+
);
|
|
84
|
+
var currentLckey = Object.keys(this.props.selectedLayers).find((e) =>
|
|
85
|
+
e.includes('all_present_lc'),
|
|
86
|
+
);
|
|
87
|
+
if (currentLcckey) {
|
|
88
|
+
//this.props.map.remove(this.props.selectedLayers[currentLcckey]);
|
|
89
|
+
this.props.selectedLayers[currentLcckey].visible = false;
|
|
90
|
+
}
|
|
91
|
+
if (currentLckey) {
|
|
92
|
+
//this.props.map.remove(this.props.selectedLayers[currentLckey]);
|
|
93
|
+
this.props.selectedLayers[currentLckey].visible = false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (typeFilter === 'lcc') {
|
|
97
|
+
var selectBoxHighlightsLcc = document
|
|
98
|
+
.getElementById('select-klc-lccTime')
|
|
99
|
+
.value.match(/\d+/g)
|
|
100
|
+
.map(Number)[0];
|
|
101
|
+
/* var typeLegend =
|
|
102
|
+
document.getElementById('select-klc-highlights-lcc').value ===
|
|
103
|
+
'Dichotomous'
|
|
104
|
+
? 'all_lcc_a_pol'
|
|
105
|
+
: 'all_lcc_b_pol'; */
|
|
106
|
+
if (this.esriLayer_lcc !== null) {
|
|
107
|
+
//this.esriLayer_lcc.sublayers.items[0].name = typeLegend;
|
|
108
|
+
this.esriLayer_lcc.customLayerParameters['CQL_FILTER'] =
|
|
109
|
+
'klc_code LIKE ' +
|
|
110
|
+
"'" +
|
|
111
|
+
this.dataKlc_code +
|
|
112
|
+
"'" +
|
|
113
|
+
" AND in_pa = 'not_defined' AND date = " +
|
|
114
|
+
selectBoxHighlightsLcc;
|
|
115
|
+
this.props.map.add(this.esriLayer_lcc);
|
|
116
|
+
this.props.selectedLayers['lcc_filter'] = this.esriLayer_lcc;
|
|
117
|
+
this.props.selectedLayers['lcc_filter'].visible = true;
|
|
118
|
+
} else {
|
|
119
|
+
/* var typeLegend =
|
|
120
|
+
document.getElementById('select-klc-highlights-lcc').value ===
|
|
121
|
+
'Dichotomous'
|
|
122
|
+
? 'all_present_lc_a_pol'
|
|
123
|
+
: 'all_present_lc_b_pol'; */
|
|
124
|
+
var selectBoxHighlightsLc = document
|
|
125
|
+
.getElementById('select-klc-lcTime')
|
|
126
|
+
.value.match(/\d+/g)
|
|
127
|
+
.map(Number)[0];
|
|
128
|
+
if (this.esriLayer_lc !== null) {
|
|
129
|
+
//this.esriLayer_lc.sublayers.items[0].name = typeLegend;
|
|
130
|
+
this.esriLayer_lc.customLayerParameters['CQL_FILTER'] =
|
|
131
|
+
'klc_code LIKE ' +
|
|
132
|
+
"'" +
|
|
133
|
+
this.dataKlc_code +
|
|
134
|
+
"'" +
|
|
135
|
+
" AND in_pa = 'not_defined' AND date = " +
|
|
136
|
+
selectBoxHighlightsLc;
|
|
137
|
+
this.props.map.add(this.esriLayer_lc);
|
|
138
|
+
this.props.selectedLayers['lc_filter'] = this.esriLayer_lc;
|
|
139
|
+
this.props.selectedLayers['lc_filter'].visible = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
dropdownAnimation() {
|
|
146
|
+
var button = this.container.current.querySelector(
|
|
147
|
+
'.ccl-expandable__button',
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
if (button.ariaExpanded === 'true') button.ariaExpanded = 'false';
|
|
151
|
+
else button.ariaExpanded = 'true';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Method that will be invoked when the
|
|
156
|
+
* button is clicked. It controls the open
|
|
157
|
+
* and close actions of the component
|
|
158
|
+
*/
|
|
159
|
+
openMenu() {
|
|
160
|
+
if (this.state.showMapMenu) {
|
|
161
|
+
this.props.mapViewer.setActiveWidget();
|
|
162
|
+
this.container.current.querySelector('.right-panel').style.display =
|
|
163
|
+
'none';
|
|
164
|
+
this.container.current
|
|
165
|
+
.querySelector('.esri-widget--button')
|
|
166
|
+
.classList.remove('active-widget');
|
|
167
|
+
document
|
|
168
|
+
.querySelector('.esri-ui-top-right.esri-ui-corner')
|
|
169
|
+
.classList.remove('show-panel');
|
|
170
|
+
// By invoking the setState, we notify the state we want to reach
|
|
171
|
+
// and ensure that the component is rendered again
|
|
172
|
+
this.setState({ showMapMenu: false });
|
|
173
|
+
} else {
|
|
174
|
+
this.getKLCNames(this.dataJSONNames, this.dataJSONNames[0].node.klc_name);
|
|
175
|
+
this.props.mapViewer.setActiveWidget(this);
|
|
176
|
+
this.container.current.querySelector('.right-panel').style.display =
|
|
177
|
+
'flex';
|
|
178
|
+
this.container.current
|
|
179
|
+
.querySelector('.esri-widget--button')
|
|
180
|
+
.classList.add('active-widget');
|
|
181
|
+
document
|
|
182
|
+
.querySelector('.esri-ui-top-right.esri-ui-corner')
|
|
183
|
+
.classList.add('show-panel');
|
|
184
|
+
// By invoking the setState, we notify the state we want to reach
|
|
185
|
+
// and ensure that the component is rendered again
|
|
186
|
+
this.setState({ showMapMenu: true });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async getLayerParameters() {
|
|
191
|
+
fetch('https://land.copernicus.eu/global/hsm/all_geo_klc_json')
|
|
192
|
+
.then((data) => {
|
|
193
|
+
if (data.status === 200) {
|
|
194
|
+
return data.json();
|
|
195
|
+
} else {
|
|
196
|
+
throw new Error(data.status);
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
.then((data) => {
|
|
200
|
+
this.dataJSONNames = data.nodes;
|
|
201
|
+
this.getKLCNames(data.nodes, data.nodes[0].node.klc_name);
|
|
202
|
+
})
|
|
203
|
+
.catch(function (error) {
|
|
204
|
+
/* console.log('error while getting data'); */
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
renderPresentLandCover() {
|
|
209
|
+
return (
|
|
210
|
+
<div className="measurement-dropdown" id="PresentLandCoverDropdown">
|
|
211
|
+
<div
|
|
212
|
+
className="ccl-expandable__button"
|
|
213
|
+
aria-expanded="true"
|
|
214
|
+
tabIndex="0"
|
|
215
|
+
role="button"
|
|
216
|
+
onClick={this.dropdownAnimation.bind(this)}
|
|
217
|
+
onKeyDown={this.dropdownAnimation.bind(this)}
|
|
218
|
+
>
|
|
219
|
+
<span>Present Land Cover</span>
|
|
220
|
+
<span className="dropdown-icon ccl-icon-chevron-thin-down"></span>
|
|
221
|
+
</div>
|
|
222
|
+
<div className="measurement-dropdown-container">
|
|
223
|
+
<br></br>
|
|
224
|
+
<div className="esri-print__form-section-container">
|
|
225
|
+
<label>
|
|
226
|
+
Legend type
|
|
227
|
+
<select
|
|
228
|
+
id="select-klc-highlights-lc"
|
|
229
|
+
className="esri-select"
|
|
230
|
+
></select>
|
|
231
|
+
</label>
|
|
232
|
+
</div>
|
|
233
|
+
<div className="esri-print__form-section-container">
|
|
234
|
+
<label>
|
|
235
|
+
Year
|
|
236
|
+
<select
|
|
237
|
+
id="select-klc-lcTime"
|
|
238
|
+
className="esri-select"
|
|
239
|
+
data-target-property="layout"
|
|
240
|
+
></select>
|
|
241
|
+
</label>
|
|
242
|
+
</div>
|
|
243
|
+
<button
|
|
244
|
+
className="esri-button"
|
|
245
|
+
onClick={() => this.handleApplyFilter('lc')}
|
|
246
|
+
>
|
|
247
|
+
Apply filter
|
|
248
|
+
</button>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
getKLCNames(data, selectedOption) {
|
|
255
|
+
var selectBox;
|
|
256
|
+
var selectBoxHighlightsLc;
|
|
257
|
+
var selectBoxLcTime;
|
|
258
|
+
var selectBoxHighlightsLcc;
|
|
259
|
+
var selectBoxLccTime;
|
|
260
|
+
|
|
261
|
+
selectBox = document.getElementById('select-klc-area');
|
|
262
|
+
selectBoxHighlightsLcc = document.getElementById(
|
|
263
|
+
'select-klc-highlights-lcc',
|
|
264
|
+
);
|
|
265
|
+
selectBoxLccTime = document.getElementById('select-klc-lccTime');
|
|
266
|
+
selectBoxHighlightsLc = document.getElementById('select-klc-highlights-lc');
|
|
267
|
+
selectBoxLcTime = document.getElementById('select-klc-lcTime');
|
|
268
|
+
|
|
269
|
+
for (let i = 0; i < data.length; i++) {
|
|
270
|
+
var option = data[i].node.klc_name;
|
|
271
|
+
if (option === selectedOption) {
|
|
272
|
+
this.dataKlc_code = data[i].node.klc_code;
|
|
273
|
+
//reset all selected options
|
|
274
|
+
if (selectBoxLcTime && selectBoxHighlightsLc) {
|
|
275
|
+
this.removeOptions(selectBoxLcTime);
|
|
276
|
+
this.removeOptions(selectBoxHighlightsLc);
|
|
277
|
+
}
|
|
278
|
+
if (selectBoxLccTime && selectBoxHighlightsLcc) {
|
|
279
|
+
this.removeOptions(selectBoxLccTime);
|
|
280
|
+
this.removeOptions(selectBoxHighlightsLcc);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (
|
|
284
|
+
data[i].node.keymap_info
|
|
285
|
+
.toLowerCase()
|
|
286
|
+
.includes('multiple_dates":true')
|
|
287
|
+
) {
|
|
288
|
+
//new select year options values
|
|
289
|
+
var optionLcTime = data[i].node.present_lc_year;
|
|
290
|
+
var indexStart = data[i].node.keymap_info
|
|
291
|
+
.toLowerCase()
|
|
292
|
+
.indexOf('"dates":[ {');
|
|
293
|
+
var indexEnd = data[i].node.keymap_info.toLowerCase().indexOf(' }],');
|
|
294
|
+
var strOut = data[i].node.keymap_info.substring(indexStart, indexEnd);
|
|
295
|
+
var numbers = strOut.match(/\d+/g).map(Number);
|
|
296
|
+
numbers.forEach((element) => {
|
|
297
|
+
selectBoxLccTime.options.add(new Option(element, element, element));
|
|
298
|
+
});
|
|
299
|
+
selectBoxLcTime.options.add(
|
|
300
|
+
new Option(optionLcTime, optionLcTime, optionLcTime),
|
|
301
|
+
);
|
|
302
|
+
} else {
|
|
303
|
+
//new select year options values
|
|
304
|
+
var optionLccTime = data[i].node.lcc_year;
|
|
305
|
+
selectBoxLccTime.options.add(
|
|
306
|
+
new Option(optionLccTime, optionLccTime, optionLccTime),
|
|
307
|
+
);
|
|
308
|
+
optionLcTime = data[i].node.present_lc_year;
|
|
309
|
+
selectBoxLcTime.options.add(
|
|
310
|
+
new Option(optionLcTime, optionLcTime, optionLcTime),
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
if (
|
|
314
|
+
data[i].node.keymap_info.toLowerCase().includes('a_classes":true')
|
|
315
|
+
) {
|
|
316
|
+
selectBoxHighlightsLc.options.add(
|
|
317
|
+
new Option('Dichotomous', 'Dichotomous', 'Dichotomous'),
|
|
318
|
+
);
|
|
319
|
+
selectBoxHighlightsLcc.options.add(
|
|
320
|
+
new Option('Dichotomous', 'Dichotomous', 'Dichotomous'),
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
if (
|
|
324
|
+
data[i].node.keymap_info.toLowerCase().includes('b_classes":true')
|
|
325
|
+
) {
|
|
326
|
+
selectBoxHighlightsLc.options.add(
|
|
327
|
+
new Option('Modular', 'Modular', 'Modular'),
|
|
328
|
+
);
|
|
329
|
+
selectBoxHighlightsLcc.options.add(
|
|
330
|
+
new Option('Modular', 'Modular', 'Modular'),
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (selectBox.options.length <= data.length)
|
|
335
|
+
selectBox.options.add(new Option(option, option, option));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
removeOptions(selectElement) {
|
|
340
|
+
if (selectElement.options.length > 0) {
|
|
341
|
+
var i,
|
|
342
|
+
L = selectElement.options.length - 1;
|
|
343
|
+
for (i = L; i >= 0; i--) {
|
|
344
|
+
selectElement.remove(i);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
renderLandCoverChange() {
|
|
350
|
+
return (
|
|
351
|
+
<div className="measurement-dropdown" id="LandCoverChangeDropdown">
|
|
352
|
+
<div
|
|
353
|
+
className="ccl-expandable__button"
|
|
354
|
+
aria-expanded="true"
|
|
355
|
+
tabIndex="0"
|
|
356
|
+
role="button"
|
|
357
|
+
onClick={this.dropdownAnimation.bind(this)}
|
|
358
|
+
onKeyDown={this.dropdownAnimation.bind(this)}
|
|
359
|
+
>
|
|
360
|
+
<span>Land Cover Change</span>
|
|
361
|
+
<span className="dropdown-icon ccl-icon-chevron-thin-down"></span>
|
|
362
|
+
</div>
|
|
363
|
+
<div className="measurement-dropdown-container">
|
|
364
|
+
<br></br>
|
|
365
|
+
<div className="esri-print__form-section-container">
|
|
366
|
+
<label>
|
|
367
|
+
Legend type
|
|
368
|
+
<select
|
|
369
|
+
id="select-klc-highlights-lcc"
|
|
370
|
+
className="esri-select"
|
|
371
|
+
></select>
|
|
372
|
+
</label>
|
|
373
|
+
</div>
|
|
374
|
+
<div className="esri-print__form-section-container">
|
|
375
|
+
<label>
|
|
376
|
+
Year
|
|
377
|
+
<select
|
|
378
|
+
id="select-klc-lccTime"
|
|
379
|
+
className="esri-select"
|
|
380
|
+
data-target-property="layout"
|
|
381
|
+
></select>
|
|
382
|
+
</label>
|
|
383
|
+
</div>
|
|
384
|
+
<button
|
|
385
|
+
className="esri-button"
|
|
386
|
+
onClick={() => this.handleApplyFilter('lcc')}
|
|
387
|
+
>
|
|
388
|
+
Apply filter
|
|
389
|
+
</button>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
render() {
|
|
396
|
+
return (
|
|
397
|
+
<>
|
|
398
|
+
<div ref={this.container} className="hotspot-container">
|
|
399
|
+
<div tooltip="Hotspot" direction="left" type="widget">
|
|
400
|
+
<div
|
|
401
|
+
className={this.menuClass}
|
|
402
|
+
id="hotspot_button"
|
|
403
|
+
aria-label="Hotspot"
|
|
404
|
+
onClick={this.openMenu.bind(this)}
|
|
405
|
+
onKeyDown={this.openMenu.bind(this)}
|
|
406
|
+
tabIndex="0"
|
|
407
|
+
role="button"
|
|
408
|
+
></div>
|
|
409
|
+
</div>
|
|
410
|
+
<div className="right-panel">
|
|
411
|
+
<div className="right-panel-header">
|
|
412
|
+
<span>Hot-spots outside Europe filtering options</span>
|
|
413
|
+
<span
|
|
414
|
+
className="map-menu-icon esri-icon-close"
|
|
415
|
+
onClick={this.openMenu.bind(this)}
|
|
416
|
+
onKeyDown={this.openMenu.bind(this)}
|
|
417
|
+
tabIndex="0"
|
|
418
|
+
role="button"
|
|
419
|
+
></span>
|
|
420
|
+
</div>
|
|
421
|
+
<div className="right-panel-content">
|
|
422
|
+
<div className="hotspot-panel">
|
|
423
|
+
<div className="measurement-dropdown-container">
|
|
424
|
+
<div className="esri-print__form-section-container">
|
|
425
|
+
<label>
|
|
426
|
+
Key Landscape for Conservation (KLC) area
|
|
427
|
+
<select
|
|
428
|
+
onBlur={(e) =>
|
|
429
|
+
this.getKLCNames(this.dataJSONNames, e.target.value)
|
|
430
|
+
}
|
|
431
|
+
id="select-klc-area"
|
|
432
|
+
className="esri-select"
|
|
433
|
+
></select>
|
|
434
|
+
</label>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
<div className="presentLandCoverContainer">
|
|
438
|
+
{this.renderPresentLandCover()}
|
|
439
|
+
</div>
|
|
440
|
+
<div className="landCoverChangeContainer">
|
|
441
|
+
{this.renderLandCoverChange()}
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
</>
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* This method is executed after the rener method is executed
|
|
453
|
+
*/
|
|
454
|
+
async componentDidMount() {
|
|
455
|
+
await this.loader();
|
|
456
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
457
|
+
this.layerModelInit();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
export default HotspotWidget;
|
|
@@ -16,7 +16,7 @@ import ScaleWidget from './ScaleWidget';
|
|
|
16
16
|
import LegendWidget from './LegendWidget';
|
|
17
17
|
import InfoWidget from './InfoWidget';
|
|
18
18
|
import MenuWidget from './MenuWidget';
|
|
19
|
-
|
|
19
|
+
import HotspotWidget from './HotspotWidget';
|
|
20
20
|
//import "isomorphic-fetch"; <-- Necessary to use fetch?
|
|
21
21
|
var Map, MapView, Zoom, intl;
|
|
22
22
|
let mapStatus = {};
|
|
@@ -48,6 +48,15 @@ class MapViewer extends React.Component {
|
|
|
48
48
|
[`${props.customClass}`]: props.customClass || null,
|
|
49
49
|
});
|
|
50
50
|
this.state = {};
|
|
51
|
+
this.layers = {};
|
|
52
|
+
this.activeLayersHandler = this.activeLayersHandler.bind(this);
|
|
53
|
+
this.activeLayersArray = {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
activeLayersHandler(newActiveLayers) {
|
|
57
|
+
this.activeLayers = newActiveLayers;
|
|
58
|
+
mapStatus.activeLayers = newActiveLayers;
|
|
59
|
+
sessionStorage.setItem('mapStatus', JSON.stringify(mapStatus));
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
setCenterState(centerStatus) {
|
|
@@ -104,8 +113,10 @@ class MapViewer extends React.Component {
|
|
|
104
113
|
mapStatus = {};
|
|
105
114
|
mapStatus.zoom = this.mapCfg.zoom;
|
|
106
115
|
mapStatus.center = this.mapCfg.center;
|
|
116
|
+
mapStatus.activeLayers = this.mapCfg.activeLayers;
|
|
107
117
|
this.setCenterState(this.mapCfg.center);
|
|
108
118
|
this.setZoomState(this.mapCfg.zoom);
|
|
119
|
+
this.activeLayersHandler(this.mapCfg.activeLayers);
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
this.view = new MapView({
|
|
@@ -221,6 +232,19 @@ class MapViewer extends React.Component {
|
|
|
221
232
|
return <InfoWidget view={this.view} map={this.map} mapViewer={this} />;
|
|
222
233
|
}
|
|
223
234
|
|
|
235
|
+
renderHotspot() {
|
|
236
|
+
if (this.view)
|
|
237
|
+
return (
|
|
238
|
+
<HotspotWidget
|
|
239
|
+
view={this.view}
|
|
240
|
+
map={this.map}
|
|
241
|
+
selectedLayers={this.layers}
|
|
242
|
+
mapViewer={this}
|
|
243
|
+
layers={sessionStorage}
|
|
244
|
+
/>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
224
248
|
renderMenu() {
|
|
225
249
|
if (this.view)
|
|
226
250
|
return (
|
|
@@ -232,6 +256,8 @@ class MapViewer extends React.Component {
|
|
|
232
256
|
mapViewer={this}
|
|
233
257
|
updateArea={this.updateArea}
|
|
234
258
|
area={this.state.area}
|
|
259
|
+
layers={this.layers}
|
|
260
|
+
activeLayersHandler={this.activeLayersHandler}
|
|
235
261
|
/>
|
|
236
262
|
); //call conf
|
|
237
263
|
}
|
|
@@ -259,6 +285,7 @@ class MapViewer extends React.Component {
|
|
|
259
285
|
{this.renderArea()}
|
|
260
286
|
{this.renderScale()}
|
|
261
287
|
{this.renderInfo()}
|
|
288
|
+
{this.renderHotspot()}
|
|
262
289
|
{this.renderMenu()}
|
|
263
290
|
</div>
|
|
264
291
|
</div>
|
|
@@ -285,7 +312,7 @@ export const CheckLogin = ({ reference }) => {
|
|
|
285
312
|
|
|
286
313
|
export default compose(
|
|
287
314
|
connect(
|
|
288
|
-
(state
|
|
315
|
+
(state) => ({
|
|
289
316
|
mapviewer_config: state.mapviewer_config.mapviewer_config,
|
|
290
317
|
}),
|
|
291
318
|
{ MapViewerConfig },
|
|
@@ -449,7 +449,7 @@ class MenuWidget extends React.Component {
|
|
|
449
449
|
this.menuClass =
|
|
450
450
|
'esri-icon-drag-horizontal esri-widget--button esri-widget esri-interactive';
|
|
451
451
|
this.loadFirst = true;
|
|
452
|
-
this.layers =
|
|
452
|
+
this.layers = this.props.layers;
|
|
453
453
|
this.activeLayersJSON = {};
|
|
454
454
|
this.layerGroups = {};
|
|
455
455
|
|
|
@@ -463,6 +463,8 @@ class MenuWidget extends React.Component {
|
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
|
+
|
|
467
|
+
this.activeLayersHandler = this.props.activeLayersHandler;
|
|
466
468
|
}
|
|
467
469
|
|
|
468
470
|
loader() {
|
|
@@ -577,24 +579,25 @@ class MenuWidget extends React.Component {
|
|
|
577
579
|
|
|
578
580
|
// CLMS-1389
|
|
579
581
|
// "Active on map" section and the time slider opened by default if download and timeseries == true
|
|
580
|
-
if (this.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
582
|
+
if (this.layers)
|
|
583
|
+
if (this.props.download && this.layers) {
|
|
584
|
+
let layerid = Object.keys(this.layers)[0];
|
|
585
|
+
|
|
586
|
+
if (layerid && this.layers[layerid].isTimeSeries) {
|
|
587
|
+
// select active on map tab
|
|
588
|
+
let event = new MouseEvent('click', {
|
|
589
|
+
view: window,
|
|
590
|
+
bubbles: true,
|
|
591
|
+
cancelable: false,
|
|
592
|
+
});
|
|
593
|
+
let el = document.getElementById('active_label');
|
|
594
|
+
el.dispatchEvent(event);
|
|
595
|
+
|
|
596
|
+
//open time slider
|
|
597
|
+
let layerElem = document.getElementById(layerid);
|
|
598
|
+
this.showTimeSlider(layerElem);
|
|
599
|
+
}
|
|
596
600
|
}
|
|
597
|
-
}
|
|
598
601
|
}
|
|
599
602
|
|
|
600
603
|
/**
|
|
@@ -1525,6 +1528,7 @@ class MenuWidget extends React.Component {
|
|
|
1525
1528
|
}
|
|
1526
1529
|
// update DOM
|
|
1527
1530
|
this.setState({});
|
|
1531
|
+
//this.activeLayersHandler(this.activeLayersAsArray);
|
|
1528
1532
|
}
|
|
1529
1533
|
|
|
1530
1534
|
/**
|
|
@@ -1638,6 +1642,8 @@ class MenuWidget extends React.Component {
|
|
|
1638
1642
|
activeLayers.indexOf(a.props['layer-id']) -
|
|
1639
1643
|
activeLayers.indexOf(b.props['layer-id']),
|
|
1640
1644
|
);
|
|
1645
|
+
//this.props.mapDispatchToProps(activeLayersArray);
|
|
1646
|
+
this.activeLayersHandler(activeLayersArray);
|
|
1641
1647
|
return data;
|
|
1642
1648
|
}
|
|
1643
1649
|
|
|
@@ -2451,6 +2457,41 @@ class MenuWidget extends React.Component {
|
|
|
2451
2457
|
}
|
|
2452
2458
|
}
|
|
2453
2459
|
|
|
2460
|
+
renderHotspot() {
|
|
2461
|
+
var hotspotLayers = [];
|
|
2462
|
+
Object.keys(this.activeLayersJSON).forEach((key) => {
|
|
2463
|
+
let layer = this.layers[key];
|
|
2464
|
+
if (
|
|
2465
|
+
/* layer.visible && */
|
|
2466
|
+
key.includes('all_present_lc_a_pol') ||
|
|
2467
|
+
key.includes('all_lcc_a_pol')
|
|
2468
|
+
) {
|
|
2469
|
+
hotspotLayers.push(layer);
|
|
2470
|
+
}
|
|
2471
|
+
});
|
|
2472
|
+
if (
|
|
2473
|
+
hotspotLayers.length === 0 &&
|
|
2474
|
+
document.querySelector('.hotspot-container')
|
|
2475
|
+
) {
|
|
2476
|
+
this.props.mapViewer.closeActiveWidget();
|
|
2477
|
+
document.querySelector('.hotspot-container').style.display = 'none';
|
|
2478
|
+
} else if (this.props.view && hotspotLayers.length > 0) {
|
|
2479
|
+
document.querySelector('.hotspot-container').style.display = 'flex';
|
|
2480
|
+
if (sessionStorage.checkedLayers.includes('all_present_lc_a_pol'))
|
|
2481
|
+
document.querySelector('.presentLandCoverContainer').style.display =
|
|
2482
|
+
'block';
|
|
2483
|
+
else
|
|
2484
|
+
document.querySelector('.presentLandCoverContainer').style.display =
|
|
2485
|
+
'none';
|
|
2486
|
+
if (sessionStorage.checkedLayers.includes('all_lcc_a_pol'))
|
|
2487
|
+
document.querySelector('.landCoverChangeContainer').style.display =
|
|
2488
|
+
'block';
|
|
2489
|
+
else
|
|
2490
|
+
document.querySelector('.landCoverChangeContainer').style.display =
|
|
2491
|
+
'none';
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2454
2495
|
renderTimeslider(elem, layer) {
|
|
2455
2496
|
if (this.props.view && layer) {
|
|
2456
2497
|
let activeLayer = document.querySelector('#active_' + elem.id);
|
|
@@ -2693,6 +2734,7 @@ class MenuWidget extends React.Component {
|
|
|
2693
2734
|
tabIndex="0"
|
|
2694
2735
|
></div>
|
|
2695
2736
|
{<TouchScreenPopup />}
|
|
2737
|
+
{this.renderHotspot()}
|
|
2696
2738
|
</div>
|
|
2697
2739
|
</>
|
|
2698
2740
|
);
|
|
@@ -1155,3 +1155,35 @@ input[type='range']::-ms-track {
|
|
|
1155
1155
|
font-family: 'Lato', sans-serif;
|
|
1156
1156
|
font-size: 0.875rem;
|
|
1157
1157
|
}
|
|
1158
|
+
|
|
1159
|
+
/* Hotspot*/
|
|
1160
|
+
.hotspot-container {
|
|
1161
|
+
display: flex;
|
|
1162
|
+
flex-direction: column;
|
|
1163
|
+
box-shadow: none !important;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
.hotspot-panel/*.esri-legend.esri-widget*/ {
|
|
1167
|
+
overflow: visible;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
.hotspot-container .esri-button {
|
|
1171
|
+
border: none;
|
|
1172
|
+
background-color: #a0b128;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
.hotspot-container .esri-button:hover {
|
|
1176
|
+
border-color: #a0b128;
|
|
1177
|
+
background-color: white;
|
|
1178
|
+
color: #a0b128;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/*.hotspot-container .esri-select{
|
|
1182
|
+
font-family:Helvetica, sans-serif;
|
|
1183
|
+
font-size:20px;
|
|
1184
|
+
display:flex;
|
|
1185
|
+
flex-direction:column;
|
|
1186
|
+
justify-content:center;
|
|
1187
|
+
align-items:center;
|
|
1188
|
+
}
|
|
1189
|
+
*/
|