|
|
|
@ -1,16 +1,27 @@
|
|
|
|
package seng302.Controllers;
|
|
|
|
package seng302.Controllers;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import eu.hansolo.medusa.Fonts;
|
|
|
|
|
|
|
|
import eu.hansolo.medusa.Gauge;
|
|
|
|
|
|
|
|
import eu.hansolo.medusa.GaugeBuilder;
|
|
|
|
|
|
|
|
import eu.hansolo.medusa.skins.GaugeSkin;
|
|
|
|
|
|
|
|
import eu.hansolo.medusa.skins.GaugeSkinBase;
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
|
|
|
|
import javafx.geometry.Pos;
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
|
|
|
|
import javafx.scene.layout.Pane;
|
|
|
|
|
|
|
|
import javafx.scene.layout.StackPane;
|
|
|
|
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
|
|
|
|
import javafx.scene.paint.Paint;
|
|
|
|
import seng302.Mock.StreamedRace;
|
|
|
|
import seng302.Mock.StreamedRace;
|
|
|
|
import seng302.Model.*;
|
|
|
|
import seng302.Model.*;
|
|
|
|
import seng302.VisualiserInput;
|
|
|
|
import seng302.VisualiserInput;
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -24,7 +35,9 @@ public class RaceController extends Controller {
|
|
|
|
|
|
|
|
|
|
|
|
private ResizableRaceCanvas raceMap;
|
|
|
|
private ResizableRaceCanvas raceMap;
|
|
|
|
private ResizableRaceMap raceBoundaries;
|
|
|
|
private ResizableRaceMap raceBoundaries;
|
|
|
|
|
|
|
|
private Gauge arrow;
|
|
|
|
@FXML SplitPane race;
|
|
|
|
@FXML SplitPane race;
|
|
|
|
|
|
|
|
@FXML StackPane arrowPane;
|
|
|
|
@FXML CheckBox showFPS;
|
|
|
|
@FXML CheckBox showFPS;
|
|
|
|
@FXML CheckBox showBoatPath;
|
|
|
|
@FXML CheckBox showBoatPath;
|
|
|
|
@FXML CheckBox showAnnotations;
|
|
|
|
@FXML CheckBox showAnnotations;
|
|
|
|
@ -94,6 +107,8 @@ public class RaceController extends Controller {
|
|
|
|
StreamedRace newRace = new StreamedRace(visualiserInput, this);
|
|
|
|
StreamedRace newRace = new StreamedRace(visualiserInput, this);
|
|
|
|
//newRace.initialiseBoats();
|
|
|
|
//newRace.initialiseBoats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
makeArrow();
|
|
|
|
|
|
|
|
|
|
|
|
raceMap = new ResizableRaceCanvas(visualiserInput.getCourse());
|
|
|
|
raceMap = new ResizableRaceCanvas(visualiserInput.getCourse());
|
|
|
|
raceMap.setMouseTransparent(true);
|
|
|
|
raceMap.setMouseTransparent(true);
|
|
|
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
|
|
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
|
|
|
@ -101,6 +116,7 @@ public class RaceController extends Controller {
|
|
|
|
//raceMap.setBoats(newRace.getStartingBoats());
|
|
|
|
//raceMap.setBoats(newRace.getStartingBoats());
|
|
|
|
raceMap.draw();
|
|
|
|
raceMap.draw();
|
|
|
|
raceMap.setVisible(true);
|
|
|
|
raceMap.setVisible(true);
|
|
|
|
|
|
|
|
raceMap.setArrow(this.arrow);
|
|
|
|
|
|
|
|
|
|
|
|
canvasBase.getChildren().add(0, raceMap);
|
|
|
|
canvasBase.getChildren().add(0, raceMap);
|
|
|
|
|
|
|
|
|
|
|
|
@ -110,6 +126,7 @@ public class RaceController extends Controller {
|
|
|
|
raceBoundaries.heightProperty().bind(canvasBase.heightProperty());
|
|
|
|
raceBoundaries.heightProperty().bind(canvasBase.heightProperty());
|
|
|
|
raceBoundaries.draw();
|
|
|
|
raceBoundaries.draw();
|
|
|
|
raceBoundaries.setVisible(true);
|
|
|
|
raceBoundaries.setVisible(true);
|
|
|
|
|
|
|
|
|
|
|
|
canvasBase.getChildren().add(0, raceBoundaries);
|
|
|
|
canvasBase.getChildren().add(0, raceBoundaries);
|
|
|
|
|
|
|
|
|
|
|
|
race.setVisible(true);
|
|
|
|
race.setVisible(true);
|
|
|
|
@ -211,4 +228,44 @@ public class RaceController extends Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void makeArrow() {
|
|
|
|
|
|
|
|
arrow = GaugeBuilder.create()
|
|
|
|
|
|
|
|
.minValue(0)
|
|
|
|
|
|
|
|
.maxValue(359)
|
|
|
|
|
|
|
|
.startAngle(180)
|
|
|
|
|
|
|
|
.angleRange(360)
|
|
|
|
|
|
|
|
.autoScale(false)
|
|
|
|
|
|
|
|
.customTickLabelsEnabled(true)
|
|
|
|
|
|
|
|
.customTickLabels("N", "", "", "", "", "", "", "", "",
|
|
|
|
|
|
|
|
"E", "", "", "", "", "", "", "", "",
|
|
|
|
|
|
|
|
"S", "", "", "", "", "", "", "", "",
|
|
|
|
|
|
|
|
"W", "", "", "", "", "", "", "", "")
|
|
|
|
|
|
|
|
.customTickLabelFontSize(72)
|
|
|
|
|
|
|
|
.needleBehavior(Gauge.NeedleBehavior.OPTIMIZED)
|
|
|
|
|
|
|
|
.borderPaint(Color.web("#1f1e23"))
|
|
|
|
|
|
|
|
.backgroundPaint(Color.web("#1f1e23"))
|
|
|
|
|
|
|
|
.needleColor(Color.web("#dad9db"))
|
|
|
|
|
|
|
|
.tickMarkColor(Color.web("#9f9fa1"))
|
|
|
|
|
|
|
|
.tickLabelColor(Color.web("#dad9db"))
|
|
|
|
|
|
|
|
.valueColor(Color.web("#dad9db"))
|
|
|
|
|
|
|
|
.title("Wind direction")
|
|
|
|
|
|
|
|
.titleColor(Color.web("#dad9db"))
|
|
|
|
|
|
|
|
.knobType(Gauge.KnobType.FLAT)
|
|
|
|
|
|
|
|
.knobColor(Gauge.BRIGHT_COLOR)
|
|
|
|
|
|
|
|
.prefSize(125, 125)
|
|
|
|
|
|
|
|
.maxWidth(125)
|
|
|
|
|
|
|
|
.maxHeight(125)
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Label value = new Label("0°");
|
|
|
|
|
|
|
|
value.setFont(Fonts.latoBold(72));
|
|
|
|
|
|
|
|
value.setAlignment(Pos.CENTER);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arrow.valueProperty().addListener(o -> {
|
|
|
|
|
|
|
|
value.setText(String.format("%f°", arrow.getValue()));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
arrow.setValue(0);
|
|
|
|
|
|
|
|
arrowPane.getChildren().add(arrow);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|