@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.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +10 -0
- package/harmony/rn_amap3d/BuildProfile.ets +6 -0
- package/harmony/rn_amap3d/build-profile.json5 +28 -0
- package/harmony/rn_amap3d/consumer-rules.txt +0 -0
- package/harmony/rn_amap3d/hvigorfile.ts +6 -0
- package/harmony/rn_amap3d/index.ets +30 -0
- package/harmony/rn_amap3d/obfuscation-rules.txt +18 -0
- package/harmony/rn_amap3d/oh-package.json5 +16 -0
- package/harmony/rn_amap3d/src/main/cpp/AMap3dEventEmitRequestHandler.h +218 -0
- package/harmony/rn_amap3d/src/main/cpp/AMapEventEmitters.cpp +132 -0
- package/harmony/rn_amap3d/src/main/cpp/AMapEventEmitters.h +111 -0
- package/harmony/rn_amap3d/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/rn_amap3d/src/main/cpp/ComponentDescriptors.h +19 -0
- package/harmony/rn_amap3d/src/main/cpp/MapViewJSIBinder.h +168 -0
- package/harmony/rn_amap3d/src/main/cpp/MapViewPackage.h +43 -0
- package/harmony/rn_amap3d/src/main/cpp/Props.cpp +86 -0
- package/harmony/rn_amap3d/src/main/cpp/Props.h +258 -0
- package/harmony/rn_amap3d/src/main/cpp/ShadowNodes.cpp +15 -0
- package/harmony/rn_amap3d/src/main/cpp/ShadowNodes.h +33 -0
- package/harmony/rn_amap3d/src/main/ets/AMap3DModule.ts +32 -0
- package/harmony/rn_amap3d/src/main/ets/AMap3DPackage.ts +46 -0
- package/harmony/rn_amap3d/src/main/ets/GlobalCache.ets +24 -0
- package/harmony/rn_amap3d/src/main/ets/Logger.ets +65 -0
- package/harmony/rn_amap3d/src/main/ets/View/AMapCircle.ets +96 -0
- package/harmony/rn_amap3d/src/main/ets/View/AMapMarker.ets +83 -0
- package/harmony/rn_amap3d/src/main/ets/View/AMapPolygon.ets +52 -0
- package/harmony/rn_amap3d/src/main/ets/View/AMapPolyline.ets +89 -0
- package/harmony/rn_amap3d/src/main/ets/View/MapView.ets +686 -0
- package/harmony/rn_amap3d/src/main/module.json5 +17 -0
- package/harmony/rn_amap3d/src/main/resources/base/element/string.json +8 -0
- package/harmony/rn_amap3d/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/rn_amap3d/src/main/resources/rawfile/location_map_gps_locked.png +0 -0
- package/harmony/rn_amap3d/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/rn_amap3d/ts.ts +28 -0
- package/harmony/rn_amap3d.har +0 -0
- package/lib/src/NativeAMapSdk.ts +9 -0
- package/lib/src/circle.tsx +17 -0
- package/lib/src/circleNativeComponent.ts +47 -0
- package/lib/src/cluster/cluster-view.tsx +47 -0
- package/lib/src/cluster/index.tsx +159 -0
- package/lib/src/component.ts +31 -0
- package/lib/src/heat-map.tsx +17 -0
- package/lib/src/heat-mapNativeComponent.ts +34 -0
- package/lib/src/index.ts +11 -0
- package/lib/src/map-view.tsx +73 -0
- package/lib/src/map-viewNativeComponent.ts +232 -0
- package/lib/src/marker.tsx +32 -0
- package/lib/src/markerNativeComponent.ts +105 -0
- package/lib/src/multi-point.tsx +17 -0
- package/lib/src/multi-pointNativeComponent.ts +51 -0
- package/lib/src/polygon.tsx +17 -0
- package/lib/src/polygonNativeComponent.ts +42 -0
- package/lib/src/polyline.tsx +21 -0
- package/lib/src/polylineNativeComponent.ts +67 -0
- package/lib/src/types.ts +34 -0
- package/package.json +53 -0
- package/react-native.config.js +20 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#ifndef HARMONY_MAPVIEW_SRC_MAIN_CPP_MAPVIEWJSIBINDER_H
|
|
2
|
+
#define HARMONY_MAPVIEW_SRC_MAIN_CPP_MAPVIEWJSIBINDER_H
|
|
3
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
4
|
+
|
|
5
|
+
namespace rnoh {
|
|
6
|
+
class MapViewJSIBinder : public ViewComponentJSIBinder {
|
|
7
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
8
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
9
|
+
object.setProperty(rt, "mapType", "number");
|
|
10
|
+
object.setProperty(rt, "initialCameraPosition", "Object");
|
|
11
|
+
object.setProperty(rt, "myLocationEnabled", "boolean");
|
|
12
|
+
object.setProperty(rt, "indoorViewEnabled", "boolean");
|
|
13
|
+
object.setProperty(rt, "buildingsEnabled", "boolean");
|
|
14
|
+
object.setProperty(rt, "labelsEnabled", "boolean");
|
|
15
|
+
object.setProperty(rt, "compassEnabled", "boolean");
|
|
16
|
+
object.setProperty(rt, "zoomControlsEnabled", "boolean");
|
|
17
|
+
object.setProperty(rt, "scaleControlsEnabled", "boolean");
|
|
18
|
+
object.setProperty(rt, "trafficEnabled", "boolean");
|
|
19
|
+
object.setProperty(rt, "maxZoom", "number");
|
|
20
|
+
object.setProperty(rt, "minZoom", "number");
|
|
21
|
+
object.setProperty(rt, "zoomGesturesEnabled", "boolean");
|
|
22
|
+
object.setProperty(rt, "scrollGesturesEnabled", "boolean");
|
|
23
|
+
object.setProperty(rt, "rotateGesturesEnabled", "boolean");
|
|
24
|
+
object.setProperty(rt, "tiltGesturesEnabled", "boolean");
|
|
25
|
+
object.setProperty(rt, "distanceFilter", "number");
|
|
26
|
+
object.setProperty(rt, "headingFilter", "number");
|
|
27
|
+
return object;
|
|
28
|
+
}
|
|
29
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override
|
|
30
|
+
{
|
|
31
|
+
return facebook::jsi::Object(rt);
|
|
32
|
+
}
|
|
33
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
34
|
+
facebook::jsi::Object events(rt);
|
|
35
|
+
events.setProperty(rt, "topPress", createDirectEvent(rt, "onPress"));
|
|
36
|
+
events.setProperty(rt, "topPressPoi", createDirectEvent(rt, "onPressPoi"));
|
|
37
|
+
events.setProperty(rt, "topLongPress", createDirectEvent(rt, "onLongPress"));
|
|
38
|
+
events.setProperty(rt, "topCameraMove", createDirectEvent(rt, "onCameraMove"));
|
|
39
|
+
events.setProperty(rt, "topCameraIdle", createDirectEvent(rt, "onCameraIdle"));
|
|
40
|
+
events.setProperty(rt, "topLoad", createDirectEvent(rt, "onLoad"));
|
|
41
|
+
return events;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
class CircleJSIBinder : public ViewComponentJSIBinder {
|
|
46
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
47
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
48
|
+
object.setProperty(rt, "center", "Object");
|
|
49
|
+
object.setProperty(rt, "strokeColor", "number");
|
|
50
|
+
object.setProperty(rt, "radius", "number");
|
|
51
|
+
object.setProperty(rt, "strokeWidth", "number");
|
|
52
|
+
object.setProperty(rt, "fillColor", "number");
|
|
53
|
+
object.setProperty(rt, "zIndex", "number");
|
|
54
|
+
return object;
|
|
55
|
+
}
|
|
56
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
57
|
+
return facebook::jsi::Object(rt);
|
|
58
|
+
}
|
|
59
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
60
|
+
facebook::jsi::Object events(rt);
|
|
61
|
+
return events;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
class HeatMapJSIBinder : public ViewComponentJSIBinder {
|
|
66
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
67
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
68
|
+
object.setProperty(rt, "data", "array");
|
|
69
|
+
object.setProperty(rt, "radius", "number");
|
|
70
|
+
object.setProperty(rt, "opacity", "number");
|
|
71
|
+
return object;
|
|
72
|
+
}
|
|
73
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
74
|
+
return facebook::jsi::Object(rt);
|
|
75
|
+
}
|
|
76
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
77
|
+
facebook::jsi::Object events(rt);
|
|
78
|
+
return events;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
class MultipointJSIBinder : public ViewComponentJSIBinder {
|
|
83
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
84
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
85
|
+
object.setProperty(rt, "items", "array");
|
|
86
|
+
object.setProperty(rt, "icon", "Object");
|
|
87
|
+
return object;
|
|
88
|
+
}
|
|
89
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
90
|
+
return facebook::jsi::Object(rt);
|
|
91
|
+
}
|
|
92
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
93
|
+
facebook::jsi::Object events(rt);
|
|
94
|
+
return events;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
class MarkerJSIBinder : public ViewComponentJSIBinder {
|
|
99
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
100
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
101
|
+
object.setProperty(rt, "position", "Object");
|
|
102
|
+
object.setProperty(rt, "opacity", "number");
|
|
103
|
+
object.setProperty(rt, "draggable", "boolean");
|
|
104
|
+
object.setProperty(rt, "flat", "boolean");
|
|
105
|
+
object.setProperty(rt, "zIndex", "number");
|
|
106
|
+
object.setProperty(rt, "anchor", "Object");
|
|
107
|
+
object.setProperty(rt, "centerOffset", "Object");
|
|
108
|
+
object.setProperty(rt, "icon", "number");
|
|
109
|
+
return object;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
113
|
+
return facebook::jsi::Object(rt);
|
|
114
|
+
}
|
|
115
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
116
|
+
facebook::jsi::Object events(rt);
|
|
117
|
+
events.setProperty(rt, "topPress", createDirectEvent(rt, "onPress"));
|
|
118
|
+
events.setProperty(rt, "topDragStart", createDirectEvent(rt, "onDragStart"));
|
|
119
|
+
events.setProperty(rt, "topDrag", createDirectEvent(rt, "onDrag"));
|
|
120
|
+
events.setProperty(rt, "topDragEnd", createDirectEvent(rt, "onDragEnd"));
|
|
121
|
+
return events;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
class PolygonJSIBinder : public ViewComponentJSIBinder {
|
|
126
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
127
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
128
|
+
object.setProperty(rt, "points", "array");
|
|
129
|
+
object.setProperty(rt, "strokeWidth", "number");
|
|
130
|
+
object.setProperty(rt, "strokeColor", "number");
|
|
131
|
+
object.setProperty(rt, "fillColor", "number");
|
|
132
|
+
object.setProperty(rt, "zIndex", "number");
|
|
133
|
+
return object;
|
|
134
|
+
}
|
|
135
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
136
|
+
return facebook::jsi::Object(rt);
|
|
137
|
+
}
|
|
138
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
139
|
+
facebook::jsi::Object events(rt);
|
|
140
|
+
return events;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
class PolylineJSIBinder : public ViewComponentJSIBinder {
|
|
145
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
146
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
147
|
+
object.setProperty(rt, "points", "array");
|
|
148
|
+
object.setProperty(rt, "dotted", "boolean");
|
|
149
|
+
object.setProperty(rt, "geodesic", "boolean");
|
|
150
|
+
object.setProperty(rt, "zIndex", "number");
|
|
151
|
+
object.setProperty(rt, "color", "number");
|
|
152
|
+
object.setProperty(rt, "colors", "array");
|
|
153
|
+
object.setProperty(rt, "gradient", "boolean");
|
|
154
|
+
object.setProperty(rt, "width", "number");
|
|
155
|
+
return object;
|
|
156
|
+
}
|
|
157
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
158
|
+
return facebook::jsi::Object(rt);
|
|
159
|
+
}
|
|
160
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
161
|
+
facebook::jsi::Object events(rt);
|
|
162
|
+
events.setProperty(rt, "topPress", createDirectEvent(rt, "onPress"));
|
|
163
|
+
return events;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
} // namespace rnoh
|
|
168
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#ifndef HARMONY_MAPVIEW_SRC_MAIN_CPP_MAPVIEWPACKAGE_H
|
|
2
|
+
#define HARMONY_MAPVIEW_SRC_MAIN_CPP_MAPVIEWPACKAGE_H
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#include "RNOH/Package.h"
|
|
6
|
+
#include "ComponentDescriptors.h"
|
|
7
|
+
#include "MapViewJSIBinder.h"
|
|
8
|
+
#include "AMap3dEventEmitRequestHandler.h"
|
|
9
|
+
|
|
10
|
+
namespace rnoh {
|
|
11
|
+
|
|
12
|
+
class MapViewPackage : public Package {
|
|
13
|
+
public:
|
|
14
|
+
MapViewPackage(Package::Context ctx) : Package(ctx) {}
|
|
15
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
16
|
+
return {facebook::react::concreteComponentDescriptorProvider<facebook::react::MapViewComponentDescriptor>(),
|
|
17
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::HeatMapComponentDescriptor>(),
|
|
18
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::CircleComponentDescriptor>(),
|
|
19
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::PolylineComponentDescriptor>(),
|
|
20
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::PolygonComponentDescriptor>(),
|
|
21
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::MultipointComponentDescriptor>(),
|
|
22
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::MarkerComponentDescriptor>()};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
26
|
+
return {{"AMapView", std::make_shared<MapViewJSIBinder>()},
|
|
27
|
+
{"AMapHeatMap", std::make_shared<HeatMapJSIBinder>()},
|
|
28
|
+
{"AMapCircle", std::make_shared<CircleJSIBinder>()},
|
|
29
|
+
{"AMapPolyline", std::make_shared<PolylineJSIBinder>()},
|
|
30
|
+
{"AMapPolygon", std::make_shared<PolygonJSIBinder>()},
|
|
31
|
+
{"AMapMultiPoint", std::make_shared<MultipointJSIBinder>()},
|
|
32
|
+
{"AMapMarker", std::make_shared<MarkerJSIBinder>()}};
|
|
33
|
+
}
|
|
34
|
+
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
|
35
|
+
return {
|
|
36
|
+
{std::make_shared<AMapViewEventEmitRequestHandler>()},
|
|
37
|
+
{std::make_shared<AMapMarkerEventEmitRequestHandler>()},
|
|
38
|
+
{std::make_shared<AMapPolylineEventEmitRequestHandler>()},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
} // namespace rnoh
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
2
|
+
#include <react/renderer/core/propsConversions.h>
|
|
3
|
+
#include "Props.h"
|
|
4
|
+
|
|
5
|
+
namespace facebook {
|
|
6
|
+
namespace react {
|
|
7
|
+
|
|
8
|
+
MapViewProps::MapViewProps(const PropsParserContext &context, const MapViewProps &sourceProps, const RawProps &rawProps)
|
|
9
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
10
|
+
initialCameraPosition(convertRawProp(context, rawProps, "initialCameraPosition",
|
|
11
|
+
sourceProps.initialCameraPosition, {{0, 0}, 0, 0, 0})),
|
|
12
|
+
myLocationEnabled(convertRawProp(context, rawProps, "myLocationEnabled", sourceProps.myLocationEnabled, false)),
|
|
13
|
+
indoorViewEnabled(convertRawProp(context, rawProps, "indoorViewEnabled", sourceProps.indoorViewEnabled, false)),
|
|
14
|
+
buildingsEnabled(convertRawProp(context, rawProps, "buildingsEnabled", sourceProps.buildingsEnabled, false)),
|
|
15
|
+
labelsEnabled(convertRawProp(context, rawProps, "labelsEnabled", sourceProps.labelsEnabled, false)),
|
|
16
|
+
compassEnabled(convertRawProp(context, rawProps, "compassEnabled", sourceProps.compassEnabled, false)),
|
|
17
|
+
zoomControlsEnabled(
|
|
18
|
+
convertRawProp(context, rawProps, "zoomControlsEnabled", sourceProps.zoomControlsEnabled, false)),
|
|
19
|
+
scaleControlsEnabled(
|
|
20
|
+
convertRawProp(context, rawProps, "scaleControlsEnabled", sourceProps.scaleControlsEnabled, false)),
|
|
21
|
+
trafficEnabled(convertRawProp(context, rawProps, "trafficEnabled", sourceProps.trafficEnabled, false)),
|
|
22
|
+
maxZoom(convertRawProp(context, rawProps, "maxZoom", sourceProps.maxZoom, 0.f)),
|
|
23
|
+
minZoom(convertRawProp(context, rawProps, "minZoom", sourceProps.minZoom, 0.f)),
|
|
24
|
+
mapType(convertRawProp(context, rawProps, "mapType", sourceProps.mapType, 0)),
|
|
25
|
+
zoomGesturesEnabled(
|
|
26
|
+
convertRawProp(context, rawProps, "zoomGesturesEnabled", sourceProps.zoomGesturesEnabled, false)),
|
|
27
|
+
scrollGesturesEnabled(
|
|
28
|
+
convertRawProp(context, rawProps, "scrollGesturesEnabled", sourceProps.scrollGesturesEnabled, false)),
|
|
29
|
+
rotateGesturesEnabled(
|
|
30
|
+
convertRawProp(context, rawProps, "rotateGesturesEnabled", sourceProps.rotateGesturesEnabled, false)),
|
|
31
|
+
tiltGesturesEnabled(
|
|
32
|
+
convertRawProp(context, rawProps, "tiltGesturesEnabled", sourceProps.tiltGesturesEnabled, false)) {}
|
|
33
|
+
|
|
34
|
+
CircleProps::CircleProps(const PropsParserContext &context, const CircleProps &sourceProps, const RawProps &rawProps)
|
|
35
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
36
|
+
circle(convertRawProp(context, rawProps, "data", sourceProps.circle, {0, 0})),
|
|
37
|
+
radius(convertRawProp(context, rawProps, "radius", sourceProps.radius, 2.f)),
|
|
38
|
+
strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, 1.f)),
|
|
39
|
+
strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, 0x000000)),
|
|
40
|
+
fillColor(convertRawProp(context, rawProps, "fillColor", sourceProps.fillColor, 0x000000)),
|
|
41
|
+
levelIndex(convertRawProp(context, rawProps, "zIndex", sourceProps.levelIndex, 0)) {}
|
|
42
|
+
|
|
43
|
+
HeatMapProps::HeatMapProps(const PropsParserContext &context, const HeatMapProps &sourceProps, const RawProps &rawProps)
|
|
44
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
45
|
+
radius(convertRawProp(context, rawProps, "radius", sourceProps.radius, 2.f)),
|
|
46
|
+
opacity(convertRawProp(context, rawProps, "opacity", sourceProps.opacity, 0.f)),
|
|
47
|
+
data(convertRawProp(context, rawProps, "data", sourceProps.data, {{0, 0}, {0, 0}, {0, 0}})) {}
|
|
48
|
+
|
|
49
|
+
MultipointProps::MultipointProps(const PropsParserContext &context, const MultipointProps &sourceProps,
|
|
50
|
+
const RawProps &rawProps)
|
|
51
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
52
|
+
items(convertRawProp(context, rawProps, "items", sourceProps.items, {{0, 0}, {0, 0}, {0, 0}})),
|
|
53
|
+
icon(convertRawProp(context, rawProps, "radius", sourceProps.icon, {"/0", 0, 0, 0, "/0", "/0", "/0"})) {}
|
|
54
|
+
|
|
55
|
+
MarkerProps::MarkerProps(const PropsParserContext &context, const MarkerProps &sourceProps, const RawProps &rawProps)
|
|
56
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
57
|
+
draggable(convertRawProp(context, rawProps, "draggable", sourceProps.draggable, false)),
|
|
58
|
+
flat(convertRawProp(context, rawProps, "flat", sourceProps.flat, false)),
|
|
59
|
+
anchor(convertRawProp(context, rawProps, "anchor", sourceProps.anchor, {0,0})),
|
|
60
|
+
centerOffset(convertRawProp(context, rawProps, "centerOffset", sourceProps.centerOffset, {0,0})),
|
|
61
|
+
position(convertRawProp(context, rawProps, "position", sourceProps.position, {0,0})),
|
|
62
|
+
levelIndex(convertRawProp(context, rawProps, "zIndex", sourceProps.levelIndex, 0)),
|
|
63
|
+
icon(convertRawProp(context, rawProps, "icon", sourceProps.icon,{"/0", 0, 0, 0, "/0", "/0", "/0"})) {}
|
|
64
|
+
|
|
65
|
+
PolylineProps::PolylineProps(const PropsParserContext &context, const PolylineProps &sourceProps,
|
|
66
|
+
const RawProps &rawProps)
|
|
67
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
68
|
+
width(convertRawProp(context, rawProps, "width", sourceProps.width, 1.f)),
|
|
69
|
+
color(convertRawProp(context, rawProps, "color", sourceProps.color, 0x000000)),
|
|
70
|
+
colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {0xFF5566,0x112233,0x114477})),
|
|
71
|
+
levelIndex(convertRawProp(context, rawProps, "zIndex", sourceProps.levelIndex, 0.f)),
|
|
72
|
+
geodesic(convertRawProp(context, rawProps, "geodesic", sourceProps.geodesic, false)),
|
|
73
|
+
dotted(convertRawProp(context, rawProps, "dotted", sourceProps.dotted, false)),
|
|
74
|
+
gradient(convertRawProp(context, rawProps, "gradient", sourceProps.gradient, false)),
|
|
75
|
+
points(convertRawProp(context, rawProps, "points", sourceProps.points, {{0, 0}, {0, 0}, {0, 0}})) {}
|
|
76
|
+
|
|
77
|
+
PolygonProps::PolygonProps(const PropsParserContext &context, const PolygonProps &sourceProps, const RawProps &rawProps)
|
|
78
|
+
: ViewProps(context, sourceProps, rawProps),
|
|
79
|
+
points(convertRawProp(context, rawProps, "points", sourceProps.points, {{0, 0}, {0, 0}, {0, 0}})),
|
|
80
|
+
strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, 1.f)),
|
|
81
|
+
strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, 0x000000)),
|
|
82
|
+
fillColor(convertRawProp(context, rawProps, "fillColor", sourceProps.fillColor, 0x000000)),
|
|
83
|
+
levelIndex(convertRawProp(context, rawProps, "zIndex", sourceProps.levelIndex, 0.f)) {}
|
|
84
|
+
|
|
85
|
+
} // namespace react
|
|
86
|
+
} // namespace facebook
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
#ifndef HARMONY_RN_AMAP3D_SRC_MAIN_CPP_PROPS_H
|
|
2
|
+
#define HARMONY_RN_AMAP3D_SRC_MAIN_CPP_PROPS_H
|
|
3
|
+
|
|
4
|
+
#include <jsi/jsi.h>
|
|
5
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
6
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
7
|
+
#include <react/renderer/core/propsConversions.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook {
|
|
10
|
+
namespace react {
|
|
11
|
+
|
|
12
|
+
struct LatLng {
|
|
13
|
+
double latitude;
|
|
14
|
+
double longitude;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
struct CameraPosition {
|
|
18
|
+
LatLng target;
|
|
19
|
+
double zoom;
|
|
20
|
+
double bearing;
|
|
21
|
+
double tilt;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct ImageSourcePropType {
|
|
25
|
+
std::string uri;
|
|
26
|
+
double width;
|
|
27
|
+
double height;
|
|
28
|
+
double scale;
|
|
29
|
+
std::string method;
|
|
30
|
+
std::string body;
|
|
31
|
+
std::string bundle;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
static inline void fromRawValue(const PropsParserContext &context, const RawValue &value, LatLng &result) {
|
|
35
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
36
|
+
auto tmp_latitude = map.find("latitude");
|
|
37
|
+
if (tmp_latitude != map.end()) {
|
|
38
|
+
fromRawValue(context, tmp_latitude->second, result.latitude);
|
|
39
|
+
}
|
|
40
|
+
auto tmp_longitude = map.find("longitude");
|
|
41
|
+
if (tmp_longitude != map.end()) {
|
|
42
|
+
fromRawValue(context, tmp_longitude->second, result.longitude);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static inline std::string toString(const LatLng &value) { return "[Object LatLng]"; }
|
|
47
|
+
|
|
48
|
+
static inline void fromRawValue(const PropsParserContext &context, const RawValue &value, CameraPosition &result) {
|
|
49
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
50
|
+
auto tmp_target = map.find("target");
|
|
51
|
+
if (tmp_target != map.end()) {
|
|
52
|
+
fromRawValue(context, tmp_target->second, result.target);
|
|
53
|
+
}
|
|
54
|
+
auto tmp_zoom = map.find("zoom");
|
|
55
|
+
if (tmp_zoom != map.end()) {
|
|
56
|
+
fromRawValue(context, tmp_zoom->second, result.zoom);
|
|
57
|
+
}
|
|
58
|
+
auto tmp_bearing = map.find("bearing");
|
|
59
|
+
if (tmp_bearing != map.end()) {
|
|
60
|
+
fromRawValue(context, tmp_bearing->second, result.bearing);
|
|
61
|
+
}
|
|
62
|
+
auto tmp_tilt = map.find("tilt");
|
|
63
|
+
if (tmp_tilt != map.end()) {
|
|
64
|
+
fromRawValue(context, tmp_tilt->second, result.tilt);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static inline std::string toString(const CameraPosition &value) { return "[Object CameraPosition]"; }
|
|
69
|
+
|
|
70
|
+
static inline void fromRawValue(const PropsParserContext &context, const RawValue &value, ImageSourcePropType &result) {
|
|
71
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
72
|
+
auto tmp_uri = map.find("uri");
|
|
73
|
+
if (tmp_uri != map.end()) {
|
|
74
|
+
fromRawValue(context, tmp_uri->second, result.uri);
|
|
75
|
+
}
|
|
76
|
+
auto tmp_width = map.find("width");
|
|
77
|
+
if (tmp_width != map.end()) {
|
|
78
|
+
fromRawValue(context, tmp_width->second, result.width);
|
|
79
|
+
}
|
|
80
|
+
auto tmp_height = map.find("height");
|
|
81
|
+
if (tmp_height != map.end()) {
|
|
82
|
+
fromRawValue(context, tmp_height->second, result.height);
|
|
83
|
+
}
|
|
84
|
+
auto tmp_scale = map.find("scale");
|
|
85
|
+
if (tmp_scale != map.end()) {
|
|
86
|
+
fromRawValue(context, tmp_scale->second, result.scale);
|
|
87
|
+
}
|
|
88
|
+
auto tmp_method = map.find("method");
|
|
89
|
+
if (tmp_method != map.end()) {
|
|
90
|
+
fromRawValue(context, tmp_method->second, result.method);
|
|
91
|
+
}
|
|
92
|
+
auto tmp_body = map.find("body");
|
|
93
|
+
if (tmp_body != map.end()) {
|
|
94
|
+
fromRawValue(context, tmp_body->second, result.body);
|
|
95
|
+
}
|
|
96
|
+
auto tmp_bundle = map.find("bundle");
|
|
97
|
+
if (tmp_bundle != map.end()) {
|
|
98
|
+
fromRawValue(context, tmp_bundle->second, result.bundle);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static inline std::string toString(const ImageSourcePropType &value) { return "[Object ImageSourcePropType]"; }
|
|
103
|
+
|
|
104
|
+
class JSI_EXPORT MapViewProps final : public ViewProps {
|
|
105
|
+
public:
|
|
106
|
+
MapViewProps() = default;
|
|
107
|
+
MapViewProps(const PropsParserContext &context, const MapViewProps &sourceProps, const RawProps &rawProps);
|
|
108
|
+
|
|
109
|
+
#pragma mark - Props
|
|
110
|
+
// 地图类型
|
|
111
|
+
int mapType;
|
|
112
|
+
// 初始状态
|
|
113
|
+
CameraPosition initialCameraPosition;
|
|
114
|
+
// 是否显示当前定位
|
|
115
|
+
bool myLocationEnabled;
|
|
116
|
+
// 是否显示室内地图
|
|
117
|
+
bool indoorViewEnabled;
|
|
118
|
+
// 是否显示3D建筑
|
|
119
|
+
bool buildingsEnabled;
|
|
120
|
+
// 是否显示标注
|
|
121
|
+
bool labelsEnabled;
|
|
122
|
+
// 是否显示指南针
|
|
123
|
+
bool compassEnabled;
|
|
124
|
+
// 是否显示放大缩小按钮
|
|
125
|
+
bool zoomControlsEnabled;
|
|
126
|
+
// 是否显示比例尺
|
|
127
|
+
bool scaleControlsEnabled;
|
|
128
|
+
// 是否显示路况
|
|
129
|
+
bool trafficEnabled;
|
|
130
|
+
// 最大缩放级别
|
|
131
|
+
double maxZoom;
|
|
132
|
+
// 最小缩放级别
|
|
133
|
+
double minZoom;
|
|
134
|
+
// 是否启用缩放手势,用于放大缩小
|
|
135
|
+
bool zoomGesturesEnabled;
|
|
136
|
+
// 是否启用滑动手势,用于平移
|
|
137
|
+
bool scrollGesturesEnabled;
|
|
138
|
+
// 是否启用旋转手势,用于调整方向
|
|
139
|
+
bool rotateGesturesEnabled;
|
|
140
|
+
// 是否启用倾斜手势,用于改变视角
|
|
141
|
+
bool tiltGesturesEnabled;
|
|
142
|
+
//设定定位的最小更新距离
|
|
143
|
+
double distanceFilter;
|
|
144
|
+
//设定最小更新角度,默认为 1 度
|
|
145
|
+
double headingFilter;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
class JSI_EXPORT CircleProps final : public ViewProps {
|
|
149
|
+
public:
|
|
150
|
+
CircleProps() = default;
|
|
151
|
+
CircleProps(const PropsParserContext &context, const CircleProps &sourceProps, const RawProps &rawProps);
|
|
152
|
+
|
|
153
|
+
#pragma mark - CircleProps
|
|
154
|
+
// 圆点坐标
|
|
155
|
+
LatLng circle;
|
|
156
|
+
// 半径
|
|
157
|
+
double radius;
|
|
158
|
+
// 边线宽度
|
|
159
|
+
double strokeWidth;
|
|
160
|
+
// 边线颜色
|
|
161
|
+
int strokeColor;
|
|
162
|
+
// 填充颜色
|
|
163
|
+
int fillColor;
|
|
164
|
+
// 层级
|
|
165
|
+
int levelIndex;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
class JSI_EXPORT HeatMapProps final : public ViewProps {
|
|
169
|
+
public:
|
|
170
|
+
HeatMapProps() = default;
|
|
171
|
+
HeatMapProps(const PropsParserContext &context, const HeatMapProps &sourceProps, const RawProps &rawProps);
|
|
172
|
+
#pragma mark - HeatMapProps
|
|
173
|
+
// 节点坐标
|
|
174
|
+
std::vector<LatLng> data;
|
|
175
|
+
// 半径(米)
|
|
176
|
+
double radius;
|
|
177
|
+
// 透明度
|
|
178
|
+
double opacity;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
class JSI_EXPORT MultipointProps final : public ViewProps {
|
|
182
|
+
public:
|
|
183
|
+
MultipointProps() = default;
|
|
184
|
+
MultipointProps(const PropsParserContext &context, const MultipointProps &sourceProps, const RawProps &rawProps);
|
|
185
|
+
|
|
186
|
+
#pragma mark - Multipoint
|
|
187
|
+
// 坐标点集合
|
|
188
|
+
std::vector<LatLng> items;
|
|
189
|
+
// icon
|
|
190
|
+
ImageSourcePropType icon;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
class JSI_EXPORT MarkerProps final : public ViewProps {
|
|
194
|
+
public:
|
|
195
|
+
MarkerProps() = default;
|
|
196
|
+
MarkerProps(const PropsParserContext &context, const MarkerProps &sourceProps, const RawProps &rawProps);
|
|
197
|
+
|
|
198
|
+
#pragma mark - MarkerProps
|
|
199
|
+
// 坐标
|
|
200
|
+
LatLng position;
|
|
201
|
+
// 是否可拖拽
|
|
202
|
+
bool draggable;
|
|
203
|
+
// 是否平贴地图
|
|
204
|
+
bool flat;
|
|
205
|
+
// 层级
|
|
206
|
+
int levelIndex;
|
|
207
|
+
// 覆盖物锚点比例
|
|
208
|
+
Point anchor;
|
|
209
|
+
//覆盖物偏移位置
|
|
210
|
+
Point centerOffset;
|
|
211
|
+
// icon
|
|
212
|
+
ImageSourcePropType icon;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
class JSI_EXPORT PolylineProps final : public ViewProps {
|
|
216
|
+
public:
|
|
217
|
+
PolylineProps() = default;
|
|
218
|
+
PolylineProps(const PropsParserContext &context, const PolylineProps &sourceProps, const RawProps &rawProps);
|
|
219
|
+
|
|
220
|
+
#pragma mark - PolylineProps
|
|
221
|
+
// 节点坐标
|
|
222
|
+
std::vector<LatLng> points;
|
|
223
|
+
// 线段宽度
|
|
224
|
+
double width;
|
|
225
|
+
// 线段颜色
|
|
226
|
+
int color;
|
|
227
|
+
// 多段颜色
|
|
228
|
+
std::vector<int> colors;
|
|
229
|
+
// 层级
|
|
230
|
+
double levelIndex;
|
|
231
|
+
// 是否绘制大地线
|
|
232
|
+
bool geodesic;
|
|
233
|
+
// 是否绘制虚线
|
|
234
|
+
bool dotted;
|
|
235
|
+
// 是否颜色渐变
|
|
236
|
+
bool gradient;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
class JSI_EXPORT PolygonProps final : public ViewProps {
|
|
240
|
+
public:
|
|
241
|
+
PolygonProps() = default;
|
|
242
|
+
PolygonProps(const PropsParserContext &context, const PolygonProps &sourceProps, const RawProps &rawProps);
|
|
243
|
+
|
|
244
|
+
#pragma mark - PolygonProps
|
|
245
|
+
// 节点坐标
|
|
246
|
+
std::vector<LatLng> points;
|
|
247
|
+
// 边线宽度
|
|
248
|
+
double strokeWidth;
|
|
249
|
+
// 边线颜色
|
|
250
|
+
int strokeColor;
|
|
251
|
+
// 填充颜色
|
|
252
|
+
int fillColor;
|
|
253
|
+
// 层级
|
|
254
|
+
double levelIndex;
|
|
255
|
+
};
|
|
256
|
+
} // namespace react
|
|
257
|
+
} // namespace facebook
|
|
258
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#include "ShadowNodes.h"
|
|
2
|
+
|
|
3
|
+
namespace facebook {
|
|
4
|
+
namespace react {
|
|
5
|
+
|
|
6
|
+
extern const char MapViewComponentName[] = "AMapView";
|
|
7
|
+
extern const char HeatMapComponentName[] = "AMapHeatMap";
|
|
8
|
+
extern const char CircleComponentName[] = "AMapCircle";
|
|
9
|
+
extern const char PolylineComponentName[] = "AMapPolyline";
|
|
10
|
+
extern const char PolygonComponentName[] = "AMapPolygon";
|
|
11
|
+
extern const char MultipointComponentName[] = "AMapMultiPoint";
|
|
12
|
+
extern const char MarkerComponentName[] = "AMapMarker";
|
|
13
|
+
|
|
14
|
+
} // namespace react
|
|
15
|
+
} // namespace facebook
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#ifndef HARMONY_MAPVIEW_SRC_MAIN_CPP_SHADOWNODES_H
|
|
2
|
+
#define HARMONY_MAPVIEW_SRC_MAIN_CPP_SHADOWNODES_H
|
|
3
|
+
|
|
4
|
+
#include "Props.h"
|
|
5
|
+
#include "AMapEventEmitters.h"
|
|
6
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
7
|
+
#include <jsi/jsi.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook {
|
|
10
|
+
namespace react {
|
|
11
|
+
|
|
12
|
+
JSI_EXPORT extern const char MapViewComponentName[];
|
|
13
|
+
JSI_EXPORT extern const char HeatMapComponentName[];
|
|
14
|
+
JSI_EXPORT extern const char CircleComponentName[];
|
|
15
|
+
JSI_EXPORT extern const char PolylineComponentName[];
|
|
16
|
+
JSI_EXPORT extern const char PolygonComponentName[];
|
|
17
|
+
JSI_EXPORT extern const char MultipointComponentName[];
|
|
18
|
+
JSI_EXPORT extern const char MarkerComponentName[];
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* `ShadowNode` for <RNCViewPager> component.
|
|
22
|
+
*/
|
|
23
|
+
using MapViewShadowNode = ConcreteViewShadowNode<MapViewComponentName, MapViewProps,MapViewEventEmitter>;
|
|
24
|
+
using HeatMapShadowNode = ConcreteViewShadowNode<HeatMapComponentName, HeatMapProps,HeatMapEventEmitter>;
|
|
25
|
+
using CircleShadowNode = ConcreteViewShadowNode<CircleComponentName, CircleProps,CircleEventEmitter>;
|
|
26
|
+
using PolylineShadowNode = ConcreteViewShadowNode<PolylineComponentName, PolylineProps,PolylineEventEmitter>;
|
|
27
|
+
using PolygonShadowNode = ConcreteViewShadowNode<PolygonComponentName, PolygonProps,PolygonEventEmitter>;
|
|
28
|
+
using MultipointShadowNode = ConcreteViewShadowNode<MultipointComponentName, MultipointProps,MultiPointEventEmitter>;
|
|
29
|
+
using MarkerShadowNode = ConcreteViewShadowNode<MarkerComponentName, MarkerProps,MarkerEventEmitter>;
|
|
30
|
+
|
|
31
|
+
} // namespace react
|
|
32
|
+
} // namespace facebook
|
|
33
|
+
#endif
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export class AMap3DModule extends TurboModule {
|
|
29
|
+
constructor(ctx: TurboModuleContext) {
|
|
30
|
+
super(ctx);
|
|
31
|
+
}
|
|
32
|
+
}
|