Trackpoint line color fades out.
This commit is contained in:
@@ -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) {
|
||||
|
||||
List<TrackPoint> trackPoints = new ArrayList<>(boat.getTrack());
|
||||
|
||||
if (trackPoints.size() > 2 ) {
|
||||
|
||||
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;
|
||||
|
||||
//Copy trackpoint locations to x/y arrays.
|
||||
for (TrackPoint point : trackPoints) {
|
||||
//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 scaledCoordinate = this.map.convertGPS(point.getCoordinate());
|
||||
GraphCoordinate scaledCoordinate1 = this.map.convertGPS(trackPoints.get(i).getCoordinate());
|
||||
GraphCoordinate scaledCoordinate2 = this.map.convertGPS(trackPoints.get(i + 1).getCoordinate());
|
||||
|
||||
xPoints[index] = ((double)scaledCoordinate.getX());
|
||||
yPoints[index] = ((double)scaledCoordinate.getY());
|
||||
double alpha = trackPoints.get(i).getAlpha();
|
||||
Paint fadedPaint = new Color(
|
||||
boat.getColor().getRed(),
|
||||
boat.getColor().getGreen(),
|
||||
boat.getColor().getBlue(),
|
||||
alpha );
|
||||
|
||||
index++;
|
||||
//Apply the faded boat color.
|
||||
gc.setFill(fadedPaint);
|
||||
gc.setStroke(fadedPaint);
|
||||
|
||||
gc.strokeLine(
|
||||
scaledCoordinate1.getX(),
|
||||
scaledCoordinate1.getY(),
|
||||
scaledCoordinate2.getX(),
|
||||
scaledCoordinate2.getY() );
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user