|
|
|
@ -80,6 +80,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void readBoats() {
|
|
|
|
public void readBoats() {
|
|
|
|
//get all boats
|
|
|
|
//get all boats
|
|
|
|
|
|
|
|
List<Boat> boats = new ArrayList<>();
|
|
|
|
NodeList nBoats = doc.getElementsByTagName("boat");
|
|
|
|
NodeList nBoats = doc.getElementsByTagName("boat");
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < nBoats.getLength(); i++) {
|
|
|
|
for (int i = 0; i < nBoats.getLength(); i++) {
|
|
|
|
@ -96,6 +97,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boats.add(boat);
|
|
|
|
boats.add(boat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.boats = boats;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -104,12 +106,14 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void readMarkers() {
|
|
|
|
public void readMarkers() {
|
|
|
|
//get all boats
|
|
|
|
//get all boats
|
|
|
|
|
|
|
|
List<Marker> markers = new ArrayList<>();
|
|
|
|
NodeList nMarkers = doc.getElementsByTagName("marker");
|
|
|
|
NodeList nMarkers = doc.getElementsByTagName("marker");
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < nMarkers.getLength(); i++) {
|
|
|
|
for (int i = 0; i < nMarkers.getLength(); i++) {
|
|
|
|
Marker marker = getMarker((Element) nMarkers.item(i));
|
|
|
|
Marker marker = getMarker((Element) nMarkers.item(i));
|
|
|
|
if (marker.getName() != null) markers.add(marker);
|
|
|
|
if (marker.getName() != null) markers.add(marker);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.markers = markers;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -117,6 +121,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void readLegs() {
|
|
|
|
public void readLegs() {
|
|
|
|
//get all legs
|
|
|
|
//get all legs
|
|
|
|
|
|
|
|
List<Leg> legs = new ArrayList<>();
|
|
|
|
NodeList nLegs = doc.getElementsByTagName("leg");
|
|
|
|
NodeList nLegs = doc.getElementsByTagName("leg");
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < nLegs.getLength(); i++) {
|
|
|
|
for (int i = 0; i < nLegs.getLength(); i++) {
|
|
|
|
@ -127,12 +132,14 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|
|
|
Marker finishMarker = getMarker(finish);
|
|
|
|
Marker finishMarker = getMarker(finish);
|
|
|
|
legs.add(new Leg(label, startMarker, finishMarker, i));
|
|
|
|
legs.add(new Leg(label, startMarker, finishMarker, i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.legs = legs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Read courses in XML file
|
|
|
|
* Read courses in XML file
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void readCourse() {
|
|
|
|
public void readCourse() {
|
|
|
|
|
|
|
|
List<GPSCoordinate> boundary = new ArrayList<>();
|
|
|
|
NodeList nCourse = doc.getElementsByTagName("course");
|
|
|
|
NodeList nCourse = doc.getElementsByTagName("course");
|
|
|
|
|
|
|
|
|
|
|
|
NodeList nBounds = ((Element) nCourse.item(0)).getElementsByTagName("boundaries");
|
|
|
|
NodeList nBounds = ((Element) nCourse.item(0)).getElementsByTagName("boundaries");
|
|
|
|
@ -197,6 +204,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
|
|
|
|
leewardPt2 = getCoordinates(nMarks, 3, 1);
|
|
|
|
leewardPt2 = getCoordinates(nMarks, 3, 1);
|
|
|
|
finishPt1 = getCoordinates(nMarks, 4);
|
|
|
|
finishPt1 = getCoordinates(nMarks, 4);
|
|
|
|
finishPt2 = getCoordinates(nMarks, 4, 1);
|
|
|
|
finishPt2 = getCoordinates(nMarks, 4, 1);
|
|
|
|
|
|
|
|
this.boundary = boundary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|