diff --git a/src/main/java/seng302/controllers/ImportantAnnotationController.java b/src/main/java/seng302/controllers/ImportantAnnotationController.java index e1a031cf..d5cd577e 100644 --- a/src/main/java/seng302/controllers/ImportantAnnotationController.java +++ b/src/main/java/seng302/controllers/ImportantAnnotationController.java @@ -28,6 +28,9 @@ public class ImportantAnnotationController implements Initializable { @FXML private CheckBox boatNameSelect; + @FXML + private CheckBox boatEstTimeToNextMarkSelect; + @FXML private AnchorPane annotationSelectWindow; @@ -87,6 +90,10 @@ public class ImportantAnnotationController implements Initializable { boatNameSelect.setSelected(importantAnnotations.get(key)); break; + case "BoatEstTimeToNextMark": + boatEstTimeToNextMarkSelect.setSelected(importantAnnotations.get(key)); + break; + default: break; } @@ -120,6 +127,11 @@ public class ImportantAnnotationController implements Initializable { sendUpdate(); }); + boatEstTimeToNextMarkSelect.setOnAction(event -> { + setAnnotation("BoatEstTimeToNextMark", boatEstTimeToNextMarkSelect.isSelected()); + sendUpdate(); + }); + closeButton.setOnAction(event -> stage.close()); } } diff --git a/src/main/java/seng302/controllers/RaceViewController.java b/src/main/java/seng302/controllers/RaceViewController.java index d2e2ba11..d6bcdc49 100644 --- a/src/main/java/seng302/controllers/RaceViewController.java +++ b/src/main/java/seng302/controllers/RaceViewController.java @@ -315,6 +315,7 @@ public class RaceViewController extends Thread{ BoatGroup bg = (BoatGroup) ro; bg.setTeamNameObjectVisible(false); bg.setVelocityObjectVisible(false); + bg.setEstTimeToNextMarkVisible(false); bg.setLineGroupVisible(false); bg.setWakeVisible(false); } @@ -326,6 +327,7 @@ public class RaceViewController extends Thread{ BoatGroup bg = (BoatGroup) ro; bg.setTeamNameObjectVisible(true); bg.setVelocityObjectVisible(false); + bg.setEstTimeToNextMarkVisible(false); bg.setLineGroupVisible(false); bg.setWakeVisible(false); } @@ -348,7 +350,14 @@ public class RaceViewController extends Thread{ bg.setVelocityObjectVisible(true); } else{ - bg.setTeamNameObjectVisible(false); + bg.setVelocityObjectVisible(false); + } + + if (importantAnnotations.containsKey("BoatEstTimeToNextMark") && importantAnnotations.get("BoatEstTimeToNextMark")) { + bg.setEstTimeToNextMarkVisible(true); + } + else{ + bg.setEstTimeToNextMarkVisible(false); } if (importantAnnotations.containsKey("BoatTrack") && importantAnnotations.get("BoatTrack")){ @@ -373,6 +382,7 @@ public class RaceViewController extends Thread{ BoatGroup bg = (BoatGroup) ro; bg.setTeamNameObjectVisible(true); bg.setVelocityObjectVisible(true); + bg.setEstTimeToNextMarkVisible(true); bg.setLineGroupVisible(true); bg.setWakeVisible(true); } diff --git a/src/main/java/seng302/models/BoatGroup.java b/src/main/java/seng302/models/BoatGroup.java index 57dd48db..0a58d90e 100644 --- a/src/main/java/seng302/models/BoatGroup.java +++ b/src/main/java/seng302/models/BoatGroup.java @@ -23,9 +23,11 @@ public class BoatGroup extends RaceObject{ //Constants for drawing private static final double TEAMNAME_X_OFFSET = 10d; - private static final double TEAMNAME_Y_OFFSET = -15d; + private static final double TEAMNAME_Y_OFFSET = -29d; private static final double VELOCITY_X_OFFSET = 10d; - private static final double VELOCITY_Y_OFFSET = -5d; + private static final double VELOCITY_Y_OFFSET = -17d; + private static final double ESTTIMETONEXTMARK_X_OFFSET = 10d; + private static final double ESTTIMETONEXTMARK_Y_OFFSET = -5d; private static final double BOAT_HEIGHT = 15d; private static final double BOAT_WIDTH = 10d; //Variables for boat logic. @@ -38,6 +40,7 @@ public class BoatGroup extends RaceObject{ private Polygon boatPoly; private Text teamNameObject; private Text velocityObject; + private Text estTimeToNextMarkObject; private Wake wake; //Handles boat moving when connecting to a stream private boolean setToInitialLocation = false; @@ -83,6 +86,7 @@ public class BoatGroup extends RaceObject{ teamNameObject = new Text(boat.getShortName()); velocityObject = new Text(String.valueOf(boat.getVelocity())); + estTimeToNextMarkObject = new Text(String.valueOf(boat.getEstimateTimeAtNextMark())); teamNameObject.setX(TEAMNAME_X_OFFSET); teamNameObject.setY(TEAMNAME_Y_OFFSET); @@ -93,8 +97,12 @@ public class BoatGroup extends RaceObject{ velocityObject.relocate(velocityObject.getX(), velocityObject.getY()); destinationSet = false; + estTimeToNextMarkObject.setX(ESTTIMETONEXTMARK_X_OFFSET); + estTimeToNextMarkObject.setY(ESTTIMETONEXTMARK_Y_OFFSET); + estTimeToNextMarkObject.relocate(estTimeToNextMarkObject.getX(), estTimeToNextMarkObject.getY()); + wake = new Wake(0, -BOAT_HEIGHT); - super.getChildren().addAll(teamNameObject, velocityObject, boatPoly); + super.getChildren().addAll(teamNameObject, velocityObject, boatPoly, estTimeToNextMarkObject); } /** @@ -120,6 +128,8 @@ public class BoatGroup extends RaceObject{ teamNameObject.setLayoutY(teamNameObject.getLayoutY() + dy); velocityObject.setLayoutX(velocityObject.getLayoutX() + dx); velocityObject.setLayoutY(velocityObject.getLayoutY() + dy); + estTimeToNextMarkObject.setLayoutX(estTimeToNextMarkObject.getLayoutX() + dx); + estTimeToNextMarkObject.setLayoutY(estTimeToNextMarkObject.getLayoutY() + dy); wake.setLayoutX(wake.getLayoutX() + dx); wake.setLayoutY(wake.getLayoutY() + dy); rotateTo(rotation + currentRotation); @@ -148,6 +158,8 @@ public class BoatGroup extends RaceObject{ teamNameObject.setLayoutY(y); velocityObject.setLayoutX(x); velocityObject.setLayoutY(y); + estTimeToNextMarkObject.setLayoutX(x); + estTimeToNextMarkObject.setLayoutY(y); wake.setLayoutX(x); wake.setLayoutY(y); wake.rotate(currentRotation); @@ -287,6 +299,10 @@ public class BoatGroup extends RaceObject{ velocityObject.setVisible(visible); } + public void setEstTimeToNextMarkVisible(Boolean visible) { + estTimeToNextMarkObject.setVisible(visible); + } + public void setLineGroupVisible(Boolean visible) { lineGroup.setVisible(visible); } diff --git a/src/main/resources/views/importantAnnotationSelectView.fxml b/src/main/resources/views/importantAnnotationSelectView.fxml index fb88442d..da89b52a 100644 --- a/src/main/resources/views/importantAnnotationSelectView.fxml +++ b/src/main/resources/views/importantAnnotationSelectView.fxml @@ -15,7 +15,8 @@ - + +