@eeacms/volto-arcgis-block 0.1.133 → 0.1.135

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,14 @@ 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.135](https://github.com/eea/volto-arcgis-block/compare/0.1.134...0.1.135) - 5 May 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-1733 (lint):Ran linting scripts before push [Urkorue - [`3fffb43`](https://github.com/eea/volto-arcgis-block/commit/3fffb438efb27a59f251ea89bd35b67301af9040)]
12
+ - CLMS-1733 (fix): Compares the product title instead of the url [Urkorue - [`41b88af`](https://github.com/eea/volto-arcgis-block/commit/41b88afdfc34dafccd9d587da880caf998bf7f41)]
13
+ ### [0.1.134](https://github.com/eea/volto-arcgis-block/compare/0.1.133...0.1.134) - 4 May 2023
14
+
7
15
  ### [0.1.133](https://github.com/eea/volto-arcgis-block/compare/0.1.132...0.1.133) - 2 May 2023
8
16
 
9
17
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.133",
3
+ "version": "0.1.135",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -1961,11 +1961,31 @@ class MenuWidget extends React.Component {
1961
1961
  product.Datasets.forEach((dataset) => {
1962
1962
  if (dataset.DatasetTitle.includes(selectedDataset.title)) {
1963
1963
  this.url = dataset.ViewService;
1964
+ this.productTitle = product.ProductTitle;
1964
1965
  }
1965
1966
  });
1966
1967
  });
1967
1968
  });
1968
1969
  }
1970
+ findDatasetBoundingBox(elem) {
1971
+ this.compCfg.forEach((component) => {
1972
+ component.Products.forEach((product) => {
1973
+ product.Datasets.forEach((dataset) => {
1974
+ dataset.Layer.forEach((layer) => {
1975
+ if (layer.Title.includes(elem.title)) {
1976
+ this.dataBBox = layer.bbox;
1977
+ }
1978
+ });
1979
+ });
1980
+ });
1981
+ });
1982
+ }
1983
+ parseBBOXJSON(bboxJson) {
1984
+ let bbox = JSON.parse(bboxJson);
1985
+ let BBoxes = [];
1986
+ BBoxes[0] = { xmin: bbox[0], ymin: bbox[1], xmax: bbox[2], ymax: bbox[3] };
1987
+ return BBoxes;
1988
+ }
1969
1989
  parseBBOXWMS(xml) {
1970
1990
  const layerParentNode = xml.querySelectorAll('Layer');
1971
1991
  let layersChildren = Array.from(layerParentNode).filter(
@@ -2083,23 +2103,44 @@ class MenuWidget extends React.Component {
2083
2103
  .catch(() => {});
2084
2104
  };
2085
2105
  async fullExtent(elem) {
2086
- let parentId = elem.getAttribute('parentid');
2087
- if (
2088
- parentId.includes('map_dataset_2_4') ||
2089
- parentId.includes('map_dataset_2_3')
2106
+ this.findCheckedDataset(elem);
2107
+ let BBoxes = {};
2108
+ let firstLayer;
2109
+ if (this.productTitle.includes('Global Dynamic Land Cover')) {
2110
+ this.findDatasetBoundingBox(elem);
2111
+ BBoxes = this.parseBBOXJSON(this.dataBBox);
2112
+ } else if (
2113
+ this.productTitle.includes('Low Resolution Vegetation Parameters') ||
2114
+ this.productTitle.includes('Water Parameters')
2090
2115
  ) {
2091
- this.view.goTo(this.layers[elem.id].fullExtents[0]);
2092
- } else {
2093
- this.findCheckedDataset(elem);
2094
- let BBoxes = {};
2095
- let firstLayer;
2096
- if (this.url.toLowerCase().includes('wms')) {
2097
- await this.getCapabilities(this.url, 'wms');
2098
- BBoxes = this.parseBBOXWMS(this.xml);
2099
- } else if (this.url.toLowerCase().includes('wmts')) {
2100
- await this.getCapabilities(this.url, 'wmts');
2101
- BBoxes = this.parseBBOXWMTS(this.xml);
2116
+ if (
2117
+ this.layers[elem.id].fullExtents &&
2118
+ this.layers[elem.id].fullExtents !== null
2119
+ ) {
2120
+ this.view.goTo(this.layers[elem.id].fullExtents[0]);
2121
+ } else {
2122
+ let myExtent = new Extent({
2123
+ xmin: -20037508.342789,
2124
+ ymin: -20037508.342789,
2125
+ xmax: 20037508.342789,
2126
+ ymax: 20037508.342789,
2127
+ // spatialReference: 4326 // by default wkid 4326
2128
+ });
2129
+ this.view.goTo(myExtent);
2102
2130
  }
2131
+ } else if (this.url.toLowerCase().includes('wms')) {
2132
+ await this.getCapabilities(this.url, 'wms');
2133
+ BBoxes = this.parseBBOXWMS(this.xml);
2134
+ } else if (this.url.toLowerCase().includes('wmts')) {
2135
+ await this.getCapabilities(this.url, 'wmts');
2136
+ BBoxes = this.parseBBOXWMTS(this.xml);
2137
+ }
2138
+ if (
2139
+ BBoxes &&
2140
+ BBoxes !== null &&
2141
+ BBoxes[Object.keys(BBoxes)[0]] &&
2142
+ BBoxes[Object.keys(BBoxes)[0]] !== null
2143
+ ) {
2103
2144
  if (elem.title.includes('Corine Land Cover')) {
2104
2145
  if (elem.title.includes('Guadeloupe')) {
2105
2146
  firstLayer = BBoxes[Object.keys(BBoxes)[0]];