mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Marks display correctly on the canvas, no double ups or anything like that left.
#[issue10]
This commit is contained in:
@@ -239,6 +239,9 @@ public class XMLParser {
|
||||
private ArrayList<Corner> compoundMarkSequence;
|
||||
private ArrayList<Limit> courseLimit;
|
||||
|
||||
// ensures there's no duplicate marks.
|
||||
private List<Long> seenSourceIDs = new ArrayList<Long>();
|
||||
|
||||
/**
|
||||
* Constructor for a RaceXMLObject.
|
||||
* Takes the information from a Document object and creates a more usable format.
|
||||
@@ -312,6 +315,7 @@ public class XMLParser {
|
||||
private Map<Integer, Mark> createCompoundMarks(Element docEle) {
|
||||
Map<Integer, Mark> cMarks = new HashMap<>();
|
||||
|
||||
|
||||
NodeList cMarkList = docEle.getElementsByTagName("Course").item(0).getChildNodes();
|
||||
for (int i = 0; i < cMarkList.getLength(); i++) {
|
||||
Node cMarkNode = cMarkList.item(i);
|
||||
@@ -319,14 +323,15 @@ public class XMLParser {
|
||||
if (cMarkNode.getNodeName().equals("CompoundMark")) {
|
||||
Integer markID = getNodeAttributeInt(cMarkNode, "CompoundMarkID");
|
||||
Mark mark = createMark(cMarkNode);
|
||||
|
||||
cMarks.put(markID, mark);
|
||||
if (mark != null) {
|
||||
cMarks.put(markID, mark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cMarks;
|
||||
}
|
||||
|
||||
|
||||
private Mark createMark(Node compoundMark) {
|
||||
|
||||
List<SingleMark> marksList = new ArrayList<>();
|
||||
@@ -348,6 +353,14 @@ public class XMLParser {
|
||||
}
|
||||
}
|
||||
|
||||
for (SingleMark mark : marksList) {
|
||||
if (seenSourceIDs.contains(mark.getId())) {
|
||||
return null;
|
||||
} else {
|
||||
seenSourceIDs.add(mark.getId());
|
||||
}
|
||||
}
|
||||
|
||||
if (marksList.size() == 1) {
|
||||
return marksList.get(0);
|
||||
} else if (marksList.size() == 2) {
|
||||
|
||||
Reference in New Issue
Block a user