mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 05:35:51 +00:00
bug5918: including cache
This commit is contained in:
+6
-1
@@ -343,10 +343,15 @@ public interface TrackedLegOfCompetitor extends Serializable {
|
|||||||
TimePoint getTimePointNotAfterFinishingOfLeg(TimePoint timePoint);
|
TimePoint getTimePointNotAfterFinishingOfLeg(TimePoint timePoint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the bearing between the cog and the next waypoint is smaller then the one between cog and wind direction
|
* If the bearing between cog and the next waypoint is smaller then the one between cog and wind direction
|
||||||
* {@link TackType#LONGTACK longtack} is returned, if it is bigger {@link TackType#SHORTTACK shorttack}. For other cases <code>null</code> is returned.
|
* {@link TackType#LONGTACK longtack} is returned, if it is bigger {@link TackType#SHORTTACK shorttack}. For other cases <code>null</code> is returned.
|
||||||
*/
|
*/
|
||||||
TackType getTackType(TimePoint timePoint) throws NoWindException;
|
TackType getTackType(TimePoint timePoint) throws NoWindException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as {@link #getTackType(TimePoint timePoint)}, only that a cache for leg type calculation is passed.
|
||||||
|
*/
|
||||||
|
TackType getTackType(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) throws NoWindException;
|
||||||
|
|
||||||
Double getExpeditionAWA(TimePoint at);
|
Double getExpeditionAWA(TimePoint at);
|
||||||
Double getExpeditionAWS(TimePoint at);
|
Double getExpeditionAWS(TimePoint at);
|
||||||
|
|||||||
+7
-3
@@ -1246,6 +1246,11 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TackType getTackType(TimePoint timePoint) throws NoWindException {
|
public TackType getTackType(TimePoint timePoint) throws NoWindException {
|
||||||
|
return getTackType(timePoint, new LeaderboardDTOCalculationReuseCache(timePoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TackType getTackType(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) throws NoWindException {
|
||||||
final TackType result;
|
final TackType result;
|
||||||
final Position competitorPosition = getTrackedRace().getTrack(competitor).getEstimatedPosition(timePoint,
|
final Position competitorPosition = getTrackedRace().getTrack(competitor).getEstimatedPosition(timePoint,
|
||||||
/* extrapolate */ true);
|
/* extrapolate */ true);
|
||||||
@@ -1254,11 +1259,10 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
|
|||||||
if (start != null && timePoint.after(start.getTimePoint())) {
|
if (start != null && timePoint.after(start.getTimePoint())) {
|
||||||
final MarkPassing end = getMarkPassingForLegEnd();
|
final MarkPassing end = getMarkPassingForLegEnd();
|
||||||
if (end != null && timePoint.before(end.getTimePoint())) {
|
if (end != null && timePoint.before(end.getTimePoint())) {
|
||||||
final Position waypointPosition = getTrackedRace().getApproximatePosition(getLeg().getTo(),
|
final Position waypointPosition = cache.getApproximatePosition(getTrackedRace(), getLeg().getTo(), timePoint);
|
||||||
timePoint);
|
|
||||||
final Bearing cog = getSpeedOverGround(timePoint).getBearing();
|
final Bearing cog = getSpeedOverGround(timePoint).getBearing();
|
||||||
final Bearing bearingToWaypoint = competitorPosition.getBearingGreatCircle(waypointPosition);
|
final Bearing bearingToWaypoint = competitorPosition.getBearingGreatCircle(waypointPosition);
|
||||||
final Bearing bearingWind = getTrackedRace().getWind(competitorPosition, timePoint).getFrom();
|
final Bearing bearingWind = cache.getWind(getTrackedRace(), competitor, timePoint).getFrom();
|
||||||
final Bearing diffWindToBoat = bearingWind.getDifferenceTo(cog).abs();
|
final Bearing diffWindToBoat = bearingWind.getDifferenceTo(cog).abs();
|
||||||
final Bearing diffMarkToBoat = bearingToWaypoint.getDifferenceTo(cog).abs();
|
final Bearing diffMarkToBoat = bearingToWaypoint.getDifferenceTo(cog).abs();
|
||||||
if (diffMarkToBoat.compareTo(diffWindToBoat) < 0) {
|
if (diffMarkToBoat.compareTo(diffWindToBoat) < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user