Authored by Justin R. Miller

fix bug & clarify that only points are supported currently

... ... @@ -92,7 +92,7 @@ typedef enum : NSUInteger {
* @return An initialized Mapbox tile source. */
- (id)initWithTileJSON:(NSString *)tileJSON;
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data.
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add point annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data.
*
* This method requires a network connection in order to download the TileJSON used to define the tile source.
*
... ... @@ -101,7 +101,7 @@ typedef enum : NSUInteger {
* @return An initialized Mapbox tile source. */
- (id)initWithMapID:(NSString *)mapID enablingDataOnMapView:(RMMapView *)mapView;
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data, optionally enabling SSL.
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add point annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data, optionally enabling SSL.
*
* This method requires a network connection in order to download the TileJSON used to define the tile source.
*
... ... @@ -111,13 +111,13 @@ typedef enum : NSUInteger {
* @return An initialized Mapbox tile source. */
- (id)initWithMapID:(NSString *)mapID enablingDataOnMapView:(RMMapView *)mapView enablingSSL:(BOOL)enableSSL;
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data.
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add point annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data.
* @param tileJSON A string containing TileJSON.
* @param mapView A map view on which to display the annotations.
* @return An initialized Mapbox tile source. */
- (id)initWithTileJSON:(NSString *)tileJSON enablingDataOnMapView:(RMMapView *)mapView;
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data.
/** For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add point annotations from [simplestyle](http://mapbox.com/developers/simplestyle/) data.
*
* Passing a remote URL requires a network connection. If offline functionality is desired, you should cache the TileJSON locally at a prior date, then pass a file path URL to this method.
*
... ...
... ... @@ -116,26 +116,29 @@
{
for (NSDictionary *feature in jsonObject[@"features"])
{
NSDictionary *properties = feature[@"properties"];
CLLocationCoordinate2D coordinate = {
.longitude = [feature[@"geometry"][@"coordinates"][0] floatValue],
.latitude = [feature[@"geometry"][@"coordinates"][1] floatValue]
};
RMAnnotation *annotation = nil;
if ([mapView.delegate respondsToSelector:@selector(mapView:layerForAnnotation:)])
annotation = [RMAnnotation annotationWithMapView:mapView coordinate:coordinate andTitle:properties[@"title"]];
else
annotation = [RMPointAnnotation annotationWithMapView:mapView coordinate:coordinate andTitle:properties[@"title"]];
annotation.userInfo = properties;
dispatch_async(dispatch_get_main_queue(), ^(void)
if ([feature[@"geometry"][@"type"] isEqualToString:@"Point"])
{
[mapView addAnnotation:annotation];
});
NSDictionary *properties = feature[@"properties"];
CLLocationCoordinate2D coordinate = {
.longitude = [feature[@"geometry"][@"coordinates"][0] floatValue],
.latitude = [feature[@"geometry"][@"coordinates"][1] floatValue]
};
RMAnnotation *annotation = nil;
if ([mapView.delegate respondsToSelector:@selector(mapView:layerForAnnotation:)])
annotation = [RMAnnotation annotationWithMapView:mapView coordinate:coordinate andTitle:properties[@"title"]];
else
annotation = [RMPointAnnotation annotationWithMapView:mapView coordinate:coordinate andTitle:properties[@"title"]];
annotation.userInfo = properties;
dispatch_async(dispatch_get_main_queue(), ^(void)
{
[mapView addAnnotation:annotation];
});
}
}
}
}
... ...