[feature][refactor] Implemented Relative Positioning for Axial, Angular, and Radius directions

- Allows more precise and flexible control of component positions
- file format:
  -- maintains compatability with previous major release (15.04)
  -- may not accept file formats from unstable development branches in-between major releases
This commit is contained in:
Daniel_M_Williams 2018-01-21 12:00:16 -05:00
parent 0498900078
commit 85fc41d203
33 changed files with 158 additions and 108 deletions

View File

@ -899,7 +899,6 @@ StageConfig.tab.Separation.ttip = Stage separation options
StageConfig.separation.lbl.title = Select when this stage separates: StageConfig.separation.lbl.title = Select when this stage separates:
StageConfig.separation.lbl.plus = plus StageConfig.separation.lbl.plus = plus
StageConfig.separation.lbl.seconds = seconds StageConfig.separation.lbl.seconds = seconds
StageConfig.parallel.autoradius = Enable Automatic Positioning
StageConfig.parallel.radius = Radial Distance StageConfig.parallel.radius = Radial Distance
StageConfig.parallel.angle = Angle StageConfig.parallel.angle = Angle
StageConfig.parallel.count = Number of Copies StageConfig.parallel.count = Number of Copies
@ -1399,20 +1398,23 @@ Shape.Haackseries.desc2 = The Haack series <i>nose cones</i> are designed to min
! RocketComponent ! RocketComponent
RocketComponent.Position.Method.Axial.Label = Radius Positioning Method
RocketComponent.Position.Method.Axial.ABSOLUTE = Tip of the nose cone RocketComponent.Position.Method.Axial.ABSOLUTE = Tip of the nose cone
RocketComponent.Position.Method.Axial.AFTER = After the sibling component RocketComponent.Position.Method.Axial.AFTER = After the sibling component
RocketComponent.Position.Method.Axial.BOTTOM = Bottom of the parent 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.MIDDLE = Middle of the parent component
RocketComponent.Position.Method.Axial.TOP = Top 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.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.SURFACE = Position on the target component surface (without offset)
RocketComponent.Position.Method.Radius.RELATIVE = Position relative to the component surface 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.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.RELATIVE = Relative to the parent component
RocketComponent.Position.Method.Angle.FIXED = Angle is fixed. 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.X = "X axis"
RocketComponent.Direction.Y = "Y axis" RocketComponent.Direction.Y = "Y axis"

View File

@ -2,7 +2,6 @@ package net.sf.openrocket.file.openrocket.importt;
import java.util.HashMap; import java.util.HashMap;
import net.sf.openrocket.aerodynamics.Warning;
import net.sf.openrocket.aerodynamics.WarningSet; import net.sf.openrocket.aerodynamics.WarningSet;
import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.position.AngleMethod; import net.sf.openrocket.rocketcomponent.position.AngleMethod;
@ -14,26 +13,25 @@ class AnglePositionSetter implements Setter {
public void set(RocketComponent c, String value, HashMap<String, String> attributes, public void set(RocketComponent c, String value, HashMap<String, String> attributes,
WarningSet warnings) { WarningSet warnings) {
AngleMethod type = (AngleMethod) DocumentConfig.findEnum(attributes.get("method"), AngleMethod.class); AngleMethod method = (AngleMethod) DocumentConfig.findEnum(attributes.get("method"), AngleMethod.class);
if (type == null) { if (null==method) {
warnings.add(Warning.FILE_INVALID_PARAMETER); method=AngleMethod.RELATIVE;
return;
} }
double pos; double pos;
try { try {
pos = Double.parseDouble(value); pos = Double.parseDouble(value) * Math.PI / 180.0 ;
} catch (NumberFormatException e) { } 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; return;
} }
if ( AnglePositionable.class.isAssignableFrom( c.getClass() ) ) { if ( AnglePositionable.class.isAssignableFrom( c.getClass() ) ) {
AnglePositionable apc = (AnglePositionable)c; AnglePositionable apc = (AnglePositionable)c;
apc.setAngleMethod(type); apc.setAngleMethod(method);
apc.setAngleOffset(pos); apc.setAngleOffset(pos);
} else { } 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()));
} }
} }

View File

@ -15,9 +15,8 @@ class AxialPositionSetter implements Setter {
// first check preferred attribute name: // first check preferred attribute name:
AxialMethod type = (AxialMethod) DocumentConfig.findEnum(attributes.get("method"), AxialMethod.class); AxialMethod type = (AxialMethod) DocumentConfig.findEnum(attributes.get("method"), AxialMethod.class);
// fall-back to old name // fall-back to old name
if (type == null) { if (null == type) {
type = (AxialMethod) DocumentConfig.findEnum(attributes.get("type"), AxialMethod.class); type = (AxialMethod) DocumentConfig.findEnum(attributes.get("type"), AxialMethod.class);
} }
@ -30,7 +29,7 @@ class AxialPositionSetter implements Setter {
try { try {
pos = Double.parseDouble(value); pos = Double.parseDouble(value);
} catch (NumberFormatException e) { } 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; return;
} }
@ -39,7 +38,7 @@ class AxialPositionSetter implements Setter {
apc.setAxialMethod(type); apc.setAxialMethod(type);
apc.setAxialOffset(pos); apc.setAxialOffset(pos);
} else { } 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()));
} }
} }

