diff --git a/src/main/java/seng302/Constants.java b/src/main/java/seng302/Constants.java index 0db52afb..e7569a13 100644 --- a/src/main/java/seng302/Constants.java +++ b/src/main/java/seng302/Constants.java @@ -25,12 +25,12 @@ public class Constants { public static final GPSCoordinate finishLineMarker2 = new GPSCoordinate(32.317257, -64.836260); public static final BoatInRace[] OFFICIAL_AC35_COMPETITORS = new BoatInRace[] - {new BoatInRace("Oracle Team USA", 200.0, Color.BLUEVIOLET), - new BoatInRace("Land Rover BAR", 180.0, Color.BLACK), - new BoatInRace("SoftBank Team Japan", 190.0, Color.RED), - new BoatInRace("Groupama Team France", 210.0, Color.ORANGE), - new BoatInRace("Artemis Racing", 220.0, Color.DARKOLIVEGREEN), - new BoatInRace("Emirates Team New Zealand", 310, Color.LIMEGREEN)}; + {new BoatInRace("Oracle Team USA", 200.0, Color.BLUEVIOLET, "USA"), + new BoatInRace("Land Rover BAR", 180.0, Color.BLACK, "BAR"), + new BoatInRace("SoftBank Team Japan", 190.0, Color.RED, "JAP"), + new BoatInRace("Groupama Team France", 210.0, Color.ORANGE, "FRN"), + new BoatInRace("Artemis Racing", 220.0, Color.DARKOLIVEGREEN, "ART"), + new BoatInRace("Emirates Team New Zealand", 310, Color.LIMEGREEN, "ENZ")}; //public static final Leg bermudaCourseStartToMark1 = new Leg(0, , new ) } diff --git a/src/main/java/seng302/Controllers/RaceController.java b/src/main/java/seng302/Controllers/RaceController.java index 57f96474..317d69da 100644 --- a/src/main/java/seng302/Controllers/RaceController.java +++ b/src/main/java/seng302/Controllers/RaceController.java @@ -46,6 +46,8 @@ public class RaceController extends Controller{ TableColumn boatTeamColumn; @FXML TableColumn boatMarkColumn; + @FXML + TableColumn boatSpeedColumn; /** * updates the ResizableRaceCanvas (raceMap) with most recent data @@ -68,6 +70,7 @@ public class RaceController extends Controller{ boatInfoTable.setItems(race.getStartingBoats()); boatTeamColumn.setCellValueFactory(cellData -> cellData.getValue().getName()); + boatSpeedColumn.setCellValueFactory(cellData -> cellData.getValue().getVelocityProp()); boatMarkColumn.setCellValueFactory(cellData -> cellData.getValue().getCurrentLegName()); boatPlacingColumn.setCellValueFactory(new Callback, ObservableValue>() { @Override diff --git a/src/main/java/seng302/Model/Boat.java b/src/main/java/seng302/Model/Boat.java index 10c6d863..4cd2503b 100644 --- a/src/main/java/seng302/Model/Boat.java +++ b/src/main/java/seng302/Model/Boat.java @@ -1,5 +1,7 @@ package seng302.Model; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -11,14 +13,18 @@ import java.util.ArrayList; public class Boat { private StringProperty name; private double velocity; + private StringProperty velocityProp; + private String abbrev; /** * Boat initialiser which keeps all of the information of the boat. * @param name Name of the Boat. * @param velocity Speed in m/s that the boat travels at. */ - public Boat(String name, double velocity){ + public Boat(String name, double velocity, String abbrev){ this.velocity = velocity; + this.velocityProp = new SimpleStringProperty(String.valueOf(velocity)); + this.abbrev = abbrev; this.name = new SimpleStringProperty(name); } @@ -50,4 +56,10 @@ public class Boat { return getName().getValue(); } + public StringProperty getVelocityProp() { + return velocityProp; + } + + public String getAbbrev() { return abbrev; } + } diff --git a/src/main/java/seng302/Model/BoatInRace.java b/src/main/java/seng302/Model/BoatInRace.java index ab2ad312..560feb21 100644 --- a/src/main/java/seng302/Model/BoatInRace.java +++ b/src/main/java/seng302/Model/BoatInRace.java @@ -28,8 +28,8 @@ public class BoatInRace extends Boat { * @param velocity Speed that the boat travels. * @param colour Colour the boat will be displayed as on the map */ - public BoatInRace(String name, double velocity, Color colour) { - super(name, velocity); + public BoatInRace(String name, double velocity, Color colour, String abbrev) { + super(name, velocity, abbrev); setColour(colour); currentLegName = new SimpleStringProperty(""); } diff --git a/src/main/java/seng302/Model/ResizableRaceCanvas.java b/src/main/java/seng302/Model/ResizableRaceCanvas.java index d85c3a4e..bcb44e1e 100644 --- a/src/main/java/seng302/Model/ResizableRaceCanvas.java +++ b/src/main/java/seng302/Model/ResizableRaceCanvas.java @@ -126,11 +126,12 @@ public class ResizableRaceCanvas extends Canvas { /** * Display given name and speed of boat at a graph coordinate - * @param name name of boat + * @param name name of the boat + * @param speed speed of the boat * @param coordinate coordinate the text appears */ public void displayText(String name, double speed, GraphCoordinate coordinate){ - String text = name + ", " + speed + " knots"; + String text = name + ", " + speed + " knots"; gc.fillText(text, coordinate.getX()+20, coordinate.getY()); } @@ -176,7 +177,7 @@ public class ResizableRaceCanvas extends Canvas { if (boat != null) { // System.out.print("Drawing Boat At: " + boat.getCurrentPosition()); displayMark(this.map.convertGPS(boat.getCurrentPosition()), boat.getColour()); - displayText(boat.getName().getValue(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition())); + displayText(boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition())); } } } diff --git a/src/main/resources/scenes/racepane.fxml b/src/main/resources/scenes/racepane.fxml index d699ff46..ed538a38 100644 --- a/src/main/resources/scenes/racepane.fxml +++ b/src/main/resources/scenes/racepane.fxml @@ -20,6 +20,7 @@ +