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 GPSCoordinate finishLineMarker2 = new GPSCoordinate(32.317257, -64.836260);
|
||||||
|
|
||||||
public static final BoatInRace[] OFFICIAL_AC35_COMPETITORS = new BoatInRace[]
|
public static final BoatInRace[] OFFICIAL_AC35_COMPETITORS = new BoatInRace[]
|
||||||
{new BoatInRace("Oracle Team USA", 200.0, Color.BLUEVIOLET),
|
{new BoatInRace("Oracle Team USA", 200.0, Color.BLUEVIOLET, "USA"),
|
||||||
new BoatInRace("Land Rover BAR", 180.0, Color.BLACK),
|
new BoatInRace("Land Rover BAR", 180.0, Color.BLACK, "BAR"),
|
||||||
new BoatInRace("SoftBank Team Japan", 190.0, Color.RED),
|
new BoatInRace("SoftBank Team Japan", 190.0, Color.RED, "JAP"),
|
||||||
new BoatInRace("Groupama Team France", 210.0, Color.ORANGE),
|
new BoatInRace("Groupama Team France", 210.0, Color.ORANGE, "FRN"),
|
||||||
new BoatInRace("Artemis Racing", 220.0, Color.DARKOLIVEGREEN),
|
new BoatInRace("Artemis Racing", 220.0, Color.DARKOLIVEGREEN, "ART"),
|
||||||
new BoatInRace("Emirates Team New Zealand", 310, Color.LIMEGREEN)};
|
new BoatInRace("Emirates Team New Zealand", 310, Color.LIMEGREEN, "ENZ")};
|
||||||
|
|
||||||
//public static final Leg bermudaCourseStartToMark1 = new Leg(0, , new )
|
//public static final Leg bermudaCourseStartToMark1 = new Leg(0, , new )
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ public class RaceController extends Controller{
|
|||||||
TableColumn<BoatInRace, String> boatTeamColumn;
|
TableColumn<BoatInRace, String> boatTeamColumn;
|
||||||
@FXML
|
@FXML
|
||||||
TableColumn<BoatInRace, String> boatMarkColumn;
|
TableColumn<BoatInRace, String> boatMarkColumn;
|
||||||
|
@FXML
|
||||||
|
TableColumn<BoatInRace, String> boatSpeedColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates the ResizableRaceCanvas (raceMap) with most recent data
|
* updates the ResizableRaceCanvas (raceMap) with most recent data
|
||||||
@@ -68,6 +70,7 @@ public class RaceController extends Controller{
|
|||||||
boatInfoTable.setItems(race.getStartingBoats());
|
boatInfoTable.setItems(race.getStartingBoats());
|
||||||
|
|
||||||
boatTeamColumn.setCellValueFactory(cellData -> cellData.getValue().getName());
|
boatTeamColumn.setCellValueFactory(cellData -> cellData.getValue().getName());
|
||||||
|
boatSpeedColumn.setCellValueFactory(cellData -> cellData.getValue().getVelocityProp());
|
||||||
boatMarkColumn.setCellValueFactory(cellData -> cellData.getValue().getCurrentLegName());
|
boatMarkColumn.setCellValueFactory(cellData -> cellData.getValue().getCurrentLegName());
|
||||||
boatPlacingColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<BoatInRace, String>, ObservableValue<String>>() {
|
boatPlacingColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<BoatInRace, String>, ObservableValue<String>>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package seng302.Model;
|
package seng302.Model;
|
||||||
|
|
||||||
|
import javafx.beans.property.DoubleProperty;
|
||||||
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
|
|
||||||
@@ -11,14 +13,18 @@ import java.util.ArrayList;
|
|||||||
public class Boat {
|
public class Boat {
|
||||||
private StringProperty name;
|
private StringProperty name;
|
||||||
private double velocity;
|
private double velocity;
|
||||||
|
private StringProperty velocityProp;
|
||||||
|
private String abbrev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boat initialiser which keeps all of the information of the boat.
|
* Boat initialiser which keeps all of the information of the boat.
|
||||||
* @param name Name of the Boat.
|
* @param name Name of the Boat.
|
||||||
* @param velocity Speed in m/s that the boat travels at.
|
* @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.velocity = velocity;
|
||||||
|
this.velocityProp = new SimpleStringProperty(String.valueOf(velocity));
|
||||||
|
this.abbrev = abbrev;
|
||||||
this.name = new SimpleStringProperty(name);
|
this.name = new SimpleStringProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,4 +56,10 @@ public class Boat {
|
|||||||
return getName().getValue();
|
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 velocity Speed that the boat travels.
|
||||||
* @param colour Colour the boat will be displayed as on the map
|
* @param colour Colour the boat will be displayed as on the map
|
||||||
*/
|
*/
|
||||||
public BoatInRace(String name, double velocity, Color colour) {
|
public BoatInRace(String name, double velocity, Color colour, String abbrev) {
|
||||||
super(name, velocity);
|
super(name, velocity, abbrev);
|
||||||
setColour(colour);
|
setColour(colour);
|
||||||
currentLegName = new SimpleStringProperty("");
|
currentLegName = new SimpleStringProperty("");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,11 +126,12 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Display given name and speed of boat at a graph coordinate
|
* 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
|
* @param coordinate coordinate the text appears
|
||||||
*/
|
*/
|
||||||
public void displayText(String name, double speed, GraphCoordinate coordinate){
|
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());
|
gc.fillText(text, coordinate.getX()+20, coordinate.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
if (boat != null) {
|
if (boat != null) {
|
||||||
// System.out.print("Drawing Boat At: " + boat.getCurrentPosition());
|
// System.out.print("Drawing Boat At: " + boat.getCurrentPosition());
|
||||||
displayMark(this.map.convertGPS(boat.getCurrentPosition()), boat.getColour());
|
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="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
||||||
<TableColumn fx:id="boatTeamColumn" prefWidth="50.0" text="Team" />
|
<TableColumn fx:id="boatTeamColumn" prefWidth="50.0" text="Team" />
|
||||||
<TableColumn fx:id="boatMarkColumn" prefWidth="50.0" text="Mark" />
|
<TableColumn fx:id="boatMarkColumn" prefWidth="50.0" text="Mark" />
|
||||||
|
<TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" />
|
||||||
</columns>
|
</columns>
|
||||||
</TableView>
|
</TableView>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
Reference in New Issue
Block a user