cbt24 9 years ago
commit 92c0011f80

@ -62,10 +62,20 @@ public abstract class Race implements Runnable {
long timeLoopStarted;
long timeLoopEnded;
long minutes;
long currentTimeInSeconds;
long remainingSeconds;
while (boatsFinished < startingBoats.length) {
timeLoopStarted = System.currentTimeMillis();
totalTimeElapsed = System.currentTimeMillis() - timeRaceStarted;
long currentTime = System.currentTimeMillis() - timeRaceStarted;
currentTimeInSeconds = currentTime / 1000;
minutes = currentTimeInSeconds / 60;
remainingSeconds = currentTimeInSeconds % 60;
System.out.println(minutes + ":" + remainingSeconds);
for (BoatInRace boat : startingBoats) {
updatePosition(boat, SLEEP_TIME);
checkPosition(boat, totalTimeElapsed);

@ -69,7 +69,7 @@ public class ResizableRaceCanvas extends Canvas {
double width = getWidth();
double height = getHeight();
System.out.println("Race Map Canvas Width: "+ width + ", Height:" + height);
this.map = new RaceMap(32.321989, -64.873, 32.28, -64.831, (int)width, (int)height);
this.map = new RaceMap(32.320989, -64.863, 32.278, -64.821, (int)width, (int)height);
if (map == null){
return;
@ -100,7 +100,6 @@ public class ResizableRaceCanvas extends Canvas {
displayLine(startline1, startline2, Color.GREEN);
//display wind direction arrow - specify origin point and angle
displayPoint(this.map.convertGPS(32.293771, -64.855242), Color.BLACK);
displayArrow(new GraphCoordinate(500, 20), 100);
}

@ -19,6 +19,6 @@ public class RaceMap {
* @see GraphCoordinate
*/
public GraphCoordinate convertGPS(double lat, double lon) {
return new GraphCoordinate((int) (width * (lat - x1) / (x2 - x1)), (int) (height - (height * (lon - y1) / (y2 - y1))));
return new GraphCoordinate((int) ((height * (lon - y1) / (y2 - y1))),(int) (width * (lat - x1) / (x2 - x1)));
}
}

Loading…
Cancel
Save