Event takes string and sets time of race

- RaceXmlReaders can handle strings now
- Not working with visualiser, gps coords may be worng

#story[881]
This commit is contained in:
Erika Savell
2017-05-10 21:46:24 +12:00
parent 91b1773703
commit ffa3d530ae
15 changed files with 301 additions and 649 deletions
@@ -29,18 +29,4 @@ public class StreamedBoat extends Boat {
return sourceID;
}
/**
* Calculates the azimuth of the travel via heading of the boat
*
* @return the direction that the boat is heading towards in degrees (-180 to 180).
*/
public double calculateAzimuth() {
double azimuth;
if (heading <= 180) {
azimuth = heading;
} else {
azimuth = -heading + 180;
}
return azimuth;
}
}
@@ -33,6 +33,7 @@ public class StreamedCourse extends Observable implements RaceDataSource {
this.boatXMLReader = boatXMLReader;
if (streamedCourseXMLReader != null && boatXMLReader != null) {
this.boatXMLReader.setParticipants(streamedCourseXMLReader.getParticipants());
System.out.println(streamedCourseXMLReader.getParticipants().size());
boatXMLReader.read();
}
@@ -219,7 +219,6 @@ public class VisualiserInput implements Runnable {
//If no heartbeat has been received in more the heartbeat period
//then the connection will need to be restarted.
System.out.println("time since last heartbeat: " + timeSinceHeartbeat());//TEMP REMOVE
long heartBeatPeriod = 10 * 1000;
if (timeSinceHeartbeat() > heartBeatPeriod) {
System.out.println("Connection has stopped, trying to reconnect.");
@@ -369,6 +368,8 @@ public class VisualiserInput implements Runnable {
BoatLocation boatLocation = (BoatLocation) message;
//System.out.println("Boat Location!");
//System.out.println(boatLocation.getSourceID());
if (this.boatLocationMap.containsKey(boatLocation.getSourceID())) {
//If our boatlocation map already contains a boat location message for this boat, check that the new message is actually for a later timestamp (i.e., newer).
if (boatLocation.getTime() > this.boatLocationMap.get(boatLocation.getSourceID()).getTime()){