mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Made sure only boats in participant list are replaced. Also removed mark coloring as it wasn't as accurate as was necessary.
#story[923]
This commit is contained in:
@@ -63,7 +63,7 @@ public class App extends Application {
|
||||
//Change the StreamReceiver in this else block to change the default data source.
|
||||
else{
|
||||
// sr = new StreamReceiver("localhost", 4949, "RaceStream");
|
||||
sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941, "RaceStream");
|
||||
sr = new StreamReceiver("livedata.americascup.com", 4941, "RaceStream");
|
||||
}
|
||||
|
||||
sr.start();
|
||||
|
||||
@@ -26,6 +26,7 @@ import seng302.models.mark.SingleMark;
|
||||
import seng302.models.stream.StreamParser;
|
||||
import seng302.models.stream.XMLParser;
|
||||
import seng302.models.stream.XMLParser.RaceXMLObject.Limit;
|
||||
import seng302.models.stream.XMLParser.RaceXMLObject.Participant;
|
||||
import seng302.models.stream.packets.BoatPositionPacket;
|
||||
|
||||
/**
|
||||
@@ -244,12 +245,20 @@ public class CanvasController {
|
||||
Map<Integer, Yacht> boats = StreamParser.getBoats();
|
||||
Group boatAnnotations = new Group();
|
||||
|
||||
ArrayList<Participant> participants = StreamParser.getXmlObject().getRaceXML().getParticipants();
|
||||
ArrayList<Integer> participantIDs = new ArrayList<>();
|
||||
for (Participant p : participants) {
|
||||
participantIDs.add(p.getsourceID());
|
||||
}
|
||||
|
||||
for (Yacht boat : boats.values()) {
|
||||
if (participantIDs.contains(boat.getSourceID())) {
|
||||
boat.setColour(Colors.getColor());
|
||||
BoatGroup boatGroup = new BoatGroup(boat, boat.getColour());
|
||||
boatGroups.add(boatGroup);
|
||||
boatAnnotations.getChildren().add(boatGroup.getLowPriorityAnnotations());
|
||||
}
|
||||
}
|
||||
group.getChildren().add(boatAnnotations);
|
||||
group.getChildren().addAll(boatGroups);
|
||||
}
|
||||
|
||||
@@ -307,6 +307,7 @@ public class StreamParser extends Thread{
|
||||
boats = xmlObject.getBoatXML().getCompetingBoats();
|
||||
}
|
||||
if (messageType == 6) { //6 is race info xml
|
||||
|
||||
newRaceXmlReceived = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,10 +326,6 @@ public class XMLParser {
|
||||
}
|
||||
}
|
||||
|
||||
// This is awful but it works.
|
||||
cMarks.get(0).setName("Start");
|
||||
cMarks.get(cMarks.size()-1).setName("Finish");
|
||||
|
||||
return cMarks;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user