[#2104] Display ISAA values in temp & pressure fields
This commit is contained in:
parent
47731a41fc
commit
4257bb2777
@ -213,6 +213,13 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
if (MathUtil.equals(this.launchAltitude, altitude))
|
if (MathUtil.equals(this.launchAltitude, altitude))
|
||||||
return;
|
return;
|
||||||
this.launchAltitude = altitude;
|
this.launchAltitude = altitude;
|
||||||
|
|
||||||
|
// Update the launch temperature and pressure if using ISA
|
||||||
|
if (useISA) {
|
||||||
|
setLaunchTemperature(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getTemperature());
|
||||||
|
setLaunchPressure(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getPressure());
|
||||||
|
}
|
||||||
|
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +272,13 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
if (isa == useISA)
|
if (isa == useISA)
|
||||||
return;
|
return;
|
||||||
useISA = isa;
|
useISA = isa;
|
||||||
|
|
||||||
|
// Update the launch temperature and pressure
|
||||||
|
if (isa) {
|
||||||
|
setLaunchTemperature(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getTemperature());
|
||||||
|
setLaunchPressure(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getPressure());
|
||||||
|
}
|
||||||
|
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +349,13 @@ public abstract class Preferences implements ChangeSource {
|
|||||||
if (MathUtil.equals(this.getDouble(LAUNCH_ALTITUDE, 0), altitude))
|
if (MathUtil.equals(this.getDouble(LAUNCH_ALTITUDE, 0), altitude))
|
||||||
return;
|
return;
|
||||||
this.putDouble(LAUNCH_ALTITUDE, altitude);
|
this.putDouble(LAUNCH_ALTITUDE, altitude);
|
||||||
|
|
||||||
|
// Update the launch temperature and pressure if using ISA
|
||||||
|
if (getISAAtmosphere()) {
|
||||||
|
setLaunchTemperature(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getTemperature());
|
||||||
|
setLaunchPressure(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getPressure());
|
||||||
|
}
|
||||||
|
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,6 +450,13 @@ public abstract class Preferences implements ChangeSource {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.putBoolean(LAUNCH_USE_ISA, isa);
|
this.putBoolean(LAUNCH_USE_ISA, isa);
|
||||||
|
|
||||||
|
// Update the launch temperature and pressure
|
||||||
|
if (isa) {
|
||||||
|
setLaunchTemperature(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getTemperature());
|
||||||
|
setLaunchPressure(ISA_ATMOSPHERIC_MODEL.getConditions(getLaunchAltitude()).getPressure());
|
||||||
|
}
|
||||||
|
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package net.sf.openrocket.gui.dialogs.preferences;
|
|||||||
import java.awt.LayoutManager;
|
import java.awt.LayoutManager;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
@ -26,6 +27,7 @@ import net.sf.openrocket.models.atmosphere.ExtendedISAModel;
|
|||||||
import net.sf.openrocket.simulation.SimulationOptions;
|
import net.sf.openrocket.simulation.SimulationOptions;
|
||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
import net.sf.openrocket.util.Chars;
|
import net.sf.openrocket.util.Chars;
|
||||||
|
import net.sf.openrocket.util.StateChangeListener;
|
||||||
|
|
||||||
public class LaunchPreferencesPanel extends PreferencesPanel {
|
public class LaunchPreferencesPanel extends PreferencesPanel {
|
||||||
|
|
||||||
@ -50,6 +52,8 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
|
|||||||
UnitSelector unit;
|
UnitSelector unit;
|
||||||
BasicSlider slider;
|
BasicSlider slider;
|
||||||
DoubleModel m;
|
DoubleModel m;
|
||||||
|
DoubleModel temperatureModel;
|
||||||
|
DoubleModel pressureModel;
|
||||||
JSpinner spin;
|
JSpinner spin;
|
||||||
|
|
||||||
// Wind settings: Average wind speed, turbulence intensity, std.
|
// Wind settings: Average wind speed, turbulence intensity, std.
|
||||||
@ -215,20 +219,20 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
|
|||||||
isa.addEnableComponent(label, false);
|
isa.addEnableComponent(label, false);
|
||||||
sub.add(label);
|
sub.add(label);
|
||||||
|
|
||||||
m = new DoubleModel(preferences, "LaunchTemperature",
|
temperatureModel = new DoubleModel(preferences, "LaunchTemperature",
|
||||||
UnitGroup.UNITS_TEMPERATURE, 0);
|
UnitGroup.UNITS_TEMPERATURE, 0);
|
||||||
|
|
||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(temperatureModel.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
spin.setToolTipText(tip);
|
spin.setToolTipText(tip);
|
||||||
isa.addEnableComponent(spin, false);
|
isa.addEnableComponent(spin, false);
|
||||||
sub.add(spin, "growx");
|
sub.add(spin, "growx");
|
||||||
|
|
||||||
unit = new UnitSelector(m);
|
unit = new UnitSelector(temperatureModel);
|
||||||
unit.setToolTipText(tip);
|
unit.setToolTipText(tip);
|
||||||
isa.addEnableComponent(unit, false);
|
isa.addEnableComponent(unit, false);
|
||||||
sub.add(unit, "growx");
|
sub.add(unit, "growx");
|
||||||
slider = new BasicSlider(m.getSliderModel(253.15, 308.15)); // -20 ...
|
slider = new BasicSlider(temperatureModel.getSliderModel(253.15, 308.15)); // -20 ...
|
||||||
// 35
|
// 35
|
||||||
slider.setToolTipText(tip);
|
slider.setToolTipText(tip);
|
||||||
isa.addEnableComponent(slider, false);
|
isa.addEnableComponent(slider, false);
|
||||||
@ -242,24 +246,33 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
|
|||||||
isa.addEnableComponent(label, false);
|
isa.addEnableComponent(label, false);
|
||||||
sub.add(label);
|
sub.add(label);
|
||||||
|
|
||||||
m = new DoubleModel(preferences, "LaunchPressure",
|
pressureModel = new DoubleModel(preferences, "LaunchPressure",
|
||||||
UnitGroup.UNITS_PRESSURE, 0);
|
UnitGroup.UNITS_PRESSURE, 0);
|
||||||
|
|
||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(pressureModel.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
spin.setToolTipText(tip);
|
spin.setToolTipText(tip);
|
||||||
isa.addEnableComponent(spin, false);
|
isa.addEnableComponent(spin, false);
|
||||||
sub.add(spin, "growx");
|
sub.add(spin, "growx");
|
||||||
|
|
||||||
unit = new UnitSelector(m);
|
unit = new UnitSelector(pressureModel);
|
||||||
unit.setToolTipText(tip);
|
unit.setToolTipText(tip);
|
||||||
isa.addEnableComponent(unit, false);
|
isa.addEnableComponent(unit, false);
|
||||||
sub.add(unit, "growx");
|
sub.add(unit, "growx");
|
||||||
slider = new BasicSlider(m.getSliderModel(0.950e5, 1.050e5));
|
slider = new BasicSlider(pressureModel.getSliderModel(0.950e5, 1.050e5));
|
||||||
slider.setToolTipText(tip);
|
slider.setToolTipText(tip);
|
||||||
isa.addEnableComponent(slider, false);
|
isa.addEnableComponent(slider, false);
|
||||||
sub.add(slider, "w 75lp, wrap");
|
sub.add(slider, "w 75lp, wrap");
|
||||||
|
|
||||||
|
isa.addChangeListener(new StateChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void stateChanged(EventObject e) {
|
||||||
|
temperatureModel.stateChanged(e);
|
||||||
|
pressureModel.stateChanged(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// // Launch site preferences
|
// // Launch site preferences
|
||||||
sub = new JPanel(new MigLayout("fill, gap rel unrel",
|
sub = new JPanel(new MigLayout("fill, gap rel unrel",
|
||||||
"[grow][65lp!][30lp!][75lp!]", ""));
|
"[grow][65lp!][30lp!][75lp!]", ""));
|
||||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.gui.simulation;
|
|||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@ -27,6 +28,7 @@ import net.sf.openrocket.startup.Application;
|
|||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
import net.sf.openrocket.util.Chars;
|
import net.sf.openrocket.util.Chars;
|
||||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||||
|
import net.sf.openrocket.util.StateChangeListener;
|
||||||
|
|
||||||
public class SimulationConditionsPanel extends JPanel {
|
public class SimulationConditionsPanel extends JPanel {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
@ -43,6 +45,8 @@ public class SimulationConditionsPanel extends JPanel {
|
|||||||
BasicSlider slider;
|
BasicSlider slider;
|
||||||
DoubleModel m;
|
DoubleModel m;
|
||||||
JSpinner spin;
|
JSpinner spin;
|
||||||
|
DoubleModel temperatureModel;
|
||||||
|
DoubleModel pressureModel;
|
||||||
|
|
||||||
//// Wind settings: Average wind speed, turbulence intensity, std. deviation, and direction
|
//// Wind settings: Average wind speed, turbulence intensity, std. deviation, and direction
|
||||||
sub = new JPanel(new MigLayout("fill, gap rel unrel",
|
sub = new JPanel(new MigLayout("fill, gap rel unrel",
|
||||||
@ -197,20 +201,20 @@ public class SimulationConditionsPanel extends JPanel {
|
|||||||
label.setToolTipText(tip);
|
label.setToolTipText(tip);
|
||||||
isa.addEnableComponent(label, false);
|
isa.addEnableComponent(label, false);
|
||||||
sub.add(label);
|
sub.add(label);
|
||||||
|
|
||||||
|
temperatureModel = new DoubleModel(conditions, "LaunchTemperature", UnitGroup.UNITS_TEMPERATURE, 0);
|
||||||
|
|
||||||
m = new DoubleModel(conditions, "LaunchTemperature", UnitGroup.UNITS_TEMPERATURE, 0);
|
spin = new JSpinner(temperatureModel.getSpinnerModel());
|
||||||
|
|
||||||
spin = new JSpinner(m.getSpinnerModel());
|
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
spin.setToolTipText(tip);
|
spin.setToolTipText(tip);
|
||||||
isa.addEnableComponent(spin, false);
|
isa.addEnableComponent(spin, false);
|
||||||
sub.add(spin, "growx");
|
sub.add(spin, "growx");
|
||||||
|
|
||||||
unit = new UnitSelector(m);
|
unit = new UnitSelector(temperatureModel);
|
||||||
unit.setToolTipText(tip);
|
unit.setToolTipText(tip);
|
||||||
isa.addEnableComponent(unit, false);
|
isa.addEnableComponent(unit, false);
|
||||||
sub.add(unit, "growx");
|
sub.add(unit, "growx");
|
||||||
slider = new BasicSlider(m.getSliderModel(253.15, 308.15)); // -20 ... 35
|
slider = new BasicSlider(temperatureModel.getSliderModel(253.15, 308.15)); // -20 ... 35
|
||||||
slider.setToolTipText(tip);
|
slider.setToolTipText(tip);
|
||||||
isa.addEnableComponent(slider, false);
|
isa.addEnableComponent(slider, false);
|
||||||
sub.add(slider, "w 75lp, wrap");
|
sub.add(slider, "w 75lp, wrap");
|
||||||
@ -224,28 +228,35 @@ public class SimulationConditionsPanel extends JPanel {
|
|||||||
label.setToolTipText(tip);
|
label.setToolTipText(tip);
|
||||||
isa.addEnableComponent(label, false);
|
isa.addEnableComponent(label, false);
|
||||||
sub.add(label);
|
sub.add(label);
|
||||||
|
|
||||||
|
pressureModel = new DoubleModel(conditions, "LaunchPressure", UnitGroup.UNITS_PRESSURE, 0);
|
||||||
|
|
||||||
m = new DoubleModel(conditions, "LaunchPressure", UnitGroup.UNITS_PRESSURE, 0);
|
spin = new JSpinner(pressureModel.getSpinnerModel());
|
||||||
|
|
||||||
spin = new JSpinner(m.getSpinnerModel());
|
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
spin.setToolTipText(tip);
|
spin.setToolTipText(tip);
|
||||||
isa.addEnableComponent(spin, false);
|
isa.addEnableComponent(spin, false);
|
||||||
sub.add(spin, "growx");
|
sub.add(spin, "growx");
|
||||||
|
|
||||||
unit = new UnitSelector(m);
|
unit = new UnitSelector(pressureModel);
|
||||||
unit.setToolTipText(tip);
|
unit.setToolTipText(tip);
|
||||||
isa.addEnableComponent(unit, false);
|
isa.addEnableComponent(unit, false);
|
||||||
sub.add(unit, "growx");
|
sub.add(unit, "growx");
|
||||||
slider = new BasicSlider(m.getSliderModel(0.950e5, 1.050e5));
|
slider = new BasicSlider(pressureModel.getSliderModel(0.950e5, 1.050e5));
|
||||||
slider.setToolTipText(tip);
|
slider.setToolTipText(tip);
|
||||||
isa.addEnableComponent(slider, false);
|
isa.addEnableComponent(slider, false);
|
||||||
sub.add(slider, "w 75lp, wrap");
|
sub.add(slider, "w 75lp, wrap");
|
||||||
|
|
||||||
|
|
||||||
|
isa.addChangeListener(new StateChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void stateChanged(EventObject e) {
|
||||||
|
temperatureModel.stateChanged(e);
|
||||||
|
pressureModel.stateChanged(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// Launch site conditions
|
//// Launch site conditions
|
||||||
sub = new JPanel(new MigLayout("fill, gap rel unrel",
|
sub = new JPanel(new MigLayout("fill, gap rel unrel",
|
||||||
"[grow][65lp!][30lp!][75lp!]", ""));
|
"[grow][65lp!][30lp!][75lp!]", ""));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user