Fixed boats not displayinggit stash
- Was gps coordinates being initialised with X and Y switched around #story[881]
This commit is contained in:
@@ -99,7 +99,7 @@ public class BoatXMLReader extends XMLReader implements BoatDataSource {
|
|||||||
Node nCoord = ((Element)boatNode).getElementsByTagName("GPSposition").item(0);
|
Node nCoord = ((Element)boatNode).getElementsByTagName("GPSposition").item(0);
|
||||||
double x = Double.parseDouble(nCoord.getAttributes().getNamedItem("X").getTextContent());
|
double x = Double.parseDouble(nCoord.getAttributes().getNamedItem("X").getTextContent());
|
||||||
double y = Double.parseDouble(nCoord.getAttributes().getNamedItem("Y").getTextContent());
|
double y = Double.parseDouble(nCoord.getAttributes().getNamedItem("Y").getTextContent());
|
||||||
Mark mark = new Mark(sourceID, name, new GPSCoordinate(x,y));
|
Mark mark = new Mark(sourceID, name, new GPSCoordinate(y,x));
|
||||||
markerMap.put(sourceID, mark);
|
markerMap.put(sourceID, mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|||||||
CompoundMark marker;
|
CompoundMark marker;
|
||||||
|
|
||||||
switch(nMarks.getLength()) {
|
switch(nMarks.getLength()) {
|
||||||
case 1: marker = new CompoundMark(getMark((Element)nMarks.item(0))); break;
|
case 1: marker = new CompoundMark(getMark((Element)nMarks.item(0)));
|
||||||
|
break;
|
||||||
case 2: marker = new CompoundMark(getMark((Element)nMarks.item(0)), getMark((Element)nMarks.item(1))); break;
|
case 2: marker = new CompoundMark(getMark((Element)nMarks.item(0)), getMark((Element)nMarks.item(1))); break;
|
||||||
default: throw new StreamedCourseXMLException();
|
default: throw new StreamedCourseXMLException();
|
||||||
}
|
}
|
||||||
@@ -216,7 +217,6 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double maxLatitude = boundary.stream().max(Comparator.comparingDouble(GPSCoordinate::getLatitude)).get().getLatitude() + COORDINATEPADDING;
|
double maxLatitude = boundary.stream().max(Comparator.comparingDouble(GPSCoordinate::getLatitude)).get().getLatitude() + COORDINATEPADDING;
|
||||||
double maxLongitude = boundary.stream().max(Comparator.comparingDouble(GPSCoordinate::getLongitude)).get().getLongitude() + COORDINATEPADDING;
|
double maxLongitude = boundary.stream().max(Comparator.comparingDouble(GPSCoordinate::getLongitude)).get().getLongitude() + COORDINATEPADDING;
|
||||||
double minLatitude = boundary.stream().min(Comparator.comparingDouble(GPSCoordinate::getLatitude)).get().getLatitude() + COORDINATEPADDING;
|
double minLatitude = boundary.stream().min(Comparator.comparingDouble(GPSCoordinate::getLatitude)).get().getLatitude() + COORDINATEPADDING;
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ public class Race implements Runnable {
|
|||||||
//get new point
|
//get new point
|
||||||
Point2D endPoint = geodeticCalculator.getDestinationGeographicPoint();
|
Point2D endPoint = geodeticCalculator.getDestinationGeographicPoint();
|
||||||
|
|
||||||
System.out.println(endPoint.getX());
|
|
||||||
return new GPSCoordinate(endPoint.getY(), endPoint.getX());
|
return new GPSCoordinate(endPoint.getY(), endPoint.getX());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +114,6 @@ public class Race implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(long arg0) {
|
public void handle(long arg0) {
|
||||||
timeLeft = startTime - currentTime;
|
timeLeft = startTime - currentTime;
|
||||||
System.out.println(timeLeft);
|
|
||||||
ArrayList<BoatStatus> boatStatuses = new ArrayList<>();
|
ArrayList<BoatStatus> boatStatuses = new ArrayList<>();
|
||||||
//For each boat, we update it's position, and generate a BoatLocationMessage.
|
//For each boat, we update it's position, and generate a BoatLocationMessage.
|
||||||
for (int i = 0; i < startingBoats.size(); i++) {
|
for (int i = 0; i < startingBoats.size(); i++) {
|
||||||
@@ -160,7 +158,6 @@ public class Race implements Runnable {
|
|||||||
|
|
||||||
for (Boat boat : startingBoats) {
|
for (Boat boat : startingBoats) {
|
||||||
boat.setStarted(true);
|
boat.setStarted(true);
|
||||||
System.out.println(boat.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new AnimationTimer() {
|
new AnimationTimer() {
|
||||||
@@ -218,7 +215,6 @@ public class Race implements Runnable {
|
|||||||
if (boat != null) {
|
if (boat != null) {
|
||||||
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
||||||
boat.setCurrentPosition(startingPositions.get(i));
|
boat.setCurrentPosition(startingPositions.get(i));
|
||||||
System.out.println(boat.getCurrentPosition());
|
|
||||||
boat.setCurrentLeg(officialStart);
|
boat.setCurrentLeg(officialStart);
|
||||||
boat.setHeading(boat.calculateHeading());
|
boat.setHeading(boat.calculateHeading());
|
||||||
}
|
}
|
||||||
@@ -235,7 +231,6 @@ public class Race implements Runnable {
|
|||||||
int nBoats = startingBoats.size();
|
int nBoats = startingBoats.size();
|
||||||
Marker compoundMark = legs.get(0).getStartCompoundMark();
|
Marker compoundMark = legs.get(0).getStartCompoundMark();
|
||||||
|
|
||||||
System.out.println(compoundMark.getAverageGPSCoordinate());
|
|
||||||
|
|
||||||
GeodeticCalculator initialCalc = new GeodeticCalculator();
|
GeodeticCalculator initialCalc = new GeodeticCalculator();
|
||||||
initialCalc.setStartingGeographicPoint(compoundMark.getMark1().getLongitude(), compoundMark.getMark1().getLatitude());
|
initialCalc.setStartingGeographicPoint(compoundMark.getMark1().getLongitude(), compoundMark.getMark1().getLatitude());
|
||||||
@@ -254,7 +249,6 @@ public class Race implements Runnable {
|
|||||||
Point2D position = positionCalc.getDestinationGeographicPoint();
|
Point2D position = positionCalc.getDestinationGeographicPoint();
|
||||||
positions.add(new GPSCoordinate(position.getY(), position.getX()));
|
positions.add(new GPSCoordinate(position.getY(), position.getX()));
|
||||||
|
|
||||||
System.out.println(position.getX());
|
|
||||||
positionCalc = new GeodeticCalculator();
|
positionCalc = new GeodeticCalculator();
|
||||||
positionCalc.setStartingGeographicPoint(position);
|
positionCalc.setStartingGeographicPoint(position);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user