@eeacms/volto-arcgis-block 0.1.274 → 0.1.276

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,7 +4,15 @@ 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.274](https://github.com/eea/volto-arcgis-block/compare/0.1.273...0.1.274) - 11 April 2024
7
+ ### [0.1.276](https://github.com/eea/volto-arcgis-block/compare/0.1.275...0.1.276) - 23 April 2024
8
+
9
+ ### [0.1.275](https://github.com/eea/volto-arcgis-block/compare/0.1.274...0.1.275) - 19 April 2024
10
+
11
+ #### :hammer_and_wrench: Others
12
+
13
+ - CLMS-3157 (feat): improve graphic color and transparency [Unai Bolivar - [`4f02a02`](https://github.com/eea/volto-arcgis-block/commit/4f02a02eda72f9b663e1694b79d003234bc71895)]
14
+ - CLMS-3157 (bug): committing current work on graphics. Incomplete ticket. [Unai Bolivar - [`45e7d04`](https://github.com/eea/volto-arcgis-block/commit/45e7d041aed301c28ed1f3ab23de6db61a1e17a8)]
15
+ ### [0.1.274](https://github.com/eea/volto-arcgis-block/compare/0.1.273...0.1.274) - 12 April 2024
8
16
 
9
17
  ### [0.1.273](https://github.com/eea/volto-arcgis-block/compare/0.1.272...0.1.273) - 11 April 2024
10
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.274",
3
+ "version": "0.1.276",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -367,19 +367,19 @@ class AreaWidget extends React.Component {
367
367
  .then((response) => {
368
368
  if (response.data && response.data.featureCollection) {
369
369
  //Check for more than a single feature
370
- if (this.checkFeatureCount(response.data.featureCollection) === false)
371
- return;
370
+ let featureCollection = response.data.featureCollection;
371
+ if (this.checkFeatureCount(featureCollection) === false) return;
372
372
 
373
373
  //Check that attributes and geometry are not null or undefined
374
374
  if (
375
- response.data.featureCollection.layers[0].featureSet.features[0]
376
- .attributes === null ||
377
- response.data.featureCollection.layers[0].featureSet.features[0]
378
- .attributes === undefined ||
379
- response.data.featureCollection.layers[0].featureSet.features[0]
380
- .geometry === null ||
381
- response.data.featureCollection.layers[0].featureSet.features[0]
382
- .geometry === undefined
375
+ featureCollection.layers[0].featureSet.features[0].attributes ===
376
+ null ||
377
+ featureCollection.layers[0].featureSet.features[0].attributes ===
378
+ undefined ||
379
+ featureCollection.layers[0].featureSet.features[0].geometry ===
380
+ null ||
381
+ featureCollection.layers[0].featureSet.features[0].geometry ===
382
+ undefined
383
383
  ) {
384
384
  this.setState({
385
385
  showInfoPopup: true,
@@ -389,7 +389,7 @@ class AreaWidget extends React.Component {
389
389
  }
390
390
 
391
391
  //Create a feature layer from the feature collection
392
- this.addFeatureCollectionToMap(response.data.featureCollection);
392
+ this.addFeatureCollectionToMap(featureCollection);
393
393
  } else {
394
394
  //console.error('Unexpected response structure:', response);
395
395
  }
@@ -417,28 +417,29 @@ class AreaWidget extends React.Component {
417
417
  // see the 'Feature Collection in Local Storage' sample for an example of how to work with local storage
418
418
  addFeatureCollectionToMap(featureCollection) {
419
419
  let sourceGraphics = [];
420
- //const symbol = new SimpleFillSymbol({
421
- // //type: 'simple-fill',
422
- // color: [255, 255, 255, 0.5],
423
- // outline: {
424
- // color: [0, 0, 0],
425
- // width: 1,
426
- // },
427
- //});
428
420
 
429
421
  //Create a graphic for each feature in the feature collection
430
422
 
431
423
  const layers = featureCollection.layers.map((layer) => {
432
424
  const graphics = layer.featureSet.features.map((feature) => {
433
- //feature.symbol = symbol;
434
- return Graphic.fromJSON(feature);
425
+ const polygonSymbol = {
426
+ type: 'simple-fill', // autocasts as new SimpleFillSymbol()
427
+ color: [234, 168, 72, 0.8],
428
+ outline: {
429
+ // autocasts as new SimpleLineSymbol()
430
+ color: '#000000',
431
+ width: 0.1,
432
+ },
433
+ };
434
+ let graphic = Graphic.fromJSON(feature);
435
+ graphic.symbol = polygonSymbol;
436
+ return graphic;
435
437
  });
436
438
  sourceGraphics = sourceGraphics.concat(graphics);
437
439
 
438
440
  // Create a feature layer from the feature collection fields and gaphics
439
441
 
440
442
  const featureLayer = new FeatureLayer({
441
- // id: 9,
442
443
  objectIdField: 'FID',
443
444
  source: graphics,
444
445
  legendEnabled: false,
@@ -1244,7 +1245,7 @@ class AreaWidget extends React.Component {
1244
1245
  <FontAwesomeIcon icon={['fas', 'info-circle']} />
1245
1246
  </span>
1246
1247
  <div className="drawRectanglePopup-text">
1247
- Invalid Shapefile: missing or incomplete shp file.
1248
+ Invalid file format, or incomplete shapefile.
1248
1249
  </div>
1249
1250
  </>
1250
1251
  )}
@@ -487,7 +487,7 @@ class MenuWidget extends React.Component {
487
487
  this.compCfg.forEach((component) => {
488
488
  component.Products.forEach((product) => {
489
489
  product.Datasets.forEach((dataset) => {
490
- if (dataset.ViewService.endsWith('file')) {
490
+ if (dataset.ViewService?.endsWith('file')) {
491
491
  let promise = fetch(dataset.ViewService, { mode: 'no-cors' })
492
492
  .then((response) => {
493
493
  if (!response.ok) {
@@ -955,18 +955,18 @@ class MenuWidget extends React.Component {
955
955
  // dont show the product if all of its datasets has the auxiliary service as its ViewService URL
956
956
  //CLMS-1756
957
957
  //don´t show the product if MarkAsDownloadableNoServiceToVisualize is true
958
- const isAuxiliary = (dataset) =>
959
- dataset.MarkAsDownloadableNoServiceToVisualize;
960
- if (!component.Products[i].Datasets.every(isAuxiliary)) {
961
- products.push(
962
- this.metodProcessProduct(
963
- component.Products[i],
964
- index,
965
- inheritedIndexComponent,
966
- ),
967
- );
968
- index++;
969
- }
958
+ // const isAuxiliary = (dataset) =>
959
+ // dataset.MarkAsDownloadableNoServiceToVisualize;
960
+ // if (!component.Products[i].Datasets.every(isAuxiliary)) {
961
+ products.push(
962
+ this.metodProcessProduct(
963
+ component.Products[i],
964
+ index,
965
+ inheritedIndexComponent,
966
+ ),
967
+ );
968
+ index++;
969
+ //}
970
970
  }
971
971
  let style = this.props.download ? { display: 'none' } : {};
972
972
 
@@ -1033,17 +1033,17 @@ class MenuWidget extends React.Component {
1033
1033
  }
1034
1034
 
1035
1035
  // CLMS-1545
1036
- if (!product.Datasets[i].MarkAsDownloadableNoServiceToVisualize) {
1037
- datasets.push(
1038
- this.metodProcessDataset(
1039
- product.Datasets[i],
1040
- index,
1041
- inheritedIndexProduct,
1042
- checkProduct,
1043
- ),
1044
- );
1045
- index++;
1046
- }
1036
+ //if (!product.Datasets[i].MarkAsDownloadableNoServiceToVisualize) {
1037
+ datasets.push(
1038
+ this.metodProcessDataset(
1039
+ product.Datasets[i],
1040
+ index,
1041
+ inheritedIndexProduct,
1042
+ checkProduct,
1043
+ ),
1044
+ );
1045
+ index++;
1046
+ //}
1047
1047
  }
1048
1048
 
1049
1049
  // Empty vector, add the first dataset
@@ -1204,7 +1204,7 @@ class MenuWidget extends React.Component {
1204
1204
  }
1205
1205
 
1206
1206
  // TMS
1207
- if (dataset.ViewService.endsWith('file')) {
1207
+ if (dataset.ViewService?.endsWith('file')) {
1208
1208
  let tmsLayerIndex = 0;
1209
1209
 
1210
1210
  dataset.Layer.forEach((layer, sublayerIndex) => {
@@ -1546,8 +1546,8 @@ class MenuWidget extends React.Component {
1546
1546
  if (
1547
1547
  !this.layers.hasOwnProperty(layer.LayerId + '_' + inheritedIndexLayer)
1548
1548
  ) {
1549
- if (viewService.toLowerCase().includes('wms')) {
1550
- viewService = viewService.endsWith('?')
1549
+ if (viewService?.toLowerCase().includes('wms')) {
1550
+ viewService = viewService?.endsWith('?')
1551
1551
  ? viewService
1552
1552
  : viewService + '?';
1553
1553
  this.layers[layer.LayerId + '_' + inheritedIndexLayer] = new WMSLayer({
@@ -1577,9 +1577,9 @@ class MenuWidget extends React.Component {
1577
1577
  ProductId: ProductId,
1578
1578
  ViewService: viewService,
1579
1579
  });
1580
- } else if (viewService.toLowerCase().includes('wmts')) {
1580
+ } else if (viewService?.toLowerCase().includes('wmts')) {
1581
1581
  this.layers[layer.LayerId + '_' + inheritedIndexLayer] = new WMTSLayer({
1582
- url: viewService.endsWith('?') ? viewService : viewService + '?',
1582
+ url: viewService?.endsWith('?') ? viewService : viewService + '?',
1583
1583
  //id: layer.LayerId,
1584
1584
  title: '',
1585
1585
  _wmtsTitle: layer.Title, // CLMS-1105
@@ -1603,7 +1603,7 @@ class MenuWidget extends React.Component {
1603
1603
  ] = new FeatureLayer({
1604
1604
  url:
1605
1605
  viewService +
1606
- (viewService.endsWith('/') ? '' : '/') +
1606
+ (viewService?.endsWith('/') ? '' : '/') +
1607
1607
  layer.LayerId,
1608
1608
  id: layer.LayerId,
1609
1609
  title: layer.Title,
@@ -2044,8 +2044,8 @@ class MenuWidget extends React.Component {
2044
2044
  this.checkInfoWidget();
2045
2045
  // toggle custom legend for WMTS and TMS
2046
2046
  if (
2047
- this.layers[elem.id].ViewService.toLowerCase().includes('wmts') ||
2048
- this.layers[elem.id].ViewService.toLowerCase().endsWith('file')
2047
+ this.layers[elem.id].ViewService?.toLowerCase().includes('wmts') ||
2048
+ this.layers[elem.id].ViewService?.toLowerCase().endsWith('file')
2049
2049
  ) {
2050
2050
  this.toggleCustomLegendItem(this.layers[elem.id]);
2051
2051
  }