mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
fixes from merge #story[923]
This commit is contained in:
@@ -26,7 +26,7 @@ import seng302.controllers.annotations.ImportantAnnotationController;
|
||||
import seng302.controllers.annotations.ImportantAnnotationDelegate;
|
||||
import seng302.controllers.annotations.ImportantAnnotationsState;
|
||||
import seng302.models.*;
|
||||
import seng302.models.parsers.StreamParser;
|
||||
import seng302.models.stream.StreamParser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@@ -58,7 +58,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
private ArrayList<Yacht> startingBoats = new ArrayList<>();
|
||||
private boolean displayFps;
|
||||
private Timeline timerTimeline;
|
||||
private Race race;
|
||||
private Stage stage;
|
||||
|
||||
private ImportantAnnotationsState importantAnnotations;
|
||||
@@ -68,13 +67,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
// Load a default important annotation state
|
||||
importantAnnotations = new ImportantAnnotationsState();
|
||||
|
||||
//Initialise race controller
|
||||
RaceController raceController = new RaceController();
|
||||
raceController.initializeRace();
|
||||
race = raceController.getRace();
|
||||
|
||||
startingBoats = new ArrayList<>(Arrays.asList(race.getBoats()));
|
||||
|
||||
includedCanvasController.setup(this);
|
||||
includedCanvasController.initializeCanvas();
|
||||
initializeUpdateTimer();
|
||||
@@ -282,7 +274,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
*/
|
||||
private void loadRaceResultView() {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/FinishView.fxml"));
|
||||
loader.setController(new RaceResultController(race));
|
||||
|
||||
try {
|
||||
contentAnchorPane.getChildren().removeAll();
|
||||
@@ -335,11 +326,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
return displayFps;
|
||||
}
|
||||
|
||||
public Race getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the important annotations for a specific BoatGroup
|
||||
* @param bg The boat group to set the annotations for
|
||||
@@ -368,57 +354,48 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
} else {
|
||||
bg.setWakeVisible(false);
|
||||
}
|
||||
|
||||
if (importantAnnotations.getAnnotationState(Annotation.ESTTIMETONEXTMARK)) {
|
||||
bg.setEstTimeToNextMarkObjectVisible(true);
|
||||
} else {
|
||||
bg.setEstTimeToNextMarkObjectVisible(false);
|
||||
}
|
||||
|
||||
if (importantAnnotations.getAnnotationState(Annotation.LEGTIME)) {
|
||||
bg.setLegTimeObjectVisible(true);
|
||||
} else {
|
||||
bg.setLegTimeObjectVisible(false);
|
||||
}
|
||||
//TODO fix boat annotations with new boatgroup
|
||||
// if (importantAnnotations.getAnnotationState(Annotation.ESTTIMETONEXTMARK)) {
|
||||
// bg.setEstTimeToNextMarkObjectVisible(true);
|
||||
// } else {
|
||||
// bg.setEstTimeToNextMarkObjectVisible(false);
|
||||
// }
|
||||
//
|
||||
// if (importantAnnotations.getAnnotationState(Annotation.LEGTIME)) {
|
||||
// bg.setLegTimeObjectVisible(true);
|
||||
// } else {
|
||||
// bg.setLegTimeObjectVisible(false);
|
||||
// }
|
||||
}
|
||||
|
||||
private void setAnnotations(Integer annotationLevel) {
|
||||
switch (annotationLevel) {
|
||||
// No Annotations
|
||||
case 0:
|
||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||
if (ro instanceof BoatGroup) {
|
||||
BoatGroup bg = (BoatGroup) ro;
|
||||
bg.setTeamNameObjectVisible(false);
|
||||
bg.setVelocityObjectVisible(false);
|
||||
bg.setEstTimeToNextMarkObjectVisible(false);
|
||||
bg.setLegTimeObjectVisible(false);
|
||||
bg.setLineGroupVisible(false);
|
||||
bg.setWakeVisible(false);
|
||||
}
|
||||
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||
bg.setTeamNameObjectVisible(false);
|
||||
bg.setVelocityObjectVisible(false);
|
||||
// bg.setEstTimeToNextMarkObjectVisible(false);
|
||||
// bg.setLegTimeObjectVisible(false);
|
||||
bg.setLineGroupVisible(false);
|
||||
bg.setWakeVisible(false);
|
||||
}
|
||||
break;
|
||||
// Important Annotations
|
||||
case 1:
|
||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||
if (ro instanceof BoatGroup) {
|
||||
BoatGroup bg = (BoatGroup) ro;
|
||||
setBoatGroupImportantAnnotations(bg);
|
||||
}
|
||||
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||
setBoatGroupImportantAnnotations(bg);
|
||||
}
|
||||
break;
|
||||
// All Annotations
|
||||
case 2:
|
||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||
if (ro instanceof BoatGroup) {
|
||||
BoatGroup bg = (BoatGroup) ro;
|
||||
bg.setTeamNameObjectVisible(true);
|
||||
bg.setVelocityObjectVisible(true);
|
||||
bg.setEstTimeToNextMarkObjectVisible(true);
|
||||
bg.setLegTimeObjectVisible(true);
|
||||
bg.setLineGroupVisible(true);
|
||||
bg.setWakeVisible(true);
|
||||
}
|
||||
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||
bg.setTeamNameObjectVisible(true);
|
||||
bg.setVelocityObjectVisible(true);
|
||||
// bg.setEstTimeToNextMarkObjectVisible(true);
|
||||
// bg.setLegTimeObjectVisible(true);
|
||||
bg.setLineGroupVisible(true);
|
||||
bg.setWakeVisible(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -431,18 +408,16 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
* @param yacht The yacht for which we want to view all annotations
|
||||
*/
|
||||
private void setSelectedBoat(Yacht yacht) {
|
||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
||||
if (ro instanceof BoatGroup) {
|
||||
BoatGroup bg = (BoatGroup) ro;
|
||||
//We need to iterate over all race groups to get the matching boat group belonging to this boat if we
|
||||
//are to toggle its annotations, there is no other backwards knowledge of a yacht to its boatgroup.
|
||||
if (bg.getBoat().getHullID().equals(yacht.getHullID())) {
|
||||
bg.setIsSelected(true);
|
||||
selectedBoat = yacht;
|
||||
} else {
|
||||
bg.setIsSelected(false);
|
||||
}
|
||||
}
|
||||
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||
//We need to iterate over all race groups to get the matching boat group belonging to this boat if we
|
||||
//are to toggle its annotations, there is no other backwards knowledge of a yacht to its boatgroup.
|
||||
//TODO fix boat selection with new boatgroup
|
||||
// if (bg.getBoat().getHullID().equals(yacht.getHullID())) {
|
||||
// bg.setIsSelected(true);
|
||||
// selectedBoat = yacht;
|
||||
// } else {
|
||||
// bg.setIsSelected(false);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.paint.Color;
|
||||
import seng302.models.Yacht;
|
||||
import seng302.models.parsers.StreamParser;
|
||||
import seng302.models.stream.StreamParser;
|
||||
|
||||
public class StartScreenController implements Initializable {
|
||||
@FXML
|
||||
|
||||
Reference in New Issue
Block a user