Merge branch 'story9' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into story9
This commit is contained in:
@@ -62,10 +62,20 @@ public abstract class Race implements Runnable {
|
|||||||
|
|
||||||
long timeLoopStarted;
|
long timeLoopStarted;
|
||||||
long timeLoopEnded;
|
long timeLoopEnded;
|
||||||
|
long minutes;
|
||||||
|
long currentTimeInSeconds;
|
||||||
|
long remainingSeconds;
|
||||||
|
|
||||||
|
|
||||||
while (boatsFinished < startingBoats.length) {
|
while (boatsFinished < startingBoats.length) {
|
||||||
timeLoopStarted = System.currentTimeMillis();
|
timeLoopStarted = System.currentTimeMillis();
|
||||||
totalTimeElapsed = System.currentTimeMillis() - timeRaceStarted;
|
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) {
|
for (BoatInRace boat : startingBoats) {
|
||||||
updatePosition(boat, SLEEP_TIME);
|
updatePosition(boat, SLEEP_TIME);
|
||||||
checkPosition(boat, totalTimeElapsed);
|
checkPosition(boat, totalTimeElapsed);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
double width = getWidth();
|
double width = getWidth();
|
||||||
double height = getHeight();
|
double height = getHeight();
|
||||||
System.out.println("Race Map Canvas Width: "+ width + ", Height:" + height);
|
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){
|
if (map == null){
|
||||||
return;
|
return;
|
||||||
@@ -100,7 +100,6 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
displayLine(startline1, startline2, Color.GREEN);
|
displayLine(startline1, startline2, Color.GREEN);
|
||||||
|
|
||||||
//display wind direction arrow - specify origin point and angle
|
//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);
|
displayArrow(new GraphCoordinate(500, 20), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ public class RaceMap {
|
|||||||
* @see GraphCoordinate
|
* @see GraphCoordinate
|
||||||
*/
|
*/
|
||||||
public GraphCoordinate convertGPS(double lat, double lon) {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user