mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
Merge remote-tracking branch 'origin/simulator' into simulator
Conflicts: java/com.sap.sailing.gwt.ui/META-INF/MANIFEST.MF java/com.sap.sailing.simulator/src/com/sap/sailing/simulator/impl/WindFieldImpl.java
This commit is contained in:
commit
2fcb2b743b
6 files changed
+134
-2
No files matched your search
+4
@@ -3,6 +3,8 @@ package com.sap.sailing.gwt.ui.client;
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldGenParamsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindLatticeDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindLatticeGenParamsDTO;
|
||||
|
||||
@@ -12,4 +14,6 @@ public interface SimulatorService extends RemoteService {
|
||||
public PositionDTO[] getRaceLocations();
|
||||
|
||||
public WindLatticeDTO getWindLatice(WindLatticeGenParamsDTO params);
|
||||
|
||||
public WindFieldDTO getWindField(WindFieldGenParamsDTO params);
|
||||
}
|
||||
+5
@@ -2,6 +2,8 @@ package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldGenParamsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindLatticeDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindLatticeGenParamsDTO;
|
||||
|
||||
@@ -12,4 +14,7 @@ public interface SimulatorServiceAsync {
|
||||
void getWindLatice(WindLatticeGenParamsDTO params,
|
||||
AsyncCallback<WindLatticeDTO> callback);
|
||||
|
||||
void getWindField(WindFieldGenParamsDTO params,
|
||||
AsyncCallback<WindFieldDTO> callback);
|
||||
|
||||
}
|
||||
+46
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
@@ -7,10 +9,20 @@ import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
import com.sap.sailing.gwt.ui.client.SimulatorService;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindFieldGenParamsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindLatticeDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindLatticeGenParamsDTO;
|
||||
import com.sap.sailing.simulator.Boundaries;
|
||||
import com.sap.sailing.simulator.BoundariesIterator;
|
||||
import com.sap.sailing.simulator.WindField;
|
||||
import com.sap.sailing.simulator.impl.RectangularBoundary;
|
||||
import com.sap.sailing.simulator.impl.WindFieldCoordinatesImpl;
|
||||
import com.sap.sailing.simulator.impl.WindFieldImpl;
|
||||
|
||||
public class SimulatorServiceImpl extends RemoteServiceServlet implements SimulatorService {
|
||||
|
||||
@@ -86,4 +98,38 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simul
|
||||
|
||||
return wl;
|
||||
}
|
||||
|
||||
|
||||
public WindFieldDTO getWindField(WindFieldGenParamsDTO params){
|
||||
|
||||
|
||||
Position nw = new DegreePosition(params.getNorthWest().latDeg, params.getNorthWest().lngDeg);
|
||||
Position se = new DegreePosition(params.getSouthEast().latDeg, params.getSouthEast().lngDeg);
|
||||
Boundaries bd = new RectangularBoundary(nw,se);
|
||||
|
||||
WindField wf = new WindFieldImpl(bd, params.getWindSpeed(), params.getWindBearing());
|
||||
|
||||
BoundariesIterator bi = wf.getBoundaries().boundariesIterator();
|
||||
bi.setHorizontalResolution(params.getxRes());
|
||||
bi.setVerticalResolution(params.getyRes());
|
||||
|
||||
List<WindDTO> wList = new ArrayList<WindDTO>();
|
||||
|
||||
while (bi.hasNext()) {
|
||||
|
||||
Wind localWind = wf.getWind(new WindFieldCoordinatesImpl(bi.next()));
|
||||
WindDTO w = new WindDTO();
|
||||
w.position.latDeg = localWind.getPosition().getLatDeg();
|
||||
w.position.lngDeg = localWind.getPosition().getLngDeg();
|
||||
w.trueWindBearingDeg = localWind.getBearing().getDegrees();
|
||||
w.trueWindSpeedInMetersPerSecond = localWind.getMetersPerSecond();
|
||||
wList.add(w);
|
||||
|
||||
}
|
||||
|
||||
WindFieldDTO wfDTO = new WindFieldDTO();
|
||||
wfDTO.setMatrix(wList);
|
||||
return wfDTO;
|
||||
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class WindFieldDTO implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private List<WindDTO> matrix;
|
||||
|
||||
public List<WindDTO> getMatrix() {
|
||||
return matrix;
|
||||
}
|
||||
public void setMatrix(List<WindDTO> matrix) {
|
||||
this.matrix = matrix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WindFieldGenParamsDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PositionDTO northWest;
|
||||
private PositionDTO southEast;
|
||||
|
||||
private double xRes;
|
||||
private double yRes;
|
||||
|
||||
private double windSpeed;
|
||||
private double windBearing;
|
||||
|
||||
public PositionDTO getNorthWest() {
|
||||
return northWest;
|
||||
}
|
||||
public void setNorthWest(PositionDTO northWest) {
|
||||
this.northWest = northWest;
|
||||
}
|
||||
public PositionDTO getSouthEast() {
|
||||
return southEast;
|
||||
}
|
||||
public void setSouthEast(PositionDTO southEast) {
|
||||
this.southEast = southEast;
|
||||
}
|
||||
public double getxRes() {
|
||||
return xRes;
|
||||
}
|
||||
public void setxRes(double xRes) {
|
||||
this.xRes = xRes;
|
||||
}
|
||||
public double getyRes() {
|
||||
return yRes;
|
||||
}
|
||||
public void setyRes(double yRes) {
|
||||
this.yRes = yRes;
|
||||
}
|
||||
public double getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
public void setWindSpeed(double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
public double getWindBearing() {
|
||||
return windBearing;
|
||||
}
|
||||
public void setWindBearing(double windBearing) {
|
||||
this.windBearing = windBearing;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -8,7 +8,6 @@ import com.sap.sailing.simulator.Boundaries;
|
||||
import com.sap.sailing.simulator.BoundariesIterator;
|
||||
import com.sap.sailing.simulator.WindField;
|
||||
import com.sap.sailing.simulator.WindFieldCoordinates;
|
||||
import com.sap.sailing.simulator.impl.RectangularBoundary;
|
||||
|
||||
public class WindFieldImpl implements WindField {
|
||||
|
||||
@@ -16,7 +15,7 @@ public class WindFieldImpl implements WindField {
|
||||
double windBearing;
|
||||
protected Boundaries boundary;
|
||||
|
||||
public WindFieldImpl(RectangularBoundary b, double windspeed, double bearing)
|
||||
public WindFieldImpl(Boundaries b, double windspeed, double bearing)
|
||||
{
|
||||
boundary = b;
|
||||
windSpeed = windspeed;
|
||||
|
||||
Reference in new issue
Block a user