cleanup of setting titles for all canvas overlays

This commit is contained in:
fmittag committed 2013-02-06 17:33:40 +01:00
1 parent ac2eba2ab8
commit ee59f73ebe
4 files changed
+16 -7

No files matched your search

@@ -55,6 +55,8 @@ public class CourseMarkOverlay extends CanvasOverlay {
@Override
protected void redraw(boolean force) {
if (mark != null && position != null && markImageCanvas.isImageLoaded()) {
getCanvas().setTitle(getTitle());
LatLng latLngPosition = LatLng.newInstance(position.latDeg, position.lngDeg);
// calculate canvas size
@@ -108,6 +110,10 @@ public class CourseMarkOverlay extends CanvasOverlay {
}
}
private String getTitle() {
return mark.name;
}
public boolean isShowBuoyZone() {
return showBuoyZone;
}
@@ -1047,7 +1047,6 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
protected WindSensorOverlay createWindSensorOverlay(final WindSource windSource, final WindTrackInfoDTO windTrackInfoDTO) {
final WindSensorOverlay windSensorOverlay = new WindSensorOverlay(raceMapImageManager, stringMessages);
windSensorOverlay.setWindInfo(windTrackInfoDTO, windSource);
// windSensorOverlay.setTitle(");
windSensorOverlay.getCanvas().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@@ -2,12 +2,14 @@ package com.sap.sailing.gwt.ui.shared.racemap;
/**
* Defines constants for the Z-Indexes for all race map canvas overlays to achieve the right z ordering of the layers.
* Attention: We also need to incorporate about the z-Indexes of the map markers.
* The default value of the map markers seems to be 1000.
* @author Frank
*
*/
public interface RaceMapOverlaysZIndexes {
public static int BOATS_ZINDEX = 100;
public static int COURSEMARK_ZINDEX = 200;
public static int COMPETITOR_INFO_ZINDEX = 300;
public static int WINDSENSOR_ZINDEX = 400;
public static int BOATS_ZINDEX = 1100;
public static int COURSEMARK_ZINDEX = 1200;
public static int COMPETITOR_INFO_ZINDEX = 1300;
public static int WINDSENSOR_ZINDEX = 1400;
}
@@ -64,6 +64,9 @@ public class WindSensorOverlay extends CanvasOverlay {
if (windTrackInfoDTO != null && windTrackInfoDTO.windFixes.size() > 0) {
WindDTO windDTO = windTrackInfoDTO.windFixes.get(0);
PositionDTO position = windDTO.position;
getCanvas().setTitle(getTitle(windDTO));
// Attention: sometimes there is no valid position for the wind source available -> ignore the wind in this case
if (position != null) {
double rotationDegOfWindSymbol = windDTO.dampenedTrueWindBearingDeg;
@@ -72,7 +75,6 @@ public class WindSensorOverlay extends CanvasOverlay {
Point sensorPositionInPx = getMap().convertLatLngToDivPixel(getLatLngPosition());
getPane().setWidgetPosition(getCanvas(), sensorPositionInPx.getX() - canvasWidth / 2, sensorPositionInPx.getY() - canvasHeight / 2);
// getCanvas().setTitle(title);
hasValidWind = true;
}
}
@@ -82,7 +84,7 @@ public class WindSensorOverlay extends CanvasOverlay {
getCanvas().setVisible(hasValidWind);
}
protected String getTitle(WindDTO windDTO) {
private String getTitle(WindDTO windDTO) {
String title = stringMessages.wind() + " ("+ WindSourceTypeFormatter.format(windSource, stringMessages) + "): ";
title += Math.round(windDTO.dampenedTrueWindFromDeg) + " " + stringMessages.degreesShort()+ ", ";
title += numberFormat.format(windDTO.dampenedTrueWindSpeedInKnots) + " " + stringMessages.knotsUnit();