缓存什么存在平局对Android的图形页面 [英] Cache whats being draw on MapView in Android

查看:116
本文介绍了缓存什么存在平局对Android的图形页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发我的高校校园显示在MapView校园的应用;然后使用geopoints采用抽签方法扩展区<一类绘制建筑物的轮廓在校园上的MapView href=\"http://$c$c.google.com/android/add-ons/google-apis/reference/com/google/android/maps/Overlay.html\"相对=nofollow>叠加。有大约50-60的建筑物被绘制,从而导致非常laggy地图作为拉伸方法不断被绘制遍。

I am developing an app for my Universities campus that displays the campus in a MapView; then using geopoints draws the outlines of the buildings on campus on the mapView using the draw method a class that extents Overlay. There are about 50-60 buildings being drawn, resulting in a very laggy map as the draw method constantly gets drawn over and over.

我看着我的问题,我发现一些人提到在画布上绘制的建筑物,但我已经找到了如何去实现这个没有很好的例子或信息。任何人都可以点我如何降低地图的滞后正确的方向?地图上看起来很不错,但滞后只是杀死它的用处。

I have looked into my problem and I have found some people mentioning drawing the buildings on a canvas, but I have found no good examples or info on how to go about implementing this. Can anyone point me in the right direction on how to reduce the map's lag? The map looks very nice but the lag just kills its usefulness.

谢谢!

推荐答案

如果您有整理成多边形所有点你可以画在画布上的多边形,然后绘制其上叠加。我认为会更快。

If you have all the points organized into polygons you can draw polygons on a canvas and then draw it on an Overlay. That i think would be quicker.

此外,你总是可以做什么建筑的一部分需要重新绘制下一个位置,只是改变了画布的那部分一些计算。

Also you can always do some calculation about what part of the building need to be redrawn for the next position and just change that part of the Canvas.

如果您移动(X,Y)的像素从以前的位置,现有画布转移到新的位置,只画出现在地图上的新事物。

If you moved (X,Y) pixels from an earlier position, shift the existing canvas into the new position and just draw the new things that appear on map.

这当然不是最佳的解决方案,因为这种缓存不会与变焦工作

This is not the optimal solution of course because this kind of caching wouldn't work with the zoom.

希望它以某种方式帮助!
JQCorreia

Hope it helped somehow! JQCorreia

这篇关于缓存什么存在平局对Android的图形页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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