mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-11 06:40:53 +00:00
also adapted gap chart to gap in own time
This commit is contained in:
1 parent
53ba99f9aa
commit
0ad2425617
4 files changed
+44
-3
No files matched your search
+5
-1
@@ -12,6 +12,7 @@ import com.sap.sailing.domain.base.Leg;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.leaderboard.caching.LeaderboardDTOCalculationReuseCache;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sailing.domain.tracking.TrackedLeg;
|
||||
@@ -362,7 +363,10 @@ public abstract class AbstractRankingMetric implements RankingMetric {
|
||||
? getTrackedRace().getTrack(to).getEstimatedPosition(timePoint, /* extrapolate */ true)
|
||||
// not in the same leg; let "who" travel to the end of the leg
|
||||
: getTrackedRace().getApproximatePosition(currentLegWho.getLeg().getTo(), timePoint);
|
||||
final Duration toEndOfLegOrTo = currentLegWho.getAverageVelocityMadeGood(timePoint, cache).getDuration(
|
||||
final Speed currentVMG = currentLegWho.getVelocityMadeGood(timePoint, WindPositionMode.EXACT, cache);
|
||||
final Speed averageVMG = currentLegWho.getAverageVelocityMadeGood(timePoint, cache);
|
||||
final Speed vmg = Double.isNaN(averageVMG.getKnots()) ? currentVMG : averageVMG;
|
||||
final Duration toEndOfLegOrTo = vmg.getDuration(
|
||||
currentLegWho.getTrackedLeg().getWindwardDistance(
|
||||
getTrackedRace().getTrack(who).getEstimatedPosition(timePoint, /* extrapolate */true),
|
||||
windwardPositionToReachInWhosCurrentLeg, timePoint, WindPositionMode.LEG_MIDDLE));
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.domain.tracking.impl;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class DummyMarkPassingWithTimePointAndCompetitor implements MarkPassing {
|
||||
private static final long serialVersionUID = -5494669910047887984L;
|
||||
private final TimePoint timePoint;
|
||||
private final Competitor competitor;
|
||||
|
||||
public DummyMarkPassingWithTimePointAndCompetitor(TimePoint timePoint, Competitor competitor) {
|
||||
super();
|
||||
this.timePoint = timePoint;
|
||||
this.competitor = competitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getTimePoint() {
|
||||
return timePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Waypoint getWaypoint() {
|
||||
throw new UnsupportedOperationException("getWaypoint() not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Competitor getCompetitor() {
|
||||
return competitor;
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1303,8 +1303,10 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
|
||||
|
||||
@Override
|
||||
public TrackedLegOfCompetitor getCurrentLeg(Competitor competitor, TimePoint timePoint) {
|
||||
// If the mark passing that starts a leg happened exactly at timePoint, the MarkPassingByTimeComparator won't consider
|
||||
// them equal because
|
||||
NavigableSet<MarkPassing> competitorMarkPassings = markPassingsForCompetitor.get(competitor);
|
||||
DummyMarkPassingWithTimePointOnly markPassingTimePoint = new DummyMarkPassingWithTimePointOnly(timePoint);
|
||||
DummyMarkPassingWithTimePointAndCompetitor markPassingTimePoint = new DummyMarkPassingWithTimePointAndCompetitor(timePoint, competitor);
|
||||
TrackedLegOfCompetitor result = null;
|
||||
if (!competitorMarkPassings.isEmpty()) {
|
||||
final Course course = getRace().getCourse();
|
||||
|
||||
+3
-1
@@ -417,6 +417,7 @@ import com.sap.sailing.xrr.structureimport.StructureImporter;
|
||||
import com.sap.sailing.xrr.structureimport.buildstructure.SetRacenumberFromSeries;
|
||||
import com.sap.sse.BuildVersion;
|
||||
import com.sap.sse.common.CountryCode;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
@@ -2719,7 +2720,8 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
break;
|
||||
case GAP_TO_LEADER_IN_SECONDS:
|
||||
if (trackedLeg != null) {
|
||||
result = trackedLeg.getGapToLeader(timePoint, WindPositionMode.LEG_MIDDLE, cache).asSeconds();
|
||||
final Duration gapToLeaderInOwnTime = trackedLeg.getTrackedLeg().getTrackedRace().getRankingMetric().getGapToLeaderInOwnTime(competitor, timePoint, cache);
|
||||
result = gapToLeaderInOwnTime == null ? null : gapToLeaderInOwnTime.asSeconds();
|
||||
}
|
||||
break;
|
||||
case WINDWARD_DISTANCE_TO_OVERALL_LEADER:
|
||||
|
||||
Reference in new issue
Block a user