Merge pull request #672 from JoePfeiffer/use-simulation-options
Use simulation options (addresses
This commit is contained in:
commit
67fed96137
@ -574,5 +574,28 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
||||
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "SimulationOptions [\n"
|
||||
.concat(" AtmosphericModel: " + getAtmosphericModel().toString() + "\n")
|
||||
.concat(String.format(" launchRodLength: %f\n", launchRodLength))
|
||||
.concat(String.format(" launchIntoWind: %b\n", launchIntoWind))
|
||||
.concat(String.format(" launchRodAngle: %f\n", launchRodAngle))
|
||||
.concat(String.format(" windDirection: %f\n", windDirection))
|
||||
.concat(String.format(" launchRodDirection: %f\n", launchRodDirection))
|
||||
.concat(String.format(" windAverage: %f\n", windAverage))
|
||||
.concat(String.format(" windTurbulence: %f\n", windTurbulence))
|
||||
.concat(String.format(" launchAltitude: %f\n", launchAltitude))
|
||||
.concat(String.format(" launchLatitude: %f\n", launchLatitude))
|
||||
.concat(String.format(" launchLongitude: %f\n", launchLongitude))
|
||||
.concat(" geodeticComputation: " + geodeticComputation.toString() + "\n")
|
||||
.concat(String.format(" useISA: %b\n", useISA))
|
||||
.concat(String.format(" launchTemperature: %f\n", launchTemperature))
|
||||
.concat(String.format(" launchPressure: %f\n", launchPressure))
|
||||
.concat(String.format(" timeStep: %f\n", timeStep))
|
||||
.concat(String.format(" maximumAngle: %f\n", maximumAngle))
|
||||
.concat(String.format(" calculateExtras: %b\n", calculateExtras))
|
||||
.concat("]\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -682,9 +682,27 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
extraText.setCalculatingData(true);
|
||||
|
||||
Rocket duplicate = (Rocket) document.getRocket().copy();
|
||||
Simulation simulation = ((SwingPreferences) Application.getPreferences()).getBackgroundSimulation(duplicate);
|
||||
simulation.setFlightConfigurationId( document.getSelectedConfiguration().getId());
|
||||
|
||||
// find a Simulation based on the current flight configuration
|
||||
FlightConfigurationId curID = curConfig.getFlightConfigurationID();
|
||||
Simulation simulation = null;
|
||||
for (Simulation sim : document.getSimulations()) {
|
||||
if (sim.getFlightConfigurationId().compareTo(curID) == 0) {
|
||||
simulation = sim;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// I *think* every FlightConfiguration has at least one associated simulation; just in case I'm wrong,
|
||||
// if there isn't one we'll create a new simulation to update the statistics in the panel using the
|
||||
// default simulation conditions
|
||||
if (simulation == null) {
|
||||
System.out.println("creating new simulation");
|
||||
simulation = ((SwingPreferences) Application.getPreferences()).getBackgroundSimulation(duplicate);
|
||||
simulation.setFlightConfigurationId( document.getSelectedConfiguration().getId());
|
||||
} else
|
||||
System.out.println("using pre-existing simulation");
|
||||
|
||||
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
|
||||
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user