@eeacms/volto-arcgis-block 0.1.182 → 0.1.184
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 +12 -0
- package/Jenkinsfile +2 -2
- package/package.json +1 -1
- package/src/components/MapViewer/AreaWidget.jsx +2 -0
- package/src/components/MapViewer/BookmarkWidget.jsx +152 -0
- package/src/components/MapViewer/MapViewer.jsx +38 -0
- package/src/components/UseCasesMapViewer/LayerControl.jsx +7 -1
- package/src/components/UseCasesMapViewer/NavigationControl.jsx +1 -1
- package/src/components/UseCasesMapViewer/UseCasesMapViewer.jsx +18 -23
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.184](https://github.com/eea/volto-arcgis-block/compare/0.1.183...0.1.184) - 21 August 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-2454 (feat): ESRI Copyright displayed in Area Selection widget when selecting countries [Urkorue - [`e7d060d`](https://github.com/eea/volto-arcgis-block/commit/e7d060dfd8436584e34bc08d67840875b2e3c136)]
|
|
12
|
+
### [0.1.183](https://github.com/eea/volto-arcgis-block/compare/0.1.182...0.1.183) - 7 August 2023
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- CLMS-2446 (jenkins) [Urkorue - [`efc5da9`](https://github.com/eea/volto-arcgis-block/commit/efc5da9ae68f664b295ffee899afb1cd51701507)]
|
|
17
|
+
- CLMS-2446 (bug): EEA38+UK remarked in the use cases map [Urkorue - [`c70ac80`](https://github.com/eea/volto-arcgis-block/commit/c70ac805f53d70efb07e68bd86afabe006bc7b0b)]
|
|
18
|
+
- CLMS-2402 (feat): Changed Use cases basemap to other with more information [Urkorue - [`5f7b42f`](https://github.com/eea/volto-arcgis-block/commit/5f7b42fbfb3e8138a139bdf780a5f09e07fc7f4f)]
|
|
7
19
|
### [0.1.182](https://github.com/eea/volto-arcgis-block/compare/0.1.181...0.1.182) - 3 August 2023
|
|
8
20
|
|
|
9
21
|
#### :house: Documentation changes
|
package/Jenkinsfile
CHANGED
package/package.json
CHANGED
|
@@ -259,6 +259,7 @@ class AreaWidget extends React.Component {
|
|
|
259
259
|
document.querySelector('.drawRectanglePopup-block').style.display =
|
|
260
260
|
'block';
|
|
261
261
|
}
|
|
262
|
+
this.props.view.ui._removeComponents(['attribution']);
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
/**
|
|
@@ -272,6 +273,7 @@ class AreaWidget extends React.Component {
|
|
|
272
273
|
});
|
|
273
274
|
this.props.map.add(this.nutsGroupLayer);
|
|
274
275
|
this.props.view.on('click', (event) => {
|
|
276
|
+
this.props.view.ui.components = ['attribution'];
|
|
275
277
|
if (
|
|
276
278
|
(this.props.mapViewer.activeWidget === this || this.props.download) &&
|
|
277
279
|
(this.props.mapViewer.activeWidget
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { createRef } from 'react';
|
|
2
|
+
//import "@arcgis/core/assets/esri/css/main.css";
|
|
3
|
+
//import "./css/ArcgisMap.css";
|
|
4
|
+
import { loadModules } from 'esri-loader';
|
|
5
|
+
|
|
6
|
+
export const BOOKMARK_SESSION_KEY = 'bookmark_session';
|
|
7
|
+
|
|
8
|
+
var Bookmarks;
|
|
9
|
+
class BookmarkWidget extends React.Component {
|
|
10
|
+
/**
|
|
11
|
+
* Creator of the Basemap widget class
|
|
12
|
+
* @param {*} props
|
|
13
|
+
*/
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
//We create a reference to a DOM element to be mounted
|
|
17
|
+
this.container = createRef();
|
|
18
|
+
//Initially, we set the state of the component to
|
|
19
|
+
//not be showing the basemap panel
|
|
20
|
+
this.state = {
|
|
21
|
+
showMapMenu: false,
|
|
22
|
+
};
|
|
23
|
+
this.mapViewer = this.props.mapViewer;
|
|
24
|
+
this.userID = this.props.userID;
|
|
25
|
+
this.menuClass =
|
|
26
|
+
'esri-icon-bookmark esri-widget--button esri-widget esri-interactive';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
loader() {
|
|
30
|
+
return loadModules(['esri/widgets/Bookmarks']).then(([_Bookmarks]) => {
|
|
31
|
+
Bookmarks = _Bookmarks;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Method that will be invoked when the
|
|
36
|
+
* button is clicked. It controls the open
|
|
37
|
+
* and close actions of the component
|
|
38
|
+
*/
|
|
39
|
+
openMenu() {
|
|
40
|
+
if (this.state.showMapMenu) {
|
|
41
|
+
this.props.mapViewer.setActiveWidget();
|
|
42
|
+
this.container.current.querySelector('.right-panel').style.display =
|
|
43
|
+
'none';
|
|
44
|
+
this.container.current
|
|
45
|
+
.querySelector('.esri-widget--button')
|
|
46
|
+
.classList.remove('active-widget');
|
|
47
|
+
document
|
|
48
|
+
.querySelector('.esri-ui-top-right.esri-ui-corner')
|
|
49
|
+
.classList.remove('show-panel');
|
|
50
|
+
// By invoking the setState, we notify the state we want to reach
|
|
51
|
+
// and ensure that the component is rendered again
|
|
52
|
+
this.setState({ showMapMenu: false });
|
|
53
|
+
} else {
|
|
54
|
+
this.props.mapViewer.setActiveWidget(this);
|
|
55
|
+
this.container.current.querySelector('.right-panel').style.display =
|
|
56
|
+
'flex';
|
|
57
|
+
this.container.current
|
|
58
|
+
.querySelector('.esri-widget--button')
|
|
59
|
+
.classList.add('active-widget');
|
|
60
|
+
document
|
|
61
|
+
.querySelector('.esri-ui-top-right.esri-ui-corner')
|
|
62
|
+
.classList.add('show-panel');
|
|
63
|
+
// By invoking the setState, we notify the state we want to reach
|
|
64
|
+
// and ensure that the component is rendered again
|
|
65
|
+
this.setState({ showMapMenu: true });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* This method is executed after the rener method is executed
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
async componentDidMount() {
|
|
73
|
+
await this.loader();
|
|
74
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
75
|
+
let sessionBookmarks = {};
|
|
76
|
+
if (this.userID != null) {
|
|
77
|
+
sessionBookmarks =
|
|
78
|
+
JSON.parse(
|
|
79
|
+
localStorage.getItem(BOOKMARK_SESSION_KEY + '_' + this.userID),
|
|
80
|
+
) || {};
|
|
81
|
+
}
|
|
82
|
+
this.Bookmarks = new Bookmarks({
|
|
83
|
+
view: this.props.view,
|
|
84
|
+
// allows bookmarks to be added, edited, or deleted
|
|
85
|
+
editingEnabled: true,
|
|
86
|
+
visibleElements: {
|
|
87
|
+
time: false, // don't show the time (h:m:s) next to the date
|
|
88
|
+
},
|
|
89
|
+
container: document.querySelector('.bookmark-panel'),
|
|
90
|
+
bookmarks: sessionBookmarks,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
this.Bookmarks.when(() => {
|
|
94
|
+
this.Bookmarks.bookmarks.on('change', () => {
|
|
95
|
+
if (this.userID != null) {
|
|
96
|
+
localStorage.setItem(
|
|
97
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID,
|
|
98
|
+
JSON.stringify(this.Bookmarks.bookmarks.items),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
this.Bookmarks.on('bookmark-edit', () => {
|
|
103
|
+
if (this.userID != null) {
|
|
104
|
+
localStorage.setItem(
|
|
105
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID,
|
|
106
|
+
JSON.stringify(this.Bookmarks.bookmarks.items),
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* This method renders the component
|
|
114
|
+
* @returns jsx
|
|
115
|
+
*/
|
|
116
|
+
render() {
|
|
117
|
+
return (
|
|
118
|
+
<>
|
|
119
|
+
<div ref={this.container} className="legend-container">
|
|
120
|
+
<div tooltip="Bookmark" direction="left" type="widget">
|
|
121
|
+
<div
|
|
122
|
+
className={this.menuClass}
|
|
123
|
+
id="legend_button"
|
|
124
|
+
aria-label="Bookmark"
|
|
125
|
+
onClick={this.openMenu.bind(this)}
|
|
126
|
+
onKeyDown={this.openMenu.bind(this)}
|
|
127
|
+
tabIndex="0"
|
|
128
|
+
role="button"
|
|
129
|
+
></div>
|
|
130
|
+
</div>
|
|
131
|
+
<div className="right-panel">
|
|
132
|
+
<div className="right-panel-header">
|
|
133
|
+
<span>Bookmark</span>
|
|
134
|
+
<span
|
|
135
|
+
className="map-menu-icon esri-icon-close"
|
|
136
|
+
onClick={this.openMenu.bind(this)}
|
|
137
|
+
onKeyDown={this.openMenu.bind(this)}
|
|
138
|
+
tabIndex="0"
|
|
139
|
+
role="button"
|
|
140
|
+
></span>
|
|
141
|
+
</div>
|
|
142
|
+
<div className="right-panel-content">
|
|
143
|
+
<div className="bookmark-panel"></div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default BookmarkWidget;
|
|
@@ -18,6 +18,7 @@ import InfoWidget from './InfoWidget';
|
|
|
18
18
|
import MenuWidget from './MenuWidget';
|
|
19
19
|
import HotspotWidget from './HotspotWidget';
|
|
20
20
|
import PanWidget from './PanWidget';
|
|
21
|
+
import BookmarkWidget from './BookmarkWidget';
|
|
21
22
|
//import "isomorphic-fetch"; <-- Necessary to use fetch?
|
|
22
23
|
var Map, MapView, Zoom, intl, Basemap, WebTileLayer, Extent;
|
|
23
24
|
let mapStatus = {};
|
|
@@ -55,6 +56,7 @@ class MapViewer extends React.Component {
|
|
|
55
56
|
this.activeLayersArray = {};
|
|
56
57
|
this.props.mapviewer_config.loading = true;
|
|
57
58
|
this.cfgUrls = this.props.cfg.Urls;
|
|
59
|
+
this.userID = null;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
activeLayersHandler(newActiveLayers) {
|
|
@@ -90,6 +92,7 @@ class MapViewer extends React.Component {
|
|
|
90
92
|
'esri/Basemap',
|
|
91
93
|
'esri/layers/WebTileLayer',
|
|
92
94
|
'esri/geometry/Extent',
|
|
95
|
+
'esri/widgets/Bookmarks',
|
|
93
96
|
]).then(
|
|
94
97
|
([_Map, _MapView, _Zoom, _intl, _Basemap, _WebTileLayer, _Extent]) => {
|
|
95
98
|
[Map, MapView, Zoom, intl, Basemap, WebTileLayer, Extent] = [
|
|
@@ -350,6 +353,10 @@ class MapViewer extends React.Component {
|
|
|
350
353
|
); //call conf
|
|
351
354
|
}
|
|
352
355
|
|
|
356
|
+
renderBookmark() {
|
|
357
|
+
if (this.view) return <CheckUserID reference={this} />;
|
|
358
|
+
}
|
|
359
|
+
|
|
353
360
|
appLanguage() {
|
|
354
361
|
return intl && <CheckLanguage />;
|
|
355
362
|
}
|
|
@@ -383,6 +390,7 @@ class MapViewer extends React.Component {
|
|
|
383
390
|
{this.renderInfo()}
|
|
384
391
|
{this.renderHotspot()}
|
|
385
392
|
{this.renderMenu()}
|
|
393
|
+
{this.renderBookmark()}
|
|
386
394
|
</div>
|
|
387
395
|
</div>
|
|
388
396
|
);
|
|
@@ -407,6 +415,36 @@ export const CheckLogin = ({ reference }) => {
|
|
|
407
415
|
</>
|
|
408
416
|
);
|
|
409
417
|
};
|
|
418
|
+
export const CheckUserID = ({ reference }) => {
|
|
419
|
+
let { user_id, isLoggedIn } = useCartState();
|
|
420
|
+
if (isLoggedIn) {
|
|
421
|
+
return (
|
|
422
|
+
<>
|
|
423
|
+
{
|
|
424
|
+
<BookmarkWidget
|
|
425
|
+
view={reference.view}
|
|
426
|
+
map={reference.map}
|
|
427
|
+
mapViewer={reference}
|
|
428
|
+
userID={user_id}
|
|
429
|
+
/>
|
|
430
|
+
}
|
|
431
|
+
</>
|
|
432
|
+
);
|
|
433
|
+
} else {
|
|
434
|
+
return (
|
|
435
|
+
<>
|
|
436
|
+
{
|
|
437
|
+
<BookmarkWidget
|
|
438
|
+
view={reference.view}
|
|
439
|
+
map={reference.map}
|
|
440
|
+
mapViewer={reference}
|
|
441
|
+
userID={null}
|
|
442
|
+
/>
|
|
443
|
+
}
|
|
444
|
+
</>
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
};
|
|
410
448
|
|
|
411
449
|
export default compose(
|
|
412
450
|
connect(
|
|
@@ -29,7 +29,12 @@ class LayerControl {
|
|
|
29
29
|
|
|
30
30
|
getGeometry(country, layer) {
|
|
31
31
|
layer.definitionExpression = `(`;
|
|
32
|
-
if (
|
|
32
|
+
if (
|
|
33
|
+
country === 'EU' ||
|
|
34
|
+
country === 'EU 27+UK' ||
|
|
35
|
+
country === 'EEA38' ||
|
|
36
|
+
country === 'EEA38+UK'
|
|
37
|
+
) {
|
|
33
38
|
let states = mapViewer.props.cfg.Codes[country];
|
|
34
39
|
for (let i = 0; i < states.length; i++) {
|
|
35
40
|
layer.definitionExpression += `CNTR_ID = '${states[i]}'`;
|
|
@@ -124,6 +129,7 @@ class LayerControl {
|
|
|
124
129
|
return Math.min(latZoom, lngZoom, this.zoomMax);
|
|
125
130
|
//TODO calculate the corresponding level of zoom automatically
|
|
126
131
|
}
|
|
132
|
+
|
|
127
133
|
latRad(lat) {
|
|
128
134
|
let sin = Math.sin((lat * Math.PI) / 180);
|
|
129
135
|
let radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
|
|
@@ -21,7 +21,7 @@ class NavigationControl extends React.Component {
|
|
|
21
21
|
this.layerControl.hideLayer(layerSpatial.id);
|
|
22
22
|
this.layerControl.showLayer(layerRegion.id);
|
|
23
23
|
this.view.center = this.center;
|
|
24
|
-
this.view.zoom =
|
|
24
|
+
this.view.zoom = 1;
|
|
25
25
|
layerSpatial.definitionExpression = null;
|
|
26
26
|
mapViewer.setState(() => ({
|
|
27
27
|
useCaseLevel: 1,
|
|
@@ -13,11 +13,11 @@ let Map,
|
|
|
13
13
|
FeatureLayer,
|
|
14
14
|
Extent,
|
|
15
15
|
Basemap,
|
|
16
|
-
VectorTileLayer,
|
|
17
16
|
layerControl,
|
|
18
17
|
navigationControl,
|
|
19
18
|
layerSpatial,
|
|
20
|
-
layerHighlight
|
|
19
|
+
layerHighlight,
|
|
20
|
+
WebTileLayer;
|
|
21
21
|
|
|
22
22
|
class UseCasesMapViewer extends React.Component {
|
|
23
23
|
constructor(props) {
|
|
@@ -74,23 +74,16 @@ class UseCasesMapViewer extends React.Component {
|
|
|
74
74
|
'esri/layers/FeatureLayer',
|
|
75
75
|
'esri/geometry/Extent',
|
|
76
76
|
'esri/Basemap',
|
|
77
|
-
'esri/layers/
|
|
77
|
+
'esri/layers/WebTileLayer',
|
|
78
78
|
]).then(
|
|
79
|
-
([
|
|
80
|
-
|
|
81
|
-
_MapView,
|
|
82
|
-
_FeatureLayer,
|
|
83
|
-
_Extent,
|
|
84
|
-
_Basemap,
|
|
85
|
-
_VectorTileLayer,
|
|
86
|
-
]) => {
|
|
87
|
-
[Map, MapView, FeatureLayer, Extent, Basemap, VectorTileLayer] = [
|
|
79
|
+
([_Map, _MapView, _FeatureLayer, _Extent, _Basemap, _WebTileLayer]) => {
|
|
80
|
+
[Map, MapView, FeatureLayer, Extent, Basemap, WebTileLayer] = [
|
|
88
81
|
_Map,
|
|
89
82
|
_MapView,
|
|
90
83
|
_FeatureLayer,
|
|
91
84
|
_Extent,
|
|
92
85
|
_Basemap,
|
|
93
|
-
|
|
86
|
+
_WebTileLayer,
|
|
94
87
|
];
|
|
95
88
|
},
|
|
96
89
|
);
|
|
@@ -105,27 +98,29 @@ class UseCasesMapViewer extends React.Component {
|
|
|
105
98
|
loadCss();
|
|
106
99
|
await this.loader();
|
|
107
100
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
this.basemap = new Basemap({
|
|
102
|
+
title: 'Countries World',
|
|
103
|
+
thumbnailUrl:
|
|
104
|
+
'https://gisco-services.ec.europa.eu/maps/wmts/CountriesWorld/EPSG3857/0/0/0.png',
|
|
105
|
+
baseLayers: [
|
|
106
|
+
new WebTileLayer({
|
|
107
|
+
urlTemplate:
|
|
108
|
+
'https://gisco-services.ec.europa.eu/maps/tiles/CountriesWorld/EPSG3857/{z}/{x}/{y}.png',
|
|
109
|
+
}),
|
|
110
|
+
],
|
|
116
111
|
});
|
|
117
112
|
|
|
118
113
|
// this.mapdiv.current is the reference to the current DOM element of
|
|
119
114
|
// this.mapdiv after it was mounted by the render() method
|
|
120
115
|
this.map = new Map({
|
|
121
|
-
basemap: basemap,
|
|
116
|
+
basemap: this.basemap,
|
|
122
117
|
});
|
|
123
118
|
|
|
124
119
|
this.view = new MapView({
|
|
125
120
|
container: this.mapdiv.current,
|
|
126
121
|
map: this.map,
|
|
127
122
|
center: this.mapCfg.center,
|
|
128
|
-
zoom:
|
|
123
|
+
zoom: 1,
|
|
129
124
|
ui: {
|
|
130
125
|
components: ['attribution'],
|
|
131
126
|
},
|