diff --git a/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java b/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java index dcd152768..062536233 100644 --- a/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java +++ b/core/src/main/java/info/openrocket/core/simulation/AbstractSimulationStepper.java @@ -323,6 +323,8 @@ public abstract class AbstractSimulationStepper implements SimulationStepper { flightConditions.getAtmosphericConditions().getTemperature()); dataBranch.setValue(FlightDataType.TYPE_AIR_PRESSURE, flightConditions.getAtmosphericConditions().getPressure()); + dataBranch.setValue(FlightDataType.TYPE_AIR_DENSITY, + flightConditions.getAtmosphericConditions().getDensity()); dataBranch.setValue(FlightDataType.TYPE_SPEED_OF_SOUND, flightConditions.getAtmosphericConditions().getMachSpeed()); } diff --git a/core/src/main/java/info/openrocket/core/simulation/FlightDataType.java b/core/src/main/java/info/openrocket/core/simulation/FlightDataType.java index 0519f4ae3..15b4174bc 100644 --- a/core/src/main/java/info/openrocket/core/simulation/FlightDataType.java +++ b/core/src/main/java/info/openrocket/core/simulation/FlightDataType.java @@ -275,10 +275,14 @@ public class FlightDataType implements Comparable { public static final FlightDataType TYPE_AIR_PRESSURE = newType(trans.get("FlightDataType.TYPE_AIR_PRESSURE"), "P", UnitGroup.UNITS_PRESSURE, FlightDataTypeGroup.ATMOSPHERIC_CONDITIONS, 2); + //// Air density + public static final FlightDataType TYPE_AIR_DENSITY = newType(trans.get("FlightDataType.TYPE_AIR_DENSITY"), "\u03C1", + UnitGroup.UNITS_DENSITY_BULK, + FlightDataTypeGroup.ATMOSPHERIC_CONDITIONS, 3); //// Speed of sound public static final FlightDataType TYPE_SPEED_OF_SOUND = newType(trans.get("FlightDataType.TYPE_SPEED_OF_SOUND"), "Vs", UnitGroup.UNITS_VELOCITY, - FlightDataTypeGroup.ATMOSPHERIC_CONDITIONS, 3); + FlightDataTypeGroup.ATMOSPHERIC_CONDITIONS, 4); // Simulation information //// Simulation time step @@ -345,6 +349,7 @@ public class FlightDataType implements Comparable { TYPE_WIND_VELOCITY, TYPE_AIR_TEMPERATURE, TYPE_AIR_PRESSURE, + TYPE_AIR_DENSITY, TYPE_SPEED_OF_SOUND, TYPE_TIME_STEP, TYPE_COMPUTATION_TIME diff --git a/core/src/main/resources/l10n/messages.properties b/core/src/main/resources/l10n/messages.properties index 42c08cc0a..36b7c2b8f 100644 --- a/core/src/main/resources/l10n/messages.properties +++ b/core/src/main/resources/l10n/messages.properties @@ -2127,6 +2127,7 @@ FlightDataType.TYPE_ORIENTATION_PHI = Lateral orientation (azimuth) FlightDataType.TYPE_WIND_VELOCITY = Wind velocity FlightDataType.TYPE_AIR_TEMPERATURE = Air temperature FlightDataType.TYPE_AIR_PRESSURE = Air pressure +FlightDataType.TYPE_AIR_DENSITY = Air density FlightDataType.TYPE_SPEED_OF_SOUND = Speed of sound FlightDataType.TYPE_TIME_STEP = Simulation time step FlightDataType.TYPE_COMPUTATION_TIME = Computation time diff --git a/swing/src/main/java/info/openrocket/swing/gui/print/PaperSize.java b/swing/src/main/java/info/openrocket/swing/gui/print/PaperSize.java index a31b2d18f..ccc2532ef 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/print/PaperSize.java +++ b/swing/src/main/java/info/openrocket/swing/gui/print/PaperSize.java @@ -3,6 +3,7 @@ package info.openrocket.swing.gui.print; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.util.List; import java.util.Locale; import org.slf4j.Logger; @@ -12,18 +13,25 @@ import com.itextpdf.text.PageSize; import com.itextpdf.text.Rectangle; public enum PaperSize { + A1("A1", PageSize.A1), + A2("A2", PageSize.A2), A3("A3", PageSize.A3), A4("A4", PageSize.A4), A5("A5", PageSize.A5), - LETTER("Letter", PageSize.LETTER), - LEGAL("Legal", PageSize.LEGAL); + ANSI_D("ANSI D", new Rectangle(22 * PrintUnit.POINTS_PER_INCH, 34 * PrintUnit.POINTS_PER_INCH)), + ANSI_C("ANSI C", new Rectangle(17 * PrintUnit.POINTS_PER_INCH, 22 * PrintUnit.POINTS_PER_INCH)), + TABLOID("Tabloid (ANSI B)", PageSize.TABLOID, "Tabloid", "ANSI B"), + LEGAL("Legal", PageSize.LEGAL), + LETTER("Letter (ANSI A)", PageSize.LETTER, "Letter", "ANSI A"); private final String name; + private final List alternativeNames; private final Rectangle size; - - private PaperSize(String name, Rectangle size) { + + PaperSize(String name, Rectangle size, String... alternativeNames) { this.name = name; this.size = size; + this.alternativeNames = List.of(alternativeNames); } public Rectangle getSize() { @@ -158,6 +166,11 @@ public enum PaperSize { if (p.name.equalsIgnoreCase(size)) { return p; } + for (String alt : p.alternativeNames) { + if (alt.equalsIgnoreCase(size)) { + return p; + } + } } return null; }