Trackpoint line color fades out.

This commit is contained in:
fjc40
2017-08-17 12:56:11 +12:00
parent fa26abe10c
commit 62f400b924
2 changed files with 33 additions and 24 deletions
@@ -428,7 +428,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
double endPointDiameter = 12;
//Line.
drawLine(wakeFrom, wakeTo, boat.getColor(), lineWidth);
drawLine(wakeFrom, wakeTo, Color.DARKBLUE, lineWidth);
//Draw end-point.
drawCircle(wakeTo, endPointDiameter, Color.BLACK);
@@ -712,35 +712,44 @@ public class ResizableRaceCanvas extends ResizableCanvas {
//Check that track points are enabled.
if (this.annoPath) {
gc.save();
gc.setLineWidth(3);
//Apply the boat color.
gc.setFill(boat.getColor());
gc.setStroke(boat.getColor());
List<TrackPoint> trackPoints = new ArrayList<>(boat.getTrack());
double[] xPoints = new double[trackPoints.size()];
double[] yPoints = new double[trackPoints.size()];
int index = 0;
if (trackPoints.size() > 2 ) {
//Copy trackpoint locations to x/y arrays.
for (TrackPoint point : trackPoints) {
gc.save();
//Convert the GPSCoordinate to a screen coordinate.
GraphCoordinate scaledCoordinate = this.map.convertGPS(point.getCoordinate());
gc.setLineWidth(3);
xPoints[index] = ((double)scaledCoordinate.getX());
yPoints[index] = ((double)scaledCoordinate.getY());
index++;
//Draw a line between each adjacent pair of track points.
for (int i = 0; i < trackPoints.size() - 1; i++) {
//Convert the GPSCoordinate to a screen coordinate.
GraphCoordinate scaledCoordinate1 = this.map.convertGPS(trackPoints.get(i).getCoordinate());
GraphCoordinate scaledCoordinate2 = this.map.convertGPS(trackPoints.get(i + 1).getCoordinate());
double alpha = trackPoints.get(i).getAlpha();
Paint fadedPaint = new Color(
boat.getColor().getRed(),
boat.getColor().getGreen(),
boat.getColor().getBlue(),
alpha );
//Apply the faded boat color.
gc.setFill(fadedPaint);
gc.setStroke(fadedPaint);
gc.strokeLine(
scaledCoordinate1.getX(),
scaledCoordinate1.getY(),
scaledCoordinate2.getX(),
scaledCoordinate2.getY() );
}
gc.restore();
}
gc.strokePolyline(xPoints, yPoints, xPoints.length);
gc.restore();
}
}
@@ -41,7 +41,7 @@ public class VisualiserBoat extends Boat {
/**
* The number of track points that should be created before fully diminishing the alpha of a given track point.
*/
private static final int trackPointLimit = 10;
private static final int trackPointLimit = 50;
/**