@aguacerowx/react-native 0.0.52 → 0.0.54
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/LICENSE +21 -0
- package/android/src/main/cpp/satellite_ktx_jni.cpp +6 -1
- package/android/src/main/java/com/aguacerowx/reactnative/NexradRadarLayerView.java +14 -2
- package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayer.java +121 -1
- package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayerView.java +556 -392
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +77 -0
- package/index.js +1 -1
- package/ios/SatelliteLayerView.swift +517 -517
- package/ios/WeatherFrameProcessorModule.m +19 -15
- package/ios/WeatherFrameProcessorModule.swift +65 -0
- package/lib/commonjs/AguaceroContext.js +0 -4
- package/lib/commonjs/AguaceroContext.js.map +1 -1
- package/lib/commonjs/GridRenderLayer.js +62 -76
- package/lib/commonjs/GridRenderLayer.js.map +1 -1
- package/lib/commonjs/MapManager.js +110 -224
- package/lib/commonjs/MapManager.js.map +1 -1
- package/lib/commonjs/MapRegistry.js +21 -33
- package/lib/commonjs/MapRegistry.js.map +1 -1
- package/lib/commonjs/NexradRadarLayer.android.js +28 -100
- package/lib/commonjs/NexradRadarLayer.android.js.map +1 -1
- package/lib/commonjs/NexradRadarLayer.ios.js +26 -97
- package/lib/commonjs/NexradRadarLayer.ios.js.map +1 -1
- package/lib/commonjs/NexradSitesMapLayer.js +41 -61
- package/lib/commonjs/NexradSitesMapLayer.js.map +1 -1
- package/lib/commonjs/SatelliteLayer.android.js +26 -38
- package/lib/commonjs/SatelliteLayer.android.js.map +1 -1
- package/lib/commonjs/SatelliteLayer.ios.js +30 -42
- package/lib/commonjs/SatelliteLayer.ios.js.map +1 -1
- package/lib/commonjs/StyleApplicator.js +129 -175
- package/lib/commonjs/StyleApplicator.js.map +1 -1
- package/lib/commonjs/WeatherLayerManager.js +996 -1627
- package/lib/commonjs/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/aguaceroCoreDebugHooks.js +58 -130
- package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -1
- package/lib/commonjs/aguaceroRnDebug.js +147 -287
- package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
- package/lib/commonjs/cdnAuthenticatedFetch.js +104 -0
- package/lib/commonjs/cdnAuthenticatedFetch.js.map +1 -0
- package/lib/commonjs/dispatchViewManagerCommandCompat.js +51 -88
- package/lib/commonjs/dispatchViewManagerCommandCompat.js.map +1 -1
- package/lib/commonjs/gridCdnAuth.js +41 -50
- package/lib/commonjs/gridCdnAuth.js.map +1 -1
- package/lib/commonjs/index.js +51 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nexrad/nexradAndroidController.js +851 -863
- package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
- package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/nexradDiag.js +32 -148
- package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
- package/lib/commonjs/nexrad/nexradLevel2Keys.js +261 -0
- package/lib/commonjs/nexrad/nexradLevel2Keys.js.map +1 -0
- package/lib/commonjs/nexrad/nexradLutBuild.js +64 -111
- package/lib/commonjs/nexrad/nexradLutBuild.js.map +1 -1
- package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js +136 -164
- package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/nexradSdkImports.js +51 -0
- package/lib/commonjs/nexrad/nexradSdkImports.js.map +1 -0
- package/lib/commonjs/nexrad/radarArchiveCore.bundled.js +2848 -4455
- package/lib/commonjs/nexrad/radarArchiveCore.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/radarDecode.worker.bundled.js +445 -648
- package/lib/commonjs/nexrad/radarDecode.worker.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js +52 -68
- package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
- package/lib/commonjs/nexradNativeCommandIds.js +24 -0
- package/lib/commonjs/nexradNativeCommandIds.js.map +1 -0
- package/lib/commonjs/nws/NwsAlertsOverlay.android.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.ios.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.js +3 -3
- package/lib/commonjs/nws/NwsAlertsOverlay.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.native.js +235 -361
- package/lib/commonjs/nws/NwsAlertsOverlay.native.js.map +1 -1
- package/lib/commonjs/nws/eventSourceRnPolyfill.js +92 -146
- package/lib/commonjs/nws/eventSourceRnPolyfill.js.map +1 -1
- package/lib/commonjs/nws/nwsAndroidConstants.js +2 -8
- package/lib/commonjs/nws/nwsAndroidConstants.js.map +1 -1
- package/lib/commonjs/satellite/satelliteAndroidController.js +122 -199
- package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/commonjs/satelliteBridgeDiag.js +3 -13
- package/lib/commonjs/satelliteBridgeDiag.js.map +1 -1
- package/lib/commonjs/satelliteRnDebug.js +160 -0
- package/lib/commonjs/satelliteRnDebug.js.map +1 -0
- package/lib/module/AguaceroContext.js +2 -7
- package/lib/module/AguaceroContext.js.map +1 -1
- package/lib/module/GridRenderLayer.js +66 -80
- package/lib/module/GridRenderLayer.js.map +1 -1
- package/lib/module/MapManager.js +125 -239
- package/lib/module/MapManager.js.map +1 -1
- package/lib/module/MapRegistry.js +21 -33
- package/lib/module/MapRegistry.js.map +1 -1
- package/lib/module/NexradRadarLayer.android.js +32 -104
- package/lib/module/NexradRadarLayer.android.js.map +1 -1
- package/lib/module/NexradRadarLayer.ios.js +30 -101
- package/lib/module/NexradRadarLayer.ios.js.map +1 -1
- package/lib/module/NexradSitesMapLayer.js +44 -63
- package/lib/module/NexradSitesMapLayer.js.map +1 -1
- package/lib/module/SatelliteLayer.android.js +32 -44
- package/lib/module/SatelliteLayer.android.js.map +1 -1
- package/lib/module/SatelliteLayer.ios.js +36 -48
- package/lib/module/SatelliteLayer.ios.js.map +1 -1
- package/lib/module/StyleApplicator.js +144 -191
- package/lib/module/StyleApplicator.js.map +1 -1
- package/lib/module/WeatherLayerManager.js +1024 -1655
- package/lib/module/WeatherLayerManager.js.map +1 -1
- package/lib/module/aguaceroCoreDebugHooks.js +59 -130
- package/lib/module/aguaceroCoreDebugHooks.js.map +1 -1
- package/lib/module/aguaceroRnDebug.js +151 -291
- package/lib/module/aguaceroRnDebug.js.map +1 -1
- package/lib/module/cdnAuthenticatedFetch.js +97 -0
- package/lib/module/cdnAuthenticatedFetch.js.map +1 -0
- package/lib/module/dispatchViewManagerCommandCompat.js +52 -90
- package/lib/module/dispatchViewManagerCommandCompat.js.map +1 -1
- package/lib/module/gridCdnAuth.js +38 -50
- package/lib/module/gridCdnAuth.js.map +1 -1
- package/lib/module/index.js +9 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/nexrad/nexradAndroidController.js +865 -876
- package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
- package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
- package/lib/module/nexrad/nexradDiag.js +31 -145
- package/lib/module/nexrad/nexradDiag.js.map +1 -1
- package/lib/module/nexrad/nexradLevel2Keys.js +245 -0
- package/lib/module/nexrad/nexradLevel2Keys.js.map +1 -0
- package/lib/module/nexrad/nexradLutBuild.js +64 -110
- package/lib/module/nexrad/nexradLutBuild.js.map +1 -1
- package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js +136 -163
- package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
- package/lib/module/nexrad/nexradSdkImports.js +4 -0
- package/lib/module/nexrad/nexradSdkImports.js.map +1 -0
- package/lib/module/nexrad/radarArchiveCore.bundled.js +2839 -4448
- package/lib/module/nexrad/radarArchiveCore.bundled.js.map +1 -1
- package/lib/module/nexrad/radarDecode.worker.bundled.js +445 -648
- package/lib/module/nexrad/radarDecode.worker.bundled.js.map +1 -1
- package/lib/module/nexrad/radarFrameGpuMatch.bundled.js +50 -66
- package/lib/module/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
- package/lib/module/nexradNativeCommandIds.js +18 -0
- package/lib/module/nexradNativeCommandIds.js.map +1 -0
- package/lib/module/nws/NwsAlertsOverlay.android.js +1 -1
- package/lib/module/nws/NwsAlertsOverlay.android.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.ios.js +1 -1
- package/lib/module/nws/NwsAlertsOverlay.ios.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.js +5 -5
- package/lib/module/nws/NwsAlertsOverlay.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.native.js +248 -373
- package/lib/module/nws/NwsAlertsOverlay.native.js.map +1 -1
- package/lib/module/nws/eventSourceRnPolyfill.js +92 -146
- package/lib/module/nws/eventSourceRnPolyfill.js.map +1 -1
- package/lib/module/nws/nwsAndroidConstants.js +2 -8
- package/lib/module/nws/nwsAndroidConstants.js.map +1 -1
- package/lib/module/satellite/satelliteAndroidController.js +125 -202
- package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/module/satelliteBridgeDiag.js +3 -13
- package/lib/module/satelliteBridgeDiag.js.map +1 -1
- package/lib/module/satelliteRnDebug.js +148 -0
- package/lib/module/satelliteRnDebug.js.map +1 -0
- package/lib/typescript/AguaceroContext.d.ts +0 -4
- package/lib/typescript/AguaceroContext.d.ts.map +1 -1
- package/lib/typescript/GridRenderLayer.d.ts.map +1 -1
- package/lib/typescript/MapManager.d.ts +0 -12
- package/lib/typescript/MapManager.d.ts.map +1 -1
- package/lib/typescript/MapRegistry.d.ts +10 -12
- package/lib/typescript/MapRegistry.d.ts.map +1 -1
- package/lib/typescript/NexradRadarLayer.android.d.ts.map +1 -1
- package/lib/typescript/NexradRadarLayer.ios.d.ts.map +1 -1
- package/lib/typescript/NexradSitesMapLayer.d.ts +4 -10
- package/lib/typescript/NexradSitesMapLayer.d.ts.map +1 -1
- package/lib/typescript/SatelliteLayer.android.d.ts.map +1 -1
- package/lib/typescript/SatelliteLayer.ios.d.ts.map +1 -1
- package/lib/typescript/StyleApplicator.d.ts +1 -1
- package/lib/typescript/StyleApplicator.d.ts.map +1 -1
- package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts +2 -9
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -1
- package/lib/typescript/aguaceroRnDebug.d.ts +47 -66
- package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
- package/lib/typescript/cdnAuthenticatedFetch.d.ts +10 -0
- package/lib/typescript/cdnAuthenticatedFetch.d.ts.map +1 -0
- package/lib/typescript/dispatchViewManagerCommandCompat.d.ts +1 -17
- package/lib/typescript/dispatchViewManagerCommandCompat.d.ts.map +1 -1
- package/lib/typescript/gridCdnAuth.d.ts +16 -21
- package/lib/typescript/gridCdnAuth.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/nexrad/nexradAndroidController.d.ts +39 -89
- package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts +2 -1
- package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradDiag.d.ts +13 -101
- package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradLevel2Keys.d.ts +36 -0
- package/lib/typescript/nexrad/nexradLevel2Keys.d.ts.map +1 -0
- package/lib/typescript/nexrad/nexradLutBuild.d.ts +3 -10
- package/lib/typescript/nexrad/nexradLutBuild.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts +4 -3
- package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradSdkImports.d.ts +2 -0
- package/lib/typescript/nexrad/nexradSdkImports.d.ts.map +1 -0
- package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts +12 -7
- package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts +20 -20
- package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts +4 -3
- package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts.map +1 -1
- package/lib/typescript/nexradNativeCommandIds.d.ts +2 -0
- package/lib/typescript/nexradNativeCommandIds.d.ts.map +1 -0
- package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts +6 -17
- package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts.map +1 -1
- package/lib/typescript/nws/eventSourceRnPolyfill.d.ts +0 -3
- package/lib/typescript/nws/eventSourceRnPolyfill.d.ts.map +1 -1
- package/lib/typescript/nws/nwsAndroidConstants.d.ts +0 -5
- package/lib/typescript/nws/nwsAndroidConstants.d.ts.map +1 -1
- package/lib/typescript/satellite/satelliteAndroidController.d.ts +9 -47
- package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
- package/lib/typescript/satelliteBridgeDiag.d.ts +1 -5
- package/lib/typescript/satelliteBridgeDiag.d.ts.map +1 -1
- package/lib/typescript/satelliteRnDebug.d.ts +75 -0
- package/lib/typescript/satelliteRnDebug.d.ts.map +1 -0
- package/package.json +75 -74
- package/src/AguaceroContext.js +1 -7
- package/src/GridRenderLayer.js +1 -128
- package/src/MapManager.js +1 -277
- package/src/MapRegistry.js +1 -56
- package/src/NexradRadarLayer.android.js +1 -121
- package/src/NexradRadarLayer.ios.js +1 -115
- package/src/NexradSitesMapLayer.js +1 -75
- package/src/SatelliteLayer.android.js +1 -63
- package/src/SatelliteLayer.ios.js +1 -70
- package/src/StyleApplicator.js +1 -241
- package/src/WeatherLayerManager.js +1 -2025
- package/src/aguaceroCoreDebugHooks.js +1 -142
- package/src/aguaceroRnDebug.js +1 -335
- package/src/cdnAuthenticatedFetch.js +1 -0
- package/src/dispatchViewManagerCommandCompat.js +1 -100
- package/src/gridCdnAuth.js +1 -56
- package/src/index.js +1 -19
- package/src/nexrad/nexradAndroidController.js +1 -1078
- package/src/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +1 -91
- package/src/nexrad/nexradDiag.js +1 -150
- package/src/nexrad/nexradLevel2Keys.js +1 -0
- package/src/nexrad/nexradLutBuild.js +1 -126
- package/src/nexrad/nexradMapboxFrameOpts.bundled.js +1 -245
- package/src/nexrad/nexradSdkImports.js +1 -0
- package/src/nexrad/radarArchiveCore.bundled.js +1 -7085
- package/src/nexrad/radarDecode.worker.bundled.js +1 -813
- package/src/nexrad/radarFrameGpuMatch.bundled.js +1 -79
- package/src/nexradNativeCommandIds.js +1 -0
- package/src/nws/NwsAlertsOverlay.android.js +1 -1
- package/src/nws/NwsAlertsOverlay.ios.js +1 -1
- package/src/nws/NwsAlertsOverlay.js +1 -7
- package/src/nws/NwsAlertsOverlay.native.js +1 -463
- package/src/nws/eventSourceRnPolyfill.js +7 -193
- package/src/nws/nwsAndroidConstants.js +1 -8
- package/src/satellite/satelliteAndroidController.js +1 -245
- package/src/satelliteBridgeDiag.js +1 -15
- package/src/satelliteRnDebug.js +1 -0
- package/lib/commonjs/nexrad/nexradNativeCommandIds.js +0 -51
- package/lib/commonjs/nexrad/nexradNativeCommandIds.js.map +0 -1
- package/lib/module/nexrad/nexradNativeCommandIds.js +0 -44
- package/lib/module/nexrad/nexradNativeCommandIds.js.map +0 -1
- package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts +0 -9
- package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts.map +0 -1
- package/src/nexrad/nexradNativeCommandIds.js +0 -44
- /package/lib/commonjs/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
- /package/lib/module/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
- /package/src/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
|
@@ -13,1811 +13,1180 @@ var _GridRenderLayer = require("./GridRenderLayer");
|
|
|
13
13
|
var _NexradRadarLayer = _interopRequireDefault(require("./NexradRadarLayer"));
|
|
14
14
|
var _SatelliteLayer = _interopRequireDefault(require("./SatelliteLayer"));
|
|
15
15
|
var _NexradSitesMapLayer = require("./NexradSitesMapLayer");
|
|
16
|
-
var _nexradAndroidController = require("./nexrad/nexradAndroidController");
|
|
17
16
|
var _satelliteAndroidController = require("./satellite/satelliteAndroidController");
|
|
17
|
+
var _nexradAndroidController = require("./nexrad/nexradAndroidController");
|
|
18
|
+
var _cdnAuthenticatedFetch = require("./cdnAuthenticatedFetch");
|
|
19
|
+
var _radarArchiveCoreBundled = require("./nexrad/radarArchiveCore.bundled.js");
|
|
18
20
|
var _NwsAlertsOverlay = _interopRequireDefault(require("./nws/NwsAlertsOverlay"));
|
|
19
21
|
var _MapRegistry = require("./MapRegistry");
|
|
20
22
|
var _satelliteBridgeDiag = require("./satelliteBridgeDiag");
|
|
21
23
|
var _aguaceroRnDebug = require("./aguaceroRnDebug");
|
|
22
24
|
var _aguaceroCoreDebugHooks = require("./aguaceroCoreDebugHooks");
|
|
23
25
|
var _gridCdnAuth = require("./gridCdnAuth");
|
|
26
|
+
var _satelliteRnDebug = require("./satelliteRnDebug");
|
|
24
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
28
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const SATELLITE_NATIVE = _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios';
|
|
30
|
-
(0, _satelliteBridgeDiag.satBridgeWarn)('SDK fingerprint', {
|
|
29
|
+
const Q = _reactNative.Platform.OS === "android" || _reactNative.Platform.OS === "ios",
|
|
30
|
+
ie = _reactNative.Platform.OS === "android" || _reactNative.Platform.OS === "ios";
|
|
31
|
+
(0, _satelliteBridgeDiag.satBridgeWarn)("SDK fingerprint", {
|
|
31
32
|
platform: _reactNative.Platform.OS,
|
|
32
|
-
SATELLITE_NATIVE,
|
|
33
|
-
note:
|
|
33
|
+
SATELLITE_NATIVE: ie,
|
|
34
|
+
note: "If you never see sat-bridge logs, the app bundle is not loading this WeatherLayerManager build."
|
|
34
35
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const hours = (0, _javascriptSdk.parseTimelineDurationHours)(core.state.mrmsDurationValue);
|
|
44
|
-
let list = [...raw].map(t => Number(t)).filter(t => !Number.isNaN(t)).sort((a, b) => a - b);
|
|
45
|
-
if (hours > 0 && list.length > 0) {
|
|
46
|
-
const latest = list[list.length - 1];
|
|
47
|
-
const cutoff = latest - hours * 3600;
|
|
48
|
-
list = list.filter(t => t >= cutoff);
|
|
36
|
+
function Kt(m, x) {
|
|
37
|
+
const g = m.mrmsStatus?.[x];
|
|
38
|
+
if (!g || !g.length) return [];
|
|
39
|
+
const I = (0, _javascriptSdk.parseTimelineDurationHours)(m.state.mrmsDurationValue);
|
|
40
|
+
let v = [...g].map(O => Number(O)).filter(O => !Number.isNaN(O)).sort((O, _) => O - _);
|
|
41
|
+
if (I > 0 && v.length > 0) {
|
|
42
|
+
const O = v[v.length - 1] - I * 3600;
|
|
43
|
+
v = v.filter(_ => _ >= O);
|
|
49
44
|
}
|
|
50
|
-
return
|
|
45
|
+
return v;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* {@code setNexradDurationValue}; mirror those methods here using the same logic as the SDK.
|
|
56
|
-
*/
|
|
57
|
-
async function applyMrmsDurationValue(core, value) {
|
|
58
|
-
if (typeof core.setMRMSDurationValue === 'function') {
|
|
59
|
-
await core.setMRMSDurationValue(value);
|
|
47
|
+
async function qt(m, x) {
|
|
48
|
+
if (typeof m.setMRMSDurationValue == "function") {
|
|
49
|
+
await m.setMRMSDurationValue(x);
|
|
60
50
|
return;
|
|
61
51
|
}
|
|
62
|
-
const
|
|
63
|
-
await
|
|
64
|
-
mrmsDurationValue:
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
mrmsTimestamp: filtered[filtered.length - 1]
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async function applyNexradDurationValue(core, value) {
|
|
77
|
-
if (typeof core.setNexradDurationValue === 'function') {
|
|
78
|
-
await core.setNexradDurationValue(value);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const v = (0, _javascriptSdk.formatTimelineDurationValue)(value);
|
|
82
|
-
await core.setState({
|
|
83
|
-
nexradDurationValue: v
|
|
84
|
-
});
|
|
85
|
-
if (!core.state.isNexrad || !core.state.nexradSite) return;
|
|
86
|
-
if (typeof core.refreshNexradTimes === 'function') {
|
|
87
|
-
await core.refreshNexradTimes();
|
|
88
|
-
}
|
|
89
|
-
const nk = typeof core._nexradTimesCacheKey === 'function' ? core._nexradTimesCacheKey() : null;
|
|
90
|
-
const raw = nk ? core.nexradTimesByStation?.[nk]?.unixTimes || [] : [];
|
|
91
|
-
const filtered = typeof core._getFilteredNexradTimestampsForVariable === 'function' ? core._getFilteredNexradTimestampsForVariable(raw) : [...raw].map(t => Number(t)).filter(t => !Number.isNaN(t)).sort((a, b) => a - b);
|
|
92
|
-
if (!filtered || filtered.length === 0) return;
|
|
93
|
-
const curN = core.state.nexradTimestamp == null ? null : Number(core.state.nexradTimestamp);
|
|
94
|
-
if (curN == null || !filtered.includes(curN)) {
|
|
95
|
-
await core.setState({
|
|
96
|
-
nexradTimestamp: filtered[filtered.length - 1]
|
|
97
|
-
});
|
|
98
|
-
}
|
|
52
|
+
const g = (0, _javascriptSdk.formatTimelineDurationValue)(x);
|
|
53
|
+
if (await m.setState({
|
|
54
|
+
mrmsDurationValue: g
|
|
55
|
+
}), !m.state.isMRMS || !m.state.variable) return;
|
|
56
|
+
const I = typeof m._getFilteredMrmsTimestampsForVariable == "function" ? m._getFilteredMrmsTimestampsForVariable(m.state.variable) : Kt(m, m.state.variable);
|
|
57
|
+
if (!I || I.length === 0) return;
|
|
58
|
+
const v = m.state.mrmsTimestamp == null ? null : Number(m.state.mrmsTimestamp);
|
|
59
|
+
(v == null || !I.includes(v)) && (await m.setState({
|
|
60
|
+
mrmsTimestamp: I[I.length - 1]
|
|
61
|
+
}));
|
|
99
62
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
const
|
|
104
|
-
for (const
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
date:
|
|
110
|
-
run:
|
|
63
|
+
function Gt(m, x) {
|
|
64
|
+
const g = m?.[x];
|
|
65
|
+
if (!g) return null;
|
|
66
|
+
const I = Object.keys(g).sort((v, O) => O.localeCompare(v));
|
|
67
|
+
for (const v of I) {
|
|
68
|
+
const O = g[v];
|
|
69
|
+
if (!O) continue;
|
|
70
|
+
const _ = Object.keys(O).sort((ee, B) => B.localeCompare(ee));
|
|
71
|
+
if (_.length > 0) return {
|
|
72
|
+
date: v,
|
|
73
|
+
run: _[0]
|
|
111
74
|
};
|
|
112
75
|
}
|
|
113
76
|
return null;
|
|
114
77
|
}
|
|
115
78
|
const {
|
|
116
|
-
WeatherFrameProcessorModule,
|
|
117
|
-
InspectorModule
|
|
79
|
+
WeatherFrameProcessorModule: qe,
|
|
80
|
+
InspectorModule: kt
|
|
118
81
|
} = _reactNative.NativeModules;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* are populated; {@code core.state} is updated first. Merge so readouts match the active radar.
|
|
123
|
-
*
|
|
124
|
-
* @param {object | null} emitted
|
|
125
|
-
* @param {object | null} coreState
|
|
126
|
-
*/
|
|
127
|
-
function mergeNexradEmittedWithCore(emitted, coreState) {
|
|
128
|
-
if (!emitted || !coreState) return null;
|
|
129
|
-
return {
|
|
130
|
-
...emitted,
|
|
131
|
-
nexradSite: coreState.nexradSite ?? emitted.nexradSite,
|
|
132
|
-
nexradTimestamp: coreState.nexradTimestamp ?? emitted.nexradTimestamp,
|
|
133
|
-
nexradProduct: coreState.nexradProduct ?? emitted.nexradProduct,
|
|
134
|
-
nexradTilt: coreState.nexradTilt ?? emitted.nexradTilt,
|
|
135
|
-
nexradDataSource: coreState.nexradDataSource ?? emitted.nexradDataSource,
|
|
136
|
-
nexradStormRelative: coreState.nexradStormRelative ?? emitted.nexradStormRelative
|
|
137
|
-
};
|
|
82
|
+
function ue(m) {
|
|
83
|
+
const x = Object.keys(m?.satelliteTimeToFileMap || {}).map(Number).filter(g => Number.isFinite(g)).sort((g, I) => g - I);
|
|
84
|
+
return x.length ? `${x.length}:${x[0]}:${x[x.length - 1]}` : "0";
|
|
138
85
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* Compact timeline identity for deduping {@code state:change}: extending the NEXRAD/satellite window
|
|
142
|
-
* often keeps the same selected unix — without this, {@link WeatherLayerManager} short-circuits and
|
|
143
|
-
* never calls native {@code sync} / preload with the expanded frame list.
|
|
144
|
-
*/
|
|
145
|
-
function nexradObsTimelineSig(state) {
|
|
146
|
-
const arr = [...(state?.availableNexradTimestamps || [])].map(Number).filter(t => Number.isFinite(t)).sort((a, b) => a - b);
|
|
147
|
-
if (!arr.length) return '0';
|
|
148
|
-
return `${arr.length}:${arr[0]}:${arr[arr.length - 1]}`;
|
|
149
|
-
}
|
|
150
|
-
function satelliteObsTimelineSig(state) {
|
|
151
|
-
const keys = Object.keys(state?.satelliteTimeToFileMap || {}).map(Number).filter(t => Number.isFinite(t)).sort((a, b) => a - b);
|
|
152
|
-
if (!keys.length) return '0';
|
|
153
|
-
return `${keys.length}:${keys[0]}:${keys[keys.length - 1]}`;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** True when {@link WeatherLayerManager} `debug` / {@link configureAguaceroRnDebug}, or legacy `__AGUACERO_WX_GRID_DEBUG__`. */
|
|
157
|
-
function wxGridDebugEnabled() {
|
|
158
|
-
if ((0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)()) return true;
|
|
86
|
+
function pt() {
|
|
87
|
+
if ((0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)()) return !0;
|
|
159
88
|
try {
|
|
160
|
-
|
|
161
|
-
return Boolean(typeof globalThis !== 'undefined' && globalThis.__AGUACERO_WX_GRID_DEBUG__);
|
|
89
|
+
return typeof __DEV__ < "u" && __DEV__ ? !0 : !!(typeof globalThis < "u" && globalThis.__AGUACERO_WX_GRID_DEBUG__);
|
|
162
90
|
} catch {
|
|
163
|
-
return
|
|
91
|
+
return !1;
|
|
164
92
|
}
|
|
165
93
|
}
|
|
166
|
-
function
|
|
167
|
-
|
|
168
|
-
if (detail !== undefined) {
|
|
169
|
-
console.log(`[AguaceroWX][grid][${tag}]`, detail);
|
|
170
|
-
} else {
|
|
171
|
-
console.log(`[AguaceroWX][grid][${tag}]`);
|
|
172
|
-
}
|
|
94
|
+
function z(m, x) {
|
|
95
|
+
pt() && (x !== void 0 ? console.log(`[AguaceroWX][grid][${m}]`, x) : console.log(`[AguaceroWX][grid][${m}]`));
|
|
173
96
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
function wxGridWarn(tag, detail) {
|
|
177
|
-
if (detail !== undefined) {
|
|
178
|
-
console.warn(`[AguaceroWX][grid][${tag}]`, detail);
|
|
179
|
-
} else {
|
|
180
|
-
console.warn(`[AguaceroWX][grid][${tag}]`);
|
|
181
|
-
}
|
|
97
|
+
function Z(m, x) {
|
|
98
|
+
x !== void 0 ? console.warn(`[AguaceroWX][grid][${m}]`, x) : console.warn(`[AguaceroWX][grid][${m}]`);
|
|
182
99
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
* @param {string | undefined} gridRequestSiteOrigin - prop or core origin (see {@link resolveGridRequestSiteOrigin})
|
|
193
|
-
* @param {import('@aguacerowx/javascript-sdk').AguaceroCore | null | undefined} core
|
|
194
|
-
*/
|
|
195
|
-
function buildGridFrameProcessOptions(baseGridUrl, resourcePath, apiKey, bundleId, gridRequestSiteOrigin, core) {
|
|
196
|
-
const trimmedKey = typeof apiKey === 'string' ? apiKey.trim() : apiKey;
|
|
197
|
-
const url = `${baseGridUrl}${resourcePath}?apiKey=${encodeURIComponent(trimmedKey || '')}`;
|
|
198
|
-
const options = {
|
|
199
|
-
url,
|
|
200
|
-
apiKey: trimmedKey,
|
|
201
|
-
bundleId
|
|
202
|
-
};
|
|
203
|
-
const origin = (0, _gridCdnAuth.resolveGridRequestSiteOrigin)(gridRequestSiteOrigin, core);
|
|
204
|
-
if (origin) {
|
|
205
|
-
options.gridRequestSiteOrigin = origin;
|
|
206
|
-
}
|
|
207
|
-
return options;
|
|
100
|
+
function Ze(m, x, g, I, v, O) {
|
|
101
|
+
const _ = `${m}${x}`;
|
|
102
|
+
return (0, _gridCdnAuth.buildNativeCloudFrontFetchOptions)({
|
|
103
|
+
url: _,
|
|
104
|
+
apiKey: g,
|
|
105
|
+
bundleId: I,
|
|
106
|
+
gridRequestSiteOrigin: v,
|
|
107
|
+
core: O
|
|
108
|
+
});
|
|
208
109
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
let lower = stops[0];
|
|
232
|
-
let upper = stops[stops.length - 1];
|
|
233
|
-
for (let j = 0; j < stops.length - 1; j++) {
|
|
234
|
-
if (val >= stops[j].value && val <= stops[j + 1].value) {
|
|
235
|
-
lower = stops[j];
|
|
236
|
-
upper = stops[j + 1];
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
110
|
+
const et = m => {
|
|
111
|
+
const x = new Uint8Array(1024),
|
|
112
|
+
g = m.reduce((_, ee, B) => B % 2 === 0 ? [..._, {
|
|
113
|
+
value: m[B],
|
|
114
|
+
color: m[B + 1]
|
|
115
|
+
}] : _, []);
|
|
116
|
+
if (g.length === 0) return x;
|
|
117
|
+
const I = g[0].value,
|
|
118
|
+
v = g[g.length - 1].value,
|
|
119
|
+
O = _ => {
|
|
120
|
+
const ee = parseInt(_.slice(1, 3), 16),
|
|
121
|
+
B = parseInt(_.slice(3, 5), 16),
|
|
122
|
+
fe = parseInt(_.slice(5, 7), 16);
|
|
123
|
+
return [ee, B, fe];
|
|
124
|
+
};
|
|
125
|
+
for (let _ = 0; _ < 256; _++) {
|
|
126
|
+
const ee = I + _ / 255 * (v - I);
|
|
127
|
+
let B = g[0],
|
|
128
|
+
fe = g[g.length - 1];
|
|
129
|
+
for (let J = 0; J < g.length - 1; J++) if (ee >= g[J].value && ee <= g[J + 1].value) {
|
|
130
|
+
B = g[J], fe = g[J + 1];
|
|
131
|
+
break;
|
|
239
132
|
}
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
data[offset + 1] = Math.round(rgb[1]);
|
|
247
|
-
data[offset + 2] = Math.round(rgb[2]);
|
|
248
|
-
data[offset + 3] = 255;
|
|
133
|
+
const Ae = (ee - B.value) / (fe.value - B.value || 1),
|
|
134
|
+
Pe = O(B.color),
|
|
135
|
+
xe = O(fe.color),
|
|
136
|
+
$e = Pe.map((J, Ge) => J * (1 - Ae) + xe[Ge] * Ae),
|
|
137
|
+
Te = _ * 4;
|
|
138
|
+
x[Te + 0] = Math.round($e[0]), x[Te + 1] = Math.round($e[1]), x[Te + 2] = Math.round($e[2]), x[Te + 3] = 255;
|
|
249
139
|
}
|
|
250
|
-
return
|
|
140
|
+
return x;
|
|
251
141
|
};
|
|
252
|
-
_javascriptSdk.AguaceroCore.prototype.setMapCenter = function (
|
|
253
|
-
this.emit(
|
|
142
|
+
_javascriptSdk.AguaceroCore.prototype.setMapCenter = function (m) {
|
|
143
|
+
this.emit("map:move", m);
|
|
254
144
|
};
|
|
255
|
-
const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _react.forwardRef)((
|
|
145
|
+
const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _react.forwardRef)((m, x) => {
|
|
256
146
|
const {
|
|
257
|
-
inspectorEnabled,
|
|
258
|
-
onInspect,
|
|
259
|
-
apiKey,
|
|
260
|
-
customColormaps,
|
|
261
|
-
initialMode,
|
|
262
|
-
initialVariable,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
gridRequestSiteOrigin,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
} = props;
|
|
147
|
+
inspectorEnabled: g,
|
|
148
|
+
onInspect: I,
|
|
149
|
+
apiKey: v,
|
|
150
|
+
customColormaps: O,
|
|
151
|
+
initialMode: _,
|
|
152
|
+
initialVariable: ee,
|
|
153
|
+
initialSatelliteId: B,
|
|
154
|
+
initialSatelliteSector: fe,
|
|
155
|
+
initialSatelliteProduct: Ae,
|
|
156
|
+
autoRefresh: Pe,
|
|
157
|
+
autoRefreshInterval: xe,
|
|
158
|
+
initialModel: $e,
|
|
159
|
+
belowID: Te,
|
|
160
|
+
watchesWarnings: J,
|
|
161
|
+
onNwsAlertClick: Ge,
|
|
162
|
+
gridRequestSiteOrigin: te,
|
|
163
|
+
debug: Ce = !1,
|
|
164
|
+
...Ht
|
|
165
|
+
} = m;
|
|
277
166
|
(0, _react.useEffect)(() => {
|
|
278
167
|
(0, _aguaceroRnDebug.configureAguaceroRnDebug)({
|
|
279
|
-
enabled:
|
|
168
|
+
enabled: !!Ce
|
|
280
169
|
});
|
|
281
|
-
}, [
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
170
|
+
}, [Ce]), (0, _react.useEffect)(() => {
|
|
171
|
+
if (Ce) return (0, _satelliteRnDebug.auditSatelliteIntegration)({
|
|
172
|
+
core: t,
|
|
173
|
+
satelliteLayerRef: Ne
|
|
174
|
+
}), (0, _satelliteRnDebug.installSatelliteDiagnosticListener)();
|
|
175
|
+
}, [Ce, t]);
|
|
176
|
+
const _e = (0, _react.useContext)(_AguaceroContext.AguaceroContext),
|
|
177
|
+
t = (0, _react.useMemo)(() => new _javascriptSdk.AguaceroCore({
|
|
178
|
+
apiKey: v,
|
|
179
|
+
customColormaps: O,
|
|
180
|
+
gridRequestSiteOrigin: te,
|
|
181
|
+
layerOptions: {
|
|
182
|
+
mode: _,
|
|
183
|
+
variable: ee,
|
|
184
|
+
model: $e,
|
|
185
|
+
...(_ === "satellite" ? {
|
|
186
|
+
satelliteId: B,
|
|
187
|
+
sector: fe,
|
|
188
|
+
satelliteProduct: Ae ?? ee
|
|
189
|
+
} : {})
|
|
190
|
+
},
|
|
191
|
+
autoRefresh: !1
|
|
192
|
+
}), [v, te]);
|
|
296
193
|
(0, _react.useEffect)(() => {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
snapshot: (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(core)
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}, [core, debug, gridRequestSiteOrigin, apiKey]);
|
|
314
|
-
const [watchesWarningsOptions, setWatchesWarningsOptions] = (0, _react.useState)(() => ({
|
|
315
|
-
alertInteractionEnabled: true,
|
|
316
|
-
...(watchesWarningsProp ?? {})
|
|
194
|
+
t && ((0, _aguaceroCoreDebugHooks.installAguaceroCoreDebugHooks)(t, {
|
|
195
|
+
gridRequestSiteOriginProp: te ?? null,
|
|
196
|
+
debugProp: !!Ce
|
|
197
|
+
}), (0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)() && !v && (0, _aguaceroRnDebug.aguaceroDebugWarn)("WeatherLayerManager.missingApiKey", {
|
|
198
|
+
hint: "apiKey prop is empty \u2014 all CDN requests will fail or return 403"
|
|
199
|
+
}), (0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)() && v && !te && (0, _aguaceroRnDebug.aguaceroDebugWarn)("WeatherLayerManager.missingGridOrigin", {
|
|
200
|
+
hint: "gridRequestSiteOrigin is not set \u2014 CloudFront often returns 403 without Origin/Referer on React Native",
|
|
201
|
+
snapshot: (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(t)
|
|
202
|
+
}));
|
|
203
|
+
}, [t, Ce, te, v]);
|
|
204
|
+
const [gt, tt] = (0, _react.useState)(() => ({
|
|
205
|
+
alertInteractionEnabled: !0,
|
|
206
|
+
...(J ?? {})
|
|
317
207
|
}));
|
|
318
208
|
(0, _react.useEffect)(() => {
|
|
319
|
-
|
|
320
|
-
...
|
|
321
|
-
...(
|
|
209
|
+
tt(r => ({
|
|
210
|
+
...r,
|
|
211
|
+
...(J ?? {})
|
|
322
212
|
}));
|
|
323
|
-
}, [
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
return null;
|
|
355
|
-
}
|
|
356
|
-
const emitted = lastEmittedStateForInspectRef.current;
|
|
357
|
-
if (!emitted) {
|
|
358
|
-
return null;
|
|
359
|
-
}
|
|
360
|
-
const st = mergeNexradEmittedWithCore(emitted, core.state);
|
|
361
|
-
if (!st?.nexradSite || st.nexradTimestamp == null) {
|
|
362
|
-
return null;
|
|
363
|
-
}
|
|
364
|
-
return ctl.getInspectPayload(lng, lat, st) ?? null;
|
|
365
|
-
}, [core, ensureNexradController]);
|
|
366
|
-
const ensureSatelliteController = (0, _react.useCallback)(() => {
|
|
367
|
-
if (!SATELLITE_NATIVE) return null;
|
|
368
|
-
if (!satelliteControllerRef.current) {
|
|
369
|
-
satelliteControllerRef.current = new _satelliteAndroidController.SatelliteAndroidController(core, satelliteLayerRef);
|
|
370
|
-
}
|
|
371
|
-
return satelliteControllerRef.current;
|
|
372
|
-
}, [core]);
|
|
213
|
+
}, [J]), (0, _react.useEffect)(() => {
|
|
214
|
+
st(!!(t.state.isNexrad && t.state.nexradShowSitesPicker !== !1));
|
|
215
|
+
}, [t]);
|
|
216
|
+
const p = (0, _react.useRef)(null),
|
|
217
|
+
rt = (0, _react.useRef)(null),
|
|
218
|
+
X = (0, _react.useRef)(null),
|
|
219
|
+
Ne = (0, _react.useRef)(null),
|
|
220
|
+
re = (0, _react.useRef)(null),
|
|
221
|
+
De = (0, _react.useRef)(null),
|
|
222
|
+
me = (0, _react.useRef)(null),
|
|
223
|
+
at = (0, _react.useCallback)(() => ie ? (re.current || (re.current = new _satelliteAndroidController.SatelliteAndroidController(t, Ne)), re.current) : null, [t]),
|
|
224
|
+
nt = (0, _react.useCallback)(() => !Q || !t ? null : (X.current || (X.current = new _nexradAndroidController.NexradAndroidController(t, rt, {
|
|
225
|
+
interpolateNexradColormap: t.state?.shaderSmoothingEnabled !== !1
|
|
226
|
+
})), X.current), [t]),
|
|
227
|
+
ht = (0, _react.useCallback)(r => {
|
|
228
|
+
const {
|
|
229
|
+
colormap: a,
|
|
230
|
+
baseUnit: e
|
|
231
|
+
} = t._getColormapForVariable(r.variable),
|
|
232
|
+
o = t._getTargetUnit(e, r.units);
|
|
233
|
+
return {
|
|
234
|
+
...r,
|
|
235
|
+
colormap: t._convertColormapUnits(a, e, o),
|
|
236
|
+
colormapBaseUnit: o
|
|
237
|
+
};
|
|
238
|
+
}, [t]),
|
|
239
|
+
Ie = (0, _react.useCallback)(r => {
|
|
240
|
+
if (!Q || !r?.isNexrad) return;
|
|
241
|
+
const a = nt();
|
|
242
|
+
a && (ae.current = !0, a.preloadAllAvailable(r), a.sync(r));
|
|
243
|
+
}, [nt]);
|
|
373
244
|
(0, _react.useEffect)(() => {
|
|
374
|
-
if (!
|
|
375
|
-
|
|
376
|
-
|
|
245
|
+
if (!Q || !t) return;
|
|
246
|
+
const r = (0, _gridCdnAuth.resolveGridRequestSiteOrigin)(te, t),
|
|
247
|
+
a = (0, _cdnAuthenticatedFetch.createNexradCloudFrontFetch)(() => ({
|
|
248
|
+
apiKey: t.apiKey,
|
|
249
|
+
bundleId: t.bundleId,
|
|
250
|
+
gridRequestSiteOrigin: r
|
|
251
|
+
}));
|
|
252
|
+
return (0, _radarArchiveCoreBundled.setNexradLevel2CloudFrontFetch)(a), () => (0, _radarArchiveCoreBundled.setNexradLevel2CloudFrontFetch)(null);
|
|
253
|
+
}, [t, te]), (0, _react.useEffect)(() => {
|
|
254
|
+
if (!ie) return;
|
|
255
|
+
let r = [],
|
|
256
|
+
a = [];
|
|
377
257
|
try {
|
|
378
|
-
|
|
258
|
+
r = Object.keys(_reactNative.UIManager.getViewManagerConfig?.("GridRenderLayer")?.Commands ?? {});
|
|
379
259
|
} catch {
|
|
380
|
-
|
|
260
|
+
r = ["error"];
|
|
381
261
|
}
|
|
382
262
|
try {
|
|
383
|
-
|
|
263
|
+
a = Object.keys(_reactNative.UIManager.getViewManagerConfig?.("SatelliteLayer")?.Commands ?? {});
|
|
384
264
|
} catch {
|
|
385
|
-
|
|
265
|
+
a = ["error"];
|
|
386
266
|
}
|
|
387
|
-
(0, _satelliteBridgeDiag.satBridgeWarn)(
|
|
388
|
-
GridRenderLayerCommands:
|
|
389
|
-
SatelliteLayerCommands:
|
|
390
|
-
satelliteMissing:
|
|
267
|
+
(0, _satelliteBridgeDiag.satBridgeWarn)("mount UIManager command registration", {
|
|
268
|
+
GridRenderLayerCommands: r,
|
|
269
|
+
SatelliteLayerCommands: a,
|
|
270
|
+
satelliteMissing: a.length === 0
|
|
391
271
|
});
|
|
392
272
|
}, []);
|
|
393
|
-
(0, _react.
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
273
|
+
const W = (0, _react.useRef)(new Map()),
|
|
274
|
+
pe = (0, _react.useRef)(null),
|
|
275
|
+
ge = (0, _react.useRef)(null),
|
|
276
|
+
ke = (0, _react.useRef)([0, 1]),
|
|
277
|
+
ae = (0, _react.useRef)(!1),
|
|
278
|
+
ne = (0, _react.useRef)(!1),
|
|
279
|
+
Le = (0, _react.useRef)(0),
|
|
280
|
+
He = (0, _react.useRef)(null),
|
|
281
|
+
l = (0, _react.useRef)(null),
|
|
282
|
+
[Ve, Me] = (0, _react.useState)({
|
|
283
|
+
opacity: 1,
|
|
284
|
+
dataRange: [0, 1]
|
|
285
|
+
}),
|
|
286
|
+
[St, st] = (0, _react.useState)(!1);
|
|
287
|
+
(0, _react.useImperativeHandle)(x, () => ({
|
|
288
|
+
play: () => {
|
|
289
|
+
t.play();
|
|
290
|
+
},
|
|
291
|
+
pause: () => {
|
|
292
|
+
t.pause();
|
|
293
|
+
},
|
|
294
|
+
togglePlay: () => {
|
|
295
|
+
t.togglePlay();
|
|
296
|
+
},
|
|
297
|
+
step: r => {
|
|
298
|
+
t.step(r);
|
|
299
|
+
},
|
|
300
|
+
setPlaybackSpeed: r => {
|
|
301
|
+
r > 0 && (t.playbackSpeed = r, t.isPlaying && (t.pause(), t.play()));
|
|
302
|
+
},
|
|
303
|
+
setOpacity: r => t.setOpacity(r),
|
|
304
|
+
setUnits: r => t.setUnits(r),
|
|
305
|
+
switchMode: r => t.switchMode(r),
|
|
306
|
+
getAvailableVariables: r => t.getAvailableVariables(r),
|
|
307
|
+
getVariableDisplayName: r => t.getVariableDisplayName(r),
|
|
308
|
+
setRun: r => t.setState({
|
|
309
|
+
run: r.split(":")[1]
|
|
310
|
+
}),
|
|
311
|
+
setState: r => t.setState(r),
|
|
312
|
+
setMRMSTimestamp: r => t.setMRMSTimestamp(r),
|
|
313
|
+
setMRMSDurationValue: r => qt(t, r),
|
|
314
|
+
setNexradSite: r => t.setNexradSite(r),
|
|
315
|
+
setNexradProduct: r => t.setNexradProduct(r),
|
|
316
|
+
setNexradTilt: r => t.setNexradTilt(r),
|
|
317
|
+
setNexradStormRelative: r => t.setNexradStormRelative(r),
|
|
318
|
+
setNexradTimestamp: r => t.setNexradTimestamp(r),
|
|
319
|
+
setNexradDurationValue: r => typeof t.setNexradDurationValue == "function" ? t.setNexradDurationValue(r) : t.setState({
|
|
320
|
+
nexradDurationValue: (0, _javascriptSdk.formatTimelineDurationValue)(r)
|
|
321
|
+
}),
|
|
322
|
+
setSatelliteTimestamp: r => t.setSatelliteTimestamp(r),
|
|
323
|
+
setSatelliteDurationValue: r => t.setSatelliteDurationValue(r),
|
|
324
|
+
setSatelliteSelection: r => t.setSatelliteSelection(r),
|
|
325
|
+
setShaderSmoothing: async r => {
|
|
326
|
+
await t.setShaderSmoothing(r), p.current && p.current.setSmoothing(r);
|
|
327
|
+
},
|
|
328
|
+
setSmoothing: r => {
|
|
329
|
+
p.current && p.current.setSmoothing(r);
|
|
330
|
+
},
|
|
331
|
+
setAutoRefresh: (r, a) => {
|
|
332
|
+
if (me.current && (clearInterval(me.current), me.current = null), r) {
|
|
333
|
+
const e = (a || xe || 30) * 1e3;
|
|
334
|
+
Se(), me.current = setInterval(Se, e);
|
|
402
335
|
}
|
|
336
|
+
},
|
|
337
|
+
refreshData: () => {
|
|
338
|
+
Se();
|
|
339
|
+
},
|
|
340
|
+
configureWatchesWarnings: r => {
|
|
341
|
+
tt(a => ({
|
|
342
|
+
...a,
|
|
343
|
+
...r
|
|
344
|
+
}));
|
|
403
345
|
}
|
|
404
|
-
}, [
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
// Store geometry and colormap that don't change with forecast hour
|
|
410
|
-
const cachedGeometry = (0, _react.useRef)(null);
|
|
411
|
-
const cachedColormap = (0, _react.useRef)(null);
|
|
412
|
-
const cachedDataRange = (0, _react.useRef)([0, 1]);
|
|
413
|
-
|
|
414
|
-
// Track if we've done the initial load
|
|
415
|
-
const hasInitialLoad = (0, _react.useRef)(false);
|
|
416
|
-
const hasPreloadedRef = (0, _react.useRef)(false);
|
|
417
|
-
/** Bumped on {@code cancelAllFrames} / full reload so stale {@code processFrame} results are ignored. */
|
|
418
|
-
const preloadGenerationRef = (0, _react.useRef)(0);
|
|
419
|
-
|
|
420
|
-
// Track the last state we processed to avoid redundant updates
|
|
421
|
-
const lastProcessedState = (0, _react.useRef)(null);
|
|
422
|
-
const previousStateRef = (0, _react.useRef)(null);
|
|
423
|
-
const [renderProps, setRenderProps] = (0, _react.useState)({
|
|
424
|
-
opacity: 1,
|
|
425
|
-
dataRange: [0, 1]
|
|
426
|
-
});
|
|
427
|
-
/** Drives {@link NexradSitesMapLayer}; must re-render when core NEXRAD / picker flags change. */
|
|
428
|
-
const [nexradSitesMapVisible, setNexradSitesMapVisible] = (0, _react.useState)(false);
|
|
429
|
-
(0, _react.useImperativeHandle)(ref, () => {
|
|
430
|
-
const setAutoRefresh = (enabled, intervalSeconds) => {
|
|
431
|
-
if (autoRefreshIntervalId.current) {
|
|
432
|
-
clearInterval(autoRefreshIntervalId.current);
|
|
433
|
-
autoRefreshIntervalId.current = null;
|
|
434
|
-
}
|
|
435
|
-
if (enabled) {
|
|
436
|
-
const effectiveInterval = (intervalSeconds || autoRefreshInterval || 30) * 1000;
|
|
437
|
-
// Run once immediately, then start the interval
|
|
438
|
-
_checkForUpdates();
|
|
439
|
-
autoRefreshIntervalId.current = setInterval(_checkForUpdates, effectiveInterval);
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
return {
|
|
443
|
-
play: () => {
|
|
444
|
-
core.play();
|
|
445
|
-
},
|
|
446
|
-
pause: () => {
|
|
447
|
-
core.pause();
|
|
448
|
-
},
|
|
449
|
-
togglePlay: () => {
|
|
450
|
-
core.togglePlay();
|
|
451
|
-
},
|
|
452
|
-
step: direction => {
|
|
453
|
-
core.step(direction);
|
|
454
|
-
},
|
|
455
|
-
setPlaybackSpeed: speed => {
|
|
456
|
-
if (speed > 0) {
|
|
457
|
-
core.playbackSpeed = speed;
|
|
458
|
-
if (core.isPlaying) {
|
|
459
|
-
core.pause();
|
|
460
|
-
core.play();
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
setOpacity: opacity => core.setOpacity(opacity),
|
|
465
|
-
setUnits: units => core.setUnits(units),
|
|
466
|
-
switchMode: options => core.switchMode(options),
|
|
467
|
-
getAvailableVariables: model => core.getAvailableVariables(model),
|
|
468
|
-
getVariableDisplayName: code => core.getVariableDisplayName(code),
|
|
469
|
-
setRun: runString => core.setState({
|
|
470
|
-
run: runString.split(':')[1]
|
|
471
|
-
}),
|
|
472
|
-
setState: newState => core.setState(newState),
|
|
473
|
-
setMRMSTimestamp: timestamp => core.setMRMSTimestamp(timestamp),
|
|
474
|
-
setMRMSDurationValue: value => applyMrmsDurationValue(core, value),
|
|
475
|
-
setNexradSite: siteId => core.setNexradSite(siteId),
|
|
476
|
-
setNexradProduct: product => core.setNexradProduct(product),
|
|
477
|
-
setNexradTilt: tilt => core.setNexradTilt(tilt),
|
|
478
|
-
setNexradStormRelative: enabled => core.setNexradStormRelative(enabled),
|
|
479
|
-
setNexradTimestamp: ts => core.setNexradTimestamp(ts),
|
|
480
|
-
setNexradDurationValue: value => applyNexradDurationValue(core, value),
|
|
481
|
-
setSatelliteTimestamp: timestamp => core.setSatelliteTimestamp(timestamp),
|
|
482
|
-
setSatelliteDurationValue: value => core.setSatelliteDurationValue(value),
|
|
483
|
-
setSatelliteSelection: opts => core.setSatelliteSelection(opts),
|
|
484
|
-
setShaderSmoothing: async enabled => {
|
|
485
|
-
await core.setShaderSmoothing(enabled);
|
|
486
|
-
if (gridLayerRef.current) {
|
|
487
|
-
gridLayerRef.current.setSmoothing(enabled);
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
setSmoothing: enabled => {
|
|
491
|
-
if (gridLayerRef.current) {
|
|
492
|
-
gridLayerRef.current.setSmoothing(enabled);
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
setAutoRefresh,
|
|
496
|
-
refreshData: () => {
|
|
497
|
-
_checkForUpdates();
|
|
498
|
-
},
|
|
499
|
-
/**
|
|
500
|
-
* NWS watches/warnings (native map, iOS + Android): same options as mapsgl {@link WeatherLayerManager#configureWatchesWarnings}.
|
|
501
|
-
* @param {object} partial
|
|
502
|
-
*/
|
|
503
|
-
configureWatchesWarnings: partial => {
|
|
504
|
-
setWatchesWarningsOptions(prev => ({
|
|
505
|
-
...prev,
|
|
506
|
-
...partial
|
|
507
|
-
}));
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
}, [core, autoRefreshInterval, _checkForUpdates]);
|
|
511
|
-
const preloadAllFramesToDisk = async state => {
|
|
512
|
-
if (state.isNexrad || state.isSatellite) {
|
|
513
|
-
hasPreloadedRef.current = false;
|
|
514
|
-
wxGridVerbose('preloadSkip', {
|
|
515
|
-
reason: 'nexrad_or_satellite'
|
|
346
|
+
}), [t, xe, Se]);
|
|
347
|
+
const it = async r => {
|
|
348
|
+
if (r.isNexrad || r.isSatellite) {
|
|
349
|
+
ne.current = !1, z("preloadSkip", {
|
|
350
|
+
reason: "nexrad_or_satellite"
|
|
516
351
|
});
|
|
517
352
|
return;
|
|
518
353
|
}
|
|
519
|
-
if (
|
|
520
|
-
|
|
521
|
-
reason:
|
|
522
|
-
isMRMS:
|
|
523
|
-
variable:
|
|
354
|
+
if (ne.current) {
|
|
355
|
+
z("preloadSkip", {
|
|
356
|
+
reason: "hasPreloadedRef_gate",
|
|
357
|
+
isMRMS: r.isMRMS,
|
|
358
|
+
variable: r.variable
|
|
524
359
|
});
|
|
525
360
|
return;
|
|
526
361
|
}
|
|
527
362
|
const {
|
|
528
|
-
isMRMS,
|
|
529
|
-
model,
|
|
530
|
-
date,
|
|
531
|
-
run,
|
|
532
|
-
variable,
|
|
533
|
-
units,
|
|
534
|
-
availableHours,
|
|
535
|
-
availableTimestamps,
|
|
536
|
-
forecastHour,
|
|
537
|
-
mrmsTimestamp
|
|
538
|
-
} =
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
mrmsTimestamp,
|
|
546
|
-
timestampCount: availableTimestamps?.length ?? 0,
|
|
547
|
-
variable
|
|
363
|
+
isMRMS: a,
|
|
364
|
+
model: e,
|
|
365
|
+
date: o,
|
|
366
|
+
run: F,
|
|
367
|
+
variable: s,
|
|
368
|
+
units: w,
|
|
369
|
+
availableHours: N,
|
|
370
|
+
availableTimestamps: c,
|
|
371
|
+
forecastHour: i,
|
|
372
|
+
mrmsTimestamp: u
|
|
373
|
+
} = r;
|
|
374
|
+
if (a && (u == null || !c || c.length === 0)) {
|
|
375
|
+
ne.current = !1, Z("preloadAbort", {
|
|
376
|
+
reason: "mrms_missing_frame_or_timestamps",
|
|
377
|
+
mrmsTimestamp: u,
|
|
378
|
+
timestampCount: c?.length ?? 0,
|
|
379
|
+
variable: s
|
|
548
380
|
});
|
|
549
381
|
return;
|
|
550
382
|
}
|
|
551
|
-
if (!
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
variable
|
|
383
|
+
if (!a && (i == null || !N || N.length === 0)) {
|
|
384
|
+
ne.current = !1, Z("preloadAbort", {
|
|
385
|
+
reason: "model_missing_hour_or_hours",
|
|
386
|
+
forecastHour: i,
|
|
387
|
+
hourCount: N?.length ?? 0,
|
|
388
|
+
model: e,
|
|
389
|
+
variable: s
|
|
559
390
|
});
|
|
560
391
|
return;
|
|
561
392
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
bundleId: core?.bundleId ?? null,
|
|
578
|
-
gridRequestSiteOrigin: gridRequestSiteOrigin || null
|
|
393
|
+
ne.current = !0;
|
|
394
|
+
const A = Le.current,
|
|
395
|
+
y = () => A !== Le.current;
|
|
396
|
+
z("preloadStart", {
|
|
397
|
+
isMRMS: a,
|
|
398
|
+
model: e,
|
|
399
|
+
date: o,
|
|
400
|
+
run: F,
|
|
401
|
+
variable: s,
|
|
402
|
+
mrmsTimestamp: a ? u : void 0,
|
|
403
|
+
forecastHour: a ? void 0 : i,
|
|
404
|
+
baseGridUrl: t?.baseGridUrl,
|
|
405
|
+
hasApiKey: !!t?.apiKey,
|
|
406
|
+
bundleId: t?.bundleId ?? null,
|
|
407
|
+
gridRequestSiteOrigin: te || null
|
|
579
408
|
});
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
const validHours = availableHours.filter(hour => hour !== 0);
|
|
585
|
-
effectiveForecastHour = validHours.length > 0 ? validHours[0] : 0;
|
|
409
|
+
let M = i;
|
|
410
|
+
if (!a && s === "ptypeRefl" && e === "hrrr" && i === 0) {
|
|
411
|
+
const d = N.filter(G => G !== 0);
|
|
412
|
+
M = d.length > 0 ? d[0] : 0;
|
|
586
413
|
}
|
|
587
|
-
if (!
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
nx: gridDef?.grid_params?.nx,
|
|
602
|
-
ny: gridDef?.grid_params?.ny
|
|
414
|
+
if (!pe.current || !ge.current) {
|
|
415
|
+
const d = a ? "mrms" : e,
|
|
416
|
+
{
|
|
417
|
+
corners: G,
|
|
418
|
+
gridDef: n
|
|
419
|
+
} = t._getGridCornersAndDef(d);
|
|
420
|
+
p.current.updateGeometry(G, n), pe.current = {
|
|
421
|
+
model: d,
|
|
422
|
+
variable: s
|
|
423
|
+
}, z("geometryColormapInit", {
|
|
424
|
+
gridModel: d,
|
|
425
|
+
variable: s,
|
|
426
|
+
nx: n?.grid_params?.nx,
|
|
427
|
+
ny: n?.grid_params?.ny
|
|
603
428
|
});
|
|
604
429
|
const {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
let
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
key: `${variable}-${units}`
|
|
621
|
-
};
|
|
622
|
-
cachedDataRange.current = dataRange;
|
|
623
|
-
setRenderProps({
|
|
624
|
-
opacity: state.opacity,
|
|
625
|
-
dataRange: dataRange
|
|
626
|
-
});
|
|
627
|
-
hasInitialLoad.current = true;
|
|
430
|
+
colormap: R,
|
|
431
|
+
baseUnit: h
|
|
432
|
+
} = t._getColormapForVariable(s),
|
|
433
|
+
k = t._getTargetUnit(h, w),
|
|
434
|
+
P = t._convertColormapUnits(R, h, k);
|
|
435
|
+
let f;
|
|
436
|
+
s === "ptypeRefl" || s === "ptypeRate" ? f = a ? [5, 380] : [5, 380] : f = [P[0], P[P.length - 2]];
|
|
437
|
+
const C = et(P),
|
|
438
|
+
b = (0, _base64Js.fromByteArray)(C);
|
|
439
|
+
p.current.updateColormapTexture(b), ge.current = {
|
|
440
|
+
key: `${s}-${w}`
|
|
441
|
+
}, ke.current = f, Me({
|
|
442
|
+
opacity: r.opacity,
|
|
443
|
+
dataRange: f
|
|
444
|
+
}), ae.current = !0;
|
|
628
445
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
if (!
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
hasPreloadedRef.current = false;
|
|
638
|
-
wxGridWarn('preloadAbort', {
|
|
639
|
-
reason: 'no_frames_after_filter',
|
|
640
|
-
isMRMS,
|
|
641
|
-
variable
|
|
446
|
+
let U = N;
|
|
447
|
+
!a && s === "ptypeRefl" && e === "hrrr" && N && N.length > 0 && (U = N.filter(d => d !== 0));
|
|
448
|
+
const E = a ? c : U;
|
|
449
|
+
if (!E || E.length === 0) {
|
|
450
|
+
ne.current = !1, Z("preloadAbort", {
|
|
451
|
+
reason: "no_frames_after_filter",
|
|
452
|
+
isMRMS: a,
|
|
453
|
+
variable: s
|
|
642
454
|
});
|
|
643
455
|
return;
|
|
644
456
|
}
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
reason: 'currentFrame_null',
|
|
652
|
-
isMRMS,
|
|
653
|
-
variable
|
|
457
|
+
const K = a ? u : M;
|
|
458
|
+
if (K == null) {
|
|
459
|
+
ne.current = !1, Z("preloadAbort", {
|
|
460
|
+
reason: "currentFrame_null",
|
|
461
|
+
isMRMS: a,
|
|
462
|
+
variable: s
|
|
654
463
|
});
|
|
655
464
|
return;
|
|
656
465
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
} else {
|
|
681
|
-
resourcePath = `/grids/${model}/${date}/${run}/${currentFrame}/${variable}/0`;
|
|
682
|
-
}
|
|
683
|
-
const options = (0, _aguaceroRnDebug.augmentProcessFrameOptionsForDebug)(buildGridFrameProcessOptions(core.baseGridUrl, resourcePath, core.apiKey, core.bundleId, gridRequestSiteOrigin, core), core);
|
|
684
|
-
(0, _aguaceroCoreDebugHooks.logProcessFrameAuthMismatch)(core, options, {
|
|
685
|
-
phase: 'preloadCurrent',
|
|
686
|
-
currentCacheKey
|
|
466
|
+
const Y = [...E].reverse().filter(d => d !== K),
|
|
467
|
+
{
|
|
468
|
+
corners: D,
|
|
469
|
+
gridDef: q
|
|
470
|
+
} = t._getGridCornersAndDef(a ? "mrms" : e),
|
|
471
|
+
{
|
|
472
|
+
nx: de,
|
|
473
|
+
ny: ye
|
|
474
|
+
} = q.grid_params,
|
|
475
|
+
$ = a ? `mrms-${K}-${s}` : `${e}-${o}-${F}-${K}-${s}`;
|
|
476
|
+
if (!W.current.has($)) {
|
|
477
|
+
let d;
|
|
478
|
+
if (a) {
|
|
479
|
+
const n = new Date(K * 1e3),
|
|
480
|
+
R = n.getUTCFullYear(),
|
|
481
|
+
h = (n.getUTCMonth() + 1).toString().padStart(2, "0"),
|
|
482
|
+
k = n.getUTCDate().toString().padStart(2, "0");
|
|
483
|
+
d = `/grids/mrms/${R}${h}${k}/${K}/0/${s}/0`;
|
|
484
|
+
} else d = `/grids/${e}/${o}/${F}/${K}/${s}/0`;
|
|
485
|
+
const G = (0, _aguaceroRnDebug.augmentProcessFrameOptionsForDebug)(Ze(t.baseGridUrl, d, t.apiKey, t.bundleId, te, t), t);
|
|
486
|
+
(0, _aguaceroCoreDebugHooks.logProcessFrameAuthMismatch)(t, G, {
|
|
487
|
+
phase: "preloadCurrent",
|
|
488
|
+
currentCacheKey: $
|
|
687
489
|
});
|
|
688
490
|
try {
|
|
689
|
-
|
|
690
|
-
currentCacheKey
|
|
691
|
-
resourcePath,
|
|
692
|
-
frame:
|
|
491
|
+
z("processFrameRequest", {
|
|
492
|
+
currentCacheKey: $,
|
|
493
|
+
resourcePath: d,
|
|
494
|
+
frame: K
|
|
693
495
|
});
|
|
694
|
-
const
|
|
695
|
-
if (
|
|
696
|
-
|
|
697
|
-
currentCacheKey
|
|
698
|
-
generation
|
|
496
|
+
const n = await qe.processFrame(G);
|
|
497
|
+
if (y()) {
|
|
498
|
+
z("preloadCurrentFrameStale", {
|
|
499
|
+
currentCacheKey: $,
|
|
500
|
+
generation: A
|
|
699
501
|
});
|
|
700
502
|
return;
|
|
701
503
|
}
|
|
702
|
-
if (!
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
resultKeys: result ? Object.keys(result) : []
|
|
504
|
+
if (!n || !n.filePath) {
|
|
505
|
+
ne.current = !1, Z("preloadAbort", {
|
|
506
|
+
reason: "processFrame_empty_result",
|
|
507
|
+
currentCacheKey: $,
|
|
508
|
+
resultKeys: n ? Object.keys(n) : []
|
|
708
509
|
});
|
|
709
510
|
return;
|
|
710
511
|
}
|
|
711
512
|
const {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
732
|
-
} else {
|
|
733
|
-
convertedOffset = conversionFunc(dataOffset);
|
|
734
|
-
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
735
|
-
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
736
|
-
}
|
|
737
|
-
dataScale = convertedScale;
|
|
738
|
-
dataOffset = convertedOffset;
|
|
513
|
+
baseUnit: R
|
|
514
|
+
} = t._getColormapForVariable(s),
|
|
515
|
+
h = t._getTargetUnit(R, w),
|
|
516
|
+
k = (_javascriptSdk.DICTIONARIES?.fld?.[s] || {}).defaultUnit || R;
|
|
517
|
+
let P = n.scale,
|
|
518
|
+
f = n.offset,
|
|
519
|
+
C = P,
|
|
520
|
+
b = f;
|
|
521
|
+
if (k !== R) {
|
|
522
|
+
const T = (0, _javascriptSdk.getUnitConversionFunction)(k, R);
|
|
523
|
+
if (T) {
|
|
524
|
+
if (n.scaleType === "sqrt") {
|
|
525
|
+
const L = f * f,
|
|
526
|
+
H = (f + P) * (f + P),
|
|
527
|
+
oe = T(L),
|
|
528
|
+
ce = T(H);
|
|
529
|
+
b = Math.sqrt(Math.abs(oe)) * Math.sign(oe), C = Math.sqrt(Math.abs(ce)) * Math.sign(ce) - b;
|
|
530
|
+
} else b = T(f), C = T(f + P) - b;
|
|
531
|
+
P = C, f = b;
|
|
739
532
|
}
|
|
740
533
|
}
|
|
741
|
-
if (
|
|
742
|
-
const
|
|
743
|
-
if (
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
751
|
-
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
752
|
-
} else {
|
|
753
|
-
convertedOffset = conversionFunc(dataOffset);
|
|
754
|
-
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
755
|
-
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
534
|
+
if (R !== h) {
|
|
535
|
+
const T = (0, _javascriptSdk.getUnitConversionFunction)(R, h);
|
|
536
|
+
if (T) if (n.scaleType === "sqrt") {
|
|
537
|
+
const L = f * f,
|
|
538
|
+
H = (f + P) * (f + P),
|
|
539
|
+
oe = T(L),
|
|
540
|
+
ce = T(H);
|
|
541
|
+
b = Math.sqrt(Math.abs(oe)) * Math.sign(oe), C = Math.sqrt(Math.abs(ce)) * Math.sign(ce) - b;
|
|
542
|
+
} else b = T(f), C = T(f + P) - b;
|
|
758
543
|
}
|
|
759
|
-
const
|
|
760
|
-
filePath:
|
|
761
|
-
nx,
|
|
762
|
-
ny,
|
|
763
|
-
scale:
|
|
764
|
-
offset:
|
|
765
|
-
missing:
|
|
766
|
-
corners,
|
|
767
|
-
gridDef,
|
|
768
|
-
scaleType:
|
|
769
|
-
originalScale:
|
|
770
|
-
originalOffset:
|
|
771
|
-
};
|
|
772
|
-
preloadedDataCache.current.set(currentCacheKey, frameData);
|
|
773
|
-
|
|
774
|
-
// Update the GPU with the current frame
|
|
775
|
-
gridLayerRef.current.updateDataTextureFromFile(frameData.filePath, frameData.nx, frameData.ny, frameData.scale, frameData.offset, frameData.missing, frameData.scaleType);
|
|
776
|
-
currentGridDataRef.current = {
|
|
777
|
-
nx: frameData.nx,
|
|
778
|
-
ny: frameData.ny,
|
|
779
|
-
scale: frameData.scale,
|
|
780
|
-
offset: frameData.offset,
|
|
781
|
-
missing: frameData.missing,
|
|
782
|
-
gridDef: frameData.gridDef,
|
|
783
|
-
variable: variable,
|
|
784
|
-
units: units,
|
|
785
|
-
scaleType: frameData.scaleType
|
|
544
|
+
const S = {
|
|
545
|
+
filePath: n.filePath,
|
|
546
|
+
nx: de,
|
|
547
|
+
ny: ye,
|
|
548
|
+
scale: C,
|
|
549
|
+
offset: b,
|
|
550
|
+
missing: n.missing,
|
|
551
|
+
corners: D,
|
|
552
|
+
gridDef: q,
|
|
553
|
+
scaleType: n.scaleType,
|
|
554
|
+
originalScale: n.scale,
|
|
555
|
+
originalOffset: n.offset
|
|
786
556
|
};
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
557
|
+
W.current.set($, S), p.current.updateDataTextureFromFile(S.filePath, S.nx, S.ny, S.scale, S.offset, S.missing, S.scaleType), De.current = {
|
|
558
|
+
nx: S.nx,
|
|
559
|
+
ny: S.ny,
|
|
560
|
+
scale: S.scale,
|
|
561
|
+
offset: S.offset,
|
|
562
|
+
missing: S.missing,
|
|
563
|
+
gridDef: S.gridDef,
|
|
564
|
+
variable: s,
|
|
565
|
+
units: w,
|
|
566
|
+
scaleType: S.scaleType
|
|
567
|
+
}, z("preloadCurrentFrameOk", {
|
|
568
|
+
currentCacheKey: $,
|
|
569
|
+
nx: S.nx,
|
|
570
|
+
ny: S.ny,
|
|
571
|
+
scale: S.scale,
|
|
572
|
+
offset: S.offset,
|
|
573
|
+
filePathSuffix: String(S.filePath).split("/").pop()
|
|
794
574
|
});
|
|
795
|
-
} catch (
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
575
|
+
} catch (n) {
|
|
576
|
+
if (n && (n.code === "E_CANCELLED" || n?.userInfo?.code === "E_CANCELLED" || typeof n?.message == "string" && n.message.includes("superseded"))) z("preloadProcessFrameCancelled", {
|
|
577
|
+
currentCacheKey: $
|
|
578
|
+
});else {
|
|
579
|
+
ne.current = !1;
|
|
580
|
+
const R = {
|
|
581
|
+
currentCacheKey: $,
|
|
582
|
+
code: n?.code,
|
|
583
|
+
message: n?.message,
|
|
584
|
+
userInfo: n?.userInfo
|
|
804
585
|
};
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
(0, _aguaceroRnDebug.
|
|
808
|
-
|
|
809
|
-
auth: (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(core),
|
|
810
|
-
is403: e?.code === 'HTTP_ERROR' && typeof e?.message === 'string' && e.message.includes('403')
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
} else {
|
|
814
|
-
wxGridVerbose('preloadProcessFrameCancelled', {
|
|
815
|
-
currentCacheKey
|
|
586
|
+
Z("preloadProcessFrameError", R), (0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)() && (0, _aguaceroRnDebug.aguaceroDebugWarn)("preloadProcessFrameError", {
|
|
587
|
+
...R,
|
|
588
|
+
auth: (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(t),
|
|
589
|
+
is403: n?.code === "HTTP_ERROR" && typeof n?.message == "string" && n.message.includes("403")
|
|
816
590
|
});
|
|
817
591
|
}
|
|
818
592
|
}
|
|
819
593
|
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
if (
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
const options = (0, _aguaceroRnDebug.augmentProcessFrameOptionsForDebug)(buildGridFrameProcessOptions(core.baseGridUrl, resourcePath, core.apiKey, core.bundleId, gridRequestSiteOrigin, core), core);
|
|
838
|
-
(0, _aguaceroCoreDebugHooks.logProcessFrameAuthMismatch)(core, options, {
|
|
839
|
-
phase: 'preloadBackground',
|
|
840
|
-
cacheKey
|
|
841
|
-
});
|
|
842
|
-
WeatherFrameProcessorModule.processFrame(options).then(result => {
|
|
843
|
-
if (isStaleGeneration()) {
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
if (!result || !result.filePath) {
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
// ADD: Same two-step conversion as the current frame
|
|
594
|
+
Y.forEach(d => {
|
|
595
|
+
const G = a ? `mrms-${d}-${s}` : `${e}-${o}-${F}-${d}-${s}`;
|
|
596
|
+
if (W.current.has(G)) return;
|
|
597
|
+
let n;
|
|
598
|
+
if (a) {
|
|
599
|
+
const h = new Date(d * 1e3),
|
|
600
|
+
k = h.getUTCFullYear(),
|
|
601
|
+
P = (h.getUTCMonth() + 1).toString().padStart(2, "0"),
|
|
602
|
+
f = h.getUTCDate().toString().padStart(2, "0");
|
|
603
|
+
n = `/grids/mrms/${k}${P}${f}/${d}/0/${s}/0`;
|
|
604
|
+
} else n = `/grids/${e}/${o}/${F}/${d}/${s}/0`;
|
|
605
|
+
const R = (0, _aguaceroRnDebug.augmentProcessFrameOptionsForDebug)(Ze(t.baseGridUrl, n, t.apiKey, t.bundleId, te, t), t);
|
|
606
|
+
(0, _aguaceroCoreDebugHooks.logProcessFrameAuthMismatch)(t, R, {
|
|
607
|
+
phase: "preloadBackground",
|
|
608
|
+
cacheKey: G
|
|
609
|
+
}), qe.processFrame(R).then(h => {
|
|
610
|
+
if (y() || !h || !h.filePath) return;
|
|
851
611
|
const {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
convertedOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
|
|
872
|
-
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
873
|
-
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
874
|
-
} else {
|
|
875
|
-
convertedOffset = conversionFunc(dataOffset);
|
|
876
|
-
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
877
|
-
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
878
|
-
}
|
|
879
|
-
dataScale = convertedScale;
|
|
880
|
-
dataOffset = convertedOffset;
|
|
612
|
+
baseUnit: k
|
|
613
|
+
} = t._getColormapForVariable(s),
|
|
614
|
+
P = t._getTargetUnit(k, w),
|
|
615
|
+
f = (_javascriptSdk.DICTIONARIES?.fld?.[s] || {}).defaultUnit || k;
|
|
616
|
+
let C = h.scale,
|
|
617
|
+
b = h.offset,
|
|
618
|
+
S = C,
|
|
619
|
+
T = b;
|
|
620
|
+
if (f !== k) {
|
|
621
|
+
const H = (0, _javascriptSdk.getUnitConversionFunction)(f, k);
|
|
622
|
+
if (H) {
|
|
623
|
+
if (h.scaleType === "sqrt") {
|
|
624
|
+
const oe = b * b,
|
|
625
|
+
ce = (b + C) * (b + C),
|
|
626
|
+
Re = H(oe),
|
|
627
|
+
Fe = H(ce);
|
|
628
|
+
T = Math.sqrt(Math.abs(Re)) * Math.sign(Re), S = Math.sqrt(Math.abs(Fe)) * Math.sign(Fe) - T;
|
|
629
|
+
} else T = H(b), S = H(b + C) - T;
|
|
630
|
+
C = S, b = T;
|
|
881
631
|
}
|
|
882
632
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
const convertedPhysicalAtOffsetPlusScale = conversionFunc(physicalAtOffsetPlusScale);
|
|
893
|
-
convertedOffset = Math.sqrt(Math.abs(convertedPhysicalAtOffset)) * Math.sign(convertedPhysicalAtOffset);
|
|
894
|
-
const newOffsetPlusScale = Math.sqrt(Math.abs(convertedPhysicalAtOffsetPlusScale)) * Math.sign(convertedPhysicalAtOffsetPlusScale);
|
|
895
|
-
convertedScale = newOffsetPlusScale - convertedOffset;
|
|
896
|
-
} else {
|
|
897
|
-
convertedOffset = conversionFunc(dataOffset);
|
|
898
|
-
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
899
|
-
convertedScale = convertedOffsetPlusScale - convertedOffset;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
633
|
+
if (k !== P) {
|
|
634
|
+
const H = (0, _javascriptSdk.getUnitConversionFunction)(k, P);
|
|
635
|
+
if (H) if (h.scaleType === "sqrt") {
|
|
636
|
+
const oe = b * b,
|
|
637
|
+
ce = (b + C) * (b + C),
|
|
638
|
+
Re = H(oe),
|
|
639
|
+
Fe = H(ce);
|
|
640
|
+
T = Math.sqrt(Math.abs(Re)) * Math.sign(Re), S = Math.sqrt(Math.abs(Fe)) * Math.sign(Fe) - T;
|
|
641
|
+
} else T = H(b), S = H(b + C) - T;
|
|
902
642
|
}
|
|
903
|
-
const
|
|
904
|
-
filePath:
|
|
905
|
-
nx,
|
|
906
|
-
ny,
|
|
907
|
-
scale:
|
|
908
|
-
offset:
|
|
909
|
-
missing:
|
|
910
|
-
corners,
|
|
911
|
-
gridDef,
|
|
912
|
-
scaleType:
|
|
913
|
-
originalScale:
|
|
914
|
-
originalOffset:
|
|
643
|
+
const L = {
|
|
644
|
+
filePath: h.filePath,
|
|
645
|
+
nx: de,
|
|
646
|
+
ny: ye,
|
|
647
|
+
scale: S,
|
|
648
|
+
offset: T,
|
|
649
|
+
missing: h.missing,
|
|
650
|
+
corners: D,
|
|
651
|
+
gridDef: q,
|
|
652
|
+
scaleType: h.scaleType,
|
|
653
|
+
originalScale: h.scale,
|
|
654
|
+
originalOffset: h.offset
|
|
915
655
|
};
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
originalOffset: frameData.originalOffset
|
|
656
|
+
if (W.current.set(G, L), _reactNative.Platform.OS === "ios" && p.current.primeGpuCache) {
|
|
657
|
+
const H = {
|
|
658
|
+
[G]: {
|
|
659
|
+
filePath: L.filePath,
|
|
660
|
+
nx: L.nx,
|
|
661
|
+
ny: L.ny,
|
|
662
|
+
scale: L.scale,
|
|
663
|
+
offset: L.offset,
|
|
664
|
+
missing: L.missing,
|
|
665
|
+
scaleType: L.scaleType || "linear",
|
|
666
|
+
originalScale: L.originalScale,
|
|
667
|
+
originalOffset: L.originalOffset
|
|
929
668
|
}
|
|
930
669
|
};
|
|
931
|
-
|
|
932
|
-
}
|
|
933
|
-
}).catch(e => {
|
|
934
|
-
const cancelled = e && (e.code === 'E_CANCELLED' || e?.userInfo?.code === 'E_CANCELLED' || typeof e?.message === 'string' && e.message.includes('superseded'));
|
|
935
|
-
if (!cancelled) {
|
|
936
|
-
wxGridWarn('backgroundFrameError', {
|
|
937
|
-
cacheKey,
|
|
938
|
-
code: e?.code,
|
|
939
|
-
message: e?.message
|
|
940
|
-
});
|
|
670
|
+
p.current.primeGpuCache(H);
|
|
941
671
|
}
|
|
672
|
+
}).catch(h => {
|
|
673
|
+
h && (h.code === "E_CANCELLED" || h?.userInfo?.code === "E_CANCELLED" || typeof h?.message == "string" && h.message.includes("superseded")) || Z("backgroundFrameError", {
|
|
674
|
+
cacheKey: G,
|
|
675
|
+
code: h?.code,
|
|
676
|
+
message: h?.message
|
|
677
|
+
});
|
|
942
678
|
});
|
|
943
679
|
});
|
|
944
680
|
};
|
|
945
681
|
(0, _react.useEffect)(() => {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
_checkForUpdates(); // Run immediately on enable
|
|
950
|
-
autoRefreshIntervalId.current = setInterval(_checkForUpdates, interval);
|
|
682
|
+
if (Pe) {
|
|
683
|
+
const r = (xe || 30) * 1e3;
|
|
684
|
+
Se(), me.current = setInterval(Se, r);
|
|
951
685
|
}
|
|
952
|
-
|
|
953
|
-
// Cleanup function: this runs when the component unmounts or props change
|
|
954
686
|
return () => {
|
|
955
|
-
|
|
956
|
-
clearInterval(autoRefreshIntervalId.current);
|
|
957
|
-
autoRefreshIntervalId.current = null;
|
|
958
|
-
}
|
|
687
|
+
me.current && (clearInterval(me.current), me.current = null);
|
|
959
688
|
};
|
|
960
|
-
}, [
|
|
961
|
-
const
|
|
962
|
-
const {
|
|
963
|
-
model,
|
|
964
|
-
date,
|
|
965
|
-
run,
|
|
966
|
-
forecastHour,
|
|
967
|
-
variable,
|
|
968
|
-
units,
|
|
969
|
-
isMRMS,
|
|
970
|
-
mrmsTimestamp
|
|
971
|
-
} = state;
|
|
972
|
-
const cacheKey = isMRMS ? `mrms-${mrmsTimestamp}-${variable}` : `${model}-${date}-${run}-${forecastHour}-${variable}`;
|
|
973
|
-
if (_reactNative.Platform.OS === 'ios' && gridLayerRef.current.setActiveFrame) {
|
|
974
|
-
// Get the cached data BEFORE calling setActiveFrame
|
|
975
|
-
const cachedData = preloadedDataCache.current.get(cacheKey);
|
|
976
|
-
if (cachedData) {
|
|
977
|
-
currentGridDataRef.current = {
|
|
978
|
-
nx: cachedData.nx,
|
|
979
|
-
ny: cachedData.ny,
|
|
980
|
-
scale: cachedData.scale,
|
|
981
|
-
offset: cachedData.offset,
|
|
982
|
-
missing: cachedData.missing,
|
|
983
|
-
gridDef: cachedData.gridDef,
|
|
984
|
-
variable: variable,
|
|
985
|
-
units: units,
|
|
986
|
-
scaleType: cachedData.scaleType
|
|
987
|
-
};
|
|
988
|
-
} else {
|
|
989
|
-
wxGridVerbose('gpuIOS_setActiveFrame_no_row', {
|
|
990
|
-
cacheKey,
|
|
991
|
-
cacheSize: preloadedDataCache.current.size
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
gridLayerRef.current.setActiveFrame(cacheKey);
|
|
995
|
-
wxGridVerbose('gpuIOS_setActiveFrame', {
|
|
996
|
-
cacheKey,
|
|
997
|
-
hadCachedRow: Boolean(cachedData)
|
|
998
|
-
});
|
|
999
|
-
return true;
|
|
1000
|
-
}
|
|
1001
|
-
const cachedData = preloadedDataCache.current.get(cacheKey);
|
|
1002
|
-
if (!cachedData) {
|
|
1003
|
-
wxGridWarn('updateGPUNoCache', {
|
|
1004
|
-
cacheKey,
|
|
1005
|
-
cacheSize: preloadedDataCache.current.size,
|
|
1006
|
-
sampleKeys: Array.from(preloadedDataCache.current.keys()).slice(0, 5)
|
|
1007
|
-
});
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
if (!gridLayerRef.current) {
|
|
1011
|
-
wxGridWarn('updateGPUNoGridLayerRef', {
|
|
1012
|
-
cacheKey
|
|
1013
|
-
});
|
|
1014
|
-
return false;
|
|
1015
|
-
}
|
|
1016
|
-
if (!cachedGeometry.current || cachedGeometry.current.model !== (isMRMS ? 'mrms' : model) || cachedGeometry.current.variable !== variable) {
|
|
1017
|
-
gridLayerRef.current.updateGeometry(cachedData.corners, cachedData.gridDef);
|
|
1018
|
-
cachedGeometry.current = {
|
|
1019
|
-
model: isMRMS ? 'mrms' : model,
|
|
1020
|
-
variable
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
const colormapKey = `${variable}-${units}`;
|
|
1024
|
-
if (!cachedColormap.current || cachedColormap.current.key !== colormapKey) {
|
|
689
|
+
}, [Pe, xe, Se]);
|
|
690
|
+
const yt = r => {
|
|
1025
691
|
const {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
692
|
+
model: a,
|
|
693
|
+
date: e,
|
|
694
|
+
run: o,
|
|
695
|
+
forecastHour: F,
|
|
696
|
+
variable: s,
|
|
697
|
+
units: w,
|
|
698
|
+
isMRMS: N,
|
|
699
|
+
mrmsTimestamp: c
|
|
700
|
+
} = r,
|
|
701
|
+
i = N ? `mrms-${c}-${s}` : `${a}-${e}-${o}-${F}-${s}`;
|
|
702
|
+
if (_reactNative.Platform.OS === "ios" && p.current.setActiveFrame) {
|
|
703
|
+
const y = W.current.get(i);
|
|
704
|
+
return y ? De.current = {
|
|
705
|
+
nx: y.nx,
|
|
706
|
+
ny: y.ny,
|
|
707
|
+
scale: y.scale,
|
|
708
|
+
offset: y.offset,
|
|
709
|
+
missing: y.missing,
|
|
710
|
+
gridDef: y.gridDef,
|
|
711
|
+
variable: s,
|
|
712
|
+
units: w,
|
|
713
|
+
scaleType: y.scaleType
|
|
714
|
+
} : z("gpuIOS_setActiveFrame_no_row", {
|
|
715
|
+
cacheKey: i,
|
|
716
|
+
cacheSize: W.current.size
|
|
717
|
+
}), p.current.setActiveFrame(i), z("gpuIOS_setActiveFrame", {
|
|
718
|
+
cacheKey: i,
|
|
719
|
+
hadCachedRow: !!y
|
|
720
|
+
}), !0;
|
|
1040
721
|
}
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
};
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
if (cachedData.filePath) {
|
|
1054
|
-
gridLayerRef.current.updateDataTextureFromFile(cachedData.filePath, cachedData.nx, cachedData.ny, cachedData.scale, cachedData.offset, cachedData.missing, cachedData.scaleType);
|
|
1055
|
-
currentGridDataRef.current = {
|
|
1056
|
-
nx: cachedData.nx,
|
|
1057
|
-
ny: cachedData.ny,
|
|
1058
|
-
scale: cachedData.scale,
|
|
1059
|
-
offset: cachedData.offset,
|
|
1060
|
-
missing: cachedData.missing,
|
|
1061
|
-
gridDef: cachedData.gridDef,
|
|
1062
|
-
variable: variable,
|
|
1063
|
-
units: units,
|
|
1064
|
-
scaleType: cachedData.scaleType
|
|
1065
|
-
};
|
|
1066
|
-
wxGridVerbose('gpuUploadFromFile', {
|
|
1067
|
-
cacheKey,
|
|
1068
|
-
nx: cachedData.nx,
|
|
1069
|
-
ny: cachedData.ny,
|
|
1070
|
-
filePathSuffix: String(cachedData.filePath).split('/').pop()
|
|
722
|
+
const u = W.current.get(i);
|
|
723
|
+
if (!u) return Z("updateGPUNoCache", {
|
|
724
|
+
cacheKey: i,
|
|
725
|
+
cacheSize: W.current.size,
|
|
726
|
+
sampleKeys: Array.from(W.current.keys()).slice(0, 5)
|
|
727
|
+
}), !1;
|
|
728
|
+
if (!p.current) return Z("updateGPUNoGridLayerRef", {
|
|
729
|
+
cacheKey: i
|
|
730
|
+
}), !1;
|
|
731
|
+
(!pe.current || pe.current.model !== (N ? "mrms" : a) || pe.current.variable !== s) && (p.current.updateGeometry(u.corners, u.gridDef), pe.current = {
|
|
732
|
+
model: N ? "mrms" : a,
|
|
733
|
+
variable: s
|
|
1071
734
|
});
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
// Trigger a re-render if we already have data loaded
|
|
1091
|
-
if (hasInitialLoad.current) {
|
|
1092
|
-
core._emitStateChange();
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}, [core, props.customColormaps]);
|
|
1096
|
-
const getValueAtPoint = async (lng, lat) => {
|
|
1097
|
-
if (!core) {
|
|
1098
|
-
return null;
|
|
1099
|
-
}
|
|
1100
|
-
if (NEXRAD_NATIVE && core.state?.isNexrad) {
|
|
1101
|
-
return getNexradInspectPayloadAt(lng, lat);
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
// ADD THIS: Check if we have valid data before attempting inspection
|
|
1105
|
-
if (!currentGridDataRef.current) {
|
|
1106
|
-
return null;
|
|
1107
|
-
}
|
|
1108
|
-
try {
|
|
1109
|
-
const gridIndices = core._getGridIndexFromLngLat(lng, lat);
|
|
1110
|
-
if (!gridIndices) return null;
|
|
1111
|
-
const {
|
|
1112
|
-
i,
|
|
1113
|
-
j
|
|
1114
|
-
} = gridIndices;
|
|
1115
|
-
const value = await InspectorModule.getValueAtGridIndex(i, j);
|
|
1116
|
-
if (value === null) {
|
|
1117
|
-
return null;
|
|
1118
|
-
}
|
|
1119
|
-
const {
|
|
1120
|
-
colormap,
|
|
1121
|
-
baseUnit
|
|
1122
|
-
} = core._getColormapForVariable(core.state.variable);
|
|
1123
|
-
const displayUnit = core._getTargetUnit(baseUnit, core.state.units);
|
|
1124
|
-
const finalColormap = core._convertColormapUnits(colormap, baseUnit, displayUnit);
|
|
1125
|
-
const minThreshold = finalColormap[0];
|
|
1126
|
-
if (value < minThreshold) {
|
|
1127
|
-
return null;
|
|
735
|
+
const A = `${s}-${w}`;
|
|
736
|
+
if (!ge.current || ge.current.key !== A) {
|
|
737
|
+
const {
|
|
738
|
+
colormap: y,
|
|
739
|
+
baseUnit: M
|
|
740
|
+
} = t._getColormapForVariable(s),
|
|
741
|
+
U = t._getTargetUnit(M, w),
|
|
742
|
+
E = t._convertColormapUnits(y, M, U);
|
|
743
|
+
let K;
|
|
744
|
+
s === "ptypeRefl" || s === "ptypeRate" ? N ? K = [5, 380] : K = [5, 380] : K = [E[0], E[E.length - 2]];
|
|
745
|
+
const Y = et(E),
|
|
746
|
+
D = (0, _base64Js.fromByteArray)(Y);
|
|
747
|
+
p.current.updateColormapTexture(D), ge.current = {
|
|
748
|
+
key: A
|
|
749
|
+
}, ke.current = K, Me(q => ({
|
|
750
|
+
...q,
|
|
751
|
+
dataRange: K
|
|
752
|
+
}));
|
|
1128
753
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
754
|
+
if (u.filePath) p.current.updateDataTextureFromFile(u.filePath, u.nx, u.ny, u.scale, u.offset, u.missing, u.scaleType), De.current = {
|
|
755
|
+
nx: u.nx,
|
|
756
|
+
ny: u.ny,
|
|
757
|
+
scale: u.scale,
|
|
758
|
+
offset: u.offset,
|
|
759
|
+
missing: u.missing,
|
|
760
|
+
gridDef: u.gridDef,
|
|
761
|
+
variable: s,
|
|
762
|
+
units: w,
|
|
763
|
+
scaleType: u.scaleType
|
|
764
|
+
}, z("gpuUploadFromFile", {
|
|
765
|
+
cacheKey: i,
|
|
766
|
+
nx: u.nx,
|
|
767
|
+
ny: u.ny,
|
|
768
|
+
filePathSuffix: String(u.filePath).split("/").pop()
|
|
769
|
+
});else return Z("updateGPUNoFilePath", {
|
|
770
|
+
cacheKey: i
|
|
771
|
+
}), !1;
|
|
772
|
+
return p.current && p.current.updateDataParameters && p.current.updateDataParameters(u.scale, u.offset, u.missing), !0;
|
|
773
|
+
},
|
|
774
|
+
he = (0, _react.useRef)(null),
|
|
775
|
+
le = (0, _react.useRef)(null);
|
|
776
|
+
(0, _react.useEffect)(() => {
|
|
777
|
+
t && m.customColormaps && (t.customColormaps = m.customColormaps, ae.current && t._emitStateChange());
|
|
778
|
+
}, [t, m.customColormaps]);
|
|
779
|
+
const lt = async (r, a) => {
|
|
780
|
+
if (!t) return null;
|
|
781
|
+
if (t.state?.isNexrad) {
|
|
782
|
+
const e = X.current;
|
|
783
|
+
return e ? e.getInspectPayload(r, a, ht(t.state)) : null;
|
|
1133
784
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
785
|
+
if (!De.current) return null;
|
|
786
|
+
try {
|
|
787
|
+
const e = t._getGridIndexFromLngLat(r, a);
|
|
788
|
+
if (!e) return null;
|
|
789
|
+
const {
|
|
790
|
+
i: o,
|
|
791
|
+
j: F
|
|
792
|
+
} = e,
|
|
793
|
+
s = await kt.getValueAtGridIndex(o, F);
|
|
794
|
+
if (s === null) return null;
|
|
795
|
+
const {
|
|
796
|
+
colormap: w,
|
|
797
|
+
baseUnit: N
|
|
798
|
+
} = t._getColormapForVariable(t.state.variable),
|
|
799
|
+
c = t._getTargetUnit(N, t.state.units),
|
|
800
|
+
i = t._convertColormapUnits(w, N, c)[0];
|
|
801
|
+
return s < i || s < i || !isFinite(s) ? null : {
|
|
802
|
+
value: s,
|
|
803
|
+
unit: c,
|
|
804
|
+
variable: {
|
|
805
|
+
code: t.state.variable,
|
|
806
|
+
name: t.getVariableDisplayName(t.state.variable)
|
|
807
|
+
},
|
|
808
|
+
lngLat: {
|
|
809
|
+
lng: r,
|
|
810
|
+
lat: a
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
} catch {
|
|
1137
814
|
return null;
|
|
1138
815
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
const {
|
|
1163
|
-
isMRMS,
|
|
1164
|
-
isSatellite,
|
|
1165
|
-
isNexrad,
|
|
1166
|
-
model: currentModel,
|
|
1167
|
-
variable: currentVariable,
|
|
1168
|
-
date,
|
|
1169
|
-
run
|
|
1170
|
-
} = s;
|
|
1171
|
-
if (isSatellite) {
|
|
1172
|
-
const prevTimeline = core._computeSatelliteTimeline();
|
|
1173
|
-
const prevTimes = [...(prevTimeline.unixTimes || [])].map(t => Number(t)).filter(t => !Number.isNaN(t)).sort((a, b) => a - b);
|
|
1174
|
-
const prevMax = prevTimes.length ? prevTimes[prevTimes.length - 1] : null;
|
|
1175
|
-
const curSat = s.satelliteTimestamp == null ? null : Number(s.satelliteTimestamp);
|
|
1176
|
-
await core.fetchSatelliteListing(true);
|
|
1177
|
-
core._emitStateChange();
|
|
1178
|
-
const nextTimeline = core._computeSatelliteTimeline();
|
|
1179
|
-
const nextTimes = [...(nextTimeline.unixTimes || [])].map(t => Number(t)).filter(t => !Number.isNaN(t)).sort((a, b) => a - b);
|
|
1180
|
-
const newMax = nextTimes.length ? nextTimes[nextTimes.length - 1] : null;
|
|
1181
|
-
if (prevMax != null && curSat != null && curSat === prevMax && newMax != null && newMax > prevMax) {
|
|
1182
|
-
await core.setSatelliteTimestamp(newMax);
|
|
1183
|
-
} else if (curSat != null && newMax != null && nextTimes.length && !nextTimes.includes(curSat)) {
|
|
1184
|
-
await core.setSatelliteTimestamp(newMax);
|
|
1185
|
-
}
|
|
816
|
+
},
|
|
817
|
+
We = (0, _react.useRef)(lt);
|
|
818
|
+
We.current = lt;
|
|
819
|
+
const Se = (0, _react.useMemo)(() => async () => {
|
|
820
|
+
if (!t) return;
|
|
821
|
+
const r = t.state,
|
|
822
|
+
{
|
|
823
|
+
isMRMS: a,
|
|
824
|
+
isSatellite: e,
|
|
825
|
+
isNexrad: o,
|
|
826
|
+
model: F,
|
|
827
|
+
variable: s,
|
|
828
|
+
date: w,
|
|
829
|
+
run: N
|
|
830
|
+
} = r;
|
|
831
|
+
if (e) {
|
|
832
|
+
const c = [...(t._computeSatelliteTimeline().unixTimes || [])].map(M => Number(M)).filter(M => !Number.isNaN(M)).sort((M, U) => M - U),
|
|
833
|
+
i = c.length ? c[c.length - 1] : null,
|
|
834
|
+
u = r.satelliteTimestamp == null ? null : Number(r.satelliteTimestamp);
|
|
835
|
+
await t.fetchSatelliteListing(!0), t._emitStateChange();
|
|
836
|
+
const A = [...(t._computeSatelliteTimeline().unixTimes || [])].map(M => Number(M)).filter(M => !Number.isNaN(M)).sort((M, U) => M - U),
|
|
837
|
+
y = A.length ? A[A.length - 1] : null;
|
|
838
|
+
i != null && u != null && u === i && y != null && y > i ? await t.setSatelliteTimestamp(y) : u != null && y != null && A.length && !A.includes(u) && (await t.setSatelliteTimestamp(y));
|
|
1186
839
|
return;
|
|
1187
840
|
}
|
|
1188
|
-
if (
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
await
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
await core.setNexradTimestamp(newMax);
|
|
1200
|
-
} else if (curNx != null && newMax != null && filteredAfter.length && !filteredAfter.includes(curNx)) {
|
|
1201
|
-
await core.setNexradTimestamp(newMax);
|
|
1202
|
-
}
|
|
841
|
+
if (o && r.nexradSite) {
|
|
842
|
+
const c = t._nexradTimesCacheKey(),
|
|
843
|
+
i = c ? t.nexradTimesByStation[c]?.unixTimes : [],
|
|
844
|
+
u = t._getFilteredNexradTimestampsForVariable(i || []),
|
|
845
|
+
A = u.length ? u[u.length - 1] : null,
|
|
846
|
+
y = r.nexradTimestamp == null ? null : Number(r.nexradTimestamp);
|
|
847
|
+
await t.refreshNexradTimes(), t._emitStateChange();
|
|
848
|
+
const M = c ? t.nexradTimesByStation[c]?.unixTimes : [],
|
|
849
|
+
U = t._getFilteredNexradTimestampsForVariable(M || []),
|
|
850
|
+
E = U.length ? U[U.length - 1] : null;
|
|
851
|
+
A != null && y != null && y === A && E != null && E > A ? await t.setNexradTimestamp(E) : y != null && E != null && U.length && !U.includes(y) && (await t.setNexradTimestamp(E));
|
|
1203
852
|
return;
|
|
1204
853
|
}
|
|
1205
|
-
if (
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
core.mrmsStatus = mrmsStatus;
|
|
1214
|
-
core._emitStateChange(); // Update UI slider without changing selection
|
|
1215
|
-
|
|
1216
|
-
// ... (Keep your existing preloading logic here) ...
|
|
854
|
+
if (a) {
|
|
855
|
+
const c = new Set(t.mrmsStatus?.[s] || []),
|
|
856
|
+
i = await t.fetchMRMSStatus(!0),
|
|
857
|
+
u = i?.[s] || [];
|
|
858
|
+
if (u.length === 0) return;
|
|
859
|
+
const A = u.filter(y => !c.has(y));
|
|
860
|
+
if (A.length > 0) {
|
|
861
|
+
t.mrmsStatus = i, t._emitStateChange();
|
|
1217
862
|
const {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
const
|
|
1227
|
-
if (
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
(0, _aguaceroCoreDebugHooks.logProcessFrameAuthMismatch)(
|
|
1235
|
-
phase:
|
|
1236
|
-
cacheKey
|
|
1237
|
-
})
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
originalOffset: result.offset
|
|
863
|
+
corners: y,
|
|
864
|
+
gridDef: M
|
|
865
|
+
} = t._getGridCornersAndDef("mrms"),
|
|
866
|
+
{
|
|
867
|
+
nx: U,
|
|
868
|
+
ny: E
|
|
869
|
+
} = M.grid_params;
|
|
870
|
+
A.forEach(Y => {
|
|
871
|
+
const D = `mrms-${Y}-${s}`;
|
|
872
|
+
if (W.current.has(D)) return;
|
|
873
|
+
const q = new Date(Y * 1e3),
|
|
874
|
+
de = q.getUTCFullYear(),
|
|
875
|
+
ye = (q.getUTCMonth() + 1).toString().padStart(2, "0"),
|
|
876
|
+
$ = q.getUTCDate().toString().padStart(2, "0"),
|
|
877
|
+
d = `/grids/mrms/${de}${ye}${$}/${Y}/0/${s}/0`,
|
|
878
|
+
G = (0, _aguaceroRnDebug.augmentProcessFrameOptionsForDebug)(Ze(t.baseGridUrl, d, t.apiKey, t.bundleId, te, t), t);
|
|
879
|
+
(0, _aguaceroCoreDebugHooks.logProcessFrameAuthMismatch)(t, G, {
|
|
880
|
+
phase: "mrmsRefresh",
|
|
881
|
+
cacheKey: D
|
|
882
|
+
}), qe.processFrame(G).then(n => {
|
|
883
|
+
if (!n || !n.filePath) return;
|
|
884
|
+
const R = {
|
|
885
|
+
filePath: n.filePath,
|
|
886
|
+
nx: U,
|
|
887
|
+
ny: E,
|
|
888
|
+
scale: n.scale,
|
|
889
|
+
offset: n.offset,
|
|
890
|
+
missing: n.missing,
|
|
891
|
+
corners: y,
|
|
892
|
+
gridDef: M,
|
|
893
|
+
scaleType: n.scaleType,
|
|
894
|
+
originalScale: n.scale,
|
|
895
|
+
originalOffset: n.offset
|
|
1252
896
|
};
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
wxGridWarn('mrmsRefreshFrameError', {
|
|
1263
|
-
cacheKey,
|
|
1264
|
-
code: e?.code,
|
|
1265
|
-
message: e?.message
|
|
1266
|
-
});
|
|
1267
|
-
}
|
|
897
|
+
W.current.set(D, R), _reactNative.Platform.OS === "ios" && p.current?.primeGpuCache && p.current.primeGpuCache({
|
|
898
|
+
[D]: R
|
|
899
|
+
});
|
|
900
|
+
}).catch(n => {
|
|
901
|
+
n && (n.code === "E_CANCELLED" || n?.userInfo?.code === "E_CANCELLED" || typeof n?.message == "string" && n.message.includes("superseded")) || Z("mrmsRefreshFrameError", {
|
|
902
|
+
cacheKey: D,
|
|
903
|
+
code: n?.code,
|
|
904
|
+
message: n?.message
|
|
905
|
+
});
|
|
1268
906
|
});
|
|
1269
907
|
});
|
|
1270
|
-
const
|
|
1271
|
-
|
|
1272
|
-
if (!
|
|
1273
|
-
const
|
|
1274
|
-
|
|
908
|
+
const K = new Set(u);
|
|
909
|
+
c.forEach(Y => {
|
|
910
|
+
if (!K.has(Y)) {
|
|
911
|
+
const D = `mrms-${Y}-${s}`;
|
|
912
|
+
W.current.delete(D);
|
|
1275
913
|
}
|
|
1276
914
|
});
|
|
1277
915
|
}
|
|
1278
916
|
} else {
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
if (statusChanged) {
|
|
1283
|
-
core._emitStateChange();
|
|
1284
|
-
}
|
|
1285
|
-
const latestRun = findLatestModelRun(modelStatus, currentModel);
|
|
1286
|
-
if (!latestRun) return;
|
|
917
|
+
const c = t.modelStatus,
|
|
918
|
+
i = await t.fetchModelStatus(!0);
|
|
919
|
+
if (JSON.stringify(c) !== JSON.stringify(i) && t._emitStateChange(), !Gt(i, F)) return;
|
|
1287
920
|
}
|
|
1288
|
-
}, [
|
|
921
|
+
}, [t]);
|
|
1289
922
|
(0, _react.useEffect)(() => {
|
|
1290
|
-
if (!
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1301
|
-
const stateKey = newState.isNexrad ? `nx-${newState.nexradSite}-${newState.nexradProduct}-${newState.nexradDataSource}-${newState.nexradTimestamp}-${newState.nexradTilt}-${newState.units}-${newState.model}-${newState.variable}-${newState.mrmsTimestamp}-${newState.forecastHour}-dur:${newState.nexradDurationValue ?? ''}-tl:${nexradObsTimelineSig(newState)}` : newState.isSatellite ? `sat-${newState.satelliteInstrumentId}-${newState.satelliteSectorLabel}-${newState.satelliteChannel}-${newState.satelliteTimestamp}-${newState.variable}-${newState.units}-${newState.opacity}-dur:${newState.satelliteDurationValue ?? ''}-tl:${satelliteObsTimelineSig(newState)}` : `${newState.model}-${newState.variable}-${newState.date}-${newState.run}-${newState.forecastHour}-${newState.units}-${newState.mrmsTimestamp}`;
|
|
1302
|
-
const sameTimeline = newState.isNexrad ? newState.nexradTimestamp === previousStateRef.current?.nexradTimestamp && newState.nexradSite === previousStateRef.current?.nexradSite && newState.nexradProduct === previousStateRef.current?.nexradProduct && Number(newState.nexradTilt) === Number(previousStateRef.current?.nexradTilt) && newState.nexradDurationValue === previousStateRef.current?.nexradDurationValue && nexradObsTimelineSig(newState) === nexradObsTimelineSig(previousStateRef.current) : newState.isSatellite ? newState.satelliteTimestamp === previousStateRef.current?.satelliteTimestamp && newState.satelliteInstrumentId === previousStateRef.current?.satelliteInstrumentId && newState.satelliteSectorLabel === previousStateRef.current?.satelliteSectorLabel && newState.satelliteChannel === previousStateRef.current?.satelliteChannel && newState.satelliteDurationValue === previousStateRef.current?.satelliteDurationValue && satelliteObsTimelineSig(newState) === satelliteObsTimelineSig(previousStateRef.current) : newState.forecastHour === previousStateRef.current?.forecastHour && newState.mrmsTimestamp === previousStateRef.current?.mrmsTimestamp;
|
|
1303
|
-
const sameModeAnchor = newState.isSatellite ? newState.satelliteInstrumentId === previousStateRef.current?.satelliteInstrumentId && newState.satelliteSectorLabel === previousStateRef.current?.satelliteSectorLabel && newState.satelliteChannel === previousStateRef.current?.satelliteChannel : newState.model === previousStateRef.current?.model && newState.isMRMS === previousStateRef.current?.isMRMS;
|
|
1304
|
-
const isOpacityOnlyChange = hasInitialLoad.current && newState.opacity !== renderProps.opacity && newState.variable === previousStateRef.current?.variable && sameTimeline && sameModeAnchor && newState.units === previousStateRef.current?.units;
|
|
1305
|
-
const isPlayStateOnlyChange = hasInitialLoad.current && newState.isPlaying !== previousStateRef.current?.isPlaying && newState.variable === previousStateRef.current?.variable && sameTimeline && sameModeAnchor && newState.units === previousStateRef.current?.units && newState.opacity === previousStateRef.current?.opacity;
|
|
1306
|
-
if (!isOpacityOnlyChange && !isPlayStateOnlyChange && lastProcessedState.current === stateKey) {
|
|
1307
|
-
previousStateRef.current = newState;
|
|
923
|
+
if (!t) return;
|
|
924
|
+
const r = e => {
|
|
925
|
+
l.current || (l.current = t.state), (!l.current || e.variable !== l.current.variable) && p.current?.setVariable && p.current.setVariable(e.variable);
|
|
926
|
+
const o = e.isNexrad ? `nx-${e.nexradSite}-${e.nexradProduct}-${e.nexradDataSource}-${e.nexradTimestamp}-${e.nexradTilt}-${e.opacity}` : e.isSatellite ? `sat-${e.satelliteInstrumentId}-${e.satelliteSectorLabel}-${e.satelliteChannel}-${e.satelliteTimestamp}-${e.variable}-${e.units}-${e.opacity}-dur:${e.satelliteDurationValue ?? ""}-tl:${ue(e)}` : `${e.model}-${e.variable}-${e.date}-${e.run}-${e.forecastHour}-${e.units}-${e.mrmsTimestamp}`,
|
|
927
|
+
F = e.isNexrad ? e.nexradTimestamp === l.current?.nexradTimestamp && e.nexradSite === l.current?.nexradSite && e.nexradProduct === l.current?.nexradProduct && Number(e.nexradTilt) === Number(l.current?.nexradTilt) : e.isSatellite ? e.satelliteTimestamp === l.current?.satelliteTimestamp && e.satelliteInstrumentId === l.current?.satelliteInstrumentId && e.satelliteSectorLabel === l.current?.satelliteSectorLabel && e.satelliteChannel === l.current?.satelliteChannel && e.satelliteDurationValue === l.current?.satelliteDurationValue && ue(e) === ue(l.current) : e.forecastHour === l.current?.forecastHour && e.mrmsTimestamp === l.current?.mrmsTimestamp,
|
|
928
|
+
s = e.isSatellite ? e.satelliteInstrumentId === l.current?.satelliteInstrumentId && e.satelliteSectorLabel === l.current?.satelliteSectorLabel && e.satelliteChannel === l.current?.satelliteChannel : e.model === l.current?.model && e.isMRMS === l.current?.isMRMS,
|
|
929
|
+
w = ae.current && e.opacity !== Ve.opacity && e.variable === l.current?.variable && F && s && e.units === l.current?.units,
|
|
930
|
+
N = ae.current && e.isPlaying !== l.current?.isPlaying && e.variable === l.current?.variable && F && s && e.units === l.current?.units && e.opacity === l.current?.opacity;
|
|
931
|
+
if (!w && !N && He.current === o) {
|
|
932
|
+
l.current = e;
|
|
1308
933
|
return;
|
|
1309
934
|
}
|
|
1310
|
-
if (
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
willSyncNative: true
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
if (newState.isSatellite && prev?.isSatellite) {
|
|
1328
|
-
if (newState.satelliteDurationValue !== prev.satelliteDurationValue || satelliteObsTimelineSig(newState) !== satelliteObsTimelineSig(prev)) {
|
|
1329
|
-
wxGridVerbose('iosSatelliteTimelineWindowChanged', {
|
|
1330
|
-
duration: {
|
|
1331
|
-
from: prev.satelliteDurationValue,
|
|
1332
|
-
to: newState.satelliteDurationValue
|
|
1333
|
-
},
|
|
1334
|
-
timelineSig: {
|
|
1335
|
-
from: satelliteObsTimelineSig(prev),
|
|
1336
|
-
to: satelliteObsTimelineSig(newState)
|
|
1337
|
-
},
|
|
1338
|
-
willSyncNative: true
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
if (!isOpacityOnlyChange && !isPlayStateOnlyChange) {
|
|
1344
|
-
lastProcessedState.current = stateKey;
|
|
935
|
+
if (pt() && _reactNative.Platform.OS === "ios" && e.isSatellite && l.current?.isSatellite) {
|
|
936
|
+
const i = l.current;
|
|
937
|
+
e.isSatellite && i?.isSatellite && (e.satelliteDurationValue !== i.satelliteDurationValue || ue(e) !== ue(i)) && z("iosSatelliteTimelineWindowChanged", {
|
|
938
|
+
duration: {
|
|
939
|
+
from: i.satelliteDurationValue,
|
|
940
|
+
to: e.satelliteDurationValue
|
|
941
|
+
},
|
|
942
|
+
timelineSig: {
|
|
943
|
+
from: ue(i),
|
|
944
|
+
to: ue(e)
|
|
945
|
+
},
|
|
946
|
+
willSyncNative: !0
|
|
947
|
+
});
|
|
1345
948
|
}
|
|
1346
|
-
if (
|
|
1347
|
-
|
|
1348
|
-
...
|
|
1349
|
-
opacity:
|
|
1350
|
-
}))
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
satelliteLayerRef.current?.updateSatelliteStyle?.(JSON.stringify({
|
|
1356
|
-
visible: newState.visible !== false,
|
|
1357
|
-
opacity: newState.opacity ?? 1,
|
|
1358
|
-
fillSmoothing: 0
|
|
1359
|
-
}));
|
|
1360
|
-
}
|
|
1361
|
-
previousStateRef.current = newState;
|
|
949
|
+
if (!w && !N && (He.current = o), w) {
|
|
950
|
+
Me(i => ({
|
|
951
|
+
...i,
|
|
952
|
+
opacity: e.opacity
|
|
953
|
+
})), ie && e.isSatellite && Ne.current?.updateSatelliteStyle?.(JSON.stringify({
|
|
954
|
+
visible: e.visible !== !1,
|
|
955
|
+
opacity: e.opacity ?? 1,
|
|
956
|
+
fillSmoothing: 0
|
|
957
|
+
})), Q && e.isNexrad && Ie(e), l.current = e;
|
|
1362
958
|
return;
|
|
1363
959
|
}
|
|
1364
|
-
if (
|
|
1365
|
-
|
|
960
|
+
if (N) {
|
|
961
|
+
l.current = e;
|
|
1366
962
|
return;
|
|
1367
963
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
}));
|
|
1375
|
-
nexradControllerRef.current?.applyStyleFromState?.(newState);
|
|
1376
|
-
previousStateRef.current = newState;
|
|
964
|
+
if (ae.current && e.model === l.current.model && e.isMRMS === l.current.isMRMS && e.variable === l.current.variable && e.date === l.current.date && e.run === l.current.run && (e.isNexrad ? e.nexradTimestamp === l.current.nexradTimestamp && e.nexradSite === l.current.nexradSite && e.nexradProduct === l.current.nexradProduct : e.forecastHour === l.current.forecastHour && e.mrmsTimestamp === l.current.mrmsTimestamp) && e.units !== l.current.units) {
|
|
965
|
+
if (Q && e.isNexrad) {
|
|
966
|
+
Me(q => ({
|
|
967
|
+
...q,
|
|
968
|
+
opacity: e.opacity
|
|
969
|
+
})), Ie(e), l.current = e;
|
|
1377
970
|
return;
|
|
1378
971
|
}
|
|
1379
972
|
const {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
if (
|
|
973
|
+
variable: i,
|
|
974
|
+
units: u,
|
|
975
|
+
isMRMS: A,
|
|
976
|
+
mrmsTimestamp: y,
|
|
977
|
+
model: M,
|
|
978
|
+
date: U,
|
|
979
|
+
run: E,
|
|
980
|
+
forecastHour: K
|
|
981
|
+
} = e,
|
|
982
|
+
Y = A ? `mrms-${y}-${i}` : `${M}-${U}-${E}-${K}-${i}`,
|
|
983
|
+
D = W.current.get(Y);
|
|
984
|
+
if (D && D.originalScale !== void 0 && D.originalOffset !== void 0) {
|
|
1392
985
|
const {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
dataOffset = newOffset;
|
|
1412
|
-
} else {
|
|
1413
|
-
const convertedOffset = conversionFunc(dataOffset);
|
|
1414
|
-
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
1415
|
-
dataScale = convertedOffsetPlusScale - convertedOffset;
|
|
1416
|
-
dataOffset = convertedOffset;
|
|
1417
|
-
}
|
|
986
|
+
baseUnit: q
|
|
987
|
+
} = t._getColormapForVariable(i),
|
|
988
|
+
de = t._getTargetUnit(q, u),
|
|
989
|
+
ye = (_javascriptSdk.DICTIONARIES?.fld?.[i] || {}).defaultUnit || q;
|
|
990
|
+
let $ = D.originalScale,
|
|
991
|
+
d = D.originalOffset;
|
|
992
|
+
if (ye !== q) {
|
|
993
|
+
const f = (0, _javascriptSdk.getUnitConversionFunction)(ye, q);
|
|
994
|
+
if (f) if (D.scaleType === "sqrt") {
|
|
995
|
+
const C = d * d,
|
|
996
|
+
b = (d + $) * (d + $),
|
|
997
|
+
S = f(C),
|
|
998
|
+
T = f(b),
|
|
999
|
+
L = Math.sqrt(Math.abs(S)) * Math.sign(S);
|
|
1000
|
+
$ = Math.sqrt(Math.abs(T)) * Math.sign(T) - L, d = L;
|
|
1001
|
+
} else {
|
|
1002
|
+
const C = f(d);
|
|
1003
|
+
$ = f(d + $) - C, d = C;
|
|
1418
1004
|
}
|
|
1419
1005
|
}
|
|
1420
|
-
if (
|
|
1421
|
-
const
|
|
1422
|
-
if (
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
} else {
|
|
1433
|
-
const convertedOffset = conversionFunc(dataOffset);
|
|
1434
|
-
const convertedOffsetPlusScale = conversionFunc(dataOffset + dataScale);
|
|
1435
|
-
dataScale = convertedOffsetPlusScale - convertedOffset;
|
|
1436
|
-
dataOffset = convertedOffset;
|
|
1437
|
-
}
|
|
1006
|
+
if (q !== de) {
|
|
1007
|
+
const f = (0, _javascriptSdk.getUnitConversionFunction)(q, de);
|
|
1008
|
+
if (f) if (D.scaleType === "sqrt") {
|
|
1009
|
+
const C = d * d,
|
|
1010
|
+
b = (d + $) * (d + $),
|
|
1011
|
+
S = f(C),
|
|
1012
|
+
T = f(b),
|
|
1013
|
+
L = Math.sqrt(Math.abs(S)) * Math.sign(S);
|
|
1014
|
+
$ = Math.sqrt(Math.abs(T)) * Math.sign(T) - L, d = L;
|
|
1015
|
+
} else {
|
|
1016
|
+
const C = f(d);
|
|
1017
|
+
$ = f(d + $) - C, d = C;
|
|
1438
1018
|
}
|
|
1439
1019
|
}
|
|
1440
1020
|
const {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
let
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
}));
|
|
1457
|
-
if (gridLayerRef.current && gridLayerRef.current.updateDataParameters) {
|
|
1458
|
-
const scaleTypeValue = cachedData.scaleType === 'sqrt' ? 1 : 0;
|
|
1459
|
-
gridLayerRef.current.updateDataParameters(dataScale, dataOffset, cachedData.missing, scaleTypeValue);
|
|
1021
|
+
colormap: G
|
|
1022
|
+
} = t._getColormapForVariable(i),
|
|
1023
|
+
n = t._convertColormapUnits(G, q, de);
|
|
1024
|
+
let R = i === "ptypeRefl" || i === "ptypeRate" ? [5, 380] : [n[0], n[n.length - 2]];
|
|
1025
|
+
const h = et(n),
|
|
1026
|
+
k = (0, _base64Js.fromByteArray)(h);
|
|
1027
|
+
if (p.current.updateColormapTexture(k), ge.current = {
|
|
1028
|
+
key: `${i}-${u}`
|
|
1029
|
+
}, ke.current = R, Me(f => ({
|
|
1030
|
+
...f,
|
|
1031
|
+
dataRange: R,
|
|
1032
|
+
opacity: e.opacity
|
|
1033
|
+
})), p.current && p.current.updateDataParameters) {
|
|
1034
|
+
const f = D.scaleType === "sqrt" ? 1 : 0;
|
|
1035
|
+
p.current.updateDataParameters($, d, D.missing, f);
|
|
1460
1036
|
}
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1463
|
-
...
|
|
1464
|
-
scale:
|
|
1465
|
-
offset:
|
|
1037
|
+
const P = A ? `mrms-${y}-${i}` : `${M}-${U}-${E}-${K}-${i}`;
|
|
1038
|
+
W.current.set(P, {
|
|
1039
|
+
...D,
|
|
1040
|
+
scale: $,
|
|
1041
|
+
offset: d
|
|
1466
1042
|
});
|
|
1467
1043
|
}
|
|
1468
|
-
|
|
1044
|
+
l.current = e;
|
|
1469
1045
|
return;
|
|
1470
1046
|
}
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
prevModel: prev?.model
|
|
1047
|
+
const c = l.current;
|
|
1048
|
+
if (!ae.current || e.isNexrad !== c?.isNexrad || e.isSatellite !== c?.isSatellite || e.isNexrad && c?.isNexrad && (e.nexradSite !== c.nexradSite || e.nexradDataSource !== c.nexradDataSource || e.nexradProduct !== c.nexradProduct) || e.isSatellite && c?.isSatellite && (e.satelliteInstrumentId !== c.satelliteInstrumentId || e.satelliteSectorLabel !== c.satelliteSectorLabel || e.satelliteChannel !== c.satelliteChannel) || !e.isNexrad && !e.isSatellite && (e.model !== c?.model || e.isMRMS !== c?.isMRMS || e.variable !== c?.variable || e.date !== c?.date || e.run !== c?.run)) {
|
|
1049
|
+
z("needsFullLoad", {
|
|
1050
|
+
variable: e.variable,
|
|
1051
|
+
isMRMS: e.isMRMS,
|
|
1052
|
+
model: e.model,
|
|
1053
|
+
isInitial: !ae.current,
|
|
1054
|
+
prevVariable: c?.variable,
|
|
1055
|
+
prevModel: c?.model
|
|
1481
1056
|
});
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
if (
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
if (satelliteIdentityChange) {
|
|
1491
|
-
satelliteControllerRef.current?.destroy();
|
|
1492
|
-
satelliteControllerRef.current = null;
|
|
1493
|
-
}
|
|
1494
|
-
if (gridLayerRef.current) {
|
|
1495
|
-
gridLayerRef.current.setVariable(newState.variable);
|
|
1496
|
-
gridLayerRef.current.clear();
|
|
1497
|
-
if (_reactNative.Platform.OS === 'ios' && gridLayerRef.current.clearGpuCache) {
|
|
1498
|
-
gridLayerRef.current.clearGpuCache();
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
hasPreloadedRef.current = false;
|
|
1502
|
-
preloadGenerationRef.current += 1;
|
|
1503
|
-
preloadedDataCache.current.clear();
|
|
1504
|
-
cachedGeometry.current = null;
|
|
1505
|
-
cachedColormap.current = null;
|
|
1506
|
-
currentGridDataRef.current = null;
|
|
1507
|
-
WeatherFrameProcessorModule.cancelAllFrames();
|
|
1508
|
-
wxGridVerbose('cancelAllFrames', {
|
|
1509
|
-
reason: 'needsFullLoad',
|
|
1510
|
-
variable: newState.variable,
|
|
1511
|
-
generation: preloadGenerationRef.current
|
|
1512
|
-
});
|
|
1513
|
-
if (!newState.variable) {
|
|
1514
|
-
previousStateRef.current = newState;
|
|
1057
|
+
const i = Q && (e.isNexrad !== c?.isNexrad || e.isNexrad && c?.isNexrad && (e.nexradSite !== c.nexradSite || e.nexradDataSource !== c.nexradDataSource || e.nexradProduct !== c.nexradProduct)),
|
|
1058
|
+
u = ie && (e.isSatellite !== c?.isSatellite || e.isSatellite && c?.isSatellite && (e.satelliteInstrumentId !== c.satelliteInstrumentId || e.satelliteSectorLabel !== c.satelliteSectorLabel || e.satelliteChannel !== c.satelliteChannel));
|
|
1059
|
+
if (i && (X.current?.destroy(), X.current = null), u && (re.current?.destroy(), re.current = null), p.current && (p.current.setVariable(e.variable), p.current.clear(), _reactNative.Platform.OS === "ios" && p.current.clearGpuCache && p.current.clearGpuCache()), ne.current = !1, Le.current += 1, W.current.clear(), pe.current = null, ge.current = null, De.current = null, qe.cancelAllFrames(), z("cancelAllFrames", {
|
|
1060
|
+
reason: "needsFullLoad",
|
|
1061
|
+
variable: e.variable,
|
|
1062
|
+
generation: Le.current
|
|
1063
|
+
}), !e.variable) {
|
|
1064
|
+
l.current = e;
|
|
1515
1065
|
return;
|
|
1516
1066
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
variable: newState.variable,
|
|
1530
|
-
mrmsTimestamp: newState.mrmsTimestamp,
|
|
1531
|
-
forecastHour: newState.forecastHour
|
|
1532
|
-
});
|
|
1533
|
-
hasPreloadedRef.current = false;
|
|
1534
|
-
void preloadAllFramesToDisk(newState);
|
|
1535
|
-
}
|
|
1536
|
-
if (success && newState.opacity !== renderProps.opacity) {
|
|
1537
|
-
setRenderProps(prev => ({
|
|
1538
|
-
...prev,
|
|
1539
|
-
opacity: newState.opacity
|
|
1540
|
-
}));
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
if (NEXRAD_NATIVE && newState.isNexrad && newState.nexradSite && newState.nexradTimestamp != null) {
|
|
1544
|
-
const ctl = ensureNexradController();
|
|
1545
|
-
if (ctl) {
|
|
1546
|
-
hasInitialLoad.current = true;
|
|
1547
|
-
void ctl.sync(newState);
|
|
1548
|
-
nexradPreloadInteractionRef.current?.cancel?.();
|
|
1549
|
-
const preloadCancelled = {
|
|
1550
|
-
v: false
|
|
1551
|
-
};
|
|
1552
|
-
nexradPreloadInteractionRef.current = {
|
|
1553
|
-
cancel: () => {
|
|
1554
|
-
preloadCancelled.v = true;
|
|
1555
|
-
}
|
|
1556
|
-
};
|
|
1557
|
-
const nexradTimelineSnapshot = Array.isArray(newState.availableNexradTimestamps) ? newState.availableNexradTimestamps : [];
|
|
1558
|
-
const kickPreload = () => {
|
|
1559
|
-
nexradPreloadInteractionRef.current = null;
|
|
1560
|
-
if (preloadCancelled.v) {
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1563
|
-
const cur = nexradControllerRef.current;
|
|
1564
|
-
if (!cur) {
|
|
1565
|
-
return;
|
|
1566
|
-
}
|
|
1567
|
-
const s = core.state;
|
|
1568
|
-
if (!s.isNexrad || !s.nexradSite || s.nexradTimestamp == null) {
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
const coreTs = Array.isArray(s.availableNexradTimestamps) ? s.availableNexradTimestamps : [];
|
|
1572
|
-
const mergedTimestamps = coreTs.length > 0 ? coreTs : nexradTimelineSnapshot.length > 0 ? nexradTimelineSnapshot : [];
|
|
1573
|
-
const preloadState = {
|
|
1574
|
-
...s,
|
|
1575
|
-
availableNexradTimestamps: mergedTimestamps
|
|
1576
|
-
};
|
|
1577
|
-
cur.preloadAllAvailable(preloadState);
|
|
1578
|
-
};
|
|
1579
|
-
if (typeof queueMicrotask === 'function') {
|
|
1580
|
-
queueMicrotask(kickPreload);
|
|
1581
|
-
} else {
|
|
1582
|
-
setTimeout(kickPreload, 0);
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
} else if (NEXRAD_NATIVE && (!newState.isNexrad || !newState.nexradSite)) {
|
|
1586
|
-
nexradPreloadInteractionRef.current?.cancel?.();
|
|
1587
|
-
nexradPreloadInteractionRef.current = null;
|
|
1588
|
-
nexradControllerRef.current?.destroy();
|
|
1589
|
-
nexradControllerRef.current = null;
|
|
1067
|
+
!e.isNexrad && !e.isSatellite ? it(e) : Q && e.isNexrad ? Ie(e) : ie && e.isSatellite && (ae.current = !0);
|
|
1068
|
+
} else if (!e.isNexrad && (e.forecastHour !== l.current.forecastHour || e.isMRMS && e.mrmsTimestamp !== l.current.mrmsTimestamp)) {
|
|
1069
|
+
const i = yt(e);
|
|
1070
|
+
i || (Z("timelineGpuUpdateMiss", {
|
|
1071
|
+
isMRMS: e.isMRMS,
|
|
1072
|
+
variable: e.variable,
|
|
1073
|
+
mrmsTimestamp: e.mrmsTimestamp,
|
|
1074
|
+
forecastHour: e.forecastHour
|
|
1075
|
+
}), ne.current = !1, it(e)), i && e.opacity !== Ve.opacity && Me(u => ({
|
|
1076
|
+
...u,
|
|
1077
|
+
opacity: e.opacity
|
|
1078
|
+
}));
|
|
1590
1079
|
}
|
|
1591
|
-
if (
|
|
1592
|
-
(0, _satelliteBridgeDiag.satBridgeWarn)(
|
|
1593
|
-
satelliteInstrumentId:
|
|
1594
|
-
satelliteSectorLabel:
|
|
1595
|
-
satelliteChannel:
|
|
1596
|
-
timelineKeys: Object.keys(
|
|
1597
|
-
refHasSync:
|
|
1080
|
+
if (Q && e.isNexrad ? Ie(e) : Q && !e.isNexrad && (X.current?.destroy(), X.current = null), ie && e.isSatellite) {
|
|
1081
|
+
(0, _satelliteBridgeDiag.satBridgeWarn)("handleStateChange \u2192 satellite", {
|
|
1082
|
+
satelliteInstrumentId: e.satelliteInstrumentId ?? null,
|
|
1083
|
+
satelliteSectorLabel: e.satelliteSectorLabel ?? null,
|
|
1084
|
+
satelliteChannel: e.satelliteChannel ?? null,
|
|
1085
|
+
timelineKeys: Object.keys(e.satelliteTimeToFileMap || {}).length,
|
|
1086
|
+
refHasSync: !!Ne.current?.syncSatellite
|
|
1598
1087
|
});
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
} else {
|
|
1604
|
-
(0, _satelliteBridgeDiag.satBridgeWarn)('handleStateChange satellite: ensureSatelliteController returned null', {});
|
|
1605
|
-
}
|
|
1606
|
-
if (!newState.satelliteInstrumentId && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
1607
|
-
console.warn('[AguaceroWX][satellite] isSatellite is true but satelliteInstrumentId is missing — native sync still runs; timeline may be empty until core sets instrument.');
|
|
1608
|
-
}
|
|
1609
|
-
} else if (SATELLITE_NATIVE && !newState.isSatellite) {
|
|
1610
|
-
satelliteControllerRef.current?.destroy();
|
|
1611
|
-
satelliteControllerRef.current = null;
|
|
1612
|
-
}
|
|
1613
|
-
previousStateRef.current = newState;
|
|
1088
|
+
const i = at();
|
|
1089
|
+
i ? (ae.current = !0, i.sync(e)) : (0, _satelliteBridgeDiag.satBridgeWarn)("handleStateChange satellite: ensureSatelliteController returned null", {}), !e.satelliteInstrumentId && typeof __DEV__ < "u" && __DEV__ && console.warn("[AguaceroWX][satellite] isSatellite is true but satelliteInstrumentId is missing \u2014 native sync still runs; timeline may be empty until core sets instrument.");
|
|
1090
|
+
} else ie && !e.isSatellite && (re.current?.destroy(), re.current = null);
|
|
1091
|
+
l.current = e;
|
|
1614
1092
|
};
|
|
1615
|
-
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
// OPTIMIZATION: If playing (high speed), prioritize MAP update and skip debounce
|
|
1620
|
-
if (newState.isPlaying) {
|
|
1621
|
-
// 1. Update Map FIRST (Native Enqueue)
|
|
1622
|
-
if (handleStateChangeRef.current) {
|
|
1623
|
-
handleStateChangeRef.current(newState);
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
// 2. Update UI Slider SECOND
|
|
1627
|
-
// This ensures the heavy map frame is processing while React reconciles the slider
|
|
1628
|
-
props.onStateChange?.(newState);
|
|
1629
|
-
if (debounceTimeoutRef.current) {
|
|
1630
|
-
clearTimeout(debounceTimeoutRef.current);
|
|
1631
|
-
debounceTimeoutRef.current = null;
|
|
1632
|
-
}
|
|
1093
|
+
he.current = r;
|
|
1094
|
+
const a = e => {
|
|
1095
|
+
if (st(!!(e.isNexrad && e.nexradShowSitesPicker !== !1)), e.isPlaying) {
|
|
1096
|
+
he.current && he.current(e), m.onStateChange?.(e), le.current && (clearTimeout(le.current), le.current = null);
|
|
1633
1097
|
return;
|
|
1634
1098
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
const prevStable = previousStateRef.current;
|
|
1644
|
-
const sameTimelineStable = prevStable && (prevStable.isNexrad ? newState.nexradTimestamp === prevStable.nexradTimestamp && newState.nexradSite === prevStable.nexradSite && newState.nexradProduct === prevStable.nexradProduct && Number(newState.nexradTilt) === Number(prevStable.nexradTilt) && newState.nexradDurationValue === prevStable.nexradDurationValue && nexradObsTimelineSig(newState) === nexradObsTimelineSig(prevStable) : prevStable.isSatellite ? newState.satelliteTimestamp === prevStable.satelliteTimestamp && newState.satelliteInstrumentId === prevStable.satelliteInstrumentId && newState.satelliteSectorLabel === prevStable.satelliteSectorLabel && newState.satelliteChannel === prevStable.satelliteChannel && newState.satelliteDurationValue === prevStable.satelliteDurationValue && satelliteObsTimelineSig(newState) === satelliteObsTimelineSig(prevStable) : newState.forecastHour === prevStable.forecastHour && newState.mrmsTimestamp === prevStable.mrmsTimestamp);
|
|
1645
|
-
const sameModeStable = prevStable && (newState.isSatellite ? newState.satelliteInstrumentId === prevStable.satelliteInstrumentId && newState.satelliteSectorLabel === prevStable.satelliteSectorLabel && newState.satelliteChannel === prevStable.satelliteChannel : newState.model === prevStable.model && newState.isMRMS === prevStable.isMRMS);
|
|
1646
|
-
|
|
1647
|
-
// Opacity and Play state changes should be immediate for the native layer too
|
|
1648
|
-
const isOpacityOnlyChange = prevStable && sameTimelineStable && sameModeStable && newState.opacity !== prevStable.opacity && newState.variable === prevStable.variable && newState.units === prevStable.units;
|
|
1649
|
-
const isPlayStateOnlyChange = prevStable && sameTimelineStable && sameModeStable && newState.isPlaying !== prevStable.isPlaying && newState.variable === prevStable.variable && newState.units === prevStable.units && newState.opacity === prevStable.opacity;
|
|
1650
|
-
if (isOpacityOnlyChange || isPlayStateOnlyChange || !previousStateRef.current) {
|
|
1651
|
-
if (handleStateChangeRef.current) {
|
|
1652
|
-
handleStateChangeRef.current(newState);
|
|
1653
|
-
}
|
|
1099
|
+
m.onStateChange?.(e), le.current && clearTimeout(le.current);
|
|
1100
|
+
const o = l.current,
|
|
1101
|
+
F = o && (o.isNexrad ? e.nexradTimestamp === o.nexradTimestamp && e.nexradSite === o.nexradSite && e.nexradProduct === o.nexradProduct && Number(e.nexradTilt) === Number(o.nexradTilt) : o.isSatellite ? e.satelliteTimestamp === o.satelliteTimestamp && e.satelliteInstrumentId === o.satelliteInstrumentId && e.satelliteSectorLabel === o.satelliteSectorLabel && e.satelliteChannel === o.satelliteChannel && e.satelliteDurationValue === o.satelliteDurationValue && ue(e) === ue(o) : e.forecastHour === o.forecastHour && e.mrmsTimestamp === o.mrmsTimestamp),
|
|
1102
|
+
s = o && (e.isSatellite ? e.satelliteInstrumentId === o.satelliteInstrumentId && e.satelliteSectorLabel === o.satelliteSectorLabel && e.satelliteChannel === o.satelliteChannel : e.model === o.model && e.isMRMS === o.isMRMS),
|
|
1103
|
+
w = o && F && s && e.opacity !== o.opacity && e.variable === o.variable && e.units === o.units,
|
|
1104
|
+
N = o && F && s && e.isPlaying !== o.isPlaying && e.variable === o.variable && e.units === o.units && e.opacity === o.opacity;
|
|
1105
|
+
if (w || N || !l.current) {
|
|
1106
|
+
he.current && he.current(e);
|
|
1654
1107
|
return;
|
|
1655
1108
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}
|
|
1660
|
-
debounceTimeoutRef.current = null;
|
|
1661
|
-
}, 16); // ~60fps map updates
|
|
1109
|
+
le.current = setTimeout(() => {
|
|
1110
|
+
he.current && he.current(e), le.current = null;
|
|
1111
|
+
}, 16);
|
|
1662
1112
|
};
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
core.off('state:change', stableHandler);
|
|
1666
|
-
if (debounceTimeoutRef.current) {
|
|
1667
|
-
clearTimeout(debounceTimeoutRef.current);
|
|
1668
|
-
}
|
|
1669
|
-
if (NEXRAD_NATIVE) {
|
|
1670
|
-
nexradPreloadInteractionRef.current?.cancel?.();
|
|
1671
|
-
nexradPreloadInteractionRef.current = null;
|
|
1672
|
-
nexradControllerRef.current?.destroy();
|
|
1673
|
-
nexradControllerRef.current = null;
|
|
1674
|
-
}
|
|
1675
|
-
if (SATELLITE_NATIVE) {
|
|
1676
|
-
satelliteControllerRef.current?.destroy();
|
|
1677
|
-
satelliteControllerRef.current = null;
|
|
1678
|
-
}
|
|
1679
|
-
};
|
|
1680
|
-
}, [core, ensureNexradController, ensureSatelliteController]);
|
|
1681
|
-
(0, _react.useEffect)(() => {
|
|
1682
|
-
return () => {
|
|
1683
|
-
preloadedDataCache.current.clear(); // This drops JS references
|
|
1684
|
-
hasInitialLoad.current = false;
|
|
1685
|
-
lastProcessedState.current = null;
|
|
1686
|
-
// Native cleanup
|
|
1687
|
-
if (gridLayerRef.current && _reactNative.Platform.OS === 'ios') {
|
|
1688
|
-
gridLayerRef.current.clearGpuCache();
|
|
1689
|
-
}
|
|
1690
|
-
if (NEXRAD_NATIVE) {
|
|
1691
|
-
nexradPreloadInteractionRef.current?.cancel?.();
|
|
1692
|
-
nexradPreloadInteractionRef.current = null;
|
|
1693
|
-
nexradControllerRef.current?.destroy();
|
|
1694
|
-
nexradControllerRef.current = null;
|
|
1695
|
-
}
|
|
1696
|
-
if (SATELLITE_NATIVE) {
|
|
1697
|
-
satelliteControllerRef.current?.destroy();
|
|
1698
|
-
satelliteControllerRef.current = null;
|
|
1699
|
-
}
|
|
1113
|
+
return t.on("state:change", a), () => {
|
|
1114
|
+
t.off("state:change", a), le.current && clearTimeout(le.current), Q && (X.current?.destroy(), X.current = null), ie && (re.current?.destroy(), re.current = null);
|
|
1700
1115
|
};
|
|
1116
|
+
}, [t, at, Ie]), (0, _react.useEffect)(() => () => {
|
|
1117
|
+
W.current.clear(), ae.current = !1, He.current = null, p.current && _reactNative.Platform.OS === "ios" && p.current.clearGpuCache(), Q && (X.current?.destroy(), X.current = null), ie && (re.current?.destroy(), re.current = null);
|
|
1701
1118
|
}, []);
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1119
|
+
const ot = (0, _react.useRef)(0),
|
|
1120
|
+
bt = 50;
|
|
1704
1121
|
(0, _react.useEffect)(() => {
|
|
1705
|
-
if (!
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
const now = Date.now();
|
|
1715
|
-
if (now - lastInspectorUpdateRef.current < INSPECTOR_THROTTLE_MS) {
|
|
1716
|
-
return;
|
|
1717
|
-
}
|
|
1718
|
-
lastInspectorUpdateRef.current = now;
|
|
1719
|
-
const [longitude, latitude] = center;
|
|
1720
|
-
if (NEXRAD_NATIVE && core.state?.isNexrad) {
|
|
1721
|
-
onInspect?.(getNexradInspectPayloadAtRef.current(longitude, latitude));
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
void getValueAtPointRef.current(longitude, latitude).then(payload => {
|
|
1725
|
-
onInspect?.(payload);
|
|
1122
|
+
if (!t || !g) return;
|
|
1123
|
+
const r = a => {
|
|
1124
|
+
if (!a || !Array.isArray(a) || a.length !== 2) return;
|
|
1125
|
+
const e = Date.now();
|
|
1126
|
+
if (e - ot.current < bt) return;
|
|
1127
|
+
ot.current = e;
|
|
1128
|
+
const [o, F] = a;
|
|
1129
|
+
We.current(o, F).then(s => {
|
|
1130
|
+
I?.(s);
|
|
1726
1131
|
});
|
|
1727
1132
|
};
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
if (center) {
|
|
1732
|
-
handleMapMove(center);
|
|
1733
|
-
}
|
|
1133
|
+
if (t.on("map:move", r), _e && _e.getCenter) {
|
|
1134
|
+
const a = _e.getCenter();
|
|
1135
|
+
a && r(a);
|
|
1734
1136
|
}
|
|
1735
1137
|
return () => {
|
|
1736
|
-
|
|
1737
|
-
};
|
|
1738
|
-
}, [inspectorEnabled, onInspect, core, context]);
|
|
1739
|
-
(0, _react.useEffect)(() => {
|
|
1740
|
-
if (!core || !inspectorEnabled) {
|
|
1741
|
-
return;
|
|
1742
|
-
}
|
|
1743
|
-
const triggerReinspection = () => {
|
|
1744
|
-
const mapRef = _MapRegistry.mapRegistry.getMap();
|
|
1745
|
-
const center = mapRef?._currentCenter;
|
|
1746
|
-
if (center && Array.isArray(center) && center.length === 2) {
|
|
1747
|
-
const [longitude, latitude] = center;
|
|
1748
|
-
if (NEXRAD_NATIVE && core?.state?.isNexrad) {
|
|
1749
|
-
onInspect?.(getNexradInspectPayloadAtRef.current(longitude, latitude));
|
|
1750
|
-
} else {
|
|
1751
|
-
getValueAtPointRef.current(longitude, latitude).then(payload => {
|
|
1752
|
-
onInspect?.(payload);
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1138
|
+
t.off("map:move", r);
|
|
1756
1139
|
};
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
const
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
const handleCameraChange = center => {
|
|
1767
|
-
if (core && center) {
|
|
1768
|
-
core.setMapCenter(center);
|
|
1140
|
+
}, [g, I, t, _e]), (0, _react.useEffect)(() => {
|
|
1141
|
+
if (!t || !g) return;
|
|
1142
|
+
const r = setTimeout(() => {
|
|
1143
|
+
const a = _MapRegistry.mapRegistry.getMap()?._currentCenter;
|
|
1144
|
+
if (a && Array.isArray(a) && a.length === 2) {
|
|
1145
|
+
const [e, o] = a;
|
|
1146
|
+
We.current(e, o).then(F => {
|
|
1147
|
+
I?.(F);
|
|
1148
|
+
});
|
|
1769
1149
|
}
|
|
1150
|
+
}, 100);
|
|
1151
|
+
return () => clearTimeout(r);
|
|
1152
|
+
}, [t?.state?.nexradTimestamp, t?.state?.isNexrad, t?.state?.nexradSite, t?.state?.nexradProduct, t?.state?.nexradTilt, t?.state?.nexradDataSource, t?.state?.nexradStormRelative, t?.state?.variable, t?.state?.model, t?.state?.forecastHour, t?.state?.mrmsTimestamp, t?.state?.units, t?.state?.opacity, g, I]), (0, _react.useEffect)(() => {
|
|
1153
|
+
if (!t) return;
|
|
1154
|
+
const r = e => {
|
|
1155
|
+
t && e && t.setMapCenter(e);
|
|
1770
1156
|
};
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
// Try to get initial center
|
|
1776
|
-
const mapRef = _MapRegistry.mapRegistry.getMap();
|
|
1777
|
-
if (mapRef?._currentCenter) {
|
|
1778
|
-
handleCameraChange(mapRef._currentCenter);
|
|
1779
|
-
}
|
|
1780
|
-
return () => {
|
|
1781
|
-
_MapRegistry.mapRegistry.removeCameraListener(handleCameraChange);
|
|
1782
|
-
};
|
|
1783
|
-
}, [core]);
|
|
1784
|
-
(0, _react.useEffect)(() => {
|
|
1785
|
-
core.initialize({
|
|
1786
|
-
autoRefresh: false
|
|
1787
|
-
}); // <-- add the argument
|
|
1788
|
-
return () => {
|
|
1789
|
-
core.destroy();
|
|
1157
|
+
_MapRegistry.mapRegistry.addCameraListener(r);
|
|
1158
|
+
const a = _MapRegistry.mapRegistry.getMap();
|
|
1159
|
+
return a?._currentCenter && r(a._currentCenter), () => {
|
|
1160
|
+
_MapRegistry.mapRegistry.removeCameraListener(r);
|
|
1790
1161
|
};
|
|
1791
|
-
}, [
|
|
1792
|
-
|
|
1162
|
+
}, [t]), (0, _react.useEffect)(() => (t.initialize({
|
|
1163
|
+
autoRefresh: !1
|
|
1164
|
+
}), () => {
|
|
1165
|
+
t.destroy();
|
|
1166
|
+
}), [t]);
|
|
1167
|
+
const Oe = Te ?? _e?.weatherBeforeLayerId ?? "AML_-_terrain";
|
|
1793
1168
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridRenderLayer.GridRenderLayer, {
|
|
1794
|
-
ref:
|
|
1795
|
-
opacity:
|
|
1796
|
-
dataRange:
|
|
1797
|
-
belowID:
|
|
1798
|
-
}),
|
|
1799
|
-
ref:
|
|
1800
|
-
belowID:
|
|
1801
|
-
}) : null,
|
|
1802
|
-
ref:
|
|
1803
|
-
belowID:
|
|
1169
|
+
ref: p,
|
|
1170
|
+
opacity: Ve.opacity,
|
|
1171
|
+
dataRange: Ve.dataRange,
|
|
1172
|
+
belowID: Oe
|
|
1173
|
+
}), Q ? /*#__PURE__*/_react.default.createElement(_NexradRadarLayer.default, {
|
|
1174
|
+
ref: rt,
|
|
1175
|
+
belowID: Oe
|
|
1176
|
+
}) : null, ie ? /*#__PURE__*/_react.default.createElement(_SatelliteLayer.default, {
|
|
1177
|
+
ref: Ne,
|
|
1178
|
+
belowID: Oe
|
|
1804
1179
|
}) : null, /*#__PURE__*/_react.default.createElement(_NwsAlertsOverlay.default, {
|
|
1805
|
-
core:
|
|
1806
|
-
watchesWarnings:
|
|
1807
|
-
onNwsAlertClick:
|
|
1808
|
-
}),
|
|
1809
|
-
visible:
|
|
1810
|
-
belowLayerID:
|
|
1811
|
-
onSelectSite:
|
|
1180
|
+
core: t,
|
|
1181
|
+
watchesWarnings: gt,
|
|
1182
|
+
onNwsAlertClick: Ge
|
|
1183
|
+
}), St ? /*#__PURE__*/_react.default.createElement(_NexradSitesMapLayer.NexradSitesMapLayer, {
|
|
1184
|
+
visible: !0,
|
|
1185
|
+
belowLayerID: Oe,
|
|
1186
|
+
onSelectSite: r => void t.setNexradSite(r)
|
|
1812
1187
|
}) : null);
|
|
1813
1188
|
});
|
|
1814
|
-
WeatherLayerManager.getAvailableVariables =
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}
|
|
1818
|
-
const core = new _javascriptSdk.AguaceroCore({
|
|
1819
|
-
apiKey: options.apiKey
|
|
1820
|
-
});
|
|
1821
|
-
return core.getAvailableVariables('mrms');
|
|
1822
|
-
};
|
|
1189
|
+
WeatherLayerManager.getAvailableVariables = m => !m || !m.apiKey ? [] : new _javascriptSdk.AguaceroCore({
|
|
1190
|
+
apiKey: m.apiKey
|
|
1191
|
+
}).getAvailableVariables("mrms");
|
|
1823
1192
|
//# sourceMappingURL=WeatherLayerManager.js.map
|