@react-native-ohos/react-native-amap3d 3.2.5-rc.1

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +10 -0
  4. package/harmony/rn_amap3d/BuildProfile.ets +6 -0
  5. package/harmony/rn_amap3d/build-profile.json5 +28 -0
  6. package/harmony/rn_amap3d/consumer-rules.txt +0 -0
  7. package/harmony/rn_amap3d/hvigorfile.ts +6 -0
  8. package/harmony/rn_amap3d/index.ets +30 -0
  9. package/harmony/rn_amap3d/obfuscation-rules.txt +18 -0
  10. package/harmony/rn_amap3d/oh-package.json5 +16 -0
  11. package/harmony/rn_amap3d/src/main/cpp/AMap3dEventEmitRequestHandler.h +218 -0
  12. package/harmony/rn_amap3d/src/main/cpp/AMapEventEmitters.cpp +132 -0
  13. package/harmony/rn_amap3d/src/main/cpp/AMapEventEmitters.h +111 -0
  14. package/harmony/rn_amap3d/src/main/cpp/CMakeLists.txt +7 -0
  15. package/harmony/rn_amap3d/src/main/cpp/ComponentDescriptors.h +19 -0
  16. package/harmony/rn_amap3d/src/main/cpp/MapViewJSIBinder.h +168 -0
  17. package/harmony/rn_amap3d/src/main/cpp/MapViewPackage.h +43 -0
  18. package/harmony/rn_amap3d/src/main/cpp/Props.cpp +86 -0
  19. package/harmony/rn_amap3d/src/main/cpp/Props.h +258 -0
  20. package/harmony/rn_amap3d/src/main/cpp/ShadowNodes.cpp +15 -0
  21. package/harmony/rn_amap3d/src/main/cpp/ShadowNodes.h +33 -0
  22. package/harmony/rn_amap3d/src/main/ets/AMap3DModule.ts +32 -0
  23. package/harmony/rn_amap3d/src/main/ets/AMap3DPackage.ts +46 -0
  24. package/harmony/rn_amap3d/src/main/ets/GlobalCache.ets +24 -0
  25. package/harmony/rn_amap3d/src/main/ets/Logger.ets +65 -0
  26. package/harmony/rn_amap3d/src/main/ets/View/AMapCircle.ets +96 -0
  27. package/harmony/rn_amap3d/src/main/ets/View/AMapMarker.ets +83 -0
  28. package/harmony/rn_amap3d/src/main/ets/View/AMapPolygon.ets +52 -0
  29. package/harmony/rn_amap3d/src/main/ets/View/AMapPolyline.ets +89 -0
  30. package/harmony/rn_amap3d/src/main/ets/View/MapView.ets +686 -0
  31. package/harmony/rn_amap3d/src/main/module.json5 +17 -0
  32. package/harmony/rn_amap3d/src/main/resources/base/element/string.json +8 -0
  33. package/harmony/rn_amap3d/src/main/resources/en_US/element/string.json +8 -0
  34. package/harmony/rn_amap3d/src/main/resources/rawfile/location_map_gps_locked.png +0 -0
  35. package/harmony/rn_amap3d/src/main/resources/zh_CN/element/string.json +8 -0
  36. package/harmony/rn_amap3d/ts.ts +28 -0
  37. package/harmony/rn_amap3d.har +0 -0
  38. package/lib/src/NativeAMapSdk.ts +9 -0
  39. package/lib/src/circle.tsx +17 -0
  40. package/lib/src/circleNativeComponent.ts +47 -0
  41. package/lib/src/cluster/cluster-view.tsx +47 -0
  42. package/lib/src/cluster/index.tsx +159 -0
  43. package/lib/src/component.ts +31 -0
  44. package/lib/src/heat-map.tsx +17 -0
  45. package/lib/src/heat-mapNativeComponent.ts +34 -0
  46. package/lib/src/index.ts +11 -0
  47. package/lib/src/map-view.tsx +73 -0
  48. package/lib/src/map-viewNativeComponent.ts +232 -0
  49. package/lib/src/marker.tsx +32 -0
  50. package/lib/src/markerNativeComponent.ts +105 -0
  51. package/lib/src/multi-point.tsx +17 -0
  52. package/lib/src/multi-pointNativeComponent.ts +51 -0
  53. package/lib/src/polygon.tsx +17 -0
  54. package/lib/src/polygonNativeComponent.ts +42 -0
  55. package/lib/src/polyline.tsx +21 -0
  56. package/lib/src/polylineNativeComponent.ts +67 -0
  57. package/lib/src/types.ts +34 -0
  58. package/package.json +53 -0
  59. package/react-native.config.js +20 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 7c00 <i@7c00.cc>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "Name": "react-native-amap3d",
