extend slider for individual number of steps and floating point stepsize, e.g. 0.1; add arrow on PathCanvasOverlay for water current

This commit is contained in:
Christopher Ronnewinkel (D036654) committed 2013-01-11 19:23:01 +01:00
1 parent edea89901e
commit ef65da4c2a
14 files changed
+139 -36

No files matched your search

@@ -151,7 +151,7 @@ public class PathGeneratorDynProgForward extends PathGeneratorBase {
// grid
// steps
// Formula: sgridh ~ xscale*sgridv/tan(beatangle*pi/180)
int spatialGridsizeHorizontal = 21*5; //(41-1)*5; //(int) Math.round(2 *
int spatialGridsizeHorizontal = 23*6; //(41-1)*5; //(int) Math.round(2 *
// simulationParameters.getProperty("Djikstra.gridh[int]").intValue()); // number
// of
// horizontal
@@ -149,7 +149,7 @@ public class PolarDiagramBase implements PolarDiagram {
NavigableMap<Double,Object> wcurSpeedMap = new TreeMap<Double,Object>();
for(double wcurSpeed=0.0; wcurSpeed<=2.0; wcurSpeed+=0.1) {
for(double wcurSpeed=0.0; wcurSpeed<=2.2; wcurSpeed+=0.1) {
NavigableMap<Double,Object> wcurBearMap = new TreeMap<Double,Object>();
@@ -264,13 +264,12 @@ public class PolarDiagramBase implements PolarDiagram {
@Override
public void setCurrent(SpeedWithBearing newCurrent) {
if ((newCurrent == null)&&(extTable == null)) {
extTable = this.extendSpeedMap();
}
current = newCurrent;
current = newCurrent;
}
@@ -332,7 +331,12 @@ public class PolarDiagramBase implements PolarDiagram {
@Override
public SpeedWithBearing getSpeedAtBearingOverGround(Bearing bearing) {
if (current == null) {
// TODO: check this new initialization, maybe keep previous current and reset current at end
/*if (extTable == null) {
extTable = this.extendSpeedMap();
}*/
if ((current == null)||(current.getKnots() == 0.0)) {
return getSpeedAtBearingRaw(bearing);
@@ -21,8 +21,10 @@ import java.util.logging.Logger;
import org.osgi.framework.FrameworkUtil;
import com.sap.sailing.domain.base.impl.KnotSpeedWithBearingImpl;
import com.sap.sailing.domain.base.impl.MeterDistance;
import com.sap.sailing.domain.common.Position;
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
import com.sap.sailing.simulator.Boundary;
import com.sap.sailing.simulator.Path;
import com.sap.sailing.simulator.PathGenerator;
@@ -126,9 +128,9 @@ public class SailingSimulatorImpl implements SailingSimulator {
logger.info("base wind: "+this.simulationParameters.getBoatPolarDiagram().getWind().getKnots()+" kn, "+((wf.getWindParameters().baseWindBearing)%360.0)+"°");
// set water current
// TODO: nicer initialize of polar diagram interpolate table
//this.simulationParameters.getBoatPolarDiagram().setCurrent(null); // initialize
//this.simulationParameters.getBoatPolarDiagram().setCurrent(new KnotSpeedWithBearingImpl(1.0,new DegreeBearingImpl((wf.getWindParameters().baseWindBearing+90.0)%360.0)));
this.simulationParameters.getBoatPolarDiagram().setCurrent(null); // initialize
//this.simulationParameters.getBoatPolarDiagram().setCurrent(new KnotSpeedWithBearingImpl(0.0,new DegreeBearingImpl((wf.getWindParameters().baseWindBearing+90.0)%360.0)));
this.simulationParameters.getBoatPolarDiagram().setCurrent(new KnotSpeedWithBearingImpl(wf.getWindParameters().curSpeed, new DegreeBearingImpl(wf.getWindParameters().curBearing)));
//this.simulationParameters.getBoatPolarDiagram().setCurrent(new KnotSpeedWithBearingImpl(2.0,new DegreeBearingImpl((270.0)%360.0)));
if (this.simulationParameters.getBoatPolarDiagram().getCurrent() != null) {
logger.info("water current: "+this.simulationParameters.getBoatPolarDiagram().getCurrent().getKnots()+" kn, "+this.simulationParameters.getBoatPolarDiagram().getCurrent().getBearing().getDegrees()+"°");
@@ -19,6 +19,17 @@ public class WindControlParameters implements Serializable {
* Value range 0 to 360 degrees
*/
public Double baseWindBearing;
/**
* Base wind speed in knots
* Value range 0 to 30
*/
public Double curSpeed;
/**
* Base average wind direction in degrees
* Value range 0 to 360 degrees
*/
public Double curBearing;
/**
* Oscillation parameter frequency
@@ -106,6 +117,9 @@ public class WindControlParameters implements Serializable {
baseWindSpeed = 12.0;
curSpeed = 0.0;
curBearing = 0.0;
baseWindBearing = 0.0;
frequency = 0.0; //30.0;
amplitude = 15.0;