@opengeoweb/sigmet-airmet 4.14.1 → 4.15.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 CHANGED
@@ -1467,27 +1467,52 @@ var DrawTools = function DrawTools(_ref) {
1467
1467
  }))));
1468
1468
  };
1469
1469
 
1470
- var invalidLevelsTill4900FTStepsMessage = 'Levels must be rounded to the nearest 100ft';
1471
- var invalidLevelsFrom50FLStepsMessage = 'Levels must be rounded to the nearest 5';
1470
+ var DEFAULT_ROUNDING_LEVELS_FL = 100;
1471
+ var DEFAULT_ROUNDING_LEVELS_FT = 5;
1472
+ var DEFAULT_ROUNDING_LEVELS_M = 1;
1473
+ var getLevelInvalidStepsForFLUnitMessage = function getLevelInvalidStepsForFLUnitMessage() {
1474
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_LEVELS_FL;
1475
+ return "Levels must be rounded to the nearest ".concat(value);
1476
+ };
1477
+ var getLevelInvalidStepsForFTUnitMessage = function getLevelInvalidStepsForFTUnitMessage() {
1478
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_LEVELS_FT;
1479
+ return "Levels must be rounded to the nearest ".concat(value, "ft");
1480
+ };
1481
+ var getLevelInvalidStepsForMUnitMessage = function getLevelInvalidStepsForMUnitMessage() {
1482
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_LEVELS_M;
1483
+ return "Levels must be rounded to the nearest ".concat(value, "m");
1484
+ };
1485
+ var invalidUnitMessage$1 = 'Level unit not defined';
1472
1486
 
1473
- var _validateLevels = function validateLevels(value, unit) {
1487
+ var _validateLevels = function validateLevels(value, unit, productConfig, selectedFIR) {
1474
1488
  if (isEmpty(value)) {
1475
1489
  return true;
1476
- } // Parse to integer to check for steps
1490
+ }
1491
+
1492
+ var _getActiveFIRArea = getActiveFIRArea(selectedFIR, productConfig),
1493
+ _getActiveFIRArea$lev = _getActiveFIRArea.level_rounding_FL,
1494
+ level_rounding_FL = _getActiveFIRArea$lev === void 0 ? DEFAULT_ROUNDING_LEVELS_FL : _getActiveFIRArea$lev,
1495
+ _getActiveFIRArea$lev2 = _getActiveFIRArea.level_rounding_FT,
1496
+ level_rounding_FT = _getActiveFIRArea$lev2 === void 0 ? DEFAULT_ROUNDING_LEVELS_FT : _getActiveFIRArea$lev2,
1497
+ _getActiveFIRArea$lev3 = _getActiveFIRArea.level_rounding_M,
1498
+ level_rounding_M = _getActiveFIRArea$lev3 === void 0 ? DEFAULT_ROUNDING_LEVELS_M : _getActiveFIRArea$lev3; // Parse to integer to check for steps
1477
1499
 
1478
1500
 
1479
1501
  var intLevel = parseInt(value, 10);
1480
1502
 
1481
1503
  if (LevelUnits[unit] === LevelUnits.FT) {
1482
- return intLevel % 100 === 0 || invalidLevelsTill4900FTStepsMessage;
1504
+ return intLevel % level_rounding_FT === 0 || getLevelInvalidStepsForFTUnitMessage(level_rounding_FT);
1483
1505
  }
1484
1506
 
1485
1507
  if (LevelUnits[unit] === LevelUnits.FL) {
1486
- return intLevel % 5 === 0 || invalidLevelsFrom50FLStepsMessage;
1487
- } // For meters the allowed step is 1, so always valid
1508
+ return intLevel % level_rounding_FL === 0 || getLevelInvalidStepsForFLUnitMessage(level_rounding_FL);
1509
+ }
1488
1510
 
1511
+ if (LevelUnits[unit] === LevelUnits.M) {
1512
+ return intLevel % level_rounding_M === 0 || getLevelInvalidStepsForMUnitMessage(level_rounding_M);
1513
+ }
1489
1514
 
1490
- return true;
1515
+ return invalidUnitMessage$1;
1491
1516
  };
1492
1517
  var invalidLevelUnitCombinationMessage = 'Invalid unit combination';
1493
1518
 
@@ -1631,7 +1656,7 @@ var Levels = function Levels(_ref) {
1631
1656
  },
1632
1657
  validateLevels: function validateLevels(value) {
1633
1658
  return (// level step depends on the unit
1634
- _validateLevels(value, getValues('level.unit'))
1659
+ _validateLevels(value, getValues('level.unit'), productConfig, selectedFIR)
1635
1660
  );
1636
1661
  }
1637
1662
  }
@@ -1709,7 +1734,7 @@ var Levels = function Levels(_ref) {
1709
1734
  },
1710
1735
  validateLevels: function validateLevels(value) {
1711
1736
  return (// level step depends on the unit
1712
- _validateLevels(value, getValues('level.unit'))
1737
+ _validateLevels(value, getValues('level.unit'), productConfig, selectedFIR)
1713
1738
  );
1714
1739
  }
1715
1740
  }
@@ -1809,7 +1834,7 @@ var Levels = function Levels(_ref) {
1809
1834
  },
1810
1835
  validateLevels: function validateLevels(value) {
1811
1836
  return (// level step depends on the unit
1812
- _validateLevels(value, getValues('lowerLevel.unit'))
1837
+ _validateLevels(value, getValues('lowerLevel.unit'), productConfig, selectedFIR)
1813
1838
  );
1814
1839
  }
1815
1840
  }