4
+ "License": "MIT License",
5
+ "License File": "LICENSE",
6
+ "Version Number": "3.2.4",
7
+ "Owner" : "xiafeng@huawei.com",
8
+ "Upstream URL": "https://github.com/qiuxiang/react-native-amap3d",
9
+ "Description": "react-native 高德地图组件,使用最新 3D SDK,受 react-native-maps 启发,提供功能丰富且易用的接口。"
10
+ }
11
+ ]
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # @react-native-ohos/react-native-amap3d
2
+ This project is based on [react-native-amap3d](https://github.com/qiuxiang/react-native-amap3d)
3
+ ## Documentation
4
+ [中文](https://gitee.com/react-native-oh-library/usage-docs/tree/master/zh-cn/react-native-amap3d.md)
5
+
6
+ [English](https://gitee.com/react-native-oh-library/usage-docs/tree/master/en/react-native-amap3d.md)
7
+
8
+ ## License
9
+ This library is licensed under [MIT License (MIT)](https://github.com/react-native-oh-library/react-native-amap3d/blob/sig/LICENSE).
10
+
@@ -0,0 +1,6 @@
1
+ export default class BuildProfile {
2
+ static readonly HAR_VERSION = '3.2.4-0.0.8';
3
+ static readonly BUILD_MODE_NAME = 'debug';
4
+ static readonly DEBUG = true;
5
+ static readonly TARGET_NAME = 'default';
6
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "apiType": "stageMode",
3
+ "buildOption": {
4
+ },
5
+ "buildOptionSet": [
6
+ {
7
+ "name": "release",
8
+ "arkOptions": {
9
+ "obfuscation": {
10
+ "ruleOptions": {
11
+ "enable": true,
12
+ "files": [
13
+ "./obfuscation-rules.txt"
14
+ ]
15
+ },
16
+ "consumerFiles": [
17
+ "./consumer-rules.txt"
18
+ ]
19
+ }
20
+ }
21
+ }
22
+ ],
23
+ "targets": [
24
+ {
25
+ "name": "default"
26
+ }
27
+ ]
28
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ import { harTasks } from '@ohos/hvigor-ohos-plugin';
2
+
3
+ export default {
4
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
5
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
6
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2023 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ export * from "./src/main/ets/View/MapView";
26
+ export * from "./src/main/ets/View/AMapCircle";
27
+ export * from "./src/main/ets/View/AMapMarker";
28
+ export * from "./src/main/ets/View/AMapPolygon";
29
+ export * from "./src/main/ets/View/AMapPolyline";
30
+ export * from "./ts";
@@ -0,0 +1,18 @@
1
+ # Define project specific obfuscation rules here.
2
+ # You can include the obfuscation configuration files in the current module's build-profile.json5.
3
+ #
4
+ # For more details, see
5
+ # https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
6
+
7
+ # Obfuscation options:
8
+ # -disable-obfuscation: disable all obfuscations
9
+ # -enable-property-obfuscation: obfuscate the property names
10
+ # -enable-toplevel-obfuscation: obfuscate the names in the global scope
11
+ # -compact: remove unnecessary blank spaces and all line feeds
12
+ # -remove-log: remove all console.* statements
13
+ # -print-namecache: print the name cache that contains the mapping from the old names to new names
14
+ # -apply-namecache: reuse the given cache file
15
+
16
+ # Keep options:
17
+ # -keep-property-name: specifies property names that you want to keep
18
+ # -keep-global-name: specifies names that you want to keep in the global scope
@@ -0,0 +1,16 @@
1
+ {
2
+ "types": "",
3
+ "devDependencies": {
4
+ },
5
+ "name": "@react-native-ohos/react-native-amap3d",
6
+ "version": "3.2.5-rc.1",
7
+ "description": "Please describe the basic information.",
8
+ "main": "index.ets",
9
+ "author": "",
10
+ "license": "Apache-2.0",
11
+ "dependencies": {
12
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
13
+ "@amap/amap_lbs_map3d": "2.1.0",
14
+ "@amap/amap_lbs_common": ">=1.0.0",
15
+ }
16
+ }
@@ -0,0 +1,218 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2023 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ #pragma once
25
+ #include "RNOH/ArkJS.h"
26
+ #include "RNOH/EventEmitRequestHandler.h"
27
+ #include "AMapEventEmitters.h"
28
+
29
+ #include <glog/logging.h>
30
+ #include "folly/json.h"
31
+
32
+ using namespace facebook;
33
+ namespace rnoh {
34
+
35
+ enum class AMapViewEventType {
36
+ RNC_ONPress = 0,
37
+ RNC_ONPressPoi = 1,
38
+ RNC_ONLongPress = 2,
39
+ RNC_ONCameraMove = 3,
40
+ RNC_ONCameraIdle = 4,
41
+ RNC_ONLoad = 5
42
+ };
43
+
44
+ enum class AMapMarkerEventType { RNC_ONPress = 0, RNC_ONDragStart = 2, RNC_ONDrag = 3, RNC_ONDragEnd = 4 };
45
+
46
+ AMapViewEventType getAMapViewEventType(ArkJS &arkJs, napi_value eventObject) {
47
+ auto eventType = arkJs.getString(arkJs.getObjectProperty(eventObject, "type"));
48
+ if (eventType == "onPress") {
49
+ return AMapViewEventType::RNC_ONPress;
50
+ } else if (eventType == "onPressPoi") {
51
+ return AMapViewEventType::RNC_ONPressPoi;
52
+ } else if (eventType == "onLongPress") {
53
+ return AMapViewEventType::RNC_ONLongPress;
54
+ } else if (eventType == "onCameraMove") {
55
+ return AMapViewEventType::RNC_ONCameraMove;
56
+ } else if (eventType == "onCameraIdle") {
57
+ return AMapViewEventType::RNC_ONCameraIdle;
58
+ } else if (eventType == "onLoad") {
59
+ return AMapViewEventType::RNC_ONLoad;
60
+ } else {
61
+ throw std::runtime_error("Unknown Page event type");
62
+ }
63
+ }
64
+
65
+ AMapMarkerEventType getAMapMarkerEventType(ArkJS &arkJs, napi_value eventObject) {
66
+ auto eventType = arkJs.getString(arkJs.getObjectProperty(eventObject, "type"));
67
+ if (eventType == "onPress") {
68
+ return AMapMarkerEventType::RNC_ONPress;
69
+ } else if (eventType == "onDragStart") {
70
+ return AMapMarkerEventType::RNC_ONDragStart;
71
+ } else if (eventType == "onDrag") {
72
+ return AMapMarkerEventType::RNC_ONDrag;
73
+ } else if (eventType == "onDragEnd") {
74
+ return AMapMarkerEventType::RNC_ONDragEnd;
75
+ } else {
76
+ throw std::runtime_error("Unknown Page event type");
77
+ }
78
+ }
79
+
80
+ class AMapViewEventEmitRequestHandler : public EventEmitRequestHandler {
81
+ public:
82
+ void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
83
+ LOG(INFO) << "AMapViewEventEmitRequestHandler AMapViewEventType::RNC_ONLoad entry";
84
+ if (ctx.eventName != "AMapView") {
85
+ return;
86
+ }
87
+ ArkJS arkJs(ctx.env);
88
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::MapViewEventEmitter>(ctx.tag);
89
+ if (eventEmitter == nullptr) {
90
+ return;
91
+ }
92
+ LOG(INFO) << "AMapViewEventEmitRequestHandler AMapViewEventType eventEmitter not nullptr";
93
+ switch (getAMapViewEventType(arkJs, ctx.payload)) {
94
+ case AMapViewEventType::RNC_ONPress: {
95
+ RNOHNapiObject target = arkJs.getObject((arkJs.getObjectProperty(ctx.payload, "LatLng")));
96
+ double latitude = (double)arkJs.getDouble(target.getProperty("latitude"));
97
+ double longitude = (double)arkJs.getDouble(target.getProperty("longitude"));
98
+ facebook::react::MapViewEventEmitter::onPressEvent event{latitude, longitude};
99
+ eventEmitter->onPress(event);
100
+ break;
101
+ }
102
+ case AMapViewEventType::RNC_ONPressPoi: {
103
+ RNOHNapiObject Poi = arkJs.getObject((arkJs.getObjectProperty(ctx.payload, "Poi")));
104
+ std::string id = (std::string)arkJs.getString(Poi.getProperty("poiid"));
105
+ std::string name = (std::string)arkJs.getString(Poi.getProperty("name"));
106
+ RNOHNapiObject latLngObject = arkJs.getObject(Poi.getProperty("coordinate"));
107
+ double latitude = (double)arkJs.getDouble(latLngObject.getProperty("latitude"));
108
+ double longitude = (double)arkJs.getDouble(latLngObject.getProperty("longitude"));
109
+ facebook::react::MapViewEventEmitter::LatLng latLngC{latitude, longitude};
110
+ facebook::react::MapViewEventEmitter::onMapPoiEvent event{id, name, latLngC};
111
+ eventEmitter->onPressPoi(event);
112
+ break;
113
+ }
114
+ case AMapViewEventType::RNC_ONLongPress: {
115
+ RNOHNapiObject target = arkJs.getObject((arkJs.getObjectProperty(ctx.payload, "LatLng")));
116
+ double latitude = (double)arkJs.getDouble(target.getProperty("latitude"));
117
+ double longitude = (double)arkJs.getDouble(target.getProperty("longitude"));
118
+ facebook::react::MapViewEventEmitter::onLongPressEvent event{latitude, longitude};
119
+ eventEmitter->onLongPress(event);
120
+ break;
121
+ }
122
+ case AMapViewEventType::RNC_ONCameraMove: {
123
+ RNOHNapiObject cameraPosition = arkJs.getObject((arkJs.getObjectProperty(ctx.payload, "CameraPosition")));
124
+ double zoom = (double)arkJs.getDouble(cameraPosition.getProperty("zoom"));
125
+ double bearing = (double)arkJs.getDouble(cameraPosition.getProperty("bearing"));
126
+ double tilt = (double)arkJs.getDouble(cameraPosition.getProperty("tilt"));
127
+ RNOHNapiObject target = arkJs.getObject(cameraPosition.getProperty("target"));
128
+ double latitude = (double)arkJs.getDouble(target.getProperty("latitude"));
129
+ double longitude = (double)arkJs.getDouble(target.getProperty("longitude"));
130
+ facebook::react::MapViewEventEmitter::LatLng targetL{latitude, longitude};
131
+ facebook::react::MapViewEventEmitter::CameraPosition event{targetL, zoom, bearing, tilt};
132
+ eventEmitter->onCameraMove(event);
133
+ break;
134
+ }
135
+ case AMapViewEventType::RNC_ONCameraIdle: {
136
+ RNOHNapiObject cameraPosition = arkJs.getObject((arkJs.getObjectProperty(ctx.payload, "CameraPosition")));
137
+ double zoom = (double)arkJs.getDouble(cameraPosition.getProperty("zoom"));
138
+ double bearing = (double)arkJs.getDouble(cameraPosition.getProperty("bearing"));
139
+ double tilt = (double)arkJs.getDouble(cameraPosition.getProperty("tilt"));
140
+ RNOHNapiObject target = arkJs.getObject(cameraPosition.getProperty("target"));
141
+ double latitude = (double)arkJs.getDouble(target.getProperty("latitude"));
142
+ double longitude = (double)arkJs.getDouble(target.getProperty("longitude"));
143
+ facebook::react::MapViewEventEmitter::LatLng targetL{latitude, longitude};
144
+ facebook::react::MapViewEventEmitter::CameraPosition event{targetL, zoom, bearing, tilt};
145
+ eventEmitter->onCameraIdle(event);
146
+ break;
147
+ }
148
+ case AMapViewEventType::RNC_ONLoad: {
149
+ LOG(INFO) << "AMapViewEventEmitRequestHandler AMapViewEventType::RNC_ONLoad entry";
150
+ facebook::react::MapViewEventEmitter::onLoadEvent event{};
151
+ eventEmitter->onLoad(event);
152
+ break;
153
+ }
154
+ default:
155
+ break;
156
+ }
157
+ };
158
+ };
159
+
160
+ class AMapMarkerEventEmitRequestHandler : public EventEmitRequestHandler {
161
+ public:
162
+ void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
163
+ if (ctx.eventName != "AMapMarker") {
164
+ return;
165
+ }
166
+ ArkJS arkJs(ctx.env);
167
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<react::MarkerEventEmitter>(ctx.tag);
168
+ if (eventEmitter == nullptr) {
169
+ return;
170
+ }
171
+
172
+ switch (getAMapMarkerEventType(arkJs, ctx.payload)) {
173
+ case AMapMarkerEventType::RNC_ONPress: {
174
+ facebook::react::MarkerEventEmitter::onPressEvent event{};
175
+ eventEmitter->onPress(event);
176
+ break;
177
+ }
178
+ case AMapMarkerEventType::RNC_ONDragStart: {
179
+ facebook::react::MarkerEventEmitter::onDragStartEvent event{};
180
+ eventEmitter->onDragStart(event);
181
+ break;
182
+ }
183
+ case AMapMarkerEventType::RNC_ONDrag: {
184
+ facebook::react::MarkerEventEmitter::onDragEvent event{};
185
+ eventEmitter->onDrag(event);
186
+ break;
187
+ }
188
+ case AMapMarkerEventType::RNC_ONDragEnd: {
189
+ RNOHNapiObject target = arkJs.getObject((arkJs.getObjectProperty(ctx.payload, "LatLng")));
190
+ double latitude = (double)arkJs.getDouble(target.getProperty("latitude"));
191
+ double longitude = (double)arkJs.getDouble(target.getProperty("longitude"));
192
+ facebook::react::MarkerEventEmitter::onDragEndEvent event{latitude, longitude};
193
+ eventEmitter->onDragEnd(event);
194
+ break;
195
+ }
196
+ default:
197
+ break;
198
+ }
199
+ };
200
+ };
201
+
202
+ class AMapPolylineEventEmitRequestHandler : public EventEmitRequestHandler {
203
+ public:
204
+ void handleEvent(EventEmitRequestHandler::Context const &ctx) override {
205
+ if (ctx.eventName != "AMapPolyline") {
206
+ return;
207
+ }
208
+ ArkJS arkJs(ctx.env);
209
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::PolylineEventEmitter>(ctx.tag);
210
+ if (eventEmitter == nullptr) {
211
+ return;
212
+ }
213
+ facebook::react::PolylineEventEmitter::onPressEvent event{};
214
+ eventEmitter->onPress(event);
215
+ };
216
+ };
217
+
218
+ } // namespace rnoh
@@ -0,0 +1,132 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2024 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ #include "AMapEventEmitters.h"
25
+
26
+ namespace facebook {
27
+ namespace react {
28
+ void MapViewEventEmitter::onPress(struct onPressEvent event) const {
29
+
30
+ dispatchEvent("Press", [event = std::move(event)](jsi::Runtime &runtime) {
31
+ auto payload = jsi::Object(runtime);
32
+ payload.setProperty(runtime, "latitude", event.latitude);
33
+ payload.setProperty(runtime, "longitude", event.longitude);
34
+ return payload;
35
+ });
36
+ }
37
+ void MapViewEventEmitter::onPressPoi(struct onMapPoiEvent event) const {
38
+ dispatchEvent("PressPoi", [event = std::move(event)](jsi::Runtime &runtime) {
39
+ auto payload = jsi::Object(runtime);
40
+ payload.setProperty(runtime, "id", event.id);
41
+ payload.setProperty(runtime, "name", event.name);
42
+ auto latLng = jsi::Object(runtime);
43
+ latLng.setProperty(runtime, "latitude", event.latLng.latitude);
44
+ latLng.setProperty(runtime, "longitude", event.latLng.longitude);
45
+ payload.setProperty(runtime, "position", latLng);
46
+ return payload;
47
+ });
48
+ }
49
+
50
+ void MapViewEventEmitter::onLongPress(struct onLongPressEvent event) const {
51
+ dispatchEvent("LongPress", [event = std::move(event)](jsi::Runtime &runtime) {
52
+ auto payload = jsi::Object(runtime);
53
+ payload.setProperty(runtime, "latitude", event.latitude);
54
+ payload.setProperty(runtime, "longitude", event.longitude);
55
+ return payload;
56
+ });
57
+ }
58
+
59
+ void MapViewEventEmitter::onCameraMove(struct CameraPosition event) const {
60
+ dispatchEvent("CameraMove", [event = std::move(event)](jsi::Runtime &runtime) {
61
+ auto payload = jsi::Object(runtime);
62
+ payload.setProperty(runtime, "zoom", event.zoom);
63
+ payload.setProperty(runtime, "bearing", event.bearing);
64
+ payload.setProperty(runtime, "tilt", event.tilt);
65
+ auto target = jsi::Object(runtime);
66
+ target.setProperty(runtime, "longitude", event.target.longitude);
67
+ target.setProperty(runtime, "latitude", event.target.latitude);
68
+ payload.setProperty(runtime, "targetValue", target);
69
+ return payload;
70
+ });
71
+ }
72
+
73
+ void MapViewEventEmitter::onCameraIdle(struct CameraPosition event) const {
74
+ dispatchEvent("CameraIdle", [event = std::move(event)](jsi::Runtime &runtime) {
75
+ auto payload = jsi::Object(runtime);
76
+ payload.setProperty(runtime, "zoom", event.zoom);
77
+ payload.setProperty(runtime, "bearing", event.bearing);
78
+ payload.setProperty(runtime, "tilt", event.tilt);
79
+ auto target = jsi::Object(runtime);
80
+ target.setProperty(runtime, "longitude", event.target.longitude);
81
+ target.setProperty(runtime, "latitude", event.target.latitude);
82
+ payload.setProperty(runtime, "targetValue", target);
83
+ return payload;
84
+ });
85
+ }
86
+
87
+ void MapViewEventEmitter::onLoad(struct onLoadEvent event) const {
88
+ dispatchEvent("Load", [event = std::move(event)](jsi::Runtime &runtime) {
89
+ auto payload = jsi::Object(runtime);
90
+ return payload;
91
+ });
92
+ }
93
+
94
+
95
+ void MarkerEventEmitter::onPress(struct onPressEvent event) const {
96
+ dispatchEvent("Press", [event = std::move(event)](jsi::Runtime &runtime) {
97
+ auto payload = jsi::Object(runtime);
98
+ return payload;
99
+ });
100
+ }
101
+
102
+ void MarkerEventEmitter::onDragStart(struct onDragStartEvent event) const {
103
+ dispatchEvent("DragStart", [event = std::move(event)](jsi::Runtime &runtime) {
104
+ auto payload = jsi::Object(runtime);
105
+ return payload;
106
+ });
107
+ }
108
+
109
+ void MarkerEventEmitter::onDrag(struct onDragEvent event) const {
110
+ dispatchEvent("Drag", [event = std::move(event)](jsi::Runtime &runtime) {
111
+ auto payload = jsi::Object(runtime);
112
+ return payload;
113
+ });
114
+ }
115
+
116
+ void MarkerEventEmitter::onDragEnd(struct onDragEndEvent event) const {
117
+ dispatchEvent("DragEnd", [event = std::move(event)](jsi::Runtime &runtime) {
118
+ auto payload = jsi::Object(runtime);
119
+ payload.setProperty(runtime, "latitude", event.latitude);
120
+ payload.setProperty(runtime, "longitude", event.longitude);
121
+ return payload;
122
+ });
123
+ }
124
+
125
+ void PolylineEventEmitter::onPress(struct onPressEvent event) const {
126
+ dispatchEvent("Press", [event = std::move(event)](jsi::Runtime &runtime) {
127
+ auto payload = jsi::Object(runtime);
128
+ return payload;
129
+ });
130
+ }
131
+ } // namespace react
132
+ } // namespace facebook
@@ -0,0 +1,111 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2024 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #pragma once
26
+ #include "react/renderer/components/view/ViewEventEmitter.h"
27
+ #include "jsi/jsi.h"
28
+
29
+ namespace facebook {
30
+ namespace react {
31
+ class JSI_EXPORT MapViewEventEmitter : public ViewEventEmitter {
32
+ public:
33
+ using ViewEventEmitter::ViewEventEmitter;
34
+ struct LatLng {
35
+ double latitude;
36
+ double longitude;
37
+ };
38
+ struct LatLngBounds {
39
+ LatLng southwest;
40
+ LatLng northeast;
41
+ };
42
+ struct onPressEvent {
43
+ double latitude;
44
+ double longitude;
45
+ };
46
+ struct onMapPoiEvent {
47
+ std::string id;
48
+ std::string name;
49
+ LatLng latLng;
50
+ };
51
+ struct onLongPressEvent {
52
+ double latitude;
53
+ double longitude;
54
+ };
55
+ struct CameraPosition {
56
+ LatLng target;
57
+ double zoom;
58
+ double bearing;
59
+ double tilt;
60
+ };
61
+
62
+ struct onLoadEvent {};
63
+
64
+ void onPress(struct onPressEvent value) const;
65
+ void onPressPoi(struct onMapPoiEvent value) const;
66
+ void onLongPress(struct onLongPressEvent value) const;
67
+ void onCameraMove(struct CameraPosition value) const;
68
+ void onCameraIdle(struct CameraPosition value) const;
69
+ void onLoad(struct onLoadEvent value) const;
70
+ };
71
+ class JSI_EXPORT CircleEventEmitter : public ViewEventEmitter {
72
+ public:
73
+ using ViewEventEmitter::ViewEventEmitter;
74
+ };
75
+ class JSI_EXPORT HeatMapEventEmitter : public ViewEventEmitter {
76
+ public:
77
+ using ViewEventEmitter::ViewEventEmitter;
78
+ };
79
+
80
+ class JSI_EXPORT MultiPointEventEmitter : public ViewEventEmitter {
81
+ public:
82
+ using ViewEventEmitter::ViewEventEmitter;
83
+ };
84
+
85
+ class JSI_EXPORT MarkerEventEmitter : public ViewEventEmitter {
86
+ public:
87
+ struct onPressEvent {};
88
+ struct onDragStartEvent {};
89
+ struct onDragEvent {};
90
+ struct onDragEndEvent {
91
+ double latitude;
92
+ double longitude;
93
+ };
94
+ void onPress(struct onPressEvent value) const;
95
+ void onDragStart(struct onDragStartEvent value) const;
96
+ void onDrag(struct onDragEvent value) const;
97
+ void onDragEnd(struct onDragEndEvent value) const;
98
+ using ViewEventEmitter::ViewEventEmitter;
99
+ };
100
+ class JSI_EXPORT PolygonEventEmitter : public ViewEventEmitter {
101
+ public:
102
+ using ViewEventEmitter::ViewEventEmitter;
103
+ };
104
+ class JSI_EXPORT PolylineEventEmitter : public ViewEventEmitter {
105
+ public:
106
+ struct onPressEvent {};
107
+ void onPress(struct onPressEvent value) const;
108
+ using ViewEventEmitter::ViewEventEmitter;
109
+ };
110
+ } // namespace react
111
+ } // namespace facebook
@@ -0,0 +1,7 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ file(GLOB rnoh_amap3d_SRC CONFIGURE_DEPENDS *.cpp)
5
+ add_library(rnoh_amap3d SHARED ${rnoh_amap3d_SRC})
6
+ target_include_directories(rnoh_amap3d PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
7
+ target_link_libraries(rnoh_amap3d PUBLIC rnoh)
@@ -0,0 +1,19 @@
1
+ #ifndef HARMONY_MAPVIEW_SRC_MAIN_CPP_COMPONENTDESCRIPTORS_H
2
+ #define HARMONY_MAPVIEW_SRC_MAIN_CPP_COMPONENTDESCRIPTORS_H
3
+
4
+
5
+ #include "ShadowNodes.h"
6
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
7
+
8
+ namespace facebook {
9
+ namespace react {
10
+ using MapViewComponentDescriptor = ConcreteComponentDescriptor<MapViewShadowNode>;
11
+ using HeatMapComponentDescriptor = ConcreteComponentDescriptor<HeatMapShadowNode>;
12
+ using CircleComponentDescriptor = ConcreteComponentDescriptor<CircleShadowNode>;
13
+ using PolylineComponentDescriptor = ConcreteComponentDescriptor<PolylineShadowNode>;
14
+ using PolygonComponentDescriptor = ConcreteComponentDescriptor<PolygonShadowNode>;
15
+ using MultipointComponentDescriptor = ConcreteComponentDescriptor<MultipointShadowNode>;
16
+ using MarkerComponentDescriptor = ConcreteComponentDescriptor<MarkerShadowNode>;
17
+ } // namespace react
18
+ } // namespace facebook
19
+ #endif