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.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +41 -0
  3. package/android/build.gradle +60 -0
  4. package/android/src/main/AndroidManifest.xml +4 -0
  5. package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -0
  6. package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -0
  7. package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -0
  8. package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -0
  9. package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -0
  10. package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -0
  11. package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -0
  12. package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +122 -0
  13. package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -0
  14. package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -0
  15. package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +18 -0
  16. package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -0
  17. package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +226 -0
  18. package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -0
  19. package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +212 -0
  20. package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -0
  21. package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -0
  22. package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +173 -0
  23. package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +148 -0
  24. package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -0
  25. package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +138 -0
  26. package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -0
  27. package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +65 -0
  28. package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -0
  29. package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -0
  30. package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -0
  31. package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -0
  32. package/ios/Map4dMap.h +7 -0
  33. package/ios/Map4dMap.m +14 -0
  34. package/ios/Map4dMap.xcodeproj/project.pbxproj +282 -0
  35. package/ios/Map4dMapViewManager.m +34 -0
  36. package/ios/RCTConvert+Map4dMap.h +33 -0
  37. package/ios/RCTConvert+Map4dMap.m +112 -0
  38. package/ios/RMFCircle.h +37 -0
  39. package/ios/RMFCircle.m +100 -0
  40. package/ios/RMFCircleManager.h +18 -0
  41. package/ios/RMFCircleManager.m +155 -0
  42. package/ios/RMFCircleMap4d.h +23 -0
  43. package/ios/RMFCircleMap4d.m +13 -0
  44. package/ios/RMFCoordinate.h +22 -0
  45. package/ios/RMFCoordinate.m +13 -0
  46. package/ios/RMFDirectionsMarkerOptions.h +24 -0
  47. package/ios/RMFDirectionsMarkerOptions.m +23 -0
  48. package/ios/RMFDirectionsRenderer.h +47 -0
  49. package/ios/RMFDirectionsRenderer.m +182 -0
  50. package/ios/RMFDirectionsRendererManager.h +17 -0
  51. package/ios/RMFDirectionsRendererManager.m +84 -0
  52. package/ios/RMFDirectionsRendererMap4d.h +21 -0
  53. package/ios/RMFDirectionsRendererMap4d.m +12 -0
  54. package/ios/RMFDummyView.h +7 -0
  55. package/ios/RMFDummyView.m +13 -0
  56. package/ios/RMFEventResponse.h +39 -0
  57. package/ios/RMFEventResponse.m +98 -0
  58. package/ios/RMFIcon.h +24 -0
  59. package/ios/RMFIcon.m +35 -0
  60. package/ios/RMFMapView.h +84 -0
  61. package/ios/RMFMapView.m +376 -0
  62. package/ios/RMFMapViewManager.h +17 -0
  63. package/ios/RMFMapViewManager.m +493 -0
  64. package/ios/RMFMarker.h +57 -0
  65. package/ios/RMFMarker.m +267 -0
  66. package/ios/RMFMarkerManager.h +17 -0
  67. package/ios/RMFMarkerManager.m +156 -0
  68. package/ios/RMFMarkerMap4d.h +19 -0
  69. package/ios/RMFMarkerMap4d.m +13 -0
  70. package/ios/RMFPOI.h +38 -0
  71. package/ios/RMFPOI.m +123 -0
  72. package/ios/RMFPOIManager.h +18 -0
  73. package/ios/RMFPOIManager.m +168 -0
  74. package/ios/RMFPOIMap4d.h +22 -0
  75. package/ios/RMFPOIMap4d.m +12 -0
  76. package/ios/RMFPolygon.h +41 -0
  77. package/ios/RMFPolygon.m +106 -0
  78. package/ios/RMFPolygonManager.h +18 -0
  79. package/ios/RMFPolygonManager.m +141 -0
  80. package/ios/RMFPolygonMap4d.h +23 -0
  81. package/ios/RMFPolygonMap4d.m +15 -0
  82. package/ios/RMFPolyline.h +38 -0
  83. package/ios/RMFPolyline.m +101 -0
  84. package/ios/RMFPolylineManager.h +18 -0
  85. package/ios/RMFPolylineManager.m +139 -0
  86. package/ios/RMFPolylineMap4d.h +22 -0
  87. package/ios/RMFPolylineMap4d.m +15 -0
  88. package/ios/building/RMFBuilding.h +41 -0
  89. package/ios/building/RMFBuilding.m +104 -0
  90. package/ios/building/RMFBuildingManager.h +19 -0
  91. package/ios/building/RMFBuildingManager.m +133 -0
  92. package/ios/building/RMFBuildingMap4d.h +23 -0
  93. package/ios/building/RMFBuildingMap4d.m +15 -0
  94. package/ios/overlays/RMFTileOverlay.h +36 -0
  95. package/ios/overlays/RMFTileOverlay.m +64 -0
  96. package/ios/overlays/RMFTileOverlayManager.h +17 -0
  97. package/ios/overlays/RMFTileOverlayManager.m +27 -0
  98. package/lib/commonjs/components/MFBuilding.js +192 -0
  99. package/lib/commonjs/components/MFBuilding.js.map +1 -0
  100. package/lib/commonjs/components/MFCircle.js +181 -0
  101. package/lib/commonjs/components/MFCircle.js.map +1 -0
  102. package/lib/commonjs/components/MFDirectionsRenderer.js +240 -0
  103. package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -0
  104. package/lib/commonjs/components/MFMapView.js +375 -0
  105. package/lib/commonjs/components/MFMapView.js.map +1 -0
  106. package/lib/commonjs/components/MFMarker.js +255 -0
  107. package/lib/commonjs/components/MFMarker.js.map +1 -0
  108. package/lib/commonjs/components/MFPOI.js +204 -0
  109. package/lib/commonjs/components/MFPOI.js.map +1 -0
  110. package/lib/commonjs/components/MFPolygon.js +183 -0
  111. package/lib/commonjs/components/MFPolygon.js.map +1 -0
  112. package/lib/commonjs/components/MFPolyline.js +173 -0
  113. package/lib/commonjs/components/MFPolyline.js.map +1 -0
  114. package/lib/commonjs/components/MFTileOverlay.js +51 -0
  115. package/lib/commonjs/components/MFTileOverlay.js.map +1 -0
  116. package/lib/commonjs/components/Map4dMapView.js +19 -0
  117. package/lib/commonjs/components/Map4dMapView.js.map +1 -0
  118. package/lib/commonjs/index.js +78 -0
  119. package/lib/commonjs/index.js.map +1 -0
  120. package/lib/module/components/MFBuilding.js +178 -0
  121. package/lib/module/components/MFBuilding.js.map +1 -0
  122. package/lib/module/components/MFCircle.js +167 -0
  123. package/lib/module/components/MFCircle.js.map +1 -0
  124. package/lib/module/components/MFDirectionsRenderer.js +226 -0
  125. package/lib/module/components/MFDirectionsRenderer.js.map +1 -0
  126. package/lib/module/components/MFMapView.js +361 -0
  127. package/lib/module/components/MFMapView.js.map +1 -0
  128. package/lib/module/components/MFMarker.js +240 -0
  129. package/lib/module/components/MFMarker.js.map +1 -0
  130. package/lib/module/components/MFPOI.js +190 -0
  131. package/lib/module/components/MFPOI.js.map +1 -0
  132. package/lib/module/components/MFPolygon.js +169 -0
  133. package/lib/module/components/MFPolygon.js.map +1 -0
  134. package/lib/module/components/MFPolyline.js +159 -0
  135. package/lib/module/components/MFPolyline.js.map +1 -0
  136. package/lib/module/components/MFTileOverlay.js +38 -0
  137. package/lib/module/components/MFTileOverlay.js.map +1 -0
  138. package/lib/module/components/Map4dMapView.js +10 -0
  139. package/lib/module/components/Map4dMapView.js.map +1 -0
  140. package/lib/module/index.js +11 -0
  141. package/lib/module/index.js.map +1 -0
  142. package/lib/typescript/components/Map4dMapView.d.ts +7 -0
  143. package/package.json +152 -0
  144. package/react-native-map4d-map.podspec +20 -0
  145. package/src/components/MFBuilding.js +188 -0
  146. package/src/components/MFCircle.js +173 -0
  147. package/src/components/MFDirectionsRenderer.js +237 -0
  148. package/src/components/MFMapView.js +374 -0
  149. package/src/components/MFMarker.js +246 -0
  150. package/src/components/MFPOI.js +184 -0
  151. package/src/components/MFPolygon.js +186 -0
  152. package/src/components/MFPolyline.js +172 -0
  153. package/src/components/MFTileOverlay.js +45 -0
  154. package/src/components/Map4dMapView.tsx +27 -0
  155. package/src/index.js +21 -0
