Fixed racescaling a mark twice and removed println statements #story[1323]
This commit is contained in:
@@ -110,7 +110,6 @@ public class Event {
|
||||
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, windAngle, false);
|
||||
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML,
|
||||
windSpeed, raceLength);
|
||||
System.out.println(raceLength);
|
||||
}
|
||||
|
||||
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
||||
|
||||
@@ -21,6 +21,8 @@ import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Helper Class for creating a Race XML
|
||||
@@ -218,13 +220,17 @@ public class RaceXMLCreator {
|
||||
double averageSpeed = (bestDownWindSpeed + bestUpWindSpeed) / 2;
|
||||
double raceApproximateTime = getRaceLength(race, averageSpeed);
|
||||
double scale = milliseconds / raceApproximateTime;
|
||||
Map<XMLCompoundMark, Boolean> hasBeenScaled = new HashMap<>();
|
||||
for (XMLCorner cm: race.getCompoundMarkSequence().getCorner()){
|
||||
int index = cm.getCompoundMarkID() - 1;
|
||||
XMLCompoundMark mark = race.getCourse().getCompoundMark().get(index);
|
||||
if (!hasBeenScaled.containsKey(mark)) {
|
||||
for (XMLMark m : mark.getMark()) {
|
||||
scalePoint(m, center, scale);
|
||||
}
|
||||
}
|
||||
hasBeenScaled.put(mark, true);
|
||||
}
|
||||
for (XMLLimit limit: race.getCourseLimit().getLimit()){
|
||||
scalePoint(limit, center, scale);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user