]> git.gag.com Git - debian/openrocket/commitdiff
DGP - support for clusters(import and export); added thickness to tube coupler; clean...
authorrodinia814 <rodinia814@180e2498-e6e9-4542-8430-84ac67f01cd8>
Tue, 10 Jan 2012 02:13:18 +0000 (02:13 +0000)
committerrodinia814 <rodinia814@180e2498-e6e9-4542-8430-84ac67f01cd8>
Tue, 10 Jan 2012 02:13:18 +0000 (02:13 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@327 180e2498-e6e9-4542-8430-84ac67f01cd8

52 files changed:
core/src/net/sf/openrocket/file/TipShapeCode.java [new file with mode: 0644]
core/src/net/sf/openrocket/file/rocksim/RocksimCommonConstants.java
core/src/net/sf/openrocket/file/rocksim/RocksimDensityType.java [new file with mode: 0644]
core/src/net/sf/openrocket/file/rocksim/RocksimFinishCode.java [new file with mode: 0644]
core/src/net/sf/openrocket/file/rocksim/RocksimLocationMode.java [new file with mode: 0644]
core/src/net/sf/openrocket/file/rocksim/RocksimNoseConeCode.java [new file with mode: 0644]
core/src/net/sf/openrocket/file/rocksim/TipShapeCode.java [deleted file]
core/src/net/sf/openrocket/file/rocksim/export/AbstractTransitionDTO.java
core/src/net/sf/openrocket/file/rocksim/export/BasePartDTO.java
core/src/net/sf/openrocket/file/rocksim/export/BodyTubeDTO.java
core/src/net/sf/openrocket/file/rocksim/export/BulkheadDTO.java
core/src/net/sf/openrocket/file/rocksim/export/CenteringRingDTO.java
core/src/net/sf/openrocket/file/rocksim/export/CustomFinSetDTO.java
core/src/net/sf/openrocket/file/rocksim/export/FinSetDTO.java
core/src/net/sf/openrocket/file/rocksim/export/InnerBodyTubeDTO.java
core/src/net/sf/openrocket/file/rocksim/export/LaunchLugDTO.java
core/src/net/sf/openrocket/file/rocksim/export/MassObjectDTO.java
core/src/net/sf/openrocket/file/rocksim/export/NoseConeDTO.java
core/src/net/sf/openrocket/file/rocksim/export/ParachuteDTO.java
core/src/net/sf/openrocket/file/rocksim/export/RocksimDesignDTO.java
core/src/net/sf/openrocket/file/rocksim/export/RocksimDocumentDTO.java
core/src/net/sf/openrocket/file/rocksim/export/StageDTO.java
core/src/net/sf/openrocket/file/rocksim/export/StreamerDTO.java
core/src/net/sf/openrocket/file/rocksim/export/TransitionDTO.java
core/src/net/sf/openrocket/file/rocksim/export/TubeCouplerDTO.java
core/src/net/sf/openrocket/file/rocksim/importt/AttachedPartsHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/BaseHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/BodyTubeHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/FinSetHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/InnerBodyTubeHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/LaunchLugHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/MassObjectHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/ParachuteHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/PositionDependentHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/RecoveryDeviceHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/RingHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/RocksimDensityType.java [deleted file]
core/src/net/sf/openrocket/file/rocksim/importt/RocksimFinishCode.java [deleted file]
core/src/net/sf/openrocket/file/rocksim/importt/RocksimHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/RocksimLocationMode.java [deleted file]
core/src/net/sf/openrocket/file/rocksim/importt/RocksimNoseConeCode.java [deleted file]
core/src/net/sf/openrocket/file/rocksim/importt/StreamerHandler.java
core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java
core/test/net/sf/openrocket/file/rocksim/importt/BodyTubeHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/InnerBodyTubeHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/LaunchLugHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/MassObjectHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/NoseConeHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/ParachuteHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/StreamerHandlerTest.java
core/test/net/sf/openrocket/file/rocksim/importt/TransitionHandlerTest.java

diff --git a/core/src/net/sf/openrocket/file/TipShapeCode.java b/core/src/net/sf/openrocket/file/TipShapeCode.java
new file mode 100644 (file)
index 0000000..c7018fd
--- /dev/null
@@ -0,0 +1,38 @@
+package net.sf.openrocket.file;
+
+import net.sf.openrocket.rocketcomponent.FinSet;
+
+/**
+ */
+public final class TipShapeCode {
+
+    /**
+     * Convert a Rocksim tip shape to an OpenRocket CrossSection.
+     *
+     * @param tipShape the tip shape code from Rocksim
+     *
+     * @return a CrossSection instance
+     */
+    public static FinSet.CrossSection convertTipShapeCode (int tipShape) {
+        switch (tipShape) {
+            case 0:
+                return FinSet.CrossSection.SQUARE;
+            case 1:
+                return FinSet.CrossSection.ROUNDED;
+            case 2:
+                return FinSet.CrossSection.AIRFOIL;
+            default:
+                return FinSet.CrossSection.SQUARE;
+        }
+    }
+
+    public static int convertTipShapeCode (FinSet.CrossSection cs) {
+        if (FinSet.CrossSection.ROUNDED.equals(cs)) {
+            return 1;
+        }
+        if (FinSet.CrossSection.AIRFOIL.equals(cs)) {
+            return 2;
+        }
+        return 0;
+    }
+}
index 569f2420fb317e2e15ff725a06a0c7a74b0615eb..f0d9c859cd3e0b8c2d9a618a42b36b89455763e7 100644 (file)
@@ -3,4 +3,103 @@ package net.sf.openrocket.file.rocksim;
 /**
  */
 public class RocksimCommonConstants {
+
+    public static final String SHAPE_CODE = "ShapeCode";
+    public static final String CONSTRUCTION_TYPE = "ConstructionType";
+    public static final String WALL_THICKNESS = "WallThickness";
+    public static final String SHAPE_PARAMETER = "ShapeParameter";
+    public static final String ATTACHED_PARTS = "AttachedParts";
+    public static final String BODY_TUBE = "BodyTube";
+    public static final String FIN_SET = "FinSet";
+    public static final String CUSTOM_FIN_SET = "CustomFinSet";
+    public static final String RING = "Ring";
+    public static final String STREAMER = "Streamer";
+    public static final String PARACHUTE = "Parachute";
+    public static final String MASS_OBJECT = "MassObject";
+    public static final String KNOWN_MASS = "KnownMass";
+    public static final String DENSITY = "Density";
+    public static final String MATERIAL = "Material";
+    public static final String NAME = "Name";
+    public static final String KNOWN_CG = "KnownCG";
+    public static final String USE_KNOWN_CG = "UseKnownCG";
+    public static final String XB = "Xb";
+    public static final String CALC_MASS = "CalcMass";
+    public static final String CALC_CG = "CalcCG";
+    public static final String DENSITY_TYPE = "DensityType";
+    public static final String RADIAL_LOC = "RadialLoc";
+    public static final String RADIAL_ANGLE = "RadialAngle";
+    public static final String LOCATION_MODE = "LocationMode";
+    public static final String FINISH_CODE = "FinishCode";
+    public static final String LEN = "Len";
+    public static final String OD = "OD";
+    public static final String ID = "ID";
+    public static final String IS_MOTOR_MOUNT = "IsMotorMount";
+    public static final String MOTOR_DIA = "MotorDia";
+    public static final String ENGINE_OVERHANG = "EngineOverhang";
+    public static final String IS_INSIDE_TUBE = "IsInsideTube";
+    public static final String LAUNCH_LUG = "LaunchLug";
+    public static final String USAGE_CODE = "UsageCode";
+    public static final String AUTO_SIZE = "AutoSize";
+    public static final String POINT_LIST = "PointList";
+    public static final String FIN_COUNT = "FinCount";
+    public static final String ROOT_CHORD = "RootChord";
+    public static final String TIP_CHORD = "TipChord";
+    public static final String SEMI_SPAN = "SemiSpan";
+    public static final String SWEEP_DISTANCE = "SweepDistance";
+    public static final String THICKNESS = "Thickness";
+    public static final String TIP_SHAPE_CODE = "TipShapeCode";
+    public static final String TAB_LENGTH = "TabLength";
+    public static final String TAB_DEPTH = "TabDepth";
+    public static final String TAB_OFFSET = "TabOffset";
+    public static final String SWEEP_MODE = "SweepMode";
+    public static final String CANT_ANGLE = "CantAngle";
+    public static final String TYPE_CODE = "TypeCode";
+    public static final String NOSE_CONE = "NoseCone";
+    public static final String BASE_DIA = "BaseDia";
+    public static final String SHOULDER_LEN = "ShoulderLen";
+    public static final String SHOULDER_OD = "ShoulderOD";
+    public static final String DIAMETER = "Dia";
+    public static final String SPILL_HOLE_DIA = "SpillHoleDia";
+    public static final String SHROUD_LINE_COUNT = "ShroudLineCount";
+    public static final String SHROUD_LINE_LEN = "ShroudLineLen";
+    public static final String CHUTE_COUNT = "ChuteCount";
+    public static final String SHROUD_LINE_MASS_PER_MM = "ShroudLineMassPerMM";
+    public static final String SHROUD_LINE_MATERIAL = "ShroudLineMaterial";
+    public static final String DRAG_COEFFICIENT = "DragCoefficient";
+    public static final String ROCKET_DESIGN = "RocketDesign";
+    public static final String TRANSITION = "Transition";
+    public static final String WIDTH = "Width";
+    public static final String FRONT_SHOULDER_LEN = "FrontShoulderLen";
+    public static final String REAR_SHOULDER_LEN = "RearShoulderLen";
+    public static final String FRONT_SHOULDER_DIA = "FrontShoulderDia";
+    public static final String REAR_SHOULDER_DIA = "RearShoulderDia";
+    public static final String FRONT_DIA = "FrontDia";
+    public static final String REAR_DIA = "RearDia";
+    public static final String ROCK_SIM_DOCUMENT = "RockSimDocument";
+    public static final String FILE_VERSION = "FileVersion";
+    public static final String DESIGN_INFORMATION = "DesignInformation";
+    /**
+     * Length conversion.  Rocksim is in millimeters, OpenRocket in meters.
+     */
+    public static final int ROCKSIM_TO_OPENROCKET_LENGTH = 1000;
+    /**
+     * Mass conversion.  Rocksim is in grams, OpenRocket in kilograms.
+     */
+    public static final int ROCKSIM_TO_OPENROCKET_MASS = 1000;
+    /**
+     * Bulk Density conversion.  Rocksim is in kilograms/cubic meter, OpenRocket in kilograms/cubic meter.
+     */
+    public static final int ROCKSIM_TO_OPENROCKET_BULK_DENSITY = 1;
+    /**
+     * Surface Density conversion.  Rocksim is in grams/sq centimeter, OpenRocket in kilograms/sq meter.  1000/(100*100) = 1/10
+     */
+    public static final double ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY = 1/10d;
+    /**
+     * Line Density conversion.  Rocksim is in kilograms/meter, OpenRocket in kilograms/meter.
+     */
+    public static final int ROCKSIM_TO_OPENROCKET_LINE_DENSITY = 1;
+    /**
+     * Radius conversion.  Rocksim is always in diameters, OpenRocket mostly in radius.
+     */
+    public static final int ROCKSIM_TO_OPENROCKET_RADIUS = 2 * ROCKSIM_TO_OPENROCKET_LENGTH;
 }
diff --git a/core/src/net/sf/openrocket/file/rocksim/RocksimDensityType.java b/core/src/net/sf/openrocket/file/rocksim/RocksimDensityType.java
new file mode 100644 (file)
index 0000000..2e8d54c
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * RocksimDensityType.java
+ */
+package net.sf.openrocket.file.rocksim;
+
+import net.sf.openrocket.material.Material;
+
+/**
+ * Models the nose cone shape of a rocket.  Maps from Rocksim's notion to OpenRocket's.
+ */
+public enum RocksimDensityType {
+    ROCKSIM_BULK   (0, RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_BULK_DENSITY),
+    ROCKSIM_SURFACE(1, RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY),
+    ROCKSIM_LINE   (2, RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LINE_DENSITY);
+
+    /** The Rocksim enumeration value. Sent in XML. */
+    private final int ordinal;
+
+    /** The corresponding OpenRocket shape. */
+    private final double conversion;
+
+    /**
+     * Constructor.
+     *
+     * @param idx            the Rocksim shape code
+     * @param theConversion  the numerical conversion ratio to OpenRocket
+     */
+    private RocksimDensityType(int idx, double theConversion) {
+        ordinal = idx;
+        conversion = theConversion;
+    }
+
+    /**
+     * Get the OpenRocket shape that corresponds to the Rocksim value.
+     *
+     * @return a conversion
+     */
+    public double asOpenRocket() {
+        return conversion;
+    }
+
+    /**
+     * Lookup an instance of this enum based upon the Rocksim code.
+     *
+     * @param rocksimDensityType  the Rocksim code (from XML)
+     * @return an instance of this enum
+     */
+    public static RocksimDensityType fromCode(int rocksimDensityType) {
+        RocksimDensityType[] values = values();
+        for (RocksimDensityType value : values) {
+            if (value.ordinal == rocksimDensityType) {
+                return value;
+            }
+        }
+        return ROCKSIM_BULK; //Default
+    }
+
+    /**
+     * Get the ordinal code.
+     *
+     * @param type  the OR type
+     *
+     * @return  the Rocksim XML value
+     */
+    public static int toCode(Material.Type type) {
+        if (type.equals(Material.Type.BULK)) {
+            return ROCKSIM_BULK.ordinal;
+        }
+        if (type.equals(Material.Type.LINE)) {
+            return ROCKSIM_LINE.ordinal;
+        }
+        if (type.equals(Material.Type.SURFACE)) {
+            return ROCKSIM_SURFACE.ordinal;
+        }
+        return ROCKSIM_BULK.ordinal;
+    }
+}
+
diff --git a/core/src/net/sf/openrocket/file/rocksim/RocksimFinishCode.java b/core/src/net/sf/openrocket/file/rocksim/RocksimFinishCode.java
new file mode 100644 (file)
index 0000000..ba14ab4
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * RocksimFinishCode.java
+ */
+package net.sf.openrocket.file.rocksim;
+
+import net.sf.openrocket.rocketcomponent.ExternalComponent;
+
+/**
+ * Models the finish of a component.
+ */
+public enum RocksimFinishCode {
+    POLISHED(0, ExternalComponent.Finish.POLISHED),
+    GLOSS(1, ExternalComponent.Finish.SMOOTH),
+    MATT(2, ExternalComponent.Finish.NORMAL),
+    UNFINISHED(3, ExternalComponent.Finish.UNFINISHED);
+
+    /** The Rocksim code (from XML). */
+    private final int ordinal;
+    
+    /** The corresponding OpenRocket finish. */
+    private final ExternalComponent.Finish finish;
+
+    /**
+     * Constructor.
+     * 
+     * @param idx   the Rocksim enum value
+     * @param theFinish  the OpenRocket finish
+     */
+    private RocksimFinishCode(int idx, ExternalComponent.Finish theFinish) {
+        ordinal = idx;
+        finish = theFinish;
+    }
+
+    /**
+     * Get the OpenRocket finish.
+     * 
+     * @return a Finish instance
+     */
+    public ExternalComponent.Finish asOpenRocket() {
+        return finish;
+    }
+
+    /**
+     * Lookup an instance of this enum from a Rocksim value.
+     * 
+     * @param rocksimFinishCode  the Rocksim value
+     * 
+     * @return an instance of this enum; Defaults to MATT
+     */
+    public static RocksimFinishCode fromCode(int rocksimFinishCode) {
+        RocksimFinishCode[] values = values();
+        for (RocksimFinishCode value : values) {
+            if (value.ordinal == rocksimFinishCode) {
+                return value;
+            }
+        }
+        return MATT; //Default
+    }
+
+    /**
+     * Get the ordinal code.
+     *
+     * @param type  the OR type
+     *
+     * @return  the Rocksim XML value
+     */
+    public static int toCode(ExternalComponent.Finish type) {
+        if (type.equals(ExternalComponent.Finish.UNFINISHED)) {
+            return UNFINISHED.ordinal;
+        }
+        if (type.equals(ExternalComponent.Finish.POLISHED)) {
+            return POLISHED.ordinal;
+        }
+        if (type.equals(ExternalComponent.Finish.SMOOTH)) {
+            return GLOSS.ordinal;
+        }
+        return MATT.ordinal;
+    }
+
+}
+
diff --git a/core/src/net/sf/openrocket/file/rocksim/RocksimLocationMode.java b/core/src/net/sf/openrocket/file/rocksim/RocksimLocationMode.java
new file mode 100644 (file)
index 0000000..e16c97e
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * RocksimLocationMode.java
+ */
+package net.sf.openrocket.file.rocksim;
+
+import net.sf.openrocket.rocketcomponent.RocketComponent;
+
+/**
+ * Models the relative position of parts on a rocket.  Maps from Rocksim's notion to OpenRocket's.
+ */
+public enum RocksimLocationMode {
+    FRONT_OF_OWNING_PART (0, RocketComponent.Position.TOP),
+    FROM_TIP_OF_NOSE     (1, RocketComponent.Position.ABSOLUTE),
+    BACK_OF_OWNING_PART  (2, RocketComponent.Position.BOTTOM);
+
+    /** The value Rocksim uses internally (and in the XML file). */
+    private final int ordinal;
+    
+    /** The OpenRocket position equivalent. */
+    private final RocketComponent.Position position;
+
+    /**
+     * Constructor.
+     * 
+     * @param idx   the rocksim enum value
+     * @param theOpenRocketPosition  the corresponding OpenRocket position
+     */
+    RocksimLocationMode(int idx, RocketComponent.Position theOpenRocketPosition) {
+        ordinal = idx;
+        position = theOpenRocketPosition;
+    }
+
+    /**
+     * Get the OpenRocket position.
+     * 
+     * @return  the position instance
+     */
+    public RocketComponent.Position asOpenRocket() {
+        return position;
+    }
+
+    /**
+     * Lookup an instance of this class from a rocksim enum value.
+     * 
+     * @param rocksimCode  the rocksim enum value
+     * 
+     * @return an instance of this enum
+     */
+    public static RocksimLocationMode fromCode(int rocksimCode) {
+        RocksimLocationMode[] values = values();
+        for (RocksimLocationMode value : values) {
+            if (value.ordinal == rocksimCode) {
+                return value;
+            }
+        }
+        return FRONT_OF_OWNING_PART;
+    }
+
+    public static int toCode(RocketComponent.Position position) {
+        if (RocketComponent.Position.TOP.equals(position)) {
+            return 0;
+        }
+        if (RocketComponent.Position.ABSOLUTE.equals(position)) {
+            return 1;
+        }
+        if (RocketComponent.Position.BOTTOM.equals(position)) {
+            return 2;
+        }
+        return 0;
+    }
+}
\ No newline at end of file
diff --git a/core/src/net/sf/openrocket/file/rocksim/RocksimNoseConeCode.java b/core/src/net/sf/openrocket/file/rocksim/RocksimNoseConeCode.java
new file mode 100644 (file)
index 0000000..cd580ea
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * RocksimNoseConeCode.java
+ */
+package net.sf.openrocket.file.rocksim;
+
+import net.sf.openrocket.rocketcomponent.Transition;
+
+/**
+ * Models the nose cone shape of a rocket.  Maps from Rocksim's notion to OpenRocket's.
+ */
+public enum RocksimNoseConeCode {
+    CONICAL         (0, Transition.Shape.CONICAL),
+    OGIVE           (1, Transition.Shape.OGIVE),
+    PARABOLIC       (2, Transition.Shape.ELLIPSOID),  //Rocksim' PARABOLIC most closely resembles an ELLIPSOID in OpenRocket
+    ELLIPTICAL      (3, Transition.Shape.ELLIPSOID),
+    POWER_SERIES    (4, Transition.Shape.POWER),
+    PARABOLIC_SERIES(5, Transition.Shape.PARABOLIC),
+    HAACK           (6, Transition.Shape.HAACK);
+
+    /** The Rocksim enumeration value. Sent in XML. */
+    private final int ordinal;
+    
+    /** The corresponding OpenRocket shape. */
+    private final Transition.Shape shape;
+
+    /**
+     * Constructor.
+     * 
+     * @param idx    the Rocksim shape code
+     * @param aShape the corresponding OpenRocket shape
+     */
+    private RocksimNoseConeCode(int idx, Transition.Shape aShape) {
+        ordinal = idx;
+        shape = aShape;
+    }
+
+    /**
+     * Get the OpenRocket shape that corresponds to the Rocksim shape.
+     * 
+     * @return a shape
+     */
+    public Transition.Shape asOpenRocket() {
+        return shape;
+    }
+
+    /**
+     * Lookup an instance of this enum based upon the Rocksim code.
+     * 
+     * @param rocksimShapeCode  the Rocksim code (from XML)
+     * @return an instance of this enum
+     */
+    public static RocksimNoseConeCode fromCode(int rocksimShapeCode) {
+        RocksimNoseConeCode[] values = values();
+        for (RocksimNoseConeCode value : values) {
+            if (value.ordinal == rocksimShapeCode) {
+                return value;
+            }
+        }
+        return PARABOLIC; //Default
+    }
+
+    /**
+     * Lookup an ordinal value for the Rocksim code.
+     * 
+     * @param type  the OR Shape
+     *              
+     * @return the Rocksim code
+     */
+    public static int toCode(Transition.Shape type) {
+        RocksimNoseConeCode[] values = values();
+        for (RocksimNoseConeCode value : values) {
+            if (value.shape.equals(type)) {
+                if (value.ordinal == 2) {
+                    return 3;
+                }
+                return value.ordinal;
+            }
+        }
+        return ELLIPTICAL.ordinal; //Default
+    }
+}
diff --git a/core/src/net/sf/openrocket/file/rocksim/TipShapeCode.java b/core/src/net/sf/openrocket/file/rocksim/TipShapeCode.java
deleted file mode 100644 (file)
index 976bdc9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.sf.openrocket.file.rocksim;
-
-import net.sf.openrocket.rocketcomponent.FinSet;
-
-/**
- */
-public final class TipShapeCode {
-
-    /**
-     * Convert a Rocksim tip shape to an OpenRocket CrossSection.
-     *
-     * @param tipShape the tip shape code from Rocksim
-     *
-     * @return a CrossSection instance
-     */
-    public static FinSet.CrossSection convertTipShapeCode (int tipShape) {
-        switch (tipShape) {
-            case 0:
-                return FinSet.CrossSection.SQUARE;
-            case 1:
-                return FinSet.CrossSection.ROUNDED;
-            case 2:
-                return FinSet.CrossSection.AIRFOIL;
-            default:
-                return FinSet.CrossSection.SQUARE;
-        }
-    }
-
-    public static int convertTipShapeCode (FinSet.CrossSection cs) {
-        if (FinSet.CrossSection.ROUNDED.equals(cs)) {
-            return 1;
-        }
-        if (FinSet.CrossSection.AIRFOIL.equals(cs)) {
-            return 2;
-        }
-        return 0;
-    }
-}
index 10386bbede5073b22d5a7443fb6a75f688e02224..88b19e4c657402db89d55643df18a2faa724cd10 100644 (file)
@@ -1,7 +1,7 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
-import net.sf.openrocket.file.rocksim.importt.RocksimNoseConeCode;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimNoseConeCode;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.Bulkhead;
 import net.sf.openrocket.rocketcomponent.CenteringRing;
@@ -31,25 +31,25 @@ import java.util.List;
 @XmlAccessorType(XmlAccessType.FIELD)
 public class AbstractTransitionDTO extends BasePartDTO {
 
-    @XmlElement(name = "ShapeCode")
+    @XmlElement(name = RocksimCommonConstants.SHAPE_CODE)
     private int shapeCode = 1;
-    @XmlElement(name = "ConstructionType")
+    @XmlElement(name = RocksimCommonConstants.CONSTRUCTION_TYPE)
     private int constructionType = 1;
-    @XmlElement(name = "WallThickness")
+    @XmlElement(name = RocksimCommonConstants.WALL_THICKNESS)
     private double wallThickness = 0d;
-    @XmlElement(name = "ShapeParameter")
+    @XmlElement(name = RocksimCommonConstants.SHAPE_PARAMETER)
     private double shapeParameter = 0d;
 
-    @XmlElementWrapper(name = "AttachedParts")
+    @XmlElementWrapper(name = RocksimCommonConstants.ATTACHED_PARTS)
     @XmlElementRefs({
-            @XmlElementRef(name = "BodyTube", type = BodyTubeDTO.class),
-            @XmlElementRef(name = "BodyTube", type = InnerBodyTubeDTO.class),
-            @XmlElementRef(name = "FinSet", type = FinSetDTO.class),
-            @XmlElementRef(name = "CustomFinSet", type = CustomFinSetDTO.class),
-            @XmlElementRef(name = "Ring", type = CenteringRingDTO.class),
-            @XmlElementRef(name = "Streamer", type = StreamerDTO.class),
-            @XmlElementRef(name = "Parachute", type = ParachuteDTO.class),
-            @XmlElementRef(name = "MassObject", type = MassObjectDTO.class)})
+            @XmlElementRef(name = RocksimCommonConstants.BODY_TUBE, type = BodyTubeDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.BODY_TUBE, type = InnerBodyTubeDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.FIN_SET, type = FinSetDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.CUSTOM_FIN_SET, type = CustomFinSetDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.RING, type = CenteringRingDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.STREAMER, type = StreamerDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.PARACHUTE, type = ParachuteDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.MASS_OBJECT, type = MassObjectDTO.class)})
     List<BasePartDTO> attachedParts = new ArrayList<BasePartDTO>();
 
     /**
@@ -74,7 +74,7 @@ public class AbstractTransitionDTO extends BasePartDTO {
             setShapeParameter(nc.getShapeParameter());
         }
 
-        setWallThickness(nc.getThickness() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setWallThickness(nc.getThickness() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
 
         List<RocketComponent> children = nc.getChildren();
         for (int i = 0; i < children.size(); i++) {
index 8c79575e3face833b52fb1f71013bfdeff1877e3..9f87a41403029cf5411e86ab371a1224e03e53fc 100644 (file)
@@ -1,13 +1,15 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimDensityType;
+import net.sf.openrocket.file.rocksim.RocksimFinishCode;
+import net.sf.openrocket.file.rocksim.RocksimLocationMode;
 import net.sf.openrocket.file.rocksim.importt.BaseHandler;
-import net.sf.openrocket.file.rocksim.importt.RocksimDensityType;
-import net.sf.openrocket.file.rocksim.importt.RocksimFinishCode;
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
-import net.sf.openrocket.file.rocksim.importt.RocksimLocationMode;
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
 import net.sf.openrocket.rocketcomponent.FinSet;
+import net.sf.openrocket.rocketcomponent.MassObject;
 import net.sf.openrocket.rocketcomponent.RecoveryDevice;
+import net.sf.openrocket.rocketcomponent.RingComponent;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
 import net.sf.openrocket.rocketcomponent.StructuralComponent;
 
@@ -23,35 +25,35 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.FIELD)
 public abstract class BasePartDTO {
 
-    @XmlElement(name = "KnownMass")
-    private Double knownMass = 0d;
-    @XmlElement(name = "Density")
+    @XmlElement(name = RocksimCommonConstants.KNOWN_MASS)
+    private double knownMass = 0d;
+    @XmlElement(name = RocksimCommonConstants.DENSITY)
     private double density = 0d;
-    @XmlElement(name = "Material")
+    @XmlElement(name = RocksimCommonConstants.MATERIAL)
     private String material = "";
-    @XmlElement(name = "Name")
+    @XmlElement(name = RocksimCommonConstants.NAME)
     private String name = "";
-    @XmlElement(name = "KnownCG")
-    private Double knownCG = null;
-    @XmlElement(name = "UseKnownCG")
+    @XmlElement(name = RocksimCommonConstants.KNOWN_CG)
+    private double knownCG = 0;
+    @XmlElement(name = RocksimCommonConstants.USE_KNOWN_CG)
     private int useKnownCG = 1;
-    @XmlElement(name = "Xb")
+    @XmlElement(name = RocksimCommonConstants.XB)
     private double xb = 0;
-    @XmlElement(name = "CalcMass")
+    @XmlElement(name = RocksimCommonConstants.CALC_MASS)
     private double calcMass = 0d;
-    @XmlElement(name = "CalcCG")
+    @XmlElement(name = RocksimCommonConstants.CALC_CG)
     private double calcCG = 0d;
-    @XmlElement(name = "DensityType")
+    @XmlElement(name = RocksimCommonConstants.DENSITY_TYPE)
     private int densityType = 0;
-    @XmlElement(name = "RadialLoc")
-    private String radialLoc = "0.";
-    @XmlElement(name = "RadialAngle")
+    @XmlElement(name = RocksimCommonConstants.RADIAL_LOC)
+    private double radialLoc = 0;
+    @XmlElement(name = RocksimCommonConstants.RADIAL_ANGLE)
     private double radialAngle = 0;
-    @XmlElement(name = "LocationMode")
+    @XmlElement(name = RocksimCommonConstants.LOCATION_MODE)
     private int locationMode = 0;
-    @XmlElement(name = "Len", required = false, nillable = false)
+    @XmlElement(name = RocksimCommonConstants.LEN, required = false, nillable = false)
     private double len = 0d;
-    @XmlElement(name = "FinishCode")
+    @XmlElement(name = RocksimCommonConstants.FINISH_CODE)
     private int finishCode = 0;
 
     /**
@@ -66,34 +68,35 @@ public abstract class BasePartDTO {
      * @param ec
      */
     protected BasePartDTO(RocketComponent ec) {
-        setCalcCG(ec.getCG().x * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setCalcMass(ec.getComponentMass() * RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
-        setKnownCG(ec.getOverrideCGX() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setKnownMass(ec.getOverrideMass() * RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
+        setCalcCG(ec.getCG().x * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setCalcMass(ec.getComponentMass() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
+        setKnownCG(ec.getOverrideCGX() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setKnownMass(ec.getOverrideMass() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
+
         if (! (ec instanceof FinSet)) {
-            setLen(ec.getLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setLen(ec.getLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         }
         setUseKnownCG(ec.isCGOverridden() || ec.isMassOverridden() ? 1 : 0);
         setName(ec.getName());
 
-        setXb(ec.getPositionValue() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setXb(ec.getPositionValue() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
 
         //When the relative position is BOTTOM, the position location of the bottom edge of the component is +
         //to the right of the bottom of the parent, and - to the left.
         //But in Rocksim, it's + to the left and - to the right
         if (ec.getRelativePosition().equals(RocketComponent.Position.BOTTOM)) {
-            setXb((-1 * ec.getPositionValue()) * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setXb((-1 * ec.getPositionValue()) * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         }
         else if (ec.getRelativePosition().equals(RocketComponent.Position.MIDDLE)) {
             //Mapped to TOP, so adjust accordingly
-            setXb((ec.getPositionValue() + (ec.getParent().getLength() - ec.getLength()) /2)* RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setXb((ec.getPositionValue() + (ec.getParent().getLength() - ec.getLength()) /2)* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         }
 
         if (ec instanceof ExternalComponent) {
             ExternalComponent comp = (ExternalComponent) ec;
             setLocationMode(RocksimLocationMode.toCode(comp.getRelativePosition()));
 
-            setDensity(comp.getMaterial().getDensity() * RocksimHandler.ROCKSIM_TO_OPENROCKET_BULK_DENSITY);
+            setDensity(comp.getMaterial().getDensity() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_BULK_DENSITY);
             setDensityType(RocksimDensityType.toCode(comp.getMaterial().getType()));
             String material = comp.getMaterial().getName();
             if (material.startsWith(BaseHandler.ROCKSIM_MATERIAL_PREFIX)) {
@@ -107,7 +110,7 @@ public abstract class BasePartDTO {
             StructuralComponent comp = (StructuralComponent) ec;
 
             setLocationMode(RocksimLocationMode.toCode(comp.getRelativePosition()));
-            setDensity(comp.getMaterial().getDensity() * RocksimHandler.ROCKSIM_TO_OPENROCKET_BULK_DENSITY);
+            setDensity(comp.getMaterial().getDensity() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_BULK_DENSITY);
             setDensityType(RocksimDensityType.toCode(comp.getMaterial().getType()));
             String material = comp.getMaterial().getName();
             if (material.startsWith(BaseHandler.ROCKSIM_MATERIAL_PREFIX)) {
@@ -119,7 +122,7 @@ public abstract class BasePartDTO {
             RecoveryDevice comp = (RecoveryDevice) ec;
 
             setLocationMode(RocksimLocationMode.toCode(comp.getRelativePosition()));
-            setDensity(comp.getMaterial().getDensity() * RocksimHandler.ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY);
+            setDensity(comp.getMaterial().getDensity() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY);
             setDensityType(RocksimDensityType.toCode(comp.getMaterial().getType()));
             String material = comp.getMaterial().getName();
             if (material.startsWith(BaseHandler.ROCKSIM_MATERIAL_PREFIX)) {
@@ -127,6 +130,17 @@ public abstract class BasePartDTO {
             }
             setMaterial(material);
         }
+
+        if (ec instanceof RingComponent) {
+            RingComponent rc = (RingComponent)ec;
+            setRadialAngle(rc.getRadialDirection());
+            setRadialLoc(rc.getRadialPosition() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        }
+        else if (ec instanceof MassObject) {
+            MassObject rc = (MassObject)ec;
+            setRadialAngle(rc.getRadialDirection());
+            setRadialLoc(rc.getRadialPosition() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        }
     }
 
     public Double getKnownMass() {
@@ -209,11 +223,11 @@ public abstract class BasePartDTO {
         densityType = theDensityType;
     }
 
-    public String getRadialLoc() {
+    public double getRadialLoc() {
         return radialLoc;
     }
 
-    public void setRadialLoc(String theRadialLoc) {
+    public void setRadialLoc(double theRadialLoc) {
         radialLoc = theRadialLoc;
     }
 
index f9325d857d4040c1fb777aa30e9ea1ccdbd8e249..a39a2f77d486c67c9e3e3cd5a27eeb475f297e41 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.Bulkhead;
 import net.sf.openrocket.rocketcomponent.CenteringRing;
@@ -28,33 +28,33 @@ import java.util.List;
 
 /**
  */
-@XmlRootElement(name = "BodyTube")
+@XmlRootElement(name = RocksimCommonConstants.BODY_TUBE)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class BodyTubeDTO extends BasePartDTO {
 
-    @XmlElement(name = "OD")
+    @XmlElement(name = RocksimCommonConstants.OD)
     private double od = 0d;
-    @XmlElement(name = "ID")
+    @XmlElement(name = RocksimCommonConstants.ID)
     private double id = 0d;
-    @XmlElement(name = "IsMotorMount")
+    @XmlElement(name = RocksimCommonConstants.IS_MOTOR_MOUNT)
     private int isMotorMount = 0;
-    @XmlElement(name = "MotorDia")
+    @XmlElement(name = RocksimCommonConstants.MOTOR_DIA)
     private double motorDia = 0d;
-    @XmlElement(name = "EngineOverhang")
+    @XmlElement(name = RocksimCommonConstants.ENGINE_OVERHANG)
     private double engineOverhang = 0d;
-    @XmlElement(name = "IsInsideTube")
+    @XmlElement(name = RocksimCommonConstants.IS_INSIDE_TUBE)
     private int isInsideTube = 0;
-    @XmlElementWrapper(name = "AttachedParts")
+    @XmlElementWrapper(name = RocksimCommonConstants.ATTACHED_PARTS)
     @XmlElementRefs({
-            @XmlElementRef(name = "BodyTube", type = BodyTubeDTO.class),
-            @XmlElementRef(name = "BodyTube", type = InnerBodyTubeDTO.class),
-            @XmlElementRef(name = "Ring", type = CenteringRingDTO.class),
-            @XmlElementRef(name = "LaunchLug", type = LaunchLugDTO.class),
-            @XmlElementRef(name = "FinSet", type = FinSetDTO.class),
-            @XmlElementRef(name = "CustomFinSet", type = CustomFinSetDTO.class),
-            @XmlElementRef(name = "Streamer", type = StreamerDTO.class),
-            @XmlElementRef(name = "Parachute", type = ParachuteDTO.class),
-            @XmlElementRef(name = "MassObject", type = MassObjectDTO.class)})
+            @XmlElementRef(name = RocksimCommonConstants.BODY_TUBE, type = BodyTubeDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.BODY_TUBE, type = InnerBodyTubeDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.RING, type = CenteringRingDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.LAUNCH_LUG, type = LaunchLugDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.FIN_SET, type = FinSetDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.CUSTOM_FIN_SET, type = CustomFinSetDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.STREAMER, type = StreamerDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.PARACHUTE, type = ParachuteDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.MASS_OBJECT, type = MassObjectDTO.class)})
     List<BasePartDTO> attachedParts = new ArrayList<BasePartDTO>();
 
     public BodyTubeDTO() {
@@ -67,10 +67,10 @@ public class BodyTubeDTO extends BasePartDTO {
     public BodyTubeDTO(BodyTube bt) {
         super(bt);
 
-        setEngineOverhang(bt.getMotorOverhang() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setId(bt.getInnerRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setOd(bt.getOuterRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setMotorDia((bt.getMotorMountDiameter() / 2) * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setEngineOverhang(bt.getMotorOverhang() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setId(bt.getInnerRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setOd(bt.getOuterRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setMotorDia((bt.getMotorMountDiameter() / 2) * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
         setMotorMount(bt.isMotorMount());
 
         List<RocketComponent> children = bt.getChildren();
index c5a82bfc84615542dba7855082cf2cddcd546463..847c7dc2390dcb8d8858db2b77d0729829130b47 100644 (file)
@@ -1,5 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.Bulkhead;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -7,10 +8,17 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
+ * Conversion of an OR Bulkhead to an Rocksim Bulkhead.  Bulkheads are represented as Rings in Rocksim.
  */
-@XmlRootElement(name = "Ring")
+@XmlRootElement(name = RocksimCommonConstants.RING)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class BulkheadDTO extends CenteringRingDTO {
+
+    /**
+     * Constructor.
+     *
+     * @param bh bulkhead
+     */
     public BulkheadDTO(Bulkhead bh) {
         super(bh);
         setUsageCode(CenteringRingDTO.UsageCode.Bulkhead);
index e2e8a7c88602952c1c18d8959caab4f5cd10013a..742999a378776daedb4a8b26da648bc33fc09bfe 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.RadiusRingComponent;
 import net.sf.openrocket.rocketcomponent.ThicknessRingComponent;
 
@@ -11,8 +11,9 @@ import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 /**
+ * Centering ring conversion from OR to Rocksim.
  */
-@XmlRootElement(name = "Ring")
+@XmlRootElement(name = RocksimCommonConstants.RING)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class CenteringRingDTO extends BasePartDTO {
 
@@ -32,13 +33,13 @@ public class CenteringRingDTO extends BasePartDTO {
         }
     }
 
-    @XmlElement(name = "OD")
+    @XmlElement(name = RocksimCommonConstants.OD)
     private double od = 0d;
-    @XmlElement(name = "ID")
+    @XmlElement(name = RocksimCommonConstants.ID)
     private double id = 0d;
-    @XmlElement(name = "UsageCode")
+    @XmlElement(name = RocksimCommonConstants.USAGE_CODE)
     private int usageCode = UsageCode.CenteringRing.ordinal;
-    @XmlElement(name = "AutoSize")
+    @XmlElement(name = RocksimCommonConstants.AUTO_SIZE)
     private int autoSize = 0;
 
     public CenteringRingDTO() {
@@ -46,14 +47,14 @@ public class CenteringRingDTO extends BasePartDTO {
     }
     public CenteringRingDTO(RadiusRingComponent cr) {
         super(cr);
-        setId(cr.getInnerRadius()* RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setOd(cr.getOuterRadius()* RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setId(cr.getInnerRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setOd(cr.getOuterRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
     }
 
     public CenteringRingDTO(ThicknessRingComponent trc) {
         super(trc);
-        setId(trc.getInnerRadius()* RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setOd(trc.getOuterRadius()* RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setId(trc.getInnerRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setOd(trc.getOuterRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
     }
     public double getOd() {
         return od;
index f37c9fecfecc747dc9ea86639d46a454efd75367..c7f95ac225509b880cb61439dfb5213e0798e837 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.FreeformFinSet;
 import net.sf.openrocket.util.Coordinate;
 
@@ -11,16 +11,24 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "CustomFinSet")
+@XmlRootElement(name = RocksimCommonConstants.CUSTOM_FIN_SET)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class CustomFinSetDTO extends FinSetDTO {
 
-    @XmlElement(name = "PointList")
+    @XmlElement(name = RocksimCommonConstants.POINT_LIST)
     private String pointList = "";
 
+    /**
+     * Default constructor.
+     */
     public CustomFinSetDTO() {
     }
 
+    /**
+     * Copy constructor of sorts.
+     *
+     * @param ec  a free form finset
+     */
     public CustomFinSetDTO(FreeformFinSet ec) {
         super(ec);
         setPointList(convertFreeFormPoints(ec.getFinPoints()));
@@ -33,8 +41,8 @@ public class CustomFinSetDTO extends FinSetDTO {
         //Reverse the order for Rocksim
         for (int i = points.length - 1; i >= 0; i--) {
             Coordinate point = points[i];
-            sb.append(point.x * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH).append(",")
-                    .append(point.y * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH).append("|");
+            sb.append(point.x * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH).append(",")
+                    .append(point.y * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH).append("|");
         }
         return sb.toString();
     }
index 03ba5e377b7a6370cd0f75179bc0f1471be61fb1..b8238dd7eb0be88d3d48311082c2c34430911317 100644 (file)
@@ -1,7 +1,7 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.TipShapeCode;
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.TipShapeCode;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.EllipticalFinSet;
 import net.sf.openrocket.rocketcomponent.FinSet;
 import net.sf.openrocket.rocketcomponent.FreeformFinSet;
@@ -14,35 +14,35 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "FinSet")
+@XmlRootElement(name = RocksimCommonConstants.FIN_SET)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class FinSetDTO extends BasePartDTO {
 
-    @XmlElement(name = "FinCount")
+    @XmlElement(name = RocksimCommonConstants.FIN_COUNT)
     private int finCount = 0;
-    @XmlElement(name = "RootChord")
+    @XmlElement(name = RocksimCommonConstants.ROOT_CHORD)
     private double rootChord = 0d;
-    @XmlElement(name = "TipChord")
+    @XmlElement(name = RocksimCommonConstants.TIP_CHORD)
     private double tipChord = 0d;
-    @XmlElement(name = "SemiSpan")
+    @XmlElement(name = RocksimCommonConstants.SEMI_SPAN)
     private double semiSpan = 0d;
-    @XmlElement(name = "SweepDistance")
+    @XmlElement(name = RocksimCommonConstants.SWEEP_DISTANCE)
     private double sweepDistance = 0d;
-    @XmlElement(name = "Thickness")
+    @XmlElement(name = RocksimCommonConstants.THICKNESS)
     private double thickness = 0d;
-    @XmlElement(name = "ShapeCode")
+    @XmlElement(name = RocksimCommonConstants.SHAPE_CODE)
     private int shapeCode = 0;
-    @XmlElement(name = "TipShapeCode")
+    @XmlElement(name = RocksimCommonConstants.TIP_SHAPE_CODE)
     private int tipShapeCode = 0;
-    @XmlElement(name = "TabLength")
+    @XmlElement(name = RocksimCommonConstants.TAB_LENGTH)
     private double tabLength = 0d;
-    @XmlElement(name = "TabDepth")
+    @XmlElement(name = RocksimCommonConstants.TAB_DEPTH)
     private double tabDepth = 0d;
-    @XmlElement(name = "TabOffset")
+    @XmlElement(name = RocksimCommonConstants.TAB_OFFSET)
     private double tabOffset = 0d;
-    @XmlElement(name = "SweepMode")
+    @XmlElement(name = RocksimCommonConstants.SWEEP_MODE)
     private int sweepMode = 1;
-    @XmlElement(name = "CantAngle")
+    @XmlElement(name = RocksimCommonConstants.CANT_ANGLE)
     private double cantAngle = 0d;
 
     public FinSetDTO() {
@@ -53,26 +53,26 @@ public class FinSetDTO extends BasePartDTO {
 
         setFinCount(ec.getFinCount());
         setCantAngle(ec.getCantAngle());
-        setTabDepth(ec.getTabHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setTabLength(ec.getTabLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setTabOffset(ec.getTabShift() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setThickness(ec.getThickness() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setTabDepth(ec.getTabHeight() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setTabLength(ec.getTabLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setTabOffset(ec.getTabShift() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setThickness(ec.getThickness() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
 
         setRadialAngle(ec.getBaseRotation());
         setTipShapeCode(TipShapeCode.convertTipShapeCode(ec.getCrossSection()));
         if (ec instanceof TrapezoidFinSet) {
             TrapezoidFinSet tfs = (TrapezoidFinSet) ec;
             setShapeCode(0);
-            setRootChord(ec.getLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-            setSemiSpan(tfs.getHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-            setTipChord(tfs.getTipChord() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-            setSweepDistance(tfs.getSweep() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setRootChord(ec.getLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setSemiSpan(tfs.getHeight() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setTipChord(tfs.getTipChord() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setSweepDistance(tfs.getSweep() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         }
         else if (ec instanceof EllipticalFinSet) {
             EllipticalFinSet efs = (EllipticalFinSet) ec;
             setShapeCode(1);
-            setRootChord(ec.getLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-            setSemiSpan(efs.getHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setRootChord(ec.getLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+            setSemiSpan(efs.getHeight() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         }
         else if (ec instanceof FreeformFinSet) {
             setShapeCode(2);
index c898abb2e61c9f637016ed693d2009e0843d022a..a2343c8937825455f7823d1f4fcca72414f571d6 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.Bulkhead;
 import net.sf.openrocket.rocketcomponent.CenteringRing;
@@ -20,7 +20,7 @@ import java.util.List;
 
 /**
  */
-@XmlRootElement(name = "BodyTube")
+@XmlRootElement(name = RocksimCommonConstants.BODY_TUBE)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class InnerBodyTubeDTO extends BodyTubeDTO {
 
@@ -30,10 +30,10 @@ public class InnerBodyTubeDTO extends BodyTubeDTO {
 
     public InnerBodyTubeDTO(InnerTube bt) {
         super(bt);
-        setEngineOverhang(bt.getMotorOverhang() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setId(bt.getInnerRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setOd(bt.getOuterRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setMotorDia((bt.getMotorMountDiameter() / 2) * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setEngineOverhang(bt.getMotorOverhang() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setId(bt.getInnerRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setOd(bt.getOuterRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setMotorDia((bt.getMotorMountDiameter() / 2) * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
         setMotorMount(bt.isMotorMount());
 
         List<RocketComponent> children = bt.getChildren();
index f2932c832ba61aa427faa6b17473db6add29f8fa..27408228860c6ff5771806ac284ef98939828e05 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.LaunchLug;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -10,13 +10,13 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "LaunchLug")
+@XmlRootElement(name = RocksimCommonConstants.LAUNCH_LUG)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class LaunchLugDTO extends BasePartDTO {
 
-    @XmlElement(name = "OD")
+    @XmlElement(name = RocksimCommonConstants.OD)
     private double od = 0d;
-    @XmlElement(name = "ID")
+    @XmlElement(name = RocksimCommonConstants.ID)
     private double id = 0d;
 
     public LaunchLugDTO() {
@@ -24,8 +24,8 @@ public class LaunchLugDTO extends BasePartDTO {
 
     public LaunchLugDTO(LaunchLug ec) {
         super(ec);
-        setId(ec.getInnerRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setOd(ec.getOuterRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setId(ec.getInnerRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setOd(ec.getOuterRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
         setRadialAngle(ec.getRadialDirection());
     }
 
index ea48844d8540416d4d7a78f19e972004ad9cfd68..de182a9bb1a0f405cb6ee027a578d7a74b7a301b 100644 (file)
@@ -1,5 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.MassObject;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -8,18 +9,27 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
+ * Class that models a Rocksim MassObject.
  */
-@XmlRootElement(name = "MassObject")
+@XmlRootElement(name = RocksimCommonConstants.MASS_OBJECT)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class MassObjectDTO extends BasePartDTO{
 
-    @XmlElement(name = "TypeCode")
+    @XmlElement(name = RocksimCommonConstants.TYPE_CODE)
     private int typeCode = 0;
 
+    /**
+     * Default constructor.
+     */
     public MassObjectDTO() {
     }
 
-    public MassObjectDTO(MassObject ec) {
-        super(ec);
+    /**
+     * Typed constructor.
+     *
+     * @param mo  OR MassObject
+     */
+    public MassObjectDTO(MassObject mo) {
+        super(mo);
     }
 }
index 5a5f250879d451d161c38cad5cab8af254537dd4..aa838e0df8643327ec08bfc05aa4a7193e884f67 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.NoseCone;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -10,26 +10,34 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "NoseCone")
+@XmlRootElement(name = RocksimCommonConstants.NOSE_CONE)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class NoseConeDTO extends AbstractTransitionDTO {
 
 
-    @XmlElement(name = "BaseDia")
+    @XmlElement(name = RocksimCommonConstants.BASE_DIA)
     private double baseDia = 0d;
-    @XmlElement(name = "ShoulderLen")
+    @XmlElement(name = RocksimCommonConstants.SHOULDER_LEN)
     private double shoulderLen = 0d;
-    @XmlElement(name = "ShoulderOD")
+    @XmlElement(name = RocksimCommonConstants.SHOULDER_OD)
     private double shoulderOD = 0d;
 
+    /**
+     * Default constructor.
+     */
     public NoseConeDTO() {
     }
 
+    /**
+     * Full copy constructor.
+     *
+     * @param nc  the OR nose cone
+     */
     public NoseConeDTO(NoseCone nc) {
         super(nc);
-        setBaseDia(nc.getAftRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setShoulderLen(nc.getAftShoulderLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setShoulderOD(nc.getAftShoulderRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setBaseDia(nc.getAftRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setShoulderLen(nc.getAftShoulderLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setShoulderOD(nc.getAftShoulderRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
     }
 
     public double getBaseDia() {
index eb612227df17346e837eb34819008fe6c7a6f832..de60dfc7b5736aa8e9cee7f5307dd83733685795 100644 (file)
@@ -1,7 +1,7 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.rocksim.importt.BaseHandler;
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
 import net.sf.openrocket.rocketcomponent.Parachute;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -11,27 +11,27 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "Parachute")
+@XmlRootElement(name = RocksimCommonConstants.PARACHUTE)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class ParachuteDTO extends BasePartDTO {
 
-    @XmlElement(name = "Dia")
+    @XmlElement(name = RocksimCommonConstants.DIAMETER)
     private double dia = 0d;
-    @XmlElement(name = "SpillHoleDia")
+    @XmlElement(name = RocksimCommonConstants.SPILL_HOLE_DIA)
     private double spillHoleDia = 0d;
-    @XmlElement(name = "ShroudLineCount")
+    @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_COUNT)
     private int ShroudLineCount = 0;
-    @XmlElement(name = "Thickness")
+    @XmlElement(name = RocksimCommonConstants.THICKNESS)
     private double thickness = 0d;
-    @XmlElement(name = "ShroudLineLen")
+    @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_LEN)
     private double shroudLineLen = 0d;
-    @XmlElement(name = "ChuteCount")
+    @XmlElement(name = RocksimCommonConstants.CHUTE_COUNT)
     private int chuteCount = 1;
-    @XmlElement(name = "ShroudLineMassPerMM")
+    @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_MASS_PER_MM)
     private double shroudLineMassPerMM = 0d;
-    @XmlElement(name = "ShroudLineMaterial")
+    @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_MATERIAL)
     private String shroudLineMaterial = "";
-    @XmlElement(name = "DragCoefficient")
+    @XmlElement(name = RocksimCommonConstants.DRAG_COEFFICIENT)
     private double dragCoefficient = 0.75d;
     
     public ParachuteDTO() {
@@ -41,13 +41,13 @@ public class ParachuteDTO extends BasePartDTO {
         super(ec);
         
         setChuteCount(1);
-        setDia(ec.getDiameter() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setDia(ec.getDiameter() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         setDragCoefficient(ec.getCD());
         setShroudLineCount(ec.getLineCount());
-        setShroudLineLen(ec.getLineLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setShroudLineLen(ec.getLineLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
 
         String material = ec.getLineMaterial().getName();
-        setShroudLineMassPerMM(ec.getLineMaterial().getDensity() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LINE_DENSITY);
+        setShroudLineMassPerMM(ec.getLineMaterial().getDensity() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LINE_DENSITY);
 
         if (material.startsWith(BaseHandler.ROCKSIM_MATERIAL_PREFIX)) {
             material = material.substring(BaseHandler.ROCKSIM_MATERIAL_PREFIX.length());
index 5612925088b8cfc68204f5766a4e89061be04a47..3dfffe81cc6a14b260079eadae74d2d5481e94c7 100644 (file)
@@ -1,24 +1,40 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 
 /**
+ * High-level placeholder element for Rocksim.
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 public class RocksimDesignDTO {
 
-    @XmlElement(name = "RocketDesign")
+    @XmlElement(name = RocksimCommonConstants.ROCKET_DESIGN)
     private RocketDesignDTO design;
 
+    /**
+     * Constructor.
+     */
     public RocksimDesignDTO() {
     }
 
+    /**
+     * Get the DTO.
+     *
+     * @return the DTO
+     */
     public RocketDesignDTO getDesign() {
         return design;
     }
 
+    /**
+     * Set the DTO.
+     *
+     * @param theDesign  the DTO
+     */
     public void setDesign(RocketDesignDTO theDesign) {
         design = theDesign;
     }
index 681f408642a3705284138b81ec474a9a14cd2408..99e65ca3246ef328f9e45ca425e63b332f202f8a 100644 (file)
@@ -1,31 +1,54 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-@XmlRootElement(name = "RockSimDocument")
+/**
+ * The top level Rocksim document.
+ */
+@XmlRootElement(name = RocksimCommonConstants.ROCK_SIM_DOCUMENT)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class RocksimDocumentDTO {
-    
-    @XmlElement(name = "FileVersion")
+
+    @XmlElement(name = RocksimCommonConstants.FILE_VERSION)
     private final String version = "4";
 
-    @XmlElement(name = "DesignInformation")
+    @XmlElement(name = RocksimCommonConstants.DESIGN_INFORMATION)
     private RocksimDesignDTO design;
 
+    /**
+     * Constructor.
+     */
     public RocksimDocumentDTO() {
     }
 
+    /**
+     * Get the subordinate design DTO.
+     *
+     * @return  the RocksimDesignDTO
+     */
     public RocksimDesignDTO getDesign() {
         return design;
     }
 
+    /**
+     * Setter.
+     *
+     * @param theDesign
+     */
     public void setDesign(RocksimDesignDTO theDesign) {
         this.design = theDesign;
     }
 
+    /**
+     * Getter.
+     *
+     * @return
+     */
     public String getVersion() {
         return version;
     }
index 112be2c6280f0bb473040bae1634b7577304659a..e70944600510ac5ddb5757dc96bc5780a95e05ac 100644 (file)
@@ -1,5 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.util.ArrayList;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -9,17 +10,21 @@ import javax.xml.bind.annotation.XmlElementRefs;
 import java.util.List;
 
 /**
+ * Placeholder for a Rocksim Stage.
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 public class StageDTO {
 
     @XmlElementRefs({
-            @XmlElementRef(name = "BodyTube", type = BodyTubeDTO.class),
-            @XmlElementRef(name = "NoseCone", type = NoseConeDTO.class),
-            @XmlElementRef(name = "Transition", type = TransitionDTO.class)
+            @XmlElementRef(name = RocksimCommonConstants.BODY_TUBE, type = BodyTubeDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.NOSE_CONE, type = NoseConeDTO.class),
+            @XmlElementRef(name = RocksimCommonConstants.TRANSITION, type = TransitionDTO.class)
     })
     private List<BasePartDTO> externalPart = new ArrayList<BasePartDTO>();
 
+    /**
+     * Default constructor.
+     */
     public StageDTO() {
     }
 
index cb687666e535346e4daa85fbe31b98888f5413c7..dbcd6489551934766bbda226260f4ae00f22b82b 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.Streamer;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -10,13 +10,13 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "Streamer")
+@XmlRootElement(name = RocksimCommonConstants.STREAMER)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class StreamerDTO extends BasePartDTO {
 
-        @XmlElement(name = "Width")
+    @XmlElement(name = RocksimCommonConstants.WIDTH)
         private double width = 0d;
-        @XmlElement(name = "DragCoefficient")
+        @XmlElement(name = RocksimCommonConstants.DRAG_COEFFICIENT)
         private double dragCoefficient = 0.75d;
 
     public StreamerDTO() {
@@ -24,7 +24,7 @@ public class StreamerDTO extends BasePartDTO {
 
     public StreamerDTO(Streamer ec) {
         super(ec);
-        setWidth(ec.getStripWidth() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setWidth(ec.getStripWidth() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
         setDragCoefficient(ec.getCD());
     }
 
index 5d668303becb037193f90320ebdd156a7970a14a..bf46747669c498b0ae475358dd7b2d326082a02f 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
-import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.Transition;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -10,22 +10,22 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 /**
  */
-@XmlRootElement(name = "Transition")
+@XmlRootElement(name = RocksimCommonConstants.TRANSITION)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class TransitionDTO extends AbstractTransitionDTO {
 
 
-    @XmlElement(name = "FrontShoulderLen")
+    @XmlElement(name = RocksimCommonConstants.FRONT_SHOULDER_LEN)
     private double frontShoulderLen = 0d;
-    @XmlElement(name = "RearShoulderLen")
+    @XmlElement(name = RocksimCommonConstants.REAR_SHOULDER_LEN)
     private double rearShoulderLen = 0d;
-    @XmlElement(name = "FrontShoulderDia")
+    @XmlElement(name = RocksimCommonConstants.FRONT_SHOULDER_DIA)
     private double frontShoulderDia = 0d;
-    @XmlElement(name = "RearShoulderDia")
+    @XmlElement(name = RocksimCommonConstants.REAR_SHOULDER_DIA)
     private double rearShoulderDia = 0d;
-    @XmlElement(name = "FrontDia")
+    @XmlElement(name = RocksimCommonConstants.FRONT_DIA)
     private double frontDia = 0d;
-    @XmlElement(name = "RearDia")
+    @XmlElement(name = RocksimCommonConstants.REAR_DIA)
     private double rearDia = 0d;
 
     public TransitionDTO() {
@@ -33,12 +33,12 @@ public class TransitionDTO extends AbstractTransitionDTO {
 
     public TransitionDTO(Transition tran) {
         super(tran);
-        setFrontDia(tran.getForeRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setRearDia(tran.getAftRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setFrontShoulderDia(tran.getForeShoulderRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setFrontShoulderLen(tran.getForeShoulderLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
-        setRearShoulderDia(tran.getAftShoulderRadius() * RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
-        setRearShoulderLen(tran.getAftShoulderLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setFrontDia(tran.getForeRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setRearDia(tran.getAftRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setFrontShoulderDia(tran.getForeShoulderRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setFrontShoulderLen(tran.getForeShoulderLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+        setRearShoulderDia(tran.getAftShoulderRadius() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
+        setRearShoulderLen(tran.getAftShoulderLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
 
 
     }
index 5293f1986e781b91869288f2dc037255eec158dc..8debc947e5656b0b3aaac79795344219c6677e92 100644 (file)
@@ -1,5 +1,6 @@
 package net.sf.openrocket.file.rocksim.export;
 
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.rocketcomponent.TubeCoupler;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -9,7 +10,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 /**
  * Conversion DTO for a TubeCoupler.  TubeCoupler's are represented as Rings in Rocksim.
  */
-@XmlRootElement(name = "Ring")
+@XmlRootElement(name = RocksimCommonConstants.RING)
 @XmlAccessorType(XmlAccessType.FIELD)
 public class TubeCouplerDTO extends CenteringRingDTO {
 
index 4543c51968d453adb7a969d23bff41a3becddb66..155fdd8900a1ea8baff98b755adad8edbc8574e2 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
 
@@ -32,31 +33,31 @@ class AttachedPartsHandler extends ElementHandler {
 
     @Override
     public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
-        if ("FinSet".equals(element)) {
+        if (RocksimCommonConstants.FIN_SET.equals(element)) {
             return new FinSetHandler(component);
         }
-        if ("CustomFinSet".equals(element)) {
+        if (RocksimCommonConstants.CUSTOM_FIN_SET.equals(element)) {
             return new FinSetHandler(component);
         }
-        if ("LaunchLug".equals(element)) {
+        if (RocksimCommonConstants.LAUNCH_LUG.equals(element)) {
             return new LaunchLugHandler(component, warnings);
         }
-        if ("Parachute".equals(element)) {
+        if (RocksimCommonConstants.PARACHUTE.equals(element)) {
             return new ParachuteHandler(component, warnings);
         }
-        if ("Streamer".equals(element)) {
+        if (RocksimCommonConstants.STREAMER.equals(element)) {
             return new StreamerHandler(component, warnings);
         }
-        if ("MassObject".equals(element)) {
+        if (RocksimCommonConstants.MASS_OBJECT.equals(element)) {
             return new MassObjectHandler(component, warnings);
         }
-        if ("Ring".equals(element)) {
+        if (RocksimCommonConstants.RING.equals(element)) {
             return new RingHandler(component, warnings);
         }
-        if ("BodyTube".equals(element)) {
+        if (RocksimCommonConstants.BODY_TUBE.equals(element)) {
             return new InnerBodyTubeHandler(component, warnings);
         }
-        if ("Transition".equals(element)) {
+        if (RocksimCommonConstants.TRANSITION.equals(element)) {
             return new TransitionHandler(component, warnings);
         }
         if ("TubeFinSet".equals(element)) {
index 59fb05a3da739dbd1d7ec4086742d54998ef3657..b825111a4e07b8720793151c980b0933e1969f3f 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimDensityType;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
@@ -61,23 +63,23 @@ public abstract class BaseHandler<C extends RocketComponent> extends ElementHand
             throws SAXException {
         final C component = getComponent();
         try {
-            if ("Name".equals(element)) {
+            if (RocksimCommonConstants.NAME.equals(element)) {
                 component.setName(content);
             }
-            if ("KnownMass".equals(element)) {
-                mass = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
+            if (RocksimCommonConstants.KNOWN_MASS.equals(element)) {
+                mass = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
             }
-            if ("Density".equals(element)) {
+            if (RocksimCommonConstants.DENSITY.equals(element)) {
                 density = Math.max(0d, Double.parseDouble(content) );
             }
-            if ("KnownCG".equals(element)) {
-                cg = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.KNOWN_CG.equals(element)) {
+                cg = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("UseKnownCG".equals(element)) {  //Rocksim sets UseKnownCG to true to control the override of both cg and mass
+            if (RocksimCommonConstants.USE_KNOWN_CG.equals(element)) {  //Rocksim sets UseKnownCG to true to control the override of both cg and mass
                 boolean override = "1".equals(content);
                 setOverride(component, override, mass, cg);
             }
-            if ("DensityType".equals(element)) {
+            if (RocksimCommonConstants.DENSITY_TYPE.equals(element)) {
                 densityType = RocksimDensityType.fromCode(Integer.parseInt(content));
             }
         }
index f2acb4cbd94b33dc9c6945bdad2586a51ae18dc3..a528f8d1f8f659303673fb9850d87d0cd3e0b33f 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimFinishCode;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -41,7 +43,7 @@ class BodyTubeHandler extends BaseHandler<BodyTube> {
 
     @Override
     public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
-        if ("AttachedParts".equals(element)) {
+        if (RocksimCommonConstants.ATTACHED_PARTS.equals(element)) {
             return new AttachedPartsHandler(bodyTube);
         }
         return PlainTextHandler.INSTANCE;
@@ -53,26 +55,26 @@ class BodyTubeHandler extends BaseHandler<BodyTube> {
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("OD".equals(element)) {
-                bodyTube.setOuterRadius(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+            if (RocksimCommonConstants.OD.equals(element)) {
+                bodyTube.setOuterRadius(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
             }
-            if ("ID".equals(element)) {
-                final double r = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS;
+            if (RocksimCommonConstants.ID.equals(element)) {
+                final double r = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS;
                 bodyTube.setInnerRadius(r);
             }
-            if ("Len".equals(element)) {
-                bodyTube.setLength(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                bodyTube.setLength(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("FinishCode".equals(element)) {
+            if (RocksimCommonConstants.FINISH_CODE.equals(element)) {
                 bodyTube.setFinish(RocksimFinishCode.fromCode(Integer.parseInt(content)).asOpenRocket());
             }
-            if ("IsMotorMount".equals(element)) {
+            if (RocksimCommonConstants.IS_MOTOR_MOUNT.equals(element)) {
                 bodyTube.setMotorMount("1".equals(content));
             }
-            if ("EngineOverhang".equals(element)) {
-                bodyTube.setMotorOverhang(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.ENGINE_OVERHANG.equals(element)) {
+                bodyTube.setMotorOverhang(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
         }
index 1ddb5677ef9dc82d6f70dec1e9264bdb288b4441..693792a33b44ed37250810c0f887a1d82ae3b300 100644 (file)
@@ -4,6 +4,9 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimFinishCode;
+import net.sf.openrocket.file.rocksim.RocksimLocationMode;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -169,7 +172,7 @@ class FinSetHandler extends ElementHandler {
                 finish = RocksimFinishCode.fromCode(Integer.parseInt(content)).asOpenRocket();
             }
             if ("Xb".equals(element)) {
-                location = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                location = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("LocationMode".equals(element)) {
                 position = RocksimLocationMode.fromCode(Integer.parseInt(content)).asOpenRocket();
@@ -178,34 +181,34 @@ class FinSetHandler extends ElementHandler {
                 finCount = Integer.parseInt(content);
             }
             if ("RootChord".equals(element)) {
-                rootChord = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                rootChord = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("TipChord".equals(element)) {
-                tipChord = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                tipChord = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("SemiSpan".equals(element)) {
-                semiSpan = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                semiSpan = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("MidChordLen".equals(element)) {
-                midChordLen = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                midChordLen = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("SweepDistance".equals(element)) {
-                sweepDistance = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                sweepDistance = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("Thickness".equals(element)) {
-                thickness = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                thickness = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("TipShapeCode".equals(element)) {
                 tipShapeCode = Integer.parseInt(content);
             }
             if ("TabLength".equals(element)) {
-                tabLength = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                tabLength = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("TabDepth".equals(element)) {
-                tabDepth = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                tabDepth = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("TabOffset".equals(element)) {
-                taboffset = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                taboffset = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("RadialAngle".equals(element)) {
                 radialAngle = Double.parseDouble(content);
@@ -217,22 +220,22 @@ class FinSetHandler extends ElementHandler {
                 pointList = content;
             }
             if ("KnownMass".equals(element)) {
-                mass = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
+                mass = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
             }
             if ("Density".equals(element)) {
-                density = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_BULK_DENSITY);
+                density = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_BULK_DENSITY);
             }
             if ("KnownCG".equals(element)) {
-                cg = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
+                cg = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
             }
             if ("UseKnownCG".equals(element)) {
                 override = "1".equals(content);
             }
             if ("CalcMass".equals(element)) {
-                calcMass = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS;
+                calcMass = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS;
             }
             if ("CalcCg".equals(element)) {
-                calcCg = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                calcCg = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
         }
         catch (NumberFormatException nfe) {
@@ -333,8 +336,8 @@ class FinSetHandler extends ElementHandler {
                 try {
                     if (aPoint.length > 1) {
                         Coordinate c = new Coordinate(
-                                Double.parseDouble(aPoint[0]) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH,
-                                Double.parseDouble(aPoint[1]) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+                                Double.parseDouble(aPoint[0]) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH,
+                                Double.parseDouble(aPoint[1]) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
                         result.add(c);
                     }
                     else {
index edcf83f93e50b55a08eee1d759e9fb51ad474c98..0d264fe05e90170bca38610c1aa983fcb1871cb6 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -42,7 +43,7 @@ class InnerBodyTubeHandler extends PositionDependentHandler<InnerTube> {
 
     @Override
     public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
-        if ("AttachedParts".equals(element)) {
+        if (RocksimCommonConstants.ATTACHED_PARTS.equals(element)) {
             return new AttachedPartsHandler(bodyTube);
         }
         return PlainTextHandler.INSTANCE;
@@ -54,25 +55,31 @@ class InnerBodyTubeHandler extends PositionDependentHandler<InnerTube> {
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("OD".equals(element)) {
-                bodyTube.setOuterRadius(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+            if (RocksimCommonConstants.OD.equals(element)) {
+                bodyTube.setOuterRadius(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
             }
-            if ("ID".equals(element)) {
-                final double r = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS;
+            if (RocksimCommonConstants.ID.equals(element)) {
+                final double r = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS;
                 bodyTube.setInnerRadius(r);
             }
-            if ("Len".equals(element)) {
-                bodyTube.setLength(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                bodyTube.setLength(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("IsMotorMount".equals(element)) {
+            if (RocksimCommonConstants.IS_MOTOR_MOUNT.equals(element)) {
                 bodyTube.setMotorMount("1".equals(content));
             }
-            if ("EngineOverhang".equals(element)) {
-                bodyTube.setMotorOverhang(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.ENGINE_OVERHANG.equals(element)) {
+                bodyTube.setMotorOverhang(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
+            if (RocksimCommonConstants.RADIAL_ANGLE.equals(element)) {
+                bodyTube.setRadialDirection(Double.parseDouble(content));
+            }
+            if (RocksimCommonConstants.RADIAL_LOC.equals(element)) {
+                bodyTube.setRadialPosition(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
+            }
         }
         catch (NumberFormatException nfe) {
             warnings.add("Could not convert " + element + " value of " + content + ".  It is expected to be a number.");
index 1a9d51aac913ee55be13341868e3c04183450610..33fd62d69ab6a434a64915d71c300d870b49c54e 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimFinishCode;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -52,22 +54,22 @@ class LaunchLugHandler extends PositionDependentHandler<LaunchLug> {
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("OD".equals(element)) {
-                lug.setOuterRadius(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+            if (RocksimCommonConstants.OD.equals(element)) {
+                lug.setOuterRadius(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
-            if ("ID".equals(element)) {
-                lug.setInnerRadius(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+            if (RocksimCommonConstants.ID.equals(element)) {
+                lug.setInnerRadius(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
-            if ("Len".equals(element)) {
-                lug.setLength(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                lug.setLength(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
-            if ("RadialAngle".equals(element)) {
+            if (RocksimCommonConstants.RADIAL_ANGLE.equals(element)) {
                 lug.setRadialDirection(Double.parseDouble(content));
             }
-            if ("FinishCode".equals(element)) {
+            if (RocksimCommonConstants.FINISH_CODE.equals(element)) {
                 lug.setFinish(RocksimFinishCode.fromCode(Integer.parseInt(content)).asOpenRocket());
             }
         }
index 53a33d8b027e23925ccbfaa41888c296c5cc5ca0..178d96dc14b8824a795cb67f0ae2a52c00a4897d 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -60,13 +61,13 @@ class MassObjectHandler extends PositionDependentHandler<MassComponent> {
             throws SAXException {
         super.closeElement(element, attributes, content, warnings);
         try {
-            if ("Len".equals(element)) {
-                mass.setLength(Double.parseDouble(content) / (RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH * MASS_LEN_FUDGE_FACTOR));
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                mass.setLength(Double.parseDouble(content) / (RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH * MASS_LEN_FUDGE_FACTOR));
             }
-            if ("KnownMass".equals(element)) {
-                mass.setComponentMass(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
+            if (RocksimCommonConstants.KNOWN_MASS.equals(element)) {
+                mass.setComponentMass(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
             }
-            if ("KnownCG".equals(element)) {
+            if (RocksimCommonConstants.KNOWN_CG.equals(element)) {
                 //Setting the CG of the Mass Object to 0 is important because of the different ways that Rocksim and
                 //OpenRocket treat mass objects.  Rocksim treats them as points (even though the data file contains a
                 //length) and because Rocksim sets the CG of the mass object to really be relative to the front of
index 7021331dbcc9aabc328839f67339301ec3a35fca..b2f07c128c01d18a6e6dbfb35205904fe2802942 100644 (file)
@@ -4,6 +4,9 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimFinishCode;
+import net.sf.openrocket.file.rocksim.RocksimNoseConeCode;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -50,7 +53,7 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
     @Override
     public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
         //Nose cones in Rocksim may have attached parts - namely Mass Objects - as children.
-        if ("AttachedParts".equals(element)) {
+        if (RocksimCommonConstants.ATTACHED_PARTS.equals(element)) {
             return new AttachedPartsHandler(noseCone);
         }
         return PlainTextHandler.INSTANCE;
@@ -62,27 +65,27 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("ShapeCode".equals(element)) {
+            if (RocksimCommonConstants.SHAPE_CODE.equals(element)) {
                 noseCone.setType(RocksimNoseConeCode.fromCode(Integer.parseInt(content)).asOpenRocket());
             }
-            if ("Len".equals(element)) {
-                noseCone.setLength(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                noseCone.setLength(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
-            if ("BaseDia".equals(element)) {
-                noseCone.setAftRadius(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+            if (RocksimCommonConstants.BASE_DIA.equals(element)) {
+                noseCone.setAftRadius(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
-            if ("WallThickness".equals(element)) {
-                thickness = Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.WALL_THICKNESS.equals(element)) {
+                thickness = Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("ShoulderOD".equals(element)) {
+            if (RocksimCommonConstants.SHOULDER_OD.equals(element)) {
                 noseCone.setAftShoulderRadius(Math.max(0, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
-            if ("ShoulderLen".equals(element)) {
+            if (RocksimCommonConstants.SHOULDER_LEN.equals(element)) {
                 noseCone.setAftShoulderLength(Math.max(0, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
-            if ("ShapeParameter".equals(element)) {
+            if (RocksimCommonConstants.SHAPE_PARAMETER.equals(element)) {
                 //The Rocksim ShapeParameter only applies to certain shapes, although it is included
                 //in the design file for all nose cones.  Applying it when it should not be causes oddities so 
                 //a check is made for the allowable shapes.
@@ -92,7 +95,7 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
                     noseCone.setShapeParameter(Double.parseDouble(content));
                 }
             }
-            if ("ConstructionType".equals(element)) {
+            if (RocksimCommonConstants.CONSTRUCTION_TYPE.equals(element)) {
                 int typeCode = Integer.parseInt(content);
                 if (typeCode == 0) {
                     //SOLID
@@ -103,10 +106,10 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
                     noseCone.setFilled(false);
                 }
             }
-            if ("FinishCode".equals(element)) {
+            if (RocksimCommonConstants.FINISH_CODE.equals(element)) {
                 noseCone.setFinish(RocksimFinishCode.fromCode(Integer.parseInt(content)).asOpenRocket());
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
         }
index 3ff7555eac25550cc54efb84f371609af2520266..cc47e24e504ebb0ed55a1c8693002640f9061226 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -62,8 +63,8 @@ class ParachuteHandler extends RecoveryDeviceHandler<Parachute> {
             throws SAXException {
         super.closeElement(element, attributes, content, warnings);
         try {
-            if ("Dia".equals(element)) {
-                chute.setDiameter(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.DIAMETER.equals(element)) {
+                chute.setDiameter(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
                 /* Rocksim doesn't have a packed parachute radius, so we approximate it. */
                 double packed;
                 RocketComponent parent = chute.getParent();
@@ -78,27 +79,27 @@ class ParachuteHandler extends RecoveryDeviceHandler<Parachute> {
                 }
                 chute.setRadius(packed);
             }
-            if ("ShroudLineCount".equals(element)) {
+            if (RocksimCommonConstants.SHROUD_LINE_COUNT.equals(element)) {
                 chute.setLineCount(Math.max(0, Integer.parseInt(content)));
             }
-            if ("ShroudLineLen".equals(element)) {
-                chute.setLineLength(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+            if (RocksimCommonConstants.SHROUD_LINE_LEN.equals(element)) {
+                chute.setLineLength(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
-            if ("SpillHoleDia".equals(element)) {
+            if (RocksimCommonConstants.SPILL_HOLE_DIA.equals(element)) {
                 //Not supported in OpenRocket
-                double spillHoleRadius = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS;
+                double spillHoleRadius = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS;
                 warnings.add("Parachute spill holes are not supported. Ignoring.");
             }
-            if ("ShroudLineMassPerMM".equals(element)) {
-                shroudLineDensity = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LINE_DENSITY;
+            if (RocksimCommonConstants.SHROUD_LINE_MASS_PER_MM.equals(element)) {
+                shroudLineDensity = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LINE_DENSITY;
             }
-            if ("ShroudLineMaterial".equals(element)) {
+            if (RocksimCommonConstants.SHROUD_LINE_MATERIAL.equals(element)) {
                 chute.setLineMaterial(createCustomMaterial(Material.Type.LINE, content, shroudLineDensity));
             }
-            if ("DragCoefficient".equals(element)) {
+            if (RocksimCommonConstants.DRAG_COEFFICIENT.equals(element)) {
                 chute.setCD(Double.parseDouble(content));
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
         }
index 6639b050e6ebcb16a500f73d1ae92b0a1a97afa8..0d04128a5349d0ac8cb720fd217df128c2bc1e38 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimLocationMode;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
 import org.xml.sax.SAXException;
 
@@ -30,10 +32,10 @@ public abstract class PositionDependentHandler<C extends RocketComponent> extend
     public void closeElement(String element, HashMap<String, String> attributes, String content, WarningSet warnings)
             throws SAXException {
         super.closeElement(element, attributes, content, warnings);
-        if ("Xb".equals(element)) {
-            positionValue = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+        if (RocksimCommonConstants.XB.equals(element)) {
+            positionValue = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
         }
-        if ("LocationMode".equals(element)) {
+        if (RocksimCommonConstants.LOCATION_MODE.equals(element)) {
             position = RocksimLocationMode.fromCode(Integer.parseInt(
                     content)).asOpenRocket();
         }
index 72e356dbaf8917015300507e26906f2d6aabd6ec..35aea771b5922971b42815228ba762a8115b99b3 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimDensityType;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.RecoveryDevice;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
@@ -38,11 +40,11 @@ public abstract class RecoveryDeviceHandler<C extends RecoveryDevice> extends Po
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("Thickness".equals(element)) {
-                thickness = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+            if (RocksimCommonConstants.THICKNESS.equals(element)) {
+                thickness = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
-            if ("CalcMass".equals(element)) {
-                calcMass = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS);
+            if (RocksimCommonConstants.CALC_MASS.equals(element)) {
+                calcMass = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS);
             }
         }
         catch (NumberFormatException nfe) {
index 20f6aac034fc1f825c99798b54725923a3c8613f..3418718aa046b73b64699cf39f891057fcadeb28 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -62,19 +63,19 @@ class RingHandler extends PositionDependentHandler<CenteringRing> {
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("OD".equals(element)) {
-                ring.setOuterRadius(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+            if (RocksimCommonConstants.OD.equals(element)) {
+                ring.setOuterRadius(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
             }
-            if ("ID".equals(element)) {
-                ring.setInnerRadius(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS);
+            if (RocksimCommonConstants.ID.equals(element)) {
+                ring.setInnerRadius(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
             }
-            if ("Len".equals(element)) {
-                ring.setLength(Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                ring.setLength(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
-            if ("UsageCode".equals(element)) {
+            if (RocksimCommonConstants.USAGE_CODE.equals(element)) {
                 usageCode = Integer.parseInt(content);
             }
         } catch (NumberFormatException nfe) {
@@ -172,6 +173,7 @@ class RingHandler extends PositionDependentHandler<CenteringRing> {
         result.setRelativePosition(ring.getRelativePosition());
         result.setPositionValue(ring.getPositionValue());
         result.setMaterial(ring.getMaterial());
+        result.setThickness(result.getThickness());
     }
 
     /**
diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/RocksimDensityType.java b/core/src/net/sf/openrocket/file/rocksim/importt/RocksimDensityType.java
deleted file mode 100644 (file)
index 9e70fa8..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * RocksimDensityType.java
- */
-package net.sf.openrocket.file.rocksim.importt;
-
-import net.sf.openrocket.material.Material;
-
-/**
- * Models the nose cone shape of a rocket.  Maps from Rocksim's notion to OpenRocket's.
- */
-public enum RocksimDensityType {
-    ROCKSIM_BULK   (0, RocksimHandler.ROCKSIM_TO_OPENROCKET_BULK_DENSITY),
-    ROCKSIM_SURFACE(1, RocksimHandler.ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY),
-    ROCKSIM_LINE   (2, RocksimHandler.ROCKSIM_TO_OPENROCKET_LINE_DENSITY);
-
-    /** The Rocksim enumeration value. Sent in XML. */
-    private final int ordinal;
-
-    /** The corresponding OpenRocket shape. */
-    private final double conversion;
-
-    /**
-     * Constructor.
-     *
-     * @param idx            the Rocksim shape code
-     * @param theConversion  the numerical conversion ratio to OpenRocket
-     */
-    private RocksimDensityType(int idx, double theConversion) {
-        ordinal = idx;
-        conversion = theConversion;
-    }
-
-    /**
-     * Get the OpenRocket shape that corresponds to the Rocksim value.
-     *
-     * @return a conversion
-     */
-    public double asOpenRocket() {
-        return conversion;
-    }
-
-    /**
-     * Lookup an instance of this enum based upon the Rocksim code.
-     *
-     * @param rocksimDensityType  the Rocksim code (from XML)
-     * @return an instance of this enum
-     */
-    public static RocksimDensityType fromCode(int rocksimDensityType) {
-        RocksimDensityType[] values = values();
-        for (RocksimDensityType value : values) {
-            if (value.ordinal == rocksimDensityType) {
-                return value;
-            }
-        }
-        return ROCKSIM_BULK; //Default
-    }
-
-    /**
-     * Get the ordinal code.
-     *
-     * @param type  the OR type
-     *
-     * @return  the Rocksim XML value
-     */
-    public static int toCode(Material.Type type) {
-        if (type.equals(Material.Type.BULK)) {
-            return ROCKSIM_BULK.ordinal;
-        }
-        if (type.equals(Material.Type.LINE)) {
-            return ROCKSIM_LINE.ordinal;
-        }
-        if (type.equals(Material.Type.SURFACE)) {
-            return ROCKSIM_SURFACE.ordinal;
-        }
-        return ROCKSIM_BULK.ordinal;
-    }
-}
-
diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/RocksimFinishCode.java b/core/src/net/sf/openrocket/file/rocksim/importt/RocksimFinishCode.java
deleted file mode 100644 (file)
index 658db56..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * RocksimFinishCode.java
- */
-package net.sf.openrocket.file.rocksim.importt;
-
-import net.sf.openrocket.rocketcomponent.ExternalComponent;
-
-/**
- * Models the finish of a component.
- */
-public enum RocksimFinishCode {
-    POLISHED(0, ExternalComponent.Finish.POLISHED),
-    GLOSS(1, ExternalComponent.Finish.SMOOTH),
-    MATT(2, ExternalComponent.Finish.NORMAL),
-    UNFINISHED(3, ExternalComponent.Finish.UNFINISHED);
-
-    /** The Rocksim code (from XML). */
-    private final int ordinal;
-    
-    /** The corresponding OpenRocket finish. */
-    private final ExternalComponent.Finish finish;
-
-    /**
-     * Constructor.
-     * 
-     * @param idx   the Rocksim enum value
-     * @param theFinish  the OpenRocket finish
-     */
-    private RocksimFinishCode(int idx, ExternalComponent.Finish theFinish) {
-        ordinal = idx;
-        finish = theFinish;
-    }
-
-    /**
-     * Get the OpenRocket finish.
-     * 
-     * @return a Finish instance
-     */
-    public ExternalComponent.Finish asOpenRocket() {
-        return finish;
-    }
-
-    /**
-     * Lookup an instance of this enum from a Rocksim value.
-     * 
-     * @param rocksimFinishCode  the Rocksim value
-     * 
-     * @return an instance of this enum; Defaults to MATT
-     */
-    public static RocksimFinishCode fromCode(int rocksimFinishCode) {
-        RocksimFinishCode[] values = values();
-        for (RocksimFinishCode value : values) {
-            if (value.ordinal == rocksimFinishCode) {
-                return value;
-            }
-        }
-        return MATT; //Default
-    }
-
-    /**
-     * Get the ordinal code.
-     *
-     * @param type  the OR type
-     *
-     * @return  the Rocksim XML value
-     */
-    public static int toCode(ExternalComponent.Finish type) {
-        if (type.equals(ExternalComponent.Finish.UNFINISHED)) {
-            return UNFINISHED.ordinal;
-        }
-        if (type.equals(ExternalComponent.Finish.POLISHED)) {
-            return POLISHED.ordinal;
-        }
-        if (type.equals(ExternalComponent.Finish.SMOOTH)) {
-            return GLOSS.ordinal;
-        }
-        return MATT.ordinal;
-    }
-
-}
-
index 7d2d527a86940695277c8f5f971cf06f15e58700..6b5765e2a10a3567275ab230c6207181b5cd981f 100644 (file)
@@ -7,6 +7,7 @@ package net.sf.openrocket.file.rocksim.importt;
 import net.sf.openrocket.aerodynamics.Warning;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.document.OpenRocketDocument;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.rocketcomponent.Rocket;
@@ -25,36 +26,6 @@ import java.util.HashMap;
  */
 public class RocksimHandler extends ElementHandler {
 
-    /**
-     * Length conversion.  Rocksim is in millimeters, OpenRocket in meters.
-     */
-    public static final int ROCKSIM_TO_OPENROCKET_LENGTH = 1000;
-
-    /**
-     * Mass conversion.  Rocksim is in grams, OpenRocket in kilograms.
-     */
-    public static final int ROCKSIM_TO_OPENROCKET_MASS = 1000;
-
-    /**
-     * Bulk Density conversion.  Rocksim is in kilograms/cubic meter, OpenRocket in kilograms/cubic meter.
-     */
-    public static final int ROCKSIM_TO_OPENROCKET_BULK_DENSITY = 1;
-
-    /**
-     * Surface Density conversion.  Rocksim is in grams/sq centimeter, OpenRocket in kilograms/sq meter.  1000/(100*100) = 1/10
-     */
-    public static final double ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY = 1/10d;
-
-    /**
-     * Line Density conversion.  Rocksim is in kilograms/meter, OpenRocket in kilograms/meter. 
-     */
-    public static final int ROCKSIM_TO_OPENROCKET_LINE_DENSITY = 1;
-
-    /**
-     * Radius conversion.  Rocksim is always in diameters, OpenRocket mostly in radius.
-     */
-    public static final int ROCKSIM_TO_OPENROCKET_RADIUS = 2 * ROCKSIM_TO_OPENROCKET_LENGTH;
-
     /**
      * The main content handler.
      */
@@ -310,22 +281,22 @@ class RocketDesignHandler extends ElementHandler {
                 stageCount = Integer.parseInt(content);
             }
             if ("Stage3Mass".equals(element)) {
-                stage3Mass = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS;
+                stage3Mass = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS;
             }
             if ("Stage2Mass".equals(element)) {
-                stage2Mass = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS;
+                stage2Mass = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS;
             }
             if ("Stage1Mass".equals(element)) {
-                stage1Mass = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS;
+                stage1Mass = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS;
             }
             if ("Stage3CG".equals(element)) {
-                stage3CG = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                stage3CG = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("Stage2CGAlone".equals(element)) {
-                stage2CG = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                stage2CG = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
             if ("Stage1CGAlone".equals(element)) {
-                stage1CG = Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH;
+                stage1CG = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
             }
         }
         catch (NumberFormatException nfe) {
@@ -359,13 +330,13 @@ class StageHandler extends ElementHandler {
 
     @Override
     public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
-        if ("NoseCone".equals(element)) {
+        if (RocksimCommonConstants.NOSE_CONE.equals(element)) {
             return new NoseConeHandler(component, warnings);
         }
-        if ("BodyTube".equals(element)) {
+        if (RocksimCommonConstants.BODY_TUBE.equals(element)) {
             return new BodyTubeHandler(component, warnings);
         }
-        if ("Transition".equals(element)) {
+        if (RocksimCommonConstants.TRANSITION.equals(element)) {
             return new TransitionHandler(component, warnings);
         }
         return null;
diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/RocksimLocationMode.java b/core/src/net/sf/openrocket/file/rocksim/importt/RocksimLocationMode.java
deleted file mode 100644 (file)
index 02daeb8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * RocksimLocationMode.java
- */
-package net.sf.openrocket.file.rocksim.importt;
-
-import net.sf.openrocket.rocketcomponent.RocketComponent;
-
-/**
- * Models the relative position of parts on a rocket.  Maps from Rocksim's notion to OpenRocket's.
- */
-public enum RocksimLocationMode {
-    FRONT_OF_OWNING_PART (0, RocketComponent.Position.TOP),
-    FROM_TIP_OF_NOSE     (1, RocketComponent.Position.ABSOLUTE),
-    BACK_OF_OWNING_PART  (2, RocketComponent.Position.BOTTOM);
-
-    /** The value Rocksim uses internally (and in the XML file). */
-    private final int ordinal;
-    
-    /** The OpenRocket position equivalent. */
-    private final RocketComponent.Position position;
-
-    /**
-     * Constructor.
-     * 
-     * @param idx   the rocksim enum value
-     * @param theOpenRocketPosition  the corresponding OpenRocket position
-     */
-    RocksimLocationMode(int idx, RocketComponent.Position theOpenRocketPosition) {
-        ordinal = idx;
-        position = theOpenRocketPosition;
-    }
-
-    /**
-     * Get the OpenRocket position.
-     * 
-     * @return  the position instance
-     */
-    public RocketComponent.Position asOpenRocket() {
-        return position;
-    }
-
-    /**
-     * Lookup an instance of this class from a rocksim enum value.
-     * 
-     * @param rocksimCode  the rocksim enum value
-     * 
-     * @return an instance of this enum
-     */
-    public static RocksimLocationMode fromCode(int rocksimCode) {
-        RocksimLocationMode[] values = values();
-        for (RocksimLocationMode value : values) {
-            if (value.ordinal == rocksimCode) {
-                return value;
-            }
-        }
-        return FRONT_OF_OWNING_PART;
-    }
-
-    public static int toCode(RocketComponent.Position position) {
-        if (RocketComponent.Position.TOP.equals(position)) {
-            return 0;
-        }
-        if (RocketComponent.Position.ABSOLUTE.equals(position)) {
-            return 1;
-        }
-        if (RocketComponent.Position.BOTTOM.equals(position)) {
-            return 2;
-        }
-        return 0;
-    }
-}
\ No newline at end of file
diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/RocksimNoseConeCode.java b/core/src/net/sf/openrocket/file/rocksim/importt/RocksimNoseConeCode.java
deleted file mode 100644 (file)
index 0454002..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * RocksimNoseConeCode.java
- */
-package net.sf.openrocket.file.rocksim.importt;
-
-import net.sf.openrocket.rocketcomponent.Transition;
-
-/**
- * Models the nose cone shape of a rocket.  Maps from Rocksim's notion to OpenRocket's.
- */
-public enum RocksimNoseConeCode {
-    CONICAL         (0, Transition.Shape.CONICAL),
-    OGIVE           (1, Transition.Shape.OGIVE),
-    PARABOLIC       (2, Transition.Shape.ELLIPSOID),  //Rocksim' PARABOLIC most closely resembles an ELLIPSOID in OpenRocket
-    ELLIPTICAL      (3, Transition.Shape.ELLIPSOID),
-    POWER_SERIES    (4, Transition.Shape.POWER),
-    PARABOLIC_SERIES(5, Transition.Shape.PARABOLIC),
-    HAACK           (6, Transition.Shape.HAACK);
-
-    /** The Rocksim enumeration value. Sent in XML. */
-    private final int ordinal;
-    
-    /** The corresponding OpenRocket shape. */
-    private final Transition.Shape shape;
-
-    /**
-     * Constructor.
-     * 
-     * @param idx    the Rocksim shape code
-     * @param aShape the corresponding OpenRocket shape
-     */
-    private RocksimNoseConeCode(int idx, Transition.Shape aShape) {
-        ordinal = idx;
-        shape = aShape;
-    }
-
-    /**
-     * Get the OpenRocket shape that corresponds to the Rocksim shape.
-     * 
-     * @return a shape
-     */
-    public Transition.Shape asOpenRocket() {
-        return shape;
-    }
-
-    /**
-     * Lookup an instance of this enum based upon the Rocksim code.
-     * 
-     * @param rocksimShapeCode  the Rocksim code (from XML)
-     * @return an instance of this enum
-     */
-    public static RocksimNoseConeCode fromCode(int rocksimShapeCode) {
-        RocksimNoseConeCode[] values = values();
-        for (RocksimNoseConeCode value : values) {
-            if (value.ordinal == rocksimShapeCode) {
-                return value;
-            }
-        }
-        return PARABOLIC; //Default
-    }
-
-    /**
-     * Lookup an ordinal value for the Rocksim code.
-     * 
-     * @param type  the OR Shape
-     *              
-     * @return the Rocksim code
-     */
-    public static int toCode(Transition.Shape type) {
-        RocksimNoseConeCode[] values = values();
-        for (RocksimNoseConeCode value : values) {
-            if (value.shape.equals(type)) {
-                if (value.ordinal == 2) {
-                    return 3;
-                }
-                return value.ordinal;
-            }
-        }
-        return ELLIPTICAL.ordinal; //Default
-    }
-}
index 3002a78336ffbdf93273202a1dbd90477ca009b4..cdf87a93c2ecad24cf03e0730e1fa5e4ccf3f676 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
@@ -57,16 +58,16 @@ class StreamerHandler extends RecoveryDeviceHandler<Streamer> {
         super.closeElement(element, attributes, content, warnings);
 
         try {
-            if ("Width".equals(element)) {
-                streamer.setStripWidth(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+            if (RocksimCommonConstants.WIDTH.equals(element)) {
+                streamer.setStripWidth(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
-            if ("Len".equals(element)) {
-                streamer.setStripLength(Math.max(0, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+            if (RocksimCommonConstants.LEN.equals(element)) {
+                streamer.setStripLength(Math.max(0, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
-            if ("DragCoefficient".equals(element)) {
+            if (RocksimCommonConstants.DRAG_COEFFICIENT.equals(element)) {
                 streamer.setCD(Double.parseDouble(content));
             }
-            if ("Material".equals(element)) {
+            if (RocksimCommonConstants.MATERIAL.equals(element)) {
                 setMaterialName(content);
             }
         }
@@ -83,5 +84,4 @@ class StreamerHandler extends RecoveryDeviceHandler<Streamer> {
         return streamer;
     }
 
-}
-
+}
\ No newline at end of file
index b589b67796bac63507fc2d939c9e0ea90d83dbe3..0cd180e951cc5e8042067d114cc4ff66ae24b9ee 100644 (file)
@@ -4,6 +4,9 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimFinishCode;
+import net.sf.openrocket.file.rocksim.RocksimNoseConeCode;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -59,34 +62,34 @@ class TransitionHandler extends BaseHandler<Transition> {
             }
             if ("Len".equals(element)) {
                 transition.setLength(Math.max(0, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
             if ("FrontDia".equals(element)) {
                 transition.setForeRadius(Math.max(0, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
             if ("RearDia".equals(element)) {
                 transition.setAftRadius(Math.max(0, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
             if ("WallThickness".equals(element)) {
-                thickness = Math.max(0d, Double.parseDouble(content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+                thickness = Math.max(0d, Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
             }
             if ("FrontShoulderDia".equals(element)) {
                 transition.setForeShoulderRadius(Math.max(0d, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
             if ("RearShoulderDia".equals(element)) {
                 transition.setAftShoulderRadius(Math.max(0d, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS));
             }
             if ("FrontShoulderLen".equals(element)) {
                 transition.setForeShoulderLength(Math.max(0d, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
             if ("RearShoulderLen".equals(element)) {
                 transition.setAftShoulderLength(Math.max(0d, Double.parseDouble(
-                        content) / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH));
+                        content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
             }
             if ("ShapeParameter".equals(element)) {
                 if (Transition.Shape.POWER.equals(transition.getType()) ||
index b69a3bd9134eb1885ff87e9ef074712c2fef81d6..8b8bc3b62c3597b276d321be527f2d60bb1da540 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
@@ -72,7 +73,7 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
         handler.closeElement("OD", attributes, "0", warnings);
         Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
+        Assert.assertEquals(75d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -82,7 +83,7 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
         handler.closeElement("ID", attributes, "0", warnings);
         Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
+        Assert.assertEquals(75d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -90,9 +91,9 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -105,11 +106,11 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
         Assert.assertFalse(component.isMotorMount());
 
         handler.closeElement("EngineOverhang", attributes, "-1", warnings);
-        Assert.assertEquals(-1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
+        Assert.assertEquals(-1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
index fa070ce787095c03ae3e7f74b7104ea6edf23495..f2533c3551519a292f6125f56e95209e72049bac 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
@@ -71,7 +72,7 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
         handler.closeElement("OD", attributes, "0", warnings);
         Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
+        Assert.assertEquals(75d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -81,7 +82,7 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
         handler.closeElement("ID", attributes, "0", warnings);
         Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
+        Assert.assertEquals(75d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -89,9 +90,9 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -104,11 +105,11 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
         Assert.assertFalse(component.isMotorMount());
 
         handler.closeElement("EngineOverhang", attributes, "-1", warnings);
-        Assert.assertEquals(-1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
+        Assert.assertEquals(-1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
index 503ce805d28874cb43fa7306254affd28ad4aca0..937c8cbc46da150c2d32230866f277130f8dddb8 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
@@ -71,7 +72,7 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
         handler.closeElement("OD", attributes, "0", warnings);
         Assert.assertEquals(0d, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getOuterRadius(), 0.001);
+        Assert.assertEquals(75d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -81,7 +82,7 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
         handler.closeElement("ID", attributes, "0", warnings);
         Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
+        Assert.assertEquals(75d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -89,9 +90,9 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
index e5360a12dd04fa6f9a82b09853df72d3fe5fbc6b..fa435229f4bd4c110cd538b7b77c1423546e0c9e 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
@@ -69,10 +70,10 @@ public class MassObjectHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH)
+        Assert.assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH)
                 , component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH)
+        Assert.assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH)
                 , component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
@@ -81,7 +82,7 @@ public class MassObjectHandlerTest extends RocksimTestBase {
         handler.closeElement("KnownMass", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getComponentMass(), 0.001);
         handler.closeElement("KnownMass", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS, component.getComponentMass(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_MASS, component.getComponentMass(), 0.001);
         handler.closeElement("KnownMass", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
index 593434c4b72b873d4e9a538646c879b3b3e57744..03943d8b76dc2836a5557556f7f2cb1369a54cc3 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimNoseConeCode;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
@@ -84,9 +86,9 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -94,7 +96,7 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         handler.closeElement("BaseDia", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getAftRadius(), 0.001);
         handler.closeElement("BaseDia", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius(), 0.001);
         handler.closeElement("BaseDia", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -125,15 +127,15 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         Assert.assertEquals(0d, component.getAftShoulderThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "1.1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness(), 0.001);
-        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness(), 0.001);
+        Assert.assertEquals(1.1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness(), 0.001);
+        Assert.assertEquals(1.1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness(), 0.001);
         
         handler.closeElement("ShoulderLen", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getAftShoulderLength(), 0.001);
         handler.closeElement("ShoulderLen", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("ShoulderLen", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("ShoulderLen", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -141,7 +143,7 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         handler.closeElement("ShoulderOD", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("ShoulderOD", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("ShoulderOD", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
index 20ab19fba2d66111be132754e1f6e66c31f4e486..135a94fcdc5bd4a986dbcfcebe73280e90cc6605 100644 (file)
@@ -4,6 +4,7 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
@@ -54,9 +55,9 @@ public class ParachuteHandlerTest extends RocksimTestBase {
         warnings.clear();
 
         handler.closeElement("Dia", attributes, "-1", warnings);
-        Assert.assertEquals(-1d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter(), 0.001);
+        Assert.assertEquals(-1d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter(), 0.001);
         handler.closeElement("Dia", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter(), 0.001);
         handler.closeElement("Dia", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -72,7 +73,7 @@ public class ParachuteHandlerTest extends RocksimTestBase {
         handler.closeElement("ShroudLineLen", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLineLength(), 0.001);
         handler.closeElement("ShroudLineLen", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLineLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLineLength(), 0.001);
         handler.closeElement("ShroudLineLen", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -152,12 +153,12 @@ public class ParachuteHandlerTest extends RocksimTestBase {
         handler.closeElement("LocationMode", attributes, "1", warnings);
         handler.endHandler("Parachute", attributes, null, warnings);
         Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
-        Assert.assertEquals(component.getPositionValue(), -10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
+        Assert.assertEquals(component.getPositionValue(), -10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
 
         handler.closeElement("Xb", attributes, "-10", warnings);
         handler.closeElement("LocationMode", attributes, "2", warnings);
         handler.endHandler("Parachute", attributes, null, warnings);
         Assert.assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
-        Assert.assertEquals(component.getPositionValue(), 10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
+        Assert.assertEquals(component.getPositionValue(), 10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
     }
 }
index a1dea0aa9235fdfa660840486b37cd044e68850d..fe2b9c9c1436a55186b07cba95a849d19a4b2325 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimDensityType;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
@@ -44,9 +46,9 @@ public class StreamerHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("Width", attributes, "0", warnings);
-        Assert.assertEquals(0d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth(), 0.001);
+        Assert.assertEquals(0d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth(), 0.001);
         handler.closeElement("Width", attributes, "10", warnings);
-        Assert.assertEquals(10d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth(), 0.001);
+        Assert.assertEquals(10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth(), 0.001);
         handler.closeElement("Width", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -54,9 +56,9 @@ public class StreamerHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getStripLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -147,13 +149,13 @@ public class StreamerHandlerTest extends RocksimTestBase {
         handler.closeElement("LocationMode", attributes, "1", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
         Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
-        Assert.assertEquals(component.getPositionValue(), -10d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
+        Assert.assertEquals(component.getPositionValue(), -10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
 
         handler.closeElement("Xb", attributes, "-10", warnings);
         handler.closeElement("LocationMode", attributes, "2", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
         Assert.assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
-        Assert.assertEquals(component.getPositionValue(), 10d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
+        Assert.assertEquals(component.getPositionValue(), 10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
 
         handler.closeElement("Thickness", attributes, "0.02", warnings);
         Assert.assertEquals(0.01848, handler.computeDensity(RocksimDensityType.ROCKSIM_BULK, 924d), 0.001);
index cea3a07f03f820dcd0d4b497129b2abc0d8991b1..28087d170e03e198b69edd7f8b73fc996c4b106e 100644 (file)
@@ -4,6 +4,8 @@
 package net.sf.openrocket.file.rocksim.importt;
 
 import net.sf.openrocket.aerodynamics.WarningSet;
+import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
+import net.sf.openrocket.file.rocksim.RocksimNoseConeCode;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
@@ -79,9 +81,9 @@ public class TransitionHandlerTest extends RocksimTestBase {
         handler.closeElement("Len", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -89,7 +91,7 @@ public class TransitionHandlerTest extends RocksimTestBase {
         handler.closeElement("FrontDia", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getForeRadius(), 0.001);
         handler.closeElement("FrontDia", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeRadius(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeRadius(), 0.001);
         handler.closeElement("FrontDia", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -97,7 +99,7 @@ public class TransitionHandlerTest extends RocksimTestBase {
         handler.closeElement("RearDia", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getAftRadius(), 0.001);
         handler.closeElement("RearDia", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius(), 0.001);
         handler.closeElement("RearDia", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -131,17 +133,17 @@ public class TransitionHandlerTest extends RocksimTestBase {
         Assert.assertEquals(0d, component.getForeShoulderThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "1.1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness(), 0.001);
-        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness(), 0.001);
-        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderThickness(), 0.001);
+        Assert.assertEquals(1.1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness(), 0.001);
+        Assert.assertEquals(1.1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness(), 0.001);
+        Assert.assertEquals(1.1d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderThickness(), 0.001);
         
 
         handler.closeElement("FrontShoulderLen", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getForeShoulderLength(), 0.001);
         handler.closeElement("FrontShoulderLen", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength(), 0.001);
         handler.closeElement("FrontShoulderLen", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength(), 0.001);
         handler.closeElement("FrontShoulderLen", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -149,9 +151,9 @@ public class TransitionHandlerTest extends RocksimTestBase {
         handler.closeElement("RearShoulderLen", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getAftShoulderLength(), 0.001);
         handler.closeElement("RearShoulderLen", attributes, "10", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("RearShoulderLen", attributes, "10.0", warnings);
-        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
+        Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("RearShoulderLen", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -159,7 +161,7 @@ public class TransitionHandlerTest extends RocksimTestBase {
         handler.closeElement("FrontShoulderDia", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getForeShoulderRadius(), 0.001);
         handler.closeElement("FrontShoulderDia", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeShoulderRadius(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeShoulderRadius(), 0.001);
         handler.closeElement("FrontShoulderDia", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();
@@ -167,7 +169,7 @@ public class TransitionHandlerTest extends RocksimTestBase {
         handler.closeElement("RearShoulderDia", attributes, "-1", warnings);
         Assert.assertEquals(0d, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("RearShoulderDia", attributes, "100", warnings);
-        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius(), 0.001);
+        Assert.assertEquals(100d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("RearShoulderDia", attributes, "foo", warnings);
         Assert.assertEquals(1, warnings.size());
         warnings.clear();