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.ImportantAnnotationDelegate;
|
||||||
import seng302.controllers.annotations.ImportantAnnotationsState;
|
import seng302.controllers.annotations.ImportantAnnotationsState;
|
||||||
import seng302.models.*;
|
import seng302.models.*;
|
||||||
import seng302.models.parsers.StreamParser;
|
import seng302.models.stream.StreamParser;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -58,7 +58,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
private ArrayList<Yacht> startingBoats = new ArrayList<>();
|
private ArrayList<Yacht> startingBoats = new ArrayList<>();
|
||||||
private boolean displayFps;
|
private boolean displayFps;
|
||||||
private Timeline timerTimeline;
|
private Timeline timerTimeline;
|
||||||
private Race race;
|
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
|
|
||||||
private ImportantAnnotationsState importantAnnotations;
|
private ImportantAnnotationsState importantAnnotations;
|
||||||
@@ -68,13 +67,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// Load a default important annotation state
|
// Load a default important annotation state
|
||||||
importantAnnotations = new ImportantAnnotationsState();
|
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.setup(this);
|
||||||
includedCanvasController.initializeCanvas();
|
includedCanvasController.initializeCanvas();
|
||||||
initializeUpdateTimer();
|
initializeUpdateTimer();
|
||||||
@@ -282,7 +274,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
*/
|
*/
|
||||||
private void loadRaceResultView() {
|
private void loadRaceResultView() {
|
||||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/FinishView.fxml"));
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/FinishView.fxml"));
|
||||||
loader.setController(new RaceResultController(race));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
contentAnchorPane.getChildren().removeAll();
|
contentAnchorPane.getChildren().removeAll();
|
||||||
@@ -335,11 +326,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
return displayFps;
|
return displayFps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Race getRace() {
|
|
||||||
return race;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -368,58 +354,49 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
} else {
|
} else {
|
||||||
bg.setWakeVisible(false);
|
bg.setWakeVisible(false);
|
||||||
}
|
}
|
||||||
|
//TODO fix boat annotations with new boatgroup
|
||||||
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)) {
|
// if (importantAnnotations.getAnnotationState(Annotation.LEGTIME)) {
|
||||||
bg.setLegTimeObjectVisible(true);
|
// bg.setLegTimeObjectVisible(true);
|
||||||
} else {
|
// } else {
|
||||||
bg.setLegTimeObjectVisible(false);
|
// bg.setLegTimeObjectVisible(false);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAnnotations(Integer annotationLevel) {
|
private void setAnnotations(Integer annotationLevel) {
|
||||||
switch (annotationLevel) {
|
switch (annotationLevel) {
|
||||||
// No Annotations
|
// No Annotations
|
||||||
case 0:
|
case 0:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||||
if (ro instanceof BoatGroup) {
|
|
||||||
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.setLegTimeObjectVisible(false);
|
||||||
bg.setLineGroupVisible(false);
|
bg.setLineGroupVisible(false);
|
||||||
bg.setWakeVisible(false);
|
bg.setWakeVisible(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
// Important Annotations
|
// Important Annotations
|
||||||
case 1:
|
case 1:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||||
if (ro instanceof BoatGroup) {
|
|
||||||
BoatGroup bg = (BoatGroup) ro;
|
|
||||||
setBoatGroupImportantAnnotations(bg);
|
setBoatGroupImportantAnnotations(bg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
// All Annotations
|
// All Annotations
|
||||||
case 2:
|
case 2:
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||||
if (ro instanceof BoatGroup) {
|
|
||||||
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.setLegTimeObjectVisible(true);
|
||||||
bg.setLineGroupVisible(true);
|
bg.setLineGroupVisible(true);
|
||||||
bg.setWakeVisible(true);
|
bg.setWakeVisible(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,18 +408,16 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
* @param yacht The yacht for which we want to view all annotations
|
* @param yacht The yacht for which we want to view all annotations
|
||||||
*/
|
*/
|
||||||
private void setSelectedBoat(Yacht yacht) {
|
private void setSelectedBoat(Yacht yacht) {
|
||||||
for (RaceObject ro : includedCanvasController.getRaceObjects()) {
|
for (BoatGroup bg : includedCanvasController.getBoatGroups()) {
|
||||||
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
|
//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.
|
//are to toggle its annotations, there is no other backwards knowledge of a yacht to its boatgroup.
|
||||||
if (bg.getBoat().getHullID().equals(yacht.getHullID())) {
|
//TODO fix boat selection with new boatgroup
|
||||||
bg.setIsSelected(true);
|
// if (bg.getBoat().getHullID().equals(yacht.getHullID())) {
|
||||||
selectedBoat = yacht;
|
// bg.setIsSelected(true);
|
||||||
} else {
|
// selectedBoat = yacht;
|
||||||
bg.setIsSelected(false);
|
// } else {
|
||||||
}
|
// bg.setIsSelected(false);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import javafx.scene.layout.GridPane;
|
|||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import seng302.models.Yacht;
|
import seng302.models.Yacht;
|
||||||
import seng302.models.parsers.StreamParser;
|
import seng302.models.stream.StreamParser;
|
||||||
|
|
||||||
public class StartScreenController implements Initializable {
|
public class StartScreenController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package seng302.models.parsers;
|
package seng302.models.stream;
|
||||||
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import seng302.models.Yacht;
|
import seng302.models.Yacht;
|
||||||
import seng302.models.parsers.packets.BoatPositionPacket;
|
import seng302.models.stream.packets.BoatPositionPacket;
|
||||||
import seng302.models.parsers.packets.StreamPacket;
|
import seng302.models.stream.packets.StreamPacket;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
@@ -19,6 +19,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
import java.util.concurrent.PriorityBlockingQueue;
|
import java.util.concurrent.PriorityBlockingQueue;
|
||||||
|
import seng302.models.stream.XMLParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The purpose of this class is to take in the stream of divided packets so they can be read
|
* The purpose of this class is to take in the stream of divided packets so they can be read
|
||||||
|
|||||||
Reference in New Issue
Block a user