Merge remote-tracking branch 'origin/49Mock' into Story49Vis
# Conflicts: # visualiser/src/test/java/seng302/Model/RaceXMLTest.java
This commit is contained in:
@@ -88,7 +88,7 @@ public class BoatXMLReader extends XMLReader {
|
||||
Element nBoats = (Element) doc.getElementsByTagName("Boats").item(0);
|
||||
for (int i = 0; i < nBoats.getChildNodes().getLength(); i++) {
|
||||
Node boat = nBoats.getChildNodes().item(i);
|
||||
if (boat.getNodeName().equals("Boat")) {
|
||||
if (boat.getNodeName().equals("Boat") && boat.getAttributes().getNamedItem("Type").getTextContent().equals("Yacht")) {
|
||||
readSingleBoat(boat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,18 +29,4 @@ public class StreamedBoat extends Boat {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 double calculateAzimuth() {
|
||||
double azimuth;
|
||||
if (heading <= 180) {
|
||||
azimuth = heading;
|
||||
} else {
|
||||
azimuth = -heading + 180;
|
||||
}
|
||||
return azimuth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class StreamedCourse extends Observable implements RaceDataSource {
|
||||
this.boatXMLReader = boatXMLReader;
|
||||
if (streamedCourseXMLReader != null && boatXMLReader != null) {
|
||||
this.boatXMLReader.setParticipants(streamedCourseXMLReader.getParticipants());
|
||||
System.out.println(streamedCourseXMLReader.getParticipants().size());
|
||||
|
||||
boatXMLReader.read();
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@ public class StreamedRace implements Runnable {
|
||||
private void initialiseBoats() {
|
||||
Leg officialStart = legs.get(0);
|
||||
String name = officialStart.getName();
|
||||
Marker endMarker = officialStart.getEndMarker();
|
||||
Marker endCompoundMark = officialStart.getEndMarker();
|
||||
|
||||
for (Boat boat : startingBoats) {
|
||||
if (boat != null) {
|
||||
Leg startLeg = new Leg(name, 0);
|
||||
startLeg.setEndMarker(endMarker);
|
||||
startLeg.setEndMarker(endCompoundMark);
|
||||
boat.setCurrentLeg(startLeg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,19 +60,19 @@
|
||||
// public void initialiseBoats() {
|
||||
// Leg officialStart = legs.get(0);
|
||||
// String name = officialStart.getName();
|
||||
// Marker endMarker = officialStart.getEndMarker();
|
||||
// CompoundMark endMarker = officialStart.getEndCompoundMark();
|
||||
//
|
||||
// BoatInRace.setTrackPointTimeInterval(BoatInRace.getBaseTrackPointTimeInterval() / scaleFactor);
|
||||
//
|
||||
// ArrayList<Marker> startMarkers = getSpreadStartingPositions();
|
||||
// ArrayList<CompoundMark> startMarkers = getSpreadStartingPositions();
|
||||
// for (int i = 0; i < startingBoats.size(); i++) {
|
||||
// BoatInRace boat = startingBoats.get(i);
|
||||
// if (boat != null) {
|
||||
// boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
||||
// Leg startLeg = new Leg(name, 0);
|
||||
// boat.setCurrentPosition(startMarkers.get(i).getAverageGPSCoordinate());
|
||||
// startLeg.setStartMarker(startMarkers.get(i));
|
||||
// startLeg.setEndMarker(endMarker);
|
||||
// startLeg.setStartCompoundMark(startMarkers.get(i));
|
||||
// startLeg.setEndCompoundMark(endMarker);
|
||||
// startLeg.calculateDistance();
|
||||
// boat.setCurrentLeg(startLeg);
|
||||
// boat.setHeading(boat.calculateHeading());
|
||||
@@ -85,10 +85,10 @@
|
||||
// *
|
||||
// * @return list of starting positions
|
||||
// */
|
||||
// public ArrayList<Marker> getSpreadStartingPositions() {
|
||||
// public ArrayList<CompoundMark> getSpreadStartingPositions() {
|
||||
//
|
||||
// int nBoats = startingBoats.size();
|
||||
// Marker marker = legs.get(0).getStartMarker();
|
||||
// CompoundMark marker = legs.get(0).getStartCompoundMark();
|
||||
//
|
||||
// GeodeticCalculator initialCalc = new GeodeticCalculator();
|
||||
// initialCalc.setStartingGeographicPoint(marker.getMark1().getLongitude(), marker.getMark1().getLatitude());
|
||||
@@ -100,12 +100,12 @@
|
||||
//
|
||||
// GeodeticCalculator positionCalc = new GeodeticCalculator();
|
||||
// positionCalc.setStartingGeographicPoint(marker.getMark1().getLongitude(), marker.getMark1().getLatitude());
|
||||
// ArrayList<Marker> positions = new ArrayList<>();
|
||||
// ArrayList<CompoundMark> positions = new ArrayList<>();
|
||||
//
|
||||
// for (int i = 0; i < nBoats; i++) {
|
||||
// positionCalc.setDirection(azimuth, distanceBetweenBoats);
|
||||
// Point2D position = positionCalc.getDestinationGeographicPoint();
|
||||
// positions.add(new Marker(new GPSCoordinate(position.getY(), position.getX())));
|
||||
// positions.add(new CompoundMark(new GPSCoordinate(position.getY(), position.getX())));
|
||||
//
|
||||
// positionCalc = new GeodeticCalculator();
|
||||
// positionCalc.setStartingGeographicPoint(position);
|
||||
@@ -147,7 +147,7 @@
|
||||
// //update boat's distance travelled
|
||||
// boat.setDistanceTravelledInLeg(totalDistanceTravelled);
|
||||
// //Calculate boat's new position by adding the distance travelled onto the start point of the leg
|
||||
// boat.setCurrentPosition(calculatePosition(boat.getCurrentLeg().getStartMarker().getAverageGPSCoordinate(),
|
||||
// boat.setCurrentPosition(calculatePosition(boat.getCurrentLeg().getStartCompoundMark().getAverageGPSCoordinate(),
|
||||
// totalDistanceTravelled, boat.calculateAzimuth()));
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<leg>
|
||||
<name>Start to Mark 1</name>
|
||||
<start>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.296577</latitude>
|
||||
<longitude>-64.854304</longitude>
|
||||
@@ -51,29 +51,29 @@
|
||||
<latitude>32.293771</latitude>
|
||||
<longitude>-64.855242</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</start>
|
||||
<finish>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.293039</latitude>
|
||||
<longitude>-64.843983</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</finish>
|
||||
</leg>
|
||||
<leg>
|
||||
<name>Mark 1 to Leeward Gate</name>
|
||||
<start>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.293039</latitude>
|
||||
<longitude>-64.843983</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</start>
|
||||
<finish>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.309693</latitude>
|
||||
<longitude>-64.835249</longitude>
|
||||
@@ -82,13 +82,13 @@
|
||||
<latitude>32.308046</latitude>
|
||||
<longitude>-64.831785</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</finish>
|
||||
</leg>
|
||||
<leg>
|
||||
<name>Leeward Gate to Windward Gate</name>
|
||||
<start>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.309693</latitude>
|
||||
<longitude>-64.835249</longitude>
|
||||
@@ -97,10 +97,10 @@
|
||||
<latitude>32.308046</latitude>
|
||||
<longitude>-64.831785</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</start>
|
||||
<finish>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.284680</latitude>
|
||||
<longitude>-64.850045</longitude>
|
||||
@@ -109,13 +109,13 @@
|
||||
<latitude>32.280164</latitude>
|
||||
<longitude>-64.847591</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</finish>
|
||||
</leg>
|
||||
<leg>
|
||||
<name>Windward Gate to Leeward Gate</name>
|
||||
<start>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.284680</latitude>
|
||||
<longitude>-64.850045</longitude>
|
||||
@@ -124,10 +124,10 @@
|
||||
<latitude>32.280164</latitude>
|
||||
<longitude>-64.847591</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</start>
|
||||
<finish>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.309693</latitude>
|
||||
<longitude>-64.835249</longitude>
|
||||
@@ -136,13 +136,13 @@
|
||||
<latitude>32.308046</latitude>
|
||||
<longitude>-64.831785</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</finish>
|
||||
</leg>
|
||||
<leg>
|
||||
<name>Leeward Gate to Finish</name>
|
||||
<start>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.309693</latitude>
|
||||
<longitude>-64.835249</longitude>
|
||||
@@ -151,10 +151,10 @@
|
||||
<latitude>32.308046</latitude>
|
||||
<longitude>-64.831785</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</start>
|
||||
<finish>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<coordinate>
|
||||
<latitude>32.317379</latitude>
|
||||
<longitude>-64.839291</longitude>
|
||||
@@ -163,7 +163,7 @@
|
||||
<latitude>32.317257</latitude>
|
||||
<longitude>-64.836260</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</finish>
|
||||
</leg>
|
||||
</legs>
|
||||
@@ -214,7 +214,7 @@
|
||||
<longitude>-64.849184</longitude>
|
||||
</coordinate>
|
||||
</boundaries>
|
||||
<marker>
|
||||
<compoundMark>
|
||||
<name>Start Line</name>
|
||||
<coordinate>
|
||||
<latitude>32.296577</latitude>
|
||||
@@ -224,15 +224,15 @@
|
||||
<latitude>32.293771</latitude>
|
||||
<longitude>-64.855242</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
<marker>
|
||||
</compoundMark>
|
||||
<compoundMark>
|
||||
<name>Mark</name>
|
||||
<coordinate>
|
||||
<latitude>32.293039</latitude>
|
||||
<longitude>-64.843983</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
<marker>
|
||||
</compoundMark>
|
||||
<compoundMark>
|
||||
<name>Windward Gate</name>
|
||||
<coordinate>
|
||||
<latitude>32.284680</latitude>
|
||||
@@ -242,8 +242,8 @@
|
||||
<latitude>32.280164</latitude>
|
||||
<longitude>-64.847591</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
<marker>
|
||||
</compoundMark>
|
||||
<compoundMark>
|
||||
<name>Leeward Gate</name>
|
||||
<coordinate>
|
||||
<latitude>32.309693</latitude>
|
||||
@@ -253,8 +253,8 @@
|
||||
<latitude>32.308046</latitude>
|
||||
<longitude>-64.831785</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
<marker>
|
||||
</compoundMark>
|
||||
<compoundMark>
|
||||
<name>Finish Line</name>
|
||||
<coordinate>
|
||||
<latitude>32.317379</latitude>
|
||||
@@ -264,6 +264,6 @@
|
||||
<latitude>32.317257</latitude>
|
||||
<longitude>-64.836260</longitude>
|
||||
</coordinate>
|
||||
</marker>
|
||||
</compoundMark>
|
||||
</course>
|
||||
</race>
|
||||
|
||||
Reference in New Issue
Block a user