@eeacms/volto-arcgis-block 0.1.13 → 0.1.17
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 +61 -0
- package/Jenkinsfile +28 -5
- package/package.json +6 -2
- package/src/components/MapViewer/AreaWidget.jsx +88 -37
- package/src/components/MapViewer/LegendWidget.jsx +2 -0
- package/src/components/MapViewer/MapViewer.jsx +8 -0
- package/src/components/MapViewer/MenuWidget.jsx +498 -108
- package/src/components/MapViewer/TimesliderWidget.jsx +81 -0
- package/src/components/MapViewer/css/ArcgisMap.css +50 -9
- package/src/components/UseCasesMapViewer/InfoWidget.jsx +30 -32
- package/src/components/UseCasesMapViewer/LayerControl.jsx +58 -23
- package/src/components/UseCasesMapViewer/LegendWidget.jsx +122 -0
- package/src/components/UseCasesMapViewer/NavigationControl.jsx +2 -2
- package/src/components/UseCasesMapViewer/UseCasesMapViewer.jsx +39 -51
- package/src/components/UseCasesMapViewer/config.js +15 -1
- package/src/components/UseCasesMapViewer/css/ArcgisMap.css +26 -0
- package/src/components/UseCasesMapViewer/map.css +0 -6
|
@@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { loadModules, loadCss } from 'esri-loader';
|
|
6
6
|
import LayerControl from './LayerControl';
|
|
7
7
|
import InfoWidget from './InfoWidget';
|
|
8
|
+
import LegendWidget from './LegendWidget';
|
|
8
9
|
import NavigationControl from './NavigationControl';
|
|
9
10
|
|
|
10
11
|
let Map,
|
|
@@ -28,6 +29,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
28
29
|
this.map = null;
|
|
29
30
|
this.id = props.id;
|
|
30
31
|
this.popupOnce = false;
|
|
32
|
+
this.popupRegion = '';
|
|
31
33
|
this.mapClass = classNames('map-container', {
|
|
32
34
|
[`${props.customClass}`]: props.customClass || null,
|
|
33
35
|
});
|
|
@@ -48,6 +50,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
48
50
|
selectedUseCase: '',
|
|
49
51
|
selectedUseCases: [],
|
|
50
52
|
previousState: 1,
|
|
53
|
+
showMapMenu: false,
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -123,6 +126,8 @@ class UseCasesMapViewer extends React.Component {
|
|
|
123
126
|
map: this.map,
|
|
124
127
|
view: this.view,
|
|
125
128
|
mapViewer: this,
|
|
129
|
+
worldDimensions: this.mapCfg.worldDimensions,
|
|
130
|
+
maxZoom: this.mapCfg.maxZoom,
|
|
126
131
|
FeatureLayer: FeatureLayer,
|
|
127
132
|
Extent: Extent,
|
|
128
133
|
});
|
|
@@ -134,7 +139,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
134
139
|
|
|
135
140
|
layerSpatial.renderer = this.spatialConfig.render;
|
|
136
141
|
|
|
137
|
-
|
|
142
|
+
let layerRegion = layerControl.createLayer({
|
|
138
143
|
id: this.regionConfig.id,
|
|
139
144
|
url: this.regionConfig.url,
|
|
140
145
|
});
|
|
@@ -179,17 +184,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
179
184
|
* @param {FeatureLayer} layerSpatial
|
|
180
185
|
*/
|
|
181
186
|
setMapFunctions(view, layerControl, navigationControl, layerSpatial) {
|
|
182
|
-
const prohibitedKeys =
|
|
183
|
-
'+',
|
|
184
|
-
'-',
|
|
185
|
-
'Shift',
|
|
186
|
-
'_',
|
|
187
|
-
'=',
|
|
188
|
-
'ArrowUp',
|
|
189
|
-
'ArrowDown',
|
|
190
|
-
'ArrowLeft',
|
|
191
|
-
'ArrowRight',
|
|
192
|
-
];
|
|
187
|
+
const prohibitedKeys = this.mapCfg.prohibitedKeys;
|
|
193
188
|
|
|
194
189
|
view.on('mouse-wheel', function (event) {
|
|
195
190
|
event.stopPropagation();
|
|
@@ -214,27 +209,27 @@ class UseCasesMapViewer extends React.Component {
|
|
|
214
209
|
event.stopPropagation();
|
|
215
210
|
});
|
|
216
211
|
view.on('key-down', function (event) {
|
|
217
|
-
|
|
212
|
+
let keyPressed = event.key;
|
|
218
213
|
if (prohibitedKeys.indexOf(keyPressed) !== -1) {
|
|
219
214
|
event.stopPropagation();
|
|
220
215
|
}
|
|
221
216
|
});
|
|
222
217
|
view.on('key-down', ['Shift'], function (event) {
|
|
223
|
-
|
|
218
|
+
let keyPressed = event.key;
|
|
224
219
|
if (prohibitedKeys.indexOf(keyPressed) !== -1) {
|
|
225
220
|
event.stopPropagation();
|
|
226
221
|
}
|
|
227
222
|
});
|
|
228
223
|
view.on('click', (e) => {
|
|
229
|
-
|
|
224
|
+
let screenPoint = { x: e.x, y: e.y };
|
|
230
225
|
|
|
231
226
|
(async () => {
|
|
232
227
|
let selectedPoint = await layerControl.getPointInfo(screenPoint);
|
|
233
228
|
if (selectedPoint.BBOX) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
229
|
+
let selectedRegion = selectedPoint.Region;
|
|
230
|
+
let boundingBox = selectedPoint.BBOX;
|
|
231
|
+
let selectedTitle = selectedPoint.Use_case_title;
|
|
232
|
+
let selectedSpatial = selectedPoint.Spatial_coverage;
|
|
238
233
|
if (this.state.useCaseLevel === 1 && selectedPoint.COUNT > 1) {
|
|
239
234
|
navigationControl.navigateToRegion(
|
|
240
235
|
boundingBox,
|
|
@@ -244,6 +239,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
244
239
|
this.setState((prevState) => {
|
|
245
240
|
return {
|
|
246
241
|
useCaseLevel: 2,
|
|
242
|
+
selectedUseCase: selectedPoint,
|
|
247
243
|
region: selectedRegion,
|
|
248
244
|
previousState: prevState.useCaseLevel,
|
|
249
245
|
};
|
|
@@ -274,7 +270,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
274
270
|
},
|
|
275
271
|
);
|
|
276
272
|
} else {
|
|
277
|
-
|
|
273
|
+
let latLon = {
|
|
278
274
|
latitude: selectedPoint.Latitude,
|
|
279
275
|
longitude: selectedPoint.Longitude,
|
|
280
276
|
};
|
|
@@ -283,6 +279,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
283
279
|
MapViewerThis.setState((prevState) => {
|
|
284
280
|
return {
|
|
285
281
|
useCaseLevel: 3,
|
|
282
|
+
selectedUseCase: selectedPoint,
|
|
286
283
|
selectedUseCases: data.features,
|
|
287
284
|
previousState: prevState.useCaseLevel,
|
|
288
285
|
};
|
|
@@ -318,13 +315,13 @@ class UseCasesMapViewer extends React.Component {
|
|
|
318
315
|
x: e.x,
|
|
319
316
|
y: e.y,
|
|
320
317
|
};
|
|
321
|
-
|
|
322
318
|
if (this.state.useCaseLevel === 1) {
|
|
323
319
|
view.hitTest(screenPoint).then((response) => {
|
|
324
320
|
if (response.results.length > 1) {
|
|
325
321
|
if (
|
|
326
322
|
response.results[0].graphic.geometry !== null &&
|
|
327
|
-
this.popupOnce
|
|
323
|
+
this.popupOnce &&
|
|
324
|
+
this.popupRegion === response.results[0].graphic.attributes.Region
|
|
328
325
|
) {
|
|
329
326
|
this.popupOnce = false;
|
|
330
327
|
document.querySelector('.map').style.cursor = 'pointer';
|
|
@@ -349,16 +346,16 @@ class UseCasesMapViewer extends React.Component {
|
|
|
349
346
|
|
|
350
347
|
let string = '';
|
|
351
348
|
if (data_eu > 0) {
|
|
352
|
-
string += `<div
|
|
349
|
+
string += `<div>${data_eu} Use cases with EU27+UK coverage</div>`;
|
|
353
350
|
}
|
|
354
351
|
if (data_eea > 0) {
|
|
355
|
-
string += `<div
|
|
352
|
+
string += `<div>${data_eea} Use cases with EEA38+UK coverage</div>`;
|
|
356
353
|
}
|
|
357
354
|
if (data_global > 0) {
|
|
358
355
|
string += `<div>Global use cases: ${data_global}</div>`;
|
|
359
356
|
}
|
|
360
357
|
if (data_country > 0) {
|
|
361
|
-
string += `<div
|
|
358
|
+
string += `<div>${data_country} Use cases with one or multi-country coverage</div>`;
|
|
362
359
|
}
|
|
363
360
|
|
|
364
361
|
view.popup.open({
|
|
@@ -369,37 +366,23 @@ class UseCasesMapViewer extends React.Component {
|
|
|
369
366
|
content: string,
|
|
370
367
|
});
|
|
371
368
|
});
|
|
369
|
+
} else {
|
|
370
|
+
this.popupRegion = response.results[0].graphic.attributes.Region;
|
|
371
|
+
this.popupOnce = true;
|
|
372
|
+
if (response.results[0].graphic.attributes.Region === undefined) {
|
|
373
|
+
view.popup.close();
|
|
374
|
+
document.querySelector('.map').style.cursor = '';
|
|
375
|
+
}
|
|
372
376
|
}
|
|
373
377
|
} else {
|
|
374
|
-
view.popup.close();
|
|
375
378
|
this.popupOnce = true;
|
|
376
379
|
document.querySelector('.map').style.cursor = '';
|
|
380
|
+
view.popup.close();
|
|
377
381
|
}
|
|
378
382
|
});
|
|
379
383
|
} else if (this.state.useCaseLevel === 2) {
|
|
380
384
|
view.hitTest(screenPoint).then((response) => {
|
|
381
|
-
|
|
382
|
-
if (
|
|
383
|
-
response.results[0].graphic.geometry !== null &&
|
|
384
|
-
this.popupOnce
|
|
385
|
-
) {
|
|
386
|
-
this.popupOnce = false;
|
|
387
|
-
document.querySelector('.map').style.cursor = 'pointer';
|
|
388
|
-
document
|
|
389
|
-
.querySelector(
|
|
390
|
-
'#use_case_' +
|
|
391
|
-
response.results[0].graphic.attributes.OBJECTID,
|
|
392
|
-
)
|
|
393
|
-
.classList.add('selected');
|
|
394
|
-
}
|
|
395
|
-
} else {
|
|
396
|
-
this.popupOnce = true;
|
|
397
|
-
document.querySelector('.map').style.cursor = '';
|
|
398
|
-
if (document.querySelector('.use-case-element.selected'))
|
|
399
|
-
document
|
|
400
|
-
.querySelector('.use-case-element.selected')
|
|
401
|
-
.classList.remove('selected');
|
|
402
|
-
}
|
|
385
|
+
layerControl.highlightInfo(response);
|
|
403
386
|
});
|
|
404
387
|
}
|
|
405
388
|
});
|
|
@@ -419,6 +402,12 @@ class UseCasesMapViewer extends React.Component {
|
|
|
419
402
|
}
|
|
420
403
|
}
|
|
421
404
|
|
|
405
|
+
renderLegend() {
|
|
406
|
+
if (this.view) {
|
|
407
|
+
return <LegendWidget view={this.view} mapViewer={this} />;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
422
411
|
/**
|
|
423
412
|
* This method renders the map viewer, invoking if necessary the methods
|
|
424
413
|
* to render the other widgets to display
|
|
@@ -436,10 +425,9 @@ class UseCasesMapViewer extends React.Component {
|
|
|
436
425
|
</div>
|
|
437
426
|
<div className="ccl-container ccl-container-flex">
|
|
438
427
|
{this.renderInfo()}
|
|
428
|
+
{this.renderLegend()}
|
|
439
429
|
<div className="use-cases-products-map cont-w-50">
|
|
440
|
-
<div className="use-cases-products-title">
|
|
441
|
-
Organisation locations
|
|
442
|
-
</div>
|
|
430
|
+
<div className="use-cases-products-title">{this.mapCfg.title}</div>
|
|
443
431
|
<div className={this.mapClass}>
|
|
444
432
|
<div ref={this.mapdiv} className="map"></div>
|
|
445
433
|
</div>
|
|
@@ -7,7 +7,7 @@ const greenSpatial = '#a2b32e';
|
|
|
7
7
|
const black = '#000000';
|
|
8
8
|
|
|
9
9
|
const regionMarkerSize = '40px';
|
|
10
|
-
const regionOutlineSize = '
|
|
10
|
+
const regionOutlineSize = '6px';
|
|
11
11
|
const regionLabelTextPosition = 'center-center';
|
|
12
12
|
const grey = '#656565';
|
|
13
13
|
const greenRegion = '#acba47';
|
|
@@ -15,8 +15,22 @@ const greenRegion = '#acba47';
|
|
|
15
15
|
const config = {
|
|
16
16
|
Map: {
|
|
17
17
|
div: 'mapDiv',
|
|
18
|
+
title: 'Geographical coverage of use cases',
|
|
18
19
|
center: [10.78, 30],
|
|
19
20
|
zoom: 0,
|
|
21
|
+
maxZoom: 5,
|
|
22
|
+
worldDimensions: { height: 256, width: 256 },
|
|
23
|
+
prohibitedKeys: [
|
|
24
|
+
'+',
|
|
25
|
+
'-',
|
|
26
|
+
'Shift',
|
|
27
|
+
'_',
|
|
28
|
+
'=',
|
|
29
|
+
'ArrowUp',
|
|
30
|
+
'ArrowDown',
|
|
31
|
+
'ArrowLeft',
|
|
32
|
+
'ArrowRight',
|
|
33
|
+
],
|
|
20
34
|
},
|
|
21
35
|
Services: {
|
|
22
36
|
RegionLayer:
|
|
@@ -40,10 +40,31 @@
|
|
|
40
40
|
height: 25rem;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
.use-cases-products-map .esri-widget--button {
|
|
44
|
+
border: none !important;
|
|
45
|
+
background-color: #a0b128cc;
|
|
46
|
+
box-shadow: none !important;
|
|
47
|
+
color: white;
|
|
48
|
+
line-height: 1rem;
|
|
49
|
+
outline: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.use-cases-products-map .esri-widget--button:hover {
|
|
53
|
+
background-color: #7c8921;
|
|
54
|
+
color: white;
|
|
55
|
+
}
|
|
56
|
+
|
|
43
57
|
.use-cases-products-map .esri-attribution {
|
|
44
58
|
display: none;
|
|
45
59
|
}
|
|
46
60
|
|
|
61
|
+
.use-cases-products-map
|
|
62
|
+
.esri-popup--aligned-top-center
|
|
63
|
+
.esri-popup__main-container.esri-widget {
|
|
64
|
+
width: auto;
|
|
65
|
+
max-width: 360px;
|
|
66
|
+
}
|
|
67
|
+
|
|
47
68
|
.use-cases-products-map .esri-widget .esri-popup__header {
|
|
48
69
|
display: none;
|
|
49
70
|
}
|
|
@@ -57,6 +78,7 @@
|
|
|
57
78
|
}
|
|
58
79
|
|
|
59
80
|
.use-cases-products-list {
|
|
81
|
+
width: 100%;
|
|
60
82
|
max-height: 25rem;
|
|
61
83
|
overflow-y: auto;
|
|
62
84
|
}
|
|
@@ -170,6 +192,10 @@
|
|
|
170
192
|
flex-direction: column;
|
|
171
193
|
}
|
|
172
194
|
|
|
195
|
+
.use-cases-container .ccl-container-flex {
|
|
196
|
+
justify-content: flex-end;
|
|
197
|
+
}
|
|
198
|
+
|
|
173
199
|
.use-cases-map-container {
|
|
174
200
|
position: relative;
|
|
175
201
|
width: 100%;
|