@eeacms/volto-arcgis-block 0.1.220 → 0.1.222
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 +25 -7
- package/package.json +1 -1
- package/src/components/MapViewer/HotspotWidget.jsx +192 -169
- package/src/components/MapViewer/LegendWidget.jsx +75 -54
- package/src/components/MapViewer/LoadingSpinner.jsx +49 -11
- package/src/components/MapViewer/MapViewer.jsx +11 -3
- package/src/components/MapViewer/MenuWidget.jsx +142 -74
- package/src/components/MapViewer/css/ArcgisMap.css +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ 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.222](https://github.com/eea/volto-arcgis-block/compare/0.1.221...0.1.222) - 25 October 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- ready for push [ujbolivar - [`1d00c02`](https://github.com/eea/volto-arcgis-block/commit/1d00c02ac73a24f2179eafbb947cc10ffb19aabb)]
|
|
12
|
+
- ran linting scripts [ujbolivar - [`839258f`](https://github.com/eea/volto-arcgis-block/commit/839258fc2674edd345fb308ad86c33f9e6b8b8c8)]
|
|
13
|
+
- miguel fix added [ujbolivar - [`2f91b36`](https://github.com/eea/volto-arcgis-block/commit/2f91b3642a3d7ec3b9df8163870453d323536f0e)]
|
|
14
|
+
- final lint check before push for hotspot and vector layer update corrections [ujbolivar - [`b1c025c`](https://github.com/eea/volto-arcgis-block/commit/b1c025cd85b231a322d6ab9bde024d622498ec23)]
|
|
15
|
+
- hotspot tabs swaps order based on active layers tab order [ujbolivar - [`b928c3c`](https://github.com/eea/volto-arcgis-block/commit/b928c3ccc8304163ad756e32ecbfb9072a398575)]
|
|
16
|
+
- activelayers are arranged following menu order. Position of dragged layers is preserved [ujbolivar - [`68f1ff4`](https://github.com/eea/volto-arcgis-block/commit/68f1ff43774b6690a7f1f94f12d197f5b518c760)]
|
|
17
|
+
- mods done to hotspot and legends again to cover new edgecases [ujbolivar - [`a1367a3`](https://github.com/eea/volto-arcgis-block/commit/a1367a33fd2184f604182a1c7dffd21e9cb3eed7)]
|
|
18
|
+
- hotspot and legend functions working properly [ujbolivar - [`0f87558`](https://github.com/eea/volto-arcgis-block/commit/0f875580d11ee93ae9919fb7d893dacf360ea7c3)]
|
|
19
|
+
- layers are added and destroyed properly even when pa and klc is unchecked in menuwidget and checked again, it still loads the filtered layer correctly. Legends are acting up after this action as they do not load properly. Next commit will have this feature corrected. [ujbolivar - [`eb6e950`](https://github.com/eea/volto-arcgis-block/commit/eb6e950dc312c1ea3343a29a5d716d183f15b0bd)]
|
|
20
|
+
- hotspot layers are added and removed correctly, still needs a bit of fine tuning, but definitely on track now [ujbolivar - [`240ab62`](https://github.com/eea/volto-arcgis-block/commit/240ab62ca36e561367c66f527d36529024a5a066)]
|
|
21
|
+
### [0.1.221](https://github.com/eea/volto-arcgis-block/compare/0.1.220...0.1.221) - 25 October 2023
|
|
22
|
+
|
|
23
|
+
#### :hammer_and_wrench: Others
|
|
24
|
+
|
|
25
|
+
- final lint check before push [ujbolivar - [`f6835d2`](https://github.com/eea/volto-arcgis-block/commit/f6835d2ed53d0e600918a05b6a6da1f064395968)]
|
|
26
|
+
- hotspot tabs swaps order based on active layers tab order [ujbolivar - [`4989ddb`](https://github.com/eea/volto-arcgis-block/commit/4989ddb4ebbb6b6097d6d5ebb8aeb66cb132f924)]
|
|
27
|
+
- activelayers are arranged following menu order. Position of dragged layers is preserved [ujbolivar - [`d4cd100`](https://github.com/eea/volto-arcgis-block/commit/d4cd10054bc33a7772a0acbaa059e6e215743c67)]
|
|
28
|
+
- mods done to hotspot and legends again to cover new edgecases [ujbolivar - [`957971f`](https://github.com/eea/volto-arcgis-block/commit/957971fc619283d2ebb7317cf519bacbfebec44e)]
|
|
29
|
+
- hotspot and legend functions working properly [ujbolivar - [`21cafd8`](https://github.com/eea/volto-arcgis-block/commit/21cafd83333bbb4495f276e6cbc7c537b7d26470)]
|
|
30
|
+
- Completed: CLMS-2678, CLMS-2663, CLMS-1985, CLMS-2400, CLMS-2678 [ujbolivar - [`fd78b38`](https://github.com/eea/volto-arcgis-block/commit/fd78b381de7772cff70eef7fb480a4af5f03e539)]
|
|
31
|
+
- hotspot layers are added and removed correctly, still needs a bit of fine tuning, but definitely on track now [ujbolivar - [`1835b08`](https://github.com/eea/volto-arcgis-block/commit/1835b08daa1f4d9ce26d103d783b944e074059da)]
|
|
7
32
|
### [0.1.220](https://github.com/eea/volto-arcgis-block/compare/0.1.219...0.1.220) - 24 October 2023
|
|
8
33
|
|
|
9
34
|
### [0.1.219](https://github.com/eea/volto-arcgis-block/compare/0.1.218...0.1.219) - 24 October 2023
|
|
@@ -1020,13 +1045,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1020
1045
|
#### :hammer_and_wrench: Others
|
|
1021
1046
|
|
|
1022
1047
|
- Merge pull request #148 from eea/develop [KCarpinteroBM - [`24266fb`](https://github.com/eea/volto-arcgis-block/commit/24266fb3a0c1662d22ae0529dc1d5a25c711cf97)]
|
|
1023
|
-
- Revert "[JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`f751f69`](https://github.com/eea/volto-arcgis-block/commit/f751f69f652f0340ae55af6a4dab89d6bdc80906)]
|
|
1024
1048
|
- Revert "Revert "Mapviewer menu and map viewer options persistence"" [Mikel Larreategi - [`ad6e440`](https://github.com/eea/volto-arcgis-block/commit/ad6e440cdc160cffb1e86e1b26e501dbe648476c)]
|
|
1025
1049
|
- Revert "code coverage removal" [Mikel Larreategi - [`376f2d1`](https://github.com/eea/volto-arcgis-block/commit/376f2d1cd6e4e5110b3b63d5114af1bcfebe094b)]
|
|
1026
1050
|
- Revert "Update cypress.json" [Mikel Larreategi - [`43d01a0`](https://github.com/eea/volto-arcgis-block/commit/43d01a0a95a58ef5215c6cbf18223ca30a11b9cc)]
|
|
1027
1051
|
- Revert "Update cypress.json" [Mikel Larreategi - [`054c4ae`](https://github.com/eea/volto-arcgis-block/commit/054c4ae1767e1f26e6ec7e96a0e26a9711f29f04)]
|
|
1028
|
-
- 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)]
|
|
1029
|
-
- revert [JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967 [Mikel Larreategi - [`85ee194`](https://github.com/eea/volto-arcgis-block/commit/85ee1941e029df2b7dc910bf75231c75ffeca8c2)]
|
|
1030
1052
|
- Update cypress.json [KCarpinteroBM - [`be285ff`](https://github.com/eea/volto-arcgis-block/commit/be285fff0c53e06a0180d5318cce81195eabcf80)]
|
|
1031
1053
|
- Update cypress.json [KCarpinteroBM - [`a7f2118`](https://github.com/eea/volto-arcgis-block/commit/a7f2118acb7b048b4cef85aa9663c2244a1c9ca0)]
|
|
1032
1054
|
- linting fix [KCarpinteroBM - [`27e969a`](https://github.com/eea/volto-arcgis-block/commit/27e969a7a411fd4646e0e742ce846efc0d79703e)]
|
|
@@ -1086,7 +1108,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1086
1108
|
- UX improvements [rodriama - [`151dc4b`](https://github.com/eea/volto-arcgis-block/commit/151dc4b02d0a73fdd66de9d594620ac0fa5f1dbf)]
|
|
1087
1109
|
- deleted failing tests [KCarpinteroBM - [`ddaa9e6`](https://github.com/eea/volto-arcgis-block/commit/ddaa9e6f06db6960a4c214d3be2420c48b26715d)]
|
|
1088
1110
|
- cleaning unnecessary files [KCarpinteroBM - [`2c02199`](https://github.com/eea/volto-arcgis-block/commit/2c021990912beb02b603a1de89aecd62e0063769)]
|
|
1089
|
-
- Reverting to Automated release 0.1.39 [KCarpinteroBM - [`fb9f317`](https://github.com/eea/volto-arcgis-block/commit/fb9f3176ccdea18fceb329eaac13ced0566ee648)]
|
|
1090
1111
|
- commands added [KCarpinteroBM - [`049e60b`](https://github.com/eea/volto-arcgis-block/commit/049e60b7d124d1c05abd0b2775b510795f4ed59f)]
|
|
1091
1112
|
- Mapviewer testing implementation [KCarpinteroBM - [`0103002`](https://github.com/eea/volto-arcgis-block/commit/0103002869eea108e16e3b5ff2e77a725dcc7c4b)]
|
|
1092
1113
|
### [0.1.39](https://github.com/eea/volto-arcgis-block/compare/0.1.38...0.1.39) - 24 March 2022
|
|
@@ -1106,7 +1127,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1106
1127
|
- ESLint fix [rodriama - [`75dae9b`](https://github.com/eea/volto-arcgis-block/commit/75dae9b5bba18ab6d9624f6c99714b4bd2179003)]
|
|
1107
1128
|
- Remove section title [rodriama - [`ece860e`](https://github.com/eea/volto-arcgis-block/commit/ece860eae3519c7e611abac16e8d53c9a9408b34)]
|
|
1108
1129
|
- Es-Lint [manuelmartinezbilbomatica - [`39d8d11`](https://github.com/eea/volto-arcgis-block/commit/39d8d11b9096fd603df8510c119d2e12817415d6)]
|
|
1109
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`bf9f683`](https://github.com/eea/volto-arcgis-block/commit/bf9f683dd35a9edb4cfd9111affcb8f8edbeae89)]
|
|
1110
1130
|
- FEAT: Parser Time implemented [manuelmartinezbilbomatica - [`689c99e`](https://github.com/eea/volto-arcgis-block/commit/689c99e55221fee6c7c7fafc4ab95ae7a646d3dd)]
|
|
1111
1131
|
### [0.1.38](https://github.com/eea/volto-arcgis-block/compare/0.1.37...0.1.38) - 18 March 2022
|
|
1112
1132
|
|
|
@@ -1201,7 +1221,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1201
1221
|
- ESLint fix [rodriama - [`5fd3772`](https://github.com/eea/volto-arcgis-block/commit/5fd3772f197a3a380067962a5638dbf901a4624e)]
|
|
1202
1222
|
- Pixel info [rodriama - [`1ccef39`](https://github.com/eea/volto-arcgis-block/commit/1ccef39a9adcc3ee94655c77a5a166b613600a08)]
|
|
1203
1223
|
- NUTS bug fix [rodriama - [`37fe7f3`](https://github.com/eea/volto-arcgis-block/commit/37fe7f3fad2c005e3b7c234b3b0564d5df92fa8c)]
|
|
1204
|
-
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`ea5af8b`](https://github.com/eea/volto-arcgis-block/commit/ea5af8b02a5f2ee25b9b0be67cf3792bbbe84ed7)]
|
|
1205
1224
|
### [0.1.23](https://github.com/eea/volto-arcgis-block/compare/0.1.22...0.1.23) - 17 December 2021
|
|
1206
1225
|
|
|
1207
1226
|
#### :hammer_and_wrench: Others
|
|
@@ -1446,7 +1465,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1446
1465
|
- Trying to delay ArcGIS modules load [gonzalezsd - [`ff16985`](https://github.com/eea/volto-arcgis-block/commit/ff169858e42d30bfcacc423ffc27762bb9ef05a4)]
|
|
1447
1466
|
- Run bootstrap to fix files [valentinab25 - [`236893f`](https://github.com/eea/volto-arcgis-block/commit/236893f03314eb638b7667f81b1f91491a98ee17)]
|
|
1448
1467
|
- fix git_name [valentinab25 - [`c7806c3`](https://github.com/eea/volto-arcgis-block/commit/c7806c312964425dc23e5d4c6973de8b81ddaeac)]
|
|
1449
|
-
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`e3afb51`](https://github.com/eea/volto-arcgis-block/commit/e3afb515dda459ee03e2b5d4b56465d2d4ad1503)]
|
|
1450
1468
|
- Trying to change imports [gonzalezsd - [`d83d7e2`](https://github.com/eea/volto-arcgis-block/commit/d83d7e2f68da4b2a284735847f93c0763a7e13b6)]
|
|
1451
1469
|
- default design [bipoza - [`88fbe0b`](https://github.com/eea/volto-arcgis-block/commit/88fbe0b2bc73e732e2993324a567f53902e85506)]
|
|
1452
1470
|
- cleanup of unused code [bipoza - [`b167677`](https://github.com/eea/volto-arcgis-block/commit/b1676771f637f056cad50cb0bc186f2ea79e8517)]
|
package/package.json
CHANGED
|
@@ -17,6 +17,10 @@ class HotspotWidget extends React.Component {
|
|
|
17
17
|
this.state = {
|
|
18
18
|
showMapMenu: false,
|
|
19
19
|
activeLayers: {},
|
|
20
|
+
selectedArea: null,
|
|
21
|
+
lcYear: null,
|
|
22
|
+
lccYear: null,
|
|
23
|
+
activeLayersArray: [],
|
|
20
24
|
};
|
|
21
25
|
this.menuClass =
|
|
22
26
|
'esri-icon-filter esri-widget--button esri-widget esri-interactive';
|
|
@@ -40,12 +44,15 @@ class HotspotWidget extends React.Component {
|
|
|
40
44
|
this.layerModelInit = this.layerModelInit.bind(this);
|
|
41
45
|
this.getBBoxData = this.getBBoxData.bind(this);
|
|
42
46
|
this.handleApplyFilter = this.handleApplyFilter.bind(this);
|
|
47
|
+
this.filteredLayersToHotspotData = this.filteredLayersToHotspotData.bind(
|
|
48
|
+
this,
|
|
49
|
+
);
|
|
43
50
|
this.mapCfg = this.props.mapCfg;
|
|
44
|
-
//this.getLayerParameters();
|
|
45
51
|
this.selectedArea = null;
|
|
46
52
|
this.lcYear = null;
|
|
47
53
|
this.lccYear = null;
|
|
48
54
|
this.urls = this.props.urls;
|
|
55
|
+
this.layers = this.props.selectedLayers;
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
loader() {
|
|
@@ -184,65 +191,24 @@ class HotspotWidget extends React.Component {
|
|
|
184
191
|
|
|
185
192
|
async handleApplyFilter(typeFilter) {
|
|
186
193
|
let typeLegend;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
var currentLcLayer = Object.keys(this.props.selectedLayers).find((e) =>
|
|
198
|
-
e.includes('lc_filter'),
|
|
199
|
-
);
|
|
200
|
-
if (currentLcLayer) delete this.props.selectedLayers[currentLcLayer];
|
|
201
|
-
|
|
202
|
-
var currentKlcLayer = Object.keys(this.props.selectedLayers).find((e) =>
|
|
203
|
-
e.includes('klc_filter'),
|
|
204
|
-
);
|
|
205
|
-
if (currentKlcLayer) delete this.props.selectedLayers[currentKlcLayer];
|
|
194
|
+
let activeLayers =
|
|
195
|
+
this.props.hotspotData && this.props.hotspotData['activeLayers']
|
|
196
|
+
? Object.keys(this.props.hotspotData['activeLayers'])
|
|
197
|
+
: [];
|
|
198
|
+
let filteredLayers =
|
|
199
|
+
this.props.hotspotData && this.props.hotspotData['filteredLayers']
|
|
200
|
+
? Object.keys(this.props.hotspotData['filteredLayers'])
|
|
201
|
+
: [];
|
|
202
|
+
let layersToAdd = {};
|
|
206
203
|
|
|
207
|
-
var currentPaLayer = Object.keys(this.props.selectedLayers).find((e) =>
|
|
208
|
-
e.includes('pa_filter'),
|
|
209
|
-
);
|
|
210
|
-
if (currentPaLayer) delete this.props.selectedLayers[currentPaLayer];
|
|
211
|
-
|
|
212
|
-
var currentLcckey = Object.keys(this.props.selectedLayers).find((e) =>
|
|
213
|
-
e.includes('all_lcc'),
|
|
214
|
-
);
|
|
215
|
-
var currentLckey = Object.keys(this.props.selectedLayers).find((e) =>
|
|
216
|
-
e.includes('all_present_lc'),
|
|
217
|
-
);
|
|
218
|
-
var currentKlckey = Object.keys(this.props.selectedLayers).find((e) =>
|
|
219
|
-
e.includes('cop_klc'),
|
|
220
|
-
);
|
|
221
|
-
var currentPakey = Object.keys(this.props.selectedLayers).find((e) =>
|
|
222
|
-
e.includes('protected_areas'),
|
|
223
|
-
);
|
|
224
|
-
if (currentLcckey) {
|
|
225
|
-
//this.props.map.remove(this.props.selectedLayers[currentLcckey]);
|
|
226
|
-
this.props.selectedLayers[currentLcckey].visible = false;
|
|
227
|
-
}
|
|
228
|
-
if (currentLckey) {
|
|
229
|
-
//this.props.map.remove(this.props.selectedLayers[currentLckey]);
|
|
230
|
-
this.props.selectedLayers[currentLckey].visible = false;
|
|
231
|
-
}
|
|
232
|
-
if (currentKlckey) {
|
|
233
|
-
//this.props.map.remove(this.props.selectedLayers[currentKlckey]);
|
|
234
|
-
this.props.selectedLayers[currentKlckey].visible = false;
|
|
235
|
-
}
|
|
236
|
-
if (currentPakey) {
|
|
237
|
-
//this.props.map.remove(this.props.selectedLayers[currentPakey]);
|
|
238
|
-
this.props.selectedLayers[currentPakey].visible = false;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
204
|
typeFilter.forEach((type) => {
|
|
205
|
+
let filterLayer;
|
|
206
|
+
|
|
242
207
|
if (type === 'lcc') {
|
|
243
208
|
let selectLccBoxTime = document.getElementById('select-klc-lccTime')
|
|
244
209
|
.value;
|
|
245
|
-
this.lccYear = selectLccBoxTime;
|
|
210
|
+
//this.lccYear = selectLccBoxTime;
|
|
211
|
+
this.setState({ lccYear: selectLccBoxTime });
|
|
246
212
|
var selectBoxHighlightsLcc = document
|
|
247
213
|
.getElementById('select-klc-lccTime')
|
|
248
214
|
.value.match(/\d+/g)
|
|
@@ -258,30 +224,19 @@ class HotspotWidget extends React.Component {
|
|
|
258
224
|
}
|
|
259
225
|
}
|
|
260
226
|
|
|
261
|
-
|
|
262
|
-
if (this.esriLayer_lcc2 !== null) {
|
|
263
|
-
this.props.map.remove(this.esriLayer_lcc2);
|
|
264
|
-
}
|
|
227
|
+
filterLayer = this.esriLayer_lcc;
|
|
265
228
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
" AND in_pa = 'not_defined' AND date = " +
|
|
278
|
-
selectBoxHighlightsLcc;
|
|
279
|
-
this.props.map.add(this.esriLayer_lcc);
|
|
280
|
-
this.props.selectedLayers['lcc_filter'] = this.esriLayer_lcc;
|
|
281
|
-
this.props.selectedLayers['lcc_filter'].visible = true;
|
|
282
|
-
this.esriLayer_lcc2 = this.esriLayer_lcc;
|
|
283
|
-
//this.layerModelInit();
|
|
284
|
-
}
|
|
229
|
+
filterLayer.sublayers.items[0].name = this.addLegendName(typeLegend);
|
|
230
|
+
filterLayer.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
|
|
231
|
+
typeLegend,
|
|
232
|
+
);
|
|
233
|
+
filterLayer.customLayerParameters['CQL_FILTER'] =
|
|
234
|
+
'klc_code LIKE ' +
|
|
235
|
+
"'" +
|
|
236
|
+
this.dataKlc_code +
|
|
237
|
+
"'" +
|
|
238
|
+
" AND in_pa = 'not_defined' AND date = " +
|
|
239
|
+
selectBoxHighlightsLcc;
|
|
285
240
|
}
|
|
286
241
|
if (type === 'lc') {
|
|
287
242
|
for (let i = 0; i < activeLayers.length; i++) {
|
|
@@ -296,80 +251,94 @@ class HotspotWidget extends React.Component {
|
|
|
296
251
|
|
|
297
252
|
let selectLcBoxTime = document.getElementById('select-klc-lcTime')
|
|
298
253
|
.value;
|
|
299
|
-
this.lcYear = selectLcBoxTime;
|
|
254
|
+
//this.lcYear = selectLcBoxTime;
|
|
255
|
+
this.setState({ lcYear: selectLcBoxTime });
|
|
300
256
|
var selectBoxHighlightsLc = document
|
|
301
257
|
.getElementById('select-klc-lcTime')
|
|
302
258
|
.value.match(/\d+/g)
|
|
303
259
|
.map(Number)[0];
|
|
304
260
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
this.dataKlc_code +
|
|
319
|
-
"'" +
|
|
320
|
-
" AND in_pa = 'not_defined' AND date = " +
|
|
321
|
-
selectBoxHighlightsLc;
|
|
322
|
-
this.props.map.add(this.esriLayer_lc);
|
|
323
|
-
this.props.selectedLayers['lc_filter'] = this.esriLayer_lc;
|
|
324
|
-
this.props.selectedLayers['lc_filter'].visible = true;
|
|
325
|
-
this.esriLayer_lc2 = this.esriLayer_lc;
|
|
326
|
-
}
|
|
261
|
+
filterLayer = this.esriLayer_lc;
|
|
262
|
+
|
|
263
|
+
filterLayer.sublayers.items[0].name = this.addLegendName(typeLegend);
|
|
264
|
+
filterLayer.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
|
|
265
|
+
typeLegend,
|
|
266
|
+
);
|
|
267
|
+
filterLayer.customLayerParameters['CQL_FILTER'] =
|
|
268
|
+
'klc_code LIKE ' +
|
|
269
|
+
"'" +
|
|
270
|
+
this.dataKlc_code +
|
|
271
|
+
"'" +
|
|
272
|
+
" AND in_pa = 'not_defined' AND date = " +
|
|
273
|
+
selectBoxHighlightsLc;
|
|
327
274
|
}
|
|
328
|
-
this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
|
|
329
|
-
"klc_code LIKE '" + this.dataKlc_code + "'";
|
|
330
|
-
this.props.selectedLayers['klc_filter'] = this.esriLayer_klc;
|
|
331
275
|
if (type === 'klc') {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
this.props.map.add(this.esriLayer_klc);
|
|
337
|
-
this.props.selectedLayers['klc_filter'].visible = true;
|
|
338
|
-
this.esriLayer_klc2 = this.esriLayer_klc;
|
|
339
|
-
//this.layerModelInit();
|
|
340
|
-
}
|
|
276
|
+
this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
|
|
277
|
+
"klc_code LIKE '" + this.dataKlc_code + "'";
|
|
278
|
+
filterLayer = this.esriLayer_klc;
|
|
341
279
|
}
|
|
342
|
-
this.esriLayer_pa.customLayerParameters['CQL_FILTER'] =
|
|
343
|
-
"klc_code LIKE '" + this.dataKlc_code + "'";
|
|
344
|
-
this.props.selectedLayers['pa_filter'] = this.esriLayer_pa;
|
|
345
280
|
if (type === 'pa') {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
281
|
+
this.esriLayer_pa.customLayerParameters['CQL_FILTER'] =
|
|
282
|
+
"klc_code LIKE '" + this.dataKlc_code + "'";
|
|
283
|
+
filterLayer = this.esriLayer_pa;
|
|
284
|
+
}
|
|
285
|
+
layersToAdd[type + '_filter'] = filterLayer;
|
|
286
|
+
});
|
|
287
|
+
activeLayers.forEach((activeLayer) => {
|
|
288
|
+
let layerId = Object.keys(this.layers).find((key) =>
|
|
289
|
+
key.includes(activeLayer),
|
|
290
|
+
);
|
|
291
|
+
if (layerId !== undefined) this.layers[layerId].visible = false;
|
|
292
|
+
let layer = this.props.map.findLayerById(layerId);
|
|
293
|
+
if (layer !== undefined) {
|
|
294
|
+
layer.clear();
|
|
295
|
+
layer.destroy();
|
|
296
|
+
this.props.map.remove(layer);
|
|
355
297
|
}
|
|
356
|
-
this.layerModelInit();
|
|
357
|
-
this.setBBoxCoordinates(this.dataBBox);
|
|
358
|
-
//this.setState({ activeLayers: {[type+'_filter']: this.props.selectedLayers[type+'_filter']}})
|
|
359
298
|
});
|
|
299
|
+
filteredLayers.forEach((filteredLayer) => {
|
|
300
|
+
let layerId = Object.keys(this.layers).find((key) =>
|
|
301
|
+
key.includes(filteredLayer),
|
|
302
|
+
);
|
|
303
|
+
if (layerId !== undefined) this.layers[layerId].visible = false;
|
|
304
|
+
let layer = this.props.map.findLayerById(layerId);
|
|
305
|
+
if (layer !== undefined) {
|
|
306
|
+
layer.clear();
|
|
307
|
+
layer.destroy();
|
|
308
|
+
this.props.map.remove(layer);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
this.props.map.addMany(Object.values(layersToAdd));
|
|
312
|
+
Object.keys(layersToAdd).forEach((key) => {
|
|
313
|
+
this.layers[key] = layersToAdd[key];
|
|
314
|
+
this.layers[key].visible = true;
|
|
315
|
+
});
|
|
316
|
+
this.setBBoxCoordinates(this.dataBBox);
|
|
360
317
|
//set sessionStorage value to keep the widget open
|
|
361
318
|
sessionStorage.setItem('hotspotFilterApplied', 'true');
|
|
362
319
|
this.disableButton();
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
320
|
+
this.props.mapLayersHandler(this.layers);
|
|
321
|
+
this.filteredLayersToHotspotData(Object.keys(layersToAdd));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
filteredLayersToHotspotData(layerIds) {
|
|
325
|
+
let updatedFilteredLayers = this.props.hotspotData['filteredLayers'] || {};
|
|
326
|
+
let newHotspotData = this.props.hotspotData;
|
|
327
|
+
layerIds.forEach((layerId) => {
|
|
328
|
+
let layer = Object.entries(this.layers).find(
|
|
329
|
+
([key, value]) => key === layerId,
|
|
330
|
+
)?.[1];
|
|
331
|
+
|
|
332
|
+
Object.keys(updatedFilteredLayers).forEach((key) => {
|
|
333
|
+
if (key === layerId) {
|
|
334
|
+
delete updatedFilteredLayers[key];
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
updatedFilteredLayers[layerId] = layer;
|
|
372
339
|
});
|
|
340
|
+
newHotspotData['filteredLayers'] = updatedFilteredLayers;
|
|
341
|
+
return this.props.hotspotDataHandler(newHotspotData);
|
|
373
342
|
}
|
|
374
343
|
|
|
375
344
|
dropdownAnimation() {
|
|
@@ -389,7 +358,6 @@ class HotspotWidget extends React.Component {
|
|
|
389
358
|
|
|
390
359
|
openMenu() {
|
|
391
360
|
if (this.state.showMapMenu) {
|
|
392
|
-
//this.getKLCNames(this.dataJSONNames, this.selectedArea);
|
|
393
361
|
this.props.mapViewer.setActiveWidget();
|
|
394
362
|
this.container.current.querySelector('.right-panel').style.display =
|
|
395
363
|
'none';
|
|
@@ -403,9 +371,6 @@ class HotspotWidget extends React.Component {
|
|
|
403
371
|
// and ensure that the component is rendered again
|
|
404
372
|
this.setState({ showMapMenu: false });
|
|
405
373
|
} else {
|
|
406
|
-
//this.getLayerParameters();
|
|
407
|
-
//if (this.getLayerParameters.length !== 0)
|
|
408
|
-
//this.getKLCNames(this.dataJSONNames, this.selectedArea);
|
|
409
374
|
this.props.mapViewer.setActiveWidget(this);
|
|
410
375
|
this.container.current.querySelector('.right-panel').style.display =
|
|
411
376
|
'flex';
|
|
@@ -432,9 +397,6 @@ class HotspotWidget extends React.Component {
|
|
|
432
397
|
})
|
|
433
398
|
.then((data) => {
|
|
434
399
|
this.dataJSONNames = data.nodes;
|
|
435
|
-
//if (this.selectedArea == null) {
|
|
436
|
-
// this.selectedArea = data.nodes[0].node.klc_name;
|
|
437
|
-
//}
|
|
438
400
|
})
|
|
439
401
|
.catch(function (error) {
|
|
440
402
|
/* console.log('error while getting data'); */
|
|
@@ -475,6 +437,7 @@ class HotspotWidget extends React.Component {
|
|
|
475
437
|
let lccContainer = document.querySelector('.landCoverChangeContainer');
|
|
476
438
|
let lccTimeSelect = document.querySelector('#select-klc-lccTime');
|
|
477
439
|
let lcTimeSelect = document.querySelector('#select-klc-lcTime');
|
|
440
|
+
if (lcContainer === null || lccContainer === null) return;
|
|
478
441
|
if (
|
|
479
442
|
(lcContainer.style.display === 'block' &&
|
|
480
443
|
lcTimeSelect.value === 'default') ||
|
|
@@ -541,12 +504,14 @@ class HotspotWidget extends React.Component {
|
|
|
541
504
|
selectBoxLccTime = document.getElementById('select-klc-lccTime');
|
|
542
505
|
selectBoxLcTime = document.getElementById('select-klc-lcTime');
|
|
543
506
|
|
|
544
|
-
if (selectedOption !== this.selectedArea) {
|
|
545
|
-
this.
|
|
546
|
-
|
|
507
|
+
if (selectedOption !== this.state.selectedArea) {
|
|
508
|
+
this.setState({
|
|
509
|
+
lcYear: null,
|
|
510
|
+
lccYear: null,
|
|
511
|
+
});
|
|
547
512
|
}
|
|
548
513
|
|
|
549
|
-
this.selectedArea = selectedOption;
|
|
514
|
+
//this.selectedArea = selectedOption;
|
|
550
515
|
|
|
551
516
|
for (let i = 0; i < data.length; i++) {
|
|
552
517
|
var option = data[i].node.klc_name;
|
|
@@ -632,16 +597,16 @@ class HotspotWidget extends React.Component {
|
|
|
632
597
|
selectBox.options.add(new Option(option, option, option));
|
|
633
598
|
}
|
|
634
599
|
for (let u = 0; u < selectBox.options.length; u++) {
|
|
635
|
-
if (!selectBox.options[u].label.includes(this.selectedArea)) {
|
|
600
|
+
if (!selectBox.options[u].label.includes(this.state.selectedArea)) {
|
|
636
601
|
selectBox.value = 'default';
|
|
637
602
|
continue;
|
|
638
603
|
} else {
|
|
639
|
-
selectBox.value = this.selectedArea;
|
|
640
|
-
if (this.lcYear !== null) {
|
|
641
|
-
selectBoxLcTime.value = this.lcYear;
|
|
604
|
+
selectBox.value = this.state.selectedArea;
|
|
605
|
+
if (this.state.lcYear !== null) {
|
|
606
|
+
selectBoxLcTime.value = this.state.lcYear;
|
|
642
607
|
}
|
|
643
|
-
if (this.lccYear !== null) {
|
|
644
|
-
selectBoxLccTime.value = this.lccYear;
|
|
608
|
+
if (this.state.lccYear !== null) {
|
|
609
|
+
selectBoxLccTime.value = this.state.lccYear;
|
|
645
610
|
}
|
|
646
611
|
break; // move break statement inside the if block
|
|
647
612
|
}
|
|
@@ -656,18 +621,18 @@ class HotspotWidget extends React.Component {
|
|
|
656
621
|
selectBox.options.add(new Option(option, option, option));
|
|
657
622
|
}
|
|
658
623
|
for (let u = 0; u < selectBox.options.length; u++) {
|
|
659
|
-
if (!selectBox.options[u].label.includes(this.selectedArea)) {
|
|
624
|
+
if (!selectBox.options[u].label.includes(this.state.selectedArea)) {
|
|
660
625
|
selectBox.value = 'default';
|
|
661
626
|
continue;
|
|
662
627
|
} else {
|
|
663
|
-
selectBox.value = this.selectedArea;
|
|
664
|
-
if (this.lcYear !== null) {
|
|
665
|
-
selectBoxLcTime.value = this.lcYear;
|
|
628
|
+
selectBox.value = this.state.selectedArea;
|
|
629
|
+
if (this.state.lcYear !== null) {
|
|
630
|
+
selectBoxLcTime.value = this.state.lcYear;
|
|
666
631
|
}
|
|
667
|
-
if (this.lccYear !== null) {
|
|
668
|
-
selectBoxLccTime.value = this.lccYear;
|
|
632
|
+
if (this.state.lccYear !== null) {
|
|
633
|
+
selectBoxLccTime.value = this.state.lccYear;
|
|
669
634
|
}
|
|
670
|
-
break;
|
|
635
|
+
break;
|
|
671
636
|
}
|
|
672
637
|
}
|
|
673
638
|
break;
|
|
@@ -738,6 +703,29 @@ class HotspotWidget extends React.Component {
|
|
|
738
703
|
}
|
|
739
704
|
|
|
740
705
|
render() {
|
|
706
|
+
let divs = [
|
|
707
|
+
{
|
|
708
|
+
id: 'all_present_lc',
|
|
709
|
+
func: this.renderPresentLandCover,
|
|
710
|
+
className: 'presentLandCoverContainer',
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
id: 'all_lcc',
|
|
714
|
+
func: this.renderLandCoverChange,
|
|
715
|
+
className: 'landCoverChangeContainer',
|
|
716
|
+
},
|
|
717
|
+
];
|
|
718
|
+
|
|
719
|
+
divs.sort((a, b) => {
|
|
720
|
+
let indexA = this.state.activeLayersArray.findIndex((layer) =>
|
|
721
|
+
layer.getAttribute('layer-id').includes(a.id),
|
|
722
|
+
);
|
|
723
|
+
let indexB = this.state.activeLayersArray.findIndex((layer) =>
|
|
724
|
+
layer.getAttribute('layer-id').includes(b.id),
|
|
725
|
+
);
|
|
726
|
+
if (indexA === -1 || indexB === -1) return 0;
|
|
727
|
+
return indexA - indexB;
|
|
728
|
+
});
|
|
741
729
|
return (
|
|
742
730
|
<>
|
|
743
731
|
<div ref={this.container} className="hotspot-container">
|
|
@@ -772,8 +760,7 @@ class HotspotWidget extends React.Component {
|
|
|
772
760
|
<select
|
|
773
761
|
onBlur={() => {}}
|
|
774
762
|
onChange={(e) => {
|
|
775
|
-
this.
|
|
776
|
-
this.disableButton();
|
|
763
|
+
this.setState({ selectedArea: e.target.value });
|
|
777
764
|
}}
|
|
778
765
|
id="select-klc-area"
|
|
779
766
|
className="esri-select"
|
|
@@ -781,11 +768,12 @@ class HotspotWidget extends React.Component {
|
|
|
781
768
|
</label>
|
|
782
769
|
</div>
|
|
783
770
|
</div>
|
|
784
|
-
<div
|
|
785
|
-
{
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
771
|
+
<div>
|
|
772
|
+
{divs.map((div, i) => (
|
|
773
|
+
<div key={i} className={div.className}>
|
|
774
|
+
{div.func()}
|
|
775
|
+
</div>
|
|
776
|
+
))}
|
|
789
777
|
</div>
|
|
790
778
|
<button
|
|
791
779
|
id="applyFilterButton"
|
|
@@ -802,6 +790,31 @@ class HotspotWidget extends React.Component {
|
|
|
802
790
|
);
|
|
803
791
|
}
|
|
804
792
|
|
|
793
|
+
//sortHotspotTabs = () => {
|
|
794
|
+
// let activeLayersArray = Array.from(document.querySelectorAll('.active-layer'));
|
|
795
|
+
// let divs = [
|
|
796
|
+
// { id: 'all_present_lc', func: this.renderPresentLandCover, className: 'presentLandCoverContainer' },
|
|
797
|
+
// { id: 'all_lcc', func: this.renderLandCoverChange, className: 'landCoverChangeContainer' }
|
|
798
|
+
// ];
|
|
799
|
+
//
|
|
800
|
+
// divs.sort((a, b) => {
|
|
801
|
+
// let indexA = activeLayersArray.findIndex(layer => layer.getAttribute('layer-id').includes(a.id));
|
|
802
|
+
// let indexB = activeLayersArray.findIndex(layer => layer.getAttribute('layer-id').includes(b.id));
|
|
803
|
+
// if (indexA === -1 || indexB === -1) return 0;
|
|
804
|
+
// return indexA - indexB;
|
|
805
|
+
// });
|
|
806
|
+
//
|
|
807
|
+
// return (
|
|
808
|
+
// <div>
|
|
809
|
+
// {divs.map(div => (
|
|
810
|
+
// <div className={div.className}>
|
|
811
|
+
// {div.func()}
|
|
812
|
+
// </div>
|
|
813
|
+
// ))}
|
|
814
|
+
// </div>
|
|
815
|
+
// );
|
|
816
|
+
//}
|
|
817
|
+
|
|
805
818
|
/**
|
|
806
819
|
* This method is executed after the rener method is executed
|
|
807
820
|
*/
|
|
@@ -811,12 +824,22 @@ class HotspotWidget extends React.Component {
|
|
|
811
824
|
this.props.view.ui.add(this.container.current, 'top-right');
|
|
812
825
|
this.layerModelInit();
|
|
813
826
|
this.getBBoxData();
|
|
827
|
+
this.props.view.map.layers.on('change', () => {
|
|
828
|
+
this.setState({
|
|
829
|
+
activeLayersArray: Array.from(
|
|
830
|
+
document.querySelectorAll('.active-layer'),
|
|
831
|
+
),
|
|
832
|
+
});
|
|
833
|
+
const newHotspotData = this.props.hotspotData;
|
|
834
|
+
this.props.hotspotDataHandler(newHotspotData);
|
|
835
|
+
});
|
|
814
836
|
}
|
|
815
837
|
|
|
816
838
|
componentDidUpdate(prevState, prevProps) {
|
|
817
839
|
if (prevProps.hotspotData !== this.props.hotspotData) {
|
|
818
|
-
this.getKLCNames(this.dataJSONNames, this.selectedArea);
|
|
840
|
+
this.getKLCNames(this.dataJSONNames, this.state.selectedArea);
|
|
819
841
|
this.disableButton();
|
|
842
|
+
//this.layerModelInit();
|
|
820
843
|
}
|
|
821
844
|
}
|
|
822
845
|
}
|
|
@@ -45,14 +45,38 @@ class LegendWidget extends React.Component {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
scanImages() {
|
|
49
|
+
let img = {};
|
|
49
50
|
const collection = document.getElementsByClassName('esri-legend__symbol');
|
|
50
51
|
Array.prototype.forEach.call(collection, (element) => {
|
|
51
|
-
|
|
52
|
+
if (element.hasChildNodes()) {
|
|
53
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
54
|
+
let child = element.childNodes[i];
|
|
55
|
+
if (child.nodename === 'IMG') {
|
|
56
|
+
img = child;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} else img = element;
|
|
61
|
+
if (!(img instanceof HTMLImageElement)) return;
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
img.onerror = () => this.setState({ loading: true });
|
|
64
|
+
});
|
|
65
|
+
}
|
|
55
66
|
|
|
67
|
+
brokenLegendImagePatch() {
|
|
68
|
+
let img = {};
|
|
69
|
+
const collection = document.getElementsByClassName('esri-legend__symbol');
|
|
70
|
+
Array.prototype.forEach.call(collection, (element) => {
|
|
71
|
+
if (element.hasChildNodes()) {
|
|
72
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
73
|
+
let child = element.childNodes[i];
|
|
74
|
+
if (child.nodeName === 'IMG') {
|
|
75
|
+
img = child;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} else img = element;
|
|
56
80
|
if (!(img.complete && img.naturalHeight !== 0)) {
|
|
57
81
|
// If img src returns a broken link
|
|
58
82
|
if (img?.src?.includes('all_present_lc_a_pol')) {
|
|
@@ -62,28 +86,13 @@ class LegendWidget extends React.Component {
|
|
|
62
86
|
|
|
63
87
|
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
64
88
|
'Dichotomous Present Land Cover in selected hot spots';
|
|
65
|
-
return;
|
|
66
89
|
} else if (img?.src?.includes('all_present_lc_b_pol')) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//find the legend that contains a broken img
|
|
74
|
-
if (
|
|
75
|
-
legend.querySelector('img')?.src?.includes('all_present_lc_b_pol')
|
|
76
|
-
) {
|
|
77
|
-
const img = legend.querySelector('img');
|
|
78
|
-
//set this legend to display none
|
|
79
|
-
if (!(img.complete && img.naturalHeight !== 0)) {
|
|
80
|
-
legend.style.display = 'none';
|
|
81
|
-
}
|
|
82
|
-
break; // break out of the loop after the first match
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/*img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
86
|
-
'Modular Present Land Cover in selected hot spots';*/
|
|
90
|
+
img.src = this.props.hotspotData.all_present_lc[
|
|
91
|
+
'all_present_lc_b_pol'
|
|
92
|
+
].FilterStaticImageLegend;
|
|
93
|
+
|
|
94
|
+
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
95
|
+
'Modular Present Land Cover in selected hot spots';
|
|
87
96
|
} else if (img?.src?.includes('all_lcc_a_pol')) {
|
|
88
97
|
img.src = this.props.hotspotData.all_lcc[
|
|
89
98
|
'all_lcc_a_pol'
|
|
@@ -92,29 +101,25 @@ class LegendWidget extends React.Component {
|
|
|
92
101
|
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
93
102
|
'Dichotomous Land Cover Change in selected hot spots';
|
|
94
103
|
} else if (img?.src?.includes('all_lcc_b_pol')) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
//find the legend that contains a broken img
|
|
102
|
-
if (legend.querySelector('img')?.src?.includes('all_lcc_b_pol')) {
|
|
103
|
-
const img = legend.querySelector('img');
|
|
104
|
-
//set this legend to display none
|
|
105
|
-
if (!(img.complete && img.naturalHeight !== 0)) {
|
|
106
|
-
legend.style.display = 'none';
|
|
107
|
-
}
|
|
108
|
-
break; // break out of the loop after the first match
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/*img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
112
|
-
'Modular Present Land Cover in selected hot spots';*/
|
|
104
|
+
img.src = this.props.hotspotData.all_lcc[
|
|
105
|
+
'all_lcc_b_pol'
|
|
106
|
+
].FilterStaticImageLegend;
|
|
107
|
+
|
|
108
|
+
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
109
|
+
'Modular Land Cover Change in selected hot spots';
|
|
113
110
|
} else if (img?.src?.includes('cop_klc')) {
|
|
114
|
-
img.src = this.
|
|
111
|
+
img.src = this.props.hotspotData.cop_klc[
|
|
112
|
+
'cop_klc'
|
|
113
|
+
].FilterStaticImageLegend;
|
|
115
114
|
|
|
116
115
|
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
117
116
|
'Key Landscapes for Conservation borders in selected hotspots';
|
|
117
|
+
} else if (img?.src?.includes('protected_areas')) {
|
|
118
|
+
img.src = this.props.hotspotData.protected_areas[
|
|
119
|
+
'protected_areas'
|
|
120
|
+
].FilterStaticImageLegend;
|
|
121
|
+
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
122
|
+
'Protected Areas in Key Landscapes for Conservation borders in selected hot-spots';
|
|
118
123
|
} else if (img.style) {
|
|
119
124
|
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.style.display =
|
|
120
125
|
'none';
|
|
@@ -126,6 +131,15 @@ class LegendWidget extends React.Component {
|
|
|
126
131
|
span.innerHTML = 'No legend available';
|
|
127
132
|
element.parentNode.appendChild(span);
|
|
128
133
|
}
|
|
134
|
+
if (
|
|
135
|
+
img.closest('.esri-legend__service').firstElementChild.nodeName ===
|
|
136
|
+
'H3' &&
|
|
137
|
+
img.closest('.esri-legend__service').firstElementChild.textContent ===
|
|
138
|
+
'WMS'
|
|
139
|
+
) {
|
|
140
|
+
img.closest('.esri-legend__service').firstElementChild.style.display =
|
|
141
|
+
'none';
|
|
142
|
+
}
|
|
129
143
|
}
|
|
130
144
|
});
|
|
131
145
|
}
|
|
@@ -176,11 +190,6 @@ class LegendWidget extends React.Component {
|
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
imageFixWithTimer() {
|
|
179
|
-
let newHotspotData = this.props.hotspotData;
|
|
180
|
-
if (this.props.hotspotData?.layerViewError !== undefined) {
|
|
181
|
-
delete newHotspotData['layerViewError'];
|
|
182
|
-
}
|
|
183
|
-
this.props.hotspotDataHandler(newHotspotData);
|
|
184
193
|
this.setState({ loading: true });
|
|
185
194
|
setTimeout(() => {
|
|
186
195
|
this.brokenLegendImagePatch();
|
|
@@ -204,16 +213,28 @@ class LegendWidget extends React.Component {
|
|
|
204
213
|
}),
|
|
205
214
|
container: document.querySelector('.legend-panel'),
|
|
206
215
|
});
|
|
207
|
-
this.
|
|
208
|
-
this.
|
|
216
|
+
this.LegendWidget.when(() => {
|
|
217
|
+
this.LegendWidget.activeLayerInfos.on('after-changes', (event) => {
|
|
218
|
+
this.setState({ loading: true });
|
|
219
|
+
this.scanImages();
|
|
220
|
+
});
|
|
209
221
|
});
|
|
210
222
|
}
|
|
211
223
|
|
|
212
|
-
componentDidUpdate(prevProps) {
|
|
213
|
-
if (
|
|
214
|
-
this.
|
|
224
|
+
componentDidUpdate(prevState, prevProps) {
|
|
225
|
+
if (prevState.loading !== this.state.loading) {
|
|
226
|
+
if (this.state.loading === true) {
|
|
227
|
+
setTimeout(() => {
|
|
228
|
+
this.brokenLegendImagePatch();
|
|
229
|
+
if (this.props.download) {
|
|
230
|
+
this.hideNutsLegend();
|
|
231
|
+
}
|
|
232
|
+
this.setState({ loading: false });
|
|
233
|
+
}, 2000);
|
|
234
|
+
}
|
|
215
235
|
}
|
|
216
236
|
}
|
|
237
|
+
|
|
217
238
|
/**
|
|
218
239
|
* This method renders the component
|
|
219
240
|
* @returns jsx
|
|
@@ -9,7 +9,11 @@ class LoadingSpinner extends React.Component {
|
|
|
9
9
|
this.container = createRef();
|
|
10
10
|
//Initially, we set the state of the component to
|
|
11
11
|
//not be showing the basemap panel
|
|
12
|
-
this.state = {
|
|
12
|
+
this.state = {
|
|
13
|
+
loading: false,
|
|
14
|
+
};
|
|
15
|
+
this.showLoading = this.showLoading.bind(this);
|
|
16
|
+
this.listenForLayerChanges = this.listenForLayerChanges.bind(this);
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
loader() {
|
|
@@ -18,8 +22,38 @@ class LoadingSpinner extends React.Component {
|
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
listenForLayerChanges() {
|
|
26
|
+
this.props.view.map.layers.on('change', (event) => {
|
|
27
|
+
if (event.added.length > 0)
|
|
28
|
+
if (this.state.loading === false) {
|
|
29
|
+
this.setState({ loading: true });
|
|
30
|
+
this.showLoading();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
this.props.view.on('layerview-create', (event) => {
|
|
34
|
+
if (event.layer.loadStatus === 'loaded') {
|
|
35
|
+
this.props.view.watch('updating', (isUpdating) => {
|
|
36
|
+
if (!isUpdating) {
|
|
37
|
+
if (this.state.loading === true) {
|
|
38
|
+
this.setState({ loading: false });
|
|
39
|
+
this.showLoading();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.props.view.on('layerview-create-error', (event) => {
|
|
46
|
+
if (event.layer.loadError !== null) {
|
|
47
|
+
if (this.state.loading === true) {
|
|
48
|
+
this.setState({ loading: false });
|
|
49
|
+
this.showLoading();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
21
55
|
showLoading() {
|
|
22
|
-
if (this.
|
|
56
|
+
if (this.state.loading === false) {
|
|
23
57
|
this.container.current.style.display = 'none';
|
|
24
58
|
} else {
|
|
25
59
|
this.container.current.style.display = 'block';
|
|
@@ -29,18 +63,22 @@ class LoadingSpinner extends React.Component {
|
|
|
29
63
|
|
|
30
64
|
async componentDidMount() {
|
|
31
65
|
await this.loader();
|
|
32
|
-
this.props.view.when(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
66
|
+
//this.props.view.when(() => {
|
|
67
|
+
// this.props.view.ui.add(this.container.current, 'manual');
|
|
68
|
+
// this.listenForLayerChanges();
|
|
69
|
+
//});
|
|
70
|
+
watchUtils.when(this.props.view, 'ready', (isReady) => {
|
|
71
|
+
if (isReady) {
|
|
72
|
+
this.props.view.ui.add(this.container.current, 'manual');
|
|
73
|
+
this.listenForLayerChanges();
|
|
74
|
+
}
|
|
37
75
|
});
|
|
38
76
|
}
|
|
39
77
|
|
|
40
|
-
componentDidUpdate(
|
|
41
|
-
if (this.
|
|
42
|
-
this.showLoading();
|
|
43
|
-
}
|
|
78
|
+
componentDidUpdate(prevState) {
|
|
79
|
+
// if (this.state.loading !== prevState.loading) {
|
|
80
|
+
// this.showLoading();
|
|
81
|
+
// }
|
|
44
82
|
}
|
|
45
83
|
|
|
46
84
|
render() {
|
|
@@ -55,8 +55,8 @@ class MapViewer extends React.Component {
|
|
|
55
55
|
});
|
|
56
56
|
this.state = {
|
|
57
57
|
layerLoading: false,
|
|
58
|
+
layers: {},
|
|
58
59
|
};
|
|
59
|
-
this.layers = {};
|
|
60
60
|
this.activeLayersHandler = this.activeLayersHandler.bind(this);
|
|
61
61
|
this.activeLayersArray = {};
|
|
62
62
|
this.props.mapviewer_config.loading = true;
|
|
@@ -64,6 +64,11 @@ class MapViewer extends React.Component {
|
|
|
64
64
|
this.userID = null;
|
|
65
65
|
this.loadingHandler = this.loadingHandler.bind(this);
|
|
66
66
|
this.hotspotDataHandler = this.hotspotDataHandler.bind(this);
|
|
67
|
+
this.mapLayersHandler = this.mapLayersHandler.bind(this);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
mapLayersHandler(newLayers) {
|
|
71
|
+
this.setState({ layers: newLayers });
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
loadingHandler(bool) {
|
|
@@ -307,6 +312,7 @@ class MapViewer extends React.Component {
|
|
|
307
312
|
mapViewer={this}
|
|
308
313
|
download={this.props.mapviewer_config.Download}
|
|
309
314
|
urls={this.cfgUrls}
|
|
315
|
+
layerLoading={this.state.layerLoading}
|
|
310
316
|
hotspotData={this.state.hotspotData}
|
|
311
317
|
hotspotDataHandler={this.hotspotDataHandler}
|
|
312
318
|
/>
|
|
@@ -364,7 +370,7 @@ class MapViewer extends React.Component {
|
|
|
364
370
|
<HotspotWidget
|
|
365
371
|
view={this.view}
|
|
366
372
|
map={this.map}
|
|
367
|
-
selectedLayers={this.layers}
|
|
373
|
+
selectedLayers={this.state.layers}
|
|
368
374
|
mapViewer={this}
|
|
369
375
|
layers={sessionStorage}
|
|
370
376
|
mapCfg={this.mapCfg}
|
|
@@ -372,6 +378,7 @@ class MapViewer extends React.Component {
|
|
|
372
378
|
loadingHandler={this.loadingHandler}
|
|
373
379
|
hotspotData={this.state.hotspotData}
|
|
374
380
|
hotspotDataHandler={this.hotspotDataHandler}
|
|
381
|
+
mapLayersHandler={this.mapLayersHandler}
|
|
375
382
|
/>
|
|
376
383
|
);
|
|
377
384
|
}
|
|
@@ -388,12 +395,13 @@ class MapViewer extends React.Component {
|
|
|
388
395
|
mapViewer={this}
|
|
389
396
|
updateArea={this.updateArea}
|
|
390
397
|
area={this.state.area}
|
|
391
|
-
layers={this.layers}
|
|
398
|
+
layers={this.state.layers}
|
|
392
399
|
activeLayersHandler={this.activeLayersHandler}
|
|
393
400
|
urls={this.cfgUrls}
|
|
394
401
|
loadingHandler={this.loadingHandler}
|
|
395
402
|
hotspotDataHandler={this.hotspotDataHandler}
|
|
396
403
|
hotspotData={this.state.hotspotData}
|
|
404
|
+
mapLayersHandler={this.mapLayersHandler}
|
|
397
405
|
/>
|
|
398
406
|
); //call conf
|
|
399
407
|
}
|
|
@@ -253,6 +253,7 @@ class MenuWidget extends React.Component {
|
|
|
253
253
|
noServiceModal: true,
|
|
254
254
|
setNoServiceModal: true,
|
|
255
255
|
TMSLayerObj: null,
|
|
256
|
+
draggedElements: [],
|
|
256
257
|
};
|
|
257
258
|
this.menuClass =
|
|
258
259
|
'esri-icon-drag-horizontal esri-widget--button esri-widget esri-interactive';
|
|
@@ -263,6 +264,8 @@ class MenuWidget extends React.Component {
|
|
|
263
264
|
this.xml = null;
|
|
264
265
|
this.dataBBox = null;
|
|
265
266
|
this.extentInitiated = false;
|
|
267
|
+
this.hotspotLayerIds = [];
|
|
268
|
+
this.getHotspotLayerIds = this.getHotspotLayerIds.bind(this);
|
|
266
269
|
this.prepareHotspotLayers = this.prepareHotspotLayers.bind(this);
|
|
267
270
|
this.activeLayersToHotspotData = this.activeLayersToHotspotData.bind(this);
|
|
268
271
|
this.getLimitScale = this.getLimitScale.bind(this);
|
|
@@ -323,8 +326,8 @@ class MenuWidget extends React.Component {
|
|
|
323
326
|
}
|
|
324
327
|
}
|
|
325
328
|
if (!this.visibleLayers) this.visibleLayers = {};
|
|
326
|
-
this.
|
|
327
|
-
|
|
329
|
+
this.handleRasterVectorLegend();
|
|
330
|
+
this.setState({});
|
|
328
331
|
}
|
|
329
332
|
});
|
|
330
333
|
|
|
@@ -631,7 +634,6 @@ class MenuWidget extends React.Component {
|
|
|
631
634
|
bubbles: true,
|
|
632
635
|
cancelable: false,
|
|
633
636
|
});
|
|
634
|
-
// let el = document.getElementById('active_label');
|
|
635
637
|
let el = document.getElementById('download_label');
|
|
636
638
|
el.dispatchEvent(event);
|
|
637
639
|
}
|
|
@@ -647,6 +649,7 @@ class MenuWidget extends React.Component {
|
|
|
647
649
|
await this.loader();
|
|
648
650
|
await this.getTMSLayersJSON();
|
|
649
651
|
this.prepareHotspotLayers();
|
|
652
|
+
this.getHotspotLayerIds();
|
|
650
653
|
this.props.view.ui.add(this.container.current, 'top-left');
|
|
651
654
|
if (this.props.download) {
|
|
652
655
|
setTimeout(() => {
|
|
@@ -977,8 +980,8 @@ class MenuWidget extends React.Component {
|
|
|
977
980
|
<Popup
|
|
978
981
|
trigger={
|
|
979
982
|
product.ProductId ===
|
|
980
|
-
|
|
981
|
-
product.ProductTitle === 'Snow and Ice Parameters' ? (
|
|
983
|
+
'8474c3b080fa42cc837f1d2338fcf096' /*||
|
|
984
|
+
product.ProductTitle === 'Snow and Ice Parameters' */ ? (
|
|
982
985
|
<div className="zoom-in-message-container">
|
|
983
986
|
<span>{product.ProductTitle}</span>
|
|
984
987
|
<div
|
|
@@ -998,9 +1001,9 @@ class MenuWidget extends React.Component {
|
|
|
998
1001
|
style={{ transform: 'translateX(-4rem)' }}
|
|
999
1002
|
/>
|
|
1000
1003
|
) : product.ProductId ===
|
|
1001
|
-
|
|
1004
|
+
'8474c3b080fa42cc837f1d2338fcf096' /*||
|
|
1002
1005
|
product.ProductTitle ===
|
|
1003
|
-
'High Resolution Snow and Ice Parameters' ? (
|
|
1006
|
+
'High Resolution Snow and Ice Parameters' */ ? (
|
|
1004
1007
|
<div className="zoom-in-message-container">
|
|
1005
1008
|
<span>{product.ProductTitle}</span>
|
|
1006
1009
|
<div className="zoom-in-message">
|
|
@@ -1245,6 +1248,14 @@ class MenuWidget extends React.Component {
|
|
|
1245
1248
|
Zoom in to view on map
|
|
1246
1249
|
</div>
|
|
1247
1250
|
</div>
|
|
1251
|
+
) : dataset.productId ===
|
|
1252
|
+
'd764e020485a402598551fa461bf1db2' ? (
|
|
1253
|
+
<div className="hotspot-filter-message-container">
|
|
1254
|
+
<span>{dataset.DatasetTitle}</span>
|
|
1255
|
+
<div className="hotspot-filter-message hotspot-filter-message-dataset">
|
|
1256
|
+
Use the filter to visualize a KLC area
|
|
1257
|
+
</div>
|
|
1258
|
+
</div>
|
|
1248
1259
|
) : (
|
|
1249
1260
|
<span>{dataset.DatasetTitle}</span>
|
|
1250
1261
|
)
|
|
@@ -1262,6 +1273,14 @@ class MenuWidget extends React.Component {
|
|
|
1262
1273
|
Zoom in to view on map
|
|
1263
1274
|
</div>
|
|
1264
1275
|
</div>
|
|
1276
|
+
) : dataset.productId ===
|
|
1277
|
+
'd764e020485a402598551fa461bf1db2' ? (
|
|
1278
|
+
<div className="hotspot-filter-message-container">
|
|
1279
|
+
<span>{dataset.DatasetTitle}</span>
|
|
1280
|
+
<div className="hotspot-filter-message hotspot-filter-message-dataset">
|
|
1281
|
+
Use the filter to visualize a KLC area
|
|
1282
|
+
</div>
|
|
1283
|
+
</div>
|
|
1265
1284
|
) : (
|
|
1266
1285
|
<span>{dataset.DatasetTitle}</span>
|
|
1267
1286
|
)}
|
|
@@ -1401,7 +1420,6 @@ class MenuWidget extends React.Component {
|
|
|
1401
1420
|
url: viewService,
|
|
1402
1421
|
featureInfoFormat: 'text/html',
|
|
1403
1422
|
featureInfoUrl: viewService,
|
|
1404
|
-
//id: layer.LayerId,
|
|
1405
1423
|
title: '',
|
|
1406
1424
|
legendEnabled: true,
|
|
1407
1425
|
sublayers: [
|
|
@@ -1691,16 +1709,6 @@ class MenuWidget extends React.Component {
|
|
|
1691
1709
|
}
|
|
1692
1710
|
}
|
|
1693
1711
|
if (productContainerId === 'd764e020485a402598551fa461bf1db2') {
|
|
1694
|
-
// if (this.layers['lc_filter'] || this.layers['lcc_filter']) {
|
|
1695
|
-
// let myExtent = new Extent({
|
|
1696
|
-
// xmin: -2037508.342789,
|
|
1697
|
-
// ymin: -2037508.342789,
|
|
1698
|
-
// xmax: 8037508.342789,
|
|
1699
|
-
// ymax: 8037508.342789,
|
|
1700
|
-
// spatialReference: 3857, // by default wkid 4326
|
|
1701
|
-
// });
|
|
1702
|
-
// this.view.goTo(myExtent);
|
|
1703
|
-
// }
|
|
1704
1712
|
if (nextElemSibling) {
|
|
1705
1713
|
siblingInput = nextElemSibling.querySelector('input');
|
|
1706
1714
|
} else if (previousElemSibling) {
|
|
@@ -1807,6 +1815,7 @@ class MenuWidget extends React.Component {
|
|
|
1807
1815
|
}
|
|
1808
1816
|
|
|
1809
1817
|
async toggleLayer(elem) {
|
|
1818
|
+
if (this.layers[elem.id] === undefined) return;
|
|
1810
1819
|
if (!this.visibleLayers) this.visibleLayers = {};
|
|
1811
1820
|
if (!this.timeLayers) this.timeLayers = {};
|
|
1812
1821
|
let parentId = elem.getAttribute('parentid');
|
|
@@ -1814,9 +1823,10 @@ class MenuWidget extends React.Component {
|
|
|
1814
1823
|
.getElementById(parentId)
|
|
1815
1824
|
.closest('.map-menu-product-dropdown')
|
|
1816
1825
|
.getAttribute('productid');
|
|
1826
|
+
|
|
1817
1827
|
let group = this.getGroup(elem);
|
|
1818
1828
|
if (elem.checked) {
|
|
1819
|
-
this.props.loadingHandler(true);
|
|
1829
|
+
//this.props.loadingHandler(true);
|
|
1820
1830
|
if (
|
|
1821
1831
|
this.props.download ||
|
|
1822
1832
|
this.location.search.includes('product=') ||
|
|
@@ -1833,20 +1843,25 @@ class MenuWidget extends React.Component {
|
|
|
1833
1843
|
}
|
|
1834
1844
|
}
|
|
1835
1845
|
if (this.layers['lc_filter'] || this.layers['lcc_filter']) {
|
|
1836
|
-
if (
|
|
1846
|
+
if (
|
|
1847
|
+
elem.id.includes('cop_klc') &&
|
|
1848
|
+
this.layers['klc_filter'] !== undefined
|
|
1849
|
+
) {
|
|
1837
1850
|
this.layers['klc_filter'].visible = true;
|
|
1838
1851
|
this.map.add(this.layers['klc_filter']);
|
|
1839
|
-
} else if (
|
|
1852
|
+
} else if (
|
|
1853
|
+
elem.id.includes('protected_areas') &&
|
|
1854
|
+
this.layers['pa_filter'] !== undefined
|
|
1855
|
+
) {
|
|
1840
1856
|
this.layers['pa_filter'].visible = true;
|
|
1841
1857
|
this.map.add(this.layers['pa_filter']);
|
|
1842
1858
|
} else {
|
|
1843
1859
|
this.map.add(this.layers[elem.id]);
|
|
1844
1860
|
}
|
|
1845
1861
|
} else {
|
|
1862
|
+
this.layers[elem.id].visible = true; //layer id
|
|
1846
1863
|
this.map.add(this.layers[elem.id]);
|
|
1847
1864
|
}
|
|
1848
|
-
if (this.layers[elem.id] === undefined) return;
|
|
1849
|
-
this.layers[elem.id].visible = true; //layer id
|
|
1850
1865
|
this.visibleLayers[elem.id] = ['fas', 'eye'];
|
|
1851
1866
|
this.timeLayers[elem.id] = ['far', 'clock'];
|
|
1852
1867
|
if (group) {
|
|
@@ -1872,36 +1887,20 @@ class MenuWidget extends React.Component {
|
|
|
1872
1887
|
if (nuts) {
|
|
1873
1888
|
this.map.reorder(nuts, this.map.layers.items.length + 1);
|
|
1874
1889
|
}
|
|
1875
|
-
this.props.view
|
|
1876
|
-
.whenLayerView(this.layers[elem.id])
|
|
1877
|
-
.then((layerView) => {
|
|
1878
|
-
layerView.watch('updating', (isUpdating) => {
|
|
1879
|
-
if (!isUpdating) {
|
|
1880
|
-
this.props.loadingHandler(false);
|
|
1881
|
-
} else {
|
|
1882
|
-
}
|
|
1883
|
-
});
|
|
1884
|
-
})
|
|
1885
|
-
.catch((error) => {
|
|
1886
|
-
let newHotspotData = this.props.hotspotData;
|
|
1887
|
-
let LayerId = elem.id.replace(/\d+\D*/g, '').slice(0, -1);
|
|
1888
|
-
let errObj = {};
|
|
1889
|
-
errObj[LayerId] = error;
|
|
1890
|
-
newHotspotData['layerViewError'] = errObj;
|
|
1891
|
-
this.props.hotspotDataHandler(newHotspotData);
|
|
1892
|
-
this.props.loadingHandler(false);
|
|
1893
|
-
});
|
|
1894
1890
|
this.checkForHotspots(elem, productContainerId);
|
|
1895
1891
|
} else {
|
|
1896
1892
|
sessionStorage.removeItem('downloadButtonClicked');
|
|
1897
1893
|
sessionStorage.removeItem('timeSliderTag');
|
|
1898
1894
|
this.deleteCheckedLayer(elem.id);
|
|
1899
|
-
this.deleteFilteredLayer(elem.id);
|
|
1900
1895
|
this.layers[elem.id].opacity = 1;
|
|
1901
1896
|
this.layers[elem.id].visible = false;
|
|
1897
|
+
this.deleteFilteredLayer(elem.id);
|
|
1902
1898
|
let mapLayer = this.map.findLayerById(elem.id);
|
|
1903
|
-
if (mapLayer)
|
|
1904
|
-
|
|
1899
|
+
if (mapLayer) {
|
|
1900
|
+
mapLayer.clear();
|
|
1901
|
+
mapLayer.destroy();
|
|
1902
|
+
this.map.remove(this.layers[elem.id]);
|
|
1903
|
+
}
|
|
1905
1904
|
delete this.activeLayersJSON[elem.id];
|
|
1906
1905
|
delete this.visibleLayers[elem.id];
|
|
1907
1906
|
delete this.timeLayers[elem.id];
|
|
@@ -1917,24 +1916,26 @@ class MenuWidget extends React.Component {
|
|
|
1917
1916
|
this.toggleCustomLegendItem(this.layers[elem.id]);
|
|
1918
1917
|
}
|
|
1919
1918
|
this.activeLayersToHotspotData(elem.id);
|
|
1920
|
-
// update DOM
|
|
1921
|
-
//this.setState({});
|
|
1922
1919
|
}
|
|
1923
1920
|
|
|
1924
|
-
|
|
1925
|
-
let layer = Object.entries(this.layers).find(
|
|
1926
|
-
([key, value]) => key === layerId,
|
|
1927
|
-
)?.[1];
|
|
1921
|
+
getHotspotLayerIds() {
|
|
1928
1922
|
let hotspotLayersIds = [];
|
|
1929
|
-
let updatedActiveLayers = this.props.hotspotData['activeLayers'] || {};
|
|
1930
|
-
let newHotspotData = this.props.hotspotData;
|
|
1931
|
-
|
|
1932
1923
|
Object.keys(this.props.hotspotData).forEach((key) => {
|
|
1933
1924
|
let dataset = this.props.hotspotData[key];
|
|
1934
1925
|
Object.keys(dataset).forEach((layerKey) => {
|
|
1935
1926
|
hotspotLayersIds.push(layerKey);
|
|
1936
1927
|
});
|
|
1937
1928
|
});
|
|
1929
|
+
this.hotspotLayersIds = hotspotLayersIds;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
activeLayersToHotspotData(layerId) {
|
|
1933
|
+
let layer = Object.entries(this.layers).find(
|
|
1934
|
+
([key, value]) => key === layerId,
|
|
1935
|
+
)?.[1];
|
|
1936
|
+
let hotspotLayersIds = this.hotspotLayersIds;
|
|
1937
|
+
let updatedActiveLayers = this.props.hotspotData['activeLayers'] || {};
|
|
1938
|
+
let newHotspotData = this.props.hotspotData;
|
|
1938
1939
|
|
|
1939
1940
|
for (let i = 0; i < hotspotLayersIds.length; i++) {
|
|
1940
1941
|
const id = hotspotLayersIds[i];
|
|
@@ -2141,16 +2142,24 @@ class MenuWidget extends React.Component {
|
|
|
2141
2142
|
if (!activeLayersArray.length) {
|
|
2142
2143
|
messageLayers && (messageLayers.style.display = 'block');
|
|
2143
2144
|
} else messageLayers && (messageLayers.style.display = 'none');
|
|
2144
|
-
let
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2145
|
+
let data = activeLayersArray.sort((a, b) => {
|
|
2146
|
+
let layerIdA = a.props['layer-id'];
|
|
2147
|
+
let layerIdB = b.props['layer-id'];
|
|
2148
|
+
layerIdA = layerIdA.split('_').slice(-4).join('_');
|
|
2149
|
+
layerIdB = layerIdB.split('_').slice(-4).join('_');
|
|
2150
|
+
|
|
2151
|
+
if (
|
|
2152
|
+
this.state.draggedElements !== undefined &&
|
|
2153
|
+
(this.state.draggedElements.includes(layerIdA) ||
|
|
2154
|
+
this.state.draggedElements.includes(layerIdB))
|
|
2155
|
+
) {
|
|
2156
|
+
return 0;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
if (layerIdA < layerIdB) return -1;
|
|
2160
|
+
if (layerIdA > layerIdB) return 1;
|
|
2161
|
+
return 0;
|
|
2148
2162
|
});
|
|
2149
|
-
let data = activeLayersArray.sort(
|
|
2150
|
-
(a, b) =>
|
|
2151
|
-
activeLayers.indexOf(a.props['layer-id']) -
|
|
2152
|
-
activeLayers.indexOf(b.props['layer-id']),
|
|
2153
|
-
);
|
|
2154
2163
|
this.activeLayersHandler(activeLayersArray);
|
|
2155
2164
|
return data;
|
|
2156
2165
|
}
|
|
@@ -2731,7 +2740,7 @@ class MenuWidget extends React.Component {
|
|
|
2731
2740
|
onDrop(e) {
|
|
2732
2741
|
let dst = e.target.closest('div.active-layer');
|
|
2733
2742
|
if (dst === this.draggingElement) return;
|
|
2734
|
-
|
|
2743
|
+
let id = dst.id.split('_').slice(-4).join('_');
|
|
2735
2744
|
//First, we decide how to insert the element in the DOM
|
|
2736
2745
|
let init_ord = this.draggingElement.getAttribute('layer-order');
|
|
2737
2746
|
let dst_ord = dst.getAttribute('layer-order');
|
|
@@ -2742,6 +2751,9 @@ class MenuWidget extends React.Component {
|
|
|
2742
2751
|
dst.parentElement.insertBefore(this.draggingElement, dst);
|
|
2743
2752
|
}
|
|
2744
2753
|
|
|
2754
|
+
if (!this.state.draggedElements.includes(id)) {
|
|
2755
|
+
this.setState({ draggedElements: [...this.state.draggedElements, id] });
|
|
2756
|
+
}
|
|
2745
2757
|
this.layersReorder();
|
|
2746
2758
|
this.saveLayerOrder();
|
|
2747
2759
|
}
|
|
@@ -3378,16 +3390,72 @@ class MenuWidget extends React.Component {
|
|
|
3378
3390
|
}
|
|
3379
3391
|
|
|
3380
3392
|
deleteFilteredLayer(layer) {
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3393
|
+
if (
|
|
3394
|
+
!(
|
|
3395
|
+
layer.includes('all_lcc') ||
|
|
3396
|
+
layer.includes('all_present') ||
|
|
3397
|
+
layer.includes('cop_klc') ||
|
|
3398
|
+
layer.includes('protected_areas')
|
|
3399
|
+
)
|
|
3400
|
+
)
|
|
3401
|
+
return;
|
|
3402
|
+
let filterLayer;
|
|
3403
|
+
//let temp;
|
|
3404
|
+
let updatedHotspotData = this.props.hotspotData;
|
|
3405
|
+
let updatedFilteredLayers = this.props.hotspotData['filteredLayers'];
|
|
3406
|
+
if (this.layers['lcc_filter'] && layer.includes('all_lcc')) {
|
|
3407
|
+
this.layers['lcc_filter'].visible = false;
|
|
3408
|
+
filterLayer = this.props.map.findLayerById('lcc_filter');
|
|
3409
|
+
if (filterLayer !== undefined) {
|
|
3410
|
+
filterLayer.clear();
|
|
3411
|
+
filterLayer.destroy();
|
|
3412
|
+
this.props.map.remove(filterLayer);
|
|
3413
|
+
}
|
|
3414
|
+
delete updatedFilteredLayers['lcc_filter'];
|
|
3415
|
+
delete this.layers['lcc_filter'];
|
|
3416
|
+
} else if (this.layers['lc_filter'] && layer.includes('all_present_lc')) {
|
|
3417
|
+
this.layers['lc_filter'].visible = false;
|
|
3418
|
+
filterLayer = this.props.map.findLayerById('lc_filter');
|
|
3419
|
+
if (filterLayer !== undefined) {
|
|
3420
|
+
filterLayer.clear();
|
|
3421
|
+
filterLayer.destroy();
|
|
3422
|
+
this.props.map.remove(filterLayer);
|
|
3423
|
+
}
|
|
3424
|
+
delete updatedFilteredLayers['lc_filter'];
|
|
3425
|
+
delete this.layers['lc_filter'];
|
|
3426
|
+
} else if (
|
|
3427
|
+
this.layers['klc_filter'] !== undefined &&
|
|
3428
|
+
layer.includes('cop_klc')
|
|
3429
|
+
) {
|
|
3430
|
+
this.layers['klc_filter'].visible = false;
|
|
3431
|
+
this.layers[layer].visible = false;
|
|
3432
|
+
filterLayer = this.props.map.findLayerById('klc_filter');
|
|
3433
|
+
if (filterLayer !== undefined) {
|
|
3434
|
+
// temp = filterLayer;
|
|
3435
|
+
filterLayer.clear();
|
|
3436
|
+
filterLayer.destroy();
|
|
3437
|
+
this.props.map.remove(filterLayer);
|
|
3438
|
+
}
|
|
3439
|
+
delete updatedFilteredLayers['klc_filter'];
|
|
3440
|
+
//delete this.layers['klc_filter'];
|
|
3441
|
+
} else if (
|
|
3442
|
+
this.layers['pa_filter'] !== undefined &&
|
|
3443
|
+
layer.includes('protected_areas')
|
|
3444
|
+
) {
|
|
3445
|
+
this.layers['pa_filter'].visible = false;
|
|
3446
|
+
this.layers[layer].visible = false;
|
|
3447
|
+
filterLayer = this.props.map.findLayerById('pa_filter');
|
|
3448
|
+
if (filterLayer !== undefined) {
|
|
3449
|
+
// temp = filterLayer;
|
|
3450
|
+
filterLayer.clear();
|
|
3451
|
+
filterLayer.destroy();
|
|
3452
|
+
this.props.map.remove(filterLayer);
|
|
3453
|
+
}
|
|
3454
|
+
delete updatedFilteredLayers['pa_filter'];
|
|
3455
|
+
}
|
|
3456
|
+
this.props.mapLayersHandler(this.layers);
|
|
3457
|
+
updatedHotspotData['filteredLayers'] = updatedFilteredLayers;
|
|
3458
|
+
this.props.hotspotDataHandler(updatedHotspotData);
|
|
3391
3459
|
}
|
|
3392
3460
|
|
|
3393
3461
|
/**
|
|
@@ -1244,7 +1244,14 @@ input[type='range']::-ms-track {
|
|
|
1244
1244
|
box-shadow: none;
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
|
-
.
|
|
1247
|
+
.hotspot-filter-message-container,
|
|
1248
|
+
.hotspot-filter-message,
|
|
1249
|
+
.hotspot-filter-message-dataset {
|
|
1250
|
+
display: block;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
.zoom-in-message,
|
|
1254
|
+
.hotspot-filter-message {
|
|
1248
1255
|
padding: 0.1rem 0.6rem 0.1rem 0.6rem;
|
|
1249
1256
|
margin-top: 0.2rem;
|
|
1250
1257
|
background: #a0b128;
|