Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules
This commit is contained in:
@@ -10,6 +10,7 @@ import seng302.Model.Boat;
|
|||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
@@ -56,6 +57,8 @@ public class BoatData {
|
|||||||
// write the content into xml file
|
// write the content into xml file
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
Transformer transformer = transformerFactory.newTransformer();
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||||
|
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||||
DOMSource source = new DOMSource(doc);
|
DOMSource source = new DOMSource(doc);
|
||||||
|
|
||||||
//Serialize document.
|
//Serialize document.
|
||||||
@@ -63,6 +66,8 @@ public class BoatData {
|
|||||||
StreamResult result = new StreamResult(stringWriter);
|
StreamResult result = new StreamResult(stringWriter);
|
||||||
transformer.transform(source, result);
|
transformer.transform(source, result);
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(stringWriter.toString());
|
||||||
return stringWriter.toString();
|
return stringWriter.toString();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import seng302.Model.Marker;
|
|||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
@@ -20,7 +21,6 @@ import java.io.StringWriter;
|
|||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by esa46 on 21/04/17.
|
* Created by esa46 on 21/04/17.
|
||||||
*/
|
*/
|
||||||
@@ -59,6 +59,8 @@ public class RaceData {
|
|||||||
// write the content into xml file
|
// write the content into xml file
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
Transformer transformer = transformerFactory.newTransformer();
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||||
|
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||||
DOMSource source = new DOMSource(doc);
|
DOMSource source = new DOMSource(doc);
|
||||||
|
|
||||||
//Serialize document.
|
//Serialize document.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import seng302.Exceptions.InvalidRegattaDataException;
|
|||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
@@ -51,6 +52,8 @@ public class RegattaData {
|
|||||||
// write the content into xml file
|
// write the content into xml file
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
Transformer transformer = transformerFactory.newTransformer();
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||||
|
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||||
DOMSource source = new DOMSource(doc);
|
DOMSource source = new DOMSource(doc);
|
||||||
|
|
||||||
//Serialize document.
|
//Serialize document.
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public class Race implements Runnable {
|
|||||||
boatOffset = (boatOffset + 1) % (startingBoats.size());
|
boatOffset = (boatOffset + 1) % (startingBoats.size());
|
||||||
|
|
||||||
if (timeLeft <= 60000/scaleFactor && timeLeft > 0) {
|
if (timeLeft <= 60000/scaleFactor && timeLeft > 0) {
|
||||||
|
System.out.println("Race status 2");
|
||||||
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 2, 2, boatStatusMessages);
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 2, 2, boatStatusMessages);
|
||||||
mockOutput.parseRaceStatus(raceStatus);
|
mockOutput.parseRaceStatus(raceStatus);
|
||||||
}
|
}
|
||||||
@@ -142,6 +143,7 @@ public class Race implements Runnable {
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
System.out.println("Race status 1");
|
||||||
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 1, 2, boatStatusMessages);
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 1, 2, boatStatusMessages);
|
||||||
mockOutput.parseRaceStatus(raceStatus);
|
mockOutput.parseRaceStatus(raceStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ public class BoatLocationDecoder {
|
|||||||
currentSet = Arrays.copyOfRange(encodedBoatLocation,52, 54);
|
currentSet = Arrays.copyOfRange(encodedBoatLocation,52, 54);
|
||||||
rudderAngle = Arrays.copyOfRange(encodedBoatLocation,54, 56);
|
rudderAngle = Arrays.copyOfRange(encodedBoatLocation,54, 56);
|
||||||
|
|
||||||
|
// System.out.println(bytesToInt(sourceID));
|
||||||
|
// System.out.println(bytesToInt(boatSpeed));
|
||||||
|
|
||||||
message = new BoatLocationMessage(messageVersionNumber, bytesToLong(time),
|
message = new BoatLocationMessage(messageVersionNumber, bytesToLong(time),
|
||||||
bytesToInt(sourceID), bytesToInt(seqNum),
|
bytesToInt(sourceID), bytesToInt(seqNum),
|
||||||
deviceType, bytesToInt(latitude),
|
deviceType, bytesToInt(latitude),
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class BoatLocationMessage extends AC35Data
|
|||||||
this.roll = 0;
|
this.roll = 0;
|
||||||
this.boatSpeed = convertBoatSpeedDoubleToInt(boatSpeed);
|
this.boatSpeed = convertBoatSpeedDoubleToInt(boatSpeed);
|
||||||
this.boatCOG = 0;
|
this.boatCOG = 0;
|
||||||
this.boatSOG = 0;
|
this.boatSOG = convertBoatSpeedDoubleToInt(boatSpeed);
|
||||||
this.apparentWindSpeed = 0;
|
this.apparentWindSpeed = 0;
|
||||||
this.apparentWindAngle = 0;
|
this.apparentWindAngle = 0;
|
||||||
this.trueWindSpeed = 0;
|
this.trueWindSpeed = 0;
|
||||||
@@ -190,8 +190,6 @@ public class BoatLocationMessage extends AC35Data
|
|||||||
int coordinateInt = (int) ((coordinate / 180.0) * 2147483648.0);
|
int coordinateInt = (int) ((coordinate / 180.0) * 2147483648.0);
|
||||||
|
|
||||||
return coordinateInt;
|
return coordinateInt;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import seng302.RaceConnection;
|
import seng302.RaceConnection;
|
||||||
|
|
||||||
@@ -31,16 +32,21 @@ public class ConnectionController extends Controller {
|
|||||||
@FXML
|
@FXML
|
||||||
private Button connectButton;
|
private Button connectButton;
|
||||||
|
|
||||||
private List<RaceConnection> connections;
|
@FXML
|
||||||
|
private TextField urlField;
|
||||||
|
@FXML
|
||||||
|
private TextField portField;
|
||||||
|
|
||||||
|
private ObservableList<RaceConnection> connections;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
// TODO - replace with config file
|
// TODO - replace with config file
|
||||||
connections = new ArrayList<>();
|
connections = FXCollections.observableArrayList();
|
||||||
connections.add(new RaceConnection("livedata.americascup.com", 4941));
|
connections.add(new RaceConnection("livedata.americascup.com", 4941));
|
||||||
connections.add(new RaceConnection("localhost", 4942));
|
connections.add(new RaceConnection("localhost", 4942));
|
||||||
|
|
||||||
connectionTable.setItems(FXCollections.observableArrayList(connections));
|
connectionTable.setItems(connections);
|
||||||
hostnameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
|
hostnameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
|
||||||
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
||||||
|
|
||||||
@@ -60,6 +66,10 @@ public class ConnectionController extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AnchorPane startWrapper(){
|
||||||
|
return connectionWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects to host currently selected in table. Button enabled only if host is ready.
|
* Connects to host currently selected in table. Button enabled only if host is ready.
|
||||||
*/
|
*/
|
||||||
@@ -71,4 +81,19 @@ public class ConnectionController extends Controller {
|
|||||||
parent.enterLobby(socket);
|
parent.enterLobby(socket);
|
||||||
} catch (IOException e) { /* Never reached */ }
|
} catch (IOException e) { /* Never reached */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds a new connection
|
||||||
|
*/
|
||||||
|
public void addConnection(){
|
||||||
|
String hostName = urlField.getText();
|
||||||
|
String portString = portField.getText();
|
||||||
|
try{
|
||||||
|
int port = Integer.parseInt(portString);
|
||||||
|
connections.add(new RaceConnection(hostName, port));
|
||||||
|
}catch(NumberFormatException e){
|
||||||
|
System.err.println("Port number entered is not a number");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,10 @@ public class MainController extends Controller {
|
|||||||
AnchorPane.setBottomAnchor(startController.startWrapper(), 0.0);
|
AnchorPane.setBottomAnchor(startController.startWrapper(), 0.0);
|
||||||
AnchorPane.setLeftAnchor(startController.startWrapper(), 0.0);
|
AnchorPane.setLeftAnchor(startController.startWrapper(), 0.0);
|
||||||
AnchorPane.setRightAnchor(startController.startWrapper(), 0.0);
|
AnchorPane.setRightAnchor(startController.startWrapper(), 0.0);
|
||||||
|
|
||||||
|
AnchorPane.setTopAnchor(connectionController.startWrapper(), 0.0);
|
||||||
|
AnchorPane.setBottomAnchor(connectionController.startWrapper(), 0.0);
|
||||||
|
AnchorPane.setLeftAnchor(connectionController.startWrapper(), 0.0);
|
||||||
|
AnchorPane.setRightAnchor(connectionController.startWrapper(), 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import javafx.beans.value.ChangeListener;
|
|||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import seng302.Mock.StreamedRace;
|
import seng302.Mock.StreamedRace;
|
||||||
import seng302.Model.*;
|
import seng302.Model.*;
|
||||||
@@ -129,7 +131,7 @@ public class RaceController extends Controller {
|
|||||||
raceMap.drawRaceMap();
|
raceMap.drawRaceMap();
|
||||||
raceMap.setVisible(true);
|
raceMap.setVisible(true);
|
||||||
|
|
||||||
canvasBase.getChildren().add(raceMap);
|
canvasBase.getChildren().add(0, raceMap);
|
||||||
race.setVisible(true);
|
race.setVisible(true);
|
||||||
|
|
||||||
//Initialize save annotation array, fps listener, and annotation listeners
|
//Initialize save annotation array, fps listener, and annotation listeners
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ import java.net.Socket;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Observable;
|
import java.util.*;
|
||||||
import java.util.Observer;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by esa46 on 6/04/17.
|
* Created by esa46 on 6/04/17.
|
||||||
@@ -35,6 +33,7 @@ public class StartController extends Controller implements Observer {
|
|||||||
@FXML private GridPane start;
|
@FXML private GridPane start;
|
||||||
@FXML private AnchorPane startWrapper;
|
@FXML private AnchorPane startWrapper;
|
||||||
@FXML private Label raceTitleLabel;
|
@FXML private Label raceTitleLabel;
|
||||||
|
@FXML private Label raceStartLabel;
|
||||||
|
|
||||||
@FXML private TableView<Boat> boatNameTable;
|
@FXML private TableView<Boat> boatNameTable;
|
||||||
@FXML private TableColumn<Boat, String> boatNameColumn;
|
@FXML private TableColumn<Boat, String> boatNameColumn;
|
||||||
@@ -43,7 +42,7 @@ public class StartController extends Controller implements Observer {
|
|||||||
@FXML private Label timer;
|
@FXML private Label timer;
|
||||||
@FXML private int PRERACE_TIME = 10;
|
@FXML private int PRERACE_TIME = 10;
|
||||||
|
|
||||||
@FXML Button fifteenMinButton;
|
//@FXML Button fifteenMinButton;
|
||||||
|
|
||||||
private RaceClock raceClock;
|
private RaceClock raceClock;
|
||||||
|
|
||||||
@@ -56,12 +55,13 @@ public class StartController extends Controller implements Observer {
|
|||||||
* Begins the race with a scale factor of 1
|
* Begins the race with a scale factor of 1
|
||||||
*/
|
*/
|
||||||
public void startRaceNoScaling() {
|
public void startRaceNoScaling() {
|
||||||
startRace(1);
|
//startRace(1);
|
||||||
|
countdownTimer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startRace(int raceScale){
|
private void startRace(int raceScale){
|
||||||
fifteenMinButton.setDisable(true);
|
//fifteenMinButton.setDisable(true);
|
||||||
countdownTimer(raceScale);
|
//countdownTimer(raceScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,15 +103,15 @@ public class StartController extends Controller implements Observer {
|
|||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
||||||
DateFormat timerFormat = new SimpleDateFormat("'Race Clock:' -HH:mm:ss");
|
DateFormat timerFormat = new SimpleDateFormat("'Race Clock:' -HH:mm:ss");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(long arg0) {
|
public void handle(long arg0) {
|
||||||
timeLeft = startTime - currentTime;
|
timeLeft = startTime - currentTime;
|
||||||
if (timeLeft <= 0) {
|
if (visualiserInput.getRaceStatus().getRaceStatus()==2) {
|
||||||
updateTime("Race is starting...");
|
updateTime("Race is starting...");
|
||||||
stop();
|
stop();
|
||||||
parent.beginRace(visualiserInput);
|
parent.beginRace(visualiserInput);
|
||||||
startWrapper.setVisible(false);
|
startWrapper.setVisible(false);
|
||||||
|
start.setVisible(false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
updateTime(timerFormat.format(currentTime));
|
updateTime(timerFormat.format(currentTime));
|
||||||
@@ -122,7 +122,7 @@ public class StartController extends Controller implements Observer {
|
|||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRaceClock() {
|
private void setRaceClock() {
|
||||||
raceClock = new RaceClock(raceData.getZonedDateTime());
|
raceClock = new RaceClock(raceData.getZonedDateTime());
|
||||||
timeZoneTime.textProperty().bind(raceClock.timeStringProperty());
|
timeZoneTime.textProperty().bind(raceClock.timeStringProperty());
|
||||||
|
|
||||||
@@ -138,6 +138,20 @@ public class StartController extends Controller implements Observer {
|
|||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setStartingTime() {
|
||||||
|
String dateFormat = "'Starting time:' HH:mm dd/MM/YYYY";
|
||||||
|
Platform.runLater(()-> {
|
||||||
|
long utcTime = visualiserInput.getRaceStatus().getExpectedStartTime();
|
||||||
|
raceStartLabel.setText(DateTimeFormatter.ofPattern(dateFormat).format(raceClock.getLocalTime(utcTime)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCurrentTime() {
|
||||||
|
Platform.runLater(()->
|
||||||
|
raceClock.setTime(raceClock.getLocalTime(visualiserInput.getRaceStatus().getCurrentTime()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Observable o, Object arg) {
|
public void update(Observable o, Object arg) {
|
||||||
if(o instanceof StreamedCourse) {
|
if(o instanceof StreamedCourse) {
|
||||||
@@ -148,7 +162,12 @@ public class StartController extends Controller implements Observer {
|
|||||||
Platform.runLater(() -> raceTitleLabel.setText(((StreamedCourse)o).getRegattaName()));
|
Platform.runLater(() -> raceTitleLabel.setText(((StreamedCourse)o).getRegattaName()));
|
||||||
}
|
}
|
||||||
if (((StreamedCourse) o).hasReadCourse()) {
|
if (((StreamedCourse) o).hasReadCourse()) {
|
||||||
Platform.runLater(() -> setRaceClock());
|
Platform.runLater(() -> {
|
||||||
|
setRaceClock();
|
||||||
|
while(visualiserInput.getRaceStatus() == null);
|
||||||
|
setStartingTime();
|
||||||
|
setCurrentTime();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,4 +185,5 @@ public class StartController extends Controller implements Observer {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ public class StreamedRace extends Race {
|
|||||||
|
|
||||||
int legNumber = boatStatusMessage.getLegNumber();
|
int legNumber = boatStatusMessage.getLegNumber();
|
||||||
|
|
||||||
|
if (legNumber >= 1 && legNumber < legs.size()) {
|
||||||
|
boat.setCurrentLeg(legs.get(legNumber));
|
||||||
|
}
|
||||||
|
|
||||||
if (boatStatus == BoatStatus.DNF) {
|
if (boatStatus == BoatStatus.DNF) {
|
||||||
boat.setDnf(true);
|
boat.setDnf(true);
|
||||||
} else if (boatStatus == BoatStatus.FINISHED || legNumber > raceData.getLegs().size()) {
|
} else if (boatStatus == BoatStatus.FINISHED || legNumber > raceData.getLegs().size()) {
|
||||||
@@ -84,7 +88,7 @@ public class StreamedRace extends Race {
|
|||||||
double lon = boatLocationMessage.getLongitudeDouble();
|
double lon = boatLocationMessage.getLongitudeDouble();
|
||||||
boat.setCurrentPosition(new GPSCoordinate(lat, lon));
|
boat.setCurrentPosition(new GPSCoordinate(lat, lon));
|
||||||
boat.setHeading(boatLocationMessage.getHeadingDegrees());
|
boat.setHeading(boatLocationMessage.getHeadingDegrees());
|
||||||
boat.setVelocity(boatLocationMessage.getBoatSpeed() * MMPS_TO_KN);
|
boat.setVelocity(boatLocationMessage.getBoatSOG() * MMPS_TO_KN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ public abstract class Race implements Runnable {
|
|||||||
for(Boat boat: startingBoats) {
|
for(Boat boat: startingBoats) {
|
||||||
if(boat != null) {
|
if(boat != null) {
|
||||||
boat.setPosition(Integer.toString(startingBoats.indexOf(boat) + 1));
|
boat.setPosition(Integer.toString(startingBoats.indexOf(boat) + 1));
|
||||||
if (boat.getCurrentLeg().getName().equals("DNF") || boat.getCurrentLeg().getLegNumber() == 0)
|
if (boat.isDnf() || !boat.isStarted() || boat.getCurrentLeg().getLegNumber() < 0)
|
||||||
boat.setPosition("-");
|
boat.setPosition("-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
@@ -11,7 +16,7 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane fx:id="connectionWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.ConnectionController">
|
<AnchorPane fx:id="connectionWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.ConnectionController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="connection" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="connection" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -22,6 +27,7 @@
|
|||||||
<RowConstraints maxHeight="182.0" minHeight="10.0" prefHeight="182.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="182.0" minHeight="10.0" prefHeight="182.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="434.0" minHeight="10.0" prefHeight="434.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="434.0" minHeight="10.0" prefHeight="434.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="174.0" minHeight="10.0" prefHeight="174.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="174.0" minHeight="10.0" prefHeight="174.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="80.0" minHeight="50.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<TableView fx:id="connectionTable" prefHeight="200.0" prefWidth="1080.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
<TableView fx:id="connectionTable" prefHeight="200.0" prefWidth="1080.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
||||||
@@ -33,12 +39,12 @@
|
|||||||
<Insets left="50.0" right="50.0" />
|
<Insets left="50.0" right="50.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TableView>
|
</TableView>
|
||||||
<Button mnemonicParsing="false" onAction="#checkConnections" text="Refresh" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
<Button mnemonicParsing="false" onAction="#checkConnections" text="Refresh" GridPane.halignment="RIGHT" GridPane.rowIndex="3">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets right="20.0" />
|
<Insets right="20.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</Button>
|
</Button>
|
||||||
<Button fx:id="connectButton" mnemonicParsing="false" onAction="#connectSocket" text="Connect" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">
|
<Button fx:id="connectButton" mnemonicParsing="false" onAction="#connectSocket" text="Connect" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="3">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets left="20.0" />
|
<Insets left="20.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@@ -48,6 +54,32 @@
|
|||||||
<Font size="36.0" />
|
<Font size="36.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
|
<GridPane GridPane.columnSpan="2" GridPane.rowIndex="2">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<TextField fx:id="urlField" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</TextField>
|
||||||
|
<TextField fx:id="portField" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</TextField>
|
||||||
|
<Button mnemonicParsing="false" onAction="#addConnection" text="Add New Connection" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
|
||||||
|
<Label text="Host Name:" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM" />
|
||||||
|
<Label text="Port:" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM" />
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.TableColumn?>
|
<?import javafx.scene.control.TableColumn?>
|
||||||
@@ -10,7 +14,7 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" visible="false" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.StartController">
|
<AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.StartController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="start" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="start" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -29,7 +33,6 @@
|
|||||||
<RowConstraints maxHeight="191.5" minHeight="10.0" prefHeight="82.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="191.5" minHeight="10.0" prefHeight="82.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="fifteenMinButton" maxWidth="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#startRaceNoScaling" prefWidth="100.0" text="Start" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
|
|
||||||
<TableView fx:id="boatNameTable" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="2">
|
<TableView fx:id="boatNameTable" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="2">
|
||||||
<placeholder>
|
<placeholder>
|
||||||
<Label text="Initial lineup..." />
|
<Label text="Initial lineup..." />
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import org.junit.Before;
|
|||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.testng.Assert.*;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by connortaylorbrown on 3/05/17.
|
* Created by connortaylorbrown on 3/05/17.
|
||||||
|
|||||||
Reference in New Issue
Block a user