Merge branch 'master' into bug4476

Change-Id: I023a7a3cb55a07d69376e09deb44bb5007e87c71
This commit is contained in:
Axel Uhl committed 2018-05-01 18:54:01 +02:00
commit 3f4e351074
15 files changed
+63 -27

No files matched your search

@@ -162,7 +162,8 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna
defaultRaceMapSettings.isShowSelectedCompetitorsInfo(), defaultRaceMapSettings.isShowWindStreamletColors(),
defaultRaceMapSettings.isShowWindStreamletOverlay(), defaultRaceMapSettings.isShowSimulationOverlay(),
defaultRaceMapSettings.isShowMapControls(), defaultRaceMapSettings.getManeuverTypesToShow(),
defaultRaceMapSettings.isShowDouglasPeuckerPoints(), defaultRaceMapSettings.isShowEstimatedDuration());
defaultRaceMapSettings.isShowDouglasPeuckerPoints(), defaultRaceMapSettings.isShowEstimatedDuration(),
defaultRaceMapSettings.getStartCountDownFontSizeScaling());
RaceTimesInfoProvider raceTimesInfoProvider = new RaceTimesInfoProvider(sailingServiceAsync,
@@ -280,7 +280,7 @@ public class AutoplayHelper {
RaceMapZoomSettings autoFollowRace = new RaceMapZoomSettings(typesToConsiderOnZoom, true);
RaceMapSettings settings = new RaceMapSettings(autoFollowRace, new RaceMapHelpLinesSettings(), false, 15,
100000l, false, RaceMapSettings.DEFAULT_BUOY_ZONE_RADIUS, false, true, false, false, false, false,
RaceMapSettings.getDefaultManeuvers(), false, false);
RaceMapSettings.getDefaultManeuvers(), false, false, /* startCountDownFontSizeScaling */ 1.5);
RaceMapLifecycle raceMapLifecycle = new RaceMapLifecycle(StringMessages.INSTANCE);
final CompetitorColorProvider colorProvider = new CompetitorColorProviderImpl(currentLiveRace, competitorsAndTheirBoats);
RaceCompetitorSelectionModel competitorSelectionProvider = new RaceCompetitorSelectionModel(
@@ -2165,6 +2165,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
String unableToObtainCompetitorsAndBoatsForRaceInFleetInLeaderboard(String raceColumnName, String fleetName, String leaderboardName, String message);
String unableToObtainBoatsRegisteredWith(String leaderboardName, String message);
String importStartData();
String startCountDownFontSizeScaling();
String multiVideoURLOfIndex();
String multiVideoScan();
String multiVideoLinking();
@@ -2154,6 +2154,7 @@ filterToBoatsRegisteredOnRegatta=Filter to boats registered on regatta
unableToObtainCompetitorsAndBoatsForRaceInFleetInLeaderboard=Unable to obtain competitors and boats for race {0} in fleet {1} for leaderboard {2}: {3}
unableToObtainBoatsRegisteredWith=Unable to obtain boats registered with {0}: {1}
importStartData=Import start line pings and create race per start
startCountDownFontSizeScaling=Font scale for start count down
multiVideoURLOfIndex=Please insert the index url of the webserver
multiVideoScan=Scan index
multiVideoLinking=Multi video linking
@@ -2150,6 +2150,7 @@ filterToBoatsRegisteredOnRegatta=Nach Booten filtern, die bei der Regatta regstr
unableToObtainCompetitorsAndBoatsForRaceInFleetInLeaderboard=Teilnemer der Wettfahrt {0} in Gruppe {1} der Ergebnisliste {2} konnte nicht ermittelt werden: {3}
unableToObtainBoatsRegisteredWith=Die bei der Ergebnisliste {0} angemeldeten Boote konnten nicht ermittelt werden: {1}
importStartData=Positionen für Startlinie importieren und Rennen pro Start anlegen
startCountDownFontSizeScaling=Fontskalierung für Start-Countdown
multiVideoURLOfIndex=Bitte die url zum Index des webservers eintragen
multiVideoScan=Index durchsuchen
multiVideoLinking=Mehrere Videos hinzufügen
@@ -53,7 +53,8 @@ public class CombinedWindPanel extends FlowPanel {
oldRaceMapSettings.isShowSelectedCompetitorsInfo(), oldRaceMapSettings.isShowWindStreamletColors(),
newShowStreamletsOverlaySetting, oldRaceMapSettings.isShowSimulationOverlay(),
oldRaceMapSettings.isShowMapControls(), oldRaceMapSettings.getManeuverTypesToShow(),
oldRaceMapSettings.isShowDouglasPeuckerPoints(), oldRaceMapSettings.isShowEstimatedDuration());
oldRaceMapSettings.isShowDouglasPeuckerPoints(), oldRaceMapSettings.isShowEstimatedDuration(),
oldRaceMapSettings.getStartCountDownFontSizeScaling());
map.updateSettings(newRaceMapSettings);
}
});
@@ -1898,7 +1898,7 @@ public class RaceMap extends AbstractCompositeComponent<RaceMapSettings> impleme
.formatElapsedTime(timeToStartInMs)) : stringMessages.start();
if (countDownOverlay == null) {
countDownOverlay = new SmallTransparentInfoOverlay(map, RaceMapOverlaysZIndexes.INFO_OVERLAY_ZINDEX,
countDownText, coordinateSystem);
countDownText, coordinateSystem, getSettings().getStartCountDownFontSizeScaling());
countDownOverlay.addToMap();
} else {
countDownOverlay.setInfoText(countDownText);
@@ -2689,6 +2689,13 @@ public class RaceMap extends AbstractCompositeComponent<RaceMapSettings> impleme
if (!newSettings.isShowEstimatedDuration() && estimatedDurationOverlay != null){
estimatedDurationOverlay.removeFromParent();
}
if (newSettings.getStartCountDownFontSizeScaling() != settings.getStartCountDownFontSizeScaling()) {
if (countDownOverlay != null) {
countDownOverlay.removeFromMap();
countDownOverlay = null;
}
requiresRedraw = true;
}
this.settings = newSettings;
if (requiresUpdateCoordinateSystem) {
@@ -53,7 +53,7 @@ public class RaceMapLifecycle implements ComponentLifecycle<RaceMapSettings> {
settings.isShowOnlySelectedCompetitors(), settings.isShowSelectedCompetitorsInfo(),
settings.isShowWindStreamletColors(), settings.isShowWindStreamletOverlay(),
settings.isShowSimulationOverlay(), settings.isShowMapControls(), settings.getManeuverTypesToShow(),
settings.isShowDouglasPeuckerPoints(), settings.isShowEstimatedDuration());
settings.isShowDouglasPeuckerPoints(), settings.isShowEstimatedDuration(), settings.getStartCountDownFontSizeScaling());
}
@Override
@@ -65,6 +65,6 @@ public class RaceMapLifecycle implements ComponentLifecycle<RaceMapSettings> {
settings.isShowOnlySelectedCompetitors(), settings.isShowSelectedCompetitorsInfo(),
settings.isShowWindStreamletColors(), settings.isShowWindStreamletOverlay(),
settings.isShowSimulationOverlay(), settings.isShowMapControls(), settings.getManeuverTypesToShow(),
settings.isShowDouglasPeuckerPoints(), settings.isShowEstimatedDuration());
settings.isShowDouglasPeuckerPoints(), settings.isShowEstimatedDuration(), settings.getStartCountDownFontSizeScaling());
}
}
@@ -13,6 +13,7 @@ import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapHelpLinesSettings.Hel
import com.sap.sse.common.Util;
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
import com.sap.sse.common.settings.generic.BooleanSetting;
import com.sap.sse.common.settings.generic.DoubleSetting;
import com.sap.sse.common.settings.generic.EnumSetSetting;
import com.sap.sse.common.settings.generic.IntegerSetting;
import com.sap.sse.common.settings.generic.LongSetting;
@@ -71,6 +72,12 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
private BooleanSetting showEstimatedDuration;
/**
* The factor by which the start count down shown at one side of the start line shall be scaled compared to the
* other small info overlays such as the course geometry. Defaults to 1.0.
*/
private DoubleSetting startCountDownFontSizeScaling;
@Override
protected void addChildSettings() {
showMapControls = new BooleanSetting(PARAM_SHOW_MAPCONTROLS, this, true);
@@ -89,6 +96,7 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
maneuverTypesToShow = new EnumSetSetting<>("maneuverTypesToShow", this, getDefaultManeuvers(), ManeuverType::valueOf);
showDouglasPeuckerPoints = new BooleanSetting("showDouglasPeuckerPoints", this, false);
showEstimatedDuration = new BooleanSetting("showEstimatedDuration", this, false);
startCountDownFontSizeScaling = new DoubleSetting("startCountDownFontSizeScaling", this, 1.0);
}
public RaceMapSettings() {
@@ -99,7 +107,7 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
Distance buoyZoneRadius, Boolean showOnlySelectedCompetitors, Boolean showSelectedCompetitorsInfo,
Boolean showWindStreamletColors, Boolean showWindStreamletOverlay, Boolean showSimulationOverlay,
Boolean showMapControls, Collection<ManeuverType> maneuverTypesToShow, Boolean showDouglasPeuckerPoints,
Boolean showEstimatedDuration) {
Boolean showEstimatedDuration, Double startCountDownFontSizeScaling) {
this.zoomSettings.init(zoomSettings);
this.helpLinesSettings.init(helpLinesSettings);
this.transparentHoverlines.setValue(transparentHoverlines);
@@ -116,6 +124,7 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
this.maneuverTypesToShow.setValues(maneuverTypesToShow);
this.showDouglasPeuckerPoints.setValue(showDouglasPeuckerPoints);
this.showEstimatedDuration.setValue(showEstimatedDuration);
this.startCountDownFontSizeScaling.setValue(startCountDownFontSizeScaling);
}
public static RaceMapSettings getDefaultWithShowMapControls(boolean showMapControlls) {
@@ -145,7 +154,8 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
/* showMapControls */ showMapControls,
/* maneuverTypesToShow */ getDefaultManeuvers(),
/* showDouglasPeuckerPoints */ false,
/* showEstimatedDuration*/ false);
/* showEstimatedDuration*/ false,
/* startCountDownFontSizeScaling */ 1.0);
}
private static Set<HelpLineTypes> createHelpLineSettings(boolean showCourseGeometry) {
@@ -186,7 +196,8 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
/* showMapControls */ settings.isShowMapControls(),
/* maneuverTypesToShow */ settings.getManeuverTypesToShow(),
/* showDouglasPeuckerPoints */ settings.isShowDouglasPeuckerPoints(),
/* showEstimatedDuration */ settings.isShowEstimatedDuration());
/* showEstimatedDuration */ settings.isShowEstimatedDuration(),
/* startCountDownFontSizeScaling */ settings.getStartCountDownFontSizeScaling());
}
/**
@@ -256,6 +267,10 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
return buoyZoneRadius.isDefaultValue();
}
public double getStartCountDownFontSizeScaling() {
return startCountDownFontSizeScaling.getValue();
}
public static RaceMapSettings createSettingsWithNewBuoyZoneRadius(RaceMapSettings settings, Distance newDefaultBuoyZoneRadius) {
final RaceMapSettings newRaceMapSettings = new RaceMapSettings(
settings.getZoomSettings(), settings.getHelpLinesSettings(),
@@ -268,7 +283,8 @@ public class RaceMapSettings extends AbstractGenericSerializableSettings {
settings.isShowWindStreamletOverlay(),
settings.isShowSimulationOverlay(), settings.isShowMapControls(),
settings.getManeuverTypesToShow(),
settings.isShowDouglasPeuckerPoints(),settings.isShowEstimatedDuration());
settings.isShowDouglasPeuckerPoints(),settings.isShowEstimatedDuration(),
settings.getStartCountDownFontSizeScaling());
return newRaceMapSettings;
}
@@ -53,6 +53,7 @@ public class RaceMapSettingsDialogComponent implements SettingsDialogComponent<R
private DoubleBox buoyZoneRadiusInMetersBox;
private CheckBox transparentHoverlines;
private IntegerBox hoverlineStrokeWeight;
private DoubleBox startCountDownFontSizeScalingBox;
private boolean isSimulationEnabled;
@@ -244,6 +245,12 @@ public class RaceMapSettingsDialogComponent implements SettingsDialogComponent<R
hoverlineStrokeWeightPanel.add(hoverlineStrokeWeight);
vp.add(hoverlineStrokeWeightPanel);
HorizontalPanel startCountDownFontSizeScalingPanel = new HorizontalPanel();
Label startCountDownFontSizeScalingLabel = new Label(stringMessages.startCountDownFontSizeScaling() + ":");
startCountDownFontSizeScalingPanel.add(startCountDownFontSizeScalingLabel);
startCountDownFontSizeScalingBox = dialog.createDoubleBox(initialSettings.getStartCountDownFontSizeScaling(), 3);
startCountDownFontSizeScalingPanel.add(startCountDownFontSizeScalingBox);
vp.add(startCountDownFontSizeScalingPanel);
return vp;
}
@@ -288,17 +295,16 @@ public class RaceMapSettingsDialogComponent implements SettingsDialogComponent<R
if (helpLinesSettings.isVisible(HelpLineTypes.BOATTAILS)) {
tailLengthInMilliseconds = tailLengthBox.getValue() == null ? -1 : tailLengthBox.getValue() * 1000l;
}
Distance buoyZoneRadius = initialSettings.getBuoyZoneRadius();
if (helpLinesSettings.isVisible(HelpLineTypes.BUOYZONE) && buoyZoneRadiusInMetersBox.getValue() != null) {
buoyZoneRadius = new MeterDistance(buoyZoneRadiusInMetersBox.getValue());
}
return new RaceMapSettings(zoomSettings, helpLinesSettings,
transparentHoverlines.getValue(), hoverlineStrokeWeight.getValue(), tailLengthInMilliseconds, windUpCheckbox.getValue(),
buoyZoneRadius, showOnlySelectedCompetitorsCheckBox.getValue(), showSelectedCompetitorsInfoCheckBox.getValue(),
showWindStreamletColorsCheckbox.getValue(), showWindStreamletOverlayCheckbox.getValue(), showSimulationOverlay,
initialSettings.isShowMapControls(), maneuverTypesToShow, showDouglasPeuckerPointsCheckBox.getValue(),estimatedDuration);
initialSettings.isShowMapControls(), maneuverTypesToShow, showDouglasPeuckerPointsCheckBox.getValue(),estimatedDuration,
startCountDownFontSizeScalingBox.getValue());
}
private RaceMapZoomSettings getZoomSettings() {
@@ -33,10 +33,17 @@ public class SmallTransparentInfoOverlay extends CanvasOverlayV3 {
private int infoBoxHeight;
private int infoBoxWidth;
private double cornerRadius;
private final double fontScalingFactor;
public SmallTransparentInfoOverlay(MapWidget map, int zIndex, String infoText, CoordinateSystem coordinateSystem) {
this(map, zIndex, infoText, coordinateSystem, /* fontScalingFactor */ 1.0);
}
public SmallTransparentInfoOverlay(MapWidget map, int zIndex, String infoText, CoordinateSystem coordinateSystem, double fontScalingFactor) {
super(map, zIndex, coordinateSystem);
this.infoText = infoText;
this.fontScalingFactor = fontScalingFactor;
canvasWidth = 20;
canvasHeight = 45;
infoBoxWidth = 20;
@@ -61,10 +68,9 @@ public class SmallTransparentInfoOverlay extends CanvasOverlayV3 {
LatLng latLngPosition = coordinateSystem.toLatLng(position);
Context2d context2d = getCanvas().getContext2d();
CssColor grayTransparentColor = CssColor.make("rgba(255,255,255,0.75)");
final int fontSizeInPx = 12+2*Math.max(0, map.getZoom()-15);
final int fontSizeInPx = (int) (fontScalingFactor*(12+2*Math.max(0, map.getZoom()-15)));
final int LINE_HEIGHT = fontSizeInPx+LINE_SPACING;
context2d.setFont(""+fontSizeInPx+"px Roboto, Arial, sans-serif");
// context2d.setFont(""+fontSizeInPx+"px bold Verdana sans-serif");
double textWidth = 0;
infoBoxHeight = BOTTOM_MARGIN;
for (final String line : infoText.split("\n")) {
@@ -81,12 +87,10 @@ public class SmallTransparentInfoOverlay extends CanvasOverlayV3 {
getCanvas().setCoordinateSpaceWidth(canvasWidth);
getCanvas().setHeight(String.valueOf(canvasHeight));
getCanvas().setCoordinateSpaceHeight(canvasHeight);
// Change origin and dimensions to match true size (a stroke makes the shape a bit larger)
context2d.setFillStyle(grayTransparentColor);
drawRoundedRect(context2d, cornerRadius / 2, cornerRadius / 2, infoBoxWidth - cornerRadius, infoBoxHeight
- cornerRadius, cornerRadius);
// this translation is important for drawing lines with a real line width of 1 pixel
context2d.translate(-0.5, -0.5);
context2d.setStrokeStyle("gray");
@@ -96,10 +100,8 @@ public class SmallTransparentInfoOverlay extends CanvasOverlayV3 {
context2d.lineTo(cornerRadius / 2, canvasHeight);
context2d.stroke();
context2d.translate(0.0, 0.0);
context2d.beginPath();
context2d.setFillStyle("black");
// context2d.setFont(""+fontSizeInPx+"px bold Verdana sans-serif");
context2d.setFont(""+fontSizeInPx+"px Roboto, Arial, sans-serif");
int y = LINE_HEIGHT;
for (final String line : infoText.split("\n")) {
@@ -107,7 +109,6 @@ public class SmallTransparentInfoOverlay extends CanvasOverlayV3 {
y += LINE_HEIGHT;
}
context2d.stroke();
Point objectPositionInPx = mapProjection.fromLatLngToDivPixel(latLngPosition);
setCanvasPosition(objectPositionInPx.getX(), objectPositionInPx.getY() - canvasHeight);
}
@@ -53,7 +53,8 @@ public class TrueNorthIndicatorPanel extends FlowPanel {
oldRaceMapSettings.isShowSelectedCompetitorsInfo(), oldRaceMapSettings.isShowWindStreamletColors(),
oldRaceMapSettings.isShowWindStreamletOverlay(), oldRaceMapSettings.isShowSimulationOverlay(),
oldRaceMapSettings.isShowMapControls(), oldRaceMapSettings.getManeuverTypesToShow(),
oldRaceMapSettings.isShowDouglasPeuckerPoints(), oldRaceMapSettings.isShowEstimatedDuration());
oldRaceMapSettings.isShowDouglasPeuckerPoints(), oldRaceMapSettings.isShowEstimatedDuration(),
oldRaceMapSettings.getStartCountDownFontSizeScaling());
map.updateSettings(newRaceMapSettings);
}
});
@@ -119,7 +119,8 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
defaultRaceMapSettings.isShowSelectedCompetitorsInfo(), defaultRaceMapSettings.isShowWindStreamletColors(),
defaultRaceMapSettings.isShowWindStreamletOverlay(), defaultRaceMapSettings.isShowSimulationOverlay(),
defaultRaceMapSettings.isShowMapControls(), defaultRaceMapSettings.getManeuverTypesToShow(),
defaultRaceMapSettings.isShowDouglasPeuckerPoints(), true);
defaultRaceMapSettings.isShowDouglasPeuckerPoints(), true,
defaultRaceMapSettings.getStartCountDownFontSizeScaling());
sailingService.getRaceIdentifier(regattaLikeName, raceColumnName, fleetName, new AsyncCallback<RegattaAndRaceIdentifier>() {
@Override
@@ -63,7 +63,6 @@ public class StartAnalysisMode extends RaceBoardModeWithPerRaceCompetitors {
private void adjustMapSettings() {
RaceMap raceMap = getRaceBoardPanel().getMap();
final RaceMapSettings defaultSettings = raceMap.getLifecycle().createDefaultSettings();
final RaceMapSettings additiveSettings = new RaceMapSettings(
new RaceMapZoomSettings(Collections.singleton(ZoomTypes.BOATS), /* zoomToSelected */ false),
@@ -81,10 +80,9 @@ public class StartAnalysisMode extends RaceBoardModeWithPerRaceCompetitors {
defaultSettings.isShowMapControls(),
defaultSettings.getManeuverTypesToShow(),
defaultSettings.isShowDouglasPeuckerPoints(),
defaultSettings.isShowEstimatedDuration());
defaultSettings.isShowEstimatedDuration(),
defaultSettings.getStartCountDownFontSizeScaling());
((RaceBoardComponentContext) raceMap.getComponentContext()).addModesPatching(raceMap, additiveSettings, new OnSettingsReloadedCallback<RaceMapSettings>() {
@Override
public void onSettingsReloaded(RaceMapSettings patchedSettings) {
// try to update the settings once; the problem is the "wind up" display; it changes pan/zoom
@@ -76,7 +76,8 @@ public class WinningLanesMode extends RaceBoardModeWithPerRaceCompetitors {
defaultSettings.isShowMapControls(),
defaultSettings.getManeuverTypesToShow(),
defaultSettings.isShowDouglasPeuckerPoints(),
defaultSettings.isShowEstimatedDuration());
defaultSettings.isShowEstimatedDuration(),
defaultSettings.getStartCountDownFontSizeScaling());
((RaceBoardComponentContext) raceMap.getComponentContext()).addModesPatching(raceMap, additiveSettings, new OnSettingsReloadedCallback<RaceMapSettings>() {