Disabled map rotation - temp fix for the demo.
Set race to use 3 boat race.xml file.
This commit is contained in:
@@ -79,7 +79,7 @@ public class Event {
|
|||||||
*/
|
*/
|
||||||
public Event(boolean singlePlayer) throws EventConstructionException {
|
public Event(boolean singlePlayer) throws EventConstructionException {
|
||||||
|
|
||||||
String raceXMLFile = "mock/mockXML/raceTest.xml";
|
String raceXMLFile = "mock/mockXML/raceThreePlayers.xml";//TEMP 3 player race - for demo on 18th august
|
||||||
String boatsXMLFile = "mock/mockXML/boatTest.xml";
|
String boatsXMLFile = "mock/mockXML/boatTest.xml";
|
||||||
String regattaXMLFile = "mock/mockXML/regattaTest.xml";
|
String regattaXMLFile = "mock/mockXML/regattaTest.xml";
|
||||||
|
|
||||||
@@ -90,22 +90,15 @@ public class Event {
|
|||||||
|
|
||||||
//Read XML files.
|
//Read XML files.
|
||||||
try {
|
try {
|
||||||
this.raceXML = RaceXMLCreator.alterRaceToWind(raceXMLFile, 90);
|
//this.raceXML = RaceXMLCreator.alterRaceToWind(raceXMLFile, 90);
|
||||||
|
this.raceXML = XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8);
|
||||||
|
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
|
||||||
|
|
||||||
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
||||||
this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8);
|
this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
} catch (XMLReaderException e) {
|
} catch (XMLReaderException e) {
|
||||||
throw new EventConstructionException("Could not read XML files.", e);
|
throw new EventConstructionException("Could not read XML files.", e);
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParserConfigurationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (SAXException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvalidRaceDataException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.xmlFileType = XMLFileType.Contents;
|
this.xmlFileType = XMLFileType.Contents;
|
||||||
@@ -197,4 +190,29 @@ public class Event {
|
|||||||
|
|
||||||
connectionAcceptor.setBoatsXml(boatXML);
|
connectionAcceptor.setBoatsXml(boatXML);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
//TODO remove this after demo on 18th august!
|
||||||
|
/**
|
||||||
|
* Sets the xml description of the race to show the race was created now, and starts in 4 minutes
|
||||||
|
* @param raceXML The race.xml contents.
|
||||||
|
* @return String containing edited xml
|
||||||
|
*/
|
||||||
|
public static String setRaceXMLAtCurrentTimeToNow(String raceXML) {
|
||||||
|
|
||||||
|
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
||||||
|
long millisecondsToAdd = Constants.RacePreStartTime + (1 * 60 * 1000);
|
||||||
|
long secondsToAdd = millisecondsToAdd / 1000;
|
||||||
|
//Scale the time using our time scalar.
|
||||||
|
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
||||||
|
|
||||||
|
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||||
|
ZonedDateTime creationTime = ZonedDateTime.now();
|
||||||
|
raceXML = raceXML.replace("RACE_CREATION_TIME", dateFormat.format(creationTime));
|
||||||
|
raceXML = raceXML.replace("RACE_START_TIME", dateFormat.format(creationTime.plusSeconds(secondsToAdd)));
|
||||||
|
|
||||||
|
|
||||||
|
return raceXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<Race>
|
<Race>
|
||||||
<RaceID>5326</RaceID>
|
<RaceID>5326</RaceID>
|
||||||
<RaceType>FLEET</RaceType>
|
<RaceType>FLEET</RaceType>
|
||||||
<CreationTimeDate>2017-08-03T02:13:14+1200</CreationTimeDate>
|
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
|
||||||
<RaceStartTime Postpone="false" Time="2017-08-03T02:08:10+1200"/>
|
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
|
||||||
<Participants>
|
<Participants>
|
||||||
<Yacht SourceID="126"/>
|
<Yacht SourceID="126"/>
|
||||||
</Participants>
|
</Participants>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<Race>
|
<Race>
|
||||||
<RaceID>5326</RaceID>
|
<RaceID>5326</RaceID>
|
||||||
<RaceType>FLEET</RaceType>
|
<RaceType>FLEET</RaceType>
|
||||||
<CreationTimeDate>2017-08-03T02:13:14+1200</CreationTimeDate>
|
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
|
||||||
<RaceStartTime Postpone="false" Time="2017-08-03T02:08:10+1200"/>
|
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
|
||||||
<Participants>
|
<Participants>
|
||||||
<Yacht SourceID="121"/>
|
<Yacht SourceID="121"/>
|
||||||
<Yacht SourceID="122"/>
|
<Yacht SourceID="122"/>
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<Race>
|
||||||
|
<RaceID>5326</RaceID>
|
||||||
|
<RaceType>FLEET</RaceType>
|
||||||
|
<CreationTimeDate>RACE_CREATION_TIME</CreationTimeDate>
|
||||||
|
<RaceStartTime Postpone="false" Time="RACE_START_TIME"/>
|
||||||
|
<Participants>
|
||||||
|
<Yacht SourceID="124"/>
|
||||||
|
<Yacht SourceID="125"/>
|
||||||
|
<Yacht SourceID="126"/>
|
||||||
|
</Participants>
|
||||||
|
<CompoundMarkSequence>
|
||||||
|
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
|
||||||
|
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
|
||||||
|
<Corner SeqID="3" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
|
||||||
|
<Corner SeqID="4" CompoundMarkID="3" Rounding="Starboard" ZoneSize="3" />
|
||||||
|
<Corner SeqID="5" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
|
||||||
|
<Corner SeqID="6" CompoundMarkID="5" Rounding="SP" ZoneSize="3"/>
|
||||||
|
</CompoundMarkSequence>
|
||||||
|
<Course>
|
||||||
|
<CompoundMark CompoundMarkID="1" Name="Start Line">
|
||||||
|
<Mark SeqId="1" Name="PRO" TargetLat="32.296577" TargetLng="-64.854304" SourceID="101"/>
|
||||||
|
<Mark SeqId="2" Name="PIN" TargetLat="32.293771" TargetLng="-64.855242" SourceID="102"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="2" Name="Marker 1">
|
||||||
|
<Mark Name="Marker1" TargetLat="32.293039" TargetLng="-64.843983" SourceID="103"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="3" Name="Windward Gate">
|
||||||
|
<Mark Name="WGL" SeqId="1" TargetLat="32.28468" TargetLng="-64.850045" SourceID="104"/>
|
||||||
|
<Mark Name="WGR" SeqId="2" TargetLat="32.280164" TargetLng="-64.847591" SourceID="105"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="4" Name="Leeward Gate">
|
||||||
|
<Mark Name="LGL" SeqId="1" TargetLat="32.309693" TargetLng="-64.835249" SourceID="106"/>
|
||||||
|
<Mark Name="LGR" SeqId="2" TargetLat="32.308046" TargetLng="-64.831785" SourceID="107"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="5" Name="Finish Line">
|
||||||
|
<Mark Name="FL" SeqId="1" TargetLat="32.317379" TargetLng="-64.839291" SourceID="108"/>
|
||||||
|
<Mark Name="FR" SeqId="2" TargetLat="32.317257" TargetLng="-64.83626" SourceID="109"/>
|
||||||
|
</CompoundMark>
|
||||||
|
</Course>
|
||||||
|
<CourseLimit>
|
||||||
|
<Limit Lat="32.313922" Lon="-64.837168" SeqID="1"/>
|
||||||
|
<Limit Lat="32.317379" Lon="-64.839291" SeqID="2"/>
|
||||||
|
<Limit Lat="32.317911" Lon="-64.836996" SeqID="3"/>
|
||||||
|
<Limit Lat="32.317257" Lon="-64.83626" SeqID="4"/>
|
||||||
|
<Limit Lat="32.304273" Lon="-64.822834" SeqID="5"/>
|
||||||
|
<Limit Lat="32.279097" Lon="-64.841545" SeqID="6"/>
|
||||||
|
<Limit Lat="32.279604" Lon="-64.849871" SeqID="7"/>
|
||||||
|
<Limit Lat="32.289545" Lon="-64.854162" SeqID="8"/>
|
||||||
|
<Limit Lat="32.290198" Lon="-64.858711" SeqID="9"/>
|
||||||
|
<Limit Lat="32.297164" Lon="-64.856394" SeqID="10"/>
|
||||||
|
<Limit Lat="32.296148" Lon="-64.849184" SeqID="11"/>
|
||||||
|
</CourseLimit>
|
||||||
|
</Race>
|
||||||
Reference in New Issue
Block a user