@eeacms/volto-arcgis-block 0.1.233 → 0.1.234
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 +2 -0
- package/package.json +1 -1
- package/src/components/MapViewer/SwipeWidget.jsx +149 -128
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,8 @@ 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.234](https://github.com/eea/volto-arcgis-block/compare/0.1.233...0.1.234) - 15 November 2023
|
|
8
|
+
|
|
7
9
|
### [0.1.233](https://github.com/eea/volto-arcgis-block/compare/0.1.232...0.1.233) - 8 November 2023
|
|
8
10
|
|
|
9
11
|
### [0.1.232](https://github.com/eea/volto-arcgis-block/compare/0.1.231...0.1.232) - 8 November 2023
|
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ class SwipeWidget extends React.Component {
|
|
|
26
26
|
this.scaleMax = 600000000;
|
|
27
27
|
this.map = this.props.map;
|
|
28
28
|
this.layers = this.props.layers;
|
|
29
|
+
this.hasSwipe = false;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
loader() {
|
|
@@ -53,6 +54,7 @@ class SwipeWidget extends React.Component {
|
|
|
53
54
|
this.swipe.leadingLayers.removeAll();
|
|
54
55
|
this.swipe.trailingLayers.removeAll();
|
|
55
56
|
this.props.view.ui.remove(this.swipe);
|
|
57
|
+
this.hasSwipe = false;
|
|
56
58
|
this.container.current.querySelector('.right-panel').style.display =
|
|
57
59
|
'none';
|
|
58
60
|
this.setState({ showMapMenu: false });
|
|
@@ -70,26 +72,14 @@ class SwipeWidget extends React.Component {
|
|
|
70
72
|
// By invoking the setState, we notify the state we want to reach
|
|
71
73
|
// and ensure that the component is rendered again
|
|
72
74
|
this.loadOptions();
|
|
73
|
-
this.map.layers.on('change', (
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.swipe.leadingLayers.
|
|
78
|
-
this.swipe.trailingLayers.removeAll();
|
|
79
|
-
this.props.view.ui.remove(this.swipe);
|
|
75
|
+
this.map.layers.on('change', () => {
|
|
76
|
+
if (this.hasSwipe) {
|
|
77
|
+
this.map.layers.removeAll();
|
|
78
|
+
if (this.swipe.leadingLayers.items[0]) {
|
|
79
|
+
this.map.layers.add(this.swipe.leadingLayers.items[0]);
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.loadVisibleLayers();
|
|
84
|
-
if (this.swipe.leadingLayers) {
|
|
85
|
-
this.swipe.leadingLayers.removeAll();
|
|
86
|
-
}
|
|
87
|
-
if (this.swipe.trailingLayers) {
|
|
88
|
-
this.swipe.trailingLayers.removeAll();
|
|
89
|
-
}
|
|
90
|
-
if (this.props.view.ui) {
|
|
91
|
-
this.props.view.ui.remove(this.swipe);
|
|
92
|
-
}
|
|
81
|
+
if (this.swipe.trailingLayers.items[0]) {
|
|
82
|
+
this.map.layers.add(this.swipe.trailingLayers.items[0]);
|
|
93
83
|
}
|
|
94
84
|
}
|
|
95
85
|
this.loadOptions();
|
|
@@ -129,7 +119,7 @@ class SwipeWidget extends React.Component {
|
|
|
129
119
|
if (selectLeadingLayer) {
|
|
130
120
|
this.removeOptions(selectLeadingLayer);
|
|
131
121
|
selectLeadingLayer.options.add(
|
|
132
|
-
new Option('Select a leading layer', 'default',
|
|
122
|
+
new Option('Select a leading layer', 'default', false, false),
|
|
133
123
|
);
|
|
134
124
|
selectLeadingLayer.options[0].disabled = true;
|
|
135
125
|
}
|
|
@@ -137,50 +127,88 @@ class SwipeWidget extends React.Component {
|
|
|
137
127
|
if (selectTrailingLayer) {
|
|
138
128
|
this.removeOptions(selectTrailingLayer);
|
|
139
129
|
selectTrailingLayer.options.add(
|
|
140
|
-
new Option('Select a
|
|
130
|
+
new Option('Select a trailing layer', 'default', false, false),
|
|
141
131
|
);
|
|
142
132
|
selectTrailingLayer.options[0].disabled = true;
|
|
143
133
|
}
|
|
144
134
|
let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
135
|
+
if (cl) {
|
|
136
|
+
cl.forEach((layer) => {
|
|
137
|
+
if (this.layers[layer]) {
|
|
138
|
+
let layerId = this.layers[layer].id;
|
|
139
|
+
if (this.layers['lcc_filter']) {
|
|
140
|
+
if (
|
|
141
|
+
layer === 'all_lcc_a_pol_1_4_1_0' ||
|
|
142
|
+
layer === 'all_lcc_b_pol_1_4_1_1'
|
|
143
|
+
) {
|
|
144
|
+
layerId = this.layers['lcc_filter'].id;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (this.layers['lc_filter']) {
|
|
148
|
+
if (
|
|
149
|
+
layer === 'all_present_lc_a_pol_1_4_0_0' ||
|
|
150
|
+
layer === 'all_present_lc_b_pol_1_4_0_1'
|
|
151
|
+
) {
|
|
152
|
+
layerId = this.layers['lc_filter'].id;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (this.layers['klc_filter']) {
|
|
156
|
+
if (layer === 'cop_klc_1_4_2_0') {
|
|
157
|
+
layerId = this.layers['klc_filter'].id;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (this.layers['pa_filter']) {
|
|
161
|
+
if (layer === 'protected_areas_1_4_3_0') {
|
|
162
|
+
layerId = this.layers['pa_filter'].id;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (
|
|
166
|
+
this.swipe.leadingLayers &&
|
|
167
|
+
this.swipe.leadingLayers.items[0] &&
|
|
168
|
+
this.swipe.leadingLayers.items[0].id === layerId
|
|
169
|
+
) {
|
|
170
|
+
selectLeadingLayer.options.add(
|
|
171
|
+
new Option(
|
|
172
|
+
this.getLayerTitle(this.layers[layer]),
|
|
173
|
+
layerId,
|
|
174
|
+
true,
|
|
175
|
+
true,
|
|
176
|
+
),
|
|
177
|
+
);
|
|
178
|
+
} else {
|
|
179
|
+
selectLeadingLayer.options.add(
|
|
180
|
+
new Option(
|
|
181
|
+
this.getLayerTitle(this.layers[layer]),
|
|
182
|
+
layerId,
|
|
183
|
+
false,
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
if (
|
|
188
|
+
this.swipe.selectTrailingLayer &&
|
|
189
|
+
this.swipe.selectTrailingLayer.items[0] &&
|
|
190
|
+
this.swipe.selectTrailingLayer.items[0].id === layerId
|
|
191
|
+
) {
|
|
192
|
+
selectTrailingLayer.options.add(
|
|
193
|
+
new Option(
|
|
194
|
+
this.getLayerTitle(this.layers[layer]),
|
|
195
|
+
layerId,
|
|
196
|
+
true,
|
|
197
|
+
true,
|
|
198
|
+
),
|
|
199
|
+
);
|
|
200
|
+
} else {
|
|
201
|
+
selectTrailingLayer.options.add(
|
|
202
|
+
new Option(
|
|
203
|
+
this.getLayerTitle(this.layers[layer]),
|
|
204
|
+
layerId,
|
|
205
|
+
false,
|
|
206
|
+
),
|
|
207
|
+
);
|
|
208
|
+
}
|
|
181
209
|
}
|
|
182
210
|
});
|
|
183
|
-
}
|
|
211
|
+
}
|
|
184
212
|
}
|
|
185
213
|
removeOptions(selectElement) {
|
|
186
214
|
if (selectElement.options.length > 0) {
|
|
@@ -194,6 +222,7 @@ class SwipeWidget extends React.Component {
|
|
|
194
222
|
renderApplySwipeButton() {
|
|
195
223
|
this.props.view.ui.remove(this.swipe);
|
|
196
224
|
this.props.view.ui.add(this.swipe);
|
|
225
|
+
this.hasSwipe = true;
|
|
197
226
|
let selectedLeadingLayer = document.getElementById('select-leading-layer')
|
|
198
227
|
.value;
|
|
199
228
|
let selectedTrailingLayer = document.getElementById('select-trailing-layer')
|
|
@@ -204,84 +233,76 @@ class SwipeWidget extends React.Component {
|
|
|
204
233
|
this.swipe.leadingLayers.removeAll();
|
|
205
234
|
this.swipe.trailingLayers.removeAll();
|
|
206
235
|
this.swipe.direction = selectedSwipeDirection;
|
|
207
|
-
let
|
|
208
|
-
|
|
209
|
-
layer
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (vl) {
|
|
213
|
-
for (const key in vl) {
|
|
214
|
-
if (this.layers[key].id === layer.id) {
|
|
215
|
-
if (vl[key][1] === 'eye-slash') {
|
|
216
|
-
layer.visible = false;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
236
|
+
let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
237
|
+
if (cl) {
|
|
238
|
+
cl.forEach((layer) => {
|
|
239
|
+
if (this.layers[layer].id === selectedLeadingLayer) {
|
|
240
|
+
this.swipe.leadingLayers.add(this.layers[layer]);
|
|
220
241
|
}
|
|
221
|
-
this.
|
|
222
|
-
|
|
223
|
-
if (layer.id === selectedTrailingLayer) {
|
|
224
|
-
layer.visible = true;
|
|
225
|
-
if (vl) {
|
|
226
|
-
for (const key in vl) {
|
|
227
|
-
if (this.layers[key].id === layer.id) {
|
|
228
|
-
if (vl[key][1] === 'eye-slash') {
|
|
229
|
-
layer.visible = false;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
242
|
+
if (this.layers[layer].id === selectedTrailingLayer) {
|
|
243
|
+
this.swipe.trailingLayers.add(this.layers[layer]);
|
|
233
244
|
}
|
|
234
|
-
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if (this.layers['lcc_filter']) {
|
|
248
|
+
if (this.layers['lcc_filter'].id === selectedLeadingLayer) {
|
|
249
|
+
this.swipe.leadingLayers.add(this.layers['lcc_filter']);
|
|
235
250
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
loadVisibleLayers() {
|
|
239
|
-
let vl = JSON.parse(sessionStorage.getItem('visibleLayers'));
|
|
240
|
-
this.map.layers.forEach((layer) => {
|
|
241
|
-
if (this.layers['lcc_filter']) {
|
|
242
|
-
if (
|
|
243
|
-
layer.id === this.layers['all_lcc_a_pol_1_4_1_0'].id ||
|
|
244
|
-
layer.id === this.layers['all_lcc_b_pol_1_4_1_1'].id
|
|
245
|
-
) {
|
|
246
|
-
layer.visible = false;
|
|
247
|
-
} else if (layer.id === this.layers['lcc_filter'].id) {
|
|
248
|
-
layer.visible = true;
|
|
249
|
-
}
|
|
251
|
+
if (this.layers['lcc_filter'].id === selectedTrailingLayer) {
|
|
252
|
+
this.swipe.trailingLayers.add(this.layers['lcc_filter']);
|
|
250
253
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
) {
|
|
256
|
-
layer.visible = false;
|
|
257
|
-
} else if (layer.id === this.layers['lc_filter'].id) {
|
|
258
|
-
layer.visible = true;
|
|
259
|
-
}
|
|
254
|
+
}
|
|
255
|
+
if (this.layers['lc_filter']) {
|
|
256
|
+
if (this.layers['lc_filter'].id === selectedLeadingLayer) {
|
|
257
|
+
this.swipe.leadingLayers.add(this.layers['lc_filter']);
|
|
260
258
|
}
|
|
261
|
-
if (this.layers['
|
|
262
|
-
|
|
263
|
-
layer.visible = false;
|
|
264
|
-
} else if (layer.id === this.layers['klc_filter'].id) {
|
|
265
|
-
layer.visible = true;
|
|
266
|
-
}
|
|
259
|
+
if (this.layers['lc_filter'].id === selectedTrailingLayer) {
|
|
260
|
+
this.swipe.trailingLayers.add(this.layers['lc_filter']);
|
|
267
261
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
layer.visible = true;
|
|
273
|
-
}
|
|
262
|
+
}
|
|
263
|
+
if (this.layers['klc_filter']) {
|
|
264
|
+
if (this.layers['klc_filter'].id === selectedLeadingLayer) {
|
|
265
|
+
this.swipe.leadingLayers.add(this.layers['klc_filter']);
|
|
274
266
|
}
|
|
275
|
-
if (
|
|
276
|
-
|
|
277
|
-
if (this.layers[key].id === layer.id) {
|
|
278
|
-
if (vl[key][1] === 'eye-slash') {
|
|
279
|
-
layer.visible = false;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
267
|
+
if (this.layers['klc_filter'].id === selectedTrailingLayer) {
|
|
268
|
+
this.swipe.trailingLayers.add(this.layers['klc_filter']);
|
|
283
269
|
}
|
|
284
|
-
}
|
|
270
|
+
}
|
|
271
|
+
if (this.layers['pa_filter']) {
|
|
272
|
+
if (this.layers['pa_filter'].id === selectedLeadingLayer) {
|
|
273
|
+
this.swipe.leadingLayers.add(this.layers['pa_filter']);
|
|
274
|
+
}
|
|
275
|
+
if (this.layers['pa_filter'].id === selectedTrailingLayer) {
|
|
276
|
+
this.swipe.trailingLayers.add(this.layers['pa_filter']);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
this.map.layers.removeAll();
|
|
280
|
+
if (this.swipe.leadingLayers.items[0]) {
|
|
281
|
+
this.map.layers.add(this.swipe.leadingLayers.items[0]);
|
|
282
|
+
}
|
|
283
|
+
if (this.swipe.trailingLayers.items[0]) {
|
|
284
|
+
this.map.layers.add(this.swipe.trailingLayers.items[0]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
loadVisibleLayers() {
|
|
288
|
+
let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
289
|
+
if (cl) {
|
|
290
|
+
cl.forEach((layer) => {
|
|
291
|
+
this.map.layers.add(this.layers[layer]);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
if (this.layers['lcc_filter']) {
|
|
295
|
+
this.map.layers.add(this.layers['lcc_filter']);
|
|
296
|
+
}
|
|
297
|
+
if (this.layers['lc_filter']) {
|
|
298
|
+
this.map.layers.add(this.layers['lc_filter']);
|
|
299
|
+
}
|
|
300
|
+
if (this.layers['klc_filter']) {
|
|
301
|
+
this.map.layers.add(this.layers['klc_filter']);
|
|
302
|
+
}
|
|
303
|
+
if (this.layers['pa_filter']) {
|
|
304
|
+
this.map.layers.add(this.layers['pa_filter']);
|
|
305
|
+
}
|
|
285
306
|
}
|
|
286
307
|
/**
|
|
287
308
|
* This method renders the component
|