|
|
|
|
@ -24,7 +24,7 @@ public class RaceController extends Controller {
|
|
|
|
|
|
|
|
|
|
//user saved data for annotation display
|
|
|
|
|
private ArrayList<Boolean> presetAnno;
|
|
|
|
|
|
|
|
|
|
private ArrayList<Boat> startBoats;
|
|
|
|
|
private Integer sparkLineNumber = 0;
|
|
|
|
|
private ResizableRaceCanvas raceMap;
|
|
|
|
|
private ResizableRaceMap raceBoundaries;
|
|
|
|
|
@ -82,8 +82,9 @@ public class RaceController extends Controller {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
|
|
|
createSparkLine();
|
|
|
|
|
//createSparkLine();
|
|
|
|
|
//listener for fps
|
|
|
|
|
startBoats = new ArrayList<>();
|
|
|
|
|
showFPS.selectedProperty().addListener((ov, old_val, new_val) -> {
|
|
|
|
|
if (showFPS.isSelected()) {
|
|
|
|
|
FPS.setVisible(true);
|
|
|
|
|
@ -93,11 +94,14 @@ public class RaceController extends Controller {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createSparkLine(){
|
|
|
|
|
public void createSparkLine(ObservableList<Boat> boats){
|
|
|
|
|
// TODO replace for loop with boatsInRace
|
|
|
|
|
int [] boats = {1, 2, 3, 4, 5, 6};
|
|
|
|
|
//int [] boats = {1, 2, 3, 4, 5, 6};
|
|
|
|
|
// set a line for each boat
|
|
|
|
|
for (int i=0; i<boats.length; i++){
|
|
|
|
|
for (Boat boat : boats){
|
|
|
|
|
startBoats.add(boat);
|
|
|
|
|
}
|
|
|
|
|
for (int i=0; i<startBoats.size(); i++){
|
|
|
|
|
XYChart.Series<Number, Number> series = new XYChart.Series();
|
|
|
|
|
series.getData().add(new XYChart.Data(0, i+1));
|
|
|
|
|
sparklineChart.getData().add(series);
|
|
|
|
|
@ -105,7 +109,7 @@ public class RaceController extends Controller {
|
|
|
|
|
|
|
|
|
|
// reverse Y axis order (0 at top) and set axis height/width
|
|
|
|
|
// TODO change lower bound to boatsInRace + 1
|
|
|
|
|
yAxis.setLowerBound(boats.length+1);
|
|
|
|
|
yAxis.setLowerBound(startBoats.size()+1);
|
|
|
|
|
yAxis.setUpperBound(0);
|
|
|
|
|
yAxis.setAutoRanging(false);
|
|
|
|
|
xAxis.setAutoRanging(false);
|
|
|
|
|
@ -199,18 +203,20 @@ public class RaceController extends Controller {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateSparkline(){
|
|
|
|
|
// TODO replace for loops with correct boats
|
|
|
|
|
int [] startingBoats = {1, 2, 3, 4, 5, 6};
|
|
|
|
|
int [] boatsInRace = {1, 2, 3, 4, 5, 6};
|
|
|
|
|
|
|
|
|
|
public void updateSparkline(ObservableList<Boat> boatsInRace){
|
|
|
|
|
// TODO replace for loops with correct boats - Done
|
|
|
|
|
//int [] startingBoats = {1, 2, 3, 4, 5, 6};
|
|
|
|
|
//int [] boatsInRace = {1, 2, 3, 4, 5, 6};
|
|
|
|
|
int placingVal = boatsInRace.size();
|
|
|
|
|
//System.out.println(boatsInRace.get(0).toString());
|
|
|
|
|
System.out.println(startBoats.get(0).toString());
|
|
|
|
|
sparkLineNumber++;
|
|
|
|
|
for (int i=0; i<startingBoats.length; i++){
|
|
|
|
|
for (int j=0; j<boatsInRace.length; j++){
|
|
|
|
|
// TODO if startingBoat[i] == boatsInRace[j]
|
|
|
|
|
if (i==j){
|
|
|
|
|
sparklineChart.getData().get(i).getData().add(new XYChart.Data<>
|
|
|
|
|
(sparkLineNumber, j+1));
|
|
|
|
|
for (int i=0; i<boatsInRace.size(); i++){
|
|
|
|
|
for (int j=0; j<startBoats.size(); j++){
|
|
|
|
|
if (boatsInRace.get(i)==startBoats.get(j)){
|
|
|
|
|
sparklineChart.getData().get(j).getData().add(new XYChart.Data<>
|
|
|
|
|
(sparkLineNumber, placingVal));
|
|
|
|
|
placingVal-=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|