@eeacms/volto-arcgis-block 0.1.305 → 0.1.307
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 +13 -0
- package/package.json +1 -1
- package/src/components/MapViewer/AreaWidget.jsx +15 -13
- package/src/components/MapViewer/BasemapWidget.jsx +3 -1
- package/src/components/MapViewer/BookmarkWidget.jsx +4 -1
- package/src/components/MapViewer/HotspotWidget.jsx +4 -1
- package/src/components/MapViewer/InfoWidget.jsx +5 -2
- package/src/components/MapViewer/LegendWidget.jsx +4 -1
- package/src/components/MapViewer/LoadingSpinner.jsx +2 -1
- package/src/components/MapViewer/MapViewer.jsx +32 -32
- package/src/components/MapViewer/MeasurementWidget.jsx +4 -1
- package/src/components/MapViewer/MenuWidget.jsx +176 -29
- package/src/components/MapViewer/PanWidget.jsx +7 -4
- package/src/components/MapViewer/PrintWidget.jsx +8 -6
- package/src/components/MapViewer/ScaleWidget.jsx +8 -5
- package/src/components/MapViewer/SwipeWidget.jsx +9 -5
- package/src/components/MapViewer/TimesliderWidget.jsx +202 -197
- package/src/components/UseCasesMapViewer/LegendWidget.jsx +7 -4
- package/src/components/UseCasesMapViewer/UseCasesMapViewer.jsx +55 -52
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ 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.307](https://github.com/eea/volto-arcgis-block/compare/0.1.306...0.1.307) - 10 October 2024
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-276819 (bug): Deep check for all parent nodes to be cleared before insert child nodes within [Unai Bolivar - [`bba5838`](https://github.com/eea/volto-arcgis-block/commit/bba58386fc2335010dbe208367543a7d3099b10a)]
|
|
12
|
+
### [0.1.306](https://github.com/eea/volto-arcgis-block/compare/0.1.305...0.1.306) - 8 October 2024
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- CLMS-272057 (chore): Ran linting scripts [Unai Bolivar - [`33654ff`](https://github.com/eea/volto-arcgis-block/commit/33654ff17e85c58b87227e3d70202d735f62333c)]
|
|
17
|
+
- CLMS-272057 (feat): Map Image layer bounding boxes fetched and zooming in properly to sublayer extents. WMS and WMTS layers maintain correct view extent zoom in as well. [Unai Bolivar - [`9787590`](https://github.com/eea/volto-arcgis-block/commit/9787590df6d7e5f2fef52948b4d563685a818628)]
|
|
18
|
+
- CLMS-272057 (feat): Map Image layer bounding boxes fetched but not zooming into area [Unai Bolivar - [`08f67de`](https://github.com/eea/volto-arcgis-block/commit/08f67de1fb052efaef2196c6bfb4b4cb3b59db1c)]
|
|
19
|
+
- CLMS-272057 (feat): Implementing map image layer requests to the data viewer. Code is setup for initial test. Waiting on download of data.fs from demo env [Unai Bolivar - [`82e9320`](https://github.com/eea/volto-arcgis-block/commit/82e93207dd2d0c83930466adb83e505236c88279)]
|
|
7
20
|
### [0.1.305](https://github.com/eea/volto-arcgis-block/compare/0.1.304...0.1.305) - 7 October 2024
|
|
8
21
|
|
|
9
22
|
### [0.1.304](https://github.com/eea/volto-arcgis-block/compare/0.1.303...0.1.304) - 16 September 2024
|
package/package.json
CHANGED
|
@@ -1131,19 +1131,21 @@ class AreaWidget extends React.Component {
|
|
|
1131
1131
|
});
|
|
1132
1132
|
}
|
|
1133
1133
|
});
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1134
|
+
this.props.view.when(() => {
|
|
1135
|
+
this.props.download
|
|
1136
|
+
? this.container !== null && this.props.view.ui.add(this.container)
|
|
1137
|
+
: this.container.current !== null &&
|
|
1138
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
1139
|
+
|
|
1140
|
+
var popup = document.createElement('div');
|
|
1141
|
+
popup.className = 'drawRectanglePopup-block';
|
|
1142
|
+
popup.innerHTML =
|
|
1143
|
+
'<div class="drawRectanglePopup-content">' +
|
|
1144
|
+
'<span class="drawRectanglePopup-icon"><span class="esri-icon-cursor-marquee"></span></span>' +
|
|
1145
|
+
'<div class="drawRectanglePopup-text">Select or draw an area of interest in the map to continue</div>' +
|
|
1146
|
+
'</div>';
|
|
1147
|
+
this.props.download && this.props.view.ui.add(popup, 'top-right');
|
|
1148
|
+
});
|
|
1147
1149
|
}
|
|
1148
1150
|
|
|
1149
1151
|
async initFMI() {
|
|
@@ -241,7 +241,9 @@ class BasemapWidget extends React.Component {
|
|
|
241
241
|
],
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
-
this.props.view.
|
|
244
|
+
this.props.view.when(() => {
|
|
245
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
246
|
+
});
|
|
245
247
|
document.querySelector('.esri-attribution__powered-by').style.display =
|
|
246
248
|
'none';
|
|
247
249
|
}
|
|
@@ -88,7 +88,10 @@ class BookmarkWidget extends React.Component {
|
|
|
88
88
|
|
|
89
89
|
async componentDidMount() {
|
|
90
90
|
await this.loader();
|
|
91
|
-
|
|
91
|
+
if (!this.container.current) return;
|
|
92
|
+
this.props.view.when(() => {
|
|
93
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
94
|
+
});
|
|
92
95
|
if (this.userID != null) {
|
|
93
96
|
this.sessionBookmarks =
|
|
94
97
|
JSON.parse(
|
|
@@ -948,7 +948,10 @@ class HotspotWidget extends React.Component {
|
|
|
948
948
|
async componentDidMount() {
|
|
949
949
|
await this.getLayerParameters();
|
|
950
950
|
await this.loader();
|
|
951
|
-
|
|
951
|
+
if (!this.container.current) return;
|
|
952
|
+
this.props.view.when(() => {
|
|
953
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
954
|
+
});
|
|
952
955
|
this.layerModelInit();
|
|
953
956
|
this.getBBoxData();
|
|
954
957
|
this.props.view.when(() => {
|
|
@@ -98,8 +98,11 @@ class InfoWidget extends React.Component {
|
|
|
98
98
|
* This method is executed after the rener method is executed
|
|
99
99
|
*/ async componentDidMount() {
|
|
100
100
|
await this.loader();
|
|
101
|
-
this.waitForContainer(this.container.current);
|
|
102
|
-
|
|
101
|
+
//this.waitForContainer(this.container.current);
|
|
102
|
+
if (!this.container.current) return;
|
|
103
|
+
this.props.view.when(() => {
|
|
104
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
105
|
+
});
|
|
103
106
|
this.props.view.on('click', (e) => {
|
|
104
107
|
let screenPoint = {
|
|
105
108
|
x: e.x,
|
|
@@ -232,7 +232,10 @@ class LegendWidget extends React.Component {
|
|
|
232
232
|
*/
|
|
233
233
|
async componentDidMount() {
|
|
234
234
|
await this.loader();
|
|
235
|
-
|
|
235
|
+
if (!this.container.current) return;
|
|
236
|
+
this.props.view.when(() => {
|
|
237
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
238
|
+
});
|
|
236
239
|
this.LegendWidget = new Legend({
|
|
237
240
|
view: this.props.view,
|
|
238
241
|
viewModel: new LegendViewModel({
|
|
@@ -61,7 +61,8 @@ class LoadingSpinner extends React.Component {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async componentDidMount() {
|
|
64
|
-
this.waitForContainer(this.props.view);
|
|
64
|
+
//this.waitForContainer(this.props.view);
|
|
65
|
+
if (!this.container.current) return;
|
|
65
66
|
this.props.view.when(() => {
|
|
66
67
|
this.props.view.ui.add(this.container.current, 'manual');
|
|
67
68
|
this.listenForLayerChanges();
|
|
@@ -57,7 +57,7 @@ class MapViewer extends React.Component {
|
|
|
57
57
|
layerLoading: false,
|
|
58
58
|
layers: {},
|
|
59
59
|
uploadedFile: true,
|
|
60
|
-
isReady: false,
|
|
60
|
+
//isReady: false,
|
|
61
61
|
};
|
|
62
62
|
this.activeLayersHandler = this.activeLayersHandler.bind(this);
|
|
63
63
|
this.activeLayersArray = {};
|
|
@@ -176,12 +176,16 @@ class MapViewer extends React.Component {
|
|
|
176
176
|
await this.loader();
|
|
177
177
|
// this.state.url = window.location.href;
|
|
178
178
|
await this.waitForDataFill(this.compCfg);
|
|
179
|
-
this.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
if (!this.mapdiv.current) return;
|
|
180
|
+
//this.props.view.when(() => {
|
|
181
|
+
// this.props.view.ui.add(this.container.current, 'top-right');
|
|
182
|
+
//});
|
|
183
|
+
//this.intervalId = setInterval(() => {
|
|
184
|
+
// if (this.mapdiv.current !== null) {
|
|
185
|
+
// this.setState({ isReady: true });
|
|
186
|
+
// clearInterval(this.intervalId);
|
|
187
|
+
// }
|
|
188
|
+
//}, 100);
|
|
185
189
|
this.positronCompositeBasemap = new Basemap({
|
|
186
190
|
title: 'Positron composite',
|
|
187
191
|
thumbnailUrl: this.cfgUrls.positronCompositeThumbnail,
|
|
@@ -235,11 +239,11 @@ class MapViewer extends React.Component {
|
|
|
235
239
|
this.zoom = new Zoom({
|
|
236
240
|
view: this.view,
|
|
237
241
|
});
|
|
238
|
-
this.view.ui.add(this.zoom, {
|
|
239
|
-
position: 'top-right',
|
|
240
|
-
});
|
|
241
|
-
|
|
242
242
|
this.view.when(() => {
|
|
243
|
+
this.view.ui.add(this.zoom, {
|
|
244
|
+
position: 'top-right',
|
|
245
|
+
});
|
|
246
|
+
|
|
243
247
|
this.view.watch('center', (newValue, oldValue, property, object) => {
|
|
244
248
|
this.setCenterState(newValue);
|
|
245
249
|
});
|
|
@@ -296,7 +300,7 @@ class MapViewer extends React.Component {
|
|
|
296
300
|
componentWillUnmount() {
|
|
297
301
|
// clean up
|
|
298
302
|
if (this.view) {
|
|
299
|
-
clearInterval(this.intervalId);
|
|
303
|
+
//clearInterval(this.intervalId);
|
|
300
304
|
this.view.container = null;
|
|
301
305
|
this.view.destroy();
|
|
302
306
|
delete this.view;
|
|
@@ -484,26 +488,22 @@ class MapViewer extends React.Component {
|
|
|
484
488
|
} else {
|
|
485
489
|
return (
|
|
486
490
|
<div className={this.mapClass}>
|
|
487
|
-
{this.
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
</div>
|
|
504
|
-
) : (
|
|
505
|
-
<p>Loading...</p>
|
|
506
|
-
)}
|
|
491
|
+
<div ref={this.mapdiv} className="map">
|
|
492
|
+
{this.appLanguage()}
|
|
493
|
+
{this.renderBasemap()}
|
|
494
|
+
{this.renderLegend()}
|
|
495
|
+
{this.renderMeasurement()}
|
|
496
|
+
{this.renderPrint()}
|
|
497
|
+
{this.renderSwipe()}
|
|
498
|
+
{this.renderArea()}
|
|
499
|
+
{this.renderPan()}
|
|
500
|
+
{this.renderScale()}
|
|
501
|
+
{this.renderInfo()}
|
|
502
|
+
{this.renderHotspot()}
|
|
503
|
+
{this.renderMenu()}
|
|
504
|
+
{this.renderBookmark()}
|
|
505
|
+
{this.renderLoadingSpinner()}
|
|
506
|
+
</div>
|
|
507
507
|
</div>
|
|
508
508
|
);
|
|
509
509
|
}
|
|
@@ -180,7 +180,10 @@ class MeasurementWidget extends React.Component {
|
|
|
180
180
|
*/
|
|
181
181
|
async componentDidMount() {
|
|
182
182
|
await this.loader();
|
|
183
|
-
|
|
183
|
+
if (!this.container.current) return;
|
|
184
|
+
this.props.view.when(() => {
|
|
185
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
186
|
+
});
|
|
184
187
|
this.measurement = new Measurement({
|
|
185
188
|
view: this.props.view,
|
|
186
189
|
container: this.container.current.querySelector('.measurement-area'),
|
|
@@ -7,7 +7,15 @@ import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
|
|
|
7
7
|
import { Modal, Popup } from 'semantic-ui-react';
|
|
8
8
|
import AreaWidget from './AreaWidget';
|
|
9
9
|
import TimesliderWidget from './TimesliderWidget';
|
|
10
|
-
var WMSLayer,
|
|
10
|
+
var WMSLayer,
|
|
11
|
+
WMTSLayer,
|
|
12
|
+
FeatureLayer,
|
|
13
|
+
BaseTileLayer,
|
|
14
|
+
esriRequest,
|
|
15
|
+
Extent,
|
|
16
|
+
MapImageLayer,
|
|
17
|
+
projection,
|
|
18
|
+
SpatialReference;
|
|
11
19
|
|
|
12
20
|
const popupSettings = {
|
|
13
21
|
basic: true,
|
|
@@ -464,6 +472,9 @@ class MenuWidget extends React.Component {
|
|
|
464
472
|
'esri/layers/BaseTileLayer',
|
|
465
473
|
'esri/request',
|
|
466
474
|
'esri/geometry/Extent',
|
|
475
|
+
'esri/layers/MapImageLayer',
|
|
476
|
+
'esri/geometry/projection',
|
|
477
|
+
'esri/geometry/SpatialReference',
|
|
467
478
|
]).then(
|
|
468
479
|
([
|
|
469
480
|
_WMSLayer,
|
|
@@ -472,13 +483,31 @@ class MenuWidget extends React.Component {
|
|
|
472
483
|
_BaseTileLayer,
|
|
473
484
|
_esriRequest,
|
|
474
485
|
_Extent,
|
|
486
|
+
_MapImageLayer,
|
|
487
|
+
_projection,
|
|
488
|
+
_SpatialReference,
|
|
475
489
|
]) => {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
490
|
+
[
|
|
491
|
+
WMSLayer,
|
|
492
|
+
WMTSLayer,
|
|
493
|
+
FeatureLayer,
|
|
494
|
+
BaseTileLayer,
|
|
495
|
+
esriRequest,
|
|
496
|
+
Extent,
|
|
497
|
+
MapImageLayer,
|
|
498
|
+
projection,
|
|
499
|
+
SpatialReference,
|
|
500
|
+
] = [
|
|
501
|
+
_WMSLayer,
|
|
502
|
+
_WMTSLayer,
|
|
503
|
+
_FeatureLayer,
|
|
504
|
+
_BaseTileLayer,
|
|
505
|
+
_esriRequest,
|
|
506
|
+
_Extent,
|
|
507
|
+
_MapImageLayer,
|
|
508
|
+
_projection,
|
|
509
|
+
_SpatialReference,
|
|
510
|
+
];
|
|
482
511
|
},
|
|
483
512
|
);
|
|
484
513
|
}
|
|
@@ -806,16 +835,12 @@ class MenuWidget extends React.Component {
|
|
|
806
835
|
loadCss();
|
|
807
836
|
await this.loader();
|
|
808
837
|
await this.getTMSLayersJSON();
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
// currentContainer = await this.container.current;
|
|
812
|
-
//} while (currentContainer == null);
|
|
813
|
-
if (!this.props.download) {
|
|
814
|
-
this.waitForContainer(this.container.current);
|
|
838
|
+
if (!this.container.current) return;
|
|
839
|
+
this.props.view.when(() => {
|
|
815
840
|
this.prepareHotspotLayers();
|
|
816
841
|
this.getHotspotLayerIds();
|
|
817
842
|
this.props.view.ui.add(this.container.current, 'top-left');
|
|
818
|
-
}
|
|
843
|
+
});
|
|
819
844
|
if (this.props.download) {
|
|
820
845
|
setTimeout(() => {
|
|
821
846
|
document.querySelector('.area-panel input:checked').click();
|
|
@@ -1633,7 +1658,19 @@ class MenuWidget extends React.Component {
|
|
|
1633
1658
|
if (
|
|
1634
1659
|
!this.layers.hasOwnProperty(layer.LayerId + '_' + inheritedIndexLayer)
|
|
1635
1660
|
) {
|
|
1636
|
-
if (viewService?.toLowerCase().
|
|
1661
|
+
if (viewService?.toLowerCase().endsWith('mapserver')) {
|
|
1662
|
+
this.layers[
|
|
1663
|
+
layer.LayerId + '_' + inheritedIndexLayer
|
|
1664
|
+
] = new MapImageLayer({
|
|
1665
|
+
url: viewService,
|
|
1666
|
+
title: layer.Title,
|
|
1667
|
+
datasetId: DatasetId,
|
|
1668
|
+
datasetTitle: DatasetTitle,
|
|
1669
|
+
productId: ProductId,
|
|
1670
|
+
layerTitle: layer.Title,
|
|
1671
|
+
});
|
|
1672
|
+
//iterate sublayers fetching all sublayer data
|
|
1673
|
+
} else if (viewService?.toLowerCase().includes('wms')) {
|
|
1637
1674
|
viewService = viewService?.endsWith('?')
|
|
1638
1675
|
? viewService
|
|
1639
1676
|
: viewService + '?';
|
|
@@ -2536,6 +2573,44 @@ class MenuWidget extends React.Component {
|
|
|
2536
2573
|
BBoxes[0] = { xmin: bbox[0], ymin: bbox[1], xmax: bbox[2], ymax: bbox[3] };
|
|
2537
2574
|
return BBoxes;
|
|
2538
2575
|
}
|
|
2576
|
+
async parseBBOXMAPSERVER(layer) {
|
|
2577
|
+
let BBoxes = {};
|
|
2578
|
+
for (let i = 0; i < layer?.allSublayers?.items.length; i++) {
|
|
2579
|
+
const subLayer = layer.allSublayers.items.find(
|
|
2580
|
+
(sublayer) => sublayer.id === i,
|
|
2581
|
+
);
|
|
2582
|
+
try {
|
|
2583
|
+
const response = await fetch(`${subLayer.url}?f=pjson`);
|
|
2584
|
+
if (!response.ok) {
|
|
2585
|
+
//console.log('no response from server');
|
|
2586
|
+
continue; // Skip this iteration on error
|
|
2587
|
+
}
|
|
2588
|
+
const subLayerData = await response.json(); // Await JSON parsing
|
|
2589
|
+
if (subLayerData === null) {
|
|
2590
|
+
//console.log('no data retrieved:', subLayerData);
|
|
2591
|
+
continue;
|
|
2592
|
+
} else {
|
|
2593
|
+
// Convert bounding box data to correct extent values for map view
|
|
2594
|
+
|
|
2595
|
+
let extent = this.convertBBOXValues(subLayerData.extent);
|
|
2596
|
+
|
|
2597
|
+
// Store sublayer extent
|
|
2598
|
+
|
|
2599
|
+
BBoxes[subLayerData.name] = {
|
|
2600
|
+
id: subLayerData.id,
|
|
2601
|
+
extent: extent,
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
} catch (error) {
|
|
2605
|
+
//console.error('Error fetching sublayer:', error);
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
BBoxes['dataset'] = this.convertBBOXValues(layer?.fullExtent?.extent);
|
|
2610
|
+
|
|
2611
|
+
return BBoxes; // Return BBoxes after all fetches are completed
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2539
2614
|
parseBBOXWMS(xml) {
|
|
2540
2615
|
const layerParentNode = xml.querySelectorAll('Layer');
|
|
2541
2616
|
let layersChildren = Array.from(layerParentNode).filter(
|
|
@@ -2725,10 +2800,37 @@ class MenuWidget extends React.Component {
|
|
|
2725
2800
|
.catch(() => {});
|
|
2726
2801
|
};
|
|
2727
2802
|
|
|
2803
|
+
findBBoxById(obj, id) {
|
|
2804
|
+
for (let key in obj) {
|
|
2805
|
+
if (obj.hasOwnProperty(key)) {
|
|
2806
|
+
// Check if the current object's id matches the desired id
|
|
2807
|
+
if (obj[key].id === id) {
|
|
2808
|
+
return obj[key].extent; // Return the extent if found
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
return null; // Return null if the id is not found
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
convertBBOXValues(extent) {
|
|
2816
|
+
//Create a spatial reference object for the extent
|
|
2817
|
+
|
|
2818
|
+
let sr4326 = new SpatialReference({
|
|
2819
|
+
wkid: 4326,
|
|
2820
|
+
});
|
|
2821
|
+
|
|
2822
|
+
//Create a projection object for the extent
|
|
2823
|
+
|
|
2824
|
+
let newBBox = projection.project(extent, sr4326);
|
|
2825
|
+
return newBBox;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2728
2828
|
async FullExtentDataset(elem) {
|
|
2729
2829
|
let BBoxes = {};
|
|
2730
2830
|
this.findCheckedDataset(elem);
|
|
2731
|
-
if (this.url
|
|
2831
|
+
if (this.url?.toLowerCase().endsWith('mapserver')) {
|
|
2832
|
+
BBoxes = await this.parseBBOXMAPSERVER(this.layers[elem.id]);
|
|
2833
|
+
} else if (this.url.toLowerCase().includes('wms')) {
|
|
2732
2834
|
await this.getCapabilities(this.url, 'wms');
|
|
2733
2835
|
BBoxes = this.parseBBOXWMS(this.xml);
|
|
2734
2836
|
} else if (this.url.toLowerCase().includes('wmts')) {
|
|
@@ -2774,6 +2876,8 @@ class MenuWidget extends React.Component {
|
|
|
2774
2876
|
});
|
|
2775
2877
|
this.view.goTo(myExtent);
|
|
2776
2878
|
}
|
|
2879
|
+
} else if (this.url?.toLowerCase().endsWith('mapserver')) {
|
|
2880
|
+
BBoxes = await this.parseBBOXMAPSERVER(this.layers[elem.id]);
|
|
2777
2881
|
} else if (this.url?.toLowerCase().includes('wms')) {
|
|
2778
2882
|
await this.getCapabilities(this.url, 'wms');
|
|
2779
2883
|
BBoxes = this.parseBBOXWMS(this.xml);
|
|
@@ -2798,20 +2902,63 @@ class MenuWidget extends React.Component {
|
|
|
2798
2902
|
let match = str.match(/layerid="(\d+)"/);
|
|
2799
2903
|
let layerid = match ? match[1] : null;
|
|
2800
2904
|
if (layerid === null || layerid === undefined) return;
|
|
2801
|
-
if (
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2905
|
+
if (this.url?.toLowerCase().endsWith('mapserver')) {
|
|
2906
|
+
switch (layerid) {
|
|
2907
|
+
case '1':
|
|
2908
|
+
firstLayer = this.findBBoxById(BBoxes, 13);
|
|
2909
|
+
break;
|
|
2910
|
+
case '2':
|
|
2911
|
+
firstLayer = this.findBBoxById(BBoxes, 12);
|
|
2912
|
+
break;
|
|
2913
|
+
case '3':
|
|
2914
|
+
firstLayer = this.findBBoxById(BBoxes, 11);
|
|
2915
|
+
break;
|
|
2916
|
+
case '4':
|
|
2917
|
+
firstLayer = this.findBBoxById(BBoxes, 10);
|
|
2918
|
+
break;
|
|
2919
|
+
case '5':
|
|
2920
|
+
firstLayer = this.findBBoxById(BBoxes, 9);
|
|
2921
|
+
break;
|
|
2922
|
+
case '7':
|
|
2923
|
+
firstLayer = this.findBBoxById(BBoxes, 7);
|
|
2924
|
+
break;
|
|
2925
|
+
case '8':
|
|
2926
|
+
firstLayer = this.findBBoxById(BBoxes, 6);
|
|
2927
|
+
break;
|
|
2928
|
+
case '9':
|
|
2929
|
+
firstLayer = this.findBBoxById(BBoxes, 5);
|
|
2930
|
+
break;
|
|
2931
|
+
case '10':
|
|
2932
|
+
firstLayer = this.findBBoxById(BBoxes, 4);
|
|
2933
|
+
break;
|
|
2934
|
+
case '11':
|
|
2935
|
+
firstLayer = this.findBBoxById(BBoxes, 3);
|
|
2936
|
+
break;
|
|
2937
|
+
case '12':
|
|
2938
|
+
firstLayer = this.findBBoxById(BBoxes, 0);
|
|
2939
|
+
break;
|
|
2940
|
+
case '13':
|
|
2941
|
+
firstLayer = this.findBBoxById(BBoxes, 1);
|
|
2942
|
+
break;
|
|
2943
|
+
default:
|
|
2944
|
+
return;
|
|
2945
|
+
}
|
|
2813
2946
|
} else {
|
|
2814
|
-
|
|
2947
|
+
if (layerid === '12' || layerid === '13') {
|
|
2948
|
+
firstLayer = BBoxes['dataset'];
|
|
2949
|
+
} else if (layerid === '1' || layerid === '7') {
|
|
2950
|
+
firstLayer = BBoxes[Object.keys(BBoxes)[0]];
|
|
2951
|
+
} else if (layerid === '2' || layerid === '8') {
|
|
2952
|
+
firstLayer = BBoxes[Object.keys(BBoxes)[1]];
|
|
2953
|
+
} else if (layerid === '3' || layerid === '9') {
|
|
2954
|
+
firstLayer = BBoxes[Object.keys(BBoxes)[2]];
|
|
2955
|
+
} else if (layerid === '4' || layerid === '10') {
|
|
2956
|
+
firstLayer = BBoxes[Object.keys(BBoxes)[3]];
|
|
2957
|
+
} else if (layerid === '5' || layerid === '11') {
|
|
2958
|
+
firstLayer = BBoxes[Object.keys(BBoxes)[4]];
|
|
2959
|
+
} else {
|
|
2960
|
+
firstLayer = BBoxes['dataset'];
|
|
2961
|
+
}
|
|
2815
2962
|
}
|
|
2816
2963
|
} else if (
|
|
2817
2964
|
elem.id.includes('all_present') ||
|
|
@@ -20,10 +20,13 @@ class PanWidget extends React.Component {
|
|
|
20
20
|
* This method is executed after the rener method is executed
|
|
21
21
|
*/
|
|
22
22
|
async componentDidMount() {
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
if (!this.container.current) return;
|
|
24
|
+
this.props.view.when(() => {
|
|
25
|
+
this.props.view.ui.add({
|
|
26
|
+
component: this.container.current,
|
|
27
|
+
position: 'top-right',
|
|
28
|
+
index: 0,
|
|
29
|
+
});
|
|
27
30
|
});
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -79,12 +79,14 @@ class PrintWidget extends React.Component {
|
|
|
79
79
|
*/
|
|
80
80
|
async componentDidMount() {
|
|
81
81
|
await this.loader();
|
|
82
|
-
this.waitForContainer(this.container.current);
|
|
83
|
-
|
|
84
|
-
this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
//this.waitForContainer(this.container.current);
|
|
83
|
+
if (!this.container.current) return;
|
|
84
|
+
this.props.view.when(() => {
|
|
85
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
86
|
+
this.print = new Print({
|
|
87
|
+
view: this.props.view,
|
|
88
|
+
container: this.container.current.querySelector('.print-panel'),
|
|
89
|
+
});
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -38,12 +38,15 @@ class ScaleWidget extends React.Component {
|
|
|
38
38
|
*/
|
|
39
39
|
async componentDidMount() {
|
|
40
40
|
await this.loader();
|
|
41
|
-
this.waitForContainer(this.props.view);
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
//this.waitForContainer(this.props.view);
|
|
42
|
+
if (!this.container.current) return;
|
|
43
|
+
this.props.view.when(() => {
|
|
44
|
+
this.scaleBar = new ScaleBar({
|
|
45
|
+
view: this.props.view,
|
|
46
|
+
unit: 'dual',
|
|
47
|
+
});
|
|
48
|
+
this.props.view.ui.add(this.scaleBar, 'bottom-left');
|
|
45
49
|
});
|
|
46
|
-
this.props.view.ui.add(this.scaleBar, 'bottom-left');
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
52
|
* This method renders the component
|
|
@@ -91,14 +91,18 @@ class SwipeWidget extends React.Component {
|
|
|
91
91
|
* This method is executed after the rener method is executed
|
|
92
92
|
*/
|
|
93
93
|
async componentDidMount() {
|
|
94
|
-
this.props.view.ui.add(this.container.current, 'top-right');
|
|
95
94
|
await this.loader();
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
if (!this.container.current) return;
|
|
96
|
+
this.props.view.when(() => {
|
|
97
|
+
this.props.view.ui.add(this.container.current, 'top-right');
|
|
98
|
+
this.swipe = new Swipe({
|
|
99
|
+
view: this.props.view,
|
|
100
|
+
direction: 'horizontal',
|
|
101
|
+
position: 50,
|
|
102
|
+
});
|
|
100
103
|
});
|
|
101
104
|
}
|
|
105
|
+
|
|
102
106
|
getLayerTitle(layer) {
|
|
103
107
|
let title;
|
|
104
108
|
if (layer.url && layer.url.toLowerCase().includes('wmts')) {
|
|
@@ -197,105 +197,107 @@ class TimesliderWidget extends React.Component {
|
|
|
197
197
|
await this.loader();
|
|
198
198
|
let playRateValue =
|
|
199
199
|
this.layer.ProductId === '8474c3b080fa42cc837f1d2338fcf096' ? 4000 : 1000;
|
|
200
|
-
this.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const normal = new Intl.DateTimeFormat('en-gb');
|
|
214
|
-
switch (type) {
|
|
215
|
-
case 'min':
|
|
216
|
-
if (this.state.timeSelectedValuesC == null)
|
|
217
|
-
// In case of first iteration
|
|
218
|
-
this.state.timeSelectedValuesC[0] = value;
|
|
219
|
-
element.innerText = normal.format(value).replaceAll('/', '.');
|
|
220
|
-
break;
|
|
221
|
-
case 'max':
|
|
222
|
-
if (this.state.timeSelectedValuesC == null)
|
|
223
|
-
// In case of first iteration
|
|
224
|
-
this.state.timeSelectedValuesC[1] = value;
|
|
225
|
-
element.innerText = normal.format(value).replaceAll('/', '.');
|
|
226
|
-
break;
|
|
227
|
-
case 'extent':
|
|
228
|
-
this.state.timeSelectedValues = value;
|
|
229
|
-
if (
|
|
230
|
-
normal
|
|
231
|
-
.format(this.state.timeSelectedValues[0])
|
|
232
|
-
.replaceAll('/', '.') !==
|
|
233
|
-
normal
|
|
234
|
-
.format(this.state.timeSelectedValuesC[0])
|
|
235
|
-
.replaceAll('/', '.')
|
|
236
|
-
) {
|
|
237
|
-
this.state.timeSelectedValuesC[0] = value[0];
|
|
238
|
-
element.innerText = normal
|
|
239
|
-
.format(value[0])
|
|
240
|
-
.replaceAll('/', '.');
|
|
241
|
-
} else if (
|
|
242
|
-
normal
|
|
243
|
-
.format(this.state.timeSelectedValues[1])
|
|
244
|
-
.replaceAll('/', '.') !==
|
|
245
|
-
normal
|
|
246
|
-
.format(this.state.timeSelectedValuesC[1])
|
|
247
|
-
.replaceAll('/', '.')
|
|
248
|
-
) {
|
|
249
|
-
this.state.timeSelectedValuesC[1] = value[1];
|
|
250
|
-
element.innerText = normal
|
|
251
|
-
.format(value[1])
|
|
252
|
-
.replaceAll('/', '.');
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
default:
|
|
256
|
-
element.innerText = normal.format(value).replaceAll('/', '.');
|
|
257
|
-
break;
|
|
200
|
+
if (!this.container.current) return;
|
|
201
|
+
this.props.view.when(() => {
|
|
202
|
+
this.TimesliderWidget = new TimeSlider({
|
|
203
|
+
view: this.props.view,
|
|
204
|
+
container: document.querySelector('.timeslider-panel'),
|
|
205
|
+
timeVisible: true,
|
|
206
|
+
mode: 'instant',
|
|
207
|
+
playRate: playRateValue,
|
|
208
|
+
loop: false,
|
|
209
|
+
labelFormatFunction: (value, type, element, layout) => {
|
|
210
|
+
if (!this.TimesliderWidget.fullTimeExtent) {
|
|
211
|
+
element.innerText = 'Loading...';
|
|
212
|
+
return;
|
|
258
213
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
214
|
+
if (value) {
|
|
215
|
+
const normal = new Intl.DateTimeFormat('en-gb');
|
|
216
|
+
switch (type) {
|
|
217
|
+
case 'min':
|
|
218
|
+
if (this.state.timeSelectedValuesC == null)
|
|
219
|
+
// In case of first iteration
|
|
220
|
+
this.state.timeSelectedValuesC[0] = value;
|
|
221
|
+
element.innerText = normal.format(value).replaceAll('/', '.');
|
|
222
|
+
break;
|
|
223
|
+
case 'max':
|
|
224
|
+
if (this.state.timeSelectedValuesC == null)
|
|
225
|
+
// In case of first iteration
|
|
226
|
+
this.state.timeSelectedValuesC[1] = value;
|
|
227
|
+
element.innerText = normal.format(value).replaceAll('/', '.');
|
|
228
|
+
break;
|
|
229
|
+
case 'extent':
|
|
230
|
+
this.state.timeSelectedValues = value;
|
|
231
|
+
if (
|
|
232
|
+
normal
|
|
233
|
+
.format(this.state.timeSelectedValues[0])
|
|
234
|
+
.replaceAll('/', '.') !==
|
|
235
|
+
normal
|
|
236
|
+
.format(this.state.timeSelectedValuesC[0])
|
|
237
|
+
.replaceAll('/', '.')
|
|
238
|
+
) {
|
|
239
|
+
this.state.timeSelectedValuesC[0] = value[0];
|
|
240
|
+
element.innerText = normal
|
|
241
|
+
.format(value[0])
|
|
242
|
+
.replaceAll('/', '.');
|
|
243
|
+
} else if (
|
|
244
|
+
normal
|
|
245
|
+
.format(this.state.timeSelectedValues[1])
|
|
246
|
+
.replaceAll('/', '.') !==
|
|
247
|
+
normal
|
|
248
|
+
.format(this.state.timeSelectedValuesC[1])
|
|
249
|
+
.replaceAll('/', '.')
|
|
250
|
+
) {
|
|
251
|
+
this.state.timeSelectedValuesC[1] = value[1];
|
|
252
|
+
element.innerText = normal
|
|
253
|
+
.format(value[1])
|
|
254
|
+
.replaceAll('/', '.');
|
|
255
|
+
}
|
|
256
|
+
break;
|
|
257
|
+
default:
|
|
258
|
+
element.innerText = normal.format(value).replaceAll('/', '.');
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
this.setState({
|
|
262
|
+
lockDatePanel: false,
|
|
263
|
+
});
|
|
282
264
|
}
|
|
283
|
-
}
|
|
265
|
+
},
|
|
284
266
|
});
|
|
267
|
+
this.props.view.ui.add(this.container.current, 'bottom-right');
|
|
268
|
+
this.container.current.insertAdjacentHTML(
|
|
269
|
+
'beforeend',
|
|
270
|
+
'<div class="esri-icon-close" id="timeslider_close" role="button"></div>',
|
|
271
|
+
);
|
|
272
|
+
this.container.current.style.display = 'block';
|
|
273
|
+
this.setState({ showDatePanel: true });
|
|
285
274
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
this.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (!this.container.current ? true : false) {
|
|
296
|
-
this.TimesliderWidget.stop();
|
|
275
|
+
document
|
|
276
|
+
.querySelector('#timeslider_close')
|
|
277
|
+
.addEventListener('click', () => {
|
|
278
|
+
this.props.time.elem.querySelector('.active-layer-time').click();
|
|
279
|
+
if (this.props.fromDownload) {
|
|
280
|
+
if (this.props.download) {
|
|
281
|
+
document.getElementById('download_label').click();
|
|
282
|
+
} else {
|
|
283
|
+
document.getElementById('products_label').click();
|
|
297
284
|
}
|
|
298
|
-
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
this.props.view
|
|
289
|
+
.whenLayerView(this.layer, this.TimesliderWidget)
|
|
290
|
+
.then((lv) => {
|
|
291
|
+
if (this.layer.type === 'feature') {
|
|
292
|
+
this.TimesliderWidget.fullTimeExtent = this.layer.timeInfo.fullTimeExtent;
|
|
293
|
+
this.TimesliderWidget.stops = {
|
|
294
|
+
interval: this.layer.timeInfo.interval,
|
|
295
|
+
};
|
|
296
|
+
this.TimesliderWidget.watch('timeExtent', (timeExtent) => {
|
|
297
|
+
if (!this.container.current ? true : false) {
|
|
298
|
+
this.TimesliderWidget.stop();
|
|
299
|
+
}
|
|
300
|
+
/*let start = new Date(timeExtent.start).getTime();
|
|
299
301
|
let end = new Date(timeExtent.end).getTime();
|
|
300
302
|
this.props.time.elem.setAttribute('time-start', start);
|
|
301
303
|
this.props.time.elem.setAttribute('time-end', end);
|
|
@@ -305,94 +307,96 @@ class TimesliderWidget extends React.Component {
|
|
|
305
307
|
}
|
|
306
308
|
this.props.time.dataset.setAttribute('time-start', start);
|
|
307
309
|
this.props.time.dataset.setAttribute('time-end', end);*/
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (this.layer.type === 'wms') {
|
|
312
|
-
serviceType = 'wms';
|
|
313
|
-
} else if (this.layer.type === 'wmts') {
|
|
314
|
-
serviceType = 'wmts';
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
this.getCapabilities(this.layer.url, serviceType).then((xml) => {
|
|
318
|
-
let times = {};
|
|
319
|
-
let periodicity;
|
|
310
|
+
});
|
|
311
|
+
} else {
|
|
312
|
+
let serviceType = '';
|
|
320
313
|
if (this.layer.type === 'wms') {
|
|
321
|
-
|
|
314
|
+
serviceType = 'wms';
|
|
322
315
|
} else if (this.layer.type === 'wmts') {
|
|
323
|
-
|
|
316
|
+
serviceType = 'wmts';
|
|
324
317
|
}
|
|
325
|
-
// Capabilities have time enabled
|
|
326
|
-
if (times[this.layerName].hasOwnProperty('dimension') === false) {
|
|
327
|
-
// Start-End-Period
|
|
328
|
-
if (times[this.layerName].hasOwnProperty('period')) {
|
|
329
|
-
this.TimesliderWidget.fullTimeExtent = new TimeExtent({
|
|
330
|
-
start: new Date(times[this.layerName].start),
|
|
331
|
-
end: new Date(times[this.layerName].end),
|
|
332
|
-
});
|
|
333
318
|
|
|
334
|
-
|
|
319
|
+
this.getCapabilities(this.layer.url, serviceType).then((xml) => {
|
|
320
|
+
let times = {};
|
|
321
|
+
let periodicity;
|
|
322
|
+
if (this.layer.type === 'wms') {
|
|
323
|
+
times = this.parseTimeWMS(xml);
|
|
324
|
+
} else if (this.layer.type === 'wmts') {
|
|
325
|
+
times = this.parseTimeWMTS(xml);
|
|
326
|
+
}
|
|
327
|
+
// Capabilities have time enabled
|
|
328
|
+
if (times[this.layerName].hasOwnProperty('dimension') === false) {
|
|
329
|
+
// Start-End-Period
|
|
330
|
+
if (times[this.layerName].hasOwnProperty('period')) {
|
|
331
|
+
this.TimesliderWidget.fullTimeExtent = new TimeExtent({
|
|
332
|
+
start: new Date(times[this.layerName].start),
|
|
333
|
+
end: new Date(times[this.layerName].end),
|
|
334
|
+
});
|
|
335
335
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
period.years * 365 * 24 * 60 +
|
|
340
|
-
period.months * 31 * 24 * 60 +
|
|
341
|
-
period.weeks * 7 * 24 * 60 +
|
|
342
|
-
period.days * 24 * 60 +
|
|
343
|
-
period.hours * 60 +
|
|
344
|
-
period.minutes +
|
|
345
|
-
period.seconds / 60,
|
|
346
|
-
unit: 'minutes',
|
|
347
|
-
},
|
|
348
|
-
};
|
|
336
|
+
const period = this.parserPeriod(
|
|
337
|
+
times[this.layerName].period,
|
|
338
|
+
);
|
|
349
339
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
};
|
|
340
|
+
this.TimesliderWidget.stops = {
|
|
341
|
+
interval: {
|
|
342
|
+
value:
|
|
343
|
+
period.years * 365 * 24 * 60 +
|
|
344
|
+
period.months * 31 * 24 * 60 +
|
|
345
|
+
period.weeks * 7 * 24 * 60 +
|
|
346
|
+
period.days * 24 * 60 +
|
|
347
|
+
period.hours * 60 +
|
|
348
|
+
period.minutes +
|
|
349
|
+
period.seconds / 60,
|
|
350
|
+
unit: 'minutes',
|
|
351
|
+
},
|
|
352
|
+
};
|
|
364
353
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
354
|
+
periodicity = times[this.layerName].period;
|
|
355
|
+
} else if (times[this.layerName].hasOwnProperty('array')) {
|
|
356
|
+
// Dates array
|
|
357
|
+
this.TimesliderWidget.fullTimeExtent = new TimeExtent({
|
|
358
|
+
start: new Date(times[this.layerName].array[0]),
|
|
359
|
+
end: new Date(
|
|
360
|
+
times[this.layerName].array[
|
|
361
|
+
times[this.layerName].array.length - 1
|
|
362
|
+
],
|
|
363
|
+
),
|
|
364
|
+
});
|
|
365
|
+
this.TimesliderWidget.stops = {
|
|
366
|
+
dates: times[this.layerName].array.map((e) => new Date(e)),
|
|
367
|
+
};
|
|
370
368
|
|
|
371
|
-
|
|
372
|
-
|
|
369
|
+
if (this.layer.type === 'wmts') {
|
|
370
|
+
this.layer.customLayerParameters = {};
|
|
371
|
+
const time = times[this.layerName].array.map(
|
|
372
|
+
(d) => new Date(d),
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
for (let i in time) {
|
|
376
|
+
timeDict[time[i]] = times[this.layerName].array[i];
|
|
377
|
+
}
|
|
373
378
|
}
|
|
374
|
-
}
|
|
375
379
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
380
|
+
periodicity = Math.floor(
|
|
381
|
+
(Date.parse(times[this.layerName].array[1]) -
|
|
382
|
+
Date.parse(times[this.layerName].array[0])) /
|
|
383
|
+
86400000,
|
|
384
|
+
);
|
|
385
|
+
if (periodicity === 0) {
|
|
386
|
+
periodicity =
|
|
387
|
+
(new Date(times[this.layerName].array[1]).getHours() -
|
|
388
|
+
new Date(times[this.layerName].array[0]).getHours()) /
|
|
389
|
+
24;
|
|
390
|
+
}
|
|
386
391
|
}
|
|
387
|
-
}
|
|
388
392
|
|
|
389
|
-
|
|
393
|
+
this.setState({ periodicity: periodicity });
|
|
390
394
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
395
|
+
this.TimesliderWidget.watch('timeExtent', (timeExtent) => {
|
|
396
|
+
if (!this.container.current ? true : false) {
|
|
397
|
+
this.TimesliderWidget.stop();
|
|
398
|
+
}
|
|
399
|
+
/*let start = new Date(timeExtent.start).getTime();
|
|
396
400
|
let end = new Date(timeExtent.end).getTime();
|
|
397
401
|
this.props.time.elem.setAttribute('time-start', start);
|
|
398
402
|
this.props.time.elem.setAttribute('time-end', end);
|
|
@@ -402,38 +406,39 @@ class TimesliderWidget extends React.Component {
|
|
|
402
406
|
}
|
|
403
407
|
this.props.time.dataset.setAttribute('time-start', start);
|
|
404
408
|
this.props.time.dataset.setAttribute('time-end', end);*/
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
this.layer.customLayerParameters['TIME'] =
|
|
408
|
-
timeDict[this.TimesliderWidget.timeExtent.end];
|
|
409
|
-
} else {
|
|
410
|
-
this.layer.customLayerParameters = {};
|
|
411
|
-
if (times[this.layerName].hasOwnProperty('array')) {
|
|
409
|
+
if (this.layer.type === 'wmts') {
|
|
410
|
+
this.layer.customLayerParameters = {};
|
|
412
411
|
this.layer.customLayerParameters['TIME'] =
|
|
413
412
|
timeDict[this.TimesliderWidget.timeExtent.end];
|
|
414
413
|
} else {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
414
|
+
this.layer.customLayerParameters = {};
|
|
415
|
+
if (times[this.layerName].hasOwnProperty('array')) {
|
|
416
|
+
this.layer.customLayerParameters['TIME'] =
|
|
417
|
+
timeDict[this.TimesliderWidget.timeExtent.end];
|
|
418
|
+
} else {
|
|
419
|
+
const newDateTimeObject = new Date(
|
|
420
|
+
this.TimesliderWidget.timeExtent.start.toISOString(),
|
|
421
|
+
);
|
|
422
|
+
newDateTimeObject.setMinutes(
|
|
423
|
+
this.TimesliderWidget.timeExtent.start.getMinutes() +
|
|
424
|
+
this.TimesliderWidget.stops['interval'].value,
|
|
425
|
+
);
|
|
426
|
+
this.layer.customLayerParameters['TIME'] =
|
|
427
|
+
this.TimesliderWidget.timeExtent.start.toISOString() +
|
|
428
|
+
'/' +
|
|
429
|
+
newDateTimeObject.toISOString(); //OK
|
|
430
|
+
}
|
|
426
431
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
432
|
+
this.layer.refresh();
|
|
433
|
+
});
|
|
434
|
+
} // if there is dimension time
|
|
435
|
+
else {
|
|
436
|
+
this.TimesliderWidget.disabled = true;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
} // is feature or WMS/WMTS
|
|
440
|
+
});
|
|
441
|
+
});
|
|
437
442
|
} //componentDidMount
|
|
438
443
|
|
|
439
444
|
getPeriodicity() {
|
|
@@ -94,10 +94,13 @@ class LegendWidget extends React.Component {
|
|
|
94
94
|
*/
|
|
95
95
|
async componentDidMount() {
|
|
96
96
|
await this.loader();
|
|
97
|
-
|
|
98
|
-
this.
|
|
99
|
-
view
|
|
100
|
-
|
|
97
|
+
if (!this.container.current) return;
|
|
98
|
+
this.view.when(() => {
|
|
99
|
+
this.view.ui.add(this.container.current, 'top-right');
|
|
100
|
+
this.LegendWidget = new Legend({
|
|
101
|
+
view: this.view,
|
|
102
|
+
container: document.querySelector('.legend-panel'),
|
|
103
|
+
});
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
@@ -117,6 +117,7 @@ class UseCasesMapViewer extends React.Component {
|
|
|
117
117
|
basemap: this.basemap,
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
if (!this.mapdiv.current) return;
|
|
120
121
|
this.view = new MapView({
|
|
121
122
|
container: this.mapdiv.current,
|
|
122
123
|
map: this.map,
|
|
@@ -127,68 +128,70 @@ class UseCasesMapViewer extends React.Component {
|
|
|
127
128
|
},
|
|
128
129
|
});
|
|
129
130
|
|
|
130
|
-
this.view.
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
this.view.when(() => {
|
|
132
|
+
this.view.ui.add(this.zoom, {
|
|
133
|
+
position: 'top-right',
|
|
134
|
+
});
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
layerControl = new LayerControl({
|
|
137
|
+
map: this.map,
|
|
138
|
+
view: this.view,
|
|
139
|
+
mapViewer: this,
|
|
140
|
+
worldDimensions: this.mapCfg.worldDimensions,
|
|
141
|
+
maxZoom: this.mapCfg.maxZoom,
|
|
142
|
+
FeatureLayer: FeatureLayer,
|
|
143
|
+
Extent: Extent,
|
|
144
|
+
});
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
layerSpatial = layerControl.createLayer({
|
|
147
|
+
id: this.spatialConfig.id,
|
|
148
|
+
url: this.spatialConfig.url,
|
|
149
|
+
legend: this.spatialConfig.showLegend,
|
|
150
|
+
});
|
|
149
151
|
|
|
150
|
-
|
|
152
|
+
layerSpatial.renderer = this.spatialConfig.render;
|
|
151
153
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
let layerRegion = layerControl.createLayer({
|
|
155
|
+
id: this.regionConfig.id,
|
|
156
|
+
url: this.regionConfig.url,
|
|
157
|
+
legend: this.regionConfig.showLegend,
|
|
158
|
+
});
|
|
157
159
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
layerHighlight = layerControl.createLayer({
|
|
161
|
+
id: this.HighlightConfig.id,
|
|
162
|
+
url: this.HighlightConfig.url,
|
|
163
|
+
legend: this.HighlightConfig.showLegend,
|
|
164
|
+
});
|
|
163
165
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
layerRegion.renderer = this.regionConfig.render;
|
|
167
|
+
layerRegion.labelingInfo = [this.regionConfig.label];
|
|
168
|
+
layerHighlight.renderer = this.HighlightConfig.render;
|
|
167
169
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
layerControl.addLayer(layerHighlight);
|
|
171
|
+
layerControl.addLayer(layerRegion);
|
|
172
|
+
layerControl.addLayer(layerSpatial);
|
|
171
173
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
+
layerControl.hideLayer(layerHighlight.id);
|
|
175
|
+
layerControl.hideLayer(layerSpatial.id);
|
|
174
176
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
navigationControl = new NavigationControl({
|
|
178
|
+
map: this.map,
|
|
179
|
+
view: this.view,
|
|
180
|
+
center: this.mapCfg.center,
|
|
181
|
+
layerControl: layerControl,
|
|
182
|
+
mapViewer: this,
|
|
183
|
+
layerRegion: layerRegion,
|
|
184
|
+
layerSpatial: layerSpatial,
|
|
185
|
+
layerHighlight: layerHighlight,
|
|
186
|
+
});
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
this.setMapFunctions(
|
|
189
|
+
this.view,
|
|
190
|
+
layerControl,
|
|
191
|
+
navigationControl,
|
|
192
|
+
layerSpatial,
|
|
193
|
+
);
|
|
194
|
+
});
|
|
192
195
|
|
|
193
196
|
//Once we have created the MapView, we need to ensure that the map div
|
|
194
197
|
//is refreshed in order to show the map on it. To do so, we need to
|