Got the live ac35 data working in paralell with the parse and the app. Boats move and the live data works correctly. We need to fix the markers now

#story[818]
This commit is contained in:
Kusal Ekanayake
2017-04-27 16:18:33 +12:00
parent 104fd86179
commit 0a22812165
5 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ public class App extends Application
primaryStage.setScene(new Scene(root));
primaryStage.show();
StreamReceiver sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941,"TestThread1");
// StreamReceiver sr = new StreamReceiver("livedata.americascup.com", 4941, "TestThread1");
// StreamReceiver sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941,"TestThread1");
StreamReceiver sr = new StreamReceiver("livedata.americascup.com", 4941, "TestThread1");
sr.start();
StreamParser streamParser = new StreamParser("TestThread2");
@@ -594,7 +594,7 @@ public class CanvasController {
yAxisLocation += (int) Math.round(distanceScaleFactor * Math.sin(angleFromReference) * distanceFromReference);
} else if (angleFromReference < 0 && angleFromReference >= -Math.PI / 2) {
//System.out.println("3");
System.out.println(distanceFromReference);
// System.out.println(distanceFromReference);
angleFromReference = Math.abs(angleFromReference);
System.out.println(Math.cos(angleFromReference) * distanceFromReference);
xAxisLocation -= (int) Math.round(distanceScaleFactor * Math.sin(angleFromReference) * distanceFromReference);
@@ -6,6 +6,7 @@ import javafx.geometry.Point3D;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import sun.awt.UNIXToolkit;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -119,6 +120,7 @@ public class StreamParser extends Thread{
int raceStatus = payload[11];
// System.out.println("raceStatus = " + raceStatus);
long expectedStartTime = extractTimeStamp(Arrays.copyOfRange(payload,12,18), 6);
// System.out.println("Race starting in: " + expectedStartTime);
long windDir = bytesToLong(Arrays.copyOfRange(payload,18,20));
long windSpeed = bytesToLong(Arrays.copyOfRange(payload,20,22));
int noBoats = payload[22];
@@ -133,6 +135,7 @@ public class StreamParser extends Thread{
boatStatus += "\nEstTimeAtNextMark: " + extractTimeStamp(Arrays.copyOfRange(payload,31 + (i * 20),37+ (i * 20)), 6);
boatStatus += "\nEstTimeAtFinish: " + extractTimeStamp(Arrays.copyOfRange(payload,37 + (i * 20),43+ (i * 20)), 6);
boatStatuses.add(boatStatus);
// System.out.println("boatStatus = " + boatStatus);
}
}
@@ -39,7 +39,6 @@ public class StreamReceiver extends Thread {
});
packetBuffer = pq;
connect();
}
public void start () {