Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules

This commit is contained in:
Joseph Gardner
2017-05-01 16:51:48 +12:00
4 changed files with 239 additions and 189 deletions
@@ -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
}
@@ -7,6 +7,8 @@ package seng302.Networking.Utils;
import SharedModel.Constants;
import seng302.Model.Boat;
import static seng302.Networking.Utils.AC35UnitConverter.convertGPSToInt;
/**
* Represents the information in a boat location message (AC streaming spec: 4.9).
*/
@@ -156,8 +158,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;