@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
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
package org.maplibre.reactnative.utils;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Arguments;
|
|
4
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
5
|
-
import com.facebook.react.bridge.WritableArray;
|
|
6
|
-
import com.facebook.react.bridge.WritableMap;
|
|
7
|
-
import com.facebook.react.bridge.WritableNativeArray;
|
|
8
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
9
|
-
import com.google.gson.JsonObject;
|
|
10
|
-
|
|
11
|
-
import org.maplibre.geojson.Feature;
|
|
12
|
-
import org.maplibre.geojson.FeatureCollection;
|
|
13
|
-
import org.maplibre.geojson.Geometry;
|
|
14
|
-
import org.maplibre.geojson.GeometryCollection;
|
|
15
|
-
import org.maplibre.geojson.MultiLineString;
|
|
16
|
-
import org.maplibre.geojson.LineString;
|
|
17
|
-
import org.maplibre.geojson.MultiPoint;
|
|
18
|
-
import org.maplibre.geojson.Point;
|
|
19
|
-
import org.maplibre.geojson.MultiPolygon;
|
|
20
|
-
import org.maplibre.geojson.Polygon;
|
|
21
|
-
import org.maplibre.android.geometry.LatLng;
|
|
22
|
-
import org.maplibre.android.geometry.LatLngBounds;
|
|
23
|
-
import org.maplibre.android.geometry.LatLngQuad;
|
|
24
|
-
import org.maplibre.android.log.Logger;
|
|
25
|
-
import org.maplibre.turf.TurfMeasurement;
|
|
26
|
-
|
|
27
|
-
import java.util.ArrayList;
|
|
28
|
-
import java.util.List;
|
|
29
|
-
import java.util.stream.Collectors;
|
|
30
|
-
|
|
31
|
-
public class GeoJSONUtils {
|
|
32
|
-
public static final String LOG_TAG = "GeoJSONUtils";
|
|
33
|
-
|
|
34
|
-
public static WritableMap fromFeature(Feature feature) {
|
|
35
|
-
WritableMap map = Arguments.createMap();
|
|
36
|
-
map.putString("type", "Feature");
|
|
37
|
-
map.putString("id", feature.id());
|
|
38
|
-
|
|
39
|
-
Geometry geometry = feature.geometry();
|
|
40
|
-
if (geometry == null) {
|
|
41
|
-
map.putNull("geometry");
|
|
42
|
-
} else {
|
|
43
|
-
map.putMap("geometry", fromGeometry(geometry));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
JsonObject properties = feature.properties();
|
|
47
|
-
if(properties == null) {
|
|
48
|
-
map.putNull("properties");
|
|
49
|
-
} else {
|
|
50
|
-
map.putMap("properties", ConvertUtils.toWritableMap(properties));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return map;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public static WritableMap fromGeometry(Geometry geometry) {
|
|
57
|
-
final String type = geometry.type();
|
|
58
|
-
|
|
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
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public static WritableMap fromPoint(Point point) {
|
|
76
|
-
WritableMap map = Arguments.createMap();
|
|
77
|
-
map.putString("type", "Point");
|
|
78
|
-
map.putArray("coordinates", getCoordinates(point));
|
|
79
|
-
return map;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public static WritableMap fromLineString(LineString lineString) {
|
|
83
|
-
WritableMap map = Arguments.createMap();
|
|
84
|
-
map.putString("type", "LineString");
|
|
85
|
-
map.putArray("coordinates", getCoordinates(lineString));
|
|
86
|
-
return map;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public static WritableMap fromPolygon(Polygon polygon) {
|
|
90
|
-
WritableMap map = Arguments.createMap();
|
|
91
|
-
map.putString("type", "Polygon");
|
|
92
|
-
map.putArray("coordinates", getCoordinates(polygon));
|
|
93
|
-
return map;
|
|
94
|
-
}
|
|
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
|
-
|
|
134
|
-
public static WritableArray getCoordinates(Point point) {
|
|
135
|
-
return Arguments.fromArray(pointToDoubleArray(point));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
public static WritableArray getCoordinates(LineString lineString) {
|
|
139
|
-
WritableArray array = Arguments.createArray();
|
|
140
|
-
|
|
141
|
-
List<Point> points = lineString.coordinates();
|
|
142
|
-
for (Point point : points) {
|
|
143
|
-
array.pushArray(Arguments.fromArray(pointToDoubleArray(point)));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return array;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
public static WritableArray getCoordinates(Polygon polygon) {
|
|
150
|
-
WritableArray array = Arguments.createArray();
|
|
151
|
-
|
|
152
|
-
List<List<Point>> points = polygon.coordinates();
|
|
153
|
-
|
|
154
|
-
for (List<Point> curPoint : points) {
|
|
155
|
-
WritableArray innerArray = Arguments.createArray();
|
|
156
|
-
|
|
157
|
-
for (Point point : curPoint) {
|
|
158
|
-
innerArray.pushArray(Arguments.fromArray(pointToDoubleArray(point)));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
array.pushArray(innerArray);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return array;
|
|
165
|
-
}
|
|
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
|
-
|
|
218
|
-
public static WritableMap toPointFeature(LatLng latLng, WritableMap properties) {
|
|
219
|
-
WritableMap map = new WritableNativeMap();
|
|
220
|
-
map.putString("type", "Feature");
|
|
221
|
-
map.putMap("geometry", toPointGeometry(latLng));
|
|
222
|
-
map.putMap("properties", properties);
|
|
223
|
-
return map;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
public static WritableMap toPointGeometry(LatLng latLng) {
|
|
227
|
-
WritableMap geometry = new WritableNativeMap();
|
|
228
|
-
geometry.putString("type", "Point");
|
|
229
|
-
geometry.putArray("coordinates", fromLatLng(latLng));
|
|
230
|
-
return geometry;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
public static WritableArray fromLatLng(LatLng latLng) {
|
|
234
|
-
double[] coords = new double[]{ latLng.getLongitude(), latLng.getLatitude() };
|
|
235
|
-
WritableArray writableCoords = new WritableNativeArray();
|
|
236
|
-
writableCoords.pushDouble(coords[0]);
|
|
237
|
-
writableCoords.pushDouble(coords[1]);
|
|
238
|
-
return writableCoords;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
public static LatLng toLatLng(Point point) {
|
|
242
|
-
if (point == null) {
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
return new LatLng(point.latitude(), point.longitude());
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
public static LatLng toLatLng(ReadableArray coordinates) {
|
|
249
|
-
if (coordinates == null || coordinates.size() < 2) {
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
return new LatLng(coordinates.getDouble(1), coordinates.getDouble(0));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
public static Point toPointGeometry(String featureJSONString) {
|
|
256
|
-
Feature feature = Feature.fromJson(featureJSONString);
|
|
257
|
-
if (feature == null) {
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
return (Point)feature.geometry();
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
public static WritableArray fromLatLngBounds(LatLngBounds latLngBounds) {
|
|
264
|
-
WritableArray array = Arguments.createArray();
|
|
265
|
-
|
|
266
|
-
LatLng[] latLngs = latLngBounds.toLatLngs();
|
|
267
|
-
for (LatLng latLng : latLngs) {
|
|
268
|
-
array.pushArray(fromLatLng(latLng));
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return array;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private static GeometryCollection toGeometryCollection(List<Feature> features) {
|
|
275
|
-
ArrayList<Geometry> geometries = new ArrayList<>();
|
|
276
|
-
geometries.ensureCapacity(features.size());
|
|
277
|
-
for (Feature feature : features) {
|
|
278
|
-
geometries.add(feature.geometry());
|
|
279
|
-
}
|
|
280
|
-
return GeometryCollection.fromGeometries(geometries);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
public static LatLngBounds toLatLngBounds(FeatureCollection featureCollection) {
|
|
284
|
-
List<Feature> features = featureCollection.features();
|
|
285
|
-
|
|
286
|
-
double[] bbox = TurfMeasurement.bbox(toGeometryCollection(features));
|
|
287
|
-
|
|
288
|
-
return LatLngBounds.from(bbox[3], bbox[2], bbox[1], bbox[0]);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
public static LatLngQuad toLatLngQuad(ReadableArray array) {
|
|
292
|
-
// [top left, top right, bottom right, bottom left]
|
|
293
|
-
if (array == null || array.size() < 4) {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
return new LatLngQuad(
|
|
297
|
-
toLatLng(array.getArray(0)),
|
|
298
|
-
toLatLng(array.getArray(1)),
|
|
299
|
-
toLatLng(array.getArray(2)),
|
|
300
|
-
toLatLng(array.getArray(3))
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
public static double[] pointToDoubleArray(Point point) {
|
|
305
|
-
if (point == null) {
|
|
306
|
-
return new double[] { 0.0, 0.0 };
|
|
307
|
-
}
|
|
308
|
-
return new double[] { point.longitude(), point.latitude() };
|
|
309
|
-
}
|
|
310
|
-
}
|
package/ios/CameraMode.h
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
|
-
@interface CameraMode : NSObject
|
|
4
|
-
|
|
5
|
-
extern int const RCT_MAPBOX_CAMERA_MODE_FLIGHT;
|
|
6
|
-
extern int const RCT_MAPBOX_CAMERA_MODE_EASE;
|
|
7
|
-
extern int const RCT_MAPBOX_CAMERA_MODE_LINEAR;
|
|
8
|
-
extern int const RCT_MAPBOX_CAMERA_MODE_NONE;
|
|
9
|
-
|
|
10
|
-
@end
|
package/ios/CameraMode.m
DELETED
package/ios/CameraStop.m
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#import "CameraStop.h"
|
|
2
|
-
#import "CameraMode.h"
|
|
3
|
-
#import "MLRNCamera.h"
|
|
4
|
-
#import "MLRNUtils.h"
|
|
5
|
-
|
|
6
|
-
@implementation CameraStop
|
|
7
|
-
|
|
8
|
-
- (void)setMode:(NSNumber *)mode {
|
|
9
|
-
int modeInt = [mode intValue];
|
|
10
|
-
|
|
11
|
-
if (modeInt == RCT_MAPBOX_CAMERA_MODE_FLIGHT) {
|
|
12
|
-
_mode = [NSNumber numberWithInt:modeInt];
|
|
13
|
-
} else if (modeInt == RCT_MAPBOX_CAMERA_MODE_NONE) {
|
|
14
|
-
_mode = [NSNumber numberWithInt:modeInt];
|
|
15
|
-
} else if (modeInt == RCT_MAPBOX_CAMERA_MODE_LINEAR) {
|
|
16
|
-
_mode = [NSNumber numberWithInt:modeInt];
|
|
17
|
-
} else {
|
|
18
|
-
_mode = [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_EASE];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
- (id)init {
|
|
23
|
-
if (self = [super init]) {
|
|
24
|
-
self.coordinate = kCLLocationCoordinate2DInvalid;
|
|
25
|
-
self.bounds =
|
|
26
|
-
MLNCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
|
|
27
|
-
}
|
|
28
|
-
return self;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
+ (CameraStop *)fromDictionary:(NSDictionary *)args {
|
|
32
|
-
CameraStop *stop = [[CameraStop alloc] init];
|
|
33
|
-
|
|
34
|
-
if (args[@"pitch"]) {
|
|
35
|
-
stop.pitch = args[@"pitch"];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (args[@"heading"]) {
|
|
39
|
-
stop.heading = args[@"heading"];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (args[@"centerCoordinate"]) {
|
|
43
|
-
stop.coordinate = [MLRNUtils fromFeature:args[@"centerCoordinate"]];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (args[@"zoom"]) {
|
|
47
|
-
stop.zoom = args[@"zoom"];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (args[@"mode"]) {
|
|
51
|
-
stop.mode = args[@"mode"];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (args[@"bounds"]) {
|
|
55
|
-
stop.bounds = [MLRNUtils fromFeatureCollection:args[@"bounds"]];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
CGFloat paddingTop = args[@"paddingTop"] ? [args[@"paddingTop"] floatValue] : 0.0;
|
|
59
|
-
CGFloat paddingRight = args[@"paddingRight"] ? [args[@"paddingRight"] floatValue] : 0.0;
|
|
60
|
-
CGFloat paddingBottom = args[@"paddingBottom"] ? [args[@"paddingBottom"] floatValue] : 0.0;
|
|
61
|
-
CGFloat paddingLeft = args[@"paddingLeft"] ? [args[@"paddingLeft"] floatValue] : 0.0;
|
|
62
|
-
stop.padding = UIEdgeInsetsMake(paddingTop, paddingLeft, paddingBottom, paddingRight);
|
|
63
|
-
|
|
64
|
-
NSTimeInterval duration = 2.0;
|
|
65
|
-
if (args[@"duration"]) {
|
|
66
|
-
duration = [MLRNUtils fromMS:args[@"duration"]];
|
|
67
|
-
}
|
|
68
|
-
stop.duration = duration;
|
|
69
|
-
|
|
70
|
-
return stop;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@end
|
package/ios/MLRNCamera.h
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#import <React/RCTComponent.h>
|
|
2
|
-
#import <UIKit/UIKit.h>
|
|
3
|
-
#import "MLRNMapView.h"
|
|
4
|
-
|
|
5
|
-
@class MLRNMapView;
|
|
6
|
-
|
|
7
|
-
@interface MLRNCamera : UIView <MLRNMapViewCamera>
|
|
8
|
-
|
|
9
|
-
@property (nonatomic, strong) NSDictionary<NSString *, id> *stop;
|
|
10
|
-
@property (nonatomic, strong) NSDictionary<NSString *, id> *defaultStop;
|
|
11
|
-
@property (nonatomic, strong) MLRNMapView *map;
|
|
12
|
-
|
|
13
|
-
@property (nonatomic, assign) BOOL followUserLocation;
|
|
14
|
-
@property (nonatomic, copy) NSString *followUserMode;
|
|
15
|
-
@property (nonatomic, copy) NSNumber *followZoomLevel;
|
|
16
|
-
@property (nonatomic, copy) NSNumber *followPitch;
|
|
17
|
-
@property (nonatomic, copy) NSNumber *followHeading;
|
|
18
|
-
|
|
19
|
-
@property (nonatomic, copy) NSNumber *maxZoomLevel;
|
|
20
|
-
@property (nonatomic, copy) NSNumber *minZoomLevel;
|
|
21
|
-
|
|
22
|
-
@property (nonatomic, copy) NSString *maxBounds;
|
|
23
|
-
|
|
24
|
-
@property (nonatomic, copy) NSString *alignment;
|
|
25
|
-
@property (nonatomic, copy, readonly) NSNumber *cameraAnimationMode;
|
|
26
|
-
|
|
27
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onUserTrackingModeChange;
|
|
28
|
-
|
|
29
|
-
@end
|
package/ios/MLRNCamera.m
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
#import "MLRNCamera.h"
|
|
2
|
-
#import "CameraMode.h"
|
|
3
|
-
#import "CameraStop.h"
|
|
4
|
-
#import "CameraUpdateQueue.h"
|
|
5
|
-
#import "MLRNEvent.h"
|
|
6
|
-
#import "MLRNEventTypes.h"
|
|
7
|
-
#import "MLRNLocation.h"
|
|
8
|
-
#import "MLRNLocationManager.h"
|
|
9
|
-
#import "MLRNUtils.h"
|
|
10
|
-
|
|
11
|
-
@implementation MLRNCamera {
|
|
12
|
-
CameraUpdateQueue *cameraUpdateQueue;
|
|
13
|
-
MLRNCamera *followCamera;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
- (instancetype)init {
|
|
17
|
-
if (self = [super init]) {
|
|
18
|
-
cameraUpdateQueue = [[CameraUpdateQueue alloc] init];
|
|
19
|
-
}
|
|
20
|
-
return self;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
- (void)dealloc {
|
|
24
|
-
if (_map) {
|
|
25
|
-
_map.reactCamera = nil;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
- (void)setMaxZoomLevel:(NSNumber *)maxZoomLevel {
|
|
30
|
-
_maxZoomLevel = maxZoomLevel;
|
|
31
|
-
[self _updateMinMaxZoomLevel];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
- (void)setMinZoomLevel:(NSNumber *)minZoomLevel {
|
|
35
|
-
_minZoomLevel = minZoomLevel;
|
|
36
|
-
[self _updateMinMaxZoomLevel];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
- (void)setMaxBounds:(NSString *)maxBounds {
|
|
40
|
-
_maxBounds = maxBounds;
|
|
41
|
-
[self _updateMaxBounds];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
- (void)setDefaultStop:(NSDictionary<NSString *, id> *)stop {
|
|
45
|
-
_defaultStop = stop;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
- (void)setStop:(NSDictionary<NSString *, id> *)stop {
|
|
49
|
-
_stop = stop;
|
|
50
|
-
|
|
51
|
-
[self _updateCamera];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
- (void)setMap:(MLRNMapView *)map {
|
|
55
|
-
if (_map != nil) {
|
|
56
|
-
_map.reactCamera = nil;
|
|
57
|
-
}
|
|
58
|
-
_map = map;
|
|
59
|
-
_map.reactCamera = self;
|
|
60
|
-
|
|
61
|
-
[self _setInitialCamera];
|
|
62
|
-
[self _updateMinMaxZoomLevel];
|
|
63
|
-
[self _updateMaxBounds];
|
|
64
|
-
[self _updateCamera];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
- (void)setFollowUserLocation:(BOOL)followUserLocation {
|
|
68
|
-
_followUserLocation = followUserLocation;
|
|
69
|
-
[self _updateCameraFromTrackingMode];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
- (void)setFollowUserMode:(NSString *)followUserMode {
|
|
73
|
-
_followUserMode = followUserMode;
|
|
74
|
-
[self _updateCameraFromTrackingMode];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
- (void)setFollowPitch:(NSNumber *)followPitch {
|
|
78
|
-
_followPitch = followPitch;
|
|
79
|
-
[self _updateCameraFromTrackingMode];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
- (void)setFollowZoomLevel:(NSNumber *)followZoomLevel {
|
|
83
|
-
_followZoomLevel = followZoomLevel;
|
|
84
|
-
[self _updateCameraFromTrackingMode];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
- (void)setFollowHeading:(NSNumber *)followHeading {
|
|
88
|
-
_followHeading = followHeading;
|
|
89
|
-
[self _updateCameraFromTrackingMode];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
- (void)_updateCameraFromJavascript {
|
|
93
|
-
if (_stop == nil) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (_followUserLocation) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (_map != nil && _map.userTrackingMode != MLNUserTrackingModeNone) {
|
|
102
|
-
_map.userTrackingMode = MLNUserTrackingModeNone;
|
|
103
|
-
}
|
|
104
|
-
if (_stop[@"stops"]) {
|
|
105
|
-
NSArray *stops = _stop[@"stops"];
|
|
106
|
-
for (NSDictionary *stop in stops) {
|
|
107
|
-
[cameraUpdateQueue enqueue:[CameraStop fromDictionary:stop]];
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
[cameraUpdateQueue enqueue:[CameraStop fromDictionary:_stop]];
|
|
111
|
-
}
|
|
112
|
-
[cameraUpdateQueue execute:_map];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
- (void)_setInitialCamera {
|
|
116
|
-
if (!_defaultStop) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
CameraStop *stop = [CameraStop fromDictionary:_defaultStop];
|
|
121
|
-
stop.duration = 0;
|
|
122
|
-
stop.mode = [NSNumber numberWithInt:RCT_MAPBOX_CAMERA_MODE_NONE];
|
|
123
|
-
CameraUpdateItem *item = [[CameraUpdateItem alloc] init];
|
|
124
|
-
item.cameraStop = stop;
|
|
125
|
-
[item execute:_map
|
|
126
|
-
withCompletionHandler:^{
|
|
127
|
-
}];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
- (void)_updateCamera {
|
|
131
|
-
if (_map != nil) {
|
|
132
|
-
if (_followUserLocation) {
|
|
133
|
-
[self _updateCameraFromTrackingMode];
|
|
134
|
-
} else {
|
|
135
|
-
[self _updateCameraFromJavascript];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
- (void)_updateMinMaxZoomLevel {
|
|
141
|
-
if (_map != nil) {
|
|
142
|
-
if (_maxZoomLevel) {
|
|
143
|
-
_map.maximumZoomLevel = [_maxZoomLevel doubleValue];
|
|
144
|
-
}
|
|
145
|
-
if (_minZoomLevel) {
|
|
146
|
-
_map.minimumZoomLevel = [_minZoomLevel doubleValue];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
- (void)_updateMaxBounds {
|
|
152
|
-
if (_map != nil) {
|
|
153
|
-
if (_maxBounds) {
|
|
154
|
-
_map.maxBounds = [MLRNUtils fromFeatureCollection:_maxBounds];
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
- (void)_updateCameraFromTrackingMode {
|
|
160
|
-
if (_map == nil) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (!_followUserLocation) {
|
|
164
|
-
_map.userTrackingMode = MLNUserTrackingModeNone;
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
MLNMapCamera *camera = _map.camera;
|
|
169
|
-
if (_followPitch != nil && [_followPitch floatValue] >= 0.0) {
|
|
170
|
-
camera.pitch = [_followPitch floatValue];
|
|
171
|
-
} else if (_stop != nil && _stop[@"pitch"] != nil) {
|
|
172
|
-
camera.pitch = [_stop[@"pitch"] floatValue];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if ([self _userTrackingMode] != MLNUserTrackingModeFollowWithCourse &&
|
|
176
|
-
[self _userTrackingMode] != MLNUserTrackingModeFollowWithHeading) {
|
|
177
|
-
if (_followHeading != nil && [_followHeading floatValue] >= 0.0) {
|
|
178
|
-
camera.heading = [_followHeading floatValue];
|
|
179
|
-
} else if (_stop != nil && _stop[@"heading"] != nil) {
|
|
180
|
-
camera.heading = [_stop[@"heading"] floatValue];
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (_followZoomLevel != nil && [_followZoomLevel doubleValue] >= 0.0) {
|
|
185
|
-
camera.altitude = [_map altitudeFromZoom:[_followZoomLevel doubleValue]];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
[_map setCamera:camera animated:NO];
|
|
189
|
-
|
|
190
|
-
if (_map.userTrackingMode != [self _userTrackingMode]) {
|
|
191
|
-
_map.userTrackingMode = [self _userTrackingMode];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
- (NSUInteger)_userTrackingMode {
|
|
196
|
-
if ([_followUserMode isEqualToString:@"compass"]) {
|
|
197
|
-
return MLNUserTrackingModeFollowWithHeading;
|
|
198
|
-
} else if ([_followUserMode isEqualToString:@"course"]) {
|
|
199
|
-
return MLNUserTrackingModeFollowWithCourse;
|
|
200
|
-
} else if (_followUserLocation) {
|
|
201
|
-
return MLNUserTrackingModeFollow;
|
|
202
|
-
} else {
|
|
203
|
-
return MLNUserTrackingModeNone;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
- (id)_trackingModeToString:(MLNUserTrackingMode)mode {
|
|
208
|
-
switch (mode) {
|
|
209
|
-
case MLNUserTrackingModeFollowWithHeading:
|
|
210
|
-
return @"compass";
|
|
211
|
-
case MLNUserTrackingModeFollowWithCourse:
|
|
212
|
-
return @"course";
|
|
213
|
-
case MLNUserTrackingModeFollow:
|
|
214
|
-
return @"normal";
|
|
215
|
-
case MLNUserTrackingModeNone:
|
|
216
|
-
return [NSNull null];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
- (void)initialLayout {
|
|
221
|
-
[self _setInitialCamera];
|
|
222
|
-
[self _updateCamera];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
- (void)didChangeUserTrackingMode:(MLNUserTrackingMode)mode animated:(BOOL)animated {
|
|
226
|
-
NSDictionary *payload = @{
|
|
227
|
-
@"followUserMode" : [self _trackingModeToString:mode],
|
|
228
|
-
@"followUserLocation" : @((BOOL)(mode != MLNUserTrackingModeNone))
|
|
229
|
-
};
|
|
230
|
-
MLRNEvent *event = [MLRNEvent makeEvent:RCT_MAPBOX_USER_TRACKING_MODE_CHANGE withPayload:payload];
|
|
231
|
-
if (_onUserTrackingModeChange) {
|
|
232
|
-
_onUserTrackingModeChange([event toJSON]);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
@end
|