@opengeoweb/sigmet-airmet 9.20.1 → 9.21.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.
Files changed (2) hide show
  1. package/index.esm.js +50 -3
  2. package/package.json +3 -3
package/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import React__default from 'react';
4
4
  import { FormControlLabel, Radio, Grid, Typography, Box, Button, Checkbox, MenuItem, FormHelperText, useTheme, Dialog, DialogTitle, DialogContent, Card, LinearProgress, List, ListItemButton, Backdrop, CircularProgress } from '@mui/material';
5
5
  import { useFormContext } from 'react-hook-form';
6
- import { useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
6
+ import { useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
7
7
  import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
8
8
  import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, addSelectionTypeToGeoJSON, defaultDelete, getIcon, MapControls, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
9
9
  import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
@@ -3696,6 +3696,7 @@ const StartGeometry = ({
3696
3696
  geoJSONIntersection,
3697
3697
  productConfig
3698
3698
  }) => {
3699
+ var _a, _b;
3699
3700
  const {
3700
3701
  formState: {
3701
3702
  errors
@@ -3711,8 +3712,20 @@ const StartGeometry = ({
3711
3712
  } = useShortTestHelpers();
3712
3713
  const getFIRValue = () => getValues('locationIndicatorATSR');
3713
3714
  const maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
3715
+ const intersectionPointCount = countIntersectionPoints(geoJSON, geoJSONIntersection);
3716
+ const drawnGeometry = (_a = geoJSON === null || geoJSON === void 0 ? void 0 : geoJSON.features[0]) === null || _a === void 0 ? void 0 : _a.geometry;
3717
+ const interceptionGeometry = (_b = geoJSONIntersection === null || geoJSONIntersection === void 0 ? void 0 : geoJSONIntersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry;
3718
+ const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
3719
+ const totalInterceptionPolygonPoints = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
3714
3720
  const maximumPointsMessage = `The start position drawing allows a maximum of ${maxPoints - 1} individual points`;
3715
- const showMaxFeaturePointsWarning = hasMaxFeaturePoints(geoJSONIntersection, 7) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3721
+ const moreThan6PointsMessage = `The start/end position drawing has exceeded 6 individual points. The TAC has a total of ${totalDrawnPoints} points. If possible, reduce the number of points.`;
3722
+ const intersectionAbove6PointsMessage = `The start/end position of the intersected polygon has
3723
+ ${totalInterceptionPolygonPoints} points,
3724
+ and the intersection of the drawn polygon with the FIR-boundary has exceeded ${intersectionPointCount} individual points.
3725
+ Check if the TAC in the preview corresponds to the intended area.`;
3726
+ const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3727
+ const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3728
+ const showIntersectionAbove6PointsWarning = totalInterceptionPolygonPoints > 7 && intersectionPointCount > 1 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3716
3729
  return !_isReadOnly ? jsxs(ProductFormFieldLayout, Object.assign({
3717
3730
  title: "Start position",
3718
3731
  sx: styles$2.drawSection,
@@ -3738,6 +3751,16 @@ const StartGeometry = ({
3738
3751
  variant: "filled"
3739
3752
  }, {
3740
3753
  children: maxFeaturePointsMessage
3754
+ })), /* non-blocking warnings */
3755
+ showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
3756
+ variant: "filled"
3757
+ }, {
3758
+ children: moreThan6PointsMessage
3759
+ })), /* non-blocking warnings */
3760
+ showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
3761
+ variant: "filled"
3762
+ }, {
3763
+ children: intersectionAbove6PointsMessage
3741
3764
  })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.startGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
3742
3765
  variant: "filled"
3743
3766
  }, {
@@ -3796,6 +3819,7 @@ const Progress = ({
3796
3819
  geoJSON,
3797
3820
  geoJSONIntersection
3798
3821
  }) => {
3822
+ var _a, _b;
3799
3823
  const {
3800
3824
  watch,
3801
3825
  getValues,
@@ -3834,7 +3858,20 @@ const Progress = ({
3834
3858
  const isShortTestOrRdoact = isShortTest() || isRadioactiveCloud;
3835
3859
  const fieldsDisabled = _isDisabled || isShortTestOrRdoact;
3836
3860
  const maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
3861
+ const intersectionPointCount = countIntersectionPoints(geoJSON, geoJSONIntersection);
3862
+ const drawnGeometry = (_a = geoJSON === null || geoJSON === void 0 ? void 0 : geoJSON.features[0]) === null || _a === void 0 ? void 0 : _a.geometry;
3863
+ const interceptionGeometry = (_b = geoJSONIntersection === null || geoJSONIntersection === void 0 ? void 0 : geoJSONIntersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry;
3864
+ const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
3865
+ const totalInterceptionPolygonPoints = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
3837
3866
  const maximumPointsMessage = `The end position drawing allows a maximum of ${maxPoints - 1} individual points`;
3867
+ const moreThan6PointsMessage = `The start/end position drawing has exceeded 6 individual points. The TAC has a total of ${totalDrawnPoints} points. If possible, reduce the number of points.`;
3868
+ const intersectionAbove6PointsMessage = `The start/end position of the intersected polygon has
3869
+ ${totalInterceptionPolygonPoints} points,
3870
+ and the intersection of the drawn polygon with the FIR-boundary has exceeded ${intersectionPointCount} individual points.
3871
+ Check if the TAC in the preview corresponds to the intended area.`;
3872
+ const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3873
+ const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3874
+ const showIntersectionAbove6PointsWarning = totalInterceptionPolygonPoints > 7 && intersectionPointCount > 1 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3838
3875
  return jsx(ProductFormFieldLayout, Object.assign({
3839
3876
  title: "Progress",
3840
3877
  sx: styles$2.containerItem
@@ -4005,10 +4042,20 @@ const Progress = ({
4005
4042
  }, {
4006
4043
  children: errors.endGeometry.message
4007
4044
  })), /* non-blocking warnings */
4008
- hasMaxFeaturePoints(geoJSONIntersection, 7) && !activeTool && !errors.endGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
4045
+ showMaxFeaturePointsWarning && jsx(FormHelperText, Object.assign({
4009
4046
  variant: "filled"
4010
4047
  }, {
4011
4048
  children: maxFeaturePointsMessage
4049
+ })), /* non-blocking warnings */
4050
+ showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
4051
+ variant: "filled"
4052
+ }, {
4053
+ children: moreThan6PointsMessage
4054
+ })), /* non-blocking warnings */
4055
+ showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
4056
+ variant: "filled"
4057
+ }, {
4058
+ children: intersectionAbove6PointsMessage
4012
4059
  })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.endGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
4013
4060
  variant: "filled"
4014
4061
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "9.20.1",
3
+ "version": "9.21.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  "@redux-eggs/redux-toolkit": "^2.2.0",
27
27
  "@redux-eggs/saga-extension": "^2.2.0",
28
28
  "@reduxjs/toolkit": "^1.9.7",
29
- "i18next": "^23.7.11",
30
- "react-i18next": "^13.5.0"
29
+ "i18next": "^23.11.5",
30
+ "react-i18next": "^14.1.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "18"