boats have an annotation beside them that shows time since last mark passed

#story[878]
main
hba56 9 years ago
parent 9eb4e3daea
commit a24dda2fd8

@ -55,8 +55,8 @@ public class StreamedRace implements Runnable {
if (boat != null) { if (boat != null) {
Leg startLeg = new Leg(name, 0); Leg startLeg = new Leg(name, 0);
startLeg.setEndMarker(endCompoundMark); startLeg.setEndMarker(endCompoundMark);
System.out.println(controller.getRaceClock().getTime());
boat.setCurrentLeg(startLeg, controller.getRaceClock()); boat.setCurrentLeg(startLeg, controller.getRaceClock());
boat.setTimeSinceLastMark(controller.getRaceClock().getTime());
} }
} }
} }

@ -165,6 +165,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
* @param abbrev abbreviation of the boat name * @param abbrev abbreviation of the boat name
* @param speed speed of the boat * @param speed speed of the boat
* @param coordinate coordinate the text appears * @param coordinate coordinate the text appears
* @param timeSinceLastMark time since the last mark was passed
*/ */
private void displayText(String name, String abbrev, double speed, GraphCoordinate coordinate, ZonedDateTime timeSinceLastMark) { private void displayText(String name, String abbrev, double speed, GraphCoordinate coordinate, ZonedDateTime timeSinceLastMark) {
String text = ""; String text = "";
@ -178,7 +179,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
} }
//Check speed toggle value //Check speed toggle value
if (annoSpeed){ if (annoSpeed){
text += String.format("%.2fkn", speed); text += String.format("%.2fkn ", speed);
} }
//Check time since last mark toggle value //Check time since last mark toggle value
if(annoTimeSinceLastMark){ if(annoTimeSinceLastMark){
@ -304,6 +305,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
} }
if (raceAnno) if (raceAnno)
if (Duration.between(boat.getTimeSinceLastMark(), raceClock.getTime()).getSeconds() < 0){
boat.setTimeSinceLastMark(raceClock.getTime());
}
displayText(boat.toString(), boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()), boat.getTimeSinceLastMark()); displayText(boat.toString(), boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()), boat.getTimeSinceLastMark());
//TODO this needs to be fixed. //TODO this needs to be fixed.
drawTrack(boat, colours.get(currentColour)); drawTrack(boat, colours.get(currentColour));

Loading…
Cancel
Save