General code tidy up

- access modifiers adjusted
- unused declarations removed
- spelling fixes
- removed redundant code
This commit is contained in:
Jessica McAuslin
2017-05-08 20:21:20 +12:00
parent e1ba2ae5b6
commit 2d983eccfd
44 changed files with 242 additions and 406 deletions
@@ -1,14 +1,14 @@
package seng302.Model;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.transform.Rotate;
import seng302.*;
import seng302.Controllers.RaceController;
import seng302.GPSCoordinate;
import seng302.GraphCoordinate;
import seng302.Mock.StreamedCourse;
import seng302.RaceDataSource;
import seng302.RaceMap;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,9 +28,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
private boolean annoSpeed = true;
private boolean annoPath = true;
private List<Color> colours;
private List<Marker> markers;
private final List<Marker> markers;
double[] xpoints = {}, ypoints = {};
RaceDataSource raceData;
private final RaceDataSource raceData;
public ResizableRaceCanvas(RaceDataSource raceData) {
super();
@@ -61,14 +61,15 @@ public class ResizableRaceCanvas extends ResizableCanvas {
*
* @param map race map
*/
public void setMap(RaceMap map) {
private void setMap(RaceMap map) {
this.map = map;
}
/**
* Displays the mark of a race as a circle.
*
* @param graphCoordinate Latitude and Logintude in GraphCoordinate that it is to be displayed as.
* @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
@@ -80,14 +81,13 @@ public class ResizableRaceCanvas extends ResizableCanvas {
gc.fillOval(graphCoordinate.getX() - (d / 2), graphCoordinate.getY() - (d / 2), d, d);
}
public void displayBoat(Boat boat, double angle, Color colour) {
private void displayBoat(Boat boat, double angle, Color colour) {
if (boat.getCurrentPosition() != null) {
GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition());
Paint paint = colour;
double[] x = {pos.getX() - 6, pos.getX(), pos.getX() + 6};
double[] y = {pos.getY() + 12, pos.getY() - 12, pos.getY() + 12};
gc.setFill(paint);
gc.setFill(colour);
gc.save();
rotate(angle, pos.getX(), pos.getY());
@@ -203,7 +203,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
/**
* Draw race markers
*/
public void drawMarkers() {
private void drawMarkers() {
for(Marker marker: markers) {
GraphCoordinate mark1 = this.map.convertGPS(marker.getMark1());
// removed drawing of lines between the marks as only
@@ -263,58 +263,38 @@ public class ResizableRaceCanvas extends ResizableCanvas {
* Toggle the raceAnno value
*/
public void toggleAnnotations() {
if (raceAnno) {
raceAnno = false;
} else {
raceAnno = true;
}
raceAnno = !raceAnno;
}
/**
* Toggle name display in annotation
*/
public void toggleAnnoName() {
if (annoName) {
annoName = false;
} else {
annoName = true;
}
annoName = !annoName;
}
public void toggleBoatPath() {
if (annoPath) {
annoPath = false;
} else {
annoPath = true;
}
annoPath = !annoPath;
}
/**
* Toggle abbreviation display in annotation
*/
public void toggleAnnoAbbrev() {
if (annoAbbrev) {
annoAbbrev = false;
} else {
annoAbbrev = true;
}
annoAbbrev = !annoAbbrev;
}
/**
* Toggle speed display in annotation
*/
public void toggleAnnoSpeed() {
if (annoSpeed) {
annoSpeed = false;
} else {
annoSpeed = true;
}
annoSpeed = !annoSpeed;
}
/**
* Draws boats while race in progress, when leg heading is set.
*/
public void updateBoats() {
private void updateBoats() {
int currentColour = 0;
if (boats != null) {
for (Boat boat : boats) {
@@ -349,15 +329,14 @@ public class ResizableRaceCanvas extends ResizableCanvas {
if (annoPath && raceAnno) {
for (TrackPoint point : boat.getTrack()) {
GraphCoordinate scaledCoordinate = this.map.convertGPS(point.getCoordinate());
Color boatColour = colour;
gc.setFill(new Color(boatColour.getRed(), boatColour.getGreen(), boatColour.getBlue(), point.getAlpha()));
gc.setFill(new Color(colour.getRed(), colour.getGreen(), colour.getBlue(), point.getAlpha()));
gc.fillOval(scaledCoordinate.getX(), scaledCoordinate.getY(), 5, 5);
}
}
}
private void makeColours() {
colours = new ArrayList<Color>(Arrays.asList(
colours = new ArrayList<>(Arrays.asList(
Color.BLUEVIOLET,
Color.BLACK,
Color.RED,