mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Implemented elapsed time since last mark on annotation.
#story[927]
This commit is contained in:
@@ -33,7 +33,8 @@ import java.util.*;
|
|||||||
/**
|
/**
|
||||||
* Created by ptg19 on 29/03/17.
|
* Created by ptg19 on 29/03/17.
|
||||||
*/
|
*/
|
||||||
public class RaceViewController extends Thread implements ImportantAnnotationDelegate{
|
public class RaceViewController extends Thread implements ImportantAnnotationDelegate {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private VBox positionVbox;
|
private VBox positionVbox;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -85,11 +86,12 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The important annotations have been changed, update this view
|
* The important annotations have been changed, update this view
|
||||||
|
*
|
||||||
* @param importantAnnotationsState The current state of the selected annotations
|
* @param importantAnnotationsState The current state of the selected annotations
|
||||||
*/
|
*/
|
||||||
public void importantAnnotationsChanged(ImportantAnnotationsState importantAnnotationsState){
|
public void importantAnnotationsChanged(ImportantAnnotationsState importantAnnotationsState) {
|
||||||
this.importantAnnotations = importantAnnotationsState;
|
this.importantAnnotations = importantAnnotationsState;
|
||||||
setAnnotations((int)annotationSlider.getValue()); // Refresh the displayed annotations
|
setAnnotations((int) annotationSlider.getValue()); // Refresh the displayed annotations
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,12 +103,14 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
|
|
||||||
// Set controller
|
// Set controller
|
||||||
ImportantAnnotationController controller = new ImportantAnnotationController(this, stage);
|
ImportantAnnotationController controller = new ImportantAnnotationController(this,
|
||||||
|
stage);
|
||||||
fxmlLoader.setController(controller);
|
fxmlLoader.setController(controller);
|
||||||
|
|
||||||
// Load FXML and set CSS
|
// Load FXML and set CSS
|
||||||
fxmlLoader.setLocation(getClass().getResource("/views/importantAnnotationSelectView.fxml"));
|
fxmlLoader
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 469, 248);
|
.setLocation(getClass().getResource("/views/importantAnnotationSelectView.fxml"));
|
||||||
|
Scene scene = new Scene(fxmlLoader.load(), 469, 270);
|
||||||
scene.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
scene.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
||||||
stage.initStyle(StageStyle.UNDECORATED);
|
stage.initStyle(StageStyle.UNDECORATED);
|
||||||
|
|
||||||
@@ -125,7 +129,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
|
|
||||||
toggleFps.selectedProperty().addListener(new ChangeListener<Boolean>() {
|
toggleFps.selectedProperty().addListener(new ChangeListener<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
|
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue,
|
||||||
|
Boolean newValue) {
|
||||||
displayFps = !displayFps;
|
displayFps = !displayFps;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -134,10 +139,18 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
annotationSlider.setLabelFormatter(new StringConverter<Double>() {
|
annotationSlider.setLabelFormatter(new StringConverter<Double>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString(Double n) {
|
public String toString(Double n) {
|
||||||
if (n == 0) return "None";
|
if (n == 0) {
|
||||||
if (n == 1) return "Low";
|
return "None";
|
||||||
if (n == 2) return "Important";
|
}
|
||||||
if (n == 3) return "All";
|
if (n == 1) {
|
||||||
|
return "Low";
|
||||||
|
}
|
||||||
|
if (n == 2) {
|
||||||
|
return "Important";
|
||||||
|
}
|
||||||
|
if (n == 3) {
|
||||||
|
return "All";
|
||||||
|
}
|
||||||
|
|
||||||
return "All";
|
return "All";
|
||||||
}
|
}
|
||||||
@@ -161,25 +174,25 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
});
|
});
|
||||||
|
|
||||||
annotationSlider.valueProperty().addListener((obs, oldval, newVal) ->
|
annotationSlider.valueProperty().addListener((obs, oldval, newVal) ->
|
||||||
setAnnotations((int)annotationSlider.getValue()));
|
setAnnotations((int) annotationSlider.getValue()));
|
||||||
|
|
||||||
annotationSlider.setValue(3);
|
annotationSlider.setValue(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeTimer(){
|
private void initializeTimer() {
|
||||||
timerTimeline = new Timeline();
|
timerTimeline = new Timeline();
|
||||||
timerTimeline.setCycleCount(Timeline.INDEFINITE);
|
timerTimeline.setCycleCount(Timeline.INDEFINITE);
|
||||||
// Run timer update every second
|
// Run timer update every second
|
||||||
timerTimeline.getKeyFrames().add(
|
timerTimeline.getKeyFrames().add(
|
||||||
new KeyFrame(Duration.seconds(1),
|
new KeyFrame(Duration.seconds(1),
|
||||||
event -> {
|
event -> {
|
||||||
if (StreamParser.isRaceFinished()) {
|
if (StreamParser.isRaceFinished()) {
|
||||||
timerLabel.setFill(Color.RED);
|
timerLabel.setFill(Color.RED);
|
||||||
timerLabel.setText("Race Finished!");
|
timerLabel.setText("Race Finished!");
|
||||||
} else {
|
} else {
|
||||||
timerLabel.setText(currentTimer());
|
timerLabel.setText(currentTimer());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Start the timer
|
// Start the timer
|
||||||
@@ -190,11 +203,12 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
Timeline windDirTimeline = new Timeline();
|
Timeline windDirTimeline = new Timeline();
|
||||||
windDirTimeline.setCycleCount(Timeline.INDEFINITE);
|
windDirTimeline.setCycleCount(Timeline.INDEFINITE);
|
||||||
windDirTimeline.getKeyFrames().add(
|
windDirTimeline.getKeyFrames().add(
|
||||||
new KeyFrame(Duration.seconds(1),
|
new KeyFrame(Duration.seconds(1),
|
||||||
event -> {
|
event -> {
|
||||||
windDirectionText.setText(String.format("%.1f°", StreamParser.getWindDirection()));
|
windDirectionText
|
||||||
windArrowText.setRotate(StreamParser.getWindDirection());
|
.setText(String.format("%.1f°", StreamParser.getWindDirection()));
|
||||||
})
|
windArrowText.setRotate(StreamParser.getWindDirection());
|
||||||
|
})
|
||||||
);
|
);
|
||||||
windDirTimeline.playFromStart();
|
windDirTimeline.playFromStart();
|
||||||
}
|
}
|
||||||
@@ -204,10 +218,10 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
Timeline posVBoxTimeline = new Timeline();
|
Timeline posVBoxTimeline = new Timeline();
|
||||||
posVBoxTimeline.setCycleCount(Timeline.INDEFINITE);
|
posVBoxTimeline.setCycleCount(Timeline.INDEFINITE);
|
||||||
posVBoxTimeline.getKeyFrames().add(
|
posVBoxTimeline.getKeyFrames().add(
|
||||||
new KeyFrame(Duration.seconds(1),
|
new KeyFrame(Duration.seconds(1),
|
||||||
event -> {
|
event -> {
|
||||||
showOrder();
|
showOrder();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
posVBoxTimeline.playFromStart();
|
posVBoxTimeline.playFromStart();
|
||||||
|
|
||||||
@@ -240,13 +254,13 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
for (Yacht boat : StreamParser.getBoatsPos().values()) {
|
for (Yacht boat : StreamParser.getBoatsPos().values()) {
|
||||||
if (boat.getBoatStatus() == 3) { // 3 is finish status
|
if (boat.getBoatStatus() == 3) { // 3 is finish status
|
||||||
Text textToAdd = new Text(boat.getPosition() + ". " +
|
Text textToAdd = new Text(boat.getPosition() + ". " +
|
||||||
boat.getShortName() + " (Finished)");
|
boat.getShortName() + " (Finished)");
|
||||||
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
||||||
positionVbox.getChildren().add(textToAdd);
|
positionVbox.getChildren().add(textToAdd);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Text textToAdd = new Text(boat.getPosition() + ". " +
|
Text textToAdd = new Text(boat.getPosition() + ". " +
|
||||||
boat.getShortName() + " ");
|
boat.getShortName() + " ");
|
||||||
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
||||||
textToAdd.setStyle("");
|
textToAdd.setStyle("");
|
||||||
positionVbox.getChildren().add(textToAdd);
|
positionVbox.getChildren().add(textToAdd);
|
||||||
@@ -291,6 +305,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
public void stopTimer() {
|
public void stopTimer() {
|
||||||
timerTimeline.stop();
|
timerTimeline.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startTimer() {
|
public void startTimer() {
|
||||||
timerTimeline.play();
|
timerTimeline.play();
|
||||||
}
|
}
|
||||||
@@ -303,49 +318,51 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
return race;
|
return race;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Yacht> getStartingBoats(){
|
public ArrayList<Yacht> getStartingBoats() {
|
||||||
return startingBoats;
|
return startingBoats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the important annotations for a specific BoatGroup
|
* Display the important annotations for a specific BoatGroup
|
||||||
|
*
|
||||||
* @param bg The boat group to set the annotations for
|
* @param bg The boat group to set the annotations for
|
||||||
*/
|
*/
|
||||||
private void setBoatGroupImportantAnnotations(BoatGroup bg){
|
private void setBoatGroupImportantAnnotations(BoatGroup bg) {
|
||||||
if (importantAnnotations.getAnnotationState(Annotation.NAME)){
|
if (importantAnnotations.getAnnotationState(Annotation.NAME)) {
|
||||||
bg.setTeamNameObjectVisible(true);
|
bg.setTeamNameObjectVisible(true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
bg.setTeamNameObjectVisible(false);
|
bg.setTeamNameObjectVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (importantAnnotations.getAnnotationState(Annotation.SPEED)){
|
if (importantAnnotations.getAnnotationState(Annotation.SPEED)) {
|
||||||
bg.setVelocityObjectVisible(true);
|
bg.setVelocityObjectVisible(true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
bg.setVelocityObjectVisible(false);
|
bg.setVelocityObjectVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (importantAnnotations.getAnnotationState(Annotation.TRACK)){
|
if (importantAnnotations.getAnnotationState(Annotation.TRACK)) {
|
||||||
bg.setLineGroupVisible(true);
|
bg.setLineGroupVisible(true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
bg.setLineGroupVisible(false);
|
bg.setLineGroupVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (importantAnnotations.getAnnotationState(Annotation.WAKE)){
|
if (importantAnnotations.getAnnotationState(Annotation.WAKE)) {
|
||||||
bg.setWakeVisible(true);
|
bg.setWakeVisible(true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
bg.setWakeVisible(false);
|
bg.setWakeVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (importantAnnotations.getAnnotationState(Annotation.ESTTIMETONEXTMARK)) {
|
if (importantAnnotations.getAnnotationState(Annotation.ESTTIMETONEXTMARK)) {
|
||||||
bg.setEstTimeToNextMarkObjectVisible(true);
|
bg.setEstTimeToNextMarkObjectVisible(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
bg.setEstTimeToNextMarkObjectVisible(false);
|
bg.setEstTimeToNextMarkObjectVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (importantAnnotations.getAnnotationState(Annotation.LEGTIME)) {
|
||||||
|
bg.setLegTimeObjectVisible(true);
|
||||||
|
} else {
|
||||||
|
bg.setLegTimeObjectVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAnnotations(Integer annotationLevel) {
|
private void setAnnotations(Integer annotationLevel) {
|
||||||
@@ -353,11 +370,12 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// No Annotations
|
// No Annotations
|
||||||
case 0:
|
case 0:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||||
if(ro instanceof BoatGroup) {
|
if (ro instanceof BoatGroup) {
|
||||||
BoatGroup bg = (BoatGroup) ro;
|
BoatGroup bg = (BoatGroup) ro;
|
||||||
bg.setTeamNameObjectVisible(false);
|
bg.setTeamNameObjectVisible(false);
|
||||||
bg.setVelocityObjectVisible(false);
|
bg.setVelocityObjectVisible(false);
|
||||||
bg.setEstTimeToNextMarkObjectVisible(false);
|
bg.setEstTimeToNextMarkObjectVisible(false);
|
||||||
|
bg.setLegTimeObjectVisible(false);
|
||||||
bg.setLineGroupVisible(false);
|
bg.setLineGroupVisible(false);
|
||||||
bg.setWakeVisible(false);
|
bg.setWakeVisible(false);
|
||||||
}
|
}
|
||||||
@@ -366,11 +384,12 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// Low Annotations
|
// Low Annotations
|
||||||
case 1:
|
case 1:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||||
if(ro instanceof BoatGroup) {
|
if (ro instanceof BoatGroup) {
|
||||||
BoatGroup bg = (BoatGroup) ro;
|
BoatGroup bg = (BoatGroup) ro;
|
||||||
bg.setTeamNameObjectVisible(true);
|
bg.setTeamNameObjectVisible(true);
|
||||||
bg.setVelocityObjectVisible(false);
|
bg.setVelocityObjectVisible(false);
|
||||||
bg.setEstTimeToNextMarkObjectVisible(false);
|
bg.setEstTimeToNextMarkObjectVisible(false);
|
||||||
|
bg.setLegTimeObjectVisible(false);
|
||||||
bg.setLineGroupVisible(false);
|
bg.setLineGroupVisible(false);
|
||||||
bg.setWakeVisible(false);
|
bg.setWakeVisible(false);
|
||||||
}
|
}
|
||||||
@@ -379,7 +398,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// Important Annotations
|
// Important Annotations
|
||||||
case 2:
|
case 2:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||||
if(ro instanceof BoatGroup) {
|
if (ro instanceof BoatGroup) {
|
||||||
BoatGroup bg = (BoatGroup) ro;
|
BoatGroup bg = (BoatGroup) ro;
|
||||||
setBoatGroupImportantAnnotations(bg);
|
setBoatGroupImportantAnnotations(bg);
|
||||||
}
|
}
|
||||||
@@ -388,11 +407,12 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// All Annotations
|
// All Annotations
|
||||||
case 3:
|
case 3:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||||
if(ro instanceof BoatGroup) {
|
if (ro instanceof BoatGroup) {
|
||||||
BoatGroup bg = (BoatGroup) ro;
|
BoatGroup bg = (BoatGroup) ro;
|
||||||
bg.setTeamNameObjectVisible(true);
|
bg.setTeamNameObjectVisible(true);
|
||||||
bg.setVelocityObjectVisible(true);
|
bg.setVelocityObjectVisible(true);
|
||||||
bg.setEstTimeToNextMarkObjectVisible(true);
|
bg.setEstTimeToNextMarkObjectVisible(true);
|
||||||
|
bg.setLegTimeObjectVisible(true);
|
||||||
bg.setLineGroupVisible(true);
|
bg.setLineGroupVisible(true);
|
||||||
bg.setWakeVisible(true);
|
bg.setWakeVisible(true);
|
||||||
}
|
}
|
||||||
@@ -401,11 +421,11 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStage (Stage stage) {
|
void setStage(Stage stage) {
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stage getStage () {
|
Stage getStage() {
|
||||||
return stage;
|
return stage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,5 +8,6 @@ public enum Annotation {
|
|||||||
WAKE,
|
WAKE,
|
||||||
TRACK,
|
TRACK,
|
||||||
NAME,
|
NAME,
|
||||||
ESTTIMETONEXTMARK
|
ESTTIMETONEXTMARK,
|
||||||
|
LEGTIME
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class ImportantAnnotationController implements Initializable {
|
public class ImportantAnnotationController implements Initializable {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* JavaFX Outlets
|
* JavaFX Outlets
|
||||||
*/
|
*/
|
||||||
@@ -33,6 +34,9 @@ public class ImportantAnnotationController implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private CheckBox boatEstTimeToNextMarkSelect;
|
private CheckBox boatEstTimeToNextMarkSelect;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private CheckBox boatElapsedTimeSelect;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane annotationSelectWindow;
|
private AnchorPane annotationSelectWindow;
|
||||||
|
|
||||||
@@ -43,7 +47,7 @@ public class ImportantAnnotationController implements Initializable {
|
|||||||
private ImportantAnnotationsState importantAnnotationsState;
|
private ImportantAnnotationsState importantAnnotationsState;
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
|
|
||||||
public ImportantAnnotationController(ImportantAnnotationDelegate delegate, Stage stage){
|
public ImportantAnnotationController(ImportantAnnotationDelegate delegate, Stage stage) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
importantAnnotationsState = new ImportantAnnotationsState();
|
importantAnnotationsState = new ImportantAnnotationsState();
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
@@ -52,10 +56,11 @@ public class ImportantAnnotationController implements Initializable {
|
|||||||
/**
|
/**
|
||||||
* Sets whether or not an annotation is considered important, then
|
* Sets whether or not an annotation is considered important, then
|
||||||
* sends an update to the delegate
|
* sends an update to the delegate
|
||||||
|
*
|
||||||
* @param annotation The annotation
|
* @param annotation The annotation
|
||||||
* @param isSet True if annotation is important
|
* @param isSet True if annotation is important
|
||||||
*/
|
*/
|
||||||
private void setAnnotation(Annotation annotation, Boolean isSet){
|
private void setAnnotation(Annotation annotation, Boolean isSet) {
|
||||||
importantAnnotationsState.setAnnotationState(annotation, isSet);
|
importantAnnotationsState.setAnnotationState(annotation, isSet);
|
||||||
sendUpdate();
|
sendUpdate();
|
||||||
}
|
}
|
||||||
@@ -64,40 +69,50 @@ public class ImportantAnnotationController implements Initializable {
|
|||||||
* Sends an update to the delegate when the important
|
* Sends an update to the delegate when the important
|
||||||
* annotations have changed
|
* annotations have changed
|
||||||
*/
|
*/
|
||||||
private void sendUpdate(){
|
private void sendUpdate() {
|
||||||
this.delegate.importantAnnotationsChanged(importantAnnotationsState);
|
this.delegate.importantAnnotationsChanged(importantAnnotationsState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the current state of the 'important annotations'
|
* Load the current state of the 'important annotations'
|
||||||
|
*
|
||||||
* @param currentState hashmap containing the states of each annotation
|
* @param currentState hashmap containing the states of each annotation
|
||||||
*/
|
*/
|
||||||
public void loadState(ImportantAnnotationsState currentState){
|
public void loadState(ImportantAnnotationsState currentState) {
|
||||||
this.importantAnnotationsState = currentState;
|
this.importantAnnotationsState = currentState;
|
||||||
|
|
||||||
// Initialise checkboxes
|
// Initialise checkboxes
|
||||||
for (Annotation annotation : importantAnnotationsState.getAnnotations()){
|
for (Annotation annotation : importantAnnotationsState.getAnnotations()) {
|
||||||
switch (annotation){
|
switch (annotation) {
|
||||||
case WAKE:
|
case WAKE:
|
||||||
boatWakeSelect.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
boatWakeSelect
|
||||||
|
.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPEED:
|
case SPEED:
|
||||||
boatSpeedSelect.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
boatSpeedSelect
|
||||||
|
.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRACK:
|
case TRACK:
|
||||||
boatTrackSelect.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
boatTrackSelect
|
||||||
|
.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME:
|
case NAME:
|
||||||
boatNameSelect.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
boatNameSelect
|
||||||
|
.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESTTIMETONEXTMARK:
|
case ESTTIMETONEXTMARK:
|
||||||
boatEstTimeToNextMarkSelect.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
boatEstTimeToNextMarkSelect
|
||||||
|
.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LEGTIME:
|
||||||
|
boatElapsedTimeSelect
|
||||||
|
.setSelected(importantAnnotationsState.getAnnotationState(annotation));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -106,16 +121,24 @@ public class ImportantAnnotationController implements Initializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* View did load
|
* View did load
|
||||||
|
*
|
||||||
* @param location .
|
* @param location .
|
||||||
* @param resources .
|
* @param resources .
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
boatWakeSelect.setOnAction(event -> setAnnotation(Annotation.WAKE, boatWakeSelect.isSelected()));
|
boatWakeSelect
|
||||||
boatSpeedSelect.setOnAction(event -> setAnnotation(Annotation.SPEED, boatSpeedSelect.isSelected()));
|
.setOnAction(event -> setAnnotation(Annotation.WAKE, boatWakeSelect.isSelected()));
|
||||||
boatTrackSelect.setOnAction(event -> setAnnotation(Annotation.TRACK, boatTrackSelect.isSelected()));
|
boatSpeedSelect
|
||||||
boatNameSelect.setOnAction(event -> setAnnotation(Annotation.NAME, boatNameSelect.isSelected()));
|
.setOnAction(event -> setAnnotation(Annotation.SPEED, boatSpeedSelect.isSelected()));
|
||||||
boatEstTimeToNextMarkSelect.setOnAction(event -> setAnnotation(Annotation.ESTTIMETONEXTMARK, boatEstTimeToNextMarkSelect.isSelected()));
|
boatTrackSelect
|
||||||
|
.setOnAction(event -> setAnnotation(Annotation.TRACK, boatTrackSelect.isSelected()));
|
||||||
|
boatNameSelect
|
||||||
|
.setOnAction(event -> setAnnotation(Annotation.NAME, boatNameSelect.isSelected()));
|
||||||
|
boatEstTimeToNextMarkSelect.setOnAction(event -> setAnnotation(Annotation.ESTTIMETONEXTMARK,
|
||||||
|
boatEstTimeToNextMarkSelect.isSelected()));
|
||||||
|
boatElapsedTimeSelect.setOnAction(
|
||||||
|
event -> setAnnotation(Annotation.LEGTIME, boatElapsedTimeSelect.isSelected()));
|
||||||
|
|
||||||
closeButton.setOnAction(event -> stage.close());
|
closeButton.setOnAction(event -> stage.close());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BoatGroup is a javafx group that by default contains a graphical objects for representing a 2 dimensional boat.
|
* BoatGroup is a javafx group that by default contains a graphical objects for representing a 2
|
||||||
* It contains a single polygon for the boat, a group of lines to show it's path, a wake object and two text labels to
|
* dimensional boat. It contains a single polygon for the boat, a group of lines to show it's path,
|
||||||
* annotate the boat teams name and the boats velocity. The boat will update it's position onscreen everytime
|
* a wake object and two text labels to annotate the boat teams name and the boats velocity. The
|
||||||
* UpdatePosition is called unless the window is minimized in which case it attempts to store animations and apply them
|
* boat will update it's position onscreen everytime UpdatePosition is called unless the window is
|
||||||
* when the window is maximised.
|
* minimized in which case it attempts to store animations and apply them when the window is
|
||||||
|
* maximised.
|
||||||
*/
|
*/
|
||||||
public class BoatGroup extends RaceObject{
|
public class BoatGroup extends RaceObject {
|
||||||
|
|
||||||
//Constants for drawing
|
//Constants for drawing
|
||||||
private static final double TEAMNAME_X_OFFSET = 10d;
|
private static final double TEAMNAME_X_OFFSET = 10d;
|
||||||
@@ -53,50 +54,61 @@ public class BoatGroup extends RaceObject{
|
|||||||
private boolean destinationSet;
|
private boolean destinationSet;
|
||||||
//Variables for handling minimization
|
//Variables for handling minimization
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
private boolean isMaximized= true;
|
private boolean isMaximized = true;
|
||||||
private List<Line> lineStorage = new ArrayList<>();
|
private List<Line> lineStorage = new ArrayList<>();
|
||||||
private int setCallCount = 5;
|
private int setCallCount = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a BoatGroup with the default triangular boat polygon.
|
* Creates a BoatGroup with the default triangular boat polygon.
|
||||||
* @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used to tell which
|
*
|
||||||
* BoatGroup to update.
|
* @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used
|
||||||
|
* to tell which BoatGroup to update.
|
||||||
* @param color The colour of the boat polygon and the trailing line.
|
* @param color The colour of the boat polygon and the trailing line.
|
||||||
*/
|
*/
|
||||||
public BoatGroup (Yacht boat, Color color){
|
public BoatGroup(Yacht boat, Color color) {
|
||||||
this.boat = boat;
|
this.boat = boat;
|
||||||
initChildren(color);
|
initChildren(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a BoatGroup with the boat being the default polygon. The head of the boat should be at point (0,0).
|
* Creates a BoatGroup with the boat being the default polygon. The head of the boat should be
|
||||||
* @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used to tell which
|
* at point (0,0).
|
||||||
* BoatGroup to update.
|
*
|
||||||
|
* @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used
|
||||||
|
* to tell which BoatGroup to update.
|
||||||
* @param color The colour of the boat polygon and the trailing line.
|
* @param color The colour of the boat polygon and the trailing line.
|
||||||
* @param points An array of co-ordinates x1,y1,x2,y2,x3,y3... that will make up the boat polygon.
|
* @param points An array of co-ordinates x1,y1,x2,y2,x3,y3... that will make up the boat
|
||||||
|
* polygon.
|
||||||
*/
|
*/
|
||||||
public BoatGroup (Yacht boat, Color color, double... points)
|
public BoatGroup(Yacht boat, Color color, double... points) {
|
||||||
{
|
|
||||||
this.boat = boat;
|
this.boat = boat;
|
||||||
initChildren(color, points);
|
initChildren(color, points);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the javafx objects that will be the in the group by default.
|
* Creates the javafx objects that will be the in the group by default.
|
||||||
|
*
|
||||||
* @param color The colour of the boat polygon and the trailing line.
|
* @param color The colour of the boat polygon and the trailing line.
|
||||||
* @param points An array of co-ordinates x1,y1,x2,y2,x3,y3... that will make up the boat polygon.
|
* @param points An array of co-ordinates x1,y1,x2,y2,x3,y3... that will make up the boat
|
||||||
|
* polygon.
|
||||||
*/
|
*/
|
||||||
private void initChildren (Color color, double... points) {
|
private void initChildren(Color color, double... points) {
|
||||||
boatPoly = new Polygon(points);
|
boatPoly = new Polygon(points);
|
||||||
boatPoly.setFill(color);
|
boatPoly.setFill(color);
|
||||||
|
|
||||||
teamNameObject = new Text(boat.getShortName());
|
teamNameObject = new Text(boat.getShortName());
|
||||||
velocityObject = new Text(String.valueOf(boat.getVelocity()));
|
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");
|
DateFormat format = new SimpleDateFormat("mm:ss");
|
||||||
String timeToNextMark = format.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
String timeToNextMark = format
|
||||||
|
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
||||||
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
|
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
|
||||||
|
if (boat.getMarkRoundingTime() != null) {
|
||||||
|
String elapsedTime = format
|
||||||
|
.format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime());
|
||||||
|
legTimeObject = new Text("Last mark: " + elapsedTime);
|
||||||
|
} else {
|
||||||
|
legTimeObject = new Text("Last mark: -");
|
||||||
|
}
|
||||||
|
|
||||||
teamNameObject.setX(TEAMNAME_X_OFFSET);
|
teamNameObject.setX(TEAMNAME_X_OFFSET);
|
||||||
teamNameObject.setY(TEAMNAME_Y_OFFSET);
|
teamNameObject.setY(TEAMNAME_Y_OFFSET);
|
||||||
@@ -109,29 +121,35 @@ public class BoatGroup extends RaceObject{
|
|||||||
|
|
||||||
estTimeToNextMarkObject.setX(ESTTIMETONEXTMARK_X_OFFSET);
|
estTimeToNextMarkObject.setX(ESTTIMETONEXTMARK_X_OFFSET);
|
||||||
estTimeToNextMarkObject.setY(ESTTIMETONEXTMARK_Y_OFFSET);
|
estTimeToNextMarkObject.setY(ESTTIMETONEXTMARK_Y_OFFSET);
|
||||||
estTimeToNextMarkObject.relocate(estTimeToNextMarkObject.getX(), estTimeToNextMarkObject.getY());
|
estTimeToNextMarkObject
|
||||||
|
.relocate(estTimeToNextMarkObject.getX(), estTimeToNextMarkObject.getY());
|
||||||
|
|
||||||
legTimeObject.setX(LEGTIME_X_OFFSET);
|
legTimeObject.setX(LEGTIME_X_OFFSET);
|
||||||
legTimeObject.setY(LEGTIME_Y_OFFSET);
|
legTimeObject.setY(LEGTIME_Y_OFFSET);
|
||||||
legTimeObject.relocate(legTimeObject.getX(), legTimeObject.getY());
|
legTimeObject.relocate(legTimeObject.getX(), legTimeObject.getY());
|
||||||
|
|
||||||
wake = new Wake(0, -BOAT_HEIGHT);
|
wake = new Wake(0, -BOAT_HEIGHT);
|
||||||
super.getChildren().addAll(teamNameObject, velocityObject, boatPoly, estTimeToNextMarkObject, legTimeObject);
|
super.getChildren()
|
||||||
|
.addAll(teamNameObject, velocityObject, boatPoly, estTimeToNextMarkObject,
|
||||||
|
legTimeObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the javafx objects that will be the in the group by default.
|
* Creates the javafx objects that will be the in the group by default.
|
||||||
|
*
|
||||||
* @param color The colour of the boat polygon and the trailing line.
|
* @param color The colour of the boat polygon and the trailing line.
|
||||||
*/
|
*/
|
||||||
private void initChildren (Color color) {
|
private void initChildren(Color color) {
|
||||||
initChildren(color,
|
initChildren(color,
|
||||||
-BOAT_WIDTH / 2, BOAT_HEIGHT / 2,
|
-BOAT_WIDTH / 2, BOAT_HEIGHT / 2,
|
||||||
0.0, -BOAT_HEIGHT / 2,
|
0.0, -BOAT_HEIGHT / 2,
|
||||||
BOAT_WIDTH / 2, BOAT_HEIGHT / 2);
|
BOAT_WIDTH / 2, BOAT_HEIGHT / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the boat and its children annotations from its current coordinates by specified amounts.
|
* Moves the boat and its children annotations from its current coordinates by specified
|
||||||
|
* amounts.
|
||||||
|
*
|
||||||
* @param dx The amount to move the X coordinate by
|
* @param dx The amount to move the X coordinate by
|
||||||
* @param dy The amount to move the Y coordinate by
|
* @param dy The amount to move the Y coordinate by
|
||||||
*/
|
*/
|
||||||
@@ -153,21 +171,23 @@ public class BoatGroup extends RaceObject{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the boat and its children annotations to coordinates specified
|
* Moves the boat and its children annotations to coordinates specified
|
||||||
|
*
|
||||||
* @param x The X coordinate to move the boat to
|
* @param x The X coordinate to move the boat to
|
||||||
* @param y The Y coordinate to move the boat to
|
* @param y The Y coordinate to move the boat to
|
||||||
* @param rotation The heading in degrees from north the boat should rotate to.
|
* @param rotation The heading in degrees from north the boat should rotate to.
|
||||||
*/
|
*/
|
||||||
public void moveTo (double x, double y, double rotation) {
|
public void moveTo(double x, double y, double rotation) {
|
||||||
rotateTo(rotation);
|
rotateTo(rotation);
|
||||||
moveTo(x, y);
|
moveTo(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the boat and its children annotations to coordinates specified
|
* Moves the boat and its children annotations to coordinates specified
|
||||||
|
*
|
||||||
* @param x The X coordinate to move the boat to
|
* @param x The X coordinate to move the boat to
|
||||||
* @param y The Y coordinate to move the boat to
|
* @param y The Y coordinate to move the boat to
|
||||||
*/
|
*/
|
||||||
public void moveTo (double x, double y) {
|
public void moveTo(double x, double y) {
|
||||||
boatPoly.setLayoutX(x);
|
boatPoly.setLayoutX(x);
|
||||||
boatPoly.setLayoutY(y);
|
boatPoly.setLayoutY(y);
|
||||||
teamNameObject.setLayoutX(x);
|
teamNameObject.setLayoutX(x);
|
||||||
@@ -185,9 +205,11 @@ public class BoatGroup extends RaceObject{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the position of all graphics in the BoatGroup based off of the given time interval.
|
* Updates the position of all graphics in the BoatGroup based off of the given time interval.
|
||||||
* @param timeInterval The interval, in milliseconds, the boat should update it's position based on.
|
*
|
||||||
|
* @param timeInterval The interval, in milliseconds, the boat should update it's position based
|
||||||
|
* on.
|
||||||
*/
|
*/
|
||||||
public void updatePosition (long timeInterval) {
|
public void updatePosition(long timeInterval) {
|
||||||
//Calculate the movement of the boat.
|
//Calculate the movement of the boat.
|
||||||
if (isMaximized) {
|
if (isMaximized) {
|
||||||
double dx = pixelVelocityX * timeInterval;
|
double dx = pixelVelocityX * timeInterval;
|
||||||
@@ -200,10 +222,10 @@ public class BoatGroup extends RaceObject{
|
|||||||
distanceTravelled = 0;
|
distanceTravelled = 0;
|
||||||
if (lastPoint != null) {
|
if (lastPoint != null) {
|
||||||
Line l = new Line(
|
Line l = new Line(
|
||||||
lastPoint.getX(),
|
lastPoint.getX(),
|
||||||
lastPoint.getY(),
|
lastPoint.getY(),
|
||||||
boatPoly.getLayoutX(),
|
boatPoly.getLayoutX(),
|
||||||
boatPoly.getLayoutY()
|
boatPoly.getLayoutY()
|
||||||
);
|
);
|
||||||
l.getStrokeDashArray().setAll(3d, 7d);
|
l.getStrokeDashArray().setAll(3d, 7d);
|
||||||
l.setStroke(boatPoly.getFill());
|
l.setStroke(boatPoly.getFill());
|
||||||
@@ -219,18 +241,21 @@ public class BoatGroup extends RaceObject{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the destination of the boat and the headng it should have once it reaches
|
* Sets the destination of the boat and the headng it should have once it reaches
|
||||||
|
*
|
||||||
* @param newXValue The X co-ordinate the boat needs to move to.
|
* @param newXValue The X co-ordinate the boat needs to move to.
|
||||||
* @param newYValue The Y co-ordinate the boat needs to move to.
|
* @param newYValue The Y co-ordinate the boat needs to move to.
|
||||||
* @param rotation Rotation to move graphics to.
|
* @param rotation Rotation to move graphics to.
|
||||||
* @param raceIds RaceID of the object to move.
|
* @param raceIds RaceID of the object to move.
|
||||||
*/
|
*/
|
||||||
public void setDestination (double newXValue, double newYValue, double rotation, double groundSpeed, int... raceIds) {
|
public void setDestination(double newXValue, double newYValue, double rotation,
|
||||||
|
double groundSpeed, int... raceIds) {
|
||||||
if (hasRaceId(raceIds)) {
|
if (hasRaceId(raceIds)) {
|
||||||
if (setToInitialLocation) {
|
if (setToInitialLocation) {
|
||||||
destinationSet = true;
|
destinationSet = true;
|
||||||
boat.setVelocity(groundSpeed);
|
boat.setVelocity(groundSpeed);
|
||||||
if (currentRotation < 0)
|
if (currentRotation < 0) {
|
||||||
currentRotation = 360 - currentRotation;
|
currentRotation = 360 - currentRotation;
|
||||||
|
}
|
||||||
double dx = newXValue - boatPoly.getLayoutX();
|
double dx = newXValue - boatPoly.getLayoutX();
|
||||||
double dy = newYValue - boatPoly.getLayoutY();
|
double dy = newYValue - boatPoly.getLayoutY();
|
||||||
//Check movement is reasonable. Assumes a 1000 * 1000 canvas
|
//Check movement is reasonable. Assumes a 1000 * 1000 canvas
|
||||||
@@ -251,14 +276,23 @@ public class BoatGroup extends RaceObject{
|
|||||||
rotationalVelocity = 0;
|
rotationalVelocity = 0;
|
||||||
wakeGenerationDelay--;
|
wakeGenerationDelay--;
|
||||||
} else {
|
} else {
|
||||||
wake.setRotationalVelocity(rotationalVelocity, rotationalGoal, boat.getVelocity());
|
wake.setRotationalVelocity(rotationalVelocity, rotationalGoal,
|
||||||
|
boat.getVelocity());
|
||||||
}
|
}
|
||||||
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
|
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");
|
DateFormat format = new SimpleDateFormat("mm:ss");
|
||||||
String timeToNextMark = format.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
// estimate time to next mark
|
||||||
|
String timeToNextMark = format
|
||||||
|
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
||||||
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
|
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
|
||||||
|
// elapsed time
|
||||||
|
if (boat.getMarkRoundingTime() != null) {
|
||||||
|
String elapsedTime = format
|
||||||
|
.format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime());
|
||||||
|
legTimeObject.setText("Last mark: " + elapsedTime);
|
||||||
|
} else {
|
||||||
|
legTimeObject.setText("Last mark: -");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setToInitialLocation = true;
|
setToInitialLocation = true;
|
||||||
rotationalGoal = rotation;
|
rotationalGoal = rotation;
|
||||||
@@ -269,14 +303,14 @@ public class BoatGroup extends RaceObject{
|
|||||||
if (!isMaximized) {
|
if (!isMaximized) {
|
||||||
setToInitialLocation = false;
|
setToInitialLocation = false;
|
||||||
wakeGenerationDelay = 2;
|
wakeGenerationDelay = 2;
|
||||||
if(setCallCount-- == 0) {
|
if (setCallCount-- == 0) {
|
||||||
setCallCount = 5;
|
setCallCount = 5;
|
||||||
if (lastPoint != null) {
|
if (lastPoint != null) {
|
||||||
Line l = new Line(
|
Line l = new Line(
|
||||||
lastPoint.getX(),
|
lastPoint.getX(),
|
||||||
lastPoint.getY(),
|
lastPoint.getY(),
|
||||||
newXValue,
|
newXValue,
|
||||||
newYValue
|
newYValue
|
||||||
);
|
);
|
||||||
l.getStrokeDashArray().setAll(3d, 7d);
|
l.getStrokeDashArray().setAll(3d, 7d);
|
||||||
l.setStroke(boatPoly.getFill());
|
l.setStroke(boatPoly.getFill());
|
||||||
@@ -289,28 +323,29 @@ public class BoatGroup extends RaceObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestination (double newXValue, double newYValue, double groundSpeed, int... raceIDs) {
|
public void setDestination(double newXValue, double newYValue, double groundSpeed,
|
||||||
|
int... raceIDs) {
|
||||||
destinationSet = true;
|
destinationSet = true;
|
||||||
|
|
||||||
if (hasRaceId(raceIDs)) {
|
if (hasRaceId(raceIDs)) {
|
||||||
double rotation = Math.abs(
|
double rotation = Math.abs(
|
||||||
Math.toDegrees(
|
Math.toDegrees(
|
||||||
Math.atan(
|
Math.atan(
|
||||||
(newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX())
|
(newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX())
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
setDestination(newXValue, newYValue, rotation, groundSpeed, raceIDs);
|
setDestination(newXValue, newYValue, rotation, groundSpeed, raceIDs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotateTo (double rotation) {
|
public void rotateTo(double rotation) {
|
||||||
currentRotation = rotation;
|
currentRotation = rotation;
|
||||||
boatPoly.getTransforms().setAll(new Rotate(rotation));
|
boatPoly.getTransforms().setAll(new Rotate(rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceRotation () {
|
public void forceRotation() {
|
||||||
rotateTo (rotationalGoal);
|
rotateTo(rotationalGoal);
|
||||||
wake.rotate(rotationalGoal);
|
wake.rotate(rotationalGoal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +361,7 @@ public class BoatGroup extends RaceObject{
|
|||||||
estTimeToNextMarkObject.setVisible(visible);
|
estTimeToNextMarkObject.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLegObjectTime(Boolean visible) {
|
public void setLegTimeObjectVisible(Boolean visible) {
|
||||||
legTimeObject.setVisible(visible);
|
legTimeObject.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,10 +383,11 @@ public class BoatGroup extends RaceObject{
|
|||||||
* @param raceIds The ID's to check the BoatGroup for.
|
* @param raceIds The ID's to check the BoatGroup for.
|
||||||
* @return True if the BoatGroup contains at east one of the given IDs, false otherwise.
|
* @return True if the BoatGroup contains at east one of the given IDs, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean hasRaceId (int... raceIds) {
|
public boolean hasRaceId(int... raceIds) {
|
||||||
for (int id : raceIds) {
|
for (int id : raceIds) {
|
||||||
if (id == boat.getSourceID())
|
if (id == boat.getSourceID()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -361,31 +397,32 @@ public class BoatGroup extends RaceObject{
|
|||||||
*
|
*
|
||||||
* @return An array containing all ID's associated with this RaceObject.
|
* @return An array containing all ID's associated with this RaceObject.
|
||||||
*/
|
*/
|
||||||
public int[] getRaceIds () {
|
public int[] getRaceIds() {
|
||||||
return new int[] {boat.getSourceID()};
|
return new int[]{boat.getSourceID()};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Due to javaFX limitations annotations associated with a boat that you want to appear below all boats in the
|
* Due to javaFX limitations annotations associated with a boat that you want to appear below
|
||||||
* Z-axis need to be pulled out of the BoatGroup and added to the parent group of the BoatGroups. This function
|
* all boats in the Z-axis need to be pulled out of the BoatGroup and added to the parent group
|
||||||
* returns these annotations as a group.
|
* of the BoatGroups. This function returns these annotations as a group.
|
||||||
*
|
*
|
||||||
* @return A group containing low priority annotations.
|
* @return A group containing low priority annotations.
|
||||||
*/
|
*/
|
||||||
public Group getLowPriorityAnnotations () {
|
public Group getLowPriorityAnnotations() {
|
||||||
Group group = new Group();
|
Group group = new Group();
|
||||||
group.getChildren().addAll(wake, lineGroup);
|
group.getChildren().addAll(wake, lineGroup);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this function to let the BoatGroup know about the stage it is in. If it knows about it's stage then it will
|
* Use this function to let the BoatGroup know about the stage it is in. If it knows about it's
|
||||||
* listen to the iconified property of that stage and change it's behaviour upon minimization. Without setting the
|
* stage then it will listen to the iconified property of that stage and change it's behaviour
|
||||||
* Stage there is guarantee that the BoatGroup will draw properly when the stage is minimized.
|
* upon minimization. Without setting the Stage there is guarantee that the BoatGroup will draw
|
||||||
|
* properly when the stage is minimized.
|
||||||
*
|
*
|
||||||
* @param stage The stage that the BoatGroup is added to.
|
* @param stage The stage that the BoatGroup is added to.
|
||||||
*/
|
*/
|
||||||
public void setStage (Stage stage) {
|
public void setStage(Stage stage) {
|
||||||
/* TODO: 4/05/17 cir27 - Find a way to get the stage to this point. Need to pass it through multiple controllers.
|
/* TODO: 4/05/17 cir27 - Find a way to get the stage to this point. Need to pass it through multiple controllers.
|
||||||
App.start() -> Controller.setContentPane -> RaceViewController -> CanvasController
|
App.start() -> Controller.setContentPane -> RaceViewController -> CanvasController
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<AnchorPane fx:id="annotationSelectWindow" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="248.0" prefWidth="469.0" styleClass="background-blue" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
<AnchorPane fx:id="annotationSelectWindow" maxHeight="270.0" maxWidth="469.0" minHeight="270.0" minWidth="469.0" prefHeight="270.0" prefWidth="469.0" styleClass="background-blue" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<children>
|
<children>
|
||||||
<Text fill="WHITE" layoutX="26.0" layoutY="52.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Select important annotations">
|
<Text fill="WHITE" layoutX="26.0" layoutY="52.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Select important annotations">
|
||||||
<font>
|
<font>
|
||||||
@@ -26,5 +26,6 @@
|
|||||||
<String fx:value="clearExitButton" />
|
<String fx:value="clearExitButton" />
|
||||||
</styleClass>
|
</styleClass>
|
||||||
</Button>
|
</Button>
|
||||||
|
<CheckBox fx:id="boatElapsedTimeSelect" layoutX="26.0" layoutY="235.0" mnemonicParsing="false" text="Boat Elapsed Time Since Last Mark" textFill="#e7e7e7" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
Reference in New Issue
Block a user