谷歌地图使用叠加层非常慢

发布于 2024-12-22 06:13:45 字数 1010 浏览 0 评论 0原文

我有一个 MapView,在其中放置了一些 ca. 200 个叠加,全部具有相同的图片。我用 Restlet 获取位置数据。但这不应该是问题,因为我获取数据的速度足够快。

问题是,MapView 非常慢。性能会随着覆盖层的数量而降低,但它不应该降低,因为在 iPad 上,有一个应用程序可以轻松做到这一点。我的平板电脑有更多 Ghz。 即使我没有在平板电脑上滚动,平板电脑也会一次又一次地加载地图的某些部分

所以我认为我做错了什么。所以我有一些问题:

  1. LogCat 说:GC_CONCURRENT 释放了 287K,释放了 6% 7222K/7623K,暂停了 1ms+2ms 并重复此操作,试图不断获得一些空间。是否有可能这就是问题所在,缓存填充太多?

  2. 叠加层的阴影是否可能会消耗相当多的性能?我怎样才能删除它们?

  3. 如何通过按后退按钮删除所有数据?我必须在 onStop()onDestroy() 中插入什么?据我所知,垃圾收集器会自动完成所有这些工作。我还能做什么?删除叠加层?

  4. 我使用的案例如下:

    minLatitude = (minLatitude > 合作伙伴Latitude) ?合作伙伴纬度:最小纬度;
    

    和每个:

    for(BrunnerPartner 合作伙伴:查询) {     
    PartnerAL.add(合作伙伴);                     
    }
    

    这些对性能有害吗?

  5. 如果我在缩放范围较小时隐藏一些叠加层,会对我有帮助吗?我该如何做到这一点?

I have a MapView in which I place some ca. 200 Overlays, all with the same picture. I get the location-data with Restlet. But that shouldn't be the problem, because I get the Data fast enough.

The problem is, that the MapView is very slow. The performance decreases with the count of the Overlays, but it shouldn't, cause on the iPad, there's an app, which can do this easily. My Tablet has even more Ghz.
The Tablet is loading parts of the map again and again, even when I don't scroll on it.

So I think that I'm doing something wrong. So I have some questions:

  1. LogCat says: GC_CONCURRENT freed 287K, 6% free 7222K/7623K, paused 1ms+2ms
    and repeats this, trying to get some space continuously. Is it possible that this is the problem and the cache filled too much?

  2. Is it possible that the shadow of the Overlays costs pretty much performance? How can I delete them?

  3. How can I delete all the data with pressing the back button? What do I have to insert into onStop() and onDestroy() ? As I know, the Garbage Collector is doing all this stuff automatically. What else could I do? Remove Overlays?

  4. I use cases like:

    minLatitude = (minLatitude > partnerLatitude) ? partnerLatitude : minLatitude;
    

    and for-each:

    for(BrunnerPartner partner: query) {     
    partnerAL.add(partner);                     
    }
    

    Are these bad for performance?

  5. Would it help me if I would hide some Overlays when the zoom span is small? How could I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青瓷清茶倾城歌 2024-12-29 06:13:45

看一下 OverlayItem 示例: http://developer.android.com /resources/tutorials/views/hello-mapview.html

使用单独的叠加层会导致大量的膨胀。

Take a look at the OverlayItem example: http://developer.android.com/resources/tutorials/views/hello-mapview.html

Using individual overlays introduces a large amount of bloat.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文