diff --git a/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java b/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java index be4d06a9a..141146bc6 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java +++ b/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java @@ -371,6 +371,11 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial return this.motors.getDefault(); } + @Override + public MotorConfigurationSet getMotorConfigurationSet() { + return this.motors; + } + @Override public MotorConfiguration getMotorConfig( final FlightConfigurationId fcid){ return this.motors.get(fcid); @@ -432,7 +437,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial @Override public int getMotorCount() { - return this.motors.size(); + return this.getClusterConfiguration().getClusterCount(); } @Override diff --git a/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java b/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java index 0b21dcf3d..9eda2dcd3 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java +++ b/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java @@ -257,6 +257,11 @@ public class InnerTube extends ThicknessRingComponent implements AxialPositionab public MotorConfiguration getDefaultMotorConfig(){ return this.motors.getDefault(); } + + @Override + public MotorConfigurationSet getMotorConfigurationSet() { + return this.motors; + } @Override public MotorConfiguration getMotorConfig( final FlightConfigurationId fcid){ @@ -321,7 +326,7 @@ public class InnerTube extends ThicknessRingComponent implements AxialPositionab @Override public int getMotorCount() { - return this.motors.size(); + return this.getClusterConfiguration().getClusterCount(); } diff --git a/core/src/net/sf/openrocket/rocketcomponent/MotorMount.java b/core/src/net/sf/openrocket/rocketcomponent/MotorMount.java index ab47b44a5..4c6b2f112 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/MotorMount.java +++ b/core/src/net/sf/openrocket/rocketcomponent/MotorMount.java @@ -3,6 +3,7 @@ package net.sf.openrocket.rocketcomponent; import java.util.Iterator; import net.sf.openrocket.motor.MotorConfiguration; +import net.sf.openrocket.motor.MotorConfigurationSet; import net.sf.openrocket.util.ChangeSource; import net.sf.openrocket.util.Coordinate; @@ -80,6 +81,13 @@ public interface MotorMount extends ChangeSource, FlightConfigurableComponent { // duplicate of RocketComponent public Coordinate[] getLocations(); + /** + * Returns the set of motors configured for flight/simulation in this motor mount. + * @return the MotorConfigurationSet containing the set of motors configured in + * this motor mount. + */ + public MotorConfigurationSet getMotorConfigurationSet(); + /** * * @param fcid id for which to return the motor (null retrieves the default) diff --git a/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java b/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java index 46cbd903b..d9267ec2c 100644 --- a/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java +++ b/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java @@ -201,7 +201,7 @@ public class FlightConfigurationTest extends BaseTestCase { InnerTube smmt = (InnerTube)rkt.getChild(0).getChild(1).getChild(2); int expectedMotorCount = 5; - int actualMotorCount = smmt.getMotorCount(); + int actualMotorCount = smmt.getMotorConfigurationSet().size(); assertThat("number of motor configurations doesn't match.", actualMotorCount, equalTo(expectedMotorCount)); } diff --git a/swing/src/net/sf/openrocket/gui/print/DesignReport.java b/swing/src/net/sf/openrocket/gui/print/DesignReport.java index 2d116b2da..12094b560 100644 --- a/swing/src/net/sf/openrocket/gui/print/DesignReport.java +++ b/swing/src/net/sf/openrocket/gui/print/DesignReport.java @@ -28,6 +28,7 @@ import net.sf.openrocket.gui.figureelements.FigureElement; import net.sf.openrocket.gui.figureelements.RocketInfo; import net.sf.openrocket.gui.scalefigure.RocketPanel; import net.sf.openrocket.masscalc.MassCalculator; +import net.sf.openrocket.masscalc.RigidBody; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.motor.MotorConfiguration; import net.sf.openrocket.rocketcomponent.AxialStage; @@ -329,13 +330,11 @@ public class DesignReport { DecimalFormat ttwFormat = new DecimalFormat("0.00"); - MassCalculator massCalc = new MassCalculator(); - if( motorId.hasError() ){ throw new IllegalStateException("Attempted to add motor data with an invalid fcid"); } rocket.createFlightConfiguration(motorId); - FlightConfiguration config = rocket.getFlightConfiguration( motorId); + FlightConfiguration config = rocket.getFlightConfiguration(motorId); int totalMotorCount = 0; double totalPropMass = 0; @@ -352,7 +351,8 @@ public class DesignReport { config.clearAllStages(); config.setOnlyStage(stage); stage++; - stageMass = massCalc.getCGAnalysis(config).get(c).weight; + RigidBody launchInfo = MassCalculator.calculateLaunch(config); + stageMass = launchInfo.getMass(); // Calculate total thrust-to-weight from only lowest stage motors totalTTW = 0; topBorder = true;