mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge branch 'create-finish-display'
This commit is contained in:
+18
-18
@@ -6,57 +6,57 @@
|
|||||||
<name type="start-line">Start</name>
|
<name type="start-line">Start</name>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Start1</name>
|
<name>Start1</name>
|
||||||
<latitude>32.296038</latitude>
|
<latitude>32.296577</latitude>
|
||||||
<longitude>-64.854401</longitude>
|
<longitude>-64.854304</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Start2</name>
|
<name>Start2</name>
|
||||||
<latitude>32.293834</latitude>
|
<latitude>32.293771</latitude>
|
||||||
<longitude>-64.855195</longitude>
|
<longitude>-64.855242</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Mid Mark</name>
|
<name>Mid Mark</name>
|
||||||
<latitude>32.292881</latitude>
|
<latitude>32.293039</latitude>
|
||||||
<longitude>-64.843231</longitude>
|
<longitude>-64.843983</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
<gate>
|
<gate>
|
||||||
<name>Leeward Gate</name>
|
<name>Leeward Gate</name>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Leeward Gate1</name>
|
<name>Leeward Gate1</name>
|
||||||
<latitude>32.283808</latitude>
|
<latitude>32.284680</latitude>
|
||||||
<longitude>-64.850012</longitude>
|
<longitude>-64.850045</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Leeward Gate2</name>
|
<name>Leeward Gate2</name>
|
||||||
<latitude>32.283216</latitude>
|
<latitude>32.280164</latitude>
|
||||||
<longitude>-64.847686</longitude>
|
<longitude>-64.847591</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
<gate>
|
<gate>
|
||||||
<name>Windward Gate</name>
|
<name>Windward Gate</name>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Windward Gate1</name>
|
<name>Windward Gate1</name>
|
||||||
<latitude>32.309908</latitude>
|
<latitude>32.309693</latitude>
|
||||||
<longitude>-64.833665</longitude>
|
<longitude>-64.835249</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Windward Gate2</name>
|
<name>Windward Gate2</name>
|
||||||
<latitude>32.309158</latitude>
|
<latitude>32.308046</latitude>
|
||||||
<longitude>-64.830834</longitude>
|
<longitude>-64.831785</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
<gate type="finish-line">
|
<gate type="finish-line">
|
||||||
<name>Finish</name>
|
<name>Finish</name>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Finish1</name>
|
<name>Finish1</name>
|
||||||
<latitude>32.318439</latitude>
|
<latitude>32.317379</latitude>
|
||||||
<longitude>-64.837367</longitude>
|
<longitude>-64.839291</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Finish2</name>
|
<name>Finish2</name>
|
||||||
<latitude>32.318303</latitude>
|
<latitude>32.317257</latitude>
|
||||||
<longitude>-64.834974</longitude>
|
<longitude>-64.836260</longitude>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
</marks>
|
</marks>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class App extends Application
|
|||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("/RaceView.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("/MainView.fxml"));
|
||||||
primaryStage.setTitle("RaceVision");
|
primaryStage.setTitle("RaceVision");
|
||||||
primaryStage.setScene(new Scene(root));
|
primaryStage.setScene(new Scene(root));
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import javafx.animation.Timeline;
|
|||||||
import javafx.beans.property.DoubleProperty;
|
import javafx.beans.property.DoubleProperty;
|
||||||
import javafx.beans.property.SimpleDoubleProperty;
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.canvas.Canvas;
|
import javafx.scene.canvas.Canvas;
|
||||||
import javafx.scene.canvas.GraphicsContext;
|
import javafx.scene.canvas.GraphicsContext;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import seng302.models.Boat;
|
import seng302.models.Boat;
|
||||||
@@ -20,12 +23,11 @@ import seng302.models.mark.Mark;
|
|||||||
import seng302.models.mark.MarkType;
|
import seng302.models.mark.MarkType;
|
||||||
import seng302.models.mark.SingleMark;
|
import seng302.models.mark.SingleMark;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static java.lang.Math.abs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ptg19 on 15/03/17.
|
* Created by ptg19 on 15/03/17.
|
||||||
* Modified by Haoming Yin (hyi25) on 20/3/2017.
|
* Modified by Haoming Yin (hyi25) on 20/3/2017.
|
||||||
@@ -35,12 +37,34 @@ public class CanvasController {
|
|||||||
private Race race;
|
private Race race;
|
||||||
private GraphicsContext gc;
|
private GraphicsContext gc;
|
||||||
private HashMap<Boat, TimelineInfo> timelineInfos;
|
private HashMap<Boat, TimelineInfo> timelineInfos;
|
||||||
|
|
||||||
|
private final double ORIGIN_LAT = 32.320504;
|
||||||
|
private final double ORIGIN_LON = -64.857063;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Canvas canvas;
|
private Canvas canvas;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private AnchorPane contentAnchorPane;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private RaceResultController raceResultController;
|
||||||
|
|
||||||
|
private void setContentPane(String jfxUrl) {
|
||||||
|
try {
|
||||||
|
contentAnchorPane.getChildren().removeAll();
|
||||||
|
contentAnchorPane.getChildren().clear();
|
||||||
|
contentAnchorPane.getChildren().addAll((Pane) FXMLLoader.load(getClass().getResource(jfxUrl)));
|
||||||
|
} catch (javafx.fxml.LoadException e) {
|
||||||
|
System.err.println(e.getCause());
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
gc = canvas.getGraphicsContext2D();
|
gc = canvas.getGraphicsContext2D();
|
||||||
gc.scale(22, 22);
|
gc.scale(15, 15);
|
||||||
RaceController raceController = new RaceController();
|
RaceController raceController = new RaceController();
|
||||||
raceController.initializeRace();
|
raceController.initializeRace();
|
||||||
race = raceController.getRace();
|
race = raceController.getRace();
|
||||||
@@ -53,7 +77,6 @@ public class CanvasController {
|
|||||||
gc.clearRect(0, 0, 760, 360);
|
gc.clearRect(0, 0, 760, 360);
|
||||||
drawCourse();
|
drawCourse();
|
||||||
drawBoats();
|
drawBoats();
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -61,9 +84,37 @@ public class CanvasController {
|
|||||||
|
|
||||||
// starts the timer and reads events from each boat's time line
|
// starts the timer and reads events from each boat's time line
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
Double maxDuration = 0.0;
|
||||||
|
|
||||||
for (TimelineInfo timelineInfo : timelineInfos.values()) {
|
for (TimelineInfo timelineInfo : timelineInfos.values()) {
|
||||||
|
|
||||||
Timeline timeline = timelineInfo.getTimeline();
|
Timeline timeline = timelineInfo.getTimeline();
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
if (/*timeline.getTotalDuration().greaterThanOrEqualTo(maxDuration)*/ true){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == timelineInfos.values().size() - 1) {
|
||||||
|
timeline.setOnFinished(event -> {
|
||||||
|
setContentPane("/FinishView.fxml");
|
||||||
|
|
||||||
|
for (Boat boat : race.getFinishedBoats()) {
|
||||||
|
System.out.println(boat.getTeamName());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
System.out.println("B");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
System.out.println("A");
|
||||||
|
}
|
||||||
|
|
||||||
timeline.play();
|
timeline.play();
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,12 +133,22 @@ public class CanvasController {
|
|||||||
List<Event> events = boat_events.get(boat);
|
List<Event> events = boat_events.get(boat);
|
||||||
// iterates all events and convert each event to keyFrame, then add them into a list
|
// iterates all events and convert each event to keyFrame, then add them into a list
|
||||||
for (Event event : events) {
|
for (Event event : events) {
|
||||||
keyFrames.add(
|
if (event.getIsFinishingEvent()) {
|
||||||
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
|
keyFrames.add(
|
||||||
new KeyValue(x, event.getThisMark().getLatitude()),
|
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
|
||||||
new KeyValue(y, event.getThisMark().getLongitude())
|
event1 -> race.setBoatFinished(boat),
|
||||||
)
|
new KeyValue(x, event.getThisMark().getLatitude()),
|
||||||
);
|
new KeyValue(y, event.getThisMark().getLongitude())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
keyFrames.add(
|
||||||
|
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
|
||||||
|
new KeyValue(x, event.getThisMark().getLatitude()),
|
||||||
|
new KeyValue(y, event.getThisMark().getLongitude())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// uses the lists generated above to create a Timeline for the boat.
|
// uses the lists generated above to create a Timeline for the boat.
|
||||||
@@ -105,38 +166,20 @@ public class CanvasController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the distance between the two marks
|
|
||||||
*/
|
|
||||||
public double getDistanceBetweenMarks(Mark mark1, Mark mark2) {
|
|
||||||
double earth_radius = 6378.137;
|
|
||||||
double dLat = mark2.getLatitude() * Math.PI / 180 - mark1.getLatitude() * Math.PI / 180;
|
|
||||||
double dLon = mark2.getLongitude() * Math.PI / 180 - mark1.getLongitude() * Math.PI / 180;
|
|
||||||
|
|
||||||
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(mark1.getLatitude() * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
|
||||||
|
|
||||||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
||||||
double d = earth_radius * c;
|
|
||||||
|
|
||||||
return d * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a boat with given (x, y) position in the given color
|
* Draws a boat with given (x, y) position in the given color
|
||||||
*
|
*
|
||||||
* @param x
|
* @param lat
|
||||||
* @param y
|
* @param lon
|
||||||
* @param color
|
* @param color
|
||||||
*/
|
*/
|
||||||
private void drawBoat(double lat, double lon, Color color) {
|
private void drawBoat(double lat, double lon, Color color) {
|
||||||
// Latitude
|
// Latitude
|
||||||
//Double x = (MAP_WIDTH / 360.0) * (180 + lon);
|
double x = (lon - ORIGIN_LON) * 1000;
|
||||||
//Double y = (MAP_HEIGHT / 180.0) * (80 - lat);
|
double y = (ORIGIN_LAT - lat) * 1000;
|
||||||
|
|
||||||
double x = abs(lat - 32.283808) * 1000; // to prevent negative longitude
|
|
||||||
double y = abs(lon + 64.854401) * 1000; // to prevent negative latitude
|
|
||||||
|
|
||||||
double diameter = 0.5;
|
double diameter = 0.5;
|
||||||
|
|
||||||
gc.setFill(color);
|
gc.setFill(color);
|
||||||
gc.fillOval(x, y, diameter, diameter);
|
gc.fillOval(x, y, diameter, diameter);
|
||||||
}
|
}
|
||||||
@@ -147,7 +190,7 @@ public class CanvasController {
|
|||||||
private void drawCourse() {
|
private void drawCourse() {
|
||||||
for (Mark mark : race.getCourse()) {
|
for (Mark mark : race.getCourse()) {
|
||||||
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
|
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
|
||||||
drawSingleMark((SingleMark) mark);
|
drawSingleMark((SingleMark) mark, Color.BLACK);
|
||||||
} else if (mark.getMarkType() == MarkType.GATE_MARK) {
|
} else if (mark.getMarkType() == MarkType.GATE_MARK) {
|
||||||
drawGateMark((GateMark) mark);
|
drawGateMark((GateMark) mark);
|
||||||
}
|
}
|
||||||
@@ -159,11 +202,11 @@ public class CanvasController {
|
|||||||
*
|
*
|
||||||
* @param singleMark
|
* @param singleMark
|
||||||
*/
|
*/
|
||||||
private void drawSingleMark(SingleMark singleMark) {
|
private void drawSingleMark(SingleMark singleMark, Color color) {
|
||||||
double x = abs(singleMark.getLatitude() - 32.283808) * 1000; // to prevent negative longitude
|
double x = (singleMark.getLongitude() - ORIGIN_LON) * 1000;
|
||||||
double y = abs(singleMark.getLongitude() + 64.854401) * 1000; // to prevent negative latitude
|
double y = (ORIGIN_LAT - singleMark.getLatitude()) * 1000;
|
||||||
|
|
||||||
gc.setFill(Color.BLACK);
|
gc.setFill(color);
|
||||||
gc.fillOval(x, y, 0.5, 0.5);
|
gc.fillOval(x, y, 0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +216,28 @@ public class CanvasController {
|
|||||||
* @param gateMark
|
* @param gateMark
|
||||||
*/
|
*/
|
||||||
private void drawGateMark(GateMark gateMark) {
|
private void drawGateMark(GateMark gateMark) {
|
||||||
drawSingleMark(gateMark.getSingleMark1());
|
Color color = Color.BLUE;
|
||||||
drawSingleMark(gateMark.getSingleMark2());
|
|
||||||
|
if (gateMark.getName().equals("Start") || gateMark.getName().equals("Finish")){
|
||||||
|
color = Color.RED;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawSingleMark(gateMark.getSingleMark1(), color);
|
||||||
|
drawSingleMark(gateMark.getSingleMark2(), color);
|
||||||
|
|
||||||
|
GraphicsContext gc = canvas.getGraphicsContext2D();
|
||||||
|
|
||||||
|
gc.setStroke(color);
|
||||||
|
|
||||||
|
//@todo Put this in Mark class
|
||||||
|
double x1 = (gateMark.getSingleMark1().getLongitude()- ORIGIN_LON) * 1000;
|
||||||
|
double y1 = (ORIGIN_LAT - gateMark.getSingleMark1().getLatitude()) * 1000;
|
||||||
|
|
||||||
|
double x2 = (gateMark.getSingleMark2().getLongitude() - ORIGIN_LON) * 1000;
|
||||||
|
double y2 = (ORIGIN_LAT - gateMark.getSingleMark2().getLatitude()) * 1000;
|
||||||
|
|
||||||
|
gc.setLineWidth(0.1);
|
||||||
|
|
||||||
|
gc.strokeLine(x1, y1, x2, y2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package seng302.controllers;
|
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ptg19 on 20/03/17.
|
|
||||||
*/
|
|
||||||
public class Controller {
|
|
||||||
@FXML private AnchorPane window;
|
|
||||||
@FXML private Parent raceView;
|
|
||||||
@FXML private RaceController raceViewController;
|
|
||||||
|
|
||||||
//^ this is automatic fxml linking based off http://blog.buildpath.de/fxml-composition-how-to-get-the-controller-of-an-included-fxml-view-nested-controllers/
|
|
||||||
// From googling it's probably better to just add a child however you did that in your 301 michael, it kinda depends on how we are going to
|
|
||||||
// make an event for changing the screen.
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package seng302.controllers;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by michaelrausch on 21/03/17.
|
||||||
|
*/
|
||||||
|
public class MasterViewController implements Initializable {
|
||||||
|
@FXML
|
||||||
|
private AnchorPane contentPane;
|
||||||
|
|
||||||
|
private void setContentPane(String jfxUrl){
|
||||||
|
try{
|
||||||
|
contentPane.getChildren().removeAll();
|
||||||
|
contentPane.getChildren().clear();
|
||||||
|
contentPane.getChildren().addAll((Pane) FXMLLoader.load(getClass().getResource(jfxUrl)));
|
||||||
|
}
|
||||||
|
catch(javafx.fxml.LoadException e){
|
||||||
|
System.err.println(e.getCause());
|
||||||
|
}
|
||||||
|
catch(IOException e){
|
||||||
|
System.err.println(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
setContentPane("/RaceView.fxml");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,9 +2,8 @@ package seng302.controllers;
|
|||||||
|
|
||||||
import seng302.models.Boat;
|
import seng302.models.Boat;
|
||||||
import seng302.models.OldFileParser;
|
import seng302.models.OldFileParser;
|
||||||
import seng302.models.parsers.*;
|
|
||||||
import seng302.models.mark.*;
|
|
||||||
import seng302.models.Race;
|
import seng302.models.Race;
|
||||||
|
import seng302.models.parsers.CourseParser;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
@@ -20,6 +19,7 @@ import java.util.Random;
|
|||||||
*/
|
*/
|
||||||
public class RaceController {
|
public class RaceController {
|
||||||
Race race = null;
|
Race race = null;
|
||||||
|
|
||||||
public void initializeRace() {
|
public void initializeRace() {
|
||||||
String raceConfigFile;
|
String raceConfigFile;
|
||||||
raceConfigFile = "doc/examples/config.json";
|
raceConfigFile = "doc/examples/config.json";
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package seng302.controllers;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ptg19 on 20/03/17.
|
||||||
|
*/
|
||||||
|
public class RaceResultController implements Initializable{
|
||||||
|
@FXML private AnchorPane window;
|
||||||
|
@FXML private Parent raceView;
|
||||||
|
@FXML private RaceController raceViewController;
|
||||||
|
|
||||||
|
public void setResults(){
|
||||||
|
System.out.println("HI MOM");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package seng302.models;
|
package seng302.models;
|
||||||
|
|
||||||
import seng302.models.mark.Mark;
|
import seng302.models.mark.Mark;
|
||||||
import seng302.models.mark.SingleMark;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -40,7 +39,7 @@ public class Event {
|
|||||||
* @param eventTime, what time the event happens
|
* @param eventTime, what time the event happens
|
||||||
* @param eventBoat, the boat that the event belongs to
|
* @param eventBoat, the boat that the event belongs to
|
||||||
*/
|
*/
|
||||||
public Event(Double eventTime, Boat eventBoat, SingleMark mark1) {
|
public Event(Double eventTime, Boat eventBoat, Mark mark1) {
|
||||||
this.time = eventTime;
|
this.time = eventTime;
|
||||||
this.boat = eventBoat;
|
this.boat = eventBoat;
|
||||||
this.mark1 = mark1;
|
this.mark1 = mark1;
|
||||||
|
|||||||
@@ -104,8 +104,9 @@ public class Race {
|
|||||||
// There are no more marks after this event
|
// There are no more marks after this event
|
||||||
|
|
||||||
else{
|
else{
|
||||||
Event event = new Event(time, boat, course.get(i), course.get(i));
|
Event event = new Event(time, boat, course.get(i));
|
||||||
events.get(boat).add(event);
|
events.get(boat).add(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,4 +133,8 @@ public class Race {
|
|||||||
public HashMap<Boat, List> getEvents() {
|
public HashMap<Boat, List> getEvents() {
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBoatFinished(Boat boat){
|
||||||
|
this.finishingOrder.add(boat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -37,4 +37,12 @@ public class GateMark extends Mark {
|
|||||||
public void setSingleMark2(SingleMark singleMark2) {
|
public void setSingleMark2(SingleMark singleMark2) {
|
||||||
this.singleMark2 = singleMark2;
|
this.singleMark2 = singleMark2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getLatitude(){
|
||||||
|
return (this.getSingleMark1().getLatitude() + this.getSingleMark2().getLatitude()) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLongitude(){
|
||||||
|
return (this.getSingleMark1().getLongitude() + this.getSingleMark2().getLongitude()) / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<AnchorPane maxHeight="1080.0" maxWidth="1920.0" minHeight="1080.0" minWidth="1920.0" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.RaceResultController">
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
|
||||||
<children>
|
<children>
|
||||||
<GridPane layoutX="444.0" layoutY="256.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane layoutX="444.0" layoutY="256.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -22,13 +21,13 @@
|
|||||||
<RowConstraints maxHeight="812.0" minHeight="10.0" prefHeight="753.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="812.0" minHeight="10.0" prefHeight="753.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Race Results:" textAlignment="CENTER" wrappingWidth="640.244140625" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Race Results:" textAlignment="CENTER" wrappingWidth="640.244140625" GridPane.rowIndex="3">
|
||||||
<font>
|
<font>
|
||||||
<Font size="45.0" />
|
<Font size="45.0" />
|
||||||
</font>
|
</font>
|
||||||
</Text>
|
</Text>
|
||||||
<VBox fx:id="resultsVBox" prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
<VBox fx:id="resultsVBox" prefHeight="200.0" prefWidth="100.0" GridPane.rowIndex="4" />
|
||||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Finish!" textAlignment="CENTER" wrappingWidth="640.0234375" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Finish!" textAlignment="CENTER" wrappingWidth="640.0234375" GridPane.rowIndex="1">
|
||||||
<font>
|
<font>
|
||||||
<Font size="75.0" />
|
<Font size="75.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
|
||||||
<AnchorPane fx:id="window" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.Controller">
|
<AnchorPane fx:id="contentPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.MasterViewController">
|
||||||
<children>
|
<children>
|
||||||
<fx:include source="RaceView.fxml" fx:id="raceView"/>
|
<!--<fx:include source="RaceView.fxml" fx:id="raceView"/>-->
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<?import javafx.scene.canvas.Canvas?>
|
<?import javafx.scene.canvas.Canvas?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.CanvasController">
|
<AnchorPane fx:id="contentAnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.CanvasController">
|
||||||
<children>
|
<children>
|
||||||
<Canvas fx:id="canvas" height="1080.0" width="1920.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<Canvas fx:id="canvas" height="1080.0" width="1920.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
Reference in New Issue
Block a user