Merge remote-tracking branch 'origin/ribdashboard' into ribdashboard

This commit is contained in:
Alexander Ries committed 2015-04-01 10:25:52 +02:00
commit a46f2a6b80
13 files changed
+552 -504

No files matched your search

@@ -42,7 +42,11 @@ public interface RaceTracker {
/**
* Stops tracking the races.
* @param preemptive TODO
*
* @param preemptive
* if <code>false</code>, the tracker will continue to process data already received but will stop
* receiving new data. If <code>true</code>, the tracker will stop processing data immediately, ignoring
* (dropping) all data already received but not yet processed.
*/
void stop(boolean preemptive) throws MalformedURLException, IOException, InterruptedException;
@@ -260,7 +260,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
* these race states can be garbage-collected when the race log is no longer attached. The race states are created
* lazily, synchronizing on this weak hash map.
*/
protected final transient WeakHashMap<RaceLog, ReadonlyRaceState> raceStates;
protected transient WeakHashMap<RaceLog, ReadonlyRaceState> raceStates;
protected transient ConcurrentHashMap<Serializable, RegattaLog> attachedRegattaLogs;
@@ -497,6 +497,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
*/
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException, PatchFailedException {
ois.defaultReadObject();
raceStates = new WeakHashMap<>();
attachedRaceLogs = new ConcurrentHashMap<>();
markPassingsTimes = new ArrayList<com.sap.sse.common.Util.Pair<Waypoint, com.sap.sse.common.Util.Pair<TimePoint, TimePoint>>>();
// The short time wind cache needs to be there before operations such as maneuver recalculation try to access it
@@ -3158,26 +3159,30 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
if (!legs.isEmpty()) {
if (allMarksHavePositions && numberOfMarks == 2) {
final TrackedLeg legDeterminingDirection = getLegDeterminingDirectionInWhichToPassWaypoint(waypoint);
Distance crossTrackErrorOfMark0OnLineFromMark1ToNextWaypoint = markPositions.get(0)
.crossTrackError(markPositions.get(1), legDeterminingDirection.getLegBearing(timePoint));
final Position portMarkPositionWhileApproachingLine;
final Position starboardMarkPositionWhileApproachingLine;
final Mark starboardMarkWhileApproachingLine;
final Mark portMarkWhileApproachingLine;
if (crossTrackErrorOfMark0OnLineFromMark1ToNextWaypoint.getMeters() < 0) {
portMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 0);
portMarkPositionWhileApproachingLine = markPositions.get(0);
starboardMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 1);
starboardMarkPositionWhileApproachingLine = markPositions.get(1);
if (legDeterminingDirection == null) {
result = null;
} else {
portMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 1);
portMarkPositionWhileApproachingLine = markPositions.get(1);
starboardMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 0);
starboardMarkPositionWhileApproachingLine = markPositions.get(0);
Distance crossTrackErrorOfMark0OnLineFromMark1ToNextWaypoint = markPositions.get(0)
.crossTrackError(markPositions.get(1), legDeterminingDirection.getLegBearing(timePoint));
final Position portMarkPositionWhileApproachingLine;
final Position starboardMarkPositionWhileApproachingLine;
final Mark starboardMarkWhileApproachingLine;
final Mark portMarkWhileApproachingLine;
if (crossTrackErrorOfMark0OnLineFromMark1ToNextWaypoint.getMeters() < 0) {
portMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 0);
portMarkPositionWhileApproachingLine = markPositions.get(0);
starboardMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 1);
starboardMarkPositionWhileApproachingLine = markPositions.get(1);
} else {
portMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 1);
portMarkPositionWhileApproachingLine = markPositions.get(1);
starboardMarkWhileApproachingLine = Util.get(waypoint.getMarks(), 0);
starboardMarkPositionWhileApproachingLine = markPositions.get(0);
}
result = new LineMarksWithPositions(portMarkPositionWhileApproachingLine,
starboardMarkPositionWhileApproachingLine, starboardMarkWhileApproachingLine,
portMarkWhileApproachingLine);
}
result = new LineMarksWithPositions(portMarkPositionWhileApproachingLine,
starboardMarkPositionWhileApproachingLine, starboardMarkWhileApproachingLine,
portMarkWhileApproachingLine);
} else {
result = null; // either the position(s) or one or more marks is/are unknown, or the waypoint is not a two-mark waypoint
}