|
|
|
@ -126,11 +126,12 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Display given name and speed of boat at a graph coordinate
|
|
|
|
* Display given name and speed of boat at a graph coordinate
|
|
|
|
* @param name name of boat
|
|
|
|
* @param name name of the boat
|
|
|
|
|
|
|
|
* @param speed speed of the boat
|
|
|
|
* @param coordinate coordinate the text appears
|
|
|
|
* @param coordinate coordinate the text appears
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void displayText(String name, double speed, GraphCoordinate coordinate){
|
|
|
|
public void displayText(String name, double speed, GraphCoordinate coordinate){
|
|
|
|
String text = name + ", " + speed + " knots";
|
|
|
|
String text = name + ", " + speed + " knots";
|
|
|
|
gc.fillText(text, coordinate.getX()+20, coordinate.getY());
|
|
|
|
gc.fillText(text, coordinate.getX()+20, coordinate.getY());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -143,7 +144,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
double height = getHeight();
|
|
|
|
double height = getHeight();
|
|
|
|
|
|
|
|
|
|
|
|
gc.clearRect(0, 0, width, height);
|
|
|
|
gc.clearRect(0, 0, width, height);
|
|
|
|
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.278, -64.863, 32.320989, -64.821, (int)width, (int)height);
|
|
|
|
this.map = new RaceMap(32.278, -64.863, 32.320989, -64.821, (int)width, (int)height);
|
|
|
|
|
|
|
|
|
|
|
|
if (map == null){
|
|
|
|
if (map == null){
|
|
|
|
@ -176,7 +177,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
if (boat != null) {
|
|
|
|
if (boat != null) {
|
|
|
|
// System.out.print("Drawing Boat At: " + boat.getCurrentPosition());
|
|
|
|
// System.out.print("Drawing Boat At: " + boat.getCurrentPosition());
|
|
|
|
displayMark(this.map.convertGPS(boat.getCurrentPosition()), boat.getColour());
|
|
|
|
displayMark(this.map.convertGPS(boat.getCurrentPosition()), boat.getColour());
|
|
|
|
displayText(boat.getName(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()));
|
|
|
|
displayText(boat.getAbbrev(), boat.getVelocity(), this.map.convertGPS(boat.getCurrentPosition()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|