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:
Fan-Wu Yang
2017-05-01 20:13:16 +12:00
parent 04366c2e4c
commit 5444b872bd
4 changed files with 10 additions and 12 deletions
@@ -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();
}
}