use timeForPositionTransitionMillis for the advantage line animator

This commit is contained in:
Jonas committed 2015-12-03 18:21:38 +01:00
1 parent b5e15f5249
commit 6b839d840d
2 files changed
+7 -7

No files matched your search

@@ -10,19 +10,19 @@ class AdvantageLineAnimator extends Timer {
private final Polyline advantageLine;
private long lastTime;
private int durationMillis = -1;
private long durationMillis = -1;
private MVCArray<LatLng> nextPosition;
public AdvantageLineAnimator(Polyline advantageLine) {
this.advantageLine = advantageLine;
}
public void setNextPosition(MVCArray<LatLng> nextPosition) {
public void setNextPositionAndTransitionMillis(MVCArray<LatLng> nextPosition, long timeForPositionTransitionMillis) {
this.nextPosition = nextPosition;
scheduleRepeating(ANIMATION_PERIOD, 1000); //TODO: calculate the duration as Boats do
scheduleRepeating(ANIMATION_PERIOD, timeForPositionTransitionMillis);
}
public void scheduleRepeating(int periodMillis, int durationMillis) {
public void scheduleRepeating(int periodMillis, long durationMillis) {
this.lastTime = System.currentTimeMillis();
this.scheduleRepeating(periodMillis);
this.durationMillis = durationMillis;
@@ -917,7 +917,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
showStartLineToFirstMarkTriangle(raceMapDataDTO.coursePositions);
// even though the wind data is retrieved by a separate call, re-draw the advantage line because it needs to
// adjust to new boat positions
showAdvantageLine(competitorsToShow, newTime);
showAdvantageLine(competitorsToShow, newTime, timeForPositionTransitionMillis);
// Rezoom the map
LatLngBounds zoomToBounds = null;
@@ -1223,7 +1223,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
return null;
}
private void showAdvantageLine(Iterable<CompetitorDTO> competitorsToShow, Date date) {
private void showAdvantageLine(Iterable<CompetitorDTO> competitorsToShow, Date date, long timeForPositionTransitionMillis) {
if (map != null && lastRaceTimesInfo != null && quickRanks != null && lastCombinedWindTrackInfoDTO != null) {
boolean drawAdvantageLine = false;
if (settings.getHelpLinesSettings().isVisible(HelpLineTypes.ADVANTAGELINE)) {
@@ -1323,7 +1323,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
} else {
nextPath.push(advantageLinePos1);
nextPath.push(advantageLinePos2);
advantageTimer.setNextPosition(nextPath);
advantageTimer.setNextPositionAndTransitionMillis(nextPath, timeForPositionTransitionMillis);
advantageLineMouseOverHandler.setTrueWindBearing(bearingOfCombinedWindInDeg);
advantageLineMouseOverHandler.setDate(new Date(windFix.measureTimepoint));
}