mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge remote-tracking branch 'origin/develop' into story36_elapsed_time
# Conflicts: # src/main/java/seng302/models/BoatGroup.java
This commit is contained in:
@@ -8,7 +8,10 @@ import javafx.scene.shape.Polygon;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.stage.Stage;
|
||||
import seng302.models.parsers.StreamParser;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -91,6 +94,9 @@ public class BoatGroup extends RaceObject{
|
||||
velocityObject = new Text(String.valueOf(boat.getVelocity()));
|
||||
estTimeToNextMarkObject = new Text(String.valueOf(boat.getEstimateTimeAtNextMark()));
|
||||
legTimeObject = new Text(String.valueOf(boat.getMarkRoundingTime()));
|
||||
DateFormat format = new SimpleDateFormat("mm:ss");
|
||||
String timeToNextMark = format.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
||||
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
|
||||
|
||||
teamNameObject.setX(TEAMNAME_X_OFFSET);
|
||||
teamNameObject.setY(TEAMNAME_Y_OFFSET);
|
||||
@@ -250,6 +256,9 @@ public class BoatGroup extends RaceObject{
|
||||
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
|
||||
estTimeToNextMarkObject.setText(String.valueOf(boat.getEstimateTimeAtNextMark()));
|
||||
legTimeObject.setText(String.valueOf(boat.getMarkRoundingTime()));
|
||||
DateFormat format = new SimpleDateFormat("mm:ss");
|
||||
String timeToNextMark = format.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
||||
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
|
||||
} else {
|
||||
setToInitialLocation = true;
|
||||
rotationalGoal = rotation;
|
||||
|
||||
@@ -238,11 +238,11 @@ public class StreamParser extends Thread{
|
||||
Yacht boat = boats.get((int)(long) boatStatusSourceID);
|
||||
boat.setBoatStatus((int)payload[28 + (i * 20)]);
|
||||
boat.setLegNumber((int)payload[29 + (i * 20)]);
|
||||
boat.setPenaltiesAwarded((int)payload[29 + (i * 20)]);
|
||||
boat.setPenaltiesServed((int)payload[30 + (i * 20)]);
|
||||
Long estTimeAtNextMark = bytesToLong(Arrays.copyOfRange(payload,31 + (i * 20),37+ (i * 20)));
|
||||
boat.setPenaltiesAwarded((int)payload[30 + (i * 20)]);
|
||||
boat.setPenaltiesServed((int)payload[31 + (i * 20)]);
|
||||
Long estTimeAtNextMark = bytesToLong(Arrays.copyOfRange(payload,32 + (i * 20),38+ (i * 20)));
|
||||
boat.setEstimateTimeAtNextMark(estTimeAtNextMark);
|
||||
Long estTimeAtFinish = bytesToLong(Arrays.copyOfRange(payload,37 + (i * 20),43+ (i * 20)));
|
||||
Long estTimeAtFinish = bytesToLong(Arrays.copyOfRange(payload,38 + (i * 20),44+ (i * 20)));
|
||||
boat.setEstimateTimeAtFinish(estTimeAtFinish);
|
||||
boatsPos.put(estTimeAtFinish, boat);
|
||||
// String boatStatus = "SourceID: " + boatStatusSourceID;
|
||||
@@ -580,6 +580,15 @@ public class StreamParser extends Thread{
|
||||
return boatsPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns current time in stream in long
|
||||
*
|
||||
* @return a long value of current time
|
||||
*/
|
||||
public static Long getCurrentTimeLong() {
|
||||
return currentTimeLong;
|
||||
}
|
||||
|
||||
public static void appClose(){
|
||||
appRunning = false;
|
||||
System.out.println("[CLIENT] Shutting down stream parser");
|
||||
|
||||
Reference in New Issue
Block a user