Added ArrowController. This is the controller for arrow.fxml.

Removed arrow control stuff from ResizableRaceCanvas.
Added a wind speed label to arrow.fxml. Also created an outer GridPane to lay things out.
#story[1093]
This commit is contained in:
fjc40
2017-08-02 18:24:43 +12:00
parent ed12ff659d
commit 9889a474ee
5 changed files with 228 additions and 73 deletions
@@ -54,22 +54,15 @@ public class ResizableRaceCanvas extends ResizableCanvas {
private boolean annoTimeSinceLastMark = true;
/**
* The wind arrow node.
*/
private Node arrow;
/**
* Constructs a {@link ResizableRaceCanvas} using a given {@link VisualiserRace}.
* @param visualiserRace The race that data is read from in order to be drawn.
* @param arrow The wind arrow's node.
*/
public ResizableRaceCanvas(VisualiserRace visualiserRace, Node arrow) {
public ResizableRaceCanvas(VisualiserRace visualiserRace) {
super();
this.visualiserRace = visualiserRace;
this.arrow = arrow;
RaceDataSource raceData = visualiserRace.getRaceDataSource();
@@ -375,32 +368,6 @@ public class ResizableRaceCanvas extends ResizableCanvas {
/**
* Displays an arrow representing wind direction on the Canvas.
* This function accepts a wind-to bearing, but displays a wind-from bearing.
*
* @param angle Angle that the arrow is to be facing in degrees 0 degrees = North (Up).
* @see GraphCoordinate
*/
private void displayWindArrow(double angle) {
//We need to display wind-from, so add 180 degrees.
angle += 180d;
//Get it within [0, 360).
while (angle >= 360d) {
angle -= 360d;
}
//Rotate the wind arrow.
if (arrow != null && arrow.getRotate() != angle) {
arrow.setRotate(angle);
}
}
/**
* Draws all of the {@link Mark}s on the canvas.
*/
@@ -511,9 +478,6 @@ public class ResizableRaceCanvas extends ResizableCanvas {
//Marks.
drawMarks();
//Wind arrow. This rotates the wind arrow node.
displayWindArrow(this.visualiserRace.getWindDirection().degrees());
}