@eeacms/volto-arcgis-block 0.1.195 → 0.1.197
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 +15 -0
- package/package.json +1 -1
- package/src/components/MapViewer/HotspotWidget.jsx +11 -13
- package/src/components/MapViewer/LegendWidget.jsx +67 -22
- package/src/components/MapViewer/MenuWidget.jsx +39 -0
- package/src/components/MapViewer/TimesliderWidget.jsx +3 -0
- package/src/components/MapViewer/config.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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.197](https://github.com/eea/volto-arcgis-block/compare/0.1.196...0.1.197) - 14 September 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- conflicts resolved and merge completed [ujbolivar - [`2220061`](https://github.com/eea/volto-arcgis-block/commit/22200614ff032783c8b4cb6976d509da5c2f03bc)]
|
|
12
|
+
- CLMS-2279-2445-2339 (fix): latest updates to legend functions and presentation [ujbolivar - [`8ceea25`](https://github.com/eea/volto-arcgis-block/commit/8ceea25709ac494d28807beacbc2474e8a823269)]
|
|
13
|
+
- CLMS-LEGEND-BUGS latest changes [ujbolivar - [`a90c253`](https://github.com/eea/volto-arcgis-block/commit/a90c253d96af7c6757ecf83d5e58e482be799b18)]
|
|
14
|
+
- Lint [masanchez85 - [`1ea1a7f`](https://github.com/eea/volto-arcgis-block/commit/1ea1a7fdda47593fe73dbc12656d8dedd781aa47)]
|
|
15
|
+
- CLMS-2279, 1952 [masanchez85 - [`dcc3359`](https://github.com/eea/volto-arcgis-block/commit/dcc3359a3ee7344ffd0f02fc35257f59178d911e)]
|
|
16
|
+
### [0.1.196](https://github.com/eea/volto-arcgis-block/compare/0.1.195...0.1.196) - 14 September 2023
|
|
17
|
+
|
|
18
|
+
#### :hammer_and_wrench: Others
|
|
19
|
+
|
|
20
|
+
- Lint [masanchez85 - [`c6d79ad`](https://github.com/eea/volto-arcgis-block/commit/c6d79ad1b6d19cb5a43112f9ced774519b441c8c)]
|
|
21
|
+
- CLMS-2279, 1952 [masanchez85 - [`e5b42da`](https://github.com/eea/volto-arcgis-block/commit/e5b42daca404a70aa327018db260b59fcd37fb21)]
|
|
7
22
|
### [0.1.195](https://github.com/eea/volto-arcgis-block/compare/0.1.194...0.1.195) - 14 September 2023
|
|
8
23
|
|
|
9
24
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -181,9 +181,8 @@ class HotspotWidget extends React.Component {
|
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
handleApplyFilter(typeFilter) {
|
|
184
|
+
async handleApplyFilter(typeFilter) {
|
|
185
185
|
let typeLegend;
|
|
186
|
-
let filterId;
|
|
187
186
|
|
|
188
187
|
this.props.loadingHandler(true);
|
|
189
188
|
|
|
@@ -359,17 +358,16 @@ class HotspotWidget extends React.Component {
|
|
|
359
358
|
//set sessionStorage value to keep the widget open
|
|
360
359
|
sessionStorage.setItem('hotspotFilterApplied', 'true');
|
|
361
360
|
this.disableButton();
|
|
362
|
-
this.props.view
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
});
|
|
361
|
+
const layerView = await this.props.view.whenLayerView(
|
|
362
|
+
this.props.selectedLayers[typeFilter[0] + '_filter'],
|
|
363
|
+
);
|
|
364
|
+
layerView.watch('updating', (isUpdating) => {
|
|
365
|
+
if (!isUpdating) {
|
|
366
|
+
setTimeout(() => {
|
|
367
|
+
this.props.loadingHandler(false);
|
|
368
|
+
}, 1000);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
373
371
|
}
|
|
374
372
|
|
|
375
373
|
dropdownAnimation() {
|
|
@@ -17,6 +17,7 @@ class LegendWidget extends React.Component {
|
|
|
17
17
|
//not be showing the basemap panel
|
|
18
18
|
this.state = {
|
|
19
19
|
showMapMenu: false,
|
|
20
|
+
loading: false,
|
|
20
21
|
};
|
|
21
22
|
this.mapViewer = this.props.mapViewer;
|
|
22
23
|
this.menuClass =
|
|
@@ -46,7 +47,6 @@ class LegendWidget extends React.Component {
|
|
|
46
47
|
|
|
47
48
|
brokenLegendImagePatch() {
|
|
48
49
|
const collection = document.getElementsByClassName('esri-legend__symbol');
|
|
49
|
-
|
|
50
50
|
Array.prototype.forEach.call(collection, (element) => {
|
|
51
51
|
let img = {};
|
|
52
52
|
|
|
@@ -58,29 +58,59 @@ class LegendWidget extends React.Component {
|
|
|
58
58
|
if (img?.src?.includes('all_present_lc_a_pol')) {
|
|
59
59
|
img.src = this.urls.all_present_lc_a_pol;
|
|
60
60
|
|
|
61
|
-
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.
|
|
62
|
-
'
|
|
61
|
+
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
62
|
+
'Dichotomous Present Land Cover in selected hot spots';
|
|
63
63
|
return;
|
|
64
64
|
} else if (img?.src?.includes('all_present_lc_b_pol')) {
|
|
65
|
-
img.src =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
//img.src ='none';
|
|
66
|
+
const legends = document.getElementsByClassName(
|
|
67
|
+
'esri-legend__service',
|
|
68
|
+
);
|
|
69
|
+
for (let i = 0; i < legends.length; i++) {
|
|
70
|
+
const legend = legends[i];
|
|
71
|
+
//find the legend that contains a broken img
|
|
72
|
+
if (
|
|
73
|
+
legend.querySelector('img')?.src?.includes('all_present_lc_b_pol')
|
|
74
|
+
) {
|
|
75
|
+
const img = legend.querySelector('img');
|
|
76
|
+
//set this legend to display none
|
|
77
|
+
if (!(img.complete && img.naturalHeight !== 0)) {
|
|
78
|
+
legend.style.display = 'none';
|
|
79
|
+
}
|
|
80
|
+
break; // break out of the loop after the first match
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/*img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
84
|
+
'Modular Present Land Cover in selected hot spots';*/
|
|
69
85
|
} else if (img?.src?.includes('all_lcc_a_pol')) {
|
|
70
86
|
img.src = this.urls.all_lcc_a_pol;
|
|
71
87
|
|
|
72
|
-
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.
|
|
73
|
-
'
|
|
88
|
+
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
89
|
+
'Dichotomous Land Cover Change in selected hot spots';
|
|
74
90
|
} else if (img?.src?.includes('all_lcc_b_pol')) {
|
|
75
|
-
img.src =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
//img.src ='none';
|
|
92
|
+
const legends = document.getElementsByClassName(
|
|
93
|
+
'esri-legend__service',
|
|
94
|
+
);
|
|
95
|
+
for (let i = 0; i < legends.length; i++) {
|
|
96
|
+
const legend = legends[i];
|
|
97
|
+
//find the legend that contains a broken img
|
|
98
|
+
if (legend.querySelector('img')?.src?.includes('all_lcc_b_pol')) {
|
|
99
|
+
const img = legend.querySelector('img');
|
|
100
|
+
//set this legend to display none
|
|
101
|
+
if (!(img.complete && img.naturalHeight !== 0)) {
|
|
102
|
+
legend.style.display = 'none';
|
|
103
|
+
}
|
|
104
|
+
break; // break out of the loop after the first match
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/*img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
108
|
+
'Modular Present Land Cover in selected hot spots';*/
|
|
79
109
|
} else if (img?.src?.includes('cop_klc')) {
|
|
80
110
|
img.src = this.urls.cop_klc;
|
|
81
111
|
|
|
82
|
-
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.
|
|
83
|
-
'
|
|
112
|
+
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.textContent =
|
|
113
|
+
'Key Landscapes for Conservation borders in selected hotspots';
|
|
84
114
|
} else if (img.style) {
|
|
85
115
|
img.parentNode.parentNode.parentNode.parentNode.firstElementChild.style.display =
|
|
86
116
|
'none';
|
|
@@ -141,6 +171,17 @@ class LegendWidget extends React.Component {
|
|
|
141
171
|
}
|
|
142
172
|
}
|
|
143
173
|
|
|
174
|
+
imageFixWithTimer() {
|
|
175
|
+
this.setState({ loading: true });
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
this.brokenLegendImagePatch();
|
|
178
|
+
if (this.props.download) {
|
|
179
|
+
this.hideNutsLegend();
|
|
180
|
+
}
|
|
181
|
+
this.setState({ loading: false });
|
|
182
|
+
}, 2000);
|
|
183
|
+
}
|
|
184
|
+
|
|
144
185
|
/**
|
|
145
186
|
* This method is executed after the rener method is executed
|
|
146
187
|
*/
|
|
@@ -155,12 +196,7 @@ class LegendWidget extends React.Component {
|
|
|
155
196
|
container: document.querySelector('.legend-panel'),
|
|
156
197
|
});
|
|
157
198
|
this.props.view.allLayerViews.watch('length', () => {
|
|
158
|
-
|
|
159
|
-
this.brokenLegendImagePatch();
|
|
160
|
-
if (this.props.download) {
|
|
161
|
-
this.hideNutsLegend();
|
|
162
|
-
}
|
|
163
|
-
}, 1000);
|
|
199
|
+
this.imageFixWithTimer();
|
|
164
200
|
});
|
|
165
201
|
}
|
|
166
202
|
|
|
@@ -195,7 +231,16 @@ class LegendWidget extends React.Component {
|
|
|
195
231
|
></span>
|
|
196
232
|
</div>
|
|
197
233
|
<div className="right-panel-content">
|
|
198
|
-
<
|
|
234
|
+
<span
|
|
235
|
+
className="loading"
|
|
236
|
+
style={{ display: this.state.loading ? 'block' : 'none' }}
|
|
237
|
+
>
|
|
238
|
+
Loading...
|
|
239
|
+
</span>
|
|
240
|
+
<div
|
|
241
|
+
className="legend-panel"
|
|
242
|
+
style={{ display: this.state.loading ? 'none' : 'block' }}
|
|
243
|
+
></div>
|
|
199
244
|
</div>
|
|
200
245
|
</div>
|
|
201
246
|
</div>
|
|
@@ -300,6 +300,8 @@ class MenuWidget extends React.Component {
|
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
+
if (!this.visibleLayers) this.visibleLayers = {};
|
|
304
|
+
this.handleRasterVectorLegend();
|
|
303
305
|
}
|
|
304
306
|
});
|
|
305
307
|
|
|
@@ -598,6 +600,7 @@ class MenuWidget extends React.Component {
|
|
|
598
600
|
this.showZoomMessageForDatasets();
|
|
599
601
|
this.loadOpacity();
|
|
600
602
|
this.loadVisibility();
|
|
603
|
+
this.handleRasterVectorLegend();
|
|
601
604
|
}
|
|
602
605
|
|
|
603
606
|
setSliderTag(val) {
|
|
@@ -1635,6 +1638,41 @@ class MenuWidget extends React.Component {
|
|
|
1635
1638
|
this.setState({});
|
|
1636
1639
|
}
|
|
1637
1640
|
|
|
1641
|
+
/**
|
|
1642
|
+
* Method to show/hide a legend if the layer is active or not in the view
|
|
1643
|
+
*/
|
|
1644
|
+
handleRasterVectorLegend() {
|
|
1645
|
+
let zoom = this.view.get('zoom');
|
|
1646
|
+
Object.keys(this.activeLayersJSON).forEach((key) => {
|
|
1647
|
+
let activeLayer = this.activeLayersJSON[key];
|
|
1648
|
+
let layerTitle = activeLayer.props.children[0].props.children;
|
|
1649
|
+
if (layerTitle.includes('raster')) {
|
|
1650
|
+
if (zoom <= 11) {
|
|
1651
|
+
if (
|
|
1652
|
+
this.visibleLayers &&
|
|
1653
|
+
this.visibleLayers[key] &&
|
|
1654
|
+
this.visibleLayers[key][1] === 'eye'
|
|
1655
|
+
)
|
|
1656
|
+
this.layers[key].visible = true;
|
|
1657
|
+
} else {
|
|
1658
|
+
this.layers[key].visible = false;
|
|
1659
|
+
}
|
|
1660
|
+
} else if (layerTitle.includes('vector')) {
|
|
1661
|
+
if (zoom >= 12) {
|
|
1662
|
+
if (
|
|
1663
|
+
this.visibleLayers &&
|
|
1664
|
+
this.visibleLayers[key] &&
|
|
1665
|
+
this.visibleLayers[key][1] === 'eye'
|
|
1666
|
+
)
|
|
1667
|
+
this.layers[key].visible = true;
|
|
1668
|
+
} else {
|
|
1669
|
+
this.layers[key].visible = false;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
this.setState({});
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1638
1676
|
async toggleLayer(elem) {
|
|
1639
1677
|
if (!this.visibleLayers) this.visibleLayers = {};
|
|
1640
1678
|
if (!this.timeLayers) this.timeLayers = {};
|
|
@@ -1694,6 +1732,7 @@ class MenuWidget extends React.Component {
|
|
|
1694
1732
|
elem,
|
|
1695
1733
|
Object.keys(this.activeLayersJSON).length,
|
|
1696
1734
|
);
|
|
1735
|
+
this.handleRasterVectorLegend();
|
|
1697
1736
|
} else {
|
|
1698
1737
|
this.activeLayersJSON[elem.id] = this.addActiveLayer(
|
|
1699
1738
|
elem,
|
|
@@ -192,11 +192,14 @@ class TimesliderWidget extends React.Component {
|
|
|
192
192
|
*/
|
|
193
193
|
async componentDidMount() {
|
|
194
194
|
await this.loader();
|
|
195
|
+
let playRateValue =
|
|
196
|
+
this.layer.ProductId === '8474c3b080fa42cc837f1d2338fcf096' ? 4000 : 1000;
|
|
195
197
|
this.TimesliderWidget = new TimeSlider({
|
|
196
198
|
view: this.props.view,
|
|
197
199
|
container: document.querySelector('.timeslider-panel'),
|
|
198
200
|
timeVisible: true,
|
|
199
201
|
mode: 'instant',
|
|
202
|
+
playRate: playRateValue,
|
|
200
203
|
loop: false,
|
|
201
204
|
labelFormatFunction: (value, type, element, layout) => {
|
|
202
205
|
if (!this.TimesliderWidget.fullTimeExtent) {
|
|
@@ -219,15 +219,15 @@ const config = {
|
|
|
219
219
|
outsideEu:
|
|
220
220
|
'https://land.discomap.eea.europa.eu/arcgis/rest/services/CLMS_Portal/World_countries_except_EU37/MapServer',
|
|
221
221
|
all_present_lc_a_pol:
|
|
222
|
-
'https://
|
|
222
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/wms?request=GetLegendGraphic&version=1.0.0&format=image/png&layer=all_present_lc_a_pol',
|
|
223
223
|
all_present_lc_b_pol:
|
|
224
|
-
'https://
|
|
224
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/wms?request=GetLegendGraphic&version=1.0.0&format=image/png&layer=all_present_lc_b_pol',
|
|
225
225
|
all_lcc_a_pol:
|
|
226
|
-
'https://
|
|
226
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/wms?request=GetLegendGraphic&version=1.0.0&format=image/png&layer=all_lcc_a_pol',
|
|
227
227
|
all_lcc_b_pol:
|
|
228
|
-
'https://
|
|
228
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/wms?request=GetLegendGraphic&version=1.0.0&format=image/png&layer=all_lcc_b_pol',
|
|
229
229
|
cop_klc:
|
|
230
|
-
'https://
|
|
230
|
+
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/wms?request=GetLegendGraphic&version=1.0.0&format=image/png&layer=cop_klc',
|
|
231
231
|
klc_bbox: 'https://land.copernicus.eu/global/hsm/php/klc_bbox.php',
|
|
232
232
|
legendLinkUrl:
|
|
233
233
|
'https://geospatial.jrc.ec.europa.eu/geoserver/hotspots/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=',
|