Use rocket freezing for split fins

This commit is contained in:
SiboVG 2023-03-21 22:52:29 +01:00
parent 0e93ca7c25
commit 62506eced0

View File

@ -1425,7 +1425,8 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
* Split the fin set into individual fins.
* @return A list of the new fin sets.
*/
public List<FinSet> splitFins() {
public List<FinSet> splitFins(boolean freezeRocket) {
final RocketComponent root = getRoot();
RocketComponent parent = getParent();
int index = parent.getChildPosition(this);
int count = getFinCount();
@ -1433,6 +1434,13 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
List<FinSet> splitFins = null; // List of all the split fins
try {
// Freeze rocket
if (freezeRocket && root instanceof Rocket) {
((Rocket) root).freeze();
}
// Split the fins
if (count > 1) {
parent.removeChild(index);
splitFins = new ArrayList<>();
@ -1451,14 +1459,28 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
// Split fins for children
for (RocketComponent listener : configListeners) {
if (listener instanceof FinSet) {
((FinSet) listener).splitFins();
((FinSet) listener).splitFins(false);
this.removeConfigListener(listener);
}
}
} finally {
// Unfreeze rocket
if (freezeRocket && root instanceof Rocket) {
((Rocket) root).thaw();
}
}
return splitFins;
}
/**
* Split the fin set into individual fins.
* @return A list of the new fin sets.
*/
public List<FinSet> splitFins() {
return splitFins(true);
}
// for debugging. You can safely delete this method
public static String getPointDescr( final Coordinate[] points, final String name, final String indent){