|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
package seng302;
|
|
|
|
|
import javafx.application.Platform;
|
|
|
|
|
import org.xml.sax.SAXException;
|
|
|
|
|
import seng302.Mock.*;
|
|
|
|
|
import seng302.Networking.BinaryMessageDecoder;
|
|
|
|
|
@ -294,42 +295,43 @@ public class VisualiserInput implements Runnable {
|
|
|
|
|
|
|
|
|
|
//System.out.println("XML Message!");
|
|
|
|
|
|
|
|
|
|
if (xmlMessage.getXmlMsgSubType() == XMLMessage.XMLTypeRegatta){
|
|
|
|
|
//System.out.println("Setting Regatta");
|
|
|
|
|
try {
|
|
|
|
|
course.setRegattaXMLReader(new RegattaXMLReader(xmlMessage.getXmlMessage()));
|
|
|
|
|
}
|
|
|
|
|
//TODO REFACTOR should put all of these exceptions behind a RegattaXMLReaderException.
|
|
|
|
|
catch (IOException | SAXException | ParserConfigurationException e) {
|
|
|
|
|
System.err.println("Error creating RegattaXMLReader: " + e.getMessage());
|
|
|
|
|
//Continue to the next loop iteration/message.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (xmlMessage.getXmlMsgSubType() == XMLMessage.XMLTypeRace){
|
|
|
|
|
//System.out.println("Setting Course");
|
|
|
|
|
try {
|
|
|
|
|
course.setStreamedCourseXMLReader(new StreamedCourseXMLReader(xmlMessage.getXmlMessage()));
|
|
|
|
|
}
|
|
|
|
|
//TODO REFACTOR should put all of these exceptions behind a StreamedCourseXMLReaderException.
|
|
|
|
|
catch (IOException | SAXException | ParserConfigurationException | StreamedCourseXMLException e) {
|
|
|
|
|
System.err.println("Error creating StreamedCourseXMLReader: " + e.getMessage());
|
|
|
|
|
//Continue to the next loop iteration/message.
|
|
|
|
|
}
|
|
|
|
|
Platform.runLater(()-> {
|
|
|
|
|
if (xmlMessage.getXmlMsgSubType() == XMLMessage.XMLTypeRegatta) {
|
|
|
|
|
//System.out.println("Setting Regatta");
|
|
|
|
|
try {
|
|
|
|
|
course.setRegattaXMLReader(new RegattaXMLReader(xmlMessage.getXmlMessage()));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//TODO REFACTOR should put all of these exceptions behind a RegattaXMLReaderException.
|
|
|
|
|
catch (IOException | SAXException | ParserConfigurationException e) {
|
|
|
|
|
System.err.println("Error creating RegattaXMLReader: " + e.getMessage());
|
|
|
|
|
//Continue to the next loop iteration/message.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (xmlMessage.getXmlMsgSubType() == XMLMessage.XMLTypeRace) {
|
|
|
|
|
//System.out.println("Setting Course");
|
|
|
|
|
try {
|
|
|
|
|
course.setStreamedCourseXMLReader(new StreamedCourseXMLReader(xmlMessage.getXmlMessage()));
|
|
|
|
|
}
|
|
|
|
|
//TODO REFACTOR should put all of these exceptions behind a StreamedCourseXMLReaderException.
|
|
|
|
|
catch (IOException | SAXException | ParserConfigurationException | StreamedCourseXMLException e) {
|
|
|
|
|
System.err.println("Error creating StreamedCourseXMLReader: " + e.getMessage());
|
|
|
|
|
//Continue to the next loop iteration/message.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (xmlMessage.getXmlMsgSubType() == XMLMessage.XMLTypeBoat) {
|
|
|
|
|
//System.out.println("Setting Boats");
|
|
|
|
|
try {
|
|
|
|
|
course.setBoatXMLReader(new BoatXMLReader(xmlMessage.getXmlMessage()));
|
|
|
|
|
}
|
|
|
|
|
//TODO REFACTOR should put all of these exceptions behind a BoatXMLReaderException.
|
|
|
|
|
catch (IOException | SAXException | ParserConfigurationException e) {
|
|
|
|
|
System.err.println("Error creating BoatXMLReader: " + e.getMessage());
|
|
|
|
|
//Continue to the next loop iteration/message.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (xmlMessage.getXmlMsgSubType() == XMLMessage.XMLTypeBoat){
|
|
|
|
|
//System.out.println("Setting Boats");
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
course.setBoatXMLReader(new BoatXMLReader(xmlMessage.getXmlMessage()));
|
|
|
|
|
}
|
|
|
|
|
//TODO REFACTOR should put all of these exceptions behind a BoatXMLReaderException.
|
|
|
|
|
catch (IOException | SAXException | ParserConfigurationException e) {
|
|
|
|
|
System.err.println("Error creating BoatXMLReader: " + e.getMessage());
|
|
|
|
|
//Continue to the next loop iteration/message.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//RaceStartStatus.
|
|
|
|
|
else if (message instanceof RaceStartStatus) {
|
|
|
|
|
|