Merge branch 'visualiserAndDataLink' into splitIntoTwoModules
# Conflicts: # visualiser/src/main/java/seng302/Controllers/RaceController.java # visualiser/src/main/java/seng302/Controllers/StartController.java # visualiser/src/main/java/seng302/Mock/BoatXMLReader.java # visualiser/src/main/java/seng302/Mock/StreamedBoat.java # visualiser/src/main/java/seng302/Mock/StreamedCourse.java # visualiser/src/main/java/seng302/Mock/StreamedRace.java # visualiser/src/main/java/seng302/Model/BoatInRace.java # visualiser/src/main/java/seng302/Model/ConstantVelocityRace.java # visualiser/src/main/java/seng302/Model/Race.java # visualiser/src/main/java/seng302/RaceXMLReader.java # visualiser/src/test/java/seng302/Model/ConstantVelocityRaceTest.java
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
package seng302.Controllers;
|
||||
|
||||
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.Mock.StreamedRace;
|
||||
import seng302.Model.BoatInRace;
|
||||
import seng302.Model.Race;
|
||||
import seng302.Model.RaceClock;
|
||||
import seng302.Model.ResizableRaceCanvas;
|
||||
import seng302.Model.*;
|
||||
import seng302.RaceDataSource;
|
||||
import seng302.RaceXMLReader;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
@@ -22,11 +28,16 @@ import java.util.ResourceBundle;
|
||||
public class RaceController extends Controller {
|
||||
@FXML
|
||||
GridPane canvasBase;
|
||||
|
||||
//user saved data for annotation display
|
||||
private ArrayList<Boolean> presetAnno;
|
||||
|
||||
ResizableRaceCanvas raceMap;
|
||||
@FXML
|
||||
SplitPane race;
|
||||
@FXML
|
||||
CheckBox showFPS;
|
||||
|
||||
@FXML
|
||||
CheckBox showBoatPath;
|
||||
@FXML
|
||||
@@ -37,6 +48,7 @@ public class RaceController extends Controller {
|
||||
Label FPS;
|
||||
@FXML
|
||||
Label timeZone;
|
||||
|
||||
@FXML
|
||||
CheckBox showName;
|
||||
@FXML
|
||||
@@ -47,18 +59,17 @@ public class RaceController extends Controller {
|
||||
Button saveAnno;
|
||||
@FXML
|
||||
Button showSetAnno;
|
||||
|
||||
@FXML
|
||||
TableView<BoatInRace> boatInfoTable;
|
||||
TableView<Boat> boatInfoTable;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> boatPlacingColumn;
|
||||
TableColumn<Boat, String> boatPlacingColumn;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> boatTeamColumn;
|
||||
TableColumn<Boat, String> boatTeamColumn;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> boatMarkColumn;
|
||||
TableColumn<Boat, String> boatMarkColumn;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> boatSpeedColumn;
|
||||
//user saved data for annotation display
|
||||
private ArrayList<Boolean> presetAnno;
|
||||
TableColumn<Boat, String> boatSpeedColumn;
|
||||
|
||||
/**
|
||||
* Updates the ResizableRaceCanvas (raceMap) with most recent data
|
||||
@@ -66,7 +77,7 @@ public class RaceController extends Controller {
|
||||
* @param boats boats that are to be displayed in the race
|
||||
* @see ResizableRaceCanvas
|
||||
*/
|
||||
public void updateMap(ObservableList<BoatInRace> boats) {
|
||||
public void updateMap(ObservableList<Boat> boats) {
|
||||
raceMap.setBoats(boats);
|
||||
raceMap.update();
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@ import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.Mock.*;
|
||||
import seng302.Model.BoatInRace;
|
||||
import seng302.Model.Boat;
|
||||
import seng302.Model.RaceClock;
|
||||
import seng302.RaceDataSource;
|
||||
import seng302.RaceXMLReader;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
@@ -30,28 +31,20 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
public class StartController extends Controller {
|
||||
|
||||
@FXML
|
||||
Button oneMinButton;
|
||||
@FXML
|
||||
Button fiveMinButton;
|
||||
@FXML
|
||||
Button fifteenMinButton;
|
||||
@FXML
|
||||
private GridPane start;
|
||||
@FXML
|
||||
private AnchorPane startWrapper;
|
||||
@FXML
|
||||
private TableView<BoatInRace> boatNameTable;
|
||||
@FXML
|
||||
private TableColumn<BoatInRace, String> boatNameColumn;
|
||||
@FXML
|
||||
private TableColumn<BoatInRace, String> boatCodeColumn;
|
||||
@FXML
|
||||
private Label timeZoneTime;
|
||||
@FXML
|
||||
private Label timer;
|
||||
@FXML
|
||||
private int PRERACE_TIME = 15000;
|
||||
@FXML private GridPane start;
|
||||
@FXML private AnchorPane startWrapper;
|
||||
|
||||
@FXML private TableView<Boat> boatNameTable;
|
||||
@FXML private TableColumn<Boat, String> boatNameColumn;
|
||||
@FXML private TableColumn<Boat, String> boatCodeColumn;
|
||||
@FXML private Label timeZoneTime;
|
||||
@FXML private Label timer;
|
||||
@FXML private int PRERACE_TIME = 15000;
|
||||
|
||||
@FXML Button oneMinButton;
|
||||
@FXML Button fiveMinButton;
|
||||
@FXML Button fifteenMinButton;
|
||||
|
||||
private RaceClock raceClock;
|
||||
|
||||
private RaceDataSource raceData;
|
||||
@@ -78,7 +71,7 @@ public class StartController extends Controller {
|
||||
startRace(1);
|
||||
}
|
||||
|
||||
private void startRace(int raceScale) {
|
||||
private void startRace(int raceScale){
|
||||
|
||||
oneMinButton.setDisable(true);
|
||||
fiveMinButton.setDisable(true);
|
||||
@@ -87,7 +80,7 @@ public class StartController extends Controller {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
public void initialize(URL location, ResourceBundle resources){
|
||||
raceData = null;
|
||||
try {
|
||||
StreamedCourse streamedCourse = new StreamedCourse(new BoatXMLReader("mockXML/boatXML/boatTest.xml"));
|
||||
@@ -109,13 +102,13 @@ public class StartController extends Controller {
|
||||
setRaceClock();
|
||||
}
|
||||
|
||||
public AnchorPane startWrapper() {
|
||||
public AnchorPane startWrapper(){
|
||||
return startWrapper;
|
||||
}
|
||||
|
||||
private void initialiseTables() {
|
||||
List<BoatInRace> boats = raceData.getBoats();
|
||||
ObservableList<BoatInRace> observableBoats = FXCollections.observableArrayList(boats);
|
||||
List<Boat> boats = raceData.getBoats();
|
||||
ObservableList<Boat> observableBoats = FXCollections.observableArrayList(boats);
|
||||
|
||||
boatNameTable.setItems(observableBoats);
|
||||
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().getName());
|
||||
@@ -140,7 +133,7 @@ public class StartController extends Controller {
|
||||
protected void countdownTimer(int scaleFactor) {
|
||||
new AnimationTimer() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long startTime = currentTime + (PRERACE_TIME / scaleFactor);
|
||||
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
||||
long minutes;
|
||||
long currentTimeInSeconds;
|
||||
long remainingSeconds;
|
||||
@@ -156,7 +149,7 @@ public class StartController extends Controller {
|
||||
startWrapper.setVisible(false);
|
||||
|
||||
} else {
|
||||
currentTimeInSeconds = (timeLeft * scaleFactor) / 1000;
|
||||
currentTimeInSeconds = (timeLeft*scaleFactor) / 1000;
|
||||
minutes = currentTimeInSeconds / 60;
|
||||
remainingSeconds = currentTimeInSeconds % 60;
|
||||
hours = minutes / 60;
|
||||
|
||||
Reference in New Issue
Block a user