@eeacms/volto-arcgis-block 0.1.22 → 0.1.23

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,8 +4,28 @@ 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.23](https://github.com/eea/volto-arcgis-block/compare/0.1.22...0.1.23)
8
+
9
+ - Use cases region highlight [`#71`](https://github.com/eea/volto-arcgis-block/pull/71)
10
+ - Bugs n improvements [`#74`](https://github.com/eea/volto-arcgis-block/pull/74)
11
+ - Add NUTS 2 in the Map viewer [`#72`](https://github.com/eea/volto-arcgis-block/pull/72)
12
+ - Mapviewer menu widget correction [`#73`](https://github.com/eea/volto-arcgis-block/pull/73)
13
+ - Update highlight service [`fbec327`](https://github.com/eea/volto-arcgis-block/commit/fbec3279c44900ec1100affed350a517133997fb)
14
+ - ESLint fix [`4a695e3`](https://github.com/eea/volto-arcgis-block/commit/4a695e39ab3d276483ad2922e7ee2b446826db2c)
15
+ - ESLint fix [`62e6a10`](https://github.com/eea/volto-arcgis-block/commit/62e6a1034a6317a0a45f682248ef1c1bc12081a6)
16
+ - NUTS layer order [`4942c25`](https://github.com/eea/volto-arcgis-block/commit/4942c25ef0fe7c7f239015f8d14910b3ac2238fe)
17
+ - Remove debugger [`bcbb107`](https://github.com/eea/volto-arcgis-block/commit/bcbb1076f80fe773ff3dd2ffb5dc038e5c8f4733)
18
+ - Update layers array key values to unique IDs [`066951d`](https://github.com/eea/volto-arcgis-block/commit/066951d571fc77a96b98cc0650d36d1a22665e49)
19
+ - Remove unused variable [`830349f`](https://github.com/eea/volto-arcgis-block/commit/830349f17e8549f8883acd805302ecb65d35dec4)
20
+ - Add individual region highlight [`6e4cb62`](https://github.com/eea/volto-arcgis-block/commit/6e4cb62d26a493da83e53a10bba8f64ea9df80e3)
21
+ - Update LegendWidget.jsx [`3273d53`](https://github.com/eea/volto-arcgis-block/commit/3273d53183ef17328ddfce7913910671eb5a43a9)
22
+ - Change legend text [`09eb6e0`](https://github.com/eea/volto-arcgis-block/commit/09eb6e08e4199cab914d6300c62af633876579cb)
23
+
7
24
  #### [0.1.22](https://github.com/eea/volto-arcgis-block/compare/0.1.21...0.1.22)
8
25
 
26
+ > 10 December 2021
27
+
28
+ - Develop [`#70`](https://github.com/eea/volto-arcgis-block/pull/70)
9
29
  - ESLint fix [`#69`](https://github.com/eea/volto-arcgis-block/pull/69)
10
30
  - Bugs n improvements [`#68`](https://github.com/eea/volto-arcgis-block/pull/68)
11
31
  - Change services URLs to discomap [`ed4dc62`](https://github.com/eea/volto-arcgis-block/commit/ed4dc62df3af66a71acbe981b3e74a4a621ef2c4)
package/Jenkinsfile CHANGED
@@ -31,8 +31,8 @@ pipeline {
31
31
  when {
32
32
  allOf {
33
33
  environment name: 'CHANGE_ID', value: ''
34
- not { branch 'master' }
35
34
  not { changelog '.*^Automated release [0-9\\.]+$' }
35
+ not { branch 'master' }
36
36
  }
37
37
  }
38
38
  steps {
@@ -63,7 +63,10 @@ pipeline {
63
63
  when {
64
64
  allOf {
65
65
  environment name: 'CHANGE_ID', value: ''
66
- not { changelog '.*^Automated release [0-9\\.]+$' }
66
+ anyOf {
67
+ not { changelog '.*^Automated release [0-9\\.]+$' }
68
+ branch 'master'
69
+ }
67
70
  }
68
71
  }
69
72
  steps {
@@ -108,7 +111,10 @@ pipeline {
108
111
  when {
109
112
  allOf {
110
113
  environment name: 'CHANGE_ID', value: ''
111
- not { changelog '.*^Automated release [0-9\\.]+$' }
114
+ anyOf {
115
+ not { changelog '.*^Automated release [0-9\\.]+$' }
116
+ branch 'master'
117
+ }
112
118
  }
113
119
  }
114
120
  steps {
@@ -159,12 +165,16 @@ pipeline {
159
165
 
160
166
  stage('Report to SonarQube') {
161
167
  when {
168
+ allOf {
162
169
  environment name: 'CHANGE_ID', value: ''
163
170
  anyOf {
164
171
  branch 'master'
165
- branch 'develop'
172
+ allOf {
173
+ branch 'develop'
174
+ not { changelog '.*^Automated release [0-9\\.]+$' }
175
+ }
166
176
  }
167
- not { changelog '.*^Automated release [0-9\\.]+$' }
177
+ }
168
178
  }
169
179
  steps {
170
180
  node(label: 'swarm') {
package/README.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # [WIP] Volto Arcgis Block
2
+
2
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-arcgis-block)](https://github.com/eea/volto-arcgis-block/releases)
4
+
3
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-arcgis-block%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-arcgis-block/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
10
+
4
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-arcgis-block%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-arcgis-block/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
5
16
 
6
17
  ## ArcGIS Map integration for Volto blocks
7
18
  ****This product is in development, at this time it is not recommended to use it.***
@@ -64,4 +75,84 @@ const customBlocks = (config) => ({
64
75
  "@eeacms/volto-clms-theme"
65
76
  ],
66
77
  ````
67
- ![Style example volto-arcgis-block](docs/styles_example.gif)
78
+ ![Style example volto-arcgis-block](docs/styles_example.gif)
79
+
80
+ ## Release
81
+
82
+ ### Automatic release using Jenkins
83
+
84
+ * The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
85
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
86
+ * The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
87
+ * Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
88
+ * As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
89
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
90
+ * You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
91
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
92
+
93
+ ### Manual release from the develop branch ( beta release )
94
+
95
+ #### Installation and configuration of release-it
96
+
97
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
98
+
99
+ ```
100
+ npm install -g release-it
101
+ ```
102
+
103
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
104
+
105
+ Release-it is a tool that automates 4 important steps in the release process:
106
+
107
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
108
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
109
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
110
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
111
+
112
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
113
+
114
+ ```
115
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
116
+ ```
117
+
118
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
119
+
120
+ ```
121
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
122
+ ```
123
+
124
+ #### Using release-it tool
125
+
126
+ There are 3 yarn scripts that can be run to do the release
127
+
128
+ ##### yarn release-beta
129
+
130
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
131
+
132
+ ```
133
+ ? Select increment (next version):
134
+ ❯ prepatch (0.1.1-beta.0)
135
+ preminor (0.2.0-beta.0)
136
+ premajor (1.0.0-beta.0)
137
+ Other, please specify...
138
+ ```
139
+
140
+ ##### yarn release-major-beta
141
+
142
+ Same as `yarn release-beta`, but with premajor version pre-selected.
143
+
144
+ ##### yarn release
145
+
146
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
147
+
148
+ #### Important notes
149
+
150
+ > Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
151
+
152
+ > Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
153
+
154
+
155
+ ## How to contribute
156
+
157
+ See [DEVELOP.md](https://github.com/eea/volto-arcgis-block/blob/master/DEVELOP.md).
158
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -21,6 +21,8 @@
21
21
  "scripts": {
22
22
  "i18n": "NODE_ENV=production node src/i18n.js",
23
23
  "release": "release-it",
24
+ "release-major-beta": "release-it major --preRelease=beta",
25
+ "release-beta": "release-it --preRelease=beta",
24
26
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
25
27
  "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'",
26
28
  "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",
@@ -111,6 +111,9 @@ class AreaWidget extends React.Component {
111
111
  nuts1handler(e) {
112
112
  this.loadNutsService(e.target.value, 1);
113
113
  }
114
+ nuts2handler(e) {
115
+ this.loadNutsService(e.target.value, 2);
116
+ }
114
117
  nuts3handler(e) {
115
118
  this.loadNutsService(e.target.value, 3);
116
119
  }
@@ -127,6 +130,18 @@ class AreaWidget extends React.Component {
127
130
  definitionExpression: 'LEVL_CODE=' + level,
128
131
  });
129
132
  this.nutsGroupLayer.add(layer);
133
+ let index = this.getHighestIndex();
134
+ this.props.map.reorder(this.nutsGroupLayer, index + 1);
135
+ }
136
+ getHighestIndex() {
137
+ let index = 0;
138
+ document.querySelectorAll('.active-layer').forEach((layer) => {
139
+ let value = parseInt(layer.getAttribute('layer-order'));
140
+ if (value > index) {
141
+ index = value;
142
+ }
143
+ });
144
+ return index;
130
145
  }
131
146
  rectanglehandler() {
132
147
  this.clearWidget();
@@ -187,33 +202,36 @@ class AreaWidget extends React.Component {
187
202
  });
188
203
  this.props.map.add(this.nutsGroupLayer);
189
204
  this.props.view.on('click', (event) => {
190
- this.props.view.hitTest(event).then((response) => {
191
- if (response.results.length > 0) {
192
- let graphic = response.results.filter((result) => {
193
- let layer;
194
- if ('nuts0 nuts1 nuts3'.includes(result.graphic.layer.id)) {
195
- layer = result.graphic;
196
- }
197
- return layer;
198
- })[0].graphic;
199
- if (graphic) {
200
- let geometry = graphic.geometry;
201
- if (geometry.type === 'polygon') {
202
- let nuts = graphic.attributes.NUTS_ID;
203
- this.props.updateArea(nuts);
204
- let symbol = new SimpleFillSymbol(
205
- 'solid',
206
- new SimpleLineSymbol('solid', new Color([232, 104, 80]), 2),
207
- new Color([232, 104, 80, 0.25]),
208
- );
209
- let highlight = new Graphic(geometry, symbol);
210
- this.props.view.graphics.removeAll();
211
- this.props.view.graphics.add(highlight);
205
+ if (this.props.mapViewer.activeWidget === this) {
206
+ this.props.view.hitTest(event).then((response) => {
207
+ if (response.results.length > 0) {
208
+ let graphic = response.results.filter((result) => {
209
+ let layer;
210
+ if ('nuts0 nuts1 nuts2 nuts3'.includes(result.graphic.layer.id)) {
211
+ layer = result.graphic;
212
+ }
213
+ return layer;
214
+ })[0].graphic;
215
+ if (graphic) {
216
+ let geometry = graphic.geometry;
217
+ if (geometry.type === 'polygon') {
218
+ let nuts = graphic.attributes.NUTS_ID;
219
+ this.props.updateArea(nuts);
220
+ let symbol = new SimpleFillSymbol(
221
+ 'solid',
222
+ new SimpleLineSymbol('solid', new Color([232, 104, 80]), 2),
223
+ new Color([232, 104, 80, 0.25]),
224
+ );
225
+ let highlight = new Graphic(geometry, symbol);
226
+ this.props.view.graphics.removeAll();
227
+ this.props.view.graphics.add(highlight);
228
+ }
212
229
  }
213
230
  }
214
- }
215
- });
231
+ });
232
+ }
216
233
  });
234
+
217
235
  this.props.download
218
236
  ? this.props.view.ui.add(this.container)
219
237
  : this.props.view.ui.add(this.container.current, 'top-right');
@@ -284,6 +302,22 @@ class AreaWidget extends React.Component {
284
302
  <span>NUTS 1</span>
285
303
  </label>
286
304
  </div>
305
+ <div className="ccl-form-group">
306
+ <input
307
+ type="radio"
308
+ id="download_area_select_nuts2"
309
+ name="downloadAreaSelect"
310
+ value="nuts2"
311
+ className="ccl-checkbox ccl-required ccl-form-check-input"
312
+ onClick={this.nuts2handler.bind(this)}
313
+ ></input>
314
+ <label
315
+ className="ccl-form-radio-label"
316
+ htmlFor="download_area_select_nuts2"
317
+ >
318
+ <span>NUTS 2</span>
319
+ </label>
320
+ </div>
287
321
  <div className="ccl-form-group">
288
322
  <input
289
323
  type="radio"
@@ -118,6 +118,23 @@ export const AddCartItem = ({
118
118
  setModal(false);
119
119
  };
120
120
 
121
+ const checkScrollPosition = () => {
122
+ let dt = document.querySelector(
123
+ '.map-menu-dataset[datasetid="' +
124
+ dataset.DatasetId +
125
+ '"] .map-dataset-checkbox',
126
+ );
127
+ if (
128
+ dt.offsetTop + dt.offsetHeight + 4 * 16 >
129
+ document.querySelector('.panels').offsetHeight +
130
+ document.querySelector('.panels').scrollTop
131
+ ) {
132
+ return 'translate(1rem, -5rem)';
133
+ } else {
134
+ return 'translate(1rem, 2rem)';
135
+ }
136
+ };
137
+
121
138
  return (
122
139
  <>
123
140
  {showMessage && (
@@ -127,7 +144,7 @@ export const AddCartItem = ({
127
144
  style={{
128
145
  transform: download
129
146
  ? 'translate(1rem, 4rem)'
130
- : 'translate(1rem, 2rem)',
147
+ : checkScrollPosition(),
131
148
  }}
132
149
  >
133
150
  {message}
@@ -595,11 +612,12 @@ class MenuWidget extends React.Component {
595
612
  'request=GetLegendGraphic&version=1.0.0&format=image/png&layer=';
596
613
  //For each layer
597
614
  var inheritedIndexLayer = inheritedIndex + '_' + layerIndex;
598
-
599
615
  //Add sublayers and popup enabled for layers
600
- if (!this.layers.hasOwnProperty(layer.LayerId)) {
616
+ if (
617
+ !this.layers.hasOwnProperty(layer.LayerId + '_' + inheritedIndexLayer)
618
+ ) {
601
619
  if (urlWMS.toLowerCase().includes('wms')) {
602
- this.layers[layer.LayerId] = new WMSLayer({
620
+ this.layers[layer.LayerId + '_' + inheritedIndexLayer] = new WMSLayer({
603
621
  url: urlWMS,
604
622
  featureInfoFormat: 'text/html',
605
623
  featureInfoUrl: urlWMS,
@@ -619,7 +637,7 @@ class MenuWidget extends React.Component {
619
637
  ],
620
638
  });
621
639
  } else if (urlWMS.toLowerCase().includes('wmts')) {
622
- this.layers[layer.LayerId] = new WMTSLayer({
640
+ this.layers[layer.LayerId + '_' + inheritedIndexLayer] = new WMTSLayer({
623
641
  url: urlWMS,
624
642
  //id: layer.LayerId,
625
643
  title: '',
@@ -629,10 +647,12 @@ class MenuWidget extends React.Component {
629
647
  },
630
648
  });
631
649
  } else {
632
- this.layers[layer.LayerId] = new FeatureLayer({
633
- url: urlWMS,
634
- //id: layer.LayerId,
635
- title: '',
650
+ this.layers[
651
+ layer.LayerId + '_' + inheritedIndexLayer
652
+ ] = new FeatureLayer({
653
+ url: urlWMS + (urlWMS.endsWith('/') ? '' : '/') + layer.LayerId,
654
+ id: layer.LayerId,
655
+ title: layer.Title,
636
656
  popupEnabled: true,
637
657
  });
638
658
  }
@@ -680,13 +700,17 @@ class MenuWidget extends React.Component {
680
700
  let parentId = elem.getAttribute('parentid');
681
701
  let layerId = elem.getAttribute('layerid');
682
702
  if (elem.checked) {
683
- this.map.add(this.layers[layerId]);
703
+ this.map.add(this.layers[elem.id]);
684
704
  this.visibleLayers[elem.id] = ['fas', 'eye'];
685
705
  this.timeLayers[elem.id] = ['fas', 'step-forward'];
686
706
  this.activeLayersJSON[elem.id] = this.addActiveLayer(
687
707
  elem,
688
708
  Object.keys(this.activeLayersJSON).length,
689
709
  );
710
+ let nuts = this.map.layers.items.find((layer) => layer.title === 'nuts');
711
+ if (nuts) {
712
+ this.map.reorder(nuts, this.map.layers.items.length + 1);
713
+ }
690
714
  } else {
691
715
  let checkboxes = document.getElementsByName('layerCheckbox');
692
716
  let repeatedLayers = [];
@@ -696,7 +720,7 @@ class MenuWidget extends React.Component {
696
720
  }
697
721
  }
698
722
  if (repeatedLayers.length === 0) {
699
- this.map.remove(this.layers[layerId]);
723
+ this.map.remove(this.layers[elem.id]);
700
724
  delete this.activeLayersJSON[elem.id];
701
725
  delete this.visibleLayers[elem.id];
702
726
  delete this.timeLayers[elem.id];
@@ -831,10 +855,7 @@ class MenuWidget extends React.Component {
831
855
  />
832
856
  </span>
833
857
  {this.timeLayers[elem.id][1] === 'stop' &&
834
- this.renderTimeslider(
835
- elem,
836
- this.layers[elem.getAttribute('layerid')],
837
- )}
858
+ this.renderTimeslider(elem, this.layers[elem.id])}
838
859
  </div>
839
860
  </div>
840
861
  );
@@ -875,10 +896,7 @@ class MenuWidget extends React.Component {
875
896
  this.layerReorder(reorder_elem.id, counter);
876
897
  while ((reorder_elem = reorder_elem.nextSibling)) {
877
898
  reorder_elem.setAttribute('layer-order', counter++);
878
- this.layerReorder(
879
- this.layers[reorder_elem.getAttribute('layer-id')],
880
- counter,
881
- );
899
+ this.layerReorder(this.layers[reorder_elem.id], counter);
882
900
  }
883
901
  }
884
902
 
@@ -919,21 +937,21 @@ class MenuWidget extends React.Component {
919
937
  if (this.timeLayers[elem.id][1] === 'step-forward') {
920
938
  activeLayers.forEach((layer) => {
921
939
  let layerId = layer.getAttribute('layer-id');
922
- let order = this.activeLayersJSON[layerId].props['layer-order'];
940
+ let order = this.activeLayersJSON[elem.id].props['layer-order'];
923
941
  if (elem.id === layerId) {
924
942
  this.timeLayers[elem.id] = ['fas', 'stop'];
925
- if (this.visibleLayers[layerId][1] === 'eye-slash') {
926
- this.layers[layerId].visible = true;
927
- this.visibleLayers[layerId] = ['fas', 'eye'];
943
+ if (this.visibleLayers[elem.id][1] === 'eye-slash') {
944
+ this.layers[elem.id].visible = true;
945
+ this.visibleLayers[elem.id] = ['fas', 'eye'];
928
946
  }
929
947
  document
930
948
  .querySelector(
931
- '.active-layer[layer-id="' + layerId + '"] .active-layer-hide',
949
+ '.active-layer[layer-id="' + elem.id + '"] .active-layer-hide',
932
950
  )
933
951
  .classList.add('locked');
934
952
  document
935
953
  .querySelector(
936
- '.active-layer[layer-id="' + layerId + '"] .active-layer-delete',
954
+ '.active-layer[layer-id="' + elem.id + '"] .active-layer-delete',
937
955
  )
938
956
  .classList.add('locked');
939
957
  document.querySelector('#products_label').classList.add('locked');
@@ -941,15 +959,15 @@ class MenuWidget extends React.Component {
941
959
  document.querySelector('#download_label').classList.add('locked');
942
960
  this.activeLayersJSON[elem.id] = this.addActiveLayer(elem, order);
943
961
  } else {
944
- if (this.visibleLayers[layerId][1] === 'eye') {
945
- this.layers[layerId].visible = false;
946
- this.visibleLayers[layerId] = ['fas', 'eye-slash'];
962
+ if (this.visibleLayers[elem.id][1] === 'eye') {
963
+ this.layers[elem.id].visible = false;
964
+ this.visibleLayers[elem.id] = ['fas', 'eye-slash'];
947
965
  }
948
966
  document
949
- .querySelector('.active-layer[layer-id="' + layerId + '"]')
967
+ .querySelector('.active-layer[layer-id="' + elem.id + '"]')
950
968
  .classList.add('locked');
951
- this.activeLayersJSON[layerId] = this.addActiveLayer(
952
- document.getElementById(layerId),
969
+ this.activeLayersJSON[elem.id] = this.addActiveLayer(
970
+ document.getElementById(elem.id),
953
971
  order,
954
972
  );
955
973
  }
@@ -957,18 +975,18 @@ class MenuWidget extends React.Component {
957
975
  } else {
958
976
  activeLayers.forEach((layer) => {
959
977
  let layerId = layer.getAttribute('layer-id');
960
- let order = this.activeLayersJSON[layerId].props['layer-order'];
978
+ let order = this.activeLayersJSON[elem.id].props['layer-order'];
961
979
  if (elem.id === layerId) {
962
980
  this.timeLayers[elem.id] = ['fas', 'step-forward'];
963
981
  this.activeLayersJSON[elem.id] = this.addActiveLayer(elem, order);
964
982
  document
965
983
  .querySelector(
966
- '.active-layer[layer-id="' + layerId + '"] .active-layer-hide',
984
+ '.active-layer[layer-id="' + elem.id + '"] .active-layer-hide',
967
985
  )
968
986
  .classList.remove('locked');
969
987
  document
970
988
  .querySelector(
971
- '.active-layer[layer-id="' + layerId + '"] .active-layer-delete',
989
+ '.active-layer[layer-id="' + elem.id + '"] .active-layer-delete',
972
990
  )
973
991
  .classList.remove('locked');
974
992
  document.querySelector('#products_label').classList.remove('locked');
@@ -983,16 +1001,16 @@ class MenuWidget extends React.Component {
983
1001
  document.querySelector('.esri-ui-bottom-right'),
984
1002
  );
985
1003
  } else {
986
- if (this.visibleLayers[layerId][1] === 'eye-slash') {
987
- this.layers[layerId].visible = true;
988
- this.visibleLayers[layerId] = ['fas', 'eye'];
989
- this.activeLayersJSON[layerId] = this.addActiveLayer(
990
- document.getElementById(layerId),
1004
+ if (this.visibleLayers[elem.id][1] === 'eye-slash') {
1005
+ this.layers[elem.id].visible = true;
1006
+ this.visibleLayers[elem.id] = ['fas', 'eye'];
1007
+ this.activeLayersJSON[elem.id] = this.addActiveLayer(
1008
+ document.getElementById(elem.id),
991
1009
  order,
992
1010
  );
993
1011
  }
994
1012
  document
995
- .querySelector('.active-layer[layer-id="' + layerId + '"]')
1013
+ .querySelector('.active-layer[layer-id="' + elem.id + '"]')
996
1014
  .classList.remove('locked');
997
1015
  }
998
1016
  });
@@ -1006,13 +1024,13 @@ class MenuWidget extends React.Component {
1006
1024
  * @param {*} id id from elem
1007
1025
  */
1008
1026
  eyeLayer(elem) {
1009
- let elementId = elem.getAttribute('layerid');
1027
+ // let elementId = elem.getAttribute('layerid');
1010
1028
  if (this.visibleLayers[elem.id][1] === 'eye') {
1011
- this.layers[elementId].visible = false;
1029
+ this.layers[elem.id].visible = false;
1012
1030
  this.visibleLayers[elem.id] = ['fas', 'eye-slash'];
1013
1031
  } else {
1014
- this.map.add(this.layers[elementId]);
1015
- this.layers[elementId].visible = true;
1032
+ this.map.add(this.layers[elem.id]);
1033
+ this.layers[elem.id].visible = true;
1016
1034
  this.visibleLayers[elem.id] = ['fas', 'eye'];
1017
1035
  }
1018
1036
  this.activeLayersJSON[elem.id] = this.addActiveLayer(elem, 0);
@@ -5,7 +5,6 @@ let layerControl,
5
5
  view,
6
6
  mapViewer,
7
7
  layerSpatial,
8
- layerNUTS,
9
8
  processedData = [];
10
9
  class InfoWidget extends React.Component {
11
10
  constructor(props) {
@@ -15,7 +14,6 @@ class InfoWidget extends React.Component {
15
14
  navigationControl = props.navigationControl;
16
15
  layerControl = props.layerControl;
17
16
  layerSpatial = props.layerSpatial;
18
- layerNUTS = props.layerNUTS;
19
17
  this.container = createRef();
20
18
  }
21
19
 
@@ -25,13 +23,11 @@ class InfoWidget extends React.Component {
25
23
  * @returns lateralMenu DOM
26
24
  */
27
25
  showUseCase(UseCase) {
28
- layerControl.getGeometry(UseCase.Spatial_coverage, layerNUTS);
29
26
  let responsibleOrganizationOrPerson = UseCase.Responsible_organisation
30
27
  ? UseCase.Responsible_organisation
31
28
  : UseCase.Contact_person_name_
32
29
  ? UseCase.Contact_person_name_
33
30
  : '';
34
- layerControl.showLayer(layerNUTS.id);
35
31
  return (
36
32
  <>
37
33
  <div className="use-cases-products-title">Use case detail</div>
@@ -28,11 +28,11 @@ class LayerControl {
28
28
  }
29
29
 
30
30
  getGeometry(country, layer) {
31
- layer.definitionExpression = `LEVL_CODE = 0 AND (`;
31
+ layer.definitionExpression = `(`;
32
32
  if (country === 'EU' || country === 'EEA') {
33
33
  let states = mapViewer.props.cfg.Codes[country];
34
34
  for (let i = 0; i < states.length; i++) {
35
- layer.definitionExpression += `CNTR_CODE = '${states[i]}'`;
35
+ layer.definitionExpression += `CNTR_ID = '${states[i]}'`;
36
36
  if (i < states.length - 1) {
37
37
  layer.definitionExpression += ' OR ';
38
38
  } else {
@@ -40,7 +40,7 @@ class LayerControl {
40
40
  }
41
41
  }
42
42
  } else {
43
- layer.definitionExpression += `CNTR_CODE = 'none')`;
43
+ layer.definitionExpression += `CNTR_ID = '${country}')`;
44
44
  }
45
45
  }
46
46
 
@@ -48,7 +48,7 @@ class LegendWidget extends React.Component {
48
48
 
49
49
  this.container.current.children[1].querySelector(
50
50
  '.esri-legend__service-label',
51
- ).textContent = 'Use Cases Coverage Legend';
51
+ ).textContent = 'Legend';
52
52
 
53
53
  try {
54
54
  this.container.current.children[1]
@@ -63,13 +63,13 @@ class LegendWidget extends React.Component {
63
63
  let currentValue = legendCells[i].textContent;
64
64
  switch (currentValue.toLowerCase()) {
65
65
  case 'eu':
66
- legendCells[i].textContent = 'EU27+UK';
66
+ legendCells[i].textContent = 'EU27+UK coverage';
67
67
  break;
68
68
  case 'eea':
69
- legendCells[i].textContent = 'EEA 38';
69
+ legendCells[i].textContent = 'EEA38+UK coverage';
70
70
  break;
71
71
  case 'others':
72
- legendCells[i].textContent = 'Country';
72
+ legendCells[i].textContent = 'Country coverage';
73
73
  break;
74
74
  default:
75
75
  break;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- let layerRegion, layerSpatial, layerNUTS, mapViewer;
3
+ let layerRegion, layerSpatial, layerHighlight, mapViewer;
4
4
  class NavigationControl extends React.Component {
5
5
  constructor(props) {
6
6
  super(props);
@@ -11,7 +11,7 @@ class NavigationControl extends React.Component {
11
11
  mapViewer = props.mapViewer;
12
12
  layerRegion = props.layerRegion;
13
13
  layerSpatial = props.layerSpatial;
14
- layerNUTS = props.layerNUTS;
14
+ layerHighlight = props.layerHighlight;
15
15
  }
16
16
 
17
17
  /**
@@ -82,8 +82,7 @@ class NavigationControl extends React.Component {
82
82
 
83
83
  */
84
84
  returnToPrevious() {
85
- // this.layerControl.hideLayer(layerNUTS.id);
86
- this.layerControl.getGeometry('none', layerNUTS);
85
+ // this.layerControl.hideLayer(layerHighlight.id);
87
86
 
88
87
  switch (
89
88
  mapViewer.state.previousState === mapViewer.state.useCaseLevel
@@ -91,10 +90,12 @@ class NavigationControl extends React.Component {
91
90
  : mapViewer.state.previousState
92
91
  ) {
93
92
  case 1:
93
+ this.layerControl.getGeometry('none', layerHighlight);
94
94
  this.showWorld();
95
95
  break;
96
96
 
97
97
  case 2:
98
+ this.layerControl.getGeometry('none', layerHighlight);
98
99
  this.navigateToRegion(
99
100
  mapViewer.state.selectedUseCase.BBOX,
100
101
  mapViewer.state.selectedUseCase.Region,
@@ -17,7 +17,7 @@ let Map,
17
17
  layerControl,
18
18
  navigationControl,
19
19
  layerSpatial,
20
- layerNUTS;
20
+ layerHighlight;
21
21
 
22
22
  class UseCasesMapViewer extends React.Component {
23
23
  constructor(props) {
@@ -48,10 +48,10 @@ class UseCasesMapViewer extends React.Component {
48
48
  label: props.cfg.RegionLabel,
49
49
  showLegend: false,
50
50
  };
51
- this.NUTSConfig = {
52
- id: 'NUTSLayer',
53
- url: props.cfg.Services.NUTS_service,
54
- render: props.cfg.NUTSRenderer,
51
+ this.HighlightConfig = {
52
+ id: 'HightlightLayer',
53
+ url: props.cfg.Services.Highlight_service,
54
+ render: props.cfg.HightlightRenderer,
55
55
  showLegend: false,
56
56
  };
57
57
  this.state = {
@@ -156,21 +156,21 @@ class UseCasesMapViewer extends React.Component {
156
156
  legend: this.regionConfig.showLegend,
157
157
  });
158
158
 
159
- layerNUTS = layerControl.createLayer({
160
- id: this.NUTSConfig.id,
161
- url: this.NUTSConfig.url,
162
- legend: this.NUTSConfig.showLegend,
159
+ layerHighlight = layerControl.createLayer({
160
+ id: this.HighlightConfig.id,
161
+ url: this.HighlightConfig.url,
162
+ legend: this.HighlightConfig.showLegend,
163
163
  });
164
164
 
165
165
  layerRegion.renderer = this.regionConfig.render;
166
166
  layerRegion.labelingInfo = [this.regionConfig.label];
167
- layerNUTS.renderer = this.NUTSConfig.render;
167
+ layerHighlight.renderer = this.HighlightConfig.render;
168
168
 
169
- layerControl.addLayer(layerNUTS);
169
+ layerControl.addLayer(layerHighlight);
170
170
  layerControl.addLayer(layerRegion);
171
171
  layerControl.addLayer(layerSpatial);
172
172
 
173
- layerControl.hideLayer(layerNUTS.id);
173
+ layerControl.hideLayer(layerHighlight.id);
174
174
  layerControl.hideLayer(layerSpatial.id);
175
175
 
176
176
  navigationControl = new NavigationControl({
@@ -181,7 +181,7 @@ class UseCasesMapViewer extends React.Component {
181
181
  mapViewer: this,
182
182
  layerRegion: layerRegion,
183
183
  layerSpatial: layerSpatial,
184
- layerNUTS: layerNUTS,
184
+ layerHighlight: layerHighlight,
185
185
  });
186
186
 
187
187
  this.setMapFunctions(
@@ -298,6 +298,8 @@ class UseCasesMapViewer extends React.Component {
298
298
  longitude: selectedPoint.Longitude,
299
299
  };
300
300
  layerControl.checkIfMorePoints(latLon, (data, MapViewerThis) => {
301
+ layerControl.getGeometry(selectedSpatial, layerHighlight);
302
+ layerControl.showLayer(layerHighlight.id);
301
303
  if (data.features.length !== 1) {
302
304
  MapViewerThis.setState((prevState) => {
303
305
  return {
@@ -424,7 +426,7 @@ class UseCasesMapViewer extends React.Component {
424
426
  navigationControl={navigationControl}
425
427
  layerSpatial={layerSpatial}
426
428
  thumbnail={this.thumbnail}
427
- layerNUTS={layerNUTS}
429
+ layerHighlight={layerHighlight}
428
430
  />
429
431
  );
430
432
  }
@@ -33,8 +33,8 @@ const config = {
33
33
  ],
34
34
  },
35
35
  Services: {
36
- NUTS_service:
37
- 'https://trial.discomap.eea.europa.eu/arcgis/rest/services/CLMS/NUTS_2021/MapServer/0',
36
+ Highlight_service:
37
+ 'https://trial.discomap.eea.europa.eu/arcgis/rest/services/CLMS/UseCasesWorldCountries/MapServer/1',
38
38
  RegionLayer:
39
39
  'https://trial.discomap.eea.europa.eu/arcgis/rest/services/CLMS/UseCasesRegion_count/MapServer/0',
40
40
  SpatialCoverageLayer:
@@ -119,7 +119,7 @@ const config = {
119
119
  ],
120
120
  },
121
121
 
122
- NUTSRenderer: {
122
+ HightlightRenderer: {
123
123
  type: 'unique-value',
124
124
  field: 'LEVL_CODE',
125
125
  defaultSymbol: {