added "tack" field to "showboatpositions" output, added corresponding doc to README

This commit is contained in:
Axel Uhl committed 2011-09-15 10:05:32 +02:00
1 parent ac9e388c87
commit cadf618c07
4 files changed
+5 -3

No files matched your search

@@ -201,7 +201,7 @@ public interface TrackedRace {
* Determines whether the <code>competitor</code> is sailing on port or starboard tack at the
* <code>timePoint</code> requested.
*/
Tack getTack(Competitor competitor, TimePoint timePoint) throws NoWindException;
Tack getTack(Competitor competitor, TimePoint timePoint);
TrackedEvent getTrackedEvent();
}
@@ -597,7 +597,7 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
* For the unlikely case of 0 degrees difference, {@link Tack#STARBOARD} will result.
*/
@Override
public Tack getTack(Competitor competitor, TimePoint timePoint) throws NoWindException {
public Tack getTack(Competitor competitor, TimePoint timePoint) {
Bearing wind = getWind(getTrack(competitor).getEstimatedPosition(timePoint, /* extrapolate */ false), timePoint).getBearing();
Bearing boat = getTrack(competitor).getEstimatedSpeed(timePoint).getBearing();
Bearing difference = wind.getDifferenceTo(boat);
@@ -116,6 +116,7 @@ public class ModeratorApp extends Servlet {
jsonFix.put("lngdeg", fix.getPosition().getLngDeg());
jsonFix.put("truebearingdeg", fix.getSpeed().getBearing().getDegrees());
jsonFix.put("knotspeed", fix.getSpeed().getKnots());
jsonFix.put("tack", trackedRace.getTack(competitor, fix.getTimePoint()).name());
jsonFixes.add(jsonFix);
}
jsonCompetitor.put("track", jsonFixes);