@eeacms/volto-arcgis-block 0.1.166 → 0.1.168

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 CHANGED
@@ -4,6 +4,18 @@ 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.168](https://github.com/eea/volto-arcgis-block/compare/0.1.167...0.1.168) - 6 July 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-2300 (fix): Preserve selected region in dropdown menu if layers are changed and region exists in both layers [ujbolivar - [`443d3a5`](https://github.com/eea/volto-arcgis-block/commit/443d3a53eb4958a2d5fd3e9dd3a8b938f0416f4f)]
12
+ ### [0.1.167](https://github.com/eea/volto-arcgis-block/compare/0.1.166...0.1.167) - 5 July 2023
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - LINT [manuelmartinezbilbomatica - [`0fd14f1`](https://github.com/eea/volto-arcgis-block/commit/0fd14f153088c272884939c73d7fc5b535ccf764)]
17
+ - LINT [manuelmartinezbilbomatica - [`725d36c`](https://github.com/eea/volto-arcgis-block/commit/725d36cce3fd03e0eecc5302f94d24a331096af7)]
18
+ - FIX: Full Extent to whole dataset working from Custom Mapviewer and General Mapviewer [manuelmartinezbilbomatica - [`0d90358`](https://github.com/eea/volto-arcgis-block/commit/0d903585e0b37311da39f5b80516ce5145801393)]
7
19
  ### [0.1.166](https://github.com/eea/volto-arcgis-block/compare/0.1.165...0.1.166) - 4 July 2023
8
20
 
9
21
  ### [0.1.165](https://github.com/eea/volto-arcgis-block/compare/0.1.164...0.1.165) - 4 July 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.166",
3
+ "version": "0.1.168",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -16,7 +16,6 @@ class HotspotWidget extends React.Component {
16
16
  //not be showing the basemap panel
17
17
  this.state = {
18
18
  showMapMenu: false,
19
- activeLayers: sessionStorage.checkedLayers,
20
19
  };
21
20
  this.menuClass =
22
21
  'esri-icon-filter esri-widget--button esri-widget esri-interactive';
@@ -30,7 +29,6 @@ class HotspotWidget extends React.Component {
30
29
  this.esriLayer_pa = null;
31
30
  this.esriLayer_pa2 = null;
32
31
  this.subscribedLayers = sessionStorage;
33
- this.checkedLayers = {};
34
32
  this.dataBBox = [];
35
33
  this.dataJSONNames = [];
36
34
  this.klcHighlightsArray = [];
@@ -186,8 +184,6 @@ class HotspotWidget extends React.Component {
186
184
  }
187
185
 
188
186
  handleApplyFilter(typeFilter) {
189
- let checkedLayers =
190
- JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
191
187
  let typeLegend;
192
188
 
193
189
  if (this.props.selectedLayers) {
@@ -250,7 +246,7 @@ class HotspotWidget extends React.Component {
250
246
  .getElementById('select-klc-lccTime')
251
247
  .value.match(/\d+/g)
252
248
  .map(Number)[0];
253
- checkedLayers.forEach((layer) => {
249
+ this.state.activeLayers.forEach((layer) => {
254
250
  layer.includes('all_lcc_a_pol')
255
251
  ? (typeLegend = 'all_lcc_a_pol')
256
252
  : (typeLegend = 'all_lcc_b_pol');
@@ -281,7 +277,7 @@ class HotspotWidget extends React.Component {
281
277
  }
282
278
  }
283
279
  if (type === 'lc') {
284
- checkedLayers.forEach((layer) => {
280
+ this.state.activeLayers.forEach((layer) => {
285
281
  layer.includes('all_present_lc_a_pol')
286
282
  ? (typeLegend = 'all_present_lc_a_pol')
287
283
  : (typeLegend = 'all_present_lc_b_pol');
@@ -437,9 +433,7 @@ class HotspotWidget extends React.Component {
437
433
  ) {
438
434
  typeFilter.push('lcc');
439
435
  }
440
- let checkedLayers =
441
- JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
442
- checkedLayers.forEach((layer) => {
436
+ this.state.activeLayers.forEach((layer) => {
443
437
  if (layer.match('cop_klc')) {
444
438
  typeFilter.push('klc');
445
439
  }
@@ -510,8 +504,6 @@ class HotspotWidget extends React.Component {
510
504
  var selectBoxLccTime;
511
505
  let modularKLCAreas = [];
512
506
  let dichotomousKLCAreas = [];
513
- let checkedLayers =
514
- JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
515
507
 
516
508
  selectBox = document.getElementById('select-klc-area');
517
509
  selectBoxLccTime = document.getElementById('select-klc-lccTime');
@@ -597,17 +589,16 @@ class HotspotWidget extends React.Component {
597
589
  );
598
590
  selectBox.options[0].disabled = true;
599
591
  }
600
- if (checkedLayers.length) {
601
- for (let a = 0; a < checkedLayers.length; a++) {
592
+ if (this.state.activeLayers.length) {
593
+ for (let a = 0; a < this.state.activeLayers.length; a++) {
602
594
  if (
603
- checkedLayers[a].includes('all_lcc_b_pol') ||
604
- checkedLayers[a].includes('all_present_lc_b_pol')
595
+ this.state.activeLayers[a].includes('all_lcc_b_pol') ||
596
+ this.state.activeLayers[a].includes('all_present_lc_b_pol')
605
597
  ) {
606
598
  for (let i = 0; i < modularKLCAreas.length; i++) {
607
599
  let option = modularKLCAreas[i];
608
600
  selectBox.options.add(new Option(option, option, option));
609
601
  }
610
- this.checkedLayers = checkedLayers;
611
602
  for (let u = 0; u < selectBox.options.length; u++) {
612
603
  if (selectBox.options[u].label.includes(this.selectedArea)) {
613
604
  selectBox.value = this.selectedArea;
@@ -627,14 +618,13 @@ class HotspotWidget extends React.Component {
627
618
  }
628
619
  break;
629
620
  } else if (
630
- checkedLayers[a].includes('all_lcc_a_pol') ||
631
- checkedLayers[a].includes('all_present_lc_a_pol')
621
+ this.state.activeLayers[a].includes('all_lcc_a_pol') ||
622
+ this.state.activeLayers[a].includes('all_present_lc_a_pol')
632
623
  ) {
633
624
  for (let i = 0; i < dichotomousKLCAreas.length; i++) {
634
625
  let option = dichotomousKLCAreas[i];
635
626
  selectBox.options.add(new Option(option, option, option));
636
627
  }
637
- this.checkedLayers = checkedLayers;
638
628
  for (let u = 0; u < selectBox.options.length; u++) {
639
629
  if (selectBox.options[u].label.includes(this.selectedArea)) {
640
630
  selectBox.value = this.selectedArea;
@@ -783,8 +773,6 @@ class HotspotWidget extends React.Component {
783
773
  * This method is executed after the rener method is executed
784
774
  */
785
775
  async componentDidMount() {
786
- this.checkedLayers =
787
- JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
788
776
  await this.getLayerParameters();
789
777
  await this.loader();
790
778
  this.props.view.ui.add(this.container.current, 'top-right');
@@ -794,14 +782,19 @@ class HotspotWidget extends React.Component {
794
782
  window.addEventListener('storage', this.handleStorageChange);
795
783
  }
796
784
 
785
+ componentDidUpdate(prevState) {
786
+ if (prevState.activeLayers !== this.state.activeLayers) {
787
+ this.getKLCNames(this.dataJSONNames, this.selectedArea);
788
+ }
789
+ }
790
+
797
791
  componentWillUnmount() {
798
792
  // Remove the event listener when the component is unmounted
799
793
  window.removeEventListener('storage', this.handleStorageChange);
800
794
  }
801
795
 
802
796
  handleStorageChange = () => {
803
- this.checkedLayers =
804
- JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
797
+ this.setState({ activeLayers: JSON.parse(sessionStorage.checkedLayers) });
805
798
  this.forceUpdate();
806
799
  };
807
800
  }
@@ -1669,11 +1669,11 @@ class MenuWidget extends React.Component {
1669
1669
  if (this.props.download || this.location.search !== '') {
1670
1670
  if (
1671
1671
  this.extentInitiated === false &&
1672
- productContainerId !== 'd764e020485a402598551fa461bf1db2' //hotspot
1672
+ productContainerId !== 'd764e020485a402598551fa461bf1db2' // hotspot
1673
1673
  ) {
1674
1674
  this.extentInitiated = true;
1675
1675
  setTimeout(() => {
1676
- this.fullExtent(elem);
1676
+ this.FullExtentDataset(elem);
1677
1677
  }, 2000);
1678
1678
  }
1679
1679
  }
@@ -2260,6 +2260,27 @@ class MenuWidget extends React.Component {
2260
2260
  })
2261
2261
  .catch(() => {});
2262
2262
  };
2263
+
2264
+ async FullExtentDataset(elem) {
2265
+ let BBoxes = {};
2266
+ this.findCheckedDataset(elem);
2267
+ if (this.url.toLowerCase().includes('wms')) {
2268
+ await this.getCapabilities(this.url, 'wms');
2269
+ BBoxes = this.parseBBOXWMS(this.xml);
2270
+ } else if (this.url.toLowerCase().includes('wmts')) {
2271
+ await this.getCapabilities(this.url, 'wmts');
2272
+ BBoxes = this.parseBBOXWMTS(this.xml);
2273
+ }
2274
+ let myExtent = new Extent({
2275
+ xmin: BBoxes['dataset'].xmin,
2276
+ ymin: BBoxes['dataset'].ymin,
2277
+ xmax: BBoxes['dataset'].xmax,
2278
+ ymax: BBoxes['dataset'].ymax,
2279
+ // spatialReference: 4326 // by default wkid 4326
2280
+ });
2281
+ this.view.goTo(myExtent); //
2282
+ }
2283
+
2263
2284
  async fullExtent(elem) {
2264
2285
  this.findCheckedDataset(elem);
2265
2286
  let BBoxes = {};
@@ -2294,7 +2315,6 @@ class MenuWidget extends React.Component {
2294
2315
  BBoxes = this.parseBBOXWMS(this.xml);
2295
2316
  } else if (this.url.toLowerCase().includes('wmts')) {
2296
2317
  await this.getCapabilities(this.url, 'wmts');
2297
-
2298
2318
  BBoxes = this.parseBBOXWMTS(this.xml);
2299
2319
  }
2300
2320
  if (
@@ -2308,11 +2328,8 @@ class MenuWidget extends React.Component {
2308
2328
  !this.productId.includes('333e4100b79045daa0ff16466ac83b7f') &&
2309
2329
  this.location.search !== ''
2310
2330
  ) {
2311
- // firstLayer = BBoxes['dataset'];
2312
2331
  firstLayer = BBoxes.dataset;
2313
2332
  } else if (this.productId.includes('130299ac96e54c30a12edd575eff80f7')) {
2314
- //corine land cover
2315
- //
2316
2333
  if (elem.title.includes('LAEA')) {
2317
2334
  firstLayer = BBoxes['dataset'];
2318
2335
  } else if (elem.title.includes('Guadeloupe')) {
@@ -2326,7 +2343,6 @@ class MenuWidget extends React.Component {
2326
2343
  } else if (elem.title.includes('Reunion')) {
2327
2344
  firstLayer = BBoxes[Object.keys(BBoxes)[4]];
2328
2345
  } else {
2329
- // firstLayer = BBoxes[Object.keys(BBoxes)[Object.keys(BBoxes).length - 1]];
2330
2346
  firstLayer = BBoxes['dataset'];
2331
2347
  }
2332
2348
  } else if (
@@ -2339,7 +2355,6 @@ class MenuWidget extends React.Component {
2339
2355
  } else {
2340
2356
  // Takes the BBOX corresponding to the layer.
2341
2357
  firstLayer = BBoxes[elem.attributes.layerid.value];
2342
- // firstLayer = BBoxes[Object.keys(BBoxes)[0]];
2343
2358
  }
2344
2359
 
2345
2360
  let myExtent = new Extent({