@opengeoweb/webmap-react 12.0.0 → 12.1.0
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/index.esm.js +244 -84
- package/package.json +15 -24
- package/src/lib/components/OpenLayers/OlStyles.d.ts +4 -1
- package/src/lib/components/OpenLayers/index.d.ts +1 -0
- package/src/lib/components/OpenLayers/tools/index.d.ts +1 -0
- package/src/lib/hooks/index.d.ts +2 -0
- package/src/lib/hooks/useAnimationForLayer.d.ts +1 -1
- package/src/lib/hooks/{useViewFromLayerById.d.ts → useViewFromLayer.d.ts} +1 -1
package/index.esm.js
CHANGED
|
@@ -20,6 +20,7 @@ import proj4 from 'proj4';
|
|
|
20
20
|
import { register } from 'ol/proj/proj4';
|
|
21
21
|
import WMTSCapabilities from 'ol/format/WMTSCapabilities';
|
|
22
22
|
import { optionsFromCapabilities } from 'ol/source/WMTS';
|
|
23
|
+
import { View, Map, Feature, Collection } from 'ol';
|
|
23
24
|
import { Vector } from 'ol/layer';
|
|
24
25
|
import VectorSource from 'ol/source/Vector';
|
|
25
26
|
import GeoJSON from 'ol/format/GeoJSON';
|
|
@@ -34,7 +35,6 @@ import { produce } from 'immer';
|
|
|
34
35
|
import { useResizeDetector } from 'react-resize-detector';
|
|
35
36
|
import Box$1 from '@mui/material/Box';
|
|
36
37
|
import Typography$1 from '@mui/material/Typography';
|
|
37
|
-
import { View, Map, Feature, Collection } from 'ol';
|
|
38
38
|
import { defaults, MouseWheelZoom, Draw, Modify, Translate, Snap } from 'ol/interaction';
|
|
39
39
|
import 'ol/ol.css';
|
|
40
40
|
import { toLonLat, fromLonLat } from 'ol/proj';
|
|
@@ -1552,7 +1552,9 @@ var getDimensionParamsForWMS = function getDimensionParamsForWMS(dimensions, wmL
|
|
|
1552
1552
|
}
|
|
1553
1553
|
// Take the closest WMLayer dimension value, if not available just use the already existing value
|
|
1554
1554
|
var closestValue = (wmLayer === null || wmLayer === void 0 || (_wmLayer$getDimension = wmLayer.getDimension(dimension.name)) === null || _wmLayer$getDimension === void 0 ? void 0 : _wmLayer$getDimension.getClosestValue(dimension.currentValue)) || dimension.currentValue;
|
|
1555
|
-
|
|
1555
|
+
if (!WMInvalidDateValues.has(closestValue)) {
|
|
1556
|
+
dimProps[getCorrectWMSDimName(dimension.name)] = closestValue;
|
|
1557
|
+
}
|
|
1556
1558
|
});
|
|
1557
1559
|
return dimProps;
|
|
1558
1560
|
};
|
|
@@ -1849,9 +1851,15 @@ var TimeawareImageSourceWMSLayer = function TimeawareImageSourceWMSLayer(_ref) {
|
|
|
1849
1851
|
}, [layer, visible]);
|
|
1850
1852
|
// Layer styleName properties useEffect
|
|
1851
1853
|
useEffect(function () {
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1854
|
+
if (wmLayer) {
|
|
1855
|
+
var _styles$, _layer$getSource;
|
|
1856
|
+
var styles = wmLayer.getStyles();
|
|
1857
|
+
var style = styleName && styles.some(function (style) {
|
|
1858
|
+
return style.name === styleName;
|
|
1859
|
+
}) ? styleName : ((_styles$ = styles[0]) === null || _styles$ === void 0 ? void 0 : _styles$.name) || '';
|
|
1860
|
+
wmLayer.setStyle(style);
|
|
1861
|
+
layer === null || layer === void 0 || (_layer$getSource = layer.getSource()) === null || _layer$getSource === void 0 || _layer$getSource.setStyle(style);
|
|
1862
|
+
}
|
|
1855
1863
|
}, [layer, styleName, wmLayer]);
|
|
1856
1864
|
// layerName useEffect
|
|
1857
1865
|
useEffect(function () {
|
|
@@ -2022,61 +2030,6 @@ var useProjection = function useProjection() {
|
|
|
2022
2030
|
return projection;
|
|
2023
2031
|
};
|
|
2024
2032
|
|
|
2025
|
-
/* *
|
|
2026
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2027
|
-
* you may not use this file except in compliance with the License.
|
|
2028
|
-
* You may obtain a copy of the License at
|
|
2029
|
-
*
|
|
2030
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2031
|
-
*
|
|
2032
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2033
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2034
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2035
|
-
* See the License for the specific language governing permissions and
|
|
2036
|
-
* limitations under the License.
|
|
2037
|
-
*
|
|
2038
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2039
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2040
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2041
|
-
* */
|
|
2042
|
-
var useSetIntervalWhenVisible = function useSetIntervalWhenVisible(autoUpdate, refetchInterval) {
|
|
2043
|
-
var shouldAutoFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2044
|
-
var intervalIdRef = useRef();
|
|
2045
|
-
var lastRefetched = useRef(new Date().getTime());
|
|
2046
|
-
var refetch = useCallback(function () {
|
|
2047
|
-
if (document.visibilityState === 'visible') {
|
|
2048
|
-
lastRefetched.current = new Date().getTime();
|
|
2049
|
-
if (shouldAutoFetch) {
|
|
2050
|
-
autoUpdate();
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
}, [autoUpdate, shouldAutoFetch]);
|
|
2054
|
-
var refetchIfTimeHasPassed = useCallback(function () {
|
|
2055
|
-
if (document.visibilityState === 'visible' && new Date().getTime() - lastRefetched.current > refetchInterval) {
|
|
2056
|
-
refetch();
|
|
2057
|
-
}
|
|
2058
|
-
}, [refetch, refetchInterval]);
|
|
2059
|
-
// Triggers when document becomes visible
|
|
2060
|
-
useLayoutEffect(function () {
|
|
2061
|
-
var onVisibilityChange = function onVisibilityChange() {
|
|
2062
|
-
refetchIfTimeHasPassed();
|
|
2063
|
-
};
|
|
2064
|
-
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
2065
|
-
return function () {
|
|
2066
|
-
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
2067
|
-
};
|
|
2068
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2069
|
-
}, [refetchInterval, shouldAutoFetch]);
|
|
2070
|
-
// Sets a timer
|
|
2071
|
-
useEffect(function () {
|
|
2072
|
-
intervalIdRef.current = setInterval(refetch, refetchInterval);
|
|
2073
|
-
refetchIfTimeHasPassed();
|
|
2074
|
-
return function () {
|
|
2075
|
-
clearInterval(intervalIdRef.current);
|
|
2076
|
-
};
|
|
2077
|
-
}, [refetch, refetchIfTimeHasPassed, refetchInterval, shouldAutoFetch]);
|
|
2078
|
-
};
|
|
2079
|
-
|
|
2080
2033
|
var WMSLayer = function WMSLayer(_ref) {
|
|
2081
2034
|
var url = _ref.url,
|
|
2082
2035
|
layerName = _ref.layerName,
|
|
@@ -2780,6 +2733,142 @@ var WMTSLayer = function WMTSLayer(_ref) {
|
|
|
2780
2733
|
return null;
|
|
2781
2734
|
};
|
|
2782
2735
|
|
|
2736
|
+
/* *
|
|
2737
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2738
|
+
* you may not use this file except in compliance with the License.
|
|
2739
|
+
* You may obtain a copy of the License at
|
|
2740
|
+
*
|
|
2741
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2742
|
+
*
|
|
2743
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2744
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2745
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2746
|
+
* See the License for the specific language governing permissions and
|
|
2747
|
+
* limitations under the License.
|
|
2748
|
+
*
|
|
2749
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2750
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2751
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2752
|
+
* */
|
|
2753
|
+
var useSetIntervalWhenVisible = function useSetIntervalWhenVisible(autoUpdate, refetchInterval) {
|
|
2754
|
+
var shouldAutoFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2755
|
+
var intervalIdRef = useRef();
|
|
2756
|
+
var lastRefetched = useRef(new Date().getTime());
|
|
2757
|
+
var refetch = useCallback(function () {
|
|
2758
|
+
if (document.visibilityState === 'visible') {
|
|
2759
|
+
lastRefetched.current = new Date().getTime();
|
|
2760
|
+
if (shouldAutoFetch) {
|
|
2761
|
+
autoUpdate();
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
}, [autoUpdate, shouldAutoFetch]);
|
|
2765
|
+
var refetchIfTimeHasPassed = useCallback(function () {
|
|
2766
|
+
if (document.visibilityState === 'visible' && new Date().getTime() - lastRefetched.current > refetchInterval) {
|
|
2767
|
+
refetch();
|
|
2768
|
+
}
|
|
2769
|
+
}, [refetch, refetchInterval]);
|
|
2770
|
+
// Triggers when document becomes visible
|
|
2771
|
+
useLayoutEffect(function () {
|
|
2772
|
+
var onVisibilityChange = function onVisibilityChange() {
|
|
2773
|
+
refetchIfTimeHasPassed();
|
|
2774
|
+
};
|
|
2775
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
2776
|
+
return function () {
|
|
2777
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
2778
|
+
};
|
|
2779
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2780
|
+
}, [refetchInterval, shouldAutoFetch]);
|
|
2781
|
+
// Sets a timer
|
|
2782
|
+
useEffect(function () {
|
|
2783
|
+
intervalIdRef.current = setInterval(refetch, refetchInterval);
|
|
2784
|
+
refetchIfTimeHasPassed();
|
|
2785
|
+
return function () {
|
|
2786
|
+
clearInterval(intervalIdRef.current);
|
|
2787
|
+
};
|
|
2788
|
+
}, [refetch, refetchIfTimeHasPassed, refetchInterval, shouldAutoFetch]);
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
/* *
|
|
2792
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2793
|
+
* you may not use this file except in compliance with the License.
|
|
2794
|
+
* You may obtain a copy of the License at
|
|
2795
|
+
*
|
|
2796
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2797
|
+
*
|
|
2798
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2799
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2800
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2801
|
+
* See the License for the specific language governing permissions and
|
|
2802
|
+
* limitations under the License.
|
|
2803
|
+
*
|
|
2804
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2805
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2806
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2807
|
+
* */
|
|
2808
|
+
var useViewFromLayer = function useViewFromLayer(layerProps) {
|
|
2809
|
+
var baseView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
2810
|
+
projection: 'EPSG:3857',
|
|
2811
|
+
zoom: 1,
|
|
2812
|
+
center: [0, 0]
|
|
2813
|
+
};
|
|
2814
|
+
var viewRef = useRef(new View(baseView));
|
|
2815
|
+
var wmLayer = useGetWMLayerInstance(layerProps.service, layerProps.name, layerProps.id);
|
|
2816
|
+
useEffect(function () {
|
|
2817
|
+
if (!wmLayer) {
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
var layerProjectionForCode = wmLayer.getProjection(viewRef.current.getProjection().getCode());
|
|
2821
|
+
if (!layerProjectionForCode) {
|
|
2822
|
+
return;
|
|
2823
|
+
}
|
|
2824
|
+
viewRef.current.fit(layerProjectionForCode.bbox.getExtent());
|
|
2825
|
+
}, [wmLayer]);
|
|
2826
|
+
return viewRef.current;
|
|
2827
|
+
};
|
|
2828
|
+
|
|
2829
|
+
var useAnimationForLayer = function useAnimationForLayer(layerProps, intervalInMs) {
|
|
2830
|
+
var numStepsTillLatest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 48;
|
|
2831
|
+
var checkForUpdatesMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
|
|
2832
|
+
var animationStep = useRef(0);
|
|
2833
|
+
var _React$useState = React__default.useState(''),
|
|
2834
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2835
|
+
timeValue = _React$useState2[0],
|
|
2836
|
+
setTimeValue = _React$useState2[1];
|
|
2837
|
+
var wmLayer = useGetWMLayerInstance(layerProps.service, layerProps.name, layerProps.id);
|
|
2838
|
+
var trigger = React__default.useCallback(function () {
|
|
2839
|
+
animationStep.current += 1;
|
|
2840
|
+
if (animationStep.current >= numStepsTillLatest) {
|
|
2841
|
+
animationStep.current = 0;
|
|
2842
|
+
}
|
|
2843
|
+
if (wmLayer) {
|
|
2844
|
+
var timeDim = wmLayer.getDimension('time');
|
|
2845
|
+
if (timeDim) {
|
|
2846
|
+
var numTimeSteps = timeDim.size();
|
|
2847
|
+
var timeString = timeDim.getValueForIndex(animationStep.current + numTimeSteps - numStepsTillLatest);
|
|
2848
|
+
setTimeValue(timeString);
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}, [numStepsTillLatest, wmLayer]);
|
|
2852
|
+
useSetIntervalWhenVisible(trigger, intervalInMs);
|
|
2853
|
+
var refetchLayer = React__default.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2854
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2855
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2856
|
+
case 0:
|
|
2857
|
+
_context.next = 2;
|
|
2858
|
+
return wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.parseLayer(true);
|
|
2859
|
+
case 2:
|
|
2860
|
+
case "end":
|
|
2861
|
+
return _context.stop();
|
|
2862
|
+
}
|
|
2863
|
+
}, _callee);
|
|
2864
|
+
})), [wmLayer]);
|
|
2865
|
+
useSetIntervalWhenVisible(refetchLayer, checkForUpdatesMs);
|
|
2866
|
+
return [{
|
|
2867
|
+
name: 'time',
|
|
2868
|
+
currentValue: timeValue
|
|
2869
|
+
}];
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2783
2872
|
var TiledWMSLayer = function TiledWMSLayer(_ref) {
|
|
2784
2873
|
var url = _ref.url,
|
|
2785
2874
|
layerName = _ref.layerName,
|
|
@@ -11400,6 +11489,8 @@ var MapFeatureClass;
|
|
|
11400
11489
|
MapFeatureClass["MyLocation"] = "MyLocation";
|
|
11401
11490
|
MapFeatureClass["GenericMarker"] = "GenericMarker";
|
|
11402
11491
|
MapFeatureClass["ObservationStation"] = "ObservationStation";
|
|
11492
|
+
MapFeatureClass["EDRFeature"] = "EDRFeature";
|
|
11493
|
+
MapFeatureClass["EDRMultiPolygon"] = "EDRMultiPolygon";
|
|
11403
11494
|
MapFeatureClass["default"] = "default";
|
|
11404
11495
|
})(MapFeatureClass || (MapFeatureClass = {}));
|
|
11405
11496
|
var FEATURE_FILL = new Fill({
|
|
@@ -11508,34 +11599,65 @@ new Style$1({
|
|
|
11508
11599
|
})
|
|
11509
11600
|
})
|
|
11510
11601
|
})];
|
|
11511
|
-
var
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
}),
|
|
11523
|
-
backgroundStroke: new Stroke({
|
|
11524
|
-
color: '#111',
|
|
11525
|
-
width: 4,
|
|
11526
|
-
lineCap: 'round',
|
|
11527
|
-
lineJoin: 'round'
|
|
11528
|
-
}),
|
|
11529
|
-
offsetY: 40
|
|
11602
|
+
var FEATURE_EDR = [new Style$1({
|
|
11603
|
+
fill: FEATURE_FILL,
|
|
11604
|
+
stroke: FEATURE_STROKE
|
|
11605
|
+
})];
|
|
11606
|
+
var FEATURE_EDR_HOVER = [new Style$1({
|
|
11607
|
+
fill: new Fill({
|
|
11608
|
+
color: '#e14'
|
|
11609
|
+
}),
|
|
11610
|
+
stroke: new Stroke({
|
|
11611
|
+
color: '#e14',
|
|
11612
|
+
width: 1.5
|
|
11530
11613
|
})
|
|
11614
|
+
})];
|
|
11615
|
+
var labelOptions = {
|
|
11616
|
+
font: '16px Roboto',
|
|
11617
|
+
padding: [8, 8, 8, 8],
|
|
11618
|
+
fill: new Fill({
|
|
11619
|
+
color: '#eee'
|
|
11620
|
+
}),
|
|
11621
|
+
text: '-',
|
|
11622
|
+
// f.getProperties().name,
|
|
11623
|
+
backgroundFill: new Fill({
|
|
11624
|
+
color: '#111'
|
|
11625
|
+
}),
|
|
11626
|
+
backgroundStroke: new Stroke({
|
|
11627
|
+
color: '#111',
|
|
11628
|
+
width: 4,
|
|
11629
|
+
lineCap: 'round',
|
|
11630
|
+
lineJoin: 'round'
|
|
11631
|
+
}),
|
|
11632
|
+
offsetY: 40,
|
|
11633
|
+
overflow: true
|
|
11634
|
+
};
|
|
11635
|
+
var labelBaseStyle = new Style$1({
|
|
11636
|
+
text: new Text(labelOptions)
|
|
11637
|
+
});
|
|
11638
|
+
// Multi-polygons need separate handling to only draw single label
|
|
11639
|
+
var multiPolygonLabelBaseStyle = new Style$1({
|
|
11640
|
+
text: new Text(labelOptions),
|
|
11641
|
+
geometry: function geometry(feature) {
|
|
11642
|
+
var polygons = feature.getGeometry().getPolygons();
|
|
11643
|
+
var largestPolygon = polygons.reduce(function (prev, curr) {
|
|
11644
|
+
return prev.getArea() > curr.getArea() ? prev : curr;
|
|
11645
|
+
});
|
|
11646
|
+
return largestPolygon.getInteriorPoint();
|
|
11647
|
+
}
|
|
11531
11648
|
});
|
|
11532
|
-
var
|
|
11649
|
+
var textLabelStyle = function textLabelStyle(text) {
|
|
11533
11650
|
var _labelBaseStyle$getTe;
|
|
11534
11651
|
(_labelBaseStyle$getTe = labelBaseStyle.getText()) === null || _labelBaseStyle$getTe === void 0 || _labelBaseStyle$getTe.setText(text);
|
|
11535
11652
|
return labelBaseStyle;
|
|
11536
11653
|
};
|
|
11537
|
-
var
|
|
11538
|
-
|
|
11654
|
+
var multiPolygonLabelStyle = function multiPolygonLabelStyle(text) {
|
|
11655
|
+
var _multiPolygonLabelBas;
|
|
11656
|
+
(_multiPolygonLabelBas = multiPolygonLabelBaseStyle.getText()) === null || _multiPolygonLabelBas === void 0 || _multiPolygonLabelBas.setText(text);
|
|
11657
|
+
return multiPolygonLabelBaseStyle;
|
|
11658
|
+
};
|
|
11659
|
+
var stylesByMapFeatureClass = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, MapFeatureClass.GenericMarker, function (f) {
|
|
11660
|
+
return !f.get('hover') ? ICON_LOCATIONMARKER : [ICON_LOCATIONMARKER, textLabelStyle(f.getProperties().name)];
|
|
11539
11661
|
}), MapFeatureClass.MyLocation, [
|
|
11540
11662
|
// Outer circle
|
|
11541
11663
|
new Style$1({
|
|
@@ -11559,7 +11681,11 @@ new Style$1({
|
|
|
11559
11681
|
})
|
|
11560
11682
|
})
|
|
11561
11683
|
})]), MapFeatureClass.ObservationStation, function (f) {
|
|
11562
|
-
return !f.get('hover') ? FEATURE_OBSERVATIONSTATION : [].concat(FEATURE_OBSERVATIONSTATION_HOVER, [
|
|
11684
|
+
return !f.get('hover') ? FEATURE_OBSERVATIONSTATION : [].concat(FEATURE_OBSERVATIONSTATION_HOVER, [textLabelStyle(f.getProperties().name)]);
|
|
11685
|
+
}), MapFeatureClass.EDRFeature, function (f) {
|
|
11686
|
+
return !f.get('hover') ? FEATURE_EDR : [].concat(FEATURE_EDR_HOVER, [textLabelStyle(f.getProperties().name)]);
|
|
11687
|
+
}), MapFeatureClass.EDRMultiPolygon, function (f) {
|
|
11688
|
+
return !f.get('hover') ? FEATURE_EDR : [].concat(FEATURE_EDR_HOVER, [multiPolygonLabelStyle(f.getProperties().name)]);
|
|
11563
11689
|
}), MapFeatureClass["default"], [
|
|
11564
11690
|
// Polygon / LineString
|
|
11565
11691
|
new Style$1({
|
|
@@ -11933,6 +12059,40 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
11933
12059
|
return null;
|
|
11934
12060
|
};
|
|
11935
12061
|
|
|
12062
|
+
var ClickOnMapTool = function ClickOnMapTool(_ref) {
|
|
12063
|
+
var isActive = _ref.isActive,
|
|
12064
|
+
isVisible = _ref.isVisible,
|
|
12065
|
+
pointStyle = _ref.pointStyle,
|
|
12066
|
+
_ref$layerZIndex = _ref.layerZIndex,
|
|
12067
|
+
layerZIndex = _ref$layerZIndex === void 0 ? 999999 : _ref$layerZIndex,
|
|
12068
|
+
pointSelected = _ref.pointSelected;
|
|
12069
|
+
var _useContext = useContext(MapContext),
|
|
12070
|
+
map = _useContext.map;
|
|
12071
|
+
var _useState = useState([]),
|
|
12072
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12073
|
+
features = _useState2[0],
|
|
12074
|
+
setFeatures = _useState2[1];
|
|
12075
|
+
useEffect(function () {
|
|
12076
|
+
if (!map || !isActive) {
|
|
12077
|
+
return function () {};
|
|
12078
|
+
}
|
|
12079
|
+
var clickHandler = function clickHandler(event) {
|
|
12080
|
+
var coords = event.coordinate;
|
|
12081
|
+
setFeatures([new Feature(new Point(coords))]);
|
|
12082
|
+
pointSelected(coords);
|
|
12083
|
+
};
|
|
12084
|
+
map.addEventListener('click', clickHandler);
|
|
12085
|
+
return function () {
|
|
12086
|
+
map.removeEventListener('click', clickHandler);
|
|
12087
|
+
};
|
|
12088
|
+
}, [map, isActive, pointSelected]);
|
|
12089
|
+
return jsx(FeatureLayer, {
|
|
12090
|
+
features: features,
|
|
12091
|
+
style: isVisible ? pointStyle : [],
|
|
12092
|
+
zIndex: layerZIndex
|
|
12093
|
+
});
|
|
12094
|
+
};
|
|
12095
|
+
|
|
11936
12096
|
/* *
|
|
11937
12097
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11938
12098
|
* you may not use this file except in compliance with the License.
|
|
@@ -11961,4 +12121,4 @@ var isOpenLayersEnabled = function isOpenLayersEnabled() {
|
|
|
11961
12121
|
return _useOpenLayers;
|
|
11962
12122
|
};
|
|
11963
12123
|
|
|
11964
|
-
export { DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FEATURE_FILL, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayers, GeoJSONTextField, ICON_LOCATIONMARKER, ICON_LOCATIONMARKER_MODIFY, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MINUTE_TO_MILLISECOND, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapFeatureClass, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, Proj4js, radarGetCapabilities_spec as RadarGetCapabilities, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, TimeContext, TimeawareImageSource, WEBMAP_REACT_NAMESPACE, WMSLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, addWMLayerPropsBasedOnChildProps, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, convertGeoCoordsToScreenCoords, createIconStyle, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, distance, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, findClosestCoords, firSelectionType, formatTime, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getCurrentDimensionValue, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFeatureExtent, getFeatureLayers, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getPixelCoordFromGeoCoord, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isAGeoJSONLayer, isAMapLayer, isBetween, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isOpenLayersEnabled, isPointFeatureCollection, lineString, lineStringCollection, makeLayerPropListFromChildren, makeView, marksByDimension, modifyStyles, moveFeature, opacityOptions, openLayersGetMapImageStore, orderLayers, parseWMJSLayer, projectorCache, publicLayers, publicServices, registerDrawFunction, removeWMLayerFromMap, rewindGeometry, selectPreferredWMSProjection, setMapCenter, setOpenLayersEnabled, setViewFromExtent, setViewFromFeature, setWMLayerPropsBasedOnChildProps, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions,
|
|
12124
|
+
export { ClickOnMapTool, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FEATURE_FILL, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayers, GeoJSONTextField, ICON_LOCATIONMARKER, ICON_LOCATIONMARKER_MODIFY, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MINUTE_TO_MILLISECOND, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapFeatureClass, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, Proj4js, radarGetCapabilities_spec as RadarGetCapabilities, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, TimeContext, TimeawareImageSource, WEBMAP_REACT_NAMESPACE, WMSLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, addWMLayerPropsBasedOnChildProps, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, convertGeoCoordsToScreenCoords, createIconStyle, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, distance, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, findClosestCoords, firSelectionType, formatTime, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getCurrentDimensionValue, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFeatureExtent, getFeatureLayers, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getPixelCoordFromGeoCoord, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isAGeoJSONLayer, isAMapLayer, isBetween, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isOpenLayersEnabled, isPointFeatureCollection, lineString, lineStringCollection, makeLayerPropListFromChildren, makeView, marksByDimension, modifyStyles, moveFeature, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, orderLayers, parseWMJSLayer, projectorCache, publicLayers, publicServices, registerDrawFunction, removeWMLayerFromMap, rewindGeometry, selectPreferredWMSProjection, setMapCenter, setOpenLayersEnabled, setViewFromExtent, setViewFromFeature, setWMLayerPropsBasedOnChildProps, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useViewFromLayer, viewUtils, webmapReactTranslations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap-react",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "GeoWeb react wrapper for webmap",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,34 +8,25 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@
|
|
12
|
-
"@emotion/styled": "11.14.0",
|
|
13
|
-
"@mui/material": "^6.1.1",
|
|
14
|
-
"@mui/system": "6.4.6",
|
|
15
|
-
"@mui/x-date-pickers": "7.27.1",
|
|
16
|
-
"@reduxjs/toolkit": "1.9.7",
|
|
17
|
-
"@sentry/react": "8.54.0",
|
|
18
|
-
"@storybook/react": "8.4.2",
|
|
19
|
-
"@tanstack/query-core": "5.67.1",
|
|
20
|
-
"@tanstack/react-query": "^5.62.7",
|
|
21
|
-
"@testing-library/react": "16.0.1",
|
|
22
|
-
"@testing-library/user-event": "14.5.2",
|
|
23
|
-
"@turf/turf": "^7.1.0",
|
|
11
|
+
"@opengeoweb/webmap": "12.1.0",
|
|
24
12
|
"axios": "^1.7.7",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"i18next": "^23.11.5",
|
|
28
|
-
"immer": "^10.0.3",
|
|
29
|
-
"jest-canvas-mock": "2.5.2",
|
|
30
|
-
"jest-date-mock": "1.0.10",
|
|
13
|
+
"@opengeoweb/theme": "12.1.0",
|
|
14
|
+
"@opengeoweb/shared": "12.1.0",
|
|
31
15
|
"lodash": "^4.17.21",
|
|
32
16
|
"ol": "^10.4.0",
|
|
33
17
|
"proj4": "^2.9.2",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"react-
|
|
18
|
+
"@turf/turf": "^7.1.0",
|
|
19
|
+
"immer": "^10.0.3",
|
|
20
|
+
"react-resize-detector": "^9.1.0",
|
|
21
|
+
"i18next": "^23.11.5",
|
|
22
|
+
"@mui/material": "^6.1.1",
|
|
37
23
|
"react-i18next": "^15.1.1",
|
|
38
|
-
"react-
|
|
24
|
+
"@tanstack/react-query": "^5.62.7"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": "18",
|
|
28
|
+
"@emotion/react": "*",
|
|
29
|
+
"@emotion/styled": "*"
|
|
39
30
|
},
|
|
40
31
|
"module": "./index.esm.js",
|
|
41
32
|
"type": "module",
|
|
@@ -6,6 +6,8 @@ export declare enum MapFeatureClass {
|
|
|
6
6
|
MyLocation = "MyLocation",
|
|
7
7
|
GenericMarker = "GenericMarker",
|
|
8
8
|
ObservationStation = "ObservationStation",
|
|
9
|
+
EDRFeature = "EDRFeature",
|
|
10
|
+
EDRMultiPolygon = "EDRMultiPolygon",
|
|
9
11
|
default = "default"
|
|
10
12
|
}
|
|
11
13
|
export declare const FEATURE_FILL: Fill;
|
|
@@ -16,7 +18,8 @@ export declare const FEATURE_VERTICE_HANDLE_IMAGE: Circle;
|
|
|
16
18
|
export declare const ICON_LOCATIONMARKER: Style;
|
|
17
19
|
export declare const ICON_LOCATIONMARKER_MODIFY: Style;
|
|
18
20
|
export declare const FEATURE_VERTICES_EDIT_HANDLES: Style;
|
|
19
|
-
export declare const
|
|
21
|
+
export declare const textLabelStyle: (text: string) => Style;
|
|
22
|
+
export declare const multiPolygonLabelStyle: (text: string) => Style;
|
|
20
23
|
export declare const geowebColorToOpenLayersColor: (color: string, opacity?: string | number) => ColorLike;
|
|
21
24
|
export declare const inlineFeatureStyle: StyleFunction;
|
|
22
25
|
export declare const genericOpenLayersFeatureStyle: StyleFunction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ClickOnMapTool } from './ClickOnMapTool';
|
package/src/lib/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Dimension } from '@opengeoweb/webmap';
|
|
2
|
-
import { OpenLayersLayerProps } from '../components/OpenLayers/layers';
|
|
2
|
+
import type { OpenLayersLayerProps } from '../components/OpenLayers/layers';
|
|
3
3
|
export declare const useAnimationForLayer: (layerProps: OpenLayersLayerProps, intervalInMs: number, numStepsTillLatest?: number, checkForUpdatesMs?: number) => Dimension[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { View } from 'ol';
|
|
2
|
-
import { OpenLayersLayerProps } from '../components/OpenLayers/layers';
|
|
2
|
+
import type { OpenLayersLayerProps } from '../components/OpenLayers/layers';
|
|
3
3
|
export declare const useViewFromLayer: (layerProps: OpenLayersLayerProps, baseView?: {
|
|
4
4
|
projection: string;
|
|
5
5
|
zoom: number;
|