Merge remote-tracking branch 'origin/master'

This commit is contained in:
fmittag
2012-03-28 13:37:21 +02:00
4 changed files with 13 additions and 23 deletions
@@ -1,15 +1,9 @@
package com.sap.sailing.gwt.ui.adminconsole;
public abstract class LatLngBoundsCalculaterForSelected implements LatLngBoundsCalculator {
private boolean zoomOnlyToSelectedCompetitors;
public void setZoomOnlyToSelectedCompetitors(boolean zoomOnlyToSelectedCompetitors) {
this.zoomOnlyToSelectedCompetitors = zoomOnlyToSelectedCompetitors;
}
public boolean isZoomOnlyToSelectedCompetitors() {
return zoomOnlyToSelectedCompetitors;
public boolean isZoomOnlyToSelectedCompetitors(RaceMap forMap) {
return forMap.getSettings().getZoomSettings().isZoomToSelectedCompetitors();
}
}
@@ -1353,7 +1353,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
if (selectedCompetitors == null || !selectedCompetitors.iterator().hasNext()) {
competitors = forMap.getCompetitorsToShow();
} else {
competitors = isZoomOnlyToSelectedCompetitors() ? selectedCompetitors : forMap.getCompetitorsToShow();
competitors = isZoomOnlyToSelectedCompetitors(forMap) ? selectedCompetitors : forMap.getCompetitorsToShow();
}
for (CompetitorDTO competitor : competitors) {
try {
@@ -1386,7 +1386,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
@Override
public LatLngBounds calculateNewBounds(RaceMap forMap) {
LatLngBounds newBounds = null;
Iterable<CompetitorDTO> competitors = isZoomOnlyToSelectedCompetitors() ? forMap.competitorSelection.getSelectedCompetitors() : forMap.getCompetitorsToShow();
Iterable<CompetitorDTO> competitors = isZoomOnlyToSelectedCompetitors(forMap) ? forMap.competitorSelection.getSelectedCompetitors() : forMap.getCompetitorsToShow();
for (CompetitorDTO competitor : competitors) {
Polyline tail = forMap.tails.get(competitor);
LatLngBounds bounds = tail != null ? tail.getBounds() : null;
@@ -54,12 +54,6 @@ public class RaceMapZoomSettings {
LatLngBounds newBounds = null;
if (typesToConsiderOnZoom != null) {
for (ZoomTypes type : typesToConsiderOnZoom) {
//Set the forSelected attribute for the corresponding calculaters
if (type.calculater instanceof LatLngBoundsCalculaterForSelected) {
((LatLngBoundsCalculaterForSelected) type.calculater)
.setZoomOnlyToSelectedCompetitors(zoomToSelectedCompetitors);
}
//Calculate the new bounds and extend the result
LatLngBounds calculatedBounds = type.calculateNewBounds(forMap);
if (calculatedBounds != null) {
@@ -329,12 +329,6 @@ public class WindChart extends SimpleChartPanel implements Component<WindChartSe
if (timeOfLatestRequestInMillis == null || wind.timepoint>timeOfLatestRequestInMillis) {
timeOfLatestRequestInMillis = wind.timepoint;
}
if (directionMax == null || wind.dampenedTrueWindFromDeg > directionMax) {
directionMax = wind.dampenedTrueWindFromDeg;
}
if (directionMin == null || wind.dampenedTrueWindFromDeg < directionMin) {
directionMin = wind.dampenedTrueWindFromDeg;
}
Point newDirectionPoint = new Point(wind.timepoint, wind.dampenedTrueWindFromDeg);
if (wind.dampenedTrueWindSpeedInKnots != null) {
@@ -343,6 +337,14 @@ public class WindChart extends SimpleChartPanel implements Component<WindChartSe
newDirectionPoint = recalculateDirectionPoint(directionMax, directionMin, newDirectionPoint);
directionPoints[i] = newDirectionPoint;
double direction = newDirectionPoint.getY().doubleValue();
if (directionMax == null || direction > directionMax) {
directionMax = direction;
}
if (directionMin == null || direction < directionMin) {
directionMin = direction;
}
Point newSpeedPoint = new Point(wind.timepoint, wind.dampenedTrueWindSpeedInKnots);
speedPoints[i++] = newSpeedPoint;
}
@@ -374,7 +376,7 @@ public class WindChart extends SimpleChartPanel implements Component<WindChartSe
double y = directionPoint.getY().doubleValue();
boolean recalculated = false;
if (yMax != null && yMin != null && (y <= yMin || yMax <= y)) {
if (yMax != null && yMin != null && (y < yMin || yMax < y)) {
double deltaMin = Math.abs(yMin - y);
double deltaMax = Math.abs(yMax - y);