Refactored BoatLocation message, encoders, decoders. It now exposes datatypes that we actually use in the program (double knots, bearings, etc..), instead of the bits-on-the-wire packed units (like int mmPerSec). Also documented it, and updated test.
issue #35 #36 #story[1095]
This commit is contained in:
@@ -16,7 +16,6 @@ import shared.dataInput.RegattaDataSource;
|
||||
import shared.model.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -198,20 +197,20 @@ public class VisualiserRace extends Race implements Runnable {
|
||||
if (boatLocation != null && boatStatus != null) {
|
||||
|
||||
//Get the new position.
|
||||
double latitude = boatLocation.getLatitudeDouble();
|
||||
double longitude = boatLocation.getLongitudeDouble();
|
||||
double latitude = boatLocation.getLatitude();
|
||||
double longitude = boatLocation.getLongitude();
|
||||
GPSCoordinate gpsCoordinate = new GPSCoordinate(latitude, longitude);
|
||||
|
||||
boat.setCurrentPosition(gpsCoordinate);
|
||||
|
||||
//Bearing.
|
||||
boat.setBearing(Bearing.fromDegrees(boatLocation.getHeadingDegrees()));
|
||||
boat.setBearing(boatLocation.getHeading());
|
||||
|
||||
//Time until next mark.
|
||||
boat.setEstimatedTimeAtNextMark(raceClock.getLocalTime(boatStatus.getEstTimeAtNextMark()));
|
||||
|
||||
//Speed.
|
||||
boat.setCurrentSpeed(boatLocation.getBoatSOG() / Constants.KnotsToMMPerSecond);
|
||||
boat.setCurrentSpeed(boatLocation.getBoatSpeedKnots());
|
||||
|
||||
|
||||
//Boat status.
|
||||
@@ -292,8 +291,8 @@ public class VisualiserRace extends Race implements Runnable {
|
||||
if (boatLocation != null) {
|
||||
|
||||
//We only update the boat's position.
|
||||
double latitude = boatLocation.getLatitudeDouble();
|
||||
double longitude = boatLocation.getLongitudeDouble();
|
||||
double latitude = boatLocation.getLatitude();
|
||||
double longitude = boatLocation.getLongitude();
|
||||
GPSCoordinate gpsCoordinate = new GPSCoordinate(latitude, longitude);
|
||||
|
||||
mark.setPosition(gpsCoordinate);
|
||||
|
||||
Reference in New Issue
Block a user