View File

@ -119,7 +119,7 @@ class DocumentConfig {
Reflection.findMethod(RocketComponent.class, "setLineStyle", LineStyle.class), Reflection.findMethod(RocketComponent.class, "setLineStyle", LineStyle.class),
LineStyle.class)); LineStyle.class));
setters.put("RocketComponent:position", new AxialPositionSetter() ); setters.put("RocketComponent:position", new AxialPositionSetter() );
setters.put("RocketComponent:axialposition", new AxialPositionSetter() ); setters.put("RocketComponent:axialoffset", new AxialPositionSetter() );
setters.put("RocketComponent:overridemass", new OverrideSetter( setters.put("RocketComponent:overridemass", new OverrideSetter(
Reflection.findMethod(RocketComponent.class, "setOverrideMass", double.class), Reflection.findMethod(RocketComponent.class, "setOverrideMass", double.class),
Reflection.findMethod(RocketComponent.class, "setMassOverridden", boolean.class))); Reflection.findMethod(RocketComponent.class, "setMassOverridden", boolean.class)));
@ -158,8 +158,8 @@ class DocumentConfig {
// Parallel Stage // Parallel Stage
setters.put("ParallelStage:instancecount", new IntSetter( setters.put("ParallelStage:instancecount", new IntSetter(
Reflection.findMethod(ParallelStage.class, "setInstanceCount",int.class))); Reflection.findMethod(ParallelStage.class, "setInstanceCount",int.class)));
setters.put("ParallelStage:angleposition", new AnglePositionSetter()); setters.put("ParallelStage:angleoffset", new AnglePositionSetter());
setters.put("ParallelStage:radiusposition", new RadiusPositionSetter()); setters.put("ParallelStage:radiusoffset", new RadiusPositionSetter());
// SymmetricComponent // SymmetricComponent
setters.put("SymmetricComponent:thickness", new DoubleSetter( setters.put("SymmetricComponent:thickness", new DoubleSetter(
@ -174,6 +174,7 @@ class DocumentConfig {
Reflection.findMethod( LaunchLug.class, "setInstanceSeparation", double.class))); Reflection.findMethod( LaunchLug.class, "setInstanceSeparation", double.class)));
setters.put("LaunchLug:radialdirection", new DoubleSetter( setters.put("LaunchLug:radialdirection", new DoubleSetter(
Reflection.findMethod( LaunchLug.class, "setAngleOffset", double.class), Math.PI / 180.0)); Reflection.findMethod( LaunchLug.class, "setAngleOffset", double.class), Math.PI / 180.0));
setters.put("LaunchLug:angleoffset", new AnglePositionSetter() );
setters.put("LaunchLug:radius", new DoubleSetter( setters.put("LaunchLug:radius", new DoubleSetter(
Reflection.findMethod(LaunchLug.class, "setOuterRadius", double.class))); Reflection.findMethod(LaunchLug.class, "setOuterRadius", double.class)));
setters.put("LaunchLug:length", new DoubleSetter( setters.put("LaunchLug:length", new DoubleSetter(
@ -186,7 +187,7 @@ class DocumentConfig {
Reflection.findMethod( RailButton.class, "setInstanceCount",int.class))); Reflection.findMethod( RailButton.class, "setInstanceCount",int.class)));
setters.put("RailButton:instanceseparation", new DoubleSetter( setters.put("RailButton:instanceseparation", new DoubleSetter(
Reflection.findMethod( RailButton.class, "setInstanceSeparation", double.class))); 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( setters.put("RailButton:height", new DoubleSetter(
Reflection.findMethod( RailButton.class, "setTotalHeight", double.class))); Reflection.findMethod( RailButton.class, "setTotalHeight", double.class)));
setters.put("RailButton:outerdiameter", new DoubleSetter( setters.put("RailButton:outerdiameter", new DoubleSetter(
@ -242,8 +243,8 @@ class DocumentConfig {
Reflection.findMethod(FinSet.class, "setInstanceCount", int.class))); Reflection.findMethod(FinSet.class, "setInstanceCount", int.class)));
setters.put("FinSet:rotation", new DoubleSetter( setters.put("FinSet:rotation", new DoubleSetter(
Reflection.findMethod(FinSet.class, "setBaseRotation", double.class), Math.PI / 180.0)); Reflection.findMethod(FinSet.class, "setBaseRotation", double.class), Math.PI / 180.0));
setters.put("FinSet:angularoffset", new AnglePositionSetter() ); setters.put("FinSet:angleoffset", new AnglePositionSetter() );
setters.put("FinSet:radialoffset", new RadiusPositionSetter() ); setters.put("FinSet:radiusoffset", new RadiusPositionSetter() );
setters.put("FinSet:thickness", new DoubleSetter( setters.put("FinSet:thickness", new DoubleSetter(
Reflection.findMethod(FinSet.class, "setThickness", double.class))); Reflection.findMethod(FinSet.class, "setThickness", double.class)));
setters.put("FinSet:crosssection", new EnumSetter<FinSet.CrossSection>( setters.put("FinSet:crosssection", new EnumSetter<FinSet.CrossSection>(

View File

@ -2,7 +2,6 @@ package net.sf.openrocket.file.openrocket.importt;
import java.util.HashMap; import java.util.HashMap;
import net.sf.openrocket.aerodynamics.Warning;
import net.sf.openrocket.aerodynamics.WarningSet; import net.sf.openrocket.aerodynamics.WarningSet;
import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.position.RadiusMethod; import net.sf.openrocket.rocketcomponent.position.RadiusMethod;
@ -14,10 +13,9 @@ class RadiusPositionSetter implements Setter {
public void set(RocketComponent c, String value, HashMap<String, String> attributes, public void set(RocketComponent c, String value, HashMap<String, String> attributes,
WarningSet warnings) { 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) { if (method == null) {
warnings.add(Warning.FILE_INVALID_PARAMETER); method = RadiusMethod.SURFACE;
return;
} }
@ -25,7 +23,7 @@ class RadiusPositionSetter implements Setter {
try { try {
offset = Double.parseDouble(value); offset = Double.parseDouble(value);
} catch (NumberFormatException e) { } 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; return;
} }
@ -34,7 +32,7 @@ class RadiusPositionSetter implements Setter {
rp.setRadiusMethod(method); rp.setRadiusMethod(method);
rp.setRadiusOffset(offset); rp.setRadiusOffset(offset);
} else { } else {
warnings.add(Warning.FILE_INVALID_PARAMETER); warnings.add("Warning: radiusPositionable is not valid for this class: "+c.getClass().getCanonicalName());
} }
} }

View File

@ -27,7 +27,7 @@ public class RailButtonSaver extends ExternalComponentSaver {
emitDouble( elements, "outerdiameter", rb.getOuterDiameter()); emitDouble( elements, "outerdiameter", rb.getOuterDiameter());
emitDouble( elements, "height", rb.getTotalHeight()); emitDouble( elements, "height", rb.getTotalHeight());
emitDouble( elements, "angularoffset", rb.getAngularOffset()*180.0/Math.PI);
} }

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import net.sf.openrocket.appearance.Appearance; import net.sf.openrocket.appearance.Appearance;
import net.sf.openrocket.appearance.Decal; 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.Instanceable;
import net.sf.openrocket.rocketcomponent.LineInstanceable; import net.sf.openrocket.rocketcomponent.LineInstanceable;
import net.sf.openrocket.rocketcomponent.MotorMount; import net.sf.openrocket.rocketcomponent.MotorMount;
import net.sf.openrocket.rocketcomponent.RingInstanceable;
import net.sf.openrocket.rocketcomponent.Rocket; import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent; 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.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.startup.Application;
import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Color; import net.sf.openrocket.util.Color;
@ -86,37 +87,41 @@ public class RocketComponentSaver {
if ( c instanceof Instanceable) { if ( c instanceof Instanceable) {
int instanceCount = c.getInstanceCount(); int instanceCount = c.getInstanceCount();
if( c instanceof Clusterable ){ if( c instanceof Clusterable ){
; // no-op. Instance counts are set via named cluster configurations ; // no-op. Instance counts are set via named cluster configurations
}else if( 1 < instanceCount ) {
emitInteger( elements, "instancecount", c.getInstanceCount() );
} }
if( c instanceof LineInstanceable ){ if( c instanceof LineInstanceable ){
LineInstanceable line = (LineInstanceable)c; LineInstanceable line = (LineInstanceable)c;
emitInteger( elements, "instancecount", instanceCount );
emitDouble( elements, "instanceseparation", line.getInstanceSeparation()); emitDouble( elements, "instanceseparation", line.getInstanceSeparation());
} }
if( c instanceof RingInstanceable){ if( c instanceof RadiusPositionable ){
RingInstanceable ring = (RingInstanceable)c; final RadiusPositionable radPos = (RadiusPositionable)c;
emitInteger( elements, "instancecount", instanceCount ); // The type names are currently equivalent to the enum names except for case.
// WARNING!! THIS IS WRONG! final String radiusMethod = radPos.getRadiusMethod().name().toLowerCase(Locale.ENGLISH);
// TODO: Re-Implement final double radiusOffset = radPos.getRadiusOffset();
if( RadiusMethod.SURFACE == ring.getRadiusMethod() ) { elements.add("<radiusoffset method=\"" + radiusMethod + "\">" + radiusOffset + "</radiusoffset>");
emitString(elements, "radialoffset", "auto"); }
}else{ if( c instanceof AnglePositionable ) {
emitDouble( elements, "radialoffset", ring.getRadiusOffset() ); final AnglePositionable anglePos= (AnglePositionable)c;
} // The type names are currently equivalent to the enum names except for case.
emitDouble( elements, "angularoffset", ring.getAngleOffset()*180.0/Math.PI); final String angleMethod = anglePos.getAngleMethod().name().toLowerCase(Locale.ENGLISH);
final double angleOffset = anglePos.getAngleOffset()*180.0/Math.PI ;
elements.add("<angleoffset method=\"" + angleMethod + "\">" + angleOffset + "</angleoffset>");
} }
} }
// Save position unless "AFTER" // Save position unless "AFTER"
if (c.getAxialMethod() != AxialMethod.AFTER) { if (c.getAxialMethod() != AxialMethod.AFTER) {
// The type names are currently equivalent to the enum names except for case. // The type names are currently equivalent to the enum names except for case.
String type = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH); String axialMethod = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH);
elements.add("<position type=\"" + type + "\">" + c.getAxialOffset() + "</position>"); elements.add("<axialoffset method=\"" + axialMethod + "\">" + c.getAxialOffset() + "</axialoffset>");
} }
// Overrides // Overrides
boolean overridden = false; boolean overridden = false;
if (c.isMassOverridden()) { if (c.isMassOverridden()) {
@ -252,17 +257,31 @@ public class RocketComponentSaver {
} }
protected static void emitDouble( final List<String> elements, final String enclosingTag, final double value){ protected static void emitDouble( final List<String> 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<String> elements, final String enclosingTag, final int value){ protected static void emitInteger( final List<String> elements, final String enclosingTag, final int value){
elements.add("<"+enclosingTag+">" + Integer.toString( value ) + "</"+enclosingTag+">"); appendElement( elements, enclosingTag, enclosingTag, Integer.toString( value ) );
} }
protected static void emitString( final List<String> elements, final String enclosingTag, final String value){ protected static void emitString( final List<String> elements, final String enclosingTag, final String value){
elements.add("<"+enclosingTag+">" + value + "</"+enclosingTag+">"); appendElement( elements, enclosingTag, enclosingTag, value );
} }
protected static String generateOpenTag( final Map<String,String> attrs, final String enclosingTag ){
StringBuffer buf = new StringBuffer();
if( null == attrs ) {
return enclosingTag;
}
for (Map.Entry<String, String> entry : attrs.entrySet()) {
buf.append(String.format(" %s=\"%s\"", entry.getKey(), entry.getValue() ));
}
return buf.toString();
}
protected static void appendElement( final List<String> elements, final String openTag, final String closeTag, final String elementValue ){
elements.add("<"+openTag+">" + elementValue + "</"+closeTag+">");
}
} }

View File

@ -215,7 +215,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
trans.get("optimization.modifier.internalcomponent.position"), trans.get("optimization.modifier.internalcomponent.position"),
trans.get("optimization.modifier.internalcomponent.position.desc"), trans.get("optimization.modifier.internalcomponent.position.desc"),
c, UnitGroup.UNITS_LENGTH, c, UnitGroup.UNITS_LENGTH,
1.0, c.getClass(), c.getID(), "RelativePosition"); 1.0, c.getClass(), c.getID(), "AxialMethod");
mod.setMinValue(0); mod.setMinValue(0);
mod.setMaxValue(parent.getLength()); mod.setMaxValue(parent.getLength());
modifiers.add(mod); modifiers.add(mod);
@ -229,7 +229,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
trans.get("optimization.modifier.finset.position"), trans.get("optimization.modifier.finset.position"),
trans.get("optimization.modifier.finset.position.desc"), trans.get("optimization.modifier.finset.position.desc"),
c, UnitGroup.UNITS_LENGTH, c, UnitGroup.UNITS_LENGTH,
1.0, c.getClass(), c.getID(), "RelativePosition"); 1.0, c.getClass(), c.getID(), "AxialMethod");
mod.setMinValue(0); mod.setMinValue(0);
mod.setMaxValue(parent.getLength()); mod.setMaxValue(parent.getLength());
modifiers.add(mod); modifiers.add(mod);
@ -243,7 +243,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
trans.get("optimization.modifier.launchlug.position"), trans.get("optimization.modifier.launchlug.position"),
trans.get("optimization.modifier.launchlug.position.desc"), trans.get("optimization.modifier.launchlug.position.desc"),
c, UnitGroup.UNITS_LENGTH, c, UnitGroup.UNITS_LENGTH,
1.0, c.getClass(), c.getID(), "RelativePosition"); 1.0, c.getClass(), c.getID(), "AxialMethod");
mod.setMinValue(0); mod.setMinValue(0);
mod.setMaxValue(parent.getLength()); mod.setMaxValue(parent.getLength());
modifiers.add(mod); modifiers.add(mod);
@ -252,8 +252,6 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
// Recovery device deployment altitude and delay // Recovery device deployment altitude and delay
if (c instanceof RecoveryDevice) { if (c instanceof RecoveryDevice) {
RecoveryDevice device = (RecoveryDevice) c;
SimulationModifier mod = new FlightConfigurationModifier<DeploymentConfiguration>( SimulationModifier mod = new FlightConfigurationModifier<DeploymentConfiguration>(
trans.get("optimization.modifier.recoverydevice.deployDelay"), trans.get("optimization.modifier.recoverydevice.deployDelay"),
trans.get("optimization.modifier.recoverydevice.deployDelay.desc"), trans.get("optimization.modifier.recoverydevice.deployDelay.desc"),

View File

@ -3,10 +3,11 @@ package net.sf.openrocket.rocketcomponent;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type; import net.sf.openrocket.preset.ComponentPreset.Type;
import net.sf.openrocket.rocketcomponent.position.AxialPositionable;
import net.sf.openrocket.startup.Application; 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(); private static final Translator trans = Application.getTranslator();

View File

@ -12,6 +12,7 @@ import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.motor.MotorConfiguration; import net.sf.openrocket.motor.MotorConfiguration;
import net.sf.openrocket.motor.MotorConfigurationSet; import net.sf.openrocket.motor.MotorConfigurationSet;
import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.rocketcomponent.position.AxialPositionable;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Coordinate;
@ -24,7 +25,7 @@ import net.sf.openrocket.util.MathUtil;
* *
* @author Sampo Niskanen <sampo.niskanen@iki.fi> * @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/ */
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 Translator trans = Application.getTranslator();
private static final Logger log = LoggerFactory.getLogger(InnerTube.class); private static final Logger log = LoggerFactory.getLogger(InnerTube.class);

View File

@ -1,6 +1,7 @@
package net.sf.openrocket.rocketcomponent; package net.sf.openrocket.rocketcomponent;
import net.sf.openrocket.rocketcomponent.position.AxialMethod; 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 * 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 <sampo.niskanen@iki.fi> * @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/ */
public abstract class InternalComponent extends RocketComponent { public abstract class InternalComponent extends RocketComponent implements AxialPositionable {
public InternalComponent() { public InternalComponent() {
super( AxialMethod.BOTTOM); super( AxialMethod.BOTTOM);

View File

@ -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(); private static final Translator trans = Application.getTranslator();

View File

@ -1,6 +1,8 @@
package net.sf.openrocket.rocketcomponent; 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(); public double getInstanceSeparation();

View File

@ -6,7 +6,10 @@ import java.util.Collection;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type; 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.AxialMethod;
import net.sf.openrocket.rocketcomponent.position.AxialPositionable;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Coordinate;
@ -17,7 +20,7 @@ import net.sf.openrocket.util.MathUtil;
* @author widget (Daniel Williams) * @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(); private static final Translator trans = Application.getTranslator();
@ -49,15 +52,16 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
protected final static double MINIMUM_STANDOFF= 0.001; protected final static double MINIMUM_STANDOFF= 0.001;
private double radialDistance_m=0; private double radialDistance_m=0;
protected static final AngleMethod angleMethod = AngleMethod.RELATIVE;
private double angle_rad = 0; private double angle_rad = 0;
private int instanceCount = 1; private int instanceCount = 1;
private double instanceSeparation = 0; // front-front along the positive rocket axis. i.e. [1,0,0]; private double instanceSeparation = 0; // front-front along the positive rocket axis. i.e. [1,0,0];
public RailButton(){ public RailButton(){
super(AxialMethod.MIDDLE); super(AxialMethod.MIDDLE);
this.outerDiameter_m = 0; this.outerDiameter_m = 1.0;
this.totalHeight_m = 0; this.totalHeight_m = 1.0;
this.innerDiameter_m = 0; this.innerDiameter_m = 0.8;
this.flangeHeight_m = 0.002; this.flangeHeight_m = 0.002;
this.setStandoff( 0.002); this.setStandoff( 0.002);
this.setInstanceSeparation( 1.0); this.setInstanceSeparation( 1.0);
@ -177,11 +181,24 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
return false; return false;
} }
public double getAngularOffset(){ @Override
public double getAngleOffset(){
return angle_rad; 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); double clamped_rad = MathUtil.clamp(angle_rad, -Math.PI, Math.PI);
if (MathUtil.equals(this.angle_rad, clamped_rad)) if (MathUtil.equals(this.angle_rad, clamped_rad))

View File

@ -1,7 +1,5 @@
package net.sf.openrocket.rocketcomponent; package net.sf.openrocket.rocketcomponent;
import static org.junit.Assert.assertEquals;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.Collection; import java.util.Collection;
import java.util.Deque; import java.util.Deque;

View File

@ -29,7 +29,7 @@ public enum AngleMethod implements DistanceMethod {
// Mirror Instances // Mirror Instances
// - Intended for 2x-instance components... // - Intended for 2x-instance components...
// - Undefined behavior for components with 3 or more instances // - 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 @Override
public boolean clampToZero() { return false; } public boolean clampToZero() { return false; }
@ -45,6 +45,10 @@ public enum AngleMethod implements DistanceMethod {
} }
}; };
public static final AngleMethod[] choices(){
return new AngleMethod[]{ AngleMethod.RELATIVE, AngleMethod.FIXED };
}
public final String name; public final String name;
private AngleMethod( final String _name ) { private AngleMethod( final String _name ) {

View File

@ -54,6 +54,10 @@ public enum RadiusMethod implements DistanceMethod {
} }
}; };
public static final RadiusMethod[] choices(){
return new RadiusMethod[]{ RadiusMethod.FREE, RadiusMethod.RELATIVE, RadiusMethod.SURFACE };
}
public final String name; public final String name;
// ============= // =============

View File

@ -1,7 +1,6 @@
package net.sf.openrocket.gui.configdialog; package net.sf.openrocket.gui.configdialog;
import javax.swing.ComboBoxModel; import javax.swing.ComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -10,7 +9,6 @@ import javax.swing.JSpinner;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.gui.SpinnerEditor; 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.DoubleModel;
import net.sf.openrocket.gui.adaptors.EnumModel; import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.adaptors.IntegerModel; 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.ParallelStage;
import net.sf.openrocket.rocketcomponent.PodSet; import net.sf.openrocket.rocketcomponent.PodSet;
import net.sf.openrocket.rocketcomponent.RocketComponent; 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.AxialMethod;
import net.sf.openrocket.rocketcomponent.position.RadiusMethod;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class ComponentAssemblyConfig extends RocketComponentConfig { public class ComponentAssemblyConfig extends RocketComponentConfig {
private static final long serialVersionUID = -5153592258788614257L;
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
public ComponentAssemblyConfig(OpenRocketDocument document, RocketComponent component) { public ComponentAssemblyConfig(OpenRocketDocument document, RocketComponent component) {
@ -43,29 +43,37 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
private JPanel parallelTab( final ComponentAssembly boosters ){ private JPanel parallelTab( final ComponentAssembly boosters ){
JPanel motherPanel = new JPanel( new MigLayout("fill")); JPanel motherPanel = new JPanel( new MigLayout("fill"));
// auto radial distance // radial distance method
BooleanModel autoRadOffsModel = new BooleanModel( boosters, "AutoRadialOffset"); JLabel radiusMethodLabel = new JLabel(trans.get("RocketComponent.Position.Method.Radius.Label"));
JCheckBox autoRadCheckBox = new JCheckBox( autoRadOffsModel ); motherPanel.add( radiusMethodLabel, "align left");
autoRadCheckBox.setText( trans.get("StageConfig.parallel.autoradius")); final EnumModel<RadiusMethod> radiusMethodModel = new EnumModel<RadiusMethod>( boosters, "RadiusMethod", RadiusMethod.choices());
motherPanel.add( autoRadCheckBox, "align left, wrap"); final JComboBox<RadiusMethod> radiusMethodCombo = new JComboBox<RadiusMethod>( radiusMethodModel );
motherPanel.add( radiusMethodCombo, "align left, wrap");
// set radial distance // set radial distance
JLabel radiusLabel = new JLabel(trans.get("StageConfig.parallel.radius")); JLabel radiusLabel = new JLabel(trans.get("StageConfig.parallel.radius"));
motherPanel.add( radiusLabel , "align left"); motherPanel.add( radiusLabel , "align left");
autoRadOffsModel.addEnableComponent(radiusLabel, false); //radiusMethodModel.addEnableComponent(radiusLabel, false);
DoubleModel radiusModel = new DoubleModel( boosters, "RadialOffset", UnitGroup.UNITS_LENGTH, 0); DoubleModel radiusModel = new DoubleModel( boosters, "RadiusOffset", UnitGroup.UNITS_LENGTH, 0);
JSpinner radiusSpinner = new JSpinner( radiusModel.getSpinnerModel()); JSpinner radiusSpinner = new JSpinner( radiusModel.getSpinnerModel());
radiusSpinner.setEditor(new SpinnerEditor(radiusSpinner )); radiusSpinner.setEditor(new SpinnerEditor(radiusSpinner ));
motherPanel.add(radiusSpinner , "growx 1, align right"); motherPanel.add(radiusSpinner , "growx 1, align right");
autoRadOffsModel.addEnableComponent(radiusSpinner, false); // autoRadOffsModel.addEnableComponent(radiusSpinner, false);
UnitSelector radiusUnitSelector = new UnitSelector(radiusModel); UnitSelector radiusUnitSelector = new UnitSelector(radiusModel);
motherPanel.add(radiusUnitSelector, "growx 1, wrap"); motherPanel.add(radiusUnitSelector, "growx 1, wrap");
autoRadOffsModel.addEnableComponent(radiusUnitSelector, false); // autoRadOffsModel.addEnableComponent(radiusUnitSelector, false);
// set location angle around the primary stage // set location angle around the primary stage
JLabel angleMethodLabel = new JLabel(trans.get("RocketComponent.Position.Method.Angle.Label"));
motherPanel.add( angleMethodLabel, "align left");
EnumModel<AngleMethod> angleMethodModel = new EnumModel<AngleMethod>( boosters, "AngleMethod", AngleMethod.choices() );
final JComboBox<AngleMethod> angleMethodCombo = new JComboBox<AngleMethod>( angleMethodModel );
motherPanel.add( angleMethodCombo, "align left, wrap");
JLabel angleLabel = new JLabel(trans.get("StageConfig.parallel.angle")); JLabel angleLabel = new JLabel(trans.get("StageConfig.parallel.angle"));
motherPanel.add( angleLabel, "align left"); 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()); JSpinner angleSpinner = new JSpinner(angleModel.getSpinnerModel());
angleSpinner.setEditor(new SpinnerEditor(angleSpinner)); angleSpinner.setEditor(new SpinnerEditor(angleSpinner));
@ -86,7 +94,7 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
JLabel positionLabel = new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")); JLabel positionLabel = new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto"));
motherPanel.add( positionLabel); motherPanel.add( positionLabel);
ComboBoxModel<AxialMethod> axialPositionMethodModel = new EnumModel<AxialMethod>(component, "RelativePositionMethod", AxialMethod.axialOffsetMethods ); ComboBoxModel<AxialMethod> axialPositionMethodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
JComboBox<?> positionMethodCombo = new JComboBox<AxialMethod>( axialPositionMethodModel ); JComboBox<?> positionMethodCombo = new JComboBox<AxialMethod>( axialPositionMethodModel );
motherPanel.add(positionMethodCombo, "spanx 2, growx, wrap"); motherPanel.add(positionMethodCombo, "spanx 2, growx, wrap");

View File

@ -111,7 +111,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Positionrelativeto"))); panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Positionrelativeto")));
JComboBox<AxialMethod> positionCombo= new JComboBox<AxialMethod>( new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods )); JComboBox<AxialMethod> positionCombo= new JComboBox<AxialMethod>( new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods ));
panel.add(positionCombo, "spanx, growx, wrap"); panel.add(positionCombo, "spanx, growx, wrap");
//// plus //// plus

View File

@ -43,6 +43,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@SuppressWarnings("serial")
public abstract class FinSetConfig extends RocketComponentConfig { public abstract class FinSetConfig extends RocketComponentConfig {
private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class); private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class);
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
@ -178,10 +179,9 @@ public abstract class FinSetConfig extends RocketComponentConfig {
"w 100lp, growx 5, wrap"); "w 100lp, growx 5, wrap");
//// Tab length
//// Tab height: //// Tab height:
label = new JLabel(trans.get("FinSetConfig.lbl.Tabheight")); 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")); label.setToolTipText(trans.get("FinSetConfig.ttip.Tabheight"));
panel.add(label, "gapleft para"); panel.add(label, "gapleft para");
@ -210,16 +210,15 @@ public abstract class FinSetConfig extends RocketComponentConfig {
panel.add(new UnitSelector(mts), "growx"); panel.add(new UnitSelector(mts), "growx");
panel.add(new BasicSlider(mts.getSliderModel(length_2, length2)), "w 100lp, growx 5, wrap"); panel.add(new BasicSlider(mts.getSliderModel(length_2, length2)), "w 100lp, growx 5, wrap");
//// relative to //// relative to
label = new JLabel(trans.get("FinSetConfig.lbl.relativeto")); label = new JLabel(trans.get("FinSetConfig.lbl.relativeto"));
panel.add(label, "right, gapright unrel"); panel.add(label, "right, gapright unrel");
final EnumModel<FinSet.TabRelativePosition> em = final EnumModel<FinSet.TabRelativePosition> em = new EnumModel<FinSet.TabRelativePosition>(component, "TabRelativePosition");
new EnumModel<FinSet.TabRelativePosition>(component, "TabRelativePosition");
panel.add(new JComboBox(em), "spanx 3, growx, wrap para"); JComboBox<?> enumCombo = new JComboBox<FinSet.TabRelativePosition>(em);
panel.add( enumCombo, "spanx 3, growx, wrap para");
// Calculate fin tab height, length, and position // Calculate fin tab height, length, and position
autoCalc = new JButton(trans.get("FinSetConfig.but.AutoCalc")); 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")); label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects"));
filletPanel.add(label, "spanx 4, wrap rel"); 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. //// The component material affects the weight of the component.
combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects")); combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects"));
filletPanel.add(combo, "spanx 4, growx, wrap paragraph"); filletPanel.add(combo, "spanx 4, growx, wrap paragraph");

