mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
Merge remote-tracking branch 'server/master'
This commit is contained in:
commit
ffc8e185b9
3 files changed
+47
-23
No files matched your search
+27
-15
@@ -41,6 +41,7 @@ import com.google.gwt.maps.client.overlay.Polyline;
|
||||
import com.google.gwt.maps.client.overlay.PolylineOptions;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.RequiresResize;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
@@ -74,7 +75,7 @@ import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class RaceMap extends SimplePanel implements TimeListener, CompetitorSelectionChangeListener, RaceSelectionChangeListener,
|
||||
Component<RaceMapSettings>, RequiresDataInitialization {
|
||||
Component<RaceMapSettings>, RequiresDataInitialization, RequiresResize {
|
||||
protected MapWidget map;
|
||||
|
||||
private final SailingServiceAsync sailingService;
|
||||
@@ -925,6 +926,9 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The last shown GPS fix for the given competitor
|
||||
*/
|
||||
protected GPSFixDTO getBoatFix(CompetitorDTO competitorDTO) {
|
||||
return fixes.get(competitorDTO).get(lastShownFix.get(competitorDTO));
|
||||
}
|
||||
@@ -1138,21 +1142,23 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
|
||||
competitors = isZoomOnlyToSelectedCompetitors() ? selectedCompetitors : forMap.getCompetitorsToShow();
|
||||
}
|
||||
for (CompetitorDTO competitor : competitors) {
|
||||
List<GPSFixDTO> competitorFixes = forMap.fixes.get(competitor);
|
||||
Integer lastShownFixForCompetitor = forMap.lastShownFix.get(competitor);
|
||||
GPSFixDTO competitorFix = competitorFixes != null && lastShownFixForCompetitor != null ? competitorFixes.get(lastShownFixForCompetitor) : null;
|
||||
PositionDTO competitorPosition = competitorFix != null ? competitorFix.position : null;
|
||||
LatLng competitorLatLng = competitorPosition != null ? LatLng.newInstance(competitorPosition.latDeg,
|
||||
competitorPosition.lngDeg) : null;
|
||||
LatLngBounds 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());
|
||||
try {
|
||||
GPSFixDTO competitorFix = forMap.getBoatFix(competitor);
|
||||
PositionDTO competitorPosition = competitorFix != null ? competitorFix.position : null;
|
||||
LatLng competitorLatLng = competitorPosition != null ? LatLng.newInstance(competitorPosition.latDeg,
|
||||
competitorPosition.lngDeg) : null;
|
||||
LatLngBounds 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());
|
||||
}
|
||||
}
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//Catch this in case the competitor has no GPS fixes at the current time (e.g. in race 'Finale 2' of STG)
|
||||
}
|
||||
}
|
||||
return newBounds;
|
||||
@@ -1214,4 +1220,10 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
|
||||
public boolean isDataInitialized() {
|
||||
return dataInitialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResize() {
|
||||
map.checkResize();
|
||||
zoomMapToNewBounds(getSettings().getZoomSettings().getNewBounds(RaceMap.this));
|
||||
}
|
||||
}
|
||||
+18
-7
@@ -55,17 +55,19 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
private ErrorReporter errorReporter;
|
||||
private LeaderboardGroupDTO group;
|
||||
private String root;
|
||||
private String viewMode;
|
||||
|
||||
private FlowPanel mainPanel;
|
||||
private Widget welcomeWidget = null;
|
||||
|
||||
public LeaderboardGroupPanel(SailingServiceAsync sailingService, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, final String groupName, String root) {
|
||||
ErrorReporter errorReporter, final String groupName, String root, String viewMode) {
|
||||
super();
|
||||
this.sailingService = sailingService;
|
||||
this.stringConstants = stringConstants;
|
||||
this.errorReporter = errorReporter;
|
||||
this.root = root;
|
||||
this.viewMode = viewMode;
|
||||
if (this.root == null || this.root.length() == 0) {
|
||||
this.root = "leaderboardGroupPanel";
|
||||
}
|
||||
@@ -187,15 +189,21 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
String displayName = race.getRaceColumnName();
|
||||
if (race.getRaceColumnName().equals(stringConstants.overview())) {
|
||||
String link = URLFactory.INSTANCE.encode("/gwt/Leaderboard.html?name=" + leaderboard.name
|
||||
+ "&leaderboardGroupName=" + group.name + "&root=" + root
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""));
|
||||
+ "&leaderboardGroupName=" + group.name + "&root=" + root);
|
||||
if(debugParam != null && !debugParam.isEmpty())
|
||||
link += "&gwt.codesvr=" + debugParam;
|
||||
if(viewMode != null && !viewMode.isEmpty())
|
||||
link += "&viewMode=" + viewMode;
|
||||
b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveLeaderboard"));
|
||||
} else {
|
||||
if (race.getRaceIdentifier() != null) {
|
||||
EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier();
|
||||
String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name + "&raceName=" + raceId.getRaceName()
|
||||
+ "&eventName=" + raceId.getEventName() + "&leaderboardGroupName=" + group.name + "&root=" + root
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""));
|
||||
+ "&eventName=" + raceId.getEventName() + "&leaderboardGroupName=" + group.name + "&root=" + root);
|
||||
if(debugParam != null && !debugParam.isEmpty())
|
||||
link += "&gwt.codesvr=" + debugParam;
|
||||
if(viewMode != null && !viewMode.isEmpty())
|
||||
link += "&viewMode=" + viewMode;
|
||||
b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveRace"));
|
||||
} else {
|
||||
b.append(TEXTTEMPLATE.textWithClass(race.getRaceColumnName(), STYLE_NAME_PREFIX + "InactiveRace"));
|
||||
@@ -213,8 +221,11 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier();
|
||||
String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name
|
||||
+ "&raceName=" + raceId.getRaceName() + "&root=" + root + raceId.getRaceName() + "&eventName="
|
||||
+ raceId.getEventName() + "&leaderboardGroupName=" + group.name
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""));
|
||||
+ raceId.getEventName() + "&leaderboardGroupName=" + group.name);
|
||||
if(debugParam != null && !debugParam.isEmpty())
|
||||
link += "&gwt.codesvr=" + debugParam;
|
||||
if(viewMode != null && !viewMode.isEmpty())
|
||||
link += "&viewMode=" + viewMode;
|
||||
b.append(ANCHORTEMPLATE.anchor(link, race.getRaceColumnName(), STYLE_NAME_PREFIX + "ActiveRace"));
|
||||
} else {
|
||||
if (!first) {
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
|
||||
public void onModuleLoad() {
|
||||
super.onModuleLoad();
|
||||
String groupParamValue = Window.Location.getParameter("leaderboardGroupName");
|
||||
String viewModeParamValue = Window.Location.getParameter("viewMode");
|
||||
final String groupName;
|
||||
if (groupParamValue == null || groupParamValue.isEmpty()) {
|
||||
groupName = null;
|
||||
@@ -52,7 +53,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
|
||||
// panelToDisplay = new LeaderboardGroupOverviewPanel(sailingService, this, stringMessages);
|
||||
Window.alert("No leaderboard group name was given.");
|
||||
} else {
|
||||
panelToDisplay = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName, root);
|
||||
panelToDisplay = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName, root, viewModeParamValue);
|
||||
LeaderboardGroupPanel groupPanel = (LeaderboardGroupPanel) panelToDisplay;
|
||||
groupPanel.setWelcomeWidget(new SimpleWelcomeWidget( stringMessages.welcomeToSailingAnalytics(),
|
||||
"Understanding what happens out on the race course isn't always easy. To help solve this challenge and" +
|
||||
|
||||
Reference in new issue
Block a user