Refactored and moved RaceXMLReader to shared/dataInput.
RaceStatus can provide windspeed in knots in addition to mm/sec. RaceDataSource now provides a list of participating boat sourceIDs instead of boats. Added a RegattaDataSource interface. Angle, Azimuth, Bearing and mutable - careful. Boat has positionInRace. CompoundMarks have an ID and name. Marks can be moved (setPosition(...)). Refactored Mock.Race, Visualiser.StreamedCourse, Visualiser.StreamedRace, into (shared) Race, MockRace, VisualiserRace. VisualiserBoat has color. Added xml and polar files into resources folder.
This commit is contained in:
@@ -3,6 +3,7 @@ package mock.app;
|
||||
import mock.model.Polars;
|
||||
import network.Messages.Enums.MessageType;
|
||||
import org.xml.sax.SAXException;
|
||||
import shared.model.Constants;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
@@ -66,15 +67,24 @@ public class Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the xml description of the race to show the race was created now, and starts in 3 minutes
|
||||
* Sets the xml description of the race to show the race was created now, and starts in 4 minutes
|
||||
* @param raceXML
|
||||
* @return String containing edited xml
|
||||
*/
|
||||
private String getRaceXMLAtCurrentTime(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;
|
||||
|
||||
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
ZonedDateTime creationTime = ZonedDateTime.now();
|
||||
return raceXML.replace("CREATION_TIME", dateFormat.format(creationTime))
|
||||
.replace("START_TIME", dateFormat.format(creationTime.plusMinutes(3)));
|
||||
raceXML.replace("CREATION_TIME", dateFormat.format(creationTime));
|
||||
|
||||
raceXML.replace("START_TIME", dateFormat.format(creationTime.plusSeconds(secondsToAdd)));
|
||||
|
||||
return raceXML;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user