Merge remote-tracking branch 'origin/master' into timeMinMaxModel

This commit is contained in:
fmittag
2012-10-04 13:17:24 +02:00
5 changed files with 18 additions and 12 deletions
Binary file not shown.
@@ -148,6 +148,10 @@ public abstract class AbstractScoringSchemeImpl implements ScoringScheme {
@Override
public int compareByLastRace(List<Double> o1Scores, List<Double> o2Scores, boolean nullScoresAreBetter) {
return getScoreComparator(nullScoresAreBetter).compare(o1Scores.get(o1Scores.size()-1), o2Scores.get(o2Scores.size()-1));
int result = 0;
if (!o1Scores.isEmpty() && !o2Scores.isEmpty()) {
result = getScoreComparator(nullScoresAreBetter).compare(o1Scores.get(o1Scores.size()-1), o2Scores.get(o2Scores.size()-1));
}
return result;
}
}
@@ -338,10 +338,10 @@ public abstract class AbstractSimpleLeaderboardImpl implements Leaderboard, Race
@Override
public boolean countRaceForComparisonWithDiscardingThresholds(Competitor competitor, RaceColumn raceColumn, TimePoint timePoint) {
TrackedRace trackedRaceForCompetitorInColumn;
return getScoreCorrection().isScoreCorrected(competitor, raceColumn) ||
(getScoringScheme().isValidInTotalScore(this, raceColumn, timePoint) &&
(trackedRaceForCompetitorInColumn=raceColumn.getTrackedRace(competitor)) != null &&
trackedRaceForCompetitorInColumn.hasStarted(timePoint));
return getScoringScheme().isValidInTotalScore(this, raceColumn, timePoint) &&
(getScoreCorrection().isScoreCorrected(competitor, raceColumn) ||
((trackedRaceForCompetitorInColumn=raceColumn.getTrackedRace(competitor)) != null &&
trackedRaceForCompetitorInColumn.hasStarted(timePoint)));
}
@Override
@@ -1526,7 +1526,8 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
try {
for (Competitor competitor : getRace().getCompetitors()) {
TrackedLegOfCompetitor leg = getTrackedLeg(competitor, timePoint);
if (leg != null) {
// if bearings was set to null this indicates there was an exception; no need for further calculations, return null
if (bearings != null && leg != null) {
TrackedLeg trackedLeg = getTrackedLeg(leg.getLeg());
LegType legType;
try {
@@ -685,7 +685,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
Math.cos(lat1) * Math.sin(distianceRad) * Math.cos(bearingRad));
double lon2 = lon1 + Math.atan2(Math.sin(bearingRad)*Math.sin(distianceRad)*Math.cos(lat1),
Math.cos(distianceRad)-Math.sin(lat1)*Math.sin(lat2));
lon2 = (lon2+3*Math.PI) % (2*Math.PI) - Math.PI; // normalize to -180..+180º
lon2 = (lon2+3*Math.PI) % (2*Math.PI) - Math.PI; // normalize to -180..+180�
return LatLng.newInstance(lat2 / Math.PI * 180., lon2 / Math.PI * 180.);
}
@@ -709,11 +709,13 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
&& lastCombinedWindTrackInfoDTO.windFixes.size() > 0) {
// find competitor with highest rank
Pair<Integer, CompetitorDTO> visibleLeaderInfo = getLeadingVisibleCompetitorInfo(competitorsToShow);
if (visibleLeaderInfo != null && settings.getHelpLinesSettings().containsHelpLine(HelpLineTypes.ADVANTAGELINE) &&
// the boat fix may be null; may mean that no positions were loaded yet for the leading visible boat; don't show anything
GPSFixDTO lastBoatFix;
if (visibleLeaderInfo != null && getSettings().getHelpLinesSettings().containsHelpLine(HelpLineTypes.ADVANTAGELINE) &&
lastShownFix.containsKey(visibleLeaderInfo.getB()) && lastShownFix.get(visibleLeaderInfo.getB()) != -1
&& visibleLeaderInfo.getA() > 0 && visibleLeaderInfo.getA() <= lastRaceTimesInfo.getLegInfos().size()) {
&& visibleLeaderInfo.getA() > 0 && visibleLeaderInfo.getA() <= lastRaceTimesInfo.getLegInfos().size() &&
(lastBoatFix = getBoatFix(visibleLeaderInfo.getB(), date)) != null) {
LegInfoDTO legInfoDTO = lastRaceTimesInfo.getLegInfos().get(visibleLeaderInfo.getA()-1);
GPSFixDTO lastBoatFix = getBoatFix(visibleLeaderInfo.getB(), date);
double advantageLineLengthInKm = 1.0; // TODO this should probably rather scale with the visible area of the map; bug 616
double distanceFromBoatPositionInKm = visibleLeaderInfo.getB().boatClass.getHullLengthInMeters()/1000.; // one hull length
// implement and use Position.translateRhumb()
@@ -777,8 +779,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
advantageLine.insertVertex(0, advantageLinePoints[0]);
advantageLine.insertVertex(1, advantageLinePoints[1]);
}
}
else {
} else {
if (advantageLine != null) {
map.removeOverlay(advantageLine);
advantageLine = null;