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.
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/android/CMakeLists.txt +13 -0
- package/android/build.gradle +108 -0
- package/android/generated/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/NativeWeatherOverlaySpec.java +95 -0
- package/android/generated/jni/CMakeLists.txt +28 -0
- package/android/generated/jni/RNMapsforgeVtmExtGribSpec-generated.cpp +62 -0
- package/android/generated/jni/RNMapsforgeVtmExtGribSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNMapsforgeVtmExtGribSpec/RNMapsforgeVtmExtGribSpecJSI.h +521 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/ExtGribPackage.java +62 -0
- package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/modules/WeatherOverlay.java +343 -0
- package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/ColorRamp.java +165 -0
- package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/WeatherGridData.java +103 -0
- package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/WeatherTileDataSource.java +147 -0
- package/android/src/main/java/com/jhotadhari/reactnative/mapsforge/vtm/ext/grib/tiles/WeatherTileSource.java +80 -0
- package/lib/commonjs/NativeModules/NativeWeatherOverlay.js +9 -0
- package/lib/commonjs/NativeModules/NativeWeatherOverlay.js.map +1 -0
- package/lib/commonjs/components/WeatherOverlay.js +180 -0
- package/lib/commonjs/components/WeatherOverlay.js.map +1 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/reanimated/index.js +13 -0
- package/lib/commonjs/reanimated/index.js.map +1 -0
- package/lib/commonjs/reanimated/useWeatherAnimation.js +86 -0
- package/lib/commonjs/reanimated/useWeatherAnimation.js.map +1 -0
- package/lib/commonjs/reportNativeError.js +14 -0
- package/lib/commonjs/reportNativeError.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/NativeModules/NativeWeatherOverlay.js +5 -0
- package/lib/module/NativeModules/NativeWeatherOverlay.js.map +1 -0
- package/lib/module/components/WeatherOverlay.js +174 -0
- package/lib/module/components/WeatherOverlay.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/reanimated/index.js +4 -0
- package/lib/module/reanimated/index.js.map +1 -0
- package/lib/module/reanimated/useWeatherAnimation.js +81 -0
- package/lib/module/reanimated/useWeatherAnimation.js.map +1 -0
- package/lib/module/reportNativeError.js +10 -0
- package/lib/module/reportNativeError.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeModules/NativeWeatherOverlay.d.ts +63 -0
- package/lib/typescript/commonjs/src/NativeModules/NativeWeatherOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/WeatherOverlay.d.ts +10 -0
- package/lib/typescript/commonjs/src/components/WeatherOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +11 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/reanimated/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/reanimated/useWeatherAnimation.d.ts +44 -0
- package/lib/typescript/commonjs/src/reanimated/useWeatherAnimation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/reportNativeError.d.ts +3 -0
- package/lib/typescript/commonjs/src/reportNativeError.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +51 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeModules/NativeWeatherOverlay.d.ts +63 -0
- package/lib/typescript/module/src/NativeModules/NativeWeatherOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/components/WeatherOverlay.d.ts +10 -0
- package/lib/typescript/module/src/components/WeatherOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +11 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/reanimated/index.d.ts +3 -0
- package/lib/typescript/module/src/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/module/src/reanimated/useWeatherAnimation.d.ts +44 -0
- package/lib/typescript/module/src/reanimated/useWeatherAnimation.d.ts.map +1 -0
- package/lib/typescript/module/src/reportNativeError.d.ts +3 -0
- package/lib/typescript/module/src/reportNativeError.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +51 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/package.json +159 -0
- package/react-native.config.js +13 -0
- package/src/NativeModules/NativeWeatherOverlay.ts +73 -0
- package/src/components/WeatherOverlay.tsx +173 -0
- package/src/index.ts +22 -0
- package/src/reanimated/index.ts +2 -0
- package/src/reanimated/useWeatherAnimation.ts +118 -0
- package/src/reportNativeError.ts +15 -0
- package/src/types.ts +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jhotadhari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# react-native-mapsforge-vtm-ext-grib
|
|
2
|
+
|
|
3
|
+
Weather GRIB overlay extension for [`react-native-mapsforge-vtm`](https://github.com/jhotadhari/react-native-mapsforge-vtm).
|
|
4
|
+
Renders gridded weather data (wind, temperature, pressure, precipitation, waves) as colored overlays on offline vector maps.
|
|
5
|
+
|
|
6
|
+
**Android only** — matches the platform scope of the parent library.
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { MapContainer, LayerMapsforge } from 'react-native-mapsforge-vtm';
|
|
12
|
+
import { WeatherOverlay } from 'react-native-mapsforge-vtm-ext-grib';
|
|
13
|
+
|
|
14
|
+
<MapContainer>
|
|
15
|
+
<LayerMapsforge mapFile="/sdcard/maps/germany.map" />
|
|
16
|
+
<WeatherOverlay
|
|
17
|
+
dataUrl="https://weather.example.com/forecast.json"
|
|
18
|
+
parameter="WIND"
|
|
19
|
+
timeIndex={0}
|
|
20
|
+
colorMap="wind"
|
|
21
|
+
opacity={0.7}
|
|
22
|
+
/>
|
|
23
|
+
</MapContainer>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Features (Phase 1 — Static Overlay)
|
|
27
|
+
|
|
28
|
+
- Colored grid overlay from pre-processed JSON weather data
|
|
29
|
+
- 6 built-in color ramps: `temperature`, `wind`, `pressure`, `rainfall`, `waves`, `grayscale`
|
|
30
|
+
- Per-pixel bilinear interpolation from the source grid
|
|
31
|
+
- Zoom-level bounds (`zoomMin`/`zoomMax`, `enabledZoomMin`/`enabledZoomMax`)
|
|
32
|
+
- Layer opacity control
|
|
33
|
+
- Time step selection
|
|
34
|
+
|
|
35
|
+
## JSON Data Format
|
|
36
|
+
|
|
37
|
+
The `dataUrl` should point to a JSON file with this structure:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"parameter": "WIND",
|
|
42
|
+
"unit": "m/s",
|
|
43
|
+
"timeSteps": [
|
|
44
|
+
{
|
|
45
|
+
"validTime": "2026-07-03T00:00:00Z",
|
|
46
|
+
"minLat": 47.0,
|
|
47
|
+
"maxLat": 55.0,
|
|
48
|
+
"minLng": 5.0,
|
|
49
|
+
"maxLng": 16.0,
|
|
50
|
+
"ni": 44,
|
|
51
|
+
"nj": 32,
|
|
52
|
+
"values": [0.5, 1.2, null, 3.1, ...]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- `values` is a row-major array of length `ni * nj`. `null` entries represent missing data (rendered as transparent).
|
|
59
|
+
- `ni`: number of grid points in the longitude direction.
|
|
60
|
+
- `nj`: number of grid points in the latitude direction.
|
|
61
|
+
|
|
62
|
+
Use [`@weacast/grib2json`](https://www.npmjs.com/package/@weacast/grib2json) for server-side GRIB→JSON conversion. On-device GRIB parsing (via JGribX) is planned for Phase 5.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
yarn add react-native-mapsforge-vtm-ext-grib
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This library has a **peer dependency** on `react-native-mapsforge-vtm` and `react-native-reanimated`.
|
|
71
|
+
|
|
72
|
+
## Example app
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
# Clone and install:
|
|
76
|
+
git clone https://github.com/jhotadhari/react-native-mapsforge-vtm-ext-grib
|
|
77
|
+
cd react-native-mapsforge-vtm-ext-grib
|
|
78
|
+
yarn install
|
|
79
|
+
|
|
80
|
+
# Development (with yalc-linked react-native-mapsforge-vtm):
|
|
81
|
+
cd example && yalc link react-native-mapsforge-vtm && cd ..
|
|
82
|
+
yarn example android
|
|
83
|
+
|
|
84
|
+
# Serve sample weather data for the example:
|
|
85
|
+
cd example/data && python3 -m http.server 8000
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Documentation
|
|
89
|
+
|
|
90
|
+
- [Extending react-native-mapsforge-vtm](https://github.com/jhotadhari/react-native-mapsforge-vtm/blob/main/docs/advanced/extending.md) — extension architecture guide
|
|
91
|
+
- [ext-plan skill](https://github.com/jhotadhari/react-native-mapsforge-vtm/blob/main/.claude/skills/ext-plan.md) — interactive scaffolding command
|
|
92
|
+
|
|
93
|
+
## Architecture
|
|
94
|
+
|
|
95
|
+
`WeatherOverlay` creates a custom vtm `TileSource` (`WeatherTileSource`) that renders weather grid data into bitmap tiles on demand. The tile source is backed by a `BitmapTileLayer` — the same layer type used for OSM raster tiles and hillshading in the parent library.
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
WeatherGridData (in-memory)
|
|
99
|
+
→ WeatherTileSource (extends TileSource)
|
|
100
|
+
→ WeatherTileDataSource (implements ITileDataSource)
|
|
101
|
+
→ query() → bitmap → setTileImage()
|
|
102
|
+
→ BitmapTileLayer
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Roadmap
|
|
106
|
+
|
|
107
|
+
| Phase | Feature | Status |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| 1 | Static colored overlay (tile-based) | ✅ Current |
|
|
110
|
+
| 2 | Smooth time animation (dual-layer crossfade) | Planned |
|
|
111
|
+
| 3 | Custom vtm Layer (GPU interpolation + particles) | Planned |
|
|
112
|
+
| 4 | Wind barbs, isobars, cursor readout | Planned |
|
|
113
|
+
| 5 | On-device GRIB parsing (JGribX + jj2000) | Planned |
|
|
114
|
+
| 6 | Polish, performance, reanimated bearing/tilt | Planned |
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Wrapper CMakeLists.txt for react-native-mapsforge-vtm-ext-grib.
|
|
2
|
+
#
|
|
3
|
+
# Discovered by React Native autolinking at the android/ module root.
|
|
4
|
+
# Pulls in the codegen-generated TurboModule JNI from generated/jni/.
|
|
5
|
+
#
|
|
6
|
+
# Structure mirrors the parent library (react-native-mapsforge-vtm):
|
|
7
|
+
# the wrapper is discovered by autolinking and delegates to the
|
|
8
|
+
# generated JNI subdirectory.
|
|
9
|
+
cmake_minimum_required(VERSION 3.16)
|
|
10
|
+
|
|
11
|
+
# Codegen-generated TurboModule JNI.
|
|
12
|
+
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/generated/jni/"
|
|
13
|
+
extgrib_codegen_build)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['MapsforgeVtmExtGrib_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.12.0"
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
apply plugin: "com.android.library"
|
|
18
|
+
apply plugin: "kotlin-android"
|
|
19
|
+
apply plugin: "com.facebook.react"
|
|
20
|
+
|
|
21
|
+
def getExtOrIntegerDefault(name) {
|
|
22
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["MapsforgeVtmExtGrib_" + name]).toInteger()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
def supportsNamespace() {
|
|
26
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
27
|
+
def major = parsed[0].toInteger()
|
|
28
|
+
def minor = parsed[1].toInteger()
|
|
29
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
android {
|
|
33
|
+
if (supportsNamespace()) {
|
|
34
|
+
namespace "com.jhotadhari.reactnative.mapsforge.vtm.ext.grib"
|
|
35
|
+
|
|
36
|
+
sourceSets {
|
|
37
|
+
main {
|
|
38
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
44
|
+
|
|
45
|
+
defaultConfig {
|
|
46
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
47
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
buildFeatures {
|
|
51
|
+
buildConfig true
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
buildTypes {
|
|
55
|
+
release {
|
|
56
|
+
minifyEnabled false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
lintOptions {
|
|
61
|
+
disable "GradleCompatible"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
compileOptions {
|
|
65
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
66
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
sourceSets {
|
|
70
|
+
main {
|
|
71
|
+
java.srcDirs += [
|
|
72
|
+
"generated/java",
|
|
73
|
+
"generated/jni"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
repositories {
|
|
80
|
+
mavenCentral()
|
|
81
|
+
google()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
85
|
+
|
|
86
|
+
dependencies {
|
|
87
|
+
implementation "com.facebook.react:react-android"
|
|
88
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
89
|
+
|
|
90
|
+
// Parent library — provides Utils, LayerHelper, LayerZoomBoundsHelper,
|
|
91
|
+
// and the extension-point hooks (MapHandleContext, useLayerOrder,
|
|
92
|
+
// useNativeLayerLifecycle).
|
|
93
|
+
compileOnly project(':react-native-mapsforge-vtm')
|
|
94
|
+
|
|
95
|
+
// vtm — same version as the main library
|
|
96
|
+
implementation 'com.github.mapsforge.vtm:vtm:0.29.0'
|
|
97
|
+
implementation 'com.github.mapsforge.vtm:vtm-android:0.29.0'
|
|
98
|
+
runtimeOnly 'com.github.mapsforge.vtm:vtm-android:0.29.0:natives-armeabi-v7a'
|
|
99
|
+
runtimeOnly 'com.github.mapsforge.vtm:vtm-android:0.29.0:natives-arm64-v8a'
|
|
100
|
+
runtimeOnly 'com.github.mapsforge.vtm:vtm-android:0.29.0:natives-x86'
|
|
101
|
+
runtimeOnly 'com.github.mapsforge.vtm:vtm-android:0.29.0:natives-x86_64'
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
react {
|
|
105
|
+
jsRootDir = file("../src/")
|
|
106
|
+
libraryName = "MapsforgeVtmExtGrib"
|
|
107
|
+
codegenJavaPackageName = "com.jhotadhari.reactnative.mapsforge.vtm.ext.grib"
|
|
108
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.jhotadhari.reactnative.mapsforge.vtm.ext.grib;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
21
|
+
import com.facebook.react.common.build.ReactBuildConfig;
|
|
22
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
23
|
+
import java.util.Arrays;
|
|
24
|
+
import java.util.HashSet;
|
|
25
|
+
import java.util.Map;
|
|
26
|
+
import java.util.Set;
|
|
27
|
+
import javax.annotation.Nonnull;
|
|
28
|
+
import javax.annotation.Nullable;
|
|
29
|
+
|
|
30
|
+
public abstract class NativeWeatherOverlaySpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
31
|
+
public static final String NAME = "WeatherOverlay";
|
|
32
|
+
|
|
33
|
+
public NativeWeatherOverlaySpec(ReactApplicationContext reactContext) {
|
|
34
|
+
super(reactContext);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public @Nonnull String getName() {
|
|
39
|
+
return NAME;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected abstract Map<String, Object> getTypedExportedConstants();
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
public final @Nullable Map<String, Object> getConstants() {
|
|
47
|
+
Map<String, Object> constants = getTypedExportedConstants();
|
|
48
|
+
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
|
|
49
|
+
Set<String> obligatoryFlowConstants = new HashSet<>();
|
|
50
|
+
Set<String> optionalFlowConstants = new HashSet<>(Arrays.asList(
|
|
51
|
+
"colorMap",
|
|
52
|
+
"dataUrl",
|
|
53
|
+
"enabledZoomMax",
|
|
54
|
+
"enabledZoomMin",
|
|
55
|
+
"opacity",
|
|
56
|
+
"parameter",
|
|
57
|
+
"timeIndex",
|
|
58
|
+
"zoomMax",
|
|
59
|
+
"zoomMin"
|
|
60
|
+
));
|
|
61
|
+
Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
|
|
62
|
+
undeclaredConstants.removeAll(obligatoryFlowConstants);
|
|
63
|
+
undeclaredConstants.removeAll(optionalFlowConstants);
|
|
64
|
+
if (!undeclaredConstants.isEmpty()) {
|
|
65
|
+
throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
|
|
66
|
+
}
|
|
67
|
+
undeclaredConstants = obligatoryFlowConstants;
|
|
68
|
+
undeclaredConstants.removeAll(constants.keySet());
|
|
69
|
+
if (!undeclaredConstants.isEmpty()) {
|
|
70
|
+
throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return constants;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@ReactMethod
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
public abstract void createLayer(ReadableMap params, Promise promise);
|
|
79
|
+
|
|
80
|
+
@ReactMethod
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
public abstract void removeLayer(ReadableMap params, Promise promise);
|
|
83
|
+
|
|
84
|
+
@ReactMethod
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
public abstract void updateEnabledZoomMinMax(ReadableMap params, Promise promise);
|
|
87
|
+
|
|
88
|
+
@ReactMethod
|
|
89
|
+
@DoNotStrip
|
|
90
|
+
public abstract void setOpacity(ReadableMap params, Promise promise);
|
|
91
|
+
|
|
92
|
+
@ReactMethod
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
public abstract void setTimeIndex(ReadableMap params, Promise promise);
|
|
95
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNMapsforgeVtmExtGribSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNMapsforgeVtmExtGribSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNMapsforgeVtmExtGribSpec PUBLIC . react/renderer/components/RNMapsforgeVtmExtGribSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNMapsforgeVtmExtGribSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_reactnative_options(react_codegen_RNMapsforgeVtmExtGribSpec PRIVATE)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNMapsforgeVtmExtGribSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeWeatherOverlaySpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ObjectKind, "getConstants", "()Ljava/util/Map;", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeWeatherOverlaySpecJSI_createLayer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
+
static jmethodID cachedMethodId = nullptr;
|
|
22
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "createLayer", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static facebook::jsi::Value __hostFunction_NativeWeatherOverlaySpecJSI_removeLayer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
+
static jmethodID cachedMethodId = nullptr;
|
|
27
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "removeLayer", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static facebook::jsi::Value __hostFunction_NativeWeatherOverlaySpecJSI_updateEnabledZoomMinMax(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
31
|
+
static jmethodID cachedMethodId = nullptr;
|
|
32
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "updateEnabledZoomMinMax", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static facebook::jsi::Value __hostFunction_NativeWeatherOverlaySpecJSI_setOpacity(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
36
|
+
static jmethodID cachedMethodId = nullptr;
|
|
37
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setOpacity", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static facebook::jsi::Value __hostFunction_NativeWeatherOverlaySpecJSI_setTimeIndex(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
41
|
+
static jmethodID cachedMethodId = nullptr;
|
|
42
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setTimeIndex", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
NativeWeatherOverlaySpecJSI::NativeWeatherOverlaySpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
46
|
+
: JavaTurboModule(params) {
|
|
47
|
+
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeWeatherOverlaySpecJSI_getConstants};
|
|
48
|
+
methodMap_["createLayer"] = MethodMetadata {1, __hostFunction_NativeWeatherOverlaySpecJSI_createLayer};
|
|
49
|
+
methodMap_["removeLayer"] = MethodMetadata {1, __hostFunction_NativeWeatherOverlaySpecJSI_removeLayer};
|
|
50
|
+
methodMap_["updateEnabledZoomMinMax"] = MethodMetadata {1, __hostFunction_NativeWeatherOverlaySpecJSI_updateEnabledZoomMinMax};
|
|
51
|
+
methodMap_["setOpacity"] = MethodMetadata {1, __hostFunction_NativeWeatherOverlaySpecJSI_setOpacity};
|
|
52
|
+
methodMap_["setTimeIndex"] = MethodMetadata {1, __hostFunction_NativeWeatherOverlaySpecJSI_setTimeIndex};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
std::shared_ptr<TurboModule> RNMapsforgeVtmExtGribSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
56
|
+
if (moduleName == "WeatherOverlay") {
|
|
57
|
+
return std::make_shared<NativeWeatherOverlaySpecJSI>(params);
|
|
58
|
+
}
|
|
59
|
+
return nullptr;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeWeatherOverlay'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeWeatherOverlaySpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeWeatherOverlaySpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNMapsforgeVtmExtGribSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|