expo-gaode-map 0.1.0 → 0.1.2
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/ExpoSmartrefreshlayoutModule.swift +119 -0
- package/README.md +35 -496
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +7 -8
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +9 -1
- package/android/src/main/java/expo/modules/gaodemap/managers/CameraManager.kt +14 -0
- package/android/src/main/java/expo/modules/gaodemap/managers/OverlayManager.kt +11 -45
- package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +111 -9
- package/android/src/main/java/expo/modules/gaodemap/utils/ColorParser.kt +48 -0
- package/build/components/overlays/Polyline.d.ts.map +1 -1
- package/build/components/overlays/Polyline.js +10 -17
- package/build/components/overlays/Polyline.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/modules/AMapSDK.d.ts +0 -6
- package/build/modules/AMapSDK.d.ts.map +1 -1
- package/build/modules/AMapSDK.js +2 -11
- package/build/modules/AMapSDK.js.map +1 -1
- package/build/types/map-view.types.d.ts +27 -5
- package/build/types/map-view.types.d.ts.map +1 -1
- package/build/types/map-view.types.js.map +1 -1
- package/docs/API.md +248 -0
- package/docs/EXAMPLES.md +479 -0
- package/ios/ColorParser.swift +158 -0
- package/ios/ExpoGaodeMap.podspec +1 -0
- package/ios/ExpoGaodeMapModule.swift +445 -42
- package/ios/ExpoGaodeMapView.swift +278 -32
- package/ios/UIColorExtension.swift +11 -0
- package/ios/managers/CameraManager.swift +107 -0
- package/ios/managers/OverlayManager.swift +210 -0
- package/ios/managers/UIManager.swift +163 -0
- package/ios/modules/LocationManager.swift +144 -0
- package/ios/overlays/CircleView.swift +76 -0
- package/ios/overlays/ClusterView.swift +56 -0
- package/ios/overlays/HeatMapView.swift +98 -0
- package/ios/overlays/MarkerView.swift +81 -0
- package/ios/overlays/MultiPointView.swift +50 -0
- package/ios/overlays/PolygonView.swift +70 -0
- package/ios/overlays/PolylineView.swift +62 -0
- package/lib/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/lib/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/lib/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/lib/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/lib/android/.gradle/8.9/gc.properties +0 -0
- package/lib/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/lib/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/lib/android/.gradle/vcs-1/gc.properties +0 -0
- package/lib/android/build/.transforms/7df4812a1bb640a0eb92904b45f433ca/results.bin +1 -0
- package/lib/android/build/.transforms/7df4812a1bb640a0eb92904b45f433ca/transformed/classes/classes_dex/classes.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/results.bin +1 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/AMap3DPackage.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/BuildConfig.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/UtilsKt$fetchImage$request$1$1.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/UtilsKt.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/Circle.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/CircleManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/HeatMap.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/HeatMapManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapView$7.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapView$8.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapView$animateCallback$1.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapView.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapViewManager$commands$1.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapViewManager$commands$2.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MapViewManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/Marker$setIcon$1.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/Marker.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MarkerManager$Companion.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MarkerManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MultiPoint$setIcon$1.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MultiPoint.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/MultiPointManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/Overlay.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/Polygon.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/PolygonManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/Polyline.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/map_view/PolylineManager.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/debug_dex/qiuxiang/amap3d/modules/SdkModule.dex +0 -0
- package/lib/android/build/.transforms/d6c91342f3c8bae4ed26783459def84b/transformed/debug/desugar_graph.bin +0 -0
- package/lib/android/build/generated/source/buildConfig/debug/qiuxiang/amap3d/BuildConfig.java +10 -0
- package/lib/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +14 -0
- package/lib/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
- package/lib/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +6 -0
- package/lib/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/lib/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/lib/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/lib/android/build/intermediates/compile_symbol_list/debug/R.txt +1 -0
- package/lib/android/build/intermediates/compiled_local_resources/debug/out/drawable-hdpi-v4_positio_icon.png.flat +0 -0
- package/lib/android/build/intermediates/compiled_local_resources/debug/out/drawable-mdpi-v4_positio_icon.png.flat +0 -0
- package/lib/android/build/intermediates/compiled_local_resources/debug/out/drawable-xhdpi-v4_positio_icon.png.flat +0 -0
- package/lib/android/build/intermediates/compiled_local_resources/debug/out/drawable-xxhdpi-v4_positio_icon.png.flat +0 -0
- package/lib/android/build/intermediates/compiled_local_resources/debug/out/drawable-xxxhdpi-v4_positio_icon.png.flat +0 -0
- package/lib/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +6 -0
- package/lib/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/lib/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/lib/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/lib/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/lib/android/build/intermediates/java_res/debug/out/META-INF/react-native-amap3d_debug.kotlin_module +0 -0
- package/lib/android/build/intermediates/javac/debug/classes/qiuxiang/amap3d/BuildConfig.class +0 -0
- package/lib/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +3 -0
- package/lib/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +26 -0
- package/lib/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +14 -0
- package/lib/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
- package/lib/android/build/intermediates/packaged_res/debug/drawable-hdpi-v4/positio_icon.png +0 -0
- package/lib/android/build/intermediates/packaged_res/debug/drawable-mdpi-v4/positio_icon.png +0 -0
- package/lib/android/build/intermediates/packaged_res/debug/drawable-xhdpi-v4/positio_icon.png +0 -0
- package/lib/android/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/positio_icon.png +0 -0
- package/lib/android/build/intermediates/packaged_res/debug/drawable-xxxhdpi-v4/positio_icon.png +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/META-INF/react-native-amap3d_debug.kotlin_module +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/AMap3DPackage.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/BuildConfig.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/UtilsKt$fetchImage$request$1$1.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/UtilsKt.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/Circle.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/CircleManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/HeatMap.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/HeatMapManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapView$7.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapView$8.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapView$animateCallback$1.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapView.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapViewManager$commands$1.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapViewManager$commands$2.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MapViewManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/Marker$setIcon$1.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/Marker.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MarkerManager$Companion.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MarkerManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MultiPoint$setIcon$1.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MultiPoint.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/MultiPointManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/Overlay.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/Polygon.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/PolygonManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/Polyline.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/map_view/PolylineManager.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_dir/debug/qiuxiang/amap3d/modules/SdkModule.class +0 -0
- package/lib/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/lib/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +2 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.s +1 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/lib/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/lib/android/build/outputs/logs/manifest-merger-debug-report.txt +41 -0
- package/lib/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/META-INF/react-native-amap3d_debug.kotlin_module +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/AMap3DPackage.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/UtilsKt$fetchImage$request$1$1.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/UtilsKt.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/Circle.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/CircleManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/HeatMap.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/HeatMapManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapView$7.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapView$8.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapView$animateCallback$1.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapView.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapViewManager$commands$1.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapViewManager$commands$2.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MapViewManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/Marker$setIcon$1.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/Marker.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MarkerManager$Companion.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MarkerManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MultiPoint$setIcon$1.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MultiPoint.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/MultiPointManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/Overlay.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/Polygon.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/PolygonManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/Polyline.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/map_view/PolylineManager.class +0 -0
- package/lib/android/build/tmp/kotlin-classes/debug/qiuxiang/amap3d/modules/SdkModule.class +0 -0
- package/lib/android/build.gradle +34 -0
- package/lib/android/drawable/rn_edit_text_material.xml +37 -0
- package/lib/android/drawable-hdpi/positio_icon.png +0 -0
- package/lib/android/drawable-hdpi/splashscreen_image.png +0 -0
- package/lib/android/drawable-mdpi/splashscreen_image.png +0 -0
- package/lib/android/drawable-xhdpi/splashscreen_image.png +0 -0
- package/lib/android/drawable-xxhdpi/splashscreen_image.png +0 -0
- package/lib/android/drawable-xxxhdpi/splashscreen_image.png +0 -0
- package/lib/android/src/main/AndroidManifest.xml +10 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/AMap3DPackage.kt +30 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/Utils.kt +114 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/Circle.kt +65 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/CircleManager.kt +49 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/HeatMap.kt +32 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/HeatMapManager.kt +33 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/MapView.kt +190 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/MapViewManager.kt +181 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/Marker.kt +102 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/MarkerManager.kt +78 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/MultiPoint.kt +53 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/MultiPointManager.kt +33 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/Overlay.kt +8 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/Polygon.kt +58 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/PolygonManager.kt +44 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/Polyline.kt +69 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/map_view/PolylineManager.kt +64 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/modules/AMapGeolocationModule.kt +468 -0
- package/lib/android/src/main/java/qiuxiang/amap3d/modules/SdkModule.kt +31 -0
- package/lib/android/src/main/res/drawable-hdpi/positio_icon.png +0 -0
- package/lib/android/src/main/res/drawable-mdpi/positio_icon.png +0 -0
- package/lib/android/src/main/res/drawable-xhdpi/positio_icon.png +0 -0
- package/lib/android/src/main/res/drawable-xxhdpi/positio_icon.png +0 -0
- package/lib/android/src/main/res/drawable-xxxhdpi/positio_icon.png +0 -0
- package/lib/ios/.swiftformat +2 -0
- package/lib/ios/Bridging-Header.h +4 -0
- package/lib/ios/MapView/CircleManager.m +11 -0
- package/lib/ios/MapView/CircleManager.swift +30 -0
- package/lib/ios/MapView/HeatMapManager.m +9 -0
- package/lib/ios/MapView/HeatMapManager.swift +29 -0
- package/lib/ios/MapView/MapViewManager.m +35 -0
- package/lib/ios/MapView/MapViewManager.swift +188 -0
- package/lib/ios/MapView/MarkerManager.m +18 -0
- package/lib/ios/MapView/MarkerManager.swift +100 -0
- package/lib/ios/MapView/MultiPointManager.m +9 -0
- package/lib/ios/MapView/MultiPointManager.swift +47 -0
- package/lib/ios/MapView/Overlay.swift +4 -0
- package/lib/ios/MapView/PolygonManager.m +10 -0
- package/lib/ios/MapView/PolygonManager.swift +30 -0
- package/lib/ios/MapView/PolylineManager.m +12 -0
- package/lib/ios/MapView/PolylineManager.swift +41 -0
- package/lib/ios/Modules/SdkModule.m +8 -0
- package/lib/ios/Modules/SdkModule.swift +16 -0
- package/lib/ios/RNAMapGeolocation.h +8 -0
- package/lib/ios/RNAMapGeolocation.m +302 -0
- package/lib/ios/Utils.swift +104 -0
- package/lib/ios/react-native-amap3d.podspec +21 -0
- package/lib/src/circle.tsx +36 -0
- package/lib/src/cluster/cluster-view.tsx +58 -0
- package/lib/src/cluster/index.tsx +159 -0
- package/lib/src/component.ts +31 -0
- package/lib/src/geolocation/index.d.ts +287 -0
- package/lib/src/geolocation/index.js +344 -0
- package/lib/src/heat-map.tsx +21 -0
- package/lib/src/index.ts +13 -0
- package/lib/src/location/index.d.ts +287 -0
- package/lib/src/location/index.js +344 -0
- package/lib/src/map-view.tsx +230 -0
- package/lib/src/marker.tsx +128 -0
- package/lib/src/multi-point.tsx +28 -0
- package/lib/src/polygon.tsx +31 -0
- package/lib/src/polyline.tsx +65 -0
- package/lib/src/sdk.ts +11 -0
- package/lib/src/types.ts +137 -0
- package/package.json +2 -2
- package/src/components/overlays/Polyline.tsx +11 -19
- package/src/index.ts +2 -2
- package/src/modules/AMapSDK.ts +2 -12
- package/src/types/map-view.types.ts +27 -5
- package/docs/followUserLocation.md +0 -186
- package/src/types/README.md +0 -186
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
#import "RNAMapGeolocation.h"
|
|
2
|
+
|
|
3
|
+
@implementation RNAMapGeolocation {
|
|
4
|
+
AMapLocationManager *_manager;
|
|
5
|
+
CLLocationManager *_clManager;
|
|
6
|
+
BOOL _isStarted;
|
|
7
|
+
BOOL _locatingWithReGeocode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
RCT_EXPORT_MODULE()
|
|
11
|
+
|
|
12
|
+
- (dispatch_queue_t)methodQueue {
|
|
13
|
+
return dispatch_get_main_queue();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
17
|
+
return YES;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
RCT_EXPORT_METHOD(setApiKey:(NSString *)apiKey) {
|
|
21
|
+
[AMapServices sharedServices].apiKey = apiKey;
|
|
22
|
+
_manager = [[AMapLocationManager alloc] init];
|
|
23
|
+
_manager.delegate = self;
|
|
24
|
+
[AMapLocationManager updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];
|
|
25
|
+
[AMapLocationManager updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain];
|
|
26
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyHundredMeters];
|
|
27
|
+
[_manager setPausesLocationUpdatesAutomatically: NO];
|
|
28
|
+
[[AMapServices sharedServices] setEnableHTTPS:YES];
|
|
29
|
+
_clManager = [CLLocationManager new];
|
|
30
|
+
_locatingWithReGeocode = NO;
|
|
31
|
+
_isStarted = NO;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 定位超时时间,最低2s,默认设置为2s
|
|
35
|
+
RCT_EXPORT_METHOD(setLocationTimeout: (int)value) {
|
|
36
|
+
_manager.locationTimeout = value;
|
|
37
|
+
}
|
|
38
|
+
// 逆地理请求超时时间,最低2s,默认设置为2s
|
|
39
|
+
RCT_EXPORT_METHOD(setReGeocodeTimeout: (int)value) {
|
|
40
|
+
_manager.reGeocodeTimeout = value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 设定定位的最小更新距离。单位米,默认为 kCLDistanceFilterNone,表示只要检测到设备位置发生变化就会更新位置信息。
|
|
44
|
+
RCT_EXPORT_METHOD(setDistanceFilter : (int)value) {
|
|
45
|
+
_manager.distanceFilter = value;
|
|
46
|
+
}
|
|
47
|
+
// 用于指定所需的精度级别。 定位服务将尽最大努力达到您想要的精度。 但是,不能保证。
|
|
48
|
+
// 为了优化电源性能,请确保为您的使用情况指定适当的精度(例如,当仅需要粗略位置时,使用较大的精度值)。
|
|
49
|
+
// 0 => kCLLocationAccuracyBestForNavigation
|
|
50
|
+
// 1 => kCLLocationAccuracyBest
|
|
51
|
+
// 2 => kCLLocationAccuracyNearestTenMeters
|
|
52
|
+
// 3 => kCLLocationAccuracyHundredMeters
|
|
53
|
+
// 4 => kCLLocationAccuracyKilometer
|
|
54
|
+
// 5 => kCLLocationAccuracyThreeKilometers
|
|
55
|
+
RCT_EXPORT_METHOD(setDesiredAccuracy: (NSInteger)accuracy) {
|
|
56
|
+
switch (accuracy) {
|
|
57
|
+
case 0:
|
|
58
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyBestForNavigation];
|
|
59
|
+
break;
|
|
60
|
+
case 1:
|
|
61
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyBest];
|
|
62
|
+
break;
|
|
63
|
+
case 2:
|
|
64
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyNearestTenMeters];
|
|
65
|
+
break;
|
|
66
|
+
case 3:
|
|
67
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyHundredMeters];
|
|
68
|
+
break;
|
|
69
|
+
case 4:
|
|
70
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyKilometer];
|
|
71
|
+
break;
|
|
72
|
+
case 5:
|
|
73
|
+
[_manager setDesiredAccuracy: kCLLocationAccuracyThreeKilometers];
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 是否已经开始定位了
|
|
81
|
+
RCT_REMAP_METHOD(isStarted, resolver: (RCTPromiseResolveBlock)resolve
|
|
82
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
83
|
+
resolve(@(_isStarted));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 开始定位
|
|
87
|
+
RCT_EXPORT_METHOD(start) {
|
|
88
|
+
_isStarted = YES;
|
|
89
|
+
[_manager startUpdatingLocation];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 停止更新位置信息
|
|
93
|
+
RCT_EXPORT_METHOD(stop) {
|
|
94
|
+
_isStarted = NO;
|
|
95
|
+
[_manager stopUpdatingLocation];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法-wx
|
|
99
|
+
RCT_EXPORT_METHOD(startUpdatingHeading) {
|
|
100
|
+
[_manager startUpdatingHeading];
|
|
101
|
+
}
|
|
102
|
+
// 停止获取设备朝向-wx
|
|
103
|
+
RCT_EXPORT_METHOD(stopUpdatingHeading) {
|
|
104
|
+
[_manager stopUpdatingHeading];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 定位是否返回逆地理信息,默认NO。
|
|
108
|
+
RCT_EXPORT_METHOD(setLocatingWithReGeocode: (BOOL)value) {
|
|
109
|
+
_locatingWithReGeocode = value;
|
|
110
|
+
[_manager setLocatingWithReGeocode: value];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 逆地址语言类型,默认是AMapLocationRegionLanguageDefault
|
|
114
|
+
// AMapLocationReGeocodeLanguageDefault = 0, ///<默认,根据地区选择语言
|
|
115
|
+
// AMapLocationReGeocodeLanguageChinse = 1, ///<中文
|
|
116
|
+
// AMapLocationReGeocodeLanguageEnglish = 2, ///<英文
|
|
117
|
+
RCT_EXPORT_METHOD(setGeoLanguage : (int)value) {
|
|
118
|
+
_manager.reGeocodeLanguage = (AMapLocationReGeocodeLanguage)value;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 指定定位是否会被系统自动暂停。默认为NO。
|
|
122
|
+
RCT_EXPORT_METHOD(setPausesLocationUpdatesAutomatically: (BOOL)value) {
|
|
123
|
+
_manager.pausesLocationUpdatesAutomatically = value;
|
|
124
|
+
}
|
|
125
|
+
// 是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。
|
|
126
|
+
// 设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
|
|
127
|
+
RCT_EXPORT_METHOD(setAllowsBackgroundLocationUpdates: (BOOL)value) {
|
|
128
|
+
_manager.allowsBackgroundLocationUpdates = value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @brief 转换目标经纬度为高德坐标系,不在枚举范围内的经纬度将直接返回。
|
|
133
|
+
* @param coordinate 待转换的经纬度
|
|
134
|
+
* @param typeNum 坐标系类型,对应的序号
|
|
135
|
+
* @return 高德坐标系经纬度
|
|
136
|
+
* https://lbs.amap.com/api/ios-sdk/guide/computing-equipment/amap-calculate-tool
|
|
137
|
+
*/
|
|
138
|
+
RCT_EXPORT_METHOD(coordinateConvert:
|
|
139
|
+
(CLLocationCoordinate2D) coordinate
|
|
140
|
+
typer:(NSInteger)typeNum
|
|
141
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
142
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
143
|
+
{
|
|
144
|
+
AMapCoordinateType typeObj;
|
|
145
|
+
switch (typeNum) {
|
|
146
|
+
case -1:
|
|
147
|
+
typeObj = AMapCoordinateTypeAMap;
|
|
148
|
+
break;
|
|
149
|
+
case 0:
|
|
150
|
+
typeObj = AMapCoordinateTypeBaidu;
|
|
151
|
+
break;
|
|
152
|
+
case 1:
|
|
153
|
+
typeObj = AMapCoordinateTypeMapBar;
|
|
154
|
+
break;
|
|
155
|
+
case 2:
|
|
156
|
+
typeObj = AMapCoordinateTypeMapABC;
|
|
157
|
+
break;
|
|
158
|
+
case 3:
|
|
159
|
+
typeObj = AMapCoordinateTypeSoSoMap;
|
|
160
|
+
break;
|
|
161
|
+
case 4:
|
|
162
|
+
typeObj = AMapCoordinateTypeAliYun;
|
|
163
|
+
break;
|
|
164
|
+
case 5:
|
|
165
|
+
typeObj = AMapCoordinateTypeGoogle;
|
|
166
|
+
break;
|
|
167
|
+
case 6:
|
|
168
|
+
typeObj = AMapCoordinateTypeGPS;
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
typeObj = AMapCoordinateTypeGPS;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
CLLocationCoordinate2D amapcoord = AMapCoordinateConvert(CLLocationCoordinate2DMake(coordinate.latitude, coordinate.longitude), typeObj);
|
|
176
|
+
resolve(@{
|
|
177
|
+
@"latitude": [NSNumber numberWithDouble:amapcoord.latitude],
|
|
178
|
+
@"longitude": [NSNumber numberWithDouble:amapcoord.longitude]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// 获取当前定位
|
|
183
|
+
// 默认只获取经纬度,通过 setLocatingWithReGeocode 设置,是否返回逆地理信息
|
|
184
|
+
RCT_EXPORT_METHOD(getCurrentLocation: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
185
|
+
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
|
186
|
+
[_clManager requestWhenInUseAuthorization];
|
|
187
|
+
NSLog(@"reGeocode:逆地理信息");
|
|
188
|
+
// - kCLAuthorizationStatusAuthorizedWhenInUse 用户已授权仅在使用您的应用程序时使用其位置。
|
|
189
|
+
// - kCLAuthorizationStatusAuthorizedAlways 用户已授权在任何时间使用其位置。
|
|
190
|
+
// - kCLAuthorizationStatusNotDetermined 用户尚未对此应用做出选择
|
|
191
|
+
if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse || status == kCLAuthorizationStatusNotDetermined) {
|
|
192
|
+
[_manager requestLocationWithReGeocode: _locatingWithReGeocode completionBlock:^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) {
|
|
193
|
+
if (error) {
|
|
194
|
+
reject([NSString stringWithFormat:@"%ld",(long)error.code], error.localizedDescription, error);
|
|
195
|
+
} else {
|
|
196
|
+
NSLog(@"location:定位信息:%@", location);
|
|
197
|
+
NSLog(@"regeocode:逆地理信息:%@", regeocode);
|
|
198
|
+
if (regeocode) {
|
|
199
|
+
NSLog(@"reGeocode:逆地理信息:%@", regeocode);
|
|
200
|
+
}
|
|
201
|
+
id json = [self json:location reGeocode:regeocode];
|
|
202
|
+
[NSUserDefaults.standardUserDefaults setObject: json forKey: RNAMapGeolocation.storeKey];
|
|
203
|
+
resolve(json);
|
|
204
|
+
}
|
|
205
|
+
}];
|
|
206
|
+
} else {
|
|
207
|
+
reject(@"-10086", @"location unauthorized", nil);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
+ (NSString *)storeKey {
|
|
212
|
+
return @"RNAMapGeolocation";
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
- (id)json:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode {
|
|
216
|
+
|
|
217
|
+
BOOL flag = AMapLocationDataAvailableForCoordinate(location.coordinate);
|
|
218
|
+
// 逆地理信息
|
|
219
|
+
if (reGeocode) {
|
|
220
|
+
return @{
|
|
221
|
+
@"accuracy" : @(location.horizontalAccuracy),
|
|
222
|
+
@"latitude" : @(location.coordinate.latitude),
|
|
223
|
+
@"longitude" : @(location.coordinate.longitude),
|
|
224
|
+
@"altitude" : @(location.altitude),
|
|
225
|
+
@"speed" : @(location.speed),
|
|
226
|
+
@"heading" : @(location.course),
|
|
227
|
+
@"timestamp" : @(location.timestamp.timeIntervalSince1970 * 1000),
|
|
228
|
+
@"isAvailableCoordinate": @(flag),
|
|
229
|
+
|
|
230
|
+
@"address" : reGeocode.formattedAddress ? reGeocode.formattedAddress : @"",
|
|
231
|
+
@"country" : reGeocode.country ? reGeocode.country : @"",
|
|
232
|
+
@"province" : reGeocode.province ? reGeocode.province : @"",
|
|
233
|
+
@"city" : reGeocode.city ? reGeocode.city : @"",
|
|
234
|
+
@"district" : reGeocode.district ? reGeocode.district : @"",
|
|
235
|
+
@"cityCode" : reGeocode.citycode ? reGeocode.citycode : @"",
|
|
236
|
+
@"adCode" : reGeocode.adcode ? reGeocode.adcode : @"",
|
|
237
|
+
@"street" : reGeocode.street ? reGeocode.street : @"",
|
|
238
|
+
@"streetNumber" : reGeocode.number ? reGeocode.number : @"",
|
|
239
|
+
@"poiName" : reGeocode.POIName ? reGeocode.POIName : @"",
|
|
240
|
+
@"aoiName" : reGeocode.AOIName ? reGeocode.AOIName : @"",
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
} else {
|
|
244
|
+
// 定位信息
|
|
245
|
+
return @{
|
|
246
|
+
@"accuracy": @(location.horizontalAccuracy),
|
|
247
|
+
@"latitude": @(location.coordinate.latitude),
|
|
248
|
+
@"longitude": @(location.coordinate.longitude),
|
|
249
|
+
@"isAvailableCoordinate": @(flag),
|
|
250
|
+
@"altitude": @(location.altitude),
|
|
251
|
+
@"speed": @(location.speed),
|
|
252
|
+
@"heading": @(location.course),
|
|
253
|
+
@"timestamp": @(location.timestamp.timeIntervalSince1970 * 1000),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @brief 当plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription,
|
|
260
|
+
* 并且[CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined,会调用代理的此方法。
|
|
261
|
+
* 此方法实现申请后台权限API即可:[locationManager requestAlwaysAuthorization](必须调用,不然无法正常获取定位权限)
|
|
262
|
+
* @param manager 地理围栏管理类。
|
|
263
|
+
* @param locationManager 需要申请后台定位权限的locationManager。
|
|
264
|
+
* @since 2.6.2
|
|
265
|
+
*/
|
|
266
|
+
- (void)amapLocationManager:(AMapLocationManager *)manager
|
|
267
|
+
doRequireLocationAuth:(CLLocationManager *)locationManager {
|
|
268
|
+
[locationManager requestAlwaysAuthorization];
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
272
|
+
return @[ @"AMapGeolocation" ];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @brief 连续定位回调函数.注意:如果实现了本方法,则定位信息不会通过amapLocationManager:didUpdateLocation:方法回调。
|
|
277
|
+
* @param manager 定位 AMapLocationManager 类。
|
|
278
|
+
* @param location 定位结果。
|
|
279
|
+
* @param reGeocode 逆地理信息。
|
|
280
|
+
*/
|
|
281
|
+
- (void)amapLocationManager:(AMapLocationManager *)manager
|
|
282
|
+
didUpdateLocation:(CLLocation *)location
|
|
283
|
+
reGeocode:(AMapLocationReGeocode *)reGeocode
|
|
284
|
+
{
|
|
285
|
+
id json = [self json:location reGeocode:reGeocode];
|
|
286
|
+
[self sendEventWithName: @"AMapGeolocation" body:json];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @brief 当定位发生错误时,会调用代理的此方法。
|
|
291
|
+
* @param manager 定位 AMapLocationManager 类。
|
|
292
|
+
* @param error 返回的错误,参考 CLError 。
|
|
293
|
+
*/
|
|
294
|
+
- (void)amapLocationManager:(AMapLocationManager *)manager didFailWithError:(NSError *)error {
|
|
295
|
+
[self sendEventWithName: @"AMapGeolocation"
|
|
296
|
+
body: @{
|
|
297
|
+
@"errorCode": @(error.code),
|
|
298
|
+
@"errorInfo": error.localizedDescription,
|
|
299
|
+
}];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
extension NSDictionary {
|
|
2
|
+
var coordinate: CLLocationCoordinate2D {
|
|
3
|
+
CLLocationCoordinate2DMake(self["latitude"] as! Double, self["longitude"] as! Double)
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
var point: CGPoint {
|
|
7
|
+
CGPoint(x: self["x"] as! Double, y: self["y"] as! Double)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
extension CLLocationCoordinate2D {
|
|
12
|
+
var json: [String: Double] {
|
|
13
|
+
["latitude": latitude, "longitude": longitude]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
extension MAUserLocation {
|
|
18
|
+
var json: [String: Any] {
|
|
19
|
+
[
|
|
20
|
+
"coords": [
|
|
21
|
+
"latitude": coordinate.latitude,
|
|
22
|
+
"longitude": coordinate.longitude,
|
|
23
|
+
"altitude": location?.altitude ?? 0,
|
|
24
|
+
"heading": heading?.trueHeading,
|
|
25
|
+
"accuracy": location?.horizontalAccuracy ?? 0,
|
|
26
|
+
"speed": location?.speed ?? 0,
|
|
27
|
+
],
|
|
28
|
+
"timestamp": NSDate().timeIntervalSince1970 * 1000,
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
extension MACoordinateRegion {
|
|
34
|
+
var json: [String: Any] {
|
|
35
|
+
[
|
|
36
|
+
"southwest": [
|
|
37
|
+
"latitude": center.latitude - span.latitudeDelta / 2,
|
|
38
|
+
"longitude": center.longitude - span.longitudeDelta / 2,
|
|
39
|
+
],
|
|
40
|
+
"northeast": [
|
|
41
|
+
"latitude": center.latitude + span.latitudeDelta / 2,
|
|
42
|
+
"longitude": center.longitude + span.longitudeDelta / 2,
|
|
43
|
+
],
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
extension MAMapStatus {
|
|
49
|
+
var json: [String: Any] {
|
|
50
|
+
[
|
|
51
|
+
"target": centerCoordinate.json,
|
|
52
|
+
"zoom": zoomLevel,
|
|
53
|
+
"bearing": rotationDegree,
|
|
54
|
+
"tilt": cameraDegree,
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
extension MAMapView {
|
|
60
|
+
var cameraEvent: [String: Any] {
|
|
61
|
+
[
|
|
62
|
+
"cameraPosition": getMapStatus().json,
|
|
63
|
+
"latLngBounds": region.json,
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
extension Double {
|
|
69
|
+
var cgFloat: CGFloat {
|
|
70
|
+
CGFloat(self)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
extension RCTConvert {
|
|
75
|
+
@objc static func MAMapType(_ json: Any) -> MAMapType {
|
|
76
|
+
MAMapKit.MAMapType(rawValue: json as! NSInteger)!
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
extension RCTImageLoader {
|
|
81
|
+
func loadImage(_ icon: NSDictionary?, callback: @escaping (UIImage) -> Void) {
|
|
82
|
+
if icon == nil {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
let width = icon?["width"] as? Double ?? 0
|
|
86
|
+
let height = icon?["height"] as? Double ?? 0
|
|
87
|
+
loadImage(
|
|
88
|
+
with: RCTConvert.nsurlRequest(icon),
|
|
89
|
+
size: CGSize(width: width, height: height),
|
|
90
|
+
scale: RCTScreenScale(),
|
|
91
|
+
clipped: false,
|
|
92
|
+
resizeMode: RCTResizeMode.cover,
|
|
93
|
+
progressBlock: { _, _ in },
|
|
94
|
+
partialLoad: { _ in },
|
|
95
|
+
completionBlock: { _, image in
|
|
96
|
+
if image != nil {
|
|
97
|
+
DispatchQueue.main.async {
|
|
98
|
+
callback(image!)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "../../package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-amap3d"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "10.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/qiuxiang/react-native-amap3d.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "**/*.{h,m,mm,swift}"
|
|
17
|
+
|
|
18
|
+
s.dependency "React-Core"
|
|
19
|
+
s.dependency 'AMap3DMap', '10.0.600'
|
|
20
|
+
s.dependency "AMapLocation"
|
|
21
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { requireNativeComponent } from "react-native";
|
|
2
|
+
import { LatLng } from "./types";
|
|
3
|
+
|
|
4
|
+
export interface CircleProps {
|
|
5
|
+
/**
|
|
6
|
+
* 圆点坐标
|
|
7
|
+
*/
|
|
8
|
+
center: LatLng;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 半径(米)
|
|
12
|
+
*/
|
|
13
|
+
radius: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 边线宽度
|
|
17
|
+
*/
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 边线颜色
|
|
22
|
+
*/
|
|
23
|
+
strokeColor?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 填充颜色
|
|
27
|
+
*/
|
|
28
|
+
fillColor?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 层级
|
|
32
|
+
*/
|
|
33
|
+
zIndex?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default requireNativeComponent<CircleProps>("AMapCircle");
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
|
|
3
|
+
* @Date : 2024-12-17 21:28:15
|
|
4
|
+
* @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
|
|
5
|
+
* @LastEditTime : 2025-03-25 09:25:54
|
|
6
|
+
* @FilePath : /jintan-app/lib/amap3d/lib/src/cluster/cluster-view.tsx
|
|
7
|
+
* @Description :
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
|
|
10
|
+
*/
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { StyleSheet, Text, ViewStyle } from "react-native";
|
|
13
|
+
import { ClusterParams } from ".";
|
|
14
|
+
import Marker from "../marker";
|
|
15
|
+
import { View } from "@/components/Themed";
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
cluster: ClusterParams;
|
|
19
|
+
style?: ViewStyle;
|
|
20
|
+
textStyle?: ViewStyle;
|
|
21
|
+
onPress?: (params: ClusterParams) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default class ClusterView extends React.PureComponent<Props> {
|
|
25
|
+
onPress = () => {
|
|
26
|
+
this.props.onPress?.call(this, this.props.cluster);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
renderClusterView = () => {
|
|
30
|
+
const { count } = this.props.cluster;
|
|
31
|
+
const size = 36 + Math.log2(count);
|
|
32
|
+
const clusterStyle = { width: size, height: size, borderRadius: size / 2 };
|
|
33
|
+
return (
|
|
34
|
+
<View style={[style.cluster, clusterStyle, this.props.style]}>
|
|
35
|
+
<Text style={[style.text, this.props.textStyle]}>{count}</Text>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
return (
|
|
42
|
+
<Marker onPress={this.onPress} position={this.props.cluster.position}>
|
|
43
|
+
{this.renderClusterView()}
|
|
44
|
+
</Marker>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const style = StyleSheet.create({
|
|
50
|
+
cluster: {
|
|
51
|
+
borderWidth: 4,
|
|
52
|
+
borderColor: "#fff",
|
|
53
|
+
backgroundColor: "rgba(245,83,61,0.9)",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
},
|
|
57
|
+
text: { color: "#fff", fontWeight: "600" },
|
|
58
|
+
});
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ViewStyle } from "react-native";
|
|
3
|
+
import Supercluster, { ClusterFeature, ClusterProperties } from "supercluster";
|
|
4
|
+
import { CameraEvent } from "../map-view";
|
|
5
|
+
import { LatLng } from "../types";
|
|
6
|
+
import ClusterView from "./cluster-view";
|
|
7
|
+
|
|
8
|
+
export interface ClusterParams {
|
|
9
|
+
/**
|
|
10
|
+
* 唯一标识
|
|
11
|
+
*/
|
|
12
|
+
id: number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 包含的 Marker 数量
|
|
16
|
+
*/
|
|
17
|
+
count: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 坐标
|
|
21
|
+
*/
|
|
22
|
+
position: LatLng;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ClusterPoint {
|
|
26
|
+
/**
|
|
27
|
+
* 坐标
|
|
28
|
+
*/
|
|
29
|
+
position: LatLng;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 携带的数据,可以是任意类型
|
|
33
|
+
*/
|
|
34
|
+
properties?: any;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface Props {
|
|
38
|
+
/**
|
|
39
|
+
* 聚合半径
|
|
40
|
+
*/
|
|
41
|
+
radius?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 聚合点样式
|
|
45
|
+
*/
|
|
46
|
+
clusterStyle?: ViewStyle;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 聚合点文本样式
|
|
50
|
+
*/
|
|
51
|
+
clusterTextStyle?: ViewStyle;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 坐标点列表
|
|
55
|
+
*/
|
|
56
|
+
points: ClusterPoint[];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 渲染 Marker
|
|
60
|
+
*/
|
|
61
|
+
renderMarker: (item: ClusterPoint) => React.ReactNode;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 渲染聚合点
|
|
65
|
+
*/
|
|
66
|
+
renderCluster?: (params: ClusterParams) => React.ComponentType<any>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 聚合点点击事件
|
|
70
|
+
*/
|
|
71
|
+
onPress?: (params: ClusterParams) => void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface State {
|
|
75
|
+
clusters: ClusterFeature<ClusterProperties>[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default class Cluster extends React.PureComponent<Props, State> {
|
|
79
|
+
static defaultProps = { radius: 200 };
|
|
80
|
+
state: State = { clusters: [] };
|
|
81
|
+
status?: CameraEvent;
|
|
82
|
+
cluster?: Supercluster<any, ClusterProperties>;
|
|
83
|
+
|
|
84
|
+
componentDidMount() {
|
|
85
|
+
this.init();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
componentDidUpdate(props: Props) {
|
|
89
|
+
if (props.points != this.props.points) {
|
|
90
|
+
this.init();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async init() {
|
|
95
|
+
const { radius, points } = this.props;
|
|
96
|
+
// 如果主线程占用太多计算资源,会导致 ios onLoad 事件无法触发,非常蛋疼
|
|
97
|
+
// 暂时想到的解决办法是等一个事件循环
|
|
98
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
99
|
+
const options = { radius, minZoom: 3, maxZoom: 21 };
|
|
100
|
+
this.cluster = new Supercluster<any, ClusterProperties>(options).load(
|
|
101
|
+
points.map((marker) => ({
|
|
102
|
+
type: "Feature",
|
|
103
|
+
geometry: {
|
|
104
|
+
type: "Point",
|
|
105
|
+
coordinates: [marker.position.longitude, marker.position.latitude],
|
|
106
|
+
},
|
|
107
|
+
properties: marker.properties,
|
|
108
|
+
}))
|
|
109
|
+
);
|
|
110
|
+
if (this.status) {
|
|
111
|
+
this.update(this.status);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 需要在 MapView.onCameraIdle({ nativeEvent }) 回调里调用,参数为 nativeEvent
|
|
117
|
+
*/
|
|
118
|
+
async update(status: CameraEvent) {
|
|
119
|
+
this.status = status;
|
|
120
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
121
|
+
const { cameraPosition, latLngBounds } = status;
|
|
122
|
+
const { southwest, northeast } = latLngBounds;
|
|
123
|
+
const clusters = this.cluster!.getClusters(
|
|
124
|
+
[southwest.longitude, southwest.latitude, northeast.longitude, northeast.latitude],
|
|
125
|
+
Math.round(cameraPosition.zoom!)
|
|
126
|
+
);
|
|
127
|
+
this.setState({ clusters });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
renderCluster = (cluster: ClusterParams) => {
|
|
131
|
+
return (
|
|
132
|
+
<ClusterView
|
|
133
|
+
key={cluster.id}
|
|
134
|
+
cluster={cluster}
|
|
135
|
+
onPress={this.props.onPress}
|
|
136
|
+
style={this.props.clusterStyle}
|
|
137
|
+
textStyle={this.props.clusterTextStyle}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
render() {
|
|
143
|
+
const { renderCluster, renderMarker } = this.props;
|
|
144
|
+
const render = renderCluster || this.renderCluster;
|
|
145
|
+
return this.state.clusters.map(({ geometry, properties }) => {
|
|
146
|
+
const position = {
|
|
147
|
+
latitude: geometry.coordinates[1],
|
|
148
|
+
longitude: geometry.coordinates[0],
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
if (properties.point_count > 0) {
|
|
152
|
+
const { cluster_id, point_count } = properties;
|
|
153
|
+
return render({ position, id: cluster_id, count: point_count });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return renderMarker({ position, properties });
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|