Rename get/setType to get/setShapeType

This commit is contained in:
SiboVG 2023-02-12 06:52:33 +00:00
parent b5de5347ff
commit 8a779cfc11
30 changed files with 83 additions and 86 deletions

View File

@ -77,7 +77,7 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
frontalArea = 0;
sinphi = 0;
} else if (component instanceof Transition) {
shape = ((Transition) component).getType();
shape = ((Transition) component).getShapeType();
param = ((Transition) component).getShapeParameter();
frontalArea = Math.abs(Math.PI * (foreRadius * foreRadius - aftRadius * aftRadius));

View File

@ -213,7 +213,7 @@ class DocumentConfig {
// Transition
setters.put("Transition:shape", new EnumSetter<Transition.Shape>(
Reflection.findMethod(Transition.class, "setType", Transition.Shape.class),
Reflection.findMethod(Transition.class, "setShapeType", Transition.Shape.class),
Transition.Shape.class));
setters.put("Transition:shapeclipped", new BooleanSetter(
Reflection.findMethod(Transition.class, "setClipped", boolean.class)));
@ -409,7 +409,7 @@ class DocumentConfig {
Reflection.findMethod(MassComponent.class, "setMassComponentType", MassComponent.MassComponentType.class),
MassComponent.MassComponentType.class));
/* setters.put("Transition:shape", new EnumSetter<Transition.Shape>(
Reflection.findMethod(Transition.class, "setType", Transition.Shape.class),
Reflection.findMethod(Transition.class, "setShapeType", Transition.Shape.class),
Transition.Shape.class));*/
// ShockCord

View File

@ -38,7 +38,7 @@ class FlightDataBranchHandler extends AbstractElementHandler {
String typeName = split[i];
FlightDataType matching = findFlightDataType(typeName);
types[i] = matching;
//types[i] = FlightDataType.getType(typeName, matching.getSymbol(), matching.getUnitGroup());
//types[i] = FlightDataType.getShapeType(typeName, matching.getSymbol(), matching.getUnitGroup());
}
// TODO: LOW: May throw an IllegalArgumentException

View File

@ -31,7 +31,7 @@ public class TransitionSaver extends SymmetricComponentSaver {
super.addParams(c, elements);
net.sf.openrocket.rocketcomponent.Transition trans = (net.sf.openrocket.rocketcomponent.Transition) c;
Transition.Shape shape = trans.getType();
Transition.Shape shape = trans.getShapeType();
elements.add("<shape>" + shape.name().toLowerCase(Locale.ENGLISH) + "</shape>");
if (shape.isClippable()) {
elements.add("<shapeclipped>" + trans.isClipped() + "</shapeclipped>");

View File

@ -66,11 +66,11 @@ public class AbstractTransitionDTO extends BasePartDTO implements AttachablePart
protected AbstractTransitionDTO(Transition nc) {
super(nc);
setConstructionType(nc.isFilled() ? 0 : 1);
setShapeCode(RockSimNoseConeCode.toCode(nc.getType()));
setShapeCode(RockSimNoseConeCode.toCode(nc.getShapeType()));
if (Transition.Shape.POWER.equals(nc.getType()) ||
Transition.Shape.HAACK.equals(nc.getType()) ||
Transition.Shape.PARABOLIC.equals(nc.getType())) {
if (Transition.Shape.POWER.equals(nc.getShapeType()) ||
Transition.Shape.HAACK.equals(nc.getShapeType()) ||
Transition.Shape.PARABOLIC.equals(nc.getShapeType())) {
setShapeParameter(nc.getShapeParameter());
}

View File

@ -69,7 +69,7 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
try {
if (RockSimCommonConstants.SHAPE_CODE.equals(element)) {
noseCone.setType(RockSimNoseConeCode.fromCode(Integer.parseInt(content)).asOpenRocket());
noseCone.setShapeType(RockSimNoseConeCode.fromCode(Integer.parseInt(content)).asOpenRocket());
}
if (RockSimCommonConstants.LEN.equals(element)) {
noseCone.setLength(Math.max(0, Double.parseDouble(content) / RockSimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
@ -92,9 +92,9 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
//The Rocksim ShapeParameter only applies to certain shapes, although it is included
//in the design file for all nose cones. Applying it when it should not be causes oddities so
//a check is made for the allowable shapes.
if (Transition.Shape.POWER.equals(noseCone.getType()) ||
Transition.Shape.HAACK.equals(noseCone.getType()) ||
Transition.Shape.PARABOLIC.equals(noseCone.getType())) {
if (Transition.Shape.POWER.equals(noseCone.getShapeType()) ||
Transition.Shape.HAACK.equals(noseCone.getShapeType()) ||
Transition.Shape.PARABOLIC.equals(noseCone.getShapeType())) {
noseCone.setShapeParameter(Double.parseDouble(content));
}
}

View File

@ -64,7 +64,7 @@ class TransitionHandler extends BaseHandler<Transition> {
try {
if ("ShapeCode".equals(element)) {
transition.setType(RockSimNoseConeCode.fromCode(Integer.parseInt(content)).asOpenRocket());
transition.setShapeType(RockSimNoseConeCode.fromCode(Integer.parseInt(content)).asOpenRocket());
}
if ("Len".equals(element)) {
transition.setLength(Math.max(0, Double.parseDouble(
@ -98,9 +98,9 @@ class TransitionHandler extends BaseHandler<Transition> {
content) / RockSimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH));
}
if ("ShapeParameter".equals(element)) {
if (Transition.Shape.POWER.equals(transition.getType()) ||
Transition.Shape.HAACK.equals(transition.getType()) ||
Transition.Shape.PARABOLIC.equals(transition.getType())) {
if (Transition.Shape.POWER.equals(transition.getShapeType()) ||
Transition.Shape.HAACK.equals(transition.getShapeType()) ||
Transition.Shape.PARABOLIC.equals(transition.getShapeType())) {
transition.setShapeParameter(Double.parseDouble(content));
}
}

View File

@ -295,7 +295,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
// Conditional shape parameter of Transition
if (c instanceof Transition) {
Transition transition = (Transition) c;
Transition.Shape shape = transition.getType();
Transition.Shape shape = transition.getShapeType();
if (shape.usesParameter()) {
SimulationModifier mod = new GenericComponentModifier(
trans.get("optimization.modifier." + c.getClass().getSimpleName().toLowerCase(Locale.ENGLISH) + ".shapeparameter"),

View File

@ -970,7 +970,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
public boolean isRootStraight( ){
if( getParent() instanceof Transition){
return ((Transition) getParent()).getType() == Shape.CONICAL;
return ((Transition) getParent()).getShapeType() == Shape.CONICAL;
}
// by default, assume a flat base
@ -1078,7 +1078,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
final double intervalLength = xEnd - xStart;
// for anything more complicated, increase the count:
if ((body instanceof Transition) && (((Transition)body).getType() != Shape.CONICAL)) {
if ((body instanceof Transition) && (((Transition)body).getShapeType() != Shape.CONICAL)) {
// the maximum precision to enforce when calculating the areas of fins (especially on curved parent bodies)
final double xWidth = 0.0025; // width (in meters) of each individual iteration
divisionCount = (int) Math.ceil(intervalLength / xWidth);

View File

@ -29,7 +29,7 @@ public class NoseCone extends Transition implements InsideColorComponent {
public NoseCone(Transition.Shape type, double length, double radius) {
super();
this.isFlipped = false;
super.setType(type);
super.setShapeType(type);
super.setThickness(0.002);
super.setLength(length);
super.setClipped(false);

View File

@ -322,19 +322,19 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
//////// Type & shape /////////
public Shape getType() {
public Shape getShapeType() {
return type;
}
public void setType(Shape type) {
public void setShapeType(Shape type) {
for (RocketComponent listener : configListeners) {
if (listener instanceof Transition) {
((Transition) listener).setType(type);
((Transition) listener).setShapeType(type);
}
}
if (type == null) {
throw new IllegalArgumentException("setType called with null argument");
throw new IllegalArgumentException("setShapeType called with null argument");
}
if (this.type == type)
@ -766,7 +766,7 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
if ( preset.has(ComponentPreset.SHAPE) ) {
Shape s = preset.get(ComponentPreset.SHAPE);
this.setType(s);
this.setShapeType(s);
this.setClipped(s.canClip);
this.setShapeParameter(s.defaultParameter());
}

View File

@ -329,7 +329,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
// TODO: this event seems to get enqueue'd multiple times ...
log.info("Queueing Ignition Event for: "+state.toDescription()+" @: "+ignitionTime);
//log.info(" Because of "+event.getType().name()+" @"+event.getTime()+" from: "+event.getSource().getName());
//log.info(" Because of "+event.getShapeType().name()+" @"+event.getTime()+" from: "+event.getSource().getName());
addEvent(new FlightEvent(FlightEvent.Type.IGNITION, ignitionTime, (RocketComponent) mount, state ));
}

View File

@ -28,7 +28,6 @@ import net.sf.openrocket.rocketcomponent.CenteringRing;
import net.sf.openrocket.rocketcomponent.ClusterConfiguration;
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration;
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
import net.sf.openrocket.rocketcomponent.EllipticalFinSet;
import net.sf.openrocket.rocketcomponent.EngineBlock;
import net.sf.openrocket.rocketcomponent.ExternalComponent;
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
@ -263,7 +262,7 @@ public class TestRockets {
nose.setForeRadius(rnd(0.1)); // Unset
nose.setLength(rnd(0.15));
nose.setShapeParameter(rnd(0.5));
nose.setType((Shape) randomEnum(Shape.class));
nose.setShapeType((Shape) randomEnum(Shape.class));
stage.addChild(nose);
Transition shoulder = new Transition();
@ -286,7 +285,7 @@ public class TestRockets {
shoulder.setLength(rnd(0.15));
shoulder.setShapeParameter(rnd(0.5));
shoulder.setThickness(rnd(0.003));
shoulder.setType((Shape) randomEnum(Shape.class));
shoulder.setShapeType((Shape) randomEnum(Shape.class));
stage.addChild(shoulder);
BodyTube body = new BodyTube();
@ -320,7 +319,7 @@ public class TestRockets {
boattail.setLength(rnd(0.15));
boattail.setShapeParameter(rnd(0.5));
boattail.setThickness(rnd(0.003));
boattail.setType((Shape) randomEnum(Shape.class));
boattail.setShapeType((Shape) randomEnum(Shape.class));
stage.addChild(boattail);
MassComponent mass = new MassComponent();

View File

@ -84,7 +84,7 @@ public class BarrowmanCalculatorTest {
NoseCone nose = (NoseCone)stage.getChild(0);
assertEquals(" Estes Alpha III nose cone has incorrect length:", 0.07, nose.getLength(), EPSILON);
assertEquals(" Estes Alpha III nosecone has wrong (base) radius:", 0.012, nose.getAftRadius(), EPSILON);
assertEquals(" Estes Alpha III nosecone has wrong type:", Transition.Shape.OGIVE, nose.getType());
assertEquals(" Estes Alpha III nosecone has wrong type:", Transition.Shape.OGIVE, nose.getShapeType());
double cna_nose = 2;
double cpx_nose = 0.03235;

View File

@ -44,12 +44,12 @@ public class SymmetricComponentCalcTest {
public void testConicalNoseParams() {
Rocket rocket = TestRockets.makeEstesAlphaIII();
NoseCone nose = (NoseCone)rocket.getChild(0).getChild(0);
nose.setType( Transition.Shape.CONICAL );
nose.setShapeType( Transition.Shape.CONICAL );
// to illustrate the NoseCone properties to the reader:
assertEquals(" Estes Alpha III nose cone has incorrect length:", 0.07, nose.getLength(), EPSILON);
assertEquals(" Estes Alpha III nosecone has wrong (base) radius:", 0.012, nose.getAftRadius(), EPSILON);
assertEquals(" Estes Alpha III nosecone has wrong type:", Transition.Shape.CONICAL, nose.getType());
assertEquals(" Estes Alpha III nosecone has wrong type:", Transition.Shape.CONICAL, nose.getShapeType());
FlightConfiguration config = rocket.getSelectedConfiguration();
FlightConditions conditions = new FlightConditions(config);
@ -80,7 +80,7 @@ public class SymmetricComponentCalcTest {
// to illustrate the NoseCone properties to the reader:
assertEquals(" Estes Alpha III nose cone has incorrect length:", 0.07, nose.getLength(), EPSILON);
assertEquals(" Estes Alpha III nosecone has wrong (base) radius:", 0.012, nose.getAftRadius(), EPSILON);
assertEquals(" Estes Alpha III nosecone has wrong type:", Transition.Shape.OGIVE, nose.getType());
assertEquals(" Estes Alpha III nosecone has wrong type:", Transition.Shape.OGIVE, nose.getShapeType());
FlightConfiguration config = rocket.getSelectedConfiguration();
FlightConditions conditions = new FlightConditions(config);
@ -108,7 +108,7 @@ public class SymmetricComponentCalcTest {
Rocket rocket = TestRockets.makeEstesAlphaIII();
NoseCone nose = (NoseCone)rocket.getChild(0).getChild(0);
// use an ellipsoidal nose cone with fineness ratio 5
nose.setType(Transition.Shape.ELLIPSOID);
nose.setShapeType(Transition.Shape.ELLIPSOID);
nose.setLength(nose.getAftRadius() * 5.0);
SymmetricComponentCalc calcObj = new SymmetricComponentCalc( nose );

View File

@ -73,13 +73,13 @@ public class NoseConeHandlerTest extends RockSimTestBase {
NoseCone component = (NoseCone) getField(handler, "noseCone");
handler.closeElement("ShapeCode", attributes, "0", warnings);
Assert.assertEquals(Transition.Shape.CONICAL, component.getType());
Assert.assertEquals(Transition.Shape.CONICAL, component.getShapeType());
handler.closeElement("ShapeCode", attributes, "1", warnings);
Assert.assertEquals(Transition.Shape.OGIVE, component.getType());
Assert.assertEquals(Transition.Shape.OGIVE, component.getShapeType());
handler.closeElement("ShapeCode", attributes, "17", warnings);
Assert.assertEquals(RockSimNoseConeCode.PARABOLIC.asOpenRocket(), component.getType()); //test of default
Assert.assertEquals(RockSimNoseConeCode.PARABOLIC.asOpenRocket(), component.getShapeType()); //test of default
handler.closeElement("ShapeCode", attributes, "foo", warnings);
Assert.assertNotNull(component.getType());
Assert.assertNotNull(component.getShapeType());
Assert.assertEquals(1, warnings.size());
warnings.clear();
@ -148,7 +148,7 @@ public class NoseConeHandlerTest extends RockSimTestBase {
Assert.assertEquals(1, warnings.size());
warnings.clear();
component.setType(Transition.Shape.HAACK);
component.setShapeType(Transition.Shape.HAACK);
handler.closeElement("ShapeParameter", attributes, "-1", warnings);
Assert.assertEquals(0d, component.getShapeParameter(), 0.001);
handler.closeElement("ShapeParameter", attributes, "100", warnings);
@ -160,7 +160,7 @@ public class NoseConeHandlerTest extends RockSimTestBase {
warnings.clear();
component.setType(Transition.Shape.CONICAL);
component.setShapeType(Transition.Shape.CONICAL);
component.setShapeParameter(0d);
handler.closeElement("ShapeParameter", attributes, "100", warnings);
Assert.assertEquals(0d, component.getShapeParameter(), 0.001);

View File

@ -102,12 +102,12 @@ public class RockSimLoaderTest extends BaseTestCase {
Assert.assertEquals(" Transition 1 length does not match", 0.075, transition1.getLength(), MathUtil.EPSILON);
Assert.assertEquals(" Transition 1 fore radius does not match", 0.0125,((Transition) transition1).getForeRadius(), MathUtil.EPSILON);
Assert.assertEquals(" Transition 1 aft radius does not match", 0.025, ((Transition) transition1).getAftRadius(), MathUtil.EPSILON);
Assert.assertEquals(" Transition 1 shape does not match", Transition.Shape.CONICAL, ((Transition) transition1).getType());
Assert.assertEquals(" Transition 1 shape does not match", Transition.Shape.CONICAL, ((Transition) transition1).getShapeType());
Assert.assertEquals(" Transition 2 length does not match", 0.075, transition2.getLength(), MathUtil.EPSILON);
Assert.assertEquals(" Transition 2 fore radius does not match", 0.025,((Transition) transition2).getForeRadius(), MathUtil.EPSILON);
Assert.assertEquals(" Transition 2 aft radius does not match", 0.0125, ((Transition) transition2).getAftRadius(), MathUtil.EPSILON);
Assert.assertEquals(" Transition 2 shape does not match", Transition.Shape.CONICAL, ((Transition) transition2).getType());
Assert.assertEquals(" Transition 2 shape does not match", Transition.Shape.CONICAL, ((Transition) transition2).getShapeType());
RocketComponent finSet1 = transition1.getChild(0);
RocketComponent finSet2 = transition2.getChild(0);

View File

@ -68,13 +68,13 @@ public class TransitionHandlerTest extends RockSimTestBase {
Transition component = (Transition) getField(handler, "transition");
handler.closeElement("ShapeCode", attributes, "0", warnings);
Assert.assertEquals(Transition.Shape.CONICAL, component.getType());
Assert.assertEquals(Transition.Shape.CONICAL, component.getShapeType());
handler.closeElement("ShapeCode", attributes, "1", warnings);
Assert.assertEquals(Transition.Shape.OGIVE, component.getType());
Assert.assertEquals(Transition.Shape.OGIVE, component.getShapeType());
handler.closeElement("ShapeCode", attributes, "17", warnings);
Assert.assertEquals(RockSimNoseConeCode.PARABOLIC.asOpenRocket(), component.getType()); //test of default
Assert.assertEquals(RockSimNoseConeCode.PARABOLIC.asOpenRocket(), component.getShapeType()); //test of default
handler.closeElement("ShapeCode", attributes, "foo", warnings);
Assert.assertNotNull(component.getType());
Assert.assertNotNull(component.getShapeType());
Assert.assertEquals(1, warnings.size());
warnings.clear();
@ -174,7 +174,7 @@ public class TransitionHandlerTest extends RockSimTestBase {
Assert.assertEquals(1, warnings.size());
warnings.clear();
component.setType(Transition.Shape.HAACK);
component.setShapeType(Transition.Shape.HAACK);
handler.closeElement("ShapeParameter", attributes, "-1", warnings);
Assert.assertEquals(0d, component.getShapeParameter(), 0.001);
handler.closeElement("ShapeParameter", attributes, "100", warnings);
@ -186,7 +186,7 @@ public class TransitionHandlerTest extends RockSimTestBase {
warnings.clear();
component.setType(Transition.Shape.CONICAL);
component.setShapeType(Transition.Shape.CONICAL);
component.setShapeParameter(0d);
handler.closeElement("ShapeParameter", attributes, "100", warnings);
Assert.assertEquals(0d, component.getShapeParameter(), 0.001);

View File

@ -55,7 +55,7 @@ public class NoseConeComponentTests extends BaseTestCase {
nc.loadPreset(preset);
assertEquals(2.0, nc.getLength(), 0.0);
assertSame(Transition.Shape.CONICAL, nc.getType());
assertSame(Transition.Shape.CONICAL, nc.getShapeType());
assertEquals(1.0, nc.getAftRadius(), 0.0);
assertEquals(0.0, nc.getForeShoulderLength(), 0.0);
assertEquals(0.0, nc.getForeShoulderRadius(), 0.0);

View File

@ -57,7 +57,7 @@ public class TransitionComponentTests extends BaseTestCase {
tr.loadPreset(preset);
assertEquals(2.0, tr.getLength(), 0.0);
assertSame(Transition.Shape.CONICAL, tr.getType());
assertSame(Transition.Shape.CONICAL, tr.getShapeType());
assertEquals(1.0, tr.getAftRadius(), 0.0);
assertEquals(1.0, tr.getForeShoulderLength(), 0.0);
assertEquals(0.25, tr.getForeShoulderRadius(), 0.0);

View File

@ -77,7 +77,7 @@ public class FreeformFinSetTest extends BaseTestCase {
nose.setForeRadius(0.0);
nose.setLength(1.0);
nose.setAftRadius(1.0);
nose.setType( Shape.ELLIPSOID );
nose.setShapeType( Shape.ELLIPSOID );
nose.setShapeParameter(0.5);
nose.setName("Nose Fairing");
stage.addChild(nose);
@ -87,7 +87,7 @@ public class FreeformFinSetTest extends BaseTestCase {
stage.addChild(body);
Transition tail = new Transition();
tail.setType(Shape.CONICAL);
tail.setShapeType(Shape.CONICAL);
tail.setForeRadius(1.0);
tail.setLength(1.0);
tail.setAftRadius(0.5);
@ -327,7 +327,7 @@ public class FreeformFinSetTest extends BaseTestCase {
final FinSet fins = createFinOnEllipsoidNose(nose);
{ // assert preconditions::Mount
assertEquals(Shape.ELLIPSOID, nose.getType());
assertEquals(Shape.ELLIPSOID, nose.getShapeType());
assertEquals(1.0, nose.getLength(), EPSILON);
}{ // Assert fin shape

View File

@ -19,7 +19,7 @@ public class NoseConeTest extends BaseTestCase {
NoseCone noseCone = new NoseCone();
// First set the parameters using the normal transition setters (i.e. using AftRadius and AftShoulder instead of Base and Shoulder)
noseCone.setType(Transition.Shape.OGIVE);
noseCone.setShapeType(Transition.Shape.OGIVE);
noseCone.setLength(0.06);
noseCone.setAftRadius(0.1);
noseCone.setAftShoulderLength(0.01);
@ -27,7 +27,7 @@ public class NoseConeTest extends BaseTestCase {
noseCone.setAftShoulderCapped(false);
noseCone.setAftShoulderThickness(0.001);
assertEquals(Transition.Shape.OGIVE, noseCone.getType());
assertEquals(Transition.Shape.OGIVE, noseCone.getShapeType());
assertEquals(0.06, noseCone.getLength(), EPSILON);
assertEquals(0.1, noseCone.getAftRadius(), EPSILON);
assertEquals(0.1, noseCone.getBaseRadius(), EPSILON);
@ -86,7 +86,7 @@ public class NoseConeTest extends BaseTestCase {
NoseCone noseCone = new NoseCone();
// First set the parameters using the normal transition setters (i.e. using AftRadius and AftShoulder instead of Base and Shoulder)
noseCone.setType(Transition.Shape.OGIVE);
noseCone.setShapeType(Transition.Shape.OGIVE);
noseCone.setLength(0.06);
noseCone.setAftRadius(0.1);
noseCone.setAftShoulderLength(0.01);
@ -95,7 +95,7 @@ public class NoseConeTest extends BaseTestCase {
noseCone.setAftShoulderThickness(0.001);
noseCone.setFlipped(true);
assertEquals(Transition.Shape.OGIVE, noseCone.getType());
assertEquals(Transition.Shape.OGIVE, noseCone.getShapeType());
assertEquals(0.06, noseCone.getLength(), EPSILON);
assertEquals(0.1, noseCone.getForeRadius(), EPSILON);
assertEquals(0.1, noseCone.getBaseRadius(), EPSILON);

View File

@ -19,7 +19,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("nose cone length is wrong ", 0.06, nose.getLength(), EPSILON );
assertEquals("nose cone fore radius is wrong ", 0.00, nose.getForeRadius(), EPSILON );
assertEquals("nose cone aft radius is wrong ", 0.01, nose.getAftRadius(), EPSILON );
assertThat("nose cone shape type is wrong ", Transition.Shape.CONICAL, equalTo(nose.getType()));
assertThat("nose cone shape type is wrong ", Transition.Shape.CONICAL, equalTo(nose.getShapeType()));
assertEquals("nose cone shape parameter is wrong ", 0.0, nose.getShapeParameter(), EPSILON );
assertEquals("bad shape - conical forward ", 0.0, nose.getRadius(0.00), EPSILON );
@ -33,7 +33,7 @@ public class TransitionTest extends BaseTestCase {
@Test
public void testVerifyForwardConicTransition(){
Transition nose = new Transition();
nose.setType( Transition.Shape.CONICAL);
nose.setShapeType( Transition.Shape.CONICAL);
nose.setForeRadius( 0.5);
nose.setAftRadius( 1.0);
nose.setLength( 5.0);
@ -41,7 +41,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("nose cone length is wrong ", 5.0, nose.getLength(), EPSILON );
assertEquals("nose cone fore radius is wrong ", 0.5, nose.getForeRadius(), EPSILON );
assertEquals("nose cone aft radius is wrong ", 1.0, nose.getAftRadius(), EPSILON );
assertThat("nose cone shape type is wrong ", Transition.Shape.CONICAL, equalTo(nose.getType()));
assertThat("nose cone shape type is wrong ", Transition.Shape.CONICAL, equalTo(nose.getShapeType()));
assertEquals("nose cone shape parameter is wrong ", 0.0, nose.getShapeParameter(), EPSILON );
assertEquals("bad shape - conical forward transition", 0.5, nose.getRadius(0.0), EPSILON );
@ -57,7 +57,7 @@ public class TransitionTest extends BaseTestCase {
@Test
public void testVerifyBackwardConicTransition(){
Transition tail = new Transition();
tail.setType( Transition.Shape.CONICAL);
tail.setShapeType( Transition.Shape.CONICAL);
tail.setForeRadius( 1.0);
tail.setAftRadius( 0.5);
tail.setLength( 5.0);
@ -65,7 +65,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("nose cone length is wrong ", 5.0, tail.getLength(), EPSILON );
assertEquals("nose cone fore radius is wrong ", 1.0, tail.getForeRadius(), EPSILON );
assertEquals("nose cone aft radius is wrong ", 0.5, tail.getAftRadius(), EPSILON );
assertThat("nose cone shape type is wrong ", Transition.Shape.CONICAL, equalTo(tail.getType()));
assertThat("nose cone shape type is wrong ", Transition.Shape.CONICAL, equalTo(tail.getShapeType()));
assertEquals("nose cone shape parameter is wrong ", 0.0, tail.getShapeParameter(), EPSILON );
assertEquals("bad shape - conical forward transition", 1.0, tail.getRadius(0.0), EPSILON );
@ -79,7 +79,7 @@ public class TransitionTest extends BaseTestCase {
@Test
public void testVerifyOgiveNoseCone(){
Transition nose = new Transition();
nose.setType( Transition.Shape.OGIVE);
nose.setShapeType( Transition.Shape.OGIVE);
nose.setForeRadius( 0.0);
nose.setAftRadius( 1.0);
nose.setLength( 8.0);
@ -87,7 +87,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("nose cone length is wrong ", 8.0, nose.getLength(), EPSILON );
assertEquals("nose cone fore radius is wrong ", 0.0, nose.getForeRadius(), EPSILON );
assertEquals("nose cone aft radius is wrong ", 1.0, nose.getAftRadius(), EPSILON );
assertThat("nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(nose.getType()));
assertThat("nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(nose.getShapeType()));
assertEquals("nose cone shape parameter is wrong ", 1.0, nose.getShapeParameter(), EPSILON );
assertEquals("bad shape - conical forward transition", 0.0, nose.getRadius(0.0), EPSILON );
@ -104,7 +104,7 @@ public class TransitionTest extends BaseTestCase {
@Test
public void testVerifyForwardOgiveTransition(){
Transition transition = new Transition();
transition.setType( Transition.Shape.OGIVE);
transition.setShapeType( Transition.Shape.OGIVE);
transition.setForeRadius( 0.44135);
transition.setAftRadius( 1.0);
transition.setLength( 6.0);
@ -112,7 +112,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("nose cone length is wrong ", 6.0, transition.getLength(), EPSILON );
assertEquals("nose cone fore radius is wrong ", 0.44135, transition.getForeRadius(), EPSILON );
assertEquals("nose cone aft radius is wrong ", 1.0, transition.getAftRadius(), EPSILON );
assertThat("nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(transition.getType()));
assertThat("nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(transition.getShapeType()));
assertEquals("nose cone shape parameter is wrong ", 1.0, transition.getShapeParameter(), EPSILON );
assertEquals("bad shape - conical forward transition", 0.44135250736, transition.getRadius(0.0), EPSILON );
@ -127,7 +127,7 @@ public class TransitionTest extends BaseTestCase {
@Test
public void testVerifyBackwardOgiveTransition(){
Transition transition = new Transition();
transition.setType( Transition.Shape.OGIVE);
transition.setShapeType( Transition.Shape.OGIVE);
transition.setForeRadius( 1.0);
transition.setAftRadius( 0.44135);
transition.setLength( 6.0);
@ -135,7 +135,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("nose cone length is wrong ", 6.0, transition.getLength(), EPSILON );
assertEquals("nose cone fore radius is wrong ", 1.0, transition.getForeRadius(), EPSILON );
assertEquals("nose cone aft radius is wrong ", 0.44135, transition.getAftRadius(), EPSILON );
assertThat("nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(transition.getType()));
assertThat("nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(transition.getShapeType()));
assertEquals("nose cone shape parameter is wrong ",1.0, transition.getShapeParameter(), EPSILON );
assertEquals("bad shape - conical forward transition", 1.0, transition.getRadius(0.0), EPSILON );
@ -155,7 +155,7 @@ public class TransitionTest extends BaseTestCase {
assertEquals("Alpha3 nose cone length is wrong ", 0.07, nose.getLength(), EPSILON );
assertEquals("Alpha3 nose cone fore radius is wrong ", 0.00, nose.getForeRadius(), EPSILON );
assertEquals("Alpha3 nose cone aft radius is wrong ", 0.012, nose.getAftRadius(), EPSILON );
assertThat("Alpha3 nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(nose.getType()));
assertThat("Alpha3 nose cone shape type is wrong ", Transition.Shape.OGIVE, equalTo(nose.getShapeType()));
assertEquals("Alpha3 nose cone shape parameter is wrong ", 1.0, nose.getShapeParameter(), EPSILON );
assertEquals("Alpha3 nose cone aft shoulder length is wrong ", 0.02, nose.getAftShoulderLength(), EPSILON );

View File

@ -17,7 +17,7 @@ public class TransitionShapeModel extends AbstractListModel<Transition.Shape>
public TransitionShapeModel(RocketComponent component) {
this.component = component;
if (component instanceof Transition) {
previousType = ((Transition) component).getType();
previousType = ((Transition) component).getShapeType();
setSelectedItem(previousType);
component.addComponentChangeListener(this);
}
@ -29,13 +29,13 @@ public class TransitionShapeModel extends AbstractListModel<Transition.Shape>
return;
}
((Transition) component).setType((Transition.Shape) item);
((Transition) component).setShapeType((Transition.Shape) item);
}
@Override
public Object getSelectedItem() {
if (component instanceof Transition) {
return ((Transition) component).getType();
return ((Transition) component).getShapeType();
}
return null;
}
@ -56,8 +56,8 @@ public class TransitionShapeModel extends AbstractListModel<Transition.Shape>
return;
}
if (previousType != ((Transition) component).getType()) {
previousType = ((Transition) component).getType();
if (previousType != ((Transition) component).getShapeType()) {
previousType = ((Transition) component).getShapeType();
fireContentsChanged(this, 0, 0);
}
}

View File

@ -169,7 +169,7 @@ public class NoseConeConfig extends RocketComponentConfig {
JPanel panel2 = new JPanel(new MigLayout("ins 0"));
description = new DescriptionArea(5);
description.setText(PREDESC + ((NoseCone) component).getType().getNoseConeDescription());
description.setText(PREDESC + ((NoseCone) component).getShapeType().getNoseConeDescription());
panel2.add(description, "wmin 250lp, spanx, growx, wrap para");
@ -197,7 +197,7 @@ public class NoseConeConfig extends RocketComponentConfig {
private void updateEnabled() {
boolean e = ((NoseCone) component).getType().usesParameter();
boolean e = ((NoseCone) component).getShapeType().usesParameter();
shapeLabel.setEnabled(e);
shapeSpinner.setEnabled(e);
shapeSlider.setEnabled(e);

View File

@ -185,7 +185,7 @@ public class TransitionConfig extends RocketComponentConfig {
JPanel panel2 = new JPanel(new MigLayout("ins 0"));
description = new DescriptionArea(5);
description.setText(PREDESC + ((Transition) component).getType().
description.setText(PREDESC + ((Transition) component).getShapeType().
getTransitionDescription());
panel2.add(description, "wmin 250lp, spanx, growx, wrap para");
@ -214,7 +214,7 @@ public class TransitionConfig extends RocketComponentConfig {
private void updateEnabled() {
boolean e = ((Transition) component).getType().usesParameter();
boolean e = ((Transition) component).getShapeType().usesParameter();
shapeLabel.setEnabled(e);
shapeSpinner.setEnabled(e);
shapeSlider.setEnabled(e);

View File

@ -29,8 +29,6 @@ import net.sf.openrocket.rocketcomponent.TubeFinSet;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.Transformation;
import static com.jogamp.opengl.GL2ES3.GL_QUADS;
/*
* @author Bill Kuker <bkuker@billkuker.com>
* @author Daniel Williams <equipoise@gmail.com>
@ -149,7 +147,7 @@ public class ComponentRenderer {
if (which == Surface.INSIDE) {
gl.glFrontFace(GL.GL_CCW);
}
TransitionRenderer.drawTransition(gl, t, LOD, t.getType() == Shape.CONICAL ? 4 : LOD / 2, which == Surface.INSIDE ? -t.getThickness() : 0);
TransitionRenderer.drawTransition(gl, t, LOD, t.getShapeType() == Shape.CONICAL ? 4 : LOD / 2, which == Surface.INSIDE ? -t.getThickness() : 0);
if (which == Surface.INSIDE) {
gl.glFrontFace(GL.GL_CW);
}

View File

@ -161,7 +161,7 @@ final class TransitionRenderer {
}
if (r == 0) {
switch (tr.getType()) {
switch (tr.getShapeType()) {
case CONICAL:
case OGIVE:
case PARABOLIC:

View File

@ -181,7 +181,7 @@ public class PartsDetailVisitorStrategy {
grid.addCell(iconToImage(component));
grid.addCell(createNameCell(component.getName(), true, component.getPresetComponent()));
grid.addCell(createMaterialCell(nc.getMaterial()));
grid.addCell(ITextHelper.createCell(nc.getType().getName(), PdfPCell.BOTTOM));
grid.addCell(ITextHelper.createCell(nc.getShapeType().getName(), PdfPCell.BOTTOM));
grid.addCell(createLengthCell(component.getLength()));
grid.addCell(createMassCell(component.getMass()));
List<RocketComponent> rc = component.getChildren();

View File

@ -29,7 +29,7 @@ public class TransitionShapes extends RocketComponentShape {
RocketComponentShape[] mainShapes;
// Simpler shape for conical transition, others use the method from SymmetricComponent
if (transition.getType() == Transition.Shape.CONICAL) {
if (transition.getShapeType() == Transition.Shape.CONICAL) {
final Coordinate frontCenter = instanceAbsoluteLocation;
double length = transition.getLength();