Fix for some movement on racestart issues

#bug
This commit is contained in:
Calum
2017-05-04 10:38:04 +12:00
parent f0d6312fa5
commit a56e55ae70
6 changed files with 157 additions and 70 deletions
@@ -5,11 +5,14 @@ import javafx.beans.property.SimpleDoubleProperty;
import javafx.fxml.FXML;
import javafx.geometry.Point2D;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import seng302.models.Boat;
import seng302.models.BoatGroup;
import seng302.models.Colors;
@@ -326,7 +329,7 @@ public class CanvasController {
for (Boat boat : boats) {
BoatGroup boatGroup = new BoatGroup(boat, Colors.getColor());
boatGroup.moveTo(startingX, startingY, 0d);
boatGroup.forceRotation();
boatGroup.setStage(raceViewController.getStage());
raceObjects.add(boatGroup);
boatAnnotations.getChildren().add(boatGroup.getLowPriorityAnnotations());
}
@@ -7,6 +7,7 @@ import javafx.concurrent.Task;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
@@ -15,6 +16,7 @@ import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import seng302.models.parsers.StreamParser;
import seng302.models.parsers.XMLParser;
@@ -48,12 +50,17 @@ public class Controller implements Initializable {
private TableColumn countryCol;
@FXML
private Label realTime;
private Stage stage;
private void setContentPane(String jfxUrl){
try{
contentPane.getChildren().removeAll();
contentPane.getChildren().clear();
contentPane.getChildren().addAll((Pane) FXMLLoader.load(getClass().getResource(jfxUrl)));
// contentPane.getChildren().addAll((Pane) FXMLLoader.load(getClass().getResource(jfxUrl)));
FXMLLoader loader = new FXMLLoader(getClass().getResource(jfxUrl));
contentPane.getChildren().addAll((Node) loader.load());
RaceViewController r = (RaceViewController) loader.getController();
//((RaceViewController) loader.getController()).setStage(stage);
}
catch(javafx.fxml.LoadException e){
System.err.println(e.getCause());
@@ -145,4 +152,7 @@ public class Controller implements Initializable {
data.add(boat);
}
}
public void setStage (Stage stage) {
this.stage = stage;
}
}
@@ -15,6 +15,7 @@ import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Duration;
import javafx.util.StringConverter;
import seng302.models.*;
@@ -49,6 +50,7 @@ public class RaceViewController extends Thread{
private Map<Boat, TimelineInfo> timelineInfos = new HashMap<>();
private ArrayList<Boat> boatOrder = new ArrayList<>();
private Race race;
private Stage stage;
public void initialize() {
@@ -397,4 +399,11 @@ public class RaceViewController extends Thread{
}
}
void setStage (Stage stage) {
this.stage = stage;
}
Stage getStage () {
return stage;
}
}