Removed boats being able to store colour, this is now down the in the ResizableRaceCanvas. #refactor #story[782]

main
Joseph Gardner 9 years ago
parent f377cf6471
commit 39d3cc7c28

@ -20,8 +20,6 @@ import java.util.*;
public class BoatXMLReader extends XMLReader {
Map<Integer, StreamedBoat> streamedBoatMap = new HashMap<>();
Map<Integer, StreamedBoat> participants = new HashMap<>();
private List<Color> colours;
private static int currentColourIndex = 0;
/**
* Constructor for Boat XML Reader
@ -32,7 +30,6 @@ public class BoatXMLReader extends XMLReader {
*/
public BoatXMLReader(String filePath) throws IOException, SAXException, ParserConfigurationException, ParseException {
this(filePath, false);
makeColours();
}
/**
@ -45,7 +42,6 @@ public class BoatXMLReader extends XMLReader {
*/
public BoatXMLReader(String filePath, boolean read) throws IOException, SAXException, ParserConfigurationException, ParseException {
super(filePath);
makeColours();
if (read) {
read();
}
@ -82,7 +78,6 @@ public class BoatXMLReader extends XMLReader {
Node boat = nBoats.getChildNodes().item(i);
if (boat.getNodeName().equals("Boat")) {
readSingleBoat(boat);
currentColourIndex = (currentColourIndex + 1) % colours.size();
}
}
}
@ -109,9 +104,9 @@ public class BoatXMLReader extends XMLReader {
if (!streamedBoatMap.containsKey(sourceID)) {
if (country != null) {
streamedBoat = new StreamedBoat(sourceID, boatName, colours.get(currentColourIndex), country);
streamedBoat = new StreamedBoat(sourceID, boatName, country);
} else {
streamedBoat = new StreamedBoat(sourceID, boatName, colours.get(currentColourIndex), shortName);
streamedBoat = new StreamedBoat(sourceID, boatName, shortName);
}
streamedBoatMap.put(sourceID, streamedBoat);
// Override boat with new boat
@ -133,20 +128,6 @@ public class BoatXMLReader extends XMLReader {
// TODO Get relative point before implementing. (GPSposition is based off a relative point).
}
private void makeColours() {
colours = new ArrayList<Color>(Arrays.asList(
Color.BLUEVIOLET,
Color.BLACK,
Color.RED,
Color.ORANGE,
Color.DARKOLIVEGREEN,
Color.LIMEGREEN,
Color.PURPLE,
Color.DARKGRAY,
Color.YELLOW
));
}
public void setParticipants(Map<Integer, StreamedBoat> participants) {
this.participants = participants;
}

@ -19,7 +19,7 @@ public class StreamedBoat extends Boat {
this.velocity = 0;
}
public StreamedBoat(int sourceID, String name, Color colour, String abbrev) {
public StreamedBoat(int sourceID, String name, String abbrev) {
super(name, abbrev);
this.sourceID = sourceID;
this.init();

Loading…
Cancel
Save