Changed abbreviations for teams
-Updated the team abbreviations to official ones -Change methods that were public to private
This commit is contained in:
@@ -23,10 +23,10 @@ public class Constants {
|
||||
|
||||
public static final BoatInRace[] OFFICIAL_AC35_COMPETITORS = new BoatInRace[]
|
||||
{new BoatInRace("Oracle Team USA", 30.0, Color.BLUEVIOLET, "Oracle"),
|
||||
new BoatInRace("Land Rover BAR", 23.0, Color.BLACK, "BAR"),
|
||||
new BoatInRace("SoftBank Team Japan", 27.0, Color.RED, "JAP"),
|
||||
new BoatInRace("Land Rover BAR", 23.0, Color.BLACK, "BGR"),
|
||||
new BoatInRace("SoftBank Team Japan", 27.0, Color.RED, "JPN"),
|
||||
new BoatInRace("Groupama Team France", 25.0, Color.ORANGE, "FRA"),
|
||||
new BoatInRace("Artemis Racing", 22.5, Color.DARKOLIVEGREEN, "ART"),
|
||||
new BoatInRace("Artemis Racing", 22.5, Color.DARKOLIVEGREEN, "SWE"),
|
||||
new BoatInRace("Emirates Team New Zealand", 62, Color.LIMEGREEN, "ETNZ")};
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public class RaceController extends Controller{
|
||||
|
||||
@FXML
|
||||
GridPane startScreen;
|
||||
|
||||
@FXML
|
||||
SplitPane ongoingRacePane;
|
||||
|
||||
@@ -119,6 +120,8 @@ public class RaceController extends Controller{
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
//listener for fps
|
||||
Tooltip tp = new Tooltip("memes for days");
|
||||
tp.install(timer, tp);
|
||||
showFPS.selectedProperty().addListener(new ChangeListener<Boolean>() {
|
||||
public void changed(ObservableValue<? extends Boolean> ov,
|
||||
Boolean old_val, Boolean new_val) {
|
||||
@@ -129,6 +132,18 @@ public class RaceController extends Controller{
|
||||
}
|
||||
}
|
||||
});
|
||||
timer.setOnMouseEntered(new EventHandler<MouseEvent>() {
|
||||
@Override
|
||||
public void handle(MouseEvent e) {
|
||||
tp.show(timer, timer.getLayoutX()+timer.getWidth()+10, timer.getLayoutY()+timer.getHeight()-10);
|
||||
}
|
||||
});
|
||||
timer.setOnMouseExited(new EventHandler<MouseEvent>() {
|
||||
@Override
|
||||
public void handle(MouseEvent e) {
|
||||
tp.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +151,7 @@ public class RaceController extends Controller{
|
||||
* Initializes and runs the race, based on the user's chosen scale factor
|
||||
* Currently uses an example racecourse
|
||||
*
|
||||
* @param scaleFactor
|
||||
* @param scaleFactor scale value of race
|
||||
*/
|
||||
private void startRace(int scaleFactor) {
|
||||
RaceXMLReader raceXMLReader = null;
|
||||
|
||||
@@ -48,7 +48,6 @@ public class Boat {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print method prints the name of the boat
|
||||
* @return Name of the boat.
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
* @see Color
|
||||
* @see Paint
|
||||
*/
|
||||
public void displayMark(GraphCoordinate graphCoordinate, Paint paint) {
|
||||
private void displayMark(GraphCoordinate graphCoordinate, Paint paint) {
|
||||
gc.setFill(paint);
|
||||
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 25, 25);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
* @see Color
|
||||
* @see Paint
|
||||
*/
|
||||
public void displayLine(GraphCoordinate graphCoordinateA, GraphCoordinate graphCoordinateB, Paint paint) {
|
||||
private void displayLine(GraphCoordinate graphCoordinateA, GraphCoordinate graphCoordinateB, Paint paint) {
|
||||
gc.setStroke(paint);
|
||||
gc.setFill(paint);
|
||||
gc.fillOval(graphCoordinateA.getX() - 3, graphCoordinateA.getY() - 3, 6, 6);
|
||||
@@ -103,18 +103,19 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
* @see Paint
|
||||
* @see Color
|
||||
*/
|
||||
public void displayPoint(GraphCoordinate graphCoordinate, Paint paint) {
|
||||
private void displayPoint(GraphCoordinate graphCoordinate, Paint paint) {
|
||||
gc.setFill(paint);
|
||||
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays an arrow on the Canvas
|
||||
* @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).
|
||||
* @see GraphCoordinate
|
||||
*/
|
||||
public void displayArrow(GraphCoordinate coordinate, int angle) {
|
||||
private void displayArrow(GraphCoordinate coordinate, int angle) {
|
||||
gc.save();
|
||||
rotate(angle, coordinate.getX(),coordinate.getY());
|
||||
gc.setFill(Color.BLACK);
|
||||
@@ -141,8 +142,8 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
* @param speed speed of the boat
|
||||
* @param coordinate coordinate the text appears
|
||||
*/
|
||||
public void displayText(String name, double speed, GraphCoordinate coordinate){
|
||||
String text = String.format("%s, %2$.2f knots", name, speed);
|
||||
private void displayText(String name, double speed, GraphCoordinate coordinate){
|
||||
String text = String.format("%s, %2$.2fkn", name, speed);
|
||||
//System.out.println(text.length()*7);
|
||||
long xCoord = coordinate.getX()+20;
|
||||
long yCoord = coordinate.getY();
|
||||
@@ -155,6 +156,7 @@ public class ResizableRaceCanvas extends Canvas {
|
||||
gc.fillText(text, xCoord, yCoord);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
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
|
||||
|
||||
@@ -9,31 +9,31 @@
|
||||
<boat>
|
||||
<name>Land Rover BAR</name>
|
||||
<speed>500</speed>
|
||||
<abbr>BAR</abbr>
|
||||
<abbr>GBR</abbr>
|
||||
<colour>BLACK</colour>
|
||||
</boat>
|
||||
<boat>
|
||||
<name>SoftBank Team Japan</name>
|
||||
<speed>400</speed>
|
||||
<abbr>JAP</abbr>
|
||||
<abbr>JPN</abbr>
|
||||
<colour>RED</colour>
|
||||
</boat>
|
||||
<boat>
|
||||
<name>Groupama Team France</name>
|
||||
<speed>350</speed>
|
||||
<abbr>FRN</abbr>
|
||||
<abbr>FRA</abbr>
|
||||
<colour>ORANGE</colour>
|
||||
</boat>
|
||||
<boat>
|
||||
<name>Artemis Racing</name>
|
||||
<speed>440</speed>
|
||||
<abbr>ART</abbr>
|
||||
<abbr>SWE</abbr>
|
||||
<colour>DARKOLIVEGREEN</colour>
|
||||
</boat>
|
||||
<boat>
|
||||
<name>Emirates Team New Zealand</name>
|
||||
<speed>620</speed>
|
||||
<abbr>ENZ</abbr>
|
||||
<abbr>NZL</abbr>
|
||||
<colour>LIMEGREEN</colour>
|
||||
</boat>
|
||||
</boats>
|
||||
|
||||
@@ -63,14 +63,20 @@
|
||||
<items>
|
||||
<AnchorPane fx:id="canvasBase" prefHeight="581.0" prefWidth="537.0">
|
||||
<children>
|
||||
<Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" />
|
||||
<Label fx:id="timer" layoutX="45.0" layoutY="146.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font></Label>
|
||||
<Label fx:id="timer" layoutX="45.0" layoutY="146.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font></Label>
|
||||
<TitledPane fx:id="userControl" animated="false" text="User Control" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="77.0" prefWidth="200.0">
|
||||
<children>
|
||||
<CheckBox fx:id="showFPS" mnemonicParsing="false" selected="true" text="Show FPS" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<CheckBox fx:id="showAnno" mnemonicParsing="false" selected="true" text="Show Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" />
|
||||
<CheckBox fx:id="showAnno" mnemonicParsing="false" selected="true" text="Show Annotation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="30.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
|
||||
Reference in New Issue
Block a user