Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules
This commit is contained in:
@@ -5,14 +5,14 @@ package seng302.Networking.Utils;
|
|||||||
*/
|
*/
|
||||||
public class AC35UnitConverter {
|
public class AC35UnitConverter {
|
||||||
|
|
||||||
public static double convertGPS(long value){
|
public static double convertGPS(int value){
|
||||||
//converts latitude or longitue to angle
|
//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){
|
public static int convertGPSToInt(double value){
|
||||||
//converts latitude or longitue to angle
|
//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){
|
public static double convertHeading(long value){
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class RegattaXMLReader extends XMLReader {
|
|||||||
String courseName = getTextValueOfNode(attributes, "CourseName");
|
String courseName = getTextValueOfNode(attributes, "CourseName");
|
||||||
double centralLatitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralLatitude"));
|
double centralLatitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralLatitude"));
|
||||||
double centralLongitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralLongitude"));
|
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"));
|
double centralAltitude = Double.parseDouble(getTextValueOfNode(attributes, "CentralAltitude"));
|
||||||
float utcOffset = Float.parseFloat(getTextValueOfNode(attributes, "UtcOffset"));
|
float utcOffset = Float.parseFloat(getTextValueOfNode(attributes, "UtcOffset"));
|
||||||
float magneticVariation = Float.parseFloat(getTextValueOfNode(attributes, "MagneticVariation"));
|
float magneticVariation = Float.parseFloat(getTextValueOfNode(attributes, "MagneticVariation"));
|
||||||
|
|||||||
@@ -2,17 +2,14 @@ package seng302.Mock;
|
|||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
import seng302.Constants;
|
import seng302.*;
|
||||||
import seng302.Controllers.RaceController;
|
import seng302.Controllers.RaceController;
|
||||||
import seng302.GPSCoordinate;
|
|
||||||
import seng302.Model.*;
|
import seng302.Model.*;
|
||||||
import seng302.Networking.MessageDecoders.BoatLocationDecoder;
|
import seng302.Networking.MessageDecoders.BoatLocationDecoder;
|
||||||
import seng302.Networking.Utils.BoatStatusMessage;
|
import seng302.Networking.Utils.BoatStatusMessage;
|
||||||
import seng302.Networking.Utils.ByteConverter;
|
import seng302.Networking.Utils.ByteConverter;
|
||||||
import seng302.Networking.Utils.Enums.BoatStatus;
|
import seng302.Networking.Utils.Enums.BoatStatus;
|
||||||
import seng302.Networking.Utils.BoatLocationMessage;
|
import seng302.Networking.Utils.BoatLocationMessage;
|
||||||
import seng302.RaceDataSource;
|
|
||||||
import seng302.VisualiserInput;
|
|
||||||
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void displayBoat(Boat boat, double angle, Color colour) {
|
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;
|
Paint paint = colour;
|
||||||
|
|
||||||
double[] x = {pos.getX() - 6, pos.getX(), pos.getX() + 6};
|
double[] x = {pos.getX() - 6, pos.getX(), pos.getX() + 6};
|
||||||
@@ -325,8 +327,6 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
*/
|
*/
|
||||||
public void updateBoats() {
|
public void updateBoats() {
|
||||||
int currentColour = 0;
|
int currentColour = 0;
|
||||||
// TODO Remove null when boats are ready
|
|
||||||
boats = null;
|
|
||||||
if (boats != null) {
|
if (boats != null) {
|
||||||
for (Boat boat : boats) {
|
for (Boat boat : boats) {
|
||||||
boolean finished = boat.getCurrentLeg().getName().equals("Finish") || boat.getCurrentLeg().getName().equals("DNF");
|
boolean finished = boat.getCurrentLeg().getName().equals("Finish") || boat.getCurrentLeg().getName().equals("DNF");
|
||||||
@@ -344,8 +344,8 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
|
|
||||||
if (raceAnno)
|
if (raceAnno)
|
||||||
displayText(boat.toString(), boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()));
|
displayText(boat.toString(), boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()));
|
||||||
|
//TODO this needs to be fixed.
|
||||||
drawTrack(boat, colours.get(currentColour));
|
//drawTrack(boat, colours.get(currentColour));
|
||||||
currentColour = (currentColour + 1) % colours.size();
|
currentColour = (currentColour + 1) % colours.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user