From 31e7c532d9bf2ebeacc87c99a4b0132c61541ec4 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sat, 24 Dec 2022 03:24:52 +0100 Subject: [PATCH 01/13] [#1894] Add inline pods warning --- core/resources/l10n/messages.properties | 1 + core/src/net/sf/openrocket/aerodynamics/Warning.java | 1 + 2 files changed, 2 insertions(+) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index e1e9dd23d..4721c4e23 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1860,6 +1860,7 @@ Warning.NO_RECOVERY_DEVICE = No recovery device defined in the simulation. Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: Warning.ZERO_VOLUME_BODY = Zero-volume bodies may not simulate accurately. +Warning.INLINE_PODS = Inline pods may not simulate accurately. Warning.TUBE_SEPARATION = Space between tube fins may not simulate accurately. Warning.TUBE_OVERLAP = Overlapping tube fins may not simulate accurately. Warning.EMPTY_BRANCH = Simulation branch contains no data diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index c746650ea..cba62d3e5 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -391,6 +391,7 @@ public abstract class Warning { public static final Warning EVENT_AFTER_LANDING = new Other(trans.get("Warning.EVENT_AFTER_LANDING")); public static final Warning ZERO_VOLUME_BODY = new Other(trans.get("Warning.ZERO_VOLUME_BODY")); + public static final Warning INLINE_PODS = new Other(trans.get("Warning.INLINE_PODS")); public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION")); public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP")); From de32314569c91ddfed51f207a3c7129dd935d46a Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 16 Jan 2023 00:10:09 +0100 Subject: [PATCH 02/13] [#1973] Don't mark all simulations out-of-date on flight config change --- .../sf/openrocket/document/Simulation.java | 19 ++-- .../rocketcomponent/FlightConfiguration.java | 15 +-- .../sf/openrocket/rocketcomponent/Rocket.java | 92 +++++++++++++++---- .../simulation/SimulationStatus.java | 3 +- .../gui/main/FlightConfigurationPanel.java | 25 +++-- .../FlightConfigurablePanel.java | 5 +- .../MotorConfigurationPanel.java | 8 +- .../RecoveryConfigurationPanel.java | 4 +- .../SeparationConfigurationPanel.java | 4 +- 9 files changed, 122 insertions(+), 53 deletions(-) diff --git a/core/src/net/sf/openrocket/document/Simulation.java b/core/src/net/sf/openrocket/document/Simulation.java index 95a93af50..eed9ca6a8 100644 --- a/core/src/net/sf/openrocket/document/Simulation.java +++ b/core/src/net/sf/openrocket/document/Simulation.java @@ -75,7 +75,7 @@ public class Simulation implements ChangeSource, Cloneable { private String name = ""; - private Status status = Status.NOT_SIMULATED; + private Status status; /** The conditions to use */ // TODO: HIGH: Change to use actual conditions class?? @@ -98,7 +98,7 @@ public class Simulation implements ChangeSource, Cloneable { private SimulationOptions simulatedConditions = null; private String simulatedConfigurationDescription = null; private FlightData simulatedData = null; - private int simulatedRocketID = -1; + private int simulatedConfigurationID = -1; /** @@ -147,7 +147,8 @@ public class Simulation implements ChangeSource, Cloneable { this.options = options; - this.setFlightConfigurationId( rocket.getSelectedConfiguration().getFlightConfigurationID()); + final FlightConfiguration config = rocket.getSelectedConfiguration(); + this.setFlightConfigurationId(config.getFlightConfigurationID()); options.addChangeListener(new ConditionListener()); @@ -160,7 +161,7 @@ public class Simulation implements ChangeSource, Cloneable { simulatedData = data; if (this.status == Status.LOADED) { simulatedConditions = options.clone(); - simulatedRocketID = rocket.getModID(); + simulatedConfigurationID = config.getModID(); } } @@ -308,8 +309,10 @@ public class Simulation implements ChangeSource, Cloneable { */ public Status getStatus() { mutex.verify(); + final FlightConfiguration config = rocket.getFlightConfiguration(this.getId()).clone(); + if (isStatusUpToDate(status)) { - if (rocket.getFunctionalModID() != simulatedRocketID || !options.equals(simulatedConditions)) { + if (config.getModID() != simulatedConfigurationID || !options.equals(simulatedConditions)) { status = Status.OUTDATED; } } @@ -320,8 +323,6 @@ public class Simulation implements ChangeSource, Cloneable { status = Status.CANT_RUN; return status; } - - FlightConfiguration config = rocket.getFlightConfiguration( this.getId()).clone(); //Make sure this simulation has motors. if ( ! config.hasMotors() ){ @@ -392,7 +393,7 @@ public class Simulation implements ChangeSource, Cloneable { // Set simulated info after simulation simulatedConditions = options.clone(); simulatedConfigurationDescription = descriptor.format( this.rocket, getId()); - simulatedRocketID = rocket.getFunctionalModID(); + simulatedConfigurationID = getActiveConfiguration().getModID(); status = Status.UPTODATE; fireChangeEvent(); @@ -492,7 +493,7 @@ public class Simulation implements ChangeSource, Cloneable { copy.simulatedConditions = null; copy.simulatedConfigurationDescription = null; copy.simulatedData = null; - copy.simulatedRocketID = -1; + copy.simulatedConfigurationID = -1; return copy; diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index ec1546236..2521f102b 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -525,6 +525,13 @@ public class FlightConfiguration implements FlightConfigurableParameter stagesBackup = new HashMap<>(this.stages); @@ -890,13 +897,7 @@ public class FlightConfiguration implements FlightConfigurableParameter iterator = this.iterator(true); while (iterator.hasNext()) { RocketComponent next = iterator.next(); next.componentChanged(cce); } - updateConfigurations(); + updateConfigurations(ids); notifyAllListeners(cce); - + } finally { mutex.unlock("fireComponentChangeEvent"); } } + @Override + protected void fireComponentChangeEvent(ComponentChangeEvent cce) { + fireComponentChangeEvent(cce, null); + } + @Override public void update(){ updateStageNumbers(); @@ -537,11 +555,51 @@ public class Rocket extends ComponentAssembly { trackStage(stage); } } - - private void updateConfigurations(){ - for( FlightConfiguration config : configSet ){ - config.update(); + + /** + * Update the modIDs of the supplied flight configurations. + * @param ids IDs of the flight configurations to update, or null to update all. + */ + private void updateConfigurationsModID(FlightConfigurationId[] ids) { + if (ids == null) { + for (FlightConfiguration config : configSet) { + config.updateModID(); + } + return; } + for (FlightConfiguration config : configSet) { + for (FlightConfigurationId id : ids) { + if (config.getId().equals(id)) { + config.updateModID(); + break; + } + } + } + } + + /** + * Update the flight configurations. + * @param ids IDs of the flight configurations to update, or null to update all. + */ + private void updateConfigurations(FlightConfigurationId[] ids) { + if (ids == null) { + for (FlightConfiguration config : configSet) { + config.update(); + } + return; + } + for (FlightConfiguration config : configSet) { + for (FlightConfigurationId id : ids) { + if (config.getId().equals(id)) { + config.update(); + break; + } + } + } + } + + private void updateConfigurations() { + updateConfigurations(null); } @@ -678,8 +736,8 @@ public class Rocket extends ComponentAssembly { } // Get current configuration: - this.configSet.reset( fcid); - fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); + this.configSet.reset(fcid); + fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); } diff --git a/core/src/net/sf/openrocket/simulation/SimulationStatus.java b/core/src/net/sf/openrocket/simulation/SimulationStatus.java index f3457b532..4cb132312 100644 --- a/core/src/net/sf/openrocket/simulation/SimulationStatus.java +++ b/core/src/net/sf/openrocket/simulation/SimulationStatus.java @@ -33,8 +33,7 @@ import net.sf.openrocket.util.WorldCoordinate; */ public class SimulationStatus implements Monitorable { - private static final Logger log = LoggerFactory.getLogger(SimulationStatus.class); - + private SimulationConditions simulationConditions; private FlightConfiguration configuration; private FlightDataBranch flightData; diff --git a/swing/src/net/sf/openrocket/gui/main/FlightConfigurationPanel.java b/swing/src/net/sf/openrocket/gui/main/FlightConfigurationPanel.java index d8fa0a279..edec986cc 100644 --- a/swing/src/net/sf/openrocket/gui/main/FlightConfigurationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/FlightConfigurationPanel.java @@ -2,6 +2,7 @@ package net.sf.openrocket.gui.main; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; +import java.util.Collections; import java.util.EventObject; import java.util.LinkedHashMap; import java.util.List; @@ -156,8 +157,9 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe * @param duplicate if True, then duplicate configuration operation, if False then create a new configuration */ private void newOrDuplicateConfigAction(boolean duplicate) { - addOrDuplicateConfiguration(duplicate); - configurationChanged(ComponentChangeEvent.MOTOR_CHANGE); + Map newConfigs = addOrDuplicateConfiguration(duplicate); + FlightConfigurationId[] ids = newConfigs.keySet().toArray(new FlightConfigurationId[0]); + configurationChanged(ComponentChangeEvent.MOTOR_CHANGE, ids); stateChanged(null); if (!duplicate) { switch (tabs.getSelectedIndex()) { @@ -179,14 +181,16 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe * either create or duplicate configuration * set new configuration as current * create simulation for new configuration + * + * @return the new/duplicated configurations */ - private void addOrDuplicateConfiguration(boolean duplicate) { + private Map addOrDuplicateConfiguration(boolean duplicate) { final Map newConfigs = new LinkedHashMap<>(); // create or duplicate configuration if (duplicate) { List oldIds = getSelectedConfigurationIds(); - if (oldIds == null || oldIds.size() == 0) return; + if (oldIds == null || oldIds.size() == 0) return Collections.emptyMap(); for (FlightConfigurationId oldId : oldIds) { final FlightConfiguration oldConfig = rocket.getFlightConfiguration(oldId); @@ -210,7 +214,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe } OpenRocketDocument doc = BasicFrame.findDocument(rocket); - if (doc == null) return; + if (doc == null) return Collections.emptyMap(); for (Map.Entry config : newConfigs.entrySet()) { // associate configuration with Id and select it @@ -226,6 +230,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe // Reset to first selected flight config rocket.setSelectedConfiguration((FlightConfigurationId) newConfigs.keySet().toArray()[0]); + return newConfigs; } private void renameConfigurationAction() { @@ -273,10 +278,14 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe return duplicateConfigAction; } + private void configurationChanged(int cce, FlightConfigurationId[] ids) { + motorConfigurationPanel.fireTableDataChanged(cce, ids); + recoveryConfigurationPanel.fireTableDataChanged(cce, ids); + separationConfigurationPanel.fireTableDataChanged(cce, ids); + } + private void configurationChanged(int cce) { - motorConfigurationPanel.fireTableDataChanged(cce); - recoveryConfigurationPanel.fireTableDataChanged(cce); - separationConfigurationPanel.fireTableDataChanged(cce); + configurationChanged(cce, null); } private void updateButtonState() { diff --git a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java index 69dc1d532..2d3ef491d 100644 --- a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java +++ b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java @@ -64,11 +64,12 @@ public abstract class FlightConfigurablePanel } if (update) { - fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE); + fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE, fcIds.toArray(new FlightConfigurationId[0])); } else { table.requestFocusInWindow(); } @@ -349,7 +349,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel } } - fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE); + fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE, fcIds.toArray(new FlightConfigurationId[0])); } private void selectIgnition() { @@ -396,7 +396,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel } if (update) { - fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE); + fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE, fcIds.toArray(new FlightConfigurationId[0])); } else { table.requestFocusInWindow(); } @@ -426,7 +426,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel } if (update) { - fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE); + fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE, fcIds.toArray(new FlightConfigurationId[0])); } else { table.requestFocusInWindow(); } diff --git a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java index a1e6e8745..3b272018b 100644 --- a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java @@ -209,7 +209,7 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel Date: Mon, 16 Jan 2023 02:41:42 +0100 Subject: [PATCH 03/13] Remove redundant update calls These are already called in fireChangeEvent() --- .../rocketcomponent/FlightConfiguration.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 2521f102b..40910e2d0 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -159,8 +159,6 @@ public class FlightConfiguration implements FlightConfigurableParameter Date: Mon, 16 Jan 2023 03:25:36 +0100 Subject: [PATCH 04/13] Fix sims going out-of-date on stage activeness change --- .../sf/openrocket/rocketcomponent/Rocket.java | 16 ++++++++++++++-- .../openrocket/gui/components/StageSelector.java | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index 63c8f6314..9422f0ba5 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -476,11 +476,23 @@ public class Rocket extends ComponentAssembly { * @param ids IDs of the flight configurations to update, or null to update all. * @see #fireComponentChangeEvent(ComponentChangeEvent) */ - public void fireComponentChangeEvent(int type, FlightConfigurationId[] ids) { + public void fireComponentChangeEvent(int type, final FlightConfigurationId[] ids) { fireComponentChangeEvent(new ComponentChangeEvent(this, type), ids); } - protected void fireComponentChangeEvent(ComponentChangeEvent cce, FlightConfigurationId[] ids) { + /** + * Fires a ComponentChangeEvent of the given type. The source of the event is set to + * this rocket. + * + * @param type Type of event + * @param id ID of the flight configurations to update, or null to update all. + * @see #fireComponentChangeEvent(ComponentChangeEvent) + */ + public void fireComponentChangeEvent(int type, FlightConfigurationId id) { + fireComponentChangeEvent(type, new FlightConfigurationId[]{ id }); + } + + protected void fireComponentChangeEvent(ComponentChangeEvent cce, final FlightConfigurationId[] ids) { if (!this.eventsEnabled) { return; } diff --git a/swing/src/net/sf/openrocket/gui/components/StageSelector.java b/swing/src/net/sf/openrocket/gui/components/StageSelector.java index f0e9ce289..1609c16d9 100644 --- a/swing/src/net/sf/openrocket/gui/components/StageSelector.java +++ b/swing/src/net/sf/openrocket/gui/components/StageSelector.java @@ -96,8 +96,10 @@ public class StageSelector extends JPanel implements StateChangeListener { setEnabled(true); putValue(SHORT_DESCRIPTION, trans.get("RocketPanel.btn.Stages.Toggle.ttip")); } - rocket.getSelectedConfiguration().toggleStage(stage.getStageNumber()); - rocket.fireComponentChangeEvent(ComponentChangeEvent.AEROMASS_CHANGE | ComponentChangeEvent.MOTOR_CHANGE ); + FlightConfiguration config = rocket.getSelectedConfiguration(); + config.toggleStage(stage.getStageNumber()); + rocket.fireComponentChangeEvent(ComponentChangeEvent.AEROMASS_CHANGE | ComponentChangeEvent.MOTOR_CHANGE, + config.getFlightConfigurationID()); } } From 25f0984334335129f99f4e94d614bb525d4d45dc Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 16 Jan 2023 03:26:29 +0100 Subject: [PATCH 05/13] Sync sims modID after file import This fixes loaded sims to still be marked as up-to-date after .ork importing --- core/src/net/sf/openrocket/document/Simulation.java | 8 +++++++- .../file/openrocket/importt/OpenRocketLoader.java | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/document/Simulation.java b/core/src/net/sf/openrocket/document/Simulation.java index eed9ca6a8..8d4644450 100644 --- a/core/src/net/sf/openrocket/document/Simulation.java +++ b/core/src/net/sf/openrocket/document/Simulation.java @@ -339,7 +339,13 @@ public class Simulation implements ChangeSource, Cloneable { public static boolean isStatusUpToDate(Status status) { return status == Status.UPTODATE || status == Status.LOADED || status == Status.EXTERNAL; } - + + /** + * Syncs the modID with its flight configuration. + */ + public void syncModID() { + this.simulatedConfigurationID = getActiveConfiguration().getModID(); + } /** diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/OpenRocketLoader.java b/core/src/net/sf/openrocket/file/openrocket/importt/OpenRocketLoader.java index 5460d3c99..e0bf4717b 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/OpenRocketLoader.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/OpenRocketLoader.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; +import net.sf.openrocket.rocketcomponent.ComponentChangeEvent; import net.sf.openrocket.rocketcomponent.FlightConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,6 +63,7 @@ public class OpenRocketLoader extends AbstractRocketLoader { // Deduce suitable time skip double timeSkip = StorageOptions.SIMULATION_DATA_NONE; for (Simulation s : doc.getSimulations()) { + s.syncModID(); // The config's modID can be out of sync with the simulation's after the whole loading process if (s.getStatus() == Simulation.Status.EXTERNAL || s.getStatus() == Simulation.Status.NOT_SIMULATED) continue; From b1e173d54ef9fafa173402c44a915bfeb42d59cf Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 17 Jan 2023 01:27:47 +0100 Subject: [PATCH 06/13] Refactor pod/booster shapes --- .../rocketfigure/ComponentAssemblyShapes.java | 56 +++++++++++++++++++ .../gui/rocketfigure/ParallelStageShapes.java | 47 +--------------- .../gui/rocketfigure/PodSetShapes.java | 47 +--------------- .../gui/scalefigure/RocketFigure.java | 4 +- 4 files changed, 62 insertions(+), 92 deletions(-) create mode 100644 swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java new file mode 100644 index 000000000..c4b2cb960 --- /dev/null +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java @@ -0,0 +1,56 @@ +package net.sf.openrocket.gui.rocketfigure; + +import net.sf.openrocket.rocketcomponent.ParallelStage; +import net.sf.openrocket.rocketcomponent.PodSet; +import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.util.Color; +import net.sf.openrocket.util.Transformation; + +import java.awt.Shape; + +public class ComponentAssemblyShapes extends RocketComponentShape { + + public static RocketComponentShape[] getShapesSide(final RocketComponent component, final Transformation transformation) { + double radius = getDisplayRadius(component); + + Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(transformation, radius); + RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); + + // Set the color of the shapes + Color color = getColor(component); + for (int i = 0; i < shapes.length - 1; i++) { + shapes[i].setColor(color); + } + + return shapes; + } + + public static RocketComponentShape[] getShapesBack(final RocketComponent component, final Transformation transformation) { + double radius = getDisplayRadius(component); + + Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(transformation, radius); + RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); + + // Set the color of the shapes + Color color = getColor(component); + for (int i = 0; i < shapes.length - 1; i++) { + shapes[i].setColor(color); + } + + return shapes; + } + + private static double getDisplayRadius(RocketComponent component) { + return component.getRocket().getBoundingRadius() * 0.03; + } + + private static Color getColor(RocketComponent component) { + if (component instanceof PodSet) { + return new Color(160,160,215); + } else if (component instanceof ParallelStage) { + return new Color(198,163,184); + } else { + return new Color(160, 160, 160); + } + } +} diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java index 565a23591..18f27ab4a 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java @@ -1,48 +1,5 @@ package net.sf.openrocket.gui.rocketfigure; -import net.sf.openrocket.rocketcomponent.ParallelStage; -import net.sf.openrocket.rocketcomponent.RocketComponent; -import net.sf.openrocket.util.Color; -import net.sf.openrocket.util.Transformation; - -import java.awt.Shape; - -public class ParallelStageShapes extends RocketComponentShape { - public static final Color boosterColor = new Color(198,163,184); - - public static RocketComponentShape[] getShapesSide(final RocketComponent component, final Transformation transformation) { - ParallelStage booster = (ParallelStage)component; - double radius = getDisplayRadius(booster); - - Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(transformation, radius); - RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); - - // Set the color of the shapes - for (int i = 0; i < shapes.length - 1; i++) { - shapes[i].setColor(boosterColor); - } - shapes[shapes.length - 1].setColor(Color.INVISIBLE); - - return shapes; - } - - public static RocketComponentShape[] getShapesBack(final RocketComponent component, final Transformation transformation) { - ParallelStage booster = (ParallelStage)component; - double radius = getDisplayRadius(booster); - - Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(transformation, radius); - RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); - - // Set the color of the shapes - for (int i = 0; i < shapes.length - 1; i++) { - shapes[i].setColor(boosterColor); - } - shapes[shapes.length - 1].setColor(Color.INVISIBLE); - - return shapes; - } - - private static double getDisplayRadius(ParallelStage booster) { - return booster.getRocket().getBoundingRadius() * 0.03; - } +public class ParallelStageShapes extends ComponentAssemblyShapes { + // Everything is implemented in ComponentAssemblyShapes.java } diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java index 7ef928f2d..1d2ba4144 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java @@ -1,48 +1,5 @@ package net.sf.openrocket.gui.rocketfigure; -import net.sf.openrocket.rocketcomponent.PodSet; -import net.sf.openrocket.rocketcomponent.RocketComponent; -import net.sf.openrocket.util.Color; -import net.sf.openrocket.util.Transformation; - -import java.awt.Shape; - -public class PodSetShapes extends RocketComponentShape { - public static final Color podsetColor = new Color(160,160,215); - - public static RocketComponentShape[] getShapesSide(final RocketComponent component, final Transformation transformation) { - PodSet podset = (PodSet)component; - double radius = getDisplayRadius(podset); - - Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(transformation, radius); - RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); - - // Set the color of the shapes - for (int i = 0; i < shapes.length - 1; i++) { - shapes[i].setColor(podsetColor); - } - shapes[shapes.length - 1].setColor(Color.INVISIBLE); - - return shapes; - } - - public static RocketComponentShape[] getShapesBack(final RocketComponent component, final Transformation transformation) { - PodSet podset = (PodSet)component; - double radius = getDisplayRadius(podset); - - Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(transformation, radius); - RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); - - // Set the color of the shapes - for (int i = 0; i < shapes.length - 1; i++) { - shapes[i].setColor(podsetColor); - } - shapes[shapes.length - 1].setColor(Color.INVISIBLE); - - return shapes; - } - - private static double getDisplayRadius(PodSet podset) { - return podset.getRocket().getBoundingRadius() * 0.03; - } +public class PodSetShapes extends ComponentAssemblyShapes { + // Everything is implemented in ComponentAssemblyShapes.java } diff --git a/swing/src/net/sf/openrocket/gui/scalefigure/RocketFigure.java b/swing/src/net/sf/openrocket/gui/scalefigure/RocketFigure.java index 0f62a28f7..fa195b4c0 100644 --- a/swing/src/net/sf/openrocket/gui/scalefigure/RocketFigure.java +++ b/swing/src/net/sf/openrocket/gui/scalefigure/RocketFigure.java @@ -387,8 +387,8 @@ public class RocketFigure extends AbstractScaleFigure { for (Entry> entry : config.getActiveInstances().entrySet()) { final RocketComponent comp = entry.getKey(); - // Only draw podsets when they are selected - if ((comp instanceof PodSet || comp instanceof ParallelStage) && preferences.isShowMarkers()) { + // Only draw pod sets and boosters when they are selected + if (preferences.isShowMarkers() && (comp instanceof PodSet || comp instanceof ParallelStage)) { boolean selected = false; // Check if component is in the selection From 738905d6d8248f2d3dc6b763346c73692b2a8f47 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 17 Jan 2023 22:48:28 +0100 Subject: [PATCH 07/13] Refactoring --- .../rocketcomponent/FlightConfiguration.java | 2 +- .../sf/openrocket/rocketcomponent/InstanceMap.java | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 307b1e2d4..271e1fb59 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -427,7 +427,7 @@ public class FlightConfiguration implements FlightConfigurableParameter()); + public void emplace(final RocketComponent component, int number, final Transformation transform) { + if (!containsKey(component)) { + put(component, new ArrayList<>()); } - final InstanceContext context = new InstanceContext(component, number, xform); - get(key).add(context); + final InstanceContext context = new InstanceContext(component, number, transform); + get(component).add(context); } public List getInstanceContexts(final RocketComponent key) { From 3d02766d41ab987a1a508fa8564af305138d240c Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 18 Jan 2023 00:13:04 +0100 Subject: [PATCH 08/13] [#1980] Render booster markers even if no children --- .../rocketcomponent/FlightConfiguration.java | 19 +++++++++++++++++-- .../gui/scalefigure/RocketFigure.java | 9 +++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 271e1fb59..44089a499 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -67,6 +67,7 @@ public class FlightConfiguration implements FlightConfigurableParameter preloadStageActiveness = null; final private Collection activeMotors = new ConcurrentLinkedQueue(); final private InstanceMap activeInstances = new InstanceMap(); + final private InstanceMap extraRenderInstances = new InstanceMap(); // Extra instances to be rendered, besides the active instances private int boundsModID = -1; private BoundingBox cachedBoundsAerodynamic = new BoundingBox(); // Bounding box of all aerodynamic components @@ -288,7 +289,7 @@ public class FlightConfiguration implements FlightConfigurableParameter 0 && + return stage != null && stage.getChildCount() > 0 && // Stages with no children are marked as inactive stages.get(stageNumber) != null && stages.get(stageNumber).active; } @@ -398,6 +399,15 @@ public class FlightConfiguration implements FlightConfigurableParameter> entry : config.getActiveInstances().entrySet()) { + addShapesFromInstanceEntries(allShapes, config.getActiveInstances().entrySet()); + addShapesFromInstanceEntries(allShapes, config.getExtraRenderInstances().entrySet()); + } + + private void addShapesFromInstanceEntries(PriorityQueue allShapes, Set>> entries) { + for (Entry> entry : entries) { final RocketComponent comp = entry.getKey(); // Only draw pod sets and boosters when they are selected @@ -409,7 +414,7 @@ public class RocketFigure extends AbstractScaleFigure { } } } - + /** * Gets the shapes required to draw the component. * From 08b9afb6ca60af7bdc9269ca6e11d6476bfec2fa Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 18 Jan 2023 00:20:01 +0100 Subject: [PATCH 09/13] Refactor again --- .../gui/rocketfigure/ComponentAssemblyShapes.java | 10 ++++++++++ .../gui/rocketfigure/ParallelStageShapes.java | 5 ----- .../sf/openrocket/gui/rocketfigure/PodSetShapes.java | 5 ----- 3 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java delete mode 100644 swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java index c4b2cb960..da8250474 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java @@ -1,5 +1,6 @@ package net.sf.openrocket.gui.rocketfigure; +import net.sf.openrocket.rocketcomponent.AxialStage; import net.sf.openrocket.rocketcomponent.ParallelStage; import net.sf.openrocket.rocketcomponent.PodSet; import net.sf.openrocket.rocketcomponent.RocketComponent; @@ -11,6 +12,11 @@ import java.awt.Shape; public class ComponentAssemblyShapes extends RocketComponentShape { public static RocketComponentShape[] getShapesSide(final RocketComponent component, final Transformation transformation) { + // Ignore normal stages + if (component instanceof AxialStage && !(component instanceof ParallelStage)) { + return null; + } + double radius = getDisplayRadius(component); Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(transformation, radius); @@ -26,6 +32,10 @@ public class ComponentAssemblyShapes extends RocketComponentShape { } public static RocketComponentShape[] getShapesBack(final RocketComponent component, final Transformation transformation) { + // Ignore normal stages + if (component instanceof AxialStage && !(component instanceof ParallelStage)) { + return null; + } double radius = getDisplayRadius(component); Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(transformation, radius); diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java deleted file mode 100644 index 18f27ab4a..000000000 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/ParallelStageShapes.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.sf.openrocket.gui.rocketfigure; - -public class ParallelStageShapes extends ComponentAssemblyShapes { - // Everything is implemented in ComponentAssemblyShapes.java -} diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java deleted file mode 100644 index 1d2ba4144..000000000 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/PodSetShapes.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.sf.openrocket.gui.rocketfigure; - -public class PodSetShapes extends ComponentAssemblyShapes { - // Everything is implemented in ComponentAssemblyShapes.java -} From fcc3de10daf6407d4b25746156ce73003a79e728 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 18 Jan 2023 00:39:02 +0100 Subject: [PATCH 10/13] [#1981] Update pod/booster marker position based on axial method --- .../gui/rocketfigure/ComponentAssemblyShapes.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java index da8250474..05727dae1 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java @@ -1,9 +1,11 @@ package net.sf.openrocket.gui.rocketfigure; import net.sf.openrocket.rocketcomponent.AxialStage; +import net.sf.openrocket.rocketcomponent.ComponentAssembly; import net.sf.openrocket.rocketcomponent.ParallelStage; import net.sf.openrocket.rocketcomponent.PodSet; import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.rocketcomponent.position.AxialMethod; import net.sf.openrocket.util.Color; import net.sf.openrocket.util.Transformation; @@ -17,9 +19,19 @@ public class ComponentAssemblyShapes extends RocketComponentShape { return null; } + ComponentAssembly assembly = (ComponentAssembly) component; + + // Update the marker location based on the axial method. The axial method changes the "reference point" of the component. + Transformation newTransform = transformation; + if (assembly.getAxialMethod() == AxialMethod.BOTTOM) { + newTransform = transformation.applyTransformation(new Transformation(assembly.getLength(), 0, 0)); + } else if (assembly.getAxialMethod() == AxialMethod.MIDDLE) { + newTransform = transformation.applyTransformation(new Transformation(assembly.getLength() / 2, 0, 0)); + } + double radius = getDisplayRadius(component); - Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(transformation, radius); + Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(newTransform, radius); RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); // Set the color of the shapes From 8a04eed0a2043e37c5aabd886a1bfc78cdd5c9d0 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 18 Jan 2023 02:32:08 +0100 Subject: [PATCH 11/13] [#1981] Correct for pod/booster marker radius offset --- .../rocketfigure/ComponentAssemblyShapes.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java index 05727dae1..5dd94d4d0 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/ComponentAssemblyShapes.java @@ -22,16 +22,19 @@ public class ComponentAssemblyShapes extends RocketComponentShape { ComponentAssembly assembly = (ComponentAssembly) component; // Update the marker location based on the axial method. The axial method changes the "reference point" of the component. - Transformation newTransform = transformation; + Transformation correctedTransform = transformation; if (assembly.getAxialMethod() == AxialMethod.BOTTOM) { - newTransform = transformation.applyTransformation(new Transformation(assembly.getLength(), 0, 0)); + correctedTransform = transformation.applyTransformation(new Transformation(assembly.getLength(), 0, 0)); } else if (assembly.getAxialMethod() == AxialMethod.MIDDLE) { - newTransform = transformation.applyTransformation(new Transformation(assembly.getLength() / 2, 0, 0)); + correctedTransform = transformation.applyTransformation(new Transformation(assembly.getLength() / 2, 0, 0)); } - double radius = getDisplayRadius(component); + // Correct the radius to be at the "reference point" dictated by the component's radius offset. + double boundingRadius = assembly.getBoundingRadius(); + correctedTransform = correctedTransform.applyTransformation(new Transformation(0, -boundingRadius, 0)); - Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(newTransform, radius); + double markerRadius = getDisplayRadius(component); + Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(correctedTransform, markerRadius); RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); // Set the color of the shapes @@ -48,9 +51,15 @@ public class ComponentAssemblyShapes extends RocketComponentShape { if (component instanceof AxialStage && !(component instanceof ParallelStage)) { return null; } - double radius = getDisplayRadius(component); - Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(transformation, radius); + ComponentAssembly assembly = (ComponentAssembly) component; + + // Correct the radius to be at the "reference point" dictated by the component's radius offset. + double boundingRadius = assembly.getBoundingRadius(); + Transformation correctedTransform = transformation.applyTransformation(new Transformation(0, -boundingRadius, 0)); + + double markerRadius = getDisplayRadius(component); + Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(correctedTransform, markerRadius); RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); // Set the color of the shapes @@ -62,6 +71,11 @@ public class ComponentAssemblyShapes extends RocketComponentShape { return shapes; } + /** + * Returns the radius of the marker (i.e. the marker size), based on the rocket size. + * @param component this component + * @return the radius to draw the marker with + */ private static double getDisplayRadius(RocketComponent component) { return component.getRocket().getBoundingRadius() * 0.03; } From 60896d2236fd706694a10ad7f7b6e48afe001b3b Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 17 Jan 2023 00:05:08 +0100 Subject: [PATCH 12/13] Better warning component printing --- core/src/net/sf/openrocket/aerodynamics/WarningSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/aerodynamics/WarningSet.java b/core/src/net/sf/openrocket/aerodynamics/WarningSet.java index 6f709e83b..6fcd7b837 100644 --- a/core/src/net/sf/openrocket/aerodynamics/WarningSet.java +++ b/core/src/net/sf/openrocket/aerodynamics/WarningSet.java @@ -76,7 +76,7 @@ public class WarningSet extends AbstractSet implements Cloneable, Monit * */ public boolean add (Warning w, String d) { - return this.add(w.toString() + ": " + d); + return this.add(w.toString() + ": \"" + d + "\""); } @Override From 4f3d63f1db26c7db7be38d2d1cabda1d84433182 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 17 Jan 2023 00:18:47 +0100 Subject: [PATCH 13/13] Apply zero-volume body warning earlier on + add component information --- core/resources/l10n/messages.properties | 3 +- .../aerodynamics/BarrowmanCalculator.java | 11 +++++-- .../sf/openrocket/aerodynamics/Warning.java | 1 - .../aerodynamics/barrowman/FinSetCalc.java | 29 +++++++------------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index bc6eabbeb..0a286092b 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1899,8 +1899,7 @@ Warning.RECOVERY_HIGH_SPEED = Recovery device deployment at high speed Warning.NO_RECOVERY_DEVICE = No recovery device defined in the simulation. Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: -Warning.ZERO_VOLUME_BODY = Zero-volume bodies may not simulate accurately. -Warning.INLINE_PODS = Inline pods may not simulate accurately. +Warning.ZERO_VOLUME_BODY = Zero-volume bodies may not simulate accurately Warning.TUBE_SEPARATION = Space between tube fins may not simulate accurately. Warning.TUBE_OVERLAP = Overlapping tube fins may not simulate accurately. Warning.EMPTY_BRANCH = Simulation branch contains no data diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 264c1298b..5c161082b 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -1,5 +1,6 @@ package net.sf.openrocket.aerodynamics; +import static net.sf.openrocket.util.MathUtil.EPSILON; import static net.sf.openrocket.util.MathUtil.pow2; import java.util.*; @@ -300,9 +301,9 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { SymmetricComponent sym = (SymmetricComponent) comp; prevComp = sym.getPreviousSymmetricComponent(); - if( null == prevComp){ + if (prevComp == null) { if (sym.getForeRadius() - sym.getThickness() > MathUtil.EPSILON) { - warnings.add(Warning.OPEN_AIRFRAME_FORWARD, sym.toString()); + warnings.add(Warning.OPEN_AIRFRAME_FORWARD, sym.getName()); } } else { // Check for radius discontinuity @@ -314,6 +315,12 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { warnings.add( Warning.DIAMETER_DISCONTINUITY, sym + ", " + prevComp); } } + + // Check for phantom tube + if ((sym.getLength() < MathUtil.EPSILON) || + (sym.getAftRadius() < MathUtil.EPSILON && sym.getForeRadius() < MathUtil.EPSILON)) { + warnings.add(Warning.ZERO_VOLUME_BODY, sym.getName()); + } // double x = component.toAbsolute(Coordinate.NUL)[0].x; // // Check for lengthwise discontinuity diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index 0558cc762..b3c31fecc 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -394,7 +394,6 @@ public abstract class Warning { public static final Warning EVENT_AFTER_LANDING = new Other(trans.get("Warning.EVENT_AFTER_LANDING")); public static final Warning ZERO_VOLUME_BODY = new Other(trans.get("Warning.ZERO_VOLUME_BODY")); - public static final Warning INLINE_PODS = new Other(trans.get("Warning.INLINE_PODS")); public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION")); public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP")); diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java index 1bafd4abc..53746d2e6 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java @@ -46,10 +46,9 @@ public class FinSetCalc extends RocketComponentCalc { protected final WarningSet geometryWarnings = new WarningSet(); private final double[] poly = new double[6]; - + private final double thickness; private final double bodyRadius; - private final double bodyLength; private final int finCount; private final double cantAngle; private final FinSet.CrossSection crossSection; @@ -62,20 +61,17 @@ public class FinSetCalc extends RocketComponentCalc { ///why not put FinSet in the parameter instead? public FinSetCalc(FinSet component) { super(component); - - FinSet fin = component; - thickness = fin.getThickness(); - bodyLength = component.getParent().getLength(); - bodyRadius = fin.getBodyRadius(); - finCount = fin.getFinCount(); + this.thickness = component.getThickness(); + this.bodyRadius = component.getBodyRadius(); + this.finCount = component.getFinCount(); + + this.cantAngle = component.getCantAngle(); + this.span = component.getSpan(); + this.finArea = component.getPlanformArea(); + this.crossSection = component.getCrossSection(); - cantAngle = fin.getCantAngle(); - span = fin.getSpan(); - finArea = fin.getPlanformArea(); - crossSection = fin.getCrossSection(); - - calculateFinGeometry(fin); + calculateFinGeometry(component); calculatePoly(); calculateInterferenceFinCount(component); } @@ -101,10 +97,7 @@ public class FinSetCalc extends RocketComponentCalc { return; } - if ((bodyLength < EPSILON) || (bodyRadius < EPSILON)) { - // Add warnings: Phantom Body - warnings.add(Warning.ZERO_VOLUME_BODY); - }else if( (0 < bodyRadius) && (thickness > bodyRadius / 2)){ + if ((bodyRadius > 0) && (thickness > bodyRadius / 2)){ // Add warnings (radius/2 == diameter/4) warnings.add(Warning.THICK_FIN); }