@maplibre/maplibre-react-native 10.0.0-beta.8 → 10.0.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/README.md +10 -54
- package/android/build.gradle +35 -12
- package/android/gradle.properties +14 -6
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +37 -48
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +16 -9
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +11 -13
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +4 -11
- package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyle.java +1 -4
- package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyleFactory.java +10 -11
- package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +7 -11
- package/android/src/main/java/org/maplibre/reactnative/location/engine/DefaultLocationEngineProvider.java +18 -0
- package/android/src/main/java/org/maplibre/reactnative/location/engine/LocationEngineProvidable.java +9 -0
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +27 -148
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.java +1 -3
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +123 -18
- package/android/src/main/location-engine-default/org/maplibre/reactnative/location/engine/LocationEngineProvider.java +12 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineImpl.java +151 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineProvider.java +24 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/LocationEngineProvider.java +12 -0
- package/app.plugin.js +1 -1
- package/ios/MLRN/MLRNCamera.m +6 -7
- package/ios/MLRN/MLRNMapView.h +1 -1
- package/ios/MLRN/MLRNMapView.m +7 -7
- package/ios/MLRN/MLRNMapViewManager.m +1 -1
- package/ios/MLRN/MLRNModule.m +8 -139
- package/ios/MLRN/MLRNStyle.m +0 -40
- package/lib/commonjs/MLRNModule.js +3 -5
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/MapLibreRN.js +77 -59
- package/lib/commonjs/MapLibreRN.js.map +1 -1
- package/lib/commonjs/components/Annotation.js +7 -9
- package/lib/commonjs/components/Annotation.js.map +1 -1
- package/lib/commonjs/components/BackgroundLayer.js +6 -8
- package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
- package/lib/commonjs/components/Callout.js +2 -2
- package/lib/commonjs/components/Callout.js.map +1 -1
- package/lib/commonjs/components/Camera.js +111 -63
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/CircleLayer.js +6 -8
- package/lib/commonjs/components/CircleLayer.js.map +1 -1
- package/lib/commonjs/components/FillExtrusionLayer.js +6 -8
- package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
- package/lib/commonjs/components/FillLayer.js +6 -8
- package/lib/commonjs/components/FillLayer.js.map +1 -1
- package/lib/commonjs/components/HeadingIndicator.js +4 -4
- package/lib/commonjs/components/HeadingIndicator.js.map +1 -1
- package/lib/commonjs/components/HeatmapLayer.js +6 -8
- package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
- package/lib/commonjs/components/ImageSource.js +4 -5
- package/lib/commonjs/components/ImageSource.js.map +1 -1
- package/lib/commonjs/components/Images.js +2 -2
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/Light.js +4 -6
- package/lib/commonjs/components/Light.js.map +1 -1
- package/lib/commonjs/components/LineLayer.js +6 -8
- package/lib/commonjs/components/LineLayer.js.map +1 -1
- package/lib/commonjs/components/MapView.js +69 -76
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/MarkerView.js +4 -5
- package/lib/commonjs/components/MarkerView.js.map +1 -1
- package/lib/commonjs/components/NativeUserLocation.js +2 -2
- package/lib/commonjs/components/NativeUserLocation.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js +7 -10
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/RasterLayer.js +6 -8
- package/lib/commonjs/components/RasterLayer.js.map +1 -1
- package/lib/commonjs/components/RasterSource.js +8 -10
- package/lib/commonjs/components/RasterSource.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +6 -8
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/SymbolLayer.js +6 -7
- package/lib/commonjs/components/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js +21 -23
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +8 -10
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/hooks/useAbstractLayer.js +1 -1
- package/lib/commonjs/hooks/useAbstractLayer.js.map +1 -1
- package/lib/commonjs/hooks/useAbstractSource.js +1 -1
- package/lib/commonjs/hooks/useAbstractSource.js.map +1 -1
- package/lib/commonjs/hooks/useNativeBridge.js +2 -2
- package/lib/commonjs/hooks/useNativeBridge.js.map +1 -1
- package/lib/commonjs/hooks/useOnce.js +2 -2
- package/lib/commonjs/hooks/useOnce.js.map +1 -1
- package/lib/commonjs/index.js +3 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/location/{locationManager.js → LocationManager.js} +10 -10
- package/lib/commonjs/modules/location/LocationManager.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -2
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/commonjs/modules/offline/{offlineManager.js → OfflineManager.js} +34 -36
- package/lib/commonjs/modules/offline/OfflineManager.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflinePack.js +2 -2
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
- package/lib/commonjs/modules/snapshot/{snapshotManager.js → SnapshotManager.js} +12 -14
- package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -0
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js +3 -4
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/commonjs/plugin/MapLibrePluginProps.js +2 -0
- package/lib/commonjs/plugin/MapLibrePluginProps.js.map +1 -0
- package/lib/commonjs/plugin/android.js +41 -0
- package/lib/commonjs/plugin/android.js.map +1 -0
- package/lib/commonjs/plugin/ios.js +131 -0
- package/lib/commonjs/plugin/ios.js.map +1 -0
- package/lib/commonjs/plugin/withMapLibre.js +31 -0
- package/lib/commonjs/plugin/withMapLibre.js.map +1 -0
- package/lib/commonjs/types/MapLibreRNStyles.js +6 -0
- package/lib/commonjs/types/MapLibreRNStyles.js.map +1 -0
- package/lib/commonjs/utils/BridgeValue.js +2 -2
- package/lib/commonjs/utils/BridgeValue.js.map +1 -1
- package/lib/commonjs/utils/Logger.js +2 -2
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/StyleValue.js +4 -5
- package/lib/commonjs/utils/StyleValue.js.map +1 -1
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js +2 -2
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/commonjs/utils/animated/Animated.js +29 -31
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedCoordinatesArray.js +4 -5
- package/lib/commonjs/utils/animated/AnimatedCoordinatesArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js +2 -2
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedPoint.js +1 -2
- package/lib/commonjs/utils/animated/AnimatedPoint.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +4 -4
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedShape.js +2 -2
- package/lib/commonjs/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/commonjs/utils/getStylePropertyType.js +252 -0
- package/lib/commonjs/utils/getStylePropertyType.js.map +1 -0
- package/lib/module/MLRNModule.js +1 -2
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/MapLibreRN.js +40 -28
- package/lib/module/MapLibreRN.js.map +1 -1
- package/lib/module/components/Annotation.js +5 -6
- package/lib/module/components/Annotation.js.map +1 -1
- package/lib/module/components/BackgroundLayer.js +4 -6
- package/lib/module/components/BackgroundLayer.js.map +1 -1
- package/lib/module/components/Callout.js +2 -3
- package/lib/module/components/Callout.js.map +1 -1
- package/lib/module/components/Camera.js +112 -64
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/CircleLayer.js +4 -6
- package/lib/module/components/CircleLayer.js.map +1 -1
- package/lib/module/components/FillExtrusionLayer.js +4 -6
- package/lib/module/components/FillExtrusionLayer.js.map +1 -1
- package/lib/module/components/FillLayer.js +4 -6
- package/lib/module/components/FillLayer.js.map +1 -1
- package/lib/module/components/HeadingIndicator.js +2 -3
- package/lib/module/components/HeadingIndicator.js.map +1 -1
- package/lib/module/components/HeatmapLayer.js +4 -6
- package/lib/module/components/HeatmapLayer.js.map +1 -1
- package/lib/module/components/ImageSource.js +2 -3
- package/lib/module/components/ImageSource.js.map +1 -1
- package/lib/module/components/Images.js +2 -3
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/Light.js +2 -4
- package/lib/module/components/Light.js.map +1 -1
- package/lib/module/components/LineLayer.js +4 -6
- package/lib/module/components/LineLayer.js.map +1 -1
- package/lib/module/components/MapView.js +65 -72
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/MarkerView.js +2 -3
- package/lib/module/components/MarkerView.js.map +1 -1
- package/lib/module/components/NativeUserLocation.js +1 -2
- package/lib/module/components/NativeUserLocation.js.map +1 -1
- package/lib/module/components/PointAnnotation.js +5 -7
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterLayer.js +4 -6
- package/lib/module/components/RasterLayer.js.map +1 -1
- package/lib/module/components/RasterSource.js +5 -7
- package/lib/module/components/RasterSource.js.map +1 -1
- package/lib/module/components/ShapeSource.js +4 -5
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/SymbolLayer.js +4 -5
- package/lib/module/components/SymbolLayer.js.map +1 -1
- package/lib/module/components/UserLocation.js +14 -15
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/VectorSource.js +5 -6
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/hooks/useAbstractLayer.js +1 -1
- package/lib/module/hooks/useAbstractLayer.js.map +1 -1
- package/lib/module/hooks/useAbstractSource.js +1 -1
- package/lib/module/hooks/useAbstractSource.js.map +1 -1
- package/lib/module/hooks/useNativeBridge.js +1 -2
- package/lib/module/hooks/useNativeBridge.js.map +1 -1
- package/lib/module/hooks/useNativeRef.js.map +1 -1
- package/lib/module/hooks/useOnce.js +1 -2
- package/lib/module/hooks/useOnce.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/location/{locationManager.js → LocationManager.js} +10 -9
- package/lib/module/modules/location/LocationManager.js.map +1 -0
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +1 -2
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/module/modules/offline/{offlineManager.js → OfflineManager.js} +30 -30
- package/lib/module/modules/offline/OfflineManager.js.map +1 -0
- package/lib/module/modules/offline/OfflinePack.js +1 -2
- package/lib/module/modules/offline/OfflinePack.js.map +1 -1
- package/lib/module/modules/snapshot/{snapshotManager.js → SnapshotManager.js} +10 -10
- package/lib/module/modules/snapshot/{snapshotManager.js.map → SnapshotManager.js.map} +1 -1
- package/lib/module/modules/snapshot/SnapshotOptions.js +2 -3
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/module/plugin/MapLibrePluginProps.js +2 -0
- package/lib/module/plugin/MapLibrePluginProps.js.map +1 -0
- package/lib/module/plugin/android.js +34 -0
- package/lib/module/plugin/android.js.map +1 -0
- package/lib/module/plugin/ios.js +123 -0
- package/lib/module/plugin/ios.js.map +1 -0
- package/lib/module/plugin/withMapLibre.js +27 -0
- package/lib/module/plugin/withMapLibre.js.map +1 -0
- package/lib/module/types/MapLibreRNStyles.js +4 -0
- package/lib/module/types/MapLibreRNStyles.js.map +1 -0
- package/lib/module/utils/BridgeValue.js +1 -1
- package/lib/module/utils/BridgeValue.js.map +1 -1
- package/lib/module/utils/Logger.js +1 -2
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/StyleValue.js +3 -3
- package/lib/module/utils/StyleValue.js.map +1 -1
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js +1 -2
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/module/utils/animated/Animated.js +14 -15
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/module/utils/animated/AnimatedCoordinatesArray.js +2 -3
- package/lib/module/utils/animated/AnimatedCoordinatesArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -1
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedPoint.js +0 -1
- package/lib/module/utils/animated/AnimatedPoint.js.map +1 -1
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +2 -2
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedShape.js +1 -2
- package/lib/module/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/module/utils/getStylePropertyType.js +248 -0
- package/lib/module/utils/getStylePropertyType.js.map +1 -0
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +2 -6
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +43 -30
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Annotation.d.ts +6 -6
- package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Callout.d.ts +3 -4
- package/lib/typescript/commonjs/src/components/Callout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +4 -4
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +2 -3
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ImageSource.d.ts +3 -4
- package/lib/typescript/commonjs/src/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts +5 -5
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Light.d.ts +4 -5
- package/lib/typescript/commonjs/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +12 -15
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts +3 -3
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NativeUserLocation.d.ts +2 -3
- package/lib/typescript/commonjs/src/components/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/PointAnnotation.d.ts +7 -8
- package/lib/typescript/commonjs/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterSource.d.ts +4 -4
- package/lib/typescript/commonjs/src/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +8 -15
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts +3 -4
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts +6 -6
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts +4 -8
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts +5 -4
- package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useAbstractSource.d.ts +4 -3
- package/lib/typescript/commonjs/src/hooks/useAbstractSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNativeBridge.d.ts +5 -5
- package/lib/typescript/commonjs/src/hooks/useNativeBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useOnce.d.ts +1 -2
- package/lib/typescript/commonjs/src/hooks/useOnce.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts +33 -0
- package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/offline/OfflineCreatePackOptions.d.ts +1 -2
- package/lib/typescript/commonjs/src/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/offline/{offlineManager.d.ts → OfflineManager.d.ts} +25 -25
- package/lib/typescript/commonjs/src/modules/offline/OfflineManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts +2 -3
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/{module/src/modules/snapshot/snapshotManager.d.ts → commonjs/src/modules/snapshot/SnapshotManager.d.ts} +9 -9
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/plugin/MapLibrePluginProps.d.ts +77 -0
- package/lib/typescript/commonjs/src/plugin/MapLibrePluginProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/android.d.ts +16 -0
- package/lib/typescript/commonjs/src/plugin/android.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/ios.d.ts +17 -0
- package/lib/typescript/commonjs/src/plugin/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts +5 -0
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts +960 -0
- package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/BridgeValue.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/BridgeValue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/Logger.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/Logger.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/StyleValue.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/StyleValue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +19 -19
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedCoordinatesArray.d.ts +3 -3
- package/lib/typescript/commonjs/src/utils/animated/AnimatedCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +5 -5
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/filterUtils.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/filterUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts +35 -0
- package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts.map +1 -0
- package/lib/typescript/module/src/MLRNModule.d.ts +2 -6
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +43 -30
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Annotation.d.ts +6 -6
- package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Callout.d.ts +3 -4
- package/lib/typescript/module/src/components/Callout.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Camera.d.ts +4 -4
- package/lib/typescript/module/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/module/src/components/CircleLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts +2 -3
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ImageSource.d.ts +3 -4
- package/lib/typescript/module/src/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Images.d.ts +5 -5
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Light.d.ts +4 -5
- package/lib/typescript/module/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/module/src/components/LineLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MapView.d.ts +12 -15
- package/lib/typescript/module/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MarkerView.d.ts +3 -3
- package/lib/typescript/module/src/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NativeUserLocation.d.ts +2 -3
- package/lib/typescript/module/src/components/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/PointAnnotation.d.ts +7 -8
- package/lib/typescript/module/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterSource.d.ts +4 -4
- package/lib/typescript/module/src/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +8 -15
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SymbolLayer.d.ts +3 -4
- package/lib/typescript/module/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts +6 -6
- package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts +4 -8
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts +5 -4
- package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useAbstractSource.d.ts +4 -3
- package/lib/typescript/module/src/hooks/useAbstractSource.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNativeBridge.d.ts +5 -5
- package/lib/typescript/module/src/hooks/useNativeBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useOnce.d.ts +1 -2
- package/lib/typescript/module/src/hooks/useOnce.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +3 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/location/LocationManager.d.ts +33 -0
- package/lib/typescript/module/src/modules/location/LocationManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/offline/OfflineCreatePackOptions.d.ts +1 -2
- package/lib/typescript/module/src/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/offline/{offlineManager.d.ts → OfflineManager.d.ts} +25 -25
- package/lib/typescript/module/src/modules/offline/OfflineManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts +2 -3
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/modules/snapshot/snapshotManager.d.ts → module/src/modules/snapshot/SnapshotManager.d.ts} +9 -9
- package/lib/typescript/module/src/modules/snapshot/SnapshotManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts +1 -1
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/module/src/plugin/MapLibrePluginProps.d.ts +77 -0
- package/lib/typescript/module/src/plugin/MapLibrePluginProps.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/android.d.ts +16 -0
- package/lib/typescript/module/src/plugin/android.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/ios.d.ts +17 -0
- package/lib/typescript/module/src/plugin/ios.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts +5 -0
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts.map +1 -0
- package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts +960 -0
- package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/BridgeValue.d.ts +1 -1
- package/lib/typescript/module/src/utils/BridgeValue.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/Logger.d.ts +2 -2
- package/lib/typescript/module/src/utils/Logger.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/StyleValue.d.ts +2 -2
- package/lib/typescript/module/src/utils/StyleValue.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +2 -2
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +19 -19
- package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedCoordinatesArray.d.ts +3 -3
- package/lib/typescript/module/src/utils/animated/AnimatedCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +2 -2
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +5 -5
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/filterUtils.d.ts +1 -1
- package/lib/typescript/module/src/utils/filterUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/getStylePropertyType.d.ts +35 -0
- package/lib/typescript/module/src/utils/getStylePropertyType.d.ts.map +1 -0
- package/maplibre-react-native.podspec +15 -14
- package/package.json +17 -14
- package/src/MLRNModule.ts +15 -10
- package/src/MapLibreRN.ts +59 -41
- package/src/components/Annotation.tsx +12 -14
- package/src/components/BackgroundLayer.tsx +7 -9
- package/src/components/Callout.tsx +8 -10
- package/src/components/Camera.tsx +154 -78
- package/src/components/CircleLayer.tsx +7 -9
- package/src/components/FillExtrusionLayer.tsx +7 -9
- package/src/components/FillLayer.tsx +7 -9
- package/src/components/HeadingIndicator.tsx +2 -6
- package/src/components/HeatmapLayer.tsx +7 -9
- package/src/components/ImageSource.tsx +4 -6
- package/src/components/Images.tsx +7 -9
- package/src/components/Light.tsx +5 -7
- package/src/components/LineLayer.tsx +7 -9
- package/src/components/MapView.tsx +85 -94
- package/src/components/MarkerView.tsx +4 -6
- package/src/components/NativeUserLocation.tsx +1 -4
- package/src/components/PointAnnotation.tsx +10 -11
- package/src/components/RasterLayer.tsx +7 -9
- package/src/components/RasterSource.tsx +7 -9
- package/src/components/ShapeSource.tsx +17 -22
- package/src/components/SymbolLayer.tsx +7 -8
- package/src/components/UserLocation.tsx +21 -22
- package/src/components/VectorSource.tsx +8 -15
- package/src/hooks/useAbstractLayer.ts +8 -8
- package/src/hooks/useAbstractSource.ts +6 -6
- package/src/hooks/useNativeBridge.ts +9 -6
- package/src/hooks/useNativeRef.ts +2 -2
- package/src/hooks/useOnce.ts +3 -3
- package/src/index.ts +3 -0
- package/src/modules/location/{locationManager.ts → LocationManager.ts} +16 -15
- package/src/modules/offline/OfflineCreatePackOptions.ts +1 -3
- package/src/modules/offline/{offlineManager.ts → OfflineManager.ts} +30 -29
- package/src/modules/offline/OfflinePack.ts +2 -4
- package/src/modules/snapshot/{snapshotManager.ts → SnapshotManager.ts} +9 -9
- package/src/modules/snapshot/SnapshotOptions.ts +2 -4
- package/src/plugin/MapLibrePluginProps.ts +83 -0
- package/src/plugin/android.ts +64 -0
- package/src/plugin/ios.ts +166 -0
- package/src/plugin/withMapLibre.ts +30 -0
- package/src/{utils/MapLibreRNStyles.d.ts → types/MapLibreRNStyles.ts} +86 -406
- package/src/utils/BridgeValue.ts +1 -1
- package/src/utils/Logger.ts +1 -3
- package/src/utils/StyleValue.ts +6 -5
- package/src/utils/animated/AbstractAnimatedCoordinates.ts +3 -3
- package/src/utils/animated/Animated.ts +23 -21
- package/src/utils/animated/AnimatedCoordinatesArray.ts +3 -4
- package/src/utils/animated/AnimatedExtractCoordinateFromArray.ts +1 -1
- package/src/utils/animated/AnimatedPoint.ts +0 -2
- package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +3 -2
- package/src/utils/animated/AnimatedShape.ts +4 -6
- package/src/utils/filterUtils.ts +1 -1
- package/src/utils/getStylePropertyType.ts +265 -0
- package/lib/commonjs/modules/location/locationManager.js.map +0 -1
- package/lib/commonjs/modules/offline/offlineManager.js.map +0 -1
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +0 -1
- package/lib/commonjs/types/StyleURL.js +0 -11
- package/lib/commonjs/types/StyleURL.js.map +0 -1
- package/lib/commonjs/utils/MapLibreRNStyles.d.js +0 -181
- package/lib/commonjs/utils/MapLibreRNStyles.d.js.map +0 -1
- package/lib/commonjs/utils/styleMap.js +0 -255
- package/lib/commonjs/utils/styleMap.js.map +0 -1
- package/lib/module/modules/location/locationManager.js.map +0 -1
- package/lib/module/modules/offline/offlineManager.js.map +0 -1
- package/lib/module/types/StyleURL.js +0 -7
- package/lib/module/types/StyleURL.js.map +0 -1
- package/lib/module/utils/MapLibreRNStyles.d.js +0 -180
- package/lib/module/utils/MapLibreRNStyles.d.js.map +0 -1
- package/lib/module/utils/styleMap.js +0 -249
- package/lib/module/utils/styleMap.js.map +0 -1
- package/lib/typescript/commonjs/jest.config.d.ts +0 -2
- package/lib/typescript/commonjs/jest.config.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/location/locationManager.d.ts +0 -64
- package/lib/typescript/commonjs/src/modules/location/locationManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/offline/offlineManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/snapshot/snapshotManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/StyleURL.d.ts +0 -4
- package/lib/typescript/commonjs/src/types/StyleURL.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/styleMap.d.ts +0 -231
- package/lib/typescript/commonjs/src/utils/styleMap.d.ts.map +0 -1
- package/lib/typescript/module/jest.config.d.ts +0 -2
- package/lib/typescript/module/jest.config.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/location/locationManager.d.ts +0 -64
- package/lib/typescript/module/src/modules/location/locationManager.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/offline/offlineManager.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/snapshot/snapshotManager.d.ts.map +0 -1
- package/lib/typescript/module/src/types/StyleURL.d.ts +0 -4
- package/lib/typescript/module/src/types/StyleURL.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/styleMap.d.ts +0 -231
- package/lib/typescript/module/src/utils/styleMap.d.ts.map +0 -1
- package/plugin/build/withMapLibre.d.ts +0 -12
- package/plugin/build/withMapLibre.js +0 -148
- package/src/types/StyleURL.ts +0 -3
- package/src/utils/styleMap.ts +0 -265
|
@@ -7,21 +7,14 @@ import android.util.Log;
|
|
|
7
7
|
|
|
8
8
|
import org.maplibre.android.location.engine.LocationEngine;
|
|
9
9
|
import org.maplibre.android.location.engine.LocationEngineCallback;
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
import com.mapbox.android.core.location.LocationEngineListener;
|
|
13
|
-
import com.mapbox.android.core.location.LocationEnginePriority;
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import org.maplibre.android.location.engine.LocationEngineDefault;
|
|
17
10
|
import org.maplibre.android.location.engine.LocationEngineRequest;
|
|
18
11
|
import org.maplibre.android.location.engine.LocationEngineResult;
|
|
19
12
|
import org.maplibre.android.location.permissions.PermissionsManager;
|
|
13
|
+
import org.maplibre.reactnative.location.engine.LocationEngineProvider;
|
|
20
14
|
|
|
21
15
|
import java.lang.ref.WeakReference;
|
|
22
16
|
import java.util.ArrayList;
|
|
23
17
|
import java.util.List;
|
|
24
|
-
import java.util.Locale;
|
|
25
18
|
|
|
26
19
|
@SuppressWarnings({"MissingPermission"})
|
|
27
20
|
public class LocationManager implements LocationEngineCallback<LocationEngineResult> {
|
|
@@ -58,8 +51,10 @@ public class LocationManager implements LocationEngineCallback<LocationEngineRes
|
|
|
58
51
|
this.buildEngineRequest();
|
|
59
52
|
|
|
60
53
|
}
|
|
54
|
+
|
|
61
55
|
private void buildEngineRequest() {
|
|
62
|
-
locationEngine =
|
|
56
|
+
locationEngine = new LocationEngineProvider().getLocationEngine(context);
|
|
57
|
+
|
|
63
58
|
locationEngineRequest = new LocationEngineRequest.Builder(DEFAULT_INTERVAL_MILLIS)
|
|
64
59
|
.setFastestInterval(DEFAULT_FASTEST_INTERVAL_MILLIS)
|
|
65
60
|
.setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY)
|
|
@@ -78,9 +73,11 @@ public class LocationManager implements LocationEngineCallback<LocationEngineRes
|
|
|
78
73
|
listeners.remove(listener);
|
|
79
74
|
}
|
|
80
75
|
}
|
|
76
|
+
|
|
81
77
|
public void setMinDisplacement(float minDisplacement) {
|
|
82
78
|
mMinDisplacement = minDisplacement;
|
|
83
79
|
}
|
|
80
|
+
|
|
84
81
|
public void enable() {
|
|
85
82
|
if (!PermissionsManager.areLocationPermissionsGranted(context)) {
|
|
86
83
|
return;
|
|
@@ -134,8 +131,7 @@ public class LocationManager implements LocationEngineCallback<LocationEngineRes
|
|
|
134
131
|
|
|
135
132
|
try {
|
|
136
133
|
locationEngine.getLastLocation(callback);
|
|
137
|
-
}
|
|
138
|
-
catch(Exception exception) {
|
|
134
|
+
} catch (Exception exception) {
|
|
139
135
|
Log.w(LOG_TAG, exception);
|
|
140
136
|
callback.onFailure(exception);
|
|
141
137
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package org.maplibre.reactnative.location.engine;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.util.Log;
|
|
5
|
+
|
|
6
|
+
import org.maplibre.android.location.engine.LocationEngine;
|
|
7
|
+
import org.maplibre.android.location.engine.LocationEngineDefault;
|
|
8
|
+
|
|
9
|
+
public class DefaultLocationEngineProvider implements LocationEngineProvidable {
|
|
10
|
+
private static final String LOG_TAG = "DefaultLocationEngineProvider";
|
|
11
|
+
|
|
12
|
+
@Override
|
|
13
|
+
public LocationEngine getLocationEngine(Context context) {
|
|
14
|
+
LocationEngine locationEngine = LocationEngineDefault.INSTANCE.getDefaultLocationEngine(context.getApplicationContext());
|
|
15
|
+
Log.d(LOG_TAG, "DefaultLocationEngine will be used.");
|
|
16
|
+
return locationEngine;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -11,9 +11,7 @@ import com.facebook.react.common.MapBuilder;
|
|
|
11
11
|
import com.facebook.react.module.annotations.ReactModule;
|
|
12
12
|
import org.maplibre.android.MapLibre;
|
|
13
13
|
import org.maplibre.android.WellKnownTileServer;
|
|
14
|
-
import org.maplibre.android.style.layers.Property;
|
|
15
14
|
import org.maplibre.reactnative.components.camera.constants.CameraMode;
|
|
16
|
-
import org.maplibre.reactnative.components.styles.MLRNStyleValue;
|
|
17
15
|
import org.maplibre.reactnative.components.styles.sources.MLRNSource;
|
|
18
16
|
import org.maplibre.reactnative.events.constants.EventTypes;
|
|
19
17
|
import org.maplibre.reactnative.http.CustomHeadersInterceptor;
|
|
@@ -34,6 +32,8 @@ import javax.annotation.Nullable;
|
|
|
34
32
|
public class MLRNModule extends ReactContextBaseJavaModule {
|
|
35
33
|
public static final String REACT_CLASS = "MLRNModule";
|
|
36
34
|
|
|
35
|
+
public static final String DEFAULT_STYLE_URL = "https://demotiles.maplibre.org/style.json";
|
|
36
|
+
|
|
37
37
|
private static boolean customHeaderInterceptorAdded = false;
|
|
38
38
|
|
|
39
39
|
private Handler mUiThreadHandler;
|
|
@@ -44,6 +44,11 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
44
44
|
mReactContext = reactApplicationContext;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
@Override
|
|
48
|
+
public void initialize() {
|
|
49
|
+
initializeMapLibreInstance();
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
@Override
|
|
48
53
|
public String getName() {
|
|
49
54
|
return REACT_CLASS;
|
|
@@ -54,7 +59,7 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
54
59
|
public Map<String, Object> getConstants() {
|
|
55
60
|
// map style urls
|
|
56
61
|
Map<String, String> styleURLS = new HashMap<>();
|
|
57
|
-
styleURLS.put("Default",
|
|
62
|
+
styleURLS.put("Default", DEFAULT_STYLE_URL);
|
|
58
63
|
|
|
59
64
|
// events
|
|
60
65
|
Map<String, String> eventTypes = new HashMap<>();
|
|
@@ -99,127 +104,6 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
99
104
|
Map<String, String> styleSourceConsts = new HashMap<>();
|
|
100
105
|
styleSourceConsts.put("DefaultSourceID", MLRNSource.DEFAULT_ID);
|
|
101
106
|
|
|
102
|
-
// interpolation modes
|
|
103
|
-
Map<String, Integer> interpolationModes = new HashMap<>();
|
|
104
|
-
interpolationModes.put("Exponential", MLRNStyleValue.InterpolationModeExponential);
|
|
105
|
-
interpolationModes.put("Categorical", MLRNStyleValue.InterpolationModeCategorical);
|
|
106
|
-
interpolationModes.put("Interval", MLRNStyleValue.InterpolationModeInterval);
|
|
107
|
-
interpolationModes.put("Identity", MLRNStyleValue.InterpolationModeIdentity);
|
|
108
|
-
|
|
109
|
-
// line layer constants
|
|
110
|
-
Map<String, String> lineJoin = new HashMap<>();
|
|
111
|
-
lineJoin.put("Bevel", Property.LINE_JOIN_BEVEL);
|
|
112
|
-
lineJoin.put("Round", Property.LINE_JOIN_ROUND);
|
|
113
|
-
lineJoin.put("Miter", Property.LINE_JOIN_MITER);
|
|
114
|
-
|
|
115
|
-
Map<String, String> lineCap = new HashMap<>();
|
|
116
|
-
lineCap.put("Butt", Property.LINE_CAP_BUTT);
|
|
117
|
-
lineCap.put("Round", Property.LINE_CAP_ROUND);
|
|
118
|
-
lineCap.put("Square", Property.LINE_CAP_SQUARE);
|
|
119
|
-
|
|
120
|
-
Map<String, String> lineTranslateAnchor = new HashMap<>();
|
|
121
|
-
lineTranslateAnchor.put("Map", Property.LINE_TRANSLATE_ANCHOR_MAP);
|
|
122
|
-
lineTranslateAnchor.put("Viewport", Property.LINE_TRANSLATE_ANCHOR_VIEWPORT);
|
|
123
|
-
|
|
124
|
-
// circle layer constants
|
|
125
|
-
Map<String, String> circlePitchScale = new HashMap<>();
|
|
126
|
-
circlePitchScale.put("Map", Property.CIRCLE_PITCH_SCALE_MAP);
|
|
127
|
-
circlePitchScale.put("Viewport", Property.CIRCLE_PITCH_SCALE_VIEWPORT);
|
|
128
|
-
|
|
129
|
-
Map<String, String> circleTranslateAnchor = new HashMap<>();
|
|
130
|
-
circleTranslateAnchor.put("Map", Property.CIRCLE_TRANSLATE_ANCHOR_MAP);
|
|
131
|
-
circleTranslateAnchor.put("Viewport", Property.CIRCLE_TRANSLATE_ANCHOR_VIEWPORT);
|
|
132
|
-
|
|
133
|
-
Map<String, String> circlePitchAlignment = new HashMap<>();
|
|
134
|
-
circlePitchAlignment.put("Map", Property.CIRCLE_PITCH_ALIGNMENT_MAP);
|
|
135
|
-
circlePitchAlignment.put("Viewport", Property.CIRCLE_PITCH_ALIGNMENT_VIEWPORT);
|
|
136
|
-
|
|
137
|
-
// fill extrusion layer constants
|
|
138
|
-
Map<String, String> fillExtrusionTranslateAnchor = new HashMap<>();
|
|
139
|
-
fillExtrusionTranslateAnchor.put("Map", Property.FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP);
|
|
140
|
-
fillExtrusionTranslateAnchor.put("Viewport", Property.FILL_EXTRUSION_TRANSLATE_ANCHOR_VIEWPORT);
|
|
141
|
-
|
|
142
|
-
// fill layer constants
|
|
143
|
-
Map<String, String> fillTranslateAnchor = new HashMap<>();
|
|
144
|
-
fillTranslateAnchor.put("Map", Property.FILL_TRANSLATE_ANCHOR_MAP);
|
|
145
|
-
fillTranslateAnchor.put("Viewport", Property.FILL_TRANSLATE_ANCHOR_VIEWPORT);
|
|
146
|
-
|
|
147
|
-
// symbol layer constants
|
|
148
|
-
Map<String, String> iconRotationAlignment = new HashMap<>();
|
|
149
|
-
iconRotationAlignment.put("Auto", Property.ICON_ROTATION_ALIGNMENT_AUTO);
|
|
150
|
-
iconRotationAlignment.put("Map", Property.ICON_ROTATION_ALIGNMENT_MAP);
|
|
151
|
-
iconRotationAlignment.put("Viewport", Property.ICON_ROTATION_ALIGNMENT_VIEWPORT);
|
|
152
|
-
|
|
153
|
-
Map<String, String> iconTextFit = new HashMap<>();
|
|
154
|
-
iconTextFit.put("None", Property.ICON_TEXT_FIT_NONE);
|
|
155
|
-
iconTextFit.put("Width", Property.ICON_TEXT_FIT_WIDTH);
|
|
156
|
-
iconTextFit.put("Height", Property.ICON_TEXT_FIT_HEIGHT);
|
|
157
|
-
iconTextFit.put("Both", Property.ICON_TEXT_FIT_BOTH);
|
|
158
|
-
|
|
159
|
-
Map<String, String> iconAnchor = new HashMap<>();
|
|
160
|
-
iconAnchor.put("Center", Property.ICON_ANCHOR_CENTER);
|
|
161
|
-
iconAnchor.put("Left", Property.ICON_ANCHOR_LEFT);
|
|
162
|
-
iconAnchor.put("Right", Property.ICON_ANCHOR_RIGHT);
|
|
163
|
-
iconAnchor.put("Top", Property.ICON_ANCHOR_TOP);
|
|
164
|
-
iconAnchor.put("Bottom", Property.ICON_ANCHOR_BOTTOM);
|
|
165
|
-
iconAnchor.put("TopLeft", Property.ICON_ANCHOR_TOP_LEFT);
|
|
166
|
-
iconAnchor.put("TopRight", Property.ICON_ANCHOR_TOP_RIGHT);
|
|
167
|
-
iconAnchor.put("BottomLeft", Property.ICON_ANCHOR_BOTTOM_LEFT);
|
|
168
|
-
iconAnchor.put("BottomRight", Property.ICON_ANCHOR_BOTTOM_RIGHT);
|
|
169
|
-
|
|
170
|
-
Map<String, String> iconPitchAlignment = new HashMap<>();
|
|
171
|
-
iconPitchAlignment.put("Auto", Property.ICON_PITCH_ALIGNMENT_AUTO);
|
|
172
|
-
iconPitchAlignment.put("Map", Property.ICON_PITCH_ALIGNMENT_MAP);
|
|
173
|
-
iconPitchAlignment.put("Viewport", Property.ICON_PITCH_ALIGNMENT_VIEWPORT);
|
|
174
|
-
|
|
175
|
-
Map<String, String> iconTranslateAnchor = new HashMap<>();
|
|
176
|
-
iconTranslateAnchor.put("Map", Property.ICON_TRANSLATE_ANCHOR_MAP);
|
|
177
|
-
iconTranslateAnchor.put("Viewport", Property.ICON_TRANSLATE_ANCHOR_VIEWPORT);
|
|
178
|
-
|
|
179
|
-
Map<String, String> symbolPlacement = new HashMap<>();
|
|
180
|
-
symbolPlacement.put("Line", Property.SYMBOL_PLACEMENT_LINE);
|
|
181
|
-
symbolPlacement.put("Point", Property.SYMBOL_PLACEMENT_POINT);
|
|
182
|
-
|
|
183
|
-
Map<String, String> textAnchor = new HashMap<>();
|
|
184
|
-
textAnchor.put("Center", Property.TEXT_ANCHOR_CENTER);
|
|
185
|
-
textAnchor.put("Left", Property.TEXT_ANCHOR_LEFT);
|
|
186
|
-
textAnchor.put("Right", Property.TEXT_ANCHOR_RIGHT);
|
|
187
|
-
textAnchor.put("Top", Property.TEXT_ANCHOR_TOP);
|
|
188
|
-
textAnchor.put("Bottom", Property.TEXT_ANCHOR_BOTTOM);
|
|
189
|
-
textAnchor.put("TopLeft", Property.TEXT_ANCHOR_TOP_LEFT);
|
|
190
|
-
textAnchor.put("TopRight", Property.TEXT_ANCHOR_TOP_RIGHT);
|
|
191
|
-
textAnchor.put("BottomLeft", Property.TEXT_ANCHOR_BOTTOM_LEFT);
|
|
192
|
-
textAnchor.put("BottomRight", Property.TEXT_ANCHOR_BOTTOM_RIGHT);
|
|
193
|
-
|
|
194
|
-
Map<String, String> textJustify = new HashMap<>();
|
|
195
|
-
textJustify.put("Center", Property.TEXT_JUSTIFY_CENTER);
|
|
196
|
-
textJustify.put("Left", Property.TEXT_JUSTIFY_LEFT);
|
|
197
|
-
textJustify.put("Right", Property.TEXT_JUSTIFY_RIGHT);
|
|
198
|
-
|
|
199
|
-
Map<String, String> textPitchAlignment = new HashMap<>();
|
|
200
|
-
textPitchAlignment.put("Auto", Property.TEXT_PITCH_ALIGNMENT_AUTO);
|
|
201
|
-
textPitchAlignment.put("Map", Property.TEXT_PITCH_ALIGNMENT_MAP);
|
|
202
|
-
textPitchAlignment.put("Viewport", Property.TEXT_PITCH_ALIGNMENT_VIEWPORT);
|
|
203
|
-
|
|
204
|
-
Map<String, String> textRotationAlignment = new HashMap<>();
|
|
205
|
-
textRotationAlignment.put("Auto", Property.TEXT_ROTATION_ALIGNMENT_AUTO);
|
|
206
|
-
textRotationAlignment.put("Map", Property.TEXT_ROTATION_ALIGNMENT_MAP);
|
|
207
|
-
textRotationAlignment.put("Viewport", Property.TEXT_ROTATION_ALIGNMENT_VIEWPORT);
|
|
208
|
-
|
|
209
|
-
Map<String, String> textTransform = new HashMap<>();
|
|
210
|
-
textTransform.put("None", Property.TEXT_TRANSFORM_NONE);
|
|
211
|
-
textTransform.put("Lowercase", Property.TEXT_TRANSFORM_LOWERCASE);
|
|
212
|
-
textTransform.put("Uppercase", Property.TEXT_TRANSFORM_UPPERCASE);
|
|
213
|
-
|
|
214
|
-
Map<String, String> textTranslateAnchor = new HashMap<>();
|
|
215
|
-
textTranslateAnchor.put("Map", Property.TEXT_TRANSLATE_ANCHOR_MAP);
|
|
216
|
-
textTranslateAnchor.put("Viewport", Property.TEXT_TRANSLATE_ANCHOR_VIEWPORT);
|
|
217
|
-
|
|
218
|
-
// light constants
|
|
219
|
-
Map<String, String> lightAnchor = new HashMap<>();
|
|
220
|
-
lightAnchor.put("Map", Property.ANCHOR_MAP);
|
|
221
|
-
lightAnchor.put("Viewport", Property.ANCHOR_VIEWPORT);
|
|
222
|
-
|
|
223
107
|
// offline region download states
|
|
224
108
|
Map<String, Integer> offlinePackDownloadStates = new HashMap<>();
|
|
225
109
|
offlinePackDownloadStates.put("Inactive", MLRNOfflineModule.INACTIVE_REGION_DOWNLOAD_STATE);
|
|
@@ -242,35 +126,17 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
242
126
|
.put("UserLocationVerticalAlignment", userLocationVerticalAlignment)
|
|
243
127
|
.put("CameraModes", cameraModes)
|
|
244
128
|
.put("StyleSource", styleSourceConsts)
|
|
245
|
-
.put("InterpolationMode", interpolationModes)
|
|
246
|
-
.put("LineJoin", lineJoin)
|
|
247
|
-
.put("LineCap", lineCap)
|
|
248
|
-
.put("LineTranslateAnchor", lineTranslateAnchor)
|
|
249
|
-
.put("CirclePitchScale", circlePitchScale)
|
|
250
|
-
.put("CircleTranslateAnchor", circleTranslateAnchor)
|
|
251
|
-
.put("CirclePitchAlignment", circlePitchAlignment)
|
|
252
|
-
.put("FillExtrusionTranslateAnchor", fillExtrusionTranslateAnchor)
|
|
253
|
-
.put("FillTranslateAnchor", fillTranslateAnchor)
|
|
254
|
-
.put("IconRotationAlignment", iconRotationAlignment)
|
|
255
|
-
.put("IconTextFit", iconTextFit)
|
|
256
|
-
.put("IconTranslateAnchor", iconTranslateAnchor)
|
|
257
|
-
.put("SymbolPlacement", symbolPlacement)
|
|
258
|
-
.put("IconAnchor", iconAnchor)
|
|
259
|
-
.put("TextAnchor", textAnchor)
|
|
260
|
-
.put("TextJustify", textJustify)
|
|
261
|
-
.put("IconPitchAlignment", iconPitchAlignment)
|
|
262
|
-
.put("TextPitchAlignment", textPitchAlignment)
|
|
263
|
-
.put("TextRotationAlignment", textRotationAlignment)
|
|
264
|
-
.put("TextTransform", textTransform)
|
|
265
|
-
.put("TextTranslateAnchor", textTranslateAnchor)
|
|
266
|
-
.put("LightAnchor", lightAnchor)
|
|
267
129
|
.put("OfflinePackDownloadState", offlinePackDownloadStates)
|
|
268
130
|
.put("OfflineCallbackName", offlineModuleCallbackNames)
|
|
269
131
|
.put("LocationCallbackName", locationModuleCallbackNames)
|
|
270
132
|
.build();
|
|
271
133
|
}
|
|
272
134
|
|
|
273
|
-
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated This will be removed in the next major version.
|
|
137
|
+
* @see https://github.com/maplibre/maplibre-react-native/issues/25#issuecomment-1382382044
|
|
138
|
+
*/
|
|
139
|
+
@Deprecated
|
|
274
140
|
@ReactMethod
|
|
275
141
|
public void setAccessToken(final String accessToken) {
|
|
276
142
|
mReactContext.runOnUiQueueThread(new Runnable() {
|
|
@@ -313,7 +179,11 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
313
179
|
});
|
|
314
180
|
}
|
|
315
181
|
|
|
316
|
-
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated This will be removed in the next major version.
|
|
184
|
+
* @see https://github.com/maplibre/maplibre-react-native/issues/25#issuecomment-1382382044
|
|
185
|
+
*/
|
|
186
|
+
@Deprecated
|
|
317
187
|
@ReactMethod
|
|
318
188
|
public void getAccessToken(Promise promise) {
|
|
319
189
|
String token = MapLibre.getApiKey();
|
|
@@ -341,4 +211,13 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
341
211
|
dispatcher.setMaxRequestsPerHost(20);
|
|
342
212
|
return dispatcher;
|
|
343
213
|
}
|
|
214
|
+
|
|
215
|
+
private void initializeMapLibreInstance() {
|
|
216
|
+
mReactContext.runOnUiQueueThread(new Runnable() {
|
|
217
|
+
@Override
|
|
218
|
+
public void run() {
|
|
219
|
+
MapLibre.getInstance(getReactApplicationContext());
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
344
223
|
}
|
|
@@ -9,7 +9,6 @@ import com.facebook.react.bridge.*;
|
|
|
9
9
|
import com.facebook.react.module.annotations.ReactModule;
|
|
10
10
|
import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
|
|
11
11
|
import org.maplibre.geojson.FeatureCollection;
|
|
12
|
-
// import org.maplibre.android.constants.Style;
|
|
13
12
|
import org.maplibre.android.geometry.LatLngBounds;
|
|
14
13
|
import org.maplibre.android.offline.OfflineManager;
|
|
15
14
|
import org.maplibre.android.offline.OfflineRegion;
|
|
@@ -43,7 +42,6 @@ public class MLRNOfflineModule extends ReactContextBaseJavaModule {
|
|
|
43
42
|
public static final String OFFLINE_ERROR = "MapboxOfflineRegionError";
|
|
44
43
|
public static final String OFFLINE_PROGRESS = "MapboxOfflineRegionProgress";
|
|
45
44
|
|
|
46
|
-
public static final String DEFAULT_STYLE_URL = "https://demotiles.maplibre.org/style.json";
|
|
47
45
|
public static final Double DEFAULT_MIN_ZOOM_LEVEL = 10.0;
|
|
48
46
|
public static final Double DEFAULT_MAX_ZOOM_LEVEL = 20.0;
|
|
49
47
|
|
|
@@ -426,7 +424,7 @@ public class MLRNOfflineModule extends ReactContextBaseJavaModule {
|
|
|
426
424
|
|
|
427
425
|
private OfflineRegionDefinition makeDefinition(LatLngBounds latLngBounds, ReadableMap options) {
|
|
428
426
|
return new OfflineTilePyramidRegionDefinition(
|
|
429
|
-
ConvertUtils.getString("styleURL", options, DEFAULT_STYLE_URL),
|
|
427
|
+
ConvertUtils.getString("styleURL", options, MLRNModule.DEFAULT_STYLE_URL),
|
|
430
428
|
latLngBounds,
|
|
431
429
|
ConvertUtils.getDouble("minZoom", options, DEFAULT_MIN_ZOOM_LEVEL),
|
|
432
430
|
ConvertUtils.getDouble("maxZoom", options, DEFAULT_MAX_ZOOM_LEVEL),
|
|
@@ -6,34 +6,49 @@ import com.facebook.react.bridge.WritableArray;
|
|
|
6
6
|
import com.facebook.react.bridge.WritableMap;
|
|
7
7
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
8
8
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
9
|
+
import com.google.gson.JsonObject;
|
|
10
|
+
|
|
9
11
|
import org.maplibre.geojson.Feature;
|
|
10
12
|
import org.maplibre.geojson.FeatureCollection;
|
|
11
13
|
import org.maplibre.geojson.Geometry;
|
|
12
14
|
import org.maplibre.geojson.GeometryCollection;
|
|
15
|
+
import org.maplibre.geojson.MultiLineString;
|
|
13
16
|
import org.maplibre.geojson.LineString;
|
|
14
17
|
import org.maplibre.geojson.MultiPoint;
|
|
15
18
|
import org.maplibre.geojson.Point;
|
|
19
|
+
import org.maplibre.geojson.MultiPolygon;
|
|
16
20
|
import org.maplibre.geojson.Polygon;
|
|
17
21
|
import org.maplibre.android.geometry.LatLng;
|
|
18
22
|
import org.maplibre.android.geometry.LatLngBounds;
|
|
19
23
|
import org.maplibre.android.geometry.LatLngQuad;
|
|
20
|
-
import org.maplibre.android.
|
|
24
|
+
import org.maplibre.android.log.Logger;
|
|
21
25
|
import org.maplibre.turf.TurfMeasurement;
|
|
22
26
|
|
|
23
27
|
import java.util.ArrayList;
|
|
24
28
|
import java.util.List;
|
|
29
|
+
import java.util.stream.Collectors;
|
|
25
30
|
|
|
26
31
|
public class GeoJSONUtils {
|
|
32
|
+
public static final String LOG_TAG = "GeoJSONUtils";
|
|
33
|
+
|
|
27
34
|
public static WritableMap fromFeature(Feature feature) {
|
|
28
35
|
WritableMap map = Arguments.createMap();
|
|
29
36
|
map.putString("type", "Feature");
|
|
30
37
|
map.putString("id", feature.id());
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
Geometry geometry = feature.geometry();
|
|
40
|
+
if (geometry == null) {
|
|
41
|
+
map.putNull("geometry");
|
|
42
|
+
} else {
|
|
43
|
+
map.putMap("geometry", fromGeometry(geometry));
|
|
44
|
+
}
|
|
34
45
|
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
JsonObject properties = feature.properties();
|
|
47
|
+
if(properties == null) {
|
|
48
|
+
map.putNull("properties");
|
|
49
|
+
} else {
|
|
50
|
+
map.putMap("properties", ConvertUtils.toWritableMap(properties));
|
|
51
|
+
}
|
|
37
52
|
|
|
38
53
|
return map;
|
|
39
54
|
}
|
|
@@ -41,16 +56,20 @@ public class GeoJSONUtils {
|
|
|
41
56
|
public static WritableMap fromGeometry(Geometry geometry) {
|
|
42
57
|
final String type = geometry.type();
|
|
43
58
|
|
|
44
|
-
switch (type) {
|
|
45
|
-
case "Point"
|
|
46
|
-
|
|
47
|
-
case "
|
|
48
|
-
|
|
49
|
-
case "
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
return switch (type) {
|
|
60
|
+
case "Point" -> fromPoint((Point) geometry);
|
|
61
|
+
case "LineString" -> fromLineString((LineString) geometry);
|
|
62
|
+
case "Polygon" -> fromPolygon((Polygon) geometry);
|
|
63
|
+
case "MultiPoint" -> fromMultiPoint((MultiPoint) geometry);
|
|
64
|
+
case "MultiLineString" -> fromMultiLineString((MultiLineString) geometry);
|
|
65
|
+
case "MultiPolygon" -> fromMultiPolygon((MultiPolygon) geometry);
|
|
66
|
+
case "GeometryCollection" -> fromGeometryCollection((GeometryCollection) geometry);
|
|
67
|
+
default -> {
|
|
68
|
+
Logger.w(LOG_TAG, "GeoJSONUtils.fromGeometry unsupported type: \"" + type + "\"");
|
|
69
|
+
|
|
70
|
+
yield null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
public static WritableMap fromPoint(Point point) {
|
|
@@ -74,6 +93,44 @@ public class GeoJSONUtils {
|
|
|
74
93
|
return map;
|
|
75
94
|
}
|
|
76
95
|
|
|
96
|
+
public static WritableMap fromMultiPoint(MultiPoint multiPoint) {
|
|
97
|
+
WritableMap map = Arguments.createMap();
|
|
98
|
+
map.putString("type", "MultiPoint");
|
|
99
|
+
map.putArray("coordinates", getCoordinates(multiPoint));
|
|
100
|
+
return map;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public static WritableMap fromMultiLineString(MultiLineString multiLineString) {
|
|
104
|
+
WritableMap map = Arguments.createMap();
|
|
105
|
+
map.putString("type", "MultiLineString");
|
|
106
|
+
map.putArray("coordinates", getCoordinates(multiLineString));
|
|
107
|
+
return map;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public static WritableMap fromMultiPolygon(MultiPolygon multiPolygon) {
|
|
111
|
+
WritableMap map = Arguments.createMap();
|
|
112
|
+
map.putString("type", "MultiPolygon");
|
|
113
|
+
map.putArray("coordinates", getCoordinates(multiPolygon));
|
|
114
|
+
return map;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public static WritableMap fromGeometryCollection(GeometryCollection geometryCollection) {
|
|
118
|
+
WritableMap map = Arguments.createMap();
|
|
119
|
+
map.putString("type", "GeometryCollection");
|
|
120
|
+
|
|
121
|
+
map.putArray("geometries",
|
|
122
|
+
Arguments.fromList(
|
|
123
|
+
geometryCollection
|
|
124
|
+
.geometries()
|
|
125
|
+
.stream()
|
|
126
|
+
.map(GeoJSONUtils::fromGeometry)
|
|
127
|
+
.collect(Collectors.toList())
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
return map;
|
|
132
|
+
}
|
|
133
|
+
|
|
77
134
|
public static WritableArray getCoordinates(Point point) {
|
|
78
135
|
return Arguments.fromArray(pointToDoubleArray(point));
|
|
79
136
|
}
|
|
@@ -93,9 +150,6 @@ public class GeoJSONUtils {
|
|
|
93
150
|
WritableArray array = Arguments.createArray();
|
|
94
151
|
|
|
95
152
|
List<List<Point>> points = polygon.coordinates();
|
|
96
|
-
if (points == null) {
|
|
97
|
-
return array;
|
|
98
|
-
}
|
|
99
153
|
|
|
100
154
|
for (List<Point> curPoint : points) {
|
|
101
155
|
WritableArray innerArray = Arguments.createArray();
|
|
@@ -110,6 +164,57 @@ public class GeoJSONUtils {
|
|
|
110
164
|
return array;
|
|
111
165
|
}
|
|
112
166
|
|
|
167
|
+
public static WritableArray getCoordinates(MultiPoint multiPoint) {
|
|
168
|
+
WritableArray array = Arguments.createArray();
|
|
169
|
+
|
|
170
|
+
List<Point> points = multiPoint.coordinates();
|
|
171
|
+
for (Point point : points) {
|
|
172
|
+
array.pushArray(Arguments.fromArray(pointToDoubleArray(point)));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return array;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public static WritableArray getCoordinates(MultiLineString multiLineString) {
|
|
179
|
+
WritableArray array = Arguments.createArray();
|
|
180
|
+
|
|
181
|
+
List<List<Point>> lines = multiLineString.coordinates();
|
|
182
|
+
for (List<Point> line : lines) {
|
|
183
|
+
WritableArray lineArray = Arguments.createArray();
|
|
184
|
+
|
|
185
|
+
for (Point point : line) {
|
|
186
|
+
lineArray.pushArray(Arguments.fromArray(pointToDoubleArray(point)));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
array.pushArray(lineArray);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return array;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public static WritableArray getCoordinates(MultiPolygon multiPolygon) {
|
|
196
|
+
WritableArray array = Arguments.createArray();
|
|
197
|
+
|
|
198
|
+
List<List<List<Point>>> polygons = multiPolygon.coordinates();
|
|
199
|
+
for (List<List<Point>> polygon : polygons) {
|
|
200
|
+
WritableArray polygonArray = Arguments.createArray();
|
|
201
|
+
|
|
202
|
+
for (List<Point> ring : polygon) {
|
|
203
|
+
WritableArray ringArray = Arguments.createArray();
|
|
204
|
+
|
|
205
|
+
for (Point point : ring) {
|
|
206
|
+
ringArray.pushArray(Arguments.fromArray(pointToDoubleArray(point)));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
polygonArray.pushArray(ringArray);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
array.pushArray(polygonArray);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return array;
|
|
216
|
+
}
|
|
217
|
+
|
|
113
218
|
public static WritableMap toPointFeature(LatLng latLng, WritableMap properties) {
|
|
114
219
|
WritableMap map = new WritableNativeMap();
|
|
115
220
|
map.putString("type", "Feature");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package org.maplibre.reactnative.location.engine;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
|
|
5
|
+
import org.maplibre.android.location.engine.LocationEngine;
|
|
6
|
+
|
|
7
|
+
public class LocationEngineProvider implements LocationEngineProvidable {
|
|
8
|
+
@Override
|
|
9
|
+
public LocationEngine getLocationEngine(Context context) {
|
|
10
|
+
return new DefaultLocationEngineProvider().getLocationEngine(context);
|
|
11
|
+
}
|
|
12
|
+
}
|