diff --git a/mock/pom.xml b/mock/pom.xml
index 3d29db73..5dc648f3 100644
--- a/mock/pom.xml
+++ b/mock/pom.xml
@@ -52,6 +52,12 @@
1.0-SNAPSHOT
+
+ seng302
+ racevisionGame
+ 1.0-SNAPSHOT
+
+
@@ -97,7 +103,7 @@
- seng302.App
+ mock.app.App
${maven.compiler.source}
${maven.compiler.target}
@@ -161,4 +167,4 @@
-
\ No newline at end of file
+
diff --git a/network/pom.xml b/network/pom.xml
index 40087f2d..8d9b6324 100644
--- a/network/pom.xml
+++ b/network/pom.xml
@@ -14,12 +14,6 @@
-
- seng302
- sharedModel
- 1.0-SNAPSHOT
-
-
junit
diff --git a/racevisionGame/pom.xml b/racevisionGame/pom.xml
index bf2952b7..16d1d529 100644
--- a/racevisionGame/pom.xml
+++ b/racevisionGame/pom.xml
@@ -39,17 +39,21 @@
+
+
+ org.jetbrains
+ annotations
+ 15.0
+
+
+
+
org.geotools
gt-referencing
9.0
-
- com.github.bfsmith
- geotimezone
- 1.0.3
-
@@ -78,40 +82,92 @@
1.8
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.5.1
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 2.4.3
-
-
-
-
- seng302.App
- ${maven.compiler.source}
- ${maven.compiler.target}
-
-
-
-
-
-
- package
-
- shade
-
-
-
-
-
-
+
+
+
+
+ mock
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.5.1
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.3
+
+
+
+
+ mock.app.App
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+
+
+ visualiser
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.5.1
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.3
+
+
+
+
+ visualiser.app.App
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/racevisionGame/src/main/java/shared/model/Boat.java b/racevisionGame/src/main/java/shared/model/Boat.java
index 18c5c0c4..d6e28783 100644
--- a/racevisionGame/src/main/java/shared/model/Boat.java
+++ b/racevisionGame/src/main/java/shared/model/Boat.java
@@ -1,9 +1,9 @@
package shared.model;
-import com.sun.istack.internal.Nullable;
import javafx.beans.property.*;
import network.Messages.Enums.BoatStatusEnum;
+import org.jetbrains.annotations.Nullable;
import java.time.ZonedDateTime;
diff --git a/racevisionGame/src/main/java/shared/model/Constants.java b/racevisionGame/src/main/java/shared/model/Constants.java
index 715ba86d..51666bf2 100644
--- a/racevisionGame/src/main/java/shared/model/Constants.java
+++ b/racevisionGame/src/main/java/shared/model/Constants.java
@@ -33,7 +33,7 @@ public class Constants {
* Frame periods are multiplied by this to get the amount of time a single frame represents.
* E.g., frame period = 20ms, scale = 5, frame represents 20 * 5 = 100ms, and so boats are simulated for 100ms, even though only 20ms actually occurred.
*/
- public static final int RaceTimeScale = 15;
+ public static final int RaceTimeScale = 10;
/**
* The race pre-start time, in milliseconds. 3 minutes.
diff --git a/racevisionGame/src/main/java/shared/model/RaceClock.java b/racevisionGame/src/main/java/shared/model/RaceClock.java
index f4c58e17..4c6532a9 100644
--- a/racevisionGame/src/main/java/shared/model/RaceClock.java
+++ b/racevisionGame/src/main/java/shared/model/RaceClock.java
@@ -1,14 +1,11 @@
package shared.model;
-import com.github.bfsmith.geotimezone.TimeZoneLookup;
-import com.github.bfsmith.geotimezone.TimeZoneResult;
-import com.sun.istack.internal.Nullable;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
+import org.jetbrains.annotations.Nullable;
import visualiser.model.ResizableRaceCanvas;
import java.time.Duration;
-import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
@@ -91,20 +88,6 @@ public class RaceClock {
}
- //TODO could potentially remove this, and the dependency, as it doesn't appear to be needed (regatta.xml has timezone already).
- /**
- * Returns the ZonedDateTime corresponding to a specified GPSCoordinate.
- * @param gpsCoordinate The GPSCoordinate to lookup.
- * @return The ZonedDateTime for the coordinate.
- */
- public static ZonedDateTime getCurrentZonedDateTime(GPSCoordinate gpsCoordinate) {
- TimeZoneLookup timeZoneLookup = new TimeZoneLookup();
- TimeZoneResult timeZoneResult = timeZoneLookup.getTimeZone(gpsCoordinate.getLatitude(), gpsCoordinate.getLongitude());
- ZoneId zone = ZoneId.of(timeZoneResult.getResult());
- return LocalDateTime.now(zone).atZone(zone);
- }
-
-
/**
@@ -227,6 +210,7 @@ public class RaceClock {
* Returns the current time of the race.
* @return The current time of the race.
*/
+ @Nullable
public ZonedDateTime getCurrentTime() {
return currentTime;
}
diff --git a/racevisionGame/src/main/java/visualiser/model/VisualiserBoat.java b/racevisionGame/src/main/java/visualiser/model/VisualiserBoat.java
index 02c3dd55..57ba0790 100644
--- a/racevisionGame/src/main/java/visualiser/model/VisualiserBoat.java
+++ b/racevisionGame/src/main/java/visualiser/model/VisualiserBoat.java
@@ -104,19 +104,18 @@ public class VisualiserBoat extends Boat {
/**
* Attempts to add a new point to boat's track.
- * It only adds a new point if the boat is still racing (see {@link #getStatus()} and {@link BoatStatusEnum#RACING}), and if at least {@link #trackPointTimeInterval} milliseconds have occurred.
+ * It only adds a new point if the boat is still racing (see {@link #getStatus()} and {@link BoatStatusEnum#RACING}), and if at least {@link #trackPointTimeInterval} milliseconds have occurred, using race time.
* @param coordinate The {@link GPSCoordinate} of the trackpoint.
+ * @param currentTime The current race time.
* @see TrackPoint
*/
- public void addTrackPoint(GPSCoordinate coordinate) {
-
- //TODO bugfix: instead of creating a track point every #trackPointTimeInterval milliseconds of real time, we should base it off of race time, so that we will create a consistent number of track points regardless of what the race time scale is.
+ public void addTrackPoint(GPSCoordinate coordinate, ZonedDateTime currentTime) {
//Get current time.
- long currentTime = System.currentTimeMillis();
+ long currentTimeMilli = currentTime.toInstant().toEpochMilli();
//Check if enough time has passed to create a new track point.
- Boolean canBeAdded = currentTime >= nextValidTime;
+ Boolean canBeAdded = currentTimeMilli >= nextValidTime;
//If it has, and if we are still racing, create the point.
if (canBeAdded && (getStatus() == BoatStatusEnum.RACING)) {
@@ -125,11 +124,11 @@ public class VisualiserBoat extends Boat {
long expiryPeriod = trackPointTimeInterval * trackPointLimit;
//Create and add point.
- TrackPoint trackPoint = new TrackPoint(coordinate, currentTime, expiryPeriod);
+ TrackPoint trackPoint = new TrackPoint(coordinate, currentTimeMilli, expiryPeriod);
track.add(trackPoint);
//Update the nextValidTime for the next track point.
- nextValidTime = currentTime + trackPointTimeInterval;
+ nextValidTime = currentTimeMilli + trackPointTimeInterval;
}
}
diff --git a/racevisionGame/src/main/java/visualiser/model/VisualiserRace.java b/racevisionGame/src/main/java/visualiser/model/VisualiserRace.java
index 1116e8ea..da0df20c 100644
--- a/racevisionGame/src/main/java/visualiser/model/VisualiserRace.java
+++ b/racevisionGame/src/main/java/visualiser/model/VisualiserRace.java
@@ -237,7 +237,7 @@ public class VisualiserRace extends Race {
//Attempt to add a track point.
if (newBoatStatusEnum == BoatStatusEnum.RACING) {
- boat.addTrackPoint(boat.getCurrentPosition());
+ boat.addTrackPoint(boat.getCurrentPosition(), raceClock.getCurrentTime());
}
//Set finish time if boat finished.
@@ -353,17 +353,21 @@ public class VisualiserRace extends Race {
long currentFrameTime = System.currentTimeMillis();
long framePeriod = currentFrameTime - lastFrameTime;
+
+ //Update race status.
+ updateRaceStatus(latestMessages.getRaceStatus());
+
+
//Update racing boats.
updateBoats(boats, latestMessages.getBoatLocationMap(), latestMessages.getBoatStatusMap());
//And their positions (e.g., 5th).
updateBoatPositions(boats);
+
//Update marker boats.
updateMarkers(boatMarkers, latestMessages.getBoatLocationMap(), latestMessages.getBoatStatusMap());
- //Update race status.
- updateRaceStatus(latestMessages.getRaceStatus());
if (getRaceStatusEnum() == RaceStatusEnum.FINISHED) {
diff --git a/visualiser/pom.xml b/visualiser/pom.xml
index 156c8e60..6525f1b1 100644
--- a/visualiser/pom.xml
+++ b/visualiser/pom.xml
@@ -54,6 +54,12 @@
1.0-SNAPSHOT
+
+ seng302
+ racevisionGame
+ 1.0-SNAPSHOT
+
+
@@ -99,7 +105,7 @@
- seng302.App
+ visualiser.app.App
${maven.compiler.source}
${maven.compiler.target}
@@ -163,4 +169,4 @@
-
\ No newline at end of file
+