Merge remote-tracking branch 'origin/story9' into story9
# Conflicts: # src/main/java/seng302/Model/ResizableRaceCanvas.java
This commit is contained in:
@@ -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 )
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ public class RaceController extends Controller{
|
||||
TableColumn<BoatInRace, String> boatTeamColumn;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> boatMarkColumn;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> 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<TableColumn.CellDataFeatures<BoatInRace, String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -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("");
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
||||
<TableColumn fx:id="boatTeamColumn" prefWidth="50.0" text="Team" />
|
||||
<TableColumn fx:id="boatMarkColumn" prefWidth="50.0" text="Mark" />
|
||||
<TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
|
||||
Reference in New Issue
Block a user