@@ -1896,7 +1921,7 @@ var Levels = function Levels(_ref) {
1896
1921
  },
1897
1922
  validateLevels: function validateLevels(value) {
1898
1923
  return (// level step depends on the unit
1899
- _validateLevels(value, getValues('level.unit'))
1924
+ _validateLevels(value, getValues('level.unit'), productConfig, selectedFIR)
1900
1925
  );
1901
1926
  }
1902
1927
  }
@@ -2169,23 +2194,38 @@ var StartGeometry = function StartGeometry(_ref) {
2169
2194
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2170
2195
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
2171
2196
  * */
2197
+ var DEFAULT_ROUNDING_MOVEMENT_KT = 5;
2198
+ var DEFAULT_ROUNDING_MOVEMENT_KMH = 10;
2199
+ var getMovementStepValKTMessage = function getMovementStepValKTMessage() {
2200
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_MOVEMENT_KT;
2201
+ return "Speed should be rounded to the nearest ".concat(value, "kt");
2202
+ };
2203
+ var getMovementStepValKMHMessage = function getMovementStepValKMHMessage() {
2204
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_MOVEMENT_KMH;
2205
+ return "Speed should be rounded to the nearest ".concat(value, "kmh");
2206
+ };
2172
2207
  var coordinatesEmptyMessage = 'An end position drawing is required when selecting End position';
2173
- var movementStepValMessageKT = 'Speed should be rounded to the nearest 5kt';
2174
- var movementStepValMessageKMH = 'Speed should be rounded to the nearest 10kmh';
2175
2208
  var noIntersectionMessage = 'The end position needs to be (partly) inside the FIR';
2176
2209
  var maximum6PointsMessage = 'The end position drawing allows a maximum of 6 individual points';
2177
2210
 
2178
- var _validateMovementSteps = function validateMovementSteps(value, unit) {
2179
- if (isEmpty(value)) return true; // Parse to integer to check for steps
2211
+ var _validateMovementSteps = function validateMovementSteps(value, unit, productConfig, selectedFIR) {
2212
+ if (isEmpty(value)) return true;
2213
+
2214
+ var _getActiveFIRArea = getActiveFIRArea(selectedFIR, productConfig),
2215
+ _getActiveFIRArea$mov = _getActiveFIRArea.movement_rounding_kt,
2216
+ movement_rounding_kt = _getActiveFIRArea$mov === void 0 ? DEFAULT_ROUNDING_MOVEMENT_KT : _getActiveFIRArea$mov,
2217
+ _getActiveFIRArea$mov2 = _getActiveFIRArea.movement_rounding_kmh,
2218
+ movement_rounding_kmh = _getActiveFIRArea$mov2 === void 0 ? DEFAULT_ROUNDING_MOVEMENT_KMH : _getActiveFIRArea$mov2; // Parse to integer to check for steps
2219
+
2180
2220
 
2181
2221
  var intLevel = parseInt(value, 10);
2182
2222
 
2183
2223
  if (MovementUnit[unit] === MovementUnit.KT) {
2184
- return intLevel % 5 === 0 || movementStepValMessageKT;
2224
+ return intLevel % movement_rounding_kt === 0 || getMovementStepValKTMessage(movement_rounding_kt);
2185
2225
  }
2186
2226
 
2187
2227
  if (MovementUnit[unit] === MovementUnit.KMH) {
2188
- return intLevel % 10 === 0 || movementStepValMessageKMH;
2228
+ return intLevel % movement_rounding_kmh === 0 || getMovementStepValKMHMessage(movement_rounding_kmh);
2189
2229
  }
2190
2230
 
2191
2231
  return 'Invalid unit';
@@ -2342,7 +2382,7 @@ var Progress = function Progress(_ref) {
2342
2382
  },
2343
2383
  validateMovementSteps: function validateMovementSteps(value) {
2344
2384
  return (// movement step depends on the unit
2345
- _validateMovementSteps(value, getValues('movementUnit'))
2385
+ _validateMovementSteps(value, getValues('movementUnit'), productConfig, selectedFIR)
2346
2386
  );
2347
2387
  }
2348
2388
  }
@@ -2839,18 +2879,34 @@ var VolcanicFields = function VolcanicFields(_ref) {
2839
2879
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2840
2880
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2841
2881
  * */
2842
- var invalidSurfaceVisibilityTill750StepsMessage = 'A visibility below 750m must be rounded to the nearest 50m';
2843
- var invalidSurfaceVisibilityFrom750StepsMessage = 'A visibility above 750m must be rounded to the nearest 100m';
2844
- var validateSurfaceVisibility = function validateSurfaceVisibility(value) {
2845
- if (isEmpty(value)) return true; // Parse to integer to check for steps
2882
+ var DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW = 50;
2883
+ var DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE = 100;
2884
+ var getInvalidSurfaceVisibilityTill750StepsMessage = function getInvalidSurfaceVisibilityTill750StepsMessage() {
2885
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW;
2886
+ return "A visibility below 750m must be rounded to the nearest ".concat(value, "m");
2887
+ };
2888
+ var getInvalidSurfaceVisibilityFrom750StepsMessage = function getInvalidSurfaceVisibilityFrom750StepsMessage() {
2889
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE;
2890
+ return "A visibility above 750m must be rounded to the nearest ".concat(value, "m");
2891
+ };
2892
+
2893
+ var _validateSurfaceVisibility = function validateSurfaceVisibility(value, productConfig, selectedFIR) {
2894
+ if (isEmpty(value)) return true;
2895
+
2896
+ var _getActiveFIRArea = getActiveFIRArea(selectedFIR, productConfig),
2897
+ _getActiveFIRArea$vis = _getActiveFIRArea.visibility_rounding_below,
2898
+ visibility_rounding_below = _getActiveFIRArea$vis === void 0 ? DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW : _getActiveFIRArea$vis,
2899
+ _getActiveFIRArea$vis2 = _getActiveFIRArea.visibility_rounding_above,
2900
+ visibility_rounding_above = _getActiveFIRArea$vis2 === void 0 ? DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE : _getActiveFIRArea$vis2; // Parse to integer to check for steps
2901
+
2846
2902
 
2847
2903
  var intVisibility = parseInt(value, 10);
2848
2904
 
2849
2905
  if (intVisibility > 750) {
2850
- return intVisibility % 100 === 0 || invalidSurfaceVisibilityFrom750StepsMessage;
2906
+ return intVisibility % visibility_rounding_above === 0 || getInvalidSurfaceVisibilityFrom750StepsMessage(visibility_rounding_above);
2851
2907
  }
2852
2908
 
2853
- return intVisibility % 50 === 0 || invalidSurfaceVisibilityTill750StepsMessage;
2909
+ return intVisibility % visibility_rounding_below === 0 || getInvalidSurfaceVisibilityTill750StepsMessage(visibility_rounding_below);
2854
2910
  };
2855
2911
 
2856
2912
  var SurfaceVisibility = function SurfaceVisibility(_ref) {
@@ -2905,7 +2961,9 @@ var SurfaceVisibility = function SurfaceVisibility(_ref) {
2905
2961
  isValidMax(value, getMaxVisibilityValue(selectedFIR, productConfig)) || "The maximum visibility in meters is ".concat(getMaxVisibilityValue(selectedFIR, productConfig))
2906
2962
  );
2907
2963
  },
2908
- validateSurfaceVisibility: validateSurfaceVisibility
2964
+ validateSurfaceVisibility: function validateSurfaceVisibility(value) {
2965
+ return _validateSurfaceVisibility(value, productConfig, selectedFIR);
2966
+ }
2909
2967
  }
2910
2968
  },
2911
2969
  disabled: isDisabled,
@@ -4026,6 +4084,9 @@ var fir_areas$1 = {
4026
4084
  FT: 4900,
4027
4085
  FL: 650
4028
4086
  },
4087
+ level_rounding_FL: 100,
4088
+ level_rounding_FT: 5,
4089
+ level_rounding_M: 1,
4029
4090
  movement_min: {
4030
4091
  KT: 5,
4031
4092
  KMH: 10
@@ -4034,6 +4095,8 @@ var fir_areas$1 = {
4034
4095
  KT: 150,
4035
4096
  KMH: 99
4036
4097
  },
4098
+ movement_rounding_kt: 5,
4099
+ movement_rounding_kmh: 10,
4037
4100
  units: [
4038
4101
  {
4039
4102
  unit_type: "level_unit",
@@ -5279,6 +5342,8 @@ var fir_areas$1 = {
5279
5342
  tc_hours_before_validity: 12,
5280
5343
  va_max_hours_of_validity: 6,
5281
5344
  va_hours_before_validity: 12,
5345
+ movement_rounding_kt: 20,
5346
+ movement_rounding_kmh: 30,
5282
5347
  adjacent_firs: [
5283
5348
  "EKDK",
5284
5349
  "EDWW",
@@ -5298,7 +5363,8 @@ var fir_areas$1 = {
5298
5363
  {
5299
5364
  unit_type: "movement_unit",
5300
5365
  allowed_units: [
5301
- "KT"
5366
+ "KT",
5367
+ "KMH"
5302
5368
  ]
5303
5369
  }
5304
5370
  ]
@@ -5528,6 +5594,8 @@ var fir_areas = {
5528
5594
  },
5529
5595
  visibility_max: 4900,
5530
5596
  visibility_min: 0,
5597
+ visibility_rounding_below: 50,
5598
+ visibility_rounding_above: 100,
5531
5599
  level_min: {
5532
5600
  FT: 100,
5533
5601
  FL: 50
@@ -5536,6 +5604,9 @@ var fir_areas = {
5536
5604
  FT: 4900,
5537
5605
  FL: 100
5538
5606
  },
5607
+ level_rounding_FL: 100,
5608
+ level_rounding_FT: 5,
5609
+ level_rounding_M: 1,
5539
5610
  movement_min: {
5540
5611
  KT: 5,
5541
5612
  KMH: 10
@@ -5544,6 +5615,8 @@ var fir_areas = {
5544
5615
  KT: 150,
5545
5616
  KMH: 99
5546
5617
  },
5618
+ movement_rounding_kt: 5,
5619
+ movement_rounding_kmh: 10,
5547
5620
  units: [
5548
5621
  {
5549
5622
  unit_type: "level_unit",
@@ -6796,6 +6869,8 @@ var fir_areas = {
6796
6869
  location_indicator_atsu: "EZZZ",
6797
6870
  max_hours_of_validity: 4,
6798
6871
  hours_before_validity: 4,
6872
+ movement_rounding_kt: 5,
6873
+ movement_rounding_kmh: 10,
6799
6874
  units: [
6800
6875
  {
6801
6876
  unit_type: "level_unit",
@@ -6807,7 +6882,8 @@ var fir_areas = {
6807
6882
  {
6808
6883
  unit_type: "movement_unit",
6809
6884
  allowed_units: [
6810
- "KT"
6885
+ "KT",
6886
+ "KMH"
6811
6887
  ]
6812
6888
  },
6813
6889
  {
@@ -6897,6 +6973,12 @@ var properties$3 = {
6897
6973
  hours_before_validity: {
6898
6974
  type: "number"
6899
6975
  },
6976
+ movement_rounding_kt: {
6977
+ type: "number"
6978
+ },
6979
+ movement_rounding_kmh: {
6980
+ type: "number"
6981
+ },
6900
6982
  level_min: {
6901
6983
  type: "object",
6902
6984
  additionalProperties: {
@@ -6909,6 +6991,15 @@ var properties$3 = {
6909
6991
  type: "number"
6910
6992
  }
6911
6993
  },
6994
+ level_rounding_FL: {
6995
+ type: "number"
6996
+ },
6997
+ level_rounding_FT: {
6998
+ type: "number"
6999
+ },
7000
+ level_rounding_M: {
7001
+ type: "number"
7002
+ },
6912
7003
  movement_min: {
6913
7004
  type: "object",
6914
7005
  additionalProperties: {
@@ -7009,22 +7100,12 @@ var properties$2 = {
7009
7100
  ]
7010
7101
  },
7011
7102
  properties: {
7012
- oneOf: [
7013
- {
7014
- type: "null"
7015
- },
7016
- {
7017
- type: "object",
7018
- properties: {
7019
- selectionType: {
7020
- type: "string"
7021
- }
7022
- },
7023
- required: [
7024
- "selectionType"
7025
- ]
7103
+ type: "object",
7104
+ properties: {
7105
+ selectionType: {
7106
+ type: "string"
7026
7107
  }
7027
- ]
7108
+ }
7028
7109
  },
7029
7110
  geometry: {
7030
7111
  oneOf: [
@@ -7717,6 +7798,12 @@ var properties = {
7717
7798
  },
7718
7799
  visibility_min: {
7719
7800
  type: "number"
7801
+ },
7802
+ visibility_rounding_below: {
7803
+ type: "number"
7804
+ },
7805
+ visibility_rounding_above: {
7806
+ type: "number"
7720
7807
  }
7721
7808
  },
7722
7809
  required: [
package/index.umd.js CHANGED
@@ -1440,27 +1440,65 @@
1440
1440
  }))));
1441
1441
  };
1442
1442
 
1443
- var invalidLevelsTill4900FTStepsMessage = 'Levels must be rounded to the nearest 100ft';
1444
- var invalidLevelsFrom50FLStepsMessage = 'Levels must be rounded to the nearest 5';
1443
+ var DEFAULT_ROUNDING_LEVELS_FL = 100;
1444
+ var DEFAULT_ROUNDING_LEVELS_FT = 5;
1445
+ var DEFAULT_ROUNDING_LEVELS_M = 1;
1446
+ var getLevelInvalidStepsForFLUnitMessage = function getLevelInvalidStepsForFLUnitMessage(value) {
1447
+ if (value === void 0) {
1448
+ value = DEFAULT_ROUNDING_LEVELS_FL;
1449
+ }
1450
+
1451
+ return "Levels must be rounded to the nearest " + value;
1452
+ };
1453
+ var getLevelInvalidStepsForFTUnitMessage = function getLevelInvalidStepsForFTUnitMessage(value) {
1454
+ if (value === void 0) {
1455
+ value = DEFAULT_ROUNDING_LEVELS_FT;
1456
+ }
1457
+
1458
+ return "Levels must be rounded to the nearest " + value + "ft";
1459
+ };
1460
+ var getLevelInvalidStepsForMUnitMessage = function getLevelInvalidStepsForMUnitMessage(value) {
1461
+ if (value === void 0) {
1462
+ value = DEFAULT_ROUNDING_LEVELS_M;
1463
+ }
1464
+
1465
+ return "Levels must be rounded to the nearest " + value + "m";
1466
+ };
1467
+ var invalidUnitMessage$1 = 'Level unit not defined';
1445
1468
 
1446
- var _validateLevels = function validateLevels(value, unit) {
1469
+ var _validateLevels = function validateLevels(value, unit, productConfig, selectedFIR) {
1447
1470
  if (formFields.isEmpty(value)) {
1448
1471
  return true;
1449
- } // Parse to integer to check for steps
1472
+ }
1473
+
1474
+ var _a = getActiveFIRArea(selectedFIR, productConfig),
1475
+
1476
+ /* eslint-disable @typescript-eslint/naming-convention */
1477
+ _b = _a.level_rounding_FL,
1478
+
1479
+ /* eslint-disable @typescript-eslint/naming-convention */
1480
+ level_rounding_FL = _b === void 0 ? DEFAULT_ROUNDING_LEVELS_FL : _b,
1481
+ _c = _a.level_rounding_FT,
1482
+ level_rounding_FT = _c === void 0 ? DEFAULT_ROUNDING_LEVELS_FT : _c,
1483
+ _d = _a.level_rounding_M,
1484
+ level_rounding_M = _d === void 0 ? DEFAULT_ROUNDING_LEVELS_M : _d; // Parse to integer to check for steps
1450
1485
 
1451
1486
 
1452
1487
  var intLevel = parseInt(value, 10);
1453
1488
 
1454
1489
  if (exports.LevelUnits[unit] === exports.LevelUnits.FT) {
1455
- return intLevel % 100 === 0 || invalidLevelsTill4900FTStepsMessage;
1490
+ return intLevel % level_rounding_FT === 0 || getLevelInvalidStepsForFTUnitMessage(level_rounding_FT);
1456
1491
  }
1457
1492
 
1458
1493
  if (exports.LevelUnits[unit] === exports.LevelUnits.FL) {
1459
- return intLevel % 5 === 0 || invalidLevelsFrom50FLStepsMessage;
1460
- } // For meters the allowed step is 1, so always valid
1494
+ return intLevel % level_rounding_FL === 0 || getLevelInvalidStepsForFLUnitMessage(level_rounding_FL);
1495
+ }
1461
1496
 
1497
+ if (exports.LevelUnits[unit] === exports.LevelUnits.M) {
1498
+ return intLevel % level_rounding_M === 0 || getLevelInvalidStepsForMUnitMessage(level_rounding_M);
1499
+ }
1462
1500
 
1463
- return true;
1501
+ return invalidUnitMessage$1;
1464
1502
  };
1465
1503
  var invalidLevelUnitCombinationMessage = 'Invalid unit combination';
1466
1504
 
@@ -1600,7 +1638,7 @@
1600
1638
  },
1601
1639
  validateLevels: function validateLevels(value) {
1602
1640
  // level step depends on the unit
1603
- return _validateLevels(value, getValues('level.unit'));
1641
+ return _validateLevels(value, getValues('level.unit'), productConfig, selectedFIR);
1604
1642
  }
1605
1643
  }
1606
1644
  },
@@ -1674,7 +1712,7 @@
1674
1712
  },
1675
1713
  validateLevels: function validateLevels(value) {
1676
1714
  // level step depends on the unit
1677
- return _validateLevels(value, getValues('level.unit'));
1715
+ return _validateLevels(value, getValues('level.unit'), productConfig, selectedFIR);
1678
1716
  }
1679
1717
  }
1680
1718
  },
@@ -1769,7 +1807,7 @@
1769
1807
  },
1770
1808
  validateLevels: function validateLevels(value) {
1771
1809
  // level step depends on the unit
1772
- return _validateLevels(value, getValues('lowerLevel.unit'));
1810
+ return _validateLevels(value, getValues('lowerLevel.unit'), productConfig, selectedFIR);
1773
1811
  }
1774
1812
  }
1775
1813
  },
@@ -1853,7 +1891,7 @@
1853
1891
  },
1854
1892
  validateLevels: function validateLevels(value) {
1855
1893
  // level step depends on the unit
1856
- return _validateLevels(value, getValues('level.unit'));
1894
+ return _validateLevels(value, getValues('level.unit'), productConfig, selectedFIR);
1857
1895
  }
1858
1896
  }
1859
1897
  },
@@ -2119,23 +2157,48 @@
2119
2157
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2120
2158
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
2121
2159
  * */
2160
+ var DEFAULT_ROUNDING_MOVEMENT_KT = 5;
2161
+ var DEFAULT_ROUNDING_MOVEMENT_KMH = 10;
2162
+ var getMovementStepValKTMessage = function getMovementStepValKTMessage(value) {
2163
+ if (value === void 0) {
2164
+ value = DEFAULT_ROUNDING_MOVEMENT_KT;
2165
+ }
2166
+
2167
+ return "Speed should be rounded to the nearest " + value + "kt";
2168
+ };
2169
+ var getMovementStepValKMHMessage = function getMovementStepValKMHMessage(value) {
2170
+ if (value === void 0) {
2171
+ value = DEFAULT_ROUNDING_MOVEMENT_KMH;
2172
+ }
2173
+
2174
+ return "Speed should be rounded to the nearest " + value + "kmh";
2175
+ };
2122
2176
  var coordinatesEmptyMessage = 'An end position drawing is required when selecting End position';
2123
- var movementStepValMessageKT = 'Speed should be rounded to the nearest 5kt';
2124
- var movementStepValMessageKMH = 'Speed should be rounded to the nearest 10kmh';
2125
2177
  var noIntersectionMessage = 'The end position needs to be (partly) inside the FIR';
2126
2178
  var maximum6PointsMessage = 'The end position drawing allows a maximum of 6 individual points';
2127
2179
 
2128
- var _validateMovementSteps = function validateMovementSteps(value, unit) {
2129
- if (formFields.isEmpty(value)) return true; // Parse to integer to check for steps
2180
+ var _validateMovementSteps = function validateMovementSteps(value, unit, productConfig, selectedFIR) {
2181
+ if (formFields.isEmpty(value)) return true;
2182
+
2183
+ var _a = getActiveFIRArea(selectedFIR, productConfig),
2184
+
2185
+ /* eslint-disable @typescript-eslint/naming-convention */
2186
+ _b = _a.movement_rounding_kt,
2187
+
2188
+ /* eslint-disable @typescript-eslint/naming-convention */
2189
+ movement_rounding_kt = _b === void 0 ? DEFAULT_ROUNDING_MOVEMENT_KT : _b,
2190
+ _c = _a.movement_rounding_kmh,
2191
+ movement_rounding_kmh = _c === void 0 ? DEFAULT_ROUNDING_MOVEMENT_KMH : _c; // Parse to integer to check for steps
2192
+
2130
2193
 
2131
2194
  var intLevel = parseInt(value, 10);
2132
2195
 
2133
2196
  if (exports.MovementUnit[unit] === exports.MovementUnit.KT) {
2134
- return intLevel % 5 === 0 || movementStepValMessageKT;
2197
+ return intLevel % movement_rounding_kt === 0 || getMovementStepValKTMessage(movement_rounding_kt);
2135
2198
  }
2136
2199
 
2137
2200
  if (exports.MovementUnit[unit] === exports.MovementUnit.KMH) {
2138
- return intLevel % 10 === 0 || movementStepValMessageKMH;
2201
+ return intLevel % movement_rounding_kmh === 0 || getMovementStepValKMHMessage(movement_rounding_kmh);
2139
2202
  }
2140
2203
 
2141
2204
  return 'Invalid unit';
@@ -2290,7 +2353,7 @@
2290
2353
  },
2291
2354
  validateMovementSteps: function validateMovementSteps(value) {
2292
2355
  // movement step depends on the unit
2293
- return _validateMovementSteps(value, getValues('movementUnit'));
2356
+ return _validateMovementSteps(value, getValues('movementUnit'), productConfig, selectedFIR);
2294
2357
  }
2295
2358
  }
2296
2359
  },
@@ -2757,18 +2820,44 @@
2757
2820
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2758
2821
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2759
2822
  * */
2760
- var invalidSurfaceVisibilityTill750StepsMessage = 'A visibility below 750m must be rounded to the nearest 50m';
2761
- var invalidSurfaceVisibilityFrom750StepsMessage = 'A visibility above 750m must be rounded to the nearest 100m';
2762
- var validateSurfaceVisibility = function validateSurfaceVisibility(value) {
2763
- if (formFields.isEmpty(value)) return true; // Parse to integer to check for steps
2823
+ var DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW = 50;
2824
+ var DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE = 100;
2825
+ var getInvalidSurfaceVisibilityTill750StepsMessage = function getInvalidSurfaceVisibilityTill750StepsMessage(value) {
2826
+ if (value === void 0) {
2827
+ value = DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW;
2828
+ }
2829
+
2830
+ return "A visibility below 750m must be rounded to the nearest " + value + "m";
2831
+ };
2832
+ var getInvalidSurfaceVisibilityFrom750StepsMessage = function getInvalidSurfaceVisibilityFrom750StepsMessage(value) {
2833
+ if (value === void 0) {
2834
+ value = DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE;
2835
+ }
2836
+
2837
+ return "A visibility above 750m must be rounded to the nearest " + value + "m";
2838
+ };
2839
+
2840
+ var _validateSurfaceVisibility = function validateSurfaceVisibility(value, productConfig, selectedFIR) {
2841
+ if (formFields.isEmpty(value)) return true;
2842
+
2843
+ var _a = getActiveFIRArea(selectedFIR, productConfig),
2844
+
2845
+ /* eslint-disable @typescript-eslint/naming-convention */
2846
+ _b = _a.visibility_rounding_below,
2847
+
2848
+ /* eslint-disable @typescript-eslint/naming-convention */
2849
+ visibility_rounding_below = _b === void 0 ? DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW : _b,
2850
+ _c = _a.visibility_rounding_above,
2851
+ visibility_rounding_above = _c === void 0 ? DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE : _c; // Parse to integer to check for steps
2852
+
2764
2853
 
2765
2854
  var intVisibility = parseInt(value, 10);
2766
2855
 
2767
2856
  if (intVisibility > 750) {
2768
- return intVisibility % 100 === 0 || invalidSurfaceVisibilityFrom750StepsMessage;
2857
+ return intVisibility % visibility_rounding_above === 0 || getInvalidSurfaceVisibilityFrom750StepsMessage(visibility_rounding_above);
2769
2858
  }
2770
2859
 
2771
- return intVisibility % 50 === 0 || invalidSurfaceVisibilityTill750StepsMessage;
2860
+ return intVisibility % visibility_rounding_below === 0 || getInvalidSurfaceVisibilityTill750StepsMessage(visibility_rounding_below);
2772
2861
  };
2773
2862
 
2774
2863
  var SurfaceVisibility = function SurfaceVisibility(_a) {
@@ -2817,7 +2906,9 @@
2817
2906
  // The max level depends on the unit
2818
2907
  return formFields.isValidMax(value, getMaxVisibilityValue(selectedFIR, productConfig)) || "The maximum visibility in meters is " + getMaxVisibilityValue(selectedFIR, productConfig);
2819
2908
  },
2820
- validateSurfaceVisibility: validateSurfaceVisibility
2909
+ validateSurfaceVisibility: function validateSurfaceVisibility(value) {
2910
+ return _validateSurfaceVisibility(value, productConfig, selectedFIR);
2911
+ }
2821
2912
  }
2822
2913
  },
2823
2914
  disabled: isDisabled,
@@ -3912,6 +4003,9 @@
3912
4003
  FT: 4900,
3913
4004
  FL: 650
3914
4005
  },
