Deleted and Fixed some redundant code

- Deleted some unused functions
- Fixed NullPointerException for Marks
#story[881] #pair[fwy13,jam339]
main
Fan-Wu Yang 9 years ago
parent 9e19ddb1f4
commit 045e69a637

@ -181,7 +181,11 @@ public class StreamedCourseXMLReader extends XMLReader {
}
private int getSourceId(Element mark) {
return Integer.parseInt(mark.getAttribute("SourceID"));
String sourceId = mark.getAttribute("SourceID");
if (sourceId.isEmpty()){
return 0;
}
return Integer.parseInt(sourceId);
}
/**

@ -113,7 +113,7 @@ public class StreamedRace extends Race {
}
int sourceID2 = mark.getSourceId2();
BoatLocation boatLocation2 = visualiserInput.getBoatLocationMessage(sourceID2);
if(boatLocation1 != null) {
if(boatLocation2 != null) {
double lat = boatLocation2.getLatitudeDouble();
double lon = boatLocation2.getLongitudeDouble();
mark.setCurrentPosition2(new GPSCoordinate(lat, lon));

@ -50,20 +50,6 @@ public class BoatInRace extends Boat {
position = new SimpleStringProperty("-");
}
/**
* Constructor method.
*
* @param name Name of the boat.
* @param colour Colour the boat will be displayed as on the map
* @param abbrev of boat
*/
public BoatInRace(String name, Color colour, String abbrev) {
super(name, abbrev);
setColour(colour);
currentLegName = new SimpleStringProperty("");
position = new SimpleStringProperty("-");
}
/**
* Calculates the azimuth of the travel via map coordinates of the raceMarkers
*

@ -31,7 +31,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) {
@ -77,22 +76,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());
@ -258,19 +241,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
*/

Loading…
Cancel
Save