Increased minimum opacity so actual track from start is visible.
- No longer removes points from track #story[25]
This commit is contained in:
@@ -28,7 +28,7 @@ public class BoatInRace extends Boat {
|
|||||||
private boolean started = false;
|
private boolean started = false;
|
||||||
private StringProperty position;
|
private StringProperty position;
|
||||||
|
|
||||||
private Queue<TrackPoint> track = new ConcurrentLinkedQueue<TrackPoint>();
|
private Queue<TrackPoint> track = new ConcurrentLinkedQueue<>();
|
||||||
private long nextValidTime = 0;
|
private long nextValidTime = 0;
|
||||||
private final int TRACK_POINT_TIME_INTERVAL = 1000; // every 1 seconds
|
private final int TRACK_POINT_TIME_INTERVAL = 1000; // every 1 seconds
|
||||||
private final int TRACK_POINT_LIMIT = 10;
|
private final int TRACK_POINT_LIMIT = 10;
|
||||||
@@ -263,9 +263,6 @@ public class BoatInRace extends Boat {
|
|||||||
if (added && this.started) {
|
if (added && this.started) {
|
||||||
nextValidTime = System.currentTimeMillis() + TRACK_POINT_TIME_INTERVAL;
|
nextValidTime = System.currentTimeMillis() + TRACK_POINT_TIME_INTERVAL;
|
||||||
track.add(new TrackPoint(coordinate, System.currentTimeMillis(), TRACK_POINT_LIMIT*TRACK_POINT_TIME_INTERVAL));
|
track.add(new TrackPoint(coordinate, System.currentTimeMillis(), TRACK_POINT_LIMIT*TRACK_POINT_TIME_INTERVAL));
|
||||||
if (track.size() > TRACK_POINT_LIMIT) {
|
|
||||||
track.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ public class TrackPoint {
|
|||||||
private GPSCoordinate coordinate;
|
private GPSCoordinate coordinate;
|
||||||
private long timeAdded;
|
private long timeAdded;
|
||||||
private long expiry;
|
private long expiry;
|
||||||
|
private double minAlpha;
|
||||||
|
|
||||||
public TrackPoint(GPSCoordinate coordinate, long timeAdded, long expiry) {
|
public TrackPoint(GPSCoordinate coordinate, long timeAdded, long expiry) {
|
||||||
this.coordinate = coordinate;
|
this.coordinate = coordinate;
|
||||||
this.timeAdded = timeAdded;
|
this.timeAdded = timeAdded;
|
||||||
this.expiry = expiry;
|
this.expiry = expiry;
|
||||||
|
this.minAlpha = 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPSCoordinate getCoordinate() {
|
public GPSCoordinate getCoordinate() {
|
||||||
@@ -21,6 +23,6 @@ public class TrackPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getAlpha() {
|
public double getAlpha() {
|
||||||
return Double.max(0,1.0 - (double)(System.currentTimeMillis() - timeAdded)/expiry);
|
return Double.max(minAlpha,1.0 - (double)(System.currentTimeMillis() - timeAdded)/expiry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user