iPhone Google Maps中的路线,折线 [英] Routing, polylines in iPhone Google Maps

查看:72
本文介绍了iPhone Google Maps中的路线,折线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的iPhone应用程序中,我们需要在Google Maps上绘制路线(GMaps是唯一的选择,我们不能考虑其他地图).

In our iPhone app we need to draw a route on Google Maps (GMaps is the only option, we can't consider other maps).

我们在用户走动时绘制路线-基本上是GPS跟踪.然后,我们在地图上显示所有已保存的路线.问题在于Google地图几乎无法使用.不可能滚动地图,缩放地图(一切都非常慢).

We draw the route while the user walks around - GPS tracking basically. Then we display all saved routes on the map. The problem is that Google Maps is almost unusable. It is impossible to scroll the map, zoom it (everything is extremely slow).

现在,我们在方法中的透明层[UIColor clearColor]上绘制路线 -(void)drawRect:(CGRect)rect 通过UIGraphicsGetCurrentContext使用[setNeedsDisplay]调用. 我们的任务是绘制一条路线(几乎像在本机iPhone GMaps应用程序中一样),以便地图可滚动且易于缩放,并且路线不会出现毛刺.

Now we draw the route on a transparent layer [UIColor clearColor] in the method - (void)drawRect:(CGRect)rect which is called using [ setNeedsDisplay] through UIGraphicsGetCurrentContext. Our task is to draw a route (almost like in native iPhone GMaps app) so that the map will be scrollable and easy to zoom and the route won't be glitchy.

作为我们需要执行的操作的示例,我可以指向此应用程序

As an example of what we need to do I can point to this app http://itunes.apple.com/us/app/endomondo-tracker/id333210180?mt=8 Maybe you can point me to any of the libraries that do this? Thank you for your help.

推荐答案

您可能想看看 http ://github.com/mobilemelting/nvpolyline 此解决方案特别针对v.4.0之前的iPhone OS版本

You might want to have a look at http://github.com/mobilemelting/nvpolyline This solution is especially targeted at iPhone OS versions prior to v.4.0

尽管它也可以在v.4.0中使用 希望这会有所帮助.

Although it can also be used in v.4.0 Hope this helps.

这篇关于iPhone Google Maps中的路线,折线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