The trackpoint line is now a line (poly-line) instead of a sequence of circles. A point along the poly-line is added every 250ms.
issue #18
This commit is contained in:
@@ -2,6 +2,7 @@ package visualiser.model;
|
|||||||
|
|
||||||
|
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.paint.LinearGradient;
|
||||||
import javafx.scene.paint.Paint;
|
import javafx.scene.paint.Paint;
|
||||||
import javafx.scene.transform.Rotate;
|
import javafx.scene.transform.Rotate;
|
||||||
import network.Messages.Enums.BoatStatusEnum;
|
import network.Messages.Enums.BoatStatusEnum;
|
||||||
@@ -11,6 +12,7 @@ import shared.model.Mark;
|
|||||||
import shared.model.RaceClock;
|
import shared.model.RaceClock;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,6 +173,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|||||||
graphCoordinateB.getX(),
|
graphCoordinateB.getX(),
|
||||||
graphCoordinateB.getY() );
|
graphCoordinateB.getY() );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -523,15 +526,27 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|||||||
//Apply the boat color.
|
//Apply the boat color.
|
||||||
gc.setFill(boat.getColor());
|
gc.setFill(boat.getColor());
|
||||||
|
|
||||||
|
double[] xPoints = new double[boat.getTrack().size()];
|
||||||
|
double[] yPoints = new double[boat.getTrack().size()];
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
//Draw each TrackPoint.
|
//Draw each TrackPoint.
|
||||||
for (TrackPoint point : new ArrayList<>(boat.getTrack())) {
|
for (TrackPoint point : new ArrayList<>(boat.getTrack())) {
|
||||||
|
|
||||||
//Convert the GPSCoordinate to a screen coordinate.
|
//Convert the GPSCoordinate to a screen coordinate.
|
||||||
GraphCoordinate scaledCoordinate = this.map.convertGPS(point.getCoordinate());
|
GraphCoordinate scaledCoordinate = this.map.convertGPS(point.getCoordinate());
|
||||||
|
|
||||||
//Draw a circle for the trackpoint.
|
xPoints[index] = ((double)scaledCoordinate.getX());
|
||||||
gc.fillOval(scaledCoordinate.getX(), scaledCoordinate.getY(), point.getDiameter(), point.getDiameter());
|
yPoints[index] = ((double)scaledCoordinate.getY());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gc.strokePolyline(xPoints, yPoints, xPoints.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ public class TrackPoint {
|
|||||||
*/
|
*/
|
||||||
private final double minAlpha;
|
private final double minAlpha;
|
||||||
|
|
||||||
/**
|
|
||||||
* The diameter to draw the track point with.
|
|
||||||
*/
|
|
||||||
private final double diameter;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new track point with fixed GPS coordinates and time, to reach minimum opacity on expiry.
|
* Creates a new track point with fixed GPS coordinates and time, to reach minimum opacity on expiry.
|
||||||
@@ -53,7 +48,6 @@ public class TrackPoint {
|
|||||||
this.expiry = expiry;
|
this.expiry = expiry;
|
||||||
|
|
||||||
this.minAlpha = 0.1;
|
this.minAlpha = 0.1;
|
||||||
this.diameter = 5d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -97,12 +91,4 @@ public class TrackPoint {
|
|||||||
return timeAdded;
|
return timeAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the diameter to draw the track point with.
|
|
||||||
* @return The diameter to draw the track point with.
|
|
||||||
*/
|
|
||||||
public double getDiameter() {
|
|
||||||
return diameter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package visualiser.model;
|
package visualiser.model;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
|
||||||
import javafx.beans.property.StringProperty;
|
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import network.Messages.Enums.BoatStatusEnum;
|
import network.Messages.Enums.BoatStatusEnum;
|
||||||
import shared.model.Azimuth;
|
import shared.model.Azimuth;
|
||||||
@@ -38,7 +36,7 @@ public class VisualiserBoat extends Boat {
|
|||||||
/**
|
/**
|
||||||
* The minimum period of time, in milliseconds, between the creation of each track point.
|
* The minimum period of time, in milliseconds, between the creation of each track point.
|
||||||
*/
|
*/
|
||||||
private static final long trackPointTimeInterval = 5000;
|
private static final long trackPointTimeInterval = 250;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of track points that should be created before fully diminishing the alpha of a given track point.
|
* The number of track points that should be created before fully diminishing the alpha of a given track point.
|
||||||
@@ -55,7 +53,7 @@ public class VisualiserBoat extends Boat {
|
|||||||
/**
|
/**
|
||||||
* Scalar used to scale the boat's wake.
|
* Scalar used to scale the boat's wake.
|
||||||
*/
|
*/
|
||||||
private static final double wakeScale = 5;
|
private static final double wakeScale = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true then this boat has been allocated to the client.
|
* If true then this boat has been allocated to the client.
|
||||||
|
|||||||
Reference in New Issue
Block a user