|
|
|
@ -73,7 +73,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
* @see Color
|
|
|
|
* @see Color
|
|
|
|
* @see Paint
|
|
|
|
* @see Paint
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void displayMark(GraphCoordinate graphCoordinate, Paint paint) {
|
|
|
|
private void displayMark(GraphCoordinate graphCoordinate, Paint paint) {
|
|
|
|
gc.setFill(paint);
|
|
|
|
gc.setFill(paint);
|
|
|
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 25, 25);
|
|
|
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 25, 25);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -87,7 +87,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
* @see Color
|
|
|
|
* @see Color
|
|
|
|
* @see Paint
|
|
|
|
* @see Paint
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void displayLine(GraphCoordinate graphCoordinateA, GraphCoordinate graphCoordinateB, Paint paint) {
|
|
|
|
private void displayLine(GraphCoordinate graphCoordinateA, GraphCoordinate graphCoordinateB, Paint paint) {
|
|
|
|
gc.setStroke(paint);
|
|
|
|
gc.setStroke(paint);
|
|
|
|
gc.setFill(paint);
|
|
|
|
gc.setFill(paint);
|
|
|
|
gc.fillOval(graphCoordinateA.getX() - 3, graphCoordinateA.getY() - 3, 6, 6);
|
|
|
|
gc.fillOval(graphCoordinateA.getX() - 3, graphCoordinateA.getY() - 3, 6, 6);
|
|
|
|
@ -103,18 +103,19 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
* @see Paint
|
|
|
|
* @see Paint
|
|
|
|
* @see Color
|
|
|
|
* @see Color
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void displayPoint(GraphCoordinate graphCoordinate, Paint paint) {
|
|
|
|
private void displayPoint(GraphCoordinate graphCoordinate, Paint paint) {
|
|
|
|
gc.setFill(paint);
|
|
|
|
gc.setFill(paint);
|
|
|
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
|
|
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Displays an arrow on the Canvas
|
|
|
|
* Displays an arrow on the Canvas
|
|
|
|
* @param coordinate Coordinate that the arrow is to be displayed at.
|
|
|
|
* @param coordinate Coordinate that the arrow is to be displayed at.
|
|
|
|
* @param angle Angle that the arrow is to be facing in degrees 0 degrees = North (Up).
|
|
|
|
* @param angle Angle that the arrow is to be facing in degrees 0 degrees = North (Up).
|
|
|
|
* @see GraphCoordinate
|
|
|
|
* @see GraphCoordinate
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void displayArrow(GraphCoordinate coordinate, int angle) {
|
|
|
|
private void displayArrow(GraphCoordinate coordinate, int angle) {
|
|
|
|
gc.save();
|
|
|
|
gc.save();
|
|
|
|
rotate(angle, coordinate.getX(),coordinate.getY());
|
|
|
|
rotate(angle, coordinate.getX(),coordinate.getY());
|
|
|
|
gc.setFill(Color.BLACK);
|
|
|
|
gc.setFill(Color.BLACK);
|
|
|
|
@ -141,8 +142,8 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
* @param speed speed 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){
|
|
|
|
private void displayText(String name, double speed, GraphCoordinate coordinate){
|
|
|
|
String text = String.format("%s, %2$.2f knots", name, speed);
|
|
|
|
String text = String.format("%s, %2$.2fkn", name, speed);
|
|
|
|
//System.out.println(text.length()*7);
|
|
|
|
//System.out.println(text.length()*7);
|
|
|
|
long xCoord = coordinate.getX()+20;
|
|
|
|
long xCoord = coordinate.getX()+20;
|
|
|
|
long yCoord = coordinate.getY();
|
|
|
|
long yCoord = coordinate.getY();
|
|
|
|
@ -155,6 +156,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
gc.fillText(text, xCoord, yCoord);
|
|
|
|
gc.fillText(text, xCoord, yCoord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Draws the Race Map
|
|
|
|
* Draws the Race Map
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -203,21 +205,9 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//display wind direction arrow - specify origin point and angle - angle now set to random angle
|
|
|
|
//display wind direction arrow - specify origin point and angle - angle now set to random angle
|
|
|
|
displayArrow(new GraphCoordinate((int)getWidth()-40, 40), 0);
|
|
|
|
displayArrow(new GraphCoordinate((int)getWidth()-40, 40), 150);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Draws a boat at a certain GPSCoordinate
|
|
|
|
|
|
|
|
* @param colour Colour to colour boat.
|
|
|
|
|
|
|
|
* @param gpsCoordinates GPScoordinate that the boat is to be drawn at.
|
|
|
|
|
|
|
|
* @see GPSCoordinate
|
|
|
|
|
|
|
|
* @see Color
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void drawBoat(Color colour, GPSCoordinate gpsCoordinates) {
|
|
|
|
|
|
|
|
GraphCoordinate graphCoordinate = this.map.convertGPS(gpsCoordinates);
|
|
|
|
|
|
|
|
//System.out.println("DrawingBoat" + gpsCoordinates.getLongitude());
|
|
|
|
|
|
|
|
displayPoint(graphCoordinate, colour);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Toggle the raceAnno value
|
|
|
|
* Toggle the raceAnno value
|
|
|
|
|