Added Important and Partial Annotations and other refactors and documentation.

- Important, Partial, Hidden, Visible are all radiobuttons
- Fixed bug where the Visualiser would end the race before the last boat had finished
- Refactored the visualiser and the mock to use the race finished status message
- Added and Changed many Javadocs
#story[877]
This commit is contained in:
Fan-Wu Yang
2017-05-22 03:51:14 +12:00
78 changed files with 2262 additions and 3956 deletions
@@ -1,10 +1,10 @@
package seng302.Model;
import javafx.collections.ObservableList;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.transform.Rotate;
import seng302.GPSCoordinate;
import seng302.GraphCoordinate;
import seng302.Mock.StreamedCourse;
import seng302.RaceDataSource;
@@ -22,6 +22,7 @@ import java.util.List;
public class ResizableRaceCanvas extends ResizableCanvas {
private RaceMap map;
private List<Boat> boats;
private List<Marker> boatMarkers;
private boolean raceAnno = true;
private boolean annoName = true;
private boolean annoAbbrev = true;
@@ -29,7 +30,6 @@ public class ResizableRaceCanvas extends ResizableCanvas {
private boolean annoPath = true;
private List<Color> colours;
private final List<Marker> markers;
double[] xpoints = {}, ypoints = {};
private final RaceDataSource raceData;
public ResizableRaceCanvas(RaceDataSource raceData) {
@@ -56,6 +56,16 @@ public class ResizableRaceCanvas extends ResizableCanvas {
this.boats = boats;
}
/**
* Sets the boat markers that are to be displayed in this race.
*
* @param boatMarkers in race
*/
public void setBoatMarkers(ObservableList<Marker> boatMarkers) {
this.boatMarkers = boatMarkers;
}
/**
* Sets the RaceMap that the RaceCanvas is to be displaying for.
*
@@ -65,22 +75,6 @@ public class ResizableRaceCanvas extends ResizableCanvas {
this.map = map;
}
/**
* Displays the mark of a race as a circle.
*
* @param graphCoordinate Latitude and Longitude in GraphCoordinate that it
* is to be displayed as.
* @param paint Colour the mark is to be coloured.
* @see GraphCoordinate
* @see Color
* @see Paint
*/
public void displayMark(GraphCoordinate graphCoordinate, Paint paint) {
double d = 25;
this.gc.setFill(paint);
gc.fillOval(graphCoordinate.getX() - (d / 2), graphCoordinate.getY() - (d / 2), d, d);
}
private void displayBoat(Boat boat, double angle, Color colour) {
if (boat.getCurrentPosition() != null) {
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());
@@ -246,19 +240,6 @@ public class ResizableRaceCanvas extends ResizableCanvas {
}
}
/**
* Draws a boat at a certain GPSCoordinate
*
* @param colour Colour to colour boat.
* @param gpsCoordinates GPScoordinate that the boat is to be drawn at.
* @see GPSCoordinate
* @see Color
*/
public void drawBoat(Color colour, GPSCoordinate gpsCoordinates) {
GraphCoordinate graphCoordinate = this.map.convertGPS(gpsCoordinates);
displayPoint(graphCoordinate, colour);
}
/**
* Toggle the raceAnno value
*/
@@ -266,6 +247,20 @@ public class ResizableRaceCanvas extends ResizableCanvas {
raceAnno = !raceAnno;
}
/**
* Shows the race Annotations
*/
public void showAnnotations(){
raceAnno = true;
}
/**
* Hides the Race ANnotations
*/
public void hideAnnotations(){
raceAnno = false;
}
/**
* Toggle name display in annotation
*/
@@ -273,6 +268,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
annoName = !annoName;
}
/**
* Toggles the path of the boat
*/
public void toggleBoatPath() {
annoPath = !annoPath;
}
@@ -335,6 +333,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
}
}
/**
* makes colours
*/
private void makeColours() {
colours = new ArrayList<>(Arrays.asList(
Color.BLUEVIOLET,