Merge pull request #1306 from hcraigmiller/Parachure-Enhance-Data
Parachute configuration preset input enhancements
This commit is contained in:
		
						commit
						9f5ccdb6a0
					
				@ -369,7 +369,9 @@ class DocumentConfig {
 | 
			
		||||
		setters.put("MassObject:packedlength", new DoubleSetter(
 | 
			
		||||
				Reflection.findMethod(MassObject.class, "setLength", double.class)));
 | 
			
		||||
		setters.put("MassObject:packedradius", new DoubleSetter(
 | 
			
		||||
				Reflection.findMethod(MassObject.class, "setRadius", double.class)));
 | 
			
		||||
				Reflection.findMethod(MassObject.class, "setRadius", double.class),
 | 
			
		||||
				"auto", " ",
 | 
			
		||||
				Reflection.findMethod(MassObject.class, "setRadiusAutomatic", boolean.class)));
 | 
			
		||||
		setters.put("MassObject:radialposition", new DoubleSetter(
 | 
			
		||||
				Reflection.findMethod(MassObject.class, "setRadialPosition", double.class)));
 | 
			
		||||
		setters.put("MassObject:radialdirection", new DoubleSetter(
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,11 @@ public class MassObjectSaver extends InternalComponentSaver {
 | 
			
		||||
		MassObject mass = (MassObject) c;
 | 
			
		||||
 | 
			
		||||
		elements.add("<packedlength>" + mass.getLength() + "</packedlength>");
 | 
			
		||||
		elements.add("<packedradius>" + mass.getRadius() + "</packedradius>");
 | 
			
		||||
		if (mass.isRadiusAutomatic()) {
 | 
			
		||||
			elements.add("<packedradius>auto " + mass.getRadiusNoAuto() + "</packedradius>");
 | 
			
		||||
		} else {
 | 
			
		||||
			elements.add("<packedradius>" + mass.getRadiusNoAuto() + "</packedradius>");
 | 
			
		||||
		}
 | 
			
		||||
		elements.add("<radialposition>" + mass.getRadialPosition() + "</radialposition>");
 | 
			
		||||
		elements.add("<radialdirection>" + (mass.getRadialDirection() * 180.0 / Math.PI)
 | 
			
		||||
				+ "</radialdirection>");
 | 
			
		||||
 | 
			
		||||
@ -153,6 +153,9 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
 | 
			
		||||
				ComponentPreset.DESCRIPTION,
 | 
			
		||||
				ComponentPreset.DIAMETER,
 | 
			
		||||
				ComponentPreset.SIDES,
 | 
			
		||||
				ComponentPreset.PARACHUTE_CD,
 | 
			
		||||
				ComponentPreset.PACKED_DIAMETER,
 | 
			
		||||
				ComponentPreset.PACKED_LENGTH,
 | 
			
		||||
				ComponentPreset.LINE_COUNT,
 | 
			
		||||
				ComponentPreset.LINE_LENGTH,
 | 
			
		||||
				ComponentPreset.LINE_MATERIAL,
 | 
			
		||||
@ -208,6 +211,9 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
 | 
			
		||||
	public final static TypedKey<Double> MASS = new TypedKey<Double>("Mass", Double.class, UnitGroup.UNITS_MASS);
 | 
			
		||||
	public final static TypedKey<Double> DIAMETER = new TypedKey<Double>("Diameter", Double.class, UnitGroup.UNITS_LENGTH);
 | 
			
		||||
	public final static TypedKey<Integer> SIDES = new TypedKey<Integer>("Sides", Integer.class);
 | 
			
		||||
	public static final TypedKey<Double> PARACHUTE_CD = new TypedKey<Double>("DragCoefficient", Double.class, UnitGroup.UNITS_COEFFICIENT);
 | 
			
		||||
	public final static TypedKey<Double> PACKED_LENGTH = new TypedKey<Double>("PackedLength", Double.class, UnitGroup.UNITS_LENGTH);
 | 
			
		||||
	public final static TypedKey<Double> PACKED_DIAMETER = new TypedKey<Double>("PackedDiameter", Double.class, UnitGroup.UNITS_LENGTH);
 | 
			
		||||
	public final static TypedKey<Integer> LINE_COUNT = new TypedKey<Integer>("LineCount", Integer.class);
 | 
			
		||||
	public final static TypedKey<Double> LINE_LENGTH = new TypedKey<Double>("LineLength", Double.class, UnitGroup.UNITS_LENGTH);
 | 
			
		||||
	public final static TypedKey<Material> LINE_MATERIAL = new TypedKey<Material>("LineMaterial", Material.class);
 | 
			
		||||
@ -237,6 +243,11 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
 | 
			
		||||
			FILLED,
 | 
			
		||||
			DIAMETER,
 | 
			
		||||
			SIDES,
 | 
			
		||||
			/** DO NOT add new presets to this list without defining table.column
 | 
			
		||||
			PARACHUTE_CD,
 | 
			
		||||
			PACKED_LENGTH,
 | 
			
		||||
			PACKED_DIAMETER,
 | 
			
		||||
			*/
 | 
			
		||||
			LINE_COUNT,
 | 
			
		||||
			LINE_LENGTH,
 | 
			
		||||
			LINE_MATERIAL,
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,12 @@ public class ParachuteDTO extends BaseComponentDTO {
 | 
			
		||||
    private AnnotatedLengthDTO diameter;
 | 
			
		||||
    @XmlElement(name = "Sides")
 | 
			
		||||
    private Integer sides;
 | 
			
		||||
	@XmlElement(name = "PackedDiameter")
 | 
			
		||||
	private AnnotatedLengthDTO PackedDiameter;
 | 
			
		||||
	@XmlElement(name = "PackedLength")
 | 
			
		||||
	private AnnotatedLengthDTO PackedLength;
 | 
			
		||||
	@XmlElement(name = "DragCoefficient")
 | 
			
		||||
	private AnnotatedLengthDTO DragCoefficient;
 | 
			
		||||
    @XmlElement(name = "LineCount")
 | 
			
		||||
    private Integer lineCount;
 | 
			
		||||
    @XmlElement(name = "LineLength")
 | 
			
		||||
@ -57,6 +63,38 @@ public class ParachuteDTO extends BaseComponentDTO {
 | 
			
		||||
		this.sides = sides;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public double getPackedDiameter() {
 | 
			
		||||
		return PackedDiameter.getValue();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setPackedDiameter(AnnotatedLengthDTO PackedDiameter) {
 | 
			
		||||
		this.PackedDiameter = PackedDiameter;
 | 
			
		||||
	}
 | 
			
		||||
	public void setPackedDiameter(double PackedDiameter) {
 | 
			
		||||
		this.PackedDiameter = new AnnotatedLengthDTO(PackedDiameter);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public double getPackedLength() {
 | 
			
		||||
		return PackedLength.getValue();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setPackedLength(AnnotatedLengthDTO PackedLength) {
 | 
			
		||||
		this.PackedLength = PackedLength;
 | 
			
		||||
	}
 | 
			
		||||
	public void setPackedLength(double PackedLength) {
 | 
			
		||||
		this.PackedLength = new AnnotatedLengthDTO(PackedLength);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public double getDragCoefficient() {
 | 
			
		||||
		return DragCoefficient.getValue();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setDragCoefficient(AnnotatedLengthDTO DragCoefficient) {
 | 
			
		||||
		this.DragCoefficient = DragCoefficient;
 | 
			
		||||
	}
 | 
			
		||||
	public void setDragCoefficient(double DragCoefficient) { this.DragCoefficient = new AnnotatedLengthDTO(DragCoefficient); }
 | 
			
		||||
 | 
			
		||||
	public Integer getLineCount() {
 | 
			
		||||
		return lineCount;
 | 
			
		||||
	}
 | 
			
		||||
@ -102,6 +140,15 @@ public class ParachuteDTO extends BaseComponentDTO {
 | 
			
		||||
        if ( preset.has(ComponentPreset.SIDES)) {
 | 
			
		||||
        	setSides(preset.get(ComponentPreset.SIDES));
 | 
			
		||||
        }
 | 
			
		||||
		if ( preset.has(ComponentPreset.PACKED_DIAMETER)) {
 | 
			
		||||
			setPackedDiameter(preset.get(ComponentPreset.PACKED_DIAMETER));
 | 
			
		||||
		}
 | 
			
		||||
		if ( preset.has(ComponentPreset.PACKED_LENGTH)) {
 | 
			
		||||
			setPackedLength(preset.get(ComponentPreset.PACKED_LENGTH));
 | 
			
		||||
		}
 | 
			
		||||
		if ( preset.has(ComponentPreset.PARACHUTE_CD)) {
 | 
			
		||||
			setDragCoefficient(preset.get(ComponentPreset.PARACHUTE_CD));
 | 
			
		||||
		}
 | 
			
		||||
        if ( preset.has(ComponentPreset.LINE_MATERIAL)) {
 | 
			
		||||
        	setLineMaterial(new AnnotatedMaterialDTO(preset.get(ComponentPreset.LINE_MATERIAL)));
 | 
			
		||||
        }
 | 
			
		||||
@ -120,6 +167,15 @@ public class ParachuteDTO extends BaseComponentDTO {
 | 
			
		||||
        // need to fix the MATERIAL packed into the componentpreset.
 | 
			
		||||
        props.put(ComponentPreset.TYPE, type);
 | 
			
		||||
        props.put(ComponentPreset.DIAMETER, this.getDiameter());
 | 
			
		||||
		if ( this.PackedDiameter != null ) {
 | 
			
		||||
			props.put(ComponentPreset.PACKED_DIAMETER, this.getPackedDiameter());
 | 
			
		||||
		}
 | 
			
		||||
		if ( this.PackedLength != null ) {
 | 
			
		||||
			props.put(ComponentPreset.PACKED_LENGTH, this.getPackedLength());
 | 
			
		||||
		}
 | 
			
		||||
		if ( this.PackedLength != null ) {
 | 
			
		||||
			props.put(ComponentPreset.PARACHUTE_CD, this.getDragCoefficient());
 | 
			
		||||
		}
 | 
			
		||||
        props.put(ComponentPreset.LINE_COUNT, this.getLineCount());
 | 
			
		||||
        if ( this.lineLength != null ) {
 | 
			
		||||
        	props.put(ComponentPreset.LINE_LENGTH, this.getLineLength());
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,8 @@ import net.sf.openrocket.rocketcomponent.position.AxialMethod;
 | 
			
		||||
 | 
			
		||||
public abstract class BodyComponent extends ExternalComponent {
 | 
			
		||||
 | 
			
		||||
	private double InnerRadius;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Default constructor.  Sets the relative position to POSITION_RELATIVE_AFTER,
 | 
			
		||||
	 * i.e. body components come after one another.
 | 
			
		||||
@ -82,4 +84,6 @@ public abstract class BodyComponent extends ExternalComponent {
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public double getInnerRadius() {
 | 
			
		||||
	return InnerRadius; }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,8 @@ import net.sf.openrocket.util.MathUtil;
 | 
			
		||||
 */
 | 
			
		||||
public abstract class MassObject extends InternalComponent {
 | 
			
		||||
	
 | 
			
		||||
	private double radius;
 | 
			
		||||
	protected double radius;
 | 
			
		||||
	private boolean autoRadius = false;
 | 
			
		||||
	
 | 
			
		||||
	private double radialPosition;
 | 
			
		||||
	private double radialDirection;
 | 
			
		||||
@ -66,12 +67,31 @@ public abstract class MassObject extends InternalComponent {
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	public final double getRadius() {
 | 
			
		||||
	public double getRadius() {
 | 
			
		||||
		if (autoRadius) {
 | 
			
		||||
			if (parent == null) {
 | 
			
		||||
				return radius;
 | 
			
		||||
			}
 | 
			
		||||
			if (parent instanceof NoseCone) {
 | 
			
		||||
				return ((NoseCone) parent).getAftRadius();
 | 
			
		||||
			} else if (parent instanceof Transition) {
 | 
			
		||||
				double foreRadius = ((Transition) parent).getForeRadius();
 | 
			
		||||
				double aftRadius = ((Transition) parent).getAftRadius();
 | 
			
		||||
				return (Math.max(foreRadius, aftRadius));
 | 
			
		||||
			} else if (parent instanceof BodyComponent) {
 | 
			
		||||
				return ((BodyComponent) parent).getInnerRadius();
 | 
			
		||||
			} else if (parent instanceof RingComponent) {
 | 
			
		||||
				return ((RingComponent) parent).getInnerRadius();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return radius;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public double getRadiusNoAuto() {
 | 
			
		||||
		return radius;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public final void setRadius(double radius) {
 | 
			
		||||
	public void setRadius(double radius) {
 | 
			
		||||
		radius = Math.max(radius, 0);
 | 
			
		||||
 | 
			
		||||
		for (RocketComponent listener : configListeners) {
 | 
			
		||||
@ -80,14 +100,32 @@ public abstract class MassObject extends InternalComponent {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (MathUtil.equals(this.radius, radius)) {
 | 
			
		||||
		if (MathUtil.equals(this.radius, radius) && (!autoRadius))
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		this.autoRadius = false;
 | 
			
		||||
		this.radius = radius;
 | 
			
		||||
		fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public boolean isRadiusAutomatic() {
 | 
			
		||||
		return autoRadius;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setRadiusAutomatic(boolean auto) {
 | 
			
		||||
		for (RocketComponent listener : configListeners) {
 | 
			
		||||
			if (listener instanceof Parachute) {
 | 
			
		||||
				((Parachute) listener).setRadiusAutomatic(auto);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (autoRadius == auto)
 | 
			
		||||
			return;
 | 
			
		||||
 | 
			
		||||
		autoRadius = auto;
 | 
			
		||||
 | 
			
		||||
		fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public final double getRadialPosition() {
 | 
			
		||||
		return radialPosition;
 | 
			
		||||
 | 
			
		||||
@ -10,19 +10,19 @@ import net.sf.openrocket.util.MathUtil;
 | 
			
		||||
public class Parachute extends RecoveryDevice {
 | 
			
		||||
	private static final Translator trans = Application.getTranslator();
 | 
			
		||||
	
 | 
			
		||||
	public static final double DEFAULT_CD = 0.8;
 | 
			
		||||
	public static double DEFAULT_CD = 0.8;
 | 
			
		||||
	
 | 
			
		||||
	private double diameter;
 | 
			
		||||
	private final double InitialPackedLength = this.length;
 | 
			
		||||
	private final double InitialPackedRadius = this.radius;
 | 
			
		||||
 | 
			
		||||
	private Material lineMaterial;
 | 
			
		||||
	private int lineCount = 6;
 | 
			
		||||
	private double lineLength = 0.3;
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	public Parachute() {
 | 
			
		||||
		this.diameter = 0.3;
 | 
			
		||||
		this.lineMaterial = Application.getPreferences().getDefaultComponentMaterial(Parachute.class, Material.Type.LINE);
 | 
			
		||||
		this.lineLength = 0.3;
 | 
			
		||||
		super.displayOrder_side = 11;		// Order for displaying the component in the 2D side view
 | 
			
		||||
		super.displayOrder_back = 9;		// Order for displaying the component in the 2D back view
 | 
			
		||||
	}
 | 
			
		||||
@ -159,9 +159,93 @@ public class Parachute extends RecoveryDevice {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void loadFromPreset(ComponentPreset preset) {
 | 
			
		||||
 | 
			
		||||
		// BEGIN Substitute parachute description for component name
 | 
			
		||||
		if (preset.has(ComponentPreset.DESCRIPTION)) {
 | 
			
		||||
			String temporaryName = preset.get(ComponentPreset.DESCRIPTION);
 | 
			
		||||
			int size = temporaryName.length();
 | 
			
		||||
			if (size > 0) {
 | 
			
		||||
				this.name = preset.get(ComponentPreset.DESCRIPTION);
 | 
			
		||||
			} else {
 | 
			
		||||
				this.name = getComponentName();
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			this.name = getComponentName();
 | 
			
		||||
		}
 | 
			
		||||
		// END Substitute parachute description for component name
 | 
			
		||||
 | 
			
		||||
		if (preset.has(ComponentPreset.DIAMETER)) {
 | 
			
		||||
			this.diameter = preset.get(ComponentPreset.DIAMETER);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		 // BEGIN Implement parachute cd
 | 
			
		||||
		 if (preset.has(ComponentPreset.PARACHUTE_CD)) {
 | 
			
		||||
			 if (preset.get(ComponentPreset.PARACHUTE_CD) > 0) {
 | 
			
		||||
		 		cdAutomatic = false;
 | 
			
		||||
		 		cd = preset.get(ComponentPreset.PARACHUTE_CD);
 | 
			
		||||
		 		}
 | 
			
		||||
			 else {
 | 
			
		||||
				 cdAutomatic = true;
 | 
			
		||||
				 cd = Parachute.DEFAULT_CD;
 | 
			
		||||
		 		}
 | 
			
		||||
		 } else {
 | 
			
		||||
			 cdAutomatic = true;
 | 
			
		||||
			 cd = Parachute.DEFAULT_CD;
 | 
			
		||||
		 }
 | 
			
		||||
		 // END Implement parachute cd
 | 
			
		||||
 | 
			
		||||
		// BEGIN Implement parachute length, diameter, and volume
 | 
			
		||||
		//// BEGIN Implement parachute packed length
 | 
			
		||||
		if (preset.has(ComponentPreset.PACKED_LENGTH)) {
 | 
			
		||||
			this.PackedLength = preset.get(ComponentPreset.PACKED_LENGTH);
 | 
			
		||||
			if (PackedLength > 0) {
 | 
			
		||||
				length = PackedLength;
 | 
			
		||||
			}
 | 
			
		||||
			if (PackedLength <= 0) {
 | 
			
		||||
				length = InitialPackedLength;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			length = InitialPackedLength;
 | 
			
		||||
		}
 | 
			
		||||
		//// END Implement parachute packed length
 | 
			
		||||
		//// BEGIN Implement parachute packed diameter
 | 
			
		||||
		if (preset.has(ComponentPreset.PACKED_DIAMETER)) {
 | 
			
		||||
			this.PackedDiameter = preset.get(ComponentPreset.PACKED_DIAMETER);
 | 
			
		||||
			if (PackedDiameter > 0) {
 | 
			
		||||
				radius = PackedDiameter / 2;
 | 
			
		||||
			}
 | 
			
		||||
			if (PackedDiameter <= 0) {
 | 
			
		||||
				radius = InitialPackedRadius;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			radius = InitialPackedRadius;
 | 
			
		||||
	}
 | 
			
		||||
		//// END Implement parachute packed diameter
 | 
			
		||||
		//// BEGIN Size parachute packed diameter within parent inner diameter
 | 
			
		||||
		if (length > 0 && radius > 0) {
 | 
			
		||||
			double parachuteVolume = (Math.PI * Math.pow(radius, 2) * length);
 | 
			
		||||
			setRadiusAutomatic(true);
 | 
			
		||||
			length = parachuteVolume / (Math.PI * Math.pow(getRadius(), 2));
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		//// END Size parachute packed diameter within parent inner diameter
 | 
			
		||||
		// END Implement parachute length, diameter, and volume
 | 
			
		||||
 | 
			
		||||
		// BEGIN Activate Override Mass Preset
 | 
			
		||||
		if (preset.has(ComponentPreset.MASS)) {
 | 
			
		||||
			this.overrideMass = (preset.get(ComponentPreset.MASS));
 | 
			
		||||
			if (overrideMass > 0) {
 | 
			
		||||
				massOverridden = true;
 | 
			
		||||
			} else {
 | 
			
		||||
				this.overrideMass = 0;
 | 
			
		||||
				massOverridden = false;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			this.overrideMass = 0;
 | 
			
		||||
			massOverridden = false;
 | 
			
		||||
		}
 | 
			
		||||
		// END Activate Override Mass Preset
 | 
			
		||||
 | 
			
		||||
		if (preset.has(ComponentPreset.LINE_COUNT)) {
 | 
			
		||||
			this.lineCount = preset.get(ComponentPreset.LINE_COUNT);
 | 
			
		||||
		}
 | 
			
		||||
@ -174,10 +258,8 @@ public class Parachute extends RecoveryDevice {
 | 
			
		||||
		super.loadFromPreset(preset);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Type getPresetType() {
 | 
			
		||||
		return ComponentPreset.Type.PARACHUTE;
 | 
			
		||||
		return Type.PARACHUTE;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -19,9 +19,13 @@ import net.sf.openrocket.util.MathUtil;
 | 
			
		||||
 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
 | 
			
		||||
 */
 | 
			
		||||
public abstract class RecoveryDevice extends MassObject implements FlightConfigurableComponent {
 | 
			
		||||
	
 | 
			
		||||
	private double cd = Parachute.DEFAULT_CD;
 | 
			
		||||
	private boolean cdAutomatic = true;
 | 
			
		||||
	////
 | 
			
		||||
	protected double DragCoefficient;
 | 
			
		||||
	protected double PackedDiameter;
 | 
			
		||||
	protected double PackedLength;
 | 
			
		||||
	////
 | 
			
		||||
	protected double cd = Parachute.DEFAULT_CD;
 | 
			
		||||
	protected boolean cdAutomatic = true;
 | 
			
		||||
	
 | 
			
		||||
	private Material.Surface material;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
@ -97,8 +97,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	// Override mass/CG
 | 
			
		||||
	private double overrideMass = 0;
 | 
			
		||||
	private boolean massOverridden = false;
 | 
			
		||||
    protected double overrideMass = 0;
 | 
			
		||||
	protected boolean massOverridden = false;
 | 
			
		||||
	private double overrideCGX = 0;
 | 
			
		||||
	private boolean cgOverridden = false;
 | 
			
		||||
	private double overrideCD = 0;
 | 
			
		||||
@ -108,7 +108,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	// User-given name of the component
 | 
			
		||||
	private String name = null;
 | 
			
		||||
    protected String name = null;
 | 
			
		||||
	
 | 
			
		||||
	// User-specified comment
 | 
			
		||||
	private String comment = "";
 | 
			
		||||
 | 
			
		||||
@ -58,7 +58,7 @@ public class Streamer extends RecoveryDevice {
 | 
			
		||||
		if (MathUtil.equals(this.stripWidth, stripWidth))
 | 
			
		||||
			return;
 | 
			
		||||
		this.stripWidth = stripWidth;
 | 
			
		||||
		this.length = stripWidth;
 | 
			
		||||
 | 
			
		||||
		clearPreset();
 | 
			
		||||
		fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JCheckBox;
 | 
			
		||||
import javax.swing.JComboBox;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
@ -106,6 +107,11 @@ public class MassComponentConfig extends RocketComponentConfig {
 | 
			
		||||
		panel.add(new UnitSelector(od), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
 | 
			
		||||
 | 
			
		||||
		////// Automatic
 | 
			
		||||
		JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
 | 
			
		||||
		checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
 | 
			
		||||
		panel.add(checkAutoPackedRadius, "skip, span 2, wrap 30lp");
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		////  Position
 | 
			
		||||
		//// Position relative to:
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,7 @@ import java.awt.event.ActionListener;
 | 
			
		||||
 | 
			
		||||
import javax.swing.ComboBoxModel;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JCheckBox;
 | 
			
		||||
import javax.swing.JComboBox;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
@ -30,6 +31,7 @@ import net.sf.openrocket.rocketcomponent.DeploymentConfiguration;
 | 
			
		||||
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
 | 
			
		||||
import net.sf.openrocket.rocketcomponent.Parachute;
 | 
			
		||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
 | 
			
		||||
import net.sf.openrocket.rocketcomponent.Transition;
 | 
			
		||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
 | 
			
		||||
import net.sf.openrocket.startup.Application;
 | 
			
		||||
import net.sf.openrocket.unit.UnitGroup;
 | 
			
		||||
@ -177,7 +179,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		//// Packed diameter:
 | 
			
		||||
		panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Packeddiam")));
 | 
			
		||||
		
 | 
			
		||||
		DoubleModel od = new DoubleModel(component, "Radius", 2, UnitGroup.UNITS_LENGTH, 0);
 | 
			
		||||
		final DoubleModel od = new DoubleModel(component, "Radius", 2, UnitGroup.UNITS_LENGTH, 0);
 | 
			
		||||
		// Diameter = 2*Radius
 | 
			
		||||
		
 | 
			
		||||
		spin = new JSpinner(od.getSpinnerModel());
 | 
			
		||||
@ -185,7 +187,12 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(od), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap 30lp");
 | 
			
		||||
		panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
 | 
			
		||||
 | 
			
		||||
		////// Automatic
 | 
			
		||||
		JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
 | 
			
		||||
		checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
 | 
			
		||||
		panel.add(checkAutoPackedRadius, "skip, span 2, wrap 30lp");
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		//// Deployment
 | 
			
		||||
 | 
			
		||||
@ -113,7 +113,10 @@ public class ShockCordConfig extends RocketComponentConfig {
 | 
			
		||||
		panel2.add(new UnitSelector(od), "growx");
 | 
			
		||||
		panel2.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		////// Automatic
 | 
			
		||||
		JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
 | 
			
		||||
		checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
 | 
			
		||||
		panel2.add(checkAutoPackedRadius, "skip, span 2, wrap");
 | 
			
		||||
 | 
			
		||||
		//// General and General properties
 | 
			
		||||
		tabbedPane.insertTab(trans.get("ShockCordCfg.tab.General"), null, panel,
 | 
			
		||||
 | 
			
		||||
@ -160,7 +160,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
				"w 100lp, wrap");
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		////  Spatial length:
 | 
			
		||||
		////  Packed length:
 | 
			
		||||
		panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packedlength")));
 | 
			
		||||
		
 | 
			
		||||
		m = new DoubleModel(component, "Length", UnitGroup.UNITS_LENGTH, 0);
 | 
			
		||||
@ -185,7 +185,12 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(od), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap 30lp");
 | 
			
		||||
		panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
 | 
			
		||||
 | 
			
		||||
		////// Automatic
 | 
			
		||||
		JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
 | 
			
		||||
		checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
 | 
			
		||||
		panel.add(checkAutoPackedRadius, "skip, span 2, wrap 30lp");
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		//// Deployment
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user