diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 75605a86c..b3fe35573 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -899,7 +899,6 @@ StageConfig.tab.Separation.ttip = Stage separation options StageConfig.separation.lbl.title = Select when this stage separates: StageConfig.separation.lbl.plus = plus StageConfig.separation.lbl.seconds = seconds -StageConfig.parallel.autoradius = Enable Automatic Positioning StageConfig.parallel.radius = Radial Distance StageConfig.parallel.angle = Angle StageConfig.parallel.count = Number of Copies @@ -1399,20 +1398,23 @@ Shape.Haackseries.desc2 = The Haack series nose cones are designed to min ! RocketComponent +RocketComponent.Position.Method.Axial.Label = Radius Positioning Method RocketComponent.Position.Method.Axial.ABSOLUTE = Tip of the nose cone RocketComponent.Position.Method.Axial.AFTER = After the sibling component RocketComponent.Position.Method.Axial.BOTTOM = Bottom of the parent component RocketComponent.Position.Method.Axial.MIDDLE = Middle of the parent component RocketComponent.Position.Method.Axial.TOP = Top of the parent component +RocketComponent.Position.Method.Radius.Label = Radius Positioning Method RocketComponent.Position.Method.Radius.FREE = Position relative to the component's center RocketComponent.Position.Method.Radius.SURFACE = Position on the target component surface (without offset) RocketComponent.Position.Method.Radius.RELATIVE = Position relative to the component surface RocketComponent.Position.Method.Radius.COAXIAL = Position on the same axis as the target component +RocketComponent.Position.Method.Angle.Label = Angle Positioning Method RocketComponent.Position.Method.Angle.RELATIVE = Relative to the parent component RocketComponent.Position.Method.Angle.FIXED = Angle is fixed. -RocketComponent.Position.Method.Angle.XY_MIRRORED = Mirror relative to the rocket's x-y plane +RocketComponent.Position.Method.Angle.MIRROR_XY = Mirror relative to the rocket's x-y plane RocketComponent.Direction.X = "X axis" RocketComponent.Direction.Y = "Y axis" diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/AnglePositionSetter.java b/core/src/net/sf/openrocket/file/openrocket/importt/AnglePositionSetter.java index 8f8f8ea0c..06b6d97d2 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/AnglePositionSetter.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/AnglePositionSetter.java @@ -2,7 +2,6 @@ package net.sf.openrocket.file.openrocket.importt; import java.util.HashMap; -import net.sf.openrocket.aerodynamics.Warning; import net.sf.openrocket.aerodynamics.WarningSet; import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.position.AngleMethod; @@ -14,26 +13,25 @@ class AnglePositionSetter implements Setter { public void set(RocketComponent c, String value, HashMap attributes, WarningSet warnings) { - AngleMethod type = (AngleMethod) DocumentConfig.findEnum(attributes.get("method"), AngleMethod.class); - if (type == null) { - warnings.add(Warning.FILE_INVALID_PARAMETER); - return; + AngleMethod method = (AngleMethod) DocumentConfig.findEnum(attributes.get("method"), AngleMethod.class); + if (null==method) { + method=AngleMethod.RELATIVE; } double pos; try { - pos = Double.parseDouble(value); + pos = Double.parseDouble(value) * Math.PI / 180.0 ; } catch (NumberFormatException e) { - warnings.add(Warning.FILE_INVALID_PARAMETER); + warnings.add(String.format("Warning: invalid value radius position. value=%s class: %s", value, c.getClass().getCanonicalName() )); return; } if ( AnglePositionable.class.isAssignableFrom( c.getClass() ) ) { AnglePositionable apc = (AnglePositionable)c; - apc.setAngleMethod(type); + apc.setAngleMethod(method); apc.setAngleOffset(pos); } else { - warnings.add(Warning.FILE_INVALID_PARAMETER); + warnings.add(String.format("Warning: %s is not valid for class: %s", this.getClass().getCanonicalName(), c.getClass().getCanonicalName())); } } diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/AxialPositionSetter.java b/core/src/net/sf/openrocket/file/openrocket/importt/AxialPositionSetter.java index e349bd616..2fe5084a9 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/AxialPositionSetter.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/AxialPositionSetter.java @@ -15,9 +15,8 @@ class AxialPositionSetter implements Setter { // first check preferred attribute name: AxialMethod type = (AxialMethod) DocumentConfig.findEnum(attributes.get("method"), AxialMethod.class); - // fall-back to old name - if (type == null) { + if (null == type) { type = (AxialMethod) DocumentConfig.findEnum(attributes.get("type"), AxialMethod.class); } @@ -30,7 +29,7 @@ class AxialPositionSetter implements Setter { try { pos = Double.parseDouble(value); } catch (NumberFormatException e) { - warnings.add(Warning.FILE_INVALID_PARAMETER); + warnings.add(String.format("Warning: invalid value radius position. value=%s class: %s", value, c.getClass().getCanonicalName() )); return; } @@ -39,7 +38,7 @@ class AxialPositionSetter implements Setter { apc.setAxialMethod(type); apc.setAxialOffset(pos); } else { - warnings.add(Warning.FILE_INVALID_PARAMETER); + warnings.add(String.format("Warning: %s is not valid for class: %s", this.getClass().getCanonicalName(), c.getClass().getCanonicalName())); } } 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 e0eb40715..3dd43b81b 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java @@ -119,7 +119,7 @@ class DocumentConfig { Reflection.findMethod(RocketComponent.class, "setLineStyle", LineStyle.class), LineStyle.class)); setters.put("RocketComponent:position", new AxialPositionSetter() ); - setters.put("RocketComponent:axialposition", new AxialPositionSetter() ); + setters.put("RocketComponent:axialoffset", new AxialPositionSetter() ); setters.put("RocketComponent:overridemass", new OverrideSetter( Reflection.findMethod(RocketComponent.class, "setOverrideMass", double.class), Reflection.findMethod(RocketComponent.class, "setMassOverridden", boolean.class))); @@ -158,8 +158,8 @@ class DocumentConfig { // Parallel Stage setters.put("ParallelStage:instancecount", new IntSetter( Reflection.findMethod(ParallelStage.class, "setInstanceCount",int.class))); - setters.put("ParallelStage:angleposition", new AnglePositionSetter()); - setters.put("ParallelStage:radiusposition", new RadiusPositionSetter()); + setters.put("ParallelStage:angleoffset", new AnglePositionSetter()); + setters.put("ParallelStage:radiusoffset", new RadiusPositionSetter()); // SymmetricComponent setters.put("SymmetricComponent:thickness", new DoubleSetter( @@ -174,6 +174,7 @@ class DocumentConfig { Reflection.findMethod( LaunchLug.class, "setInstanceSeparation", double.class))); setters.put("LaunchLug:radialdirection", new DoubleSetter( Reflection.findMethod( LaunchLug.class, "setAngleOffset", double.class), Math.PI / 180.0)); + setters.put("LaunchLug:angleoffset", new AnglePositionSetter() ); setters.put("LaunchLug:radius", new DoubleSetter( Reflection.findMethod(LaunchLug.class, "setOuterRadius", double.class))); setters.put("LaunchLug:length", new DoubleSetter( @@ -186,7 +187,7 @@ class DocumentConfig { Reflection.findMethod( RailButton.class, "setInstanceCount",int.class))); setters.put("RailButton:instanceseparation", new DoubleSetter( Reflection.findMethod( RailButton.class, "setInstanceSeparation", double.class))); - setters.put("RailButton:angularoffset", new AnglePositionSetter() ); + setters.put("RailButton:angleoffset", new AnglePositionSetter() ); setters.put("RailButton:height", new DoubleSetter( Reflection.findMethod( RailButton.class, "setTotalHeight", double.class))); setters.put("RailButton:outerdiameter", new DoubleSetter( @@ -242,8 +243,8 @@ class DocumentConfig { Reflection.findMethod(FinSet.class, "setInstanceCount", int.class))); setters.put("FinSet:rotation", new DoubleSetter( Reflection.findMethod(FinSet.class, "setBaseRotation", double.class), Math.PI / 180.0)); - setters.put("FinSet:angularoffset", new AnglePositionSetter() ); - setters.put("FinSet:radialoffset", new RadiusPositionSetter() ); + setters.put("FinSet:angleoffset", new AnglePositionSetter() ); + setters.put("FinSet:radiusoffset", new RadiusPositionSetter() ); setters.put("FinSet:thickness", new DoubleSetter( Reflection.findMethod(FinSet.class, "setThickness", double.class))); setters.put("FinSet:crosssection", new EnumSetter( diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/RadiusPositionSetter.java b/core/src/net/sf/openrocket/file/openrocket/importt/RadiusPositionSetter.java index ea66e9584..bd4f36404 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/RadiusPositionSetter.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/RadiusPositionSetter.java @@ -2,7 +2,6 @@ package net.sf.openrocket.file.openrocket.importt; import java.util.HashMap; -import net.sf.openrocket.aerodynamics.Warning; import net.sf.openrocket.aerodynamics.WarningSet; import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.position.RadiusMethod; @@ -14,10 +13,9 @@ class RadiusPositionSetter implements Setter { public void set(RocketComponent c, String value, HashMap attributes, WarningSet warnings) { - RadiusMethod method = (RadiusMethod) DocumentConfig.findEnum(attributes.get("type"), RadiusMethod.class); + RadiusMethod method = (RadiusMethod) DocumentConfig.findEnum(attributes.get("method"), RadiusMethod.class); if (method == null) { - warnings.add(Warning.FILE_INVALID_PARAMETER); - return; + method = RadiusMethod.SURFACE; } @@ -25,7 +23,7 @@ class RadiusPositionSetter implements Setter { try { offset = Double.parseDouble(value); } catch (NumberFormatException e) { - warnings.add(Warning.FILE_INVALID_PARAMETER); + warnings.add(String.format("Warning: invalid value radius position. value=%s class: %s", value, c.getClass().getCanonicalName() )); return; } @@ -34,7 +32,7 @@ class RadiusPositionSetter implements Setter { rp.setRadiusMethod(method); rp.setRadiusOffset(offset); } else { - warnings.add(Warning.FILE_INVALID_PARAMETER); + warnings.add("Warning: radiusPositionable is not valid for this class: "+c.getClass().getCanonicalName()); } } diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/RailButtonSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/RailButtonSaver.java index e026551f7..74a9c0638 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/RailButtonSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/RailButtonSaver.java @@ -27,7 +27,7 @@ public class RailButtonSaver extends ExternalComponentSaver { emitDouble( elements, "outerdiameter", rb.getOuterDiameter()); emitDouble( elements, "height", rb.getTotalHeight()); - emitDouble( elements, "angularoffset", rb.getAngularOffset()*180.0/Math.PI); + } diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/RocketComponentSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/RocketComponentSaver.java index 8e9507508..32d8539b0 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/RocketComponentSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/RocketComponentSaver.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; +import java.util.Map; import net.sf.openrocket.appearance.Appearance; import net.sf.openrocket.appearance.Decal; @@ -20,11 +21,11 @@ import net.sf.openrocket.rocketcomponent.FlightConfigurationId; import net.sf.openrocket.rocketcomponent.Instanceable; import net.sf.openrocket.rocketcomponent.LineInstanceable; import net.sf.openrocket.rocketcomponent.MotorMount; -import net.sf.openrocket.rocketcomponent.RingInstanceable; import net.sf.openrocket.rocketcomponent.Rocket; import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.rocketcomponent.position.AnglePositionable; import net.sf.openrocket.rocketcomponent.position.AxialMethod; -import net.sf.openrocket.rocketcomponent.position.RadiusMethod; +import net.sf.openrocket.rocketcomponent.position.RadiusPositionable; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.Color; @@ -86,37 +87,41 @@ public class RocketComponentSaver { if ( c instanceof Instanceable) { int instanceCount = c.getInstanceCount(); + if( c instanceof Clusterable ){ ; // no-op. Instance counts are set via named cluster configurations + }else if( 1 < instanceCount ) { + emitInteger( elements, "instancecount", c.getInstanceCount() ); } + if( c instanceof LineInstanceable ){ LineInstanceable line = (LineInstanceable)c; - emitInteger( elements, "instancecount", instanceCount ); emitDouble( elements, "instanceseparation", line.getInstanceSeparation()); } - if( c instanceof RingInstanceable){ - RingInstanceable ring = (RingInstanceable)c; - emitInteger( elements, "instancecount", instanceCount ); - // WARNING!! THIS IS WRONG! - // TODO: Re-Implement - if( RadiusMethod.SURFACE == ring.getRadiusMethod() ) { - emitString(elements, "radialoffset", "auto"); - }else{ - emitDouble( elements, "radialoffset", ring.getRadiusOffset() ); - } - emitDouble( elements, "angularoffset", ring.getAngleOffset()*180.0/Math.PI); + if( c instanceof RadiusPositionable ){ + final RadiusPositionable radPos = (RadiusPositionable)c; + // The type names are currently equivalent to the enum names except for case. + final String radiusMethod = radPos.getRadiusMethod().name().toLowerCase(Locale.ENGLISH); + final double radiusOffset = radPos.getRadiusOffset(); + elements.add("" + radiusOffset + ""); + } + if( c instanceof AnglePositionable ) { + final AnglePositionable anglePos= (AnglePositionable)c; + // The type names are currently equivalent to the enum names except for case. + final String angleMethod = anglePos.getAngleMethod().name().toLowerCase(Locale.ENGLISH); + final double angleOffset = anglePos.getAngleOffset()*180.0/Math.PI ; + elements.add("" + angleOffset + ""); + } } - // Save position unless "AFTER" if (c.getAxialMethod() != AxialMethod.AFTER) { // The type names are currently equivalent to the enum names except for case. - String type = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH); - elements.add("" + c.getAxialOffset() + ""); + String axialMethod = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH); + elements.add("" + c.getAxialOffset() + ""); } - // Overrides boolean overridden = false; if (c.isMassOverridden()) { @@ -252,17 +257,31 @@ public class RocketComponentSaver { } protected static void emitDouble( final List elements, final String enclosingTag, final double value){ - emitString( elements, enclosingTag, Double.toString( value )); + appendElement( elements, enclosingTag, enclosingTag, Double.toString( value )); } protected static void emitInteger( final List elements, final String enclosingTag, final int value){ - elements.add("<"+enclosingTag+">" + Integer.toString( value ) + ""); + appendElement( elements, enclosingTag, enclosingTag, Integer.toString( value ) ); } protected static void emitString( final List elements, final String enclosingTag, final String value){ - elements.add("<"+enclosingTag+">" + value + ""); + appendElement( elements, enclosingTag, enclosingTag, value ); } + protected static String generateOpenTag( final Map attrs, final String enclosingTag ){ + StringBuffer buf = new StringBuffer(); + if( null == attrs ) { + return enclosingTag; + } + + for (Map.Entry entry : attrs.entrySet()) { + buf.append(String.format(" %s=\"%s\"", entry.getKey(), entry.getValue() )); + } + return buf.toString(); + } + protected static void appendElement( final List elements, final String openTag, final String closeTag, final String elementValue ){ + elements.add("<"+openTag+">" + elementValue + ""); + } } diff --git a/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java b/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java index 8fad9a573..ca2446b83 100644 --- a/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java +++ b/core/src/net/sf/openrocket/optimization/services/DefaultSimulationModifierService.java @@ -215,7 +215,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi trans.get("optimization.modifier.internalcomponent.position"), trans.get("optimization.modifier.internalcomponent.position.desc"), c, UnitGroup.UNITS_LENGTH, - 1.0, c.getClass(), c.getID(), "RelativePosition"); + 1.0, c.getClass(), c.getID(), "AxialMethod"); mod.setMinValue(0); mod.setMaxValue(parent.getLength()); modifiers.add(mod); @@ -229,7 +229,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi trans.get("optimization.modifier.finset.position"), trans.get("optimization.modifier.finset.position.desc"), c, UnitGroup.UNITS_LENGTH, - 1.0, c.getClass(), c.getID(), "RelativePosition"); + 1.0, c.getClass(), c.getID(), "AxialMethod"); mod.setMinValue(0); mod.setMaxValue(parent.getLength()); modifiers.add(mod); @@ -243,7 +243,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi trans.get("optimization.modifier.launchlug.position"), trans.get("optimization.modifier.launchlug.position.desc"), c, UnitGroup.UNITS_LENGTH, - 1.0, c.getClass(), c.getID(), "RelativePosition"); + 1.0, c.getClass(), c.getID(), "AxialMethod"); mod.setMinValue(0); mod.setMaxValue(parent.getLength()); modifiers.add(mod); @@ -252,8 +252,6 @@ public class DefaultSimulationModifierService implements SimulationModifierServi // Recovery device deployment altitude and delay if (c instanceof RecoveryDevice) { - RecoveryDevice device = (RecoveryDevice) c; - SimulationModifier mod = new FlightConfigurationModifier( trans.get("optimization.modifier.recoverydevice.deployDelay"), trans.get("optimization.modifier.recoverydevice.deployDelay.desc"), diff --git a/core/src/net/sf/openrocket/rocketcomponent/EngineBlock.java b/core/src/net/sf/openrocket/rocketcomponent/EngineBlock.java index 660bbba15..748b548ac 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/EngineBlock.java +++ b/core/src/net/sf/openrocket/rocketcomponent/EngineBlock.java @@ -3,10 +3,11 @@ package net.sf.openrocket.rocketcomponent; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset.Type; +import net.sf.openrocket.rocketcomponent.position.AxialPositionable; import net.sf.openrocket.startup.Application; -public class EngineBlock extends ThicknessRingComponent { +public class EngineBlock extends ThicknessRingComponent implements AxialPositionable { private static final Translator trans = Application.getTranslator(); diff --git a/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java b/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java index 58cbeaf4b..3af29e6ff 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java +++ b/core/src/net/sf/openrocket/rocketcomponent/InnerTube.java @@ -12,6 +12,7 @@ import net.sf.openrocket.motor.Motor; import net.sf.openrocket.motor.MotorConfiguration; import net.sf.openrocket.motor.MotorConfigurationSet; import net.sf.openrocket.preset.ComponentPreset; +import net.sf.openrocket.rocketcomponent.position.AxialPositionable; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.Coordinate; @@ -24,7 +25,7 @@ import net.sf.openrocket.util.MathUtil; * * @author Sampo Niskanen */ -public class InnerTube extends ThicknessRingComponent implements Clusterable, RadialParent, MotorMount { +public class InnerTube extends ThicknessRingComponent implements AxialPositionable, Clusterable, RadialParent, MotorMount { private static final Translator trans = Application.getTranslator(); private static final Logger log = LoggerFactory.getLogger(InnerTube.class); diff --git a/core/src/net/sf/openrocket/rocketcomponent/InternalComponent.java b/core/src/net/sf/openrocket/rocketcomponent/InternalComponent.java index bda852a0e..f108eddf2 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/InternalComponent.java +++ b/core/src/net/sf/openrocket/rocketcomponent/InternalComponent.java @@ -1,6 +1,7 @@ package net.sf.openrocket.rocketcomponent; import net.sf.openrocket.rocketcomponent.position.AxialMethod; +import net.sf.openrocket.rocketcomponent.position.AxialPositionable; /** * A component internal to the rocket. Internal components have no effect on the @@ -11,7 +12,7 @@ import net.sf.openrocket.rocketcomponent.position.AxialMethod; * * @author Sampo Niskanen */ -public abstract class InternalComponent extends RocketComponent { +public abstract class InternalComponent extends RocketComponent implements AxialPositionable { public InternalComponent() { super( AxialMethod.BOTTOM); diff --git a/core/src/net/sf/openrocket/rocketcomponent/LaunchLug.java b/core/src/net/sf/openrocket/rocketcomponent/LaunchLug.java index 7e2e2143f..5ca8a2f97 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/LaunchLug.java +++ b/core/src/net/sf/openrocket/rocketcomponent/LaunchLug.java @@ -13,7 +13,7 @@ import net.sf.openrocket.util.MathUtil; -public class LaunchLug extends ExternalComponent implements Coaxial, LineInstanceable, AnglePositionable { +public class LaunchLug extends ExternalComponent implements AnglePositionable, Coaxial, LineInstanceable { private static final Translator trans = Application.getTranslator(); diff --git a/core/src/net/sf/openrocket/rocketcomponent/LineInstanceable.java b/core/src/net/sf/openrocket/rocketcomponent/LineInstanceable.java index a9c2131bc..30b0385db 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/LineInstanceable.java +++ b/core/src/net/sf/openrocket/rocketcomponent/LineInstanceable.java @@ -1,6 +1,8 @@ package net.sf.openrocket.rocketcomponent; -public interface LineInstanceable extends Instanceable { +import net.sf.openrocket.rocketcomponent.position.AxialPositionable; + +public interface LineInstanceable extends AxialPositionable, Instanceable { public double getInstanceSeparation(); diff --git a/core/src/net/sf/openrocket/rocketcomponent/RailButton.java b/core/src/net/sf/openrocket/rocketcomponent/RailButton.java index b096362f2..df6ea275a 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/RailButton.java +++ b/core/src/net/sf/openrocket/rocketcomponent/RailButton.java @@ -6,7 +6,10 @@ import java.util.Collection; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset.Type; +import net.sf.openrocket.rocketcomponent.position.AngleMethod; +import net.sf.openrocket.rocketcomponent.position.AnglePositionable; import net.sf.openrocket.rocketcomponent.position.AxialMethod; +import net.sf.openrocket.rocketcomponent.position.AxialPositionable; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.Coordinate; @@ -17,7 +20,7 @@ import net.sf.openrocket.util.MathUtil; * @author widget (Daniel Williams) * */ -public class RailButton extends ExternalComponent implements LineInstanceable { +public class RailButton extends ExternalComponent implements AnglePositionable, AxialPositionable, LineInstanceable { private static final Translator trans = Application.getTranslator(); @@ -47,17 +50,18 @@ public class RailButton extends ExternalComponent implements LineInstanceable { protected double standoff_m; protected final static double MINIMUM_STANDOFF= 0.001; - + private double radialDistance_m=0; + protected static final AngleMethod angleMethod = AngleMethod.RELATIVE; private double angle_rad = 0; private int instanceCount = 1; private double instanceSeparation = 0; // front-front along the positive rocket axis. i.e. [1,0,0]; public RailButton(){ super(AxialMethod.MIDDLE); - this.outerDiameter_m = 0; - this.totalHeight_m = 0; - this.innerDiameter_m = 0; + this.outerDiameter_m = 1.0; + this.totalHeight_m = 1.0; + this.innerDiameter_m = 0.8; this.flangeHeight_m = 0.002; this.setStandoff( 0.002); this.setInstanceSeparation( 1.0); @@ -177,11 +181,24 @@ public class RailButton extends ExternalComponent implements LineInstanceable { return false; } - public double getAngularOffset(){ + @Override + public double getAngleOffset(){ return angle_rad; } - public void setAngularOffset(final double angle_rad){ + @Override + public AngleMethod getAngleMethod() { + return RailButton.angleMethod; + } + + @Override + public void setAngleMethod(AngleMethod newMethod) { + // no-op + } + + + @Override + public void setAngleOffset(final double angle_rad){ double clamped_rad = MathUtil.clamp(angle_rad, -Math.PI, Math.PI); if (MathUtil.equals(this.angle_rad, clamped_rad)) @@ -334,5 +351,5 @@ public class RailButton extends ExternalComponent implements LineInstanceable { // Allow nothing to be attached to a LaunchButton return false; } - + } diff --git a/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java b/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java index a5027a09a..57874f89b 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java +++ b/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java @@ -1,7 +1,5 @@ package net.sf.openrocket.rocketcomponent; -import static org.junit.Assert.assertEquals; - import java.util.ArrayDeque; import java.util.Collection; import java.util.Deque; diff --git a/core/src/net/sf/openrocket/rocketcomponent/position/AngleMethod.java b/core/src/net/sf/openrocket/rocketcomponent/position/AngleMethod.java index f0316235e..ace87b62d 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/position/AngleMethod.java +++ b/core/src/net/sf/openrocket/rocketcomponent/position/AngleMethod.java @@ -29,7 +29,7 @@ public enum AngleMethod implements DistanceMethod { // Mirror Instances // - Intended for 2x-instance components... // - Undefined behavior for components with 3 or more instances - MIRRORED_XY (Application.getTranslator().get("RocketComponent.Position.Method.Angle.MIRROR_XY") ){ + MIRROR_XY (Application.getTranslator().get("RocketComponent.Position.Method.Angle.MIRROR_XY") ){ @Override public boolean clampToZero() { return false; } @@ -44,6 +44,10 @@ public enum AngleMethod implements DistanceMethod { return combinedAngle; } }; + + public static final AngleMethod[] choices(){ + return new AngleMethod[]{ AngleMethod.RELATIVE, AngleMethod.FIXED }; + } public final String name; diff --git a/core/src/net/sf/openrocket/rocketcomponent/position/RadiusMethod.java b/core/src/net/sf/openrocket/rocketcomponent/position/RadiusMethod.java index 69cd1011e..0201fec67 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/position/RadiusMethod.java +++ b/core/src/net/sf/openrocket/rocketcomponent/position/RadiusMethod.java @@ -9,7 +9,7 @@ public enum RadiusMethod implements DistanceMethod { // just as a reminder: // public T[] getEnumConstants() - + // both components are on the same axis COAXIAL ( Application.getTranslator().get("RocketComponent.Position.Method.Radius.COAXIAL") ){ @Override @@ -53,6 +53,10 @@ public enum RadiusMethod implements DistanceMethod { return 0.; // fail-safe path } }; + + public static final RadiusMethod[] choices(){ + return new RadiusMethod[]{ RadiusMethod.FREE, RadiusMethod.RELATIVE, RadiusMethod.SURFACE }; + } public final String name; diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ComponentAssemblyConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ComponentAssemblyConfig.java index e6f24b8d9..e310cf2b7 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ComponentAssemblyConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ComponentAssemblyConfig.java @@ -1,7 +1,6 @@ package net.sf.openrocket.gui.configdialog; import javax.swing.ComboBoxModel; -import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; @@ -10,7 +9,6 @@ import javax.swing.JSpinner; import net.miginfocom.swing.MigLayout; import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.gui.SpinnerEditor; -import net.sf.openrocket.gui.adaptors.BooleanModel; import net.sf.openrocket.gui.adaptors.DoubleModel; import net.sf.openrocket.gui.adaptors.EnumModel; import net.sf.openrocket.gui.adaptors.IntegerModel; @@ -20,13 +18,15 @@ import net.sf.openrocket.rocketcomponent.ComponentAssembly; import net.sf.openrocket.rocketcomponent.ParallelStage; import net.sf.openrocket.rocketcomponent.PodSet; import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.rocketcomponent.position.AngleMethod; import net.sf.openrocket.rocketcomponent.position.AxialMethod; +import net.sf.openrocket.rocketcomponent.position.RadiusMethod; import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; +@SuppressWarnings("serial") public class ComponentAssemblyConfig extends RocketComponentConfig { - private static final long serialVersionUID = -5153592258788614257L; private static final Translator trans = Application.getTranslator(); public ComponentAssemblyConfig(OpenRocketDocument document, RocketComponent component) { @@ -43,29 +43,37 @@ public class ComponentAssemblyConfig extends RocketComponentConfig { private JPanel parallelTab( final ComponentAssembly boosters ){ JPanel motherPanel = new JPanel( new MigLayout("fill")); - // auto radial distance - BooleanModel autoRadOffsModel = new BooleanModel( boosters, "AutoRadialOffset"); - JCheckBox autoRadCheckBox = new JCheckBox( autoRadOffsModel ); - autoRadCheckBox.setText( trans.get("StageConfig.parallel.autoradius")); - motherPanel.add( autoRadCheckBox, "align left, wrap"); + // radial distance method + JLabel radiusMethodLabel = new JLabel(trans.get("RocketComponent.Position.Method.Radius.Label")); + motherPanel.add( radiusMethodLabel, "align left"); + final EnumModel radiusMethodModel = new EnumModel( boosters, "RadiusMethod", RadiusMethod.choices()); + final JComboBox radiusMethodCombo = new JComboBox( radiusMethodModel ); + motherPanel.add( radiusMethodCombo, "align left, wrap"); + // set radial distance JLabel radiusLabel = new JLabel(trans.get("StageConfig.parallel.radius")); motherPanel.add( radiusLabel , "align left"); - autoRadOffsModel.addEnableComponent(radiusLabel, false); - DoubleModel radiusModel = new DoubleModel( boosters, "RadialOffset", UnitGroup.UNITS_LENGTH, 0); + //radiusMethodModel.addEnableComponent(radiusLabel, false); + DoubleModel radiusModel = new DoubleModel( boosters, "RadiusOffset", UnitGroup.UNITS_LENGTH, 0); JSpinner radiusSpinner = new JSpinner( radiusModel.getSpinnerModel()); radiusSpinner.setEditor(new SpinnerEditor(radiusSpinner )); motherPanel.add(radiusSpinner , "growx 1, align right"); - autoRadOffsModel.addEnableComponent(radiusSpinner, false); +// autoRadOffsModel.addEnableComponent(radiusSpinner, false); UnitSelector radiusUnitSelector = new UnitSelector(radiusModel); motherPanel.add(radiusUnitSelector, "growx 1, wrap"); - autoRadOffsModel.addEnableComponent(radiusUnitSelector, false); +// autoRadOffsModel.addEnableComponent(radiusUnitSelector, false); // set location angle around the primary stage + JLabel angleMethodLabel = new JLabel(trans.get("RocketComponent.Position.Method.Angle.Label")); + motherPanel.add( angleMethodLabel, "align left"); + EnumModel angleMethodModel = new EnumModel( boosters, "AngleMethod", AngleMethod.choices() ); + final JComboBox angleMethodCombo = new JComboBox( angleMethodModel ); + motherPanel.add( angleMethodCombo, "align left, wrap"); + JLabel angleLabel = new JLabel(trans.get("StageConfig.parallel.angle")); motherPanel.add( angleLabel, "align left"); - DoubleModel angleModel = new DoubleModel( boosters, "AngularOffset", 1.0, UnitGroup.UNITS_ANGLE, 0.0, Math.PI*2); + DoubleModel angleModel = new DoubleModel( boosters, "AngleOffset", 1.0, UnitGroup.UNITS_ANGLE, 0.0, Math.PI*2); JSpinner angleSpinner = new JSpinner(angleModel.getSpinnerModel()); angleSpinner.setEditor(new SpinnerEditor(angleSpinner)); @@ -86,7 +94,7 @@ public class ComponentAssemblyConfig extends RocketComponentConfig { JLabel positionLabel = new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")); motherPanel.add( positionLabel); - ComboBoxModel axialPositionMethodModel = new EnumModel(component, "RelativePositionMethod", AxialMethod.axialOffsetMethods ); + ComboBoxModel axialPositionMethodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); JComboBox positionMethodCombo = new JComboBox( axialPositionMethodModel ); motherPanel.add(positionMethodCombo, "spanx 2, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java index f2ba85364..e37ffa058 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java @@ -111,7 +111,7 @@ public class EllipticalFinSetConfig extends FinSetConfig { //// Position relative to: panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Positionrelativeto"))); - JComboBox positionCombo= new JComboBox( new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods )); + JComboBox positionCombo= new JComboBox( new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods )); panel.add(positionCombo, "spanx, growx, wrap"); //// plus diff --git a/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java index 4bd487073..96b01d893 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java @@ -43,6 +43,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@SuppressWarnings("serial") public abstract class FinSetConfig extends RocketComponentConfig { private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class); private static final Translator trans = Application.getTranslator(); @@ -178,10 +179,9 @@ public abstract class FinSetConfig extends RocketComponentConfig { "w 100lp, growx 5, wrap"); - //// Tab length //// Tab height: label = new JLabel(trans.get("FinSetConfig.lbl.Tabheight")); - //// The spanwise height of the fin tab. + //// The span-wise height of the fin tab. label.setToolTipText(trans.get("FinSetConfig.ttip.Tabheight")); panel.add(label, "gapleft para"); @@ -210,16 +210,15 @@ public abstract class FinSetConfig extends RocketComponentConfig { panel.add(new UnitSelector(mts), "growx"); panel.add(new BasicSlider(mts.getSliderModel(length_2, length2)), "w 100lp, growx 5, wrap"); - //// relative to label = new JLabel(trans.get("FinSetConfig.lbl.relativeto")); panel.add(label, "right, gapright unrel"); - final EnumModel em = - new EnumModel(component, "TabRelativePosition"); + final EnumModel em = new EnumModel(component, "TabRelativePosition"); - panel.add(new JComboBox(em), "spanx 3, growx, wrap para"); + JComboBox enumCombo = new JComboBox(em); + panel.add( enumCombo, "spanx 3, growx, wrap para"); // Calculate fin tab height, length, and position autoCalc = new JButton(trans.get("FinSetConfig.but.AutoCalc")); @@ -507,7 +506,7 @@ public abstract class FinSetConfig extends RocketComponentConfig { label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects")); filletPanel.add(label, "spanx 4, wrap rel"); - JComboBox combo = new JComboBox(new MaterialModel(filletPanel, component, Material.Type.BULK, "FilletMaterial")); + JComboBox combo = new JComboBox<>(new MaterialModel(filletPanel, component, Material.Type.BULK, "FilletMaterial")); //// The component material affects the weight of the component. combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects")); filletPanel.add(combo, "spanx 4, growx, wrap paragraph"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java index ac3096a2f..92dfeafa5 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java @@ -146,7 +146,7 @@ public class FreeformFinSetConfig extends FinSetConfig { //// Position relative to: panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.Posrelativeto"))); - JComboBox positionCombo = new JComboBox( new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods )); + JComboBox positionCombo = new JComboBox( new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods )); panel.add(positionCombo, "spanx 3, growx, wrap"); //// plus panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.plus")), "right"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java index 0fb83eefc..69a5d2bc5 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java @@ -140,7 +140,7 @@ public class InnerTubeConfig extends RocketComponentConfig { //// Position relative to: panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto"))); - JComboBox combo = new JComboBox( new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods )); + JComboBox combo = new JComboBox( new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods )); panel.add(combo, "spanx 3, growx, wrap"); //// plus diff --git a/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java index e9d2bf548..7083121a4 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java @@ -111,7 +111,7 @@ public class LaunchLugConfig extends RocketComponentConfig { //// Position relative to: panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto"))); - EnumModel positionModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + EnumModel positionModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); JComboBox positionCombo = new JComboBox( positionModel ); panel.add( positionCombo, "spanx, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java index e715c72cd..49e869b40 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java @@ -110,7 +110,7 @@ public class MassComponentConfig extends RocketComponentConfig { //// Position relative to: panel.add(new JLabel(trans.get("MassComponentCfg.lbl.PosRelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); final JComboBox methodCombo = new JComboBox( methodModel ); panel.add(methodCombo, "spanx, growx, wrap"); //// plus diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java index bdd9108d1..b53b0a6c8 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java @@ -139,7 +139,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig { //// Position relative to: panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Posrelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); JComboBox positionCombo = new JComboBox( methodModel ); panel.add( positionCombo, "spanx, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java index 120b69f50..7db26103c 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java @@ -67,7 +67,7 @@ public class RailButtonConfig extends RocketComponentConfig { { //// Angular Position: panel.add(new JLabel(trans.get("RailBtnCfg.lbl.Angle"))); - DoubleModel angleModel = new DoubleModel(component, "AngularOffset", UnitGroup.UNITS_ANGLE, -180, +180); + DoubleModel angleModel = new DoubleModel(component, "AngleOffset", UnitGroup.UNITS_ANGLE, -180, +180); JSpinner angleSpinner = new JSpinner( angleModel.getSpinnerModel()); angleSpinner.setEditor(new SpinnerEditor(angleSpinner)); panel.add(angleSpinner, "growx"); @@ -78,7 +78,7 @@ public class RailButtonConfig extends RocketComponentConfig { { //// Position relative to: panel.add(new JLabel(trans.get("RailBtnCfg.lbl.PosRelativeTo"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); JComboBox relToCombo = new JComboBox( methodModel ); panel.add( relToCombo, "growx, wrap rel"); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java index 8d9fa4f10..0c838a237 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java @@ -127,7 +127,7 @@ public class RingComponentConfig extends RocketComponentConfig { //// Position relative to: panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); final JComboBox positionCombo = new JComboBox( methodModel ); panel.add( positionCombo, "spanx 3, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java index e61523c9e..113381cdc 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java @@ -64,7 +64,7 @@ public class ShockCordConfig extends RocketComponentConfig { //// Position relative to: panel2.add(new JLabel(trans.get("ShockCordCfg.lbl.Posrelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); final JComboBox combo = new JComboBox( methodModel ); panel2.add(combo, "spanx, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java index 265817c11..c5ffcdec6 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java @@ -140,7 +140,7 @@ public class StreamerConfig extends RecoveryDeviceConfig { //// Position relative to: panel.add(new JLabel(trans.get("StreamerCfg.lbl.Posrelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); final JComboBox positionCombo = new JComboBox( methodModel ); panel.add( positionCombo, "spanx, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java index 6b31acf8e..ce5876110 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java @@ -168,7 +168,7 @@ public class TrapezoidFinSetConfig extends FinSetConfig { //// Position relative to: panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.Posrelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); final JComboBox positionCombo = new JComboBox( methodModel ); panel.add(positionCombo, "spanx, growx, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java index c537fe08c..f036ca452 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java @@ -125,7 +125,7 @@ public class TubeFinSetConfig extends RocketComponentConfig { //// Position relative to: panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto"))); - final EnumModel methodModel = new EnumModel(component, "RelativePosition", AxialMethod.axialOffsetMethods ); + final EnumModel methodModel = new EnumModel(component, "AxialMethod", AxialMethod.axialOffsetMethods ); final JComboBox methodCombo = new JComboBox( methodModel ); panel.add(methodCombo, "spanx, growx, wrap"); 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 58854c32d..a0f44b54d 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java @@ -288,7 +288,7 @@ public class ComponentRenderer { //renderOther(gl, r); final double or = r.getOuterDiameter() / 2.0; final double ir = r.getInnerDiameter() / 2.0; - gl.glRotated(r.getAngularOffset()*180/Math.PI -90 , 1, 0, 0); + gl.glRotated(r.getAngleOffset()*180/Math.PI -90 , 1, 0, 0); //Inner Diameter glu.gluCylinder(q, ir, ir, r.getTotalHeight(), LOD, 1); diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/RailButtonShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/RailButtonShapes.java index 49f1b4153..0222656e5 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/RailButtonShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/RailButtonShapes.java @@ -21,7 +21,7 @@ public class RailButtonShapes extends RocketComponentShape { RailButton btn = (RailButton)component; - final double rotation_rad = btn.getAngularOffset(); + final double rotation_rad = btn.getAngleOffset(); final double baseHeight = btn.getStandoff(); final double innerHeight = btn.getInnerHeight(); final double flangeHeight = btn.getFlangeHeight(); @@ -87,7 +87,7 @@ public class RailButtonShapes extends RocketComponentShape { net.sf.openrocket.rocketcomponent.RailButton btn = (net.sf.openrocket.rocketcomponent.RailButton)component; - final double rotation_rad = btn.getAngularOffset(); + final double rotation_rad = btn.getAngleOffset(); final double sinr = Math.sin(rotation_rad); final double cosr = Math.cos(rotation_rad); final double baseHeight = btn.getStandoff();