Wind and Launch rod decoupled. Initial UI complete
This commit is contained in:
parent
b96277afa0
commit
0d829c1c6b
@ -65,12 +65,12 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
private double launchRodAngle = 0;
|
private double launchRodAngle = 0;
|
||||||
|
|
||||||
/** Launch rod direction, 0 = north. */
|
/** Launch rod direction, 0 = north. */
|
||||||
|
private double windDirection = Math.PI / 2;
|
||||||
private double launchRodDirection = 0;
|
private double launchRodDirection = 0;
|
||||||
|
|
||||||
|
|
||||||
private double windAverage = 2.0;
|
private double windAverage = 2.0;
|
||||||
private double windTurbulence = 0.1;
|
private double windTurbulence = 0.1;
|
||||||
private double windDirection = Math.PI / 2;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SimulationOptions maintains the launch site parameters as separate double values,
|
* SimulationOptions maintains the launch site parameters as separate double values,
|
||||||
@ -163,6 +163,9 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
|
|
||||||
public double getLaunchRodDirection() {
|
public double getLaunchRodDirection() {
|
||||||
|
if (launchIntoWind) {
|
||||||
|
this.setLaunchRodDirection(windDirection);
|
||||||
|
}
|
||||||
return launchRodDirection;
|
return launchRodDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +232,9 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
public void setWindDirection(double direction) {
|
public void setWindDirection(double direction) {
|
||||||
direction = MathUtil.reduce360(direction);
|
direction = MathUtil.reduce360(direction);
|
||||||
|
if (launchIntoWind) {
|
||||||
|
this.setLaunchRodDirection(direction);
|
||||||
|
}
|
||||||
if (MathUtil.equals(this.windDirection, direction))
|
if (MathUtil.equals(this.windDirection, direction))
|
||||||
return;
|
return;
|
||||||
this.windDirection = direction;
|
this.windDirection = direction;
|
||||||
|
@ -392,30 +392,37 @@ public class SimulationConditionsPanel extends JPanel {
|
|||||||
|
|
||||||
|
|
||||||
// Direction:
|
// Direction:
|
||||||
label = new JLabel(trans.get("simedtdlg.lbl.Direction"));
|
JLabel directionLabel = new JLabel(trans.get("simedtdlg.lbl.Direction"));
|
||||||
//// <html>Direction of the launch rod.
|
//// <html>Direction of the launch rod.
|
||||||
tip = trans.get("simedtdlg.lbl.ttip.Direction1") +
|
tip = trans.get("simedtdlg.lbl.ttip.Direction1") +
|
||||||
UnitGroup.UNITS_ANGLE.toStringUnit(0) +
|
UnitGroup.UNITS_ANGLE.toStringUnit(0) +
|
||||||
" " + trans.get("simedtdlg.lbl.ttip.Direction2") + " " +
|
" " + trans.get("simedtdlg.lbl.ttip.Direction2") + " " +
|
||||||
UnitGroup.UNITS_ANGLE.toStringUnit(2*Math.PI) +
|
UnitGroup.UNITS_ANGLE.toStringUnit(2*Math.PI) +
|
||||||
" " + trans.get("simedtdlg.lbl.ttip.Direction3");
|
" " + trans.get("simedtdlg.lbl.ttip.Direction3");
|
||||||
label.setToolTipText(tip);
|
directionLabel.setToolTipText(tip);
|
||||||
sub.add(label);
|
sub.add(directionLabel);
|
||||||
|
|
||||||
m = new DoubleModel(conditions, "LaunchRodDirection", 1.0, UnitGroup.UNITS_ANGLE,
|
m = new DoubleModel(conditions, "LaunchRodDirection", 1.0, UnitGroup.UNITS_ANGLE,
|
||||||
0, 2*Math.PI);
|
0, 2*Math.PI);
|
||||||
|
|
||||||
spin = new JSpinner(m.getSpinnerModel());
|
JSpinner directionSpin = new JSpinner(m.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
directionSpin.setEditor(new SpinnerEditor(directionSpin));
|
||||||
spin.setToolTipText(tip);
|
directionSpin.setToolTipText(tip);
|
||||||
sub.add(spin, "w 65lp!");
|
sub.add(directionSpin, "w 65lp!");
|
||||||
|
|
||||||
unit = new UnitSelector(m);
|
unit = new UnitSelector(m);
|
||||||
unit.setToolTipText(tip);
|
unit.setToolTipText(tip);
|
||||||
sub.add(unit, "growx");
|
sub.add(unit, "growx");
|
||||||
slider = new BasicSlider(m.getSliderModel(0, 2*Math.PI));
|
BasicSlider directionSlider = new BasicSlider(m.getSliderModel(0, 2*Math.PI));
|
||||||
slider.setToolTipText(tip);
|
directionSlider.setToolTipText(tip);
|
||||||
sub.add(slider, "w 75lp, wrap");
|
sub.add(directionSlider, "w 75lp, wrap");
|
||||||
|
intoWind.addEnableComponent(directionLabel, false);
|
||||||
|
intoWind.addEnableComponent(directionSpin, false);
|
||||||
|
intoWind.addEnableComponent(unit, false);
|
||||||
|
intoWind.addEnableComponent(directionSlider, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JButton restoreDefaults = new JButton(trans.get("simedtdlg.but.resettodefault"));
|
JButton restoreDefaults = new JButton(trans.get("simedtdlg.but.resettodefault"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user