Linked the streamedRace course to the visualiser, linked the boats to the visualiser (this needs to be tests) #story[768]

This commit is contained in:
Joseph
2017-04-28 00:53:07 +12:00
parent 073102d1a3
commit 033198ca2c
5 changed files with 183 additions and 45 deletions
@@ -1,44 +1,60 @@
package seng302.Mock;
import javafx.scene.paint.Color;
import org.geotools.referencing.GeodeticCalculator;
import seng302.GPSCoordinate;
import seng302.Model.Boat;
import seng302.Model.BoatInRace;
import seng302.Model.Leg;
import seng302.Model.Marker;
/**
* Created by Joseph on 24/04/2017.
*/
public class StreamedBoat extends BoatInRace {
private int sourceID;
private boolean complete;
private boolean dnf = false;
private void init() {
this.velocity = 0;
this.scaledVelocity = 0;
this.heading = 0;
this.setCurrentLeg(new Leg("None", -1));
this.setCurrentPosition(new GPSCoordinate(0, 0));
}
public StreamedBoat(int sourceID, String name, Color colour, String abbrev) {
super(name, colour, abbrev);
this.sourceID = sourceID;
this.complete = true;
this.init();
}
public StreamedBoat(int sourceID) {
super("None", Color.BLACK, "None");
this.sourceID = sourceID;
this.complete = false;
}
/**
* Overridden to ignore this function
* @deprecated
* @return 0
*/
public double getScaledVelocity() {
return 0;
this.init();
}
/**
* Overridden to ignore this function
* @deprecated
* @param velocity of boat
* Calculates the azimuth of the travel via heading of the boat
*
* @return the direction that the boat is heading towards in degrees (-180 to 180).
*/
public void setScaledVelocity(double velocity) {
public double calculateAzimuth() {
double azimuth;
if (heading <= 180) {
azimuth = heading;
} else {
azimuth = -heading + 180;
}
return azimuth;
}
public boolean isDnf() {
return dnf;
}
public void setDnf(boolean dnf) {
this.dnf = dnf;
}
}