Added heading to boatlocation messages

#story[778]
This commit is contained in:
Erika Savell
2017-05-02 19:21:43 +12:00
parent f2e0eec212
commit 42ad1f78fc
11 changed files with 9 additions and 19 deletions
@@ -235,7 +235,6 @@ public class RaceData {
DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
String text = dateFormat.format(time);
System.out.println(text);
return text;
+2 -2
View File
@@ -86,8 +86,8 @@ public class MockOutput implements Runnable
/**
* Used to give the mocOutput information about boat location to be made into a message and sent
*/
public synchronized void parseBoatLocation(int sourceID, double lat, double lon){
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceID, lat, lon, boatLocationSequenceNumber);
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading){
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceID, lat, lon, boatLocationSequenceNumber, heading);
//iterates the sequence number
boatLocationSequenceNumber++;
@@ -62,7 +62,6 @@ public class Event {
RaceData raceData = new RaceData(raceDataSource);
//Serialize race data to an XML as a string.
String xmlString = raceData.createXML();
System.out.println(xmlString);
mockOutput.setRaceXml(xmlString);
mockOutput.parseXMLString(xmlString, 26);
}
@@ -71,7 +70,6 @@ public class Event {
BoatData boatData = new BoatData(raceDataSource.getBoats());
//Serialize race data to an XML as a string.
String xmlString = boatData.createXML();
System.out.println(xmlString);
mockOutput.setBoatsXml(xmlString);
mockOutput.parseXMLString(xmlString, 26);
+1 -5
View File
@@ -95,8 +95,6 @@ public class Race implements Runnable {
*/
public void run() {
initialiseBoats();
System.out.println("Beginning");
countdownTimer();
}
@@ -119,7 +117,6 @@ public class Race implements Runnable {
@Override
public void handle(long arg0) {
timeLeft = startTime - currentTime;
System.out.println(timeLeft);
if (timeLeft <= 0) {
countdownFinish = true;
stop();
@@ -146,7 +143,6 @@ public class Race implements Runnable {
*/
private void simulateRace() {
System.out.println("Running");
System.setProperty("javafx.animation.fullspeed", "true");
for (Boat boat : startingBoats) {
@@ -174,7 +170,7 @@ public class Race implements Runnable {
updatePosition(boat, Math.round(1000 / lastFPS) > 20 ? 15 : Math.round(1000 / lastFPS));
checkPosition(boat, totalTimeElapsed);
}
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude());
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading());
boatStatusMessages.add(new BoatStatusMessage(boat.getSourceID(),
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatus.RACING : BoatStatus.DNF, boat.getCurrentLeg().getLegNumber()));
} else {