mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-23 22:19:13 +00:00
add race course for Cardiff; add raceCourse as URL-parameter to easily define race course based on lat (deg), lng (deg), diameter(nmi);
This commit is contained in:
+53
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import com.google.gwt.canvas.dom.client.Context2d;
|
||||
import com.google.gwt.canvas.dom.client.Context2d.TextAlign;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.maps.client.MapPaneType;
|
||||
import com.google.gwt.maps.client.MapType;
|
||||
import com.google.gwt.maps.client.MapWidget;
|
||||
@@ -182,6 +183,58 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case SailingSimulatorConstants.EventX40Cardiff:
|
||||
|
||||
// TV
|
||||
cPos = LatLng.newInstance(51.444058,-3.126984);
|
||||
//currentRegArea = new RegattaArea("", cPos, 1.0, "#FFFFFF", "silver");
|
||||
currentRegArea = new RegattaArea("", cPos, 1.0, "#8DA2BD", "silver");
|
||||
regAreas.add(currentRegArea);
|
||||
|
||||
|
||||
setVisible(true);
|
||||
|
||||
regIdx = 0;
|
||||
for(RegattaArea regArea : regAreas) {
|
||||
this.drawCircleFromRadius(regIdx, regArea, 10);
|
||||
regIdx++;
|
||||
}
|
||||
|
||||
// Center of Gravity
|
||||
cPos = LatLng.newInstance(51.444058,-3.125984);
|
||||
map.panTo(cPos);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case SailingSimulatorConstants.EventDummy:
|
||||
|
||||
String raceCourseStr = this.simulatorMap.raceCourseStr.replaceAll("\"", "");
|
||||
String[] raceCourseComponents = raceCourseStr.split(",");
|
||||
double lat = NumberFormat.getDecimalFormat().parse(raceCourseComponents[0]);
|
||||
double lng = NumberFormat.getDecimalFormat().parse(raceCourseComponents[1]);
|
||||
LatLng raceCourseCenter = LatLng.newInstance(lat,lng);
|
||||
double raceCourseRadius = NumberFormat.getDecimalFormat().parse(raceCourseComponents[2]) / 2.0;
|
||||
|
||||
// TV
|
||||
currentRegArea = new RegattaArea("", raceCourseCenter, raceCourseRadius, "#8DA2BD", "silver");
|
||||
regAreas.add(currentRegArea);
|
||||
|
||||
setVisible(true);
|
||||
|
||||
regIdx = 0;
|
||||
for(RegattaArea regArea : regAreas) {
|
||||
this.drawCircleFromRadius(regIdx, regArea, 10);
|
||||
regIdx++;
|
||||
}
|
||||
|
||||
// Center of Gravity
|
||||
cPos = LatLng.newInstance(raceCourseCenter.getLatitude(),raceCourseCenter.getLongitude()-0.001);
|
||||
map.panTo(cPos);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-2
@@ -30,7 +30,7 @@ public class SimulatorEntryPoint extends AbstractEntryPoint {
|
||||
private boolean showLines = false; // show the wind lines in the wind display and replay modes.
|
||||
private char seedLines = 'b'; // seed lines at: 'b'ack, 'f'ront
|
||||
private boolean showStreamlets = true; // show the wind streamlets in the wind display and replay modes.
|
||||
|
||||
|
||||
private static Logger logger = Logger.getLogger(SimulatorEntryPoint.class.getName());
|
||||
|
||||
@Override
|
||||
@@ -52,6 +52,9 @@ public class SimulatorEntryPoint extends AbstractEntryPoint {
|
||||
} else {
|
||||
yRes = Integer.parseInt(verticalRes);
|
||||
}
|
||||
String raceCourseStr = Window.Location.getParameter("raceCourse");
|
||||
// parsing of raceCourseStr is done in SimulatorMainPanel
|
||||
|
||||
String autoUpdateStr = Window.Location.getParameter("autoUpdate");
|
||||
if (autoUpdateStr == null || autoUpdateStr.isEmpty()) {
|
||||
logger.config("Using default auto update " + autoUpdate);
|
||||
@@ -108,7 +111,7 @@ public class SimulatorEntryPoint extends AbstractEntryPoint {
|
||||
}
|
||||
}
|
||||
SimulatorMainPanel mainPanel = new SimulatorMainPanel(simulatorSvc, stringMessages, this, xRes, yRes,
|
||||
autoUpdate, mode, event, showGrid, showLines, seedLines, showArrows, showStreamlets);
|
||||
autoUpdate, mode, event, raceCourseStr, showGrid, showLines, seedLines, showArrows, showStreamlets);
|
||||
createRaceBoardInOneScreenMode(mainPanel);
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -225,7 +225,7 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
}
|
||||
|
||||
public SimulatorMainPanel(SimulatorServiceAsync svc, StringMessages stringMessages, ErrorReporter errorReporter, int xRes, int yRes, boolean autoUpdate,
|
||||
char mode, char event, boolean showGrid, boolean showLines, char seedLines, boolean showArrows, boolean showStreamlets) {
|
||||
char mode, char event, String raceCourseStr, boolean showGrid, boolean showLines, char seedLines, boolean showArrows, boolean showStreamlets) {
|
||||
|
||||
super();
|
||||
|
||||
@@ -234,7 +234,11 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
this.errorReporter = errorReporter;
|
||||
this.autoUpdate = autoUpdate;
|
||||
this.mode = mode;
|
||||
this.event = event;
|
||||
if (raceCourseStr == null) {
|
||||
this.event = event;
|
||||
} else {
|
||||
this.event = SailingSimulatorConstants.EventDummy;
|
||||
}
|
||||
this.isOmniscient = new CheckBox(this.stringMessages.omniscient(), true);
|
||||
this.isOmniscient.setValue(true);
|
||||
this.isOmniscient.addClickHandler(new ClickHandler() {
|
||||
@@ -313,7 +317,7 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
// this.addNorth(logoAndTitlePanel, 68);
|
||||
|
||||
simulatorMap = new SimulatorMap(simulatorSvc, stringMessages, errorReporter, xRes, yRes, timer, timePanel,
|
||||
windParams, busyIndicator, mode, this);
|
||||
windParams, busyIndicator, mode, raceCourseStr, this);
|
||||
simulatorMap.setSize("100%", "100%");
|
||||
|
||||
this.rightPanel.add(this.simulatorMap);
|
||||
|
||||
+3
-30
@@ -76,7 +76,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
private static Logger LOGGER = Logger.getLogger(SimulatorMap.class.getName());
|
||||
private static boolean SHOW_ONLY_PATH_POLYLINE = false;
|
||||
private char rcDirection;
|
||||
|
||||
public String raceCourseStr;
|
||||
|
||||
public enum ViewName {
|
||||
SUMMARY, REPLAY, WINDDISPLAY
|
||||
@@ -250,35 +250,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
}
|
||||
|
||||
public SimulatorMap(SimulatorServiceAsync simulatorSvc, StringMessages stringMessages, ErrorReporter errorReporter, int xRes, int yRes, Timer timer,
|
||||
WindFieldGenParamsDTO windParams, SimpleBusyIndicator busyIndicator, char mode,
|
||||
SimulatorMainPanel parent) {
|
||||
this.simulatorSvc = simulatorSvc;
|
||||
this.stringMessages = stringMessages;
|
||||
this.errorReporter = errorReporter;
|
||||
this.xRes = xRes;
|
||||
this.yRes = yRes;
|
||||
this.timer = timer;
|
||||
this.timePanel = null;
|
||||
timer.addTimeListener(this);
|
||||
this.windParams = windParams;
|
||||
this.busyIndicator = busyIndicator;
|
||||
this.mode = mode;
|
||||
this.colorPalette = new ColorPaletteGenerator();
|
||||
this.dataInitialized = false;
|
||||
this.overlaysInitialized = false;
|
||||
this.windFieldCanvasOverlay = null;
|
||||
this.windStreamletsCanvasOverlay = null;
|
||||
this.windGridCanvasOverlay = null;
|
||||
this.windLineCanvasOverlay = null;
|
||||
this.replayPathCanvasOverlays = null;
|
||||
this.raceCourseCanvasOverlay = null;
|
||||
this.timeListeners = new LinkedList<TimeListenerWithStoppingCriteria>();
|
||||
this.initializeData();
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public SimulatorMap(SimulatorServiceAsync simulatorSvc, StringMessages stringMessages, ErrorReporter errorReporter, int xRes, int yRes, Timer timer,
|
||||
TimePanel<TimePanelSettings> timePanel, WindFieldGenParamsDTO windParams, SimpleBusyIndicator busyIndicator, char mode, SimulatorMainPanel parent) {
|
||||
TimePanel<TimePanelSettings> timePanel, WindFieldGenParamsDTO windParams, SimpleBusyIndicator busyIndicator, char mode, String raceCourseStr, SimulatorMainPanel parent) {
|
||||
this.simulatorSvc = simulatorSvc;
|
||||
this.stringMessages = stringMessages;
|
||||
this.errorReporter = errorReporter;
|
||||
@@ -302,6 +274,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
this.timeListeners = new LinkedList<TimeListenerWithStoppingCriteria>();
|
||||
this.initializeData();
|
||||
this.parent = parent;
|
||||
this.raceCourseStr = raceCourseStr;
|
||||
}
|
||||
|
||||
private void loadMapsAPI() {
|
||||
|
||||
+2
@@ -9,7 +9,9 @@ public interface SailingSimulatorConstants {
|
||||
public static final char LegTypeUpwind = 'u'; // leg type: 'u'pwind
|
||||
public static final char LegTypeDownwind = 'd'; // leg type: 'd'ownwind
|
||||
|
||||
public static final char EventDummy = '0'; // used in cases where race course is defined as URL parameter
|
||||
public static final char EventKielerWoche = 'k'; // event: 'k'ieler woche
|
||||
public static final char EventTravemuenderWoche = 't'; // event: 't'ravemünder woche
|
||||
public static final char EventX40Cardiff = 'c'; // event: 'c'ardiff extreme sailing series
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user