我有地圖點Android的地圖路徑借鑑點十字線
@Override
public void draw(Canvas canvas, MapView mapview, boolean shadow) {
if (!shadow) {
Projection projection = mapview.getProjection();
for(int i=0; i< puntos.size()-1; i++) {
Point origen = new Point();
Point destino = new Point();
projection.toPixels(puntos.get(i).getPoint(), origen);
projection.toPixels(puntos.get(i+1).getPoint(), destino);
Paint paint = new Paint();
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(5);
paint.setColor(Color.GREEN);
paint.setAntiAlias(true);
canvas.drawLine(origen.x, origen.y, destino.x, destino.y, paint);
mapview.invalidate();
}
}
super.draw(canvas, mapview, shadow);
}
但之間畫線的代碼,當我把對地圖上點太近或指向該行跨其他行的MapView平多行到近點。所以如果我有點1,2,3,4。點1有一個劃線點2,3,4
任何想法如何解決這個??
st發生,當我添加點3或4時,mapview從點3到點4從第3點到第1點繪製一條線... – Nonyck