View File

@ -146,7 +146,7 @@ public class FreeformFinSetConfig extends FinSetConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.Posrelativeto"))); panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.Posrelativeto")));
JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods )); JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods ));
panel.add(positionCombo, "spanx 3, growx, wrap"); panel.add(positionCombo, "spanx 3, growx, wrap");
//// plus //// plus
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.plus")), "right"); panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.plus")), "right");

View File

@ -140,7 +140,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto"))); panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto")));
JComboBox<?> combo = new JComboBox<AxialMethod>( new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods )); JComboBox<?> combo = new JComboBox<AxialMethod>( new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods ));
panel.add(combo, "spanx 3, growx, wrap"); panel.add(combo, "spanx 3, growx, wrap");
//// plus //// plus

View File

@ -111,7 +111,7 @@ public class LaunchLugConfig extends RocketComponentConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto"))); panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")));
EnumModel<AxialMethod> positionModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); EnumModel<AxialMethod> positionModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( positionModel ); JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( positionModel );
panel.add( positionCombo, "spanx, growx, wrap"); panel.add( positionCombo, "spanx, growx, wrap");

View File

@ -110,7 +110,7 @@ public class MassComponentConfig extends RocketComponentConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.PosRelativeto"))); panel.add(new JLabel(trans.get("MassComponentCfg.lbl.PosRelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<?> methodCombo = new JComboBox<AxialMethod>( methodModel ); final JComboBox<?> methodCombo = new JComboBox<AxialMethod>( methodModel );
panel.add(methodCombo, "spanx, growx, wrap"); panel.add(methodCombo, "spanx, growx, wrap");
//// plus //// plus

