|
|
|
@ -1,13 +1,21 @@
|
|
|
|
package seng302.Controllers;
|
|
|
|
package seng302.Controllers;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javafx.collections.FXCollections;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
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.TableColumn;
|
|
|
|
import javafx.scene.control.TableView;
|
|
|
|
import javafx.scene.control.TableView;
|
|
|
|
|
|
|
|
import javafx.scene.control.cell.PropertyValueFactory;
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
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 seng302.GPSCoordinate;
|
|
|
|
import seng302.GraphCoordinate;
|
|
|
|
import seng302.GraphCoordinate;
|
|
|
|
|
|
|
|
import seng302.Model.Boat;
|
|
|
|
|
|
|
|
import seng302.Model.BoatInRace;
|
|
|
|
|
|
|
|
import seng302.Model.ConstantVelocityRace;
|
|
|
|
|
|
|
|
import seng302.Model.Leg;
|
|
|
|
import seng302.RaceMap;
|
|
|
|
import seng302.RaceMap;
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
@ -20,10 +28,19 @@ public class RaceController extends Controller{
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
Canvas raceMap;
|
|
|
|
Canvas raceMap;
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
TableView boatInfoTable;
|
|
|
|
TableView<BoatInRace> boatInfoTable;
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
AnchorPane canvasBase;
|
|
|
|
AnchorPane canvasBase;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
TableColumn<BoatInRace, String> boatPlacingColumn;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
TableColumn<BoatInRace, String> boatTeamColumn;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
TableColumn<BoatInRace, String> boatMarkColumn;
|
|
|
|
|
|
|
|
*/
|
|
|
|
private GraphicsContext gc;
|
|
|
|
private GraphicsContext gc;
|
|
|
|
private RaceMap map;
|
|
|
|
private RaceMap map;
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,8 +67,22 @@ public class RaceController extends Controller{
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {/*
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {/*
|
|
|
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
|
|
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
|
|
|
raceMap.heightProperty().bind(canvasBase.heightProperty());*/
|
|
|
|
raceMap.heightProperty().bind(canvasBase.heightProperty());*/
|
|
|
|
this.gc = raceMap.getGraphicsContext2D();
|
|
|
|
|
|
|
|
|
|
|
|
BoatInRace boat = new BoatInRace("NZ", 10000);
|
|
|
|
|
|
|
|
BoatInRace[] boats = new BoatInRace[] {boat};
|
|
|
|
|
|
|
|
Leg leg1 = new Leg("first leg", 1, new GPSCoordinate(0, 0), new GPSCoordinate(1, 1), 0);
|
|
|
|
|
|
|
|
Leg[] legs = new Leg[] {leg1};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(new Thread(race)).start();
|
|
|
|
|
|
|
|
//table view
|
|
|
|
|
|
|
|
boatTeamColumn.setCellValueFactory(new PropertyValueFactory<BoatInRace,String>("Name"));
|
|
|
|
|
|
|
|
boatInfoTable.setItems(FXCollections.observableArrayList(race.getFinishingBoats()));
|
|
|
|
|
|
|
|
|
|
|
|
this.map = new RaceMap(32.321989, -64.8553, 32.246, -64.831, (int)raceMap.getWidth(), (int)raceMap.getHeight());
|
|
|
|
this.map = new RaceMap(32.321989, -64.8553, 32.246, -64.831, (int)raceMap.getWidth(), (int)raceMap.getHeight());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gc = raceMap.getGraphicsContext2D();
|
|
|
|
//boat
|
|
|
|
//boat
|
|
|
|
GraphCoordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
GraphCoordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
|