@opengeoweb/webmap-react 15.1.0 → 15.2.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 +116 -48
- package/package.json +4 -4
- package/src/lib/components/Clock/Clock.d.ts +14 -0
- package/src/lib/components/LayerInfo/LayerInfoDialog.d.ts +1 -0
- package/src/lib/components/LayerInfo/LayerInfoLegend.d.ts +1 -1
- package/src/lib/components/OpenLayers/draw/OpenLayersMapDraw.d.ts +4 -0
package/index.esm.js
CHANGED
|
@@ -11419,7 +11419,7 @@ var getDimensionsList = function getDimensionsList(dimensions) {
|
|
|
11419
11419
|
};
|
|
11420
11420
|
|
|
11421
11421
|
var LayerInfoDialog = function LayerInfoDialog(_ref) {
|
|
11422
|
-
var _layer$
|
|
11422
|
+
var _layer$styles, _layer$styles2, _layer$path, _layer$keywords;
|
|
11423
11423
|
var onClose = _ref.onClose,
|
|
11424
11424
|
layer = _ref.layer,
|
|
11425
11425
|
serviceName = _ref.serviceName,
|
|
@@ -11436,12 +11436,18 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
|
|
|
11436
11436
|
startPosition = _ref$startPosition === void 0 ? {
|
|
11437
11437
|
top: 150,
|
|
11438
11438
|
left: 900
|
|
11439
|
-
} : _ref$startPosition
|
|
11439
|
+
} : _ref$startPosition,
|
|
11440
|
+
selectedStyle = _ref.selectedStyle;
|
|
11440
11441
|
var styles = getLayerStyles(layer);
|
|
11441
11442
|
var dimensions = getDimensionsList(layer.dimensions);
|
|
11442
11443
|
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
11443
11444
|
t = _useWebmapReactTransl.t;
|
|
11444
11445
|
var bbox = getLayerBbox(t, layer);
|
|
11446
|
+
var legendURL = ((_layer$styles = layer.styles) === null || _layer$styles === void 0 || (_layer$styles = _layer$styles.find(function (styleItem) {
|
|
11447
|
+
return styleItem.name === selectedStyle;
|
|
11448
|
+
})) === null || _layer$styles === void 0 ? void 0 : _layer$styles.legendURL) || ((_layer$styles2 = layer.styles) === null || _layer$styles2 === void 0 ? void 0 : _layer$styles2[0].legendURL) ||
|
|
11449
|
+
// show first style if none selected
|
|
11450
|
+
undefined;
|
|
11445
11451
|
return jsx(ToolContainerDraggable, {
|
|
11446
11452
|
isOpen: isOpen,
|
|
11447
11453
|
onClose: onClose,
|
|
@@ -11490,7 +11496,7 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
|
|
|
11490
11496
|
value: ((_layer$keywords = layer.keywords) === null || _layer$keywords === void 0 ? void 0 : _layer$keywords.join(', ')) || '-'
|
|
11491
11497
|
}), jsx(LayerInfoLegend, {
|
|
11492
11498
|
dimensions: layer.dimensions,
|
|
11493
|
-
legendURL:
|
|
11499
|
+
legendURL: legendURL,
|
|
11494
11500
|
name: layer.name,
|
|
11495
11501
|
title: layer.title
|
|
11496
11502
|
})]
|
|
@@ -12047,12 +12053,13 @@ var addFeatureProperties = function addFeatureProperties(geojson, featurePropert
|
|
|
12047
12053
|
* @returns Whether `feature` is empty or not
|
|
12048
12054
|
*/
|
|
12049
12055
|
var isGeoJSONGeometryEmpty = function isGeoJSONGeometryEmpty(feature) {
|
|
12050
|
-
|
|
12056
|
+
var _feature$geometry$coo, _feature$geometry$coo2, _feature$geometry$coo3;
|
|
12057
|
+
return feature.geometry && (feature.geometry.type === 'Polygon' && ((_feature$geometry$coo = feature.geometry.coordinates) === null || _feature$geometry$coo === void 0 ? void 0 : _feature$geometry$coo.length) === 1 && feature.geometry.coordinates[0].length === 0 || feature.geometry.type === 'LineString' && ((_feature$geometry$coo2 = feature.geometry.coordinates) === null || _feature$geometry$coo2 === void 0 ? void 0 : _feature$geometry$coo2.length) === 0 || feature.geometry.type === 'Point' && ((_feature$geometry$coo3 = feature.geometry.coordinates) === null || _feature$geometry$coo3 === void 0 ? void 0 : _feature$geometry$coo3.length) === 0);
|
|
12051
12058
|
};
|
|
12052
12059
|
var getGeoJSONPropertyValue = function getGeoJSONPropertyValue(property, properties, polygonDrawMode) {
|
|
12053
12060
|
var defaultProperties = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultGeoJSONStyleProperties;
|
|
12054
12061
|
// if a shape is set, extract the style from there
|
|
12055
|
-
if (properties
|
|
12062
|
+
if ((properties === null || properties === void 0 ? void 0 : properties[property]) !== undefined) {
|
|
12056
12063
|
return properties[property];
|
|
12057
12064
|
}
|
|
12058
12065
|
// if active polygon tool is preset, retreive style from there
|
|
@@ -12107,7 +12114,7 @@ var moveFeature = function moveFeature(currentGeoJSON, newGeoJSON, featureLayerI
|
|
|
12107
12114
|
newGeoJSON.features.push(_copyFeature);
|
|
12108
12115
|
return newGeoJSON.features.length - 1;
|
|
12109
12116
|
}
|
|
12110
|
-
if (geometry.type === 'Point' && currentFeature
|
|
12117
|
+
if (geometry.type === 'Point' && (currentFeature === null || currentFeature === void 0 ? void 0 : currentFeature.geometry.type) === 'Point' && currentFeature.geometry.coordinates.length > 0 && reason === NEW_POINT_CREATED) {
|
|
12111
12118
|
var _copyFeature2 = _objectSpread2(_objectSpread2({}, currentFeature), selectionType && {
|
|
12112
12119
|
properties: _objectSpread2(_objectSpread2({}, feature.properties), {}, {
|
|
12113
12120
|
selectionType: selectionType
|
|
@@ -13738,7 +13745,7 @@ var FeatureLayer = function FeatureLayer(_ref) {
|
|
|
13738
13745
|
var previousHover = [];
|
|
13739
13746
|
var pointerMoveFunction = debounce(function (evt) {
|
|
13740
13747
|
var hoveredFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
|
|
13741
|
-
if (!layer || layer.getSource() !== source) {
|
|
13748
|
+
if (!layer || (layer === null || layer === void 0 ? void 0 : layer.getSource()) !== source) {
|
|
13742
13749
|
return false;
|
|
13743
13750
|
}
|
|
13744
13751
|
return feature;
|
|
@@ -15422,11 +15429,11 @@ var FEATURE_VERTICES_EDIT_HANDLES = new Style$1({
|
|
|
15422
15429
|
image: FEATURE_VERTICE_IMAGE,
|
|
15423
15430
|
geometry: function geometry(feature) {
|
|
15424
15431
|
var geom = feature === null || feature === void 0 ? void 0 : feature.getGeometry();
|
|
15425
|
-
if (geom
|
|
15432
|
+
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) === 'Polygon') {
|
|
15426
15433
|
var coordinates = geom.getCoordinates()[0];
|
|
15427
15434
|
return new MultiPoint(coordinates);
|
|
15428
15435
|
}
|
|
15429
|
-
if (geom
|
|
15436
|
+
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) === 'LineString') {
|
|
15430
15437
|
var _coordinates = geom.getCoordinates();
|
|
15431
15438
|
return new MultiPoint(_coordinates);
|
|
15432
15439
|
}
|
|
@@ -15937,7 +15944,7 @@ var drawPolygonLikeFeatureStyle = function drawPolygonLikeFeatureStyle(feature)
|
|
|
15937
15944
|
image: FEATURE_VERTICE_IMAGE,
|
|
15938
15945
|
geometry: function geometry(feature) {
|
|
15939
15946
|
var geom = feature === null || feature === void 0 ? void 0 : feature.getGeometry();
|
|
15940
|
-
if (geom
|
|
15947
|
+
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) === 'LineString') {
|
|
15941
15948
|
var coordinates = geom.getCoordinates();
|
|
15942
15949
|
return new MultiPoint(coordinates);
|
|
15943
15950
|
}
|
|
@@ -16190,7 +16197,7 @@ var createBoxBasedOnModifiedVertex = function createBoxBasedOnModifiedVertex(mod
|
|
|
16190
16197
|
var getBoxRotateHandlePoints = function getBoxRotateHandlePoints(feature, resolution) {
|
|
16191
16198
|
var originalGeometry = feature === null || feature === void 0 ? void 0 : feature.get('originalGeometry');
|
|
16192
16199
|
var geom = originalGeometry ? createBoxBasedOnModifiedVertex(feature.getGeometry(), originalGeometry, feature.get('selectionType') === 'square') : feature === null || feature === void 0 ? void 0 : feature.getGeometry();
|
|
16193
|
-
if (!geom || geom.getType() !== 'Polygon') {
|
|
16200
|
+
if (!geom || (geom === null || geom === void 0 ? void 0 : geom.getType()) !== 'Polygon') {
|
|
16194
16201
|
return undefined;
|
|
16195
16202
|
}
|
|
16196
16203
|
var ring = geom.getCoordinates()[0];
|
|
@@ -16503,7 +16510,9 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16503
16510
|
geojson = _ref.geojson,
|
|
16504
16511
|
selectedFeatureIndex = _ref.selectedFeatureIndex,
|
|
16505
16512
|
exitDrawModeCallback = _ref.exitDrawModeCallback,
|
|
16506
|
-
updateGeojson = _ref.updateGeojson
|
|
16513
|
+
updateGeojson = _ref.updateGeojson,
|
|
16514
|
+
onViewOnlyFeatureClick = _ref.onViewOnlyFeatureClick,
|
|
16515
|
+
onNoFeatureClick = _ref.onNoFeatureClick;
|
|
16507
16516
|
var _React$useContext = React.useContext(MapContext),
|
|
16508
16517
|
map = _React$useContext.map;
|
|
16509
16518
|
var projection = useProjection();
|
|
@@ -16532,7 +16541,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16532
16541
|
style: viewOnlyStyle,
|
|
16533
16542
|
zIndex: 1000000 - 1
|
|
16534
16543
|
});
|
|
16535
|
-
var editFeatureCollection = new Collection([allFeatures[selectedFeatureIndex]]);
|
|
16544
|
+
var editFeatureCollection = new Collection(allFeatures[selectedFeatureIndex] ? [allFeatures[selectedFeatureIndex]] : []);
|
|
16536
16545
|
var source = new VectorSource({
|
|
16537
16546
|
features: editFeatureCollection
|
|
16538
16547
|
});
|
|
@@ -16546,6 +16555,26 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16546
16555
|
map.addLayer(layer);
|
|
16547
16556
|
map.addLayer(viewOnlyLayer);
|
|
16548
16557
|
var interactions = [];
|
|
16558
|
+
var handleSingleClick = (onViewOnlyFeatureClick || onNoFeatureClick) && function (event) {
|
|
16559
|
+
var features = [];
|
|
16560
|
+
map.forEachFeatureAtPixel(event.pixel, function (featureAtPixel, layerAtPixel) {
|
|
16561
|
+
if (layerAtPixel === viewOnlyLayer || layerAtPixel === layer) {
|
|
16562
|
+
features.push(featureAtPixel);
|
|
16563
|
+
}
|
|
16564
|
+
}, {
|
|
16565
|
+
layerFilter: function layerFilter(layerAtPixel) {
|
|
16566
|
+
return layerAtPixel === viewOnlyLayer || layerAtPixel === layer;
|
|
16567
|
+
}
|
|
16568
|
+
});
|
|
16569
|
+
if (features.length) {
|
|
16570
|
+
onViewOnlyFeatureClick === null || onViewOnlyFeatureClick === void 0 || onViewOnlyFeatureClick(features);
|
|
16571
|
+
} else {
|
|
16572
|
+
onNoFeatureClick === null || onNoFeatureClick === void 0 || onNoFeatureClick();
|
|
16573
|
+
}
|
|
16574
|
+
};
|
|
16575
|
+
if (handleSingleClick) {
|
|
16576
|
+
map.on('singleclick', handleSingleClick);
|
|
16577
|
+
}
|
|
16549
16578
|
var updateFeature = function updateFeature(feature) {
|
|
16550
16579
|
var _feature$getGeometry;
|
|
16551
16580
|
// Convert Circle to Polygon for GeoJSON serialization
|
|
@@ -16624,6 +16653,20 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16624
16653
|
var lastPointerEvent = null;
|
|
16625
16654
|
var trackPointerMove = function trackPointerMove(event) {
|
|
16626
16655
|
lastPointerEvent = event;
|
|
16656
|
+
if (onViewOnlyFeatureClick) {
|
|
16657
|
+
var pixel = map.getEventPixel(event);
|
|
16658
|
+
var hasViewOnlyHit = false;
|
|
16659
|
+
map.forEachFeatureAtPixel(pixel, function (_featureAtPixel, layerAtPixel) {
|
|
16660
|
+
if (layerAtPixel === viewOnlyLayer) {
|
|
16661
|
+
hasViewOnlyHit = true;
|
|
16662
|
+
}
|
|
16663
|
+
}, {
|
|
16664
|
+
layerFilter: function layerFilter(layerAtPixel) {
|
|
16665
|
+
return layerAtPixel === viewOnlyLayer;
|
|
16666
|
+
}
|
|
16667
|
+
});
|
|
16668
|
+
map.getViewport().style.cursor = hasViewOnlyHit ? 'pointer' : '';
|
|
16669
|
+
}
|
|
16627
16670
|
// Update which rotate handle is "active" so only that
|
|
16628
16671
|
// icon is rendered near the mouse when editing boxes/squares.
|
|
16629
16672
|
// While rotating, keep the originally clicked handle active.
|
|
@@ -16698,7 +16741,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16698
16741
|
feature.set('suppressRotateHandle', true, true);
|
|
16699
16742
|
feature.set('originalGeometry', (_feature$getGeometry2 = feature.getGeometry()) === null || _feature$getGeometry2 === void 0 ? void 0 : _feature$getGeometry2.clone(), true);
|
|
16700
16743
|
var viewport = map.getViewport();
|
|
16701
|
-
if (viewport && viewport.style) {
|
|
16744
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16702
16745
|
viewport.style.cursor = 'grabbing';
|
|
16703
16746
|
}
|
|
16704
16747
|
});
|
|
@@ -16709,7 +16752,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16709
16752
|
// Re-enable rotate handle visibility after modifying.
|
|
16710
16753
|
feature.unset('suppressRotateHandle', true);
|
|
16711
16754
|
var viewport = map.getViewport();
|
|
16712
|
-
if (viewport && viewport.style) {
|
|
16755
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16713
16756
|
viewport.style.cursor = '';
|
|
16714
16757
|
}
|
|
16715
16758
|
updateFeature(feature);
|
|
@@ -16717,13 +16760,13 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16717
16760
|
} else {
|
|
16718
16761
|
modify.on('modifystart', function () {
|
|
16719
16762
|
var viewport = map.getViewport();
|
|
16720
|
-
if (viewport && viewport.style) {
|
|
16763
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16721
16764
|
viewport.style.cursor = 'grabbing';
|
|
16722
16765
|
}
|
|
16723
16766
|
});
|
|
16724
16767
|
modify.on('modifyend', function (evt) {
|
|
16725
16768
|
var viewport = map.getViewport();
|
|
16726
|
-
if (viewport && viewport.style) {
|
|
16769
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16727
16770
|
viewport.style.cursor = '';
|
|
16728
16771
|
}
|
|
16729
16772
|
updateFeature(evt.features.getArray()[0]);
|
|
@@ -16750,7 +16793,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16750
16793
|
}
|
|
16751
16794
|
var feature = editFeatureCollection.item(0);
|
|
16752
16795
|
var geom = feature === null || feature === void 0 ? void 0 : feature.getGeometry();
|
|
16753
|
-
if (!geom || geom.getType() !== 'Polygon') {
|
|
16796
|
+
if (!geom || (geom === null || geom === void 0 ? void 0 : geom.getType()) !== 'Polygon') {
|
|
16754
16797
|
return;
|
|
16755
16798
|
}
|
|
16756
16799
|
var polygon = geom;
|
|
@@ -16778,7 +16821,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16778
16821
|
});
|
|
16779
16822
|
if (closestDist <= threshold) {
|
|
16780
16823
|
var viewport = map.getViewport();
|
|
16781
|
-
if (viewport && viewport.style) {
|
|
16824
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16782
16825
|
viewport.style.cursor = 'grabbing';
|
|
16783
16826
|
}
|
|
16784
16827
|
isPointerDownNearCorner = true;
|
|
@@ -16789,7 +16832,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16789
16832
|
return;
|
|
16790
16833
|
}
|
|
16791
16834
|
var viewport = map.getViewport();
|
|
16792
|
-
if (viewport && viewport.style) {
|
|
16835
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16793
16836
|
viewport.style.cursor = '';
|
|
16794
16837
|
}
|
|
16795
16838
|
isPointerDownNearCorner = false;
|
|
@@ -16800,7 +16843,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16800
16843
|
}
|
|
16801
16844
|
var featureToRotate = editFeatureCollection.item(0);
|
|
16802
16845
|
var geom = featureToRotate === null || featureToRotate === void 0 ? void 0 : featureToRotate.getGeometry();
|
|
16803
|
-
if (!geom || geom.getType() !== 'Polygon') {
|
|
16846
|
+
if (!geom || (geom === null || geom === void 0 ? void 0 : geom.getType()) !== 'Polygon') {
|
|
16804
16847
|
return;
|
|
16805
16848
|
}
|
|
16806
16849
|
var polygon = geom;
|
|
@@ -16890,7 +16933,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16890
16933
|
});
|
|
16891
16934
|
// While rotating, show a grabbing cursor on the map viewport
|
|
16892
16935
|
var viewport = map.getViewport();
|
|
16893
|
-
if (viewport && viewport.style) {
|
|
16936
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16894
16937
|
viewport.style.cursor = 'grabbing';
|
|
16895
16938
|
}
|
|
16896
16939
|
// While rotating, disable modify/translate to avoid conflicts
|
|
@@ -16904,7 +16947,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16904
16947
|
}
|
|
16905
16948
|
var featureToRotate = editFeatureCollection.item(0);
|
|
16906
16949
|
var geom = featureToRotate === null || featureToRotate === void 0 ? void 0 : featureToRotate.getGeometry();
|
|
16907
|
-
if (!geom || geom.getType() !== 'Polygon') {
|
|
16950
|
+
if (!geom || (geom === null || geom === void 0 ? void 0 : geom.getType()) !== 'Polygon') {
|
|
16908
16951
|
return;
|
|
16909
16952
|
}
|
|
16910
16953
|
var polygon = geom;
|
|
@@ -16952,7 +16995,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
16952
16995
|
disabledDragPans = [];
|
|
16953
16996
|
// Restore the default cursor when rotation stops
|
|
16954
16997
|
var viewport = map.getViewport();
|
|
16955
|
-
if (viewport && viewport.style) {
|
|
16998
|
+
if (viewport !== null && viewport !== void 0 && viewport.style) {
|
|
16956
16999
|
viewport.style.cursor = '';
|
|
16957
17000
|
}
|
|
16958
17001
|
modify.setActive(true);
|
|
@@ -17022,8 +17065,14 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
|
|
|
17022
17065
|
_viewport.removeEventListener('pointerup', handlePointerUpAfterCorner);
|
|
17023
17066
|
}
|
|
17024
17067
|
window.removeEventListener('keydown', deleteVertexOnDeleteKey);
|
|
17068
|
+
if (handleSingleClick) {
|
|
17069
|
+
map.un('singleclick', handleSingleClick);
|
|
17070
|
+
}
|
|
17071
|
+
if (onViewOnlyFeatureClick) {
|
|
17072
|
+
map.getViewport().style.cursor = '';
|
|
17073
|
+
}
|
|
17025
17074
|
};
|
|
17026
|
-
}, [map, isInEditMode, geojson, projection, viewOnlyStyle, selectedFeatureIndex, exitDrawModeCallback, updateGeojson, drawMode]);
|
|
17075
|
+
}, [map, isInEditMode, geojson, projection, viewOnlyStyle, selectedFeatureIndex, exitDrawModeCallback, updateGeojson, drawMode, onViewOnlyFeatureClick, onNoFeatureClick]);
|
|
17027
17076
|
return null;
|
|
17028
17077
|
};
|
|
17029
17078
|
|
|
@@ -19078,32 +19127,42 @@ var Clock = function Clock(_ref2) {
|
|
|
19078
19127
|
var time = _ref2.time,
|
|
19079
19128
|
_ref2$isVisible = _ref2.isVisible,
|
|
19080
19129
|
isClockVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
|
|
19081
|
-
onToggleClock = _ref2.onToggleClock
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
var clockElement = useRef(null);
|
|
19085
|
-
var _useState = useState({
|
|
19130
|
+
onToggleClock = _ref2.onToggleClock,
|
|
19131
|
+
_ref2$position = _ref2.position,
|
|
19132
|
+
position = _ref2$position === void 0 ? {
|
|
19086
19133
|
x: 0,
|
|
19087
19134
|
y: 0
|
|
19088
|
-
}
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
useMakeSureContainerStaysInsideWindow(clockElement, position, setPosition);
|
|
19093
|
-
var _useState3 = useState({
|
|
19135
|
+
} : _ref2$position,
|
|
19136
|
+
onSetPosition = _ref2.onSetPosition,
|
|
19137
|
+
_ref2$size = _ref2.size,
|
|
19138
|
+
size = _ref2$size === void 0 ? {
|
|
19094
19139
|
width: MIN_WIDTH,
|
|
19095
19140
|
height: MIN_HEIGHT
|
|
19096
|
-
}
|
|
19141
|
+
} : _ref2$size,
|
|
19142
|
+
onSetSize = _ref2.onSetSize;
|
|
19143
|
+
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
19144
|
+
t = _useWebmapReactTransl.t;
|
|
19145
|
+
var clockElement = useRef(null);
|
|
19146
|
+
useMakeSureContainerStaysInsideWindow(clockElement, position, onSetPosition);
|
|
19147
|
+
var _useState = useState(FONT_SIZE_WIDTH_RATIO * size.width),
|
|
19148
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19149
|
+
resizeFontSize = _useState2[0],
|
|
19150
|
+
setResizeFontSize = _useState2[1];
|
|
19151
|
+
var _useState3 = useState(false),
|
|
19097
19152
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
fontSize = _useState6[0],
|
|
19103
|
-
setFontSize = _useState6[1];
|
|
19153
|
+
isResizing = _useState4[0],
|
|
19154
|
+
setIsResizing = _useState4[1];
|
|
19155
|
+
// While resizing, use the local font size. Once you finish and the width has been updated, revert back to the size as determined from width
|
|
19156
|
+
var fontSize = isResizing ? resizeFontSize : FONT_SIZE_WIDTH_RATIO * size.width;
|
|
19104
19157
|
var toggleClock = function toggleClock(isClockVisible) {
|
|
19105
19158
|
onToggleClock === null || onToggleClock === void 0 || onToggleClock(isClockVisible);
|
|
19106
19159
|
};
|
|
19160
|
+
var setPosition = function setPosition(position) {
|
|
19161
|
+
onSetPosition === null || onSetPosition === void 0 || onSetPosition(position);
|
|
19162
|
+
};
|
|
19163
|
+
var setSize = function setSize(size) {
|
|
19164
|
+
onSetSize === null || onSetSize === void 0 || onSetSize(size);
|
|
19165
|
+
};
|
|
19107
19166
|
return jsx(Fragment, {
|
|
19108
19167
|
children: !isClockVisible ? jsx(CustomIconButton, {
|
|
19109
19168
|
"aria-label": t('clock-show'),
|
|
@@ -19124,7 +19183,10 @@ var Clock = function Clock(_ref2) {
|
|
|
19124
19183
|
cancel: ".MuiButtonBase-root",
|
|
19125
19184
|
nodeRef: clockElement,
|
|
19126
19185
|
onStop: function onStop(_event, position) {
|
|
19127
|
-
setPosition(
|
|
19186
|
+
setPosition({
|
|
19187
|
+
x: position.x,
|
|
19188
|
+
y: position.y
|
|
19189
|
+
});
|
|
19128
19190
|
},
|
|
19129
19191
|
position: position,
|
|
19130
19192
|
children: jsx("div", {
|
|
@@ -19150,15 +19212,21 @@ var Clock = function Clock(_ref2) {
|
|
|
19150
19212
|
lockAspectRatio: true,
|
|
19151
19213
|
minHeight: MIN_HEIGHT,
|
|
19152
19214
|
minWidth: MIN_WIDTH + BUTTON_WIDTH,
|
|
19215
|
+
nodeRef: clockElement,
|
|
19153
19216
|
onResize: function onResize(_event, _direction, _ref, delta) {
|
|
19154
19217
|
var width = size.width + delta.width;
|
|
19155
|
-
var
|
|
19156
|
-
|
|
19157
|
-
|
|
19218
|
+
var fontSize = FONT_SIZE_WIDTH_RATIO * width;
|
|
19219
|
+
setResizeFontSize(fontSize);
|
|
19220
|
+
},
|
|
19221
|
+
onResizeStart: function onResizeStart() {
|
|
19222
|
+
setIsResizing(true);
|
|
19223
|
+
setResizeFontSize(FONT_SIZE_WIDTH_RATIO * size.width);
|
|
19158
19224
|
},
|
|
19159
19225
|
onResizeStop: function onResizeStop(_event, _direction, _ref, delta) {
|
|
19160
19226
|
var width = size.width + delta.width;
|
|
19161
19227
|
var height = size.height + delta.height;
|
|
19228
|
+
setIsResizing(false);
|
|
19229
|
+
setResizeFontSize(FONT_SIZE_WIDTH_RATIO * width);
|
|
19162
19230
|
setSize({
|
|
19163
19231
|
width: width,
|
|
19164
19232
|
height: height
|
|
@@ -19254,4 +19322,4 @@ var getLayerUpdateInfo = function getLayerUpdateInfo(wmLayer, mapId) {
|
|
|
19254
19322
|
return updateObject;
|
|
19255
19323
|
};
|
|
19256
19324
|
|
|
19257
|
-
export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_FILL_COLOR_TRANSPARENT, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_SECONDARY_STROKE_COLOR, FEATURE_DRAW_STROKE_COLOR, FEATURE_FILL, FEATURE_FILL_SELECTED, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_STROKE_SELECTED, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayer, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapMeasure, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, SelectField, StoryLayoutGrid, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultSmoothLine, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, fakeEdrLayerApiHandlers, featureMultiPoint, featurePoint, featurePolygon, fetchStacCollection, fetchStacItem, fetchStacItems, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getBoxRotateHandlePoints, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getLegendClass, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isPointFeatureCollection, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, rewindGeometry, roundCoordinates, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useFetchGeoTIFFBlob, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useStacCollection, useStacItems, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
|
|
19325
|
+
export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_FILL_COLOR_TRANSPARENT, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_SECONDARY_STROKE_COLOR, FEATURE_DRAW_STROKE_COLOR, FEATURE_FILL, FEATURE_FILL_SELECTED, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_STROKE_SELECTED, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayer, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MIN_HEIGHT, MIN_WIDTH, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapMeasure, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, SelectField, StoryLayoutGrid, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultSmoothLine, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, fakeEdrLayerApiHandlers, featureMultiPoint, featurePoint, featurePolygon, fetchStacCollection, fetchStacItem, fetchStacItems, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getBoxRotateHandlePoints, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getLegendClass, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isPointFeatureCollection, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, rewindGeometry, roundCoordinates, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useFetchGeoTIFFBlob, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useStacCollection, useStacItems, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap-react",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"description": "GeoWeb react wrapper for webmap",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/webmap": "15.
|
|
12
|
-
"@opengeoweb/theme": "15.
|
|
13
|
-
"@opengeoweb/shared": "15.
|
|
11
|
+
"@opengeoweb/webmap": "15.2.0",
|
|
12
|
+
"@opengeoweb/theme": "15.2.0",
|
|
13
|
+
"@opengeoweb/shared": "15.2.0",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
15
|
"ol": "^10.4.0",
|
|
16
16
|
"proj4": "^2.9.2",
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
+
export declare const MIN_WIDTH = 170;
|
|
3
|
+
export declare const MIN_HEIGHT = 32;
|
|
4
|
+
export interface Position {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
export interface Size {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
2
12
|
export declare const Clock: FC<{
|
|
3
13
|
time: number;
|
|
4
14
|
isVisible?: boolean;
|
|
5
15
|
onToggleClock?: (isVisible: boolean) => void;
|
|
16
|
+
position?: Position | undefined;
|
|
17
|
+
onSetPosition: (position: Position) => void;
|
|
18
|
+
size?: Size | undefined;
|
|
19
|
+
onSetSize: (size: Size) => void;
|
|
6
20
|
}>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Feature } from 'ol';
|
|
2
|
+
import type { Geometry } from 'ol/geom';
|
|
1
3
|
import type { StyleLike } from 'ol/style/Style';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import type { DrawModeExitCallback, DrawModeValue } from './types';
|
|
@@ -9,6 +11,8 @@ export interface OpenLayersMapDrawProps {
|
|
|
9
11
|
isInEditMode: boolean;
|
|
10
12
|
selectedFeatureIndex: number;
|
|
11
13
|
updateGeojson?: (geoJson: GeoJSON.FeatureCollection, text: string) => void;
|
|
14
|
+
onViewOnlyFeatureClick?: (feature: Feature<Geometry>[]) => void;
|
|
15
|
+
onNoFeatureClick?: () => void;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* Integrates with OpenLayers Draw and Modify (+Snap) interactions, to implement feature drawing
|