react-native-map4d-map-dtqg 0.1.0
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.md +41 -0
- package/android/build.gradle +60 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -0
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -0
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -0
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +122 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +18 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +226 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +212 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +173 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +148 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +138 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +65 -0
- package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -0
- package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -0
- package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -0
- package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -0
- package/ios/Map4dMap.h +7 -0
- package/ios/Map4dMap.m +14 -0
- package/ios/Map4dMap.xcodeproj/project.pbxproj +282 -0
- package/ios/Map4dMapViewManager.m +34 -0
- package/ios/RCTConvert+Map4dMap.h +33 -0
- package/ios/RCTConvert+Map4dMap.m +112 -0
- package/ios/RMFCircle.h +37 -0
- package/ios/RMFCircle.m +100 -0
- package/ios/RMFCircleManager.h +18 -0
- package/ios/RMFCircleManager.m +155 -0
- package/ios/RMFCircleMap4d.h +23 -0
- package/ios/RMFCircleMap4d.m +13 -0
- package/ios/RMFCoordinate.h +22 -0
- package/ios/RMFCoordinate.m +13 -0
- package/ios/RMFDirectionsMarkerOptions.h +24 -0
- package/ios/RMFDirectionsMarkerOptions.m +23 -0
- package/ios/RMFDirectionsRenderer.h +47 -0
- package/ios/RMFDirectionsRenderer.m +182 -0
- package/ios/RMFDirectionsRendererManager.h +17 -0
- package/ios/RMFDirectionsRendererManager.m +84 -0
- package/ios/RMFDirectionsRendererMap4d.h +21 -0
- package/ios/RMFDirectionsRendererMap4d.m +12 -0
- package/ios/RMFDummyView.h +7 -0
- package/ios/RMFDummyView.m +13 -0
- package/ios/RMFEventResponse.h +39 -0
- package/ios/RMFEventResponse.m +98 -0
- package/ios/RMFIcon.h +24 -0
- package/ios/RMFIcon.m +35 -0
- package/ios/RMFMapView.h +84 -0
- package/ios/RMFMapView.m +376 -0
- package/ios/RMFMapViewManager.h +17 -0
- package/ios/RMFMapViewManager.m +493 -0
- package/ios/RMFMarker.h +57 -0
- package/ios/RMFMarker.m +267 -0
- package/ios/RMFMarkerManager.h +17 -0
- package/ios/RMFMarkerManager.m +156 -0
- package/ios/RMFMarkerMap4d.h +19 -0
- package/ios/RMFMarkerMap4d.m +13 -0
- package/ios/RMFPOI.h +38 -0
- package/ios/RMFPOI.m +123 -0
- package/ios/RMFPOIManager.h +18 -0
- package/ios/RMFPOIManager.m +168 -0
- package/ios/RMFPOIMap4d.h +22 -0
- package/ios/RMFPOIMap4d.m +12 -0
- package/ios/RMFPolygon.h +41 -0
- package/ios/RMFPolygon.m +106 -0
- package/ios/RMFPolygonManager.h +18 -0
- package/ios/RMFPolygonManager.m +141 -0
- package/ios/RMFPolygonMap4d.h +23 -0
- package/ios/RMFPolygonMap4d.m +15 -0
- package/ios/RMFPolyline.h +38 -0
- package/ios/RMFPolyline.m +101 -0
- package/ios/RMFPolylineManager.h +18 -0
- package/ios/RMFPolylineManager.m +139 -0
- package/ios/RMFPolylineMap4d.h +22 -0
- package/ios/RMFPolylineMap4d.m +15 -0
- package/ios/building/RMFBuilding.h +41 -0
- package/ios/building/RMFBuilding.m +104 -0
- package/ios/building/RMFBuildingManager.h +19 -0
- package/ios/building/RMFBuildingManager.m +133 -0
- package/ios/building/RMFBuildingMap4d.h +23 -0
- package/ios/building/RMFBuildingMap4d.m +15 -0
- package/ios/overlays/RMFTileOverlay.h +36 -0
- package/ios/overlays/RMFTileOverlay.m +64 -0
- package/ios/overlays/RMFTileOverlayManager.h +17 -0
- package/ios/overlays/RMFTileOverlayManager.m +27 -0
- package/lib/commonjs/components/MFBuilding.js +192 -0
- package/lib/commonjs/components/MFBuilding.js.map +1 -0
- package/lib/commonjs/components/MFCircle.js +181 -0
- package/lib/commonjs/components/MFCircle.js.map +1 -0
- package/lib/commonjs/components/MFDirectionsRenderer.js +240 -0
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -0
- package/lib/commonjs/components/MFMapView.js +375 -0
- package/lib/commonjs/components/MFMapView.js.map +1 -0
- package/lib/commonjs/components/MFMarker.js +255 -0
- package/lib/commonjs/components/MFMarker.js.map +1 -0
- package/lib/commonjs/components/MFPOI.js +204 -0
- package/lib/commonjs/components/MFPOI.js.map +1 -0
- package/lib/commonjs/components/MFPolygon.js +183 -0
- package/lib/commonjs/components/MFPolygon.js.map +1 -0
- package/lib/commonjs/components/MFPolyline.js +173 -0
- package/lib/commonjs/components/MFPolyline.js.map +1 -0
- package/lib/commonjs/components/MFTileOverlay.js +51 -0
- package/lib/commonjs/components/MFTileOverlay.js.map +1 -0
- package/lib/commonjs/components/Map4dMapView.js +19 -0
- package/lib/commonjs/components/Map4dMapView.js.map +1 -0
- package/lib/commonjs/index.js +78 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/components/MFBuilding.js +178 -0
- package/lib/module/components/MFBuilding.js.map +1 -0
- package/lib/module/components/MFCircle.js +167 -0
- package/lib/module/components/MFCircle.js.map +1 -0
- package/lib/module/components/MFDirectionsRenderer.js +226 -0
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -0
- package/lib/module/components/MFMapView.js +361 -0
- package/lib/module/components/MFMapView.js.map +1 -0
- package/lib/module/components/MFMarker.js +240 -0
- package/lib/module/components/MFMarker.js.map +1 -0
- package/lib/module/components/MFPOI.js +190 -0
- package/lib/module/components/MFPOI.js.map +1 -0
- package/lib/module/components/MFPolygon.js +169 -0
- package/lib/module/components/MFPolygon.js.map +1 -0
- package/lib/module/components/MFPolyline.js +159 -0
- package/lib/module/components/MFPolyline.js.map +1 -0
- package/lib/module/components/MFTileOverlay.js +38 -0
- package/lib/module/components/MFTileOverlay.js.map +1 -0
- package/lib/module/components/Map4dMapView.js +10 -0
- package/lib/module/components/Map4dMapView.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/components/Map4dMapView.d.ts +7 -0
- package/package.json +152 -0
- package/react-native-map4d-map.podspec +20 -0
- package/src/components/MFBuilding.js +188 -0
- package/src/components/MFCircle.js +173 -0
- package/src/components/MFDirectionsRenderer.js +237 -0
- package/src/components/MFMapView.js +374 -0
- package/src/components/MFMarker.js +246 -0
- package/src/components/MFPOI.js +184 -0
- package/src/components/MFPolygon.js +186 -0
- package/src/components/MFPolyline.js +172 -0
- package/src/components/MFTileOverlay.js +45 -0
- package/src/components/Map4dMapView.tsx +27 -0
- package/src/index.js +21 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPOIManager.m
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 7/5/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RMFPOIManager.h"
|
|
10
|
+
#import "RMFPOI.h"
|
|
11
|
+
#import "RCTConvert+Map4dMap.h"
|
|
12
|
+
#import <React/RCTBridge.h>
|
|
13
|
+
#import <React/RCTUIManager.h>
|
|
14
|
+
#import <React/RCTConvert+CoreLocation.h>
|
|
15
|
+
#import <Foundation/Foundation.h>
|
|
16
|
+
|
|
17
|
+
@implementation RMFPOIManager
|
|
18
|
+
|
|
19
|
+
RCT_EXPORT_MODULE(RMFPOI)
|
|
20
|
+
|
|
21
|
+
- (UIView *)view {
|
|
22
|
+
RMFPOI * poi = [[RMFPOI alloc] init];
|
|
23
|
+
return poi;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D)
|
|
27
|
+
RCT_EXPORT_VIEW_PROPERTY(title, NSString)
|
|
28
|
+
RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor)
|
|
29
|
+
RCT_EXPORT_VIEW_PROPERTY(subtitle, NSString)
|
|
30
|
+
RCT_EXPORT_VIEW_PROPERTY(poiType, NSString)
|
|
31
|
+
RCT_EXPORT_VIEW_PROPERTY(icon, RMFIcon)
|
|
32
|
+
RCT_EXPORT_VIEW_PROPERTY(zIndex, float)
|
|
33
|
+
RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
|
|
34
|
+
RCT_EXPORT_VIEW_PROPERTY(userData, NSDictionary)
|
|
35
|
+
//RCT_EXPORT_VIEW_PROPERTY(userInteractionEnabled, BOOL)
|
|
36
|
+
|
|
37
|
+
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
38
|
+
|
|
39
|
+
RCT_EXPORT_METHOD(setCoordinate:(nonnull NSNumber *)reactTag
|
|
40
|
+
withCoordinate:(id)coordinate)
|
|
41
|
+
{
|
|
42
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
43
|
+
id view = viewRegistry[reactTag];
|
|
44
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
45
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
46
|
+
} else {
|
|
47
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
48
|
+
[poi setCoordinate:[RCTConvert CLLocationCoordinate2D:coordinate]];
|
|
49
|
+
}
|
|
50
|
+
}];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RCT_EXPORT_METHOD(setTitle:(nonnull NSNumber *)reactTag
|
|
54
|
+
withTitle:(NSString*)title)
|
|
55
|
+
{
|
|
56
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
57
|
+
id view = viewRegistry[reactTag];
|
|
58
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
59
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
60
|
+
} else {
|
|
61
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
62
|
+
[poi setTitle:title];
|
|
63
|
+
}
|
|
64
|
+
}];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
RCT_EXPORT_METHOD(setTitleColor:(nonnull NSNumber *)reactTag
|
|
68
|
+
withColor:(id)json)
|
|
69
|
+
{
|
|
70
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
71
|
+
id view = viewRegistry[reactTag];
|
|
72
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
73
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
74
|
+
} else {
|
|
75
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
76
|
+
UIColor* color = [RCTConvert UIColor:json];
|
|
77
|
+
if (color != nil) {
|
|
78
|
+
[poi setTitleColor:color];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
RCT_EXPORT_METHOD(setSubTitle:(nonnull NSNumber *)reactTag
|
|
85
|
+
withSubTitle:(NSString*)subTitle)
|
|
86
|
+
{
|
|
87
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
88
|
+
id view = viewRegistry[reactTag];
|
|
89
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
90
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
91
|
+
} else {
|
|
92
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
93
|
+
[poi setSubtitle:subTitle];
|
|
94
|
+
}
|
|
95
|
+
}];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
RCT_EXPORT_METHOD(setPoiType:(nonnull NSNumber *)reactTag
|
|
99
|
+
withType:(NSString*)type)
|
|
100
|
+
{
|
|
101
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
102
|
+
id view = viewRegistry[reactTag];
|
|
103
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
104
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
105
|
+
} else {
|
|
106
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
107
|
+
[poi setPoiType:type];
|
|
108
|
+
}
|
|
109
|
+
}];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
RCT_EXPORT_METHOD(setIcon:(nonnull NSNumber *)reactTag
|
|
113
|
+
withIcon:(id)json)
|
|
114
|
+
{
|
|
115
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
116
|
+
id view = viewRegistry[reactTag];
|
|
117
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
118
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
119
|
+
} else {
|
|
120
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
121
|
+
[poi setIcon:[RCTConvert RMFIcon:json]];
|
|
122
|
+
}
|
|
123
|
+
}];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
RCT_EXPORT_METHOD(setZIndex:(nonnull NSNumber *)reactTag
|
|
127
|
+
withZIndex:(float)zIndex)
|
|
128
|
+
{
|
|
129
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
130
|
+
id view = viewRegistry[reactTag];
|
|
131
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
132
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
133
|
+
} else {
|
|
134
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
135
|
+
[poi setZIndex:zIndex];
|
|
136
|
+
}
|
|
137
|
+
}];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
RCT_EXPORT_METHOD(setVisible:(nonnull NSNumber *)reactTag
|
|
141
|
+
visible:(BOOL)visible)
|
|
142
|
+
{
|
|
143
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
144
|
+
id view = viewRegistry[reactTag];
|
|
145
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
146
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
147
|
+
} else {
|
|
148
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
149
|
+
[poi setVisible:visible];
|
|
150
|
+
}
|
|
151
|
+
}];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
RCT_EXPORT_METHOD(setUserData:(nonnull NSNumber *)reactTag
|
|
155
|
+
userData:(id)json)
|
|
156
|
+
{
|
|
157
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
158
|
+
id view = viewRegistry[reactTag];
|
|
159
|
+
if (![view isKindOfClass:[RMFPOI class]]) {
|
|
160
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFMarker, got: %@", view);
|
|
161
|
+
} else {
|
|
162
|
+
RMFPOI *poi = (RMFPOI *)view;
|
|
163
|
+
[poi setUserData:[RCTConvert NSDictionary:json]];
|
|
164
|
+
}
|
|
165
|
+
}];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPOIMap4d.h
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 7/5/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RMFPOIMap4d_h
|
|
10
|
+
#define RMFPOIMap4d_h
|
|
11
|
+
|
|
12
|
+
#import <Map4dMap/Map4dMap.h>
|
|
13
|
+
|
|
14
|
+
@class RMFPOI;
|
|
15
|
+
|
|
16
|
+
@interface RMFPOIMap4d : MFPOI
|
|
17
|
+
|
|
18
|
+
@property (nonatomic, weak) RMFPOI * reactPOI;
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
#endif /* RMFPOIMap4d_h */
|
package/ios/RMFPolygon.h
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolygon.h
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 10/7/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RMFPolygon_h
|
|
10
|
+
#define RMFPolygon_h
|
|
11
|
+
|
|
12
|
+
#import <React/UIView+React.h>
|
|
13
|
+
#import <Map4dMap/Map4dMap.h>
|
|
14
|
+
#import "RMFPolygonMap4d.h"
|
|
15
|
+
#import "RMFMapView.h"
|
|
16
|
+
#import "RMFCoordinate.h"
|
|
17
|
+
|
|
18
|
+
@interface RMFPolygon : UIView
|
|
19
|
+
|
|
20
|
+
@property (nonatomic, strong) RMFPolygonMap4d* map4dPolygon;
|
|
21
|
+
|
|
22
|
+
@property (nonatomic, copy) RCTBubblingEventBlock _Nullable onPress;
|
|
23
|
+
|
|
24
|
+
@property (nonatomic, strong) NSArray<RMFCoordinate*>* coordinates;
|
|
25
|
+
@property (nonatomic, strong) NSArray<NSArray<RMFCoordinate*>*>* holes;
|
|
26
|
+
|
|
27
|
+
@property (nonatomic, assign) UIColor* fillColor;
|
|
28
|
+
@property (nonatomic, assign) CGFloat strokeWidth;
|
|
29
|
+
@property (nonatomic, assign) UIColor* strokeColor;
|
|
30
|
+
|
|
31
|
+
@property(nonatomic, assign) float zIndex;
|
|
32
|
+
@property(nonatomic, assign) BOOL visible;
|
|
33
|
+
@property(nonatomic, copy, nullable) NSDictionary * userData;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
- (void)didTapAtPixel:(CGPoint)pixel;
|
|
37
|
+
- (void)setMapView:(RMFMapView* _Nullable)mapView;
|
|
38
|
+
|
|
39
|
+
@end
|
|
40
|
+
|
|
41
|
+
#endif /* RMFPolygon_h */
|
package/ios/RMFPolygon.m
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolygon.m
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 10/7/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RMFPolygon.h"
|
|
10
|
+
#import "RMFEventResponse.h"
|
|
11
|
+
|
|
12
|
+
@implementation RMFPolygon
|
|
13
|
+
|
|
14
|
+
- (instancetype)init {
|
|
15
|
+
if (self = [super init]) {
|
|
16
|
+
_map4dPolygon = [[RMFPolygonMap4d alloc] init];
|
|
17
|
+
_map4dPolygon.reactPolygon = self;
|
|
18
|
+
|
|
19
|
+
_coordinates = nil;
|
|
20
|
+
_holes = nil;
|
|
21
|
+
_fillColor = _map4dPolygon.fillColor;
|
|
22
|
+
_strokeColor = _map4dPolygon.strokeColor;
|
|
23
|
+
_strokeWidth = _map4dPolygon.strokeWidth;
|
|
24
|
+
_zIndex = _map4dPolygon.zIndex;
|
|
25
|
+
_visible = true;
|
|
26
|
+
_userData = nil;
|
|
27
|
+
}
|
|
28
|
+
return self;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (void)setMapView:(RMFMapView *)mapView {
|
|
32
|
+
_map4dPolygon.map = mapView;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Properties */
|
|
36
|
+
|
|
37
|
+
- (void)setCoordinates:(NSArray<RMFCoordinate *> *)coordinates {
|
|
38
|
+
_coordinates = coordinates;
|
|
39
|
+
MFMutablePath* path = [[MFMutablePath alloc] init];
|
|
40
|
+
for (int i = 0; i < coordinates.count; i++) {
|
|
41
|
+
[path addCoordinate:coordinates[i].coordinate];
|
|
42
|
+
}
|
|
43
|
+
_map4dPolygon.path = path;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)setHoles:(NSArray<NSArray<RMFCoordinate *> *> *)holes {
|
|
47
|
+
_holes = holes;
|
|
48
|
+
|
|
49
|
+
NSMutableArray<MFPath*>* polygonHoles = [[NSMutableArray alloc] init];
|
|
50
|
+
for (int i = 0; i < holes.count; i++) {
|
|
51
|
+
NSArray<RMFCoordinate*>* coordinates = [holes objectAtIndex:i];
|
|
52
|
+
MFMutablePath* path = [[MFMutablePath alloc] init];
|
|
53
|
+
for (int j = 0; j < coordinates.count; j++) {
|
|
54
|
+
[path addCoordinate:coordinates[j].coordinate];
|
|
55
|
+
}
|
|
56
|
+
[polygonHoles addObject:path];
|
|
57
|
+
}
|
|
58
|
+
_map4dPolygon.holes = polygonHoles;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
- (void)setFillColor:(UIColor *)fillColor {
|
|
62
|
+
_fillColor = fillColor;
|
|
63
|
+
_map4dPolygon.fillColor = fillColor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)setStrokeColor:(UIColor *)strokeColor {
|
|
67
|
+
_strokeColor = strokeColor;
|
|
68
|
+
_map4dPolygon.strokeColor = strokeColor;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
- (void)setStrokeWidth:(CGFloat)strokeWidth {
|
|
72
|
+
_strokeWidth = strokeWidth;
|
|
73
|
+
_map4dPolygon.strokeWidth = strokeWidth;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (void)setZIndex:(float)zIndex {
|
|
77
|
+
_zIndex = zIndex;
|
|
78
|
+
_map4dPolygon.zIndex = zIndex;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (void)setVisible:(BOOL)visible {
|
|
82
|
+
_visible = visible;
|
|
83
|
+
_map4dPolygon.isHidden = !visible;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (void)setUserData:(NSDictionary *)userData {
|
|
87
|
+
_userData = userData;
|
|
88
|
+
}
|
|
89
|
+
/** Event */
|
|
90
|
+
- (void)didTapAtPixel:(CGPoint)pixel {
|
|
91
|
+
if (!self.onPress) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
CLLocationCoordinate2D tapLocation = [_map4dPolygon.map.projection coordinateForPoint:pixel];
|
|
96
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
|
|
97
|
+
pixel:pixel]];
|
|
98
|
+
response[@"polygon"] = @{
|
|
99
|
+
@"userData": _userData != nil ? _userData : @{}
|
|
100
|
+
};
|
|
101
|
+
response[@"action"] = @"polygon-press";
|
|
102
|
+
|
|
103
|
+
self.onPress(response);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolygonManager.h
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 10/7/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RMFPolygonManager_h
|
|
10
|
+
#define RMFPolygonManager_h
|
|
11
|
+
|
|
12
|
+
#import <React/RCTViewManager.h>
|
|
13
|
+
|
|
14
|
+
@interface RMFPolygonManager : RCTViewManager
|
|
15
|
+
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
#endif /* RMFPolygonManager_h */
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolygonManager.m
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 10/7/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RMFPolygonManager.h"
|
|
10
|
+
#import "RMFPolygon.h"
|
|
11
|
+
#import "RCTConvert+Map4dMap.h"
|
|
12
|
+
#import <React/RCTBridge.h>
|
|
13
|
+
#import <React/RCTUIManager.h>
|
|
14
|
+
#import <Foundation/Foundation.h>
|
|
15
|
+
|
|
16
|
+
@implementation RMFPolygonManager
|
|
17
|
+
|
|
18
|
+
RCT_EXPORT_MODULE(RMFPolygon)
|
|
19
|
+
|
|
20
|
+
- (UIView *)view {
|
|
21
|
+
RMFPolygon* polygon = [[RMFPolygon alloc] init];
|
|
22
|
+
return polygon;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
RCT_EXPORT_VIEW_PROPERTY(coordinates, RMFCoordinateArray)
|
|
26
|
+
RCT_EXPORT_VIEW_PROPERTY(holes, RMFCoordinateArrayArray)
|
|
27
|
+
RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor)
|
|
28
|
+
RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor)
|
|
29
|
+
RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat)
|
|
30
|
+
RCT_EXPORT_VIEW_PROPERTY(zIndex, float)
|
|
31
|
+
RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
|
|
32
|
+
RCT_EXPORT_VIEW_PROPERTY(userData, NSDictionary)
|
|
33
|
+
|
|
34
|
+
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
RCT_EXPORT_METHOD(setCoordinates:(nonnull NSNumber *)reactTag
|
|
38
|
+
withCoordinates:(id)coordinates)
|
|
39
|
+
{
|
|
40
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
41
|
+
id view = viewRegistry[reactTag];
|
|
42
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
43
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
44
|
+
} else {
|
|
45
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
46
|
+
[polygon setCoordinates:[RCTConvert RMFCoordinateArray:coordinates]];
|
|
47
|
+
}
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
RCT_EXPORT_METHOD(setHoles:(nonnull NSNumber *)reactTag
|
|
52
|
+
withHoles:(id)holes)
|
|
53
|
+
{
|
|
54
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
55
|
+
id view = viewRegistry[reactTag];
|
|
56
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
57
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
58
|
+
} else {
|
|
59
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
60
|
+
[polygon setHoles:[RCTConvert RMFCoordinateArrayArray:holes]];
|
|
61
|
+
}
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
RCT_EXPORT_METHOD(setFillColor:(nonnull NSNumber *)reactTag
|
|
66
|
+
color:(id)json)
|
|
67
|
+
{
|
|
68
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
69
|
+
id view = viewRegistry[reactTag];
|
|
70
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
71
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
72
|
+
} else {
|
|
73
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
74
|
+
UIColor* color = [RCTConvert UIColor:json];
|
|
75
|
+
if (color != nil) {
|
|
76
|
+
[polygon setFillColor:color];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
RCT_EXPORT_METHOD(setStrokeColor:(nonnull NSNumber *)reactTag
|
|
83
|
+
color:(id)json)
|
|
84
|
+
{
|
|
85
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
86
|
+
id view = viewRegistry[reactTag];
|
|
87
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
88
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
89
|
+
} else {
|
|
90
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
91
|
+
UIColor* color = [RCTConvert UIColor:json];
|
|
92
|
+
if (color != nil) {
|
|
93
|
+
[polygon setStrokeColor:color];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
RCT_EXPORT_METHOD(setStrokeWidth:(nonnull NSNumber *)reactTag
|
|
100
|
+
width:(CGFloat)width)
|
|
101
|
+
{
|
|
102
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
103
|
+
id view = viewRegistry[reactTag];
|
|
104
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
105
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
106
|
+
} else {
|
|
107
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
108
|
+
[polygon setStrokeWidth:width];
|
|
109
|
+
}
|
|
110
|
+
}];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
RCT_EXPORT_METHOD(setVisible:(nonnull NSNumber *)reactTag
|
|
114
|
+
visible:(BOOL)visible)
|
|
115
|
+
{
|
|
116
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
117
|
+
id view = viewRegistry[reactTag];
|
|
118
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
119
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
120
|
+
} else {
|
|
121
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
122
|
+
[polygon setVisible:visible];
|
|
123
|
+
}
|
|
124
|
+
}];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
RCT_EXPORT_METHOD(setUserData:(nonnull NSNumber *)reactTag
|
|
128
|
+
userData:(id)json)
|
|
129
|
+
{
|
|
130
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
131
|
+
id view = viewRegistry[reactTag];
|
|
132
|
+
if (![view isKindOfClass:[RMFPolygon class]]) {
|
|
133
|
+
RCTLogError(@"Invalid view returned from registry, expecting RMFPolygon, got: %@", view);
|
|
134
|
+
} else {
|
|
135
|
+
RMFPolygon *polygon = (RMFPolygon *)view;
|
|
136
|
+
[polygon setUserData:[RCTConvert NSDictionary:json]];
|
|
137
|
+
}
|
|
138
|
+
}];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolygonMap4d.h
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 10/7/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RMFPolygonMap4d_h
|
|
10
|
+
#define RMFPolygonMap4d_h
|
|
11
|
+
|
|
12
|
+
#import <Map4dMap/Map4dMap.h>
|
|
13
|
+
|
|
14
|
+
@class RMFPolygon;
|
|
15
|
+
|
|
16
|
+
@interface RMFPolygonMap4d : MFPolygon
|
|
17
|
+
|
|
18
|
+
@property (nonatomic, weak) RMFPolygon *reactPolygon;
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#endif /* RMFPolygonMap4d_h */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolyline.h
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 7/3/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef RMFPolyline_h
|
|
10
|
+
#define RMFPolyline_h
|
|
11
|
+
|
|
12
|
+
#import <React/UIView+React.h>
|
|
13
|
+
#import <Map4dMap/Map4dMap.h>
|
|
14
|
+
#import "RMFPolylineMap4d.h"
|
|
15
|
+
#import "RMFMapView.h"
|
|
16
|
+
#import "RMFCoordinate.h"
|
|
17
|
+
|
|
18
|
+
@interface RMFPolyline : UIView
|
|
19
|
+
|
|
20
|
+
@property (nonatomic, strong) RMFPolylineMap4d * map4dPolyline;
|
|
21
|
+
|
|
22
|
+
@property (nonatomic, copy) RCTBubblingEventBlock _Nullable onPress;
|
|
23
|
+
|
|
24
|
+
@property(nonatomic, strong) NSArray<RMFCoordinate *> * coordinates;
|
|
25
|
+
@property(nonatomic, assign) CGFloat width;
|
|
26
|
+
@property(nonatomic, assign) NSString * lineStyle;
|
|
27
|
+
@property(nonatomic, assign, nullable) UIColor * color;
|
|
28
|
+
@property(nonatomic, assign) float zIndex;
|
|
29
|
+
@property(nonatomic, assign) BOOL visible;
|
|
30
|
+
@property(nonatomic, copy, nullable) NSDictionary * userData;
|
|
31
|
+
|
|
32
|
+
- (void)didTapAtPixel:(CGPoint)pixel;
|
|
33
|
+
- (void)setMapView:(RMFMapView* _Nullable)mapView;
|
|
34
|
+
|
|
35
|
+
@end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#endif /* RMFPolyline_h */
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RMFPolyline.m
|
|
3
|
+
// Map4dMap
|
|
4
|
+
//
|
|
5
|
+
// Created by Huy Dang on 7/3/20.
|
|
6
|
+
// Copyright © 2020 IOTLink. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RMFPolyline.h"
|
|
10
|
+
#import "RMFEventResponse.h"
|
|
11
|
+
|
|
12
|
+
@implementation RMFPolyline
|
|
13
|
+
|
|
14
|
+
- (instancetype)init {
|
|
15
|
+
if ((self = [super init])) {
|
|
16
|
+
_map4dPolyline = [[RMFPolylineMap4d alloc] init];
|
|
17
|
+
_map4dPolyline.reactPolyline = self;
|
|
18
|
+
|
|
19
|
+
_coordinates = nil;
|
|
20
|
+
_width = _map4dPolyline.width;
|
|
21
|
+
_lineStyle = @"solid";//MFPolylineStyleSolid
|
|
22
|
+
_color = _map4dPolyline.color;
|
|
23
|
+
_zIndex = _map4dPolyline.zIndex;
|
|
24
|
+
_visible = true;//!_map4dPolyline.isHidden
|
|
25
|
+
_userData = nil;
|
|
26
|
+
}
|
|
27
|
+
return self;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (void)setMapView:(RMFMapView *)mapView {
|
|
31
|
+
_map4dPolyline.map = mapView;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Properties */
|
|
35
|
+
|
|
36
|
+
- (void)setCoordinates:(NSArray<RMFCoordinate *> *)coordinates {
|
|
37
|
+
_coordinates = coordinates;
|
|
38
|
+
MFMutablePath* path = [[MFMutablePath alloc] init];
|
|
39
|
+
for(int i = 0; i < coordinates.count; i++)
|
|
40
|
+
{
|
|
41
|
+
[path addCoordinate:coordinates[i].coordinate];
|
|
42
|
+
}
|
|
43
|
+
_map4dPolyline.path = path;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)setWidth:(CGFloat)width {
|
|
47
|
+
_width = width;
|
|
48
|
+
_map4dPolyline.width = width;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)setColor:(UIColor *)color {
|
|
52
|
+
_color = color;
|
|
53
|
+
_map4dPolyline.color = color;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)setLineStyle:(NSString *)lineStyle {
|
|
57
|
+
_lineStyle = lineStyle;
|
|
58
|
+
if ([lineStyle isEqualToString:@"dotted"]) {
|
|
59
|
+
_map4dPolyline.strokePattern = [MFStrokePattern dashWithLength:_width gap:_width];
|
|
60
|
+
} else {
|
|
61
|
+
_map4dPolyline.strokePattern = MFStrokePattern.solid;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
- (void)setZIndex:(float)zIndex {
|
|
66
|
+
_zIndex = zIndex;
|
|
67
|
+
_map4dPolyline.zIndex = zIndex;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)setVisible:(BOOL)visible {
|
|
71
|
+
_visible = visible;
|
|
72
|
+
_map4dPolyline.isHidden = !visible;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
- (void)setUserInteractionEnabled:(BOOL)enabled {
|
|
76
|
+
[super setUserInteractionEnabled:enabled];
|
|
77
|
+
_map4dPolyline.userInteractionEnabled = enabled;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (void)setUserData:(NSDictionary *)userData {
|
|
81
|
+
_userData = userData;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Event */
|
|
85
|
+
- (void)didTapAtPixel:(CGPoint)pixel {
|
|
86
|
+
if (!self.onPress) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
CLLocationCoordinate2D tapLocation = [_map4dPolyline.map.projection coordinateForPoint:pixel];
|
|
91
|
+
NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
|
|
92
|
+
pixel:pixel]];
|
|
93
|
+
response[@"polyline"] = @{
|
|
94
|
+
@"userData": _userData != nil ? _userData : @{}
|
|
95
|
+
};
|
|
96
|
+
response[@"action"] = @"polyline-press";
|
|
97
|
+
|
|
98
|
+
self.onPress(response);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@end
|