Merge remote-tracking branch 'remotes/origin/sprint4_master' into story36
# Conflicts: # visualiser/src/main/java/seng302/Controllers/RaceController.java # visualiser/src/main/java/seng302/Model/ResizableRaceCanvas.java #story[878]
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package seng302.Controllers;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.layout.Pane;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Created by Joseph on 22/05/2017.
|
||||
*/
|
||||
public class ArrowController extends Controller {
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,23 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.chart.LineChart;
|
||||
import javafx.scene.chart.NumberAxis;
|
||||
import javafx.scene.chart.XYChart;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Color;
|
||||
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.Model.*;
|
||||
import seng302.VisualiserInput;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 15/03/2017.
|
||||
@@ -33,7 +41,9 @@ public class RaceController extends Controller {
|
||||
private Map<Integer, String> boatColours = new HashMap<>();
|
||||
private int legNum;
|
||||
private RaceClock raceClock;
|
||||
@FXML Pane arrow;
|
||||
@FXML SplitPane race;
|
||||
@FXML StackPane arrowPane;
|
||||
@FXML CheckBox showFPS;
|
||||
@FXML CheckBox showBoatPath;
|
||||
@FXML CheckBox showAnnotations;
|
||||
@@ -168,6 +178,9 @@ public class RaceController extends Controller {
|
||||
|
||||
//newRace.initialiseBoats();
|
||||
legNum = visualiserInput.getCourse().getLegs().size()-1;
|
||||
|
||||
makeArrow();
|
||||
|
||||
raceMap = new ResizableRaceCanvas(visualiserInput.getCourse());
|
||||
raceMap.setMouseTransparent(true);
|
||||
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
||||
@@ -175,6 +188,7 @@ public class RaceController extends Controller {
|
||||
//raceMap.setBoats(newRace.getStartingBoats());
|
||||
raceMap.draw();
|
||||
raceMap.setVisible(true);
|
||||
raceMap.setArrow(arrow.getChildren().get(0));
|
||||
|
||||
canvasBase.getChildren().add(0, raceMap);
|
||||
|
||||
@@ -184,6 +198,7 @@ public class RaceController extends Controller {
|
||||
raceBoundaries.heightProperty().bind(canvasBase.heightProperty());
|
||||
raceBoundaries.draw();
|
||||
raceBoundaries.setVisible(true);
|
||||
|
||||
canvasBase.getChildren().add(0, raceBoundaries);
|
||||
|
||||
race.setVisible(true);
|
||||
@@ -379,6 +394,10 @@ public class RaceController extends Controller {
|
||||
(int)( color.getBlue() * 255 ) );
|
||||
}
|
||||
|
||||
private void makeArrow() {
|
||||
arrowPane.getChildren().add(arrow);
|
||||
}
|
||||
|
||||
public RaceClock getRaceClock() {
|
||||
return raceClock;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Boat {
|
||||
*/
|
||||
public GPSCoordinate getWake() {
|
||||
double reverseHeading = getHeading() - 180;
|
||||
double wakeScale = 3;
|
||||
double wakeScale = 5;
|
||||
double distance = wakeScale * getVelocity();
|
||||
|
||||
GeodeticCalculator calc = new GeodeticCalculator();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package seng302.Model;
|
||||
|
||||
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
@@ -35,6 +37,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
private final List<Marker> markers;
|
||||
private final RaceDataSource raceData;
|
||||
private Map<Integer, Color> boatColours = new HashMap<>();
|
||||
private Node arrow;
|
||||
|
||||
private RaceClock raceClock;
|
||||
|
||||
@@ -147,6 +150,13 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
gc.restore();
|
||||
}
|
||||
|
||||
private void displayFancyArrow(GraphCoordinate coordinate, double angle) {
|
||||
angle = angle % 360;
|
||||
if (arrow != null && arrow.getRotate() != angle) {
|
||||
arrow.setRotate(angle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates things on the canvas Note: this must be called in between gc.save() and gc.restore() else they will rotate everything
|
||||
*
|
||||
@@ -247,9 +257,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,6 +365,10 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
));
|
||||
}
|
||||
|
||||
public void setArrow(Node arrow) {
|
||||
this.arrow = arrow;
|
||||
}
|
||||
|
||||
public void setRaceClock(RaceClock raceClock) {
|
||||
this.raceClock = raceClock;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public class VisualiserInput implements Runnable {
|
||||
for (BoatStatus boatStatus: this.raceStatus.getBoatStatuses()) {
|
||||
this.boatStatusMap.put(boatStatus.getSourceID(), boatStatus);
|
||||
}
|
||||
setCourseWindDirection(raceStatus.getScaledWindDirection() + 180);
|
||||
setCourseWindDirection(raceStatus.getScaledWindDirection());
|
||||
}
|
||||
//DisplayTextMessage.
|
||||
/*else if (message instanceof DisplayTextMessage) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.paint.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.shape.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<Pane fx:id="compass" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="125.0" prefWidth="125.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<StackPane fx:id="arrow" prefHeight="125.0" prefWidth="125.0">
|
||||
<children>
|
||||
<ImageView fitHeight="75.0" fitWidth="75.0">
|
||||
<image>
|
||||
<Image url="@../images/arrow.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</children>
|
||||
</StackPane>
|
||||
<Circle fill="#1f93ff00" layoutX="63.0" layoutY="63.0" radius="60.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="3.0" />
|
||||
<Label layoutX="55.0" layoutY="1.0" text="N">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="42.0" layoutY="99.0" text="Wind">
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</Pane>
|
||||
@@ -19,6 +19,7 @@
|
||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<fx:include fx:id="arrow" source="arrow.fxml" />
|
||||
<Pane prefHeight="200.0" prefWidth="400.0" GridPane.halignment="LEFT" GridPane.valignment="TOP">
|
||||
<children>
|
||||
<Accordion>
|
||||
@@ -70,6 +71,7 @@
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<StackPane fx:id="arrowPane" alignment="TOP_RIGHT" mouseTransparent="true" prefHeight="150.0" prefWidth="150.0" snapToPixel="false" />
|
||||
</children>
|
||||
</GridPane>
|
||||
<AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
|
||||
Reference in New Issue
Block a user