Add option to disable flight parameter estimates in the design window.

The plumbing was all there, but no one ever exposed the functionality to the users.
This commit is contained in:
Craig Earls 2014-12-19 14:31:30 -07:00
parent 233117628d
commit 05242d4f81
5 changed files with 29 additions and 9 deletions

View File

@ -266,6 +266,7 @@ pref.dlg.opengl.lbl.useFBO = Use Off-screen Rendering
pref.dlg.lbl.Positiontoinsert = Position to insert new body components:
pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations:
pref.dlg.checkbox.Runsimulations = Run all simulations automagically after design changes.
pref.dlg.checkbox.Updateestimates = Update estimated flight parameters in design window
pref.dlg.lbl.User-definedthrust = User-defined thrust curves:
pref.dlg.lbl.Windspeed = Wind speed
pref.dlg.Allthrustcurvefiles = All thrust curve files (*.eng; *.rse; *.zip; directories)

View File

@ -31,6 +31,7 @@ public abstract class Preferences {
public static final String USER_THRUST_CURVES_KEY = "UserThrustCurves";
public static final String CONFIRM_DELETE_SIMULATION = "ConfirmDeleteSimulation";
public static final String AUTO_RUN_SIMULATIONS = "AutoRunSimulations";
// Preferences related to data export
public static final String EXPORT_FIELD_SEPARATOR = "ExportFieldSeparator";
public static final String EXPORT_SIMULATION_COMMENT = "ExportSimulationComment";

View File

@ -334,6 +334,18 @@ public class PreferencesDialog extends JDialog {
});
panel.add(automaticallyRunSimsBox, "wrap, growx, sg combos ");
//// Automatically run all simulation out-dated by design changes.
final JCheckBox updateEstimates =
new JCheckBox(trans.get("pref.dlg.checkbox.Updateestimates"));
updateEstimates.setSelected(preferences.computeFlightInBackground());
updateEstimates.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
preferences.setComputeFlightInBackground(updateEstimates.isSelected());
}
});
panel.add(updateEstimates, "wrap, growx, sg combos ");
return panel;
}

View File

@ -699,15 +699,17 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
}
// Start calculation process
extraText.setCalculatingData(true);
if(((SwingPreferences) Application.getPreferences()).computeFlightInBackground()){
extraText.setCalculatingData(true);
Rocket duplicate = (Rocket) configuration.getRocket().copy();
Simulation simulation = ((SwingPreferences) Application.getPreferences()).getBackgroundSimulation(duplicate);
simulation.getOptions().setMotorConfigurationID(
configuration.getFlightConfigurationID());
Rocket duplicate = (Rocket) configuration.getRocket().copy();
Simulation simulation = ((SwingPreferences) Application.getPreferences()).getBackgroundSimulation(duplicate);
simulation.getOptions().setMotorConfigurationID(
configuration.getFlightConfigurationID());
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
}
}
/**

View File

@ -419,6 +419,10 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
return PREFNODE.getBoolean("backgroundFlight", true);
}
public void setComputeFlightInBackground(boolean b) {
PREFNODE.putBoolean("backgroundFlight", b);
}
public Simulation getBackgroundSimulation(Rocket rocket) {
Simulation s = new Simulation(rocket);
SimulationOptions cond = s.getOptions();