diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties
index 8088c874e..fdb333378 100644
--- a/core/resources/l10n/messages.properties
+++ b/core/resources/l10n/messages.properties
@@ -555,6 +555,7 @@ simpanel.col.Timetoapogee = Time to apogee
simpanel.col.Flighttime = Flight time
simpanel.col.Groundhitvelocity = Ground hit velocity
simpanel.ttip.uptodate = Up to date
+simpanel.ttip.loaded = Loaded from file
simpanel.ttip.outdated = Out of date
Click Run simulations to simulate.
simpanel.ttip.external = Imported data
simpanel.ttip.notSimulated = Not simulated yet
Click Run simulations to simulate.
diff --git a/core/src/net/sf/openrocket/document/Simulation.java b/core/src/net/sf/openrocket/document/Simulation.java
index a695a1165..75f6cf0b2 100644
--- a/core/src/net/sf/openrocket/document/Simulation.java
+++ b/core/src/net/sf/openrocket/document/Simulation.java
@@ -146,40 +146,22 @@ public class Simulation implements ChangeSource, Cloneable {
if (options == null)
throw new IllegalArgumentException("options cannot be null");
- this.document = document;
this.rocket = rocket;
-
- if (status == Status.UPTODATE) {
- this.status = Status.LOADED;
- } else if (data == null) {
- this.status = Status.NOT_SIMULATED;
- } else {
- this.status = status;
- }
-
this.name = name;
-
+ this.status = status;
+ this.simulatedConditions = options.clone();
+ this.simulatedData = data;
+ this.document = document;
+ addChangeListener(this.document);
+
this.options = options;
-
+ this.options.addChangeListener(new ConditionListener());
+
final FlightConfiguration config = rocket.getSelectedConfiguration();
this.setFlightConfigurationId(config.getFlightConfigurationID());
-
- options.addChangeListener(new ConditionListener());
- addChangeListener(document);
-
- if (extensions != null) {
- this.simulationExtensions.addAll(extensions);
- }
-
-
- if (data != null && this.status != Status.NOT_SIMULATED) {
- simulatedData = data;
- if (this.status == Status.LOADED) {
- simulatedConditions = options.clone();
- simulatedConfigurationID = config.getModID();
- }
- }
-
+ this.simulatedConfigurationID = config.getModID();
+
+ this.simulationExtensions.addAll(extensions);
}
public FlightConfiguration getActiveConfiguration() {
diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java
index 6d90c7050..99d819327 100644
--- a/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java
+++ b/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java
@@ -92,12 +92,6 @@ class FlightDataHandler extends AbstractElementHandler {
public void endHandler(String element, HashMap attributes,
String content, WarningSet warnings) {
- // If no tag in XML, then there is no sim data
- if (dataHandler == null) {
- data = null;
- return;
- }
-
if (branches.size() > 0) {
data = new FlightData(branches.toArray(new FlightDataBranch[0]));
} else {
@@ -158,4 +152,4 @@ class FlightDataHandler extends AbstractElementHandler {
}
-}
\ No newline at end of file
+}
diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java
index 6483e09bc..629d3be25 100644
--- a/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java
+++ b/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java
@@ -109,13 +109,6 @@ class SingleSimulationHandler extends AbstractElementHandler {
public void endHandler(String element, HashMap attributes,
String content, WarningSet warnings) {
- String s = attributes.get("status");
- Simulation.Status status = (Status) DocumentConfig.findEnum(s, Simulation.Status.class);
- if (status == null) {
- warnings.add("Simulation status unknown, assuming outdated.");
- status = Simulation.Status.OUTDATED;
- }
-
SimulationOptions options;
FlightConfigurationId idToSet= FlightConfigurationId.ERROR_FCID;
if (conditionHandler != null) {
@@ -126,16 +119,23 @@ class SingleSimulationHandler extends AbstractElementHandler {
options = new SimulationOptions();
}
- if (name == null)
+ if (name == null)
name = "Simulation";
+ // If the simulation was saved with flight data (which may just be a summary)
+ // mark it as loaded from the file else as not simulated. We're ignoring the
+ // simulation status attribute, since (1) it really isn't relevant now, and (2)
+ // sim summaries are getting marked as not simulated when they're saved
FlightData data;
if (dataHandler == null)
data = null;
else
data = dataHandler.getFlightData();
- if (data == null) {
+ Simulation.Status status;
+ if (data != null) {
+ status = Status.LOADED;
+ } else {
status = Status.NOT_SIMULATED;
}
@@ -153,4 +153,4 @@ class SingleSimulationHandler extends AbstractElementHandler {
return extension;
}
-}
\ No newline at end of file
+}
diff --git a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java
index b7fd17732..3c8f45839 100644
--- a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java
+++ b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java
@@ -710,6 +710,8 @@ public class SimulationPanel extends JPanel {
tip += trans.get("simpanel.ttip.noData")+"
";
break;
case LOADED:
+ tip += trans.get("simpanel.ttip.loaded") + "
";
+ break;
case UPTODATE:
tip += trans.get("simpanel.ttip.uptodate") + "
";
break;
diff --git a/swing/src/net/sf/openrocket/gui/util/Icons.java b/swing/src/net/sf/openrocket/gui/util/Icons.java
index 0ebd96ab0..bbbe1b052 100644
--- a/swing/src/net/sf/openrocket/gui/util/Icons.java
+++ b/swing/src/net/sf/openrocket/gui/util/Icons.java
@@ -33,7 +33,7 @@ public class Icons {
map.put(Simulation.Status.NOT_SIMULATED, loadImageIcon("pix/spheres/gray-16x16.png", "Not simulated"));
map.put(Simulation.Status.CANT_RUN, loadImageIcon("pix/spheres/yellow-16x16.png", "Can't run, no motors assigned."));
map.put(Simulation.Status.UPTODATE, loadImageIcon("pix/spheres/green-16x16.png", "Up to date"));
- map.put(Simulation.Status.LOADED, loadImageIcon("pix/spheres/green-16x16.png", "Up to date"));
+ map.put(Simulation.Status.LOADED, loadImageIcon("pix/spheres/blue-16x16.png", "Loaded from File"));
map.put(Simulation.Status.OUTDATED, loadImageIcon("pix/spheres/red-16x16.png", "Out-of-date"));
map.put(Simulation.Status.EXTERNAL, loadImageIcon("pix/spheres/blue-16x16.png", "Imported data"));
SIMULATION_STATUS_ICON_MAP = Collections.unmodifiableMap(map);