react-native-maps 2.0.0-beta.5 → 2.0.0-beta.7
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/android/src/main/java/com/rnmaps/maps/MapCalloutManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapCircleManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapGradientPolyline.java +4 -4
- package/android/src/main/java/com/rnmaps/maps/MapGradientPolylineManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapHeatmapManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapLiteManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapLocalTile.java +4 -4
- package/android/src/main/java/com/rnmaps/maps/MapLocalTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +1 -56
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +9 -26
- package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolygonManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapTileProvider.java +4 -4
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +24 -131
- package/android/src/main/java/com/rnmaps/maps/MapViewModule.java +598 -0
- package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +6 -6
- package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/SizeReportingShadowNode.java +1 -1
- package/ios/{AirGoogleMaps/AIRDummyView.h → GoogleMaps/RNMDummyView.h} +3 -3
- package/ios/{AirGoogleMaps/AIRDummyView.m → GoogleMaps/RNMDummyView.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSMarker.h → GoogleMaps/RNMGMSMarker.h} +6 -6
- package/ios/{AirGoogleMaps/AIRGMSMarker.m → GoogleMaps/RNMGMSMarker.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolygon.h → GoogleMaps/RNMGMSPolygon.h} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolygon.m → GoogleMaps/RNMGMSPolygon.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolyline.h → GoogleMaps/RNMGMSPolyline.h} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolyline.m → GoogleMaps/RNMGMSPolyline.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMap.h → GoogleMaps/RNMGoogleMap.h} +5 -5
- package/ios/{AirGoogleMaps/AIRGoogleMap.m → GoogleMaps/RNMGoogleMap.m} +77 -77
- package/ios/{AirGoogleMaps/AIRGoogleMapCallout.h → GoogleMaps/RNMGoogleMapCallout.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCallout.m → GoogleMaps/RNMGoogleMapCallout.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutManager.h → GoogleMaps/RNMGoogleMapCalloutManager.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutManager.m → GoogleMaps/RNMGoogleMapCalloutManager.m} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubview.h → GoogleMaps/RNMGoogleMapCalloutSubview.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubview.m → GoogleMaps/RNMGoogleMapCalloutSubview.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.h → GoogleMaps/RNMGoogleMapCalloutSubviewManager.h} +3 -3
- package/ios/GoogleMaps/RNMGoogleMapCalloutSubviewManager.m +28 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapCircle.h → GoogleMaps/RNMGoogleMapCircle.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCircle.m → GoogleMaps/RNMGoogleMapCircle.m} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCircleManager.h → GoogleMaps/RNMGoogleMapCircleManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapCircleManager.m → GoogleMaps/RNMGoogleMapCircleManager.m} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapHeatmap.h → GoogleMaps/RNMGoogleMapHeatmap.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapHeatmap.m → GoogleMaps/RNMGoogleMapHeatmap.m} +4 -4
- package/ios/GoogleMaps/RNMGoogleMapHeatmapManager.h +11 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapHeatmapManager.m → GoogleMaps/RNMGoogleMapHeatmapManager.m} +9 -9
- package/ios/{AirGoogleMaps/AIRGoogleMapManager.h → GoogleMaps/RNMGoogleMapManager.h} +3 -3
- package/ios/GoogleMaps/RNMGoogleMapManager.m +274 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapMarker.h → GoogleMaps/RNMGoogleMapMarker.h} +15 -15
- package/ios/{AirGoogleMaps/AIRGoogleMapMarker.m → GoogleMaps/RNMGoogleMapMarker.m} +22 -22
- package/ios/{AirGoogleMaps/AIRGoogleMapMarkerManager.h → GoogleMaps/RNMGoogleMapMarkerManager.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapMarkerManager.m → GoogleMaps/RNMGoogleMapMarkerManager.m} +20 -20
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlay.h → GoogleMaps/RNMGoogleMapOverlay.h} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlay.m → GoogleMaps/RNMGoogleMapOverlay.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlayManager.h → GoogleMaps/RNMGoogleMapOverlayManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlayManager.m → GoogleMaps/RNMGoogleMapOverlayManager.m} +6 -6
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygon.h → GoogleMaps/RNMGoogleMapPolygon.h} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygon.m → GoogleMaps/RNMGoogleMapPolygon.m} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapPolylineManager.h → GoogleMaps/RNMGoogleMapPolygonManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygonManager.m → GoogleMaps/RNMGoogleMapPolygonManager.m} +10 -10
- package/ios/{AirGoogleMaps/AIRGoogleMapPolyline.h → GoogleMaps/RNMGoogleMapPolyline.h} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapPolyline.m → GoogleMaps/RNMGoogleMapPolyline.m} +9 -9
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygonManager.h → GoogleMaps/RNMGoogleMapPolylineManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapPolylineManager.m → GoogleMaps/RNMGoogleMapPolylineManager.m} +9 -9
- package/ios/{AirGoogleMaps/AIRGoogleMapUrlTile.h → GoogleMaps/RNMGoogleMapUrlTile.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapUrlTile.m → GoogleMaps/RNMGoogleMapUrlTile.m} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapUrlTileManager.h → GoogleMaps/RNMGoogleMapUrlTileManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapURLTileManager.m → GoogleMaps/RNMGoogleMapUrlTileManager.m} +7 -7
- package/ios/GoogleMaps/RNMGoogleMapViewModule.h +5 -0
- package/ios/GoogleMaps/RNMGoogleMapViewModule.m +380 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTile.h → GoogleMaps/RNMGoogleMapWMSTile.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTile.m → GoogleMaps/RNMGoogleMapWMSTile.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.h → GoogleMaps/RNMGoogleMapWMSTileManager.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.m → GoogleMaps/RNMGoogleMapWMSTileManager.m} +8 -8
- package/ios/{AirMaps → Maps}/Callout/SMCalloutView.h +4 -4
- package/ios/{AirMaps/RCTConvert+AirMap.h → Maps/RCTConvert+RNMMap.h} +1 -1
- package/ios/{AirMaps/RCTConvert+AirMap.m → Maps/RCTConvert+RNMMap.m} +8 -8
- package/ios/{AirMaps/AIRMap.h → Maps/RNMMap.h} +8 -8
- package/ios/{AirMaps/AIRMap.m → Maps/RNMMap.m} +56 -56
- package/ios/{AirMaps/AIRMapCallout.h → Maps/RNMMapCallout.h} +1 -1
- package/ios/{AirMaps/AIRMapCallout.m → Maps/RNMMapCallout.m} +2 -2
- package/ios/{AirMaps/AIRMapCircleManager.h → Maps/RNMMapCalloutManager.h} +2 -2
- package/ios/{AirMaps/AIRMapCalloutManager.m → Maps/RNMMapCalloutManager.m} +7 -7
- package/ios/{AirMaps/AIRMapCalloutSubview.h → Maps/RNMMapCalloutSubview.h} +3 -3
- package/ios/{AirMaps/AIRMapCalloutSubview.m → Maps/RNMMapCalloutSubview.m} +4 -4
- package/ios/Maps/RNMMapCalloutSubviewManager.h +14 -0
- package/ios/Maps/RNMMapCalloutSubviewManager.m +24 -0
- package/ios/{AirMaps/AIRMapCircle.h → Maps/RNMMapCircle.h} +5 -5
- package/ios/{AirMaps/AIRMapCircle.m → Maps/RNMMapCircle.m} +3 -3
- package/ios/{AirMaps/AIRMapCalloutManager.h → Maps/RNMMapCircleManager.h} +2 -2
- package/ios/{AirMaps/AIRMapCircleManager.m → Maps/RNMMapCircleManager.m} +7 -7
- package/ios/{AirMaps/AIRMapCoordinate.h → Maps/RNMMapCoordinate.h} +2 -2
- package/ios/{AirMaps/AIRMapCoordinate.m → Maps/RNMMapCoordinate.m} +3 -3
- package/ios/{AirMaps/AIRMapLocalTile.h → Maps/RNMMapLocalTile.h} +7 -7
- package/ios/{AirMaps/AIRMapLocalTile.m → Maps/RNMMapLocalTile.m} +6 -6
- package/ios/{AirMaps/AIRMapLocalTileManager.h → Maps/RNMMapLocalTileManager.h} +3 -3
- package/ios/{AirMaps/AIRMapLocalTileManager.m → Maps/RNMMapLocalTileManager.m} +9 -9
- package/ios/{AirMaps/AIRMapLocalTileOverlay.h → Maps/RNMMapLocalTileOverlay.h} +2 -2
- package/ios/{AirMaps/AIRMapLocalTileOverlay.m → Maps/RNMMapLocalTileOverlay.m} +5 -5
- package/ios/{AirMaps/AIRMapManager.h → Maps/RNMMapManager.h} +6 -6
- package/ios/Maps/RNMMapManager.m +857 -0
- package/ios/{AirMaps/AIRMapMarker.h → Maps/RNMMapMarker.h} +8 -8
- package/ios/{AirMaps/AIRMapMarker.m → Maps/RNMMapMarker.m} +13 -13
- package/ios/{AirMaps/AIRMapMarkerManager.h → Maps/RNMMapMarkerManager.h} +1 -1
- package/ios/{AirMaps/AIRMapMarkerManager.m → Maps/RNMMapMarkerManager.m} +14 -14
- package/ios/{AirMaps/AIRMapOverlay.h → Maps/RNMMapOverlay.h} +7 -7
- package/ios/{AirMaps/AIRMapOverlay.m → Maps/RNMMapOverlay.m} +4 -4
- package/ios/Maps/RNMMapOverlayManager.h +5 -0
- package/ios/{AirMaps/AIRMapOverlayManager.m → Maps/RNMMapOverlayManager.m} +6 -6
- package/ios/{AirMaps/AIRMapOverlayRenderer.h → Maps/RNMMapOverlayRenderer.h} +1 -1
- package/ios/{AirMaps/AIRMapOverlayRenderer.m → Maps/RNMMapOverlayRenderer.m} +5 -5
- package/ios/{AirMaps/AIRMapPolygon.h → Maps/RNMMapPolygon.h} +7 -7
- package/ios/{AirMaps/AIRMapPolygon.m → Maps/RNMMapPolygon.m} +4 -4
- package/ios/{AirMaps/AIRMapPolygonManager.h → Maps/RNMMapPolygonManager.h} +2 -2
- package/ios/{AirMaps/AIRMapPolygonManager.m → Maps/RNMMapPolygonManager.m} +10 -10
- package/ios/{AirMaps/AIRMapPolyline.h → Maps/RNMMapPolyline.h} +6 -6
- package/ios/{AirMaps/AIRMapPolyline.m → Maps/RNMMapPolyline.m} +11 -11
- package/ios/{AirMaps/AIRMapPolylineManager.h → Maps/RNMMapPolylineManager.h} +2 -2
- package/ios/{AirMaps/AIRMapPolylineManager.m → Maps/RNMMapPolylineManager.m} +9 -9
- package/ios/{AirMaps/AIRMapPolylineRenderer.h → Maps/RNMMapPolylineRenderer.h} +2 -2
- package/ios/{AirMaps/AIRMapPolylineRenderer.m → Maps/RNMMapPolylineRenderer.m} +10 -10
- package/ios/{AirMaps/AIRMapSnapshot.h → Maps/RNMMapSnapshot.h} +6 -6
- package/ios/{AirMaps/AIRMapUrlTile.h → Maps/RNMMapUrlTile.h} +18 -18
- package/ios/{AirMaps/AIRMapUrlTile.m → Maps/RNMMapUrlTile.m} +7 -7
- package/ios/{AirMaps/AIRMapUrlTileCachedOverlay.h → Maps/RNMMapUrlTileCachedOverlay.h} +3 -3
- package/ios/{AirMaps/AIRMapUrlTileCachedOverlay.m → Maps/RNMMapUrlTileCachedOverlay.m} +10 -10
- package/ios/{AirMaps/AIRMapUrlTileManager.h → Maps/RNMMapUrlTileManager.h} +3 -3
- package/ios/{AirMaps/AIRMapUrlTileManager.m → Maps/RNMMapUrlTileManager.m} +9 -9
- package/ios/Maps/RNMMapViewModule.h +5 -0
- package/ios/Maps/RNMMapViewModule.m +459 -0
- package/ios/{AirMaps/AIRMapWMSTile.h → Maps/RNMMapWMSTile.h} +11 -11
- package/ios/{AirMaps/AIRMapWMSTile.m → Maps/RNMMapWMSTile.m} +15 -15
- package/ios/{AirMaps/AIRMapWMSTileManager.h → Maps/RNMMapWMSTileManager.h} +3 -3
- package/ios/{AirMaps/AIRMapWMSTileManager.m → Maps/RNMMapWMSTileManager.m} +9 -9
- package/ios/RNMaps.xcodeproj/project.pbxproj +647 -0
- package/lib/MapCallout.js +2 -2
- package/lib/MapCalloutSubview.js +2 -2
- package/lib/MapCircle.js +2 -2
- package/lib/MapHeatmap.js +2 -2
- package/lib/MapLocalTile.js +2 -2
- package/lib/MapMarker.js +2 -2
- package/lib/MapOverlay.js +2 -2
- package/lib/MapPolygon.js +2 -2
- package/lib/MapPolyline.js +2 -2
- package/lib/MapUrlTile.js +2 -2
- package/lib/MapView.d.ts +7 -8
- package/lib/MapView.js +89 -97
- package/lib/MapView.types.d.ts +8 -2
- package/lib/MapViewNativeComponent.d.ts +2 -7
- package/lib/MapViewNativeComponent.js +0 -5
- package/lib/MapWMSTile.js +2 -2
- package/lib/NativeGoogleMapViewModule.d.ts +25 -0
- package/lib/NativeGoogleMapViewModule.js +4 -0
- package/lib/NativeMapViewModule.d.ts +29 -0
- package/lib/NativeMapViewModule.js +4 -0
- package/lib/decorateMapComponent.d.ts +1 -1
- package/lib/decorateMapComponent.js +3 -3
- package/package.json +1 -1
- package/react-native-google-maps.podspec +1 -1
- package/react-native-maps.podspec +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +0 -380
- package/ios/AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.m +0 -28
- package/ios/AirGoogleMaps/AIRGoogleMapHeatmapManager.h +0 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -597
- package/ios/AirMaps/AIRMapCalloutSubviewManager.h +0 -14
- package/ios/AirMaps/AIRMapCalloutSubviewManager.m +0 -24
- package/ios/AirMaps/AIRMapManager.m +0 -1253
- package/ios/AirMaps/AIRMapOverlayManager.h +0 -5
- package/ios/AirMaps/AIRWeakMapReference.h +0 -24
- package/ios/AirMaps/AIRWeakMapReference.m +0 -23
- package/ios/AirMaps/AIRWeakTimerReference.h +0 -21
- package/ios/AirMaps/AIRWeakTimerReference.m +0 -42
- package/ios/AirMaps.xcodeproj/project.pbxproj +0 -587
- /package/ios/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.h +0 -0
- /package/ios/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.m +0 -0
- /package/ios/{AirMaps → Maps}/Callout/SMCalloutView.m +0 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
#import "RNMMapViewModule.h"
|
|
2
|
+
#import "RNMMap.h"
|
|
3
|
+
#import "RNMMapMarker.h"
|
|
4
|
+
#import "RNMMapSnapshot.h"
|
|
5
|
+
#import "RNMMapCoordinate.h"
|
|
6
|
+
#import <React/RCTUIManager.h>
|
|
7
|
+
#import <React/RCTUIManagerUtils.h>
|
|
8
|
+
|
|
9
|
+
@implementation RNMMapViewModule
|
|
10
|
+
|
|
11
|
+
@synthesize bridge = _bridge;
|
|
12
|
+
|
|
13
|
+
- (dispatch_queue_t)methodQueue
|
|
14
|
+
{
|
|
15
|
+
return RCTGetUIManagerQueue();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
RCT_EXPORT_MODULE();
|
|
19
|
+
|
|
20
|
+
RCT_EXPORT_METHOD(getMapBoundaries:(nonnull NSNumber *)reactTag
|
|
21
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
22
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
23
|
+
{
|
|
24
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
25
|
+
id view = viewRegistry[reactTag];
|
|
26
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
27
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
28
|
+
} else {
|
|
29
|
+
NSArray *boundingBox = [view getMapBoundaries];
|
|
30
|
+
|
|
31
|
+
resolve(@{
|
|
32
|
+
@"northEast" : @{
|
|
33
|
+
@"longitude" : boundingBox[0][0],
|
|
34
|
+
@"latitude" : boundingBox[0][1]
|
|
35
|
+
},
|
|
36
|
+
@"southWest" : @{
|
|
37
|
+
@"longitude" : boundingBox[1][0],
|
|
38
|
+
@"latitude" : boundingBox[1][1]
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
46
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
47
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
48
|
+
{
|
|
49
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
50
|
+
id view = viewRegistry[reactTag];
|
|
51
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
52
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
53
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RNMMap, got: %@", view], NULL);
|
|
54
|
+
} else {
|
|
55
|
+
MKMapCamera *camera = [mapView camera];
|
|
56
|
+
resolve(@{
|
|
57
|
+
@"center": @{
|
|
58
|
+
@"latitude": @(camera.centerCoordinate.latitude),
|
|
59
|
+
@"longitude": @(camera.centerCoordinate.longitude),
|
|
60
|
+
},
|
|
61
|
+
@"pitch": @(camera.pitch),
|
|
62
|
+
@"heading": @(camera.heading),
|
|
63
|
+
@"altitude": @(camera.altitude),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)reactTag
|
|
70
|
+
config:(NSDictionary *)config
|
|
71
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
72
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
73
|
+
{
|
|
74
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
75
|
+
id view = viewRegistry[reactTag];
|
|
76
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
77
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
78
|
+
} else {
|
|
79
|
+
NSNumber *width = config[@"width"];
|
|
80
|
+
NSNumber *height = config[@"height"];
|
|
81
|
+
MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:config[@"region"]];
|
|
82
|
+
NSString *format = config[@"format"];
|
|
83
|
+
NSNumber *quality = config[@"quality"];
|
|
84
|
+
NSString *result = config[@"result"];
|
|
85
|
+
|
|
86
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
87
|
+
MKMapSnapshotOptions *options = [[MKMapSnapshotOptions alloc] init];
|
|
88
|
+
|
|
89
|
+
options.mapType = mapView.mapType;
|
|
90
|
+
options.region = (region.center.latitude && region.center.longitude) ? region : mapView.region;
|
|
91
|
+
options.size = CGSizeMake(
|
|
92
|
+
([width floatValue] == 0) ? mapView.bounds.size.width : [width floatValue],
|
|
93
|
+
([height floatValue] == 0) ? mapView.bounds.size.height : [height floatValue]
|
|
94
|
+
);
|
|
95
|
+
options.scale = [[UIScreen mainScreen] scale];
|
|
96
|
+
|
|
97
|
+
MKMapSnapshotter *snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options];
|
|
98
|
+
|
|
99
|
+
[self takeMapSnapshot:mapView
|
|
100
|
+
snapshotter:snapshotter
|
|
101
|
+
format:format
|
|
102
|
+
quality:quality.floatValue
|
|
103
|
+
result:result
|
|
104
|
+
resolver:resolve
|
|
105
|
+
rejecter:reject];
|
|
106
|
+
}
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
111
|
+
coordinate: (NSDictionary *)coordinate
|
|
112
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
113
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
114
|
+
{
|
|
115
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
116
|
+
id view = viewRegistry[reactTag];
|
|
117
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
118
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
119
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RNMMap, got: %@", view], NULL);
|
|
120
|
+
} else {
|
|
121
|
+
CGPoint touchPoint = [mapView convertCoordinate:
|
|
122
|
+
CLLocationCoordinate2DMake(
|
|
123
|
+
[coordinate[@"latitude"] doubleValue],
|
|
124
|
+
[coordinate[@"longitude"] doubleValue]
|
|
125
|
+
)
|
|
126
|
+
toPointToView:mapView];
|
|
127
|
+
|
|
128
|
+
resolve(@{
|
|
129
|
+
@"x": @(touchPoint.x),
|
|
130
|
+
@"y": @(touchPoint.y),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
RCT_EXPORT_METHOD(getMarkersFrames:(nonnull NSNumber *)reactTag
|
|
137
|
+
onlyVisible:(BOOL)onlyVisible
|
|
138
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
139
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
140
|
+
{
|
|
141
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
142
|
+
id view = viewRegistry[reactTag];
|
|
143
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
144
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
145
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RNMMap, got: %@", view], NULL);
|
|
146
|
+
} else {
|
|
147
|
+
resolve([mapView getMarkersFramesWithOnlyVisible:onlyVisible]);
|
|
148
|
+
}
|
|
149
|
+
}];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
155
|
+
point:(NSDictionary *)point
|
|
156
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
157
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
158
|
+
{
|
|
159
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
160
|
+
id view = viewRegistry[reactTag];
|
|
161
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
162
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
163
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RNMMap, got: %@", view], NULL);
|
|
164
|
+
} else {
|
|
165
|
+
CLLocationCoordinate2D coordinate = [mapView convertPoint:
|
|
166
|
+
CGPointMake(
|
|
167
|
+
[point[@"x"] doubleValue],
|
|
168
|
+
[point[@"y"] doubleValue]
|
|
169
|
+
)
|
|
170
|
+
toCoordinateFromView:mapView];
|
|
171
|
+
|
|
172
|
+
resolve(@{
|
|
173
|
+
@"latitude": @(coordinate.latitude),
|
|
174
|
+
@"longitude": @(coordinate.longitude),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
RCT_EXPORT_METHOD(getAddressFromCoordinates:(nonnull NSNumber *)reactTag
|
|
181
|
+
coordinate: (NSDictionary *)coordinate
|
|
182
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
183
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
184
|
+
{
|
|
185
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
186
|
+
id view = viewRegistry[reactTag];
|
|
187
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
188
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RNMMap, got: %@", view], NULL);
|
|
189
|
+
} else {
|
|
190
|
+
if (coordinate == nil ||
|
|
191
|
+
![[coordinate allKeys] containsObject:@"latitude"] ||
|
|
192
|
+
![[coordinate allKeys] containsObject:@"longitude"]) {
|
|
193
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid coordinate format"], NULL);
|
|
194
|
+
}
|
|
195
|
+
CLLocation *location = [[CLLocation alloc] initWithLatitude:[coordinate[@"latitude"] doubleValue]
|
|
196
|
+
longitude:[coordinate[@"longitude"] doubleValue]];
|
|
197
|
+
CLGeocoder *geoCoder = [[CLGeocoder alloc] init];
|
|
198
|
+
[geoCoder reverseGeocodeLocation:location
|
|
199
|
+
completionHandler:^(NSArray *placemarks, NSError *error) {
|
|
200
|
+
if (error == nil && [placemarks count] > 0){
|
|
201
|
+
CLPlacemark *placemark = placemarks[0];
|
|
202
|
+
resolve(@{
|
|
203
|
+
@"name" : [NSString stringWithFormat:@"%@", placemark.name],
|
|
204
|
+
@"thoroughfare" : [NSString stringWithFormat:@"%@", placemark.thoroughfare],
|
|
205
|
+
@"subThoroughfare" : [NSString stringWithFormat:@"%@", placemark.subThoroughfare],
|
|
206
|
+
@"locality" : [NSString stringWithFormat:@"%@", placemark.locality],
|
|
207
|
+
@"subLocality" : [NSString stringWithFormat:@"%@", placemark.subLocality],
|
|
208
|
+
@"administrativeArea" : [NSString stringWithFormat:@"%@", placemark.administrativeArea],
|
|
209
|
+
@"subAdministrativeArea" : [NSString stringWithFormat:@"%@", placemark.subAdministrativeArea],
|
|
210
|
+
@"postalCode" : [NSString stringWithFormat:@"%@", placemark.postalCode],
|
|
211
|
+
@"countryCode" : [NSString stringWithFormat:@"%@", placemark.ISOcountryCode],
|
|
212
|
+
@"country" : [NSString stringWithFormat:@"%@", placemark.country],
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Can not get address location"], NULL);
|
|
216
|
+
}
|
|
217
|
+
}];
|
|
218
|
+
}
|
|
219
|
+
}];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
RCT_EXPORT_METHOD(animateToRegion:(nonnull NSNumber *)reactTag
|
|
223
|
+
withRegion:(NSDictionary *)region
|
|
224
|
+
withDuration:(CGFloat)duration
|
|
225
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
226
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
227
|
+
{
|
|
228
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
229
|
+
id view = viewRegistry[reactTag];
|
|
230
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
231
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
232
|
+
} else {
|
|
233
|
+
MKCoordinateRegion mkRegion = [RCTConvert MKCoordinateRegion:region];
|
|
234
|
+
[RNMMap animateWithDuration:duration/1000 animations:^{
|
|
235
|
+
[(RNMMap *)view setRegion:mkRegion animated:YES];
|
|
236
|
+
} completion:^(BOOL finished){
|
|
237
|
+
resolve(nil);
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
}];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
244
|
+
withCamera:(id)json
|
|
245
|
+
withDuration:(CGFloat)duration
|
|
246
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
247
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
248
|
+
{
|
|
249
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
250
|
+
id view = viewRegistry[reactTag];
|
|
251
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
252
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
253
|
+
} else {
|
|
254
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
255
|
+
|
|
256
|
+
// Merge the changes given with the current camera
|
|
257
|
+
MKMapCamera *camera = [RCTConvert MKMapCameraWithDefaults:json existingCamera:[mapView camera]];
|
|
258
|
+
|
|
259
|
+
// don't emit region change events when we are setting the camera
|
|
260
|
+
BOOL originalIgnore = mapView.ignoreRegionChanges;
|
|
261
|
+
mapView.ignoreRegionChanges = YES;
|
|
262
|
+
[RNMMap animateWithDuration:duration/1000 animations:^{
|
|
263
|
+
[mapView setCamera:camera animated:YES];
|
|
264
|
+
} completion:^(BOOL finished){
|
|
265
|
+
mapView.ignoreRegionChanges = originalIgnore;
|
|
266
|
+
resolve(nil);
|
|
267
|
+
}];
|
|
268
|
+
}
|
|
269
|
+
}];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
RCT_EXPORT_METHOD(fitToElements:(nonnull NSNumber *)reactTag
|
|
273
|
+
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
274
|
+
withDuration:(CGFloat)duration
|
|
275
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
276
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
277
|
+
{
|
|
278
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
279
|
+
id view = viewRegistry[reactTag];
|
|
280
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
281
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
282
|
+
} else {
|
|
283
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
284
|
+
|
|
285
|
+
// TODO(lmr): we potentially want to include overlays here... and could concat the two arrays together.
|
|
286
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
287
|
+
if(duration > 0.0f) {
|
|
288
|
+
[RNMMap animateWithDuration:duration/1000 animations:^{
|
|
289
|
+
[mapView showAnnotations:mapView.annotations animated:YES];
|
|
290
|
+
} completion:^(BOOL finished){
|
|
291
|
+
resolve(nil);
|
|
292
|
+
}];
|
|
293
|
+
} else {
|
|
294
|
+
[mapView showAnnotations:mapView.annotations animated:NO];
|
|
295
|
+
resolve(nil);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
RCT_EXPORT_METHOD(fitToSuppliedMarkers:(nonnull NSNumber *)reactTag
|
|
304
|
+
markers:(nonnull NSArray *)markers
|
|
305
|
+
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
306
|
+
withDuration:(CGFloat)duration
|
|
307
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
308
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
309
|
+
{
|
|
310
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
311
|
+
id view = viewRegistry[reactTag];
|
|
312
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
313
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
314
|
+
} else {
|
|
315
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
316
|
+
// TODO(lmr): we potentially want to include overlays here... and could concat the two arrays together.
|
|
317
|
+
// id annotations = mapView.annotations;
|
|
318
|
+
|
|
319
|
+
NSPredicate *filterMarkers = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
|
|
320
|
+
RNMMapMarker *marker = (RNMMapMarker *)evaluatedObject;
|
|
321
|
+
return [marker isKindOfClass:[RNMMapMarker class]] && [markers containsObject:marker.identifier];
|
|
322
|
+
}];
|
|
323
|
+
|
|
324
|
+
NSArray *filteredMarkers = [mapView.annotations filteredArrayUsingPredicate:filterMarkers];
|
|
325
|
+
|
|
326
|
+
if(duration > 0.0f) {
|
|
327
|
+
[RNMMap animateWithDuration:duration/1000 animations:^{
|
|
328
|
+
[mapView showAnnotations:filteredMarkers animated:YES];
|
|
329
|
+
} completion:^(BOOL finished){
|
|
330
|
+
resolve(nil);
|
|
331
|
+
}];
|
|
332
|
+
} else {
|
|
333
|
+
[mapView showAnnotations:filteredMarkers animated:NO];
|
|
334
|
+
resolve(nil);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
RCT_EXPORT_METHOD(fitToCoordinates:(nonnull NSNumber *)reactTag
|
|
341
|
+
coordinates:(nonnull NSArray<RNMMapCoordinate *> *)coordinates
|
|
342
|
+
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
343
|
+
withDuration:(CGFloat)duration
|
|
344
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
345
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
346
|
+
{
|
|
347
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
348
|
+
id view = viewRegistry[reactTag];
|
|
349
|
+
if (![view isKindOfClass:[RNMMap class]]) {
|
|
350
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
351
|
+
} else {
|
|
352
|
+
RNMMap *mapView = (RNMMap *)view;
|
|
353
|
+
|
|
354
|
+
// Create Polyline with coordinates
|
|
355
|
+
CLLocationCoordinate2D coords[coordinates.count];
|
|
356
|
+
for(int i = 0; i < coordinates.count; i++)
|
|
357
|
+
{
|
|
358
|
+
coords[i] = coordinates[i].coordinate;
|
|
359
|
+
}
|
|
360
|
+
MKPolyline *polyline = [MKPolyline polylineWithCoordinates:coords count:coordinates.count];
|
|
361
|
+
|
|
362
|
+
// Set Map viewport
|
|
363
|
+
CGFloat top = [RCTConvert CGFloat:edgePadding[@"top"]];
|
|
364
|
+
CGFloat right = [RCTConvert CGFloat:edgePadding[@"right"]];
|
|
365
|
+
CGFloat bottom = [RCTConvert CGFloat:edgePadding[@"bottom"]];
|
|
366
|
+
CGFloat left = [RCTConvert CGFloat:edgePadding[@"left"]];
|
|
367
|
+
|
|
368
|
+
if(duration > 0.0f) {
|
|
369
|
+
[RNMMap animateWithDuration:duration/1000 animations:^{
|
|
370
|
+
[mapView setVisibleMapRect:[polyline boundingMapRect] edgePadding:UIEdgeInsetsMake(top, left, bottom, right) animated:YES];
|
|
371
|
+
} completion:^(BOOL finished){
|
|
372
|
+
resolve(nil);
|
|
373
|
+
}];
|
|
374
|
+
} else {
|
|
375
|
+
[mapView setVisibleMapRect:[polyline boundingMapRect] edgePadding:UIEdgeInsetsMake(top, left, bottom, right) animated:NO];
|
|
376
|
+
resolve(nil);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}];
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
- (void)takeMapSnapshot:(RNMMap *)mapView
|
|
383
|
+
snapshotter:(MKMapSnapshotter *) snapshotter
|
|
384
|
+
format:(NSString *)format
|
|
385
|
+
quality:(CGFloat) quality
|
|
386
|
+
result:(NSString *)result
|
|
387
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
388
|
+
rejecter:(RCTPromiseRejectBlock)reject {
|
|
389
|
+
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
|
390
|
+
NSString *pathComponent = [NSString stringWithFormat:@"Documents/snapshot-%.20lf.%@", timeStamp, format];
|
|
391
|
+
NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent: pathComponent];
|
|
392
|
+
|
|
393
|
+
[snapshotter startWithQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
|
|
394
|
+
completionHandler:^(MKMapSnapshot *snapshot, NSError *error) {
|
|
395
|
+
if (error) {
|
|
396
|
+
NSString *msg = [error localizedDescription];
|
|
397
|
+
reject(@"takeMapSnapshot_error", msg, nil);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
MKAnnotationView *pin = [[MKMarkerAnnotationView alloc] initWithAnnotation:nil reuseIdentifier:nil];
|
|
401
|
+
|
|
402
|
+
UIImage *image = snapshot.image;
|
|
403
|
+
UIGraphicsBeginImageContextWithOptions(image.size, YES, image.scale);
|
|
404
|
+
{
|
|
405
|
+
[image drawAtPoint:CGPointMake(0.0f, 0.0f)];
|
|
406
|
+
|
|
407
|
+
CGRect rect = CGRectMake(0.0f, 0.0f, image.size.width, image.size.height);
|
|
408
|
+
|
|
409
|
+
for (id <RNMMapSnapshot> overlay in mapView.overlays) {
|
|
410
|
+
if ([overlay respondsToSelector:@selector(drawToSnapshot:context:)]) {
|
|
411
|
+
[overlay drawToSnapshot:snapshot context:UIGraphicsGetCurrentContext()];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
for (id <MKAnnotation> annotation in mapView.annotations) {
|
|
416
|
+
CGPoint point = [snapshot pointForCoordinate:annotation.coordinate];
|
|
417
|
+
|
|
418
|
+
MKAnnotationView* anView = [mapView viewForAnnotation: annotation];
|
|
419
|
+
|
|
420
|
+
if (anView){
|
|
421
|
+
pin = anView;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (CGRectContainsPoint(rect, point)) {
|
|
425
|
+
point.x = point.x + pin.centerOffset.x - (pin.bounds.size.width / 2.0f);
|
|
426
|
+
point.y = point.y + pin.centerOffset.y - (pin.bounds.size.height / 2.0f);
|
|
427
|
+
if (pin.image) {
|
|
428
|
+
[pin.image drawAtPoint:point];
|
|
429
|
+
} else {
|
|
430
|
+
CGRect pinRect = CGRectMake(point.x, point.y, pin.bounds.size.width, pin.bounds.size.height);
|
|
431
|
+
[pin drawViewHierarchyInRect:pinRect afterScreenUpdates:NO];
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
UIImage *compositeImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
437
|
+
|
|
438
|
+
NSData *data;
|
|
439
|
+
if ([format isEqualToString:@"png"]) {
|
|
440
|
+
data = UIImagePNGRepresentation(compositeImage);
|
|
441
|
+
}
|
|
442
|
+
else if([format isEqualToString:@"jpg"]) {
|
|
443
|
+
data = UIImageJPEGRepresentation(compositeImage, quality);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if ([result isEqualToString:@"file"]) {
|
|
447
|
+
[data writeToFile:filePath atomically:YES];
|
|
448
|
+
resolve(filePath);
|
|
449
|
+
}
|
|
450
|
+
else if ([result isEqualToString:@"base64"]) {
|
|
451
|
+
NSString *base64 = [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn];
|
|
452
|
+
resolve(base64);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
UIGraphicsEndImageContext();
|
|
456
|
+
}];
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
@end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMMapWMSTile.h
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
|
|
14
14
|
#import <React/RCTComponent.h>
|
|
15
15
|
#import <React/RCTView.h>
|
|
16
|
-
#import "
|
|
17
|
-
#import "
|
|
18
|
-
#import "RCTConvert+
|
|
19
|
-
#import "
|
|
20
|
-
#import "
|
|
16
|
+
#import "RNMMapCoordinate.h"
|
|
17
|
+
#import "RNMMap.h"
|
|
18
|
+
#import "RCTConvert+RNMMap.h"
|
|
19
|
+
#import "RNMMapUrlTile.h"
|
|
20
|
+
#import "RNMMapUrlTileCachedOverlay.h"
|
|
21
21
|
|
|
22
|
-
@interface
|
|
22
|
+
@interface RNMMapWMSTile : RNMMapUrlTile <MKOverlay>
|
|
23
23
|
@end
|
|
24
24
|
|
|
25
|
-
@interface
|
|
25
|
+
@interface RNMMapWMSTileOverlay : MKTileOverlay
|
|
26
26
|
@end
|
|
27
27
|
|
|
28
|
-
@interface
|
|
28
|
+
@interface RNMMapWMSTileCachedOverlay : RNMMapUrlTileCachedOverlay
|
|
29
29
|
@end
|
|
30
30
|
|
|
31
|
-
@interface
|
|
31
|
+
@interface RNMMapWMSTileHelper : NSObject
|
|
32
32
|
|
|
33
33
|
+ (NSURL *)URLForTilePath:(MKTileOverlayPath)path withURLTemplate:(NSString *)URLTemplate withTileSize:(NSInteger)tileSize;
|
|
34
34
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMMapWMSTile.m
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
-
#import "
|
|
9
|
+
#import "RNMMapWMSTile.h"
|
|
10
10
|
#import <React/UIView+React.h>
|
|
11
11
|
|
|
12
|
-
@implementation
|
|
12
|
+
@implementation RNMMapWMSTile
|
|
13
13
|
|
|
14
14
|
- (void)createTileOverlayAndRendererIfPossible
|
|
15
15
|
{
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
NSLog(@"tileCache new overlay dir %@", self.tileCachePath);
|
|
19
19
|
NSLog(@"tileCache %d", _tileCachePathSet);
|
|
20
20
|
NSLog(@"tileCache %d", _maximumNativeZSet);
|
|
21
|
-
self.tileOverlay = [[
|
|
21
|
+
self.tileOverlay = [[RNMMapWMSTileCachedOverlay alloc] initWithURLTemplate:self.urlTemplate];
|
|
22
22
|
_cachedOverlayCreated = YES;
|
|
23
23
|
if (_tileCachePathSet) {
|
|
24
24
|
NSURL *urlPath = [NSURL URLWithString:[self.tileCachePath stringByAppendingString:@"/"]];
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
} else {
|
|
37
37
|
NSLog(@"tileCache normal overlay");
|
|
38
|
-
self.tileOverlay = [[
|
|
38
|
+
self.tileOverlay = [[RNMMapWMSTileOverlay alloc] initWithURLTemplate:self.urlTemplate];
|
|
39
39
|
_cachedOverlayCreated = NO;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
@end
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
@implementation
|
|
53
|
+
@implementation RNMMapWMSTileOverlay
|
|
54
54
|
|
|
55
|
-
- (id)initWithURLTemplate:(NSString *)URLTemplate
|
|
55
|
+
- (id)initWithURLTemplate:(NSString *)URLTemplate
|
|
56
56
|
{
|
|
57
57
|
self = [super initWithURLTemplate:URLTemplate];
|
|
58
58
|
return self;
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
|
|
61
61
|
- (NSURL *)URLForTilePath:(MKTileOverlayPath)path
|
|
62
62
|
{
|
|
63
|
-
return [
|
|
63
|
+
return [RNMMapWMSTileHelper URLForTilePath:path withURLTemplate:self.URLTemplate withTileSize:self.tileSize.width];
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
@end
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
@implementation
|
|
69
|
+
@implementation RNMMapWMSTileCachedOverlay
|
|
70
70
|
|
|
71
|
-
- (id)initWithURLTemplate:(NSString *)URLTemplate
|
|
71
|
+
- (id)initWithURLTemplate:(NSString *)URLTemplate
|
|
72
72
|
{
|
|
73
73
|
self = [super initWithURLTemplate:URLTemplate];
|
|
74
74
|
return self;
|
|
@@ -76,13 +76,13 @@
|
|
|
76
76
|
|
|
77
77
|
- (NSURL *)URLForTilePath:(MKTileOverlayPath)path
|
|
78
78
|
{
|
|
79
|
-
return [
|
|
79
|
+
return [RNMMapWMSTileHelper URLForTilePath:path withURLTemplate:self.URLTemplate withTileSize:self.tileSize.width];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
@end
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
@implementation
|
|
85
|
+
@implementation RNMMapWMSTileHelper
|
|
86
86
|
+ (NSURL *)URLForTilePath:(MKTileOverlayPath)path withURLTemplate:(NSString *)URLTemplate withTileSize:(NSInteger)tileSize
|
|
87
87
|
{
|
|
88
88
|
NSArray *bb = [self getBoundBox:path.x yAxis:path.y zoom:path.z];
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
[NSNumber numberWithDouble:MapY - (double)y * tile],
|
|
111
111
|
nil];
|
|
112
112
|
|
|
113
|
-
return result;
|
|
113
|
+
return result;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
@end
|
|
116
|
+
@end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMMapWMSTileManager.h
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
#import <React/RCTViewManager.h>
|
|
11
11
|
|
|
12
|
-
@interface
|
|
12
|
+
@interface RNMMapWMSTileManager : RCTViewManager
|
|
13
13
|
|
|
14
14
|
@end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMMapWMSTileManager.m
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -13,23 +13,23 @@
|
|
|
13
13
|
#import <React/RCTEventDispatcher.h>
|
|
14
14
|
#import <React/RCTViewManager.h>
|
|
15
15
|
#import <React/UIView+React.h>
|
|
16
|
-
#import "
|
|
17
|
-
#import "
|
|
16
|
+
#import "RNMMapMarker.h"
|
|
17
|
+
#import "RNMMapWMSTile.h"
|
|
18
18
|
|
|
19
|
-
#import "
|
|
19
|
+
#import "RNMMapWMSTileManager.h"
|
|
20
20
|
|
|
21
|
-
@interface
|
|
21
|
+
@interface RNMMapWMSTileManager()
|
|
22
22
|
|
|
23
23
|
@end
|
|
24
24
|
|
|
25
|
-
@implementation
|
|
25
|
+
@implementation RNMMapWMSTileManager
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
RCT_EXPORT_MODULE()
|
|
28
|
+
RCT_EXPORT_MODULE(RNMMapWMSTile)
|
|
29
29
|
|
|
30
30
|
- (UIView *)view
|
|
31
31
|
{
|
|
32
|
-
|
|
32
|
+
RNMMapWMSTile *tile = [RNMMapWMSTile new];
|
|
33
33
|
return tile;
|
|
34
34
|
}
|
|
35
35
|
|