Moved speed conversion to BoatMessage class
#story[778]
This commit is contained in:
@@ -88,9 +88,7 @@ public class MockOutput implements Runnable
|
|||||||
*/
|
*/
|
||||||
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading, double speed){
|
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading, double speed){
|
||||||
|
|
||||||
int newSpeed = (int) Math.round((speed * Constants.KnotsToMetersPerSecondConversionFactor * 1000));
|
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceID, lat, lon, boatLocationSequenceNumber, heading, speed);
|
||||||
|
|
||||||
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceID, lat, lon, boatLocationSequenceNumber, heading, newSpeed);
|
|
||||||
//iterates the sequence number
|
//iterates the sequence number
|
||||||
boatLocationSequenceNumber++;
|
boatLocationSequenceNumber++;
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class Race implements Runnable {
|
|||||||
protected int boatsFinished = 0;
|
protected int boatsFinished = 0;
|
||||||
protected long totalTimeElapsed;
|
protected long totalTimeElapsed;
|
||||||
protected int scaleFactor;
|
protected int scaleFactor;
|
||||||
protected int PRERACE_TIME = 180000; //time in milliseconds to pause during pre-race. At the moment, 3 minutes
|
protected int PRERACE_TIME = 180; //time in milliseconds to pause during pre-race. At the moment, 3 minutes
|
||||||
protected boolean countdownFinish = false;
|
protected boolean countdownFinish = false;
|
||||||
protected boolean runRace = true;
|
protected boolean runRace = true;
|
||||||
private int lastFPS = 20;
|
private int lastFPS = 20;
|
||||||
@@ -202,8 +202,6 @@ public class Race implements Runnable {
|
|||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void initialiseBoats() {
|
public void initialiseBoats() {
|
||||||
Leg officialStart = legs.get(0);
|
Leg officialStart = legs.get(0);
|
||||||
String name = officialStart.getName();
|
String name = officialStart.getName();
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class BoatLocationMessage extends AC35Data
|
|||||||
this.rudderAngle = rudderAngle;
|
this.rudderAngle = rudderAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoatLocationMessage(int sourceID, double lat, double lon, long sequenceNumber, double heading, int boatSpeed) {
|
public BoatLocationMessage(int sourceID, double lat, double lon, long sequenceNumber, double heading, double boatSpeed) {
|
||||||
super(MessageType.BOATLOCATION);
|
super(MessageType.BOATLOCATION);
|
||||||
|
|
||||||
this.messageVersionNumber = (byte) 1;
|
this.messageVersionNumber = (byte) 1;
|
||||||
@@ -164,7 +164,7 @@ public class BoatLocationMessage extends AC35Data
|
|||||||
this.heading = convertHeadingDoubleToInt(heading);
|
this.heading = convertHeadingDoubleToInt(heading);
|
||||||
this.pitch = 0;
|
this.pitch = 0;
|
||||||
this.roll = 0;
|
this.roll = 0;
|
||||||
this.boatSpeed = boatSpeed;
|
this.boatSpeed = convertBoatSpeedDoubleToInt(boatSpeed);
|
||||||
this.boatCOG = 0;
|
this.boatCOG = 0;
|
||||||
this.boatSOG = 0;
|
this.boatSOG = 0;
|
||||||
this.apparentWindSpeed = 0;
|
this.apparentWindSpeed = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user