@aguacerowx/react-native 0.0.29 → 0.0.30
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/ios/GridRenderLayer.swift +60 -117
- package/ios/GridRenderLayerBridge.swift +0 -1
- package/ios/GridRenderLayerView.m +1 -41
- package/ios/InspectorModule.swift +2 -2
- package/lib/commonjs/ios/GridRenderLayer.swift +60 -117
- package/lib/commonjs/ios/GridRenderLayerBridge.swift +0 -1
- package/lib/commonjs/ios/GridRenderLayerView.m +1 -41
- package/lib/commonjs/ios/InspectorModule.swift +2 -2
- package/lib/commonjs/package.json +1 -1
- package/lib/commonjs/src/GridRenderLayer.js +0 -2
- package/lib/commonjs/src/GridRenderLayer.js.map +1 -1
- package/lib/commonjs/src/WeatherLayerManager.js +125 -77
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/ios/GridRenderLayer.swift +60 -117
- package/lib/module/ios/GridRenderLayerBridge.swift +0 -1
- package/lib/module/ios/GridRenderLayerView.m +1 -41
- package/lib/module/ios/InspectorModule.swift +2 -2
- package/lib/module/lib/commonjs/android/build.gradle +108 -0
- package/lib/module/lib/commonjs/ios/AguaceroPackage.m +19 -0
- package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +16 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +986 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +158 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +217 -0
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/lib/commonjs/package.json +1 -1
- package/lib/module/lib/commonjs/src/GridRenderLayer.js +0 -2
- package/lib/module/lib/commonjs/src/GridRenderLayer.js.map +1 -1
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +125 -77
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/package.json +1 -1
- package/lib/module/src/GridRenderLayer.js +0 -2
- package/lib/module/src/GridRenderLayer.js.map +1 -1
- package/lib/module/src/WeatherLayerManager.js +125 -77
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/src/GridRenderLayer.d.ts.map +1 -1
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/GridRenderLayer.js +0 -2
- package/src/WeatherLayerManager.js +135 -87
|
@@ -68,7 +68,6 @@ public class GridRenderLayer: NSObject {
|
|
|
68
68
|
private var pendingActiveFrameKey: String?
|
|
69
69
|
private let inspectorCache = InspectorDataCache.shared
|
|
70
70
|
private struct FrameMetadata {
|
|
71
|
-
let texture: MTLTexture
|
|
72
71
|
let scale: Float
|
|
73
72
|
let offset: Float
|
|
74
73
|
let missing: Float
|
|
@@ -95,7 +94,6 @@ public class GridRenderLayer: NSObject {
|
|
|
95
94
|
self.id = id
|
|
96
95
|
super.init()
|
|
97
96
|
self.hostWrapper = GridRenderLayerHost(layer: self)
|
|
98
|
-
print("🟢 [GridRenderLayer] Initialized with ID: \(id)")
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
@objc public func getHostWrapper() -> Any {
|
|
@@ -106,29 +104,22 @@ public class GridRenderLayer: NSObject {
|
|
|
106
104
|
|
|
107
105
|
@objc public func setOpacity(value: Float) {
|
|
108
106
|
self.uniforms.opacity = value
|
|
109
|
-
print("🟢 [GridRenderLayer] Set opacity: \(value)")
|
|
110
|
-
// ADD THIS: Force the map to repaint to show the opacity change immediately.
|
|
111
107
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
112
108
|
}
|
|
113
109
|
|
|
114
110
|
@objc public func setDataRange(value: [NSNumber]) {
|
|
115
111
|
self.uniforms.dataRange = SIMD2<Float>(value[0].floatValue, value[1].floatValue)
|
|
116
|
-
print("🟢 [GridRenderLayer] Set data range: \(value)")
|
|
117
|
-
// ADD THIS: Force the map to repaint to show the data range change immediately.
|
|
118
112
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
119
113
|
}
|
|
120
114
|
|
|
121
115
|
@objc public func setSmoothing(value: Bool) {
|
|
122
116
|
self.uniforms.smoothing = value ? 1 : 0
|
|
123
|
-
print("🟢 [GridRenderLayer] Set smoothing: \(value)")
|
|
124
|
-
// ADD THIS: Force the map to repaint to show the smoothing change immediately.
|
|
125
117
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
126
118
|
}
|
|
127
119
|
|
|
128
120
|
@objc(setIsMRMSWithIsMRMS:)
|
|
129
121
|
public func setIsMRMS(isMRMS: Bool) {
|
|
130
122
|
self.uniforms.isMRMS = isMRMS ? 1 : 0
|
|
131
|
-
print("🟢 [GridRenderLayer] Set isMRMS: \(isMRMS)")
|
|
132
123
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
133
124
|
}
|
|
134
125
|
|
|
@@ -137,14 +128,12 @@ public class GridRenderLayer: NSObject {
|
|
|
137
128
|
public func setVariable(variable: String) {
|
|
138
129
|
let isPtypeVar = (variable == "ptypeRefl" || variable == "ptypeRate")
|
|
139
130
|
self.uniforms.isPtype = isPtypeVar ? 1 : 0
|
|
140
|
-
print("🟢 [GridRenderLayer] Set variable: \(variable), isPtype set to: \(self.uniforms.isPtype)")
|
|
141
131
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
142
132
|
}
|
|
143
133
|
|
|
144
134
|
@objc public func clear() {
|
|
145
135
|
self.isVisible = false
|
|
146
136
|
self.inspectorCache.clear()
|
|
147
|
-
print("🟢 [GridRenderLayer] Cleared")
|
|
148
137
|
}
|
|
149
138
|
|
|
150
139
|
@objc public func updateDataParameters(scale: NSNumber, offset: NSNumber, missing: NSNumber, scaleType: NSNumber) { // ADD scaleType parameter
|
|
@@ -162,9 +151,7 @@ public class GridRenderLayer: NSObject {
|
|
|
162
151
|
offset: offset.floatValue,
|
|
163
152
|
missing: missing.floatValue,
|
|
164
153
|
scaleType: scaleType.intValue // ADD THIS
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
print("🟢 [GridRenderLayer] Updated data parameters - scale: \(scale), offset: \(offset), missing: \(missing), scaleType: \(scaleType)")
|
|
154
|
+
)
|
|
168
155
|
}
|
|
169
156
|
|
|
170
157
|
@objc public func updateColormapTexture(colormapAsBase64: String) {
|
|
@@ -230,17 +217,14 @@ public class GridRenderLayer: NSObject {
|
|
|
230
217
|
self.inspectorCache.clear()
|
|
231
218
|
return
|
|
232
219
|
}
|
|
233
|
-
print("💡 [Inspector] 2. Successfully read \(fileData.count) bytes from file.")
|
|
234
220
|
|
|
235
221
|
guard let decompressedDeltas = self.decompressZstd(data: fileData) else {
|
|
236
222
|
print("❌ [Inspector] FATAL: Failed to decompress Zstd data.")
|
|
237
223
|
self.inspectorCache.clear()
|
|
238
224
|
return
|
|
239
225
|
}
|
|
240
|
-
print("💡 [Inspector] 3. Successfully decompressed data.")
|
|
241
226
|
|
|
242
227
|
let reconstructedData = self.reconstructData(decompressedDeltas: decompressedDeltas)
|
|
243
|
-
print("💡 [Inspector] 4. Reconstructed data with \(reconstructedData.count) bytes.")
|
|
244
228
|
|
|
245
229
|
self.inspectorCache.update(
|
|
246
230
|
data: reconstructedData,
|
|
@@ -251,37 +235,50 @@ public class GridRenderLayer: NSObject {
|
|
|
251
235
|
missing: missing,
|
|
252
236
|
scaleType: scaleType
|
|
253
237
|
)
|
|
254
|
-
|
|
255
|
-
print("💡 [Inspector] 5. ✅ Cache updated successfully with scaleType=\(scaleType)")
|
|
256
238
|
}
|
|
257
239
|
|
|
258
240
|
@objc(setActiveFrameWithCacheKey:)
|
|
259
241
|
public func setActiveFrame(cacheKey: String) {
|
|
260
242
|
if let frame = frameCache[cacheKey] {
|
|
261
|
-
print("⚡️ [GridRenderLayer] Cache HIT for key: \(cacheKey). Swapping texture.")
|
|
262
|
-
|
|
263
|
-
self.dataTexture = frame.texture
|
|
264
|
-
self.uniforms.scale = frame.scale
|
|
265
|
-
self.uniforms.offset = frame.offset
|
|
266
|
-
self.uniforms.missingQuantized = frame.missing
|
|
267
|
-
self.uniforms.textureSize = SIMD2<Float>(frame.nx, frame.ny)
|
|
268
|
-
self.uniforms.scaleType = Int32(frame.scaleType)
|
|
269
|
-
|
|
270
|
-
self.isVisible = true
|
|
271
|
-
self.pendingActiveFrameKey = nil
|
|
272
|
-
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
273
|
-
|
|
274
|
-
// Update inspector cache on background thread since we already have the frame data
|
|
275
243
|
frameProcessingQueue.async { [weak self] in
|
|
276
|
-
self
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
244
|
+
guard let self = self else { return }
|
|
245
|
+
|
|
246
|
+
guard let fileData = try? Data(contentsOf: URL(fileURLWithPath: frame.filePath)),
|
|
247
|
+
let finalTextureBytes = self.processRawData(fileData: fileData)
|
|
248
|
+
else {
|
|
249
|
+
print("❌ [GridRenderLayer] Failed to load texture data for active frame")
|
|
250
|
+
return
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
DispatchQueue.main.async { [weak self] in
|
|
254
|
+
guard let self = self,
|
|
255
|
+
let texture = self.createTextureFromBytes(bytes: finalTextureBytes, nx: Int(frame.nx), ny: Int(frame.ny))
|
|
256
|
+
else { return }
|
|
257
|
+
|
|
258
|
+
self.dataTexture = texture
|
|
259
|
+
self.uniforms.scale = frame.scale
|
|
260
|
+
self.uniforms.offset = frame.offset
|
|
261
|
+
self.uniforms.missingQuantized = frame.missing
|
|
262
|
+
self.uniforms.textureSize = SIMD2<Float>(frame.nx, frame.ny)
|
|
263
|
+
self.uniforms.scaleType = Int32(frame.scaleType)
|
|
264
|
+
|
|
265
|
+
self.isVisible = true
|
|
266
|
+
self.pendingActiveFrameKey = nil
|
|
267
|
+
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
268
|
+
|
|
269
|
+
// Update inspector cache
|
|
270
|
+
self.frameProcessingQueue.async { [weak self] in
|
|
271
|
+
self?.updateInspectorCache(
|
|
272
|
+
filePath: frame.filePath,
|
|
273
|
+
nx: Int(frame.nx),
|
|
274
|
+
ny: Int(frame.ny),
|
|
275
|
+
scale: frame.scale,
|
|
276
|
+
offset: frame.offset,
|
|
277
|
+
missing: frame.missing,
|
|
278
|
+
scaleType: frame.scaleType
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
285
282
|
}
|
|
286
283
|
|
|
287
284
|
} else {
|
|
@@ -290,13 +287,10 @@ public class GridRenderLayer: NSObject {
|
|
|
290
287
|
self.isVisible = false
|
|
291
288
|
}
|
|
292
289
|
}
|
|
290
|
+
|
|
293
291
|
@objc(primeGpuCacheWithFrameInfo:)
|
|
294
292
|
public func primeGpuCache(frameInfo: [String: [String: Any]]) {
|
|
295
293
|
let group = DispatchGroup()
|
|
296
|
-
|
|
297
|
-
if (frameInfo.count > 1) {
|
|
298
|
-
print("🟡 [GridRenderLayer] Starting to prime \(frameInfo.count) textures with concurrent processing...")
|
|
299
|
-
}
|
|
300
294
|
|
|
301
295
|
for (cacheKey, info) in frameInfo {
|
|
302
296
|
group.enter()
|
|
@@ -329,52 +323,29 @@ public class GridRenderLayer: NSObject {
|
|
|
329
323
|
return
|
|
330
324
|
}
|
|
331
325
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
if let texture = self.createTextureFromBytes(bytes: finalTextureBytes, nx: nx.intValue, ny: ny.intValue) {
|
|
345
|
-
let metadata = FrameMetadata(
|
|
346
|
-
texture: texture,
|
|
347
|
-
scale: scale.floatValue,
|
|
348
|
-
offset: offset.floatValue,
|
|
349
|
-
missing: missing.floatValue,
|
|
350
|
-
scaleType: (scaleTypeStr == "sqrt") ? 1 : 0,
|
|
351
|
-
nx: nx.floatValue,
|
|
352
|
-
ny: ny.floatValue,
|
|
353
|
-
filePath: filePath,
|
|
354
|
-
originalScale: originalScale.floatValue,
|
|
355
|
-
originalOffset: originalOffset.floatValue
|
|
356
|
-
)
|
|
357
|
-
self.frameCache[cacheKey] = metadata
|
|
326
|
+
let metadata = FrameMetadata(
|
|
327
|
+
scale: scale.floatValue,
|
|
328
|
+
offset: offset.floatValue,
|
|
329
|
+
missing: missing.floatValue,
|
|
330
|
+
scaleType: (scaleTypeStr == "sqrt") ? 1 : 0,
|
|
331
|
+
nx: nx.floatValue,
|
|
332
|
+
ny: ny.floatValue,
|
|
333
|
+
filePath: filePath,
|
|
334
|
+
originalScale: originalScale.floatValue,
|
|
335
|
+
originalOffset: originalOffset.floatValue
|
|
336
|
+
)
|
|
337
|
+
self.frameCache[cacheKey] = metadata
|
|
358
338
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
339
|
+
if let pendingKey = self.pendingActiveFrameKey, pendingKey == cacheKey {
|
|
340
|
+
DispatchQueue.main.async {
|
|
341
|
+
self.setActiveFrame(cacheKey: pendingKey)
|
|
363
342
|
}
|
|
364
343
|
}
|
|
365
344
|
}
|
|
366
345
|
}
|
|
367
|
-
|
|
368
|
-
group.notify(queue: .main) {
|
|
369
|
-
if (frameInfo.count > 1) {
|
|
370
|
-
print("🎉 [GridRenderLayer] All \(frameInfo.count) frames have been processed and cached.")
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
346
|
}
|
|
374
|
-
|
|
347
|
+
|
|
375
348
|
@objc public func updateDataTexture(data: String, nx: NSNumber, ny: NSNumber, scale: NSNumber, offset: NSNumber, missing: NSNumber, scaleType: String) {
|
|
376
|
-
print("🚀 [GridRenderLayer] FAST LANE: updateDataTexture called for initial frame...")
|
|
377
|
-
|
|
378
349
|
let filePath = data
|
|
379
350
|
|
|
380
351
|
frameProcessingQueue.async { [weak self] in
|
|
@@ -386,9 +357,10 @@ public class GridRenderLayer: NSObject {
|
|
|
386
357
|
print("❌ [GridRenderLayer] FAST LANE: Failed to process initial frame data.")
|
|
387
358
|
return
|
|
388
359
|
}
|
|
389
|
-
|
|
360
|
+
|
|
390
361
|
DispatchQueue.main.async { [weak self] in
|
|
391
362
|
guard let self = self, let texture = self.createTextureFromBytes(bytes: finalTextureBytes, nx: nx.intValue, ny: ny.intValue) else {
|
|
363
|
+
print("❌ [GridRenderLayer] FAST LANE: Failed to create texture")
|
|
392
364
|
return
|
|
393
365
|
}
|
|
394
366
|
|
|
@@ -400,9 +372,8 @@ public class GridRenderLayer: NSObject {
|
|
|
400
372
|
self.uniforms.textureSize = SIMD2<Float>(nx.floatValue, ny.floatValue)
|
|
401
373
|
|
|
402
374
|
self.isVisible = true
|
|
403
|
-
print("✅ [GridRenderLayer] FAST LANE: Initial frame processed and displayed.")
|
|
404
375
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
405
|
-
|
|
376
|
+
|
|
406
377
|
self.updateInspectorCache(
|
|
407
378
|
filePath: filePath,
|
|
408
379
|
nx: nx.intValue,
|
|
@@ -423,10 +394,7 @@ public class GridRenderLayer: NSObject {
|
|
|
423
394
|
return
|
|
424
395
|
}
|
|
425
396
|
|
|
426
|
-
print(" Device is ready, processing geometry immediately")
|
|
427
|
-
|
|
428
397
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
429
|
-
print(" 🔄 Generating geometry on background thread")
|
|
430
398
|
|
|
431
399
|
var vertices: [Float] = []
|
|
432
400
|
var indices: [UInt16] = []
|
|
@@ -441,15 +409,8 @@ public class GridRenderLayer: NSObject {
|
|
|
441
409
|
self.indexCount = indices.count
|
|
442
410
|
|
|
443
411
|
DispatchQueue.main.async {
|
|
444
|
-
print(" 🎨 Creating buffers on main thread")
|
|
445
|
-
|
|
446
412
|
self.vertexBuffer = self.device.makeBuffer(bytes: vertices, length: vertices.count * MemoryLayout<Float>.size, options: [])
|
|
447
413
|
self.indexBuffer = self.device.makeBuffer(bytes: indices, length: indices.count * MemoryLayout<UInt16>.size, options: [])
|
|
448
|
-
|
|
449
|
-
print("🟢 [GridRenderLayer] Geometry updated: \(vertices.count/4) vertices, \(indices.count/3) triangles")
|
|
450
|
-
print(" vertexBuffer: \(self.vertexBuffer != nil)")
|
|
451
|
-
print(" indexBuffer: \(self.indexBuffer != nil)")
|
|
452
|
-
print(" indexCount: \(self.indexCount)")
|
|
453
414
|
|
|
454
415
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
455
416
|
}
|
|
@@ -718,14 +679,10 @@ public class GridRenderLayer: NSObject {
|
|
|
718
679
|
}
|
|
719
680
|
|
|
720
681
|
if isLCC {
|
|
721
|
-
print("🗺️ [generateGeometryData] Using LCC projection path")
|
|
722
682
|
generateLCCGeometry(gridDef: gridDef, vertices: &vertices, indices: &indices)
|
|
723
683
|
return
|
|
724
684
|
}
|
|
725
685
|
|
|
726
|
-
// Generic Grid Path (MRMS, regional models, etc.)
|
|
727
|
-
print("🗺️ [generateGeometryData] Using generic regional grid path")
|
|
728
|
-
|
|
729
686
|
let nx = gridParams["nx"] as? Int ?? 0
|
|
730
687
|
let ny = gridParams["ny"] as? Int ?? 0
|
|
731
688
|
let lon_first = gridParams["lon_first"] as? Double ?? 0.0
|
|
@@ -811,7 +768,6 @@ public class GridRenderLayer: NSObject {
|
|
|
811
768
|
// MARK: - Internal methods for CustomLayerHost (called by wrapper)
|
|
812
769
|
|
|
813
770
|
internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFormat: UInt, depthStencilPixelFormat: UInt) {
|
|
814
|
-
print("🟢 [GridRenderLayer] renderingWillStart called")
|
|
815
771
|
self.device = metalDevice
|
|
816
772
|
self.commandQueue = metalDevice.makeCommandQueue()
|
|
817
773
|
|
|
@@ -828,14 +784,12 @@ internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFor
|
|
|
828
784
|
let defaultLibrary: MTLLibrary?
|
|
829
785
|
if let metallibUrl = bundle.url(forResource: metallibName, withExtension: "metallib"),
|
|
830
786
|
let library = try? metalDevice.makeLibrary(URL: metallibUrl) {
|
|
831
|
-
print("✅ [GridRenderLayer] Loaded pre-compiled metallib (\(metallibName))")
|
|
832
787
|
defaultLibrary = library
|
|
833
788
|
}
|
|
834
789
|
// Fall back to compiling from .metal source (for development with npm link)
|
|
835
790
|
else if let metalUrl = bundle.url(forResource: "Shaders", withExtension: "metal"),
|
|
836
791
|
let source = try? String(contentsOf: metalUrl),
|
|
837
792
|
let library = try? metalDevice.makeLibrary(source: source, options: nil) {
|
|
838
|
-
print("✅ [GridRenderLayer] Compiled Metal shader from source")
|
|
839
793
|
defaultLibrary = library
|
|
840
794
|
}
|
|
841
795
|
// Neither worked
|
|
@@ -901,23 +855,18 @@ internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFor
|
|
|
901
855
|
colormapSamplerDesc.sAddressMode = .clampToEdge
|
|
902
856
|
self.colormapSamplerState = metalDevice.makeSamplerState(descriptor: colormapSamplerDesc)
|
|
903
857
|
|
|
904
|
-
print("🟢 [GridRenderLayer] Metal setup complete")
|
|
905
|
-
|
|
906
858
|
// Process any pending updates that came in before Metal was ready
|
|
907
859
|
if let pendingGeometry = pendingGeometryUpdate {
|
|
908
|
-
print("🟡 [GridRenderLayer] Processing pending geometry update")
|
|
909
860
|
updateGeometry(corners: pendingGeometry.corners, gridDef: pendingGeometry.gridDef)
|
|
910
861
|
pendingGeometryUpdate = nil
|
|
911
862
|
}
|
|
912
863
|
|
|
913
864
|
if let pendingColormap = pendingColormapUpdate {
|
|
914
|
-
print("🟡 [GridRenderLayer] Processing pending colormap update")
|
|
915
865
|
updateColormapTexture(colormapAsBase64: pendingColormap)
|
|
916
866
|
pendingColormapUpdate = nil
|
|
917
867
|
}
|
|
918
868
|
|
|
919
869
|
if let pendingData = pendingDataUpdate {
|
|
920
|
-
print("🟡 [GridRenderLayer] Processing pending data update")
|
|
921
870
|
updateDataTexture(data: pendingData.data, nx: pendingData.nx, ny: pendingData.ny,
|
|
922
871
|
scale: pendingData.scale, offset: pendingData.offset,
|
|
923
872
|
missing: pendingData.missing, scaleType: pendingData.scaleType)
|
|
@@ -933,12 +882,7 @@ internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFor
|
|
|
933
882
|
let colormapTex = colormapTexture,
|
|
934
883
|
indexCount > 0,
|
|
935
884
|
let encoder = mtlCommandBuffer.makeRenderCommandEncoder(descriptor: mtlRenderPassDescriptor) else {
|
|
936
|
-
|
|
937
|
-
// OPTIMIZATION: Change log message to be more informative and less alarming.
|
|
938
|
-
// This is an expected state during initial load.
|
|
939
|
-
if (pipelineState != nil) { // Only log if Metal is set up
|
|
940
|
-
print("🟡 [GridRenderLayer] internalRender: Waiting for all resources to be ready before drawing.")
|
|
941
|
-
}
|
|
885
|
+
|
|
942
886
|
return
|
|
943
887
|
}
|
|
944
888
|
|
|
@@ -1021,7 +965,6 @@ internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFor
|
|
|
1021
965
|
}
|
|
1022
966
|
|
|
1023
967
|
internal func internalRenderingWillEnd() {
|
|
1024
|
-
print("🟢 [GridRenderLayer] renderingWillEnd called")
|
|
1025
968
|
vertexBuffer = nil
|
|
1026
969
|
indexBuffer = nil
|
|
1027
970
|
dataTexture = nil
|
|
@@ -14,7 +14,6 @@ import Foundation
|
|
|
14
14
|
|
|
15
15
|
do {
|
|
16
16
|
try mapView.mapboxMap.addLayer(customLayer, layerPosition: position)
|
|
17
|
-
print("✅ [GridRenderLayerBridge] Successfully added custom layer!")
|
|
18
17
|
return true
|
|
19
18
|
} catch {
|
|
20
19
|
print("❌ [GridRenderLayerBridge] Failed to add layer: \(error)")
|
|
@@ -23,27 +23,19 @@
|
|
|
23
23
|
_layerId = [NSString stringWithFormat:@"weather-layer-%@", [[NSUUID UUID] UUIDString]];
|
|
24
24
|
_layerInstance = [[GridRenderLayer alloc] initWithId:_layerId];
|
|
25
25
|
_isLayerAdded = NO;
|
|
26
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Initialized with layer ID: %@", _layerId);
|
|
27
26
|
}
|
|
28
27
|
return self;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
+ (void)load {
|
|
32
|
-
RCTLogInfo(@"🔵 GridRenderLayerView IS LOADED INTO RUNTIME 🔵");
|
|
33
|
-
NSLog(@"🔵 GridRenderLayerView IS LOADED INTO RUNTIME 🔵");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
30
|
#pragma mark - Property Setters
|
|
37
31
|
|
|
38
32
|
- (void)setOpacity:(float)opacity {
|
|
39
33
|
[self.layerInstance setOpacityWithValue:opacity];
|
|
40
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set opacity: %f", opacity);
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
- (void)setDataRange:(NSArray *)dataRange {
|
|
44
37
|
if (dataRange && dataRange.count == 2) {
|
|
45
38
|
[self.layerInstance setDataRangeWithValue:dataRange];
|
|
46
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set data range: %@", dataRange);
|
|
47
39
|
} else {
|
|
48
40
|
RCTLogError(@"❌ [GridRenderLayerView] Invalid dataRange: %@", dataRange);
|
|
49
41
|
}
|
|
@@ -51,25 +43,21 @@
|
|
|
51
43
|
|
|
52
44
|
- (void)setSmoothing:(BOOL)smoothing {
|
|
53
45
|
[self.layerInstance setSmoothingWithValue:smoothing];
|
|
54
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set smoothing: %d", smoothing);
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
- (void)setBelowID:(NSString *)belowID {
|
|
58
49
|
_belowID = belowID;
|
|
59
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set belowID: %@", belowID);
|
|
60
50
|
}
|
|
61
51
|
|
|
62
52
|
// ADD THIS METHOD
|
|
63
53
|
- (void)setVariable:(NSString *)variable {
|
|
64
54
|
[self.layerInstance setVariableWithVariable:variable];
|
|
65
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Set variable: %@", variable);
|
|
66
55
|
}
|
|
67
56
|
|
|
68
57
|
#pragma mark - View Lifecycle
|
|
69
58
|
|
|
70
59
|
- (void)didMoveToWindow {
|
|
71
60
|
[super didMoveToWindow];
|
|
72
|
-
RCTLogInfo(@"🔵 [GridRenderLayerView] didMoveToWindow called, window=%@, isLayerAdded=%d", self.window ? @"YES" : @"NO", self.isLayerAdded);
|
|
73
61
|
if (self.window && !self.isLayerAdded) {
|
|
74
62
|
[self findMapViewAndAddLayerInView:self.window];
|
|
75
63
|
}
|
|
@@ -80,10 +68,8 @@
|
|
|
80
68
|
|
|
81
69
|
static dispatch_once_t onceToken;
|
|
82
70
|
dispatch_once(&onceToken, ^{
|
|
83
|
-
RCTLogInfo(@"🔵 [GridRenderLayerView] layoutSubviews called (first time)");
|
|
84
71
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
85
72
|
if (!self.isLayerAdded) {
|
|
86
|
-
RCTLogInfo(@"🔍 [GridRenderLayerView] Attempting to find map from layoutSubviews");
|
|
87
73
|
UIView *searchRoot = self.window ? self.window : self.superview;
|
|
88
74
|
if (searchRoot) {
|
|
89
75
|
[self findMapViewAndAddLayerInView:searchRoot];
|
|
@@ -97,21 +83,14 @@
|
|
|
97
83
|
if (!view || self.isLayerAdded) {
|
|
98
84
|
return;
|
|
99
85
|
}
|
|
100
|
-
|
|
101
|
-
RCTLogInfo(@"🔍 [GridRenderLayerView] Searching for MapView from: %@", NSStringFromClass([view class]));
|
|
102
|
-
|
|
86
|
+
|
|
103
87
|
NSString *className = NSStringFromClass([view class]);
|
|
104
88
|
|
|
105
89
|
if ([className isEqualToString:@"RNMBXMapView"]) {
|
|
106
|
-
RCTLogInfo(@"✅ [GridRenderLayerView] Found RNMBXMapView!");
|
|
107
|
-
|
|
108
90
|
if (view.subviews.count > 0) {
|
|
109
91
|
UIView *firstSubview = view.subviews[0];
|
|
110
92
|
NSString *subviewClass = NSStringFromClass([firstSubview class]);
|
|
111
|
-
RCTLogInfo(@" 🔎 First subview is: %@", subviewClass);
|
|
112
|
-
|
|
113
93
|
if ([subviewClass containsString:@"MapboxMaps.MapView"] || [subviewClass isEqualToString:@"MapView"]) {
|
|
114
|
-
RCTLogInfo(@"✅ [GridRenderLayerView] Found actual MapboxMaps.MapView!");
|
|
115
94
|
self.mapView = (MapView *)firstSubview;
|
|
116
95
|
[self waitForStyleLoadAndAddLayer];
|
|
117
96
|
return;
|
|
@@ -139,13 +118,10 @@
|
|
|
139
118
|
|
|
140
119
|
// Check if the target layer already exists
|
|
141
120
|
if ([GridRenderLayerBridge layerExistsIn:self.mapView layerId:targetLayer]) {
|
|
142
|
-
RCTLogInfo(@"✅ [GridRenderLayerView] Target layer '%@' already exists, adding immediately", targetLayer);
|
|
143
121
|
[self addLayerToMap];
|
|
144
122
|
return;
|
|
145
123
|
}
|
|
146
124
|
|
|
147
|
-
// If not, start polling
|
|
148
|
-
RCTLogInfo(@"⏳ [GridRenderLayerView] Waiting for layer '%@' to exist...", targetLayer);
|
|
149
125
|
[self pollForLayerExistence];
|
|
150
126
|
}
|
|
151
127
|
|
|
@@ -157,7 +133,6 @@
|
|
|
157
133
|
NSString *targetLayer = self.belowID ?: @"AML_-_terrain";
|
|
158
134
|
|
|
159
135
|
if ([GridRenderLayerBridge layerExistsIn:self.mapView layerId:targetLayer]) {
|
|
160
|
-
RCTLogInfo(@"✅ [GridRenderLayerView] Target layer '%@' now exists!", targetLayer);
|
|
161
136
|
[self addLayerToMap];
|
|
162
137
|
return;
|
|
163
138
|
}
|
|
@@ -173,8 +148,6 @@
|
|
|
173
148
|
return;
|
|
174
149
|
}
|
|
175
150
|
|
|
176
|
-
RCTLogInfo(@"🟡 [GridRenderLayerView] Attempting to add layer via Swift bridge");
|
|
177
|
-
|
|
178
151
|
id customLayer = [self.layerInstance getHostWrapper];
|
|
179
152
|
|
|
180
153
|
if (!customLayer) {
|
|
@@ -189,13 +162,11 @@
|
|
|
189
162
|
|
|
190
163
|
if (success) {
|
|
191
164
|
self.isLayerAdded = YES;
|
|
192
|
-
RCTLogInfo(@"🎉 [GridRenderLayerView] Successfully added layer via Swift bridge!");
|
|
193
165
|
|
|
194
166
|
[[NSNotificationCenter defaultCenter] addObserverForName:@"TriggerMapRepaint"
|
|
195
167
|
object:nil
|
|
196
168
|
queue:[NSOperationQueue mainQueue]
|
|
197
169
|
usingBlock:^(NSNotification *note) {
|
|
198
|
-
RCTLogInfo(@"🔄 [GridRenderLayerView] Received repaint notification");
|
|
199
170
|
if (self.mapView) {
|
|
200
171
|
[GridRenderLayerBridge triggerRepaintOn:self.mapView];
|
|
201
172
|
}
|
|
@@ -205,15 +176,6 @@
|
|
|
205
176
|
}
|
|
206
177
|
}
|
|
207
178
|
|
|
208
|
-
- (void)logViewHierarchy:(UIView *)view depth:(int)depth {
|
|
209
|
-
NSString *indent = [@"" stringByPaddingToLength:depth * 2 withString:@" " startingAtIndex:0];
|
|
210
|
-
NSString *className = NSStringFromClass([view class]);
|
|
211
|
-
RCTLogInfo(@"%@└─ %@", indent, className);
|
|
212
|
-
|
|
213
|
-
for (UIView *subview in view.subviews) {
|
|
214
|
-
[self logViewHierarchy:subview depth:depth + 1];
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
179
|
- (void)removeFromSuperview {
|
|
218
180
|
if (self.mapView && self.isLayerAdded) {
|
|
219
181
|
id mapboxMap = [self.mapView valueForKey:@"mapboxMap"];
|
|
@@ -232,8 +194,6 @@
|
|
|
232
194
|
id nilCompletion = nil;
|
|
233
195
|
[invocation setArgument:&nilCompletion atIndex:3];
|
|
234
196
|
[invocation invoke];
|
|
235
|
-
|
|
236
|
-
RCTLogInfo(@"🟢 [GridRenderLayerView] Removed custom layer: %@", self.layerId);
|
|
237
197
|
}
|
|
238
198
|
}
|
|
239
199
|
[super removeFromSuperview];
|
|
@@ -11,11 +11,11 @@ class InspectorModule: NSObject {
|
|
|
11
11
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
12
12
|
reject: @escaping RCTPromiseRejectBlock
|
|
13
13
|
) {
|
|
14
|
+
|
|
14
15
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
15
16
|
let cache = InspectorDataCache.shared
|
|
16
|
-
|
|
17
|
+
|
|
17
18
|
guard let data = cache.lastDecompressedData else {
|
|
18
|
-
print("🔍 [Inspector] ERROR: No data in cache")
|
|
19
19
|
resolve(nil)
|
|
20
20
|
return
|
|
21
21
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// @aguacerowx/react-native/android/build.gradle
|
|
2
|
+
|
|
3
|
+
buildscript {
|
|
4
|
+
repositories {
|
|
5
|
+
google()
|
|
6
|
+
mavenCentral()
|
|
7
|
+
}
|
|
8
|
+
dependencies {
|
|
9
|
+
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
repositories {
|
|
14
|
+
google()
|
|
15
|
+
mavenCentral()
|
|
16
|
+
maven {
|
|
17
|
+
url 'https://api.mapbox.com/downloads/v2/releases/maven'
|
|
18
|
+
authentication {
|
|
19
|
+
basic(BasicAuthentication)
|
|
20
|
+
}
|
|
21
|
+
credentials {
|
|
22
|
+
username = "mapbox"
|
|
23
|
+
password = project.rootProject.findProperty("MAPBOX_DOWNLOADS_TOKEN") ?: System.getenv("MAPBOX_DOWNLOADS_TOKEN")
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
apply plugin: 'com.android.library'
|
|
29
|
+
|
|
30
|
+
def isNewArchEnabled = project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
31
|
+
|
|
32
|
+
if (isNewArchEnabled) {
|
|
33
|
+
apply plugin: "com.facebook.react"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
android {
|
|
37
|
+
namespace 'com.aguacerowx.reactnative'
|
|
38
|
+
compileSdk 34
|
|
39
|
+
|
|
40
|
+
defaultConfig {
|
|
41
|
+
minSdk 23
|
|
42
|
+
targetSdk 34
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
buildTypes {
|
|
46
|
+
release {
|
|
47
|
+
minifyEnabled false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
compileOptions {
|
|
52
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
53
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
sourceSets {
|
|
57
|
+
main {
|
|
58
|
+
java.srcDirs += new File(projectDir, "../src/main/java/com/facebook/react/viewmanagers")
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (isNewArchEnabled) {
|
|
64
|
+
react {
|
|
65
|
+
libraryName = "AguaceroWxReactNativeSpec"
|
|
66
|
+
codegenJavaPackageName = "com.aguacerowx.reactnative"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
dependencies {
|
|
71
|
+
implementation 'com.facebook.react:react-native:+'
|
|
72
|
+
api 'org.locationtech.proj4j:proj4j:1.1.5'
|
|
73
|
+
implementation 'com.github.luben:zstd-jni:1.5.7-6@aar'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
project.afterEvaluate {
|
|
77
|
+
// Fix Gradle 9 task dependency issue
|
|
78
|
+
if (isNewArchEnabled) {
|
|
79
|
+
tasks.named("generateCodegenArtifactsFromSchema").configure {
|
|
80
|
+
dependsOn("generateCodegenSchemaFromJavaScript")
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Mapbox version resolution
|
|
85
|
+
def resolvedMapboxVersion
|
|
86
|
+
if (project.rootProject.hasProperty('mapboxMapsVersion')) {
|
|
87
|
+
resolvedMapboxVersion = project.rootProject.mapboxMapsVersion
|
|
88
|
+
println "[aguacerowx] Found mapboxMapsVersion: ${resolvedMapboxVersion}"
|
|
89
|
+
} else {
|
|
90
|
+
resolvedMapboxVersion = "11.15.2"
|
|
91
|
+
println "[aguacerowx] WARNING: Could not find 'mapboxMapsVersion' property. Falling back to ${resolvedMapboxVersion}."
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
def rnMapboxIsPresent = project.rootProject.findProject(':rnmapbox_maps') != null
|
|
95
|
+
def mapboxArtifact
|
|
96
|
+
|
|
97
|
+
if (rnMapboxIsPresent) {
|
|
98
|
+
mapboxArtifact = "android-ndk27"
|
|
99
|
+
println "[aguacerowx] @rnmapbox/maps detected. Using Mapbox artifact: '${mapboxArtifact}' to ensure compatibility."
|
|
100
|
+
} else {
|
|
101
|
+
mapboxArtifact = "android"
|
|
102
|
+
println "[aguacerowx] @rnmapbox/maps not detected. Using standard Mapbox artifact: '${mapboxArtifact}'."
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
dependencies {
|
|
106
|
+
implementation "com.mapbox.maps:${mapboxArtifact}:${resolvedMapboxVersion}"
|
|
107
|
+
}
|
|
108
|
+
}
|