Removed BoatInRace from shared model, refactored
#story[778]
This commit is contained in:
@@ -29,7 +29,6 @@ public class App extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
RaceDataSource raceData = new RaceXMLReader("raceXML/bermuda_AC35.xml");
|
RaceDataSource raceData = new RaceXMLReader("raceXML/bermuda_AC35.xml");
|
||||||
RegattaDataSource regattaData = new RegattaXMLReader("mockXML/regattaTest.xml");
|
RegattaDataSource regattaData = new RegattaXMLReader("mockXML/regattaTest.xml");
|
||||||
Event raceEvent = new Event(raceData, regattaData);
|
Event raceEvent = new Event(raceData, regattaData);
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import org.w3c.dom.Attr;
|
|||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import seng302.Exceptions.InvalidBoatDataException;
|
import seng302.Exceptions.InvalidBoatDataException;
|
||||||
import SharedModel.BoatInRace;
|
import seng302.Model.Boat;
|
||||||
|
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
@@ -23,10 +24,10 @@ import java.util.List;
|
|||||||
public class BoatData {
|
public class BoatData {
|
||||||
|
|
||||||
Document doc;
|
Document doc;
|
||||||
private List<BoatInRace> boatData;
|
private List<Boat> boatData;
|
||||||
|
|
||||||
|
|
||||||
public BoatData(List<BoatInRace> boatData) {
|
public BoatData(List<Boat> boatData) {
|
||||||
this.boatData = boatData;
|
this.boatData = boatData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import org.w3c.dom.Document;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import seng302.DataInput.RaceDataSource;
|
import seng302.DataInput.RaceDataSource;
|
||||||
import seng302.Exceptions.InvalidRaceDataException;
|
import seng302.Exceptions.InvalidRaceDataException;
|
||||||
import SharedModel.BoatInRace;
|
|
||||||
import SharedModel.GPSCoordinate;
|
import SharedModel.GPSCoordinate;
|
||||||
import SharedModel.Marker;
|
import SharedModel.Marker;
|
||||||
|
import seng302.Model.Boat;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
@@ -129,7 +129,7 @@ public class RaceData {
|
|||||||
private void appendParticipants() {
|
private void appendParticipants() {
|
||||||
Element participantsElement = doc.createElement("Participants");
|
Element participantsElement = doc.createElement("Participants");
|
||||||
|
|
||||||
for (BoatInRace boat : dataSource.getBoats()) {
|
for (Boat boat : dataSource.getBoats()) {
|
||||||
Element yachtElement = doc.createElement("Yacht");
|
Element yachtElement = doc.createElement("Yacht");
|
||||||
yachtElement.setAttribute("SourceID", boat.getSourceID() + "");
|
yachtElement.setAttribute("SourceID", boat.getSourceID() + "");
|
||||||
participantsElement.appendChild(yachtElement);
|
participantsElement.appendChild(yachtElement);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package seng302.DataInput;
|
package seng302.DataInput;
|
||||||
|
|
||||||
import SharedModel.BoatInRace;
|
|
||||||
import SharedModel.GPSCoordinate;
|
import SharedModel.GPSCoordinate;
|
||||||
import SharedModel.Leg;
|
import SharedModel.Leg;
|
||||||
import SharedModel.Marker;
|
import SharedModel.Marker;
|
||||||
|
import seng302.Model.Boat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
* Created by connortaylorbrown on 19/04/17.
|
* Created by connortaylorbrown on 19/04/17.
|
||||||
*/
|
*/
|
||||||
public interface RaceDataSource {
|
public interface RaceDataSource {
|
||||||
List<BoatInRace> getBoats();
|
List<Boat> getBoats();
|
||||||
|
|
||||||
List<Leg> getLegs();
|
List<Leg> getLegs();
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import javafx.scene.paint.Color;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import SharedModel.BoatInRace;
|
|
||||||
import SharedModel.GPSCoordinate;
|
import SharedModel.GPSCoordinate;
|
||||||
import SharedModel.Leg;
|
import SharedModel.Leg;
|
||||||
import SharedModel.Marker;
|
import SharedModel.Marker;
|
||||||
|
import seng302.Model.Boat;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
||||||
private static double COORDINATEPADDING = 0.0005;
|
private static double COORDINATEPADDING = 0.0005;
|
||||||
private String raceID;
|
private String raceID;
|
||||||
private List<BoatInRace> boats = new ArrayList<>();
|
private List<Boat> boats = new ArrayList<>();
|
||||||
private Color[] colors = {Color.BLUEVIOLET, Color.BLACK, Color.RED, Color.ORANGE, Color.DARKOLIVEGREEN, Color.LIMEGREEN};//TODO make this established in xml or come up with a better system.
|
private Color[] colors = {Color.BLUEVIOLET, Color.BLACK, Color.RED, Color.ORANGE, Color.DARKOLIVEGREEN, Color.LIMEGREEN};//TODO make this established in xml or come up with a better system.
|
||||||
private List<Leg> legs = new ArrayList<>();
|
private List<Leg> legs = new ArrayList<>();
|
||||||
private GPSCoordinate mark, startPt1, startPt2, finishPt1, finishPt2, leewardPt1, leewardPt2, windwardPt1, windwardPt2;
|
private GPSCoordinate mark, startPt1, startPt2, finishPt1, finishPt2, leewardPt1, leewardPt2, windwardPt1, windwardPt2;
|
||||||
@@ -87,7 +87,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|||||||
String abbrev = getTextValueOfNode((Element) nBoats.item(i), "abbr");
|
String abbrev = getTextValueOfNode((Element) nBoats.item(i), "abbr");
|
||||||
double velo = Double.parseDouble(getTextValueOfNode((Element) nBoats.item(i), "speed"));
|
double velo = Double.parseDouble(getTextValueOfNode((Element) nBoats.item(i), "speed"));
|
||||||
int sourceID = Integer.parseInt(getTextValueOfNode((Element) nBoats.item(i), "sourceID"));
|
int sourceID = Integer.parseInt(getTextValueOfNode((Element) nBoats.item(i), "sourceID"));
|
||||||
BoatInRace boat = new BoatInRace(name, velo, colors[i], abbrev, sourceID);
|
Boat boat = new Boat(name, velo, abbrev, sourceID);
|
||||||
boat.setCurrentPosition(startPt1);
|
boat.setCurrentPosition(startPt1);
|
||||||
if (legs.size() > 0) {
|
if (legs.size() > 0) {
|
||||||
boat.setCurrentLeg(legs.get(0));
|
boat.setCurrentLeg(legs.get(0));
|
||||||
@@ -301,7 +301,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|||||||
return new GPSCoordinate(startLat, startLong);
|
return new GPSCoordinate(startLat, startLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BoatInRace> getBoats() {
|
public List<Boat> getBoats() {
|
||||||
return boats;
|
return boats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,154 @@
|
|||||||
|
package seng302.Model;
|
||||||
|
|
||||||
|
import SharedModel.*;
|
||||||
|
import SharedModel.Leg;
|
||||||
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by esa46 on 1/05/17.
|
||||||
|
*/
|
||||||
|
public class Boat {
|
||||||
|
private String name;
|
||||||
|
private double velocity;
|
||||||
|
private double scaledVelocity;
|
||||||
|
private String abbrev;
|
||||||
|
private int sourceID;
|
||||||
|
private SharedModel.Leg currentLeg;
|
||||||
|
private double distanceTravelledInLeg;
|
||||||
|
private GPSCoordinate currentPosition;
|
||||||
|
private long timeFinished = -1;
|
||||||
|
private boolean started = false;
|
||||||
|
private double heading;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boat initialiser which keeps all of the information of the boat.
|
||||||
|
*
|
||||||
|
* @param name Name of the Boat.
|
||||||
|
* @param velocity Speed in m/s that the boat travels at.
|
||||||
|
* @param abbrev nam abbreviation
|
||||||
|
* @param sourceID id of boat
|
||||||
|
*/
|
||||||
|
public Boat(String name, double velocity, String abbrev, int sourceID) {
|
||||||
|
this.velocity = velocity;
|
||||||
|
this.abbrev = abbrev;
|
||||||
|
this.name = name;
|
||||||
|
this.sourceID = sourceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the azimuth of the travel via map coordinates of the raceMarkers
|
||||||
|
*
|
||||||
|
* @return the direction that the boat is heading towards in degrees (-180 to 180).
|
||||||
|
*/
|
||||||
|
public double calculateAzimuth() {
|
||||||
|
|
||||||
|
GeodeticCalculator calc = new GeodeticCalculator();
|
||||||
|
GPSCoordinate start = currentLeg.getStartMarker().getAverageGPSCoordinate();
|
||||||
|
GPSCoordinate end = currentLeg.getEndMarker().getAverageGPSCoordinate();
|
||||||
|
|
||||||
|
calc.setStartingGeographicPoint(start.getLongitude(), start.getLatitude());
|
||||||
|
calc.setDestinationGeographicPoint(end.getLongitude(), end.getLatitude());
|
||||||
|
|
||||||
|
return calc.getAzimuth();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double calculateHeading() {
|
||||||
|
double azimuth = this.calculateAzimuth();
|
||||||
|
|
||||||
|
if (azimuth >= 0) {
|
||||||
|
return azimuth;
|
||||||
|
} else {
|
||||||
|
return azimuth + 360;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getVelocity() {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVelocity(double velocity) {
|
||||||
|
this.velocity = velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getScaledVelocity() {
|
||||||
|
return scaledVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScaledVelocity(double scaledVelocity) {
|
||||||
|
this.scaledVelocity = scaledVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbbrev() {
|
||||||
|
return abbrev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbbrev(String abbrev) {
|
||||||
|
this.abbrev = abbrev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSourceID() {
|
||||||
|
return sourceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceID(int sourceID) {
|
||||||
|
this.sourceID = sourceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Leg getCurrentLeg() {
|
||||||
|
return currentLeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentLeg(Leg currentLeg) {
|
||||||
|
this.currentLeg = currentLeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDistanceTravelledInLeg() {
|
||||||
|
return distanceTravelledInLeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistanceTravelledInLeg(double distanceTravelledInLeg) {
|
||||||
|
this.distanceTravelledInLeg = distanceTravelledInLeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GPSCoordinate getCurrentPosition() {
|
||||||
|
return currentPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentPosition(GPSCoordinate currentPosition) {
|
||||||
|
this.currentPosition = currentPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimeFinished() {
|
||||||
|
return timeFinished;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeFinished(long timeFinished) {
|
||||||
|
this.timeFinished = timeFinished;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStarted() {
|
||||||
|
return started;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarted(boolean started) {
|
||||||
|
this.started = started;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getHeading() {
|
||||||
|
return heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeading(double heading) {
|
||||||
|
this.heading = heading;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,8 +41,11 @@ public class Event {
|
|||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
|
|
||||||
|
System.out.println("Sending Regatta");
|
||||||
sendRegattaData();
|
sendRegattaData();
|
||||||
|
System.out.println("Sending Race");
|
||||||
sendRaceData();
|
sendRaceData();
|
||||||
|
System.out.println("Sending Boat");
|
||||||
sendBoatData();
|
sendBoatData();
|
||||||
|
|
||||||
Race newRace = new Race(raceDataSource, 15, mockOutput);
|
Race newRace = new Race(raceDataSource, 15, mockOutput);
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import java.util.Random;
|
|||||||
* Created by fwy13 on 3/03/17.
|
* Created by fwy13 on 3/03/17.
|
||||||
*/
|
*/
|
||||||
public class Race implements Runnable {
|
public class Race implements Runnable {
|
||||||
//protected SharedModel.BoatInRace[] startingBoats;
|
//protected Boat[] startingBoats;
|
||||||
protected ObservableList<SharedModel.BoatInRace> startingBoats;
|
protected ObservableList<Boat> startingBoats;
|
||||||
protected List<SharedModel.Leg> legs;
|
protected List<SharedModel.Leg> legs;
|
||||||
protected int boatsFinished = 0;
|
protected int boatsFinished = 0;
|
||||||
protected long totalTimeElapsed;
|
protected long totalTimeElapsed;
|
||||||
@@ -44,7 +44,7 @@ public class Race implements Runnable {
|
|||||||
* @param legs Number of marks in order that the boats pass in order to complete the race.
|
* @param legs Number of marks in order that the boats pass in order to complete the race.
|
||||||
* @param scaleFactor for race
|
* @param scaleFactor for race
|
||||||
*/
|
*/
|
||||||
public Race(List<SharedModel.BoatInRace> boats, List<SharedModel.Leg> legs, int scaleFactor, MockOutput mockOutput) {
|
public Race(List<Boat> boats, List<SharedModel.Leg> legs, int scaleFactor, MockOutput mockOutput) {
|
||||||
|
|
||||||
this.startingBoats = FXCollections.observableArrayList(boats);
|
this.startingBoats = FXCollections.observableArrayList(boats);
|
||||||
this.legs = legs;
|
this.legs = legs;
|
||||||
@@ -142,7 +142,7 @@ public class Race implements Runnable {
|
|||||||
|
|
||||||
System.setProperty("javafx.animation.fullspeed", "true");
|
System.setProperty("javafx.animation.fullspeed", "true");
|
||||||
|
|
||||||
for (SharedModel.BoatInRace boat : startingBoats) {
|
for (Boat boat : startingBoats) {
|
||||||
boat.setStarted(true);
|
boat.setStarted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,8 +160,8 @@ public class Race implements Runnable {
|
|||||||
ArrayList<BoatStatusMessage> boatStatusMessages = new ArrayList<BoatStatusMessage>();
|
ArrayList<BoatStatusMessage> boatStatusMessages = new ArrayList<BoatStatusMessage>();
|
||||||
|
|
||||||
//For each boat, we update it's position, and generate a BoatLocationMessage.
|
//For each boat, we update it's position, and generate a BoatLocationMessage.
|
||||||
for (SharedModel.BoatInRace boat : startingBoats) {
|
for (Boat boat : startingBoats) {
|
||||||
if (boat != null && !boat.isFinished()) {
|
if (boat != null && boat.getTimeFinished() > 0) {
|
||||||
//Update position.
|
//Update position.
|
||||||
updatePosition(boat, Math.round(1000 / lastFPS) > 20 ? 15 : Math.round(1000 / lastFPS));
|
updatePosition(boat, Math.round(1000 / lastFPS) > 20 ? 15 : Math.round(1000 / lastFPS));
|
||||||
checkPosition(boat, totalTimeElapsed);
|
checkPosition(boat, totalTimeElapsed);
|
||||||
@@ -179,21 +179,6 @@ public class Race implements Runnable {
|
|||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update position of boats in race, no position if on starting leg or DNF.
|
|
||||||
*/
|
|
||||||
protected void updatePositions() {
|
|
||||||
FXCollections.sort(startingBoats, (a, b) -> b.getCurrentLeg().getLegNumber() - a.getCurrentLeg().getLegNumber());
|
|
||||||
for (SharedModel.BoatInRace boat : startingBoats) {
|
|
||||||
if (boat != null) {
|
|
||||||
boat.setPosition(Integer.toString(startingBoats.indexOf(boat) + 1));
|
|
||||||
//System.out.println(boat.toString() + " " + boat.getPosition());//TEMP debug print
|
|
||||||
if (boat.getCurrentLeg().getName().equals("DNF") || boat.getCurrentLeg().getLegNumber() == 0)
|
|
||||||
boat.setPosition("-");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//System.out.println("=====");//TEMP debug print
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initialiseBoats() {
|
public void initialiseBoats() {
|
||||||
SharedModel.Leg officialStart = legs.get(0);
|
SharedModel.Leg officialStart = legs.get(0);
|
||||||
@@ -202,7 +187,7 @@ public class Race implements Runnable {
|
|||||||
|
|
||||||
ArrayList<SharedModel.Marker> startMarkers = getSpreadStartingPositions();
|
ArrayList<SharedModel.Marker> startMarkers = getSpreadStartingPositions();
|
||||||
for (int i = 0; i < startingBoats.size(); i++) {
|
for (int i = 0; i < startingBoats.size(); i++) {
|
||||||
SharedModel.BoatInRace boat = startingBoats.get(i);
|
Boat boat = startingBoats.get(i);
|
||||||
if (boat != null) {
|
if (boat != null) {
|
||||||
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
||||||
SharedModel.Leg startLeg = new SharedModel.Leg(name, 0);
|
SharedModel.Leg startLeg = new SharedModel.Leg(name, 0);
|
||||||
@@ -271,7 +256,7 @@ public class Race implements Runnable {
|
|||||||
* @param boat to be updated
|
* @param boat to be updated
|
||||||
* @param millisecondsElapsed since last update
|
* @param millisecondsElapsed since last update
|
||||||
*/
|
*/
|
||||||
protected void updatePosition(SharedModel.BoatInRace boat, int millisecondsElapsed) {
|
protected void updatePosition(Boat boat, int millisecondsElapsed) {
|
||||||
|
|
||||||
//distanceTravelled = velocity (nm p hr) * time taken to update loop
|
//distanceTravelled = velocity (nm p hr) * time taken to update loop
|
||||||
double distanceTravelled = (boat.getScaledVelocity() * millisecondsElapsed) / 3600000;
|
double distanceTravelled = (boat.getScaledVelocity() * millisecondsElapsed) / 3600000;
|
||||||
@@ -289,17 +274,17 @@ public class Race implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkPosition(SharedModel.BoatInRace boat, long timeElapsed) {
|
protected void checkPosition(Boat boat, long timeElapsed) {
|
||||||
if (boat.getDistanceTravelledInLeg() > boat.getCurrentLeg().getDistance()) {
|
if (boat.getDistanceTravelledInLeg() > boat.getCurrentLeg().getDistance()) {
|
||||||
//boat has passed onto new leg
|
//boat has passed onto new leg
|
||||||
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
||||||
//boat has finished
|
//boat has finished
|
||||||
boatsFinished++;
|
boatsFinished++;
|
||||||
boat.setFinished(true);
|
boat.setTimeFinished(timeElapsed);
|
||||||
boat.setTimeFinished(timeElapsed);
|
boat.setTimeFinished(timeElapsed);
|
||||||
} else if (doNotFinish()) {
|
} else if (doNotFinish()) {
|
||||||
boatsFinished++;
|
boatsFinished++;
|
||||||
boat.setFinished(true);
|
boat.setTimeFinished(timeElapsed);
|
||||||
boat.setCurrentLeg(new SharedModel.Leg("DNF", -1));
|
boat.setCurrentLeg(new SharedModel.Leg("DNF", -1));
|
||||||
boat.setVelocity(0);
|
boat.setVelocity(0);
|
||||||
boat.setScaledVelocity(0);
|
boat.setScaledVelocity(0);
|
||||||
@@ -313,19 +298,17 @@ public class Race implements Runnable {
|
|||||||
//Add overshoot distance into the distance travelled for the next leg
|
//Add overshoot distance into the distance travelled for the next leg
|
||||||
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg());
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg());
|
||||||
}
|
}
|
||||||
//Update the boat display table in the GUI to reflect the leg change
|
|
||||||
updatePositions();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the boats that have started the race.
|
* Returns the boats that have started the race.
|
||||||
*
|
*
|
||||||
* @return ObservableList of SharedModel.BoatInRace class that participated in the race.
|
* @return ObservableList of Boat class that participated in the race.
|
||||||
* @see ObservableList
|
* @see ObservableList
|
||||||
* @see SharedModel.BoatInRace
|
* @see Boat
|
||||||
*/
|
*/
|
||||||
public ObservableList<SharedModel.BoatInRace> getStartingBoats() {
|
public ObservableList<Boat> getStartingBoats() {
|
||||||
return startingBoats;
|
return startingBoats;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-58
@@ -9,11 +9,11 @@ import static junit.framework.TestCase.*;
|
|||||||
/**
|
/**
|
||||||
* Created by esa46 on 22/03/17.
|
* Created by esa46 on 22/03/17.
|
||||||
*/
|
*/
|
||||||
public class BoatInRaceTest {
|
public class BoatTest {
|
||||||
|
|
||||||
|
|
||||||
private GPSCoordinate ORIGIN_COORDS = new GPSCoordinate(0, 0);
|
private GPSCoordinate ORIGIN_COORDS = new GPSCoordinate(0, 0);
|
||||||
private SharedModel.BoatInRace TEST_BOAT = new SharedModel.BoatInRace("Test", 1, Color.ALICEBLUE, "tt", 1);
|
private Boat TEST_BOAT = new Boat("Test", 1, "tt", 1);
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -95,61 +95,5 @@ public class BoatInRaceTest {
|
|||||||
assertEquals(TEST_BOAT.calculateHeading(), 270, 1e-8);
|
assertEquals(TEST_BOAT.calculateHeading(), 270, 1e-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void createNewBoatCreatesInstanceOfSuperClass() {
|
|
||||||
|
|
||||||
SharedModel.BoatInRace testBoat = new SharedModel.BoatInRace("Boat", 20, Color.ALICEBLUE, "tt", 1);
|
|
||||||
testBoat.setName("Name can change");
|
|
||||||
assertTrue(testBoat instanceof SharedModel.Boat);
|
|
||||||
assertTrue(testBoat.getCurrentLeg() == null);
|
|
||||||
assertTrue(testBoat.getCurrentPosition() == null);
|
|
||||||
assertTrue(testBoat.toString().contains("Name can change"));
|
|
||||||
assertEquals(testBoat.getVelocity(), 20.0);
|
|
||||||
assertTrue(testBoat.getVelocityProp().toString().contains("20"));
|
|
||||||
assertTrue(testBoat.getAbbrev().equals("tt"));
|
|
||||||
assertTrue(testBoat.getColour().equals(Color.ALICEBLUE));
|
|
||||||
assertEquals(testBoat.getSourceID(), 1);
|
|
||||||
assertFalse(testBoat.isFinished());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWakeAtProperHeading() throws Exception {
|
|
||||||
SharedModel.BoatInRace boat = new SharedModel.BoatInRace("Test", 1, Color.ALICEBLUE, "tt", 1);
|
|
||||||
|
|
||||||
// Construct leg of 0 degrees
|
|
||||||
SharedModel.Marker startMarker = new SharedModel.Marker(ORIGIN_COORDS);
|
|
||||||
SharedModel.Marker endMarker = new SharedModel.Marker(new GPSCoordinate(50, 0));
|
|
||||||
SharedModel.Leg leg0deg = new SharedModel.Leg("Start", startMarker, endMarker, 0);
|
|
||||||
boat.setCurrentLeg(leg0deg);
|
|
||||||
boat.setCurrentPosition(new GPSCoordinate(0, 0));
|
|
||||||
|
|
||||||
assertEquals(0, boat.calculateHeading(), 1e-8);
|
|
||||||
|
|
||||||
// Construct leg from wake - heading should be 180 degrees
|
|
||||||
SharedModel.Leg leg180deg = new SharedModel.Leg("Start", startMarker, new SharedModel.Marker(boat.getWake()), 0);
|
|
||||||
boat.setCurrentLeg(leg180deg);
|
|
||||||
|
|
||||||
assertEquals(180, boat.calculateHeading(), 1e-8);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWakeProportionalToVelocity() throws Exception {
|
|
||||||
SharedModel.BoatInRace boat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 1);
|
|
||||||
|
|
||||||
// Construct leg of 0 degrees at 0 N
|
|
||||||
SharedModel.Marker startMarker = new SharedModel.Marker(ORIGIN_COORDS);
|
|
||||||
SharedModel.Marker endMarker = new SharedModel.Marker(new GPSCoordinate(50, 0));
|
|
||||||
SharedModel.Leg leg0deg = new SharedModel.Leg("Start", startMarker, endMarker, 0);
|
|
||||||
boat.setCurrentLeg(leg0deg);
|
|
||||||
boat.setCurrentPosition(new GPSCoordinate(0, 0));
|
|
||||||
|
|
||||||
// Get latitude of endpoint of wake at 10 kn (longitude is 0)
|
|
||||||
double endpointAt10Kn = boat.getWake().getLatitude();
|
|
||||||
|
|
||||||
// Latitude of endpoint at 20 kn should be twice endpoint at 10 kn
|
|
||||||
boat.setVelocity(20);
|
|
||||||
assertEquals(2 * endpointAt10Kn, boat.getWake().getLatitude(), 1e-8);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -75,9 +75,9 @@ public class RaceTest {
|
|||||||
//
|
//
|
||||||
// @Test
|
// @Test
|
||||||
// public void timerCanBeDisabled() {
|
// public void timerCanBeDisabled() {
|
||||||
// SharedModel.BoatInRace boat1 = new SharedModel.BoatInRace("Test 1", 10000, Color.ALICEBLUE, "t1", 1);
|
// Boat boat1 = new Boat("Test 1", 10000, Color.ALICEBLUE, "t1", 1);
|
||||||
// SharedModel.BoatInRace boat2 = new SharedModel.BoatInRace("Test 2", 10000, Color.BURLYWOOD, "t2", 2);
|
// Boat boat2 = new Boat("Test 2", 10000, Color.BURLYWOOD, "t2", 2);
|
||||||
// List<SharedModel.BoatInRace> boats = new ArrayList<>();
|
// List<Boat> boats = new ArrayList<>();
|
||||||
// boats.add(boat1);
|
// boats.add(boat1);
|
||||||
// boats.add(boat2);
|
// boats.add(boat2);
|
||||||
//
|
//
|
||||||
@@ -96,12 +96,12 @@ public class RaceTest {
|
|||||||
// @Test
|
// @Test
|
||||||
// public void checkPositionUpdatesNumberFinishedBoats() {
|
// public void checkPositionUpdatesNumberFinishedBoats() {
|
||||||
//
|
//
|
||||||
// SharedModel.BoatInRace finishedBoat = new SharedModel.BoatInRace("Test", 1000, Color.ALICEBLUE, "tt", 1);
|
// Boat finishedBoat = new Boat("Test", 1000, Color.ALICEBLUE, "tt", 1);
|
||||||
// finishedBoat.setDistanceTravelledInLeg(500);
|
// finishedBoat.setDistanceTravelledInLeg(500);
|
||||||
//
|
//
|
||||||
// finishedBoat.setCurrentLeg(FINISH_LEG);
|
// finishedBoat.setCurrentLeg(FINISH_LEG);
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
// ArrayList<Boat> boats = new ArrayList<>();
|
||||||
// boats.add(finishedBoat);
|
// boats.add(finishedBoat);
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
@@ -121,12 +121,12 @@ public class RaceTest {
|
|||||||
// @Test
|
// @Test
|
||||||
// public void checkPositionDoesntUpdateNumberFinishedBoats() {
|
// public void checkPositionDoesntUpdateNumberFinishedBoats() {
|
||||||
//
|
//
|
||||||
// SharedModel.BoatInRace unFinishedBoat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 1);
|
// Boat unFinishedBoat = new Boat("Test", 10, Color.ALICEBLUE, "tt", 1);
|
||||||
// unFinishedBoat.setDistanceTravelledInLeg(0);
|
// unFinishedBoat.setDistanceTravelledInLeg(0);
|
||||||
//
|
//
|
||||||
// unFinishedBoat.setCurrentLeg(FINISH_LEG);
|
// unFinishedBoat.setCurrentLeg(FINISH_LEG);
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
// ArrayList<Boat> boats = new ArrayList<>();
|
||||||
// boats.add(unFinishedBoat);
|
// boats.add(unFinishedBoat);
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
@@ -144,7 +144,7 @@ public class RaceTest {
|
|||||||
// @Test
|
// @Test
|
||||||
// public void distanceTravelledBeforeUpdatingLegIsRetained() {
|
// public void distanceTravelledBeforeUpdatingLegIsRetained() {
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
// ArrayList<Boat> boats = new ArrayList<>();
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
//
|
//
|
||||||
@@ -154,7 +154,7 @@ public class RaceTest {
|
|||||||
// Race race = new Race(boats, legs, 1, mockOutput);
|
// Race race = new Race(boats, legs, 1, mockOutput);
|
||||||
// race.setDnfChance(0);
|
// race.setDnfChance(0);
|
||||||
//
|
//
|
||||||
// SharedModel.BoatInRace unFinishedBoat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 4);
|
// Boat unFinishedBoat = new Boat("Test", 10, Color.ALICEBLUE, "tt", 4);
|
||||||
// unFinishedBoat.setDistanceTravelledInLeg(100);
|
// unFinishedBoat.setDistanceTravelledInLeg(100);
|
||||||
// unFinishedBoat.setCurrentLeg(START_LEG);
|
// unFinishedBoat.setCurrentLeg(START_LEG);
|
||||||
//
|
//
|
||||||
@@ -168,7 +168,7 @@ public class RaceTest {
|
|||||||
// @Test
|
// @Test
|
||||||
// public void timerDelaysByHalfSecond() throws InterruptedException {
|
// public void timerDelaysByHalfSecond() throws InterruptedException {
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
// ArrayList<Boat> boats = new ArrayList<>();
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
// legs.add(START_LEG);
|
// legs.add(START_LEG);
|
||||||
@@ -194,11 +194,11 @@ public class RaceTest {
|
|||||||
// float vel2 = (float) 1.999;
|
// float vel2 = (float) 1.999;
|
||||||
// float vel3 = (float) 32.5;
|
// float vel3 = (float) 32.5;
|
||||||
// float vel4 = 500;
|
// float vel4 = 500;
|
||||||
// SharedModel.BoatInRace boat1 = new SharedModel.BoatInRace("test", vel1, Color.ALICEBLUE, "tt",1);
|
// Boat boat1 = new Boat("test", vel1, Color.ALICEBLUE, "tt",1);
|
||||||
// SharedModel.BoatInRace boat2 = new SharedModel.BoatInRace("test", vel2, Color.ALICEBLUE, "tt", 2);
|
// Boat boat2 = new Boat("test", vel2, Color.ALICEBLUE, "tt", 2);
|
||||||
// SharedModel.BoatInRace boat3 = new SharedModel.BoatInRace("test", vel3, Color.ALICEBLUE, "tt", 3);
|
// Boat boat3 = new Boat("test", vel3, Color.ALICEBLUE, "tt", 3);
|
||||||
// SharedModel.BoatInRace boat4 = new SharedModel.BoatInRace("test", vel4, Color.ALICEBLUE, "tt", 4);
|
// Boat boat4 = new Boat("test", vel4, Color.ALICEBLUE, "tt", 4);
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
// ArrayList<Boat> boats = new ArrayList<>();
|
||||||
// boats.add(boat1);
|
// boats.add(boat1);
|
||||||
// boats.add(boat2);
|
// boats.add(boat2);
|
||||||
// boats.add(boat3);
|
// boats.add(boat3);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package seng302.Model;/**
|
|||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import seng302.DataInput.RaceXMLReader;
|
import seng302.DataInput.RaceXMLReader;
|
||||||
import SharedModel.BoatInRace;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -29,29 +29,29 @@ public class RaceXMLTest {
|
|||||||
try {
|
try {
|
||||||
RaceXMLReader raceXMLReader = new RaceXMLReader("raceXML/bermuda_AC35.xml", false);
|
RaceXMLReader raceXMLReader = new RaceXMLReader("raceXML/bermuda_AC35.xml", false);
|
||||||
raceXMLReader.readBoats();
|
raceXMLReader.readBoats();
|
||||||
List<BoatInRace> boats = raceXMLReader.getBoats();
|
List<Boat> boats = raceXMLReader.getBoats();
|
||||||
assertTrue(boats.size() == 6);
|
assertTrue(boats.size() == 6);
|
||||||
//test boat 1
|
//test boat 1
|
||||||
assertEquals(boats.get(0).getName().getValue(), "ORACLE TEAM USA");
|
assertEquals(boats.get(0).getName(), "ORACLE TEAM USA");
|
||||||
assertTrue(boats.get(0).getVelocity() == 20);
|
assertTrue(boats.get(0).getVelocity() == 20);
|
||||||
//test boat 2
|
//test boat 2
|
||||||
assertEquals(boats.get(1).getName().getValue(), "Land Rover BAR");
|
assertEquals(boats.get(1).getName(), "Land Rover BAR");
|
||||||
assertTrue(boats.get(1).getVelocity() == 30);
|
assertTrue(boats.get(1).getVelocity() == 30);
|
||||||
assertEquals(boats.get(1).getAbbrev(), "GBR");
|
assertEquals(boats.get(1).getAbbrev(), "GBR");
|
||||||
//test boat 3
|
//test boat 3
|
||||||
assertEquals(boats.get(2).getName().getValue(), "SoftBank Team Japan");
|
assertEquals(boats.get(2).getName(), "SoftBank Team Japan");
|
||||||
assertTrue(boats.get(2).getVelocity() == 25);
|
assertTrue(boats.get(2).getVelocity() == 25);
|
||||||
assertEquals(boats.get(2).getAbbrev(), "JPN");
|
assertEquals(boats.get(2).getAbbrev(), "JPN");
|
||||||
//test boat 4
|
//test boat 4
|
||||||
assertEquals(boats.get(3).getName().getValue(), "Groupama Team France");
|
assertEquals(boats.get(3).getName(), "Groupama Team France");
|
||||||
assertTrue(boats.get(3).getVelocity() == 20);
|
assertTrue(boats.get(3).getVelocity() == 20);
|
||||||
assertEquals(boats.get(3).getAbbrev(), "FRA");
|
assertEquals(boats.get(3).getAbbrev(), "FRA");
|
||||||
//test boat 5
|
//test boat 5
|
||||||
assertEquals(boats.get(4).getName().getValue(), "Artemis Racing");
|
assertEquals(boats.get(4).getName(), "Artemis Racing");
|
||||||
assertTrue(boats.get(4).getVelocity() == 29);
|
assertTrue(boats.get(4).getVelocity() == 29);
|
||||||
assertEquals(boats.get(4).getAbbrev(), "SWE");
|
assertEquals(boats.get(4).getAbbrev(), "SWE");
|
||||||
//test boat 6
|
//test boat 6
|
||||||
assertEquals(boats.get(5).getName().getValue(), "Emirates Team New Zealand");
|
assertEquals(boats.get(5).getName(), "Emirates Team New Zealand");
|
||||||
assertTrue(boats.get(5).getVelocity() == 62);
|
assertTrue(boats.get(5).getVelocity() == 62);
|
||||||
assertEquals(boats.get(5).getAbbrev(), "NZL");
|
assertEquals(boats.get(5).getAbbrev(), "NZL");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package seng302.Networking;
|
package seng302.Networking;
|
||||||
|
|
||||||
import SharedModel.BoatInRace;
|
|
||||||
import com.sun.jmx.remote.internal.ArrayQueue;
|
import seng302.Model.Boat;
|
||||||
import seng302.Networking.MessageEncoders.RaceVisionByteEncoder;
|
import seng302.Networking.MessageEncoders.RaceVisionByteEncoder;
|
||||||
import seng302.Networking.MessageEncoders.XMLMessageEncoder;
|
import seng302.Networking.MessageEncoders.XMLMessageEncoder;
|
||||||
import seng302.Networking.Utils.BoatLocationMessage;
|
import seng302.Networking.Utils.BoatLocationMessage;
|
||||||
@@ -10,7 +10,7 @@ import seng302.Networking.Utils.RaceStatus;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +37,7 @@ public class MockOutput implements Runnable
|
|||||||
|
|
||||||
public MockOutput() throws IOException {
|
public MockOutput() throws IOException {
|
||||||
lastHeartbeatTime = System.currentTimeMillis();
|
lastHeartbeatTime = System.currentTimeMillis();
|
||||||
serverSocket = new ServerSocket(5003);
|
serverSocket = new ServerSocket(4942);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* calculates the time since last heartbeat
|
* calculates the time since last heartbeat
|
||||||
@@ -78,7 +78,7 @@ public class MockOutput implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Used to give the mocOutput information about boat location to be made into a message and sent
|
* Used to give the mocOutput information about boat location to be made into a message and sent
|
||||||
*/
|
*/
|
||||||
public synchronized void parseBoatLocation(BoatInRace boat){
|
public synchronized void parseBoatLocation(Boat boat){
|
||||||
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(boat, boatLocationSequenceNumber);
|
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(boat, boatLocationSequenceNumber);
|
||||||
//iterates the sequence number
|
//iterates the sequence number
|
||||||
boatLocationSequenceNumber++;
|
boatLocationSequenceNumber++;
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ package seng302.Networking.Utils;
|
|||||||
* Created by f123 on 21-Apr-17.
|
* Created by f123 on 21-Apr-17.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import SharedModel.BoatInRace;
|
|
||||||
import SharedModel.Constants;
|
import SharedModel.Constants;
|
||||||
import SharedModel.GPSCoordinate;
|
import seng302.Model.Boat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the information in a boat location message (AC streaming spec: 4.9).
|
* Represents the information in a boat location message (AC streaming spec: 4.9).
|
||||||
@@ -149,7 +148,7 @@ public class BoatLocationMessage extends AC35Data
|
|||||||
this.rudderAngle = rudderAngle;
|
this.rudderAngle = rudderAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoatLocationMessage(BoatInRace boat, long sequenceNumber) {
|
public BoatLocationMessage(Boat boat, long sequenceNumber) {
|
||||||
super(MessageType.BOATLOCATION);
|
super(MessageType.BOATLOCATION);
|
||||||
|
|
||||||
this.messageVersionNumber = (byte) 1;
|
this.messageVersionNumber = (byte) 1;
|
||||||
|
|||||||
@@ -1,24 +1,17 @@
|
|||||||
package seng302.Networking;
|
package seng302.Networking;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import seng302.Mock.*;
|
import seng302.Mock.*;
|
||||||
import seng302.Networking.BinaryMessageDecoder;
|
|
||||||
import seng302.Networking.MessageDecoders.*;
|
|
||||||
import seng302.Networking.Utils.*;
|
import seng302.Networking.Utils.*;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static seng302.Networking.Utils.ByteConverter.bytesToInt;
|
|
||||||
import static seng302.Networking.Utils.ByteConverter.bytesToShort;
|
import static seng302.Networking.Utils.ByteConverter.bytesToShort;
|
||||||
import static seng302.Networking.Utils.MessageType.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCP server to act as the mock AC35 streaming interface
|
* TCP server to act as the mock AC35 streaming interface
|
||||||
@@ -99,6 +92,7 @@ public class VisualiserInput implements Runnable
|
|||||||
|
|
||||||
public void run(){
|
public void run(){
|
||||||
try{
|
try{
|
||||||
|
System.out.println("running");
|
||||||
//receiver loop that gets the input
|
//receiver loop that gets the input
|
||||||
boolean receiverLoop = true;
|
boolean receiverLoop = true;
|
||||||
while(receiverLoop) {
|
while(receiverLoop) {
|
||||||
@@ -132,7 +126,7 @@ public class VisualiserInput implements Runnable
|
|||||||
//no decoder for this.
|
//no decoder for this.
|
||||||
break;
|
break;
|
||||||
case XMLMESSAGE:
|
case XMLMESSAGE:
|
||||||
// System.out.println("XML Message!");
|
System.out.println("XML Message!");
|
||||||
XMLMessage xml = (XMLMessage) data;
|
XMLMessage xml = (XMLMessage) data;
|
||||||
try {
|
try {
|
||||||
if (xml.getXmlMsgSubType() == xml.XMLTypeRegatta){
|
if (xml.getXmlMsgSubType() == xml.XMLTypeRegatta){
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class Boat {
|
|||||||
protected StringProperty position;
|
protected StringProperty position;
|
||||||
protected boolean started = false;
|
protected boolean started = false;
|
||||||
private double wakeScale = 1 / 50;
|
private double wakeScale = 1 / 50;
|
||||||
|
private int sourceID;
|
||||||
|
|
||||||
|
|
||||||
protected Queue<TrackPoint> track = new ConcurrentLinkedQueue<>();
|
protected Queue<TrackPoint> track = new ConcurrentLinkedQueue<>();
|
||||||
protected long nextValidTime = 0;
|
protected long nextValidTime = 0;
|
||||||
@@ -226,4 +228,8 @@ public class Boat {
|
|||||||
public StringProperty getCurrentLegName() {
|
public StringProperty getCurrentLegName() {
|
||||||
return currentLegName;
|
return currentLegName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSourceID() {
|
||||||
|
return this.sourceID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user