@eeacms/volto-arcgis-block 0.1.246 → 0.1.248
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 +4 -0
- package/package.json +1 -1
- package/src/components/MapViewer/BookmarkWidget.jsx +231 -10
- package/src/components/MapViewer/HotspotWidget.jsx +76 -29
- package/src/components/MapViewer/MapViewer.jsx +2 -0
- package/src/components/MapViewer/MenuWidget.jsx +24 -0
- package/src/components/MapViewer/TimesliderWidget.jsx +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ 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.248](https://github.com/eea/volto-arcgis-block/compare/0.1.247...0.1.248) - 12 January 2024
|
|
8
|
+
|
|
9
|
+
### [0.1.247](https://github.com/eea/volto-arcgis-block/compare/0.1.246...0.1.247) - 10 January 2024
|
|
10
|
+
|
|
7
11
|
### [0.1.246](https://github.com/eea/volto-arcgis-block/compare/0.1.245...0.1.246) - 10 January 2024
|
|
8
12
|
|
|
9
13
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -21,9 +21,16 @@ class BookmarkWidget extends React.Component {
|
|
|
21
21
|
showMapMenu: false,
|
|
22
22
|
};
|
|
23
23
|
this.mapViewer = this.props.mapViewer;
|
|
24
|
+
this.map = this.props.map;
|
|
25
|
+
this.layers = this.props.layers;
|
|
24
26
|
this.userID = this.props.userID;
|
|
25
27
|
this.menuClass =
|
|
26
28
|
'esri-icon-bookmark esri-widget--button esri-widget esri-interactive';
|
|
29
|
+
this.sessionBookmarks = [];
|
|
30
|
+
this.sessionBookmarkLayers = [];
|
|
31
|
+
this.sessionBookmarkOpacity = [];
|
|
32
|
+
this.sessionBookmarkVisible = [];
|
|
33
|
+
this.sessionBookmarkHotspot = [];
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
loader() {
|
|
@@ -70,20 +77,65 @@ class BookmarkWidget extends React.Component {
|
|
|
70
77
|
*/
|
|
71
78
|
|
|
72
79
|
limitMaxLenth() {
|
|
73
|
-
|
|
74
|
-
'.esri-bookmarks__authoring-label .esri-input'
|
|
75
|
-
)
|
|
80
|
+
if (
|
|
81
|
+
document.querySelector('.esri-bookmarks__authoring-label .esri-input')
|
|
82
|
+
) {
|
|
83
|
+
document.querySelector(
|
|
84
|
+
'.esri-bookmarks__authoring-label .esri-input',
|
|
85
|
+
).maxLength = 150;
|
|
86
|
+
}
|
|
76
87
|
}
|
|
77
88
|
|
|
78
89
|
async componentDidMount() {
|
|
79
90
|
await this.loader();
|
|
80
91
|
this.props.view.ui.add(this.container.current, 'top-right');
|
|
81
|
-
let sessionBookmarks = {};
|
|
82
92
|
if (this.userID != null) {
|
|
83
|
-
sessionBookmarks =
|
|
93
|
+
this.sessionBookmarks =
|
|
84
94
|
JSON.parse(
|
|
85
95
|
localStorage.getItem(BOOKMARK_SESSION_KEY + '_' + this.userID),
|
|
86
|
-
) ||
|
|
96
|
+
) || [];
|
|
97
|
+
this.sessionBookmarkLayers =
|
|
98
|
+
JSON.parse(
|
|
99
|
+
localStorage.getItem(
|
|
100
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_layers',
|
|
101
|
+
),
|
|
102
|
+
) || [];
|
|
103
|
+
while (this.sessionBookmarkLayers.length < this.sessionBookmarks.length) {
|
|
104
|
+
this.sessionBookmarkLayers.push([]);
|
|
105
|
+
}
|
|
106
|
+
this.sessionBookmarkOpacity =
|
|
107
|
+
JSON.parse(
|
|
108
|
+
localStorage.getItem(
|
|
109
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_opacity',
|
|
110
|
+
),
|
|
111
|
+
) || [];
|
|
112
|
+
while (
|
|
113
|
+
this.sessionBookmarkOpacity.length < this.sessionBookmarks.length
|
|
114
|
+
) {
|
|
115
|
+
this.sessionBookmarkOpacity.push([]);
|
|
116
|
+
}
|
|
117
|
+
this.sessionBookmarkVisible =
|
|
118
|
+
JSON.parse(
|
|
119
|
+
localStorage.getItem(
|
|
120
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_visible',
|
|
121
|
+
),
|
|
122
|
+
) || [];
|
|
123
|
+
while (
|
|
124
|
+
this.sessionBookmarkVisible.length < this.sessionBookmarks.length
|
|
125
|
+
) {
|
|
126
|
+
this.sessionBookmarkVisible.push([]);
|
|
127
|
+
}
|
|
128
|
+
this.sessionBookmarkHotspot =
|
|
129
|
+
JSON.parse(
|
|
130
|
+
localStorage.getItem(
|
|
131
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_hotspot',
|
|
132
|
+
),
|
|
133
|
+
) || [];
|
|
134
|
+
while (
|
|
135
|
+
this.sessionBookmarkHotspot.length < this.sessionBookmarks.length
|
|
136
|
+
) {
|
|
137
|
+
this.sessionBookmarkHotspot.push([]);
|
|
138
|
+
}
|
|
87
139
|
}
|
|
88
140
|
this.Bookmarks = new Bookmarks({
|
|
89
141
|
view: this.props.view,
|
|
@@ -93,25 +145,194 @@ class BookmarkWidget extends React.Component {
|
|
|
93
145
|
time: false, // don't show the time (h:m:s) next to the date
|
|
94
146
|
},
|
|
95
147
|
container: document.querySelector('.bookmark-panel'),
|
|
96
|
-
bookmarks: sessionBookmarks,
|
|
148
|
+
bookmarks: this.sessionBookmarks,
|
|
149
|
+
});
|
|
150
|
+
this.sessionBookmarks = [];
|
|
151
|
+
this.Bookmarks.bookmarks.items.forEach((bookmark) => {
|
|
152
|
+
this.sessionBookmarks.push(bookmark);
|
|
97
153
|
});
|
|
98
|
-
|
|
99
154
|
this.Bookmarks.when(() => {
|
|
100
|
-
this.Bookmarks.bookmarks.on('change', () => {
|
|
155
|
+
this.Bookmarks.bookmarks.on('change', (e) => {
|
|
156
|
+
if (e.added[0]) {
|
|
157
|
+
let check = JSON.parse(sessionStorage.getItem('checkedLayers')) || [];
|
|
158
|
+
let visibleLayers =
|
|
159
|
+
JSON.parse(sessionStorage.getItem('visibleLayers')) || [];
|
|
160
|
+
let opacity = [];
|
|
161
|
+
let visible = [];
|
|
162
|
+
check.forEach((layer) => {
|
|
163
|
+
opacity.push(this.layers[layer].opacity);
|
|
164
|
+
if (
|
|
165
|
+
visibleLayers[check] &&
|
|
166
|
+
visibleLayers[check][1] === 'eye-slash'
|
|
167
|
+
) {
|
|
168
|
+
visible.push(false);
|
|
169
|
+
} else {
|
|
170
|
+
visible.push(true);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
this.sessionBookmarks.push(e.added[0]);
|
|
174
|
+
this.sessionBookmarkLayers.push(check);
|
|
175
|
+
this.sessionBookmarkOpacity.push(opacity);
|
|
176
|
+
this.sessionBookmarkVisible.push(visible);
|
|
177
|
+
let hotspotFilters = {
|
|
178
|
+
activeLayers: {},
|
|
179
|
+
filteredLayers: {},
|
|
180
|
+
};
|
|
181
|
+
Object.keys(this.props.hotspotData.activeLayers).forEach((key) => {
|
|
182
|
+
hotspotFilters.activeLayers[key] = null;
|
|
183
|
+
});
|
|
184
|
+
Object.keys(this.props.hotspotData.filteredLayers).forEach((key) => {
|
|
185
|
+
hotspotFilters.filteredLayers[
|
|
186
|
+
key
|
|
187
|
+
] = this.props.hotspotData.filteredLayers[
|
|
188
|
+
key
|
|
189
|
+
].customLayerParameters['CQL_FILTER'];
|
|
190
|
+
});
|
|
191
|
+
this.sessionBookmarkHotspot.push(hotspotFilters);
|
|
192
|
+
} else if (e.removed[0]) {
|
|
193
|
+
for (let index = 0; index < this.sessionBookmarks.length; index++) {
|
|
194
|
+
if (e.removed[0] === this.sessionBookmarks[index]) {
|
|
195
|
+
this.sessionBookmarks.splice(index, 1);
|
|
196
|
+
this.sessionBookmarkLayers.splice(index, 1);
|
|
197
|
+
this.sessionBookmarkOpacity.splice(index, 1);
|
|
198
|
+
this.sessionBookmarkVisible.splice(index, 1);
|
|
199
|
+
this.sessionBookmarkHotspot.splice(index, 1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
let newSessionBookmark = [];
|
|
204
|
+
let newSessionBookmarkLayers = [];
|
|
205
|
+
let newSessionBookmarkOpacity = [];
|
|
206
|
+
let newSessionBookmarkVisible = [];
|
|
207
|
+
let newSessionBookmarkHotspot = [];
|
|
208
|
+
for (let i = 0; i < this.Bookmarks.bookmarks.items.length; i++) {
|
|
209
|
+
for (let j = 0; j < this.sessionBookmarks.length; j++) {
|
|
210
|
+
if (
|
|
211
|
+
this.Bookmarks.bookmarks.items[i] === this.sessionBookmarks[j]
|
|
212
|
+
) {
|
|
213
|
+
newSessionBookmark.push(this.sessionBookmarks[j]);
|
|
214
|
+
newSessionBookmarkLayers.push(this.sessionBookmarkLayers[j]);
|
|
215
|
+
newSessionBookmarkOpacity.push(this.sessionBookmarkOpacity[j]);
|
|
216
|
+
newSessionBookmarkVisible.push(this.sessionBookmarkVisible[j]);
|
|
217
|
+
newSessionBookmarkHotspot.push(this.sessionBookmarkHotspot[j]);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
this.sessionBookmarks = newSessionBookmark;
|
|
222
|
+
this.sessionBookmarkLayers = newSessionBookmarkLayers;
|
|
223
|
+
this.sessionBookmarkOpacity = newSessionBookmarkOpacity;
|
|
224
|
+
this.sessionBookmarkVisible = newSessionBookmarkVisible;
|
|
225
|
+
this.sessionBookmarkHotspot = newSessionBookmarkHotspot;
|
|
226
|
+
}
|
|
101
227
|
if (this.userID != null) {
|
|
102
228
|
localStorage.setItem(
|
|
103
229
|
BOOKMARK_SESSION_KEY + '_' + this.userID,
|
|
104
230
|
JSON.stringify(this.Bookmarks.bookmarks.items),
|
|
105
231
|
);
|
|
232
|
+
localStorage.setItem(
|
|
233
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_layers',
|
|
234
|
+
JSON.stringify(this.sessionBookmarkLayers),
|
|
235
|
+
);
|
|
236
|
+
localStorage.setItem(
|
|
237
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_opacity',
|
|
238
|
+
JSON.stringify(this.sessionBookmarkOpacity),
|
|
239
|
+
);
|
|
240
|
+
localStorage.setItem(
|
|
241
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_visible',
|
|
242
|
+
JSON.stringify(this.sessionBookmarkVisible),
|
|
243
|
+
);
|
|
244
|
+
localStorage.setItem(
|
|
245
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_hotspot',
|
|
246
|
+
JSON.stringify(this.sessionBookmarkHotspot),
|
|
247
|
+
);
|
|
106
248
|
}
|
|
107
249
|
});
|
|
108
|
-
this.Bookmarks.on('bookmark-edit', () => {
|
|
250
|
+
this.Bookmarks.on('bookmark-edit', (e) => {
|
|
251
|
+
let check = JSON.parse(sessionStorage.getItem('checkedLayers')) || [];
|
|
252
|
+
let visibleLayers =
|
|
253
|
+
JSON.parse(sessionStorage.getItem('visibleLayers')) || [];
|
|
254
|
+
let opacity = [];
|
|
255
|
+
let visible = [];
|
|
256
|
+
check.forEach((layer) => {
|
|
257
|
+
opacity.push(this.layers[layer].opacity);
|
|
258
|
+
if (visibleLayers[check] && visibleLayers[check][1] === 'eye-slash') {
|
|
259
|
+
visible.push(false);
|
|
260
|
+
} else {
|
|
261
|
+
visible.push(true);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
let hotspotFilters = {
|
|
265
|
+
activeLayers: {},
|
|
266
|
+
filteredLayers: {},
|
|
267
|
+
};
|
|
268
|
+
Object.keys(this.props.hotspotData.activeLayers).forEach((key) => {
|
|
269
|
+
hotspotFilters.activeLayers[key] = null;
|
|
270
|
+
});
|
|
271
|
+
Object.keys(this.props.hotspotData.filteredLayers).forEach((key) => {
|
|
272
|
+
hotspotFilters.filteredLayers[
|
|
273
|
+
key
|
|
274
|
+
] = this.props.hotspotData.filteredLayers[key].customLayerParameters[
|
|
275
|
+
'CQL_FILTER'
|
|
276
|
+
];
|
|
277
|
+
});
|
|
278
|
+
for (let index = 0; index < this.sessionBookmarks.length; index++) {
|
|
279
|
+
if (e.bookmark === this.sessionBookmarks[index]) {
|
|
280
|
+
this.sessionBookmarks[index] = e.bookmark;
|
|
281
|
+
this.sessionBookmarkLayers[index] = check;
|
|
282
|
+
this.sessionBookmarkOpacity[index] = opacity;
|
|
283
|
+
this.sessionBookmarkVisible[index] = visible;
|
|
284
|
+
this.sessionBookmarkHotspot[index] = hotspotFilters;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
109
287
|
if (this.userID != null) {
|
|
110
288
|
localStorage.setItem(
|
|
111
289
|
BOOKMARK_SESSION_KEY + '_' + this.userID,
|
|
112
290
|
JSON.stringify(this.Bookmarks.bookmarks.items),
|
|
113
291
|
);
|
|
292
|
+
localStorage.setItem(
|
|
293
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_layers',
|
|
294
|
+
JSON.stringify(this.sessionBookmarkLayers),
|
|
295
|
+
);
|
|
296
|
+
localStorage.setItem(
|
|
297
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_opacity',
|
|
298
|
+
JSON.stringify(this.sessionBookmarkOpacity),
|
|
299
|
+
);
|
|
300
|
+
localStorage.setItem(
|
|
301
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_visible',
|
|
302
|
+
JSON.stringify(this.sessionBookmarkVisible),
|
|
303
|
+
);
|
|
304
|
+
localStorage.setItem(
|
|
305
|
+
BOOKMARK_SESSION_KEY + '_' + this.userID + '_hotspot',
|
|
306
|
+
JSON.stringify(this.sessionBookmarkHotspot),
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
this.Bookmarks.on('bookmark-select', (e) => {
|
|
311
|
+
let selectLayers = [];
|
|
312
|
+
let selectOpacity = [];
|
|
313
|
+
let selectVisible = [];
|
|
314
|
+
for (let index = 0; index < this.Bookmarks.bookmarks.length; index++) {
|
|
315
|
+
if (e.bookmark === this.Bookmarks.bookmarks.items[index]) {
|
|
316
|
+
selectLayers = this.sessionBookmarkLayers[index];
|
|
317
|
+
selectOpacity = this.sessionBookmarkOpacity[index];
|
|
318
|
+
selectVisible = this.sessionBookmarkVisible[index];
|
|
319
|
+
localStorage.setItem(
|
|
320
|
+
'bookmarkHotspotFilter',
|
|
321
|
+
JSON.stringify(this.sessionBookmarkHotspot[index]),
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
this.map.layers.removeAll();
|
|
326
|
+
this.map.layers.add('bookmark');
|
|
327
|
+
for (let index = 0; index < selectLayers.length; index++) {
|
|
328
|
+
if (selectOpacity[index]) {
|
|
329
|
+
this.layers[selectLayers[index]].opacity = selectOpacity[index];
|
|
330
|
+
}
|
|
331
|
+
if (selectVisible[index] !== null) {
|
|
332
|
+
this.layers[selectLayers[index]].visible = selectVisible[index];
|
|
333
|
+
}
|
|
114
334
|
}
|
|
335
|
+
sessionStorage.setItem('checkedLayers', JSON.stringify(selectLayers));
|
|
115
336
|
});
|
|
116
337
|
});
|
|
117
338
|
}
|
|
@@ -202,7 +202,9 @@ class HotspotWidget extends React.Component {
|
|
|
202
202
|
? Object.keys(this.props.hotspotData['filteredLayers'])
|
|
203
203
|
: [];
|
|
204
204
|
let layersToAdd = {};
|
|
205
|
-
|
|
205
|
+
let bookmarkHotspotFilter = JSON.parse(
|
|
206
|
+
localStorage.getItem('bookmarkHotspotFilter'),
|
|
207
|
+
);
|
|
206
208
|
typeFilter.forEach((type) => {
|
|
207
209
|
let filterLayer;
|
|
208
210
|
|
|
@@ -211,11 +213,12 @@ class HotspotWidget extends React.Component {
|
|
|
211
213
|
.value;
|
|
212
214
|
//this.lccYear = selectLccBoxTime;
|
|
213
215
|
this.setState({ lccYear: selectLccBoxTime });
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
if (document.getElementById('select-klc-lccTime').value.match(/\d+/g)) {
|
|
217
|
+
var selectBoxHighlightsLcc = document
|
|
218
|
+
.getElementById('select-klc-lccTime')
|
|
219
|
+
.value.match(/\d+/g)
|
|
220
|
+
.map(Number)[0];
|
|
221
|
+
}
|
|
219
222
|
for (let i = 0; activeLayers[i]; i++) {
|
|
220
223
|
let layer = activeLayers[i];
|
|
221
224
|
if (layer.includes('all_lcc_a_pol')) {
|
|
@@ -232,13 +235,18 @@ class HotspotWidget extends React.Component {
|
|
|
232
235
|
filterLayer.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
|
|
233
236
|
typeLegend,
|
|
234
237
|
);
|
|
235
|
-
|
|
236
|
-
'
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
if (bookmarkHotspotFilter !== null) {
|
|
239
|
+
filterLayer.customLayerParameters['CQL_FILTER'] =
|
|
240
|
+
bookmarkHotspotFilter.filteredLayers['lcc_filter'];
|
|
241
|
+
} else {
|
|
242
|
+
filterLayer.customLayerParameters['CQL_FILTER'] =
|
|
243
|
+
'klc_code LIKE ' +
|
|
244
|
+
"'" +
|
|
245
|
+
this.dataKlc_code +
|
|
246
|
+
"'" +
|
|
247
|
+
" AND in_pa = 'not_defined' AND date = " +
|
|
248
|
+
selectBoxHighlightsLcc;
|
|
249
|
+
}
|
|
242
250
|
}
|
|
243
251
|
if (type === 'lc') {
|
|
244
252
|
for (let i = 0; i < activeLayers.length; i++) {
|
|
@@ -255,10 +263,12 @@ class HotspotWidget extends React.Component {
|
|
|
255
263
|
.value;
|
|
256
264
|
//this.lcYear = selectLcBoxTime;
|
|
257
265
|
this.setState({ lcYear: selectLcBoxTime });
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
266
|
+
if (document.getElementById('select-klc-lcTime').value.match(/\d+/g)) {
|
|
267
|
+
var selectBoxHighlightsLc = document
|
|
268
|
+
.getElementById('select-klc-lcTime')
|
|
269
|
+
.value.match(/\d+/g)
|
|
270
|
+
.map(Number)[0];
|
|
271
|
+
}
|
|
262
272
|
|
|
263
273
|
filterLayer = this.esriLayer_lc;
|
|
264
274
|
|
|
@@ -266,22 +276,37 @@ class HotspotWidget extends React.Component {
|
|
|
266
276
|
filterLayer.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
|
|
267
277
|
typeLegend,
|
|
268
278
|
);
|
|
269
|
-
|
|
270
|
-
'
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
279
|
+
if (bookmarkHotspotFilter !== null) {
|
|
280
|
+
filterLayer.customLayerParameters['CQL_FILTER'] =
|
|
281
|
+
bookmarkHotspotFilter.filteredLayers['lc_filter'];
|
|
282
|
+
} else {
|
|
283
|
+
filterLayer.customLayerParameters['CQL_FILTER'] =
|
|
284
|
+
'klc_code LIKE ' +
|
|
285
|
+
"'" +
|
|
286
|
+
this.dataKlc_code +
|
|
287
|
+
"'" +
|
|
288
|
+
" AND in_pa = 'not_defined' AND date = " +
|
|
289
|
+
selectBoxHighlightsLc;
|
|
290
|
+
}
|
|
276
291
|
}
|
|
277
292
|
if (type === 'klc') {
|
|
278
|
-
|
|
279
|
-
|
|
293
|
+
if (bookmarkHotspotFilter !== null) {
|
|
294
|
+
this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
|
|
295
|
+
bookmarkHotspotFilter.filteredLayers['klc_filter'];
|
|
296
|
+
} else {
|
|
297
|
+
this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
|
|
298
|
+
"klc_code LIKE '" + this.dataKlc_code + "'";
|
|
299
|
+
}
|
|
280
300
|
filterLayer = this.esriLayer_klc;
|
|
281
301
|
}
|
|
282
302
|
if (type === 'pa') {
|
|
283
|
-
|
|
284
|
-
|
|
303
|
+
if (bookmarkHotspotFilter !== null) {
|
|
304
|
+
this.esriLayer_pa.customLayerParameters['CQL_FILTER'] =
|
|
305
|
+
bookmarkHotspotFilter.filteredLayers['pa_filter'];
|
|
306
|
+
} else {
|
|
307
|
+
this.esriLayer_pa.customLayerParameters['CQL_FILTER'] =
|
|
308
|
+
"klc_code LIKE '" + this.dataKlc_code + "'";
|
|
309
|
+
}
|
|
285
310
|
filterLayer = this.esriLayer_pa;
|
|
286
311
|
}
|
|
287
312
|
layersToAdd[type + '_filter'] = filterLayer;
|
|
@@ -315,7 +340,9 @@ class HotspotWidget extends React.Component {
|
|
|
315
340
|
this.layers[key] = layersToAdd[key];
|
|
316
341
|
this.layers[key].visible = true;
|
|
317
342
|
});
|
|
318
|
-
|
|
343
|
+
if (bookmarkHotspotFilter === null) {
|
|
344
|
+
this.setBBoxCoordinates(this.dataBBox);
|
|
345
|
+
}
|
|
319
346
|
//set sessionStorage value to keep the widget open
|
|
320
347
|
sessionStorage.setItem('hotspotFilterApplied', 'true');
|
|
321
348
|
this.disableButton();
|
|
@@ -829,6 +856,26 @@ class HotspotWidget extends React.Component {
|
|
|
829
856
|
this.getBBoxData();
|
|
830
857
|
this.props.view.when(() => {
|
|
831
858
|
this.props.view.map.layers.on('change', () => {
|
|
859
|
+
let bookmarkHotspotFilter = JSON.parse(
|
|
860
|
+
localStorage.getItem('bookmarkHotspotFilter'),
|
|
861
|
+
);
|
|
862
|
+
if (
|
|
863
|
+
bookmarkHotspotFilter !== null &&
|
|
864
|
+
this.props.view.map.layers.items[0] !== 'bookmark'
|
|
865
|
+
) {
|
|
866
|
+
let activeLayers = [];
|
|
867
|
+
let filteredLayers = [];
|
|
868
|
+
Object.keys(bookmarkHotspotFilter.activeLayers).forEach((key) => {
|
|
869
|
+
activeLayers[key] = this.layers[key];
|
|
870
|
+
});
|
|
871
|
+
Object.keys(bookmarkHotspotFilter.filteredLayers).forEach((key) => {
|
|
872
|
+
filteredLayers[key] = null;
|
|
873
|
+
});
|
|
874
|
+
this.props.hotspotData['activeLayers'] = activeLayers;
|
|
875
|
+
this.props.hotspotData['filteredLayers'] = filteredLayers;
|
|
876
|
+
this.renderApplyFilterButton();
|
|
877
|
+
localStorage.setItem('bookmarkHotspotFilter', null);
|
|
878
|
+
}
|
|
832
879
|
this.setState({
|
|
833
880
|
activeLayersArray: Array.from(
|
|
834
881
|
document.querySelectorAll('.active-layer'),
|
|
@@ -484,8 +484,10 @@ export const CheckUserID = ({ reference }) => {
|
|
|
484
484
|
<BookmarkWidget
|
|
485
485
|
view={reference.view}
|
|
486
486
|
map={reference.map}
|
|
487
|
+
layers={reference.state.layers}
|
|
487
488
|
mapViewer={reference}
|
|
488
489
|
userID={user_id}
|
|
490
|
+
hotspotData={reference.state.hotspotData}
|
|
489
491
|
/>
|
|
490
492
|
}
|
|
491
493
|
</>
|
|
@@ -680,6 +680,30 @@ class MenuWidget extends React.Component {
|
|
|
680
680
|
this.loadOpacity();
|
|
681
681
|
this.loadVisibility();
|
|
682
682
|
this.handleRasterVectorLegend();
|
|
683
|
+
this.map.when(() => {
|
|
684
|
+
this.map.layers.on('change', (e) => {
|
|
685
|
+
if (this.map.layers.items[0] === 'bookmark') {
|
|
686
|
+
this.map.layers.remove('bookmark');
|
|
687
|
+
let layers = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
688
|
+
for (const layer in this.layers) {
|
|
689
|
+
let node = document.getElementById(layer);
|
|
690
|
+
if (node) {
|
|
691
|
+
if (layers.includes(layer)) {
|
|
692
|
+
let visible = this.layers[node.id].visible;
|
|
693
|
+
node.checked = true;
|
|
694
|
+
this.toggleLayer(node);
|
|
695
|
+
if (!visible) {
|
|
696
|
+
this.eyeLayer(node);
|
|
697
|
+
}
|
|
698
|
+
} else if (node.checked) {
|
|
699
|
+
node.checked = false;
|
|
700
|
+
this.toggleLayer(node);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
});
|
|
683
707
|
}
|
|
684
708
|
|
|
685
709
|
setSliderTag(val) {
|
|
@@ -465,8 +465,8 @@ class TimesliderWidget extends React.Component {
|
|
|
465
465
|
document.querySelector(
|
|
466
466
|
'.esri-ui-bottom-right.esri-ui-corner',
|
|
467
467
|
).style.pointerEvents = 'auto';
|
|
468
|
-
this.drag.x = e.screenX - e.currentTarget.getBoundingClientRect().
|
|
469
|
-
this.drag.y = e.screenY - e.currentTarget.getBoundingClientRect().
|
|
468
|
+
this.drag.x = e.screenX - e.currentTarget.getBoundingClientRect().right;
|
|
469
|
+
this.drag.y = e.screenY - e.currentTarget.getBoundingClientRect().bottom;
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
onDragOver(e) {
|
|
@@ -474,17 +474,17 @@ class TimesliderWidget extends React.Component {
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
onDrop(e) {
|
|
477
|
-
let
|
|
478
|
-
e.screenX -
|
|
477
|
+
let right =
|
|
479
478
|
this.drag.x -
|
|
480
|
-
e.
|
|
479
|
+
e.screenX +
|
|
480
|
+
e.currentTarget.getBoundingClientRect().right +
|
|
481
481
|
'px';
|
|
482
|
-
let
|
|
483
|
-
e.screenY -
|
|
482
|
+
let bottom =
|
|
484
483
|
this.drag.y -
|
|
485
|
-
e.
|
|
484
|
+
e.screenY +
|
|
485
|
+
e.currentTarget.getBoundingClientRect().bottom +
|
|
486
486
|
'px';
|
|
487
|
-
this.setState({ styles: {
|
|
487
|
+
this.setState({ styles: { right: right, bottom: bottom } });
|
|
488
488
|
this.drag.frame.style.visibility = 'hidden';
|
|
489
489
|
document.querySelector(
|
|
490
490
|
'.esri-ui-bottom-right.esri-ui-corner',
|