mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
Displaying the 3 windpatterns as provided in the requirements.
This commit is contained in:
1 parent
8da0ab4a43
commit
bb7c30c474
7 files changed
+167
-37
No files matched your search
+2
-2
@@ -172,7 +172,7 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
List<Position> lattice = bd.extractLattice(params.getxRes(), params.getyRes());
|
||||
retreiveWindControlParameters(pattern);
|
||||
|
||||
controlParameters.windBearing = bd.getSouth().getDegrees();
|
||||
controlParameters.baseWindBearing = bd.getSouth().getDegrees();
|
||||
WindField wf = new WindFieldImpl(bd, controlParameters);
|
||||
|
||||
List<WindDTO> wList = new ArrayList<WindDTO>();
|
||||
@@ -207,7 +207,7 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
RectangularBoundary bd = new RectangularBoundary(nw, se);
|
||||
retreiveWindControlParameters(pattern);
|
||||
|
||||
controlParameters.windBearing = bd.getSouth().getDegrees();
|
||||
controlParameters.baseWindBearing = bd.getSouth().getDegrees();
|
||||
WindField wf = new WindFieldImpl(bd, controlParameters);
|
||||
|
||||
|
||||
|
||||
+4
@@ -2,10 +2,14 @@ package com.sap.sailing.gwt.ui.shared.windpattern;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternDisplayManager.WindPattern;
|
||||
|
||||
|
||||
public interface WindPatternDisplay {
|
||||
|
||||
public List<WindPatternSetting<?>> getSettings();
|
||||
|
||||
public void addSetting(WindPatternSetting<?> setting);
|
||||
|
||||
public WindPattern getWindPattern();
|
||||
}
|
||||
+9
-1
@@ -5,13 +5,16 @@ import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternDisplay;
|
||||
import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternDisplayManager.WindPattern;
|
||||
import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternSetting;
|
||||
|
||||
public class WindPatternDisplayImpl implements WindPatternDisplay, IsSerializable {
|
||||
|
||||
private WindPattern windPattern;
|
||||
private List<WindPatternSetting<?>> windPatternSettings;
|
||||
|
||||
public WindPatternDisplayImpl() {
|
||||
public WindPatternDisplayImpl(WindPattern windPattern) {
|
||||
windPattern = windPattern;
|
||||
windPatternSettings = new ArrayList<WindPatternSetting<?>>();
|
||||
}
|
||||
|
||||
@@ -24,5 +27,10 @@ public class WindPatternDisplayImpl implements WindPatternDisplay, IsSerializabl
|
||||
public void addSetting(WindPatternSetting<?> setting) {
|
||||
windPatternSettings.add(setting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindPattern getWindPattern() {
|
||||
return windPattern;
|
||||
}
|
||||
|
||||
}
|
||||
+57
-26
@@ -8,45 +8,76 @@ import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternDisplay;
|
||||
import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternDisplayManager;
|
||||
import com.sap.sailing.gwt.ui.shared.windpattern.WindPatternSetting;
|
||||
|
||||
public class WindPatternDisplayManagerImpl implements WindPatternDisplayManager {
|
||||
|
||||
|
||||
|
||||
public class WindPatternDisplayManagerImpl implements WindPatternDisplayManager {
|
||||
|
||||
public WindPatternDisplayManagerImpl() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<WindPatternDTO> getWindPatterns() {
|
||||
List<WindPatternDTO> list = new ArrayList<WindPatternDTO>();
|
||||
for (WindPattern w : WindPattern.values()) {
|
||||
list.add(new WindPatternDTO(w.name(),w.getDisplayName()));
|
||||
list.add(new WindPatternDTO(w.name(), w.getDisplayName()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindPatternDisplay getDisplay(WindPattern windPattern) {
|
||||
WindPatternDisplay display = new WindPatternDisplayImpl();
|
||||
WindPatternSetting<Double> windSpeedSetting = new WindPatternSettingSliderBar("baseSpeed", "Base Wind Speed", 1,10,1);
|
||||
display.addSetting(windSpeedSetting);
|
||||
|
||||
switch(windPattern) {
|
||||
case BLASTS :
|
||||
break;
|
||||
case OSCILLATIONS :
|
||||
WindPatternSetting<Double> noise = new WindPatternSettingSliderBar("noise", "Noise", 0,1,0);
|
||||
display.addSetting(noise);
|
||||
WindPatternSetting<String> names = new WindPatternSettingListBox("names", "Names");
|
||||
names.getValues().add("A");
|
||||
names.getValues().add("B");
|
||||
display.addSetting(names);
|
||||
break;
|
||||
case OSCILLATION_WITH_BLASTS :
|
||||
break;
|
||||
WindPatternDisplay display = new WindPatternDisplayImpl(windPattern);
|
||||
WindPatternSetting<Double> windSpeedSetting = new WindPatternSettingSliderBar("baseWindSpeed",
|
||||
"Base Wind Speed (kn)", 0, 30, 0);
|
||||
display.addSetting(windSpeedSetting);
|
||||
|
||||
switch (windPattern) {
|
||||
case BLASTS:
|
||||
addBlastParameters(display);
|
||||
break;
|
||||
case OSCILLATIONS:
|
||||
addOscillationParameters(display);
|
||||
break;
|
||||
case OSCILLATION_WITH_BLASTS:
|
||||
addOscillationParameters(display);
|
||||
break;
|
||||
}
|
||||
return display;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void addBlastParameters(WindPatternDisplay display) {
|
||||
WindPatternSetting<Double> blastProbability = new WindPatternSettingSliderBar("blastProbability",
|
||||
"Blast Probability (%)", 0, 50, 0);
|
||||
display.addSetting(blastProbability);
|
||||
WindPatternSetting<Double> maxBlastSize = new WindPatternSettingSliderBar("maxBlastSize", "Blast Size", 1, 10,
|
||||
1);
|
||||
display.addSetting(maxBlastSize);
|
||||
WindPatternSetting<Double> blastWindSpeed = new WindPatternSettingSliderBar("blastWindSpeed",
|
||||
"Average Blast Wind Speed (%)", 0, 100, 0);
|
||||
display.addSetting(blastWindSpeed);
|
||||
WindPatternSetting<Double> blastWindSpeedVar = new WindPatternSettingSliderBar("blastWindSpeedVar",
|
||||
"Blast Wind Speed Variance (%)", 0, 100, 0);
|
||||
display.addSetting(blastWindSpeedVar);
|
||||
}
|
||||
|
||||
private void addOscillationParameters(WindPatternDisplay display) {
|
||||
WindPatternSetting<Double> baseWindBearing = new WindPatternSettingSliderBar("baseWindBearing",
|
||||
"Average Wind Direction (Degrees)", 0, 360, 0);
|
||||
display.addSetting(baseWindBearing);
|
||||
WindPatternSetting<Double> frequency = new WindPatternSettingSliderBar("frequency",
|
||||
"Oscillation Frequency (per hr)", 0, 60, 0);
|
||||
display.addSetting(frequency);
|
||||
WindPatternSetting<Double> amplitude = new WindPatternSettingSliderBar("amplitude",
|
||||
"Oscillation Amplitude (Degrees)", 0, 20, 0);
|
||||
display.addSetting(amplitude);
|
||||
WindPatternSetting<Double> leftWindSpeed = new WindPatternSettingSliderBar("leftWindSpeed",
|
||||
"Wind Speed Left Side (%)", 0, 200, 0);
|
||||
display.addSetting(leftWindSpeed);
|
||||
WindPatternSetting<Double> middleWindSpeed = new WindPatternSettingSliderBar("middleWindSpeed",
|
||||
"Wind Speed Middle (%)", 0, 200, 0);
|
||||
display.addSetting(middleWindSpeed);
|
||||
WindPatternSetting<Double> rightWindSpeed = new WindPatternSettingSliderBar("rightWindSpeed",
|
||||
"Wind Speed Right Side (%)", 0, 200, 0);
|
||||
display.addSetting(rightWindSpeed);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-2
@@ -286,8 +286,10 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
FlowPanel vp = new FlowPanel();
|
||||
Label label = new Label(labelName);
|
||||
label.getElement().getStyle().setVerticalAlign(VerticalAlign.TEXT_BOTTOM);
|
||||
vp.add(label);
|
||||
label.setWordWrap(true);
|
||||
|
||||
vp.add(label);
|
||||
label.setWidth("30%");
|
||||
|
||||
final SliderBar sliderBar = new SliderBar(minValue, maxValue);
|
||||
|
||||
@@ -314,7 +316,7 @@ public class SimulatorMainPanel extends SplitLayoutPanel {
|
||||
sliderBar.getElement().getStyle().setFloat(Style.Float.RIGHT);
|
||||
sliderBar.setWidth("60%");
|
||||
sliderBar.setHeight("25px");
|
||||
|
||||
vp.setHeight("40px");
|
||||
|
||||
return vp;
|
||||
}
|
||||
|
||||
+89
-4
@@ -4,15 +4,100 @@ package com.sap.sailing.simulator;
|
||||
public class WindControlParameters {
|
||||
/**
|
||||
* Base wind speed in knots
|
||||
* Value range 0 to 30
|
||||
*/
|
||||
public Double baseSpeed;
|
||||
public Double baseWindSpeed;
|
||||
/**
|
||||
* Base average wind direction in degrees
|
||||
* Value range 0 to 360 degrees
|
||||
*/
|
||||
public Double windBearing;
|
||||
public Double baseWindBearing;
|
||||
|
||||
/**
|
||||
* Oscillation parameter frequency
|
||||
* Value range 0 to 60 per hour
|
||||
*/
|
||||
public Double frequency;
|
||||
|
||||
/**
|
||||
* Oscillation parameter amplitude
|
||||
* Value range 0 to 20 degrees
|
||||
*/
|
||||
public Double amplitude;
|
||||
|
||||
/**
|
||||
* Oscillation parameter
|
||||
* Gradient description for left side of the windfield
|
||||
* Value range 0 to 200% of baseSpeed
|
||||
*/
|
||||
public Double leftWindSpeed;
|
||||
|
||||
/**
|
||||
* Oscillation parameter
|
||||
* Gradient description for middle of the windfield
|
||||
* Value range 0 to 200% of baseSpeed
|
||||
*/
|
||||
public Double middleWindSpeed;
|
||||
|
||||
/**
|
||||
* Oscillation parameter
|
||||
* Gradient description for right of the windfield
|
||||
* Value range 0 to 200% of baseSpeed
|
||||
*/
|
||||
public Double rightWindSpeed;
|
||||
|
||||
/**
|
||||
* Blast parameter
|
||||
* probability of blast at a certain location
|
||||
* Value range 0 to 50%
|
||||
*/
|
||||
public Double blastProbability;
|
||||
|
||||
/**
|
||||
* Blast parameter
|
||||
* Maximum size of the blast, represents how many neighbouring cells it will impact
|
||||
* Value range 1 to 10
|
||||
*/
|
||||
public Double maxBlastSize;
|
||||
|
||||
/**
|
||||
* Blast parameter
|
||||
* Average blast wind speed
|
||||
* Value range 0 to 100% of baseWindSpeed
|
||||
*/
|
||||
public Double blastWindSpeed;
|
||||
|
||||
/**
|
||||
* Blast parameter
|
||||
* Variance of blast wind speed
|
||||
* Value range 0 to 100% of baseWindSpeed
|
||||
*/
|
||||
public Double blastWindSpeedVar;
|
||||
|
||||
public WindControlParameters() {
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
public WindControlParameters(double speedInKnots, double bearing) {
|
||||
baseSpeed = speedInKnots;
|
||||
windBearing = bearing;
|
||||
setDefaults();
|
||||
baseWindSpeed = speedInKnots;
|
||||
baseWindBearing = bearing;
|
||||
}
|
||||
|
||||
public void setDefaults() {
|
||||
|
||||
baseWindSpeed = 0.0;
|
||||
|
||||
baseWindBearing = 0.0;
|
||||
frequency = 0.0;
|
||||
amplitude = 0.0;
|
||||
leftWindSpeed = 0.0;
|
||||
middleWindSpeed = 0.0;
|
||||
rightWindSpeed = 0.0;
|
||||
|
||||
blastProbability = 0.0;
|
||||
maxBlastSize = 1.0;
|
||||
blastWindSpeed = 0.0;
|
||||
blastWindSpeedVar = 0.0;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -24,9 +24,9 @@ public class WindFieldImpl implements WindField {
|
||||
|
||||
@Override
|
||||
public Wind getWind(TimedPosition coordinates) {
|
||||
KnotSpeedImpl knotSpeedImpl = new KnotSpeedImpl(windParameters.baseSpeed);
|
||||
KnotSpeedImpl knotSpeedImpl = new KnotSpeedImpl(windParameters.baseWindSpeed);
|
||||
|
||||
double wBearing = windParameters.windBearing *
|
||||
double wBearing = windParameters.baseWindBearing *
|
||||
(1 + coordinates.getPosition().getDistance(boundary.getCorners().get("NorthWest")).getMeters()/boundary.getHeight().getMeters());
|
||||
SpeedWithBearing wspeed = new KilometersPerHourSpeedWithBearingImpl(knotSpeedImpl.getKilometersPerHour(), new DegreeBearingImpl(wBearing));
|
||||
|
||||
|
||||
Reference in new issue
Block a user