[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:
parent
0498900078
commit
85fc41d203
@ -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 <i>nose cones</i> 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"
|
||||
|
||||
@ -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<String, String> 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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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<FinSet.CrossSection>(
|
||||
|
||||
@ -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<String, String> 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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 method=\"" + radiusMethod + "\">" + radiusOffset + "</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 method=\"" + angleMethod + "\">" + angleOffset + "</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("<position type=\"" + type + "\">" + c.getAxialOffset() + "</position>");
|
||||
String axialMethod = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH);
|
||||
elements.add("<axialoffset method=\"" + axialMethod + "\">" + c.getAxialOffset() + "</axialoffset>");
|
||||
}
|
||||
|
||||
|
||||
// Overrides
|
||||
boolean overridden = false;
|
||||
if (c.isMassOverridden()) {
|
||||
@ -252,17 +257,31 @@ public class RocketComponentSaver {
|
||||
}
|
||||
|
||||
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){
|
||||
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){
|
||||
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+">");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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<DeploymentConfiguration>(
|
||||
trans.get("optimization.modifier.recoverydevice.deployDelay"),
|
||||
trans.get("optimization.modifier.recoverydevice.deployDelay.desc"),
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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 <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 Logger log = LoggerFactory.getLogger(InnerTube.class);
|
||||
|
||||
|
||||
@ -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 <sampo.niskanen@iki.fi>
|
||||
*/
|
||||
public abstract class InternalComponent extends RocketComponent {
|
||||
public abstract class InternalComponent extends RocketComponent implements AxialPositionable {
|
||||
|
||||
public InternalComponent() {
|
||||
super( AxialMethod.BOTTOM);
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -49,15 +52,16 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
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))
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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;
|
||||
|
||||
private AngleMethod( final String _name ) {
|
||||
|
||||
@ -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;
|
||||
|
||||
// =============
|
||||
|
||||
@ -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<RadiusMethod> radiusMethodModel = new EnumModel<RadiusMethod>( boosters, "RadiusMethod", RadiusMethod.choices());
|
||||
final JComboBox<RadiusMethod> radiusMethodCombo = new JComboBox<RadiusMethod>( 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<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"));
|
||||
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<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 );
|
||||
motherPanel.add(positionMethodCombo, "spanx 2, growx, wrap");
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
||||
//// Position relative to:
|
||||
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");
|
||||
|
||||
//// plus
|
||||
|
||||
@ -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<FinSet.TabRelativePosition> em =
|
||||
new EnumModel<FinSet.TabRelativePosition>(component, "TabRelativePosition");
|
||||
final EnumModel<FinSet.TabRelativePosition> em = 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
|
||||
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");
|
||||
|
||||
@ -146,7 +146,7 @@ public class FreeformFinSetConfig extends FinSetConfig {
|
||||
//// Position relative to:
|
||||
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");
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.plus")), "right");
|
||||
|
||||
@ -140,7 +140,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
|
||||
//// Position relative to:
|
||||
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");
|
||||
|
||||
//// plus
|
||||
|
||||
@ -111,7 +111,7 @@ public class LaunchLugConfig extends RocketComponentConfig {
|
||||
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel.add( positionCombo, "spanx, growx, wrap");
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ public class MassComponentConfig extends RocketComponentConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel.add(methodCombo, "spanx, growx, wrap");
|
||||
//// plus
|
||||
|
||||
@ -139,7 +139,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel.add( positionCombo, "spanx, growx, wrap");
|
||||
|
||||
|
||||
@ -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<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 );
|
||||
panel.add( relToCombo, "growx, wrap rel");
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public class RingComponentConfig extends RocketComponentConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel.add( positionCombo, "spanx 3, growx, wrap");
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ public class ShockCordConfig extends RocketComponentConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel2.add(combo, "spanx, growx, wrap");
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel.add( positionCombo, "spanx, growx, wrap");
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
|
||||
panel.add(positionCombo, "spanx, growx, wrap");
|
||||
|
||||
@ -125,7 +125,7 @@ public class TubeFinSetConfig extends RocketComponentConfig {
|
||||
//// Position relative to:
|
||||
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 );
|
||||
panel.add(methodCombo, "spanx, growx, wrap");
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user