Arrow is now displayed on screen more vividly, the arrow can be customised to a different colour scheme if needed. #story[882]
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package seng302.Model;
|
||||
|
||||
|
||||
import eu.hansolo.medusa.Gauge;
|
||||
import eu.hansolo.medusa.GaugeBuilder;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.transform.Rotate;
|
||||
@@ -31,6 +34,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
private final List<Marker> markers;
|
||||
double[] xpoints = {}, ypoints = {};
|
||||
private final RaceDataSource raceData;
|
||||
private Gauge arrow;
|
||||
|
||||
public ResizableRaceCanvas(RaceDataSource raceData) {
|
||||
super();
|
||||
@@ -146,6 +150,13 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
gc.restore();
|
||||
}
|
||||
|
||||
private void displayFancyArrow(GraphCoordinate coordinate, double angle) {
|
||||
angle = angle % 360;
|
||||
if (arrow != null && arrow.getValue() != angle) {
|
||||
this.arrow.setValue(angle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates things on the canvas Note: this must be called in between gc.save() and gc.restore() else they will rotate everything
|
||||
*
|
||||
@@ -240,9 +251,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
|
||||
//display wind direction arrow - specify origin point and angle - angle now set to random angle
|
||||
if (raceData instanceof StreamedCourse) {
|
||||
displayArrow(new GraphCoordinate((int) getWidth() - 40, 40), ((StreamedCourse) raceData).getWindDirection());
|
||||
displayFancyArrow(new GraphCoordinate((int) getWidth() - 40, 40), ((StreamedCourse) raceData).getWindDirection());
|
||||
} else {
|
||||
displayArrow(new GraphCoordinate((int) getWidth() - 40, 40), 150);
|
||||
displayFancyArrow(new GraphCoordinate((int) getWidth() - 40, 40), 150);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,4 +360,8 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
));
|
||||
}
|
||||
|
||||
public void setArrow(Gauge arrow) {
|
||||
this.arrow = arrow;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user