Merge branch 'master' into test

This commit is contained in:
Axel Uhl committed 2011-06-14 15:19:03 +02:00
commit 429ff3e5cb
10 files changed
+61 -42

No files matched your search

@@ -28,6 +28,7 @@ public class DynamicGPSFixMovingTrackImpl<ItemType> extends DynamicTrackImpl<Ite
*/
@Override
public SpeedWithBearing getEstimatedSpeed(TimePoint at) {
// TODO factor out the obtaining of relevant fixes which should be the same in super.getEstimatedSpeed(at)
DummyGPSFixMoving atTimed = new DummyGPSFixMoving(at);
NavigableSet<GPSFixMoving> beforeSet = getInternalFixes().headSet(atTimed, /* inclusive */ true);
NavigableSet<GPSFixMoving> afterSet = getInternalFixes().tailSet(atTimed, /* inclusive */ true);
@@ -107,7 +107,14 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
if (hasFinishedLeg(timePoint)) {
timePointToUse = getMarkPassingForLegEnd().getTimePoint();
} else {
timePointToUse = getTrackedRace().getTimePointOfNewestEvent();
// use time point of latest fix
GPSFixMoving lastFix = getTrackedRace().getTrack(getCompetitor()).getLastFix();
if (lastFix != null) {
timePointToUse = lastFix.getTimePoint();
} else {
// No fix at all? Then we can't determine any speed
return null;
}
}
Distance d = getDistanceTraveled(timePointToUse);
long millis = timePointToUse.asMillis() - legStart.getTimePoint().asMillis();
@@ -13,7 +13,6 @@ public interface MongoWindStoreFactory {
/**
* Gets the default Mongo store based on the properties mongo.hostname[=localhost], mongo.port[=27017]
* and mongo.dbName[=&lt;contents of constant {@link #DEFAULT_DB_NAME}&gt;] specified in the bundle context
* @param mongoObjectFactory TODO
*/
MongoWindStore getMongoWindStore(MongoObjectFactory mongoObjectFactory) throws UnknownHostException, MongoException;
@@ -221,6 +221,7 @@ public class AdminApp extends Servlet {
JSONObject jsonWind = new JSONObject();
jsonWind.put("truebearingdeg", wind.getBearing().getDegrees());
jsonWind.put("knotspeed", wind.getKnots());
jsonWind.put("meterspersecondspeed", wind.getMetersPerSecond());
if (wind.getTimePoint() != null) {
jsonWind.put("timepoint", wind.getTimePoint().asMillis());
jsonWind.put("dampenedtruebearingdeg",
@@ -228,6 +229,8 @@ public class AdminApp extends Servlet {
.getDegrees());
jsonWind.put("dampenedknotspeed",
windTrack.getEstimatedWind(wind.getPosition(), wind.getTimePoint()).getKnots());
jsonWind.put("dampenedmeterspersecondspeed",
windTrack.getEstimatedWind(wind.getPosition(), wind.getTimePoint()).getMetersPerSecond());
}
if (wind.getPosition() != null) {
jsonWind.put("latdeg", wind.getPosition().getLatDeg());
@@ -213,7 +213,8 @@ public class ModeratorApp extends Servlet {
if (currentWind != null) {
JSONObject jsonWind = new JSONObject();
jsonWind.put("truebearingdeg", currentWind.getBearing().getDegrees());
jsonWind.put("knowspeed", currentWind.getKnots());
jsonWind.put("knotspeed", currentWind.getKnots());
jsonWind.put("meterspersecondspeed", currentWind.getMetersPerSecond());
jsonWind.put("source", trackedRace.getWindSource().toString());
jsonRace.put("wind", jsonWind);
}
@@ -240,11 +241,15 @@ public class ModeratorApp extends Servlet {
if (currentSpeedOverGround != null) {
jsonCompetitorInLeg.put("currentSpeedOverGroundInKnots",
currentSpeedOverGround == null ? null : currentSpeedOverGround.getKnots());
jsonCompetitorInLeg.put("currentSpeedOverGroundInMetersPerSecond",
currentSpeedOverGround == null ? null : currentSpeedOverGround.getMetersPerSecond());
}
Speed averageSpeedOverGround = trackedLegOfCompetitor.getAverageSpeedOverGround(timePoint);
if (averageSpeedOverGround != null) {
jsonCompetitorInLeg.put("averageSpeedOverGroundInKnots",
averageSpeedOverGround.getKnots());
jsonCompetitorInLeg.put("averageSpeedOverGroundInMetersPerSecond",
averageSpeedOverGround.getMetersPerSecond());
}
Distance distanceTraveled = trackedLegOfCompetitor.getDistanceTraveled(timePoint);
if (distanceTraveled != null) {
@@ -255,6 +260,7 @@ public class ModeratorApp extends Servlet {
Speed velocityMadeGood = trackedLegOfCompetitor.getVelocityMadeGood(timePoint);
if (velocityMadeGood != null) {
jsonCompetitorInLeg.put("velocityMadeGoodInKnots", velocityMadeGood.getKnots());
jsonCompetitorInLeg.put("velocityMadeGoodInMetersPerSecond", velocityMadeGood.getMetersPerSecond());
}
} catch (NoWindException e) {
// well, we don't know the wind direction... then no VMG will be shown...
@@ -265,6 +271,8 @@ public class ModeratorApp extends Servlet {
if (averageVelocityMadeGood != null) {
jsonCompetitorInLeg.put("averageVelocityMadeGoodInKnots",
averageVelocityMadeGood.getKnots());
jsonCompetitorInLeg.put("averageVelocityMadeGoodInMetersPerSecond",
averageVelocityMadeGood.getMetersPerSecond());
}
} catch (NoWindException e1) {
// well, we don't know the wind direction... then no average VMG will be shown...