react-native-mapsforge-vtm-ext-grib 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +118 -0
  3. package/android/CMakeLists.txt +13 -0
  4. package/android/build.gradle +108 -0
  5. package/android/generated/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/NativeWeatherOverlaySpec.java +95 -0
  6. package/android/generated/jni/CMakeLists.txt +28 -0
  7. package/android/generated/jni/RNMapsforgeVtmExtGribSpec-generated.cpp +62 -0
  8. package/android/generated/jni/RNMapsforgeVtmExtGribSpec.h +31 -0
  9. package/android/generated/jni/react/renderer/components/RNMapsforgeVtmExtGribSpec/RNMapsforgeVtmExtGribSpecJSI.h +521 -0
  10. package/android/gradle.properties +5 -0
  11. package/android/src/main/AndroidManifest.xml +2 -0
  12. package/android/src/main/AndroidManifestNew.xml +2 -0
  13. package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/ExtGribPackage.java +62 -0
  14. package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/modules/WeatherOverlay.java +343 -0
  15. package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/ColorRamp.java +165 -0
  16. package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/WeatherGridData.java +103 -0
  17. package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/WeatherTileDataSource.java +147 -0
  18. package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/WeatherTileSource.java +80 -0
  19. package/lib/commonjs/NativeModules/NativeWeatherOverlay.js +9 -0
  20. package/lib/commonjs/NativeModules/NativeWeatherOverlay.js.map +1 -0
  21. package/lib/commonjs/components/WeatherOverlay.js +180 -0
  22. package/lib/commonjs/components/WeatherOverlay.js.map +1 -0
  23. package/lib/commonjs/index.js +21 -0
  24. package/lib/commonjs/index.js.map +1 -0
  25. package/lib/commonjs/package.json +1 -0
  26. package/lib/commonjs/reanimated/index.js +13 -0
  27. package/lib/commonjs/reanimated/index.js.map +1 -0
  28. package/lib/commonjs/reanimated/useWeatherAnimation.js +86 -0
  29. package/lib/commonjs/reanimated/useWeatherAnimation.js.map +1 -0
  30. package/lib/commonjs/reportNativeError.js +14 -0
  31. package/lib/commonjs/reportNativeError.js.map +1 -0
  32. package/lib/commonjs/types.js +2 -0
  33. package/lib/commonjs/types.js.map +1 -0
  34. package/lib/module/NativeModules/NativeWeatherOverlay.js +5 -0
  35. package/lib/module/NativeModules/NativeWeatherOverlay.js.map +1 -0
  36. package/lib/module/components/WeatherOverlay.js +174 -0
  37. package/lib/module/components/WeatherOverlay.js.map +1 -0
  38. package/lib/module/index.js +16 -0
  39. package/lib/module/index.js.map +1 -0
  40. package/lib/module/package.json +1 -0
  41. package/lib/module/reanimated/index.js +4 -0
  42. package/lib/module/reanimated/index.js.map +1 -0
  43. package/lib/module/reanimated/useWeatherAnimation.js +81 -0
  44. package/lib/module/reanimated/useWeatherAnimation.js.map +1 -0
  45. package/lib/module/reportNativeError.js +10 -0
  46. package/lib/module/reportNativeError.js.map +1 -0
  47. package/lib/module/types.js +2 -0
  48. package/lib/module/types.js.map +1 -0
  49. package/lib/typescript/commonjs/package.json +1 -0
  50. package/lib/typescript/commonjs/src/NativeModules/NativeWeatherOverlay.d.ts +63 -0
  51. package/lib/typescript/commonjs/src/NativeModules/NativeWeatherOverlay.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/src/components/WeatherOverlay.d.ts +10 -0
  53. package/lib/typescript/commonjs/src/components/WeatherOverlay.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/index.d.ts +11 -0
  55. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/reanimated/index.d.ts +3 -0
  57. package/lib/typescript/commonjs/src/reanimated/index.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/src/reanimated/useWeatherAnimation.d.ts +44 -0
  59. package/lib/typescript/commonjs/src/reanimated/useWeatherAnimation.d.ts.map +1 -0
  60. package/lib/typescript/commonjs/src/reportNativeError.d.ts +3 -0
  61. package/lib/typescript/commonjs/src/reportNativeError.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/src/types.d.ts +51 -0
  63. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  64. package/lib/typescript/module/package.json +1 -0
  65. package/lib/typescript/module/src/NativeModules/NativeWeatherOverlay.d.ts +63 -0
  66. package/lib/typescript/module/src/NativeModules/NativeWeatherOverlay.d.ts.map +1 -0
  67. package/lib/typescript/module/src/components/WeatherOverlay.d.ts +10 -0
  68. package/lib/typescript/module/src/components/WeatherOverlay.d.ts.map +1 -0
  69. package/lib/typescript/module/src/index.d.ts +11 -0
  70. package/lib/typescript/module/src/index.d.ts.map +1 -0
  71. package/lib/typescript/module/src/reanimated/index.d.ts +3 -0
  72. package/lib/typescript/module/src/reanimated/index.d.ts.map +1 -0
  73. package/lib/typescript/module/src/reanimated/useWeatherAnimation.d.ts +44 -0
  74. package/lib/typescript/module/src/reanimated/useWeatherAnimation.d.ts.map +1 -0
  75. package/lib/typescript/module/src/reportNativeError.d.ts +3 -0
  76. package/lib/typescript/module/src/reportNativeError.d.ts.map +1 -0
  77. package/lib/typescript/module/src/types.d.ts +51 -0
  78. package/lib/typescript/module/src/types.d.ts.map +1 -0
  79. package/package.json +159 -0
  80. package/react-native.config.js +13 -0
  81. package/src/NativeModules/NativeWeatherOverlay.ts +73 -0
  82. package/src/components/WeatherOverlay.tsx +173 -0
  83. package/src/index.ts +22 -0
  84. package/src/reanimated/index.ts +2 -0
  85. package/src/reanimated/useWeatherAnimation.ts +118 -0
  86. package/src/reportNativeError.ts +15 -0
  87. package/src/types.ts +56 -0
