mapbox/mbxmapkit — pull request #21 by wsnook (2014-01-14 09:49:46+00:00)
Title: Fix for issues #5 (markers) & #9 (simplestyle)

This is a fix for issues #5 and #9 which are closely related. All my new changes should be fenced off with `#ifdef MBXMAPKIT_ENABLE_SIMPLESTYLE_MAKI` unless something slipped through the cracks.

There are three main parts to my code:

1) `MBXSimpleStylePointAnnotation` implements `MKAnnotation` by way of `MKShape`, and it knows how to download stand-alone marker images from the MapBox Core API (see https://www.mapbox.com/developers/api/#Stand-alone.markers). Justin, I chose to diverge a little bit from your `pin.pinImageID = MBXPinImageBus;` suggestion because there's a pretty significant advantage to closely following the Core API... when new Maki icons are added, this code should still work without having to make any changes. One obvious potential improvement to my code would be to add defaults for the size and color, but for now I haven't done that.

2) In `MBXMapView`, `-(void)updateMarkers` loads the simplestyle geoJSON in parallel to the existing `- (void)updateOverlay`, and it creates an `MBXSimpleStylePointAnnotation` for each Point in the simplestyle. The geoJSON, and the markers are added to the cache according to the existing caching patterns. However, I didn't copy the automatic retry from `updateOverlay` because it looked like that could potentially cause an infinite loop.

3) In `viewDidLoad` of `MBXViewController.m`, I included a demonstration (issue #9 style) for a map which I created on my MapBox account since the existing example map did not include any simplestyle features for testing with. I also demonstrated how to manually add a point marker (issue #5 style). **An important thing to note is that a new demo map with simplestyle features needs to be created, and the map ID needs to be changed, before this gets merged.**

I've done some moderate testing for this on iOS, and it all seemed to work well. I have no idea what will happen on the Mac side since I don't have a membership to test that.