Merge branch 'storyA_sounds' into storyD-3D

# Conflicts:
#	racevisionGame/src/main/java/visualiser/layout/SeaSurface.java
#	racevisionGame/src/main/java/visualiser/layout/SkyBox.java
main
Joseph Gardner 8 years ago
commit 7b076f3718

@ -21,7 +21,7 @@ public class App extends Application {
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
try { try {
//TODO should read a configuration file to configure server? //TODO should read a configuration file to configure server?
Event raceEvent = new Event(false); Event raceEvent = new Event(false, 0);
} catch (Exception e) { } catch (Exception e) {

@ -18,6 +18,7 @@ import shared.exceptions.InvalidRegattaDataException;
import shared.exceptions.XMLReaderException; import shared.exceptions.XMLReaderException;
import shared.model.Bearing; import shared.model.Bearing;
import shared.model.Constants; import shared.model.Constants;
import shared.xml.XMLUtilities;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
@ -70,6 +71,8 @@ public class Event {
private Thread connectionThread; private Thread connectionThread;
private int mapIndex;
@ -79,11 +82,29 @@ public class Event {
* @param singlePlayer Whether or not to create a single player event. * @param singlePlayer Whether or not to create a single player event.
* @throws EventConstructionException Thrown if we cannot create an Event for any reason. * @throws EventConstructionException Thrown if we cannot create an Event for any reason.
*/ */
public Event(boolean singlePlayer) throws EventConstructionException { public Event(boolean singlePlayer, int mapIndex) throws EventConstructionException {
this.mapIndex = mapIndex;
String raceXMLFile = "mock/mockXML/raceThreePlayers.xml"; String raceXMLFile;
String boatsXMLFile = "mock/mockXML/boatTest.xml"; String boatsXMLFile = "mock/mockXML/boatTest.xml";
String regattaXMLFile = "mock/mockXML/regattaTest.xml"; String regattaXMLFile = "mock/mockXML/regattaTest.xml";
switch (mapIndex){
case 0:raceXMLFile = "mock/mockXML/raceSixPlayers.xml";
break;
case 1:raceXMLFile = "mock/mockXML/oMapLayout.xml";
break;
case 2: raceXMLFile = "mock/mockXML/iMapLayout.xml";
break;
case 3: raceXMLFile = "mock/mockXML/mMapLayout.xml";
break;
case 4:
raceXMLFile = "mock/mockXML/raceTutorial.xml";
boatsXMLFile = "mock/mockXML/boatTutorial.xml";
regattaXMLFile = "mock/mockXML/regattaTutorial.xml";
break;
default: raceXMLFile = "mock/mockXML/raceSixPlayers.xml";
}
if (singlePlayer) { if (singlePlayer) {
raceXMLFile = "mock/mockXML/raceSinglePlayer.xml"; raceXMLFile = "mock/mockXML/raceSinglePlayer.xml";
@ -95,7 +116,9 @@ public class Event {
//this.raceXML = RaceXMLCreator.alterRaceToWind(raceXMLFile, 90); //this.raceXML = RaceXMLCreator.alterRaceToWind(raceXMLFile, 90);
this.raceXML = XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8); this.raceXML = XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8);
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8)); this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
if(mapIndex==4){
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8), 1000, 5000);
}
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8); this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8); this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8);
@ -178,9 +201,14 @@ public class Event {
* @return String containing edited xml * @return String containing edited xml
*/ */
public static String setRaceXMLAtCurrentTimeToNow(String raceXML) { public static String setRaceXMLAtCurrentTimeToNow(String raceXML) {
return setRaceXMLAtCurrentTimeToNow(raceXML, Constants.RacePreStartTime, Constants.RacePreparatoryTime);
}
public static String setRaceXMLAtCurrentTimeToNow(String raceXML, long racePreStartTime, long racePreparatoryTime){
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute. //The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
long millisecondsToAdd = Constants.RacePreStartTime + 1 * 60 * 1000;
long millisecondsToAdd = racePreStartTime + racePreparatoryTime;
long secondsToAdd = millisecondsToAdd / 1000; long secondsToAdd = millisecondsToAdd / 1000;
//Scale the time using our time scalar. //Scale the time using our time scalar.
secondsToAdd = secondsToAdd / Constants.RaceTimeScale; secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
@ -190,7 +218,6 @@ public class Event {
raceXML = raceXML.replace("RACE_CREATION_TIME", dateFormat.format(creationTime)); raceXML = raceXML.replace("RACE_CREATION_TIME", dateFormat.format(creationTime));
raceXML = raceXML.replace("RACE_START_TIME", dateFormat.format(creationTime.plusSeconds(secondsToAdd))); raceXML = raceXML.replace("RACE_START_TIME", dateFormat.format(creationTime.plusSeconds(secondsToAdd)));
return raceXML; return raceXML;
} }

@ -11,6 +11,7 @@ import network.Messages.Enums.RaceStatusEnum;
import network.Messages.LatestMessages; import network.Messages.LatestMessages;
import shared.model.RunnableWithFramePeriod; import shared.model.RunnableWithFramePeriod;
import java.util.ArrayList;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
@ -138,6 +139,8 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
*/ */
private void raceLoop() { private void raceLoop() {
ArrayList<MockBoat> collisionBoats = new ArrayList<>();
long previousFrameTime = System.currentTimeMillis(); long previousFrameTime = System.currentTimeMillis();
while (race.getRaceStatusEnum() != RaceStatusEnum.FINISHED && loopBool) { while (race.getRaceStatusEnum() != RaceStatusEnum.FINISHED && loopBool) {
@ -163,9 +166,17 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
//If it is still racing, update its position. //If it is still racing, update its position.
if (boat.getStatus() == BoatStatusEnum.RACING) { if (boat.getStatus() == BoatStatusEnum.RACING) {
race.updatePosition(boat, framePeriod, race.getRaceClock().getDurationMilli()); race.updatePosition(boat, framePeriod, race.getRaceClock().getDurationMilli());
race.getColliderRegistry().rayCast(boat);
if(race.getColliderRegistry().rayCast(boat)){
System.out.println("Collision!");
//Add boat to list
collisionBoats.add(boat);
}
//System.out.println(race.getColliderRegistry().rayCast(boat));
} }
} }
} else { } else {
@ -178,9 +189,14 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
// Change wind direction // Change wind direction
race.changeWindDirection(); race.changeWindDirection();
//Pass collision boats in
server.parseBoatCollisions(collisionBoats);
//Parse the race snapshot. //Parse the race snapshot.
server.parseSnapshot(); server.parseSnapshot();
collisionBoats.clear();
//Update the last frame time. //Update the last frame time.
previousFrameTime = currentTime; previousFrameTime = currentTime;
} }

@ -3,6 +3,7 @@ package mock.model;
import network.AckSequencer; import network.AckSequencer;
import network.Messages.*; import network.Messages.*;
import network.Messages.Enums.BoatLocationDeviceEnum; import network.Messages.Enums.BoatLocationDeviceEnum;
import network.Messages.Enums.YachtEventEnum;
import network.Messages.Enums.XMLMessageType; import network.Messages.Enums.XMLMessageType;
import shared.model.Bearing; import shared.model.Bearing;
import shared.model.CompoundMark; import shared.model.CompoundMark;
@ -23,6 +24,7 @@ import java.util.logging.Logger;
public class RaceServer { public class RaceServer {
private MockRace race; private MockRace race;
private LatestMessages latestMessages; private LatestMessages latestMessages;
private List<YachtEvent> collisionEvents = new ArrayList<>();
/** /**
@ -67,9 +69,19 @@ public class RaceServer {
//Parse the race status. //Parse the race status.
snapshotMessages.add(parseRaceStatus()); snapshotMessages.add(parseRaceStatus());
//Parse collisions
if(collisionEvents.size()>0){
snapshotMessages.addAll(collisionEvents);
}
latestMessages.setSnapshot(snapshotMessages); latestMessages.setSnapshot(snapshotMessages);
updateXMLFiles(); updateXMLFiles();
//Reset collision list
collisionEvents.clear();
//System.out.println(collisionEvents.size());
} }
@ -307,4 +319,28 @@ public class RaceServer {
return message; return message;
} }
/**
* Parse the yacht event and return it
* @param boat yacht with event
* @param event event that happened
* @return yacht event
*/
private YachtEvent parseYachtEvent(MockBoat boat, YachtEventEnum event){
YachtEvent yachtEvent = new YachtEvent(
System.currentTimeMillis(),
this.boatLocationSequenceNumber,
race.getRaceId(),
boat.getSourceID(),
1337,
event);
return yachtEvent;
}
public void parseBoatCollisions(ArrayList<MockBoat> boats){
for (MockBoat boat : boats){
collisionEvents.add(parseYachtEvent(boat, YachtEventEnum.COLLISION));
}
}
} }

@ -42,14 +42,12 @@ public class SourceIdAllocator {
} }
List<Integer> allocatedIDs = mockRace.getRaceDataSource().getParticipants(); List<Integer> allocatedIDs = mockRace.getRaceDataSource().getParticipants();
System.out.println(allocatedIDs);
List<Integer> allIDs = new ArrayList<>(mockRace.getBoatDataSource().getBoats().keySet()); List<Integer> allIDs = new ArrayList<>(mockRace.getBoatDataSource().getBoats().keySet());
System.out.println(allIDs);
//Get list of unallocated ids. //Get list of unallocated ids.
List<Integer> unallocatedIDs = new ArrayList<>(allIDs); List<Integer> unallocatedIDs = new ArrayList<>(allIDs);
unallocatedIDs.removeAll(allocatedIDs); unallocatedIDs.removeAll(allocatedIDs);
System.out.println(unallocatedIDs.isEmpty());
if (!unallocatedIDs.isEmpty()) { if (!unallocatedIDs.isEmpty()) {

@ -32,6 +32,8 @@ public abstract class Collider extends Observable implements Locatable {
notifyObservers(collision); notifyObservers(collision);
this.setChanged(); this.setChanged();
//Send out packet to all boats
return true; return true;
} else return false; } else return false;
} }

@ -1,7 +1,7 @@
package mock.model.commandFactory; package mock.model.commandFactory;
import java.util.ArrayDeque;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
/** /**
* Wraps multiple commands into a composite to execute queued commands during a frame. * Wraps multiple commands into a composite to execute queued commands during a frame.
@ -10,15 +10,15 @@ public class CompositeCommand implements Command {
private Queue<Command> commands; private Queue<Command> commands;
public CompositeCommand() { public CompositeCommand() {
this.commands = new ArrayDeque<>(); this.commands = new ConcurrentLinkedDeque<>();
} }
public void addCommand(Command command) { public void addCommand(Command command) {
commands.add(command); commands.offer(command);
} }
@Override @Override
public void execute() { public void execute() {
while(!commands.isEmpty()) commands.remove().execute(); while(commands.peek() != null) commands.poll().execute();
} }
} }

@ -39,14 +39,14 @@ public class Constants {
* The race pre-start time, in milliseconds. 3 minutes (30 seconds for development). * The race pre-start time, in milliseconds. 3 minutes (30 seconds for development).
*/ */
// public static final long RacePreStartTime = 30 * 1000; // public static final long RacePreStartTime = 30 * 1000;
public static final long RacePreStartTime = 6 * 1000; public static final long RacePreStartTime = 1000;
/** /**
* The race preparatory time, in milliseconds. 1 minute. * The race preparatory time, in milliseconds. 1 minute.
*/ */
// public static final long RacePreparatoryTime = 60 * 1000; // public static final long RacePreparatoryTime = 60 * 1000;
public static final long RacePreparatoryTime = 6 * 1000; public static final long RacePreparatoryTime = 1 * 60 * 1000;

@ -0,0 +1,39 @@
package visualiser.Commands.VisualiserRaceCommands;
import javafx.scene.media.AudioClip;
import mock.model.commandFactory.Command;
import network.Messages.YachtEvent;
import visualiser.model.VisualiserRaceState;
/**
* Created by zwu18 on 4/09/17.
*/
public class BoatCollisionCommand implements Command {
YachtEvent yachtEvent;
VisualiserRaceState visualiserRace;
public BoatCollisionCommand(YachtEvent yachtEvent, VisualiserRaceState visualiserRace){
this.yachtEvent = yachtEvent;
this.visualiserRace = visualiserRace;
}
@Override
public void execute() {
if(visualiserRace.getPlayerBoatID()==yachtEvent.getSourceID()){
System.out.println("I crashed!");
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/collision.wav").toExternalForm());
sound.play();
} else {
System.out.println("Someone else crashed!");
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/quietcollision.wav").toExternalForm());
sound.play();
}
//System.out.println("Collision command executed!");
}
}

@ -1,5 +1,6 @@
package visualiser.Commands.VisualiserRaceCommands; package visualiser.Commands.VisualiserRaceCommands;
import javafx.scene.media.AudioClip;
import mock.model.commandFactory.Command; import mock.model.commandFactory.Command;
import network.Messages.BoatStatus; import network.Messages.BoatStatus;
import network.Messages.Enums.BoatStatusEnum; import network.Messages.Enums.BoatStatusEnum;
@ -176,6 +177,10 @@ public class RaceStatusCommand implements Command {
//Record order in which boat finished leg. //Record order in which boat finished leg.
visualiserRace.getLegCompletionOrder().get(boat.getCurrentLeg()).add(boat); visualiserRace.getLegCompletionOrder().get(boat.getCurrentLeg()).add(boat);
//play sound
AudioClip sound = new AudioClip(getClass().getResource("/visualiser/sounds/passmark.wav").toExternalForm());
sound.play();
//Update boat. //Update boat.
boat.setCurrentLeg(leg); boat.setCurrentLeg(leg);
boat.setTimeAtLastMark(visualiserRace.getRaceClock().getCurrentTime()); boat.setTimeAtLastMark(visualiserRace.getRaceClock().getCurrentTime());

@ -23,7 +23,9 @@ public class VisualiserRaceCommandFactory {
switch (message.getType()) { switch (message.getType()) {
case BOATLOCATION: return new BoatLocationCommand((BoatLocation) message, visualiserRace); case BOATLOCATION:
//System.out.println("Boat location received");
return new BoatLocationCommand((BoatLocation) message, visualiserRace);
case RACESTATUS: return new RaceStatusCommand((RaceStatus) message, visualiserRace); case RACESTATUS: return new RaceStatusCommand((RaceStatus) message, visualiserRace);
@ -31,6 +33,11 @@ public class VisualiserRaceCommandFactory {
case ASSIGN_PLAYER_BOAT: return new AssignPlayerBoatCommand((AssignPlayerBoat) message, visualiserRace); case ASSIGN_PLAYER_BOAT: return new AssignPlayerBoatCommand((AssignPlayerBoat) message, visualiserRace);
case YACHTEVENTCODE:
return new BoatCollisionCommand((YachtEvent) message, visualiserRace);
default: throw new CommandConstructionException("Could not create VisualiserRaceCommand. Unrecognised or unsupported MessageType: " + message.getType()); default: throw new CommandConstructionException("Could not create VisualiserRaceCommand. Unrecognised or unsupported MessageType: " + message.getType());
} }

@ -1,28 +1,29 @@
package visualiser.Controllers; package visualiser.Controllers;
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
import javafx.animation.AnimationTimer;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert; import javafx.scene.control.Button;
import javafx.scene.control.ButtonType; import javafx.scene.control.TextField;
import javafx.scene.control.SplitPane; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.shape.MeshView; import javafx.stage.Stage;
import javafx.scene.media.AudioClip;
import mock.app.Event; import mock.app.Event;
import org.xml.sax.SAXException;
import mock.exceptions.EventConstructionException; import mock.exceptions.EventConstructionException;
import visualiser.layout.Plane3D; import shared.exceptions.InvalidBoatDataException;
import visualiser.layout.SeaSurface; import shared.exceptions.InvalidRaceDataException;
import visualiser.layout.Subject3D; import shared.exceptions.InvalidRegattaDataException;
import visualiser.layout.View3D; import shared.exceptions.XMLReaderException;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException; import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import java.net.URL; import java.net.URL;
import java.util.Optional; import java.util.ArrayList;
import java.util.Arrays;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -33,69 +34,48 @@ import java.util.logging.Logger;
public class HostController extends Controller { public class HostController extends Controller {
// @FXML
// TextField gameNameField;
//
// @FXML
// TextField hostNameField;
@FXML @FXML
private ImageView imageView; TextField gameNameField;
@FXML @FXML
AnchorPane hostWrapper; TextField hostNameField;
@FXML @FXML
AnchorPane imagePane; AnchorPane hostWrapper;
@FXML @FXML
SplitPane splitPane; Button previousButton;
@FXML @FXML
AnchorPane specPane; Button nextButton;
@FXML @FXML
GridPane playerContainer; ImageView mapImage;
private Event game; private Event game;
private View3D view3D; private ArrayList<Image> listOfMaps;
private int currentMapIndex = 0;
@Override
public void initialize(URL location, ResourceBundle resources) {
ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
view3D = new View3D();
view3D.setItems(subjects);
playerContainer.add(view3D, 0,0);
URL asset = HostController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
StlMeshImporter importer = new StlMeshImporter(); @Override
importer.read(asset); public void initialize(URL location, ResourceBundle resources){
Subject3D subject = new Subject3D(new MeshView(importer.getImport())); Image ac35Map = new Image(getClass().getClassLoader().getResourceAsStream("images/AC35_Racecourse_MAP.png"));
Image oMap = new Image(getClass().getClassLoader().getResourceAsStream("images/oMapLayout.png"));
subjects.add(subject); Image iMap = new Image(getClass().getClassLoader().getResourceAsStream("images/iMapLayout.png"));
Image mMap = new Image(getClass().getClassLoader().getResourceAsStream("images/mMapLayout.png"));
view3D.setDistance(50);
view3D.setYaw(45); listOfMaps = new ArrayList(Arrays.asList(ac35Map, oMap, iMap, mMap));
view3D.setPitch(20); mapImage.setImage(listOfMaps.get(currentMapIndex));
AnimationTimer rotate = new AnimationTimer() {
@Override
public void handle(long now) {
subject.setHeading(subject.getHeading().getAngle() + 0.1);
}
};
rotate.start();
} }
/** /**
* Hosts a game * Hosts a game
* @throws IOException if socket cannot be connected to
*/ */
public void hostGamePressed() { public void hostGamePressed() throws IOException{
try { try {
this.game = new Event(false); this.game = new Event(false, currentMapIndex);
connectSocket("localhost", 4942); connectSocket("localhost", 4942);
} catch (EventConstructionException e) { } catch (EventConstructionException e) {
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e); Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
@ -128,10 +108,7 @@ public class HostController extends Controller {
* Hosts a game. * Hosts a game.
*/ */
public void hostGame(){ public void hostGame(){
splitPane.setResizableWithParent(specPane, false); mapImage.fitWidthProperty().bind(((Stage) mapImage.getScene().getWindow()).widthProperty().multiply(0.6));
splitPane.lookupAll(".split-pane-divider").stream().forEach(div -> div.setMouseTransparent(true));
imageView.fitWidthProperty().bind(imagePane.widthProperty());
imageView.fitHeightProperty().bind(imagePane.heightProperty());
hostWrapper.setVisible(true); hostWrapper.setVisible(true);
} }
@ -139,23 +116,33 @@ public class HostController extends Controller {
* Menu button pressed. Prompt alert then return to menu * Menu button pressed. Prompt alert then return to menu
*/ */
public void menuBtnPressed(){ public void menuBtnPressed(){
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
alert.setTitle("Quitting race"); sound.play();
alert.setContentText("Do you wish to quit the race?"); hostWrapper.setVisible(false);
alert.setHeaderText("You are about to quit the race"); parent.enterTitle();
Optional<ButtonType> result = alert.showAndWait();
if(result.get() == ButtonType.OK){
hostWrapper.setVisible(false);
parent.enterTitle();
}
} }
/** public void nextImage(){
* Start button pressed. Currently only prints out start increaseIndex();
*/ mapImage.setImage(listOfMaps.get(currentMapIndex));
public void startBtnPressed(){ }
//System.out.println("Should start the race. This button is only visible for the host");
hostGamePressed(); public void previousImage(){
decreaseIndex();
mapImage.setImage(listOfMaps.get(currentMapIndex));
}
private void increaseIndex(){
currentMapIndex = (currentMapIndex + 1)%listOfMaps.size();
} }
private void decreaseIndex(){
currentMapIndex = ((((currentMapIndex - 1)%listOfMaps.size())+listOfMaps.size())%listOfMaps.size());
}
public void setGameType(int gameType){
this.currentMapIndex = gameType;
}
public int getGameType(){ return this.currentMapIndex; }
} }

@ -8,6 +8,7 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import visualiser.model.RaceConnection; import visualiser.model.RaceConnection;
import java.io.IOException; import java.io.IOException;
@ -39,6 +40,8 @@ public class LobbyController extends Controller {
private ObservableList<RaceConnection> connections; private ObservableList<RaceConnection> connections;
private AudioClip sound;
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
@ -66,6 +69,8 @@ public class LobbyController extends Controller {
* Refreshes the connections in the lobby * Refreshes the connections in the lobby
*/ */
public void refreshBtnPressed(){ public void refreshBtnPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
for(RaceConnection connection: connections) { for(RaceConnection connection: connections) {
connection.check(); connection.check();
} }
@ -93,6 +98,8 @@ public class LobbyController extends Controller {
} }
public void menuBtnPressed(){ public void menuBtnPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
lobbyWrapper.setVisible(false); lobbyWrapper.setVisible(false);
parent.enterTitle(); parent.enterTitle();
} }
@ -101,6 +108,8 @@ public class LobbyController extends Controller {
* adds a new connection * adds a new connection
*/ */
public void addConnectionPressed(){ public void addConnectionPressed(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
String hostName = addressFld.getText(); String hostName = addressFld.getText();
String portString = portFld.getText(); String portString = portFld.getText();
try{ try{

@ -3,6 +3,8 @@ package visualiser.Controllers;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.media.AudioClip;
import visualiser.app.App;
import visualiser.gameController.ControllerClient; import visualiser.gameController.ControllerClient;
import visualiser.model.VisualiserBoat; import visualiser.model.VisualiserBoat;
import visualiser.model.VisualiserRaceEvent; import visualiser.model.VisualiserRaceEvent;
@ -26,6 +28,8 @@ public class MainController extends Controller {
@FXML private HostController hostController; @FXML private HostController hostController;
@FXML private LobbyController lobbyController; @FXML private LobbyController lobbyController;
private AudioClip sound;
/** /**
* Ctor. * Ctor.
@ -53,6 +57,8 @@ public class MainController extends Controller {
* @param isHost is connection a host * @param isHost is connection a host
*/ */
public void enterLobby(Socket socket, Boolean isHost) { public void enterLobby(Socket socket, Boolean isHost) {
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
startController.enterLobby(socket, isHost); startController.enterLobby(socket, isHost);
} }
@ -74,18 +80,38 @@ public class MainController extends Controller {
/** /**
* Transitions into lobby screen * Transitions into lobby screen
*/ */
public void enterLobby(){ lobbyController.enterLobby(); } public void enterLobby(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
lobbyController.enterLobby(); }
/** /**
* Transitions into host game screen * Transitions into host game screen
*/ */
public void hostGame(){ hostController.hostGame(); } public void hostGame(){
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
hostController.hostGame(); }
/** /**
* Sets up the css for the start of the program * Sets up the css for the start of the program
*/ */
public void startCss(){titleController.setDayMode();} public void startCss(){titleController.setDayMode();}
/**
* host controller host a game
* @throws IOException throws exception
*/
public void beginGame() throws IOException {
hostController.hostGamePressed();
}
public void setGameType(int gameType){
hostController.setGameType(gameType);
}
public int getGameType(){ return hostController.getGameType(); }
/** /**
* Main Controller for the applications will house the menu and the displayed pane. * Main Controller for the applications will house the menu and the displayed pane.
* *

@ -3,6 +3,7 @@ package visualiser.Controllers;
import com.interactivemesh.jfx.importer.stl.StlMeshImporter; import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
import javafx.animation.AnimationTimer; import javafx.animation.AnimationTimer;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -18,14 +19,20 @@ import javafx.scene.input.KeyEvent;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.paint.Material;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.shape.MeshView; import javafx.scene.shape.MeshView;
import javafx.scene.shape.Shape3D;
import javafx.scene.shape.Sphere;
import javafx.scene.transform.Translate; import javafx.scene.transform.Translate;
import javafx.util.Callback; import javafx.util.Callback;
import network.Messages.Enums.RaceStatusEnum; import network.Messages.Enums.RaceStatusEnum;
import shared.dataInput.RaceDataSource; import shared.dataInput.RaceDataSource;
import shared.model.Leg; import shared.exceptions.BoatNotFoundException;
import shared.model.Mark; import shared.model.*;
import visualiser.app.App; import visualiser.app.App;
import visualiser.enums.TutorialState;
import visualiser.gameController.ControllerClient; import visualiser.gameController.ControllerClient;
import visualiser.gameController.Keys.ControlKey; import visualiser.gameController.Keys.ControlKey;
import visualiser.layout.*; import visualiser.layout.*;
@ -34,8 +41,7 @@ import visualiser.utils.GPSConverter;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.Optional; import java.util.*;
import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -58,6 +64,15 @@ public class RaceController extends Controller {
private boolean isHost; private boolean isHost;
private TutorialState currentState;
private ArrayList<TutorialState> tutorialStates;
private boolean isTutorial = false;
private String keyToPress;
/** /**
* state of the info table * state of the info table
*/ */
@ -66,6 +81,9 @@ public class RaceController extends Controller {
private View3D view3D; private View3D view3D;
private ObservableList<Subject3D> viewSubjects; private ObservableList<Subject3D> viewSubjects;
private Subject3D nextMarkArrow;
private ChangeListener<? super GPSCoordinate> pointToMark;
/** /**
* The arrow controller. * The arrow controller.
*/ */
@ -75,6 +93,9 @@ public class RaceController extends Controller {
@FXML private SplitPane racePane; @FXML private SplitPane racePane;
@FXML private Label tutorialText;
/** /**
* This is the pane we place the actual arrow control inside of. * This is the pane we place the actual arrow control inside of.
*/ */
@ -94,6 +115,7 @@ public class RaceController extends Controller {
* Ctor. * Ctor.
*/ */
public RaceController() { public RaceController() {
this.nextMarkArrow = new Annotation3D(new Box(1,3,0));
} }
@Override @Override
@ -110,13 +132,27 @@ public class RaceController extends Controller {
if(controlKey != null) { if(controlKey != null) {
try { try {
controlKey.onAction(); // Change key state if applicable controlKey.onAction(); // Change key state if applicable
//Check if current race is a tutorial
if (isTutorial){
//Check if current tutorial state has the same boat protocol code as key press
if (controlKey.getProtocolCode().equals(currentState.getAction())){
//Update tutorial
checkTutorialState();
}
}
controllerClient.sendKey(controlKey); controllerClient.sendKey(controlKey);
event.consume(); event.consume();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
Logger.getGlobal().log(Level.WARNING, "RaceController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e); Logger.getGlobal().log(Level.WARNING, "RaceController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e);
} catch (Exception e) {
e.printStackTrace();
} }
} }
if(event.getCode() == KeyCode.ESCAPE) { if(event.getCode() == KeyCode.ESCAPE) {
try { try {
@ -237,7 +273,7 @@ public class RaceController extends Controller {
// Position and add each mark to view // Position and add each mark to view
for(Mark mark: race.getVisualiserRaceState().getMarks()) { for(Mark mark: race.getVisualiserRaceState().getMarks()) {
MeshView mesh = new MeshView(importerMark.getImport()); MeshView mesh = new MeshView(importerMark.getImport());
Subject3D markModel = new Subject3D(mesh); Subject3D markModel = new Subject3D(mesh, mark.getSourceID());
markModel.setX(gpsConverter.convertGPS(mark.getPosition()).getX()); markModel.setX(gpsConverter.convertGPS(mark.getPosition()).getX());
markModel.setZ(gpsConverter.convertGPS(mark.getPosition()).getY()); markModel.setZ(gpsConverter.convertGPS(mark.getPosition()).getY());
@ -252,7 +288,7 @@ public class RaceController extends Controller {
} else { } else {
mesh = new MeshView(importerBurgerBoat.getImport()); mesh = new MeshView(importerBurgerBoat.getImport());
} }
Subject3D boatModel = new Subject3D(mesh); Subject3D boatModel = new Subject3D(mesh, boat.getSourceID());
viewSubjects.add(boatModel); viewSubjects.add(boatModel);
@ -266,10 +302,27 @@ public class RaceController extends Controller {
} }
}; };
trackBoat.start(); trackBoat.start();
Material markColor = new PhongMaterial(new Color(0.15,0.9,0.2,1));
CompoundMark nextMark = boat.getCurrentLeg().getEndCompoundMark();
view3D.getShape(nextMark.getMark1().getSourceID()).setMaterial(markColor);
if(nextMark.getMark2() != null) {
view3D.getShape(nextMark.getMark2().getSourceID()).setMaterial(markColor);
}
boat.legProperty().addListener((o, prev, curr) -> swapColours(curr));
} }
// Fix initial bird's-eye position // Fix initial bird's-eye position
view3D.updatePivot(new Translate(250, 0, 210)); view3D.updatePivot(new Translate(250, 0, 210));
view3D.targetProperty().addListener((o, prev, curr)-> {
if(curr != null && visualiserRace.getVisualiserRaceState().isVisualiserBoat(curr.getSourceID())) {
addThirdPersonAnnotations(curr);
} else {
removeThirdPersonAnnotations(prev);
}
});
// Bind zooming to scrolling // Bind zooming to scrolling
view3D.setOnScroll(e -> { view3D.setOnScroll(e -> {
view3D.updateDistance(e.getDeltaY()); view3D.updateDistance(e.getDeltaY());
@ -281,9 +334,33 @@ public class RaceController extends Controller {
if(key != null) { if(key != null) {
switch (key.toString()) { switch (key.toString()) {
case "Zoom In": case "Zoom In":
//Check if race is a tutorial
if (isTutorial) {
//Check if the current tutorial state is zoom-in
if (currentState.equals(TutorialState.ZOOMIN)) {
try {
//Update tutorial
checkTutorialState();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
view3D.updateDistance(-10); view3D.updateDistance(-10);
break; break;
case "Zoom Out": case "Zoom Out":
//Check if race is a tutorial
if(isTutorial) {
//Check if current tutorial state is zoom-out
if (currentState.equals(TutorialState.ZOOMOUT)) {
try {
//Update tutorial
checkTutorialState();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
view3D.updateDistance(10); view3D.updateDistance(10);
break; break;
} }
@ -291,6 +368,64 @@ public class RaceController extends Controller {
}); });
} }
private void addThirdPersonAnnotations(Subject3D subject3D) {
viewSubjects.add(nextMarkArrow);
try {
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
this.pointToMark = (o, prev, curr) -> {
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
nextMarkArrow.setX(view3D.getPivot().getX());
nextMarkArrow.setY(view3D.getPivot().getY());
nextMarkArrow.setZ(view3D.getPivot().getZ() + 10);
nextMarkArrow.setHeading(headingToMark.degrees());
};
boat.positionProperty().addListener(pointToMark);
} catch (BoatNotFoundException e) {
e.printStackTrace();
}
}
private void removeThirdPersonAnnotations(Subject3D subject3D) {
viewSubjects.remove(nextMarkArrow);
try {
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
boat.positionProperty().removeListener(pointToMark);
} catch (BoatNotFoundException e) {
e.printStackTrace();
}
}
/**
* Swap the colour of the next mark to pass with the last mark passed
* @param leg boat has started on
*/
private void swapColours(Leg leg) {
CompoundMark start = leg.getStartCompoundMark();
CompoundMark end = leg.getEndCompoundMark();
Shape3D start1 = view3D.getShape(start.getMark1().getSourceID());
Shape3D end1 = view3D.getShape(end.getMark1().getSourceID());
Material nextMark = start1.getMaterial();
Material lastMark = end1.getMaterial();
start1.setMaterial(lastMark);
if(start.getMark2() != null) {
Shape3D start2 = view3D.getShape(start.getMark2().getSourceID());
start2.setMaterial(lastMark);
}
end1.setMaterial(nextMark);
if(end.getMark2() != null) {
Shape3D end2 = view3D.getShape(end.getMark2().getSourceID());
end2.setMaterial(nextMark);
}
}
/** /**
* Initialises the frame rate functionality. This allows for toggling the frame rate, and connect the fps label to the race's fps property. * Initialises the frame rate functionality. This allows for toggling the frame rate, and connect the fps label to the race's fps property.
@ -468,6 +603,25 @@ public class RaceController extends Controller {
this.controllerClient = controllerClient; this.controllerClient = controllerClient;
this.isHost = isHost; this.isHost = isHost;
//Check if the game is a tutorial
if (parent.getGameType()==4){
isTutorial = true;
tutorialText.setVisible(true);
tutorialStates = new ArrayList<>(Arrays.asList(TutorialState.values()));
currentState = tutorialStates.get(0);
tutorialStates.remove(0);
searchMapForKey("Upwind");
tutorialText.setText("Welcome to the tutorial! Exit at anytime with ESC. \nWe will first learn how to turn upwind. Press " + keyToPress + " to turn upwind.");
} else {
isTutorial = false;
tutorialText.setVisible(false);
}
initialiseRace(); initialiseRace();
//Display this controller. //Display this controller.
@ -565,4 +719,108 @@ public class RaceController extends Controller {
infoTableShow = !infoTableShow; infoTableShow = !infoTableShow;
} }
/**
* Get the next tutorial state
*/
private void updateTutorialState(){
//Next tutorial state is popped from list
currentState = tutorialStates.get(0);
tutorialStates.remove(0);
}
/**
* Search key map for key given string of command
* @param command the command of the key
*/
private void searchMapForKey(String command){
//For loop through keyFactory
for (Map.Entry<String, ControlKey> entry: keyFactory.getKeyState().entrySet()){
if(entry.getValue().toString().equals(command)){
//Found next key required to press
keyToPress = entry.getKey();
}
}
}
/**
* Updates tutorial state and gui display for tutorial text
* @throws Exception Exception thrown
*/
private void checkTutorialState() throws Exception {
//Switch statement to check what the current tutorial state is
switch (currentState){
case UPWIND:
//Set next key to press as the downwind key
searchMapForKey("Downwind");
//Update tutorial text
tutorialText.setText("Nice! To turn downwind press " + keyToPress + ".");
updateTutorialState();
break;
case DOWNWIND:
//Set next key to press as the tack/gybe key
searchMapForKey("Tack/Gybe");
//Update tutorial text
tutorialText.setText("Nice! To tack or gybe press " + keyToPress + ".");
updateTutorialState();
break;
case TACKGYBE:
//Set next key to press as the VMG key
searchMapForKey("VMG");
//Update tutorial text
tutorialText.setText("Nice! To use VMG press " + keyToPress + ". This will turn the boat.");
updateTutorialState();
break;
case VMG:
//Set next key to press as the sails-in key
searchMapForKey("Toggle Sails");
//Update tutorial text
tutorialText.setText("Nice! To sails in press " + keyToPress + ". This will stop the boat.");
updateTutorialState();
break;
case SAILSIN:
//Set next key to press as the sails-out key
searchMapForKey("Toggle Sails");
//Update tutorial text
tutorialText.setText("Nice! To sails out press " + keyToPress + " again. The will start moving again.");
updateTutorialState();
break;
case SAILSOUT:
//Set next key to press as the zoom-in key
searchMapForKey("Zoom In");
//Update tutorial text
tutorialText.setText("Nice! To zoom in press " + keyToPress + ".");
updateTutorialState();
break;
case ZOOMIN:
//Set next key to press as the zoom-out key
searchMapForKey("Zoom Out");
//Update tutorial text
tutorialText.setText("Nice! You will also be able to zoom into boats and marks by clicking them. To zoom out press " + keyToPress + ".");
updateTutorialState();
break;
case ZOOMOUT:
//Finished tutorial. Display pop-up for exiting the tutorial
tutorialText.setText("Congratulations! You're done!");
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Finished Tutorial");
alert.setHeaderText("You have finished the tutorial.");
alert.setContentText("Now you know the controls you are ready to race!");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
parent.endEvent();
racePane.setVisible(false);
App.app.showMainStage(App.getStage());
}
break;
default:
//State not found. Exit tutorial to title menu
parent.endEvent();
racePane.setVisible(false);
App.app.showMainStage(App.getStage());
break;
}
}
} }

@ -86,9 +86,6 @@ public class StartController extends Controller {
/** /**
* Ctor. * Ctor.
*/ */
@ -218,29 +215,30 @@ public class StartController extends Controller {
* Countdown timer until race starts. * Countdown timer until race starts.
*/ */
private void countdownTimer() { private void countdownTimer() {
new AnimationTimer() { new AnimationTimer() {
@Override @Override
public void handle(long arg0) { public void handle(long arg0) {
//Get the current race status. //Get the current race status.
RaceStatusEnum raceStatus = visualiserRaceEvent.getVisualiserRaceState().getRaceStatusEnum(); RaceStatusEnum raceStatus = visualiserRaceEvent.getVisualiserRaceState().getRaceStatusEnum();
//If the race has reached the preparatory phase, or has started... //If the race has reached the preparatory phase, or has started...
if (raceStatus == RaceStatusEnum.WARNING if (raceStatus == RaceStatusEnum.WARNING
|| raceStatus == RaceStatusEnum.PREPARATORY || raceStatus == RaceStatusEnum.PREPARATORY
|| raceStatus == RaceStatusEnum.STARTED) { || raceStatus == RaceStatusEnum.STARTED) {
//Stop this timer. //Stop this timer.
stop(); stop();
//Hide this, and display the race controller. //Hide this, and display the race controller.
startWrapper.setVisible(false); startWrapper.setVisible(false);
//start.setVisible(false);//TODO is this needed? //start.setVisible(false);//TODO is this needed?
parent.beginRace(visualiserRaceEvent, controllerClient, isHost); parent.beginRace(visualiserRaceEvent, controllerClient, isHost);
}
} }
} }.start();
}.start();
} }

@ -6,16 +6,29 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton; import javafx.scene.control.RadioButton;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.media.AudioClip;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import mock.app.Event;
import mock.exceptions.EventConstructionException;
import javafx.stage.WindowEvent; import javafx.stage.WindowEvent;
import visualiser.app.App; import visualiser.app.App;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Controller for the opening title window. * Controller for the opening title window.
@ -33,6 +46,12 @@ public class TitleController extends Controller {
RadioButton dayModeRD; RadioButton dayModeRD;
@FXML @FXML
RadioButton nightModeRD; RadioButton nightModeRD;
@FXML
Label tutorialLabel;
@FXML
Pane menuPane;
@FXML
ImageView imgSun;
/** /**
* Method called when the 'host a game' button is pressed. * Method called when the 'host a game' button is pressed.
@ -40,8 +59,9 @@ public class TitleController extends Controller {
* Currently used to run the RaceVision mock. * Currently used to run the RaceVision mock.
* @throws IOException if main has problems * @throws IOException if main has problems
*/ */
public void hostAGame() throws IOException { public void hostAGame() throws IOException, URISyntaxException {
titleWrapper.setVisible(false); titleWrapper.setVisible(false);
parent.setGameType(0);
parent.hostGame(); parent.hostGame();
App.getStage().setResizable(true); App.getStage().setResizable(true);
} }
@ -68,7 +88,10 @@ public class TitleController extends Controller {
*/ */
public void setDayMode(){ public void setDayMode(){
dayModeRD.getScene().getStylesheets().clear(); dayModeRD.getScene().getStylesheets().clear();
menuPane.getStylesheets().clear();
imgSun.setImage(new Image(getClass().getResource("/visualiser/images/sun.png").toExternalForm()));
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css"); dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
menuPane.setStyle("-fx-background-color: #6be6ff;");
nightModeRD.setSelected(false); nightModeRD.setSelected(false);
} }
@ -77,12 +100,17 @@ public class TitleController extends Controller {
*/ */
public void setNightMode(){ public void setNightMode(){
nightModeRD.getScene().getStylesheets().clear(); nightModeRD.getScene().getStylesheets().clear();
menuPane.getStylesheets().clear();
imgSun.setImage(new Image(getClass().getResource("/visualiser/images/sunsleep.png").toExternalForm()));
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css"); nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
menuPane.setStyle("-fx-background-color: #1f2c60;");
dayModeRD.setSelected(false); dayModeRD.setSelected(false);
} }
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
tutorialLabel.setWrapText(true);
} }
/** /**
@ -90,6 +118,8 @@ public class TitleController extends Controller {
*/ */
public void controlBtnPressed(){ public void controlBtnPressed(){
try { try {
AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
sound.play();
FXMLLoader loader = new FXMLLoader(); FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/visualiser/scenes/keyBindings.fxml")); loader.setLocation(getClass().getResource("/visualiser/scenes/keyBindings.fxml"));
Parent layout = loader.load(); Parent layout = loader.load();
@ -114,4 +144,12 @@ public class TitleController extends Controller {
} }
} }
public void tutorialStartPressed() throws IOException {
titleWrapper.setVisible(false);
parent.setGameType(4);
parent.beginGame();
}
} }

@ -3,6 +3,7 @@ package visualiser.app;
import javafx.animation.FadeTransition; import javafx.animation.FadeTransition;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.concurrent.Task; import javafx.concurrent.Task;
@ -14,6 +15,7 @@ import javafx.geometry.Rectangle2D;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.ProgressBar; import javafx.scene.control.ProgressBar;
import javafx.scene.effect.DropShadow; import javafx.scene.effect.DropShadow;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -95,7 +97,7 @@ public class App extends Application {
); );
updateMessage("Preparing ingredients . . ."); updateMessage("Preparing ingredients . . .");
Thread.sleep(200); Thread.sleep(100);
for (int i = 0; i < burgerFilling.size(); i++) { for (int i = 0; i < burgerFilling.size(); i++) {
Thread.sleep(100); Thread.sleep(100);
updateProgress(i + 1, burgerFilling.size()); updateProgress(i + 1, burgerFilling.size());

@ -0,0 +1,66 @@
package visualiser.enums;
import javafx.scene.input.KeyCode;
import network.Messages.BoatAction;
import network.Messages.Enums.BoatActionEnum;
import visualiser.gameController.Keys.ControlKey;
import static visualiser.app.App.keyFactory;
import java.util.ArrayList;
/**
* State of which stage the tutorial is currently in
*/
public enum TutorialState {
/**
* State for upwind in tutorial
*/
UPWIND(BoatActionEnum.UPWIND),
/**
* State for downwind in tutorial
*/
DOWNWIND(BoatActionEnum.DOWNWIND),
/**
* State for tacking/gybing in tutorial
*/
TACKGYBE(BoatActionEnum.TACK_GYBE),
/**
* State for vmg in tutorial
*/
VMG(BoatActionEnum.AUTO_PILOT),
/**
* State for sails-in in tutorial
*/
SAILSIN(BoatActionEnum.SAILS_IN),
/**
* State for sails-out in tutorial
*/
SAILSOUT(BoatActionEnum.SAILS_OUT),
/**
* State for zoom-in in tutorial
*/
ZOOMIN(null),
/**
* State for zoom-out in tutorial
*/
ZOOMOUT(null);
private BoatActionEnum action;
TutorialState(BoatActionEnum action){
this.action = action;
}
public BoatActionEnum getAction(){
return action;
}
}

@ -0,0 +1,24 @@
package visualiser.layout;
import javafx.scene.shape.Shape3D;
/**
* Created by connortaylorbrown on 13/09/17.
*/
public class Annotation3D extends Subject3D {
/**
* Constructor for view subject wrapper
*
* @param mesh to be rendered
*/
public Annotation3D(Shape3D mesh) {
super(mesh, 0);
}
/**
* Prevent rescaling of this subject
* @param scale ignored
*/
@Override
public void setScale(double scale) {}
}

@ -62,12 +62,12 @@ public class Boundary3D {
double c = Math.sqrt(a * a + b * b); double c = Math.sqrt(a * a + b * b);
Subject3D bound1 = new Subject3D(new Sphere(thickness * 2)); Subject3D bound1 = new Subject3D(new Sphere(thickness * 2),0);
bound1.setX(graphCoord1.getX()); bound1.setX(graphCoord1.getX());
bound1.setZ(graphCoord1.getY()); bound1.setZ(graphCoord1.getY());
boundaryNodes.add(bound1); boundaryNodes.add(bound1);
Subject3D connector = new Subject3D(new Box(c, thickness, thickness)); Subject3D connector = new Subject3D(new Box(c, thickness, thickness),0);
connector.setX(avgCoord.getX()); connector.setX(avgCoord.getX());
connector.setZ(avgCoord.getY()); connector.setZ(avgCoord.getY());
double angle = 90 + Math.toDegrees(GPSConverter.getAngle(graphCoord2, graphCoord1)); double angle = 90 + Math.toDegrees(GPSConverter.getAngle(graphCoord2, graphCoord1));

@ -24,7 +24,7 @@ public class SeaSurface extends Subject3D {
* @param freq frequency the perlin noise is to be generated at * @param freq frequency the perlin noise is to be generated at
*/ */
public SeaSurface(int size, double freq){ public SeaSurface(int size, double freq){
super(createSurface(size, freq)); super(createSurface(size, freq),0);
image = new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterDown2048.png")); image = new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterDown2048.png"));
} }

@ -50,10 +50,10 @@ public class SkyBox {
surface.setRotate(180); surface.setRotate(180);
surface.setTranslateX(x); surface.setTranslateX(x);
surface.setTranslateY(y - size/2 + yshift + clipOverlap); surface.setTranslateY(y - size + 1);
surface.setTranslateZ(z); surface.setTranslateZ(z);
Subject3D top = new SkyBoxPlane(surface); Subject3D top = new Subject3D(surface,0);
skyBoxPlanes.add(top); skyBoxPlanes.add(top);
} }
@ -72,7 +72,7 @@ public class SkyBox {
surface.setTranslateZ(z + size/2 - clipOverlap); surface.setTranslateZ(z + size/2 - clipOverlap);
Subject3D right = new SkyBoxPlane(surface); Subject3D right = new Subject3D(surface,0);
skyBoxPlanes.add(right); skyBoxPlanes.add(right);
} }
@ -94,7 +94,7 @@ public class SkyBox {
surface.setTranslateZ(z - size/2 + clipOverlap); surface.setTranslateZ(z - size/2 + clipOverlap);
Subject3D left = new SkyBoxPlane(surface); Subject3D left = new Subject3D(surface,0);
skyBoxPlanes.add(left); skyBoxPlanes.add(left);
} }
@ -112,7 +112,7 @@ public class SkyBox {
surface.setTranslateY(y + yshift); surface.setTranslateY(y + yshift);
surface.setTranslateZ(z); surface.setTranslateZ(z);
Subject3D back = new SkyBoxPlane(surface); Subject3D back = new Subject3D(surface,0);
skyBoxPlanes.add(back); skyBoxPlanes.add(back);
} }
@ -130,7 +130,7 @@ public class SkyBox {
surface.setTranslateY(y + yshift); surface.setTranslateY(y + yshift);
surface.setTranslateZ(z); surface.setTranslateZ(z);
Subject3D front = new SkyBoxPlane(surface); Subject3D front = new Subject3D(surface,0);
skyBoxPlanes.add(front); skyBoxPlanes.add(front);
} }

@ -13,6 +13,10 @@ public class Subject3D {
* Rendered mesh * Rendered mesh
*/ */
private Shape3D mesh; private Shape3D mesh;
/**
* Source ID of subject in game model
*/
private int sourceID;
/** /**
* Position translation updated by state listeners * Position translation updated by state listeners
@ -30,8 +34,9 @@ public class Subject3D {
* Constructor for view subject wrapper * Constructor for view subject wrapper
* @param mesh to be rendered * @param mesh to be rendered
*/ */
public Subject3D(Shape3D mesh) { public Subject3D(Shape3D mesh, int sourceID) {
this.mesh = mesh; this.mesh = mesh;
this.sourceID = sourceID;
this.scale = new Scale(); this.scale = new Scale();
this.position = new Translate(); this.position = new Translate();
this.heading = new Rotate(0, Rotate.Y_AXIS); this.heading = new Rotate(0, Rotate.Y_AXIS);
@ -43,6 +48,10 @@ public class Subject3D {
return mesh; return mesh;
} }
public int getSourceID() {
return sourceID;
}
public Translate getPosition() { public Translate getPosition() {
return this.position; return this.position;
} }

@ -1,5 +1,7 @@
package visualiser.layout; package visualiser.layout;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -31,11 +33,15 @@ public class View3D extends Pane {
/** /**
* Map for selecting Subject3D from Shape3D * Map for selecting Subject3D from Shape3D
*/ */
private Map<Shape3D, Subject3D> selectionMap; private Map<Shape3D, Subject3D> shapeMap;
/**
* Map for selecting Shape3D from source ID
*/
private Map<Integer, Shape3D> sourceMap;
/** /**
* Subject tracked by camera * Subject tracked by camera
*/ */
private Subject3D target; private ObjectProperty<Subject3D> target;
/** /**
* Rendering container for shapes * Rendering container for shapes
*/ */
@ -95,8 +101,9 @@ public class View3D extends Pane {
*/ */
public View3D(boolean fill) { public View3D(boolean fill) {
this.world = new Group(); this.world = new Group();
this.selectionMap = new HashMap<>(); this.shapeMap = new HashMap<>();
this.target = null; this.sourceMap = new HashMap<>();
this.target = new SimpleObjectProperty<>(null);
this.scene = new SubScene(world, 300, 300); this.scene = new SubScene(world, 300, 300);
scene.widthProperty().bind(this.widthProperty()); scene.widthProperty().bind(this.widthProperty());
@ -148,17 +155,23 @@ public class View3D extends Pane {
if (c.wasRemoved() || c.wasAdded()) { if (c.wasRemoved() || c.wasAdded()) {
for (Subject3D shape : c.getRemoved()) { for (Subject3D shape : c.getRemoved()) {
world.getChildren().remove(shape.getMesh()); world.getChildren().remove(shape.getMesh());
selectionMap.remove(shape.getMesh()); shapeMap.remove(shape.getMesh());
sourceMap.remove(shape.getSourceID());
} }
for (Subject3D shape : c.getAddedSubList()) { for (Subject3D shape : c.getAddedSubList()) {
world.getChildren().add(shape.getMesh()); world.getChildren().add(shape.getMesh());
selectionMap.put(shape.getMesh(), shape); shapeMap.put(shape.getMesh(), shape);
sourceMap.put(shape.getSourceID(), shape.getMesh());
} }
} }
} }
}); });
} }
public Shape3D getShape(int sourceID) {
return sourceMap.get(sourceID);
}
/** /**
* Intercept mouse clicks on subjects in view. The applied listener cannot be removed. * Intercept mouse clicks on subjects in view. The applied listener cannot be removed.
*/ */
@ -167,12 +180,16 @@ public class View3D extends Pane {
PickResult result = e.getPickResult(); PickResult result = e.getPickResult();
if(result != null && result.getIntersectedNode() != null && result.getIntersectedNode() instanceof Shape3D) { if(result != null && result.getIntersectedNode() != null && result.getIntersectedNode() instanceof Shape3D) {
untrackSubject(); untrackSubject();
trackSubject(selectionMap.get(result.getIntersectedNode())); trackSubject(shapeMap.get(result.getIntersectedNode()));
setThirdPerson(); setThirdPerson();
} }
}); });
} }
public ObjectProperty<Subject3D> targetProperty() {
return target;
}
/** /**
* Configures camera to third person view * Configures camera to third person view
*/ */
@ -201,11 +218,12 @@ public class View3D extends Pane {
* Stop camera from following the last selected subject * Stop camera from following the last selected subject
*/ */
private void untrackSubject() { private void untrackSubject() {
if(target != null) { if(target.get() != null) {
target.getPosition().xProperty().removeListener(pivotX); target.get().getPosition().xProperty().removeListener(pivotX);
target.getPosition().yProperty().removeListener(pivotY); target.get().getPosition().yProperty().removeListener(pivotY);
target.getPosition().zProperty().removeListener(pivotZ); target.get().getPosition().zProperty().removeListener(pivotZ);
target.getHeading().angleProperty().removeListener(pivotHeading); target.get().getHeading().angleProperty().removeListener(pivotHeading);
target.setValue(null);
} }
} }
@ -214,15 +232,15 @@ public class View3D extends Pane {
* @param subject to track * @param subject to track
*/ */
private void trackSubject(Subject3D subject) { private void trackSubject(Subject3D subject) {
target = subject; target.set(subject);
updatePivot(target.getPosition()); updatePivot(target.get().getPosition());
setYaw(target.getHeading().getAngle()); setYaw(target.get().getHeading().getAngle());
target.getPosition().xProperty().addListener(pivotX); target.get().getPosition().xProperty().addListener(pivotX);
target.getPosition().yProperty().addListener(pivotY); target.get().getPosition().yProperty().addListener(pivotY);
target.getPosition().zProperty().addListener(pivotZ); target.get().getPosition().zProperty().addListener(pivotZ);
target.getHeading().angleProperty().addListener(pivotHeading); target.get().getHeading().angleProperty().addListener(pivotHeading);
} }
public void setNearClip(double nearClip) { public void setNearClip(double nearClip) {
@ -233,6 +251,10 @@ public class View3D extends Pane {
this.farClip = farClip; this.farClip = farClip;
} }
public Translate getPivot() {
return pivot;
}
/** /**
* Sets the coordinates of the camera pivot once. * Sets the coordinates of the camera pivot once.
* @param pivot source of coordinates * @param pivot source of coordinates

@ -65,7 +65,7 @@ public class VisualiserRaceController implements RunnableWithFramePeriod {
compositeRaceCommand.addCommand(command); compositeRaceCommand.addCommand(command);
} catch (CommandConstructionException e) { } catch (CommandConstructionException e) {
Logger.getGlobal().log(Level.WARNING, "VisualiserRaceController could not create a command for incoming message."); //Logger.getGlobal().log(Level.WARNING, "VisualiserRaceController could not create a command for incoming message.");
} catch (InterruptedException e) { } catch (InterruptedException e) {
Logger.getGlobal().log(Level.SEVERE, "VisualiserRaceController was interrupted on thread: " + Thread.currentThread() + " while waiting for messages."); Logger.getGlobal().log(Level.SEVERE, "VisualiserRaceController was interrupted on thread: " + Thread.currentThread() + " while waiting for messages.");

@ -53,5 +53,39 @@
} }
#arrowImage { #arrowImage {
-fx-image: url("/visualiser/images/arrow.png"); -fx-graphic: url("/visualiser/images/arrow.png");
}
#nextButton {
-fx-background-image: url("/visualiser/images/ArrowRoundRight.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}
#nextButton:pressed {
-fx-background-image: url("/visualiser/images/ArrowRoundRightClicked.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}
#previousButton {
-fx-background-image: url("/visualiser/images/ArrowRoundLeft.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}
#previousButton:pressed {
-fx-background-image: url("/visualiser/images/ArrowRoundLeftClicked.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
} }

@ -57,3 +57,37 @@
#arrowImage { #arrowImage {
-fx-image: url("/visualiser/images/arrowLight.png"); -fx-image: url("/visualiser/images/arrowLight.png");
} }
#nextButton {
-fx-background-image: url("/visualiser/images/ArrowRoundRight.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}
#nextButton:pressed {
-fx-background-image: url("/visualiser/images/ArrowRoundRightClicked.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}
#previousButton {
-fx-background-image: url("/visualiser/images/ArrowRoundLeft.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}
#previousButton:pressed {
-fx-background-image: url("/visualiser/images/ArrowRoundLeftClicked.png");
-fx-background-size: 60px;
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-focus-color: transparent;
-fx-background-color: transparent;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<BoatConfig>
<Boats>
<!--Mark Boats-->
<Boat Type="Mark" BoatName="PRO" SourceID="101" >
<GPSposition X= "-64.854304" Y="32.296577" Z="0"/>
</Boat>
<Boat Type="Mark" BoatName="PIN" SourceID="102" >
<GPSposition X= "-64.855242" Y="32.293771" Z="0"/>
</Boat>
<Boat Type="Mark" BoatName="FL" SourceID="108" >
<GPSposition X= "-64.839291" Y="32.317379" Z="0"/>
</Boat>
<Boat Type="Mark" BoatName="FR" SourceID="109" >
<GPSposition X= "-64.83626" Y="32.317257" Z="0"/>
</Boat>
<!--Participants-->
<!--Participants-->
<Boat BoatName="Emirates Team New Zealand" HullNum="RG01" ShapeID="0" ShortName="NZL" SourceID="121" StoweName="NZL" Type="Yacht">
<GPSposition X="-64.854304" Y="32.296577" Z="0"/>
</Boat>
<!--<Boat BoatName="Land Rover BAR" HullNum="RG01" ShapeID="0" ShortName="GBR" SourceID="122" StoweName="GBR" Type="Yacht">
<GPSposition X="-64.854304" Y="32.296577" Z="0"/>
</Boat>
<Boat BoatName="SoftBank Team Japan" HullNum="RG01" ShapeID="0" ShortName="JPN" SourceID="123" StoweName="JPN" Type="Yacht">
<GPSposition X="-64.854304" Y="32.296577" Z="0"/>
</Boat>
<Boat BoatName="Groupama Team France" HullNum="RG01" ShapeID="0" ShortName="FRA" SourceID="124" StoweName="FRA" Type="Yacht">
<GPSposition X="-64.854304" Y="32.296577" Z="0"/>
</Boat>
<Boat BoatName="Artemis Racing" HullNum="RG01" ShapeID="0" ShortName="SWE" SourceID="125" StoweName="SWE" Type="Yacht">
<GPSposition X="-64.854304" Y="32.296577" Z="0"/>
</Boat>
<Boat BoatName="ORACLE TEAM USA" HullNum="RG01" ShapeID="0" ShortName="USA" SourceID="126" StoweName="USA" Type="Yacht">
<GPSposition X="-64.854304" Y="32.296577" Z="0"/>
</Boat>-->
</Boats>
</BoatConfig>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Race>
<RaceID>5326</RaceID>
<RaceType>FLEET</RaceType>
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
<Participants>
</Participants>
<CompoundMarkSequence>
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
<Corner SeqID="3" CompoundMarkID="4" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="4" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
<Corner SeqID="5" CompoundMarkID="3" Rounding="Port" ZoneSize="3" />
<Corner SeqID="7" CompoundMarkID="5" Rounding="SP" ZoneSize="3"/>
</CompoundMarkSequence>
<Course>
<CompoundMark CompoundMarkID="1" Name="Start Line">
<Mark SeqId="1" Name="PRO" TargetLat="1.681354" TargetLng="1.132354" SourceID="101"/>
<Mark SeqId="2" Name="PIN" TargetLat="1.681354" TargetLng="1.135604" SourceID="102"/>
</CompoundMark>
<CompoundMark CompoundMarkID="2" Name="Marker 1">
<Mark Name="Marker1" TargetLat="1.728713" TargetLng="1.131345" SourceID="103"/>
</CompoundMark>
<CompoundMark CompoundMarkID="3" Name="Marker 2">
<Mark Name="Marker2" TargetLat="1.725120" TargetLng="1.109701" SourceID="104"/>
</CompoundMark>
<CompoundMark CompoundMarkID="4" Name="Gate 1">
<Mark Name="LGL" SeqId="1" TargetLat="1.707354" TargetLng="1.130505" SourceID="105"/>
<Mark Name="LGR" SeqId="2" TargetLat="1.707404" TargetLng="1.133304" SourceID="106"/>
</CompoundMark>
<CompoundMark CompoundMarkID="5" Name="Finish Line">
<Mark Name="FL" SeqId="1" TargetLat="1.690202" TargetLng="1.109606" SourceID="107"/>
<Mark Name="FR" SeqId="2" TargetLat="1.692202" TargetLng="1.112629" SourceID="108"/>
</CompoundMark>
</Course>
<CourseLimit>
<Limit Lat="1.73558" Lon="1.105505" SeqID="1"/>
<Limit Lat="1.732444" Lon="1.137105" SeqID="2"/>
<Limit Lat="1.680404" Lon="1.140505" SeqID="3"/>
<Limit Lat="1.675232" Lon="1.122202" SeqID="4"/>
<Limit Lat="1.685101" Lon="1.120222" SeqID="5"/>
<Limit Lat="1.680101" Lon="1.102505" SeqID="6"/>
</CourseLimit>
</Race>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Race>
<RaceID>5326</RaceID>
<RaceType>FLEET</RaceType>
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
<Participants>
</Participants>
<CompoundMarkSequence>
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
<Corner SeqID="2" CompoundMarkID="2" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="3" CompoundMarkID="3" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="4" CompoundMarkID="2" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="5" CompoundMarkID="4" Rounding="SP" ZoneSize="3" />
</CompoundMarkSequence>
<Course>
<CompoundMark CompoundMarkID="1" Name="Start Line">
<Mark SeqId="1" Name="PRO" TargetLat="1.681354" TargetLng="1.132354" SourceID="101"/>
<Mark SeqId="2" Name="PIN" TargetLat="1.680354" TargetLng="1.135604" SourceID="102"/>
</CompoundMark>
<CompoundMark CompoundMarkID="2" Name="Marker 1">
<Mark Name="Marker1" TargetLat="1.780354" TargetLng="1.140600" SourceID="103"/>
</CompoundMark>
<CompoundMark CompoundMarkID="3" Name="Marker 2">
<Mark Name="Marker2" TargetLat="1.730354" TargetLng="1.137604" SourceID="104"/>
</CompoundMark>
<CompoundMark CompoundMarkID="4" Name="Finish Line">
<Mark SeqId="1" Name="FL" TargetLat="1.681354" TargetLng="1.132354" SourceID="105"/>
<Mark SeqId="2" Name="FR" TargetLat="1.680354" TargetLng="1.135604" SourceID="106"/>
</CompoundMark>
</Course>
<CourseLimit>
<Limit Lat="1.675354" Lon="1.122354" SeqID="1"/>
<Limit Lat="1.680354" Lon="1.141600" SeqID="2"/>
<Limit Lat="1.790354" Lon="1.146600" SeqID="3"/>
<Limit Lat="1.785354" Lon="1.127354" SeqID="4"/>
</CourseLimit>
</Race>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Race>
<RaceID>5326</RaceID>
<RaceType>FLEET</RaceType>
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
<Participants>
</Participants>
<CompoundMarkSequence>
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
<Corner SeqID="3" CompoundMarkID="3" Rounding="Port" ZoneSize="3" />
<Corner SeqID="4" CompoundMarkID="4" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="5" CompoundMarkID="3" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="6" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
<Corner SeqID="7" CompoundMarkID="5" Rounding="SP" ZoneSize="3"/>
</CompoundMarkSequence>
<Course>
<CompoundMark CompoundMarkID="1" Name="Start Line">
<Mark SeqId="1" Name="PRO" TargetLat="-40.681354" TargetLng="174.132354" SourceID="101"/>
<Mark SeqId="2" Name="PIN" TargetLat="-40.608415" TargetLng="174.272430" SourceID="102"/>
</CompoundMark>
<CompoundMark CompoundMarkID="2" Name="Marker 1">
<Mark Name="Marker1" TargetLat="-40.118713" TargetLng="173.541839" SourceID="103"/>
</CompoundMark>
<CompoundMark CompoundMarkID="3" Name="Marker 2">
<Mark Name="Marker2" TargetLat="-40.53120" TargetLng="173.250701" SourceID="104"/>
</CompoundMark>
<CompoundMark CompoundMarkID="4" Name="Gate">
<Mark Name="WGL" SeqId="1" TargetLat="-40.722999" TargetLng="173.420989" SourceID="106"/>
<Mark Name="WGR" SeqId="2" TargetLat="-40.789575" TargetLng="173.294647" SourceID="107"/>
</CompoundMark>
<CompoundMark CompoundMarkID="5" Name="Finish Line">
<Mark Name="FL" SeqId="1" TargetLat="-40.968169" TargetLng="173.692901" SourceID="108"/>
<Mark Name="FR" SeqId="2" TargetLat="-40.878932" TargetLng="173.695648" SourceID="109"/>
</CompoundMark>
</Course>
<CourseLimit>
<Limit Lat="-40.984758" Lon="173.736846" SeqID="1"/>
<Limit Lat="-41.160757" Lon="173.140838" SeqID="2"/>
<Limit Lat="-39.937843" Lon="173.085906" SeqID="3"/>
<Limit Lat="-40.244616" Lon="174.420745" SeqID="4"/>
<Limit Lat="-40.627178" Lon="174.412505" SeqID="5"/>
<Limit Lat="-40.783337" Lon="174.093902" SeqID="6"/>
<Limit Lat="-40.612585" Lon="173.893401" SeqID="7"/>
<Limit Lat="-40.752134" Lon="173.723113" SeqID="8"/>
</CourseLimit>
</Race>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Race>
<RaceID>9999</RaceID>
<RaceType>FLEET</RaceType>
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
<Participants>
<!--<Yacht SourceID="121"/>-->
</Participants>
<CompoundMarkSequence>
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
<Corner SeqID="2" CompoundMarkID="2" Rounding="SP" ZoneSize="3"/>
</CompoundMarkSequence>
<Course>
<CompoundMark CompoundMarkID="1" Name="Start Line">
<Mark SeqId="1" Name="PRO" TargetLat="32.288148" TargetLng="-64.852996" SourceID="101"/>
<Mark SeqId="2" Name="PIN" TargetLat="32.290148" TargetLng="-64.854996" SourceID="102"/>
</CompoundMark>
<CompoundMark CompoundMarkID="2" Name="Finish Line">
<Mark Name="FL" SeqId="1" TargetLat="42.315911" TargetLng="-64.846996" SourceID="108"/>
<Mark Name="FR" SeqId="2" TargetLat="42.315911" TargetLng="-64.848996" SourceID="109"/>
</CompoundMark>
</Course>
<CourseLimit>
<Limit Lat="32.317911" Lon="-64.836996" SeqID="1"/>
<Limit Lat="32.286148" Lon="-64.836996" SeqID="2"/>
<Limit Lat="32.286148" Lon="-64.856996" SeqID="3"/>
<Limit Lat="32.317911" Lon="-64.856996" SeqID="4"/>
<!--<Limit Lat="32.313922" Lon="-64.837168" SeqID="1"/>
<Limit Lat="32.317379" Lon="-64.839291" SeqID="2"/>
<Limit Lat="32.317911" Lon="-64.836996" SeqID="3"/>
<Limit Lat="32.317257" Lon="-64.83626" SeqID="4"/>
<Limit Lat="32.304273" Lon="-64.822834" SeqID="5"/>
<Limit Lat="32.279097" Lon="-64.841545" SeqID="6"/>
<Limit Lat="32.279604" Lon="-64.849871" SeqID="7"/>
<Limit Lat="32.289545" Lon="-64.854162" SeqID="8"/>
<Limit Lat="32.290198" Lon="-64.858711" SeqID="9"/>
<Limit Lat="32.297164" Lon="-64.856394" SeqID="10"/>
<Limit Lat="32.296148" Lon="-64.849184" SeqID="11"/>-->
</CourseLimit>
</Race>

@ -0,0 +1,10 @@
<RegattaConfig>
<RegattaID>0</RegattaID>
<RegattaName>Race Tutorial</RegattaName>
<CourseName>Tutorial</CourseName>
<CentralLatitude>-36.82791529</CentralLatitude>
<CentralLongitude>174.81218919</CentralLongitude>
<CentralAltitude>0.00</CentralAltitude>
<UtcOffset>12</UtcOffset>
<MagneticVariation>14.1</MagneticVariation>
</RegattaConfig>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Race>
<RaceID>99999999</RaceID>
<RaceType>Match</RaceType>
<CreationTimeDate>2011-08-06T13:25:00-0000</CreationTimeDate>
<RaceStartTime Time="2011-08-06T13:30:00-0700" Postpone="false"/>
<Participants>
<Yacht SourceID="101" Entry="Port"/>
<Yacht SourceID="108" Entry="Stbd"/>
</Participants>
<Course>
<CompoundMark CompoundMarkID="1" Name="StartLine">
<Mark SeqID="1" Name="PRO" TargetLat="-36.83" TargetLng="174.83" SourceID="101"/>
<Mark SeqID="2" Name="PIN" TargetLat="-36.84" TargetLng="174.81" SourceID="102"/>
</CompoundMark>
<CompoundMark CompoundMarkID="2" Name="M1">
<Mark Name="M1" TargetLat="-36.63566590" TargetLng="174.88543944" SourceID="103"/>
</CompoundMark>
<CompoundMark CompoundMarkID="3" Name="M2">
<Mark Name="M2" TargetLat="-36.83" TargetLng="174.80" SourceID="102"/>
</CompoundMark>
<CompoundMark CompoundMarkID="4" Name="Gate">
<Mark SeqID="1" Name="G1" TargetLat="-36.63566590" TargetLng="174.97205159" SourceID="104"/>
<Mark SeqID="2" Name="G2" TargetLat="-36.64566590" TargetLng="174.98205159" SourceID="105"/>
</CompoundMark>
</Course>
<CompoundMarkSequence>
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3"/>
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3"/>
<Corner SeqID="3" CompoundMarkID="3" Rounding="Stbd" ZoneSize="6"/>
<Corner SeqID="4" CompoundMarkID="4" Rounding="PS" ZoneSize="6"/>
<Corner SeqID="5" CompoundMarkID="1" Rounding="SP" ZoneSize="3"/>
</CompoundMarkSequence>
<CourseLimit>
<Limit SeqID="1" Lat="-36.8325" Lon="174.8325"/>
<Limit SeqID="2" Lat="-36.82883" Lon="174.81983"/>
<Limit SeqID="3" Lat="-36.82067" Lon="174.81983"/>
<Limit SeqID="4" Lat="-36.811" Lon="174.8265"/>
<Limit SeqID="5" Lat="-36.81033" Lon="174.83833"/>
<Limit SeqID="6" Lat="-36.81533" Lon="174.8525"/>
<Limit SeqID="7" Lat="-36.81533" Lon="174.86733"/>
<Limit SeqID="8" Lat="-36.81633" Lon="174.88217"/>
<Limit SeqID="9" Lat="-36.83383" Lon="174.87117"/>
<Limit SeqID="10" Lat="-36.83417" Lon="174.84767"/>
</CourseLimit>
</Race>

@ -1,44 +1,61 @@
<!--<?xml version="1.0" encoding="UTF-8"?>--> <?xml version="1.0" encoding="UTF-8"?>
<!--<?import java.lang.*?>--> <?import java.lang.*?>
<!--<?import javafx.scene.control.*?>--> <?import javafx.geometry.*?>
<!--<?import javafx.scene.text.*?>--> <?import javafx.scene.control.*?>
<!--<?import javafx.scene.control.Button?>--> <?import javafx.scene.image.*?>
<!--<?import javafx.scene.control.Label?>--> <?import javafx.scene.layout.*?>
<!--<?import javafx.scene.layout.*?>--> <?import javafx.scene.text.*?>
<!--<?import javafx.scene.text.Font?>--> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<!--<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">--> <AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostController">
<!--<children>--> <children>
<!--<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">--> <GridPane layoutY="14.0" AnchorPane.bottomAnchor="-14.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="14.0">
<!--<columnConstraints>--> <columnConstraints>
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />--> <ColumnConstraints hgrow="SOMETIMES" maxWidth="170.0" minWidth="10.0" prefWidth="170.0" />
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />--> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />--> <ColumnConstraints hgrow="SOMETIMES" maxWidth="170.0" minWidth="10.0" prefWidth="170.0" />
<!--</columnConstraints>--> </columnConstraints>
<!--<rowConstraints>--> <rowConstraints>
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />--> <RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />--> <RowConstraints minHeight="10.0" prefHeight="435.0" vgrow="SOMETIMES" />
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />--> <RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
<!--</rowConstraints>--> </rowConstraints>
<!--<children>--> <children>
<!--<Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Start Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2">--> <Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Start Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<!--<font>--> <font>
<!--<Font size="20.0" />--> <Font size="20.0" />
<!--</font>--> </font>
<!--</Button>--> <GridPane.margin>
<!--<Label text="Address: 127.0.0.1" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="TOP">--> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
<!--<font>--> </GridPane.margin>
<!--<Font size="17.0" />--> </Button>
<!--</font>--> <Label text="Address: 127.0.0.1" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<!--</Label>--> <font>
<!--<Label text="Port: 4942" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1">--> <Font size="17.0" />
<!--<font>--> </font>
<!--<Font size="17.0" />--> </Label>
<!--</font>--> <Label text="Port: 4942" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
<!--</Label>--> <font>
<!--<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Main Menu" GridPane.halignment="CENTER" />--> <Font size="17.0" />
<!--</children>--> </font>
<!--</GridPane>--> </Label>
<!--</children>--> <Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Main Menu" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<!--</AnchorPane>--> <GridPane.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</GridPane.margin></Button>
<ImageView fx:id="mapImage" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<Button fx:id="previousButton" maxHeight="80.0" maxWidth="80.0" mnemonicParsing="false" onAction="#previousImage" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
<Button fx:id="nextButton" maxHeight="80.0" maxWidth="80.0" mnemonicParsing="false" onAction="#nextImage" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostController">
<children>
<SplitPane fx:id="splitPane" dividerPositions="0.7724935732647815" layoutX="580.0" layoutY="129.0" prefHeight="160.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane fx:id="imagePane" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<ImageView fx:id="imageView" fitHeight="376.0" fitWidth="597.0" nodeOrientation="INHERIT" pickOnBounds="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<image>
<Image url="@../images/lobby.gif" />
</image></ImageView>
<GridPane style="-fx-background-color: rgba(0, 0, 0, 0.5);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" prefHeight="173.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="50.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Quit" GridPane.rowIndex="2">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Button>
<Button alignment="CENTER_RIGHT" contentDisplay="RIGHT" mnemonicParsing="false" onAction="#startBtnPressed" text="Start Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets right="20.0" />
</GridPane.margin>
</Button>
<Label alignment="CENTER" contentDisplay="CENTER" text="Map: MapNameHere" textFill="WHITE" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2">
<font>
<Font size="16.0" />
</font>
</Label>
<GridPane fx:id="playerContainer" GridPane.columnSpan="3" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
</children>
</GridPane>
<Label alignment="TOP_CENTER" text="Get Ready For The Next Race" textFill="#fffdfd" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="20.0">
<font>
<Font size="22.0" />
</font>
</Label>
</children>
</AnchorPane>
<AnchorPane fx:id="specPane" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<TableView prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: rgba(60, 60, 60, 1);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columns>
<TableColumn prefWidth="173.0" text="Spectators" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>

@ -7,7 +7,7 @@
<fx:include fx:id="start" source="start.fxml" /> <fx:include fx:id="start" source="start.fxml" />
<fx:include fx:id="connection" source="connect.fxml" /> <fx:include fx:id="connection" source="connect.fxml" />
<fx:include fx:id="finish" source="finish.fxml" /> <fx:include fx:id="finish" source="finish.fxml" />
<fx:include fx:id="host" source="hostlobby.fxml" /> <fx:include fx:id="host" source="hostgame.fxml" />
<fx:include fx:id="title" source="titleScreen.fxml" /> <fx:include fx:id="title" source="titleScreen.fxml" />
<fx:include fx:id="lobby" source="lobby.fxml" /> <fx:include fx:id="lobby" source="lobby.fxml" />
</children> </children>

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.chart.LineChart?> <?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?> <?import javafx.scene.chart.NumberAxis?>
@ -22,83 +28,91 @@
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<SplitPane fx:id="racePane" dividerPositions="1.0" prefHeight="431.0" prefWidth="610.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceController"> <SplitPane fx:id="racePane" dividerPositions="1.0" prefHeight="431.0" prefWidth="610.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceController">
<items> <items>
<GridPane fx:id="canvasBase"> <StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
<columnConstraints> <children>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" /> <AnchorPane>
</columnConstraints> <children>
<rowConstraints> <GridPane fx:id="canvasBase" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> <columnConstraints>
</rowConstraints> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
<children> </columnConstraints>
<Pane prefHeight="200.0" prefWidth="400.0" GridPane.halignment="LEFT" GridPane.valignment="TOP"> <rowConstraints>
<children> <RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<Accordion> </rowConstraints>
<panes> </GridPane>
<TitledPane animated="false" prefHeight="395.0" prefWidth="222.0" text="Annotation Control"> <Pane prefHeight="200.0" prefWidth="400.0" visible="false">
<content> <children>
<AnchorPane fx:id="annotationPane" minHeight="0.0" minWidth="0.0"> <Accordion>
<children> <panes>
<CheckBox fx:id="showName" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" /> <TitledPane animated="false" prefHeight="395.0" prefWidth="222.0" text="Annotation Control">
<CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" /> <content>
<CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0" /> <AnchorPane fx:id="annotationPane" minHeight="0.0" minWidth="0.0">
<CheckBox fx:id="showBoatPath" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="75.0" /> <children>
<CheckBox fx:id="showTime" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" /> <CheckBox fx:id="showName" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
<CheckBox fx:id="showEstTime" mnemonicParsing="false" selected="true" text="Show Est. Time to Next Mark" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="125.0" /> <CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" />
<CheckBox fx:id="showGuideline" mnemonicParsing="false" text="Show Guideline" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="150.0" /> <CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0" />
<Separator layoutX="19.6" layoutY="175.6" prefHeight="0.0" prefWidth="200.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="175.0" /> <CheckBox fx:id="showBoatPath" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="75.0" />
<Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="175.0" /> <CheckBox fx:id="showTime" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" />
<RadioButton fx:id="hideAnnoRBtn" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="200.0"> <CheckBox fx:id="showEstTime" mnemonicParsing="false" selected="true" text="Show Est. Time to Next Mark" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="125.0" />
<toggleGroup> <CheckBox fx:id="showGuideline" mnemonicParsing="false" text="Show Guideline" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="150.0" />
<ToggleGroup fx:id="annoToggleGroup" /> <Separator layoutX="19.6" layoutY="175.6" prefHeight="0.0" prefWidth="200.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="175.0" />
</toggleGroup></RadioButton> <Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="175.0" />
<RadioButton fx:id="showAnnoRBtn" mnemonicParsing="false" text="Visible" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="225.0" /> <RadioButton fx:id="hideAnnoRBtn" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="200.0">
<RadioButton fx:id="partialAnnoRBtn" mnemonicParsing="false" text="Partial" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="250.0" /> <toggleGroup>
<RadioButton fx:id="importantAnnoRBtn" mnemonicParsing="false" text="Important" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="275.0" /> <ToggleGroup fx:id="annoToggleGroup" />
<Button fx:id="saveAnno" layoutX="11.0" layoutY="126.0" mnemonicParsing="false" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="300.0" /> </toggleGroup>
</children> </RadioButton>
</AnchorPane> <RadioButton fx:id="showAnnoRBtn" mnemonicParsing="false" text="Visible" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="225.0" />
</content> <RadioButton fx:id="partialAnnoRBtn" mnemonicParsing="false" text="Partial" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="250.0" />
</TitledPane> <RadioButton fx:id="importantAnnoRBtn" mnemonicParsing="false" text="Important" toggleGroup="$annoToggleGroup" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="275.0" />
<TitledPane animated="false" text="FPS Control"> <Button fx:id="saveAnno" layoutX="11.0" layoutY="126.0" mnemonicParsing="false" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="300.0" />
<content> </children>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> </AnchorPane>
<children> </content>
<CheckBox fx:id="showFPS" layoutX="-14.0" layoutY="13.0" mnemonicParsing="false" selected="true" text="Show FPS" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" /> </TitledPane>
</children> <TitledPane animated="false" text="FPS Control">
</AnchorPane> <content>
</content> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
</TitledPane> <children>
</panes> <CheckBox fx:id="showFPS" layoutX="-14.0" layoutY="13.0" mnemonicParsing="false" selected="true" text="Show FPS" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
</Accordion> </children>
</children> </AnchorPane>
</Pane> </content>
<Label fx:id="timer" layoutX="45.0" layoutY="146.0" maxHeight="20.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" GridPane.halignment="RIGHT" GridPane.valignment="BOTTOM"> </TitledPane>
<font> </panes>
<Font name="System Bold" size="15.0" /> </Accordion>
</font> </children>
</Label> </Pane>
<Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" GridPane.halignment="LEFT" GridPane.valignment="BOTTOM"> <Label fx:id="timer" maxHeight="20.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
<font> <font>
<Font name="System Bold" size="15.0" /> <Font name="System Bold" size="15.0" />
</font> </font>
</Label> </Label>
<Label fx:id="timeZone" text="Label" GridPane.halignment="RIGHT" GridPane.valignment="BOTTOM"> <Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0">
<GridPane.margin> <font>
<Font name="System Bold" size="15.0" />
</font>
</Label>
<Label fx:id="timeZone" text="Label" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
<font>
<Font name="System Bold" size="15.0" />
</font>
<padding>
<Insets bottom="20.0" /> <Insets bottom="20.0" />
</GridPane.margin> </padding>
<font> </Label>
<Font name="System Bold" size="15.0" /> <StackPane fx:id="arrowPane" alignment="TOP_RIGHT" mouseTransparent="true" prefHeight="150.0" prefWidth="150.0" snapToPixel="false" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
</font> <children>
</Label> <fx:include fx:id="arrow" source="arrow.fxml" />
<StackPane fx:id="arrowPane" alignment="TOP_RIGHT" mouseTransparent="true" prefHeight="150.0" prefWidth="150.0" snapToPixel="false"> </children>
<children> </StackPane>
<fx:include fx:id="arrow" source="arrow.fxml" /> <Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
</children> </children>
</StackPane> </AnchorPane>
</children> </children>
</GridPane> </StackPane>
<AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1"> <AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1">
<children> <children>
<TableView fx:id="boatInfoTable" layoutX="-2.0" prefHeight="265.0" prefWidth="242.0" AnchorPane.bottomAnchor="164.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="-62.0" AnchorPane.topAnchor="0.0"> <TableView fx:id="boatInfoTable" layoutX="-2.0" prefHeight="265.0" prefWidth="242.0" AnchorPane.bottomAnchor="164.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="-62.0" AnchorPane.topAnchor="0.0">

@ -1,61 +0,0 @@
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<!--<?import javafx.geometry.*?>-->
<!--<?import javafx.scene.control.*?>-->
<!--<?import javafx.scene.layout.*?>-->
<!--<?import javafx.scene.text.Font?>-->
<!--<AnchorPane fx:id="connectionWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.ConnectionController">-->
<!--<children>-->
<!--<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">-->
<!--<columnConstraints>-->
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
<!--</columnConstraints>-->
<!--<rowConstraints>-->
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
<!--</rowConstraints>-->
<!--<children>-->
<!--<Button fx:id="hostGameTitleBtn" maxWidth="204.0" mnemonicParsing="false" text="Host Game" GridPane.halignment="LEFT" GridPane.rowIndex="1">-->
<!--<font>-->
<!--<Font size="20.0" />-->
<!--</font>-->
<!--<GridPane.margin>-->
<!--<Insets left="50.0" />-->
<!--</GridPane.margin>-->
<!--</Button>-->
<!--<Button fx:id="connectGameBtn" maxWidth="204.0" mnemonicParsing="false" text="Connect to Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="1">-->
<!--<font>-->
<!--<Font size="20.0" />-->
<!--</font>-->
<!--<GridPane.margin>-->
<!--<Insets right="50.0" />-->
<!--</GridPane.margin>-->
<!--</Button>-->
<!--<RadioButton fx:id="nightRadioBtn" mnemonicParsing="false" text="Night Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">-->
<!--<padding>-->
<!--<Insets bottom="-50.0" />-->
<!--</padding>-->
<!--<GridPane.margin>-->
<!--<Insets left="80.0" />-->
<!--</GridPane.margin>-->
<!--</RadioButton>-->
<!--<RadioButton fx:id="dayRadioBtn" mnemonicParsing="false" text="Day Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">-->
<!--<padding>-->
<!--<Insets top="-50.0" />-->
<!--</padding>-->
<!--<GridPane.margin>-->
<!--<Insets left="80.0" />-->
<!--</GridPane.margin>-->
<!--</RadioButton>-->
<!--<Label text="Game" textAlignment="CENTER" GridPane.columnIndex="1" GridPane.halignment="CENTER">-->
<!--<font>-->
<!--<Font size="60.0" />-->
<!--</font>-->
<!--</Label>-->
<!--</children>-->
<!--</GridPane>-->
<!--</children>-->
<!--</AnchorPane>-->

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.RadioButton?> <?import javafx.scene.control.RadioButton?>
<?import javafx.scene.image.*?> <?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?> <?import javafx.scene.text.*?>
<AnchorPane fx:id="titleWrapper" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController"> <AnchorPane fx:id="titleWrapper" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController">
<children> <children>
<GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
@ -40,7 +43,7 @@
<Button layoutX="28.0" layoutY="152.0" mnemonicParsing="false" onAction="#controlBtnPressed" text="Controls" /> <Button layoutX="28.0" layoutY="152.0" mnemonicParsing="false" onAction="#controlBtnPressed" text="Controls" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4"> <Pane fx:id="menuPane" prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4">
<children> <children>
<ImageView fx:id="imgBoat" fitHeight="404.0" fitWidth="296.0" layoutX="268.0" pickOnBounds="true" preserveRatio="true"> <ImageView fx:id="imgBoat" fitHeight="404.0" fitWidth="296.0" layoutX="268.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
@ -77,6 +80,7 @@
<Font name="Comic Sans MS Bold" size="16.0" /> <Font name="Comic Sans MS Bold" size="16.0" />
</font> </font>
</Button> </Button>
<Label fx:id="tutorialLabel" alignment="CENTER" layoutX="94.0" layoutY="223.0" onMouseClicked="#tutorialStartPressed" prefHeight="167.0" prefWidth="206.0" style="-fx-shape: &quot;M 45.673,0 C 67.781,0 85.703,12.475 85.703,27.862 C 85.703,43.249 67.781,55.724 45.673,55.724 C 38.742,55.724 32.224,54.497 26.539,52.34 C 15.319,56.564 0,64.542 0,64.542 C 0,64.542 9.989,58.887 14.107,52.021 C 15.159,50.266 15.775,48.426 16.128,46.659 C 9.618,41.704 5.643,35.106 5.643,27.862 C 5.643,12.475 23.565,0 45.673,0 M 45.673,2.22 C 24.824,2.22 7.862,13.723 7.862,27.863 C 7.862,34.129 11.275,40.177 17.472,44.893 L 18.576,45.734 L 18.305,47.094 C 17.86,49.324 17.088,51.366 16.011,53.163 C 15.67,53.73 15.294,54.29 14.891,54.837 C 18.516,53.191 22.312,51.561 25.757,50.264 L 26.542,49.968 L 27.327,50.266 C 32.911,52.385 39.255,53.505 45.673,53.505 C 66.522,53.505 83.484,42.002 83.484,27.862 C 83.484,13.722 66.522,2.22 45.673,2.22 L 45.673,2.22 z &quot;; -fx-background-color: black, white; -fx-background-insets: 0,1; -fx-padding: 50;" text="How do you play this game? Click here!" textAlignment="CENTER" />
</children> </children>
</Pane> </Pane>
</children> </children>

@ -1,47 +0,0 @@
//package seng302.Mock;
//
//import org.junit.Before;
//import org.junit.Test;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import static org.junit.Assert.assertEquals;
//
///**
// * Created by jjg64 on 21/04/17.
// */
//public class BoatsXMLTest {
// private BoatXMLReader boatXMLReader;
//
// @Before
// public void setup() {
// try {
// boatXMLReader = new BoatXMLReader("mockXML/boatXML/boatTest.xml", false);
// } catch (Exception e) {
// e.printStackTrace();
// //fail("Cannot find mockXML/raceXML/raceTest.xml in the resources folder");
// }
// }
//
// @Test
// public void testInvalidParticipant() {
// Map<Integer, StreamedBoat> inputParticipants = new HashMap<>();
// inputParticipants.put(420, new StreamedBoat(420));
// boatXMLReader.setParticipants(inputParticipants);
// boatXMLReader.read();
// assertEquals(boatXMLReader.getBoats().size(), 0);
// }
//
// @Test
// public void testValidParticipant() {
// Map<Integer, StreamedBoat> inputParticipants = new HashMap<>();
// inputParticipants.put(101, new StreamedBoat(101));
// boatXMLReader.setParticipants(inputParticipants);
// boatXMLReader.read();
// assertEquals(boatXMLReader.getBoats().size(), 1);
// StreamedBoat boat = (StreamedBoat) boatXMLReader.getBoats().get(0);
// assertEquals(boat.getSourceID(), 101);
// }
//
//}

@ -1,26 +0,0 @@
//package seng302.Mock;
//
//import org.junit.Test;
//import org.xml.sax.SAXException;
//
//import javax.xml.parsers.ParserConfigurationException;
//import java.io.IOException;
//import java.text.ParseException;
//
///**
// * Created by jjg64 on 1/05/17.
// */
//public class FailBoatXMLTest {
// private final String path = "mockXML/boatXML/";
//
// @Test(expected = NumberFormatException.class)
// public void invalidSourceID() throws SAXException, ParserConfigurationException, ParseException, IOException {
// new BoatXMLReader(path + "invalidSourceID.xml");
// }
//
// @Test(expected = NullPointerException.class)
// public void insufficientInformation() throws SAXException, ParserConfigurationException, ParseException, IOException {
// new BoatXMLReader(path + "insufficientInformation.xml");
// }
//
//}

@ -1,345 +0,0 @@
//package shared.model;
//
//
//import mock.model.Polars;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//import org.mockito.Mockito;
//import org.xml.sax.SAXException;
//
//import javax.xml.parsers.ParserConfigurationException;
//import java.io.IOException;
//import java.text.ParseException;
//import java.util.ArrayList;
//
//import static org.junit.Assert.*;
//import static org.mockito.Mockito.*;
//
///**
// * Created by esa46 on 15/03/17.
// */
//public class RaceTest{
//
//
// private CompoundMark ORIGIN;
//
// private CompoundMark THREE_NM_FROM_ORIGIN;
//
// private CompoundMark FIFTEEN_NM_FROM_ORIGIN;
//
// private ArrayList<Leg> TEST_LEGS = new ArrayList<>();
//
// private int START_LEG_DISTANCE = 3;
// private int MIDDLE_LEG_DISTANCE = 12;
//
// private Leg START_LEG;
//
// private Leg MIDDLE_LEG;
//
// private Leg FINISH_LEG;
//
//
// @Before
// public void setUp() {
//
// ORIGIN = new CompoundMark(
// 1,
// "origin compound",
// new Mark(1, "test origin 1", new GPSCoordinate(0, 0)) );
//
//
// THREE_NM_FROM_ORIGIN = new CompoundMark(
// 2,
// "3 NM from origin compound",
// new Mark(2, "test mark 2", new GPSCoordinate(0.050246769, 0)) );
//
//
// FIFTEEN_NM_FROM_ORIGIN = new CompoundMark(
// 3,
// "15 NM from origin compound",
// new Mark(3, "test mark 3", new GPSCoordinate(0.251233845, 0)) );
//
//
// START_LEG = new Leg("Start", ORIGIN, THREE_NM_FROM_ORIGIN, 0);
//
//
// MIDDLE_LEG = new Leg("Middle", THREE_NM_FROM_ORIGIN, FIFTEEN_NM_FROM_ORIGIN, 1);
//
//
// FINISH_LEG = new Leg("Finish", FIFTEEN_NM_FROM_ORIGIN, FIFTEEN_NM_FROM_ORIGIN, 2);
//
//
// TEST_LEGS.add(START_LEG);
// TEST_LEGS.add(MIDDLE_LEG);
// TEST_LEGS.add(FINISH_LEG);
// }
//
// @Ignore
// @Test
// public void countdownTimerSendsBoatLocations() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
// Race testRace = new Race(raceDataSource, mockOutput);
// testRace.initialiseBoats();
// testRace.countdownTimer.handle(1);
// verify(mockOutput, atLeast(boatDataSource.getBoats().size())).parseBoatLocation(anyInt(), anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyLong());
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void countdownTimerSendsRaceStatusMessages() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
// Race testRace = new Race(dataSource, mockOutput);
// testRace.initialiseBoats();
// testRace.countdownTimer.handle(1);
// verify(mockOutput, atLeast(1)).parseRaceStatus(any());
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void checkPositionFinishedUpdatesNumberFinishedBoats() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
// Race testRace = new Race(dataSource, mockOutput);
// testRace.initialiseBoats();
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(FINISH_LEG);
// testBoat.setDistanceTravelledInLeg(1);
// testRace.checkPosition(testBoat, 1);
//
// assertEquals(testRace.getNumberOfActiveBoats(), 0);
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void checkPositionSetFinishedBoatVelocityTo0() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
// Race testRace = new Race(dataSource, mockOutput);
// testRace.initialiseBoats();
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(FINISH_LEG);
// testBoat.setDistanceTravelledInLeg(1);
// testRace.checkPosition(testBoat, 1);
//
// assertEquals(testBoat.getCurrentSpeed(), 0, 1e-8);
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void checkPositionSetsFinishTime() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
// Race testRace = new Race(dataSource, mockOutput);
// testRace.initialiseBoats();
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(FINISH_LEG);
// testBoat.setDistanceTravelledInLeg(1);
// testRace.checkPosition(testBoat, 1);
//
// assertEquals(testBoat.getTimeFinished(), 1, 1e-8);
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void checkPositionUnfinishedDoesntUpdateNumberFinishedBoats() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
// Race testRace = new Race(dataSource, mockOutput);
// testRace.initialiseBoats();
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(START_LEG);
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE);
// testRace.checkPosition(testBoat, 1);
//
// assertEquals(testRace.getNumberOfActiveBoats(), 1);
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
//
// @Ignore
// @Test
// public void distanceTravelledBeforeUpdatingLegIsRetained() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// RaceDataSource dataSource = new RaceXMLReader("mockXML/raceTest.xml", new BoatXMLReader("mockXML/boatTest.xml", new Polars()));
// Race testRace = new Race(dataSource, mockOutput);
// testRace.initialiseBoats();
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(START_LEG);
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE + 1);
// testRace.checkPosition(testBoat, 0);
//
// assertEquals(testBoat.getDistanceTravelledInLeg(), 1, 1e-7);
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void doNotFinishAnswersYesIf100PercentChance() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
// Race testRace = new Race(raceDataSource, mockOutput);
//
// testRace.setDnfChance(100);
// assertTrue(testRace.doNotFinish());
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void doNotFinishAnswersNoIf0PercentChance() {
//
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
// Race testRace = new Race(raceDataSource, mockOutput);
// testRace.setDnfChance(0);
// assertFalse(testRace.doNotFinish());
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void boatsAreSetToDNF() {
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
// Race testRace = new Race(raceDataSource, mockOutput);
// testRace.setDnfChance(100);
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(START_LEG);
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE + 1);
// testRace.checkPosition(testBoat, 1);
// assertEquals(testBoat.getCurrentLeg().getName(), "DNF");
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
//
// }
//
// @Ignore
// @Test
// public void updatePositionIgnoresFinishedBoats() {
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
// Race testRace = new Race(raceDataSource, mockOutput);
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(FINISH_LEG);
// testBoat.setCurrentPosition(ORIGIN.getAverageGPSCoordinate());
// testRace.updatePosition(testBoat, 1, 1);
// assertEquals(testBoat.getCurrentPosition(), ORIGIN.getAverageGPSCoordinate());
//
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void updatePositionChangesBoatPosition() {
// try {
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml", new Polars());
// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
// Race testRace = new Race(raceDataSource, mockOutput);
// testRace.initialiseBoats();
// Boat testBoat = testRace.getBoats().get(0);
// testBoat.setCurrentLeg(START_LEG);
// testBoat.setDistanceTravelledInLeg(START_LEG_DISTANCE - 1);
// testBoat.setCurrentPosition(ORIGIN.getAverageGPSCoordinate());
// testRace.updatePosition(testBoat, 100, 100);
// assertFalse(testBoat.getCurrentPosition() == ORIGIN.getAverageGPSCoordinate());
// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
// e.printStackTrace();
// fail();
// }
// }
//
// @Ignore
// @Test
// public void windDirectionCorrectValues(){
//// try {
//// MockOutput mockOutput = Mockito.mock(MockOutput.class);
//// BoatDataSource boatDataSource = new BoatXMLReader("mockXML/boatTest.xml");
//// RaceDataSource raceDataSource = new RaceXMLReader("mockXML/raceTest.xml", boatDataSource);
//// Race testRace = new Race(raceDataSource, mockOutput);
//// testRace.setChangeWind(1);
//// testRace.setWindDir(65535);
//// testRace.changeWindDir();
//// assertEquals(100, testRace.getWind());
//// } catch (ParserConfigurationException | IOException | SAXException | ParseException | StreamedCourseXMLException e) {
//// e.printStackTrace();
//// fail();
//// }
// }
//
//
//}

@ -1,100 +0,0 @@
//package visualiser.model;
//
//
//import org.junit.Before;
//import org.junit.Test;
//import shared.dataInput.RaceXMLReader;
//import shared.dataInput.XMLReader;
//import shared.exceptions.InvalidRaceDataException;
//import shared.model.GPSCoordinate;
//
//import java.nio.charset.StandardCharsets;
//import java.util.List;
//
//import static org.junit.Assert.assertEquals;
//import static org.junit.Assert.fail;
//
///**
// * Tests only work on the current version of mockXML/raceXML/raceTest.xml
// */
//public class VisualiserRaceTest {
// private RaceXMLReader streamedCourseXMLReader;
// private List<GPSCoordinate> boundary;
//
// @Before
// public void setup() {
// try {
// streamedCourseXMLReader = new RaceXMLReader(XMLReader.readXMLFileToString("mockXML/raceXML/raceTest.xml", StandardCharsets.UTF_8));
// boundary = streamedCourseXMLReader.getBoundary();
// } catch (InvalidRaceDataException e) {
// e.printStackTrace();
// fail("Cannot find mockXML/raceXML/raceTest.xml in the resources folder");
// }
// }
//
// @Test
// public void testAllBoundaryPointsRead() {
// assertEquals(boundary.size(), 10);
// }
//
// @Test
// public void testBoundaryPointData() {
// // First point
// assertEquals(boundary.get(0).getLatitude(), -36.8325, 1e-6);
// assertEquals(boundary.get(0).getLongitude(), 174.8325, 1e-6);
//
// // Last point
// assertEquals(boundary.get(boundary.size() - 1).getLatitude(), -36.83417, 1e-6);
// assertEquals(boundary.get(boundary.size() - 1).getLongitude(), 174.84767, 1e-6);
// }
//
// @Test
// public void testMapEdges() {
// double maxLatitude = streamedCourseXMLReader.getMapBottomRight().getLatitude() - streamedCourseXMLReader.getPadding();
// double maxLongitude = streamedCourseXMLReader.getMapBottomRight().getLongitude() - streamedCourseXMLReader.getPadding();
// double minLatitude = streamedCourseXMLReader.getMapTopLeft().getLatitude() - streamedCourseXMLReader.getPadding();
// double minLongitude = streamedCourseXMLReader.getMapTopLeft().getLongitude() - streamedCourseXMLReader.getPadding();
//
// assertEquals(maxLatitude, -36.81033, 1e-6);
// assertEquals(maxLongitude, 174.88217, 1e-6);
// assertEquals(minLatitude, -36.83417, 1e-6);
// assertEquals(minLongitude, 174.81983, 1e-6);
// }
//
// @Test
// public void testRaceSettings() {
//
// }
//
// @Test
// public void correctLegSequence() {
// List<Leg> legs = streamedCourseXMLReader.getLegs();
// String[] expectedNames = {
// "StartLine",
// "M1",
// "M2",
// "Gate"
// };
// for(int i = 0; i < legs.size(); i++) {
// assertEquals(expectedNames[i], legs.get(i).getName());
// }
// }
//
// /**
// * raceTest.xml is not compliant with this test. Markers are positioned far out of bounds.
// */
// @Test
// @Ignore
// public void markersWithinRaceBoundaries() {
// GPSCoordinate topLeft = streamedCourseXMLReader.getMapTopLeft();
// GPSCoordinate bottomRight = streamedCourseXMLReader.getMapBottomRight();
//
// for(Marker compoundMark : streamedCourseXMLReader.getMarkers()) {
// GPSCoordinate centre = compoundMark.getAverageGPSCoordinate();
// assertTrue(centre.getLatitude() < bottomRight.getLatitude());
// assertTrue(centre.getLatitude() > topLeft.getLatitude());
// assertTrue(centre.getLongitude() > bottomRight.getLongitude());
// assertTrue(centre.getLongitude() < topLeft.getLongitude());
// }
// }
//}

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<java version="1.8.0_111" class="java.beans.XMLDecoder"> <java version="1.8.0_144" class="java.beans.XMLDecoder">
<object class="java.util.HashMap"> <object class="java.util.HashMap">
<void method="put"> <void method="put">
<string>SPACE</string> <string>SPACE</string>
@ -10,8 +10,8 @@
<object class="visualiser.gameController.Keys.SailsToggleKey"/> <object class="visualiser.gameController.Keys.SailsToggleKey"/>
</void> </void>
<void method="put"> <void method="put">
<string>DOWN</string> <string>LEFT</string>
<object class="visualiser.gameController.Keys.DownWindKey"/> <object class="visualiser.gameController.Keys.UpWindKey"/>
</void> </void>
<void method="put"> <void method="put">
<string>X</string> <string>X</string>
@ -22,12 +22,12 @@
<object class="visualiser.gameController.Keys.TackGybeKey"/> <object class="visualiser.gameController.Keys.TackGybeKey"/>
</void> </void>
<void method="put"> <void method="put">
<string>Z</string> <string>RIGHT</string>
<object class="visualiser.gameController.Keys.ZoomInKey"/> <object class="visualiser.gameController.Keys.DownWindKey"/>
</void> </void>
<void method="put"> <void method="put">
<string>UP</string> <string>Z</string>
<object class="visualiser.gameController.Keys.UpWindKey"/> <object class="visualiser.gameController.Keys.ZoomInKey"/>
</void> </void>
</object> </object>
</java> </java>

Loading…
Cancel
Save