Use rocket freezing for split fins
This commit is contained in:
parent
0e93ca7c25
commit
62506eced0
@ -1425,7 +1425,8 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
* Split the fin set into individual fins.
|
* Split the fin set into individual fins.
|
||||||
* @return A list of the new fin sets.
|
* @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();
|
RocketComponent parent = getParent();
|
||||||
int index = parent.getChildPosition(this);
|
int index = parent.getChildPosition(this);
|
||||||
int count = getFinCount();
|
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
|
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) {
|
if (count > 1) {
|
||||||
parent.removeChild(index);
|
parent.removeChild(index);
|
||||||
splitFins = new ArrayList<>();
|
splitFins = new ArrayList<>();
|
||||||
@ -1451,14 +1459,28 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
// Split fins for children
|
// Split fins for children
|
||||||
for (RocketComponent listener : configListeners) {
|
for (RocketComponent listener : configListeners) {
|
||||||
if (listener instanceof FinSet) {
|
if (listener instanceof FinSet) {
|
||||||
((FinSet) listener).splitFins();
|
((FinSet) listener).splitFins(false);
|
||||||
this.removeConfigListener(listener);
|
this.removeConfigListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
// Unfreeze rocket
|
||||||
|
if (freezeRocket && root instanceof Rocket) {
|
||||||
|
((Rocket) root).thaw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return splitFins;
|
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
|
// for debugging. You can safely delete this method
|
||||||
public static String getPointDescr( final Coordinate[] points, final String name, final String indent){
|
public static String getPointDescr( final Coordinate[] points, final String name, final String indent){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user