expo-gaode-map-navigation 1.1.5-next.1 → 1.1.5-next.3

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.
Files changed (136) hide show
  1. package/android/build.gradle +10 -0
  2. package/android/src/main/cpp/CMakeLists.txt +24 -0
  3. package/android/src/main/cpp/cluster_jni.cpp +848 -0
  4. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +616 -92
  5. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapOfflineModule.kt +493 -0
  6. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapView.kt +230 -14
  7. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapViewModule.kt +37 -27
  8. package/android/src/main/java/expo/modules/gaodemap/map/MapPreloadManager.kt +494 -0
  9. package/android/src/main/java/expo/modules/gaodemap/map/companion/BitmapDescriptorCache.kt +30 -0
  10. package/android/src/main/java/expo/modules/gaodemap/map/companion/IconBitmapCache.kt +37 -0
  11. package/android/src/main/java/expo/modules/gaodemap/map/managers/UIManager.kt +76 -0
  12. package/android/src/main/java/expo/modules/gaodemap/map/modules/LocationManager.kt +15 -3
  13. package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +4 -59
  14. package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleView.kt +9 -12
  15. package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleViewModule.kt +5 -6
  16. package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterView.kt +539 -66
  17. package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterViewModule.kt +17 -1
  18. package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapView.kt +165 -33
  19. package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapViewModule.kt +15 -3
  20. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +1249 -672
  21. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +40 -17
  22. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointView.kt +177 -22
  23. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointViewModule.kt +11 -3
  24. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonView.kt +57 -14
  25. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonViewModule.kt +9 -5
  26. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineView.kt +90 -63
  27. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineViewModule.kt +7 -3
  28. package/android/src/main/java/expo/modules/gaodemap/map/services/LocationForegroundService.kt +3 -2
  29. package/android/src/main/java/expo/modules/gaodemap/map/utils/BitmapDescriptorCache.kt +20 -0
  30. package/android/src/main/java/expo/modules/gaodemap/map/utils/ClusterNative.kt +13 -0
  31. package/android/src/main/java/expo/modules/gaodemap/map/utils/ColorParser.kt +20 -0
  32. package/android/src/main/java/expo/modules/gaodemap/map/utils/GeometryUtils.kt +515 -0
  33. package/android/src/main/java/expo/modules/gaodemap/map/utils/LatLngParser.kt +91 -0
  34. package/android/src/main/java/expo/modules/gaodemap/map/utils/PermissionHelper.kt +248 -0
  35. package/build/ExpoGaodeMapNaviView.d.ts +7 -7
  36. package/build/ExpoGaodeMapNaviView.js +8 -8
  37. package/build/ExpoGaodeMapNavigationModule.d.ts +2 -1
  38. package/build/index.d.ts +35 -33
  39. package/build/index.js +70 -106
  40. package/build/map/ExpoGaodeMapModule.d.ts +2 -201
  41. package/build/map/ExpoGaodeMapModule.js +584 -14
  42. package/build/map/ExpoGaodeMapOfflineModule.d.ts +139 -0
  43. package/build/map/ExpoGaodeMapOfflineModule.js +8 -0
  44. package/build/map/ExpoGaodeMapView.js +66 -58
  45. package/build/map/components/FoldableMapView.d.ts +38 -0
  46. package/build/map/components/FoldableMapView.js +209 -0
  47. package/build/map/components/MapContext.d.ts +12 -0
  48. package/build/map/components/MapContext.js +54 -0
  49. package/build/map/components/MapUI.d.ts +18 -0
  50. package/build/map/components/MapUI.js +29 -0
  51. package/build/map/components/overlays/Circle.js +34 -3
  52. package/build/map/components/overlays/Cluster.d.ts +3 -1
  53. package/build/map/components/overlays/Cluster.js +31 -2
  54. package/build/map/components/overlays/HeatMap.d.ts +3 -1
  55. package/build/map/components/overlays/HeatMap.js +33 -3
  56. package/build/map/components/overlays/Marker.d.ts +1 -1
  57. package/build/map/components/overlays/Marker.js +37 -32
  58. package/build/map/components/overlays/MultiPoint.js +1 -1
  59. package/build/map/components/overlays/Polygon.js +30 -3
  60. package/build/map/components/overlays/Polyline.js +36 -3
  61. package/build/map/index.d.ts +25 -5
  62. package/build/map/index.js +59 -18
  63. package/build/map/types/common.types.d.ts +40 -0
  64. package/build/map/types/common.types.js +0 -4
  65. package/build/map/types/index.d.ts +3 -2
  66. package/build/map/types/map-view.types.d.ts +108 -3
  67. package/build/map/types/native-module.types.d.ts +363 -0
  68. package/build/map/types/native-module.types.js +5 -0
  69. package/build/map/types/offline.types.d.ts +132 -0
  70. package/build/map/types/offline.types.js +5 -0
  71. package/build/map/types/overlays.types.d.ts +137 -24
  72. package/build/map/utils/ErrorHandler.d.ts +110 -0
  73. package/build/map/utils/ErrorHandler.js +421 -0
  74. package/build/map/utils/GeoUtils.d.ts +20 -0
  75. package/build/map/utils/GeoUtils.js +76 -0
  76. package/build/map/utils/OfflineMapManager.d.ts +148 -0
  77. package/build/map/utils/OfflineMapManager.js +217 -0
  78. package/build/map/utils/PermissionUtils.d.ts +91 -0
  79. package/build/map/utils/PermissionUtils.js +255 -0
  80. package/build/map/utils/PlatformDetector.d.ts +102 -0
  81. package/build/map/utils/PlatformDetector.js +186 -0
  82. package/build/types/index.d.ts +1 -0
  83. package/build/types/index.js +1 -0
  84. package/build/types/native-module.types.d.ts +69 -0
  85. package/build/types/native-module.types.js +2 -0
  86. package/build/types/naviview.types.d.ts +1 -1
  87. package/expo-module.config.json +12 -10
  88. package/ios/ExpoGaodeMapNavigation.podspec +9 -0
  89. package/ios/map/ExpoGaodeMapModule.swift +485 -75
  90. package/ios/map/ExpoGaodeMapOfflineModule.swift +479 -0
  91. package/ios/map/ExpoGaodeMapView.swift +611 -62
  92. package/ios/map/ExpoGaodeMapViewModule.swift +48 -26
  93. package/ios/map/MapPreloadManager.swift +348 -0
  94. package/ios/map/cpp/ClusterEngine.cpp +110 -0
  95. package/ios/map/cpp/ClusterEngine.hpp +20 -0
  96. package/ios/map/cpp/ColorParser.cpp +135 -0
  97. package/ios/map/cpp/ColorParser.hpp +14 -0
  98. package/ios/map/cpp/GeometryEngine.cpp +574 -0
  99. package/ios/map/cpp/GeometryEngine.hpp +159 -0
  100. package/ios/map/cpp/QuadTree.cpp +92 -0
  101. package/ios/map/cpp/QuadTree.hpp +42 -0
  102. package/ios/map/cpp/README.md +55 -0
  103. package/ios/map/cpp/tests/benchmark_js.js +41 -0
  104. package/ios/map/cpp/tests/run.sh +17 -0
  105. package/ios/map/cpp/tests/test_main.cpp +276 -0
  106. package/ios/map/managers/UIManager.swift +72 -1
  107. package/ios/map/modules/LocationManager.swift +114 -165
  108. package/ios/map/overlays/CircleView.swift +16 -32
  109. package/ios/map/overlays/CircleViewModule.swift +12 -12
  110. package/ios/map/overlays/ClusterAnnotation.swift +32 -0
  111. package/ios/map/overlays/ClusterView.swift +331 -45
  112. package/ios/map/overlays/ClusterViewModule.swift +20 -6
  113. package/ios/map/overlays/HeatMapView.swift +135 -32
  114. package/ios/map/overlays/HeatMapViewModule.swift +20 -8
  115. package/ios/map/overlays/MarkerView.swift +613 -130
  116. package/ios/map/overlays/MarkerViewModule.swift +38 -18
  117. package/ios/map/overlays/MultiPointView.swift +168 -10
  118. package/ios/map/overlays/MultiPointViewModule.swift +27 -5
  119. package/ios/map/overlays/PolygonView.swift +62 -23
  120. package/ios/map/overlays/PolygonViewModule.swift +18 -12
  121. package/ios/map/overlays/PolylineView.swift +21 -13
  122. package/ios/map/overlays/PolylineViewModule.swift +18 -12
  123. package/ios/map/utils/ClusterNative.h +96 -0
  124. package/ios/map/utils/ClusterNative.mm +377 -0
  125. package/ios/map/utils/ColorParser.swift +12 -1
  126. package/ios/map/utils/CppBridging.mm +13 -0
  127. package/ios/map/utils/GeometryUtils.swift +34 -0
  128. package/ios/map/utils/LatLngParser.swift +87 -0
  129. package/ios/map/utils/PermissionManager.swift +135 -6
  130. package/package.json +1 -1
  131. package/build/map/ExpoGaodeMap.types.d.ts +0 -41
  132. package/build/map/ExpoGaodeMap.types.js +0 -24
  133. package/build/map/utils/EventManager.d.ts +0 -10
  134. package/build/map/utils/EventManager.js +0 -26
  135. package/build/map/utils/ModuleLoader.d.ts +0 -73
  136. package/build/map/utils/ModuleLoader.js +0 -112
