fixed bug regarding erasing last maneuvers received from server

Change-Id: I3288685cc0e440a9d9aff16ab15ae1161c246e1b
This commit is contained in:
Axel Uhl committed 2018-07-18 15:24:42 +02:00
1 parent 3bcbbd57cc
commit 59a3431d5d
2 files changed
+23 -5

No files matched your search

@@ -118,7 +118,12 @@ public class ManeuverMarkersAndLossIndicators {
});
}
protected void removeAllManeuverMarkers() {
/**
* Removes the visualizations of maneuvers from the map. The maneuver objects as received from the server are remembered
* (see {@link #lastManeuverResult}) and may be restored by a subsequent call to {@link #showManeuvers(Map)} as it is, e.g.,
* called by {@link #updateManeuverMarkersAfterSettingsChanged()}.
*/
void removeAllManeuverMarkers() {
// clone entry set to avoid concurrent modification exception
for (final Entry<Triple<String, Date, ManeuverType>, Marker> keyAndMarker : new HashSet<>(maneuverMarkers.entrySet())) {
removeManeuverMarker(keyAndMarker.getKey(), keyAndMarker.getValue());
@@ -257,8 +262,9 @@ public class ManeuverMarkersAndLossIndicators {
}
maneuverLossLinesMap.remove(key);
}
if (maneuverLossInfoOverlayMap.remove(key) != null) {
maneuverLossInfoOverlayMap.get(key).removeFromMap();
final SmallTransparentInfoOverlay overlay;
if ((overlay=maneuverLossInfoOverlayMap.remove(key)) != null) {
overlay.removeFromMap();
}
}
@@ -401,4 +407,17 @@ public class ManeuverMarkersAndLossIndicators {
showManeuvers(lastManeuverResult);
}
}
/**
* Removes all maneuver displays from the map and also clears the structure holding the maneuvers
* last received from the server so that upon the next request to show maneuvers without a previous
* update from the server no maneuvers will be displayed.<p>
*
* @see #getAndShowManeuvers(RegattaAndRaceIdentifier, Map)
* @see #removeAllManeuverMarkers()
*/
void clearAllManeuverMarkers() {
removeAllManeuverMarkers();
lastManeuverResult = null;
}
}
@@ -1062,7 +1062,7 @@ public class RaceMap extends AbstractCompositeComponent<RaceMapSettings> impleme
if (douglasMarkers != null) {
removeAllMarkDouglasPeuckerpoints();
}
maneuverMarkersAndLossIndicators.removeAllManeuverMarkers();
maneuverMarkersAndLossIndicators.clearAllManeuverMarkers();
if (requiresCoordinateSystemUpdateWhenCoursePositionAndWindDirectionIsKnown) {
updateCoordinateSystemFromSettings();
}
@@ -1093,7 +1093,6 @@ public class RaceMap extends AbstractCompositeComponent<RaceMapSettings> impleme
}
zoomMapToNewBounds(zoomToBounds);
mapFirstZoomDone = true;
updateEstimatedDuration(raceMapDataDTO.estimatedDuration);
}
} else {