Multiple points on overlay, very slow

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Multiple points on overlay, very slow

Postby TommyB » Mon May 24, 2010 4:08 pm

Hi, I'm writing an application to track running and I decided to draw path on overlay, however, after 5km of run I have near 500 point to draw on map, what causes the app to work very slow. Maybe someone was writing something similar and solved this problem. There is a piece of my Overlay code (draw method).

One more question, eg. in cardiotrainer track is drawn like it would be directly on map not on overlay, is it possible to draw on google map and stop rendering 500points at every move of overlay?

Code: Select all
@Override
  public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    Projection projection = mapView.getProjection();

    if (shadow == false) {

         GeoPoint geoPoint;

          for(int i=0;i<pointList.size();i++){
          
             geoPoint = new GeoPoint(pointList.get(i).getLatitude().intValue(), pointList.get(i).getLongitude().intValue());
         projection.toPixels(geoPoint, newPoint);
         
           if( i==0 ){
              startPoint = new RectF(newPoint.x - mRadius, newPoint.y - mRadius, newPoint.x + mRadius, newPoint.y + mRadius);
              canvas.drawOval(startPoint, startPointPaint);
           }
           
           else if( i<pointList.size()-1 ){   
              startPoint = new RectF(newPoint.x - mRadius, newPoint.y - mRadius, newPoint.x + mRadius, newPoint.y + mRadius);
              canvas.drawOval(startPoint, startPointPaint);
           }
           
           else{
              stopPoint = new RectF(newPoint.x - mRadius, newPoint.y - mRadius, newPoint.x + mRadius, newPoint.y + mRadius);
              canvas.drawOval(stopPoint, stopPointPaint);
           }
              
         oldPoint = newPoint;
          }
    }
    super.draw(canvas, mapView, shadow);
   
  }
TommyB
Freshman
Freshman
 
Posts: 5
Joined: Tue May 27, 2008 10:49 am
Location: Poland

Top

Re: Multiple points on overlay, very slow

Postby zcj0429 » Tue Sep 07, 2010 12:17 pm

Hi, I have the same problem! I want to connect many coordinates from database to form some routes, but it becomes very slowly. I notice you post this thread on 2008, maybe now you have solved this problem. If so, please be kind to send me some information, Thank you very much
zcj0429
Freshman
Freshman
 
Posts: 2
Joined: Wed Nov 05, 2008 8:31 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests