@maplibre/maplibre-react-native 11.0.0-alpha.7 → 11.0.0-alpha.9
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/MapLibreReactNative.podspec +1 -1
- package/android/build.gradle +0 -3
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +43 -0
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.kt +24 -0
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.kt +71 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotation/MLRNPointAnnotation.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.kt +203 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.kt +109 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.kt +60 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.kt +409 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +69 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraModule.kt +34 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraEasing.kt +24 -0
- package/android/src/main/java/org/maplibre/reactnative/components/images/MLRNImages.java +1 -2
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.kt +23 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +23 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +1338 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +187 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +159 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.kt +26 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt +74 -0
- package/android/src/main/java/org/maplibre/reactnative/components/styles/layers/MLRNLayer.java +1 -5
- package/android/src/main/java/org/maplibre/reactnative/components/styles/light/MLRNLight.java +1 -6
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +2 -9
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNSource.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/events/AbstractEvent.java +2 -5
- package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.kt +18 -0
- package/android/src/main/java/org/maplibre/reactnative/events/MapClickEvent.java +4 -0
- package/android/src/main/java/org/maplibre/reactnative/events/MapPressEvent.kt +27 -0
- package/android/src/main/java/org/maplibre/reactnative/events/TrackUserLocationChangeEvent.kt +24 -0
- package/android/src/main/java/org/maplibre/reactnative/events/constants/EventKeys.java +0 -1
- package/android/src/main/java/org/maplibre/reactnative/events/constants/EventTypes.java +0 -19
- package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/location/TrackUserLocationMode.kt +43 -0
- package/android/src/main/java/org/maplibre/reactnative/location/{UserTrackingState.java → TrackUserLocationState.java} +1 -1
- package/android/src/main/java/org/maplibre/reactnative/location/UserLocation.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +1 -49
- package/android/src/main/java/org/maplibre/reactnative/utils/ConvertUtils.java +2 -9
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +322 -0
- package/android/src/main/java/org/maplibre/reactnative/utils/ReactTagResolver.kt +85 -0
- package/ios/MLRNCallout.h +1 -1
- package/ios/MLRNEvent.m +3 -1
- package/ios/MLRNEventTypes.h +10 -31
- package/ios/MLRNEventTypes.m +10 -30
- package/ios/MLRNImages.h +1 -1
- package/ios/MLRNImages.m +1 -1
- package/ios/MLRNLayer.h +1 -1
- package/ios/MLRNLayer.m +2 -2
- package/ios/MLRNLight.h +2 -1
- package/ios/MLRNLocationModule.m +2 -2
- package/ios/MLRNMapTouchEvent.h +2 -1
- package/ios/MLRNMapTouchEvent.m +12 -10
- package/ios/MLRNModule.m +5 -52
- package/ios/MLRNNativeUserLocation.m +0 -1
- package/ios/MLRNOfflineModule.h +2 -2
- package/ios/MLRNOfflineModule.m +9 -9
- package/ios/MLRNPointAnnotation.h +1 -1
- package/ios/MLRNShapeSource.h +1 -1
- package/ios/MLRNSource.h +3 -1
- package/ios/MLRNStyle.m +20 -20
- package/ios/MLRNUtils.h +17 -2
- package/ios/MLRNUtils.m +25 -2
- package/ios/components/camera/CameraEasing.h +8 -0
- package/ios/{CameraStop.h → components/camera/CameraStop.h} +10 -6
- package/ios/components/camera/CameraStop.m +75 -0
- package/ios/{CameraUpdateItem.m → components/camera/CameraUpdateItem.m} +45 -46
- package/ios/components/camera/MLRNCamera.h +26 -0
- package/ios/components/camera/MLRNCamera.m +195 -0
- package/ios/components/camera/MLRNCameraComponentView.h +18 -0
- package/ios/components/camera/MLRNCameraComponentView.mm +192 -0
- package/ios/components/camera/MLRNCameraManager.h +11 -0
- package/ios/components/camera/MLRNCameraManager.m +20 -0
- package/ios/components/camera/MLRNCameraModule.h +4 -0
- package/ios/components/camera/MLRNCameraModule.mm +111 -0
- package/ios/{MLRNMapView.h → components/map-view/MLRNMapView.h} +42 -20
- package/ios/components/map-view/MLRNMapView.m +809 -0
- package/ios/components/map-view/MLRNMapViewComponentView.h +18 -0
- package/ios/components/map-view/MLRNMapViewComponentView.mm +400 -0
- package/ios/components/map-view/MLRNMapViewManager.h +70 -0
- package/ios/components/map-view/MLRNMapViewManager.m +163 -0
- package/ios/components/map-view/MLRNMapViewModule.h +4 -0
- package/ios/components/map-view/MLRNMapViewModule.mm +249 -0
- package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.mm +0 -1
- package/lib/commonjs/MLRNModule.js +1 -3
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/components/Annotation.js +1 -13
- package/lib/commonjs/components/Annotation.js.map +1 -1
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +2 -21
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +3 -26
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/components/camera/Camera.js +97 -0
- package/lib/commonjs/components/camera/Camera.js.map +1 -0
- package/lib/commonjs/components/camera/CameraNativeComponent.ts +61 -0
- package/lib/commonjs/components/camera/NativeCameraModule.js +11 -0
- package/lib/commonjs/components/camera/NativeCameraModule.js.map +1 -0
- package/lib/commonjs/components/map-view/MapView.js +115 -0
- package/lib/commonjs/components/map-view/MapView.js.map +1 -0
- package/lib/commonjs/components/map-view/MapViewNativeComponent.ts +96 -0
- package/lib/commonjs/components/map-view/NativeMapViewModule.js +9 -0
- package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +1 -0
- package/lib/commonjs/index.js +246 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js +2 -2
- package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js.map +1 -1
- package/lib/commonjs/modules/snapshot/SnapshotManager.js +3 -2
- package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/commonjs/types/Bounds.js +2 -0
- package/lib/commonjs/types/{OnPressEvent.js.map → Bounds.js.map} +1 -1
- package/lib/commonjs/types/PressEvent.js +2 -0
- package/lib/{module/types/OnPressEvent.js.map → commonjs/types/PressEvent.js.map} +1 -1
- package/lib/commonjs/types/ViewPadding.js +2 -0
- package/lib/commonjs/types/{MapLibreRNEvent.js.map → ViewPadding.js.map} +1 -1
- package/lib/commonjs/types/codegen/UnsafeMixed.js +2 -0
- package/lib/commonjs/types/codegen/UnsafeMixed.js.map +1 -0
- package/lib/commonjs/utils/index.js +0 -11
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/MLRNModule.js +0 -1
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/components/Annotation.js +2 -14
- package/lib/module/components/Annotation.js.map +1 -1
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/ShapeSource.js +3 -22
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/VectorSource.js +4 -27
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/components/camera/Camera.js +92 -0
- package/lib/module/components/camera/Camera.js.map +1 -0
- package/lib/module/components/camera/CameraNativeComponent.ts +61 -0
- package/lib/module/components/camera/NativeCameraModule.js +10 -0
- package/lib/module/components/camera/NativeCameraModule.js.map +1 -0
- package/lib/module/components/map-view/MapView.js +110 -0
- package/lib/module/components/map-view/MapView.js.map +1 -0
- package/lib/module/components/map-view/MapViewNativeComponent.ts +96 -0
- package/lib/module/components/map-view/NativeMapViewModule.js +5 -0
- package/lib/module/components/map-view/NativeMapViewModule.js.map +1 -0
- package/lib/module/index.js +30 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/snapshot/NativeSnapshotModule.js +1 -1
- package/lib/module/modules/snapshot/NativeSnapshotModule.js.map +1 -1
- package/lib/module/modules/snapshot/SnapshotManager.js +1 -1
- package/lib/module/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/module/types/Bounds.js +2 -0
- package/lib/module/types/{MapLibreRNEvent.js.map → Bounds.js.map} +1 -1
- package/lib/module/types/PressEvent.js +2 -0
- package/lib/module/types/PressEvent.js.map +1 -0
- package/lib/module/types/ViewPadding.js +2 -0
- package/lib/module/types/ViewPadding.js.map +1 -0
- package/lib/module/types/codegen/UnsafeMixed.js +2 -0
- package/lib/module/types/codegen/UnsafeMixed.js.map +1 -0
- package/lib/module/utils/index.js +0 -9
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +1 -7
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Annotation.d.ts +3 -3
- package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +2 -5
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts +3 -2
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/camera/Camera.d.ts +180 -0
- package/lib/typescript/commonjs/src/components/camera/Camera.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts +37 -0
- package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts +27 -0
- package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts +323 -0
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts +45 -0
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +41 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/Bounds.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/Bounds.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PressEvent.d.ts +16 -0
- package/lib/typescript/commonjs/src/types/PressEvent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/ViewPadding.d.ts +7 -0
- package/lib/typescript/commonjs/src/types/ViewPadding.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts +10 -0
- package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/index.d.ts +1 -3
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/MLRNModule.d.ts +1 -7
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Annotation.d.ts +3 -3
- package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Images.d.ts +1 -2
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +2 -5
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts +3 -2
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/camera/Camera.d.ts +180 -0
- package/lib/typescript/module/src/components/camera/Camera.d.ts.map +1 -0
- package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts +37 -0
- package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts +27 -0
- package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map-view/MapView.d.ts +323 -0
- package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts +45 -0
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +41 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
- package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
- package/lib/typescript/module/src/types/Bounds.d.ts +2 -0
- package/lib/typescript/module/src/types/Bounds.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PressEvent.d.ts +16 -0
- package/lib/typescript/module/src/types/PressEvent.d.ts.map +1 -0
- package/lib/typescript/module/src/types/ViewPadding.d.ts +7 -0
- package/lib/typescript/module/src/types/ViewPadding.d.ts.map +1 -0
- package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts +10 -0
- package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/index.d.ts +1 -3
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/package.json +38 -28
- package/src/MLRNModule.ts +0 -10
- package/src/components/Annotation.tsx +8 -23
- package/src/components/Images.tsx +2 -4
- package/src/components/ShapeSource.tsx +18 -31
- package/src/components/VectorSource.tsx +5 -28
- package/src/components/camera/Camera.tsx +311 -0
- package/src/components/camera/CameraNativeComponent.ts +61 -0
- package/src/components/camera/NativeCameraModule.ts +39 -0
- package/src/components/map-view/MapView.tsx +582 -0
- package/src/components/map-view/MapViewNativeComponent.ts +96 -0
- package/src/components/map-view/NativeMapViewModule.ts +83 -0
- package/src/index.ts +86 -1
- package/src/modules/snapshot/NativeSnapshotModule.ts +1 -2
- package/src/modules/snapshot/SnapshotManager.ts +1 -1
- package/src/types/Bounds.ts +1 -0
- package/src/types/PressEvent.ts +19 -0
- package/src/types/ViewPadding.ts +6 -0
- package/src/types/codegen/UnsafeMixed.ts +9 -0
- package/src/utils/index.ts +1 -14
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.java +0 -35
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.java +0 -80
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.java +0 -245
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.java +0 -121
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.java +0 -68
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +0 -519
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.java +0 -101
- package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraMode.java +0 -18
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/LayerSourceInfo.java +0 -59
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.java +0 -13
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.java +0 -27
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +0 -1521
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +0 -342
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.java +0 -37
- package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.java +0 -43
- package/android/src/main/java/org/maplibre/reactnative/events/MapUserTrackingModeEvent.java +0 -32
- package/android/src/main/java/org/maplibre/reactnative/location/UserLocationVerticalAlignment.java +0 -7
- package/android/src/main/java/org/maplibre/reactnative/location/UserTrackingMode.java +0 -59
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +0 -310
- package/ios/CameraMode.h +0 -10
- package/ios/CameraMode.m +0 -10
- package/ios/CameraStop.m +0 -73
- package/ios/MLRNCamera.h +0 -29
- package/ios/MLRNCamera.m +0 -236
- package/ios/MLRNCameraManager.h +0 -5
- package/ios/MLRNCameraManager.m +0 -39
- package/ios/MLRNMapView.m +0 -497
- package/ios/MLRNMapViewManager.h +0 -9
- package/ios/MLRNMapViewManager.m +0 -604
- package/lib/commonjs/MapLibreRN.js +0 -266
- package/lib/commonjs/MapLibreRN.js.map +0 -1
- package/lib/commonjs/components/Camera.js +0 -333
- package/lib/commonjs/components/Camera.js.map +0 -1
- package/lib/commonjs/components/MapView.js +0 -449
- package/lib/commonjs/components/MapView.js.map +0 -1
- package/lib/commonjs/hooks/useNativeRef.js +0 -14
- package/lib/commonjs/hooks/useNativeRef.js.map +0 -1
- package/lib/commonjs/types/CameraMode.js +0 -14
- package/lib/commonjs/types/CameraMode.js.map +0 -1
- package/lib/commonjs/types/MapLibreRNEvent.js +0 -6
- package/lib/commonjs/types/OnPressEvent.js +0 -2
- package/lib/module/MapLibreRN.js +0 -33
- package/lib/module/MapLibreRN.js.map +0 -1
- package/lib/module/components/Camera.js +0 -328
- package/lib/module/components/Camera.js.map +0 -1
- package/lib/module/components/MapView.js +0 -444
- package/lib/module/components/MapView.js.map +0 -1
- package/lib/module/hooks/useNativeRef.js +0 -10
- package/lib/module/hooks/useNativeRef.js.map +0 -1
- package/lib/module/types/CameraMode.js +0 -10
- package/lib/module/types/CameraMode.js.map +0 -1
- package/lib/module/types/MapLibreRNEvent.js +0 -4
- package/lib/module/types/OnPressEvent.js +0 -2
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +0 -41
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +0 -134
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +0 -223
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +0 -8
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/CameraMode.d.ts +0 -7
- package/lib/typescript/commonjs/src/types/CameraMode.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts +0 -6
- package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts +0 -12
- package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts.map +0 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +0 -41
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Camera.d.ts +0 -134
- package/lib/typescript/module/src/components/Camera.d.ts.map +0 -1
- package/lib/typescript/module/src/components/MapView.d.ts +0 -223
- package/lib/typescript/module/src/components/MapView.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts +0 -8
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +0 -1
- package/lib/typescript/module/src/types/CameraMode.d.ts +0 -7
- package/lib/typescript/module/src/types/CameraMode.d.ts.map +0 -1
- package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts +0 -6
- package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts.map +0 -1
- package/lib/typescript/module/src/types/OnPressEvent.d.ts +0 -12
- package/lib/typescript/module/src/types/OnPressEvent.d.ts.map +0 -1
- package/src/MapLibreRN.ts +0 -75
- package/src/components/Camera.tsx +0 -568
- package/src/components/MapView.tsx +0 -838
- package/src/hooks/useNativeRef.ts +0 -14
- package/src/types/CameraMode.ts +0 -6
- package/src/types/MapLibreRNEvent.ts +0 -7
- package/src/types/OnPressEvent.ts +0 -11
- /package/ios/{CameraUpdateItem.h → components/camera/CameraUpdateItem.h} +0 -0
- /package/ios/{CameraUpdateQueue.h → components/camera/CameraUpdateQueue.h} +0 -0
- /package/ios/{CameraUpdateQueue.m → components/camera/CameraUpdateQueue.m} +0 -0
- /package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.h +0 -0
package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
package org.maplibre.reactnative.components.mapview
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import android.view.View
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
9
|
+
import com.facebook.react.uimanager.LayoutShadowNode
|
|
10
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
11
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
12
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
13
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
14
|
+
import com.facebook.react.viewmanagers.MLRNMapViewManagerDelegate
|
|
15
|
+
import com.facebook.react.viewmanagers.MLRNMapViewManagerInterface
|
|
16
|
+
|
|
17
|
+
@ReactModule(name = MLRNMapViewManager.REACT_CLASS)
|
|
18
|
+
open class MLRNMapViewManager(context: ReactApplicationContext) :
|
|
19
|
+
ViewGroupManager<MLRNMapView>(context), MLRNMapViewManagerInterface<MLRNMapView> {
|
|
20
|
+
private val delegate: MLRNMapViewManagerDelegate<MLRNMapView, MLRNMapViewManager> =
|
|
21
|
+
MLRNMapViewManagerDelegate(this)
|
|
22
|
+
|
|
23
|
+
override fun getDelegate(): ViewManagerDelegate<MLRNMapView> = delegate
|
|
24
|
+
|
|
25
|
+
companion object {
|
|
26
|
+
const val REACT_CLASS: String = "MLRNMapView"
|
|
27
|
+
const val LOG_TAG: String = "MLRNMapViewManager"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun getName(): String = REACT_CLASS
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
private val mViews: MutableMap<Int?, MLRNMapView?> = HashMap()
|
|
34
|
+
|
|
35
|
+
override fun createShadowNodeInstance(): LayoutShadowNode {
|
|
36
|
+
return MapShadowNode(this)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override fun getShadowNodeClass(): Class<out LayoutShadowNode?> {
|
|
40
|
+
return MapShadowNode::class.java
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override fun onAfterUpdateTransaction(mapView: MLRNMapView) {
|
|
44
|
+
super.onAfterUpdateTransaction(mapView)
|
|
45
|
+
|
|
46
|
+
if (mapView.mapLibreMap == null) {
|
|
47
|
+
mViews.put(mapView.id, mapView)
|
|
48
|
+
mapView.init()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override fun addView(parent: MLRNMapView, child: View, index: Int) {
|
|
53
|
+
parent.addFeature(child, index)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
override fun getChildCount(parent: MLRNMapView): Int {
|
|
57
|
+
return parent.featureCount
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
override fun getChildAt(parent: MLRNMapView, index: Int): View? {
|
|
61
|
+
return parent.getFeatureAt(index).toView();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
override fun removeViewAt(parent: MLRNMapView, index: Int) {
|
|
65
|
+
parent.removeFeature(index)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
override fun createViewInstance(themedReactContext: ThemedReactContext): MLRNMapView {
|
|
69
|
+
return MLRNMapView(themedReactContext, options = null)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
override fun onDropViewInstance(mapView: MLRNMapView) {
|
|
73
|
+
val reactTag = mapView.id
|
|
74
|
+
|
|
75
|
+
if (mViews.containsKey(reactTag)) {
|
|
76
|
+
mViews.remove(reactTag)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
super.onDropViewInstance(mapView)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fun getByReactTag(reactTag: Int): MLRNMapView? {
|
|
83
|
+
return mViews[reactTag]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//region React Props
|
|
87
|
+
|
|
88
|
+
@ReactProp(name = "mapStyle")
|
|
89
|
+
override fun setMapStyle(mapView: MLRNMapView, value: String?) {
|
|
90
|
+
mapView.setReactMapStyle(value)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@ReactProp(name = "contentInset")
|
|
94
|
+
override fun setContentInset(mapView: MLRNMapView, value: ReadableMap?) {
|
|
95
|
+
mapView.setReactContentInset(value)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@ReactProp(name = "preferredFramesPerSecond")
|
|
99
|
+
override fun setPreferredFramesPerSecond(mapView: MLRNMapView, value: Int) {
|
|
100
|
+
mapView.setReactPreferredFramesPerSecond(value)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@ReactProp(name = "dragPan")
|
|
104
|
+
override fun setDragPan(mapView: MLRNMapView, value: Boolean) {
|
|
105
|
+
mapView.setReactScrollEnabled(value)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@ReactProp(name = "touchAndDoubleTapZoom")
|
|
109
|
+
override fun setTouchAndDoubleTapZoom(mapView: MLRNMapView, value: Boolean) {
|
|
110
|
+
mapView.setReactZoomEnabled(value)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@ReactProp(name = "touchRotate")
|
|
114
|
+
override fun setTouchRotate(mapView: MLRNMapView, value: Boolean) {
|
|
115
|
+
mapView.setReactRotateEnabled(value)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@ReactProp(name = "touchPitch")
|
|
119
|
+
override fun setTouchPitch(mapView: MLRNMapView, value: Boolean) {
|
|
120
|
+
mapView.setReactPitchEnabled(value)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@ReactProp(name = "tintColor")
|
|
124
|
+
override fun setTintColor(mapView: MLRNMapView, value: Int?) {
|
|
125
|
+
mapView.setReactTintColor(value)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@ReactProp(name = "attribution")
|
|
129
|
+
override fun setAttribution(mapView: MLRNMapView, value: Boolean) {
|
|
130
|
+
mapView.setReactAttribution(value)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@ReactProp(name = "attributionPosition")
|
|
134
|
+
override fun setAttributionPosition(mapView: MLRNMapView, value: ReadableMap?) {
|
|
135
|
+
mapView.setReactAttributionPosition(value)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@ReactProp(name = "logo")
|
|
139
|
+
override fun setLogo(mapView: MLRNMapView, value: Boolean) {
|
|
140
|
+
mapView.setReactLogo(value)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@ReactProp(name = "logoPosition")
|
|
144
|
+
override fun setLogoPosition(mapView: MLRNMapView, value: ReadableMap?) {
|
|
145
|
+
mapView.setReactLogoPosition(value)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@ReactProp(name = "compass")
|
|
149
|
+
override fun setCompass(mapView: MLRNMapView, value: Boolean) {
|
|
150
|
+
mapView.setReactCompass(value)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@ReactProp(name = "compassPosition")
|
|
154
|
+
override fun setCompassPosition(mapView: MLRNMapView, value: ReadableMap?) {
|
|
155
|
+
mapView.setReactCompassPosition(value)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//endregion
|
|
159
|
+
|
|
160
|
+
private class MapShadowNode(private val mViewManager: MLRNMapViewManager) : LayoutShadowNode() {
|
|
161
|
+
override fun dispose() {
|
|
162
|
+
super.dispose()
|
|
163
|
+
disposeNativeMapView()
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* We need this mapview to dispose (calls into nativeMap.destroy) before ReactNative starts
|
|
168
|
+
* tearing down the views in onDropViewInstance.
|
|
169
|
+
*/
|
|
170
|
+
fun disposeNativeMapView() {
|
|
171
|
+
val mapView = mViewManager.getByReactTag(reactTag)
|
|
172
|
+
|
|
173
|
+
if (mapView != null) {
|
|
174
|
+
UiThreadUtil.runOnUiThread {
|
|
175
|
+
try {
|
|
176
|
+
mapView.dispose()
|
|
177
|
+
} catch (ex: Exception) {
|
|
178
|
+
Log.e(
|
|
179
|
+
LOG_TAG, " disposeNativeMapView() exception destroying map view", ex
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
package org.maplibre.reactnative.components.mapview
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReadableArray
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
8
|
+
import org.maplibre.android.camera.CameraUpdateFactory.newLatLngBounds
|
|
9
|
+
import org.maplibre.android.geometry.LatLng
|
|
10
|
+
import org.maplibre.android.geometry.LatLngBounds
|
|
11
|
+
import org.maplibre.reactnative.NativeMapViewModuleSpec
|
|
12
|
+
import org.maplibre.reactnative.utils.ConvertUtils
|
|
13
|
+
import org.maplibre.reactnative.utils.ExpressionParser
|
|
14
|
+
import org.maplibre.reactnative.utils.ReactTag
|
|
15
|
+
import org.maplibre.reactnative.utils.ReactTagResolver
|
|
16
|
+
|
|
17
|
+
@ReactModule(name = NativeMapViewModuleSpec.NAME)
|
|
18
|
+
class MLRNMapViewModule(
|
|
19
|
+
reactContext: ReactApplicationContext, private val reactTagResolver: ReactTagResolver
|
|
20
|
+
) : NativeMapViewModuleSpec(reactContext) {
|
|
21
|
+
companion object {
|
|
22
|
+
const val NAME = "MLRNMapViewModule"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private fun withViewportOnUIThread(
|
|
26
|
+
reactTag: ReactTag, promise: Promise, fn: (MLRNMapView) -> Unit
|
|
27
|
+
) {
|
|
28
|
+
reactTagResolver.withViewResolved(reactTag.toInt(), promise, fn)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun getCenter(reactTag: Double, promise: Promise) {
|
|
32
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
33
|
+
promise.resolve(it.getCenter())
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun getZoom(reactTag: Double, promise: Promise) {
|
|
38
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
39
|
+
promise.resolve(it.getZoom())
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override fun getBearing(reactTag: Double, promise: Promise) {
|
|
44
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
45
|
+
promise.resolve(it.getBearing())
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override fun getPitch(reactTag: Double, promise: Promise) {
|
|
50
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
51
|
+
promise.resolve(it.getPitch())
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override fun getBounds(reactTag: Double, promise: Promise) {
|
|
56
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
57
|
+
promise.resolve(it.getBounds())
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun getViewState(reactTag: Double, promise: Promise) {
|
|
62
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
63
|
+
promise.resolve(it.getViewState())
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override fun project(
|
|
68
|
+
reactTag: Double, coordinate: ReadableMap, promise: Promise
|
|
69
|
+
) {
|
|
70
|
+
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
71
|
+
promise.resolve(
|
|
72
|
+
mapView.project(
|
|
73
|
+
LatLng(coordinate.getDouble("latitude"), coordinate.getDouble("longitude"))
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
override fun unproject(
|
|
80
|
+
reactTag: Double, point: ReadableMap, promise: Promise
|
|
81
|
+
) {
|
|
82
|
+
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
83
|
+
promise.resolve(mapView.unproject(ConvertUtils.toPointF(point)))
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
override fun queryRenderedFeaturesWithCoordinate(
|
|
88
|
+
reactTag: Double,
|
|
89
|
+
coordinate: ReadableMap,
|
|
90
|
+
layers: ReadableArray?,
|
|
91
|
+
filter: ReadableArray?,
|
|
92
|
+
promise: Promise
|
|
93
|
+
) {
|
|
94
|
+
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
95
|
+
promise.resolve(
|
|
96
|
+
mapView.queryRenderedFeaturesWithCoordinate(
|
|
97
|
+
LatLng(coordinate.getDouble("latitude"), coordinate.getDouble("longitude")),
|
|
98
|
+
layers,
|
|
99
|
+
ExpressionParser.from(filter),
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
override fun queryRenderedFeaturesWithBounds(
|
|
106
|
+
reactTag: Double,
|
|
107
|
+
bounds: ReadableArray?,
|
|
108
|
+
layers: ReadableArray?,
|
|
109
|
+
filter: ReadableArray?,
|
|
110
|
+
promise: Promise
|
|
111
|
+
) {
|
|
112
|
+
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
113
|
+
promise.resolve(
|
|
114
|
+
mapView.queryRenderedFeaturesWithBounds(
|
|
115
|
+
if (bounds != null && bounds.size() == 4)
|
|
116
|
+
LatLngBounds.from(
|
|
117
|
+
bounds.getDouble(3),
|
|
118
|
+
bounds.getDouble(2),
|
|
119
|
+
bounds.getDouble(1),
|
|
120
|
+
bounds.getDouble(0)
|
|
121
|
+
)
|
|
122
|
+
else
|
|
123
|
+
LatLngBounds.world(),
|
|
124
|
+
layers, ExpressionParser.from(filter),
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
override fun setSourceVisibility(
|
|
131
|
+
reactTag: Double,
|
|
132
|
+
visible: Boolean,
|
|
133
|
+
sourceId: String,
|
|
134
|
+
sourceLayerId: String?,
|
|
135
|
+
promise: Promise
|
|
136
|
+
) {
|
|
137
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
138
|
+
promise.resolve(it.setSourceVisibility(visible, sourceId, sourceLayerId))
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
override fun takeSnap(
|
|
143
|
+
reactTag: Double, writeToDisk: Boolean, promise: Promise
|
|
144
|
+
) {
|
|
145
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
146
|
+
it.takeSnap(writeToDisk) { payload ->
|
|
147
|
+
promise.resolve(payload)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
override fun showAttribution(
|
|
153
|
+
reactTag: Double, promise: Promise
|
|
154
|
+
) {
|
|
155
|
+
withViewportOnUIThread(reactTag, promise) {
|
|
156
|
+
promise.resolve(it.showAttribution())
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package org.maplibre.reactnative.components.mapview.helpers
|
|
2
|
+
|
|
3
|
+
class CameraChangeTracker {
|
|
4
|
+
private var reason: Int = EMPTY
|
|
5
|
+
var isAnimating: Boolean = false
|
|
6
|
+
|
|
7
|
+
fun setReason(reason: Int) {
|
|
8
|
+
this.reason = reason
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
val isUserInteraction: Boolean
|
|
12
|
+
get() = reason == USER_GESTURE || reason == DEVELOPER_ANIMATION
|
|
13
|
+
|
|
14
|
+
val isAnimated: Boolean
|
|
15
|
+
get() = reason == DEVELOPER_ANIMATION || reason == SDK_ANIMATION
|
|
16
|
+
|
|
17
|
+
val isEmpty: Boolean
|
|
18
|
+
get() = reason == EMPTY
|
|
19
|
+
|
|
20
|
+
companion object {
|
|
21
|
+
const val EMPTY: Int = -1
|
|
22
|
+
const val USER_GESTURE: Int = 1
|
|
23
|
+
const val DEVELOPER_ANIMATION: Int = 2
|
|
24
|
+
const val SDK_ANIMATION: Int = 3
|
|
25
|
+
}
|
|
26
|
+
}
|
package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
package org.maplibre.reactnative.components.mapview.helpers
|
|
2
|
+
|
|
3
|
+
import org.maplibre.android.style.layers.CircleLayer
|
|
4
|
+
import org.maplibre.android.style.layers.FillExtrusionLayer
|
|
5
|
+
import org.maplibre.android.style.layers.FillLayer
|
|
6
|
+
import org.maplibre.android.style.layers.HeatmapLayer
|
|
7
|
+
import org.maplibre.android.style.layers.HillshadeLayer
|
|
8
|
+
import org.maplibre.android.style.layers.Layer
|
|
9
|
+
import org.maplibre.android.style.layers.LineLayer
|
|
10
|
+
import org.maplibre.android.style.layers.RasterLayer
|
|
11
|
+
import org.maplibre.android.style.layers.SymbolLayer
|
|
12
|
+
|
|
13
|
+
internal class LayerSourceInfo(layer: Layer?) {
|
|
14
|
+
val sourceId: String
|
|
15
|
+
|
|
16
|
+
val sourceLayerId: String?
|
|
17
|
+
|
|
18
|
+
init {
|
|
19
|
+
when (layer) {
|
|
20
|
+
is CircleLayer -> {
|
|
21
|
+
val symbolLayer = layer
|
|
22
|
+
sourceId = symbolLayer.getSourceId()
|
|
23
|
+
sourceLayerId = symbolLayer.getSourceLayer()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
is FillExtrusionLayer -> {
|
|
27
|
+
val fillExtrusionLayer = layer
|
|
28
|
+
sourceId = fillExtrusionLayer.getSourceId()
|
|
29
|
+
sourceLayerId = fillExtrusionLayer.getSourceLayer()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
is FillLayer -> {
|
|
33
|
+
val fillLayer = layer
|
|
34
|
+
sourceId = fillLayer.getSourceId()
|
|
35
|
+
sourceLayerId = fillLayer.getSourceLayer()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
is HeatmapLayer -> {
|
|
39
|
+
val heatmapLayer = layer
|
|
40
|
+
sourceId = heatmapLayer.getSourceId()
|
|
41
|
+
sourceLayerId = heatmapLayer.getSourceLayer()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
is HillshadeLayer -> {
|
|
45
|
+
val hillshadeLayer = layer
|
|
46
|
+
sourceId = hillshadeLayer.getSourceId()
|
|
47
|
+
sourceLayerId = null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
is LineLayer -> {
|
|
51
|
+
val lineLayer = layer
|
|
52
|
+
sourceId = lineLayer.getSourceId()
|
|
53
|
+
sourceLayerId = lineLayer.getSourceLayer()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
is RasterLayer -> {
|
|
57
|
+
val rasterLayer = layer
|
|
58
|
+
sourceId = rasterLayer.getSourceId()
|
|
59
|
+
sourceLayerId = null
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
is SymbolLayer -> {
|
|
63
|
+
val symbolLayer = layer
|
|
64
|
+
sourceId = symbolLayer.getSourceId()
|
|
65
|
+
sourceLayerId = symbolLayer.getSourceLayer()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
else -> {
|
|
69
|
+
sourceId = ""
|
|
70
|
+
sourceLayerId = null
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/android/src/main/java/org/maplibre/reactnative/components/styles/layers/MLRNLayer.java
CHANGED
|
@@ -16,10 +16,6 @@ import org.maplibre.reactnative.components.AbstractMapFeature;
|
|
|
16
16
|
import org.maplibre.reactnative.components.mapview.MLRNMapView;
|
|
17
17
|
import org.maplibre.reactnative.utils.ExpressionParser;
|
|
18
18
|
|
|
19
|
-
import java.util.Arrays;
|
|
20
|
-
import java.util.HashSet;
|
|
21
|
-
import java.util.Set;
|
|
22
|
-
|
|
23
19
|
public abstract class MLRNLayer<T extends Layer> extends AbstractMapFeature {
|
|
24
20
|
public static final String LOG_TAG = "MLRNLayer";
|
|
25
21
|
|
|
@@ -240,7 +236,7 @@ public abstract class MLRNLayer<T extends Layer> extends AbstractMapFeature {
|
|
|
240
236
|
|
|
241
237
|
@Override
|
|
242
238
|
public void addToMap(MLRNMapView mapView) {
|
|
243
|
-
mMap = mapView.
|
|
239
|
+
mMap = mapView.getMapLibreMap();
|
|
244
240
|
mMapView = mapView;
|
|
245
241
|
|
|
246
242
|
if (getStyle() == null) return;
|
package/android/src/main/java/org/maplibre/reactnative/components/styles/light/MLRNLight.java
CHANGED
|
@@ -5,17 +5,12 @@ import android.content.Context;
|
|
|
5
5
|
import com.facebook.react.bridge.ReadableMap;
|
|
6
6
|
import org.maplibre.android.maps.MapLibreMap;
|
|
7
7
|
import org.maplibre.android.maps.Style;
|
|
8
|
-
import org.maplibre.android.style.layers.TransitionOptions;
|
|
9
8
|
import org.maplibre.android.style.light.Light;
|
|
10
|
-
import org.maplibre.android.style.light.Position;
|
|
11
9
|
import org.maplibre.reactnative.components.AbstractMapFeature;
|
|
12
10
|
import org.maplibre.reactnative.components.mapview.MLRNMapView;
|
|
13
11
|
import org.maplibre.reactnative.components.styles.MLRNStyle;
|
|
14
12
|
import org.maplibre.reactnative.components.styles.MLRNStyleFactory;
|
|
15
13
|
|
|
16
|
-
import java.util.HashMap;
|
|
17
|
-
import java.util.Map;
|
|
18
|
-
|
|
19
14
|
public class MLRNLight extends AbstractMapFeature {
|
|
20
15
|
private MapLibreMap mMap;
|
|
21
16
|
private ReadableMap mReactStyle;
|
|
@@ -26,7 +21,7 @@ public class MLRNLight extends AbstractMapFeature {
|
|
|
26
21
|
|
|
27
22
|
@Override
|
|
28
23
|
public void addToMap(MLRNMapView mapView) {
|
|
29
|
-
mMap = mapView.
|
|
24
|
+
mMap = mapView.getMapLibreMap();
|
|
30
25
|
setLight();
|
|
31
26
|
}
|
|
32
27
|
|
|
@@ -5,8 +5,6 @@ import android.graphics.Bitmap;
|
|
|
5
5
|
import android.graphics.drawable.BitmapDrawable;
|
|
6
6
|
import androidx.annotation.NonNull;
|
|
7
7
|
import androidx.annotation.Nullable;
|
|
8
|
-
import androidx.annotation.Size;
|
|
9
|
-
import androidx.core.content.res.ResourcesCompat;
|
|
10
8
|
|
|
11
9
|
import com.facebook.react.bridge.WritableMap;
|
|
12
10
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
@@ -17,18 +15,13 @@ import org.maplibre.android.maps.Style;
|
|
|
17
15
|
import org.maplibre.android.style.expressions.Expression;
|
|
18
16
|
import org.maplibre.android.style.sources.GeoJsonOptions;
|
|
19
17
|
import org.maplibre.android.style.sources.GeoJsonSource;
|
|
20
|
-
import org.maplibre.android.utils.BitmapUtils;
|
|
21
|
-
import org.maplibre.reactnative.R;
|
|
22
18
|
import org.maplibre.reactnative.components.mapview.MLRNMapView;
|
|
23
19
|
import org.maplibre.reactnative.events.AndroidCallbackEvent;
|
|
24
20
|
import org.maplibre.reactnative.events.FeatureClickEvent;
|
|
25
21
|
import org.maplibre.reactnative.utils.ClusterPropertyEntry;
|
|
26
|
-
import org.maplibre.reactnative.utils.DownloadMapImageTask;
|
|
27
22
|
import org.maplibre.reactnative.utils.ImageEntry;
|
|
28
23
|
|
|
29
24
|
import java.net.URL;
|
|
30
|
-
import java.util.ArrayList;
|
|
31
|
-
import java.util.Collections;
|
|
32
25
|
import java.util.List;
|
|
33
26
|
import java.util.Map;
|
|
34
27
|
|
|
@@ -61,10 +54,10 @@ public class MLRNShapeSource extends MLRNSource<GeoJsonSource> {
|
|
|
61
54
|
@Override
|
|
62
55
|
public void addToMap(final MLRNMapView mapView) {
|
|
63
56
|
// Wait for style before adding the source to the map
|
|
64
|
-
mapView.
|
|
57
|
+
mapView.getMapLibreMap().getStyle(new Style.OnStyleLoaded() {
|
|
65
58
|
@Override
|
|
66
59
|
public void onStyleLoaded(@NonNull Style style) {
|
|
67
|
-
MapLibreMap map = mapView.
|
|
60
|
+
MapLibreMap map = mapView.getMapLibreMap();
|
|
68
61
|
MLRNShapeSource.super.addToMap(mapView);
|
|
69
62
|
}
|
|
70
63
|
});
|
package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNSource.java
CHANGED
|
@@ -114,7 +114,7 @@ public abstract class MLRNSource<T extends Source> extends AbstractMapFeature {
|
|
|
114
114
|
@Override
|
|
115
115
|
public void addToMap(MLRNMapView mapView) {
|
|
116
116
|
mMapView = mapView;
|
|
117
|
-
mMap = mapView.
|
|
117
|
+
mMap = mapView.getMapLibreMap();
|
|
118
118
|
mMap.getStyle(new Style.OnStyleLoaded() {
|
|
119
119
|
public void onStyleLoaded(@NonNull Style style) {
|
|
120
120
|
T existingSource = style.getSourceAs(mID);
|
|
@@ -46,11 +46,8 @@ abstract public class AbstractEvent implements IEvent {
|
|
|
46
46
|
|
|
47
47
|
public WritableMap toJSON() {
|
|
48
48
|
WritableMap map = Arguments.createMap();
|
|
49
|
-
map.
|
|
50
|
-
|
|
51
|
-
WritableMap payloadClone = Arguments.createMap();
|
|
52
|
-
payloadClone.merge(getPayload());
|
|
53
|
-
map.putMap("payload", payloadClone);
|
|
49
|
+
map.merge(getPayload());
|
|
50
|
+
|
|
54
51
|
return map;
|
|
55
52
|
}
|
|
56
53
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package org.maplibre.reactnative.events
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.WritableMap
|
|
5
|
+
import com.facebook.react.uimanager.events.Event
|
|
6
|
+
|
|
7
|
+
class MapChangeEvent(
|
|
8
|
+
surfaceId: Int,
|
|
9
|
+
viewId: Int,
|
|
10
|
+
private val internalEventName: String,
|
|
11
|
+
private val eventData: WritableMap = Arguments.createMap()
|
|
12
|
+
) : Event<MapChangeEvent>(surfaceId, viewId) {
|
|
13
|
+
override fun getEventName() = internalEventName
|
|
14
|
+
|
|
15
|
+
override fun getEventData(): WritableMap {
|
|
16
|
+
return eventData
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
package org.maplibre.reactnative.events;
|
|
2
2
|
|
|
3
3
|
import android.graphics.PointF;
|
|
4
|
+
|
|
4
5
|
import androidx.annotation.NonNull;
|
|
6
|
+
|
|
5
7
|
import android.view.View;
|
|
6
8
|
|
|
7
9
|
import com.facebook.react.bridge.WritableMap;
|
|
8
10
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
11
|
+
|
|
9
12
|
import org.maplibre.android.geometry.LatLng;
|
|
10
13
|
|
|
11
14
|
import org.maplibre.reactnative.events.constants.EventKeys;
|
|
12
15
|
import org.maplibre.reactnative.events.constants.EventTypes;
|
|
13
16
|
import org.maplibre.reactnative.utils.GeoJSONUtils;
|
|
14
17
|
|
|
18
|
+
// TODO: Remove
|
|
15
19
|
public class MapClickEvent extends AbstractEvent {
|
|
16
20
|
private LatLng mTouchedLatLng;
|
|
17
21
|
private PointF mScreenPoint;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package org.maplibre.reactnative.events
|
|
2
|
+
|
|
3
|
+
import android.graphics.PointF
|
|
4
|
+
import com.facebook.react.bridge.Arguments
|
|
5
|
+
import com.facebook.react.bridge.WritableMap
|
|
6
|
+
import com.facebook.react.uimanager.events.Event
|
|
7
|
+
import org.maplibre.android.geometry.LatLng
|
|
8
|
+
|
|
9
|
+
class MapPressEvent(
|
|
10
|
+
surfaceId: Int,
|
|
11
|
+
viewId: Int,
|
|
12
|
+
private val internalEventName: String,
|
|
13
|
+
private val latLng: LatLng,
|
|
14
|
+
private val screenPoint: PointF,
|
|
15
|
+
|
|
16
|
+
) : Event<MapPressEvent>(surfaceId, viewId) {
|
|
17
|
+
override fun getEventName() = internalEventName
|
|
18
|
+
|
|
19
|
+
override fun getEventData(): WritableMap {
|
|
20
|
+
return Arguments.createMap().apply {
|
|
21
|
+
putDouble("longitude", latLng.longitude)
|
|
22
|
+
putDouble("latitude", latLng.latitude)
|
|
23
|
+
putDouble("locationX", screenPoint.x.toDouble())
|
|
24
|
+
putDouble("locationY", screenPoint.y.toDouble())
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package org.maplibre.reactnative.events
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.facebook.react.bridge.Arguments
|
|
5
|
+
import com.facebook.react.bridge.WritableMap
|
|
6
|
+
import com.facebook.react.uimanager.events.Event
|
|
7
|
+
import org.maplibre.reactnative.events.constants.EventKeys
|
|
8
|
+
import org.maplibre.reactnative.events.constants.EventTypes
|
|
9
|
+
import org.maplibre.reactnative.location.TrackUserLocationMode
|
|
10
|
+
|
|
11
|
+
class TrackUserLocationChangeEvent(
|
|
12
|
+
surfaceId: Int,
|
|
13
|
+
viewId: Int,
|
|
14
|
+
private val trackUserLocationMode: Int
|
|
15
|
+
) :
|
|
16
|
+
Event<TrackUserLocationChangeEvent>(surfaceId, viewId) {
|
|
17
|
+
override fun getEventName() = "onTrackUserLocationChange"
|
|
18
|
+
|
|
19
|
+
override fun getEventData(): WritableMap? {
|
|
20
|
+
return Arguments.createMap().apply {
|
|
21
|
+
putString("trackUserLocation", TrackUserLocationMode.toString(trackUserLocationMode))
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -9,7 +9,6 @@ public class EventKeys {
|
|
|
9
9
|
public static final String MAP_ONCHANGE = ns("map.change");
|
|
10
10
|
public static final String MAP_ON_LOCATION_CHANGE = ns("map.location.change");
|
|
11
11
|
public static final String MAP_ANDROID_CALLBACK = ns("map.androidcallback");
|
|
12
|
-
public static final String MAP_USER_TRACKING_MODE_CHANGE = ns("map.usertrackingmodechange");
|
|
13
12
|
|
|
14
13
|
// point annotation events
|
|
15
14
|
public static final String POINT_ANNOTATION_SELECTED = ns("pointannotation.selected");
|