@@ -0,0 +1,147 @@
1
+ package com.jhotadhari.reactnative.mapsforge.vtm.ext.grib.tiles;
2
+
3
+ import android.graphics.Bitmap;
4
+ import android.graphics.Color;
5
+
6
+ import org.oscim.android.canvas.AndroidBitmap;
7
+ import org.oscim.core.BoundingBox;
8
+ import org.oscim.layers.tile.MapTile;
9
+ import org.oscim.tiling.ITileDataSink;
10
+ import org.oscim.tiling.ITileDataSource;
11
+ import org.oscim.tiling.QueryResult;
12
+
13
+ /**
14
+ * Renders weather grid data into bitmap tiles on demand.
15
+ *
16
+ * <p>For each tile request, this class:
17
+ * <ol>
18
+ * <li>Converts the tile's x/y/zoom to a geographic bounding box.</li>
19
+ * <li>Iterates over the tile's pixels, mapping each to a lat/lon.</li>
20
+ * <li>Looks up the weather grid value at that lat/lon.</li>
21
+ * <li>Maps the value to a color via the configured color ramp.</li>
22
+ * <li>Returns the rendered {@link Bitmap} to vtm's tile pipeline.</li>
23
+ * </ol>
24
+ */
25
+ public class WeatherTileDataSource implements ITileDataSource {
26
+
27
+ private final WeatherTileSource tileSource;
28
+ private boolean disposed = false;
29
+
30
+ public WeatherTileDataSource(WeatherTileSource tileSource) {
31
+ this.tileSource = tileSource;
32
+ }
33
+
34
+ @Override
35
+ public void query(MapTile mapTile, ITileDataSink dataSink) {
36
+ if (disposed) {
37
+ dataSink.completed(QueryResult.FAILED);
38
+ return;
39
+ }
40
+
41
+ Bitmap bitmap = null;
42
+ try {
43
+ WeatherGridData grid = tileSource.getGridData();
44
+ if (grid == null || grid.values == null || grid.values.length == 0) {
45
+ dataSink.completed(QueryResult.TILE_NOT_FOUND);
46
+ return;
47
+ }
48
+
49
+ String colorMapName = tileSource.getColorMap() != null
50
+ ? tileSource.getColorMap() : "wind";
51
+
52
+ // Get the geographic bounds of this tile.
53
+ BoundingBox bbox = tileToBoundingBox(
54
+ mapTile.tileX, mapTile.tileY, mapTile.zoomLevel);
55
+
56
+ // Only skip tiles that are completely outside the grid.
57
+ // Use a small epsilon so borderline tiles don't get excluded
58
+ // by floating-point rounding at tile edges.
59
+ final double eps = 0.0001;
60
+ if (bbox.getMaxLatitude() + eps < grid.minLat
61
+ || bbox.getMinLatitude() - eps > grid.maxLat
62
+ || bbox.getMaxLongitude() + eps < grid.minLng
63
+ || bbox.getMinLongitude() - eps > grid.maxLng) {
64
+ dataSink.completed(QueryResult.TILE_NOT_FOUND);
65
+ return;
66
+ }
67
+
68
+ int tileSize = tileSource.getTileSize();
69
+ bitmap = Bitmap.createBitmap(
70
+ tileSize, tileSize, Bitmap.Config.ARGB_8888);
71
+ int[] pixels = new int[tileSize * tileSize];
72
+
73
+ double dLng = bbox.getMaxLongitude() - bbox.getMinLongitude();
74
+ double dLat = bbox.getMaxLatitude() - bbox.getMinLatitude();
75
+
76
+ // Build the color ramp for this parameter.
77
+ ColorRamp ramp = ColorRamp.forName(colorMapName);
78
+
79
+ for (int py = 0; py < tileSize; py++) {
80
+ // Sample the center of each pixel cell, not the tile edges.
81
+ // Row 0 = top of tile (maxLat); row (tileSize-1) = bottom.
82
+ double lat = bbox.getMaxLatitude()
83
+ - ((py + 0.5) / (double) tileSize) * dLat;
84
+
85
+ for (int px = 0; px < tileSize; px++) {
86
+ // Column 0 = left (minLng); column (tileSize-1) = right.
87
+ double lng = bbox.getMinLongitude()
88
+ + ((px + 0.5) / (double) tileSize) * dLng;
89
+
90
+ float value = grid.getValueAt(lat, lng);
91
+ int color;
92
+ if (Float.isNaN(value)) {
93
+ color = Color.TRANSPARENT;
94
+ } else {
95
+ color = ramp.getColor(value);
96
+ }
97
+
98
+ pixels[py * tileSize + px] = color;
99
+ }
100
+ }
101
+
102
+ bitmap.setPixels(pixels, 0, tileSize, 0, 0, tileSize, tileSize);
103
+ dataSink.setTileImage(new AndroidBitmap(bitmap));
104
+ dataSink.completed(QueryResult.SUCCESS);
105
+
106
+ } catch (Exception e) {
107
+ e.printStackTrace();
108
+ // Recycle the bitmap if it was created before the exception.
109
+ if (bitmap != null && !bitmap.isRecycled()) {
110
+ bitmap.recycle();
111
+ }
112
+ dataSink.completed(QueryResult.FAILED);
113
+ }
114
+ }
115
+
116
+ @Override
117
+ public void dispose() {
118
+ disposed = true;
119
+ }
120
+
121
+ @Override
122
+ public void cancel() {
123
+ // Non-blocking — nothing to cancel.
124
+ }
125
+
126
+ /**
127
+ * Converts a vtm tile coordinate to a WGS84 bounding box.
128
+ *
129
+ * <p>Uses the standard Web Mercator tile scheme: tileX counts east from
130
+ * the antimeridian (-180°), tileY counts south from the north pole.
131
+ */
132
+ private static BoundingBox tileToBoundingBox(
133
+ int tileX, int tileY, byte zoomLevel) {
134
+ long numTiles = 1L << zoomLevel;
135
+
136
+ double minLon = (tileX / (double) numTiles) * 360.0 - 180.0;
137
+ double maxLon = ((tileX + 1) / (double) numTiles) * 360.0 - 180.0;
138
+
139
+ double n = Math.PI - (2.0 * Math.PI * tileY) / numTiles;
140
+ double maxLat = Math.toDegrees(Math.atan(Math.sinh(n)));
141
+
142
+ n = Math.PI - (2.0 * Math.PI * (tileY + 1)) / numTiles;
143
+ double minLat = Math.toDegrees(Math.atan(Math.sinh(n)));
144
+
145
+ return new BoundingBox(minLat, minLon, maxLat, maxLon);
146
+ }
147
+ }
@@ -0,0 +1,80 @@
1
+ package com.jhotadhari.reactnative.mapsforge.vtm.ext.grib.tiles;
2
+
3
+ import org.oscim.tiling.ITileDataSource;
4
+ import org.oscim.tiling.TileSource;
5
+
6
+ /**
7
+ * A vtm {@link TileSource} that renders weather grid data as colored bitmap tiles.
8
+ *
9
+ * <p>Extends {@link TileSource} directly — no URL, no HTTP. The data lives in
10
+ * memory (parsed from the JSON weather grid provided at creation time). Each
11
+ * tile request triggers an on-the-fly render of the corresponding geographic
12
+ * area using the configured color ramp.
13
+ *
14
+ * <p>Architecture mirrors {@code HillshadingTileSource}: direct extension of
15
+ * {@code TileSource}, with a companion {@code ITileDataSource} that does the
16
+ * per-tile rendering work in {@link ITileDataSource#query}.
17
+ */
18
+ public class WeatherTileSource extends TileSource {
19
+
20
+ private WeatherGridData gridData;
21
+ private final String parameter;
22
+ private int timeIndex;
23
+ private final String colorMap;
24
+
25
+ /**
26
+ * @param zoomMin Minimum zoom level at which tiles are requested.
27
+ * @param zoomMax Maximum zoom level at which tiles are requested.
28
+ * @param gridData The parsed weather grid data (bounds, values, etc.).
29
+ * @param parameter The parameter being displayed (e.g. "WIND", "TEMP").
30
+ * @param timeIndex Which forecast time step to render.
31
+ * @param colorMap Identifier for the color ramp to apply.
32
+ */
33
+ public WeatherTileSource(
34
+ int zoomMin,
35
+ int zoomMax,
36
+ WeatherGridData gridData,
37
+ String parameter,
38
+ int timeIndex,
39
+ String colorMap
40
+ ) {
41
+ super(zoomMin, zoomMax, 256);
42
+ this.gridData = gridData;
43
+ this.parameter = parameter;
44
+ this.timeIndex = timeIndex;
45
+ this.colorMap = colorMap;
46
+ }
47
+
48
+ @Override
49
+ public ITileDataSource getDataSource() {
50
+ return new WeatherTileDataSource(this);
51
+ }
52
+
53
+ @Override
54
+ public OpenResult open() {
55
+ // Data is already in memory — nothing to open.
56
+ return OpenResult.SUCCESS;
57
+ }
58
+
59
+ @Override
60
+ public void close() {
61
+ // Data is in memory — nothing to close.
62
+ }
63
+
64
+ // Package-private accessors for WeatherTileDataSource
65
+ WeatherGridData getGridData() { return gridData; }
66
+ String getParameter() { return parameter; }
67
+ int getTimeIndex() { return timeIndex; }
68
+ String getColorMap() { return colorMap; }
69
+
70
+ /**
71
+ * Updates the grid data in place (e.g. when switching forecast time steps).
72
+ * The next tile query will render with the new data.
73
+ */
74
+ void setGridData(WeatherGridData gridData) { this.gridData = gridData; }
75
+
76
+ /**
77
+ * Updates the time index in place.
78
+ */
79
+ void setTimeIndex(int timeIndex) { this.timeIndex = timeIndex; }
80
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('WeatherOverlay');
9
+ //# sourceMappingURL=NativeWeatherOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["NativeModules/NativeWeatherOverlay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAuEpCC,gCAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _NativeWeatherOverlay = _interopRequireDefault(require("../NativeModules/NativeWeatherOverlay.js"));
9
+ var _reportNativeError = _interopRequireDefault(require("../reportNativeError.js"));
10
+ var _reactNativeMapsforgeVtm = require("react-native-mapsforge-vtm");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * External dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ /**
21
+ * Peer dependencies (from react-native-mapsforge-vtm)
22
+ */
23
+
24
+ const WeatherOverlay = ({
25
+ dataUrl,
26
+ parameter,
27
+ timeIndex,
28
+ colorMap,
29
+ opacity,
30
+ zoomMin,
31
+ zoomMax,
32
+ enabledZoomMin,
33
+ enabledZoomMax,
34
+ onCreate,
35
+ onRemove,
36
+ onChange,
37
+ onError
38
+ }) => {
39
+ const {
40
+ nativeNodeHandle
41
+ } = (0, _react.useContext)(_reactNativeMapsforgeVtm.MapHandleContext);
42
+ const {
43
+ uid: anchorUid,
44
+ element: anchorElement
45
+ } = (0, _reactNativeMapsforgeVtm.useLayerAnchor)({
46
+ kind: 'layer'
47
+ });
48
+ const {
49
+ uuid,
50
+ triggerCreate,
51
+ triggerRemove
52
+ } = (0, _reactNativeMapsforgeVtm.useNativeLayerLifecycle)({
53
+ enabled: !!nativeNodeHandle && !!dataUrl,
54
+ create: ({
55
+ triggerOnCreate,
56
+ triggerOnChange
57
+ }) => {
58
+ if (!nativeNodeHandle) {
59
+ return Promise.reject({
60
+ userInfo: {
61
+ errorMsg: 'Missing nativeNodeHandle'
62
+ }
63
+ });
64
+ }
65
+ return _NativeWeatherOverlay.default.createLayer({
66
+ nativeNodeHandle,
67
+ ...(dataUrl && {
68
+ dataUrl
69
+ }),
70
+ ...(parameter && {
71
+ parameter
72
+ }),
73
+ ...(timeIndex != null && {
74
+ timeIndex: Math.round(timeIndex)
75
+ }),
76
+ ...(colorMap && {
77
+ colorMap
78
+ }),
79
+ ...(opacity != null && {
80
+ opacity
81
+ }),
82
+ ...(zoomMin != null && {
83
+ zoomMin: Math.round(zoomMin)
84
+ }),
85
+ ...(zoomMax != null && {
86
+ zoomMax: Math.round(zoomMax)
87
+ }),
88
+ ...(enabledZoomMin != null && {
89
+ enabledZoomMin: Math.round(enabledZoomMin)
90
+ }),
91
+ ...(enabledZoomMax != null && {
92
+ enabledZoomMax: Math.round(enabledZoomMax)
93
+ })
94
+ }).then(newUuid => {
95
+ triggerOnCreate && onCreate ? onCreate({
96
+ nativeNodeHandle,
97
+ uuid: newUuid
98
+ }) : null;
99
+ triggerOnChange && onChange ? onChange({
100
+ nativeNodeHandle,
101
+ uuid: newUuid
102
+ }) : null;
103
+ return newUuid;
104
+ });
105
+ },
106
+ remove: (currentUuid, {
107
+ triggerOnRemove
108
+ }) => {
109
+ if (!nativeNodeHandle) {
110
+ return Promise.resolve(false);
111
+ }
112
+ return _NativeWeatherOverlay.default.removeLayer({
113
+ nativeNodeHandle,
114
+ uuid: currentUuid
115
+ }).then(removedUuid => {
116
+ triggerOnRemove && onRemove ? onRemove({
117
+ nativeNodeHandle,
118
+ uuid: removedUuid
119
+ }) : null;
120
+ return true;
121
+ }).catch(err => {
122
+ (0, _reportNativeError.default)(err, onError);
123
+ return false;
124
+ });
125
+ },
126
+ onError
127
+ });
128
+ (0, _reactNativeMapsforgeVtm.useSceneUuidBinding)(anchorUid, uuid);
129
+
130
+ // Update enabledZoomMin/enabledZoomMax in place.
131
+ (0, _react.useEffect)(() => {
132
+ if (nativeNodeHandle && uuid) {
133
+ _NativeWeatherOverlay.default.updateEnabledZoomMinMax({
134
+ nativeNodeHandle,
135
+ uuid,
136
+ ...(enabledZoomMin != null && {
137
+ enabledZoomMin: Math.round(enabledZoomMin)
138
+ }),
139
+ ...(enabledZoomMax != null && {
140
+ enabledZoomMax: Math.round(enabledZoomMax)
141
+ })
142
+ }).catch(err => {
143
+ (0, _reportNativeError.default)(err, onError);
144
+ });
145
+ }
146
+ }, [enabledZoomMin, enabledZoomMax, nativeNodeHandle, uuid, onError]);
147
+
148
+ // Update opacity in place.
149
+ (0, _react.useEffect)(() => {
150
+ if (nativeNodeHandle && uuid && opacity != null) {
151
+ _NativeWeatherOverlay.default.setOpacity({
152
+ nativeNodeHandle,
153
+ uuid,
154
+ opacity
155
+ }).catch(err => {
156
+ (0, _reportNativeError.default)(err, onError);
157
+ });
158
+ }
159
+ }, [opacity, nativeNodeHandle, uuid, onError]);
160
+
161
+ // Recreate on these prop changes (baked into native construction).
162
+ // timeIndex is included here because changing it requires a fresh data
163
+ // fetch and tile source — same as dataUrl or parameter changes.
164
+ (0, _react.useEffect)(() => {
165
+ triggerRemove({
166
+ triggerOnRemove: false
167
+ }).then(success => {
168
+ if (success) {
169
+ triggerCreate({
170
+ triggerOnCreate: false,
171
+ triggerOnChange: true
172
+ });
173
+ }
174
+ });
175
+ }, [dataUrl, parameter, timeIndex, colorMap, zoomMin, zoomMax, triggerRemove, triggerCreate]);
176
+ return anchorElement;
177
+ };
178
+ WeatherOverlay.defaults = _NativeWeatherOverlay.default.getConstants();
179
+ var _default = exports.default = WeatherOverlay;
180
+ //# sourceMappingURL=WeatherOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_NativeWeatherOverlay","_interopRequireDefault","_reportNativeError","_reactNativeMapsforgeVtm","e","__esModule","default","WeatherOverlay","dataUrl","parameter","timeIndex","colorMap","opacity","zoomMin","zoomMax","enabledZoomMin","enabledZoomMax","onCreate","onRemove","onChange","onError","nativeNodeHandle","useContext","MapHandleContext","uid","anchorUid","element","anchorElement","useLayerAnchor","kind","uuid","triggerCreate","triggerRemove","useNativeLayerLifecycle","enabled","create","triggerOnCreate","triggerOnChange","Promise","reject","userInfo","errorMsg","WeatherOverlayModule","createLayer","Math","round","then","newUuid","remove","currentUuid","triggerOnRemove","resolve","removeLayer","removedUuid","catch","err","reportNativeError","useSceneUuidBinding","useEffect","updateEnabledZoomMinMax","setOpacity","success","defaults","getConstants","_default","exports"],"sourceRoot":"../../../src","sources":["components/WeatherOverlay.tsx"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,wBAAA,GAAAJ,OAAA;AAKoC,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAtBpC;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAQA,MAAMG,cAAc,GAAGA,CAAC;EACvBC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC,OAAO;EACPC,cAAc;EACdC,cAAc;EACdC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC;AACoB,CAAC,KAAK;EAC1B,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAU,EAACC,yCAAgB,CAAC;EAEzD,MAAM;IAAEC,GAAG,EAAEC,SAAS;IAAEC,OAAO,EAAEC;EAAc,CAAC,GAAG,IAAAC,uCAAc,EAAC;IACjEC,IAAI,EAAE;EACP,CAAC,CAAC;EAEF,MAAM;IAAEC,IAAI;IAAEC,aAAa;IAAEC;EAAc,CAAC,GAAG,IAAAC,gDAAuB,EAAC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: true
5
+ });
6
+ Object.defineProperty(exports, "WeatherOverlay", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _WeatherOverlay.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useWeatherAnimation", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _useWeatherAnimation.useWeatherAnimation;
16
+ }
17
+ });
18
+ var _WeatherOverlay = _interopRequireDefault(require("./components/WeatherOverlay.js"));
19
+ var _useWeatherAnimation = require("./reanimated/useWeatherAnimation.js");
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_WeatherOverlay","_interopRequireDefault","require","_useWeatherAnimation","e","__esModule","default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAOA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAaA,IAAAC,oBAAA,GAAAD,OAAA;AAAuE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useWeatherAnimation", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useWeatherAnimation.useWeatherAnimation;
10
+ }
11
+ });
12
+ var _useWeatherAnimation = require("./useWeatherAnimation.js");
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useWeatherAnimation","require"],"sourceRoot":"../../../src","sources":["reanimated/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.useWeatherAnimation = useWeatherAnimation;
8
+ var _react = require("react");
9
+ var _reactNativeReanimated = require("react-native-reanimated");
10
+ /**
11
+ * Creates a reanimated shared value that drives smooth time-step animation
12
+ * for a weather overlay.
13
+ *
14
+ * The progress value ranges from 0.0 to (numTimeSteps - 1), where the
15
+ * fractional part represents the interpolation between adjacent time steps.
16
+ *
17
+ * Usage with WeatherOverlay:
18
+ * - Pass `Math.floor(progress.value)` as `timeIndex` to the "current" layer
19
+ * - Pass `Math.ceil(progress.value)` as `timeIndex` to the "next" layer
20
+ * - Set the "next" layer's opacity to `progress.value - Math.floor(progress.value)`
21
+ *
22
+ * @param numTimeSteps - Total number of forecast time steps available.
23
+ * @param durationMs - Duration of the full animation in milliseconds.
24
+ * @returns Animation controls including the progress shared value.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * const { progressSv, play, pause } = useWeatherAnimation(
29
+ * weatherData.timeSteps.length,
30
+ * 10000
31
+ * );
32
+ *
33
+ * // In a worklet or useDerivedValue:
34
+ * const currentIdx = Math.floor(progressSv.value);
35
+ * const nextAlpha = progressSv.value - currentIdx;
36
+ * ```
37
+ */
38
+ function useWeatherAnimation(numTimeSteps, durationMs = 10000) {
39
+ const progressSv = (0, _reactNativeReanimated.useSharedValue)(0);
40
+ const isPlayingSv = (0, _reactNativeReanimated.useSharedValue)(false);
41
+ const play = (0, _react.useCallback)(() => {
42
+ 'worklet';
43
+
44
+ if (isPlayingSv.value) return;
45
+ isPlayingSv.value = true;
46
+
47
+ // Calculate remaining duration based on current progress
48
+ const remainingProgress = numTimeSteps - 1 - progressSv.value;
49
+ const remainingDuration = Math.max(100, remainingProgress / (numTimeSteps - 1) * durationMs);
50
+ progressSv.value = (0, _reactNativeReanimated.withTiming)(numTimeSteps - 1, {
51
+ duration: Math.round(remainingDuration)
52
+ }, finished => {
53
+ if (finished) {
54
+ isPlayingSv.value = false;
55
+ }
56
+ });
57
+ }, [numTimeSteps, durationMs, progressSv, isPlayingSv]);
58
+ const pause = (0, _react.useCallback)(() => {
59
+ 'worklet';
60
+
61
+ isPlayingSv.value = false;
62
+ // Cancel the current timing by setting to current value
63
+ progressSv.value = progressSv.value;
64
+ }, [progressSv, isPlayingSv]);
65
+ const reset = (0, _react.useCallback)(() => {
66
+ 'worklet';
67
+
68
+ isPlayingSv.value = false;
69
+ progressSv.value = 0;
70
+ }, [progressSv, isPlayingSv]);
71
+ const seek = (0, _react.useCallback)(timeIndex => {
72
+ 'worklet';
73
+
74
+ const clamped = Math.max(0, Math.min(numTimeSteps - 1, timeIndex));
75
+ progressSv.value = clamped;
76
+ }, [numTimeSteps, progressSv]);
77
+ return (0, _react.useMemo)(() => ({
78
+ progressSv,
79
+ play,
80
+ pause,
81
+ reset,
82
+ seek
83
+ }), [progressSv, play, pause, reset, seek]);
84
+ }
85
+ var _default = exports.default = useWeatherAnimation;
86
+ //# sourceMappingURL=useWeatherAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNativeReanimated","useWeatherAnimation","numTimeSteps","durationMs","progressSv","useSharedValue","isPlayingSv","play","useCallback","value","remainingProgress","remainingDuration","Math","max","withTiming","duration","round","finished","pause","reset","seek","timeIndex","clamped","min","useMemo","_default","exports","default"],"sourceRoot":"../../../src","sources":["reanimated/useWeatherAnimation.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAClCC,YAAoB,EACpBC,UAAkB,GAAG,KAAK,EACC;EAC3B,MAAMC,UAAU,GAAG,IAAAC,qCAAc,EAAS,CAAC,CAAC;EAC5C,MAAMC,WAAW,GAAG,IAAAD,qCAAc,EAAU,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,CAACW,GAAG,CAACrB,YAAY,GAAG,CAAC,EAAEmB,SAAS,CAAC,CAAC;IAClEjB,UAAU,CAACK,KAAK,GAAGa,OAAO;EAC3B,CAAC,EACD,CAACpB,YAAY,EAAEE,UAAU,CAC1B,CAAC;EAED,OAAO,IAAAoB,cAAO,EACb,OAAO;IAAEpB,UAAU;IAAEG,IAAI;IAAEW,KAAK;IAAEC,KAAK;IAAEC;EAAK,CAAC,CAAC,EAChD,CACChB,UAAU,EACVG,IAAI,EACJW,KAAK,EACLC,KAAK,EACLC,IAAI,CAEN,CAAC;AACF;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc1B,mBAAmB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = reportNativeError;
7
+ function reportNativeError(err, onError) {
8
+ if (onError) {
9
+ onError(err);
10
+ } else if (__DEV__) {
11
+ console.warn('[react-native-mapsforge-vtm-ext-grib]', err?.userInfo?.errorMsg ?? 'Unknown native error');
12
+ }
13
+ }
14
+ //# sourceMappingURL=reportNativeError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reportNativeError","err","onError","__DEV__","console","warn","userInfo","errorMsg"],"sourceRoot":"../../src","sources":["reportNativeError.ts"],"mappings":";;;;;;AAEe,SAASA,iBAAiBA,CACxCC,GAAc,EACdC,OAA2C,EACpC;EACP,IAAIA,OAAO,EAAE;IACZA,OAAO,CAACD,GAAG,CAAC;EACb,CAAC,MAAM,IAAIE,OAAO,EAAE;IACnBC,OAAO,CAACC,IAAI,CACX,uCAAuC,EACvCJ,GAAG,EAAEK,QAAQ,EAAEC,QAAQ,IAAI,sBAC5B,CAAC;EACF;AACD","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('WeatherOverlay');
5
+ //# sourceMappingURL=NativeWeatherOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["NativeModules/NativeWeatherOverlay.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAuElD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}