@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
|
@@ -68,7 +68,8 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
68
68
|
private ByteBuffer pendingColormapBuffer = null;
|
|
69
69
|
private FloatBuffer pendingVertexBuffer = null;
|
|
70
70
|
private ShortBuffer pendingIndexBuffer = null;
|
|
71
|
-
|
|
71
|
+
private int uIsMRMS;
|
|
72
|
+
private boolean isMRMS = false;
|
|
72
73
|
|
|
73
74
|
public GridRenderLayer(Context context) {
|
|
74
75
|
this.context = context;
|
|
@@ -123,6 +124,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
123
124
|
uSmoothing = GLES20.glGetUniformLocation(program, "u_smoothing");
|
|
124
125
|
uScaleType = GLES20.glGetUniformLocation(program, "u_scale_type");
|
|
125
126
|
uIsPtype = GLES20.glGetUniformLocation(program, "u_is_ptype");
|
|
127
|
+
uIsMRMS = GLES20.glGetUniformLocation(program, "u_is_mrms");
|
|
126
128
|
aPosition = GLES20.glGetAttribLocation(program, "a_position");
|
|
127
129
|
aTexCoord = GLES20.glGetAttribLocation(program, "a_texCoord");
|
|
128
130
|
}
|
|
@@ -138,6 +140,10 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
138
140
|
Log.d(TAG, "setVariable called. Variable: '" + this.currentVariable + "', isPtype set to: " + this.isPtype);
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
public void setIsMRMS(boolean isMRMS) {
|
|
144
|
+
this.isMRMS = isMRMS;
|
|
145
|
+
Log.d(TAG, "setIsMRMS called with: " + isMRMS);
|
|
146
|
+
}
|
|
141
147
|
|
|
142
148
|
public void clearData() {
|
|
143
149
|
this.isVisible = false;
|
|
@@ -245,7 +251,9 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
245
251
|
floatMatrix[i] = matrix.get(i).floatValue();
|
|
246
252
|
}
|
|
247
253
|
|
|
248
|
-
floatMatrix[0] *= scale;
|
|
254
|
+
floatMatrix[0] *= scale;
|
|
255
|
+
floatMatrix[1] *= scale;
|
|
256
|
+
floatMatrix[4] *= scale;
|
|
249
257
|
floatMatrix[5] *= scale;
|
|
250
258
|
|
|
251
259
|
GLES20.glUniformMatrix4fv(uMatrix, 1, false, floatMatrix, 0);
|
|
@@ -259,6 +267,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
259
267
|
GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
|
|
260
268
|
GLES20.glUniform1i(uScaleType, this.scaleType);
|
|
261
269
|
GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
|
|
270
|
+
GLES20.glUniform1i(uIsMRMS, this.isMRMS ? 1 : 0);
|
|
262
271
|
|
|
263
272
|
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
264
273
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
@@ -454,9 +463,37 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
454
463
|
}
|
|
455
464
|
|
|
456
465
|
private double[] projectLCCToLatLon(double x, double y, ReadableMap projParams) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
try {
|
|
467
|
+
StringBuilder projString = new StringBuilder("+proj=lcc");
|
|
468
|
+
|
|
469
|
+
if (projParams.hasKey("lat_1")) projString.append(" +lat_1=").append(projParams.getDouble("lat_1"));
|
|
470
|
+
if (projParams.hasKey("lat_2")) projString.append(" +lat_2=").append(projParams.getDouble("lat_2"));
|
|
471
|
+
if (projParams.hasKey("lat_0")) projString.append(" +lat_0=").append(projParams.getDouble("lat_0"));
|
|
472
|
+
if (projParams.hasKey("lon_0")) projString.append(" +lon_0=").append(projParams.getDouble("lon_0"));
|
|
473
|
+
if (projParams.hasKey("x_0")) projString.append(" +x_0=").append(projParams.getDouble("x_0"));
|
|
474
|
+
if (projParams.hasKey("y_0")) projString.append(" +y_0=").append(projParams.getDouble("y_0"));
|
|
475
|
+
if (projParams.hasKey("ellps")) projString.append(" +ellps=").append(projParams.getString("ellps"));
|
|
476
|
+
if (projParams.hasKey("a")) projString.append(" +a=").append(projParams.getDouble("a"));
|
|
477
|
+
if (projParams.hasKey("b")) projString.append(" +b=").append(projParams.getDouble("b"));
|
|
478
|
+
projString.append(" +units=m +no_defs");
|
|
479
|
+
|
|
480
|
+
org.locationtech.proj4j.CRSFactory crsFactory = new org.locationtech.proj4j.CRSFactory();
|
|
481
|
+
org.locationtech.proj4j.CoordinateReferenceSystem srcCRS = crsFactory.createFromParameters("LCC", projString.toString());
|
|
482
|
+
org.locationtech.proj4j.CoordinateReferenceSystem dstCRS = crsFactory.createFromParameters("WGS84", "+proj=longlat +datum=WGS84 +no_defs");
|
|
483
|
+
|
|
484
|
+
org.locationtech.proj4j.CoordinateTransformFactory ctFactory = new org.locationtech.proj4j.CoordinateTransformFactory();
|
|
485
|
+
org.locationtech.proj4j.CoordinateTransform transform = ctFactory.createTransform(srcCRS, dstCRS);
|
|
486
|
+
|
|
487
|
+
org.locationtech.proj4j.ProjCoordinate srcCoord = new org.locationtech.proj4j.ProjCoordinate(x, y);
|
|
488
|
+
org.locationtech.proj4j.ProjCoordinate dstCoord = new org.locationtech.proj4j.ProjCoordinate();
|
|
489
|
+
transform.transform(srcCoord, dstCoord);
|
|
490
|
+
|
|
491
|
+
return new double[]{dstCoord.x, dstCoord.y};
|
|
492
|
+
|
|
493
|
+
} catch (Exception e) {
|
|
494
|
+
Log.e(TAG, "Error in LCC projection: " + e.getMessage());
|
|
495
|
+
return null;
|
|
496
|
+
}
|
|
460
497
|
}
|
|
461
498
|
|
|
462
499
|
private boolean isLCCType(ReadableMap gridDefMap) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// packages/react-native/android/src/main/res/raw/fragment_shader.glsl
|
|
2
|
-
|
|
3
1
|
precision highp float;
|
|
4
2
|
varying vec2 v_texCoord;
|
|
5
3
|
|
|
@@ -19,7 +17,8 @@ uniform vec2 u_data_range;
|
|
|
19
17
|
// Rendering parameters
|
|
20
18
|
uniform vec2 u_texture_size;
|
|
21
19
|
uniform int u_smoothing;
|
|
22
|
-
uniform int u_is_ptype; //
|
|
20
|
+
uniform int u_is_ptype; // Flag for ptype variables
|
|
21
|
+
uniform int u_is_mrms; // NEW: Flag for MRMS data
|
|
23
22
|
|
|
24
23
|
// --- HELPER FUNCTIONS ---
|
|
25
24
|
|
|
@@ -49,11 +48,22 @@ float get_value(vec2 coord) {
|
|
|
49
48
|
|
|
50
49
|
// Maps a physical value to a precipitation type category
|
|
51
50
|
float get_ptype_from_physical(float val) {
|
|
52
|
-
if (val < 0.0) return -1.0;
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if (val < 0.0) return -1.0;
|
|
52
|
+
|
|
53
|
+
if (u_is_mrms == 1) {
|
|
54
|
+
// MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
|
|
55
|
+
if (val < 100.0) return 0.0;
|
|
56
|
+
if (val < 200.0) return 1.0;
|
|
57
|
+
if (val < 300.0) return 2.0;
|
|
58
|
+
return -1.0;
|
|
59
|
+
} else {
|
|
60
|
+
// Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
|
|
61
|
+
if (val < 100.0) return 0.0;
|
|
62
|
+
if (val < 200.0) return 1.0;
|
|
63
|
+
if (val < 300.0) return 2.0;
|
|
64
|
+
if (val < 400.0) return 3.0;
|
|
65
|
+
return -1.0;
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
|
|
@@ -60,7 +60,9 @@ public class GridRenderLayer: NSObject {
|
|
|
60
60
|
missingQuantized: 127.0,
|
|
61
61
|
textureSize: SIMD2<Float>(0.0, 0.0),
|
|
62
62
|
smoothing: 1,
|
|
63
|
-
scaleType: 0
|
|
63
|
+
scaleType: 0,
|
|
64
|
+
isPtype: 0,
|
|
65
|
+
isMRMS: 0
|
|
64
66
|
)
|
|
65
67
|
private var isVisible = false
|
|
66
68
|
private var pendingActiveFrameKey: String?
|
|
@@ -74,8 +76,8 @@ public class GridRenderLayer: NSObject {
|
|
|
74
76
|
let nx: Float
|
|
75
77
|
let ny: Float
|
|
76
78
|
let filePath: String
|
|
77
|
-
let originalScale: Float
|
|
78
|
-
let originalOffset: Float
|
|
79
|
+
let originalScale: Float
|
|
80
|
+
let originalOffset: Float
|
|
79
81
|
}
|
|
80
82
|
private var frameCache: [String: FrameMetadata] = [:]
|
|
81
83
|
private let highPriorityTextureQueue = DispatchQueue(label: "com.aguacero.texture-processing-high-priority", qos: .userInitiated)
|
|
@@ -124,7 +126,23 @@ public class GridRenderLayer: NSObject {
|
|
|
124
126
|
// ADD THIS: Force the map to repaint to show the smoothing change immediately.
|
|
125
127
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
126
128
|
}
|
|
129
|
+
|
|
130
|
+
@objc(setIsMRMSWithIsMRMS:)
|
|
131
|
+
public func setIsMRMS(isMRMS: Bool) {
|
|
132
|
+
self.uniforms.isMRMS = isMRMS ? 1 : 0
|
|
133
|
+
print("🟢 [GridRenderLayer] Set isMRMS: \(isMRMS)")
|
|
134
|
+
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
135
|
+
}
|
|
127
136
|
|
|
137
|
+
// ADD THIS METHOD
|
|
138
|
+
@objc(setVariableWithVariable:)
|
|
139
|
+
public func setVariable(variable: String) {
|
|
140
|
+
let isPtypeVar = (variable == "ptypeRefl" || variable == "ptypeRate")
|
|
141
|
+
self.uniforms.isPtype = isPtypeVar ? 1 : 0
|
|
142
|
+
print("🟢 [GridRenderLayer] Set variable: \(variable), isPtype set to: \(self.uniforms.isPtype)")
|
|
143
|
+
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
144
|
+
}
|
|
145
|
+
|
|
128
146
|
@objc public func clear() {
|
|
129
147
|
self.isVisible = false
|
|
130
148
|
self.inspectorCache.clear()
|
|
@@ -935,7 +953,9 @@ internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFor
|
|
|
935
953
|
var floatArray = matrixArray.map { $0.floatValue }
|
|
936
954
|
|
|
937
955
|
floatArray[0] *= scale // X scale
|
|
938
|
-
floatArray[
|
|
956
|
+
floatArray[1] *= scale // X rotation
|
|
957
|
+
floatArray[4] *= scale // Y rotation
|
|
958
|
+
floatArray[5] *= scale
|
|
939
959
|
|
|
940
960
|
let mvp = matrix_float4x4(
|
|
941
961
|
SIMD4<Float>(floatArray[0], floatArray[1], floatArray[2], floatArray[3]),
|
|
@@ -143,4 +143,16 @@ RCT_EXPORT_METHOD(clearGpuCache:(nonnull NSNumber *)reactTag)
|
|
|
143
143
|
}];
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// ADD THIS METHOD
|
|
147
|
+
RCT_EXPORT_METHOD(setVariable:(nonnull NSNumber *)reactTag
|
|
148
|
+
variable:(NSString *)variable)
|
|
149
|
+
{
|
|
150
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
151
|
+
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
152
|
+
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
153
|
+
[view setVariable:variable];
|
|
154
|
+
}
|
|
155
|
+
}];
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
@end
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
2
|
@class GridRenderLayer;
|
|
4
3
|
@class MapView;
|
|
5
|
-
|
|
6
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
7
|
-
|
|
8
5
|
@interface GridRenderLayerView : UIView
|
|
9
|
-
|
|
10
6
|
@property (nonatomic, strong) GridRenderLayer *layerInstance;
|
|
11
7
|
@property (nonatomic, weak) MapView *mapView;
|
|
12
8
|
@property (nonatomic, strong) NSString *layerId;
|
|
13
9
|
@property (nonatomic, strong, nullable) NSString *belowID;
|
|
14
|
-
|
|
15
10
|
// Property setters for React Native
|
|
16
11
|
- (void)setOpacity:(float)opacity;
|
|
17
12
|
- (void)setDataRange:(NSArray *)dataRange;
|
|
18
13
|
- (void)setSmoothing:(BOOL)smoothing;
|
|
19
14
|
- (void)setBelowID:(NSString *)belowID;
|
|
20
|
-
|
|
15
|
+
- (void)setVariable:(NSString *)variable; // ADD THIS LINE
|
|
21
16
|
@end
|
|
22
|
-
|
|
23
17
|
NS_ASSUME_NONNULL_END
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
RCTLogInfo(@"🟢 [GridRenderLayerView] Set belowID: %@", belowID);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// ADD THIS METHOD
|
|
63
|
+
- (void)setVariable:(NSString *)variable {
|
|
64
|
+
[self.layerInstance setVariableWithVariable:variable];
|
|
65
|
+
RCTLogInfo(@"🟢 [GridRenderLayerView] Set variable: %@", variable);
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
#pragma mark - View Lifecycle
|
|
63
69
|
|
|
64
70
|
- (void)didMoveToWindow {
|
|
@@ -196,4 +202,4 @@
|
|
|
196
202
|
[super removeFromSuperview];
|
|
197
203
|
}
|
|
198
204
|
|
|
199
|
-
@end
|
|
205
|
+
@end
|
package/ios/Shaders.metal
CHANGED
|
@@ -22,7 +22,9 @@ struct FragmentUniforms {
|
|
|
22
22
|
float missingQuantized;
|
|
23
23
|
float2 textureSize;
|
|
24
24
|
int smoothing;
|
|
25
|
-
int scaleType;
|
|
25
|
+
int scaleType;
|
|
26
|
+
int isPtype;
|
|
27
|
+
int isMRMS;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
// --- Vertex Shader (Unchanged) ---
|
|
@@ -34,52 +36,56 @@ vertex RasterizerData vertex_main(const Vertex in [[stage_in]],
|
|
|
34
36
|
return out;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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;
|
|
39
|
+
|
|
40
|
+
// --- HELPER FUNCTIONS FOR FRAGMENT SHADER ---
|
|
41
|
+
|
|
42
|
+
// Dequantizes a signed value (-127 to 127) into a physical value
|
|
43
|
+
float dequantize_val(float q_val, constant FragmentUniforms &uniforms) {
|
|
44
|
+
if (abs(q_val - uniforms.missingQuantized) < 0.5) {
|
|
45
|
+
return -9999.0;
|
|
46
|
+
}
|
|
47
|
+
float intermediate = q_val * uniforms.scale + uniforms.offset;
|
|
48
|
+
if (uniforms.scaleType == 1) { // 1 = sqrt
|
|
49
|
+
return intermediate * abs(intermediate);
|
|
71
50
|
}
|
|
51
|
+
return intermediate;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Samples texture, converts 0-255 to signed -128-127 range.
|
|
55
|
+
// Returns a quantized value, or a large positive sentinel for missing data.
|
|
56
|
+
float get_value(texture2d<float, access::sample> dataTexture, sampler dataSampler, float2 coord, constant FragmentUniforms &uniforms) {
|
|
57
|
+
// Note: The sampler should be set to 'nearest' when calling this for ptype logic.
|
|
58
|
+
float value_0_to_255 = dataTexture.sample(dataSampler, coord).r * 255.0;
|
|
59
|
+
float val = value_0_to_255 - 128.0;
|
|
60
|
+
float missing_in_texture_range_0_255 = uniforms.missingQuantized + 128.0;
|
|
61
|
+
if (abs(value_0_to_255 - missing_in_texture_range_0_255) < 0.5) {
|
|
62
|
+
return 99999.0; // Sentinel for "missing"
|
|
63
|
+
}
|
|
64
|
+
return val;
|
|
65
|
+
}
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
// Maps a physical value to a precipitation type category
|
|
68
|
+
// Maps a physical value to a precipitation type category
|
|
69
|
+
float get_ptype_from_physical(float val, constant FragmentUniforms &uniforms) { // ADD uniforms parameter
|
|
70
|
+
if (val < 0.0) return -1.0;
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
if (uniforms.isMRMS == 1) { // ADD THIS BRANCH
|
|
73
|
+
// MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
|
|
74
|
+
if (val < 100.0) return 0.0;
|
|
75
|
+
if (val < 200.0) return 1.0;
|
|
76
|
+
if (val < 300.0) return 2.0;
|
|
77
|
+
return -1.0;
|
|
78
|
+
} else {
|
|
79
|
+
// Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
|
|
80
|
+
if (val < 100.0) return 0.0;
|
|
81
|
+
if (val < 200.0) return 1.0;
|
|
82
|
+
if (val < 300.0) return 2.0;
|
|
83
|
+
if (val < 400.0) return 3.0;
|
|
84
|
+
return -1.0;
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
// --- Fragment Shader
|
|
88
|
+
// --- Main Fragment Shader ---
|
|
83
89
|
fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
84
90
|
constant FragmentUniforms &uniforms [[buffer(0)]],
|
|
85
91
|
texture2d<float, access::sample> dataTexture [[texture(0)]],
|
|
@@ -87,45 +93,99 @@ fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
|
87
93
|
sampler dataSampler [[sampler(0)]],
|
|
88
94
|
sampler colormapSampler [[sampler(1)]])
|
|
89
95
|
{
|
|
90
|
-
|
|
91
|
-
float
|
|
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
|
-
}
|
|
96
|
+
float raw_value;
|
|
97
|
+
float alpha_multiplier = 1.0; // Used for alpha feathering at data edges
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
if (uniforms.smoothing == 0) { // Nearest neighbor
|
|
100
|
+
float quantized_value = get_value(dataTexture, dataSampler, in.texCoord, uniforms);
|
|
101
|
+
if (quantized_value >= 99999.0) {
|
|
102
|
+
discard_fragment();
|
|
103
|
+
}
|
|
104
|
+
raw_value = dequantize_val(quantized_value, uniforms);
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
} else { // Bilinear interpolation
|
|
107
|
+
float2 texel_size = 1.0 / uniforms.textureSize;
|
|
108
|
+
float2 tex_coord_in_texels = in.texCoord * uniforms.textureSize;
|
|
109
|
+
float2 bl_texel_index = floor(tex_coord_in_texels - 0.5);
|
|
110
|
+
float2 f = fract(tex_coord_in_texels - 0.5); // Interpolation factors
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
// Coordinates of the 4 neighboring texels
|
|
113
|
+
float2 v00_coord = (bl_texel_index + float2(0.5, 0.5)) * texel_size;
|
|
114
|
+
float2 v10_coord = (bl_texel_index + float2(1.5, 0.5)) * texel_size;
|
|
115
|
+
float2 v01_coord = (bl_texel_index + float2(0.5, 1.5)) * texel_size;
|
|
116
|
+
float2 v11_coord = (bl_texel_index + float2(1.5, 1.5)) * texel_size;
|
|
117
|
+
|
|
118
|
+
if (uniforms.isPtype == 1) {
|
|
119
|
+
// --- PTYPE-SPECIFIC INTERPOLATION (CATEGORICAL) ---
|
|
120
|
+
float v00 = dequantize_val(get_value(dataTexture, dataSampler, v00_coord, uniforms), uniforms);
|
|
121
|
+
float v10 = dequantize_val(get_value(dataTexture, dataSampler, v10_coord, uniforms), uniforms);
|
|
122
|
+
float v01 = dequantize_val(get_value(dataTexture, dataSampler, v01_coord, uniforms), uniforms);
|
|
123
|
+
float v11 = dequantize_val(get_value(dataTexture, dataSampler, v11_coord, uniforms), uniforms);
|
|
124
|
+
|
|
125
|
+
float p00 = get_ptype_from_physical(v00, uniforms);
|
|
126
|
+
float p10 = get_ptype_from_physical(v10, uniforms);
|
|
127
|
+
float p01 = get_ptype_from_physical(v01, uniforms);
|
|
128
|
+
float p11 = get_ptype_from_physical(v11, uniforms);
|
|
129
|
+
|
|
130
|
+
// Determine the dominant precipitation type for this pixel
|
|
131
|
+
float dominant_ptype = -1.0;
|
|
132
|
+
if (p00 != -1.0) dominant_ptype = p00;
|
|
133
|
+
else if (p10 != -1.0) dominant_ptype = p10;
|
|
134
|
+
else if (p01 != -1.0) dominant_ptype = p01;
|
|
135
|
+
else if (p11 != -1.0) dominant_ptype = p11;
|
|
136
|
+
|
|
137
|
+
if (dominant_ptype == -1.0) discard_fragment();
|
|
138
|
+
|
|
139
|
+
// Interpolate ONLY the values that match the dominant ptype
|
|
140
|
+
float total_value = 0.0;
|
|
141
|
+
float total_weight = 0.0;
|
|
142
|
+
if (p00 == dominant_ptype) { float w = (1.0-f.x)*(1.0-f.y); total_value+=v00*w; total_weight+=w; }
|
|
143
|
+
if (p10 == dominant_ptype) { float w = f.x*(1.0-f.y); total_value+=v10*w; total_weight+=w; }
|
|
144
|
+
if (p01 == dominant_ptype) { float w = (1.0-f.x)*f.y; total_value+=v01*w; total_weight+=w; }
|
|
145
|
+
if (p11 == dominant_ptype) { float w = f.x*f.y; total_value+=v11*w; total_weight+=w; }
|
|
146
|
+
|
|
147
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
148
|
+
raw_value = total_value / total_weight;
|
|
149
|
+
|
|
150
|
+
// Force full alpha to prevent dark borders between ptype regions
|
|
151
|
+
alpha_multiplier = 1.0;
|
|
152
|
+
|
|
153
|
+
} else {
|
|
154
|
+
// --- STANDARD INTERPOLATION (CONTINUOUS) ---
|
|
155
|
+
float v00_q = get_value(dataTexture, dataSampler, v00_coord, uniforms);
|
|
156
|
+
float v10_q = get_value(dataTexture, dataSampler, v10_coord, uniforms);
|
|
157
|
+
float v01_q = get_value(dataTexture, dataSampler, v01_coord, uniforms);
|
|
158
|
+
float v11_q = get_value(dataTexture, dataSampler, v11_coord, uniforms);
|
|
159
|
+
|
|
160
|
+
float total_value_q = 0.0;
|
|
161
|
+
float total_weight = 0.0;
|
|
162
|
+
if (v00_q < 99999.0) { float w = (1.0-f.x)*(1.0-f.y); total_value_q+=v00_q*w; total_weight+=w; }
|
|
163
|
+
if (v10_q < 99999.0) { float w = f.x*(1.0-f.y); total_value_q+=v10_q*w; total_weight+=w; }
|
|
164
|
+
if (v01_q < 99999.0) { float w = (1.0-f.x)*f.y; total_value_q+=v01_q*w; total_weight+=w; }
|
|
165
|
+
if (v11_q < 99999.0) { float w = f.x*f.y; total_value_q+=v11_q*w; total_weight+=w; }
|
|
166
|
+
|
|
167
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
168
|
+
raw_value = dequantize_val(total_value_q / total_weight, uniforms);
|
|
169
|
+
alpha_multiplier = total_weight; // Feather the edges of the data
|
|
170
|
+
}
|
|
116
171
|
}
|
|
117
|
-
|
|
118
|
-
//
|
|
172
|
+
|
|
173
|
+
// --- COMMON FINAL STEPS ---
|
|
174
|
+
|
|
119
175
|
if (raw_value < uniforms.dataRange.x) {
|
|
120
176
|
discard_fragment();
|
|
121
177
|
}
|
|
122
|
-
|
|
123
|
-
// Normalize the value to a 0-1 coordinate for colormap lookup.
|
|
178
|
+
|
|
124
179
|
float colormap_coord = (raw_value - uniforms.dataRange.x) / (uniforms.dataRange.y - uniforms.dataRange.x);
|
|
125
180
|
colormap_coord = clamp(colormap_coord, 0.0, 1.0);
|
|
126
181
|
|
|
127
|
-
// Sample the colormap and apply final opacity.
|
|
128
182
|
float4 color = colormapTexture.sample(colormapSampler, float2(colormap_coord, 0.5));
|
|
129
183
|
|
|
130
|
-
|
|
184
|
+
// Discard if the colormap specifies transparency
|
|
185
|
+
if (color.a < 0.1) {
|
|
186
|
+
discard_fragment();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
float final_alpha = color.a * uniforms.opacity * alpha_multiplier;
|
|
190
|
+
return float4(color.rgb * final_alpha, final_alpha);
|
|
131
191
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -68,7 +68,8 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
68
68
|
private ByteBuffer pendingColormapBuffer = null;
|
|
69
69
|
private FloatBuffer pendingVertexBuffer = null;
|
|
70
70
|
private ShortBuffer pendingIndexBuffer = null;
|
|
71
|
-
|
|
71
|
+
private int uIsMRMS;
|
|
72
|
+
private boolean isMRMS = false;
|
|
72
73
|
|
|
73
74
|
public GridRenderLayer(Context context) {
|
|
74
75
|
this.context = context;
|
|
@@ -123,6 +124,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
123
124
|
uSmoothing = GLES20.glGetUniformLocation(program, "u_smoothing");
|
|
124
125
|
uScaleType = GLES20.glGetUniformLocation(program, "u_scale_type");
|
|
125
126
|
uIsPtype = GLES20.glGetUniformLocation(program, "u_is_ptype");
|
|
127
|
+
uIsMRMS = GLES20.glGetUniformLocation(program, "u_is_mrms");
|
|
126
128
|
aPosition = GLES20.glGetAttribLocation(program, "a_position");
|
|
127
129
|
aTexCoord = GLES20.glGetAttribLocation(program, "a_texCoord");
|
|
128
130
|
}
|
|
@@ -138,6 +140,10 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
138
140
|
Log.d(TAG, "setVariable called. Variable: '" + this.currentVariable + "', isPtype set to: " + this.isPtype);
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
public void setIsMRMS(boolean isMRMS) {
|
|
144
|
+
this.isMRMS = isMRMS;
|
|
145
|
+
Log.d(TAG, "setIsMRMS called with: " + isMRMS);
|
|
146
|
+
}
|
|
141
147
|
|
|
142
148
|
public void clearData() {
|
|
143
149
|
this.isVisible = false;
|
|
@@ -245,7 +251,9 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
245
251
|
floatMatrix[i] = matrix.get(i).floatValue();
|
|
246
252
|
}
|
|
247
253
|
|
|
248
|
-
floatMatrix[0] *= scale;
|
|
254
|
+
floatMatrix[0] *= scale;
|
|
255
|
+
floatMatrix[1] *= scale;
|
|
256
|
+
floatMatrix[4] *= scale;
|
|
249
257
|
floatMatrix[5] *= scale;
|
|
250
258
|
|
|
251
259
|
GLES20.glUniformMatrix4fv(uMatrix, 1, false, floatMatrix, 0);
|
|
@@ -259,6 +267,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
259
267
|
GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
|
|
260
268
|
GLES20.glUniform1i(uScaleType, this.scaleType);
|
|
261
269
|
GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
|
|
270
|
+
GLES20.glUniform1i(uIsMRMS, this.isMRMS ? 1 : 0);
|
|
262
271
|
|
|
263
272
|
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
264
273
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
@@ -454,9 +463,37 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
454
463
|
}
|
|
455
464
|
|
|
456
465
|
private double[] projectLCCToLatLon(double x, double y, ReadableMap projParams) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
try {
|
|
467
|
+
StringBuilder projString = new StringBuilder("+proj=lcc");
|
|
468
|
+
|
|
469
|
+
if (projParams.hasKey("lat_1")) projString.append(" +lat_1=").append(projParams.getDouble("lat_1"));
|
|
470
|
+
if (projParams.hasKey("lat_2")) projString.append(" +lat_2=").append(projParams.getDouble("lat_2"));
|
|
471
|
+
if (projParams.hasKey("lat_0")) projString.append(" +lat_0=").append(projParams.getDouble("lat_0"));
|
|
472
|
+
if (projParams.hasKey("lon_0")) projString.append(" +lon_0=").append(projParams.getDouble("lon_0"));
|
|
473
|
+
if (projParams.hasKey("x_0")) projString.append(" +x_0=").append(projParams.getDouble("x_0"));
|
|
474
|
+
if (projParams.hasKey("y_0")) projString.append(" +y_0=").append(projParams.getDouble("y_0"));
|
|
475
|
+
if (projParams.hasKey("ellps")) projString.append(" +ellps=").append(projParams.getString("ellps"));
|
|
476
|
+
if (projParams.hasKey("a")) projString.append(" +a=").append(projParams.getDouble("a"));
|
|
477
|
+
if (projParams.hasKey("b")) projString.append(" +b=").append(projParams.getDouble("b"));
|
|
478
|
+
projString.append(" +units=m +no_defs");
|
|
479
|
+
|
|
480
|
+
org.locationtech.proj4j.CRSFactory crsFactory = new org.locationtech.proj4j.CRSFactory();
|
|
481
|
+
org.locationtech.proj4j.CoordinateReferenceSystem srcCRS = crsFactory.createFromParameters("LCC", projString.toString());
|
|
482
|
+
org.locationtech.proj4j.CoordinateReferenceSystem dstCRS = crsFactory.createFromParameters("WGS84", "+proj=longlat +datum=WGS84 +no_defs");
|
|
483
|
+
|
|
484
|
+
org.locationtech.proj4j.CoordinateTransformFactory ctFactory = new org.locationtech.proj4j.CoordinateTransformFactory();
|
|
485
|
+
org.locationtech.proj4j.CoordinateTransform transform = ctFactory.createTransform(srcCRS, dstCRS);
|
|
486
|
+
|
|
487
|
+
org.locationtech.proj4j.ProjCoordinate srcCoord = new org.locationtech.proj4j.ProjCoordinate(x, y);
|
|
488
|
+
org.locationtech.proj4j.ProjCoordinate dstCoord = new org.locationtech.proj4j.ProjCoordinate();
|
|
489
|
+
transform.transform(srcCoord, dstCoord);
|
|
490
|
+
|
|
491
|
+
return new double[]{dstCoord.x, dstCoord.y};
|
|
492
|
+
|
|
493
|
+
} catch (Exception e) {
|
|
494
|
+
Log.e(TAG, "Error in LCC projection: " + e.getMessage());
|
|
495
|
+
return null;
|
|
496
|
+
}
|
|
460
497
|
}
|
|
461
498
|
|
|
462
499
|
private boolean isLCCType(ReadableMap gridDefMap) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// packages/react-native/android/src/main/res/raw/fragment_shader.glsl
|
|
2
|
-
|
|
3
1
|
precision highp float;
|
|
4
2
|
varying vec2 v_texCoord;
|
|
5
3
|
|
|
@@ -19,7 +17,8 @@ uniform vec2 u_data_range;
|
|
|
19
17
|
// Rendering parameters
|
|
20
18
|
uniform vec2 u_texture_size;
|
|
21
19
|
uniform int u_smoothing;
|
|
22
|
-
uniform int u_is_ptype; //
|
|
20
|
+
uniform int u_is_ptype; // Flag for ptype variables
|
|
21
|
+
uniform int u_is_mrms; // NEW: Flag for MRMS data
|
|
23
22
|
|
|
24
23
|
// --- HELPER FUNCTIONS ---
|
|
25
24
|
|
|
@@ -49,11 +48,22 @@ float get_value(vec2 coord) {
|
|
|
49
48
|
|
|
50
49
|
// Maps a physical value to a precipitation type category
|
|
51
50
|
float get_ptype_from_physical(float val) {
|
|
52
|
-
if (val < 0.0) return -1.0;
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if (val < 0.0) return -1.0;
|
|
52
|
+
|
|
53
|
+
if (u_is_mrms == 1) {
|
|
54
|
+
// MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
|
|
55
|
+
if (val < 100.0) return 0.0;
|
|
56
|
+
if (val < 200.0) return 1.0;
|
|
57
|
+
if (val < 300.0) return 2.0;
|
|
58
|
+
return -1.0;
|
|
59
|
+
} else {
|
|
60
|
+
// Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
|
|
61
|
+
if (val < 100.0) return 0.0;
|
|
62
|
+
if (val < 200.0) return 1.0;
|
|
63
|
+
if (val < 300.0) return 2.0;
|
|
64
|
+
if (val < 400.0) return 3.0;
|
|
65
|
+
return -1.0;
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
|