react-native-maps 1.21.0-alpha.42 → 1.21.0-alpha.44
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.
|
@@ -1087,6 +1087,51 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1087
1087
|
return _kmlSrc;
|
|
1088
1088
|
}
|
|
1089
1089
|
|
|
1090
|
+
- (void) setKMLData:(NSData *) urlData {
|
|
1091
|
+
GMUKMLParser *parser = [[GMUKMLParser alloc] initWithData:urlData];
|
|
1092
|
+
[parser parse];
|
|
1093
|
+
|
|
1094
|
+
NSUInteger index = 0;
|
|
1095
|
+
NSMutableArray *markers = [[NSMutableArray alloc]init];
|
|
1096
|
+
|
|
1097
|
+
for (GMUPlacemark *place in parser.placemarks) {
|
|
1098
|
+
|
|
1099
|
+
CLLocationCoordinate2D location =((GMUPoint *) place.geometry).coordinate;
|
|
1100
|
+
|
|
1101
|
+
AIRGoogleMapMarker *marker = (AIRGoogleMapMarker *)[[AIRGoogleMapMarkerManager alloc] view];
|
|
1102
|
+
if (!marker.bridge) {
|
|
1103
|
+
marker.bridge = _bridge;
|
|
1104
|
+
}
|
|
1105
|
+
marker.identifier = place.title;
|
|
1106
|
+
marker.coordinate = location;
|
|
1107
|
+
marker.title = place.title;
|
|
1108
|
+
marker.subtitle = place.snippet;
|
|
1109
|
+
marker.pinColor = place.style.fillColor;
|
|
1110
|
+
marker.imageSrc = [AIRGoogleMap GetIconUrl:place parser:parser];
|
|
1111
|
+
marker.layer.backgroundColor = [UIColor clearColor].CGColor;
|
|
1112
|
+
marker.layer.position = CGPointZero;
|
|
1113
|
+
|
|
1114
|
+
[self insertReactSubview:(UIView *) marker atIndex:index];
|
|
1115
|
+
|
|
1116
|
+
[markers addObject:@{@"id": marker.identifier,
|
|
1117
|
+
@"title": marker.title,
|
|
1118
|
+
@"description": marker.subtitle,
|
|
1119
|
+
@"coordinate": @{
|
|
1120
|
+
@"latitude": @(location.latitude),
|
|
1121
|
+
@"longitude": @(location.longitude)
|
|
1122
|
+
}
|
|
1123
|
+
}];
|
|
1124
|
+
|
|
1125
|
+
index++;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
id event = @{@"markers": markers};
|
|
1129
|
+
if (self.onKmlReady) self.onKmlReady(event);
|
|
1130
|
+
#else
|
|
1131
|
+
REQUIRES_GOOGLE_MAPS_UTILS();
|
|
1132
|
+
#endif
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1090
1135
|
- (void)setKmlSrc:(NSString *)kmlUrl {
|
|
1091
1136
|
#ifdef HAVE_GOOGLE_MAPS_UTILS
|
|
1092
1137
|
|
|
@@ -1096,53 +1141,28 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1096
1141
|
NSData *urlData = nil;
|
|
1097
1142
|
|
|
1098
1143
|
if ([url isFileURL]) {
|
|
1099
|
-
|
|
1144
|
+
[self setKMLData:[NSData dataWithContentsOfURL:url]];
|
|
1100
1145
|
} else {
|
|
1101
|
-
|
|
1146
|
+
__weak AIRGoogleMap *weakSelf = self;
|
|
1147
|
+
|
|
1148
|
+
NSURLSession *session = [NSURLSession sharedSession];
|
|
1149
|
+
NSURLSessionDataTask *dataTask = [session dataTaskWithURL:url
|
|
1150
|
+
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
|
|
1151
|
+
if (error) {
|
|
1152
|
+
NSLog(@"Error fetching data: %@", error.localizedDescription);
|
|
1153
|
+
return;
|
|
1154
|
+
} else {
|
|
1155
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1156
|
+
AIRGoogleMap *strongSelf = weakSelf;
|
|
1157
|
+
[strongSelf setKMLData:data];
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
}
|
|
1161
|
+
}];
|
|
1162
|
+
[dataTask resume];
|
|
1102
1163
|
}
|
|
1103
1164
|
|
|
1104
|
-
|
|
1105
|
-
[parser parse];
|
|
1106
|
-
|
|
1107
|
-
NSUInteger index = 0;
|
|
1108
|
-
NSMutableArray *markers = [[NSMutableArray alloc]init];
|
|
1109
|
-
|
|
1110
|
-
for (GMUPlacemark *place in parser.placemarks) {
|
|
1111
|
-
|
|
1112
|
-
CLLocationCoordinate2D location =((GMUPoint *) place.geometry).coordinate;
|
|
1113
|
-
|
|
1114
|
-
AIRGoogleMapMarker *marker = (AIRGoogleMapMarker *)[[AIRGoogleMapMarkerManager alloc] view];
|
|
1115
|
-
if (!marker.bridge) {
|
|
1116
|
-
marker.bridge = _bridge;
|
|
1117
|
-
}
|
|
1118
|
-
marker.identifier = place.title;
|
|
1119
|
-
marker.coordinate = location;
|
|
1120
|
-
marker.title = place.title;
|
|
1121
|
-
marker.subtitle = place.snippet;
|
|
1122
|
-
marker.pinColor = place.style.fillColor;
|
|
1123
|
-
marker.imageSrc = [AIRGoogleMap GetIconUrl:place parser:parser];
|
|
1124
|
-
marker.layer.backgroundColor = [UIColor clearColor].CGColor;
|
|
1125
|
-
marker.layer.position = CGPointZero;
|
|
1126
|
-
|
|
1127
|
-
[self insertReactSubview:(UIView *) marker atIndex:index];
|
|
1128
|
-
|
|
1129
|
-
[markers addObject:@{@"id": marker.identifier,
|
|
1130
|
-
@"title": marker.title,
|
|
1131
|
-
@"description": marker.subtitle,
|
|
1132
|
-
@"coordinate": @{
|
|
1133
|
-
@"latitude": @(location.latitude),
|
|
1134
|
-
@"longitude": @(location.longitude)
|
|
1135
|
-
}
|
|
1136
|
-
}];
|
|
1137
|
-
|
|
1138
|
-
index++;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
id event = @{@"markers": markers};
|
|
1142
|
-
if (self.onKmlReady) self.onKmlReady(event);
|
|
1143
|
-
#else
|
|
1144
|
-
REQUIRES_GOOGLE_MAPS_UTILS();
|
|
1145
|
-
#endif
|
|
1165
|
+
|
|
1146
1166
|
}
|
|
1147
1167
|
|
|
1148
1168
|
|
|
@@ -520,6 +520,7 @@ using namespace facebook::react;
|
|
|
520
520
|
REMAP_MAPVIEW_PROP(zoomTapEnabled)
|
|
521
521
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
522
522
|
|
|
523
|
+
REMAP_MAPVIEW_STRING_PROP(kmlSrc)
|
|
523
524
|
|
|
524
525
|
if (newViewProps.minZoom != oldViewProps.minZoom || newViewProps.maxZoom != oldViewProps.maxZoom){
|
|
525
526
|
[_view setMinZoom:newViewProps.minZoom maxZoom:newViewProps.maxZoom];
|
package/ios/AirMaps/AIRMap.m
CHANGED
|
@@ -49,6 +49,8 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
49
49
|
{
|
|
50
50
|
UIView *_legalLabel;
|
|
51
51
|
BOOL _initialRegionSet;
|
|
52
|
+
BOOL _initialRegionProvided;
|
|
53
|
+
BOOL _initialCameraProvided;
|
|
52
54
|
BOOL _initialCameraSet;
|
|
53
55
|
BOOL _initialized;
|
|
54
56
|
BOOL _loadingStarted;
|
|
@@ -586,6 +588,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
586
588
|
return;
|
|
587
589
|
}
|
|
588
590
|
_initialRegion = initialRegion;
|
|
591
|
+
_initialRegionProvided = YES;
|
|
589
592
|
if (!_initialRegionSet && _loadingStarted) {
|
|
590
593
|
_initialRegionSet = YES;
|
|
591
594
|
[self setRegion:initialRegion animated:NO];
|
|
@@ -600,6 +603,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
600
603
|
|
|
601
604
|
- (void)setInitialCamera:(MKMapCamera*)initialCamera {
|
|
602
605
|
_initialCamera = initialCamera;
|
|
606
|
+
_initialCameraProvided = YES;
|
|
603
607
|
if (initialCamera){
|
|
604
608
|
if (!_initialCameraSet && _loadingStarted) {
|
|
605
609
|
_initialCameraSet = YES;
|
|
@@ -824,8 +828,12 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
824
828
|
}
|
|
825
829
|
_loadingStarted = YES;
|
|
826
830
|
// display initialRegion/Camera
|
|
827
|
-
|
|
828
|
-
|
|
831
|
+
if (_initialRegionProvided){
|
|
832
|
+
[self setInitialRegion:_initialRegion];
|
|
833
|
+
}
|
|
834
|
+
if (_initialCameraProvided){
|
|
835
|
+
[self setInitialCamera:_initialCamera];
|
|
836
|
+
}
|
|
829
837
|
}
|
|
830
838
|
|
|
831
839
|
- (void)finishLoading {
|
|
@@ -436,17 +436,24 @@ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
#define REMAP_MAPVIEW_REGION_PROP(name) \
|
|
439
|
-
if (newViewProps.name.latitude
|
|
440
|
-
newViewProps.name.longitude
|
|
441
|
-
newViewProps.name.latitudeDelta
|
|
442
|
-
newViewProps.name.longitudeDelta
|
|
443
|
-
|
|
444
|
-
newViewProps.name.
|
|
445
|
-
|
|
446
|
-
newViewProps.name.
|
|
447
|
-
|
|
439
|
+
if (!(newViewProps.name.latitude == 0 && \
|
|
440
|
+
newViewProps.name.longitude == 0 && \
|
|
441
|
+
newViewProps.name.latitudeDelta == 0 && \
|
|
442
|
+
newViewProps.name.longitudeDelta == 0)) { \
|
|
443
|
+
if (newViewProps.name.latitude != oldViewProps.name.latitude || \
|
|
444
|
+
newViewProps.name.longitude != oldViewProps.name.longitude || \
|
|
445
|
+
newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
|
|
446
|
+
newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
|
|
447
|
+
MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
|
|
448
|
+
newViewProps.name.longitudeDelta); \
|
|
449
|
+
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
|
|
450
|
+
newViewProps.name.latitude, \
|
|
451
|
+
newViewProps.name.longitude), span); \
|
|
452
|
+
_view.name = region; \
|
|
453
|
+
} \
|
|
448
454
|
}
|
|
449
455
|
|
|
456
|
+
|
|
450
457
|
#define REMAP_MAPVIEW_CAMERA_PROP(name) \
|
|
451
458
|
if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
|
|
452
459
|
newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.21.0-alpha.
|
|
8
|
+
"version": "1.21.0-alpha.44",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|