|
|
|
@ -4,8 +4,10 @@ import javafx.fxml.FXML;
|
|
|
|
import javafx.scene.canvas.Canvas;
|
|
|
|
import javafx.scene.canvas.Canvas;
|
|
|
|
import javafx.scene.canvas.GraphicsContext;
|
|
|
|
import javafx.scene.canvas.GraphicsContext;
|
|
|
|
import javafx.scene.control.TableView;
|
|
|
|
import javafx.scene.control.TableView;
|
|
|
|
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
import javafx.scene.paint.Paint;
|
|
|
|
import javafx.scene.paint.Paint;
|
|
|
|
|
|
|
|
import javafx.scene.shape.Line;
|
|
|
|
import seng302.Coordinate;
|
|
|
|
import seng302.Coordinate;
|
|
|
|
import seng302.RaceMap;
|
|
|
|
import seng302.RaceMap;
|
|
|
|
|
|
|
|
|
|
|
|
@ -20,6 +22,8 @@ public class RaceController extends Controller{
|
|
|
|
Canvas raceMap;
|
|
|
|
Canvas raceMap;
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
TableView boatInfoTable;
|
|
|
|
TableView boatInfoTable;
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
AnchorPane canvasBase;
|
|
|
|
|
|
|
|
|
|
|
|
private GraphicsContext gc;
|
|
|
|
private GraphicsContext gc;
|
|
|
|
private RaceMap map;
|
|
|
|
private RaceMap map;
|
|
|
|
@ -29,22 +33,49 @@ public class RaceController extends Controller{
|
|
|
|
gc.fillOval(coordinate.getX(), coordinate.getY(), 15, 15);
|
|
|
|
gc.fillOval(coordinate.getX(), coordinate.getY(), 15, 15);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void displayLine(Coordinate coordinateA, Coordinate coordinateB, Paint paint){
|
|
|
|
|
|
|
|
gc.setStroke(paint);
|
|
|
|
|
|
|
|
gc.setFill(paint);
|
|
|
|
|
|
|
|
gc.fillOval(coordinateA.getX() - 3, coordinateA.getY() - 3, 6, 6);
|
|
|
|
|
|
|
|
gc.fillOval(coordinateB.getX() - 3, coordinateB.getY() - 3, 6, 6);
|
|
|
|
|
|
|
|
gc.strokeLine(coordinateA.getX(), coordinateA.getY(), coordinateB.getX(), coordinateB.getY());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void displayPoint(Coordinate coordinate, Paint paint){
|
|
|
|
|
|
|
|
gc.setFill(paint);
|
|
|
|
|
|
|
|
gc.fillOval(coordinate.getX(), coordinate.getY(), 10, 10);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {/*
|
|
|
|
|
|
|
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
|
|
|
|
|
|
|
raceMap.heightProperty().bind(canvasBase.heightProperty());*/
|
|
|
|
this.gc = raceMap.getGraphicsContext2D();
|
|
|
|
this.gc = raceMap.getGraphicsContext2D();
|
|
|
|
this.map = new RaceMap(32.321989, -64.866142, 32.273089, -64.814987, (int)raceMap.getWidth(), (int)raceMap.getHeight());
|
|
|
|
this.map = new RaceMap(32.321989, -64.8553, 32.246, -64.831, (int)raceMap.getWidth(), (int)raceMap.getHeight());
|
|
|
|
|
|
|
|
//boat
|
|
|
|
Coordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
Coordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
|
|
|
|
//finish line
|
|
|
|
gc.setStroke(Color.DARKRED);
|
|
|
|
|
|
|
|
gc.setLineWidth(2);
|
|
|
|
gc.setLineWidth(2);
|
|
|
|
Coordinate finishLineCoord1 = this.map.convertGPS(32.317379, -64.839291);
|
|
|
|
Coordinate finishLineCoord1 = this.map.convertGPS(32.317379, -64.839291);
|
|
|
|
Coordinate finishLineCoord2 = this.map.convertGPS(32.317257, -64.836260);
|
|
|
|
Coordinate finishLineCoord2 = this.map.convertGPS(32.317257, -64.836260);
|
|
|
|
gc.strokeLine(finishLineCoord1.getX(), finishLineCoord1.getY(), finishLineCoord2.getX(), finishLineCoord2.getY());
|
|
|
|
displayLine(finishLineCoord1, finishLineCoord2, Color.DARKRED);
|
|
|
|
gc.strokeRect(finishLineCoord1.getX() - 1, finishLineCoord1.getY() - 1, 3, 3);
|
|
|
|
//marks
|
|
|
|
gc.strokeRect(finishLineCoord2.getX() - 1, finishLineCoord2.getY() - 1, 3, 3);
|
|
|
|
Coordinate markCoord = this.map.convertGPS(32.293039, -64.843983);
|
|
|
|
|
|
|
|
Coordinate southGate1 = this.map.convertGPS(32.284680, -64.850045);
|
|
|
|
|
|
|
|
Coordinate southGate2 = this.map.convertGPS(32.280164, -64.847591);
|
|
|
|
|
|
|
|
Coordinate northGate1 = this.map.convertGPS(32.309693, -64.835249);
|
|
|
|
|
|
|
|
Coordinate northGate2 = this.map.convertGPS(32.308046, -64.831785);
|
|
|
|
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
|
|
|
|
displayBoat(markCoord, Color.GOLD);
|
|
|
|
|
|
|
|
displayLine(southGate1, southGate2, Color.DARKCYAN);
|
|
|
|
|
|
|
|
displayLine(northGate1, northGate2, Color.DARKVIOLET);
|
|
|
|
|
|
|
|
//start line
|
|
|
|
|
|
|
|
Coordinate startline1 = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
|
|
|
|
Coordinate startline2 = this.map.convertGPS(32.293771, -64.855242);
|
|
|
|
|
|
|
|
displayLine(startline1, startline2, Color.GREEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
displayPoint(this.map.convertGPS(32.293771, -64.855242), Color.BLACK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|