@opengeoweb/sigmet-airmet 21.2.0 → 21.3.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/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { sessionStorageProvider, PROJECTION, dateUtils, useIsMounted, usePreventBrowserClose, CustomTooltip, usePrevious, ConfirmationServiceProvider, useConfirmationDialog, CustomDialog, AlertBanner, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
3
3
  import { Box as Box$1 } from '@mui/system';
4
- import React, { useRef, useEffect, useCallback } from 'react';
4
+ import React, { useEffect, useRef, useCallback } from 'react';
5
5
  import { useQueryClient, useMutation } from '@tanstack/react-query';
6
6
  import { getHeaders, handleResponse, useAuthenticationContext, useAuthQuery } from '@opengeoweb/api';
7
7
  import i18n from 'i18next';
@@ -52,6 +52,7 @@ var en = {
52
52
  "discard-and-close": "Discard and close",
53
53
  "drop-a-point-as": "Drop a point as {{type}} position",
54
54
  "draw-a-box-as": "Draw a box as {{type}} position",
55
+ "geometry-box-projection-disabled": "Box drawing requires Europe Mercator (EPSG:3857) or WGS84 (EPSG:4326). Change the map projection to draw a box.",
55
56
  "draw-a-shape-as": "Draw a shape as {{type}} position",
56
57
  "set-a-fir-as": "Set FIR as {{type}} position",
57
58
  "remove-geometry": "Remove geometry",
@@ -184,6 +185,7 @@ var fi = {
184
185
  "discard-and-close": "Hylkää ja sulje",
185
186
  "drop-a-point-as": "Pudota piste kartalle ja käytä sitä {{type}} sijaintina ",
186
187
  "draw-a-box-as": "Piirrä laatikko kartalle ja käytä sitä {{type}} sijaintina",
188
+ "geometry-box-projection-disabled": "Laatikon piirtäminen edellyttää Europe Mercator (EPSG:3857)- tai WGS84 (EPSG:4326) -projektiota. Vaihda karttaprojektiota piirtääksesi laatikon.",
187
189
  "draw-a-shape-as": "Piirrä muoto kartalle ja käytä sitä {{type}} sijaintina",
188
190
  "set-a-fir-as": "Aseta FIR {{type}}:n sijaintina",
189
191
  "remove-geometry": "Poista geometria",
@@ -316,6 +318,7 @@ var no = {
316
318
  "discard-and-close": "Discard and close",
317
319
  "drop-a-point-as": "Drop a point as {{type}} position",
318
320
  "draw-a-box-as": "Draw a box as {{type}} position",
321
+ "geometry-box-projection-disabled": "Box drawing requires Europe Mercator (EPSG:3857) or WGS84 (EPSG:4326). Change the map projection to draw a box.",
319
322
  "draw-a-shape-as": "Draw a shape as {{type}} position",
320
323
  "set-a-fir-as": "Set FIR as {{type}} position",
321
324
  "remove-geometry": "Remove geometry",
@@ -448,6 +451,7 @@ var nl = {
448
451
  "discard-and-close": "Gooi weg en sluit",
449
452
  "drop-a-point-as": "Zet punt neer als {{type}} positie",
450
453
  "draw-a-box-as": "Teken een vierkant als {{type}} positie",
454
+ "geometry-box-projection-disabled": "Voor het tekenen van een rechthoek is Europe Mercator (EPSG:3857) of WGS84 (EPSG:4326) vereist. Wijzig de kaartprojectie om een rechthoek te tekenen.",
451
455
  "draw-a-shape-as": "Teken een vorm als {{type}} positie",
452
456
  "set-a-fir-as": "Zet FIR als {{type}} positie`",
453
457
  "remove-geometry": "Verwijder geometrie",
@@ -5748,7 +5752,11 @@ var DrawTools = function DrawTools(_ref) {
5748
5752
  onChangeTool = _ref.onChangeTool,
5749
5753
  _ref$isDisabled = _ref.isDisabled,
5750
5754
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
5751
- disabledTooltip = _ref.disabledTooltip;
5755
+ disabledTooltip = _ref.disabledTooltip,
5756
+ _ref$isBoxDisabled = _ref.isBoxDisabled,
5757
+ isBoxDisabled = _ref$isBoxDisabled === void 0 ? false : _ref$isBoxDisabled;
5758
+ var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
5759
+ t = _useSigmetAirmetTrans.t;
5752
5760
  usePreventBrowserClose(activeTool !== '');
5753
5761
  return jsx(Box, {
5754
5762
  "data-testid": "drawtools",
@@ -5758,11 +5766,12 @@ var DrawTools = function DrawTools(_ref) {
5758
5766
  justifyContent: 'space-between'
5759
5767
  },
5760
5768
  children: tools.map(function (tool) {
5769
+ var boxDisabled = isBoxDisabled && tool.selectionType === 'box';
5761
5770
  var radio = jsx(Radio, {
5762
5771
  checked: activeTool === tool.drawModeId,
5763
5772
  checkedIcon: getToolIcon(tool.selectionType),
5764
5773
  "data-testid": tool.drawModeId,
5765
- disabled: isDisabled,
5774
+ disabled: isDisabled || boxDisabled,
5766
5775
  icon: getToolIcon(tool.selectionType),
5767
5776
  onChange: function onChange() {
5768
5777
  onChangeTool(tool);
@@ -5770,7 +5779,8 @@ var DrawTools = function DrawTools(_ref) {
5770
5779
  sx: styles$1.radioInput,
5771
5780
  value: true
5772
5781
  });
5773
- var title = isDisabled && disabledTooltip ? disabledTooltip : tool.title;
5782
+ var toolTitle = boxDisabled ? t('geometry-box-projection-disabled') : tool.title;
5783
+ var title = isDisabled && disabledTooltip ? disabledTooltip : toolTitle;
5774
5784
  return jsx(CustomTooltip, {
5775
5785
  title: title,
5776
5786
  children: jsx("span", {
@@ -6672,7 +6682,9 @@ var Progress = function Progress(_ref) {
6672
6682
  geoJSON = _ref.geoJSON,
6673
6683
  geoJSONIntersection = _ref.geoJSONIntersection,
6674
6684
  _ref$drawToolsDisable = _ref.drawToolsDisabled,
6675
- drawToolsDisabled = _ref$drawToolsDisable === void 0 ? false : _ref$drawToolsDisable;
6685
+ drawToolsDisabled = _ref$drawToolsDisable === void 0 ? false : _ref$drawToolsDisable,
6686
+ _ref$isBoxDisabled = _ref.isBoxDisabled,
6687
+ isBoxDisabled = _ref$isBoxDisabled === void 0 ? false : _ref$isBoxDisabled;
6676
6688
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
6677
6689
  t = _useSigmetAirmetTrans.t;
6678
6690
  var _useFormContext = useFormContext(),
@@ -6886,6 +6898,7 @@ var Progress = function Progress(_ref) {
6886
6898
  activeTool: activeTool,
6887
6899
  "data-testid": "endGeometry-drawTools",
6888
6900
  disabledTooltip: disabledTooltip,
6901
+ isBoxDisabled: isBoxDisabled,
6889
6902
  isDisabled: combinedDisabled,
6890
6903
  onChangeTool: onChangeTool,
6891
6904
  tools: tools
@@ -7071,7 +7084,9 @@ var StartGeometry = function StartGeometry(_ref) {
7071
7084
  geoJSONIntersection = _ref.geoJSONIntersection,
7072
7085
  productConfig = _ref.productConfig,
7073
7086
  _ref$isDisabled = _ref.isDisabled,
7074
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
7087
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
7088
+ _ref$isBoxDisabled = _ref.isBoxDisabled,
7089
+ isBoxDisabled = _ref$isBoxDisabled === void 0 ? false : _ref$isBoxDisabled;
7075
7090
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
7076
7091
  t = _useSigmetAirmetTrans.t;
7077
7092
  var _useFormContext = useFormContext(),
@@ -7108,6 +7123,7 @@ var StartGeometry = function StartGeometry(_ref) {
7108
7123
  children: [jsx(DrawTools, {
7109
7124
  activeTool: activeTool,
7110
7125
  disabledTooltip: disabledTooltip,
7126
+ isBoxDisabled: isBoxDisabled,
7111
7127
  isDisabled: combinedDisabled,
7112
7128
  onChangeTool: onChangeTool,
7113
7129
  tools: tools
@@ -8303,7 +8319,8 @@ var Tac = function Tac(_ref) {
8303
8319
  };
8304
8320
 
8305
8321
  var MapViewGeoJson = function MapViewGeoJson(_ref) {
8306
- var initialBaseLayers = _ref.baseLayers,
8322
+ var suppliedMapId = _ref.mapId,
8323
+ initialBaseLayers = _ref.baseLayers,
8307
8324
  _ref$projection = _ref.projection,
8308
8325
  initialProjection = _ref$projection === void 0 ? srsAndBboxDefault : _ref$projection,
8309
8326
  _ref$geoJSONLayers = _ref.geoJSONLayers,
@@ -8321,7 +8338,7 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
8321
8338
  var mapDimensions = useSelector(function (store) {
8322
8339
  return mapSelectors.getMapDimensions(store, firstMapId);
8323
8340
  }, shallowEqual);
8324
- var mapId = React.useRef("sigmet-" + webmapUtils.generateMapId()).current;
8341
+ var mapId = React.useRef(suppliedMapId != null ? suppliedMapId : "sigmet-" + webmapUtils.generateMapId()).current;
8325
8342
  var timesliderId = React.useRef("sigmet-" + webmapUtils.generateTimesliderId()).current;
8326
8343
  var syncGroupAddGroup = React.useCallback(function (payload) {
8327
8344
  dispatch(syncGroupsActions.syncGroupAddGroup(payload));
@@ -8450,7 +8467,8 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
8450
8467
 
8451
8468
  var ProductFormLayout = function ProductFormLayout(_ref) {
8452
8469
  var _sx, _sx2, _sx3;
8453
- var children = _ref.children,
8470
+ var mapId = _ref.mapId,
8471
+ children = _ref.children,
8454
8472
  mapChildren = _ref.mapChildren,
8455
8473
  productConfig = _ref.productConfig,
8456
8474
  _ref$geoJSONLayers = _ref.geoJSONLayers,
@@ -8482,6 +8500,7 @@ var ProductFormLayout = function ProductFormLayout(_ref) {
8482
8500
  children: jsx(MapViewGeoJson, {
8483
8501
  baseLayers: baseLayers,
8484
8502
  geoJSONLayers: geoJSONLayers,
8503
+ mapId: mapId,
8485
8504
  projection: projection,
8486
8505
  children: mapChildren
8487
8506
  })
@@ -8535,7 +8554,9 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8535
8554
  startEditModes = _ref.startEditModes,
8536
8555
  endEditModes = _ref.endEditModes,
8537
8556
  currentStartDrawTool = _ref.currentStartDrawTool,
8538
- currentEndDrawTool = _ref.currentEndDrawTool;
8557
+ currentEndDrawTool = _ref.currentEndDrawTool,
8558
+ _ref$projection = _ref.projection,
8559
+ projection = _ref$projection === void 0 ? 'EPSG:3857' : _ref$projection;
8539
8560
  var dispatch = useDispatch();
8540
8561
  var sourcePanelId = useSelector(function (store) {
8541
8562
  return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.PublicWarnings);
@@ -8546,6 +8567,15 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8546
8567
  var linkedMaps = useSelector(function (store) {
8547
8568
  return genericSelectors.getLinkedMapIds(store, sourcePanelId);
8548
8569
  });
8570
+ // TAC boxes must follow meridians and parallels on every linked drawing map.
8571
+ var boxDrawingDisabled = useSelector(function (store) {
8572
+ return [projection].concat(linkedMaps.map(function (mapId) {
8573
+ var _mapSelectors$getSrs;
8574
+ return ((_mapSelectors$getSrs = mapSelectors.getSrs(store, mapId)) == null ? void 0 : _mapSelectors$getSrs.trim()) || 'EPSG:3857';
8575
+ })).some(function (srs) {
8576
+ return srs !== 'EPSG:3857' && srs !== 'EPSG:4326';
8577
+ });
8578
+ });
8549
8579
  var layersById = useSelector(function (state) {
8550
8580
  var _state$layers;
8551
8581
  return ((_state$layers = state.layers) == null ? void 0 : _state$layers.byId) || {};
@@ -8561,6 +8591,36 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8561
8591
  });
8562
8592
  var activeStartDrawTool = reduxActiveStart != null ? reduxActiveStart : currentStartDrawTool;
8563
8593
  var activeEndDrawTool = reduxActiveEnd != null ? reduxActiveEnd : currentEndDrawTool;
8594
+ useEffect(function () {
8595
+ if (!boxDrawingDisabled) {
8596
+ return;
8597
+ }
8598
+ var stopBoxDrawing = function stopBoxDrawing(type, activeTool, localActiveTool, editModes, deactivateTool) {
8599
+ var isBoxTool = function isBoxTool(toolId) {
8600
+ return !!(editModes != null && editModes.some(function (mode) {
8601
+ return mode.drawModeId === toolId && mode.selectionType === 'box';
8602
+ }));
8603
+ };
8604
+ if (!isBoxTool(activeTool) && !isBoxTool(localActiveTool)) {
8605
+ return;
8606
+ }
8607
+ deactivateTool == null || deactivateTool();
8608
+ var drawToolId = "sigmet" + (type === 'start' ? 'Start' : 'End') + "Geometry";
8609
+ dispatch(drawingToolActions.changeDrawToolMode({
8610
+ drawToolId: drawToolId,
8611
+ drawModeId: ''
8612
+ }));
8613
+ linkedMaps.forEach(function (mapId) {
8614
+ dispatch(layerActions.toggleFeatureMode({
8615
+ layerId: "drawLayer-" + drawToolId + "-" + mapId,
8616
+ isInEditMode: false,
8617
+ drawMode: ''
8618
+ }));
8619
+ });
8620
+ };
8621
+ stopBoxDrawing('start', activeStartDrawTool, currentStartDrawTool, startEditModes, deactivateStartTool);
8622
+ stopBoxDrawing('end', activeEndDrawTool, currentEndDrawTool, endEditModes, deactivateEndTool);
8623
+ }, [boxDrawingDisabled, activeStartDrawTool, activeEndDrawTool, currentStartDrawTool, currentEndDrawTool, startEditModes, endEditModes, deactivateStartTool, deactivateEndTool, dispatch, linkedMaps]);
8564
8624
  var prevActiveToolRef = useRef({
8565
8625
  start: undefined,
8566
8626
  end: undefined
@@ -8611,7 +8671,9 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8611
8671
  linkedMapsRef.current = linkedMaps;
8612
8672
  }, [linkedMaps]);
8613
8673
  var ensureActiveToolLayers = useCallback(function (type, activeTool, geoJSON, fallbackGeoJSON, editModes) {
8614
- if (!activeTool || linkedMaps.length === 0) {
8674
+ if (!activeTool || linkedMaps.length === 0 || boxDrawingDisabled && editModes != null && editModes.some(function (mode) {
8675
+ return mode.drawModeId === activeTool && mode.selectionType === 'box';
8676
+ })) {
8615
8677
  return;
8616
8678
  }
8617
8679
  var drawToolId = "sigmet" + (type === 'start' ? 'Start' : 'End') + "Geometry";
@@ -8658,7 +8720,7 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8658
8720
  drawMode: activeDrawMode.value
8659
8721
  }));
8660
8722
  }
8661
- }, [dispatch, layersById, linkedMaps]);
8723
+ }, [dispatch, layersById, linkedMaps, boxDrawingDisabled]);
8662
8724
  useEffect(function () {
8663
8725
  ensureActiveToolLayers('start', activeStartDrawTool, storedGeoJSON, startGeoJSON, startEditModes);
8664
8726
  }, [activeStartDrawTool, ensureActiveToolLayers, startEditModes, startGeoJSON, storedGeoJSON]);
@@ -8666,6 +8728,9 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8666
8728
  ensureActiveToolLayers('end', activeEndDrawTool, storedEndGeoJSON, endGeoJSON, endEditModes);
8667
8729
  }, [activeEndDrawTool, endEditModes, endGeoJSON, ensureActiveToolLayers, storedEndGeoJSON]);
8668
8730
  var onChangeTool = useCallback(function (type, newTool, deactivateOtherTool, changeActiveTool, editModes) {
8731
+ if (boxDrawingDisabled && newTool.selectionType === 'box') {
8732
+ return;
8733
+ }
8669
8734
  deactivateOtherTool();
8670
8735
  changeActiveTool(newTool);
8671
8736
  var toolKey = type === 'start' ? 'start' : 'end';
@@ -8721,7 +8786,7 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8721
8786
  updateEndGeoJson == null || updateEndGeoJson(newTool.shape);
8722
8787
  }
8723
8788
  }
8724
- }, [storedEndGeoJSON, endGeoJSON, linkedMaps, dispatch, storedGeoJSON, startGeoJSON, updateStartGeoJson, updateEndGeoJson, deactivateStartTool, deactivateEndTool]);
8789
+ }, [boxDrawingDisabled, storedEndGeoJSON, endGeoJSON, linkedMaps, dispatch, storedGeoJSON, startGeoJSON, updateStartGeoJson, updateEndGeoJson, deactivateStartTool, deactivateEndTool]);
8725
8790
  return {
8726
8791
  onChangeStartTool: function onChangeStartTool(newTool) {
8727
8792
  return onChangeTool('start', newTool, deactivateEndTool || function () {}, changeActiveStartTool, startEditModes);
@@ -8729,7 +8794,8 @@ var useGeoJSONHandling = function useGeoJSONHandling(_ref) {
8729
8794
  onChangeEndTool: function onChangeEndTool(newTool) {
8730
8795
  return onChangeTool('end', newTool, deactivateStartTool, changeActiveEndTool || function () {}, endEditModes);
8731
8796
  },
8732
- drawToolsDisabled: drawToolsDisabled
8797
+ drawToolsDisabled: drawToolsDisabled,
8798
+ boxDrawingDisabled: boxDrawingDisabled
8733
8799
  };
8734
8800
  };
8735
8801
 
@@ -8755,6 +8821,7 @@ var useConditionalFields$1 = function useConditionalFields(productConfig) {
8755
8821
  };
8756
8822
  };
8757
8823
  var SigmetForm = function SigmetForm(_ref) {
8824
+ var _getProjection;
8758
8825
  var mode = _ref.mode,
8759
8826
  _ref$isCancelSigmet = _ref.isCancelSigmet,
8760
8827
  isCancelSigmet = _ref$isCancelSigmet === void 0 ? false : _ref$isCancelSigmet,
@@ -8785,6 +8852,7 @@ var SigmetForm = function SigmetForm(_ref) {
8785
8852
  var _React$useState = React.useState(false),
8786
8853
  hasUserChangedTime = _React$useState[0],
8787
8854
  setHasUserChangedTime = _React$useState[1];
8855
+ var mapId = React.useRef("sigmet-" + webmapUtils.generateMapId()).current;
8788
8856
  var firBorderAtStart = initialSigmet ? initialSigmet.locationIndicatorATSR : productConfig.active_firs[0];
8789
8857
  var _React$useState2 = React.useState(getDefaultPhenomena(productConfig).phenomena),
8790
8858
  phenomenaList = _React$useState2[0],
@@ -8795,11 +8863,11 @@ var SigmetForm = function SigmetForm(_ref) {
8795
8863
  var linkedMaps = useSelector(function (store) {
8796
8864
  return genericSelectors.getLinkedMapIds(store, sourcePanelId);
8797
8865
  });
8798
- var getSrsForMapId = useSelector(function (store) {
8799
- return linkedMaps ? mapSelectors.getSrs(store, linkedMaps[0]) : undefined;
8866
+ var drawingMapId = showMap ? mapId : linkedMaps[0];
8867
+ var mapProjection = useSelector(function (store) {
8868
+ return drawingMapId ? mapSelectors.getSrs(store, drawingMapId) : undefined;
8800
8869
  });
8801
- // Fallback to Mercator for '', null, or undefined
8802
- var projection = getSrsForMapId != null && getSrsForMapId.trim() ? getSrsForMapId : 'EPSG:3857';
8870
+ var projection = (mapProjection == null ? void 0 : mapProjection.trim()) || (showMap ? (_getProjection = getProjection(productConfig)) == null ? void 0 : _getProjection.srs : undefined) || 'EPSG:3857';
8803
8871
  var prevProjection = usePrevious(projection);
8804
8872
  // Trigger update if projection changes
8805
8873
  useEffect(function () {
@@ -8915,6 +8983,7 @@ var SigmetForm = function SigmetForm(_ref) {
8915
8983
  onUpdateEndGeoJson(newGeoEnd, newGeoEndIntersect);
8916
8984
  }, [setEndGeoJSON, onUpdateEndGeoJson]);
8917
8985
  var _useGeoJSONHandling = useGeoJSONHandling({
8986
+ projection: projection,
8918
8987
  storedGeoJSON: storedGeoJSON,
8919
8988
  storedEndGeoJSON: storedEndGeoJSON,
8920
8989
  startGeoJSON: startGeoJSON,
@@ -8932,7 +9001,8 @@ var SigmetForm = function SigmetForm(_ref) {
8932
9001
  }),
8933
9002
  onChangeStartTool = _useGeoJSONHandling.onChangeStartTool,
8934
9003
  onChangeEndTool = _useGeoJSONHandling.onChangeEndTool,
8935
- drawToolsDisabled = _useGeoJSONHandling.drawToolsDisabled;
9004
+ drawToolsDisabled = _useGeoJSONHandling.drawToolsDisabled,
9005
+ boxDrawingDisabled = _useGeoJSONHandling.boxDrawingDisabled;
8936
9006
  var layers = [getStartLayer('geoJSONIntersectionBounds', 'geojsonlayer-fir'), Object.assign({}, getEndLayer('geoJSON', 'geojsonlayer-end'), {
8937
9007
  exitDrawModeCallback: deactivateEndTool,
8938
9008
  updateGeojson: updateEndGeoJson
@@ -9084,6 +9154,7 @@ var SigmetForm = function SigmetForm(_ref) {
9084
9154
  activeTool: activeStartTool,
9085
9155
  geoJSON: startGeoJSON,
9086
9156
  geoJSONIntersection: startGeoJSONIntersection,
9157
+ isBoxDisabled: boxDrawingDisabled,
9087
9158
  isDisabled: drawToolsDisabled,
9088
9159
  isReadOnly: isReadOnly,
9089
9160
  onChangeTool: onChangeStartTool,
@@ -9100,6 +9171,7 @@ var SigmetForm = function SigmetForm(_ref) {
9100
9171
  drawToolsDisabled: drawToolsDisabled,
9101
9172
  geoJSON: endGeoJSON,
9102
9173
  geoJSONIntersection: endGeoJSONIntersection,
9174
+ isBoxDisabled: boxDrawingDisabled,
9103
9175
  isDisabled: isDisabled,
9104
9176
  isReadOnly: isReadOnly,
9105
9177
  onChange: onChangeForm,
@@ -9156,6 +9228,7 @@ var SigmetForm = function SigmetForm(_ref) {
9156
9228
  },
9157
9229
  children: jsx(ProductFormLayout, {
9158
9230
  geoJSONLayers: layers,
9231
+ mapId: mapId,
9159
9232
  productConfig: productConfig,
9160
9233
  children: renderForm()
9161
9234
  })
@@ -9203,6 +9276,7 @@ var useConditionalFields = function useConditionalFields() {
9203
9276
  };
9204
9277
  };
9205
9278
  var AirmetForm = function AirmetForm(_ref) {
9279
+ var _getProjection;
9206
9280
  var mode = _ref.mode,
9207
9281
  _ref$isCancelAirmet = _ref.isCancelAirmet,
9208
9282
  isCancelAirmet = _ref$isCancelAirmet === void 0 ? false : _ref$isCancelAirmet,
@@ -9237,17 +9311,18 @@ var AirmetForm = function AirmetForm(_ref) {
9237
9311
  var _useTACApi = useTACApi(),
9238
9312
  fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
9239
9313
  var firBorderAtStart = initialAirmet ? initialAirmet.locationIndicatorATSR : productConfig.active_firs[0];
9314
+ var mapId = React.useRef("airmet-" + webmapUtils.generateMapId()).current;
9240
9315
  var sourcePanelId = useSelector(function (store) {
9241
9316
  return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.PublicWarnings);
9242
9317
  });
9243
9318
  var linkedMaps = useSelector(function (store) {
9244
9319
  return genericSelectors.getLinkedMapIds(store, sourcePanelId);
9245
9320
  });
9246
- var getSrsForMapId = useSelector(function (store) {
9247
- return linkedMaps ? mapSelectors.getSrs(store, linkedMaps[0]) : undefined;
9321
+ var drawingMapId = showMap ? mapId : linkedMaps[0];
9322
+ var mapProjection = useSelector(function (store) {
9323
+ return drawingMapId ? mapSelectors.getSrs(store, drawingMapId) : undefined;
9248
9324
  });
9249
- // Fallback to Mercator for '', null, or undefined
9250
- var projection = getSrsForMapId != null && getSrsForMapId.trim() ? getSrsForMapId : 'EPSG:3857';
9325
+ var projection = (mapProjection == null ? void 0 : mapProjection.trim()) || (showMap ? (_getProjection = getProjection(productConfig)) == null ? void 0 : _getProjection.srs : undefined) || 'EPSG:3857';
9251
9326
  var prevProjection = usePrevious(projection);
9252
9327
  // Trigger update if projection changes
9253
9328
  useEffect(function () {
@@ -9314,6 +9389,7 @@ var AirmetForm = function AirmetForm(_ref) {
9314
9389
  onUpdateStartgeoJSON(newGeoStart, newGeoStartIntersect);
9315
9390
  }, [setGeoJSON, onUpdateStartgeoJSON]);
9316
9391
  var _useGeoJSONHandling = useGeoJSONHandling({
9392
+ projection: projection,
9317
9393
  storedGeoJSON: storedGeoJSON,
9318
9394
  startGeoJSON: startGeoJSON,
9319
9395
  updateStartGeoJson: updateStartGeoJson,
@@ -9323,7 +9399,8 @@ var AirmetForm = function AirmetForm(_ref) {
9323
9399
  currentStartDrawTool: activeStartTool
9324
9400
  }),
9325
9401
  onChangeStartTool = _useGeoJSONHandling.onChangeStartTool,
9326
- drawToolsDisabled = _useGeoJSONHandling.drawToolsDisabled;
9402
+ drawToolsDisabled = _useGeoJSONHandling.drawToolsDisabled,
9403
+ boxDrawingDisabled = _useGeoJSONHandling.boxDrawingDisabled;
9327
9404
  var layers = [getStartLayer('geoJSONIntersectionBounds', 'geojsonlayer-fir'), Object.assign({}, getStartLayer('geoJSON', 'geojsonlayer-start'), {
9328
9405
  exitDrawModeCallback: deactivateStartTool,
9329
9406
  updateGeojson: updateStartGeoJson
@@ -9463,6 +9540,7 @@ var AirmetForm = function AirmetForm(_ref) {
9463
9540
  activeTool: activeStartTool,
9464
9541
  geoJSON: startGeoJSON,
9465
9542
  geoJSONIntersection: startGeoJSONIntersection,
9543
+ isBoxDisabled: boxDrawingDisabled,
9466
9544
  isDisabled: drawToolsDisabled,
9467
9545
  isReadOnly: isReadOnly,
9468
9546
  onChangeTool: onChangeStartTool,
@@ -9523,6 +9601,7 @@ var AirmetForm = function AirmetForm(_ref) {
9523
9601
  },
9524
9602
  children: jsx(ProductFormLayout, {
9525
9603
  geoJSONLayers: layers,
9604
+ mapId: mapId,
9526
9605
  productConfig: productConfig,
9527
9606
  children: renderForm()
9528
9607
  })
@@ -5,6 +5,7 @@ type MapViewGeoJsonLayer = OpenLayersLayerProps & {
5
5
  selectedFeatureIds?: string[];
6
6
  };
7
7
  export interface MapViewGeoJsonProps {
8
+ mapId?: string;
8
9
  baseLayers?: layerTypes.Layer[];
9
10
  projection?: mapTypes.MapPreset['proj'];
10
11
  geoJSONLayers: MapViewGeoJsonLayer[];
@@ -6,6 +6,7 @@ interface DrawToolsProps {
6
6
  onChangeTool: (newToolMode: DrawMode) => void;
7
7
  isDisabled?: boolean;
8
8
  disabledTooltip?: string;
9
+ isBoxDisabled?: boolean;
9
10
  }
10
11
  declare const DrawTools: React.FC<DrawToolsProps>;
11
12
  export default DrawTools;
@@ -14,6 +14,7 @@ interface ProgressProps extends ConfigurableFormFieldProps {
14
14
  tools?: DrawMode[];
15
15
  onChangeTool?: (newToolMode: DrawMode) => void;
16
16
  drawToolsDisabled?: boolean;
17
+ isBoxDisabled?: boolean;
17
18
  }
18
19
  declare const Progress: React.FC<ProgressProps>;
19
20
  export default Progress;
@@ -10,6 +10,7 @@ interface StartGeometryProps {
10
10
  onChangeTool: (newToolMode: DrawMode) => void;
11
11
  productConfig: ProductConfig;
12
12
  isDisabled?: boolean;
13
+ isBoxDisabled?: boolean;
13
14
  }
14
15
  declare const StartGeometry: React.FC<StartGeometryProps>;
15
16
  export default StartGeometry;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import type { OpenLayersLayerProps } from '@opengeoweb/webmap-react';
3
3
  import type { ProductConfig } from '../../types';
4
4
  interface ProducFormLayoutProps {
5
+ mapId?: string;
5
6
  children: React.ReactNode;
6
7
  mapChildren?: React.ReactNode;
7
8
  productConfig: ProductConfig;
@@ -17,10 +17,12 @@ interface UseGeoJSONHandlingProps {
17
17
  endEditModes?: DrawMode[];
18
18
  currentStartDrawTool?: string;
19
19
  currentEndDrawTool?: string;
20
+ projection?: string;
20
21
  }
21
- export declare const useGeoJSONHandling: ({ storedGeoJSON, storedEndGeoJSON, startGeoJSON, endGeoJSON, updateStartGeoJson, updateEndGeoJson, deactivateStartTool, deactivateEndTool, changeActiveStartTool, changeActiveEndTool, startEditModes, endEditModes, currentStartDrawTool, currentEndDrawTool, }: UseGeoJSONHandlingProps) => {
22
+ export declare const useGeoJSONHandling: ({ storedGeoJSON, storedEndGeoJSON, startGeoJSON, endGeoJSON, updateStartGeoJson, updateEndGeoJson, deactivateStartTool, deactivateEndTool, changeActiveStartTool, changeActiveEndTool, startEditModes, endEditModes, currentStartDrawTool, currentEndDrawTool, projection, }: UseGeoJSONHandlingProps) => {
22
23
  onChangeStartTool: (newTool: DrawMode) => void;
23
24
  onChangeEndTool: (newTool: DrawMode) => void;
24
25
  drawToolsDisabled: boolean;
26
+ boxDrawingDisabled: boolean;
25
27
  };
26
28
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "21.2.0",
3
+ "version": "21.3.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,22 +20,22 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/api": "21.2.0",
24
- "@opengeoweb/shared": "21.2.0",
25
- "@opengeoweb/theme": "21.2.0",
26
- "@opengeoweb/store": "21.2.0",
27
- "@opengeoweb/webmap": "21.2.0",
28
- "@opengeoweb/webmap-react": "21.2.0",
23
+ "@opengeoweb/api": "21.3.0",
24
+ "@opengeoweb/shared": "21.3.0",
25
+ "@opengeoweb/theme": "21.3.0",
26
+ "@opengeoweb/store": "21.3.0",
27
+ "@opengeoweb/webmap": "21.3.0",
28
+ "@opengeoweb/webmap-react": "21.3.0",
29
29
  "react-redux": "^9.2.0",
30
- "@opengeoweb/core": "21.2.0",
31
- "@opengeoweb/authentication": "21.2.0",
30
+ "@opengeoweb/core": "21.3.0",
31
+ "@opengeoweb/authentication": "21.3.0",
32
32
  "@mui/system": "^9.0.1",
33
- "@opengeoweb/form-fields": "21.2.0",
33
+ "@opengeoweb/form-fields": "21.3.0",
34
34
  "react-hook-form": "^7.50.1",
35
35
  "axios": "^1.20.0",
36
36
  "lodash": "^4.18.1",
37
37
  "@reduxjs/toolkit": "^2.6.1",
38
- "i18next": "^25.0.1",
38
+ "i18next": "^26.3.4",
39
39
  "@mui/material": "^9.0.1",
40
40
  "react-i18next": "^15.1.1",
41
41
  "@tanstack/react-query": "^5.85.5",