Made start/finish lines a different color.

#story[923]
This commit is contained in:
Alistair McIntyre
2017-05-22 15:10:05 +12:00
parent be633c0e60
commit 78573fa837
3 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -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("localhost", 4949, "RaceStream");
sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941, "RaceStream");
}
sr.start();
@@ -254,9 +254,9 @@ public class CanvasController {
}
private void initializeMarks() {
Map<Integer, Mark> allMarks = StreamParser.getXmlObject().getRaceXML().getCompoundMarks();
ArrayList<Mark> allMarks = StreamParser.getXmlObject().getRaceXML().getCompoundMarks();
System.out.println(allMarks);
for (Mark mark : allMarks.values()) {
for (Mark mark : allMarks) {
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
SingleMark sMark = (SingleMark) mark;
@@ -270,7 +270,6 @@ public class CanvasController {
}
}
group.getChildren().addAll(markGroups);
System.out.println(group.getChildren());
}
class ResizableCanvas extends Canvas {
@@ -235,7 +235,7 @@ public class XMLParser {
//Non atomic race attributes
private ArrayList<Participant> participants;
private Map<Integer, Mark> course;
private ArrayList<Mark> course;
private ArrayList<Corner> compoundMarkSequence;
private ArrayList<Limit> courseLimit;
@@ -312,22 +312,24 @@ public class XMLParser {
}
private Map<Integer, Mark> createCompoundMarks(Element docEle) {
Map<Integer, Mark> cMarks = new HashMap<>();
private ArrayList<Mark> createCompoundMarks(Element docEle) {
ArrayList<Mark> cMarks = new ArrayList<>();
NodeList cMarkList = docEle.getElementsByTagName("Course").item(0).getChildNodes();
for (int i = 0; i < cMarkList.getLength(); i++) {
Node cMarkNode = cMarkList.item(i);
if (cMarkNode.getNodeName().equals("CompoundMark")) {
Integer markID = getNodeAttributeInt(cMarkNode, "CompoundMarkID");
Mark mark = createMark(cMarkNode);
if (mark != null) {
cMarks.put(markID, mark);
cMarks.add(mark);
}
}
}
// This is awful but it works.
cMarks.get(0).setName("Start");
cMarks.get(cMarks.size()-1).setName("Finish");
return cMarks;
}
@@ -397,7 +399,7 @@ public class XMLParser {
return participants;
}
public Map<Integer, Mark> getCompoundMarks() {
public ArrayList<Mark> getCompoundMarks() {
return course;
}