Wind and Launch rod decoupled. Initial UI complete

This commit is contained in:
Craig Earls 2014-12-21 20:56:15 -07:00
parent b96277afa0
commit 0d829c1c6b
2 changed files with 24 additions and 11 deletions

View File

@ -65,12 +65,12 @@ public class SimulationOptions implements ChangeSource, Cloneable {
private double launchRodAngle = 0;
/** Launch rod direction, 0 = north. */
private double windDirection = Math.PI / 2;
private double launchRodDirection = 0;
private double windAverage = 2.0;
private double windTurbulence = 0.1;
private double windDirection = Math.PI / 2;
/*
* SimulationOptions maintains the launch site parameters as separate double values,
@ -163,6 +163,9 @@ public class SimulationOptions implements ChangeSource, Cloneable {
public double getLaunchRodDirection() {
if (launchIntoWind) {
this.setLaunchRodDirection(windDirection);
}
return launchRodDirection;
}
@ -229,6 +232,9 @@ public class SimulationOptions implements ChangeSource, Cloneable {
public void setWindDirection(double direction) {
direction = MathUtil.reduce360(direction);
if (launchIntoWind) {
this.setLaunchRodDirection(direction);
}
if (MathUtil.equals(this.windDirection, direction))
return;
this.windDirection = direction;

View File

@ -392,30 +392,37 @@ public class SimulationConditionsPanel extends JPanel {
// Direction:
label = new JLabel(trans.get("simedtdlg.lbl.Direction"));
JLabel directionLabel = new JLabel(trans.get("simedtdlg.lbl.Direction"));
//// <html>Direction of the launch rod.
tip = trans.get("simedtdlg.lbl.ttip.Direction1") +
UnitGroup.UNITS_ANGLE.toStringUnit(0) +
" " + trans.get("simedtdlg.lbl.ttip.Direction2") + " " +
UnitGroup.UNITS_ANGLE.toStringUnit(2*Math.PI) +
" " + trans.get("simedtdlg.lbl.ttip.Direction3");
label.setToolTipText(tip);
sub.add(label);
directionLabel.setToolTipText(tip);
sub.add(directionLabel);
m = new DoubleModel(conditions, "LaunchRodDirection", 1.0, UnitGroup.UNITS_ANGLE,
0, 2*Math.PI);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
spin.setToolTipText(tip);
sub.add(spin, "w 65lp!");
JSpinner directionSpin = new JSpinner(m.getSpinnerModel());
directionSpin.setEditor(new SpinnerEditor(directionSpin));
directionSpin.setToolTipText(tip);
sub.add(directionSpin, "w 65lp!");
unit = new UnitSelector(m);
unit.setToolTipText(tip);
sub.add(unit, "growx");
slider = new BasicSlider(m.getSliderModel(0, 2*Math.PI));
slider.setToolTipText(tip);
sub.add(slider, "w 75lp, wrap");
BasicSlider directionSlider = new BasicSlider(m.getSliderModel(0, 2*Math.PI));
directionSlider.setToolTipText(tip);
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"));