Fixed GPs Coordinates as well as got Boats to display
- Fixed GPS conversion number being wrong (extra 1) - Fixed Boats displaying as the boat = null (cough Joseph) was stopping it from working as well as track is broken. #story[782]
This commit is contained in:
@@ -5,14 +5,14 @@ package seng302.Networking.Utils;
|
||||
*/
|
||||
public class AC35UnitConverter {
|
||||
|
||||
public static double convertGPS(long value){
|
||||
public static double convertGPS(int value){
|
||||
//converts latitude or longitue to angle
|
||||
return (double) value * 180.0/21474836418.0;//2^31 = 21474836418
|
||||
return (double) value * 180.0 / 2147483648.0;//2^31 = 2147483648
|
||||
}
|
||||
|
||||
public static int convertGPSToInt(double value){
|
||||
//converts latitude or longitue to angle
|
||||
return (int) (value * 21474836418.0/180.0);//2^31 = 21474836418
|
||||
return (int) (value * 2147483648.0/180.0);//2^31 = 2147483648
|
||||
}
|
||||
|
||||
public static double convertHeading(long value){
|
||||
|
||||
@@ -64,6 +64,7 @@ public class RegattaXMLReader extends XMLReader {
|
||||
String courseName = getTextValueOfNode(attributes, "CourseName");
|
||||
double centralLatitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralLatitude"));
|
||||
double centralLongitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralLongitude"));
|
||||
System.out.println(String.format("central lat %s long %s", centralLatitude, centralLongitude));
|
||||
double centralAltitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralAltitude"));
|
||||
float utcOffset = Float.parseFloat(getTextValueOfNode(attributes, "UtcOffset"));
|
||||
float magneticVariation = Float.parseFloat(getTextValueOfNode(attributes, "MagneticVariation"));
|
||||
|
||||
@@ -2,14 +2,11 @@ package seng302.Mock;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
import seng302.Constants;
|
||||
import seng302.*;
|
||||
import seng302.Controllers.RaceController;
|
||||
import seng302.GPSCoordinate;
|
||||
import seng302.Model.*;
|
||||
import seng302.Networking.MessageDecoders.BoatLocationDecoder;
|
||||
import seng302.Networking.Utils.BoatLocationMessage;
|
||||
import seng302.RaceDataSource;
|
||||
import seng302.VisualiserInput;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.*;
|
||||
|
||||
@@ -84,7 +84,9 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
}
|
||||
|
||||
public void displayBoat(Boat boat, double angle, Color colour) {
|
||||
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());
|
||||
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());/*
|
||||
System.out.println(String.format("x%s y%s", pos.getX(), pos.getY()));
|
||||
System.exit(0);*/
|
||||
Paint paint = colour;
|
||||
|
||||
double[] x = {pos.getX() - 6, pos.getX(), pos.getX() + 6};
|
||||
@@ -325,8 +327,6 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
*/
|
||||
public void updateBoats() {
|
||||
int currentColour = 0;
|
||||
// TODO Remove null when boats are ready
|
||||
boats = null;
|
||||
if (boats != null) {
|
||||
for (Boat boat : boats) {
|
||||
boolean finished = boat.getCurrentLeg().getName().equals("Finish") || boat.getCurrentLeg().getName().equals("DNF");
|
||||
@@ -344,8 +344,8 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
|
||||
if (raceAnno)
|
||||
displayText(boat.toString(), boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()));
|
||||
|
||||
drawTrack(boat, colours.get(currentColour));
|
||||
//TODO this needs to be fixed.
|
||||
//drawTrack(boat, colours.get(currentColour));
|
||||
currentColour = (currentColour + 1) % colours.size();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user