changed time point used for average speed over ground; use time of competitor's last fix if leg not completed;

return null if no fix found at all for competitor
This commit is contained in:
Axel Uhl committed 2011-06-14 13:17:07 +02:00
1 parent 910c860e69
commit b745acb11f
3 files changed
+9 -2

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;