View File

@ -139,7 +139,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Posrelativeto"))); panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Posrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel ); JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel );
panel.add( positionCombo, "spanx, growx, wrap"); panel.add( positionCombo, "spanx, growx, wrap");

View File

@ -67,7 +67,7 @@ public class RailButtonConfig extends RocketComponentConfig {
{ //// Angular Position: { //// Angular Position:
panel.add(new JLabel(trans.get("RailBtnCfg.lbl.Angle"))); 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()); JSpinner angleSpinner = new JSpinner( angleModel.getSpinnerModel());
angleSpinner.setEditor(new SpinnerEditor(angleSpinner)); angleSpinner.setEditor(new SpinnerEditor(angleSpinner));
panel.add(angleSpinner, "growx"); panel.add(angleSpinner, "growx");
@ -78,7 +78,7 @@ public class RailButtonConfig extends RocketComponentConfig {
{ //// Position relative to: { //// Position relative to:
panel.add(new JLabel(trans.get("RailBtnCfg.lbl.PosRelativeTo"))); panel.add(new JLabel(trans.get("RailBtnCfg.lbl.PosRelativeTo")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
JComboBox<AxialMethod> relToCombo = new JComboBox<AxialMethod>( methodModel ); JComboBox<AxialMethod> relToCombo = new JComboBox<AxialMethod>( methodModel );
panel.add( relToCombo, "growx, wrap rel"); panel.add( relToCombo, "growx, wrap rel");
} }

View File

@ -127,7 +127,7 @@ public class RingComponentConfig extends RocketComponentConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto"))); panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel ); final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel );
panel.add( positionCombo, "spanx 3, growx, wrap"); panel.add( positionCombo, "spanx 3, growx, wrap");

View File

@ -64,7 +64,7 @@ public class ShockCordConfig extends RocketComponentConfig {
//// Position relative to: //// Position relative to:
panel2.add(new JLabel(trans.get("ShockCordCfg.lbl.Posrelativeto"))); panel2.add(new JLabel(trans.get("ShockCordCfg.lbl.Posrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<AxialMethod> combo = new JComboBox<AxialMethod>( methodModel ); final JComboBox<AxialMethod> combo = new JComboBox<AxialMethod>( methodModel );
panel2.add(combo, "spanx, growx, wrap"); panel2.add(combo, "spanx, growx, wrap");

View File

@ -140,7 +140,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Posrelativeto"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Posrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel ); final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel );
panel.add( positionCombo, "spanx, growx, wrap"); panel.add( positionCombo, "spanx, growx, wrap");

View File

@ -168,7 +168,7 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.Posrelativeto"))); panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.Posrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel ); final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel );
panel.add(positionCombo, "spanx, growx, wrap"); panel.add(positionCombo, "spanx, growx, wrap");

View File

@ -125,7 +125,7 @@ public class TubeFinSetConfig extends RocketComponentConfig {
//// Position relative to: //// Position relative to:
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto"))); panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "RelativePosition", AxialMethod.axialOffsetMethods ); final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<AxialMethod> methodCombo = new JComboBox<AxialMethod>( methodModel ); final JComboBox<AxialMethod> methodCombo = new JComboBox<AxialMethod>( methodModel );
panel.add(methodCombo, "spanx, growx, wrap"); panel.add(methodCombo, "spanx, growx, wrap");

View File

@ -288,7 +288,7 @@ public class ComponentRenderer {
//renderOther(gl, r); //renderOther(gl, r);
final double or = r.getOuterDiameter() / 2.0; final double or = r.getOuterDiameter() / 2.0;
final double ir = r.getInnerDiameter() / 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 //Inner Diameter
glu.gluCylinder(q, ir, ir, r.getTotalHeight(), LOD, 1); glu.gluCylinder(q, ir, ir, r.getTotalHeight(), LOD, 1);

View File

@ -21,7 +21,7 @@ public class RailButtonShapes extends RocketComponentShape {
RailButton btn = (RailButton)component; RailButton btn = (RailButton)component;
final double rotation_rad = btn.getAngularOffset(); final double rotation_rad = btn.getAngleOffset();
final double baseHeight = btn.getStandoff(); final double baseHeight = btn.getStandoff();
final double innerHeight = btn.getInnerHeight(); final double innerHeight = btn.getInnerHeight();
final double flangeHeight = btn.getFlangeHeight(); 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; 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 sinr = Math.sin(rotation_rad);
final double cosr = Math.cos(rotation_rad); final double cosr = Math.cos(rotation_rad);
final double baseHeight = btn.getStandoff(); final double baseHeight = btn.getStandoff();