@aguacerowx/react-native 0.0.20 → 0.0.22
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/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/ios/FragmentUniforms.swift +2 -0
- package/ios/GridRenderLayer.swift +24 -4
- package/ios/GridRenderLayerManager.mm +12 -0
- package/ios/GridRenderLayerView.h +1 -7
- package/ios/GridRenderLayerView.m +7 -1
- package/ios/Shaders.metal +131 -71
- package/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/lib/commonjs/ios/FragmentUniforms.swift +2 -0
- package/lib/commonjs/ios/GridRenderLayer.swift +24 -4
- package/lib/commonjs/ios/GridRenderLayerManager.mm +12 -0
- package/lib/commonjs/ios/GridRenderLayerView.h +1 -7
- package/lib/commonjs/ios/GridRenderLayerView.m +7 -1
- package/lib/commonjs/ios/Shaders.metal +131 -71
- package/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/package.json +3 -3
- package/lib/commonjs/scripts/compile-shaders.js +62 -0
- package/lib/commonjs/scripts/compile-shaders.js.map +1 -0
- package/lib/commonjs/scripts/compile-shaders.sh +12 -0
- package/lib/commonjs/src/WeatherLayerManager.js +51 -17
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/lib/module/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/lib/module/ios/FragmentUniforms.swift +2 -0
- package/lib/module/ios/GridRenderLayer.swift +24 -4
- package/lib/module/ios/GridRenderLayerManager.mm +12 -0
- package/lib/module/ios/GridRenderLayerView.h +1 -7
- package/lib/module/ios/GridRenderLayerView.m +7 -1
- package/lib/module/ios/Shaders.metal +131 -71
- package/lib/module/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/module/lib/commonjs/package.json +3 -3
- package/lib/module/lib/commonjs/scripts/compile-shaders.js +62 -0
- package/lib/module/lib/commonjs/scripts/compile-shaders.js.map +1 -0
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +51 -17
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/package.json +3 -3
- package/lib/module/scripts/compile-shaders.js +60 -0
- package/lib/module/scripts/compile-shaders.js.map +1 -0
- package/lib/module/scripts/compile-shaders.sh +12 -0
- package/lib/module/src/WeatherLayerManager.js +51 -17
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/scripts/compile-shaders.d.ts +3 -0
- package/lib/typescript/scripts/compile-shaders.d.ts.map +1 -0
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/WeatherLayerManager.js +192 -151
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1055
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -381
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1256
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4041
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -38
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -30
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -27
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -41
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -301
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -126
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/android/build.gradle +0 -108
- package/lib/module/lib/commonjs/android/src/main/AndroidManifest.xml +0 -7
- package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +0 -14
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +0 -983
- package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +0 -30
- package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +0 -146
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +0 -23
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +0 -199
- package/lib/module/lib/commonjs/ios/InspectorDataCache.swift +0 -66
- package/lib/module/lib/commonjs/ios/InspectorModule.m +0 -10
- package/lib/module/lib/commonjs/ios/InspectorModule.swift +0 -64
- package/lib/module/lib/commonjs/ios/Shaders.metal +0 -131
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.m +0 -16
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.swift +0 -104
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders.metallib +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec-generated.mm +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1059
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -381
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1256
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4041
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -38
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -30
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -27
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -41
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -301
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -126
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/scripts/compile-shaders.sh +0 -27
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1047
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -375
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1250
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4035
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -31
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -29
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -21
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -12
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -295
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -119
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
@_spi(Experimental) import MapboxMaps
|
|
3
|
-
|
|
4
|
-
@objc public class GridRenderLayerBridge: NSObject {
|
|
5
|
-
|
|
6
|
-
@objc public static func addCustomLayer(
|
|
7
|
-
to mapView: MapView,
|
|
8
|
-
layerHost: CustomLayerHost,
|
|
9
|
-
layerId: String,
|
|
10
|
-
belowLayerId: String?
|
|
11
|
-
) -> Bool {
|
|
12
|
-
let position: LayerPosition? = belowLayerId.map { .below($0) }
|
|
13
|
-
|
|
14
|
-
// Create a CustomLayer object
|
|
15
|
-
var customLayer = CustomLayer(id: layerId, renderer: layerHost)
|
|
16
|
-
|
|
17
|
-
do {
|
|
18
|
-
try mapView.mapboxMap.addLayer(customLayer, layerPosition: position)
|
|
19
|
-
print("✅ [GridRenderLayerBridge] Successfully added custom layer!")
|
|
20
|
-
return true
|
|
21
|
-
} catch {
|
|
22
|
-
print("❌ [GridRenderLayerBridge] Failed to add layer: \(error)")
|
|
23
|
-
return false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@objc public static func triggerRepaint(on mapView: MapView) {
|
|
28
|
-
mapView.mapboxMap.triggerRepaint()
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewManager.h>
|
|
2
|
-
#import <React/RCTUIManager.h>
|
|
3
|
-
#import <React/RCTLog.h>
|
|
4
|
-
#import "GridRenderLayerView.h"
|
|
5
|
-
|
|
6
|
-
// Import Swift bridging header here
|
|
7
|
-
#if __has_include("aguacerowx_react_native-Swift.h")
|
|
8
|
-
#import "aguacerowx_react_native-Swift.h"
|
|
9
|
-
#else
|
|
10
|
-
#import <aguacerowx_react_native/aguacerowx_react_native-Swift.h>
|
|
11
|
-
#endif
|
|
12
|
-
|
|
13
|
-
@interface GridRenderLayerManager : RCTViewManager
|
|
14
|
-
@end
|
|
15
|
-
|
|
16
|
-
@implementation GridRenderLayerManager
|
|
17
|
-
|
|
18
|
-
RCT_EXPORT_MODULE(GridRenderLayer)
|
|
19
|
-
|
|
20
|
-
+ (BOOL)requiresMainQueueSetup {
|
|
21
|
-
return YES;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
- (UIView *)view {
|
|
25
|
-
return [[GridRenderLayerView alloc] init];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// --- Props ---
|
|
29
|
-
RCT_EXPORT_VIEW_PROPERTY(opacity, float)
|
|
30
|
-
RCT_EXPORT_VIEW_PROPERTY(dataRange, NSArray)
|
|
31
|
-
RCT_EXPORT_VIEW_PROPERTY(smoothing, BOOL)
|
|
32
|
-
RCT_EXPORT_VIEW_PROPERTY(belowID, NSString)
|
|
33
|
-
|
|
34
|
-
// --- Commands ---
|
|
35
|
-
RCT_EXPORT_METHOD(updateGeometry:(nonnull NSNumber *)reactTag
|
|
36
|
-
corners:(NSDictionary *)corners
|
|
37
|
-
gridDef:(NSDictionary *)gridDef)
|
|
38
|
-
{
|
|
39
|
-
// OPTIMIZATION: Dispatch heavy geometry calculations to a high-priority background queue.
|
|
40
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
|
41
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
42
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
43
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
44
|
-
[view.layerInstance updateGeometryWithCorners:corners gridDef:gridDef];
|
|
45
|
-
}
|
|
46
|
-
}];
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
RCT_EXPORT_METHOD(updateDataTexture:(nonnull NSNumber *)reactTag
|
|
52
|
-
data:(NSString *)data
|
|
53
|
-
nx:(nonnull NSNumber *)nx
|
|
54
|
-
ny:(nonnull NSNumber *)ny
|
|
55
|
-
scale:(nonnull NSNumber *)scale
|
|
56
|
-
offset:(nonnull NSNumber *)offset
|
|
57
|
-
missing:(nonnull NSNumber *)missing
|
|
58
|
-
scaleType:(NSString *)scaleType)
|
|
59
|
-
{
|
|
60
|
-
// OPTIMIZATION: Dispatch to a high-priority background queue immediately.
|
|
61
|
-
// This unblocks the main thread and starts the heaviest work (data processing) sooner.
|
|
62
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
|
63
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
64
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
65
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
66
|
-
[view.layerInstance updateDataTextureWithData:data nx:nx ny:ny scale:scale offset:offset missing:missing scaleType:scaleType];
|
|
67
|
-
}
|
|
68
|
-
}];
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
RCT_EXPORT_METHOD(updateColormapTexture:(nonnull NSNumber *)reactTag
|
|
73
|
-
colormapAsBase64:(NSString *)colormapAsBase64)
|
|
74
|
-
{
|
|
75
|
-
// Don't block the main thread - dispatch to background first
|
|
76
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
|
77
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
78
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
79
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
80
|
-
[view.layerInstance updateColormapTextureWithColormapAsBase64:colormapAsBase64];
|
|
81
|
-
}
|
|
82
|
-
}];
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
RCT_EXPORT_METHOD(updateDataParameters:(nonnull NSNumber *)reactTag
|
|
87
|
-
scale:(nonnull NSNumber *)scale
|
|
88
|
-
offset:(nonnull NSNumber *)offset
|
|
89
|
-
missing:(nonnull NSNumber *)missing
|
|
90
|
-
scaleType:(nonnull NSNumber *)scaleType) // ADD THIS
|
|
91
|
-
{
|
|
92
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
93
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
94
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
95
|
-
[view.layerInstance updateDataParametersWithScale:scale offset:offset missing:missing scaleType:scaleType]; // ADD scaleType here
|
|
96
|
-
}
|
|
97
|
-
}];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
RCT_EXPORT_METHOD(clear:(nonnull NSNumber *)reactTag)
|
|
101
|
-
{
|
|
102
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
103
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
104
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
105
|
-
[view.layerInstance clear];
|
|
106
|
-
}
|
|
107
|
-
}];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
RCT_EXPORT_METHOD(primeGpuCache:(nonnull NSNumber *)reactTag
|
|
111
|
-
frameInfo:(NSDictionary *)frameInfo)
|
|
112
|
-
{
|
|
113
|
-
// OPTIMIZATION: Dispatch this immediately to a background thread to unblock JS.
|
|
114
|
-
// The Swift implementation will then handle its own concurrency.
|
|
115
|
-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
116
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
117
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
118
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
119
|
-
[view.layerInstance primeGpuCacheWithFrameInfo:frameInfo];
|
|
120
|
-
}
|
|
121
|
-
}];
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
RCT_EXPORT_METHOD(setActiveFrame:(nonnull NSNumber *)reactTag
|
|
126
|
-
cacheKey:(NSString *)cacheKey)
|
|
127
|
-
{
|
|
128
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
129
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
130
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
131
|
-
[view.layerInstance setActiveFrameWithCacheKey:cacheKey];
|
|
132
|
-
}
|
|
133
|
-
}];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
RCT_EXPORT_METHOD(clearGpuCache:(nonnull NSNumber *)reactTag)
|
|
137
|
-
{
|
|
138
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
139
|
-
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
140
|
-
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
141
|
-
[view.layerInstance clearGpuCache];
|
|
142
|
-
}
|
|
143
|
-
}];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
@end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
@class GridRenderLayer;
|
|
4
|
-
@class MapView;
|
|
5
|
-
|
|
6
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
7
|
-
|
|
8
|
-
@interface GridRenderLayerView : UIView
|
|
9
|
-
|
|
10
|
-
@property (nonatomic, strong) GridRenderLayer *layerInstance;
|
|
11
|
-
@property (nonatomic, weak) MapView *mapView;
|
|
12
|
-
@property (nonatomic, strong) NSString *layerId;
|
|
13
|
-
@property (nonatomic, strong, nullable) NSString *belowID;
|
|
14
|
-
|
|
15
|
-
// Property setters for React Native
|
|
16
|
-
- (void)setOpacity:(float)opacity;
|
|
17
|
-
- (void)setDataRange:(NSArray *)dataRange;
|
|
18
|
-
- (void)setSmoothing:(BOOL)smoothing;
|
|
19
|
-
- (void)setBelowID:(NSString *)belowID;
|
|
20
|
-
|
|
21
|
-
@end
|
|
22
|
-
|
|
23
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
#import "GridRenderLayerView.h"
|
|
2
|
-
#import <React/RCTLog.h>
|
|
3
|
-
#import <objc/runtime.h>
|
|
4
|
-
|
|
5
|
-
// Import Swift bridging header
|
|
6
|
-
#if __has_include("aguacerowx_react_native-Swift.h")
|
|
7
|
-
#import "aguacerowx_react_native-Swift.h"
|
|
8
|
-
#else
|
|
9
|
-
#import <aguacerowx_react_native/aguacerowx_react_native-Swift.h>
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
// Import MapboxMaps to get MapView definition
|
|
13
|
-
@import MapboxMaps;
|
|
14
|
-
|
|
15
|
-
@interface GridRenderLayerView ()
|
|
16
|
-
@property (nonatomic, assign) BOOL isLayerAdded;
|
|
17
|
-
@end
|
|
18
|
-
|
|
19
|
-
@implementation GridRenderLayerView
|
|
20
|
-
- (instancetype)init {
|
|
21
|
-
self = [super init];
|
|
22
|
-
if (self) {
|
|
23
|
-
_layerId = [NSString stringWithFormat:@"weather-layer-%@", [[NSUUID UUID] UUIDString]];
|
|
24
|
-
_layerInstance = [[GridRenderLayer alloc] initWithId:_layerId];
|
|
25
|
-
_isLayerAdded = NO;
|
|
26
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Initialized with layer ID: %@", _layerId);
|
|
27
|
-
}
|
|
28
|
-
return self;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
+ (void)load {
|
|
32
|
-
RCTLogInfo(@"🔵 GridRenderLayerView IS LOADED INTO RUNTIME 🔵");
|
|
33
|
-
NSLog(@"🔵 GridRenderLayerView IS LOADED INTO RUNTIME 🔵");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
#pragma mark - Property Setters
|
|
37
|
-
|
|
38
|
-
- (void)setOpacity:(float)opacity {
|
|
39
|
-
[self.layerInstance setOpacityWithValue:opacity];
|
|
40
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set opacity: %f", opacity);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
- (void)setDataRange:(NSArray *)dataRange {
|
|
44
|
-
if (dataRange && dataRange.count == 2) {
|
|
45
|
-
[self.layerInstance setDataRangeWithValue:dataRange];
|
|
46
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set data range: %@", dataRange);
|
|
47
|
-
} else {
|
|
48
|
-
RCTLogError(@"❌ [GridRenderLayerView] Invalid dataRange: %@", dataRange);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
- (void)setSmoothing:(BOOL)smoothing {
|
|
53
|
-
[self.layerInstance setSmoothingWithValue:smoothing];
|
|
54
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set smoothing: %d", smoothing);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
- (void)setBelowID:(NSString *)belowID {
|
|
58
|
-
_belowID = belowID;
|
|
59
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set belowID: %@", belowID);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
#pragma mark - View Lifecycle
|
|
63
|
-
|
|
64
|
-
- (void)didMoveToWindow {
|
|
65
|
-
[super didMoveToWindow];
|
|
66
|
-
if (self.window && !self.isLayerAdded) {
|
|
67
|
-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
68
|
-
[self findMapViewAndAddLayerInView:self.window]; // Start from window, not superview
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
- (void)findMapViewAndAddLayerInView:(UIView *)view {
|
|
74
|
-
if (!view || self.isLayerAdded) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
NSString *className = NSStringFromClass([view class]);
|
|
79
|
-
|
|
80
|
-
// Check if this is RNMBXMapView - the wrapper
|
|
81
|
-
if ([className isEqualToString:@"RNMBXMapView"]) {
|
|
82
|
-
RCTLogInfo(@"✅ [GridRenderLayerView] Found RNMBXMapView!");
|
|
83
|
-
|
|
84
|
-
// The first subview should be MapboxMaps.MapView
|
|
85
|
-
if (view.subviews.count > 0) {
|
|
86
|
-
UIView *firstSubview = view.subviews[0];
|
|
87
|
-
NSString *subviewClass = NSStringFromClass([firstSubview class]);
|
|
88
|
-
RCTLogInfo(@" 🔎 First subview is: %@", subviewClass);
|
|
89
|
-
|
|
90
|
-
if ([subviewClass containsString:@"MapboxMaps.MapView"] || [subviewClass isEqualToString:@"MapView"]) {
|
|
91
|
-
RCTLogInfo(@"✅ [GridRenderLayerView] Found actual MapboxMaps.MapView!");
|
|
92
|
-
self.mapView = (MapView *)firstSubview;
|
|
93
|
-
[self addLayerToMap];
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
RCTLogError(@"❌ [GridRenderLayerView] RNMBXMapView found but MapboxMaps.MapView not in expected location");
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Recursively search all subviews
|
|
103
|
-
for (UIView *subview in view.subviews) {
|
|
104
|
-
[self findMapViewAndAddLayerInView:subview];
|
|
105
|
-
if (self.isLayerAdded) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
- (void)logViewHierarchy:(UIView *)view depth:(int)depth {
|
|
112
|
-
NSString *indent = [@"" stringByPaddingToLength:depth * 2 withString:@" " startingAtIndex:0];
|
|
113
|
-
NSString *className = NSStringFromClass([view class]);
|
|
114
|
-
RCTLogInfo(@"%@└─ %@", indent, className);
|
|
115
|
-
|
|
116
|
-
for (UIView *subview in view.subviews) {
|
|
117
|
-
[self logViewHierarchy:subview depth:depth + 1];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
- (void)addLayerToMap {
|
|
122
|
-
if (!self.mapView || self.isLayerAdded) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
RCTLogInfo(@"🟡 [GridRenderLayerView] Attempting to add layer via Swift bridge");
|
|
127
|
-
|
|
128
|
-
id customLayer = [self.layerInstance getHostWrapper];
|
|
129
|
-
|
|
130
|
-
if (!customLayer) {
|
|
131
|
-
RCTLogError(@"❌ [GridRenderLayerView] Failed to get hostWrapper");
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Get the mapboxMap property using runtime
|
|
136
|
-
Ivar mapboxMapIvar = class_getInstanceVariable([self.mapView class], "mapboxMap");
|
|
137
|
-
if (!mapboxMapIvar) {
|
|
138
|
-
RCTLogError(@"❌ [GridRenderLayerView] Could not find mapboxMap ivar");
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
id mapboxMap = object_getIvar(self.mapView, mapboxMapIvar);
|
|
143
|
-
if (!mapboxMap) {
|
|
144
|
-
RCTLogError(@"❌ [GridRenderLayerView] mapboxMap is nil");
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Use the Swift bridge to add the layer
|
|
149
|
-
BOOL success = [GridRenderLayerBridge addCustomLayerTo:self.mapView
|
|
150
|
-
layerHost:customLayer
|
|
151
|
-
layerId:self.layerId
|
|
152
|
-
belowLayerId:self.belowID];
|
|
153
|
-
|
|
154
|
-
if (success) {
|
|
155
|
-
self.isLayerAdded = YES;
|
|
156
|
-
RCTLogInfo(@"🎉 [GridRenderLayerView] Successfully added layer via Swift bridge!");
|
|
157
|
-
|
|
158
|
-
[[NSNotificationCenter defaultCenter] addObserverForName:@"TriggerMapRepaint"
|
|
159
|
-
object:nil
|
|
160
|
-
queue:[NSOperationQueue mainQueue]
|
|
161
|
-
usingBlock:^(NSNotification *note) {
|
|
162
|
-
RCTLogInfo(@"🔄 [GridRenderLayerView] Received repaint notification");
|
|
163
|
-
if (self.mapView) {
|
|
164
|
-
RCTLogInfo(@" ✅ Calling Swift bridge triggerRepaint");
|
|
165
|
-
[GridRenderLayerBridge triggerRepaintOn:self.mapView];
|
|
166
|
-
RCTLogInfo(@" ✅ Called triggerRepaint via Swift bridge");
|
|
167
|
-
}
|
|
168
|
-
}];
|
|
169
|
-
} else {
|
|
170
|
-
RCTLogError(@"❌ [GridRenderLayerView] Failed to add layer via Swift bridge");
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
- (void)removeFromSuperview {
|
|
175
|
-
if (self.mapView && self.isLayerAdded) {
|
|
176
|
-
id mapboxMap = [self.mapView valueForKey:@"mapboxMap"];
|
|
177
|
-
id style = [mapboxMap valueForKey:@"style"];
|
|
178
|
-
|
|
179
|
-
SEL removeLayerSelector = NSSelectorFromString(@"removeStyleLayerWithIdentifier:completion:");
|
|
180
|
-
if ([style respondsToSelector:removeLayerSelector]) {
|
|
181
|
-
NSMethodSignature *signature = [style methodSignatureForSelector:removeLayerSelector];
|
|
182
|
-
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
|
183
|
-
[invocation setTarget:style];
|
|
184
|
-
[invocation setSelector:removeLayerSelector];
|
|
185
|
-
|
|
186
|
-
NSString *layerId = self.layerId;
|
|
187
|
-
[invocation setArgument:&layerId atIndex:2];
|
|
188
|
-
|
|
189
|
-
id nilCompletion = nil;
|
|
190
|
-
[invocation setArgument:&nilCompletion atIndex:3];
|
|
191
|
-
[invocation invoke];
|
|
192
|
-
|
|
193
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Removed custom layer: %@", self.layerId);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
[super removeFromSuperview];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
@end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
|
|
3
|
-
final class InspectorDataCache {
|
|
4
|
-
static let shared = InspectorDataCache()
|
|
5
|
-
|
|
6
|
-
private let queue = DispatchQueue(label: "com.aguacerowx.InspectorDataCacheQueue", attributes: .concurrent)
|
|
7
|
-
|
|
8
|
-
private var _lastDecompressedData: Data?
|
|
9
|
-
private var _nx: Int = 0
|
|
10
|
-
private var _ny: Int = 0
|
|
11
|
-
private var _scale: Float = 1.0
|
|
12
|
-
private var _offset: Float = 0.0
|
|
13
|
-
private var _missing: Float = 127.0
|
|
14
|
-
private var _scaleType: Int = 0 // ADD THIS
|
|
15
|
-
|
|
16
|
-
private init() {}
|
|
17
|
-
|
|
18
|
-
var lastDecompressedData: Data? {
|
|
19
|
-
get { queue.sync { _lastDecompressedData } }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var nx: Int {
|
|
23
|
-
get { queue.sync { _nx } }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var ny: Int {
|
|
27
|
-
get { queue.sync { _ny } }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var scale: Float {
|
|
31
|
-
get { queue.sync { _scale } }
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var offset: Float {
|
|
35
|
-
get { queue.sync { _offset } }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var missing: Float {
|
|
39
|
-
get { queue.sync { _missing } }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var scaleType: Int { // ADD THIS
|
|
43
|
-
get { queue.sync { _scaleType } }
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
func update(data: Data?, nx: Int, ny: Int, scale: Float, offset: Float, missing: Float, scaleType: Int = 0) { // ADD scaleType parameter
|
|
47
|
-
queue.async(flags: .barrier) {
|
|
48
|
-
self._lastDecompressedData = data
|
|
49
|
-
self._nx = nx
|
|
50
|
-
self._ny = ny
|
|
51
|
-
self._scale = scale
|
|
52
|
-
self._offset = offset
|
|
53
|
-
self._missing = missing
|
|
54
|
-
self._scaleType = scaleType // ADD THIS
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
func clear() {
|
|
59
|
-
queue.async(flags: .barrier) {
|
|
60
|
-
self._lastDecompressedData = nil
|
|
61
|
-
self._nx = 0
|
|
62
|
-
self._ny = 0
|
|
63
|
-
self._scaleType = 0 // ADD THIS
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
|
2
|
-
|
|
3
|
-
@interface RCT_EXTERN_MODULE(InspectorModule, NSObject)
|
|
4
|
-
|
|
5
|
-
RCT_EXTERN_METHOD(getValueAtGridIndex:(nonnull NSNumber *)i
|
|
6
|
-
j:(nonnull NSNumber *)j
|
|
7
|
-
resolver:(RCTPromiseResolveBlock)resolve
|
|
8
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
9
|
-
|
|
10
|
-
@end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import React
|
|
3
|
-
|
|
4
|
-
@objc(InspectorModule)
|
|
5
|
-
class InspectorModule: NSObject {
|
|
6
|
-
|
|
7
|
-
@objc(getValueAtGridIndex:j:resolver:rejecter:)
|
|
8
|
-
func getValueAtGridIndex(
|
|
9
|
-
i: NSNumber,
|
|
10
|
-
j: NSNumber,
|
|
11
|
-
resolve: @escaping RCTPromiseResolveBlock,
|
|
12
|
-
reject: @escaping RCTPromiseRejectBlock
|
|
13
|
-
) {
|
|
14
|
-
DispatchQueue.global(qos: .userInitiated).async {
|
|
15
|
-
let cache = InspectorDataCache.shared
|
|
16
|
-
|
|
17
|
-
guard let data = cache.lastDecompressedData else {
|
|
18
|
-
print("🔍 [Inspector] ERROR: No data in cache")
|
|
19
|
-
resolve(nil)
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let nx = cache.nx
|
|
24
|
-
let scale = cache.scale
|
|
25
|
-
let offset = cache.offset
|
|
26
|
-
let missing = cache.missing
|
|
27
|
-
let scaleType = cache.scaleType
|
|
28
|
-
|
|
29
|
-
let index = j.intValue * nx + i.intValue
|
|
30
|
-
|
|
31
|
-
guard index >= 0 && index < data.count else {
|
|
32
|
-
print("🔍 [Inspector] ERROR: Index out of bounds")
|
|
33
|
-
resolve(nil)
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Read as signed value
|
|
38
|
-
let signedQuantizedValue = Int(Int8(bitPattern: data[index]))
|
|
39
|
-
let missingQuantized = Int(round(missing))
|
|
40
|
-
|
|
41
|
-
// Check for missing value with tolerance
|
|
42
|
-
if abs(signedQuantizedValue - missingQuantized) < 1 {
|
|
43
|
-
resolve(nil)
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Step 1: Linear dequantization
|
|
48
|
-
let intermediateValue = Double(signedQuantizedValue) * Double(scale) + Double(offset)
|
|
49
|
-
var finalValue = intermediateValue
|
|
50
|
-
|
|
51
|
-
// Step 2: Apply sqrt inverse transformation if needed
|
|
52
|
-
if scaleType == 1 {
|
|
53
|
-
finalValue = intermediateValue * abs(intermediateValue)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
resolve(finalValue)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@objc
|
|
61
|
-
static func requiresMainQueueSetup() -> Bool {
|
|
62
|
-
return false
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
#include <metal_stdlib>
|
|
2
|
-
using namespace metal;
|
|
3
|
-
|
|
4
|
-
// Struct to match the vertex buffer layout in Swift
|
|
5
|
-
struct Vertex {
|
|
6
|
-
float2 position [[attribute(0)]];
|
|
7
|
-
float2 texCoord [[attribute(1)]];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// Struct for passing data from vertex to fragment shader
|
|
11
|
-
struct RasterizerData {
|
|
12
|
-
float4 position [[position]];
|
|
13
|
-
float2 texCoord;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// Uniforms passed from the CPU to the fragment shader
|
|
17
|
-
struct FragmentUniforms {
|
|
18
|
-
float opacity;
|
|
19
|
-
float2 dataRange;
|
|
20
|
-
float scale;
|
|
21
|
-
float offset;
|
|
22
|
-
float missingQuantized;
|
|
23
|
-
float2 textureSize;
|
|
24
|
-
int smoothing;
|
|
25
|
-
int scaleType; // 0 for linear, 1 for sqrt
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// --- Vertex Shader (Unchanged) ---
|
|
29
|
-
vertex RasterizerData vertex_main(const Vertex in [[stage_in]],
|
|
30
|
-
constant float4x4 &mvp [[buffer(1)]]) {
|
|
31
|
-
RasterizerData out;
|
|
32
|
-
out.position = mvp * float4(in.position, 0.0, 1.0);
|
|
33
|
-
out.texCoord = in.texCoord;
|
|
34
|
-
return out;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
float sampleDataTextureSmooth(
|
|
38
|
-
texture2d<float, access::sample> dataTexture,
|
|
39
|
-
sampler dataSampler,
|
|
40
|
-
float2 uv,
|
|
41
|
-
constant FragmentUniforms &uniforms)
|
|
42
|
-
{
|
|
43
|
-
float missing_value = uniforms.missingQuantized + 128.0;
|
|
44
|
-
|
|
45
|
-
// Calculate the fractional part for interpolation and the size of one texel.
|
|
46
|
-
float2 texel_size = 1.0 / uniforms.textureSize;
|
|
47
|
-
float2 pixel_coord = uv * uniforms.textureSize;
|
|
48
|
-
float2 pixel_floor = floor(pixel_coord - 0.5);
|
|
49
|
-
float2 f = fract(pixel_coord - 0.5);
|
|
50
|
-
|
|
51
|
-
// Calculate the precise UV coordinates for the CENTER of the four surrounding texels.
|
|
52
|
-
float2 uv00 = (pixel_floor + float2(0.5, 0.5)) * texel_size;
|
|
53
|
-
float2 uv10 = (pixel_floor + float2(1.5, 0.5)) * texel_size;
|
|
54
|
-
float2 uv01 = (pixel_floor + float2(0.5, 1.5)) * texel_size;
|
|
55
|
-
float2 uv11 = (pixel_floor + float2(1.5, 1.5)) * texel_size;
|
|
56
|
-
|
|
57
|
-
// Sample the four corner texels.
|
|
58
|
-
float s00 = dataTexture.sample(dataSampler, uv00).r * 255.0;
|
|
59
|
-
float s10 = dataTexture.sample(dataSampler, uv10).r * 255.0;
|
|
60
|
-
float s01 = dataTexture.sample(dataSampler, uv01).r * 255.0;
|
|
61
|
-
float s11 = dataTexture.sample(dataSampler, uv11).r * 255.0;
|
|
62
|
-
|
|
63
|
-
// THE CRITICAL CHECK: If any surrounding pixel is a "missing" value,
|
|
64
|
-
// treat this entire fragment as missing to prevent interpolation.
|
|
65
|
-
if (abs(s00 - missing_value) < 0.5 ||
|
|
66
|
-
abs(s10 - missing_value) < 0.5 ||
|
|
67
|
-
abs(s01 - missing_value) < 0.5 ||
|
|
68
|
-
abs(s11 - missing_value) < 0.5)
|
|
69
|
-
{
|
|
70
|
-
return missing_value;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// All neighbors are valid data, so we can safely perform manual bilinear interpolation.
|
|
74
|
-
float s0 = mix(s00, s10, f.x); // Interpolate the top row
|
|
75
|
-
float s1 = mix(s01, s11, f.x); // Interpolate the bottom row
|
|
76
|
-
|
|
77
|
-
// --- THE FIX IS HERE ---
|
|
78
|
-
// Remove the incorrect "1.0 - f.y" inversion. The vertical mix should use f.y directly.
|
|
79
|
-
return mix(s0, s1, f.y);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// --- Fragment Shader (NEW & IMPROVED) ---
|
|
83
|
-
fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
84
|
-
constant FragmentUniforms &uniforms [[buffer(0)]],
|
|
85
|
-
texture2d<float, access::sample> dataTexture [[texture(0)]],
|
|
86
|
-
texture2d<float, access::sample> colormapTexture [[texture(1)]],
|
|
87
|
-
sampler dataSampler [[sampler(0)]],
|
|
88
|
-
sampler colormapSampler [[sampler(1)]])
|
|
89
|
-
{
|
|
90
|
-
// Choose the sampling method based on the smoothing uniform.
|
|
91
|
-
float value_in_texture;
|
|
92
|
-
if (uniforms.smoothing == 1) {
|
|
93
|
-
// Use our custom function that prevents edge artifacts.
|
|
94
|
-
value_in_texture = sampleDataTextureSmooth(dataTexture, dataSampler, in.texCoord, uniforms);
|
|
95
|
-
} else {
|
|
96
|
-
// Smoothing is off. The sampler is already set to 'nearest' by the Swift code,
|
|
97
|
-
// so a standard sample call produces the correct pixelated result.
|
|
98
|
-
value_in_texture = dataTexture.sample(dataSampler, in.texCoord).r * 255.0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
float missing_value = uniforms.missingQuantized + 128.0;
|
|
102
|
-
|
|
103
|
-
// Discard if the pixel is a predefined missing value (either originally or from our function).
|
|
104
|
-
if (abs(value_in_texture - missing_value) < 0.5) {
|
|
105
|
-
discard_fragment();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Dequantize the value to its real-world representation.
|
|
109
|
-
float quantized_value = value_in_texture - 128.0;
|
|
110
|
-
float intermediate_value = quantized_value * uniforms.scale + uniforms.offset;
|
|
111
|
-
float raw_value = intermediate_value;
|
|
112
|
-
|
|
113
|
-
// Apply non-linear inverse scaling if specified.
|
|
114
|
-
if (uniforms.scaleType == 1) { // 'sqrt'
|
|
115
|
-
raw_value = intermediate_value * abs(intermediate_value);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Discard if the data is below the specified visible range.
|
|
119
|
-
if (raw_value < uniforms.dataRange.x) {
|
|
120
|
-
discard_fragment();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Normalize the value to a 0-1 coordinate for colormap lookup.
|
|
124
|
-
float colormap_coord = (raw_value - uniforms.dataRange.x) / (uniforms.dataRange.y - uniforms.dataRange.x);
|
|
125
|
-
colormap_coord = clamp(colormap_coord, 0.0, 1.0);
|
|
126
|
-
|
|
127
|
-
// Sample the colormap and apply final opacity.
|
|
128
|
-
float4 color = colormapTexture.sample(colormapSampler, float2(colormap_coord, 0.5));
|
|
129
|
-
|
|
130
|
-
return float4(color.rgb, color.a * uniforms.opacity);
|
|
131
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
|
2
|
-
|
|
3
|
-
@interface RCT_EXTERN_MODULE(WeatherFrameProcessorModule, NSObject)
|
|
4
|
-
|
|
5
|
-
RCT_EXTERN_METHOD(processFrame:(NSDictionary *)options
|
|
6
|
-
resolver:(RCTPromiseResolveBlock)resolve
|
|
7
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
8
|
-
|
|
9
|
-
RCT_EXTERN_METHOD(cancelAllFrames)
|
|
10
|
-
|
|
11
|
-
+ (BOOL)requiresMainQueueSetup
|
|
12
|
-
{
|
|
13
|
-
return NO;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@end
|