Merge branch 'master' into textbox

This commit is contained in:
Axel Uhl committed 2013-11-13 22:24:13 +01:00
commit ece5e747fa
2 files changed
+15 -5

No files matched your search

@@ -586,6 +586,7 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
if (speedWhenSpeedStartedToDrop != null) {
TimePoint timePointWhenSpeedLevelledOffAfterManeuver = fixes.get(fixes.size()-1).getTimePoint();
SpeedWithBearing speedAfterManeuver = track.getEstimatedSpeed(timePointWhenSpeedLevelledOffAfterManeuver);
if (speedAfterManeuver != null) {
// For upwind/downwind legs, find the mean course between inbound and outbound course and project actual and
// extrapolated positions onto it:
Bearing middleManeuverAngle = speedWhenSpeedStartedToDrop.getBearing().middle(speedAfterManeuver.getBearing());
@@ -604,6 +605,9 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
} else {
result = null;
}
} else {
result = null;
}
return result;
}
@@ -641,7 +645,7 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
while (fixIter.hasNext()) {
fix = fixIter.next();
final SpeedWithBearing estimatedSpeedAtFix = track.getEstimatedSpeed(fix.getTimePoint());
if (lastFix != null) {
if (lastFix != null && lastSpeed != null && lastLastSpeed != null && estimatedSpeedAtFix != null) {
if (lastSpeed.compareTo(lastLastSpeed) > 0 && lastSpeed.compareTo(estimatedSpeedAtFix) > 0) {
maxima.add(lastFix);
} else if (lastSpeed.compareTo(lastLastSpeed) < 0 && lastSpeed.compareTo(estimatedSpeedAtFix) < 0) {
@@ -2259,16 +2259,22 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
break;
}
if (lastFix != null) {
Bearing courseAtLastFix = track.getEstimatedSpeed(lastFix.getTimePoint()).getBearing();
Bearing courseAtFix = track.getEstimatedSpeed(fix.getTimePoint()).getBearing();
double angleSpeedInDegreesPerSecond = Math.abs((courseAtFix.getDifferenceTo(courseAtLastFix)
.getDegrees())
final SpeedWithBearing lastEstimatedSpeed = track.getEstimatedSpeed(lastFix.getTimePoint());
if (lastEstimatedSpeed != null) {
Bearing courseAtLastFix = lastEstimatedSpeed.getBearing();
final SpeedWithBearing estimatedSpeed = track.getEstimatedSpeed(fix.getTimePoint());
if (estimatedSpeed != null) {
Bearing courseAtFix = estimatedSpeed.getBearing();
double angleSpeedInDegreesPerSecond = Math.abs((courseAtFix
.getDifferenceTo(courseAtLastFix).getDegrees())
/ (double) (fix.getTimePoint().asMillis() - lastFix.getTimePoint().asMillis()));
if (angleSpeedInDegreesPerSecond > maxAngleSpeedInDegreesPerSecond) {
maxAngleSpeedInDegreesPerSecond = angleSpeedInDegreesPerSecond;
result = lastFix.getTimePoint();
}
}
}
}
lastFix = fix;
}
} finally {