Android的地图覆盖消失在放大 [英] Android Map Overlay Disappears on Zoom

查看:147
本文介绍了Android的地图覆盖消失在放大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Android的谷歌地图API头疼......我画了一些覆盖在地图上,这一切都很正常,但会定期更新,并处理好姿态,没有问​​题......然而,当我放大到可能15-16或超过的水平,一个更大的多边形以上未重新绘制。这只发生的情况下的圆例如质心位于超出屏幕的边界,并且仅在放大时,会发生..缩小时,它不会发生,也不如果一个平移地图在任何方向它发生(翻译)。

I'm having a headache with Android's Google Maps API... I draw some overlays on the map and it's all fine, it updates regularly and handles gestures well, no problem... However, when I zoom in to perhaps level 15-16 or beyond, one or more of the larger polygons aren't redrawn. This only occurs in cases where the centroid of a circle for example lies beyond the bounds of the screen, and only occurs when zooming in.. it does not occur when zooming out, nor does it occur if one pans the map in any direction (translation).

当在非常密切的放大,我猜,系统会忽略覆盖/形状,把它当作不重要吗?我想可以得出任何形状与屏幕的边界相交。我缺少明显的东西在这里,因为我似乎无法找到如何看待这种情况下任何明确的答案。

When zooming in very close, I'm guessing the system disregards the overlay/shape, treating it as unimportant? I want any shape intersecting with the screen's bounds to be drawn. Am I missing something obvious here, because I can't seem to find any definitive answer on how to treat this scenario.

推荐答案

我倒是有类似的问题,但我只用正方形,这使得它更容易解决。

I'd a similar problem, but I was using only squares, which make it easier to solve.

问题的详细说明(在免得与广场):

canvas.drawRect()只绘制如果两个矩形顶和底部有明显的内屏幕坐标的矩形。一旦顶部或矩形的底部有一个坐标以外的屏幕,它没有画出。

canvas.drawRect() only draws the rectangle if both top and bottom of rectangle have coordinates within visible screen. As soon as the top or the bottom of the rectangle have a coordinate outside screen, it's not drawn.

解决方案,我用正方形

我croped广场,使其总是可见的屏幕坐标范围内适合,它被正确地绘制。

I croped the square to make it always fit within the visible screen coordinates, and it was correctly drawn.

如果您使用的是更复杂的人物,这种解决方案可能更难治来实现。

If you are using more complex figures, this solution may be more dificult to implement.

好运。

这篇关于Android的地图覆盖消失在放大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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