When a component preset for NOSE_CONE or TRANSITION has filled set to true, then the shoulders are assumed to be filled as well.
This commit is contained in:
parent
d33792b5fc
commit
3f4f712472
@ -544,6 +544,11 @@ public class Transition extends SymmetricComponent {
|
||||
@Override
|
||||
protected void loadFromPreset(ComponentPreset preset) {
|
||||
|
||||
boolean presetFilled = false;
|
||||
if ( preset.has(ComponentPreset.FILLED ) ) {
|
||||
presetFilled = preset.get( ComponentPreset.FILLED);
|
||||
}
|
||||
|
||||
if ( preset.has(ComponentPreset.SHAPE) ) {
|
||||
Shape s = preset.get(ComponentPreset.SHAPE);
|
||||
this.setType(s);
|
||||
@ -560,6 +565,9 @@ public class Transition extends SymmetricComponent {
|
||||
if ( preset.has(ComponentPreset.AFT_SHOULDER_DIAMETER) ) {
|
||||
double d = preset.get(ComponentPreset.AFT_SHOULDER_DIAMETER);
|
||||
this.setAftShoulderRadius(d/2.0);
|
||||
if ( presetFilled ) {
|
||||
this.setAftShoulderThickness(d/2.0);
|
||||
}
|
||||
}
|
||||
if ( preset.has(ComponentPreset.FORE_OUTER_DIAMETER) ) {
|
||||
double outerDiameter = preset.get(ComponentPreset.FORE_OUTER_DIAMETER);
|
||||
@ -573,6 +581,9 @@ public class Transition extends SymmetricComponent {
|
||||
if ( preset.has(ComponentPreset.FORE_SHOULDER_DIAMETER) ) {
|
||||
double d = preset.get(ComponentPreset.FORE_SHOULDER_DIAMETER);
|
||||
this.setForeShoulderRadius(d/2.0);
|
||||
if ( presetFilled ) {
|
||||
this.setForeShoulderThickness(d/2.0);
|
||||
}
|
||||
}
|
||||
|
||||
super.loadFromPreset(preset);
|
||||
|
@ -61,6 +61,7 @@ public class NoseConeComponentTests extends BaseTestCase {
|
||||
assertEquals( 0.0, nc.getForeShoulderRadius(), 0.0 );
|
||||
assertEquals( 1.0, nc.getAftShoulderLength(), 0.0 );
|
||||
assertEquals( 0.5, nc.getAftShoulderRadius(), 0.0 );
|
||||
assertEquals( 0.5, nc.getAftShoulderThickness(), 0.0 );
|
||||
|
||||
assertFalse( nc.isForeRadiusAutomatic() );
|
||||
assertFalse( nc.isAftRadiusAutomatic() );
|
||||
|
@ -30,7 +30,7 @@ public class TransitionComponentTests extends BaseTestCase {
|
||||
@Before
|
||||
public void createPreset() throws Exception {
|
||||
TypedPropertyMap presetspec = new TypedPropertyMap();
|
||||
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.NOSE_CONE);
|
||||
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.TRANSITION);
|
||||
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
|
||||
presetspec.put( ComponentPreset.PARTNO, "partno");
|
||||
presetspec.put( ComponentPreset.LENGTH, 2.0);
|
||||
@ -65,16 +65,17 @@ public class TransitionComponentTests extends BaseTestCase {
|
||||
assertEquals( 1.0, tr.getAftRadius(), 0.0 );
|
||||
assertEquals( 1.0, tr.getForeShoulderLength(), 0.0 );
|
||||
assertEquals( 0.25, tr.getForeShoulderRadius(), 0.0 );
|
||||
assertEquals( 0.25, tr.getForeShoulderThickness(), 0.0 );
|
||||
assertEquals( 1.0, tr.getAftShoulderLength(), 0.0 );
|
||||
assertEquals( 0.5, tr.getAftShoulderRadius(), 0.0 );
|
||||
assertEquals( 0.5, tr.getAftShoulderThickness(), 0.0 );
|
||||
|
||||
assertFalse( tr.isForeRadiusAutomatic() );
|
||||
assertFalse( tr.isAftRadiusAutomatic() );
|
||||
assertTrue( tr.isFilled() );
|
||||
|
||||
assertSame( preset.get( ComponentPreset.MATERIAL), tr.getMaterial() );
|
||||
// FIXME - WOW - off by 76g! tr.getMass returns 176.518
|
||||
//assertEquals( 100.0, tr.getMass());
|
||||
assertEquals( 100.0, tr.getMass(), 1.0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user