[fixes #666] Find SymmetricComponent.PreviousSymmetricComponent now handles PodSets correctly.
This commit is contained in:
parent
e400c8aeac
commit
ce6a6fa2e3
@ -570,21 +570,21 @@ public abstract class SymmetricComponent extends BodyComponent implements Radial
|
||||
return null;
|
||||
}
|
||||
|
||||
// might be: (a) Rocket -- for centerline stages
|
||||
// (b) BodyTube -- for Parallel Stages
|
||||
final AxialStage stage = this.getStage();
|
||||
final RocketComponent stageParent = stage.getParent();
|
||||
final ComponentAssembly assembly = this.getAssembly();
|
||||
// might be: (a) Rocket -- for Centerline/Axial stages
|
||||
// (b) BodyTube -- for Parallel Stages & PodSets
|
||||
final RocketComponent assemblyParent = assembly.getParent();
|
||||
|
||||
// note: this is not guaranteed to _contain_ a stage... but that we're _searching_ for one.
|
||||
int stageIndex = stageParent.getChildPosition(stage);
|
||||
int symmetricIndex = this.parent.getChildPosition(this)-1;
|
||||
int assemblyIndex = assemblyParent.getChildPosition(assembly); // position of stage w/in parent
|
||||
int symmetricIndex = this.parent.getChildPosition(this)-1; // guess at index of previous stage
|
||||
|
||||
while( 0 <= stageIndex ) {
|
||||
final RocketComponent prevStage = stageParent.getChild(stageIndex);
|
||||
while( 0 <= assemblyIndex ) {
|
||||
final RocketComponent searchAssembly = assemblyParent.getChild(assemblyIndex);
|
||||
|
||||
if(prevStage instanceof AxialStage){
|
||||
if(searchAssembly instanceof ComponentAssembly){
|
||||
while (0 <= symmetricIndex) {
|
||||
final RocketComponent previousSymmetric = prevStage.getChild(symmetricIndex);
|
||||
final RocketComponent previousSymmetric = searchAssembly.getChild(symmetricIndex);
|
||||
|
||||
if (previousSymmetric instanceof SymmetricComponent) {
|
||||
return (SymmetricComponent) previousSymmetric;
|
||||
@ -592,8 +592,8 @@ public abstract class SymmetricComponent extends BodyComponent implements Radial
|
||||
--symmetricIndex;
|
||||
}
|
||||
}
|
||||
--stageIndex;
|
||||
symmetricIndex = prevStage.getChildCount() - 1;
|
||||
--assemblyIndex;
|
||||
symmetricIndex = searchAssembly.getChildCount() - 1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user