Merge branch 'master' into spectator

This commit is contained in:
Lennart Hensler committed 2012-02-21 15:44:33 +01:00
commit 77dd970281
1 file changed
+3 -77
@@ -499,87 +499,14 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
private void zoomMapToNewBounds(LatLngBounds newBounds) {
if (newBounds != null) {
boolean oldMapZoomedOrPannedSinceLastRaceSelectionChange = mapZoomedOrPannedSinceLastRaceSelectionChange;
map.setZoomLevel(map.getBoundsZoomLevel(newBounds));
map.setCenter(newBounds.getCenter());
map.checkResizeAndCenter();
mapZoomedOrPannedSinceLastRaceSelectionChange = oldMapZoomedOrPannedSinceLastRaceSelectionChange;
}
}
/**
* Calculates the new map bounds for the given data considering the current {@link ZoomTypes} of the map.
* @return The new map bounds
*/
// private LatLngBounds getNewMapBounds(Iterable<CompetitorDTO> competitorsToZoom, Iterable<MarkDTO> marksToZoom) {
// LatLngBounds newBounds = null;
// if (getSettings().getZoomSetting() != ZoomTypes.MANUAL) {
// //Extend bounds for the boats
// if (getSettings().getZoomSetting() == ZoomTypes.ZOOM_TO_BOATS
// || getSettings().getZoomSetting() == ZoomTypes.ZOOM_TO_BOATS_AND_BUOYS) {
// LatLngBounds boatBounds = getBoundsForBoats(competitorsToZoom);
// if (boatBounds != null) {
// newBounds = boatBounds;
// }
// }
// //Extend bounds for the marks
// if (getSettings().getZoomSetting() == ZoomTypes.ZOOM_TO_BUOYS
// || getSettings().getZoomSetting() == ZoomTypes.ZOOM_TO_BOATS_AND_BUOYS) {
// LatLngBounds markBounds = getBoundsForMarks(marksToZoom);
// if (markBounds != null) {
// if (newBounds == null) {
// newBounds = markBounds;
// } else {
// newBounds.extend(markBounds.getNorthEast());
// newBounds.extend(markBounds.getSouthWest());
// }
// }
// }
// }
// return newBounds;
// }
// private LatLngBounds getBoundsForBoats(Iterable<CompetitorDTO> competitorsToZoom) {
// LatLngBounds newBounds = null;
// for (CompetitorDTO competitorDTO : competitorsToZoom) {
// LatLngBounds bounds = null;
// if (getSettings().isIncludeTailsToAutoZoom()) {
// Polyline tail = tails.get(competitorDTO);
// bounds = tail != null ? tail.getBounds() : null;
// } else {
// List<GPSFixDTO> competitorFixes = fixes.get(competitorDTO);
// GPSFixDTO competitorFix = competitorFixes != null ? competitorFixes.get(competitorFixes.size() - 1) : null;
// PositionDTO competitorPosition = competitorFix != null ? competitorFix.position : null;
// LatLng competitorLatLng = competitorPosition != null ? LatLng.newInstance(competitorPosition.latDeg, competitorPosition.lngDeg) : null;
// bounds = competitorLatLng != null ? LatLngBounds.newInstance(competitorLatLng, competitorLatLng) : null;
// }
// if (bounds != null) {
// if (newBounds == null) {
// newBounds = bounds;
// } else {
// newBounds.extend(bounds.getNorthEast());
// newBounds.extend(bounds.getSouthWest());
// }
// }
// }
// return newBounds;
// }
// private LatLngBounds getBoundsForMarks(Iterable<MarkDTO> marksToZoom) {
// LatLngBounds newBounds = null;
// if (marksToZoom != null) {
// for (MarkDTO markDTO : marksToZoom) {
// LatLng markLatLng = LatLng.newInstance(markDTO.position.latDeg, markDTO.position.lngDeg);
// LatLngBounds bounds = LatLngBounds.newInstance(markLatLng, markLatLng);
// if (newBounds == null) {
// newBounds = bounds;
// } else {
// newBounds.extend(bounds.getNorthEast());
// newBounds.extend(bounds.getSouthWest());
// }
// }
// }
// return newBounds;
// }
private boolean updateMarkerForCompetitor(CompetitorDTO competitorDTO) {
boolean usedExistingMarker = false;
if (lastShownFix.containsKey(competitorDTO) && lastShownFix.get(competitorDTO) != -1) {
@@ -1235,8 +1162,7 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
if (newBounds == null) {
newBounds = bounds;
} else {
newBounds.extend(bounds.getNorthEast());
newBounds.extend(bounds.getSouthWest());
newBounds.extend(markLatLng);
}
}
}