fixed course for test case; fixed incremental tail update in RaceMapPanel

This commit is contained in:
Axel Uhl committed 2011-11-23 14:59:57 +01:00
1 parent fdedc241df
commit 244db59c86
2 files changed
+13 -10

No files matched your search

@@ -1,3 +1,3 @@
RAC|1|W4702;A simulated SwissTiming race
STL|W4702|46|GER 12;GER;Competitor 25|GBR 812;GBR;Competitor 19|NED 24;NED;Competitor 35|CRO 111;CRO;Competitor 11|ARG 8;ARG;Competitor 0|FRA 12;FRA;Competitor 16|CAN 610;CAN;Competitor 6|CHN 616;CHN;Competitor 10|CHN 1261;CHN;Competitor 8|ESP 133;ESP;Competitor 13|GER 72;GER;Competitor 29|EST 20;EST;Competitor 15|NZL 75;NZL;Competitor 36|SLO 64;SLO;Competitor 39|GBR 831;GBR;Competitor 20|RUS 12;RUS;Competitor 37|ITA 23;ITA;Competitor 31|ESP 696;ESP;Competitor 14|GBR 847;GBR;Competitor 22|DEN 143;DEN;Competitor 12|ISR 311;ISR;Competitor 30|GER 21;GER;Competitor 26|NED 11;NED;Competitor 34|GBR 850;GBR;Competitor 23|BRA 177;BRA;Competitor 3|AUT 431;AUT;Competitor 2|FRA 9;FRA;Competitor 18|FRA 4;FRA;Competitor 17|GBR 855;GBR;Competitor 24|BRA 1187;BRA;Competitor 4|USA 1712;USA;Competitor 43|SWE 344;SWE;Competitor 42|GER 61;GER;Competitor 27|SWE 342;SWE;Competitor 41|CHN 1211;CHN;Competitor 7|USA 1757;USA;Competitor 45|GER 66;GER;Competitor 28|SUI 14;SUI;Competitor 40|JPN 4151;JPN;Competitor 32|JPN 4321;JPN;Competitor 33|CAN 11;CAN;Competitor 5|AUS 7;AUS;Competitor 1|USA 1736;USA;Competitor 44|RUS 700;RUS;Competitor 38|CHN 221;CHN;Competitor 9|GBR 841;GBR;Competitor 21
CCG|W4702|7|0;StartGate;M2;M3|1;Buoy4;M4|2;Buoy5;M5|3;Buoy6;M6|4;Buoy7;M7|5;Buoy1;M1|6;FinishGate;M2;M3
CCG|W4702|7|0;StartGate;M1;M7|1;Buoy6;M6|2;LeeGate;M2;M3|3;Buoy6;M6|4;Buoy5;M6|5;FinishGate;M1;M4
@@ -315,7 +315,8 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
EventDAO event = selection.get(selection.size() - 1).getA();
RaceDAO race = selection.get(selection.size() - 1).getC();
if (event != null && race != null) {
final Triple<Map<CompetitorDAO, Date>, Map<CompetitorDAO, Date>, Map<CompetitorDAO, Boolean>> fromAndToAndOverlap = computeFromAndTo(date);
final Triple<Map<CompetitorDAO, Date>, Map<CompetitorDAO, Date>, Map<CompetitorDAO, Boolean>> fromAndToAndOverlap =
computeFromAndTo(date);
sailingService.getBoatPositions(event.name, race.name, fromAndToAndOverlap.getA(), fromAndToAndOverlap.getB(), true,
new AsyncCallback<Map<CompetitorDAO, List<GPSFixDAO>>>() {
@Override
@@ -462,11 +463,12 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
}
/**
* While updating the {@link #fixes} for <code>competitorDAO</code>, the invariants for {@link #tails}
* and {@link #firstShownFix} and {@link #lastShownFix} are maintained: each time a fix is inserted,
* the {@link #firstShownFix}/{@link #lastShownFix} records for <code>competitorDAO</code> are incremented
* if they are greater or equal to the insertion index. Additionally, if the fix is in between the fixes
* shown in the competitor's tail, the tail is adjusted by inserting the corresponding fix.
* While updating the {@link #fixes} for <code>competitorDAO</code>, the invariants for {@link #tails} and
* {@link #firstShownFix} and {@link #lastShownFix} are maintained: each time a fix is inserted, the
* {@link #firstShownFix}/{@link #lastShownFix} records for <code>competitorDAO</code> are incremented if they are
* greater or equal to the insertion index and we have a tail in {@link #tails} for <code>competitorDAO</code>.
* Additionally, if the fix is in between the fixes shown in the competitor's tail, the tail is adjusted by
* inserting the corresponding fix.
*/
private void mergeFixes(CompetitorDAO competitorDAO, List<GPSFixDAO> mergeThis) {
List<GPSFixDAO> intoThis = fixes.get(competitorDAO);
@@ -475,7 +477,8 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
Polyline tail = tails.get(competitorDAO);
int intoThisIndex = 0;
for (GPSFixDAO mergeThisFix : mergeThis) {
while (intoThisIndex < intoThis.size() && intoThis.get(intoThisIndex).timepoint.before(mergeThisFix.timepoint)) {
while (intoThisIndex < intoThis.size()
&& intoThis.get(intoThisIndex).timepoint.before(mergeThisFix.timepoint)) {
intoThisIndex++;
}
if (intoThisIndex < intoThis.size() && intoThis.get(intoThisIndex).timepoint.equals(mergeThisFix.timepoint)) {
@@ -489,7 +492,7 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
if (indexOfLastShownFix >= intoThisIndex) {
indexOfLastShownFix++;
}
if (intoThisIndex >= indexOfFirstShownFix && intoThisIndex <= indexOfLastShownFix) {
if (tail != null && intoThisIndex >= indexOfFirstShownFix && intoThisIndex <= indexOfLastShownFix) {
tail.insertVertex(intoThisIndex - indexOfFirstShownFix,
LatLng.newInstance(mergeThisFix.position.latDeg, mergeThisFix.position.lngDeg));
}
@@ -552,7 +555,7 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
map.addOverlay(tail);
} else {
updateTail(tail, competitorDAO, from, to);
competitorDAOsOfUnusedTails.remove(tail);
competitorDAOsOfUnusedTails.remove(competitorDAO);
}
LatLngBounds bounds = tail.getBounds();
if (newMapBounds == null) {