Amended and added tests to cope with marker change

#test #story[20]
This commit is contained in:
Erika Savell
2017-03-29 19:47:49 +13:00
parent 40a6801477
commit 495158a621
10 changed files with 458 additions and 499 deletions
@@ -145,7 +145,6 @@ public class RaceController extends Controller{
}
BoatInRace[] boats = new BoatInRace[raceXMLReader.getBoats().size()];
boats = raceXMLReader.getBoats().toArray(boats);
//BoatInRace[] boats = generateAC35Competitors();
raceMap = new ResizableRaceCanvas();
raceMap.setMouseTransparent(true);
@@ -159,7 +158,6 @@ public class RaceController extends Controller{
startScreen.setVisible(false);
ongoingRacePane.setVisible(true);
//ArrayList<Leg> legs = generateBermudaCourseLegs();
ArrayList<Leg> legs = raceXMLReader.getLegs();
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this, scaleFactor);
@@ -195,7 +193,6 @@ public class RaceController extends Controller{
timer.setText(time);
}
/**
* Set the value for the fps label
* @param fps fps that the label will be updated to
+1 -1
View File
@@ -21,7 +21,7 @@ public class Boat {
*/
public Boat(String name, double velocity, String abbrev) {
this.velocity = velocity;
this.velocityProp = new SimpleStringProperty(String.valueOf(velocity* 1.94384));
this.velocityProp = new SimpleStringProperty(String.valueOf(velocity));
this.abbrev = abbrev;
this.name = new SimpleStringProperty(name);
}
-19
View File
@@ -73,34 +73,15 @@ public class Leg {
}
public void setName(String name) {
this.name = name;
}
public void setDistance(double distance) {
this.distance = distance;
}
public Marker getStartMarker() {
return startMarker;
}
public void setStartMarker(Marker startMarker) {
this.startMarker = startMarker;
}
public Marker getEndMarker() {
return endMarker;
}
public void setEndMarker(Marker endMarker) {
this.endMarker = endMarker;
}
public void setLegNumber(int legNumber) {
this.legNumber = legNumber;
}
/**
* Calculates the distance that the legs are in nautical miles (1.852 km).
*
-19
View File
@@ -35,25 +35,6 @@ public class Marker {
return averageGPSCoordinate;
}
public void setAverageGPSCoordinate(GPSCoordinate averageGPSCoordinate) {
this.averageGPSCoordinate = averageGPSCoordinate;
}
public GPSCoordinate getMark1() {
return mark1;
}
public void setMark1(GPSCoordinate mark1) {
this.mark1 = mark1;
}
public GPSCoordinate getMark2() {
return mark2;
}
public void setMark2(GPSCoordinate mark2) {
this.mark2 = mark2;
}
private GPSCoordinate calculateAverage() {
+18 -18
View File
@@ -50,24 +50,24 @@ public abstract class Race implements Runnable {
}
}
/**
* Constructor for Race class
* @param boats boats participating in the race.
* @param legs legs that there are in the race.
*/
public Race(BoatInRace[] boats, ArrayList<Leg> legs, int scaleFactor) {
if (boats.length > 0) {
for (BoatInRace boat : boats) {
if (boat != null) {
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
}
}
}
this.startingBoats = FXCollections.observableArrayList(boats);
this.legs = legs;
this.legs.add(new Leg("Finish", this.legs.size()));
this.scaleFactor = scaleFactor;
}
// /**
// * Constructor for Race class
// * @param boats boats participating in the race.
// * @param legs legs that there are in the race.
// */
// public Race(BoatInRace[] boats, ArrayList<Leg> legs, int scaleFactor) {
// if (boats.length > 0) {
// for (BoatInRace boat : boats) {
// if (boat != null) {
// boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
// }
// }
// }
// this.startingBoats = FXCollections.observableArrayList(boats);
// this.legs = legs;
// this.legs.add(new Leg("Finish", this.legs.size()));
// this.scaleFactor = scaleFactor;
// }
protected void initialiseBoats() {
+6 -6
View File
@@ -2,37 +2,37 @@
<boats>
<boat>
<name>ORACLE TEAM USA</name>
<speed>300</speed>
<speed>30</speed>
<abbr>USA</abbr>
<colour>BLUEVIOLET</colour>
</boat>
<boat>
<name>Land Rover BAR</name>
<speed>500</speed>
<speed>50</speed>
<abbr>BAR</abbr>
<colour>BLACK</colour>
</boat>
<boat>
<name>SoftBank Team Japan</name>
<speed>400</speed>
<speed>40</speed>
<abbr>JAP</abbr>
<colour>RED</colour>
</boat>
<boat>
<name>Groupama Team France</name>
<speed>350</speed>
<speed>35</speed>
<abbr>FRN</abbr>
<colour>ORANGE</colour>
</boat>
<boat>
<name>Artemis Racing</name>
<speed>440</speed>
<speed>44</speed>
<abbr>ART</abbr>
<colour>DARKOLIVEGREEN</colour>
</boat>
<boat>
<name>Emirates Team New Zealand</name>
<speed>620</speed>
<speed>62</speed>
<abbr>ENZ</abbr>
<colour>LIMEGREEN</colour>
</boat>