mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-24 14:38:45 +00:00
final cleanup of RaceMapSettings (removed all setters)
This commit is contained in:
+14
-4
@@ -151,16 +151,26 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna
|
||||
timer.setTime(startAnalysisDTO.timeOfStartInMilliSeconds);
|
||||
zoomTypes.add(ZoomTypes.BUOYS);
|
||||
}
|
||||
RaceMapZoomSettings raceMapZoomSettings = new RaceMapZoomSettings(zoomTypes, false);
|
||||
|
||||
AsyncActionsExecutor asyncActionsExecutor = new AsyncActionsExecutor();
|
||||
RaceMapSettings raceMapSettings = RaceMapSettings.readSettingsFromURL();
|
||||
RaceMapSettings defaultRaceMapSettings = RaceMapSettings.readSettingsFromURL();
|
||||
|
||||
final RaceMapSettings raceMapSettings = new RaceMapSettings(raceMapZoomSettings, getHelpLineSettings(),
|
||||
defaultRaceMapSettings.getTransparentHoverlines(), defaultRaceMapSettings.getHoverlineStrokeWeight(),
|
||||
startAnalysisDTO.tailLenghtInMilliseconds, defaultRaceMapSettings.isWindUp(),
|
||||
defaultRaceMapSettings.getBuoyZoneRadiusInMeters(), defaultRaceMapSettings.isShowOnlySelectedCompetitors(),
|
||||
defaultRaceMapSettings.isShowSelectedCompetitorsInfo(), defaultRaceMapSettings.isShowWindStreamletColors(),
|
||||
defaultRaceMapSettings.isShowWindStreamletOverlay(), defaultRaceMapSettings.isShowSimulationOverlay(),
|
||||
defaultRaceMapSettings.isShowMapControls(), defaultRaceMapSettings.getManeuverTypesToShow(),
|
||||
defaultRaceMapSettings.isShowDouglasPeuckerPoints());
|
||||
|
||||
|
||||
RaceTimesInfoProvider raceTimesInfoProvider = new RaceTimesInfoProvider(sailingServiceAsync,
|
||||
asyncActionsExecutor, null, Collections.singletonList(startAnalysisDTO.regattaAndRaceIdentifier), 5000l /* requestInterval */);
|
||||
raceMap = new RaceMap(new RaceMapLifecycle(StringMessages.INSTANCE), raceMapSettings, sailingServiceAsync, asyncActionsExecutor, null, timer, competitorSelectionModel,
|
||||
StringMessages.INSTANCE, startAnalysisDTO.regattaAndRaceIdentifier,
|
||||
raceMapResources, /* isSimulationEnabled */ false, /* showHeaderPanel */ true);
|
||||
raceMap.getSettings().setZoomSettings(new RaceMapZoomSettings(zoomTypes, false));
|
||||
raceMap.getSettings().setHelpLinesSettings(getHelpLineSettings());
|
||||
raceMap.getSettings().setTailLengthInMilliseconds(startAnalysisDTO.tailLenghtInMilliseconds);
|
||||
raceTimesInfoProvider.addRaceTimesInfoProviderListener(raceMap);
|
||||
raceMap.setSize("100%", "100%");
|
||||
card_map_container.getElement().getStyle().setHeight(getHeightForRaceMapInPixels(), Unit.PX);
|
||||
|
||||
+25
-34
@@ -329,7 +329,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
|
||||
private RaceMapImageManager raceMapImageManager;
|
||||
|
||||
private final RaceMapSettings settings;
|
||||
private RaceMapSettings settings;
|
||||
private final RaceMapLifecycle raceMapLifecycle;
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
@@ -557,7 +557,8 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
if (!autoZoomIn && !autoZoomOut && !orientationChangeInProgress) {
|
||||
// stop automatic zoom after a manual zoom event; automatic zoom in zoomMapToNewBounds will restore old settings
|
||||
final List<RaceMapZoomSettings.ZoomTypes> emptyList = Collections.emptyList();
|
||||
settings.setZoomSettings(new RaceMapZoomSettings(emptyList, settings.getZoomSettings().isZoomToSelectedCompetitors()));
|
||||
RaceMapZoomSettings clearedZoomSettings = new RaceMapZoomSettings(emptyList, settings.getZoomSettings().isZoomToSelectedCompetitors());
|
||||
settings = new RaceMapSettings(settings, clearedZoomSettings);
|
||||
}
|
||||
// TODO bug489 when in wind-up mode, avoid zooming out too far; perhaps zoom back in if zoomed out too far
|
||||
}
|
||||
@@ -569,7 +570,8 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
autoZoomIn = false;
|
||||
autoZoomOut = false;
|
||||
final List<RaceMapZoomSettings.ZoomTypes> emptyList = Collections.emptyList();
|
||||
settings.setZoomSettings(new RaceMapZoomSettings(emptyList, settings.getZoomSettings().isZoomToSelectedCompetitors()));
|
||||
RaceMapZoomSettings clearedZoomSettings = new RaceMapZoomSettings(emptyList, settings.getZoomSettings().isZoomToSelectedCompetitors());
|
||||
settings = new RaceMapSettings(settings, clearedZoomSettings);
|
||||
}
|
||||
});
|
||||
map.addIdleHandler(new IdleMapHandler() {
|
||||
@@ -650,7 +652,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
*/
|
||||
protected void showAdditionalControls(MapWidget map) {
|
||||
}
|
||||
|
||||
|
||||
private void setHasPolar() {
|
||||
GetPolarAction getPolar = new GetPolarAction(sailingService, raceIdentifier);
|
||||
asyncActionsExecutor.execute(getPolar, GET_POLAR_CATEGORY,
|
||||
@@ -1821,7 +1823,8 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
} else {
|
||||
map.panTo(autoZoomLatLngBounds.getCenter());
|
||||
}
|
||||
settings.setZoomSettings(new RaceMapZoomSettings(oldZoomTypesToConsiderSettings, settings.getZoomSettings().isZoomToSelectedCompetitors()));
|
||||
RaceMapZoomSettings restoredZoomSettings = new RaceMapZoomSettings(oldZoomTypesToConsiderSettings, settings.getZoomSettings().isZoomToSelectedCompetitors());
|
||||
settings = new RaceMapSettings(settings, restoredZoomSettings);
|
||||
setAutoZoomInProgress(false);
|
||||
}
|
||||
}
|
||||
@@ -2445,11 +2448,12 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
@Override
|
||||
public void updateSettings(RaceMapSettings newSettings) {
|
||||
boolean maneuverTypeSelectionChanged = false;
|
||||
boolean requiredRedraw = false;
|
||||
boolean requiresRedraw = false;
|
||||
boolean requiresUpdateCoordinateSystem = false;
|
||||
|
||||
for (ManeuverType maneuverType : ManeuverType.values()) {
|
||||
if (newSettings.isShowManeuverType(maneuverType) != settings.isShowManeuverType(maneuverType)) {
|
||||
maneuverTypeSelectionChanged = true;
|
||||
settings.showManeuverType(maneuverType, newSettings.isShowManeuverType(maneuverType));
|
||||
}
|
||||
}
|
||||
if (maneuverTypeSelectionChanged) {
|
||||
@@ -2460,65 +2464,52 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
}
|
||||
if (newSettings.isShowDouglasPeuckerPoints() != settings.isShowDouglasPeuckerPoints()) {
|
||||
if (!(timer.getPlayState() == PlayStates.Playing) && lastDouglasPeuckerResult != null && newSettings.isShowDouglasPeuckerPoints()) {
|
||||
settings.setShowDouglasPeuckerPoints(true);
|
||||
removeAllMarkDouglasPeuckerpoints();
|
||||
showMarkDouglasPeuckerPoints(lastDouglasPeuckerResult);
|
||||
} else if (!newSettings.isShowDouglasPeuckerPoints()) {
|
||||
settings.setShowDouglasPeuckerPoints(false);
|
||||
removeAllMarkDouglasPeuckerpoints();
|
||||
}
|
||||
}
|
||||
if (newSettings.getTailLengthInMilliseconds() != settings.getTailLengthInMilliseconds()) {
|
||||
settings.setTailLengthInMilliseconds(newSettings.getTailLengthInMilliseconds());
|
||||
requiredRedraw = true;
|
||||
requiresRedraw = true;
|
||||
}
|
||||
if (newSettings.getBuoyZoneRadiusInMeters() != settings.getBuoyZoneRadiusInMeters()) {
|
||||
settings.setBuoyZoneRadiusInMeters(newSettings.getBuoyZoneRadiusInMeters());
|
||||
requiredRedraw = true;
|
||||
requiresRedraw = true;
|
||||
}
|
||||
if (newSettings.isShowOnlySelectedCompetitors() != settings.isShowOnlySelectedCompetitors()) {
|
||||
settings.setShowOnlySelectedCompetitors(newSettings.isShowOnlySelectedCompetitors());
|
||||
requiredRedraw = true;
|
||||
requiresRedraw = true;
|
||||
}
|
||||
if (newSettings.isShowSelectedCompetitorsInfo() != settings.isShowSelectedCompetitorsInfo()) {
|
||||
settings.setShowSelectedCompetitorsInfo(newSettings.isShowSelectedCompetitorsInfo());
|
||||
requiredRedraw = true;
|
||||
requiresRedraw = true;
|
||||
}
|
||||
if (!newSettings.getZoomSettings().equals(settings.getZoomSettings())) {
|
||||
settings.setZoomSettings(newSettings.getZoomSettings());
|
||||
if (!settings.getZoomSettings().containsZoomType(ZoomTypes.NONE)) {
|
||||
if (!newSettings.getZoomSettings().containsZoomType(ZoomTypes.NONE)) {
|
||||
removeTransitions();
|
||||
zoomMapToNewBounds(settings.getZoomSettings().getNewBounds(this));
|
||||
zoomMapToNewBounds(newSettings.getZoomSettings().getNewBounds(this));
|
||||
}
|
||||
}
|
||||
if (!newSettings.getHelpLinesSettings().equals(settings.getHelpLinesSettings())) {
|
||||
settings.setHelpLinesSettings(newSettings.getHelpLinesSettings());
|
||||
requiredRedraw = true;
|
||||
requiresRedraw = true;
|
||||
}
|
||||
if (newSettings.isShowWindStreamletOverlay() != settings.isShowWindStreamletOverlay()) {
|
||||
settings.setShowWindStreamletOverlay(newSettings.isShowWindStreamletOverlay());
|
||||
streamletOverlay.setVisible(newSettings.isShowWindStreamletOverlay());
|
||||
}
|
||||
if (newSettings.isShowWindStreamletColors() != settings.isShowWindStreamletColors()) {
|
||||
settings.setShowWindStreamletColors(newSettings.isShowWindStreamletColors());
|
||||
streamletOverlay.setColors(newSettings.isShowWindStreamletColors());
|
||||
}
|
||||
if (newSettings.isShowSimulationOverlay() != settings.isShowSimulationOverlay()) {
|
||||
settings.setShowSimulationOverlay(newSettings.isShowSimulationOverlay());
|
||||
showSimulationOverlay(newSettings.isShowSimulationOverlay());
|
||||
}
|
||||
if (newSettings.isWindUp() != settings.isWindUp()) {
|
||||
settings.setWindUp(newSettings.isWindUp());
|
||||
requiresUpdateCoordinateSystem = true;
|
||||
requiresRedraw = true;
|
||||
}
|
||||
this.settings = newSettings;
|
||||
|
||||
if (requiresUpdateCoordinateSystem) {
|
||||
updateCoordinateSystemFromSettings();
|
||||
requiredRedraw = true;
|
||||
}
|
||||
if (newSettings.getTransparentHoverlines() != settings.getTransparentHoverlines()) {
|
||||
settings.setTransparentHoverlines(newSettings.getTransparentHoverlines());
|
||||
}
|
||||
if (newSettings.getHoverlineStrokeWeight() != settings.getHoverlineStrokeWeight()) {
|
||||
settings.setHoverlineStrokeWeight(newSettings.getHoverlineStrokeWeight());
|
||||
}
|
||||
if (requiredRedraw) {
|
||||
if (requiresRedraw) {
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
+73
-81
@@ -11,34 +11,36 @@ import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
|
||||
|
||||
public class RaceMapSettings extends AbstractSettings {
|
||||
public static final String PARAM_SHOW_MAPCONTROLS = "showMapControls";
|
||||
|
||||
private boolean showDouglasPeuckerPoints = false;
|
||||
public static final String PARAM_SHOW_COURSE_GEOMETRY = "showCourseGeometry";
|
||||
public static final String PARAM_MAP_ORIENTATION_WIND_UP = "windUp";
|
||||
|
||||
private final boolean showDouglasPeuckerPoints;
|
||||
|
||||
private final Set<ManeuverType> maneuverTypesToShow;
|
||||
|
||||
private boolean showOnlySelectedCompetitors = false;
|
||||
private final boolean showOnlySelectedCompetitors;
|
||||
|
||||
private RaceMapZoomSettings zoomSettings;
|
||||
private final RaceMapZoomSettings zoomSettings;
|
||||
|
||||
private RaceMapHelpLinesSettings helpLinesSettings;
|
||||
private final RaceMapHelpLinesSettings helpLinesSettings;
|
||||
|
||||
private boolean transparentHoverlines = false; // as discussed with Stefan on 2015-12-08
|
||||
private final boolean transparentHoverlines;
|
||||
|
||||
private int hoverlineStrokeWeight = 15; // as discussed with Stefan on 2015-12-08
|
||||
private final int hoverlineStrokeWeight;
|
||||
|
||||
private long tailLengthInMilliseconds = 100000l;
|
||||
private final long tailLengthInMilliseconds;
|
||||
|
||||
private double buoyZoneRadiusInMeters = 0.0;
|
||||
private final double buoyZoneRadiusInMeters;
|
||||
|
||||
private boolean showSelectedCompetitorsInfo = true;
|
||||
private final boolean showSelectedCompetitorsInfo;
|
||||
|
||||
private boolean showWindStreamletColors = false;
|
||||
private final boolean showWindStreamletColors;
|
||||
|
||||
private boolean showWindStreamletOverlay = false;
|
||||
private final boolean showWindStreamletOverlay;
|
||||
|
||||
private boolean showSimulationOverlay = false;
|
||||
private final boolean showSimulationOverlay;
|
||||
|
||||
private boolean showMapControls = true;
|
||||
private boolean showMapControls;
|
||||
|
||||
/**
|
||||
* If <code>true</code>, all map contents will be transformed to a water-only environment, rotating all directions /
|
||||
@@ -48,12 +50,47 @@ public class RaceMapSettings extends AbstractSettings {
|
||||
* positions to any other coordinate space that is translated and rotated compared to the original
|
||||
* coordinate space.
|
||||
*/
|
||||
private boolean windUp = false;
|
||||
private final boolean windUp;
|
||||
|
||||
public RaceMapSettings() {
|
||||
this.maneuverTypesToShow = getDefaultManeuvers();
|
||||
this.zoomSettings = new RaceMapZoomSettings();
|
||||
this.helpLinesSettings = new RaceMapHelpLinesSettings();
|
||||
|
||||
this.showDouglasPeuckerPoints = false;
|
||||
this.showOnlySelectedCompetitors = false;
|
||||
this.transparentHoverlines = false; // as discussed with Stefan on 2015-12-08
|
||||
this.hoverlineStrokeWeight = 15; // as discussed with Stefan on 2015-12-08
|
||||
this.tailLengthInMilliseconds = 100000l;
|
||||
this.buoyZoneRadiusInMeters = 0.0;
|
||||
this.showSelectedCompetitorsInfo = true;
|
||||
this.showWindStreamletColors = false;
|
||||
this.showWindStreamletOverlay = false;
|
||||
this.showSimulationOverlay = false;
|
||||
this.showMapControls = true;
|
||||
this.windUp = false;
|
||||
}
|
||||
|
||||
public RaceMapSettings(RaceMapZoomSettings zoomSettings, RaceMapHelpLinesSettings helpLinesSettings,
|
||||
boolean transparentHoverlines, int hoverlineStrokeWeight, long tailLengthInMilliseconds, boolean windUp,
|
||||
double buoyZoneRadiusInMeters, boolean showOnlySelectedCompetitors, boolean showSelectedCompetitorsInfo,
|
||||
boolean showWindStreamletColors, boolean showWindStreamletOverlay, boolean showSimulationOverlay,
|
||||
boolean showMapControls, Set<ManeuverType> maneuverTypesToShow, boolean showDouglasPeuckerPoints) {
|
||||
this.zoomSettings = zoomSettings;
|
||||
this.helpLinesSettings = helpLinesSettings;
|
||||
this.transparentHoverlines = transparentHoverlines;
|
||||
this.hoverlineStrokeWeight = hoverlineStrokeWeight;
|
||||
this.tailLengthInMilliseconds = tailLengthInMilliseconds;
|
||||
this.windUp = windUp;
|
||||
this.buoyZoneRadiusInMeters = buoyZoneRadiusInMeters;
|
||||
this.showOnlySelectedCompetitors = showOnlySelectedCompetitors;
|
||||
this.showSelectedCompetitorsInfo = showSelectedCompetitorsInfo;
|
||||
this.showWindStreamletColors = showWindStreamletColors;
|
||||
this.showWindStreamletOverlay = showWindStreamletOverlay;
|
||||
this.showSimulationOverlay = showSimulationOverlay;
|
||||
this.showMapControls = showMapControls;
|
||||
this.maneuverTypesToShow = maneuverTypesToShow;
|
||||
this.showDouglasPeuckerPoints = showDouglasPeuckerPoints;
|
||||
}
|
||||
|
||||
public RaceMapSettings(boolean showMapCcontrol) {
|
||||
@@ -62,9 +99,16 @@ public class RaceMapSettings extends AbstractSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* "Copy constructor" that produces a new settings object that equals the one passed as argument
|
||||
* copy constructor that produces a new settings object that equals the one passed as argument
|
||||
*/
|
||||
public RaceMapSettings(RaceMapSettings settings) {
|
||||
this(settings, new RaceMapZoomSettings(settings.zoomSettings.getTypesToConsiderOnZoom(), settings.zoomSettings.isZoomToSelectedCompetitors()));
|
||||
}
|
||||
|
||||
/**
|
||||
* copy constructor that produces a new settings object that equals the one passed as argument but takes the zoom settings from the second parameter
|
||||
*/
|
||||
public RaceMapSettings(RaceMapSettings settings, RaceMapZoomSettings zoomSettings) {
|
||||
this.buoyZoneRadiusInMeters = settings.buoyZoneRadiusInMeters;
|
||||
this.helpLinesSettings = new RaceMapHelpLinesSettings(settings.getHelpLinesSettings().getVisibleHelpLineTypes());
|
||||
this.transparentHoverlines = settings.transparentHoverlines;
|
||||
@@ -79,9 +123,9 @@ public class RaceMapSettings extends AbstractSettings {
|
||||
this.showMapControls = settings.showMapControls;
|
||||
this.tailLengthInMilliseconds = settings.tailLengthInMilliseconds;
|
||||
this.windUp = settings.windUp;
|
||||
this.zoomSettings = new RaceMapZoomSettings(settings.zoomSettings.getTypesToConsiderOnZoom(), settings.zoomSettings.isZoomToSelectedCompetitors());
|
||||
this.zoomSettings = zoomSettings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return 0 if the tails are not visible {@link #getTailLengthInMilliseconds()} otherwise
|
||||
*/
|
||||
@@ -97,49 +141,29 @@ public class RaceMapSettings extends AbstractSettings {
|
||||
return tailLengthInMilliseconds;
|
||||
}
|
||||
|
||||
public void setTailLengthInMilliseconds(long tailLengthInMilliseconds) {
|
||||
this.tailLengthInMilliseconds = tailLengthInMilliseconds;
|
||||
}
|
||||
|
||||
public boolean isShowDouglasPeuckerPoints() {
|
||||
return showDouglasPeuckerPoints;
|
||||
}
|
||||
|
||||
public void setShowDouglasPeuckerPoints(boolean showDouglasPeuckerPoints) {
|
||||
this.showDouglasPeuckerPoints = showDouglasPeuckerPoints;
|
||||
}
|
||||
|
||||
public boolean isShowWindStreamletOverlay() {
|
||||
return showWindStreamletOverlay;
|
||||
}
|
||||
|
||||
public void setShowWindStreamletOverlay(boolean showWindStreamletOverlay) {
|
||||
this.showWindStreamletOverlay = showWindStreamletOverlay;
|
||||
}
|
||||
|
||||
public boolean isShowWindStreamletColors() {
|
||||
return showWindStreamletColors;
|
||||
}
|
||||
|
||||
public void setShowWindStreamletColors(boolean showWindStreamletColors) {
|
||||
this.showWindStreamletColors = showWindStreamletColors;
|
||||
}
|
||||
|
||||
public boolean isShowSimulationOverlay() {
|
||||
return showSimulationOverlay;
|
||||
}
|
||||
|
||||
public void setShowSimulationOverlay(boolean showSimulationOverlay) {
|
||||
this.showSimulationOverlay = showSimulationOverlay;
|
||||
}
|
||||
|
||||
public void showManeuverType(ManeuverType maneuverType, boolean show) {
|
||||
if (show) {
|
||||
maneuverTypesToShow.add(maneuverType);
|
||||
} else {
|
||||
maneuverTypesToShow.remove(maneuverType);
|
||||
}
|
||||
}
|
||||
// public void showManeuverType(ManeuverType maneuverType, boolean show) {
|
||||
// if (show) {
|
||||
// maneuverTypesToShow.add(maneuverType);
|
||||
// } else {
|
||||
// maneuverTypesToShow.remove(maneuverType);
|
||||
// }
|
||||
// }
|
||||
|
||||
public boolean isShowManeuverType(ManeuverType maneuverType) {
|
||||
return maneuverTypesToShow.contains(maneuverType);
|
||||
@@ -149,74 +173,38 @@ public class RaceMapSettings extends AbstractSettings {
|
||||
return showOnlySelectedCompetitors;
|
||||
}
|
||||
|
||||
public void setShowOnlySelectedCompetitors(boolean showOnlySelectedCompetitors) {
|
||||
this.showOnlySelectedCompetitors = showOnlySelectedCompetitors;
|
||||
}
|
||||
|
||||
public RaceMapZoomSettings getZoomSettings() {
|
||||
return zoomSettings;
|
||||
}
|
||||
|
||||
public void setZoomSettings(RaceMapZoomSettings zoomSettings) {
|
||||
this.zoomSettings = zoomSettings;
|
||||
}
|
||||
|
||||
public RaceMapHelpLinesSettings getHelpLinesSettings() {
|
||||
return helpLinesSettings;
|
||||
}
|
||||
|
||||
public void setHelpLinesSettings(RaceMapHelpLinesSettings helpLinesSettings) {
|
||||
this.helpLinesSettings = helpLinesSettings;
|
||||
}
|
||||
|
||||
public boolean getTransparentHoverlines() {
|
||||
return this.transparentHoverlines;
|
||||
}
|
||||
|
||||
public void setTransparentHoverlines(boolean transparentHoverlines) {
|
||||
this.transparentHoverlines = transparentHoverlines;
|
||||
}
|
||||
|
||||
public int getHoverlineStrokeWeight() {
|
||||
return this.hoverlineStrokeWeight;
|
||||
}
|
||||
|
||||
public void setHoverlineStrokeWeight(int hoverlineStrokeWeight) {
|
||||
this.hoverlineStrokeWeight = hoverlineStrokeWeight;
|
||||
}
|
||||
|
||||
public boolean isShowSelectedCompetitorsInfo() {
|
||||
return showSelectedCompetitorsInfo;
|
||||
}
|
||||
|
||||
public void setShowSelectedCompetitorsInfo(boolean showSelectedCompetitorsInfo) {
|
||||
this.showSelectedCompetitorsInfo = showSelectedCompetitorsInfo;
|
||||
}
|
||||
|
||||
public double getBuoyZoneRadiusInMeters() {
|
||||
return buoyZoneRadiusInMeters;
|
||||
}
|
||||
|
||||
public void setBuoyZoneRadiusInMeters(double buoyZoneRadiusInMeters) {
|
||||
this.buoyZoneRadiusInMeters = buoyZoneRadiusInMeters;
|
||||
}
|
||||
|
||||
public boolean isWindUp() {
|
||||
return windUp;
|
||||
}
|
||||
|
||||
public void setWindUp(boolean windUp) {
|
||||
this.windUp = windUp;
|
||||
}
|
||||
|
||||
public boolean isShowMapControls() {
|
||||
return showMapControls;
|
||||
}
|
||||
|
||||
public void setShowMapControls(boolean showMapControls) {
|
||||
this.showMapControls = showMapControls;
|
||||
}
|
||||
|
||||
private HashSet<ManeuverType> getDefaultManeuvers() {
|
||||
HashSet<ManeuverType> types = new HashSet<ManeuverType>();
|
||||
types.add(ManeuverType.JIBE);
|
||||
@@ -229,4 +217,8 @@ public class RaceMapSettings extends AbstractSettings {
|
||||
final boolean showMapControls = GwtHttpRequestUtils.getBooleanParameter(PARAM_SHOW_MAPCONTROLS, true /* default */);
|
||||
return new RaceMapSettings(showMapControls);
|
||||
}
|
||||
|
||||
public Set<ManeuverType> getManeuverTypesToShow() {
|
||||
return maneuverTypesToShow;
|
||||
}
|
||||
}
|
||||
|
||||
+22
-28
@@ -257,37 +257,31 @@ public class RaceMapSettingsDialogComponent implements SettingsDialogComponent<R
|
||||
|
||||
@Override
|
||||
public RaceMapSettings getResult() {
|
||||
RaceMapSettings result = new RaceMapSettings();
|
||||
Set<ManeuverType> maneuverTypesToShow = new HashSet<ManeuverType>();
|
||||
for (Util.Pair<CheckBox, ManeuverType> p : checkboxAndManeuverType) {
|
||||
result.showManeuverType(p.getB(), p.getA().getValue());
|
||||
}
|
||||
RaceMapHelpLinesSettings helpLinesSettings = getHelpLinesSettings();
|
||||
result.setZoomSettings(getZoomSettings());
|
||||
result.setHelpLinesSettings(helpLinesSettings);
|
||||
result.setShowDouglasPeuckerPoints(showDouglasPeuckerPointsCheckBox.getValue());
|
||||
result.setShowOnlySelectedCompetitors(showOnlySelectedCompetitorsCheckBox.getValue());
|
||||
result.setShowWindStreamletOverlay(showWindStreamletOverlayCheckbox.getValue());
|
||||
result.setShowWindStreamletColors(showWindStreamletColorsCheckbox.getValue());
|
||||
result.setShowMapControls(initialSettings.isShowMapControls());
|
||||
if (isSimulationEnabled) {
|
||||
result.setShowSimulationOverlay(showSimulationOverlayCheckbox.getValue());
|
||||
} else {
|
||||
result.setShowSimulationOverlay(false);
|
||||
}
|
||||
result.setWindUp(windUpCheckbox.getValue());
|
||||
result.setShowSelectedCompetitorsInfo(showSelectedCompetitorsInfoCheckBox.getValue());
|
||||
if (helpLinesSettings.isVisible(HelpLineTypes.BOATTAILS)) {
|
||||
result.setTailLengthInMilliseconds(tailLengthBox.getValue() == null ? -1 : tailLengthBox.getValue() * 1000l);
|
||||
}
|
||||
if (helpLinesSettings.isVisible(HelpLineTypes.BUOYZONE)) {
|
||||
final Double value = buoyZoneRadiusBox.getValue();
|
||||
if (value != null) {
|
||||
result.setBuoyZoneRadiusInMeters(value);
|
||||
if (p.getA().getValue() == true) {
|
||||
maneuverTypesToShow.add(p.getB());
|
||||
}
|
||||
}
|
||||
result.setTransparentHoverlines(transparentHoverlines.getValue());
|
||||
result.setHoverlineStrokeWeight(hoverlineStrokeWeight.getValue());
|
||||
return result;
|
||||
RaceMapHelpLinesSettings helpLinesSettings = getHelpLinesSettings();
|
||||
RaceMapZoomSettings zoomSettings = getZoomSettings();
|
||||
|
||||
boolean showSimulationOverlay = isSimulationEnabled ? showSimulationOverlayCheckbox.getValue() : false;
|
||||
long tailLengthInMilliseconds = initialSettings.getTailLengthInMilliseconds();
|
||||
if (helpLinesSettings.isVisible(HelpLineTypes.BOATTAILS)) {
|
||||
tailLengthInMilliseconds = tailLengthBox.getValue() == null ? -1 : tailLengthBox.getValue() * 1000l;
|
||||
}
|
||||
|
||||
double buoyZoneRadiusInMeters = initialSettings.getBuoyZoneRadiusInMeters();
|
||||
if (helpLinesSettings.isVisible(HelpLineTypes.BUOYZONE) && buoyZoneRadiusBox.getValue() != null) {
|
||||
buoyZoneRadiusInMeters = buoyZoneRadiusBox.getValue();
|
||||
}
|
||||
|
||||
return new RaceMapSettings(zoomSettings, helpLinesSettings,
|
||||
transparentHoverlines.getValue(), hoverlineStrokeWeight.getValue(), tailLengthInMilliseconds, windUpCheckbox.getValue(),
|
||||
buoyZoneRadiusInMeters, showOnlySelectedCompetitorsCheckBox.getValue(), showSelectedCompetitorsInfoCheckBox.getValue(),
|
||||
showWindStreamletColorsCheckbox.getValue(), showWindStreamletOverlayCheckbox.getValue(), showSimulationOverlay,
|
||||
initialSettings.isShowMapControls(), maneuverTypesToShow, showDouglasPeuckerPointsCheckBox.getValue());
|
||||
}
|
||||
|
||||
private RaceMapZoomSettings getZoomSettings() {
|
||||
|
||||
+12
-13
@@ -7,7 +7,6 @@ import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
/**
|
||||
* A true north indicator that can be added as a control to the map. Clicking / tapping the control toggles
|
||||
@@ -44,18 +43,18 @@ public class TrueNorthIndicatorPanel extends FlowPanel {
|
||||
canvas.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// a bit clumsy, but there is no copy constructor on RaceMapSettings, and the RaceMapSettingsDialogComponent
|
||||
// class has all we need to clone a RaceMapSettings object, without showing it
|
||||
final RaceMapSettingsDialogComponent settingsCloner = new RaceMapSettingsDialogComponent(map.getSettings(), stringMessages, /* showViewSimulation */true);
|
||||
settingsCloner.getAdditionalWidget(new DataEntryDialog<RaceMapSettings>("dummy", "dummy", "OK", "Cancel", /* validator */null, /* callback */null) {
|
||||
@Override
|
||||
protected RaceMapSettings getResult() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
final RaceMapSettings newSettings = settingsCloner.getResult();
|
||||
newSettings.setWindUp(!newSettings.isWindUp());
|
||||
map.updateSettings(newSettings);
|
||||
RaceMapSettings oldRaceMapSettings = map.getSettings();
|
||||
boolean newWindUpSettings = !oldRaceMapSettings.isWindUp();
|
||||
|
||||
final RaceMapSettings newRaceMapSettings = new RaceMapSettings(oldRaceMapSettings.getZoomSettings(),
|
||||
oldRaceMapSettings.getHelpLinesSettings(), oldRaceMapSettings.getTransparentHoverlines(),
|
||||
oldRaceMapSettings.getHoverlineStrokeWeight(), oldRaceMapSettings.getTailLengthInMilliseconds(), newWindUpSettings,
|
||||
oldRaceMapSettings.getBuoyZoneRadiusInMeters(), oldRaceMapSettings.isShowOnlySelectedCompetitors(),
|
||||
oldRaceMapSettings.isShowSelectedCompetitorsInfo(), oldRaceMapSettings.isShowWindStreamletColors(),
|
||||
oldRaceMapSettings.isShowWindStreamletOverlay(), oldRaceMapSettings.isShowSimulationOverlay(),
|
||||
oldRaceMapSettings.isShowMapControls(), oldRaceMapSettings.getManeuverTypesToShow(),
|
||||
oldRaceMapSettings.isShowDouglasPeuckerPoints());
|
||||
map.updateSettings(newRaceMapSettings);
|
||||
}
|
||||
});
|
||||
textLabel = new Label("");
|
||||
|
||||
+23
-17
@@ -63,8 +63,6 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
|
||||
private static final String PARAM_FLEET_NAME = "fleetName";
|
||||
private static final String PARAM_SHOW_COMPETITORS = "showCompetitors";
|
||||
private static final String PARAM_PLAY = "play";
|
||||
private static final String PARAM_SHOW_COURSE_GEOMETRY = "showCourseGeometry";
|
||||
private static final String PARAM_MAP_ORIENTATION_WIND_UP = "windUp";
|
||||
|
||||
private String regattaLikeName;
|
||||
private String raceColumnName;
|
||||
@@ -89,11 +87,29 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
|
||||
|
||||
// read optional parameters
|
||||
final RaceBoardPerspectiveSettings raceboardPerspectiveSettings = RaceBoardPerspectiveSettings.readSettingsFromURL();
|
||||
final RaceMapSettings raceMapSettings = RaceMapSettings.readSettingsFromURL();
|
||||
final RaceMapSettings defaultRaceMapSettings = RaceMapSettings.readSettingsFromURL();
|
||||
final boolean showCompetitors = GwtHttpRequestUtils.getBooleanParameter(PARAM_SHOW_COMPETITORS, false /* default */);
|
||||
final boolean play = GwtHttpRequestUtils.getBooleanParameter(PARAM_PLAY, false /* default */);
|
||||
final boolean showCourseGeometry = GwtHttpRequestUtils.getBooleanParameter(PARAM_SHOW_COURSE_GEOMETRY, true /* default */);
|
||||
final boolean windUp = GwtHttpRequestUtils.getBooleanParameter(PARAM_MAP_ORIENTATION_WIND_UP, true /* default */);
|
||||
final boolean showCourseGeometry = GwtHttpRequestUtils.getBooleanParameter(RaceMapSettings.PARAM_SHOW_COURSE_GEOMETRY, true /* default */);
|
||||
final boolean windUp = GwtHttpRequestUtils.getBooleanParameter(RaceMapSettings.PARAM_MAP_ORIENTATION_WIND_UP, true /* default */);
|
||||
|
||||
RaceMapZoomSettings raceMapZoomSettings = new RaceMapZoomSettings(Arrays.asList(ZoomTypes.BUOYS), /* zoom to selection */ false);
|
||||
Set<HelpLineTypes> helpLineTypes = new HashSet<>();
|
||||
Util.addAll(defaultRaceMapSettings.getHelpLinesSettings().getVisibleHelpLineTypes(), helpLineTypes);
|
||||
if (showCourseGeometry) {
|
||||
helpLineTypes.add(HelpLineTypes.COURSEGEOMETRY);
|
||||
}
|
||||
RaceMapHelpLinesSettings raceMapHelpLinesSettings = new RaceMapHelpLinesSettings(helpLineTypes);
|
||||
|
||||
final RaceMapSettings raceMapSettings = new RaceMapSettings(raceMapZoomSettings, raceMapHelpLinesSettings,
|
||||
defaultRaceMapSettings.getTransparentHoverlines(), defaultRaceMapSettings.getHoverlineStrokeWeight(),
|
||||
defaultRaceMapSettings.getTailLengthInMilliseconds(), windUp,
|
||||
defaultRaceMapSettings.getBuoyZoneRadiusInMeters(), defaultRaceMapSettings.isShowOnlySelectedCompetitors(),
|
||||
defaultRaceMapSettings.isShowSelectedCompetitorsInfo(), defaultRaceMapSettings.isShowWindStreamletColors(),
|
||||
defaultRaceMapSettings.isShowWindStreamletOverlay(), defaultRaceMapSettings.isShowSimulationOverlay(),
|
||||
defaultRaceMapSettings.isShowMapControls(), defaultRaceMapSettings.getManeuverTypesToShow(),
|
||||
defaultRaceMapSettings.isShowDouglasPeuckerPoints());
|
||||
|
||||
sailingService.getRaceIdentifier(regattaLikeName, raceColumnName, fleetName, new AsyncCallback<RegattaAndRaceIdentifier>() {
|
||||
@Override
|
||||
public void onSuccess(final RegattaAndRaceIdentifier selectedRaceIdentifier) {
|
||||
@@ -104,7 +120,7 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDTO, BoatDTO> result) {
|
||||
createEmbeddedMap(selectedRaceIdentifier, result, raceboardPerspectiveSettings, raceMapSettings,
|
||||
showCompetitors, play, showCourseGeometry, windUp);
|
||||
showCompetitors, play);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +149,7 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
|
||||
|
||||
private void createEmbeddedMap(final RegattaAndRaceIdentifier selectedRaceIdentifier, Map<CompetitorDTO, BoatDTO> competitorBoats,
|
||||
final RaceBoardPerspectiveSettings raceboardPerspectiveSettings, final RaceMapSettings raceMapSettings,
|
||||
final boolean showCompetitors, final boolean play, final boolean showCourseGeometry, final boolean windUp) {
|
||||
final boolean showCompetitors, final boolean play) {
|
||||
final StringBuilder title = new StringBuilder(regattaLikeName);
|
||||
title.append('/');
|
||||
title.append(raceColumnName);
|
||||
@@ -184,16 +200,6 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
|
||||
map.setControls(ControlPosition.RIGHT_BOTTOM, backToLivePlayButton);
|
||||
}
|
||||
};
|
||||
final RaceMapSettings mapSettings = new RaceMapSettings(raceMap.getSettings());
|
||||
mapSettings.setZoomSettings(new RaceMapZoomSettings(Arrays.asList(ZoomTypes.BUOYS), /* zoom to selection */ false));
|
||||
if (showCourseGeometry) {
|
||||
Set<HelpLineTypes> helpLineTypes = new HashSet<>();
|
||||
Util.addAll(mapSettings.getHelpLinesSettings().getVisibleHelpLineTypes(), helpLineTypes);
|
||||
helpLineTypes.add(HelpLineTypes.COURSEGEOMETRY);
|
||||
mapSettings.setHelpLinesSettings(new RaceMapHelpLinesSettings(helpLineTypes));
|
||||
}
|
||||
mapSettings.setWindUp(windUp);
|
||||
raceMap.updateSettings(mapSettings);
|
||||
final WindChart windChart;
|
||||
if (raceboardPerspectiveSettings.isShowWindChart()) {
|
||||
windChart = new WindChart(new WindChartLifecycle(getStringMessages()), sailingService, selectedRaceIdentifier, timer,
|
||||
|
||||
Reference in New Issue
Block a user