A couple things MrChaz and TreKing didn't touch on.

First, I'd make certain you're not doing something to cause the draw
method to be called 7000 times!

Second, I'd make sure you're not doing something horribly expensive in
there -- perhaps something allocating a lot of memory and triggering
the GC. That's probably not your issue, but capturing some timings on
the drawing calls is probably worth your while anyway.

Third, and probably most important -- rather than drawing 7000 items
on each draw call -- draw the 7000 items into a bitmap, and draw that
bitmap, translated and scaled appropriately. When you get off the edge
of the bitmap, redo it for the new position and/or scale. Make it big
enough to allow for smooth scrolling in the immediate vicinity.

You can draw your 7000 items with a degree of transparency, so they
overlap and add up density. That's not the ideal way to show
clustering, but it's a start. A more sophisticated approach would be
to draw into a grayscale bitmap with a density distribution image, and
use the resulting density bitmap to index a color map.

Or if you prefer iconified clustering, rather than visual illustration
of the clustering: wherever the density is over a threshold, find the
centroid of that area, integrate the total score for that area, and
draw an icon of that diameter.

On Jan 12, 11:10 pm, Stephan Wiesner <[email protected]>
wrote:
> Hi,
> my app is supposed to display about 7000 items on a mapview (distributed
> over a whole country), but I have serious performance issues with this.
> Currently I only display the items that are in an 15km radius of the center
> of the map (user has to press a button for this) and everything works fine.
> I would prefer to show all items at start, though. That is possible, but
> moving the map around becomes very slow (guess I need that new LG phone
> after all :-).
>
> I extend ItemizedOverlay and the problem seems to be in
>
> public void draw(Canvas canvas, MapView mapView, boolean shadow) {
> if (canvas != null && mapView != null) {
> super.draw(canvas, mapView, false);
>
> }
> }
>
> if I comment out the call to super, the moving of the map is smooth (but of
> course nothing is displayed).
>
> Any hints?
> Thanks,
> Stephan
>
> --
> Interessiert an Android?http://android-schweiz.blogspot.com/
> Whant to learn German?http://german-podcast.blogspot.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to