4006
+ level_rounding_FL: 100,
4007
+ level_rounding_FT: 5,
4008
+ level_rounding_M: 1,
3915
4009
  movement_min: {
3916
4010
  KT: 5,
3917
4011
  KMH: 10
@@ -3920,6 +4014,8 @@
3920
4014
  KT: 150,
3921
4015
  KMH: 99
3922
4016
  },
4017
+ movement_rounding_kt: 5,
4018
+ movement_rounding_kmh: 10,
3923
4019
  units: [
3924
4020
  {
3925
4021
  unit_type: "level_unit",
@@ -5165,6 +5261,8 @@
5165
5261
  tc_hours_before_validity: 12,
5166
5262
  va_max_hours_of_validity: 6,
5167
5263
  va_hours_before_validity: 12,
5264
+ movement_rounding_kt: 20,
5265
+ movement_rounding_kmh: 30,
5168
5266
  adjacent_firs: [
5169
5267
  "EKDK",
5170
5268
  "EDWW",
@@ -5184,7 +5282,8 @@
5184
5282
  {
5185
5283
  unit_type: "movement_unit",
5186
5284
  allowed_units: [
5187
- "KT"
5285
+ "KT",
5286
+ "KMH"
5188
5287
  ]
5189
5288
  }
5190
5289
  ]
@@ -5414,6 +5513,8 @@
5414
5513
  },
5415
5514
  visibility_max: 4900,
5416
5515
  visibility_min: 0,
5516
+ visibility_rounding_below: 50,
5517
+ visibility_rounding_above: 100,
5417
5518
  level_min: {
5418
5519
  FT: 100,
5419
5520
  FL: 50
@@ -5422,6 +5523,9 @@
5422
5523
  FT: 4900,
5423
5524
  FL: 100
5424
5525
  },
5526
+ level_rounding_FL: 100,
5527
+ level_rounding_FT: 5,
5528
+ level_rounding_M: 1,
5425
5529
  movement_min: {
5426
5530
  KT: 5,
5427
5531
  KMH: 10
@@ -5430,6 +5534,8 @@
5430
5534
  KT: 150,
5431
5535
  KMH: 99
5432
5536
  },
5537
+ movement_rounding_kt: 5,
5538
+ movement_rounding_kmh: 10,
5433
5539
  units: [
5434
5540
  {
5435
5541
  unit_type: "level_unit",
@@ -6682,6 +6788,8 @@
6682
6788
  location_indicator_atsu: "EZZZ",
6683
6789
  max_hours_of_validity: 4,
6684
6790
  hours_before_validity: 4,
6791
+ movement_rounding_kt: 5,
6792
+ movement_rounding_kmh: 10,
6685
6793
  units: [
6686
6794
  {
6687
6795
  unit_type: "level_unit",
@@ -6693,7 +6801,8 @@
6693
6801
  {
6694
6802
  unit_type: "movement_unit",
6695
6803
  allowed_units: [
6696
- "KT"
6804
+ "KT",
6805
+ "KMH"
6697
6806
  ]
6698
6807
  },
6699
6808
  {
@@ -6783,6 +6892,12 @@
6783
6892
  hours_before_validity: {
6784
6893
  type: "number"
6785
6894
  },
6895
+ movement_rounding_kt: {
6896
+ type: "number"
6897
+ },
6898
+ movement_rounding_kmh: {
6899
+ type: "number"
6900
+ },
6786
6901
  level_min: {
6787
6902
  type: "object",
6788
6903
  additionalProperties: {
@@ -6795,6 +6910,15 @@
6795
6910
  type: "number"
6796
6911
  }
6797
6912
  },
6913
+ level_rounding_FL: {
6914
+ type: "number"
6915
+ },
6916
+ level_rounding_FT: {
6917
+ type: "number"
6918
+ },
6919
+ level_rounding_M: {
6920
+ type: "number"
6921
+ },
6798
6922
  movement_min: {
6799
6923
  type: "object",
6800
6924
  additionalProperties: {
@@ -6895,22 +7019,12 @@
6895
7019
  ]
6896
7020
  },
6897
7021
  properties: {
6898
- oneOf: [
6899
- {
6900
- type: "null"
6901
- },
6902
- {
6903
- type: "object",
6904
- properties: {
6905
- selectionType: {
6906
- type: "string"
6907
- }
6908
- },
6909
- required: [
6910
- "selectionType"
6911
- ]
7022
+ type: "object",
7023
+ properties: {
7024
+ selectionType: {
7025
+ type: "string"
6912
7026
  }
6913
- ]
7027
+ }
6914
7028
  },
6915
7029
  geometry: {
6916
7030
  oneOf: [
@@ -7603,6 +7717,12 @@
7603
7717
  },
7604
7718
  visibility_min: {
7605
7719
  type: "number"
7720
+ },
7721
+ visibility_rounding_below: {
7722
+ type: "number"
7723
+ },
7724
+ visibility_rounding_above: {
7725
+ type: "number"
7606
7726
  }
7607
7727
  },
7608
7728
  required: [
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
- import { ConfigurableFormFieldProps } from '../../../types';
3
- export declare const invalidLevelsTill4900FTStepsMessage = "Levels must be rounded to the nearest 100ft";
4
- export declare const invalidLevelsFrom50FLStepsMessage = "Levels must be rounded to the nearest 5";
5
- export declare const validateLevels: (value: string, unit: string) => boolean | string;
2
+ import { ConfigurableFormFieldProps, ProductConfig } from '../../../types';
3
+ export declare const DEFAULT_ROUNDING_LEVELS_FL = 100;
4
+ export declare const DEFAULT_ROUNDING_LEVELS_FT = 5;
5
+ export declare const DEFAULT_ROUNDING_LEVELS_M = 1;
6
+ export declare const getLevelInvalidStepsForFLUnitMessage: (value?: number) => string;
7
+ export declare const getLevelInvalidStepsForFTUnitMessage: (value?: number) => string;
8
+ export declare const getLevelInvalidStepsForMUnitMessage: (value?: number) => string;
9
+ export declare const invalidUnitMessage = "Level unit not defined";
10
+ export declare const validateLevels: (value: string, unit: string, productConfig: ProductConfig, selectedFIR: string) => boolean | string;
6
11
  export declare const invalidLevelUnitCombinationMessage = "Invalid unit combination";
7
12
  export declare const validateLevelUnitCombinations: (levelUnit: string, lowerLevelUnit: string) => boolean | string;
8
13
  declare const Levels: React.FC<ConfigurableFormFieldProps>;
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import { MapDrawMode, StartOrEndDrawing, SetMapDrawModes, MapGeoJSONS, ConfigurableFormFieldProps } from '../../../types';
2
+ import { MapDrawMode, StartOrEndDrawing, SetMapDrawModes, MapGeoJSONS, ConfigurableFormFieldProps, ProductConfig } from '../../../types';
3
+ export declare const DEFAULT_ROUNDING_MOVEMENT_KT = 5;
4
+ export declare const DEFAULT_ROUNDING_MOVEMENT_KMH = 10;
5
+ export declare const getMovementStepValKTMessage: (value?: number) => string;
6
+ export declare const getMovementStepValKMHMessage: (value?: number) => string;
3
7
  export declare const coordinatesEmptyMessage = "An end position drawing is required when selecting End position";
4
- export declare const movementStepValMessageKT = "Speed should be rounded to the nearest 5kt";
5
- export declare const movementStepValMessageKMH = "Speed should be rounded to the nearest 10kmh";
6
8
  export declare const noIntersectionMessage = "The end position needs to be (partly) inside the FIR";
7
9
  export declare const maximum6PointsMessage = "The end position drawing allows a maximum of 6 individual points";
8
- export declare const validateMovementSteps: (value: string, unit: string) => boolean | string;
10
+ export declare const validateMovementSteps: (value: string, unit: string, productConfig: ProductConfig, selectedFIR: string) => boolean | string;
9
11
  interface ProgressProps extends ConfigurableFormFieldProps {
10
12
  drawMode?: SetMapDrawModes;
11
13
  geoJSONs?: MapGeoJSONS;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
- import { ConfigurableFormFieldProps } from '../../../types';
3
- export declare const invalidSurfaceVisibilityTill750StepsMessage = "A visibility below 750m must be rounded to the nearest 50m";
4
- export declare const invalidSurfaceVisibilityFrom750StepsMessage = "A visibility above 750m must be rounded to the nearest 100m";
5
- export declare const validateSurfaceVisibility: (value: string) => boolean | string;
2
+ import { ConfigurableFormFieldProps, ProductConfig } from '../../../types';
3
+ export declare const DEFAULT_ROUNDING_SURFACE_VISIBLILITY_BELOW = 50;
4
+ export declare const DEFAULT_ROUNDING_SURFACE_VISIBLILITY_ABOVE = 100;
5
+ export declare const getInvalidSurfaceVisibilityTill750StepsMessage: (value?: number) => string;
6
+ export declare const getInvalidSurfaceVisibilityFrom750StepsMessage: (value?: number) => string;
7
+ export declare const validateSurfaceVisibility: (value: string, productConfig: ProductConfig, selectedFIR: string) => boolean | string;
6
8
  declare const SurfaceVisibility: React.FC<ConfigurableFormFieldProps>;
7
9
  export default SurfaceVisibility;
package/lib/types.d.ts CHANGED
@@ -371,8 +371,13 @@ export declare type FIRArea = {
371
371
  hours_before_validity: number;
372
372
  level_min?: LevelMinMaxType;
373
373
  level_max?: LevelMinMaxType;
374
+ level_rounding_FL?: number;
375
+ level_rounding_FT?: number;
376
+ level_rounding_M?: number;
374
377
  movement_min?: MovementMinMaxType;
375
378
  movement_max?: MovementMinMaxType;
379
+ movement_rounding_kt?: number;
380
+ movement_rounding_kmh?: number;
376
381
  units: AllowedUnits[];
377
382
  };
378
383
  export interface FIRConfigSigmet extends FIRArea {
@@ -395,6 +400,8 @@ export interface FIRConfigAirmet extends FIRArea {
395
400
  wind_speed_min?: SurfaceWindMinMaxType;
396
401
  visibility_max?: number;
397
402
  visibility_min?: number;
403
+ visibility_rounding_below?: number;
404
+ visibility_rounding_above?: number;
398
405
  }
399
406
  declare type SigmetFIRArea = Record<string, FIRConfigSigmet>;
400
407
  declare type AirmetFIRArea = Record<string, FIRConfigAirmet>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "4.14.1",
3
+ "version": "4.15.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,26 +14,26 @@
14
14
  "react": "^18.2.0",
15
15
  "react-redux": "^8.0.4",
16
16
  "@mui/material": "^5.10.8",
17
- "@opengeoweb/shared": "4.14.1",
18
- "@opengeoweb/theme": "4.14.1",
17
+ "@opengeoweb/shared": "4.15.0",
18
+ "@opengeoweb/theme": "4.15.0",
19
19
  "react-draggable": "^4.4.5",
20
20
  "re-resizable": "^6.9.0",
21
21
  "@redux-eggs/core": "^2.2.0",
22
22
  "lodash": "^4.17.20",
23
23
  "axios": "^0.25.0",
24
24
  "date-fns": "^2.29.3",
25
- "@opengeoweb/core": "4.14.1",
25
+ "@opengeoweb/core": "4.15.0",
26
26
  "moment": "^2.29.0",
27
- "@opengeoweb/webmap": "4.14.1",
27
+ "@opengeoweb/webmap": "4.15.0",
28
28
  "throttle-debounce": "^3.0.1",
29
29
  "proj4": "^2.6.2",
30
- "@opengeoweb/api": "4.14.1",
30
+ "@opengeoweb/api": "4.15.0",
31
31
  "react-intl": "^5.17.5",
32
32
  "react-sortablejs": "^6.1.4",
33
33
  "sortablejs": "^1.15.0",
34
34
  "immer": "^9.0.15",
35
35
  "react-window": "^1.8.7",
36
- "@opengeoweb/form-fields": "4.14.1",
36
+ "@opengeoweb/form-fields": "4.15.0",
37
37
  "react-hook-form": "^7.41.5",
38
38
  "moment-timezone": "^0.5.31",
39
39
  "@mui/x-date-pickers": "^5.0.4",