fixed boat parser for the mock
#story[778]
This commit is contained in:
@@ -10,6 +10,11 @@ public class AC35UnitConverter {
|
|||||||
return (double) value * 180.0/21474836418.0;//2^31 = 21474836418
|
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){
|
public static double convertHeading(long value){
|
||||||
return (double) value * 360.0/65536.0;//2^15
|
return (double) value * 360.0/65536.0;//2^15
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import SharedModel.BoatInRace;
|
|||||||
import SharedModel.Constants;
|
import SharedModel.Constants;
|
||||||
import SharedModel.GPSCoordinate;
|
import SharedModel.GPSCoordinate;
|
||||||
|
|
||||||
|
import static seng302.Networking.Utils.AC35UnitConverter.convertGPSToInt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the information in a boat location message (AC streaming spec: 4.9).
|
* 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.sourceID = boat.getSourceID();
|
||||||
this.sequenceNumber = sequenceNumber;
|
this.sequenceNumber = sequenceNumber;
|
||||||
this.deviceType = 1;
|
this.deviceType = 1;
|
||||||
this.latitude = 0;//boat.getCurrentPosition().getLatitude();
|
this.latitude = convertGPSToInt(boat.getCurrentPosition().getLatitude());
|
||||||
this.longitude = 0;//boat.getCurrentPosition().getLongitude();
|
this.longitude = convertGPSToInt(boat.getCurrentPosition().getLongitude());
|
||||||
this.altitude = 0;
|
this.altitude = 0;
|
||||||
this.heading = 0;
|
this.heading = 0;
|
||||||
this.pitch = 0;
|
this.pitch = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user