Major renaming of methods and members changing "MotorConfig" to
"FlightConfig".
This commit is contained in:
parent
6e66aeac31
commit
a094b30c1d
@ -544,7 +544,7 @@ public class OpenRocketDocument implements ComponentChangeListener {
|
|||||||
public OpenRocketDocument copy() {
|
public OpenRocketDocument copy() {
|
||||||
Rocket rocketCopy = rocket.copyWithOriginalID();
|
Rocket rocketCopy = rocket.copyWithOriginalID();
|
||||||
OpenRocketDocument documentCopy = new OpenRocketDocument(rocketCopy);
|
OpenRocketDocument documentCopy = new OpenRocketDocument(rocketCopy);
|
||||||
documentCopy.getDefaultConfiguration().setMotorConfigurationID(configuration.getMotorConfigurationID());
|
documentCopy.getDefaultConfiguration().setFlightConfigurationID(configuration.getFlightConfigurationID());
|
||||||
for (Simulation s : simulations) {
|
for (Simulation s : simulations) {
|
||||||
documentCopy.addSimulation(s.duplicateSimulation(rocketCopy));
|
documentCopy.addSimulation(s.duplicateSimulation(rocketCopy));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
options = new SimulationOptions(rocket);
|
options = new SimulationOptions(rocket);
|
||||||
options.setMotorConfigurationID(
|
options.setMotorConfigurationID(
|
||||||
rocket.getDefaultConfiguration().getMotorConfigurationID());
|
rocket.getDefaultConfiguration().getFlightConfigurationID());
|
||||||
options.addChangeListener(new ConditionListener());
|
options.addChangeListener(new ConditionListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
public Configuration getConfiguration() {
|
public Configuration getConfiguration() {
|
||||||
mutex.verify();
|
mutex.verify();
|
||||||
Configuration c = new Configuration(rocket);
|
Configuration c = new Configuration(rocket);
|
||||||
c.setMotorConfigurationID(options.getMotorConfigurationID());
|
c.setFlightConfigurationID(options.getMotorConfigurationID());
|
||||||
c.setAllStages();
|
c.setAllStages();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
// Set simulated info after simulation, will not be set in case of exception
|
// Set simulated info after simulation, will not be set in case of exception
|
||||||
simulatedConditions = options.clone();
|
simulatedConditions = options.clone();
|
||||||
final Configuration configuration = getConfiguration();
|
final Configuration configuration = getConfiguration();
|
||||||
simulatedMotors = configuration.getMotorConfigurationDescription();
|
simulatedMotors = configuration.getFlightConfigurationDescription();
|
||||||
simulatedRocketID = rocket.getFunctionalModID();
|
simulatedRocketID = rocket.getFunctionalModID();
|
||||||
|
|
||||||
status = Status.UPTODATE;
|
status = Status.UPTODATE;
|
||||||
@ -349,7 +349,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
*
|
*
|
||||||
* @return a description of the motor configuration of the previous simulation, or
|
* @return a description of the motor configuration of the previous simulation, or
|
||||||
* <code>null</code>.
|
* <code>null</code>.
|
||||||
* @see Rocket#getMotorConfigurationNameOrDescription(String)
|
* @see Rocket#getFlightConfigurationNameOrDescription(String)
|
||||||
*/
|
*/
|
||||||
public String getSimulatedMotorDescription() {
|
public String getSimulatedMotorDescription() {
|
||||||
mutex.verify();
|
mutex.verify();
|
||||||
|
|||||||
@ -272,7 +272,7 @@ public class OpenRocketSaver extends RocketSaver {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
MotorMount mount = (MotorMount) c;
|
MotorMount mount = (MotorMount) c;
|
||||||
for (String id : document.getRocket().getMotorConfigurationIDs()) {
|
for (String id : document.getRocket().getFlightConfigurationIDs()) {
|
||||||
if (mount.getMotor(id) != null) {
|
if (mount.getMotor(id) != null) {
|
||||||
return FILE_VERSION_DIVISOR + 4;
|
return FILE_VERSION_DIVISOR + 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1113,11 +1113,11 @@ class MotorConfigurationHandler extends AbstractElementHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name != null && name.trim().length() > 0) {
|
if (name != null && name.trim().length() > 0) {
|
||||||
rocket.setMotorConfigurationName(configid, name);
|
rocket.setFlightConfigurationName(configid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("true".equals(attributes.remove("default"))) {
|
if ("true".equals(attributes.remove("default"))) {
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(configid);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(configid);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.closeElement(element, attributes, content, warnings);
|
super.closeElement(element, attributes, content, warnings);
|
||||||
|
|||||||
@ -121,7 +121,7 @@ public class RocketComponentSaver {
|
|||||||
if (!mount.isMotorMount())
|
if (!mount.isMotorMount())
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
||||||
String[] motorConfigIDs = ((RocketComponent) mount).getRocket().getMotorConfigurationIDs();
|
String[] motorConfigIDs = ((RocketComponent) mount).getRocket().getFlightConfigurationIDs();
|
||||||
List<String> elements = new ArrayList<String>();
|
List<String> elements = new ArrayList<String>();
|
||||||
|
|
||||||
elements.add("<motormount>");
|
elements.add("<motormount>");
|
||||||
|
|||||||
@ -40,8 +40,8 @@ public class RocketSaver extends RocketComponentSaver {
|
|||||||
|
|
||||||
|
|
||||||
// Motor configurations
|
// Motor configurations
|
||||||
String defId = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
String defId = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
for (String id : rocket.getMotorConfigurationIDs()) {
|
for (String id : rocket.getFlightConfigurationIDs()) {
|
||||||
if (id == null)
|
if (id == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -49,10 +49,10 @@ public class RocketSaver extends RocketComponentSaver {
|
|||||||
if (id.equals(defId))
|
if (id.equals(defId))
|
||||||
str += " default=\"true\"";
|
str += " default=\"true\"";
|
||||||
|
|
||||||
if (rocket.getMotorConfigurationName(id) == "") {
|
if (rocket.getFlightConfigurationName(id) == "") {
|
||||||
str += "/>";
|
str += "/>";
|
||||||
} else {
|
} else {
|
||||||
str += "><name>" + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getMotorConfigurationName(id))
|
str += "><name>" + net.sf.openrocket.file.RocketSaver.escapeXML(rocket.getFlightConfigurationName(id))
|
||||||
+ "</name></motorconfiguration>";
|
+ "</name></motorconfiguration>";
|
||||||
}
|
}
|
||||||
elements.add(str);
|
elements.add(str);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import net.sf.openrocket.rocketcomponent.Rocket;
|
|||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.util.StateChangeListener;
|
import net.sf.openrocket.util.StateChangeListener;
|
||||||
|
|
||||||
public class MotorConfigurationModel implements ComboBoxModel, StateChangeListener {
|
public class FlightConfigurationModel implements ComboBoxModel, StateChangeListener {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
private static final String EDIT = trans.get("MotorCfgModel.Editcfg");
|
private static final String EDIT = trans.get("MotorCfgModel.Editcfg");
|
||||||
@ -34,7 +34,7 @@ public class MotorConfigurationModel implements ComboBoxModel, StateChangeListen
|
|||||||
private Map<String, ID> map = new HashMap<String, ID>();
|
private Map<String, ID> map = new HashMap<String, ID>();
|
||||||
|
|
||||||
|
|
||||||
public MotorConfigurationModel(Configuration config) {
|
public FlightConfigurationModel(Configuration config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.rocket = config.getRocket();
|
this.rocket = config.getRocket();
|
||||||
config.addChangeListener(this);
|
config.addChangeListener(this);
|
||||||
@ -44,7 +44,7 @@ public class MotorConfigurationModel implements ComboBoxModel, StateChangeListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
String[] ids = rocket.getMotorConfigurationIDs();
|
String[] ids = rocket.getFlightConfigurationIDs();
|
||||||
if (index < 0 || index > ids.length)
|
if (index < 0 || index > ids.length)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -56,12 +56,12 @@ public class MotorConfigurationModel implements ComboBoxModel, StateChangeListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return rocket.getMotorConfigurationIDs().length + 1;
|
return rocket.getFlightConfigurationIDs().length + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
return get(config.getMotorConfigurationID());
|
return get(config.getFlightConfigurationID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -88,7 +88,7 @@ public class MotorConfigurationModel implements ComboBoxModel, StateChangeListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
ID idObject = (ID) item;
|
ID idObject = (ID) item;
|
||||||
config.setMotorConfigurationID(idObject.getID());
|
config.setFlightConfigurationID(idObject.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ public class MotorConfigurationModel implements ComboBoxModel, StateChangeListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return rocket.getMotorConfigurationNameOrDescription(id);
|
return rocket.getFlightConfigurationNameOrDescription(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ import net.sf.openrocket.gui.SpinnerEditor;
|
|||||||
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.adaptors.EnumModel;
|
import net.sf.openrocket.gui.adaptors.EnumModel;
|
||||||
import net.sf.openrocket.gui.adaptors.MotorConfigurationModel;
|
import net.sf.openrocket.gui.adaptors.FlightConfigurationModel;
|
||||||
import net.sf.openrocket.gui.components.BasicSlider;
|
import net.sf.openrocket.gui.components.BasicSlider;
|
||||||
import net.sf.openrocket.gui.components.StyledLabel;
|
import net.sf.openrocket.gui.components.StyledLabel;
|
||||||
import net.sf.openrocket.gui.components.UnitSelector;
|
import net.sf.openrocket.gui.components.UnitSelector;
|
||||||
@ -71,7 +71,7 @@ public class MotorConfig extends JPanel {
|
|||||||
//// Motor configuration:
|
//// Motor configuration:
|
||||||
panel.add(new JLabel(trans.get("MotorCfg.lbl.Motorcfg")), "shrink");
|
panel.add(new JLabel(trans.get("MotorCfg.lbl.Motorcfg")), "shrink");
|
||||||
|
|
||||||
JComboBox combo = new JComboBox(new MotorConfigurationModel(configuration));
|
JComboBox combo = new JComboBox(new FlightConfigurationModel(configuration));
|
||||||
panel.add(combo, "growx");
|
panel.add(combo, "growx");
|
||||||
|
|
||||||
configuration.addChangeListener(new ChangeListener() {
|
configuration.addChangeListener(new ChangeListener() {
|
||||||
@ -86,8 +86,8 @@ public class MotorConfig extends JPanel {
|
|||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String id = rocket.newMotorConfigurationID();
|
String id = rocket.newFlightConfigurationID();
|
||||||
configuration.setMotorConfigurationID(id);
|
configuration.setFlightConfigurationID(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(button, "wrap unrel");
|
panel.add(button, "wrap unrel");
|
||||||
@ -166,7 +166,7 @@ public class MotorConfig extends JPanel {
|
|||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String id = configuration.getMotorConfigurationID();
|
String id = configuration.getFlightConfigurationID();
|
||||||
|
|
||||||
MotorChooserDialog dialog = new MotorChooserDialog(mount.getMotor(id),
|
MotorChooserDialog dialog = new MotorChooserDialog(mount.getMotor(id),
|
||||||
mount.getMotorDelay(id), mount.getMotorMountDiameter(),
|
mount.getMotorDelay(id), mount.getMotorMountDiameter(),
|
||||||
@ -177,8 +177,8 @@ public class MotorConfig extends JPanel {
|
|||||||
|
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
id = rocket.newMotorConfigurationID();
|
id = rocket.newFlightConfigurationID();
|
||||||
configuration.setMotorConfigurationID(id);
|
configuration.setFlightConfigurationID(id);
|
||||||
}
|
}
|
||||||
mount.setMotor(id, m);
|
mount.setMotor(id, m);
|
||||||
mount.setMotorDelay(id, d);
|
mount.setMotorDelay(id, d);
|
||||||
@ -193,7 +193,7 @@ public class MotorConfig extends JPanel {
|
|||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
mount.setMotor(configuration.getMotorConfigurationID(), null);
|
mount.setMotor(configuration.getFlightConfigurationID(), null);
|
||||||
updateFields();
|
updateFields();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -216,7 +216,7 @@ public class MotorConfig extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateFields() {
|
public void updateFields() {
|
||||||
String id = configuration.getMotorConfigurationID();
|
String id = configuration.getFlightConfigurationID();
|
||||||
Motor m = mount.getMotor(id);
|
Motor m = mount.getMotor(id);
|
||||||
if (m == null) {
|
if (m == null) {
|
||||||
//// None
|
//// None
|
||||||
|
|||||||
@ -44,7 +44,7 @@ import net.sf.openrocket.aerodynamics.WarningSet;
|
|||||||
import net.sf.openrocket.gui.adaptors.Column;
|
import net.sf.openrocket.gui.adaptors.Column;
|
||||||
import net.sf.openrocket.gui.adaptors.ColumnTableModel;
|
import net.sf.openrocket.gui.adaptors.ColumnTableModel;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.adaptors.MotorConfigurationModel;
|
import net.sf.openrocket.gui.adaptors.FlightConfigurationModel;
|
||||||
import net.sf.openrocket.gui.components.BasicSlider;
|
import net.sf.openrocket.gui.components.BasicSlider;
|
||||||
import net.sf.openrocket.gui.components.StageSelector;
|
import net.sf.openrocket.gui.components.StageSelector;
|
||||||
import net.sf.openrocket.gui.components.StyledLabel;
|
import net.sf.openrocket.gui.components.StyledLabel;
|
||||||
@ -174,7 +174,7 @@ public class ComponentAnalysisDialog extends JDialog implements ChangeListener {
|
|||||||
JLabel label = new JLabel(trans.get("componentanalysisdlg.lbl.motorconf"));
|
JLabel label = new JLabel(trans.get("componentanalysisdlg.lbl.motorconf"));
|
||||||
label.setHorizontalAlignment(JLabel.RIGHT);
|
label.setHorizontalAlignment(JLabel.RIGHT);
|
||||||
panel.add(label, "growx, right");
|
panel.add(label, "growx, right");
|
||||||
panel.add(new JComboBox(new MotorConfigurationModel(configuration)), "wrap");
|
panel.add(new JComboBox(new FlightConfigurationModel(configuration)), "wrap");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
//// Edit motor configurations
|
//// Edit motor configurations
|
||||||
super(parent, trans.get("edtmotorconfdlg.title.Editmotorconf"));
|
super(parent, trans.get("edtmotorconfdlg.title.Editmotorconf"));
|
||||||
|
|
||||||
currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
||||||
@ -145,15 +145,15 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
|
|
||||||
public void selectConfiguration( String id ) {
|
public void selectConfiguration( String id ) {
|
||||||
currentID = id;
|
currentID = id;
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(currentID);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
// FIXME - update data in recovery configuration panel
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConfiguration() {
|
public void addConfiguration() {
|
||||||
currentID = rocket.newMotorConfigurationID();
|
currentID = rocket.newFlightConfigurationID();
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(currentID);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
// FIXME - update data in recovery configuration panel
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
@ -161,7 +161,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void changeConfigurationName( String newName ) {
|
public void changeConfigurationName( String newName ) {
|
||||||
rocket.setMotorConfigurationName(currentID, newName);
|
rocket.setFlightConfigurationName(currentID, newName);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
// FIXME - update data in recovery configuration panel
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
@ -170,8 +170,8 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
public void removeConfiguration() {
|
public void removeConfiguration() {
|
||||||
if (currentID == null)
|
if (currentID == null)
|
||||||
return;
|
return;
|
||||||
rocket.removeMotorConfigurationID(currentID);
|
rocket.removeFlightConfigurationID(currentID);
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(null);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(null);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
// FIXME - update data in recovery configuration panel
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
|
|||||||
@ -24,12 +24,12 @@ public class FlightConfigurationModel extends DefaultComboBoxModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fireContentsUpdated() {
|
void fireContentsUpdated() {
|
||||||
fireContentsChanged(this, 0, rocket.getMotorConfigurationIDs().length);
|
fireContentsChanged(this, 0, rocket.getFlightConfigurationIDs().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
String[] ids = rocket.getMotorConfigurationIDs();
|
String[] ids = rocket.getFlightConfigurationIDs();
|
||||||
if (index < 0 || index >= ids.length)
|
if (index < 0 || index >= ids.length)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -38,12 +38,12 @@ public class FlightConfigurationModel extends DefaultComboBoxModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return rocket.getMotorConfigurationIDs().length;
|
return rocket.getFlightConfigurationIDs().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
return get(config.getMotorConfigurationID());
|
return get(config.getFlightConfigurationID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,7 +90,7 @@ public class FlightConfigurationModel extends DefaultComboBoxModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return rocket.getMotorConfigurationNameOrDescription(id);
|
return rocket.getFlightConfigurationNameOrDescription(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -139,14 +139,14 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateButtonState() {
|
public void updateButtonState() {
|
||||||
String currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
selectMotorButton.setEnabled(currentMount != null && currentID != null);
|
selectMotorButton.setEnabled(currentMount != null && currentID != null);
|
||||||
removeMotorButton.setEnabled(currentMount != null && currentID != null);
|
removeMotorButton.setEnabled(currentMount != null && currentID != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void selectMotor() {
|
private void selectMotor() {
|
||||||
String currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
if (currentID == null || currentMount == null)
|
if (currentID == null || currentMount == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeMotor() {
|
private void removeMotor() {
|
||||||
String currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
if (currentID == null || currentMount == null)
|
if (currentID == null || currentMount == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String findMotorForDisplay( int column ) {
|
public String findMotorForDisplay( int column ) {
|
||||||
String currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
MotorMount mount = findMount(column);
|
MotorMount mount = findMount(column);
|
||||||
Motor motor = mount.getMotor(currentID);
|
Motor motor = mount.getMotor(currentID);
|
||||||
if (motor == null)
|
if (motor == null)
|
||||||
@ -232,7 +232,7 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String findIgnitionForDisplay( int column ) {
|
public String findIgnitionForDisplay( int column ) {
|
||||||
String currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
MotorMount mount = findMount(column);
|
MotorMount mount = findMount(column);
|
||||||
Motor motor = mount.getMotor(currentID);
|
Motor motor = mount.getMotor(currentID);
|
||||||
if (motor == null)
|
if (motor == null)
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class RecoveryConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void resetDeployment() {
|
private void resetDeployment() {
|
||||||
selectedComponent.setDeploymentConfiguration(rocket.getDefaultConfiguration().getMotorConfigurationID(), null);
|
selectedComponent.setDeploymentConfiguration(rocket.getDefaultConfiguration().getFlightConfigurationID(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtonState() {
|
private void updateButtonState() {
|
||||||
@ -144,7 +144,7 @@ public class RecoveryConfigurationPanel extends JPanel {
|
|||||||
case 0:
|
case 0:
|
||||||
return d.getName();
|
return d.getName();
|
||||||
case 1:
|
case 1:
|
||||||
DeploymentConfiguration deployConfig = d.getDeploymentConfiguration(rocket.getDefaultConfiguration().getMotorConfigurationID());
|
DeploymentConfiguration deployConfig = d.getDeploymentConfiguration(rocket.getDefaultConfiguration().getFlightConfigurationID());
|
||||||
if ( deployConfig == null ) {
|
if ( deployConfig == null ) {
|
||||||
return "[" + d.getDefaultDeploymentConfiguration().toString() + "]";
|
return "[" + d.getDefaultDeploymentConfiguration().toString() + "]";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class RenameConfigDialog extends JDialog {
|
|||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout("fill"));
|
JPanel panel = new JPanel(new MigLayout("fill"));
|
||||||
|
|
||||||
final JTextArea textbox = new JTextArea( config.getMotorConfigurationDescription() );
|
final JTextArea textbox = new JTextArea( config.getFlightConfigurationDescription() );
|
||||||
panel.add(textbox, "span, w 200lp, wrap");
|
panel.add(textbox, "span, w 200lp, wrap");
|
||||||
|
|
||||||
JButton okButton = new JButton("Ok");
|
JButton okButton = new JButton("Ok");
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class SelectDeploymentConfigDialog extends JDialog {
|
|||||||
SelectDeploymentConfigDialog( JDialog parent, final Rocket rocket, final RecoveryDevice component ) {
|
SelectDeploymentConfigDialog( JDialog parent, final Rocket rocket, final RecoveryDevice component ) {
|
||||||
super(parent);
|
super(parent);
|
||||||
super.setModal(true);
|
super.setModal(true);
|
||||||
final String configId = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
final String configId = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||||
|
|
||||||
newConfiguration = component.getDeploymentConfiguration(configId);
|
newConfiguration = component.getDeploymentConfiguration(configId);
|
||||||
if ( newConfiguration == null ) {
|
if ( newConfiguration == null ) {
|
||||||
|
|||||||
@ -991,25 +991,25 @@ public class GeneralOptimizationDialog extends JDialog {
|
|||||||
Rocket rocket = documentCopy.getRocket();
|
Rocket rocket = documentCopy.getRocket();
|
||||||
|
|
||||||
for (Simulation s : documentCopy.getSimulations()) {
|
for (Simulation s : documentCopy.getSimulations()) {
|
||||||
String id = s.getConfiguration().getMotorConfigurationID();
|
String id = s.getConfiguration().getFlightConfigurationID();
|
||||||
String name = createSimulationName(s.getName(), rocket.getMotorConfigurationNameOrDescription(id));
|
String name = createSimulationName(s.getName(), rocket.getFlightConfigurationNameOrDescription(id));
|
||||||
simulations.add(new Named<Simulation>(s, name));
|
simulations.add(new Named<Simulation>(s, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String id : rocket.getMotorConfigurationIDs()) {
|
for (String id : rocket.getFlightConfigurationIDs()) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Simulation sim = new Simulation(rocket);
|
Simulation sim = new Simulation(rocket);
|
||||||
sim.getConfiguration().setMotorConfigurationID(id);
|
sim.getConfiguration().setFlightConfigurationID(id);
|
||||||
String name = createSimulationName(trans.get("basicSimulationName"), rocket.getMotorConfigurationNameOrDescription(id));
|
String name = createSimulationName(trans.get("basicSimulationName"), rocket.getFlightConfigurationNameOrDescription(id));
|
||||||
simulations.add(new Named<Simulation>(sim, name));
|
simulations.add(new Named<Simulation>(sim, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Simulation sim = new Simulation(rocket);
|
Simulation sim = new Simulation(rocket);
|
||||||
sim.getConfiguration().setMotorConfigurationID(null);
|
sim.getConfiguration().setFlightConfigurationID(null);
|
||||||
String name = createSimulationName(trans.get("noSimulationName"), rocket.getMotorConfigurationNameOrDescription(null));
|
String name = createSimulationName(trans.get("noSimulationName"), rocket.getFlightConfigurationNameOrDescription(null));
|
||||||
simulations.add(new Named<Simulation>(sim, name));
|
simulations.add(new Named<Simulation>(sim, name));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -205,7 +205,7 @@ public class RocketRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderMotors(GL2 gl, Configuration configuration) {
|
private void renderMotors(GL2 gl, Configuration configuration) {
|
||||||
String motorID = configuration.getMotorConfigurationID();
|
String motorID = configuration.getFlightConfigurationID();
|
||||||
Iterator<MotorMount> iterator = configuration.motorIterator();
|
Iterator<MotorMount> iterator = configuration.motorIterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
MotorMount mount = iterator.next();
|
MotorMount mount = iterator.next();
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import net.sf.openrocket.gui.SpinnerEditor;
|
|||||||
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.adaptors.EnumModel;
|
import net.sf.openrocket.gui.adaptors.EnumModel;
|
||||||
import net.sf.openrocket.gui.adaptors.MotorConfigurationModel;
|
import net.sf.openrocket.gui.adaptors.FlightConfigurationModel;
|
||||||
import net.sf.openrocket.gui.components.BasicSlider;
|
import net.sf.openrocket.gui.components.BasicSlider;
|
||||||
import net.sf.openrocket.gui.components.DescriptionArea;
|
import net.sf.openrocket.gui.components.DescriptionArea;
|
||||||
import net.sf.openrocket.gui.components.SimulationExportPanel;
|
import net.sf.openrocket.gui.components.SimulationExportPanel;
|
||||||
@ -215,13 +215,13 @@ public class SimulationEditDialog extends JDialog {
|
|||||||
label.setToolTipText(trans.get("simedtdlg.lbl.ttip.Motorcfg"));
|
label.setToolTipText(trans.get("simedtdlg.lbl.ttip.Motorcfg"));
|
||||||
panel.add(label, "shrinkx, spanx, split 2");
|
panel.add(label, "shrinkx, spanx, split 2");
|
||||||
|
|
||||||
JComboBox combo = new JComboBox(new MotorConfigurationModel(configuration));
|
JComboBox combo = new JComboBox(new FlightConfigurationModel(configuration));
|
||||||
//// Select the motor configuration to use.
|
//// Select the motor configuration to use.
|
||||||
combo.setToolTipText(trans.get("simedtdlg.combo.ttip.motorconf"));
|
combo.setToolTipText(trans.get("simedtdlg.combo.ttip.motorconf"));
|
||||||
combo.addActionListener(new ActionListener() {
|
combo.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
conditions.setMotorConfigurationID(configuration.getMotorConfigurationID());
|
conditions.setMotorConfigurationID(configuration.getFlightConfigurationID());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(combo, "growx, wrap para");
|
panel.add(combo, "growx, wrap para");
|
||||||
|
|||||||
@ -302,7 +302,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
if (row < 0 || row >= document.getSimulationCount())
|
if (row < 0 || row >= document.getSimulationCount())
|
||||||
return null;
|
return null;
|
||||||
return document.getSimulation(row).getConfiguration()
|
return document.getSimulation(row).getConfiguration()
|
||||||
.getMotorConfigurationDescription();
|
.getFlightConfigurationDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -216,7 +216,7 @@ public class DesignReport {
|
|||||||
paragraph.setSpacingAfter(heightOfDiagramAndText);
|
paragraph.setSpacingAfter(heightOfDiagramAndText);
|
||||||
document.add(paragraph);
|
document.add(paragraph);
|
||||||
|
|
||||||
String[] motorIds = rocket.getMotorConfigurationIDs();
|
String[] motorIds = rocket.getFlightConfigurationIDs();
|
||||||
List<Simulation> simulations = rocketDocument.getSimulations();
|
List<Simulation> simulations = rocketDocument.getSimulations();
|
||||||
|
|
||||||
for (int j = 0; j < motorIds.length; j++) {
|
for (int j = 0; j < motorIds.length; j++) {
|
||||||
@ -321,7 +321,7 @@ public class DesignReport {
|
|||||||
MassCalculator massCalc = new BasicMassCalculator();
|
MassCalculator massCalc = new BasicMassCalculator();
|
||||||
|
|
||||||
Configuration config = new Configuration(rocket);
|
Configuration config = new Configuration(rocket);
|
||||||
config.setMotorConfigurationID(motorId);
|
config.setFlightConfigurationID(motorId);
|
||||||
|
|
||||||
int totalMotorCount = 0;
|
int totalMotorCount = 0;
|
||||||
double totalPropMass = 0;
|
double totalPropMass = 0;
|
||||||
@ -444,7 +444,7 @@ public class DesignReport {
|
|||||||
PdfPTable labelTable = new PdfPTable(2);
|
PdfPTable labelTable = new PdfPTable(2);
|
||||||
labelTable.setWidths(new int[] { 3, 2 });
|
labelTable.setWidths(new int[] { 3, 2 });
|
||||||
final Paragraph chunk = ITextHelper.createParagraph(stripBrackets(
|
final Paragraph chunk = ITextHelper.createParagraph(stripBrackets(
|
||||||
theRocket.getMotorConfigurationNameOrDescription(motorId)), PrintUtilities.BOLD);
|
theRocket.getFlightConfigurationNameOrDescription(motorId)), PrintUtilities.BOLD);
|
||||||
chunk.setLeading(leading);
|
chunk.setLeading(leading);
|
||||||
chunk.setSpacingAfter(3f);
|
chunk.setSpacingAfter(3f);
|
||||||
|
|
||||||
|
|||||||
@ -347,7 +347,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
|
|
||||||
|
|
||||||
// Draw motors
|
// Draw motors
|
||||||
String motorID = configuration.getMotorConfigurationID();
|
String motorID = configuration.getFlightConfigurationID();
|
||||||
Color fillColor = ((SwingPreferences)Application.getPreferences()).getMotorFillColor();
|
Color fillColor = ((SwingPreferences)Application.getPreferences()).getMotorFillColor();
|
||||||
Color borderColor = ((SwingPreferences)Application.getPreferences()).getMotorBorderColor();
|
Color borderColor = ((SwingPreferences)Application.getPreferences()).getMotorBorderColor();
|
||||||
Iterator<MotorMount> iterator = configuration.motorIterator();
|
Iterator<MotorMount> iterator = configuration.motorIterator();
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import net.sf.openrocket.aerodynamics.WarningSet;
|
|||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.adaptors.MotorConfigurationModel;
|
import net.sf.openrocket.gui.adaptors.FlightConfigurationModel;
|
||||||
import net.sf.openrocket.gui.components.BasicSlider;
|
import net.sf.openrocket.gui.components.BasicSlider;
|
||||||
import net.sf.openrocket.gui.components.StageSelector;
|
import net.sf.openrocket.gui.components.StageSelector;
|
||||||
import net.sf.openrocket.gui.components.UnitSelector;
|
import net.sf.openrocket.gui.components.UnitSelector;
|
||||||
@ -305,7 +305,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
JLabel label = new JLabel(trans.get("RocketPanel.lbl.Motorcfg"));
|
JLabel label = new JLabel(trans.get("RocketPanel.lbl.Motorcfg"));
|
||||||
label.setHorizontalAlignment(JLabel.RIGHT);
|
label.setHorizontalAlignment(JLabel.RIGHT);
|
||||||
add(label, "growx, right");
|
add(label, "growx, right");
|
||||||
add(new JComboBox(new MotorConfigurationModel(configuration)), "wrap");
|
add(new JComboBox(new FlightConfigurationModel(configuration)), "wrap");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -670,12 +670,12 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
|
|
||||||
// Check whether data is already up to date
|
// Check whether data is already up to date
|
||||||
if (flightDataFunctionalID == configuration.getRocket().getFunctionalModID() &&
|
if (flightDataFunctionalID == configuration.getRocket().getFunctionalModID() &&
|
||||||
flightDataMotorID == configuration.getMotorConfigurationID()) {
|
flightDataMotorID == configuration.getFlightConfigurationID()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
flightDataFunctionalID = configuration.getRocket().getFunctionalModID();
|
flightDataFunctionalID = configuration.getRocket().getFunctionalModID();
|
||||||
flightDataMotorID = configuration.getMotorConfigurationID();
|
flightDataMotorID = configuration.getFlightConfigurationID();
|
||||||
|
|
||||||
// Stop previous computation (if any)
|
// Stop previous computation (if any)
|
||||||
stopBackgroundSimulation();
|
stopBackgroundSimulation();
|
||||||
@ -693,7 +693,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
Rocket duplicate = (Rocket) configuration.getRocket().copy();
|
Rocket duplicate = (Rocket) configuration.getRocket().copy();
|
||||||
Simulation simulation = ((SwingPreferences)Application.getPreferences()).getBackgroundSimulation(duplicate);
|
Simulation simulation = ((SwingPreferences)Application.getPreferences()).getBackgroundSimulation(duplicate);
|
||||||
simulation.getOptions().setMotorConfigurationID(
|
simulation.getOptions().setMotorConfigurationID(
|
||||||
configuration.getMotorConfigurationID());
|
configuration.getFlightConfigurationID());
|
||||||
|
|
||||||
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
|
backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation);
|
||||||
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
|
backgroundSimulationExecutor.execute(backgroundSimulationWorker);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class BasicMassCalculator extends AbstractMassCalculator {
|
|||||||
totalCG = Coordinate.NUL;
|
totalCG = Coordinate.NUL;
|
||||||
|
|
||||||
// Add motor CGs
|
// Add motor CGs
|
||||||
String motorId = configuration.getMotorConfigurationID();
|
String motorId = configuration.getFlightConfigurationID();
|
||||||
if (type != MassCalcType.NO_MOTORS && motorId != null) {
|
if (type != MassCalcType.NO_MOTORS && motorId != null) {
|
||||||
Iterator<MotorMount> iterator = configuration.motorIterator();
|
Iterator<MotorMount> iterator = configuration.motorIterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
|||||||
|
|
||||||
// Simulation is used to calculate default min/max values
|
// Simulation is used to calculate default min/max values
|
||||||
Simulation simulation = new Simulation(rocket);
|
Simulation simulation = new Simulation(rocket);
|
||||||
simulation.getConfiguration().setMotorConfigurationID(null);
|
simulation.getConfiguration().setFlightConfigurationID(null);
|
||||||
|
|
||||||
for (RocketComponent c : rocket) {
|
for (RocketComponent c : rocket) {
|
||||||
|
|
||||||
|
|||||||
@ -360,7 +360,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
|
|||||||
RocketComponent root = this.getRoot();
|
RocketComponent root = this.getRoot();
|
||||||
if (!(root instanceof Rocket))
|
if (!(root instanceof Rocket))
|
||||||
return null;
|
return null;
|
||||||
if (!((Rocket) root).isMotorConfigurationID(id))
|
if (!((Rocket) root).isFlightConfigurationID(id))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return motors.get(id);
|
return motors.get(id);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class Configuration implements Cloneable, ChangeSource, ComponentChangeLi
|
|||||||
private Rocket rocket;
|
private Rocket rocket;
|
||||||
private BitSet stages = new BitSet();
|
private BitSet stages = new BitSet();
|
||||||
|
|
||||||
private String motorConfiguration = null;
|
private String flightConfigurationId = null;
|
||||||
|
|
||||||
private List<EventListener> listenerList = new ArrayList<EventListener>();
|
private List<EventListener> listenerList = new ArrayList<EventListener>();
|
||||||
|
|
||||||
@ -163,21 +163,21 @@ public class Configuration implements Cloneable, ChangeSource, ComponentChangeLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getMotorConfigurationID() {
|
public String getFlightConfigurationID() {
|
||||||
return motorConfiguration;
|
return flightConfigurationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMotorConfigurationID(String id) {
|
public void setFlightConfigurationID(String id) {
|
||||||
if ((motorConfiguration == null && id == null) ||
|
if ((flightConfigurationId == null && id == null) ||
|
||||||
(id != null && id.equals(motorConfiguration)))
|
(id != null && id.equals(flightConfigurationId)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
motorConfiguration = id;
|
flightConfigurationId = id;
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMotorConfigurationDescription() {
|
public String getFlightConfigurationDescription() {
|
||||||
return rocket.getMotorConfigurationNameOrDescription(motorConfiguration);
|
return rocket.getFlightConfigurationNameOrDescription(flightConfigurationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ public class Configuration implements Cloneable, ChangeSource, ComponentChangeLi
|
|||||||
MotorMount mount = (MotorMount) c;
|
MotorMount mount = (MotorMount) c;
|
||||||
if (!mount.isMotorMount())
|
if (!mount.isMotorMount())
|
||||||
continue;
|
continue;
|
||||||
if (mount.getMotor(this.motorConfiguration) != null) {
|
if (mount.getMotor(this.flightConfigurationId) != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,7 +458,7 @@ public class Configuration implements Cloneable, ChangeSource, ComponentChangeLi
|
|||||||
RocketComponent c = iterator.next();
|
RocketComponent c = iterator.next();
|
||||||
if (c instanceof MotorMount) {
|
if (c instanceof MotorMount) {
|
||||||
MotorMount mount = (MotorMount) c;
|
MotorMount mount = (MotorMount) c;
|
||||||
if (mount.isMotorMount() && mount.getMotor(motorConfiguration) != null) {
|
if (mount.isMotorMount() && mount.getMotor(flightConfigurationId) != null) {
|
||||||
next = mount;
|
next = mount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,7 +244,7 @@ public class InnerTube extends ThicknessRingComponent
|
|||||||
RocketComponent root = this.getRoot();
|
RocketComponent root = this.getRoot();
|
||||||
if (!(root instanceof Rocket))
|
if (!(root instanceof Rocket))
|
||||||
return null;
|
return null;
|
||||||
if (!((Rocket) root).isMotorConfigurationID(id))
|
if (!((Rocket) root).isFlightConfigurationID(id))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return motors.get(id);
|
return motors.get(id);
|
||||||
|
|||||||
@ -69,11 +69,11 @@ public class Rocket extends RocketComponent {
|
|||||||
private String revision = "";
|
private String revision = "";
|
||||||
|
|
||||||
|
|
||||||
// Motor configuration list
|
// Flight configuration list
|
||||||
private ArrayList<String> motorConfigurationIDs = new ArrayList<String>();
|
private ArrayList<String> flightConfigurationIDs = new ArrayList<String>();
|
||||||
private HashMap<String, String> motorConfigurationNames = new HashMap<String, String>();
|
private HashMap<String, String> flightConfigurationNames = new HashMap<String, String>();
|
||||||
{
|
{
|
||||||
motorConfigurationIDs.add(null);
|
flightConfigurationIDs.add(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,9 +266,9 @@ public class Rocket extends RocketComponent {
|
|||||||
@Override
|
@Override
|
||||||
public Rocket copyWithOriginalID() {
|
public Rocket copyWithOriginalID() {
|
||||||
Rocket copy = (Rocket) super.copyWithOriginalID();
|
Rocket copy = (Rocket) super.copyWithOriginalID();
|
||||||
copy.motorConfigurationIDs = this.motorConfigurationIDs.clone();
|
copy.flightConfigurationIDs = this.flightConfigurationIDs.clone();
|
||||||
copy.motorConfigurationNames =
|
copy.flightConfigurationNames =
|
||||||
(HashMap<String, String>) this.motorConfigurationNames.clone();
|
(HashMap<String, String>) this.flightConfigurationNames.clone();
|
||||||
copy.resetListeners();
|
copy.resetListeners();
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
@ -306,14 +306,14 @@ public class Rocket extends RocketComponent {
|
|||||||
this.refType = r.refType;
|
this.refType = r.refType;
|
||||||
this.customReferenceLength = r.customReferenceLength;
|
this.customReferenceLength = r.customReferenceLength;
|
||||||
|
|
||||||
this.motorConfigurationIDs = r.motorConfigurationIDs.clone();
|
this.flightConfigurationIDs = r.flightConfigurationIDs.clone();
|
||||||
this.motorConfigurationNames =
|
this.flightConfigurationNames =
|
||||||
(HashMap<String, String>) r.motorConfigurationNames.clone();
|
(HashMap<String, String>) r.flightConfigurationNames.clone();
|
||||||
this.perfectFinish = r.perfectFinish;
|
this.perfectFinish = r.perfectFinish;
|
||||||
|
|
||||||
String id = defaultConfiguration.getMotorConfigurationID();
|
String id = defaultConfiguration.getFlightConfigurationID();
|
||||||
if (!this.motorConfigurationIDs.contains(id))
|
if (!this.flightConfigurationIDs.contains(id))
|
||||||
defaultConfiguration.setMotorConfigurationID(null);
|
defaultConfiguration.setFlightConfigurationID(null);
|
||||||
|
|
||||||
this.checkComponentStructure();
|
this.checkComponentStructure();
|
||||||
|
|
||||||
@ -512,26 +512,26 @@ public class Rocket extends RocketComponent {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of the motor configuration IDs. This array is guaranteed
|
* Return an array of the flight configuration IDs. This array is guaranteed
|
||||||
* to contain the <code>null</code> ID as the first element.
|
* to contain the <code>null</code> ID as the first element.
|
||||||
*
|
*
|
||||||
* @return an array of the motor configuration IDs.
|
* @return an array of the flight configuration IDs.
|
||||||
*/
|
*/
|
||||||
public String[] getMotorConfigurationIDs() {
|
public String[] getFlightConfigurationIDs() {
|
||||||
checkState();
|
checkState();
|
||||||
return motorConfigurationIDs.toArray(new String[0]);
|
return flightConfigurationIDs.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new motor configuration ID to the motor configurations. The new ID
|
* Add a new flight configuration ID to the flight configurations. The new ID
|
||||||
* is returned.
|
* is returned.
|
||||||
*
|
*
|
||||||
* @return the new motor configuration ID.
|
* @return the new flight configuration ID.
|
||||||
*/
|
*/
|
||||||
public String newMotorConfigurationID() {
|
public String newFlightConfigurationID() {
|
||||||
checkState();
|
checkState();
|
||||||
String id = UUID.randomUUID().toString();
|
String id = UUID.randomUUID().toString();
|
||||||
motorConfigurationIDs.add(id);
|
flightConfigurationIDs.add(id);
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -544,24 +544,24 @@ public class Rocket extends RocketComponent {
|
|||||||
*/
|
*/
|
||||||
public boolean addMotorConfigurationID(String id) {
|
public boolean addMotorConfigurationID(String id) {
|
||||||
checkState();
|
checkState();
|
||||||
if (id == null || motorConfigurationIDs.contains(id))
|
if (id == null || flightConfigurationIDs.contains(id))
|
||||||
return false;
|
return false;
|
||||||
motorConfigurationIDs.add(id);
|
flightConfigurationIDs.add(id);
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a motor configuration ID from the configuration IDs. The <code>null</code>
|
* Remove a flight configuration ID from the configuration IDs. The <code>null</code>
|
||||||
* ID cannot be removed, and an attempt to remove it will be silently ignored.
|
* ID cannot be removed, and an attempt to remove it will be silently ignored.
|
||||||
*
|
*
|
||||||
* @param id the motor configuration ID to remove
|
* @param id the flight configuration ID to remove
|
||||||
*/
|
*/
|
||||||
public void removeMotorConfigurationID(String id) {
|
public void removeFlightConfigurationID(String id) {
|
||||||
checkState();
|
checkState();
|
||||||
if (id == null)
|
if (id == null)
|
||||||
return;
|
return;
|
||||||
motorConfigurationIDs.remove(id);
|
flightConfigurationIDs.remove(id);
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,9 +572,9 @@ public class Rocket extends RocketComponent {
|
|||||||
* @param id the configuration ID.
|
* @param id the configuration ID.
|
||||||
* @return whether a motor configuration with that ID exists.
|
* @return whether a motor configuration with that ID exists.
|
||||||
*/
|
*/
|
||||||
public boolean isMotorConfigurationID(String id) {
|
public boolean isFlightConfigurationID(String id) {
|
||||||
checkState();
|
checkState();
|
||||||
return motorConfigurationIDs.contains(id);
|
return flightConfigurationIDs.contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -608,17 +608,17 @@ public class Rocket extends RocketComponent {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the user-set name of the motor configuration. If no name has been set,
|
* Return the user-set name of the flight configuration. If no name has been set,
|
||||||
* returns an empty string (not null).
|
* returns an empty string (not null).
|
||||||
*
|
*
|
||||||
* @param id the motor configuration id
|
* @param id the flight configuration id
|
||||||
* @return the configuration name
|
* @return the configuration name
|
||||||
*/
|
*/
|
||||||
public String getMotorConfigurationName(String id) {
|
public String getFlightConfigurationName(String id) {
|
||||||
checkState();
|
checkState();
|
||||||
if (!isMotorConfigurationID(id))
|
if (!isFlightConfigurationID(id))
|
||||||
return "";
|
return "";
|
||||||
String s = motorConfigurationNames.get(id);
|
String s = flightConfigurationNames.get(id);
|
||||||
if (s == null)
|
if (s == null)
|
||||||
return "";
|
return "";
|
||||||
return s;
|
return s;
|
||||||
@ -626,45 +626,45 @@ public class Rocket extends RocketComponent {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the motor configuration. A name can be unset by passing
|
* Set the name of the flight configuration. A name can be unset by passing
|
||||||
* <code>null</code> or an empty string.
|
* <code>null</code> or an empty string.
|
||||||
*
|
*
|
||||||
* @param id the motor configuration id
|
* @param id the flight configuration id
|
||||||
* @param name the name for the motor configuration
|
* @param name the name for the flight configuration
|
||||||
*/
|
*/
|
||||||
public void setMotorConfigurationName(String id, String name) {
|
public void setFlightConfigurationName(String id, String name) {
|
||||||
checkState();
|
checkState();
|
||||||
motorConfigurationNames.put(id, name);
|
flightConfigurationNames.put(id, name);
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return either the motor configuration name (if set) or its description.
|
* Return either the flight configuration name (if set) or its description.
|
||||||
*
|
*
|
||||||
* @param id the motor configuration ID.
|
* @param id the flight configuration ID.
|
||||||
* @return a textual representation of the configuration
|
* @return a textual representation of the configuration
|
||||||
*/
|
*/
|
||||||
public String getMotorConfigurationNameOrDescription(String id) {
|
public String getFlightConfigurationNameOrDescription(String id) {
|
||||||
checkState();
|
checkState();
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
name = getMotorConfigurationName(id);
|
name = getFlightConfigurationName(id);
|
||||||
if (name != null && !name.equals(""))
|
if (name != null && !name.equals(""))
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
return getMotorConfigurationDescription(id);
|
return getFlightConfigurationDescription(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a description for the motor configuration, generated from the motor
|
* Return a description for the flight configuration, generated from the motor
|
||||||
* designations of the components.
|
* designations of the components.
|
||||||
*
|
*
|
||||||
* @param id the motor configuration ID.
|
* @param id the flight configuration ID.
|
||||||
* @return a textual representation of the configuration
|
* @return a textual representation of the configuration
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("null")
|
@SuppressWarnings("null")
|
||||||
public String getMotorConfigurationDescription(String id) {
|
public String getFlightConfigurationDescription(String id) {
|
||||||
checkState();
|
checkState();
|
||||||
String name;
|
String name;
|
||||||
int motorCount = 0;
|
int motorCount = 0;
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
|
|
||||||
// Set up rocket configuration
|
// Set up rocket configuration
|
||||||
Configuration configuration = setupConfiguration(simulationConditions);
|
Configuration configuration = setupConfiguration(simulationConditions);
|
||||||
flightConfigurationId = configuration.getMotorConfigurationID();
|
flightConfigurationId = configuration.getFlightConfigurationID();
|
||||||
MotorInstanceConfiguration motorConfiguration = setupMotorConfiguration(configuration);
|
MotorInstanceConfiguration motorConfiguration = setupMotorConfiguration(configuration);
|
||||||
if (motorConfiguration.getMotorIDs().isEmpty()) {
|
if (motorConfiguration.getMotorIDs().isEmpty()) {
|
||||||
throw new MotorIgnitionException("No motors defined in the simulation.");
|
throw new MotorIgnitionException("No motors defined in the simulation.");
|
||||||
@ -264,7 +264,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
private Configuration setupConfiguration(SimulationConditions simulation) {
|
private Configuration setupConfiguration(SimulationConditions simulation) {
|
||||||
Configuration configuration = new Configuration(simulation.getRocket());
|
Configuration configuration = new Configuration(simulation.getRocket());
|
||||||
configuration.setAllStages();
|
configuration.setAllStages();
|
||||||
configuration.setMotorConfigurationID(simulation.getMotorConfigurationID());
|
configuration.setFlightConfigurationID(simulation.getMotorConfigurationID());
|
||||||
|
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
*/
|
*/
|
||||||
private MotorInstanceConfiguration setupMotorConfiguration(Configuration configuration) {
|
private MotorInstanceConfiguration setupMotorConfiguration(Configuration configuration) {
|
||||||
MotorInstanceConfiguration motors = new MotorInstanceConfiguration();
|
MotorInstanceConfiguration motors = new MotorInstanceConfiguration();
|
||||||
final String motorId = configuration.getMotorConfigurationID();
|
final String motorId = configuration.getFlightConfigurationID();
|
||||||
|
|
||||||
Iterator<MotorMount> iterator = configuration.motorIterator();
|
Iterator<MotorMount> iterator = configuration.motorIterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@ -428,7 +428,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
throw new SimulationLaunchException("Motor burnout without liftoff.");
|
throw new SimulationLaunchException("Motor burnout without liftoff.");
|
||||||
}
|
}
|
||||||
// Add ejection charge event
|
// Add ejection charge event
|
||||||
String id = status.getConfiguration().getMotorConfigurationID();
|
String id = status.getConfiguration().getFlightConfigurationID();
|
||||||
MotorMount mount = (MotorMount) event.getSource();
|
MotorMount mount = (MotorMount) event.getSource();
|
||||||
double delay = mount.getMotorDelay(id);
|
double delay = mount.getMotorDelay(id);
|
||||||
if (delay != Motor.PLUGGED) {
|
if (delay != Motor.PLUGGED) {
|
||||||
|
|||||||
@ -116,7 +116,7 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
public void setMotorConfigurationID(String id) {
|
public void setMotorConfigurationID(String id) {
|
||||||
if (id != null)
|
if (id != null)
|
||||||
id = id.intern();
|
id = id.intern();
|
||||||
if (!rocket.isMotorConfigurationID(id))
|
if (!rocket.isFlightConfigurationID(id))
|
||||||
id = null;
|
id = null;
|
||||||
if (id == motorID)
|
if (id == motorID)
|
||||||
return;
|
return;
|
||||||
@ -408,11 +408,11 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
if (src.rocket.hasMotors(src.motorID)) {
|
if (src.rocket.hasMotors(src.motorID)) {
|
||||||
// Try to find a matching motor ID
|
// Try to find a matching motor ID
|
||||||
String motorDesc = src.rocket.getMotorConfigurationDescription(src.motorID);
|
String motorDesc = src.rocket.getFlightConfigurationDescription(src.motorID);
|
||||||
String matchID = null;
|
String matchID = null;
|
||||||
|
|
||||||
for (String id : this.rocket.getMotorConfigurationIDs()) {
|
for (String id : this.rocket.getFlightConfigurationIDs()) {
|
||||||
if (motorDesc.equals(this.rocket.getMotorConfigurationDescription(id))) {
|
if (motorDesc.equals(this.rocket.getFlightConfigurationDescription(id))) {
|
||||||
matchID = id;
|
matchID = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,13 +275,13 @@ public class TestRockets {
|
|||||||
bodytube.setMaterial(material);
|
bodytube.setMaterial(material);
|
||||||
finset.setMaterial(material);
|
finset.setMaterial(material);
|
||||||
|
|
||||||
String id = rocket.newMotorConfigurationID();
|
String id = rocket.newFlightConfigurationID();
|
||||||
bodytube.setMotorMount(true);
|
bodytube.setMotorMount(true);
|
||||||
|
|
||||||
Motor m = Application.getMotorSetDatabase().findMotors(null, null, "B4", Double.NaN, Double.NaN).get(0);
|
Motor m = Application.getMotorSetDatabase().findMotors(null, null, "B4", Double.NaN, Double.NaN).get(0);
|
||||||
bodytube.setMotor(id, m);
|
bodytube.setMotor(id, m);
|
||||||
bodytube.setMotorOverhang(0.005);
|
bodytube.setMotorOverhang(0.005);
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(id);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(id);
|
||||||
|
|
||||||
rocket.getDefaultConfiguration().setAllStages();
|
rocket.getDefaultConfiguration().setAllStages();
|
||||||
|
|
||||||
@ -346,13 +346,13 @@ public class TestRockets {
|
|||||||
// bodytube.setMaterial(material);
|
// bodytube.setMaterial(material);
|
||||||
// finset.setMaterial(material);
|
// finset.setMaterial(material);
|
||||||
|
|
||||||
String id = rocket.newMotorConfigurationID();
|
String id = rocket.newFlightConfigurationID();
|
||||||
bodytube.setMotorMount(true);
|
bodytube.setMotorMount(true);
|
||||||
|
|
||||||
// Motor m = Application.getMotorSetDatabase().findMotors(null, null, "F12J", Double.NaN, Double.NaN).get(0);
|
// Motor m = Application.getMotorSetDatabase().findMotors(null, null, "F12J", Double.NaN, Double.NaN).get(0);
|
||||||
// bodytube.setMotor(id, m);
|
// bodytube.setMotor(id, m);
|
||||||
// bodytube.setMotorOverhang(0.005);
|
// bodytube.setMotorOverhang(0.005);
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(id);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(id);
|
||||||
|
|
||||||
rocket.getDefaultConfiguration().setAllStages();
|
rocket.getDefaultConfiguration().setAllStages();
|
||||||
|
|
||||||
@ -549,13 +549,13 @@ public class TestRockets {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
String id = rocket.newMotorConfigurationID();
|
String id = rocket.newFlightConfigurationID();
|
||||||
tube3.setMotorMount(true);
|
tube3.setMotorMount(true);
|
||||||
|
|
||||||
// Motor m = Application.getMotorSetDatabase().findMotors(null, null, "L540", Double.NaN, Double.NaN).get(0);
|
// Motor m = Application.getMotorSetDatabase().findMotors(null, null, "L540", Double.NaN, Double.NaN).get(0);
|
||||||
// tube3.setMotor(id, m);
|
// tube3.setMotor(id, m);
|
||||||
// tube3.setMotorOverhang(0.02);
|
// tube3.setMotorOverhang(0.02);
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(id);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(id);
|
||||||
|
|
||||||
// tube3.setIgnitionEvent(MotorMount.IgnitionEvent.NEVER);
|
// tube3.setIgnitionEvent(MotorMount.IgnitionEvent.NEVER);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user