mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-23 22:19:13 +00:00
add slider resolution to support entering values intermediate to slider tickmarks;
This commit is contained in:
+2
-2
@@ -476,6 +476,7 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
double minValue = (Double) s.getMin();
|
||||
double maxValue = (Double) s.getMax();
|
||||
double defaultValue = (Double) s.getDefault();
|
||||
double stepSize = (Double) s.getResolution();
|
||||
|
||||
FlowPanel vp = new FlowPanel();
|
||||
vp.getElement().setClassName("sliderWrapper");
|
||||
@@ -489,8 +490,7 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
|
||||
sliderBar.getElement().getStyle().setProperty("width", "216px");
|
||||
|
||||
//sliderBar.setStepSize(Math.round((maxValue - minValue) / 10.), false);
|
||||
sliderBar.setStepSize(((maxValue - minValue) / (s.getSteps()) ), false);
|
||||
sliderBar.setStepSize(stepSize, false);
|
||||
sliderBar.setNumTicks(s.getSteps());
|
||||
sliderBar.setNumTickLabels(1);
|
||||
|
||||
|
||||
+3
-1
@@ -18,7 +18,9 @@ public interface WindPatternSetting<SettingsType> extends Named {
|
||||
|
||||
public SettingsType getMax();
|
||||
|
||||
public SettingsType getDefault();
|
||||
public SettingsType getResolution();
|
||||
|
||||
public SettingsType getDefault();
|
||||
|
||||
public int getSteps();
|
||||
|
||||
|
||||
+19
-19
@@ -62,69 +62,69 @@ public class WindPatternDisplayManagerImpl implements WindPatternDisplayManager
|
||||
private void addBlastParameters(WindPatternDisplay display) {
|
||||
if (mode == SailingSimulatorConstants.ModeEvent) {
|
||||
WindPatternSetting<Double> windBearingSetting = new WindPatternSettingSliderBar("windBearing",
|
||||
"Base Bearing (Degrees)", 0, 360, 0, 36);
|
||||
"Base Bearing (Degrees)", 0, 360, 5, 0, 36);
|
||||
display.addSetting(windBearingSetting);
|
||||
WindPatternSetting<Double> baseWindBearing = new WindPatternSettingSliderBar("baseWindBearing",
|
||||
"Race Course Diff (Degrees)", -20, 20, 0,10);
|
||||
"Race Course Diff (Degrees)", -20, 20, 1, 0, 10);
|
||||
display.addSetting(baseWindBearing);
|
||||
}
|
||||
WindPatternSetting<Double> windSpeedSetting = new WindPatternSettingSliderBar("baseWindSpeed",
|
||||
"Base Speed (kn)", 2, 22, 12,10);
|
||||
"Base Speed (kn)", 2, 22, 0.5, 12, 10);
|
||||
display.addSetting(windSpeedSetting);
|
||||
|
||||
WindPatternSetting<Double> blastProbability = new WindPatternSettingSliderBar("blastProbability",
|
||||
"Probability (%)", 0, 50, 25,10);
|
||||
"Probability (%)", 0, 50, 5, 25, 10);
|
||||
display.addSetting(blastProbability);
|
||||
WindPatternSetting<Double> maxBlastSize = new WindPatternSettingSliderBar("maxBlastSize", "Gust Size", 1, 10,
|
||||
1,10);
|
||||
1, 1, 10);
|
||||
display.addSetting(maxBlastSize);
|
||||
WindPatternSetting<Double> blastWindSpeed = new WindPatternSettingSliderBar("blastWindSpeed",
|
||||
"Average Speed (%)", 0, 200, 120,10);
|
||||
"Average Speed (%)", 0, 200, 5, 120, 10);
|
||||
display.addSetting(blastWindSpeed);
|
||||
WindPatternSetting<Double> blastWindSpeedVar = new WindPatternSettingSliderBar("blastWindSpeedVar",
|
||||
"Speed Variance (%)", 1e-4, 100, 10,10);
|
||||
"Speed Variance (%)", 1e-4, 100, 5, 10, 10);
|
||||
display.addSetting(blastWindSpeedVar);
|
||||
}
|
||||
|
||||
private void addOscillationParameters(WindPatternDisplay display) {
|
||||
if (mode == SailingSimulatorConstants.ModeEvent) {
|
||||
WindPatternSetting<Double> windBearingSetting = new WindPatternSettingSliderBar("windBearing",
|
||||
"Base Bearing (Degrees)", 0, 360, 0, 36);
|
||||
"Base Bearing (Degrees)", 0, 360, 5, 0, 36);
|
||||
display.addSetting(windBearingSetting);
|
||||
WindPatternSetting<Double> baseWindBearing = new WindPatternSettingSliderBar("baseWindBearing",
|
||||
"Race Course Diff (Degrees)", -20, 20, 0,10);
|
||||
"Race Course Diff (Degrees)", -20, 20, 1, 0, 10);
|
||||
display.addSetting(baseWindBearing);
|
||||
WindPatternSetting<Double> windSpeedSetting = new WindPatternSettingSliderBar("baseWindSpeed",
|
||||
"Base Speed (kn)", 2, 22, 12,10);
|
||||
"Base Speed (kn)", 2, 22, 1, 12, 10);
|
||||
display.addSetting(windSpeedSetting);
|
||||
} else {
|
||||
WindPatternSetting<Double> windSpeedSetting = new WindPatternSettingSliderBar("baseWindSpeed",
|
||||
"Base Speed (kn)", 2, 22, 12,10);
|
||||
"Base Speed (kn)", 2, 22, 1, 12, 10);
|
||||
display.addSetting(windSpeedSetting);
|
||||
WindPatternSetting<Double> baseWindBearing = new WindPatternSettingSliderBar("baseWindBearing",
|
||||
"Average Direction (Degrees)", -20, 20, 0,10);
|
||||
"Average Direction (Degrees)", -20, 20, 1, 0, 10);
|
||||
display.addSetting(baseWindBearing);
|
||||
}
|
||||
WindPatternSetting<Double> leftWindSpeed = new WindPatternSettingSliderBar("leftWindSpeed",
|
||||
"Speed Left Side (%)", 0, 200, 100,10);
|
||||
"Speed Left Side (%)", 0, 200, 5, 100, 10);
|
||||
display.addSetting(leftWindSpeed);
|
||||
WindPatternSetting<Double> middleWindSpeed = new WindPatternSettingSliderBar("middleWindSpeed",
|
||||
"Speed Middle (%)", 0, 200, 100,10);
|
||||
"Speed Middle (%)", 0, 200, 5, 100, 10);
|
||||
display.addSetting(middleWindSpeed);
|
||||
WindPatternSetting<Double> rightWindSpeed = new WindPatternSettingSliderBar("rightWindSpeed",
|
||||
"Speed Right Side (%)", 0, 200, 100,10);
|
||||
"Speed Right Side (%)", 0, 200, 5, 100, 10);
|
||||
display.addSetting(rightWindSpeed);
|
||||
WindPatternSetting<Double> frequency = new WindPatternSettingSliderBar("frequency",
|
||||
"Frequency (per hr)", 0, 20, 6,10);
|
||||
"Frequency (per hr)", 0, 20, 0.5, 6, 10);
|
||||
display.addSetting(frequency);
|
||||
WindPatternSetting<Double> amplitude = new WindPatternSettingSliderBar("amplitude",
|
||||
"Amplitude (Degrees)", -30, 30, 0, 10);
|
||||
"Amplitude (Degrees)", -30, 30, 1, 0, 10);
|
||||
display.addSetting(amplitude);
|
||||
WindPatternSetting<Double> curSpeed = new WindPatternSettingSliderBar("curSpeed",
|
||||
"Current Speed (kn)", 0, 2, 0, 10);
|
||||
"Current Speed (kn)", 0, 2, 0.1, 0, 10);
|
||||
display.addSetting(curSpeed);
|
||||
WindPatternSetting<Double> curBearing = new WindPatternSettingSliderBar("curBearing",
|
||||
"Current Bearing (Degrees)", 0, 360, 180, 36);
|
||||
"Current Bearing (Degrees)", 0, 360, 5, 180, 36);
|
||||
display.addSetting(curBearing);
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -50,6 +50,12 @@ public class WindPatternSettingListBox implements WindPatternSetting<String>, Is
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResolution() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefault() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
+9
-2
@@ -19,8 +19,9 @@ public class WindPatternSettingSliderBar implements WindPatternSetting<Double>,
|
||||
private double currentValue;
|
||||
private double min;
|
||||
private double max;
|
||||
private double res; // resolution of slider bar
|
||||
private double defaultValue;
|
||||
private int steps;
|
||||
private int steps; // number of tickmarks
|
||||
|
||||
/**
|
||||
* Required for serialization
|
||||
@@ -29,11 +30,12 @@ public class WindPatternSettingSliderBar implements WindPatternSetting<Double>,
|
||||
|
||||
}
|
||||
|
||||
public WindPatternSettingSliderBar(String name, String displayName, double min, double max, double defaultValue, int steps) {
|
||||
public WindPatternSettingSliderBar(String name, String displayName, double min, double max, double res, double defaultValue, int steps) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.res = res;
|
||||
this.defaultValue = defaultValue;
|
||||
this.currentValue = defaultValue;
|
||||
this.steps = steps;
|
||||
@@ -61,6 +63,11 @@ public class WindPatternSettingSliderBar implements WindPatternSetting<Double>,
|
||||
return max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getResolution() {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getDefault() {
|
||||
return defaultValue;
|
||||
|
||||
Reference in New Issue
Block a user