mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-08 20:12:23 +00:00
bug5932: adding comments and working on distance/time calculation
This commit is contained in:
1 parent
656e82a919
commit
14bcc77247
3 files changed
+42
-5
No files matched your search
+5
-5
@@ -51,7 +51,7 @@ public class FoilingSegmentRetrievalProcessor extends AbstractRetrievalProcessor
|
||||
TimePoint startOfSegment = null;
|
||||
bravoFixTrack.lockForRead();
|
||||
try {
|
||||
for (final BravoFix bravoFix : bravoFixTrack.getFixes(startOfRace, /* fromInclusive */ true, end, /* toInclusive */ false)) {
|
||||
for (final BravoFix bravoFix : bravoFixTrack.getFixes(startOfRace, /* fromInclusive */ true, end, /* toInclusive */ false)) { //geht ganzes Rennen durch
|
||||
if (isAborted()) {
|
||||
break;
|
||||
}
|
||||
@@ -61,10 +61,10 @@ public class FoilingSegmentRetrievalProcessor extends AbstractRetrievalProcessor
|
||||
element.getTrackedRaceContext().getTrackedRace().getTrack(element.getCompetitor()).getEstimatedSpeed(bravoFix.getTimePoint())) <= 0)) ||
|
||||
(settings.getMaximumSpeedNotFoiling() != null && settings.getMaximumSpeedNotFoiling().compareTo(
|
||||
element.getTrackedRaceContext().getTrackedRace().getTrack(element.getCompetitor()).getEstimatedSpeed(bravoFix.getTimePoint())) <= 0);
|
||||
if (currentFixIsFoiling != isFoiling) {
|
||||
if (currentFixIsFoiling) {
|
||||
if (currentFixIsFoiling != isFoiling) { //checken ob boot zum loop davor mit voherigem fix immernoch am fliegen ist, wenn nicht dann muss segment gemacht werden, wenn ja dann wird es zum segment ergänzt
|
||||
if (currentFixIsFoiling) { //wenn ich vorher nicht am fliegen war und jetzt schon start von segment
|
||||
startOfSegment = bravoFix.getTimePoint();
|
||||
} else {
|
||||
} else { // wenn ich vorher am fliegen war und jetzt nicht mehr, segment muss gebildet werden!!!!!
|
||||
if (settings.getMinimumFoilingSegmentDuration() == null ||
|
||||
startOfSegment.until(last).compareTo(settings.getMinimumFoilingSegmentDuration()) >= 0) {
|
||||
addOrMergeFoilingSegment(element, foilingSegments, bravoFixTrack, startOfSegment,
|
||||
@@ -72,7 +72,7 @@ public class FoilingSegmentRetrievalProcessor extends AbstractRetrievalProcessor
|
||||
}
|
||||
startOfSegment = null;
|
||||
}
|
||||
isFoiling = currentFixIsFoiling;
|
||||
isFoiling = currentFixIsFoiling; //aktualisiert das es vorher nicht gleich war also entweder fliegen zuende oder gerade beginnt
|
||||
}
|
||||
last = bravoFix.getTimePoint();
|
||||
}
|
||||
|
||||
@@ -197,5 +197,15 @@ public interface GPSFixTrack<ItemType, FixType extends GPSFix> extends MappedTra
|
||||
* {@link #getFixes()} if and only if this method returns {@code true}.
|
||||
*/
|
||||
boolean isValid(FixType e);
|
||||
//TODO: Morgen
|
||||
// /**
|
||||
// * The time spent on TackType during the time range provided
|
||||
// */
|
||||
// Duration getTimeSpentTackType(TimePoint from, TimePoint to);
|
||||
//
|
||||
// /**
|
||||
// * The distance sailed on TackType during the time range provided
|
||||
// */
|
||||
// Distance getDistanceSpentTackType(TimePoint from, TimePoint to);
|
||||
|
||||
}
|
||||
+27
@@ -29,6 +29,7 @@ import com.sap.sailing.domain.common.confidence.Weigher;
|
||||
import com.sap.sailing.domain.common.confidence.impl.BearingWithConfidenceImpl;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
import com.sap.sailing.domain.common.tracking.BravoFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.common.tracking.WithValidityCache;
|
||||
@@ -1214,4 +1215,30 @@ public abstract class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends
|
||||
}
|
||||
return new SpeedWithBearingStepsIterable(speedWithBearingSteps);
|
||||
}
|
||||
|
||||
private transient TimeRangeCache<Duration> tackTypeTimeCache;
|
||||
|
||||
private transient TimeRangeCache<Distance> tackTypeDistanceCache;
|
||||
//TODO: Morgen
|
||||
// @Override
|
||||
// public Duration getTimeSpentTackType(TimePoint from, TimePoint to) {
|
||||
// return getValueSum(from, to, /* nullElement */ Duration.NULL, Duration::plus, tackTypeTimeCache,
|
||||
// /* valueCalculator */ new Track.TimeRangeValueCalculator<Duration>() {
|
||||
// @Override
|
||||
// public Duration calculate(TimePoint from, TimePoint to) {
|
||||
// Duration result = Duration.NULL;
|
||||
// TimePoint last = from;
|
||||
// boolean isTackType = false;
|
||||
// for (final GPSFix fix : getFixes(from, true, to, true)) {
|
||||
// final boolean fixFoils = fix.isTackType(getTrackedRace().);
|
||||
// if (isTackType && fixFoils) {
|
||||
// result = result.plus(last.until(fix.getTimePoint()));
|
||||
// }
|
||||
// last = fix.getTimePoint();
|
||||
// isTackType = fixFoils;
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
Reference in new issue
Block a user