私はこれをしました:
public class LongTravlOverlay extends Overlay{
private Projection projection;
private List<GeoPoint> glist;
GeoPoint gP1;
GeoPoint gP2;
public LongTravlOverlay(Projection a,List<GeoPoint> b){
projection=a;
this.glist=b;
}
public void draw(Canvas canvas, MapView mapv, boolean shadow){
super.draw(canvas, mapv, shadow);
Paint mPaint = new Paint();
mPaint.setDither(true);
mPaint.setColor(Color.BLUE);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(3);
for(GeoPoint g1:glist)
{
if(gP1!=null)
{
gP1=gP2;
gP2=new GeoPoint(g1.getLatitudeE6(),g1.getLongitudeE6());
}
else
{
gP1=new GeoPoint(g1.getLatitudeE6(),g1.getLongitudeE6());
gP2=gP1;
continue;
}
Point p1 = new Point();
Point p2 = new Point();
Path path = new Path();
projection.toPixels(gP1, p1);
projection.toPixels(gP2, p2);
path.moveTo(p2.x, p2.y);
path.lineTo(p1.x,p1.y);
canvas.drawPath(path, mPaint);
}
}
}
それは機能し、すべての点の間に線を引きます。唯一の問題は、最初のポイントと最後のポイントの間に、他のポイントのパス上で交差する線もあるということです。どうすれば削除できますか?