@opengeoweb/webmap-react 21.2.0-nightly-20261120 → 21.2.0-nightly-20261122

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/dist/index.esm.js CHANGED
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
18
18
  import { useQuery, queryOptions } from '@tanstack/react-query';
19
19
  import { toLonLat, fromLonLat, get, equivalent, transformExtent, transform } from 'ol/proj';
20
20
  import { getDistance, getLength } from 'ol/sphere.js';
21
- import { Point, MultiPoint, Polygon, LineString } from 'ol/geom';
21
+ import { Point, LineString, MultiPoint, Polygon } from 'ol/geom';
22
22
  import { Style, Icon as Icon$1, Circle, Stroke, Fill, Text } from 'ol/style';
23
23
  import Box$1 from '@mui/material/Box';
24
24
  import Typography$1 from '@mui/material/Typography';
@@ -32,7 +32,7 @@ import { equals as equals$1, closestOnSegment } from 'ol/coordinate';
32
32
  import { noModifierKeys, never, platformModifierKeyOnly, always } from 'ol/events/condition';
33
33
  import Modify from 'ol/interaction/Modify';
34
34
  import Style$1, { createDefaultStyle } from 'ol/style/Style';
35
- import GeoJSON from 'ol/format/GeoJSON';
35
+ import OlGeoJSON from 'ol/format/GeoJSON';
36
36
  import Translate from 'ol/interaction/Translate';
37
37
  import { lineSplit, cleanCoords, featureCollection, round, difference, bbox, feature, simplify, booleanPointInPolygon, intersect, polygonToLine, booleanClockwise, rewind, toWgs84, toMercator, coordEach } from '@turf/turf';
38
38
  import proj4 from 'proj4';
@@ -114,7 +114,8 @@ var en = {
114
114
  "clock-animation-options": "Animation options",
115
115
  "webmap-react-show-layer-legend": "Show layer legend",
116
116
  "webmap-react-show-layer": "Show layer in legend",
117
- "webmap-react-hide-layer": "Hide layer in legend"
117
+ "webmap-react-hide-layer": "Hide layer in legend",
118
+ "webmap-react-map-draw-help-tooltip": "Click to draw"
118
119
  };
