{"action":"created","issue":{"url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/issues/789","repository_url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone","labels_url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/issues/789/labels{/name}","comments_url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/issues/789/comments","events_url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/issues/789/events","html_url":"https://github.com/OneBusAway/onebusaway-iphone/issues/789","id":181570815,"number":789,"title":"Replace OBAStopIconFactory with something a little more flexible","user":{"login":"aaronbrethorst","id":2254,"avatar_url":"https://avatars.githubusercontent.com/u/2254?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronbrethorst","html_url":"https://github.com/aaronbrethorst","followers_url":"https://api.github.com/users/aaronbrethorst/followers","following_url":"https://api.github.com/users/aaronbrethorst/following{/other_user}","gists_url":"https://api.github.com/users/aaronbrethorst/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronbrethorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronbrethorst/subscriptions","organizations_url":"https://api.github.com/users/aaronbrethorst/orgs","repos_url":"https://api.github.com/users/aaronbrethorst/repos","events_url":"https://api.github.com/users/aaronbrethorst/events{/privacy}","received_events_url":"https://api.github.com/users/aaronbrethorst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/labels/enhancement","name":"enhancement","color":"009800"},{"url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/labels/Your%20First%20PR","name":"Your First PR","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-07T02:07:51Z","updated_at":"2016-10-07T03:36:55Z","closed_at":null,"body":"`OBAStopIconFactory` has served us very well for a very long time, but, as OBA becomes multi-lingual, we will need to look at replacing it. \r\n\r\nI'd like to keep the public interface and the `UIImage`s that are output 100% unchanged for the time being, but I'd like to see the images that are generated be created mostly in code. \r\n\r\n# Example\r\n\r\n![busstopicone 2x](https://cloud.githubusercontent.com/assets/2254/19176630/9b1363c4-8bf6-11e6-9971-1e95c9e1d45f.png)\r\n\r\nLet's take the above bus stop icon as an example. The only raster image that should be used to compose this icon should be the icon of the bus itself. The white background, black squircle, arrow, and the word \"STOP\" should all be rendered in code.\r\n\r\nThis should work for all supported route types: \r\n\r\n- [ ] Ferry\r\n- [ ] Rail\r\n- [ ] LightRail\r\n- [ ] Bus\r\n\r\nand it should work for all directions. \r\n\r\nIcons should be rendered on demand, work for any screen density (1x to 3x), and be cached after creation."},"comment":{"url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/issues/comments/252145748","html_url":"https://github.com/OneBusAway/onebusaway-iphone/issues/789#issuecomment-252145748","issue_url":"https://api.github.com/repos/OneBusAway/onebusaway-iphone/issues/789","id":252145748,"user":{"login":"barbeau","id":928045,"avatar_url":"https://avatars.githubusercontent.com/u/928045?v=3","gravatar_id":"","url":"https://api.github.com/users/barbeau","html_url":"https://github.com/barbeau","followers_url":"https://api.github.com/users/barbeau/followers","following_url":"https://api.github.com/users/barbeau/following{/other_user}","gists_url":"https://api.github.com/users/barbeau/gists{/gist_id}","starred_url":"https://api.github.com/users/barbeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbeau/subscriptions","organizations_url":"https://api.github.com/users/barbeau/orgs","repos_url":"https://api.github.com/users/barbeau/repos","events_url":"https://api.github.com/users/barbeau/events{/privacy}","received_events_url":"https://api.github.com/users/barbeau/received_events","type":"User","site_admin":false},"created_at":"2016-10-07T03:36:55Z","updated_at":"2016-10-07T03:36:55Z","body":"FYI - we generate OBA Android stop markers completely from code (there is no raster there for us, just a circle with an arrow), which has been great for white labeling, as the color can easily be re-themed.  Our vehicle markers are closer to what you're proposing above, with a raster bus image and dynamic coloring.\r\n\r\nFWIW - from my experience on Android, it's far easier to dynamically generate arrows that exist within the main icon borders (which I did for the vehicle marker icons) than trying to dynamically render an arrow outside the main icon border (which I did for the stop marker icons).\r\n\r\nThe current iOS stop icon has the arrow rendered on the outside, while here's an example of a vehicle marker raw image that has the arrows inside the marker border:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/928045/17488634/38273bf8-5d68-11e6-8d7a-496d6fcf15ea.png)\r\n\r\nThe reason behind the difficulty is that if you want the marker to land at the correct lat/long on the map, and the arrow is outside the border, you have to account for the offset of the arrow itself when calculating the anchor point of the icon.  If the arrows are inside, you can always anchor the icon halfway between the borders.  I spent far more time than I'd like to admit getting this to work properly for the OBA Android stop icons, and this is one reason why I chose to put the arrows inside the marker for the vehicle markers.\r\n\r\nI'm definitely not telling you to switch, but just a heads up that this might be more difficult than it appears at first glance - I wish someone would have given me a heads up on Android.  Maybe (hopefully) this is easier to implement on iOS - on Android it's effectively drawing on a canvas.  Anyway...my two cents :)."}}
{"actor":{"display_login":"barbeau"}}