Race length is affected by slider value.

- modified constructor of a race event to take in a scale value
- race is scaled according to minutes selected on the slider
- applied minimal css styling
- playing around with more styling options
- bug exists with 1 minute races, to be fixed

#story[1323]
This commit is contained in:
Jessica Syder
2017-09-24 22:56:14 +13:00
parent 819cdc49ab
commit f1c1fc7063
4 changed files with 29 additions and 21 deletions
@@ -40,46 +40,33 @@ public class Event {
private String raceXML;
private String regattaXML;
private String boatXML;
private XMLFileType xmlFileType;
private Polars boatPolars;
/**
* Data sources containing data from the xml files.
*/
RaceDataSource raceDataSource;
BoatDataSource boatDataSource;
RegattaDataSource regattaDataSource;
private RaceDataSource raceDataSource;
private BoatDataSource boatDataSource;
private RegattaDataSource regattaDataSource;
private ConnectionAcceptor connectionAcceptor;
private LatestMessages latestMessages;
private CompositeCommand compositeCommand;
/**
* This is used to allocate source IDs.
*/
private SourceIdAllocator sourceIdAllocator;
private Thread raceThread;
private Thread connectionThread;
private int mapIndex;
/**
* Constructs an event, using various XML files.
* @param singlePlayer Whether or not to create a single player event.
* @param mapIndex Specifies which map to use.
* @throws EventConstructionException Thrown if we cannot create an Event for any reason.
*/
public Event(boolean singlePlayer, int mapIndex) throws EventConstructionException {
public Event(boolean singlePlayer, int mapIndex, int raceLength) throws
EventConstructionException {
PolarParser.parseNewPolars("mock/polars/acc_polars.csv");
this.mapIndex = mapIndex;
String raceXMLFile;
@@ -121,7 +108,9 @@ public class Event {
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, -1, true);
} else {
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, windAngle, false);
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML, windSpeed, 15 * 60 * 1000);
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML,
windSpeed, raceLength);
System.out.println(raceLength);
}
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);