mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 14:57:12 +00:00
added a few TODOs/FIXMEs for Jonas
This commit is contained in:
1 parent
185b972fbb
commit
3fc535963e
2 files changed
+11
-13
No files matched your search
+7
-9
@@ -12,7 +12,7 @@ import com.sap.sailing.gwt.ui.shared.GPSFixDTO;
|
||||
class AdvantageLineAnimator extends Timer {
|
||||
private static final double MILLIS_TO_HOURS_FACTOR = 3600000;
|
||||
|
||||
private Polyline advantageLine;
|
||||
private final Polyline advantageLine;
|
||||
private GPSFixDTO lastBoatFix;
|
||||
private long lastTime;
|
||||
private int repetitions = -1;
|
||||
@@ -26,7 +26,7 @@ class AdvantageLineAnimator extends Timer {
|
||||
scheduleRepeating(100, 10);
|
||||
}
|
||||
|
||||
public void scheduleRepeating(int periodMillis, int repetitions) {
|
||||
public void scheduleRepeating(int periodMillis, int repetitions) { // TODO Jonas: use duration instead of repetitions and check time as we go
|
||||
this.lastTime = System.currentTimeMillis();
|
||||
this.scheduleRepeating(periodMillis);
|
||||
this.repetitions = repetitions;
|
||||
@@ -36,29 +36,27 @@ class AdvantageLineAnimator extends Timer {
|
||||
public void run() {
|
||||
if (repetitions > 0) {
|
||||
repetitions--;
|
||||
} else if (repetitions == 0) {
|
||||
} else if (repetitions == 0) { // TODO Jonas: see above, use duration / target time
|
||||
this.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if(advantageLine != null) {
|
||||
if (advantageLine != null) {
|
||||
long time = System.currentTimeMillis();
|
||||
long deltaTime = time - lastTime;
|
||||
lastTime = time;
|
||||
|
||||
if (lastBoatFix != null) {
|
||||
Position oldPosition = lastBoatFix.position;
|
||||
Position newPosition = oldPosition.translateRhumb(
|
||||
Position newPosition = oldPosition.translateRhumb( // TODO Jonas: use great circle navigation
|
||||
new DegreeBearingImpl(lastBoatFix.speedWithBearing.bearingInDegrees),
|
||||
new NauticalMileDistance(deltaTime / MILLIS_TO_HOURS_FACTOR * lastBoatFix.speedWithBearing.speedInKnots));
|
||||
|
||||
final double latDelta = newPosition.getLatDeg() - oldPosition.getLatDeg();
|
||||
final double latDelta = newPosition.getLatDeg() - oldPosition.getLatDeg(); // FIXME Jonas: this would be a delta in "logical coordinates" but not Google Map coordinates
|
||||
final double lngDelta = newPosition.getLngDeg() - oldPosition.getLngDeg();
|
||||
|
||||
final MVCArray<LatLng> path = this.advantageLine.getPath();
|
||||
LatLng pos1 = path.pop();
|
||||
LatLng pos2 = path.pop();
|
||||
path.push(LatLng.newInstance(pos2.getLatitude() + latDelta, pos2.getLongitude() + lngDelta));
|
||||
path.push(LatLng.newInstance(pos2.getLatitude() + latDelta, pos2.getLongitude() + lngDelta)); // FIXME Jonas: must not use Position's lat/lng to draw on map; always use coordinateSystem to map
|
||||
path.push(LatLng.newInstance(pos1.getLatitude() + latDelta, pos1.getLongitude() + lngDelta));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -804,7 +804,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
List<com.sap.sse.common.Util.Pair<WindSource, WindTrackInfoDTO>> windSourcesToShow = new ArrayList<com.sap.sse.common.Util.Pair<WindSource, WindTrackInfoDTO>>();
|
||||
if (windInfo != null) {
|
||||
lastCombinedWindTrackInfoDTO = windInfo;
|
||||
showAdvantageLine(competitorsToShow, newTime);
|
||||
// showAdvantageLine(competitorsToShow, newTime); // TODO bug 1662: can we live without this call and assume that updating the advantage line in case the boats are moved is enough?
|
||||
for (WindSource windSource : windInfo.windTrackInfoByWindSource.keySet()) {
|
||||
WindTrackInfoDTO windTrackInfoDTO = windInfo.windTrackInfoByWindSource.get(windSource);
|
||||
switch (windSource.getType()) {
|
||||
@@ -896,7 +896,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
startedProcessingRequestID = requestID;
|
||||
// Do boat specific actions
|
||||
Map<CompetitorDTO, List<GPSFixDTO>> boatData = raceMapDataDTO.boatPositions;
|
||||
long timeForPositionTransitionMillis = calculateTimeForPositionTransition(newTime, oldTime);
|
||||
long timeForPositionTransitionMillis = calculateTimeForPositionTransitionInMillis(newTime, oldTime);
|
||||
fixesAndTails.updateFixes(boatData, hasTailOverlapForCompetitor, RaceMap.this, timeForPositionTransitionMillis);
|
||||
showBoatsOnMap(newTime, timeForPositionTransitionMillis, getCompetitorsToShow());
|
||||
showCompetitorInfoOnMap(newTime, timeForPositionTransitionMillis, competitorSelection.getSelectedFilteredCompetitors());
|
||||
@@ -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);
|
||||
|
||||
// Rezoom the map
|
||||
LatLngBounds zoomToBounds = null;
|
||||
@@ -1136,7 +1136,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
}
|
||||
}
|
||||
|
||||
private long calculateTimeForPositionTransition(final Date newTime, final Date oldTime) {
|
||||
private long calculateTimeForPositionTransitionInMillis(final Date newTime, final Date oldTime) {
|
||||
final long timeForPositionTransitionMillis;
|
||||
boolean hasTimeJumped = oldTime != null && Math.abs(oldTime.getTime() - newTime.getTime()) > 3*timer.getRefreshInterval();
|
||||
if (timer.getPlayState() == PlayStates.Playing && !hasTimeJumped) {
|
||||
|
||||
Reference in new issue
Block a user