@@ -0,0 +1,37 @@
1
+ //
2
+ // RMFCircle.h
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/3/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #ifndef RMFCircle_h
10
+ #define RMFCircle_h
11
+
12
+ #import <React/UIView+React.h>
13
+ #import "RMFCircleMap4d.h"
14
+ #import "RMFMapView.h"
15
+
16
+ @interface RMFCircle : UIView
17
+
18
+ @property(nonatomic, strong) RMFCircleMap4d * map4dCircle;
19
+
20
+ @property(nonatomic, copy) RCTBubblingEventBlock _Nullable onPress;
21
+
22
+ @property(nonatomic, assign) CLLocationCoordinate2D centerCoordinate;
23
+ @property(nonatomic, assign) UIColor* fillColor;
24
+ @property(nonatomic, assign) UIColor* strokeColor;
25
+ @property(nonatomic, assign) double strokeWidth;
26
+ @property(nonatomic, assign) double radius;
27
+ @property(nonatomic, assign) float zIndex;
28
+ @property(nonatomic, assign) BOOL visible;
29
+ @property(nonatomic, copy, nullable) NSDictionary * userData;
30
+
31
+ - (void)didTapAtPixel:(CGPoint)pixel;
32
+ - (void)setMapView:(RMFMapView* _Nullable)mapView;
33
+
34
+ @end
35
+
36
+
37
+ #endif /* RMFCircle_h */
@@ -0,0 +1,100 @@
1
+ //
2
+ // RMFCircle.m
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/3/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #import "RMFCircle.h"
10
+ #import <Foundation/Foundation.h>
11
+ #import "RMFEventResponse.h"
12
+
13
+ @implementation RMFCircle
14
+
15
+ - (instancetype)init {
16
+ if ((self = [super init])) {
17
+ _map4dCircle = [[RMFCircleMap4d alloc] init];
18
+ _map4dCircle.reactCircle = self;
19
+
20
+ _radius = _map4dCircle.radius;
21
+ _fillColor = _map4dCircle.fillColor;
22
+ _strokeWidth = _map4dCircle.strokeWidth;
23
+ _strokeColor = _map4dCircle.strokeColor;
24
+ _centerCoordinate = _map4dCircle.position;
25
+ _zIndex = _map4dCircle.zIndex;
26
+ _visible = true;//!_map4dCircle.isHidden;
27
+ _userData = nil;
28
+ }
29
+ return self;
30
+ }
31
+
32
+ - (void)setMapView:(RMFMapView *)mapView {
33
+ _map4dCircle.map = mapView;
34
+ }
35
+
36
+ /** Property */
37
+ - (void)setCenterCoordinate:(CLLocationCoordinate2D)center {
38
+ _centerCoordinate = center;
39
+ _map4dCircle.position = center;
40
+ }
41
+
42
+ - (void)setRadius:(double)radius {
43
+ _radius = radius;
44
+ _map4dCircle.radius = radius;
45
+ }
46
+
47
+ - (void)setFillColor:(UIColor *)fillColor {
48
+ _fillColor = fillColor;
49
+ _map4dCircle.fillColor = fillColor;
50
+ }
51
+
52
+ - (void)setStrokeColor:(UIColor *)strokeColor {
53
+ _strokeColor = strokeColor;
54
+ _map4dCircle.strokeColor = strokeColor;
55
+ }
56
+
57
+ - (void)setStrokeWidth:(double)strokeWidth {
58
+ _strokeWidth = strokeWidth;
59
+ _map4dCircle.strokeWidth = strokeWidth;
60
+ }
61
+
62
+ - (void)setUserInteractionEnabled:(BOOL)enabled {
63
+ [super setUserInteractionEnabled:enabled];
64
+ _map4dCircle.userInteractionEnabled = enabled;
65
+ }
66
+
67
+ - (void)setZIndex:(float)zIndex {
68
+ _zIndex = zIndex;
69
+ _map4dCircle.zIndex = zIndex;
70
+ }
71
+
72
+ - (void)setVisible:(BOOL)visible {
73
+ _visible = visible;
74
+ _map4dCircle.isHidden = !visible;
75
+ }
76
+
77
+ - (void)setUserData:(NSDictionary *)userData {
78
+ _userData = userData;
79
+ }
80
+
81
+ /** Event */
82
+ - (void)didTapAtPixel:(CGPoint)pixel {
83
+ if(!self.onPress) {
84
+ return;
85
+ }
86
+
87
+ CLLocationCoordinate2D tapLocation = [_map4dCircle.map.projection coordinateForPoint:pixel];
88
+ NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
89
+ pixel:pixel]];
90
+ response[@"circle"] = @{
91
+ @"center": [RMFEventResponse fromCoordinate:_centerCoordinate],
92
+ @"radius": @(_radius),
93
+ @"userData": _userData != nil ? _userData : @{}
94
+ };
95
+ response[@"action"] = @"circle-press";
96
+
97
+ self.onPress(response);
98
+ }
99
+
100
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // RMFCircleManager.h
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/3/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #ifndef RMFCircleManager_h
10
+ #define RMFCircleManager_h
11
+
12
+ #import <React/RCTViewManager.h>
13
+
14
+ @interface RMFCircleManager : RCTViewManager
15
+
16
+ @end
17
+
18
+ #endif /* RMFCircleManager_h */
@@ -0,0 +1,155 @@
1
+ //
2
+ // RMFCircleManager.m
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/3/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #import "RMFCircleManager.h"
10
+ #import "RMFCircle.h"
11
+ #import <Foundation/Foundation.h>
12
+ #import <React/RCTConvert+CoreLocation.h>
13
+ #import <React/RCTBridge.h>
14
+ #import <React/RCTUIManager.h>
15
+
16
+ @implementation RMFCircleManager
17
+
18
+ RCT_EXPORT_MODULE(RMFCircle)
19
+
20
+ - (UIView *)view {
21
+ RMFCircle * circle = [[RMFCircle alloc] init];
22
+ return circle;
23
+ }
24
+
25
+ RCT_REMAP_VIEW_PROPERTY(center, centerCoordinate, CLLocationCoordinate2D)
26
+ RCT_EXPORT_VIEW_PROPERTY(radius, double)
27
+ RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor)
28
+ RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor)
29
+ RCT_EXPORT_VIEW_PROPERTY(strokeWidth, double)
30
+ RCT_EXPORT_VIEW_PROPERTY(userInteractionEnabled, BOOL)
31
+ RCT_EXPORT_VIEW_PROPERTY(zIndex, float)
32
+ RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
33
+ RCT_EXPORT_VIEW_PROPERTY(userData, NSDictionary)
34
+
35
+ RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
36
+
37
+ RCT_EXPORT_METHOD(setCenter:(nonnull NSNumber *)reactTag
38
+ withCoordinate:(id)coordinate)
39
+ {
40
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
41
+ id view = viewRegistry[reactTag];
42
+ if (![view isKindOfClass:[RMFCircle class]]) {
43
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
44
+ } else {
45
+ RMFCircle *circle = (RMFCircle *)view;
46
+ [circle setCenterCoordinate:[RCTConvert CLLocationCoordinate2D:coordinate]];
47
+ }
48
+ }];
49
+ }
50
+
51
+ RCT_EXPORT_METHOD(setRadius:(nonnull NSNumber *)reactTag
52
+ withRadius:(double)radius)
53
+ {
54
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
55
+ id view = viewRegistry[reactTag];
56
+ if (![view isKindOfClass:[RMFCircle class]]) {
57
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
58
+ } else {
59
+ RMFCircle *circle = (RMFCircle *)view;
60
+ [circle setRadius:radius];
61
+ }
62
+ }];
63
+ }
64
+
65
+ RCT_EXPORT_METHOD(setFillColor:(nonnull NSNumber *)reactTag
66
+ color:(id)color)
67
+ {
68
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
69
+ id view = viewRegistry[reactTag];
70
+ if (![view isKindOfClass:[RMFCircle class]]) {
71
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
72
+ } else {
73
+ RMFCircle *circle = (RMFCircle *)view;
74
+ UIColor* fillCorlor = [RCTConvert UIColor:color];
75
+ if (fillCorlor != nil) {
76
+ [circle setFillColor:fillCorlor];
77
+ }
78
+ }
79
+ }];
80
+ }
81
+
82
+ RCT_EXPORT_METHOD(setStrokeColor:(nonnull NSNumber *)reactTag
83
+ color:(id)color)
84
+ {
85
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
86
+ id view = viewRegistry[reactTag];
87
+ if (![view isKindOfClass:[RMFCircle class]]) {
88
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
89
+ } else {
90
+ RMFCircle *circle = (RMFCircle *)view;
91
+ UIColor* strokeColor = [RCTConvert UIColor:color];
92
+ if (strokeColor != nil) {
93
+ [circle setStrokeColor:strokeColor];
94
+ }
95
+ }
96
+ }];
97
+ }
98
+
99
+ RCT_EXPORT_METHOD(setStrokeWidth:(nonnull NSNumber *)reactTag
100
+ width:(double)width)
101
+ {
102
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
103
+ id view = viewRegistry[reactTag];
104
+ if (![view isKindOfClass:[RMFCircle class]]) {
105
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
106
+ } else {
107
+ RMFCircle *circle = (RMFCircle *)view;
108
+ [circle setStrokeWidth:width];
109
+ }
110
+ }];
111
+ }
112
+
113
+ RCT_EXPORT_METHOD(setZIndex:(nonnull NSNumber *)reactTag
114
+ zIndex:(float)zIndex)
115
+ {
116
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
117
+ id view = viewRegistry[reactTag];
118
+ if (![view isKindOfClass:[RMFCircle class]]) {
119
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
120
+ } else {
121
+ RMFCircle *circle = (RMFCircle *)view;
122
+ [circle setZIndex:zIndex];
123
+ }
124
+ }];
125
+ }
126
+
127
+ RCT_EXPORT_METHOD(setVisible:(nonnull NSNumber *)reactTag
128
+ visible:(BOOL)visible)
129
+ {
130
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
131
+ id view = viewRegistry[reactTag];
132
+ if (![view isKindOfClass:[RMFCircle class]]) {
133
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
134
+ } else {
135
+ RMFCircle *circle = (RMFCircle *)view;
136
+ [circle setVisible:visible];
137
+ }
138
+ }];
139
+ }
140
+
141
+ RCT_EXPORT_METHOD(setUserData:(nonnull NSNumber *)reactTag
142
+ userData:(id)json)
143
+ {
144
+ [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
145
+ id view = viewRegistry[reactTag];
146
+ if (![view isKindOfClass:[RMFCircle class]]) {
147
+ RCTLogError(@"Invalid view returned from registry, expecting RMFCircle, got: %@", view);
148
+ } else {
149
+ RMFCircle *circle = (RMFCircle *)view;
150
+ [circle setUserData:[RCTConvert NSDictionary:json]];
151
+ }
152
+ }];
153
+ }
154
+
155
+ @end
@@ -0,0 +1,23 @@
1
+ //
2
+ // RMFCircleMap4d.h
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/3/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #ifndef RMFCircleMap4d_h
10
+ #define RMFCircleMap4d_h
11
+
12
+ #import <Map4dMap/Map4dMap.h>
13
+
14
+ @class RMFCircle;
15
+
16
+ @interface RMFCircleMap4d : MFCircle
17
+
18
+ @property (nonatomic, weak) RMFCircle *reactCircle;
19
+
20
+ @end
21
+
22
+
23
+ #endif /* RMFCircleMap4d_h */
@@ -0,0 +1,13 @@
1
+ //
2
+ // RMFCircleMap4d.m
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/4/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #import "RMFCircleMap4d.h"
10
+
11
+ @implementation RMFCircleMap4d
12
+
13
+ @end
@@ -0,0 +1,22 @@
1
+ //
2
+ // RMFCoordinate.h
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/4/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #ifndef MFCoordinate_h
10
+ #define MFCoordinate_h
11
+
12
+ #import <Foundation/Foundation.h>
13
+ #import <CoreLocation/CoreLocation.h>
14
+
15
+ @interface RMFCoordinate : NSObject
16
+
17
+ @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
18
+
19
+ @end
20
+
21
+
22
+ #endif /* RMFCoordinate_h */
@@ -0,0 +1,13 @@
1
+ //
2
+ // RMFCoordinate.m
3
+ // Map4dMap
4
+ //
5
+ // Created by Huy Dang on 7/4/20.
6
+ // Copyright © 2020 IOTLink. All rights reserved.
7
+ //
8
+
9
+ #import "RMFCoordinate.h"
10
+ #import <Foundation/Foundation.h>
11
+
12
+ @implementation RMFCoordinate
13
+ @end
@@ -0,0 +1,24 @@
1
+ //
2
+ // RMFDirectionsMarkerOptions.h
3
+ // Map4dMap React Native
4
+ //
5
+ // Created by Huy Dang on 11/16/21.
6
+ //
7
+
8
+ #ifndef RMFDirectionsMarkerOptions_h
9
+ #define RMFDirectionsMarkerOptions_h
10
+
11
+ #import "RMFIcon.h"
12
+ #import <CoreLocation/CoreLocation.h>
13
+
14
+ @interface RMFDirectionsMarkerOptions : NSObject
15
+
16
+ @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
17
+ @property (nonatomic, strong, nullable) RMFIcon* icon;
18
+ @property (nonatomic, strong, nullable) NSString* title;
19
+ @property (nonatomic, strong, nullable) UIColor* titleColor;
20
+ @property (nonatomic, assign) BOOL visible;
21
+
22
+ @end
23
+
24
+ #endif /* RMFDirectionsMarkerOptions_h */
@@ -0,0 +1,23 @@
1
+ //
2
+ // RMFDirectionsMarkerOptions.m
3
+ // Map4dMap React Native
4
+ //
5
+ // Created by Huy Dang on 11/16/21.
6
+ //
7
+
8
+ #import "RMFDirectionsMarkerOptions.h"
9
+
10
+ @implementation RMFDirectionsMarkerOptions
11
+
12
+ - (instancetype)init {
13
+ if (self = [super init]) {
14
+ _coordinate = kCLLocationCoordinate2DInvalid;
15
+ _icon = nil;
16
+ _title = nil;
17
+ _titleColor = nil;
18
+ _visible = YES;
19
+ }
20
+ return self;
21
+ }
22
+
23
+ @end
@@ -0,0 +1,47 @@
1
+ //
2
+ // RMFDirectionsRenderer.h
3
+ // Map4dMap React Native
4
+ //
5
+ // Created by Huy Dang on 11/15/21.
6
+ //
7
+
8
+ #ifndef RMFDirectionsRenderer_h
9
+ #define RMFDirectionsRenderer_h
10
+
11
+ #import <React/UIView+React.h>
12
+ #import <Map4dMap/Map4dMap.h>
13
+ #import "RMFDirectionsRendererMap4d.h"
14
+ #import "RMFCoordinate.h"
15
+ #import "RMFDirectionsMarkerOptions.h"
16
+
17
+ @class RMFMapView;
18
+
19
+ @interface RMFDirectionsRenderer : UIView
20
+
21
+ @property (nonatomic, strong, nonnull) RMFDirectionsRendererMap4d* map4dDirectionsRenderer;
22
+
23
+ @property (nonatomic, copy) RCTBubblingEventBlock _Nullable onPress;
24
+
25
+ @property (nonatomic, strong, nullable) NSArray<NSArray<RMFCoordinate*>*>* routes;
26
+ @property (nonatomic, strong, nullable) NSString* directions;
27
+ @property (nonatomic, assign) NSUInteger activedIndex;
28
+
29
+ @property(nonatomic, assign) CGFloat activeStrokeWidth;
30
+ @property(nonatomic, strong, nullable) UIColor* activeStrokeColor;
31
+ @property(nonatomic, assign) CGFloat activeOutlineWidth;
32
+ @property(nonatomic, strong, nullable) UIColor* activeOutlineColor;
33
+
34
+ @property(nonatomic, assign) CGFloat inactiveStrokeWidth;
35
+ @property(nonatomic, strong, nullable) UIColor* inactiveStrokeColor;
36
+ @property(nonatomic, assign) CGFloat inactiveOutlineWidth;
37
+ @property(nonatomic, strong, nullable) UIColor* inactiveOutlineColor;
38
+
39
+ @property(nonatomic, strong, nullable) RMFDirectionsMarkerOptions* originPOIOptions;
40
+ @property(nonatomic, strong, nullable) RMFDirectionsMarkerOptions* destinationPOIOptions;
41
+
42
+ - (void)setMapView:(RMFMapView* _Nullable)mapView;
43
+ - (void)didTapAtPixel:(CGPoint)pixel withRouteIndex:(NSInteger)routeIndex;
44
+
45
+ @end
46
+
47
+ #endif /* RMFDirectionsRenderer_h */
@@ -0,0 +1,182 @@
1
+ //
2
+ // RMFDirectionsRenderer.m
3
+ // Map4dMap React Native
4
+ //
5
+ // Created by Huy Dang on 11/15/21.
6
+ //
7
+
8
+ #import "RMFDirectionsRenderer.h"
9
+ #import "RMFEventResponse.h"
10
+
11
+ @implementation RMFDirectionsRenderer
12
+
13
+ - (instancetype)init {
14
+ if (self = [super init]) {
15
+ _map4dDirectionsRenderer = [[RMFDirectionsRendererMap4d alloc] init];
16
+ _map4dDirectionsRenderer.reactRenderer = self;
17
+
18
+ _routes = nil;
19
+ _directions = nil;
20
+
21
+ _activedIndex = _map4dDirectionsRenderer.activedIndex;
22
+
23
+ _activeStrokeColor = _map4dDirectionsRenderer.activeStrokeColor;
24
+ _activeStrokeWidth = _map4dDirectionsRenderer.activeStrokeWidth;
25
+ _activeOutlineColor = _map4dDirectionsRenderer.activeOutlineColor;
26
+ _activeOutlineWidth = _map4dDirectionsRenderer.activeOutlineWidth;
27
+
28
+ _inactiveStrokeColor = _map4dDirectionsRenderer.inactiveStrokeColor;
29
+ _inactiveStrokeWidth = _map4dDirectionsRenderer.inactiveStrokeWidth;
30
+ _inactiveOutlineColor = _map4dDirectionsRenderer.inactiveOutlineColor;
31
+ _inactiveOutlineWidth = _map4dDirectionsRenderer.inactiveOutlineWidth;
32
+
33
+ _originPOIOptions = nil;
34
+ _destinationPOIOptions = nil;
35
+ }
36
+ return self;
37
+ }
38
+
39
+ - (void)setMapView:(RMFMapView *)mapView {
40
+ _map4dDirectionsRenderer.activedIndex = _activedIndex;
41
+ _map4dDirectionsRenderer.map = (MFMapView*)mapView;
42
+ }
43
+
44
+ - (void)didTapAtPixel:(CGPoint)pixel withRouteIndex:(NSInteger)routeIndex {
45
+ if (!self.onPress) {
46
+ return;
47
+ }
48
+
49
+ CLLocationCoordinate2D tapLocation = [_map4dDirectionsRenderer.map.projection coordinateForPoint:pixel];
50
+ NSMutableDictionary* response = [NSMutableDictionary dictionaryWithDictionary:[RMFEventResponse fromCoordinate:tapLocation
51
+ pixel:pixel]];
52
+ response[@"routeIndex"] = @(routeIndex);
53
+ response[@"action"] = @"directions-press";
54
+ self.onPress(response);
55
+ }
56
+
57
+ - (void)setRoutes:(NSArray<NSArray<RMFCoordinate *> *> *)routes {
58
+ _routes = routes;
59
+ NSMutableArray<MFPath*>* paths = [NSMutableArray arrayWithCapacity:routes.count];
60
+ for (int i = 0; i < routes.count; i++) {
61
+ NSArray<RMFCoordinate*>* route = [routes objectAtIndex:i];
62
+ MFMutablePath* path = [[MFMutablePath alloc] init];
63
+ for (int j = 0; j < route.count; j++) {
64
+ [path addCoordinate:route[j].coordinate];
65
+ }
66
+
67
+ [paths addObject:path];
68
+ }
69
+
70
+ if (paths.count > 0) {
71
+ _map4dDirectionsRenderer.routes = paths;
72
+ }
73
+ else {
74
+ _map4dDirectionsRenderer.routes = nil;
75
+ }
76
+ }
77
+
78
+ - (void)setDirections:(NSString *)json {
79
+ _directions = json;
80
+ [_map4dDirectionsRenderer setRoutesWithJson:json];
81
+ }
82
+
83
+ - (void)setActivedIndex:(NSUInteger)activedIndex {
84
+ _activedIndex = activedIndex;
85
+ _map4dDirectionsRenderer.activedIndex = activedIndex;
86
+ }
87
+
88
+ - (void)setActiveStrokeColor:(UIColor *)color {
89
+ _activeStrokeColor = color;
90
+ _map4dDirectionsRenderer.activeStrokeColor = color;
91
+ }
92
+
93
+ - (void)setActiveStrokeWidth:(CGFloat)width {
94
+ _activeStrokeWidth = width;
95
+ _map4dDirectionsRenderer.activeStrokeWidth = width;
96
+ }
97
+
98
+ - (void)setActiveOutlineColor:(UIColor *)color {
99
+ _activeOutlineColor = color;
100
+ _map4dDirectionsRenderer.activeOutlineColor = color;
101
+ }
102
+
103
+ - (void)setActiveOutlineWidth:(CGFloat)width {
104
+ _activeOutlineWidth = width;
105
+ _map4dDirectionsRenderer.activeOutlineWidth = width;
106
+ }
107
+
108
+ - (void)setInactiveStrokeColor:(UIColor *)color {
109
+ _inactiveStrokeColor = color;
110
+ _map4dDirectionsRenderer.inactiveStrokeColor = color;
111
+ }
112
+
113
+ - (void)setInactiveStrokeWidth:(CGFloat)width {
114
+ _inactiveStrokeWidth = width;
115
+ _map4dDirectionsRenderer.inactiveStrokeWidth = width;
116
+ }
117
+
118
+ - (void)setInactiveOutlineColor:(UIColor *)color {
119
+ _inactiveOutlineColor = color;
120
+ _map4dDirectionsRenderer.inactiveOutlineColor = color;
121
+ }
122
+
123
+ - (void)setInactiveOutlineWidth:(CGFloat)width {
124
+ _inactiveOutlineWidth = width;
125
+ _map4dDirectionsRenderer.inactiveOutlineWidth = width;
126
+ }
127
+
128
+ - (void)setOriginPOIOptions:(RMFDirectionsMarkerOptions *)options {
129
+ _originPOIOptions = options;
130
+
131
+ _map4dDirectionsRenderer.hideOriginPOI = !options.visible;
132
+ _map4dDirectionsRenderer.originPosition = options.coordinate;
133
+ _map4dDirectionsRenderer.originTitle = options.title;
134
+ _map4dDirectionsRenderer.originTitleColor = options.titleColor;
135
+
136
+ if (options.icon == nil || options.icon.uri == nil) {
137
+ _map4dDirectionsRenderer.originIcon = nil;
138
+ }
139
+ else {
140
+ dispatch_async(dispatch_get_global_queue(0,0), ^{
141
+ NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: options.icon.uri]];
142
+ if (imageData != nil) {
143
+ dispatch_async(dispatch_get_main_queue(), ^{
144
+ UIImage* icon = [UIImage imageWithData:imageData];
145
+ UIImage* scaleIcon = [UIImage imageWithCGImage:[icon CGImage]
146
+ scale:[UIScreen mainScreen].scale
147
+ orientation:icon.imageOrientation];
148
+ self->_map4dDirectionsRenderer.originIcon = scaleIcon;
149
+ });
150
+ }
151
+ });
152
+ }
153
+ }
154
+
155
+ - (void)setDestinationPOIOptions:(RMFDirectionsMarkerOptions *)options {
156
+ _destinationPOIOptions = options;
157
+
158
+ _map4dDirectionsRenderer.hideDestinationPOI = !options.visible;
159
+ _map4dDirectionsRenderer.destinationPosition = options.coordinate;
160
+ _map4dDirectionsRenderer.destinationTitle = options.title;
161
+ _map4dDirectionsRenderer.destinationTitleColor = options.titleColor;
162
+
163
+ if (options.icon == nil || options.icon.uri == nil) {
164
+ _map4dDirectionsRenderer.destinationIcon = nil;
165
+ }
166
+ else {
167
+ dispatch_async(dispatch_get_global_queue(0,0), ^{
168
+ NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: options.icon.uri]];
169
+ if (imageData != nil) {
170
+ dispatch_async(dispatch_get_main_queue(), ^{
171
+ UIImage* icon = [UIImage imageWithData:imageData];
172
+ UIImage* scaleImage = [UIImage imageWithCGImage:[icon CGImage]
173
+ scale:[UIScreen mainScreen].scale
174
+ orientation:icon.imageOrientation];
175
+ self->_map4dDirectionsRenderer.destinationIcon = scaleImage;
176
+ });
177
+ }
178
+ });
179
+ }
180
+ }
181
+
182
+ @end
@@ -0,0 +1,17 @@
1
+ //
2
+ // RMFDirectionsRendererManager.h
3
+ // Map4dMap React Native
4
+ //
5
+ // Created by Huy Dang on 11/15/21.
6
+ //
7
+
8
+ #ifndef RMFDirectionsRendererManager_h
9
+ #define RMFDirectionsRendererManager_h
10
+
11
+ #import <React/RCTViewManager.h>
12
+
13
+ @interface RMFDirectionsRendererManager : RCTViewManager
14
+
15
+ @end
16
+
17
+ #endif /* RMFDirectionsRendererManager_h */