fixed boat parser for the mock

#story[778]
main
hba56 9 years ago
parent cdcbb07dc6
commit a271952e0c

@ -10,6 +10,11 @@ public class AC35UnitConverter {
return (double) value * 180.0/21474836418.0;//2^31 = 21474836418
}
public static int convertGPSToInt(double value){
//converts latitude or longitue to angle
return (int) (value * 21474836418.0/180.0);//2^31 = 21474836418
}
public static double convertHeading(long value){
return (double) value * 360.0/65536.0;//2^15
}

@ -8,6 +8,8 @@ import SharedModel.BoatInRace;
import SharedModel.Constants;
import SharedModel.GPSCoordinate;
import static seng302.Networking.Utils.AC35UnitConverter.convertGPSToInt;
/**
* Represents the information in a boat location message (AC streaming spec: 4.9).
*/
@ -157,8 +159,8 @@ public class BoatLocationMessage extends AC35Data
this.sourceID = boat.getSourceID();
this.sequenceNumber = sequenceNumber;
this.deviceType = 1;
this.latitude = 0;//boat.getCurrentPosition().getLatitude();
this.longitude = 0;//boat.getCurrentPosition().getLongitude();
this.latitude = convertGPSToInt(boat.getCurrentPosition().getLatitude());
this.longitude = convertGPSToInt(boat.getCurrentPosition().getLongitude());
this.altitude = 0;
this.heading = 0;
this.pitch = 0;

Loading…
Cancel
Save