@@ -0,0 +1,135 @@
1
+ #include "ColorParser.hpp"
2
+ #include <algorithm>
3
+ #include <sstream>
4
+ #include <vector>
5
+ #include <map>
6
+ #include <cmath>
7
+
8
+ namespace gaodemap {
9
+
10
+ static uint32_t argb(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
11
+ return (static_cast<uint32_t>(a) << 24) |
12
+ (static_cast<uint32_t>(r) << 16) |
13
+ (static_cast<uint32_t>(g) << 8) |
14
+ static_cast<uint32_t>(b);
15
+ }
16
+
17
+ static uint32_t parseHex(const std::string& hexStr) {
18
+ std::string cleanHex = hexStr;
19
+ if (cleanHex.empty()) return 0;
20
+ if (cleanHex[0] == '#') {
21
+ cleanHex = cleanHex.substr(1);
22
+ }
23
+
24
+ uint32_t val = 0;
25
+ try {
26
+ val = static_cast<uint32_t>(std::stoul(cleanHex, nullptr, 16));
27
+ } catch (...) {
28
+ return 0;
29
+ }
30
+
31
+ if (cleanHex.length() == 6) {
32
+ // RRGGBB -> 0xFFRRGGBB
33
+ return 0xFF000000 | val;
34
+ } else if (cleanHex.length() == 8) {
35
+ // AARRGGBB -> AARRGGBB (Android style)
36
+ // Wait, web usually uses #RRGGBBAA.
37
+ // Android Color.parseColor("#RRGGBB") or "#AARRGGBB".
38
+ // Let's assume Android style #AARRGGBB for consistency with existing Kotlin code.
39
+ return val;
40
+ } else if (cleanHex.length() == 3) {
41
+ // RGB -> RRGGBB
42
+ uint32_t r = (val >> 8) & 0xF;
43
+ uint32_t g = (val >> 4) & 0xF;
44
+ uint32_t b = val & 0xF;
45
+ return 0xFF000000 | (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b;
46
+ } else if (cleanHex.length() == 4) {
47
+ // ARGB -> AARRGGBB
48
+ uint32_t a = (val >> 12) & 0xF;
49
+ uint32_t r = (val >> 8) & 0xF;
50
+ uint32_t g = (val >> 4) & 0xF;
51
+ uint32_t b = val & 0xF;
52
+ return (a << 28) | (a << 24) | (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b;
53
+ }
54
+
55
+ return 0;
56
+ }
57
+
58
+ static uint32_t parseRgba(const std::string& str) {
59
+ // rgba(r, g, b, a) or rgb(r, g, b)
60
+ bool hasAlpha = str.find("rgba") == 0;
61
+ size_t start = str.find('(');
62
+ size_t end = str.find(')');
63
+ if (start == std::string::npos || end == std::string::npos) return 0;
64
+
65
+ std::string content = str.substr(start + 1, end - start - 1);
66
+ std::stringstream ss(content);
67
+ std::string segment;
68
+ std::vector<std::string> parts;
69
+
70
+ while (std::getline(ss, segment, ',')) {
71
+ parts.push_back(segment);
72
+ }
73
+
74
+ if (parts.size() < 3) return 0;
75
+
76
+ try {
77
+ int r = std::stoi(parts[0]);
78
+ int g = std::stoi(parts[1]);
79
+ int b = std::stoi(parts[2]);
80
+ int a = 255;
81
+
82
+ if (hasAlpha && parts.size() >= 4) {
83
+ float alphaFloat = std::stof(parts[3]);
84
+ a = static_cast<int>(alphaFloat * 255.0f);
85
+ }
86
+
87
+ return argb(
88
+ static_cast<uint8_t>(std::max(0, std::min(255, a))),
89
+ static_cast<uint8_t>(std::max(0, std::min(255, r))),
90
+ static_cast<uint8_t>(std::max(0, std::min(255, g))),
91
+ static_cast<uint8_t>(std::max(0, std::min(255, b)))
92
+ );
93
+ } catch (...) {
94
+ return 0;
95
+ }
96
+ }
97
+
98
+ static const std::map<std::string, uint32_t> NAMED_COLORS = {
99
+ {"red", 0xFFFF0000},
100
+ {"blue", 0xFF0000FF},
101
+ {"green", 0xFF00FF00},
102
+ {"yellow", 0xFFFFFF00},
103
+ {"black", 0xFF000000},
104
+ {"white", 0xFFFFFFFF},
105
+ {"gray", 0xFF888888},
106
+ {"grey", 0xFF888888},
107
+ {"cyan", 0xFF00FFFF},
108
+ {"magenta", 0xFFFF00FF},
109
+ {"transparent", 0x00000000}
110
+ };
111
+
112
+ uint32_t parseColor(const std::string& colorString) {
113
+ std::string str = colorString;
114
+ // Remove whitespace
115
+ str.erase(std::remove_if(str.begin(), str.end(), ::isspace), str.end());
116
+ // Lowercase for named colors check
117
+ std::string lowerStr = str;
118
+ std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);
119
+
120
+ if (NAMED_COLORS.count(lowerStr)) {
121
+ return NAMED_COLORS.at(lowerStr);
122
+ }
123
+
124
+ if (lowerStr.find("rgb") == 0) {
125
+ return parseRgba(str); // pass original str with potential spaces if needed, but we removed them
126
+ }
127
+
128
+ if (lowerStr.find("#") == 0 || std::all_of(lowerStr.begin(), lowerStr.end(), ::isxdigit)) {
129
+ return parseHex(str);
130
+ }
131
+
132
+ return 0; // Default black -> Default failure (0)
133
+ }
134
+
135
+ }
@@ -0,0 +1,14 @@
1
+ #pragma once
2
+
3
+ #include <string>
4
+ #include <cstdint>
5
+
6
+ namespace gaodemap {
7
+
8
+ // Returns color as ARGB integer (0xAARRGGBB)
9
+ // Returns 0 (transparent/black) if parsing fails, but 0 is also valid (transparent).
10
+ // Maybe return a bool success? Or default to Black (0xFF000000) or Transparent (0x00000000).
11
+ // Android defaults to Black in existing code.
12
+ uint32_t parseColor(const std::string& colorString);
13
+
14
+ }