import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Coordinate;
+import net.sf.openrocket.util.GeodeticComputationStrategy;
import net.sf.openrocket.util.LineStyle;
import net.sf.openrocket.util.Reflection;
class DocumentConfig {
/* Remember to update OpenRocketSaver as well! */
- public static final String[] SUPPORTED_VERSIONS = { "0.9", "1.0", "1.1", "1.2" };
+ public static final String[] SUPPORTED_VERSIONS = { "0.9", "1.0", "1.1", "1.2", "1.3" };
//////// Component constructors
public SimulationConditionsHandler(Rocket rocket) {
conditions = new SimulationOptions(rocket);
+ // Set up default loading settings (which may differ from the new defaults)
+ conditions.setGeodeticComputation(GeodeticComputationStrategy.NONE);
}
public SimulationOptions getConditions() {
} else {
conditions.setLaunchLatitude(d);
}
+ } else if (element.equals("launchlongitude")) {
+ if (Double.isNaN(d)) {
+ warnings.add("Illegal launch longitude.");
+ } else {
+ conditions.setLaunchLongitude(d);
+ }
+ } else if (element.equals("geodeticmethod")) {
+ GeodeticComputationStrategy gcs =
+ (GeodeticComputationStrategy) DocumentConfig.findEnum(content, GeodeticComputationStrategy.class);
+ if (gcs != null) {
+ conditions.setGeodeticComputation(gcs);
+ } else {
+ warnings.add("Unknown geodetic computation method '" + content + "'");
+ }
} else if (element.equals("atmosphere")) {
atmosphereHandler.storeSettings(conditions, warnings);
} else if (element.equals("timestep")) {
* Otherwise use version 1.0.
*/
+ // Check if design has simulations defined (version 1.3)
+ if (document.getSimulationCount() > 0) {
+ return FILE_VERSION_DIVISOR + 3;
+ }
+
// Check for motor definitions (version 1.2)
Iterator<RocketComponent> iterator = document.getRocket().iterator();
while (iterator.hasNext()) {
writeElement("windturbulence", cond.getWindTurbulenceIntensity());
writeElement("launchaltitude", cond.getLaunchAltitude());
writeElement("launchlatitude", cond.getLaunchLatitude());
+ writeElement("launchlongitude", cond.getLaunchLongitude());
+ writeElement("geodeticmethod", cond.getGeodeticComputation().name().toLowerCase());
if (cond.isISAAtmosphere()) {
writeln("<atmosphere model=\"isa\"/>");