|
|
|
|
@ -317,39 +317,35 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
|
*/
|
|
|
|
|
private void drawBoat(VisualiserBoat boat) {
|
|
|
|
|
|
|
|
|
|
//The position may be null if we haven't received any BoatLocation messages yet.
|
|
|
|
|
if (boat.getCurrentPosition() != null) {
|
|
|
|
|
|
|
|
|
|
if (boat.isClientBoat()) {
|
|
|
|
|
drawClientBoat(boat);
|
|
|
|
|
}
|
|
|
|
|
if (boat.isClientBoat()) {
|
|
|
|
|
drawClientBoat(boat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Convert position to graph coordinate.
|
|
|
|
|
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());
|
|
|
|
|
//Convert position to graph coordinate.
|
|
|
|
|
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());
|
|
|
|
|
|
|
|
|
|
//The x coordinates of each vertex of the boat.
|
|
|
|
|
double[] x = {
|
|
|
|
|
pos.getX() - 6,
|
|
|
|
|
pos.getX(),
|
|
|
|
|
pos.getX() + 6 };
|
|
|
|
|
//The x coordinates of each vertex of the boat.
|
|
|
|
|
double[] x = {
|
|
|
|
|
pos.getX() - 6,
|
|
|
|
|
pos.getX(),
|
|
|
|
|
pos.getX() + 6 };
|
|
|
|
|
|
|
|
|
|
//The y coordinates of each vertex of the boat.
|
|
|
|
|
double[] y = {
|
|
|
|
|
pos.getY() + 12,
|
|
|
|
|
pos.getY() - 12,
|
|
|
|
|
pos.getY() + 12 };
|
|
|
|
|
//The y coordinates of each vertex of the boat.
|
|
|
|
|
double[] y = {
|
|
|
|
|
pos.getY() + 12,
|
|
|
|
|
pos.getY() - 12,
|
|
|
|
|
pos.getY() + 12 };
|
|
|
|
|
|
|
|
|
|
//The above shape is essentially a triangle 12px wide, and 24px long.
|
|
|
|
|
//The above shape is essentially a triangle 12px wide, and 24px long.
|
|
|
|
|
|
|
|
|
|
//Draw the boat.
|
|
|
|
|
gc.setFill(boat.getColor());
|
|
|
|
|
//Draw the boat.
|
|
|
|
|
gc.setFill(boat.getColor());
|
|
|
|
|
|
|
|
|
|
gc.save();
|
|
|
|
|
rotate(boat.getBearing().degrees(), pos.getX(), pos.getY());
|
|
|
|
|
gc.fillPolygon(x, y, 3);
|
|
|
|
|
gc.restore();
|
|
|
|
|
gc.save();
|
|
|
|
|
rotate(boat.getBearing().degrees(), pos.getX(), pos.getY());
|
|
|
|
|
gc.fillPolygon(x, y, 3);
|
|
|
|
|
gc.restore();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -521,7 +517,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
|
* draws a transparent line around the course that shows the paths boats must travel
|
|
|
|
|
*/
|
|
|
|
|
public void drawRaceLine(){
|
|
|
|
|
List<Leg> legs = this.visualiserRace.getLegs();
|
|
|
|
|
List<Leg> legs = this.visualiserRace.getVisualiserRaceState().getLegs();
|
|
|
|
|
GPSCoordinate legStartPoint = legs.get(0).getStartCompoundMark().getAverageGPSCoordinate();
|
|
|
|
|
GPSCoordinate nextStartPoint;
|
|
|
|
|
for (int i = 0; i < legs.size() -1; i++) {
|
|
|
|
|
|