119
120
  var fi = {
120
121
  "webmap-react-event": "tapahtuma:",
@@ -178,7 +179,8 @@ var fi = {
178
179
  "clock-animation-options": "Animoinnin asetukset",
179
180
  "webmap-react-show-layer-legend": "Näytä karttatason selite",
180
181
  "webmap-react-show-layer": "Näytä karttataso selitteessä",
181
- "webmap-react-hide-layer": "Piilota karttataso selitteestä"
182
+ "webmap-react-hide-layer": "Piilota karttataso selitteestä",
183
+ "webmap-react-map-draw-help-tooltip": "Piirrä napsauttamalla"
182
184
  };
183
185
  var no = {
184
186
  "webmap-react-event": "hendelse:",
@@ -234,7 +236,8 @@ var no = {
234
236
  "clock-animation-options": "Animasjonsinnstillinger",
235
237
  "webmap-react-show-layer-legend": "Vis",
236
238
  "webmap-react-show-layer": "Vis laget i tegnforklaringen",
237
- "webmap-react-hide-layer": "Skjul laget i tegnforklaringen"
239
+ "webmap-react-hide-layer": "Skjul laget i tegnforklaringen",
240
+ "webmap-react-map-draw-help-tooltip": "Klikk for å tegne"
238
241
  };
239
242
  var nl = {
240
243
  "webmap-react-event": "event:",
@@ -299,7 +302,8 @@ var nl = {
299
302
  "clock-animation-options": "Animatie opties",
300
303
  "webmap-react-show-layer-legend": "Toon laag in legenda",
301
304
  "webmap-react-show-layer": "Toon laag in legenda",
302
- "webmap-react-hide-layer": "Verberg laag in legenda"
305
+ "webmap-react-hide-layer": "Verberg laag in legenda",
306
+ "webmap-react-map-draw-help-tooltip": "Klik om te tekenen"
303
307
  };
304
308
  var webmapReactTranslations = {
305
309
  en: en,
@@ -6144,7 +6148,7 @@ var isDefaultMovable = function isDefaultMovable(feature) {
6144
6148
  return feature.get('isSelected') === true && feature.get('isReadonly') !== true;
6145
6149
  };
6146
6150
  var toMovedFeatures = function toMovedFeatures(olFeatures, projection) {
6147
- var formatter = new GeoJSON({
6151
+ var formatter = new OlGeoJSON({
6148
6152
  featureProjection: projection
6149
6153
  });
6150
6154
  return olFeatures.reduce(function (acc, olFeature) {
@@ -6271,6 +6275,68 @@ var FEATURE_DRAW_STROKE_COLOR = '#186DFF';
6271
6275
  var FEATURE_DRAW_SECONDARY_FILL_COLOR = '#6e1e91';
6272
6276
  var FEATURE_DRAW_SECONDARY_STROKE_COLOR = '#6e1e91';
6273
6277
 
6278
+ var color = '#ff005c';
6279
+ var vertexImage = new Circle({
6280
+ radius: 4,
6281
+ fill: new Fill({
6282
+ color: '#fff'
6283
+ }),
6284
+ stroke: new Stroke({
6285
+ color: color,
6286
+ width: 1.5
6287
+ })
6288
+ });
6289
+ var pointerStyle = new Style({
6290
+ image: vertexImage
6291
+ });
6292
+ var getVertexLetter = function getVertexLetter(index) {
6293
+ var letter = '';
6294
+ for (var value = index + 1; value > 0; value = Math.floor((value - 1) / 26)) {
6295
+ letter = String.fromCharCode(65 + (value - 1) % 26) + letter;
6296
+ }
6297
+ return letter;
6298
+ };
6299
+ /** The sketch ends with a moving pointer coordinate, which is not a placed vertex. */
6300
+ var letteredLineStyle = function letteredLineStyle(feature) {
6301
+ var sketch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6302
+ var geometry = feature.getGeometry();
6303
+ if (sketch && geometry instanceof Point) {
6304
+ return [pointerStyle];
6305
+ }
6306
+ if (!(geometry instanceof LineString) && !(geometry instanceof Point)) {
6307
+ return [];
6308
+ }
6309
+ var coordinates = geometry instanceof Point ? [geometry.getCoordinates()] : geometry.getCoordinates();
6310
+ var vertices = sketch ? coordinates.slice(0, -1) : coordinates;
6311
+ return [].concat(_toConsumableArray(geometry instanceof LineString ? [new Style({
6312
+ stroke: new Stroke({
6313
+ color: color,
6314
+ width: 2,
6315
+ lineDash: sketch ? [10, 10] : undefined
6316
+ })
6317
+ })] : []), _toConsumableArray(vertices.map(function (coordinate, index) {
6318
+ return new Style({
6319
+ geometry: new Point(coordinate),
6320
+ image: vertexImage,
6321
+ text: new Text({
6322
+ text: getVertexLetter(index),
6323
+ font: '14px Roboto, sans-serif',
6324
+ offsetY: -13,
6325
+ fill: new Fill({
6326
+ color: color
6327
+ }),
6328
+ stroke: new Stroke({
6329
+ color: '#fff',
6330
+ width: 2
6331
+ })
6332
+ })
6333
+ });
6334
+ })));
6335
+ };
6336
+ var letteredLineResultStyle = function letteredLineResultStyle(feature) {
6337
+ return letteredLineStyle(feature);
6338
+ };
6339
+
6274
6340
  var MapFeatureClass;
6275
6341
  (function (MapFeatureClass) {
6276
6342
  MapFeatureClass["MyLocation"] = "MyLocation";
@@ -7046,6 +7112,9 @@ var genericOpenLayersFeatureStyle = function genericOpenLayersFeatureStyle(featu
7046
7112
  return textLabelStyle(name);
7047
7113
  }
7048
7114
  }() : null;
7115
+ if (selectionType === 'lettered-line') {
7116
+ return letteredLineResultStyle(feature);
7117
+ }
7049
7118
  if (selectionType === 'smooth-line') {
7050
7119
  var _feature$getGeometry2;
7051
7120
  var geom = (_feature$getGeometry2 = feature.getGeometry) === null || _feature$getGeometry2 === void 0 ? void 0 : _feature$getGeometry2.call(feature);
@@ -10237,7 +10306,7 @@ var OpenLayersFeatureLayer = function OpenLayersFeatureLayer(_ref) {
10237
10306
  if (projection && featureCollection) {
10238
10307
  featureCollectionRef.current = featureCollection;
10239
10308
  projectionRef.current = projection;
10240
- var formatter = new GeoJSON({
10309
+ var formatter = new OlGeoJSON({
10241
10310
  featureProjection: projection
10242
10311
  });
10243
10312
  features.current = formatter.readFeatures(featureCollection);
@@ -12822,6 +12891,105 @@ var OpenLayersZoomControl = function OpenLayersZoomControl(_ref) {
12822
12891
  });
12823
12892
  };
12824
12893
 
12894
+ /** Draw replacement points or paths, staying active without entering vertex-edit mode. */
12895
+ var addReplaceModeDraw = function addReplaceModeDraw(map, formatter, onComplete, tooltipMsg) {
12896
+ var pointerInside = true;
12897
+ var draw = new Draw({
12898
+ type: 'LineString',
12899
+ minPoints: 1,
12900
+ style: function style(feature) {
12901
+ var _feature$getGeometry;
12902
+ return !pointerInside && ((_feature$getGeometry = feature.getGeometry()) === null || _feature$getGeometry === void 0 ? void 0 : _feature$getGeometry.getType()) === 'Point' ? [] : letteredLineStyle(feature, true);
12903
+ }
12904
+ });
12905
+ var tooltipElement = document.createElement('div');
12906
+ tooltipElement.textContent = tooltipMsg;
12907
+ tooltipElement.setAttribute('data-testid', 'map-draw-help-overlay');
12908
+ Object.assign(tooltipElement.style, {
12909
+ padding: '8px 12px',
12910
+ backgroundColor: '#111',
12911
+ color: '#eee',
12912
+ borderRadius: '3px',
12913
+ pointerEvents: 'none',
12914
+ whiteSpace: 'nowrap'
12915
+ });
12916
+ var tooltip = new Overlay({
12917
+ element: tooltipElement,
12918
+ offset: [40, 60],
12919
+ positioning: 'bottom-center',
12920
+ stopEvent: false,
12921
+ insertFirst: false
12922
+ });
12923
+ map.addOverlay(tooltip);
12924
+ var sketchInProgress = false;
12925
+ var hideTooltip = function hideTooltip() {
12926
+ return tooltip.setPosition(undefined);
12927
+ };
12928
+ var pointerListener = map.on('pointermove', function (event) {
12929
+ if (!pointerInside) {
12930
+ pointerInside = true;
12931
+ draw.getOverlay().changed();
12932
+ }
12933
+ tooltip.setPosition(!event.dragging && !sketchInProgress ? event.coordinate : undefined);
12934
+ });
12935
+ var viewport = map.getViewport();
12936
+ var onPointerLeave = function onPointerLeave() {
12937
+ hideTooltip();
12938
+ pointerInside = false;
12939
+ draw.getOverlay().changed();
12940
+ };
12941
+ viewport.addEventListener('pointerleave', onPointerLeave);
12942
+ draw.on('drawstart', function () {
12943
+ hideTooltip();
12944
+ sketchInProgress = true;
12945
+ });
12946
+ draw.on('drawabort', function () {
12947
+ sketchInProgress = false;
12948
+ });
12949
+ draw.on('drawend', function (_ref) {
12950
+ var feature = _ref.feature;
12951
+ sketchInProgress = false;
12952
+ var result = formatter.writeFeatureObject(feature);
12953
+ var coordinates = roundCoordinates(result.geometry.coordinates).filter(function (point, index, points) {
12954
+ return index === 0 || point[0] !== points[index - 1][0] || point[1] !== points[index - 1][1];
12955
+ });
12956
+ if (coordinates.length === 0) {
12957
+ return;
12958
+ }
12959
+ var geometry = coordinates.length === 1 ? {
12960
+ type: 'Point',
12961
+ coordinates: coordinates[0]
12962
+ } : {
12963
+ type: 'LineString',
12964
+ coordinates: coordinates
12965
+ };
12966
+ onComplete(_objectSpread2(_objectSpread2({}, result), {}, {
12967
+ geometry: geometry
12968
+ }));
12969
+ });
12970
+ var finishOnEscape = function finishOnEscape(event) {
12971
+ if (event.key !== 'Escape' || !sketchInProgress) {
12972
+ return;
12973
+ }
12974
+ event.preventDefault();
12975
+ // OL drops the trailing pointer coordinate in finishDrawing().
12976
+ draw.finishDrawing();
12977
+ };
12978
+ map.addInteraction(draw);
12979
+ window.addEventListener('keydown', finishOnEscape);
12980
+ return function () {
12981
+ window.removeEventListener('keydown', finishOnEscape);
12982
+ viewport.removeEventListener('pointerleave', onPointerLeave);
12983
+ unByKey(pointerListener);
12984
+ map.removeOverlay(tooltip);
12985
+ tooltipElement.remove();
12986
+ tooltip.dispose();
12987
+ map.removeInteraction(draw);
12988
+ draw.getOverlay().clearRenderer();
12989
+ draw.dispose();
12990
+ };
12991
+ };
12992
+
12825
12993
  /* *
12826
12994
  * Licensed under the Apache License, Version 2.0 (the "License");
12827
12995
  * you may not use this file except in compliance with the License.
@@ -12961,6 +13129,7 @@ var selectionTypeToDrawModeValue = function selectionTypeToDrawModeValue(selecti
12961
13129
  * is not really a requirement for any production workflows, this functionality was left as is.
12962
13130
  */
12963
13131
  var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
13132
+ var _geojson$features$sel;
12964
13133
  var isInEditMode = _ref.isInEditMode,
12965
13134
  drawMode = _ref.drawMode,
12966
13135
  viewOnlyStyle = _ref.viewOnlyStyle,
@@ -12972,29 +13141,52 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
12972
13141
  onViewOnlyFeatureClick = _ref.onViewOnlyFeatureClick,
12973
13142
  onNoFeatureClick = _ref.onNoFeatureClick,
12974
13143
  onEscape = _ref.onEscape,
12975
- boxSelect = _ref.boxSelect;
13144
+ boxSelect = _ref.boxSelect,
13145
+ _ref$replaceMode = _ref.replaceMode,
13146
+ replaceMode = _ref$replaceMode === void 0 ? false : _ref$replaceMode;
12976
13147
  var _React$useContext = React.useContext(MapContext),
12977
13148
  map = _React$useContext.map;
12978
13149
  var projection = useProjection();
13150
+ var _useWebmapReactTransl = useWebmapReactTranslation(),
13151
+ t = _useWebmapReactTransl.t;
13152
+ var tooltipMsg = t('webmap-react-map-draw-help-tooltip');
12979
13153
  var exitDrawModeCallbackRef = React.useRef(exitDrawModeCallback);
12980
13154
  var updateGeojsonRef = React.useRef(updateGeojson);
13155
+ var geojsonRef = React.useRef(geojson);
12981
13156
  var onViewOnlyFeatureClickRef = React.useRef(onViewOnlyFeatureClick);
12982
13157
  var onNoFeatureClickRef = React.useRef(onNoFeatureClick);
12983
13158
  var onEscapeRef = React.useRef(onEscape);
12984
13159
  var boxSelectRef = React.useRef(boxSelect);
12985
13160
  exitDrawModeCallbackRef.current = exitDrawModeCallback;
12986
13161
  updateGeojsonRef.current = updateGeojson;
13162
+ geojsonRef.current = geojson;
12987
13163
  onViewOnlyFeatureClickRef.current = onViewOnlyFeatureClick;
12988
13164
  onNoFeatureClickRef.current = onNoFeatureClick;
12989
13165
  onEscapeRef.current = onEscape;
12990
13166
  boxSelectRef.current = boxSelect;
13167
+ var selectionType = geojson === null || geojson === void 0 || (_geojson$features$sel = geojson.features[selectedFeatureIndex]) === null || _geojson$features$sel === void 0 || (_geojson$features$sel = _geojson$features$sel.properties) === null || _geojson$features$sel === void 0 ? void 0 : _geojson$features$sel.selectionType;
13168
+ var actualDrawMode = drawMode || selectionTypeToDrawModeValue(selectionType);
13169
+ var isReplaceDrawing = replaceMode && actualDrawMode === DRAWMODE.LINESTRING;
13170
+ React.useEffect(function () {
13171
+ if (!map || !isInEditMode || !isReplaceDrawing) {
13172
+ return undefined;
13173
+ }
13174
+ return addReplaceModeDraw(map, new OlGeoJSON({
13175
+ featureProjection: projection
13176
+ }), function (feature) {
13177
+ var _updateGeojsonRef$cur, _geojsonRef$current$f;
13178
+ (_updateGeojsonRef$cur = updateGeojsonRef.current) === null || _updateGeojsonRef$cur === void 0 || _updateGeojsonRef$cur.call(updateGeojsonRef, {
13179
+ type: 'FeatureCollection',
13180
+ features: [_objectSpread2(_objectSpread2({}, feature), {}, {
13181
+ properties: _objectSpread2({}, (_geojsonRef$current$f = geojsonRef.current.features[0]) === null || _geojsonRef$current$f === void 0 ? void 0 : _geojsonRef$current$f.properties)
13182
+ })]
13183
+ }, NEW_FEATURE_CREATED);
13184
+ }, tooltipMsg);
13185
+ }, [map, isInEditMode, isReplaceDrawing, projection, tooltipMsg]);
12991
13186
  React.useEffect(function () {
12992
- var _geojson$features$sel;
12993
- if (!map || !isInEditMode) {
13187
+ if (!map || !isInEditMode || isReplaceDrawing) {
12994
13188
  return function () {};
12995
13189
  }
12996
- var selectionType = geojson === null || geojson === void 0 || (_geojson$features$sel = geojson.features[selectedFeatureIndex]) === null || _geojson$features$sel === void 0 || (_geojson$features$sel = _geojson$features$sel.properties) === null || _geojson$features$sel === void 0 ? void 0 : _geojson$features$sel.selectionType;
12997
- var actualDrawMode = drawMode || selectionTypeToDrawModeValue(selectionType);
12998
13190
  if (actualDrawMode === DRAWMODE.SPLIT) {
12999
13191
  var viewport = map.getViewport();
13000
13192
  if (viewport !== null && viewport !== void 0 && viewport.style) {
@@ -13005,7 +13197,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
13005
13197
  var drawOperation = createDrawOperation(actualDrawMode, selectedFeature === null || selectedFeature === void 0 ? void 0 : selectedFeature.geometry.type);
13006
13198
  var drawStyle = drawStyles[actualDrawMode];
13007
13199
  var modifyStyle = modifyStyles[actualDrawMode];
13008
- var geojsonFormatter = new GeoJSON({
13200
+ var geojsonFormatter = new OlGeoJSON({
13009
13201
  featureProjection: projection
13010
13202
  });
13011
13203
  var allFeatures = geojson ? geojsonFormatter.readFeatures(geojson) : [];
@@ -13072,7 +13264,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
13072
13264
  map.on('singleclick', handleSingleClick);
13073
13265
  }
13074
13266
  var updateFeature = function updateFeature(feature) {
13075
- var _feature$getGeometry, _updateGeojsonRef$cur;
13267
+ var _feature$getGeometry, _updateGeojsonRef$cur2;
13076
13268
  // Convert Circle to Polygon for GeoJSON serialization
13077
13269
  if (((_feature$getGeometry = feature.getGeometry()) === null || _feature$getGeometry === void 0 ? void 0 : _feature$getGeometry.getType()) === 'Circle') {
13078
13270
  var geometry = fromCircle(feature.getGeometry(), 64);
@@ -13087,7 +13279,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
13087
13279
  var newGeoJson = _objectSpread2(_objectSpread2({}, geojson), {}, {
13088
13280
  features: [].concat(_toConsumableArray(geojson.features.slice(0, selectedFeatureIndex)), [obj], _toConsumableArray(geojson.features.slice(selectedFeatureIndex + 1)))
13089
13281
  });
13090
- (_updateGeojsonRef$cur = updateGeojsonRef.current) === null || _updateGeojsonRef$cur === void 0 || _updateGeojsonRef$cur.call(updateGeojsonRef, newGeoJson, NEW_FEATURE_CREATED);
13282
+ (_updateGeojsonRef$cur2 = updateGeojsonRef.current) === null || _updateGeojsonRef$cur2 === void 0 || _updateGeojsonRef$cur2.call(updateGeojsonRef, newGeoJson, NEW_FEATURE_CREATED);
13091
13283
  };
13092
13284
  var splitSelectedPolygon = function splitSelectedPolygon(splitFeature) {
13093
13285
  var isValidSplit = selectedFeatureHasGeometry && selectedFeature.geometry.type !== 'Point';
@@ -13095,7 +13287,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
13095
13287
  return;
13096
13288
  }
13097
13289
  // GeoJsons are always treated as latlon, therefore using EPSG:4326 as transformer does not do anything except translating the object.
13098
- var geojsonFormatterNoTransform = new GeoJSON({
13290
+ var geojsonFormatterNoTransform = new OlGeoJSON({
13099
13291
  featureProjection: 'EPSG:4326'
13100
13292
  });
13101
13293
  var isLineSplit = selectedFeature.geometry.type === 'LineString';
@@ -13676,7 +13868,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
13676
13868
  // re-run when parents pass inline arrows. Re-running mid-sketch would
13677
13869
  // tear down the Draw interaction and lose the in-progress polygon.
13678
13870
  // eslint-disable-next-line react-hooks/exhaustive-deps
13679
- }, [map, isInEditMode, geojson, projection, viewOnlyStyle, selectedFeatureIndex, selectedFeatureIndices, boxSelect === null || boxSelect === void 0 ? void 0 : boxSelect.active, drawMode]);
13871
+ }, [map, isInEditMode, geojson, projection, viewOnlyStyle, selectedFeatureIndex, selectedFeatureIndices, boxSelect === null || boxSelect === void 0 ? void 0 : boxSelect.active, actualDrawMode, isReplaceDrawing]);
13680
13872
  return null;
13681
13873
  };
13682
13874
 
@@ -16054,4 +16246,4 @@ var getLayerUpdateInfo = function getLayerUpdateInfo(wmLayer, mapId) {
16054
16246
  return updateObject;
16055
16247
  };
16056
16248
 
16057
- export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, CONSTRAINED_SELECTION_TYPES, COORDINATE_DECIMALS, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDR_PLAIN_NUMBERS_STYLE, 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, POINTER_CLICK_TOLERANCE_PX, SELECTED_FEATURE_COLOR, SELECTED_POINT_HALO_STYLE, STAC_ASSET_STYLE_PREFIX, STAC_ITEM_PAGE_LIMIT, STAC_ITEM_SEARCH_FIELDS_CONFORMANCE, STAC_TEMPORAL_STEP_SAMPLE_LIMIT, SelectField, StacLegendCanvas, StoryLayoutGrid, TRANSIENT_FEATURE_PROPERTIES, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, applyStacNodataMask, asNewFeature, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, basicExampleSharedVertexDrawOptions, calculateBoxSelection, calculateNewSelection, catmullRomSpline, clearImageCacheForAllMaps, clearStacFeatureInfoCache, colorMaps, connectSharedVertices, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createModifyFeatures, createMoveFeatures, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultRotatableBox, defaultSmoothLine, defaultSplit, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, edrCollectionsToServiceLayers, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureMultiPoint, featurePoint, featurePolygon, fetchEDRArea, fetchEDRCollectionDetails, fetchEDRCube, fetchEDRJson, fetchEDRParameter, fetchEDRServiceLayers, fetchStacCatalogCollections, fetchStacCatalogRoot, fetchStacCollection, fetchStacItem, fetchStacItems, fetchStacItemsPage, fetchStacItemsWithPagination, fillOptions, firSelectionType, formatEDRValue, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getAffectedIndices, getBoxRotateHandlePoints, getBoxSelectPreviewStyle, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getEDRUnitLabel, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerExtentForProjection, getLayerStyles, getLayerUpdateInfo, getLegendClass, getOlFeatureKey, getProj4, getRendersAsStyles, getStacAssetKeyFromStyle, getStacAssetStyles, getStacCollectionStyles, getStacFeatureInfoSources, getStacFrameItemsToRender, getStacGrayscaleRange, getStacGrayscaleSampleRange, getStacItemLookupWindowForTimes, getStacItemSearchUrl, getStacItemsUrl, getStacLegendMetadata, getStacLegendWidth, getStacRasterBands, getTimeDimension, getToolIcon, getWMSStyleName, handleResponse, hasEditableVertices, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isBrowserReadableGeoTIFFAsset, isClickFromDrag, isDefaultModifiable, isDefaultMovable, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isGeoTIFFAsset, isPointFeatureCollection, isStacFeatureInfoReady, joinUrlParams, keepIdentityOnFirstSplitFeature, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStylePlainNumber, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeStacLegendModel, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyHandleStyle$1 as modifyHandleStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, normalizeEDRLabel, opacityOptions, openLayersGetMapImageStore, polygonCleanDangling, polygonCleanDanglingCoords, polygonFeatureCollectionCleanDangling, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, readStacPointValue, registerStacFeatureInfoSource, removeFeatureProperties, removeOverlappingLines, removeTransientFeatureProperties, renderStacLegend, resolvePreferredStyleName$1 as resolvePreferredStyleName, resolveStacAssetKey, rewindGeometry, roundCoordinates, roundFeatureCoordinates, selectPreferredWMSProjection, selectPreferredWMTSTileMatrixSet, setMapCenter, setStacFeatureInfoReady, setViewFromExtent, setViewFromFeature, shouldEnterEditMode, shouldExitEditModeForMultiSelect, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, splitLine, splitPolygon, splitStyle, stacCatalogCollectionToLayerProps, stacColormapToOlStyle, stacGrayscaleOlStyle, stacNormalizedGrayscaleOlStyle, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, subscribeStacFeatureInfoSources, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, toMovedFeatures, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useModifyFeatures, useMoveFeatures, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useStacCatalogRoot, useStacCollection, useStacItems, useStacOverviewItems, useStacTemporalStepItems, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
16249
+ export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, CONSTRAINED_SELECTION_TYPES, COORDINATE_DECIMALS, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDR_PLAIN_NUMBERS_STYLE, 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, POINTER_CLICK_TOLERANCE_PX, SELECTED_FEATURE_COLOR, SELECTED_POINT_HALO_STYLE, STAC_ASSET_STYLE_PREFIX, STAC_ITEM_PAGE_LIMIT, STAC_ITEM_SEARCH_FIELDS_CONFORMANCE, STAC_TEMPORAL_STEP_SAMPLE_LIMIT, SelectField, StacLegendCanvas, StoryLayoutGrid, TRANSIENT_FEATURE_PROPERTIES, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, applyStacNodataMask, asNewFeature, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, basicExampleSharedVertexDrawOptions, calculateBoxSelection, calculateNewSelection, catmullRomSpline, clearImageCacheForAllMaps, clearStacFeatureInfoCache, colorMaps, connectSharedVertices, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createModifyFeatures, createMoveFeatures, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultRotatableBox, defaultSmoothLine, defaultSplit, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, edrCollectionsToServiceLayers, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureMultiPoint, featurePoint, featurePolygon, fetchEDRArea, fetchEDRCollectionDetails, fetchEDRCube, fetchEDRJson, fetchEDRParameter, fetchEDRServiceLayers, fetchStacCatalogCollections, fetchStacCatalogRoot, fetchStacCollection, fetchStacItem, fetchStacItems, fetchStacItemsPage, fetchStacItemsWithPagination, fillOptions, firSelectionType, formatEDRValue, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getAffectedIndices, getBoxRotateHandlePoints, getBoxSelectPreviewStyle, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getEDRUnitLabel, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerExtentForProjection, getLayerStyles, getLayerUpdateInfo, getLegendClass, getOlFeatureKey, getProj4, getRendersAsStyles, getStacAssetKeyFromStyle, getStacAssetStyles, getStacCollectionStyles, getStacFeatureInfoSources, getStacFrameItemsToRender, getStacGrayscaleRange, getStacGrayscaleSampleRange, getStacItemLookupWindowForTimes, getStacItemSearchUrl, getStacItemsUrl, getStacLegendMetadata, getStacLegendWidth, getStacRasterBands, getTimeDimension, getToolIcon, getVertexLetter, getWMSStyleName, handleResponse, hasEditableVertices, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isBrowserReadableGeoTIFFAsset, isClickFromDrag, isDefaultModifiable, isDefaultMovable, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isGeoTIFFAsset, isPointFeatureCollection, isStacFeatureInfoReady, joinUrlParams, keepIdentityOnFirstSplitFeature, labelOptions, letteredLineResultStyle, letteredLineStyle, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStylePlainNumber, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeStacLegendModel, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyHandleStyle$1 as modifyHandleStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, normalizeEDRLabel, opacityOptions, openLayersGetMapImageStore, polygonCleanDangling, polygonCleanDanglingCoords, polygonFeatureCollectionCleanDangling, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, readStacPointValue, registerStacFeatureInfoSource, removeFeatureProperties, removeOverlappingLines, removeTransientFeatureProperties, renderStacLegend, resolvePreferredStyleName$1 as resolvePreferredStyleName, resolveStacAssetKey, rewindGeometry, roundCoordinates, roundFeatureCoordinates, selectPreferredWMSProjection, selectPreferredWMTSTileMatrixSet, setMapCenter, setStacFeatureInfoReady, setViewFromExtent, setViewFromFeature, shouldEnterEditMode, shouldExitEditModeForMultiSelect, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, splitLine, splitPolygon, splitStyle, stacCatalogCollectionToLayerProps, stacColormapToOlStyle, stacGrayscaleOlStyle, stacNormalizedGrayscaleOlStyle, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, subscribeStacFeatureInfoSources, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, toMovedFeatures, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useModifyFeatures, useMoveFeatures, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useStacCatalogRoot, useStacCollection, useStacItems, useStacOverviewItems, useStacTemporalStepItems, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
@@ -19,6 +19,7 @@ export interface OpenLayersMapDrawProps {
19
19
  /** Called after the map handled Escape in edit or draw mode */
20
20
  onEscape?: () => void;
21
21
  boxSelect?: BoxSelect;
22
+ replaceMode?: boolean;
22
23
  }
23
24
  /**
24
25
  * Integrates with OpenLayers Draw and Modify (+Snap) interactions, to implement feature drawing
@@ -0,0 +1,4 @@
1
+ import type { Map } from 'ol';
2
+ import type GeoJSONFormatter from 'ol/format/GeoJSON';
3
+ /** Draw replacement points or paths, staying active without entering vertex-edit mode. */
4
+ export declare const addReplaceModeDraw: (map: Map, formatter: GeoJSONFormatter, onComplete: (feature: GeoJSON.Feature<GeoJSON.LineString | GeoJSON.Point>) => void, tooltipMsg: string) => (() => void);
@@ -37,6 +37,8 @@ export interface DrawMode {
37
37
  title: string;
38
38
  isSelectable: boolean;
39
39
  selectionType: SelectionType;
40
+ /** Draw a replacement point or path and stay ready to draw, without vertex editing. */
41
+ replaceMode?: boolean;
40
42
  }
41
43
  export type ProjectFn = (feat: Feature<Polygon | MultiPolygon>) => Feature<Polygon | MultiPolygon>;
42
44
  export type UnprojectFn = (feat: Feature<Polygon | MultiPolygon>) => Feature<Polygon | MultiPolygon>;
@@ -14,3 +14,4 @@ export * from './OlStyles';
14
14
  export * from './OlColors';
15
15
  export * from './tools';
16
16
  export * from './layers';
17
+ export * from './styles/letteredLineStyle';
@@ -0,0 +1,6 @@
1
+ import type { FeatureLike } from 'ol/Feature';
2
+ import { Style } from 'ol/style';
3
+ export declare const getVertexLetter: (index: number) => string;
4
+ /** The sketch ends with a moving pointer coordinate, which is not a placed vertex. */
5
+ export declare const letteredLineStyle: (feature: FeatureLike, sketch?: boolean) => Style[];
6
+ export declare const letteredLineResultStyle: (feature: FeatureLike) => Style[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "21.2.0-nightly-20261120",
3
+ "version": "21.2.0-nightly-20261122",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,9 +20,9 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/webmap": "21.2.0-nightly-20261120",
24
- "@opengeoweb/theme": "21.2.0-nightly-20261120",
25
- "@opengeoweb/shared": "21.2.0-nightly-20261120",
23
+ "@opengeoweb/webmap": "21.2.0-nightly-20261122",
24
+ "@opengeoweb/theme": "21.2.0-nightly-20261122",
25
+ "@opengeoweb/shared": "21.2.0-nightly-20261122",
26
26
  "lodash": "^4.18.1",
27
27
  "ol": "^10.4.0",
28
28
  "geotiff": "^3.0.5",