[android-developers] Re: Drawing to MapView Incredibly Slow
If I'm both drawing lines and utilizing items, would it be wise to implement both a MapOverlay and a MapItemizedOverlay? Or do I just need one? On Feb 10, 4:55 pm, TreKing treking...@gmail.com wrote: On Wed, Feb 10, 2010 at 3:43 PM, aspekt9 aspe...@gmail.com wrote: What exactly is the span though, This is the distance between the locations demarcated by the edges of the screen. For longitude it's the distance between the locations at the left and right edges of the screen. For latitude it's the distance between the locations at the top and bottom of the screen. how would I calculate if a given coordinate or geopoint lies in between the span? You have the mapview's current center location, yes? You have the longitude and latitude spans, yes? With that you can get 2 GeoPoints that represent the min and max points of the view. (center +/- (span / 2)) With that you can check if a given GeoPoint lies within that min and max. - TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Drawing to MapView Incredibly Slow
I think I know why, in order for this to work, I'd have to add the items to an overlay everytime draw() is called, or else I can't draw them, and this is going to interrupt the addition of the stations because draw() is called numerous times in a short span of time. Here's my method to add the new items, this method is called from draw(), checkDrawableBounds verifies if it's in the drawable view. What's the right way to be drawing these? Sorry for all the posts. public void showStations(GeoPoint[] stations) { for (int i = 0; i stations.length; i++) { Log.w(GOOD?, String.valueOf(this.checkDrawableBounds(stations[i]))); if (this.checkDrawableBounds(stations[i])) { //OverlayItem overlayitem = new OverlayItem(stations[i], test, test); //itemizedOverlay.addOverlay(overlayitem); } } mapOverlays.add(itemizedOverlay); } On Feb 11, 3:50 am, aspekt9 aspe...@gmail.com wrote: Also, another issue I'm having, I can detect which points should be drawn in the view, but when I go to draw those points I call a method from the draw() method and I get a concurrent operation error: 02-11 03:47:11.848: ERROR/AndroidRuntime(2213): java.util.ConcurrentModificationException 02-11 03:47:11.848: ERROR/AndroidRuntime(2213): at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:66) 02-11 03:47:11.848: ERROR/AndroidRuntime(2213): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41) 02-11 03:47:11.848: ERROR/AndroidRuntime(2213): at com.google.android.maps.MapView.onDraw(MapView.java:476) It only does this when I call the method from the draw() method, but if I don't do that then I can't get the correct longitude and latitude coordinates, because they wont update unless they're called from draw(), if that makes sense. On Feb 11, 3:35 am, aspekt9 aspe...@gmail.com wrote: If I'm both drawing lines and utilizing items, would it be wise to implement both a MapOverlay and a MapItemizedOverlay? Or do I just need one? On Feb 10, 4:55 pm, TreKing treking...@gmail.com wrote: On Wed, Feb 10, 2010 at 3:43 PM, aspekt9 aspe...@gmail.com wrote: What exactly is the span though, This is the distance between the locations demarcated by the edges of the screen. For longitude it's the distance between the locations at the left and right edges of the screen. For latitude it's the distance between the locations at the top and bottom of the screen. how would I calculate if a given coordinate or geopoint lies in between the span? You have the mapview's current center location, yes? You have the longitude and latitude spans, yes? With that you can get 2 GeoPoints that represent the min and max points of the view. (center +/- (span / 2)) With that you can check if a given GeoPoint lies within that min and max. - TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Drawing to MapView Incredibly Slow
On Thu, Feb 11, 2010 at 2:35 AM, aspekt9 aspe...@gmail.com wrote: If I'm both drawing lines and utilizing items, would it be wise to implement both a MapOverlay and a MapItemizedOverlay? Or do I just need one? I haven't done line drawing in the map view, but probably just one. Override draw(), call super.draw() to do the default drawing and then to draw your lines however that's done. On Thu, Feb 11, 2010 at 2:55 AM, aspekt9 aspe...@gmail.com wrote: What's the right way to be drawing these? I was under the impression you were drawing these points / lines on your own, but now I see you're using ItemizedOverlay. I would expect the ItemizeOverlay class to be optimized for this sort of thing already (i.e., the map would not draw overlay items that are not in the view), so I think doing a bounds check yourself might be overkill, and may in fact make things worse if you do it every time draw is called. Of course I don't know the implementation details of the ItemizedOverlay class to know for certain. I would do as others have suggested and keep track of when the view changes (on zooming or panning basically) and needs to be updated. When this happens, in the draw() call then and only then would you need to update your list of items to draw. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Drawing to MapView Incredibly Slow
How would I do this? On Feb 10, 1:02 am, TreKing treking...@gmail.com wrote: On Tue, Feb 9, 2010 at 9:26 PM, aspekt9 aspe...@gmail.com wrote: There must be faster way, how does google deal with it when they display driving directions and they have all those path lines and points and such? Detect what is actually visible on screen and only draw those routes / points. - TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Drawing to MapView Incredibly Slow
Only do the real work when something relevant has changed, such as the map center. Then draw to a Picture. In draw, just draw the Picture every time. Neil http://l6n.org/android/ On Feb 10, 1:11 am, aspekt9 aspe...@gmail.com wrote: In my app I am drawing bus routes on top of a MapView. The routes have anywhere between a dozen and a few hundred GPS coordinates that describe the route that the bus takes. The problem I'm having is that once I draw out all these lines using drawLines panning/zooming the MapView is incredibly slow (even clicking the 'Back' button takes a minute to happen). I'm not sure how relevant it is, but I put in some debug code then checked the logcat output and the MapView is repeatedly calling the draw() method of the Overlay whether anything has changed or not. This is happening several times a second and is causing a massive amount of garbage collection to happen (2-3 MB every second). Does anyone have any ideas/suggestions for a method to try and speed this up? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Drawing to MapView Incredibly Slow
On Wed, Feb 10, 2010 at 2:35 AM, aspekt9 aspe...@gmail.com wrote: How would I do this? With a simple bounds check against the viewable area. You mapview tells you the center, the latitude span and the longitude span. You have the locations of all your points. If you point is in the view, draw it, if not, don't. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Drawing to MapView Incredibly Slow
I'm having an issue converting getLongitudeSpan() and getLatitudeSpan() to microdegrees, how do I do that? On Feb 10, 10:54 am, TreKing treking...@gmail.com wrote: On Wed, Feb 10, 2010 at 2:35 AM, aspekt9 aspe...@gmail.com wrote: How would I do this? With a simple bounds check against the viewable area. You mapview tells you the center, the latitude span and the longitude span. You have the locations of all your points. If you point is in the view, draw it, if not, don't. - TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Drawing to MapView Incredibly Slow
On Wed, Feb 10, 2010 at 2:47 PM, aspekt9 aspe...@gmail.com wrote: I'm having an issue converting getLongitudeSpan() and getLatitudeSpan() to microdegrees, how do I do that? The values returned by those functions ARE in micro-degrees... - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Drawing to MapView Incredibly Slow
What exactly is the span though, how would I calculate if a given coordinate or geopoint lies in between the span? On Feb 10, 3:59 pm, TreKing treking...@gmail.com wrote: On Wed, Feb 10, 2010 at 2:47 PM, aspekt9 aspe...@gmail.com wrote: I'm having an issue converting getLongitudeSpan() and getLatitudeSpan() to microdegrees, how do I do that? The values returned by those functions ARE in micro-degrees... - TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Drawing to MapView Incredibly Slow
On Wed, Feb 10, 2010 at 3:43 PM, aspekt9 aspe...@gmail.com wrote: What exactly is the span though, This is the distance between the locations demarcated by the edges of the screen. For longitude it's the distance between the locations at the left and right edges of the screen. For latitude it's the distance between the locations at the top and bottom of the screen. how would I calculate if a given coordinate or geopoint lies in between the span? You have the mapview's current center location, yes? You have the longitude and latitude spans, yes? With that you can get 2 GeoPoints that represent the min and max points of the view. (center +/- (span / 2)) With that you can check if a given GeoPoint lies within that min and max. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Drawing to MapView Incredibly Slow
Right now, I'm only using about 13 lines, 13 points and it's noticeably slower. There must be faster way, how does google deal with it when they display driving directions and they have all those path lines and points and such? On Feb 9, 9:57 pm, David Fire ddf...@gmail.com wrote: try with less points??? 2010/2/9 aspekt9 aspe...@gmail.com In my app I am drawing bus routes on top of a MapView. The routes have anywhere between a dozen and a few hundred GPS coordinates that describe the route that the bus takes. The problem I'm having is that once I draw out all these lines using drawLines panning/zooming the MapView is incredibly slow (even clicking the 'Back' button takes a minute to happen). I'm not sure how relevant it is, but I put in some debug code then checked the logcat output and the MapView is repeatedly calling the draw() method of the Overlay whether anything has changed or not. This is happening several times a second and is causing a massive amount of garbage collection to happen (2-3 MB every second). Does anyone have any ideas/suggestions for a method to try and speed this up? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- (\__/) (='.'=)This is Bunny. Copy and paste bunny into your ()_()signature to help him gain world domination. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Drawing to MapView Incredibly Slow
On Tue, Feb 9, 2010 at 9:26 PM, aspekt9 aspe...@gmail.com wrote: There must be faster way, how does google deal with it when they display driving directions and they have all those path lines and points and such? Detect what is actually visible on screen and only draw those routes / points. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en