Attempting to solve boats not apearing problem
- Appears to be becaus elat and long are getting switched somewhere #story[881]
This commit is contained in:
@@ -59,13 +59,7 @@ public class Race implements Runnable {
|
|||||||
this.scaleFactor = scaleFactor;
|
this.scaleFactor = scaleFactor;
|
||||||
this.mockOutput = mockOutput;
|
this.mockOutput = mockOutput;
|
||||||
|
|
||||||
|
|
||||||
this.startTime = System.currentTimeMillis() + (this.PRERACE_TIME / this.scaleFactor);
|
this.startTime = System.currentTimeMillis() + (this.PRERACE_TIME / this.scaleFactor);
|
||||||
|
|
||||||
if (startingBoats != null && startingBoats.size() > 0) {
|
|
||||||
initialiseBoats();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Race(RaceDataSource raceData, int scaleFactor, MockOutput mockOutput) {
|
public Race(RaceDataSource raceData, int scaleFactor, MockOutput mockOutput) {
|
||||||
@@ -201,7 +195,7 @@ public class Race implements Runnable {
|
|||||||
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatusEnum.RACING : BoatStatusEnum.DNF, boat.getCurrentLeg().getLegNumber()));
|
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatusEnum.RACING : BoatStatusEnum.DNF, boat.getCurrentLeg().getLegNumber()));
|
||||||
}
|
}
|
||||||
if (startingBoats.size()==finished){
|
if (startingBoats.size()==finished){
|
||||||
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 4, startTime, 0, 2300, 2, boatStatuses);//TODO FIX the second currentTime is a placeholder! Also, replace magic values.
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 4, startTime, 0, 2300, 2, boatStatuses);
|
||||||
mockOutput.parseRaceStatus(raceStatus);
|
mockOutput.parseRaceStatus(raceStatus);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -209,8 +203,7 @@ public class Race implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boatOffset = (boatOffset + 1) % (startingBoats.size());
|
boatOffset = (boatOffset + 1) % (startingBoats.size());
|
||||||
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 3, startTime, 0, 2300, 2, boatStatuses);//TODO FIX the second currentTime is a placeholder! Also, replace magic values.
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 3, startTime, 0, 2300, 2, boatStatuses);
|
||||||
System.out.println(raceStatus.getBoatStatuses().get(0).getLegNumber());
|
|
||||||
mockOutput.parseRaceStatus(raceStatus);
|
mockOutput.parseRaceStatus(raceStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,7 +211,6 @@ public class Race implements Runnable {
|
|||||||
}
|
}
|
||||||
public void initialiseBoats() {
|
public void initialiseBoats() {
|
||||||
Leg officialStart = legs.get(0);
|
Leg officialStart = legs.get(0);
|
||||||
String name = officialStart.getName();
|
|
||||||
|
|
||||||
ArrayList<GPSCoordinate> startingPositions = getSpreadStartingPositions();
|
ArrayList<GPSCoordinate> startingPositions = getSpreadStartingPositions();
|
||||||
for (int i = 0; i < startingBoats.size(); i++) {
|
for (int i = 0; i < startingBoats.size(); i++) {
|
||||||
@@ -226,6 +218,7 @@ 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());
|
||||||
}
|
}
|
||||||
@@ -242,6 +235,8 @@ 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());
|
||||||
initialCalc.setDestinationGeographicPoint(compoundMark.getMark2().getLongitude(), compoundMark.getMark2().getLatitude());
|
initialCalc.setDestinationGeographicPoint(compoundMark.getMark2().getLongitude(), compoundMark.getMark2().getLatitude());
|
||||||
@@ -259,6 +254,7 @@ 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