Refactored Race, MockRace, and VisualiserRace to use RaceClock instead of keeping their own timers.
Moved FPS tracking to Race class, so both VisualiserRace and MockRace can monitor their FPS. LatestMessages is now observable. It notifies observers when an XMLMessage is received. Boat now has StringProperty for name and country/abbreviation. Moved the MockRace timescale value to Constants.RaceTimeScale. This is passed in to MockRace on construction. Tidied up StartController. Copied the visualiser's resources into the resources folder. Refactored RaceClock. Added comments. Tidied code a bit. Moved to shared.model. Started work on RaceController.
This commit is contained in:
@@ -13,6 +13,7 @@ import static network.Utils.AC35UnitConverter.convertGPSToInt;
|
||||
*/
|
||||
public class BoatLocation extends AC35Data {
|
||||
|
||||
//TODO move these to an enum.
|
||||
public static final byte Unknown = 0;
|
||||
public static final byte RacingYacht = 1;
|
||||
public static final byte CommitteeBoat = 2;
|
||||
@@ -27,6 +28,7 @@ public class BoatLocation extends AC35Data {
|
||||
public static final byte WeatherStation = 11;
|
||||
public static final byte Helicopter = 12;
|
||||
public static final byte DataProcessingApplication = 13;
|
||||
|
||||
///Version number of the message - is always 1.
|
||||
private byte messageVersionNumber = 1;
|
||||
///Time of the event - milliseconds since jan 1 1970. Proper type is 6 byte int.
|
||||
|
||||
@@ -20,6 +20,10 @@ public enum RaceStatusEnum {
|
||||
* Less than 1:00 minutes before start.
|
||||
*/
|
||||
PREPARATORY(2),
|
||||
|
||||
/**
|
||||
* Race has started.
|
||||
*/
|
||||
STARTED(3),
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,11 +5,13 @@ import shared.dataInput.RaceDataSource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Observable;
|
||||
|
||||
/**
|
||||
* This class contains a set of the latest messages received (e.g., the latest RaceStatus, the latest BoatLocation for each boat, etc...).
|
||||
* Currently, LatestMessage only notifies observers of change when a new XMLMessage is received.
|
||||
*/
|
||||
public class LatestMessages {
|
||||
public class LatestMessages extends Observable {
|
||||
|
||||
/**
|
||||
* The latest RaceStatus message.
|
||||
@@ -218,6 +220,8 @@ public class LatestMessages {
|
||||
*/
|
||||
public void setRaceXMLMessage(XMLMessage raceXMLMessage) {
|
||||
this.raceXMLMessage = raceXMLMessage;
|
||||
|
||||
this.notifyObservers();
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +239,8 @@ public class LatestMessages {
|
||||
*/
|
||||
public void setBoatXMLMessage(XMLMessage boatXMLMessage) {
|
||||
this.boatXMLMessage = boatXMLMessage;
|
||||
|
||||
this.notifyObservers();
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +258,8 @@ public class LatestMessages {
|
||||
*/
|
||||
public void setRegattaXMLMessage(XMLMessage regattaXMLMessage) {
|
||||
this.regattaXMLMessage = regattaXMLMessage;
|
||||
|
||||
this.notifyObservers();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user