[android-developers] path appearing twice on map canvas

2010-09-14 Thread dadada
hi all,

I have a Main_Overlay class that extends Overlay.

I added This overlay to the mapview and override the Draw method as of
below:

public void draw(android.graphics.Canvas canvas, MapView mapView,
boolean shadow )
{
 mPath = new Path();
 mPath.moveTo(0, -240);
 mPath.lineTo(-50, -100);
 mPath.lineTo(0, -150);
 mPath.lineTo(50, -100);
 mPath.close();

Paint paint2 = new Paint();
paint2.setStyle(Paint.Style.FILL);
paint2.setAlpha(80);


mPaint.setAntiAlias(true);
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setAlpha(40);

int w = canvas.getWidth();
int h = canvas.getHeight();
int cx = w / 2;
int cy = h / 2;

canvas.translate(cx, cy);

canvas.drawPath(mPath, mPaint);

}



However, the path is shown twice on the map canvas. One near the 0,0.
The other is at the bottom right hand corner.

When i draw it on normal canvas, only one path is shown.

Can Someone please advise?

Thanks!
Bryan

-- 
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] path appearing twice on map canvas

2010-09-14 Thread dadada
Hi all,

I have a Main_Overlay that extends Overlay.

Inside Main_Overlay i override the draw method:



public void draw(android.graphics.Canvas canvas, MapView mapView,
boolean shadow )
{
 mPath = new Path();
 mPath.moveTo(0, -240);
 mPath.lineTo(-50, -100);
 mPath.lineTo(0, -150);
 mPath.lineTo(50, -100);
 mPath.addCircle(0, 0, 240, Path.Direction.CW);
 mPath.close();

Paint paint2 = new Paint();
paint2.setStyle(Paint.Style.FILL);
paint2.setAlpha(80);


mPaint.setAntiAlias(true);
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setAlpha(40);

int w = canvas.getWidth();
int h = canvas.getHeight();
int cx = w / 2;
int cy = h / 2;

canvas.translate(cx, cy);

canvas.drawPath(mPath, mPaint);

}




However, the path is drawn twice. First at 0,0 and then the other at
the bottom right hand side. While it is only drawn once on normal
canvas.

Can somebody please advise me on this?

Thanks
Bryan

-- 
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] path appearing twice on map canvas

2010-09-14 Thread TreKing
On Tue, Sep 14, 2010 at 3:46 AM, dadada ytbr...@gmail.com wrote:

 Can somebody please advise me on this?


From the documentation:
Draw the overlay over the map. This will be called on all active overlays
with shadow=true, to lay down the shadow layer, *and then again on all
overlays with shadow=false*.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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