|
|
@@ -74,8 +74,10 @@ public class Renderer { |
|
|
|
synchronized (holder) { |
|
|
|
int y = 0; |
|
|
|
int left = 0; |
|
|
|
int compensate = 0; |
|
|
|
float vCompensate = 0; |
|
|
|
int hCompensateStart = 0; |
|
|
|
int hCompensateEnd = 0; |
|
|
|
int vCompensateStart = 0; |
|
|
|
int vCompensateEnd = 0; |
|
|
|
canvas.drawColor(Color.BLACK); |
|
|
|
for (int curStepIdx = this.track.getVtrList().size()-1;curStepIdx >= 0; |
|
|
|
curStepIdx--) { |
|
|
@@ -85,17 +87,18 @@ public class Renderer { |
|
|
|
} catch (InterruptedException ex) { |
|
|
|
return; |
|
|
|
} |
|
|
|
vCompensate = Math.round(y * this.tooShortPerHeight); |
|
|
|
vCompensateStart = Math.round(y * this.tooShortPerHeight); |
|
|
|
vCompensateEnd = Math.round((y+this.pixelPerLine) * this.tooShortPerHeight); |
|
|
|
stepRecords = this.track.getVtrList().get(curStepIdx); |
|
|
|
int i = 0; |
|
|
|
for (VehicleTimeRecord r : stepRecords) { |
|
|
|
left = (int) (this.pixelPerVehicle * r.getPosition()); |
|
|
|
compensate = Math.round(r.getPosition() * this.tooShortPerTrackLength); |
|
|
|
|
|
|
|
hCompensateStart = Math.round(r.getPosition() * this.tooShortPerTrackLength); |
|
|
|
hCompensateEnd = Math.round((r.getPosition() + this.pixelPerVehicle) * this.tooShortPerTrackLength); |
|
|
|
this.paint.setColor(getColor(r.getVelocity(), r.getMaxVelocity())); |
|
|
|
canvas.drawRect(left + compensate, y+vCompensate, |
|
|
|
left + this.pixelPerVehicle + compensate, |
|
|
|
y + pixelPerLine + vCompensate, this.paint); |
|
|
|
canvas.drawRect(left + hCompensateStart, y+vCompensateStart, |
|
|
|
left + this.pixelPerVehicle + hCompensateEnd, |
|
|
|
y + pixelPerLine + vCompensateEnd, this.paint); |
|
|
|
i++; |
|
|
|
} |
|
|
|
track.getListSemaphore().release(); |
|
|
|