[#1600] Calculate auto tab for all inner tubes

This commit is contained in:
SiboVG 2022-08-19 01:08:41 +02:00
parent 2b8515a321
commit 69dceca653

View File

@ -233,6 +233,15 @@ public abstract class FinSetConfig extends RocketComponentConfig {
autoCalc.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
calculateAutoTab(em, mts, mtl, tabHeightModel);
}
});
panel.add(autoCalc, "skip 1, spanx");
return panel;
}
private void calculateAutoTab(EnumModel<AxialMethod> em, DoubleModel mts, DoubleModel mtl, DoubleModel tabHeightModel) {
log.info(Markers.USER_MARKER, "Computing " + component.getComponentName() + " tab height.");
double inRad = 0.0;
@ -242,16 +251,13 @@ public abstract class FinSetConfig extends RocketComponentConfig {
document.startUndo("Compute fin tabs");
List<CenteringRing> rings = new ArrayList<>();
// Do deep recursive iteration to find centering rings and determine
// radius of inner tube
// Do deep recursive iteration to find centering rings and determine radius of inner tube
Iterator<RocketComponent> iter = parent.iterator(false);
while (iter.hasNext()) {
RocketComponent rocketComponent = iter.next();
if (rocketComponent instanceof InnerTube) {
InnerTube it = (InnerTube) rocketComponent;
if (it.isMotorMount()) {
inRad = it.getOuterRadius();
}
} else if (rocketComponent instanceof CenteringRing) {
rings.add((CenteringRing) rocketComponent);
}
@ -282,11 +288,6 @@ public abstract class FinSetConfig extends RocketComponentConfig {
}
}
}
});
panel.add(autoCalc, "skip 1, spanx");
return panel;
}
/**
* Scenarios: