mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-07 11:32:16 +00:00
Started to use the first SliderBar to capture wind speed, TimePanel not yet working.
This commit is contained in:
1 parent
74ff8a069c
commit
1ce28489d8
8 files changed
+215
-103
No files matched your search
+12
-4
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.sap.sailing.domain.base.impl.KnotSpeedImpl;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
@@ -131,6 +132,8 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
course.add(se);
|
||||
Distance dist = nw.getDistance(se);
|
||||
Speed requiredSpeed10 = dist.inTime(600000);
|
||||
logger.info(requiredSpeed10.getKilometersPerHour() + "km/h," + requiredSpeed10.getKnots() + "kn,"
|
||||
+ requiredSpeed10.getMetersPerSecond() + "m/s");
|
||||
RectangularBoundary bd = new RectangularBoundary(nw, se);
|
||||
List<Position> lattice = bd.extractLattice(5, 5);
|
||||
|
||||
@@ -140,12 +143,15 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
lattice.add(nw);
|
||||
lattice.add(se);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// WindField wf = new WindFieldImpl(bd, params.getWindSpeed(), params.getWindBearing());
|
||||
// I am creating the WindField such as the course goes mainly against the wind (as it should)
|
||||
// and the speed of the wind would go over the course in 10 minutes (for the sake of the running time)
|
||||
WindField wf = new WindFieldImpl(bd, requiredSpeed10.getKilometersPerHour(), bd.getSouth().getDegrees());
|
||||
|
||||
//WindField wf = new WindFieldImpl(bd, requiredSpeed10.getKilometersPerHour(), bd.getSouth().getDegrees());
|
||||
KnotSpeedImpl knotSpeedImpl = new KnotSpeedImpl(params.getWindSpeed());
|
||||
WindField wf = new WindFieldImpl(bd, knotSpeedImpl.getKilometersPerHour(), bd.getSouth().getDegrees());
|
||||
|
||||
List<WindDTO> wList = new ArrayList<WindDTO>();
|
||||
|
||||
if (lattice != null) {
|
||||
@@ -182,7 +188,9 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
// WindField wf = new WindFieldImpl(bd, params.getWindSpeed(), params.getWindBearing());
|
||||
// I am creating the WindField such as the course goes mainly against the wind (as it should)
|
||||
// and the speed of the wind would go over the course in 10 minutes (for the sake of the running time)
|
||||
WindField wf = new WindFieldImpl(bd, requiredSpeed10.getKilometersPerHour(), bd.getSouth().getDegrees());
|
||||
KnotSpeedImpl knotSpeedImpl = new KnotSpeedImpl(params.getWindSpeed());
|
||||
WindField wf = new WindFieldImpl(bd, knotSpeedImpl.getKilometersPerHour(), bd.getSouth().getDegrees());
|
||||
|
||||
|
||||
PathDTO[] pathDTO = new PathDTO[1];
|
||||
List<WindDTO> path = getOptimumPath(course, wf);
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ public class WindFieldGenParamsDTO implements IsSerializable {
|
||||
private double xRes;
|
||||
private double yRes;
|
||||
|
||||
private double windSpeed;
|
||||
private double windSpeedInKnots;
|
||||
private double windBearing;
|
||||
|
||||
public PositionDTO getNorthWest() {
|
||||
@@ -43,10 +43,10 @@ public class WindFieldGenParamsDTO implements IsSerializable {
|
||||
this.yRes = yRes;
|
||||
}
|
||||
public double getWindSpeed() {
|
||||
return windSpeed;
|
||||
return windSpeedInKnots;
|
||||
}
|
||||
public void setWindSpeed(double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
this.windSpeedInKnots = windSpeed;
|
||||
}
|
||||
public double getWindBearing() {
|
||||
return windBearing;
|
||||
|
||||
+8
-4
@@ -20,10 +20,10 @@ import com.sap.sailing.gwt.ui.shared.racemap.FullCanvasOverlay;
|
||||
*/
|
||||
public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
|
||||
public LatLng startPoint = null;
|
||||
public LatLng endPoint = null;
|
||||
private Marker startMarker = null;
|
||||
private Marker endMarker = null;
|
||||
public LatLng startPoint;
|
||||
public LatLng endPoint;
|
||||
private Marker startMarker;
|
||||
private Marker endMarker;
|
||||
|
||||
private RaceCourseMapMouseMoveHandler raceCourseMapMouseMoveHandler = new RaceCourseMapMouseMoveHandler();
|
||||
|
||||
@@ -45,6 +45,10 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
|
||||
public RaceCourseCanvasOverlay() {
|
||||
super();
|
||||
startPoint = null;
|
||||
endPoint = null;
|
||||
startMarker = null;
|
||||
endMarker = null;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
||||
+152
-64
@@ -4,6 +4,8 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
@@ -18,16 +20,23 @@ import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.Panel;
|
||||
import com.google.gwt.user.client.ui.RadioButton;
|
||||
import com.google.gwt.user.client.ui.SplitLayoutPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
import com.sap.sailing.gwt.ui.client.LogoAndTitlePanel;
|
||||
import com.sap.sailing.gwt.ui.client.SimulatorServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.TimePanel;
|
||||
import com.sap.sailing.gwt.ui.client.TimePanelSettings;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.client.Timer.PlayModes;
|
||||
import com.sap.sailing.gwt.ui.shared.BoatClassDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldGenParamsDTO.WindPattern;
|
||||
import com.sap.sailing.gwt.ui.shared.controls.slider.SliderBar;
|
||||
|
||||
public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
|
||||
private FlowPanel leftPanel = new FlowPanel();
|
||||
private FlowPanel rightPanel = new FlowPanel();
|
||||
private FlowPanel leftPanel;
|
||||
private FlowPanel rightPanel;
|
||||
|
||||
private Button updateButton;
|
||||
private Button courseInputButton;
|
||||
@@ -36,30 +45,39 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
private RadioButton replayButton;
|
||||
private RadioButton windDisplayButton;
|
||||
|
||||
private WindControlParameters wControls = new WindControlParameters();
|
||||
private WindControlParameters wControls;
|
||||
|
||||
private ListBox patternSelector = new ListBox();
|
||||
private ListBox boatSelector = new ListBox();
|
||||
private ListBox patternSelector;
|
||||
private ListBox boatSelector;
|
||||
|
||||
private static Logger logger = Logger.getLogger("com.sap.sailing");
|
||||
|
||||
/**
|
||||
* Temporary place holders for parameters
|
||||
*/
|
||||
private final double windSpeed = 7.2;
|
||||
private final double windBearing = 45;
|
||||
|
||||
private SimulatorMap simulatorMap;
|
||||
private final StringMessages stringMessages;
|
||||
private final SimulatorServiceAsync simulatorSvc;
|
||||
|
||||
private class WindSpeedCapture implements ValueChangeHandler<Double> {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Double> arg0) {
|
||||
logger.info("Slider value : " + arg0.getValue());
|
||||
wControls.windSpeedInKnots = arg0.getValue();
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SimulatorMainPanel(SimulatorServiceAsync svc, StringMessages stringMessages) {
|
||||
// splitPanel = new SplitLayoutPanel();
|
||||
super();
|
||||
|
||||
this.stringMessages = stringMessages;
|
||||
this.simulatorSvc = svc;
|
||||
|
||||
leftPanel = new FlowPanel();
|
||||
rightPanel = new FlowPanel();
|
||||
wControls = new WindControlParameters(7.2, 0);
|
||||
patternSelector = new ListBox();
|
||||
boatSelector = new ListBox();
|
||||
LogoAndTitlePanel logoAndTitlePanel = new LogoAndTitlePanel(stringMessages.simulator(), stringMessages);
|
||||
logoAndTitlePanel.addStyleName("LogoAndTitlePanel");
|
||||
this.addNorth(logoAndTitlePanel, 68);
|
||||
@@ -74,7 +92,7 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
rightPanel.getElement().getStyle().setBackgroundColor("#e0e0e0");
|
||||
this.add(rightPanel);
|
||||
// rightPanel.getElement().getStyle().setFloat(Style.Float.RIGHT);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void createOptionsPanelTop() {
|
||||
@@ -98,44 +116,26 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
controlPanel.setSize("100%", "92%");
|
||||
controlPanel.setTitle("Control Settings");
|
||||
controlPanel.getElement().getStyle().setBackgroundColor(" #e0e0e0");
|
||||
String windSetup = stringMessages.wind() + " " + stringMessages.setup();
|
||||
Label windSetupLabel = new Label(windSetup);
|
||||
|
||||
controlPanel.add(windSetupLabel);
|
||||
|
||||
Label pattern = new Label(stringMessages.pattern());
|
||||
controlPanel.add(pattern);
|
||||
|
||||
simulatorSvc.getWindPatterns(new AsyncCallback<WindPattern[]>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable message) {
|
||||
Window.alert("Failed to initialize wind patterns\n" + message);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(WindPattern[] patterns) {
|
||||
for (int i = 0; i < patterns.length; ++i) {
|
||||
patternSelector.addItem(patterns[i].toString());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
controlPanel.add(patternSelector);
|
||||
createWindSetup(controlPanel);
|
||||
createSailingSetup(controlPanel);
|
||||
leftPanel.add(controlPanel);
|
||||
|
||||
}
|
||||
|
||||
private void createSailingSetup(Panel controlPanel) {
|
||||
private void createWindSetup(Panel controlPanel) {
|
||||
VerticalPanel windPanel = new VerticalPanel();
|
||||
|
||||
String sailingSetup = stringMessages.sailing() + " " + stringMessages.setup();
|
||||
Label sailingSetupLabel = new Label(sailingSetup);
|
||||
controlPanel.add(windPanel);
|
||||
windPanel.setSize("100%", "50%");
|
||||
String windSetup = stringMessages.wind() + " " + stringMessages.setup();
|
||||
Label windSetupLabel = new Label(windSetup);
|
||||
|
||||
controlPanel.add(sailingSetupLabel);
|
||||
windPanel.add(windSetupLabel);
|
||||
|
||||
Label boatClassLabel = new Label(stringMessages.boatClass());
|
||||
controlPanel.add(boatClassLabel);
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
Label pattern = new Label(stringMessages.pattern());
|
||||
hp.add(pattern);
|
||||
|
||||
simulatorSvc.getWindPatterns(new AsyncCallback<WindPattern[]>() {
|
||||
|
||||
@@ -153,8 +153,89 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
}
|
||||
|
||||
});
|
||||
controlPanel.add(patternSelector);
|
||||
leftPanel.add(controlPanel);
|
||||
hp.add(patternSelector);
|
||||
windPanel.add(hp);
|
||||
hp.setSize("80%", "10%");
|
||||
|
||||
addSlider(windPanel, stringMessages.strength(), 1, 10, new WindSpeedCapture());
|
||||
|
||||
}
|
||||
|
||||
private void addSlider(Panel parentPanel, String labelName, double minValue, double maxValue,
|
||||
final ValueChangeHandler<Double> handler) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
|
||||
Label label = new Label(labelName);
|
||||
vp.add(label);
|
||||
|
||||
final SliderBar sliderBar = new SliderBar(minValue, maxValue);
|
||||
|
||||
sliderBar.setStepSize(1, false);
|
||||
sliderBar.setNumTicks((int) (maxValue - minValue));
|
||||
sliderBar.setNumTickLabels(1);
|
||||
sliderBar.setTitle(labelName);
|
||||
sliderBar.setEnabled(true);
|
||||
sliderBar.addValueChangeHandler(handler);
|
||||
/*
|
||||
* sliderBar.addValueChangeHandler(new ValueChangeHandler<Double>() {
|
||||
*
|
||||
* @Override public void onValueChange(ValueChangeEvent<Double> arg0) { logger.info("Slider value : " +
|
||||
* arg0.getValue()); }
|
||||
*
|
||||
* });
|
||||
*/
|
||||
sliderBar.setLabelFormatter(new SliderBar.LabelFormatter() {
|
||||
@Override
|
||||
public String formatLabel(SliderBar slider, double value) {
|
||||
return String.valueOf(Math.round(value));
|
||||
}
|
||||
});
|
||||
// sliderBar.setMinValue(1.0, false);
|
||||
// sliderBar.setMaxValue(10.0, false);
|
||||
sliderBar.setCurrentValue(1.0);
|
||||
vp.add(sliderBar);
|
||||
sliderBar.setWidth("60%");
|
||||
|
||||
parentPanel.add(vp);
|
||||
vp.setWidth("80%");
|
||||
}
|
||||
|
||||
private void createSailingSetup(Panel controlPanel) {
|
||||
|
||||
VerticalPanel sailingPanel = new VerticalPanel();
|
||||
controlPanel.add(sailingPanel);
|
||||
sailingPanel.setSize("100%", "50%");
|
||||
String sailingSetup = stringMessages.sailing() + " " + stringMessages.setup();
|
||||
Label sailingSetupLabel = new Label(sailingSetup);
|
||||
|
||||
sailingPanel.add(sailingSetupLabel);
|
||||
|
||||
Label boatClassLabel = new Label(stringMessages.boatClass());
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
hp.add(boatClassLabel);
|
||||
|
||||
simulatorSvc.getBoatClasses(new AsyncCallback<BoatClassDTO[]>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable message) {
|
||||
Window.alert("Failed to initialize boat classes\n" + message);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BoatClassDTO[] boatClasses) {
|
||||
for (int i = 0; i < boatClasses.length; ++i) {
|
||||
boatSelector.addItem(boatClasses[i].toString());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
hp.add(boatSelector);
|
||||
|
||||
sailingPanel.add(hp);
|
||||
hp.setSize("80%", "10%");
|
||||
|
||||
}
|
||||
|
||||
@@ -174,17 +255,21 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
rightPanel.add(mapOptions);
|
||||
|
||||
initDisplayOptions(mapOptions);
|
||||
|
||||
|
||||
simulatorMap = new SimulatorMap(simulatorSvc, stringMessages);
|
||||
|
||||
//FlowPanel mapPanel = new FlowPanel();
|
||||
//mapPanel.setTitle("Map");
|
||||
//mapPanel.setSize("100%", "92%");
|
||||
//mapPanel.add(mapw);
|
||||
//mapw.setSize("100%", "100%");
|
||||
|
||||
simulatorMap.setSize("100%", "92%");
|
||||
|
||||
// FlowPanel mapPanel = new FlowPanel();
|
||||
// mapPanel.setTitle("Map");
|
||||
// mapPanel.setSize("100%", "92%");
|
||||
// mapPanel.add(mapw);
|
||||
// mapw.setSize("100%", "100%");
|
||||
|
||||
simulatorMap.setSize("100%", "82%");
|
||||
rightPanel.add(simulatorMap);
|
||||
|
||||
Timer timer = new Timer(PlayModes.Replay, 1000l);
|
||||
TimePanel<TimePanelSettings> timePanel = new TimePanel<TimePanelSettings>(timer, stringMessages);
|
||||
rightPanel.add(timePanel);
|
||||
}
|
||||
|
||||
private void initUpdateButton() {
|
||||
@@ -193,20 +278,23 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent arg0) {
|
||||
|
||||
if (windDisplayButton.getValue()) {
|
||||
simulatorMap.refreshView(SimulatorMap.ViewName.WINDDISPLAY, wControls);
|
||||
} else if (summaryButton.getValue()) {
|
||||
simulatorMap.refreshView(SimulatorMap.ViewName.SUMMARY, wControls);
|
||||
} else if (replayButton.getValue()) {
|
||||
simulatorMap.refreshView(SimulatorMap.ViewName.REPLAY, wControls);
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void update() {
|
||||
if (windDisplayButton.getValue()) {
|
||||
simulatorMap.refreshView(SimulatorMap.ViewName.WINDDISPLAY, wControls);
|
||||
} else if (summaryButton.getValue()) {
|
||||
simulatorMap.refreshView(SimulatorMap.ViewName.SUMMARY, wControls);
|
||||
} else if (replayButton.getValue()) {
|
||||
simulatorMap.refreshView(SimulatorMap.ViewName.REPLAY, wControls);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initCourseInputButton() {
|
||||
courseInputButton = new Button(stringMessages.startEnd());
|
||||
|
||||
|
||||
+15
-8
@@ -24,12 +24,12 @@ import com.sap.sailing.gwt.ui.shared.WindFieldGenParamsDTO;
|
||||
public class SimulatorMap extends AbsolutePanel implements RequiresDataInitialization {
|
||||
|
||||
private MapWidget mapw;
|
||||
private boolean dataInitialized = false;
|
||||
private boolean overlaysInitialized = false;
|
||||
private WindFieldGenParamsDTO windParams = new WindFieldGenParamsDTO();
|
||||
private WindFieldCanvasOverlay windFieldCanvasOverlay = null;
|
||||
private PathCanvasOverlay pathCanvasOverlay = null;
|
||||
private RaceCourseCanvasOverlay raceCourseCanvasOverlay = null;
|
||||
private boolean dataInitialized;
|
||||
private boolean overlaysInitialized;
|
||||
private WindFieldGenParamsDTO windParams;
|
||||
private WindFieldCanvasOverlay windFieldCanvasOverlay;
|
||||
private PathCanvasOverlay pathCanvasOverlay;
|
||||
private RaceCourseCanvasOverlay raceCourseCanvasOverlay;
|
||||
|
||||
private final SimulatorServiceAsync simulatorSvc;
|
||||
private final StringMessages stringMessages;
|
||||
@@ -46,7 +46,14 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
public SimulatorMap(SimulatorServiceAsync simulatorSvc, StringMessages stringMessages) {
|
||||
this.simulatorSvc = simulatorSvc;
|
||||
this.stringMessages = stringMessages;
|
||||
|
||||
dataInitialized = false;
|
||||
overlaysInitialized = false;
|
||||
windParams = new WindFieldGenParamsDTO();
|
||||
windFieldCanvasOverlay = null;
|
||||
pathCanvasOverlay = null;
|
||||
raceCourseCanvasOverlay = null;
|
||||
|
||||
initializeData();
|
||||
//createOverlays();
|
||||
}
|
||||
@@ -110,7 +117,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
windParams.setxRes(xRes);
|
||||
windParams.setyRes(yRes);
|
||||
windParams.setWindBearing(wControls.windBearing);
|
||||
windParams.setWindSpeed(wControls.windSpeed);
|
||||
windParams.setWindSpeed(wControls.windSpeedInKnots);
|
||||
|
||||
simulatorSvc.getWindField(windParams, new AsyncCallback<WindFieldDTO>() {
|
||||
@Override
|
||||
@@ -145,7 +152,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
windParams.setxRes(xRes);
|
||||
windParams.setyRes(yRes);
|
||||
windParams.setWindBearing(wControls.windBearing);
|
||||
windParams.setWindSpeed(wControls.windSpeed);
|
||||
windParams.setWindSpeed(wControls.windSpeedInKnots);
|
||||
|
||||
simulatorSvc.getPaths(windParams, new AsyncCallback<PathDTO[]>() {
|
||||
@Override
|
||||
|
||||
+5
-4
@@ -2,10 +2,11 @@ package com.sap.sailing.gwt.ui.simulator;
|
||||
|
||||
|
||||
public class WindControlParameters {
|
||||
public double windSpeed = 7.2;
|
||||
public double windBearing = 0;
|
||||
public double windSpeedInKnots;
|
||||
public double windBearing;
|
||||
|
||||
public WindControlParameters() {
|
||||
|
||||
public WindControlParameters(double speedInKnots, double bearing) {
|
||||
windSpeedInKnots = speedInKnots;
|
||||
windBearing = bearing;
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -30,18 +30,19 @@ public class WindFieldCanvasOverlay extends FullCanvasOverlay {
|
||||
protected WindFieldDTO wl;
|
||||
|
||||
/* The points where ToolTip is to be displayed */
|
||||
protected Map<ToolTip, WindDTO> windFieldPoints = new HashMap<ToolTip, WindDTO>();
|
||||
protected Map<ToolTip, WindDTO> windFieldPoints;
|
||||
protected String arrowColor = "Blue";
|
||||
protected String arrowHeadColor = "Blue";
|
||||
protected WindFieldMouseMoveHandler mmHandler = null;
|
||||
protected WindFieldMouseMoveHandler mmHandler;
|
||||
|
||||
private static Logger logger = Logger.getLogger("com.sap.sailing");
|
||||
|
||||
public WindFieldCanvasOverlay() {
|
||||
super();
|
||||
if (mmHandler == null) {
|
||||
mmHandler = new WindFieldMouseMoveHandler(getCanvas());
|
||||
}
|
||||
windFieldPoints = new HashMap<ToolTip, WindDTO>();
|
||||
|
||||
mmHandler = new WindFieldMouseMoveHandler(getCanvas());
|
||||
|
||||
mmHandler.setWindFieldPoints(windFieldPoints);
|
||||
getCanvas().addMouseMoveHandler(mmHandler);
|
||||
}
|
||||
|
||||
+14
-11
@@ -49,26 +49,29 @@ public class ToolTip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other != null) {
|
||||
ToolTip otherPoint = (ToolTip) other;
|
||||
|
||||
boolean value = (otherPoint.getX() >= this.getX() - toolTipTolerance && otherPoint.getX() <= this.getX()
|
||||
+ toolTipTolerance)
|
||||
&& (otherPoint.getY() >= this.getY() - toolTipTolerance && otherPoint.getY() <= this.getY()
|
||||
+ toolTipTolerance);
|
||||
return value;
|
||||
}
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ToolTip other = (ToolTip) obj;
|
||||
if (other.x <= x + toolTipTolerance && other.x >= x - toolTipTolerance
|
||||
&& other.y <= y + toolTipTolerance && other.y >= y - toolTipTolerance)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int) (x + y);
|
||||
return (int)x + (int)y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + x + "," + y + ")";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user