public void draw(Canvas canvas, PixelCalculator calculator, boolean shadow) {
super.draw(canvas, calculator, shadow);
pathPaint.setStyle(Paint.Style.STROKE);
pathPaint.setStrokeWidth(6);
pathPaint.setColor(Color.RED);
pathPaint.setPathEffect(new CornerPathEffect(10));
Path thePath = new Path();
RectF bounds = new RectF();
thePath.computeBounds(bounds, false);
Point point = SimMapa.this.getStart();
ArrayList<Point> route= SimMapa.this.getRoute();
int[] myScreenCoordinates = new int[2];
// We turn given point into screen Coordinates
calculator.getPointXY(point, myScreenCoordinates);
// -- BEGIN Graphical Debug Only for this purpose
RectF oval = new RectF(myScreenCoordinates[0] - 70, myScreenCoordinates[1] + 70,
myScreenCoordinates[0] + 70, myScreenCoordinates[1] - 70);
Paint paint = new Paint();
// We configure Paint of circle
paint.setStyle(Style.FILL);
paint.setARGB(80, 156, 192, 36);
paint.setStrokeWidth(4);
// We draw the circle
canvas.drawOval(oval, paint);
// -- END Graphical Debug
thePath.moveTo(myScreenCoordinates[0], myScreenCoordinates[1]);
for (Point currentPoint : route) {
// We turn the current point into ScreenCoordinates
calculator.getPointXY(currentPoint, myScreenCoordinates);
// -- BEGIN Graphical Debug Only for this purpose
RectF oval = new RectF(myScreenCoordinates[0] - 7, myScreenCoordinates[1] + 7,
myScreenCoordinates[0] + 7, myScreenCoordinates[1] - 7);
Paint paint = new Paint();
// We configure Paint of circle
paint.setStyle(Style.FILL);
paint.setARGB(80, 156, 192, 36);
paint.setStrokeWidth(4);
// We draw the circle
canvas.drawOval(oval, paint);
// -- END Graphical Debug
thePath.lineTo(myScreenCoordinates[0],myScreenCoordinates[1]);
}
canvas.drawPath(thePath,pathPaint);
}
}