diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java index 3399f262f..2820ce5cb 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java @@ -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)); diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java index 00b6c1467..73b1f0b16 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java @@ -213,7 +213,7 @@ class DocumentConfig { // Transition setters.put("Transition:shape", new EnumSetter( - 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( - Reflection.findMethod(Transition.class, "setType", Transition.Shape.class), + Reflection.findMethod(Transition.class, "setShapeType", Transition.Shape.class), Transition.Shape.class));*/ // ShockCord diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataBranchHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataBranchHandler.java index 88f90516e..44cb2feaa 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataBranchHandler.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataBranchHandler.java @@ -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 diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/TransitionSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/TransitionSaver.java index ca02534d7..b3b2ae8d6 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/TransitionSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/TransitionSaver.java @@ -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.name().toLowerCase(Locale.ENGLISH) + ""); if (shape.isClippable()) { elements.add("" + trans.isClipped() + ""); diff --git a/core/src/net/sf/openrocket/file/rocksim/export/AbstractTransitionDTO.java b/core/src/net/sf/openrocket/file/rocksim/export/AbstractTransitionDTO.java index 4a2748be0..93c41fa2a 100644 --- a/core/src/net/sf/openrocket/file/rocksim/export/AbstractTransitionDTO.java +++ b/core/src/net/sf/openrocket/file/rocksim/export/AbstractTransitionDTO.java @@ -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()); } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java index 5596a254a..c9b5b040d 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java @@ -69,7 +69,7 @@ class NoseConeHandler extends BaseHandler { 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 { //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)); } } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java index 0584089e7..7fe0d81d3 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java @@ -64,7 +64,7 @@ class TransitionHandler extends BaseHandler { 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 { 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)); } } diff --git a/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java b/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java index ccf25dc7d..4880a08c0 100644 --- a/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java +++ b/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java @@ -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"), diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index 83bc3b553..bdb8102ab 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -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); diff --git a/core/src/net/sf/openrocket/rocketcomponent/NoseCone.java b/core/src/net/sf/openrocket/rocketcomponent/NoseCone.java index d35f1928d..5e174bc24 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/NoseCone.java +++ b/core/src/net/sf/openrocket/rocketcomponent/NoseCone.java @@ -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); diff --git a/core/src/net/sf/openrocket/rocketcomponent/Transition.java b/core/src/net/sf/openrocket/rocketcomponent/Transition.java index 76c56b477..5fb9822eb 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Transition.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Transition.java @@ -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()); } diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index c903addbf..6c32cb151 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -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 )); } diff --git a/core/src/net/sf/openrocket/util/TestRockets.java b/core/src/net/sf/openrocket/util/TestRockets.java index 2471997b2..08f52bea4 100644 --- a/core/src/net/sf/openrocket/util/TestRockets.java +++ b/core/src/net/sf/openrocket/util/TestRockets.java @@ -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(); diff --git a/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java b/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java index 9293773bc..b2e581ba2 100644 --- a/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java +++ b/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java @@ -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; diff --git a/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java b/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java index 6c9bf7cf8..b32b5e786 100644 --- a/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java +++ b/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java @@ -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 ); diff --git a/core/test/net/sf/openrocket/file/rocksim/importt/NoseConeHandlerTest.java b/core/test/net/sf/openrocket/file/rocksim/importt/NoseConeHandlerTest.java index 66e052878..0e4a449bd 100644 --- a/core/test/net/sf/openrocket/file/rocksim/importt/NoseConeHandlerTest.java +++ b/core/test/net/sf/openrocket/file/rocksim/importt/NoseConeHandlerTest.java @@ -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); diff --git a/core/test/net/sf/openrocket/file/rocksim/importt/RockSimLoaderTest.java b/core/test/net/sf/openrocket/file/rocksim/importt/RockSimLoaderTest.java index baa8dd212..093a21d02 100644 --- a/core/test/net/sf/openrocket/file/rocksim/importt/RockSimLoaderTest.java +++ b/core/test/net/sf/openrocket/file/rocksim/importt/RockSimLoaderTest.java @@ -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); diff --git a/core/test/net/sf/openrocket/file/rocksim/importt/TransitionHandlerTest.java b/core/test/net/sf/openrocket/file/rocksim/importt/TransitionHandlerTest.java index 83d88658f..4e5c069a7 100644 --- a/core/test/net/sf/openrocket/file/rocksim/importt/TransitionHandlerTest.java +++ b/core/test/net/sf/openrocket/file/rocksim/importt/TransitionHandlerTest.java @@ -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); diff --git a/core/test/net/sf/openrocket/preset/NoseConeComponentTests.java b/core/test/net/sf/openrocket/preset/NoseConeComponentTests.java index 37f7dd4e4..63275c119 100644 --- a/core/test/net/sf/openrocket/preset/NoseConeComponentTests.java +++ b/core/test/net/sf/openrocket/preset/NoseConeComponentTests.java @@ -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); diff --git a/core/test/net/sf/openrocket/preset/TransitionComponentTests.java b/core/test/net/sf/openrocket/preset/TransitionComponentTests.java index 7f2802083..779d960f7 100644 --- a/core/test/net/sf/openrocket/preset/TransitionComponentTests.java +++ b/core/test/net/sf/openrocket/preset/TransitionComponentTests.java @@ -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); diff --git a/core/test/net/sf/openrocket/rocketcomponent/FreeformFinSetTest.java b/core/test/net/sf/openrocket/rocketcomponent/FreeformFinSetTest.java index f048a9282..b695423c7 100644 --- a/core/test/net/sf/openrocket/rocketcomponent/FreeformFinSetTest.java +++ b/core/test/net/sf/openrocket/rocketcomponent/FreeformFinSetTest.java @@ -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 diff --git a/core/test/net/sf/openrocket/rocketcomponent/NoseConeTest.java b/core/test/net/sf/openrocket/rocketcomponent/NoseConeTest.java index e02e8ce3a..f8076445b 100644 --- a/core/test/net/sf/openrocket/rocketcomponent/NoseConeTest.java +++ b/core/test/net/sf/openrocket/rocketcomponent/NoseConeTest.java @@ -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); diff --git a/core/test/net/sf/openrocket/rocketcomponent/TransitionTest.java b/core/test/net/sf/openrocket/rocketcomponent/TransitionTest.java index b9d12905f..540876cfc 100644 --- a/core/test/net/sf/openrocket/rocketcomponent/TransitionTest.java +++ b/core/test/net/sf/openrocket/rocketcomponent/TransitionTest.java @@ -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 ); diff --git a/swing/src/net/sf/openrocket/gui/adaptors/TransitionShapeModel.java b/swing/src/net/sf/openrocket/gui/adaptors/TransitionShapeModel.java index 51b02201e..d485c1896 100644 --- a/swing/src/net/sf/openrocket/gui/adaptors/TransitionShapeModel.java +++ b/swing/src/net/sf/openrocket/gui/adaptors/TransitionShapeModel.java @@ -17,7 +17,7 @@ public class TransitionShapeModel extends AbstractListModel 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 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 return; } - if (previousType != ((Transition) component).getType()) { - previousType = ((Transition) component).getType(); + if (previousType != ((Transition) component).getShapeType()) { + previousType = ((Transition) component).getShapeType(); fireContentsChanged(this, 0, 0); } } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java index 4c6842e77..20039eaa3 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java @@ -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); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java index 0e95dde39..abe6fceab 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java @@ -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); diff --git a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java index 00970de36..5f83776c6 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java @@ -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 * @author Daniel Williams @@ -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); } diff --git a/swing/src/net/sf/openrocket/gui/figure3d/geometry/TransitionRenderer.java b/swing/src/net/sf/openrocket/gui/figure3d/geometry/TransitionRenderer.java index fc154bf14..054ca02f3 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/geometry/TransitionRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/geometry/TransitionRenderer.java @@ -161,7 +161,7 @@ final class TransitionRenderer { } if (r == 0) { - switch (tr.getType()) { + switch (tr.getShapeType()) { case CONICAL: case OGIVE: case PARABOLIC: diff --git a/swing/src/net/sf/openrocket/gui/print/visitor/PartsDetailVisitorStrategy.java b/swing/src/net/sf/openrocket/gui/print/visitor/PartsDetailVisitorStrategy.java index fbc56feb6..60514ebcf 100644 --- a/swing/src/net/sf/openrocket/gui/print/visitor/PartsDetailVisitorStrategy.java +++ b/swing/src/net/sf/openrocket/gui/print/visitor/PartsDetailVisitorStrategy.java @@ -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 rc = component.getChildren(); diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/TransitionShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/TransitionShapes.java index 33699ecdf..5af0f4a55 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/TransitionShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/TransitionShapes.java @@ -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();