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(
|
setters.put("MassObject:packedlength", new DoubleSetter(
|
||||||
Reflection.findMethod(MassObject.class, "setLength", double.class)));
|
Reflection.findMethod(MassObject.class, "setLength", double.class)));
|
||||||
setters.put("MassObject:packedradius", new DoubleSetter(
|
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(
|
setters.put("MassObject:radialposition", new DoubleSetter(
|
||||||
Reflection.findMethod(MassObject.class, "setRadialPosition", double.class)));
|
Reflection.findMethod(MassObject.class, "setRadialPosition", double.class)));
|
||||||
setters.put("MassObject:radialdirection", new DoubleSetter(
|
setters.put("MassObject:radialdirection", new DoubleSetter(
|
||||||
|
@ -14,7 +14,11 @@ public class MassObjectSaver extends InternalComponentSaver {
|
|||||||
MassObject mass = (MassObject) c;
|
MassObject mass = (MassObject) c;
|
||||||
|
|
||||||
elements.add("<packedlength>" + mass.getLength() + "</packedlength>");
|
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("<radialposition>" + mass.getRadialPosition() + "</radialposition>");
|
||||||
elements.add("<radialdirection>" + (mass.getRadialDirection() * 180.0 / Math.PI)
|
elements.add("<radialdirection>" + (mass.getRadialDirection() * 180.0 / Math.PI)
|
||||||
+ "</radialdirection>");
|
+ "</radialdirection>");
|
||||||
|
@ -153,6 +153,9 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
|
|||||||
ComponentPreset.DESCRIPTION,
|
ComponentPreset.DESCRIPTION,
|
||||||
ComponentPreset.DIAMETER,
|
ComponentPreset.DIAMETER,
|
||||||
ComponentPreset.SIDES,
|
ComponentPreset.SIDES,
|
||||||
|
ComponentPreset.PARACHUTE_CD,
|
||||||
|
ComponentPreset.PACKED_DIAMETER,
|
||||||
|
ComponentPreset.PACKED_LENGTH,
|
||||||
ComponentPreset.LINE_COUNT,
|
ComponentPreset.LINE_COUNT,
|
||||||
ComponentPreset.LINE_LENGTH,
|
ComponentPreset.LINE_LENGTH,
|
||||||
ComponentPreset.LINE_MATERIAL,
|
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> 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<Double> DIAMETER = new TypedKey<Double>("Diameter", Double.class, UnitGroup.UNITS_LENGTH);
|
||||||
public final static TypedKey<Integer> SIDES = new TypedKey<Integer>("Sides", Integer.class);
|
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<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<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);
|
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,
|
FILLED,
|
||||||
DIAMETER,
|
DIAMETER,
|
||||||
SIDES,
|
SIDES,
|
||||||
|
/** DO NOT add new presets to this list without defining table.column
|
||||||
|
PARACHUTE_CD,
|
||||||
|
PACKED_LENGTH,
|
||||||
|
PACKED_DIAMETER,
|
||||||
|
*/
|
||||||
LINE_COUNT,
|
LINE_COUNT,
|
||||||
LINE_LENGTH,
|
LINE_LENGTH,
|
||||||
LINE_MATERIAL,
|
LINE_MATERIAL,
|
||||||
|
@ -23,6 +23,12 @@ public class ParachuteDTO extends BaseComponentDTO {
|
|||||||
private AnnotatedLengthDTO diameter;
|
private AnnotatedLengthDTO diameter;
|
||||||
@XmlElement(name = "Sides")
|
@XmlElement(name = "Sides")
|
||||||
private Integer 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")
|
@XmlElement(name = "LineCount")
|
||||||
private Integer lineCount;
|
private Integer lineCount;
|
||||||
@XmlElement(name = "LineLength")
|
@XmlElement(name = "LineLength")
|
||||||
@ -57,6 +63,38 @@ public class ParachuteDTO extends BaseComponentDTO {
|
|||||||
this.sides = sides;
|
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() {
|
public Integer getLineCount() {
|
||||||
return lineCount;
|
return lineCount;
|
||||||
}
|
}
|
||||||
@ -102,6 +140,15 @@ public class ParachuteDTO extends BaseComponentDTO {
|
|||||||
if ( preset.has(ComponentPreset.SIDES)) {
|
if ( preset.has(ComponentPreset.SIDES)) {
|
||||||
setSides(preset.get(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)) {
|
if ( preset.has(ComponentPreset.LINE_MATERIAL)) {
|
||||||
setLineMaterial(new AnnotatedMaterialDTO(preset.get(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.
|
// need to fix the MATERIAL packed into the componentpreset.
|
||||||
props.put(ComponentPreset.TYPE, type);
|
props.put(ComponentPreset.TYPE, type);
|
||||||
props.put(ComponentPreset.DIAMETER, this.getDiameter());
|
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());
|
props.put(ComponentPreset.LINE_COUNT, this.getLineCount());
|
||||||
if ( this.lineLength != null ) {
|
if ( this.lineLength != null ) {
|
||||||
props.put(ComponentPreset.LINE_LENGTH, this.getLineLength());
|
props.put(ComponentPreset.LINE_LENGTH, this.getLineLength());
|
||||||
|
@ -17,7 +17,9 @@ import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class BodyComponent extends ExternalComponent {
|
public abstract class BodyComponent extends ExternalComponent {
|
||||||
|
|
||||||
|
private double InnerRadius;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Sets the relative position to POSITION_RELATIVE_AFTER,
|
* Default constructor. Sets the relative position to POSITION_RELATIVE_AFTER,
|
||||||
* i.e. body components come after one another.
|
* i.e. body components come after one another.
|
||||||
@ -81,5 +83,7 @@ public abstract class BodyComponent extends ExternalComponent {
|
|||||||
public boolean allowsChildren() {
|
public boolean allowsChildren() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getInnerRadius() {
|
||||||
|
return InnerRadius; }
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ import net.sf.openrocket.util.MathUtil;
|
|||||||
*/
|
*/
|
||||||
public abstract class MassObject extends InternalComponent {
|
public abstract class MassObject extends InternalComponent {
|
||||||
|
|
||||||
private double radius;
|
protected double radius;
|
||||||
|
private boolean autoRadius = false;
|
||||||
|
|
||||||
private double radialPosition;
|
private double radialPosition;
|
||||||
private double radialDirection;
|
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;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRadius(double radius) {
|
||||||
public final void setRadius(double radius) {
|
|
||||||
radius = Math.max(radius, 0);
|
radius = Math.max(radius, 0);
|
||||||
|
|
||||||
for (RocketComponent listener : configListeners) {
|
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;
|
return;
|
||||||
}
|
|
||||||
|
this.autoRadius = false;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
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() {
|
public final double getRadialPosition() {
|
||||||
return radialPosition;
|
return radialPosition;
|
||||||
|
@ -10,19 +10,19 @@ import net.sf.openrocket.util.MathUtil;
|
|||||||
public class Parachute extends RecoveryDevice {
|
public class Parachute extends RecoveryDevice {
|
||||||
private static final Translator trans = Application.getTranslator();
|
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 double diameter;
|
||||||
|
private final double InitialPackedLength = this.length;
|
||||||
|
private final double InitialPackedRadius = this.radius;
|
||||||
|
|
||||||
private Material lineMaterial;
|
private Material lineMaterial;
|
||||||
private int lineCount = 6;
|
private int lineCount = 6;
|
||||||
private double lineLength = 0.3;
|
private double lineLength = 0.3;
|
||||||
|
|
||||||
|
|
||||||
public Parachute() {
|
public Parachute() {
|
||||||
this.diameter = 0.3;
|
this.diameter = 0.3;
|
||||||
this.lineMaterial = Application.getPreferences().getDefaultComponentMaterial(Parachute.class, Material.Type.LINE);
|
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_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
|
super.displayOrder_back = 9; // Order for displaying the component in the 2D back view
|
||||||
}
|
}
|
||||||
@ -159,25 +159,107 @@ public class Parachute extends RecoveryDevice {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFromPreset(ComponentPreset preset) {
|
protected void loadFromPreset(ComponentPreset preset) {
|
||||||
if( preset.has( ComponentPreset.DIAMETER )) {
|
|
||||||
this.diameter = preset.get( ComponentPreset.DIAMETER );
|
// 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();
|
||||||
}
|
}
|
||||||
if( preset.has( ComponentPreset.LINE_COUNT )) {
|
// END Substitute parachute description for component name
|
||||||
this.lineCount = preset.get( ComponentPreset.LINE_COUNT );
|
|
||||||
|
if (preset.has(ComponentPreset.DIAMETER)) {
|
||||||
|
this.diameter = preset.get(ComponentPreset.DIAMETER);
|
||||||
}
|
}
|
||||||
if( preset.has( ComponentPreset.LINE_LENGTH )) {
|
|
||||||
this.lineLength = preset.get( ComponentPreset.LINE_LENGTH );
|
// 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;
|
||||||
}
|
}
|
||||||
if( preset.has( ComponentPreset.LINE_MATERIAL )) {
|
//// END Implement parachute packed length
|
||||||
this.lineMaterial = preset.get( ComponentPreset.LINE_MATERIAL );
|
//// 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);
|
||||||
|
}
|
||||||
|
if (preset.has(ComponentPreset.LINE_LENGTH)) {
|
||||||
|
this.lineLength = preset.get(ComponentPreset.LINE_LENGTH);
|
||||||
|
}
|
||||||
|
if (preset.has(ComponentPreset.LINE_MATERIAL)) {
|
||||||
|
this.lineMaterial = preset.get(ComponentPreset.LINE_MATERIAL);
|
||||||
}
|
}
|
||||||
super.loadFromPreset(preset);
|
super.loadFromPreset(preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getPresetType() {
|
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>
|
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||||
*/
|
*/
|
||||||
public abstract class RecoveryDevice extends MassObject implements FlightConfigurableComponent {
|
public abstract class RecoveryDevice extends MassObject implements FlightConfigurableComponent {
|
||||||
|
////
|
||||||
private double cd = Parachute.DEFAULT_CD;
|
protected double DragCoefficient;
|
||||||
private boolean cdAutomatic = true;
|
protected double PackedDiameter;
|
||||||
|
protected double PackedLength;
|
||||||
|
////
|
||||||
|
protected double cd = Parachute.DEFAULT_CD;
|
||||||
|
protected boolean cdAutomatic = true;
|
||||||
|
|
||||||
private Material.Surface material;
|
private Material.Surface material;
|
||||||
|
|
||||||
|
@ -90,15 +90,15 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
|||||||
* Defaults to (0,0,0)
|
* Defaults to (0,0,0)
|
||||||
*/
|
*/
|
||||||
protected Coordinate position = new Coordinate();
|
protected Coordinate position = new Coordinate();
|
||||||
|
|
||||||
// Color of the component, null means to use the default color
|
// Color of the component, null means to use the default color
|
||||||
private Color color = null;
|
private Color color = null;
|
||||||
private LineStyle lineStyle = null;
|
private LineStyle lineStyle = null;
|
||||||
|
|
||||||
|
|
||||||
// Override mass/CG
|
// Override mass/CG
|
||||||
private double overrideMass = 0;
|
protected double overrideMass = 0;
|
||||||
private boolean massOverridden = false;
|
protected boolean massOverridden = false;
|
||||||
private double overrideCGX = 0;
|
private double overrideCGX = 0;
|
||||||
private boolean cgOverridden = false;
|
private boolean cgOverridden = false;
|
||||||
private double overrideCD = 0;
|
private double overrideCD = 0;
|
||||||
@ -108,7 +108,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
|||||||
|
|
||||||
|
|
||||||
// User-given name of the component
|
// User-given name of the component
|
||||||
private String name = null;
|
protected String name = null;
|
||||||
|
|
||||||
// User-specified comment
|
// User-specified comment
|
||||||
private String comment = "";
|
private String comment = "";
|
||||||
|
@ -58,7 +58,7 @@ public class Streamer extends RecoveryDevice {
|
|||||||
if (MathUtil.equals(this.stripWidth, stripWidth))
|
if (MathUtil.equals(this.stripWidth, stripWidth))
|
||||||
return;
|
return;
|
||||||
this.stripWidth = stripWidth;
|
this.stripWidth = stripWidth;
|
||||||
this.length = stripWidth;
|
|
||||||
clearPreset();
|
clearPreset();
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
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;
|
||||||
@ -105,7 +106,12 @@ public class MassComponentConfig extends RocketComponentConfig {
|
|||||||
|
|
||||||
panel.add(new UnitSelector(od), "growx");
|
panel.add(new UnitSelector(od), "growx");
|
||||||
panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
|
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
|
||||||
//// Position relative to:
|
//// Position relative to:
|
||||||
|
@ -6,6 +6,7 @@ import java.awt.event.ActionListener;
|
|||||||
|
|
||||||
import javax.swing.ComboBoxModel;
|
import javax.swing.ComboBoxModel;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
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;
|
||||||
@ -30,6 +31,7 @@ import net.sf.openrocket.rocketcomponent.DeploymentConfiguration;
|
|||||||
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
|
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
|
||||||
import net.sf.openrocket.rocketcomponent.Parachute;
|
import net.sf.openrocket.rocketcomponent.Parachute;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
|
import net.sf.openrocket.rocketcomponent.Transition;
|
||||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
@ -177,7 +179,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
|
|||||||
//// Packed diameter:
|
//// Packed diameter:
|
||||||
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Packeddiam")));
|
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
|
// Diameter = 2*Radius
|
||||||
|
|
||||||
spin = new JSpinner(od.getSpinnerModel());
|
spin = new JSpinner(od.getSpinnerModel());
|
||||||
@ -185,7 +187,12 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
|
|||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
|
||||||
panel.add(new UnitSelector(od), "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
|
//// Deployment
|
||||||
|
@ -112,8 +112,11 @@ public class ShockCordConfig extends RocketComponentConfig {
|
|||||||
|
|
||||||
panel2.add(new UnitSelector(od), "growx");
|
panel2.add(new UnitSelector(od), "growx");
|
||||||
panel2.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
|
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
|
//// General and General properties
|
||||||
tabbedPane.insertTab(trans.get("ShockCordCfg.tab.General"), null, panel,
|
tabbedPane.insertTab(trans.get("ShockCordCfg.tab.General"), null, panel,
|
||||||
|
@ -160,7 +160,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
|
|||||||
"w 100lp, wrap");
|
"w 100lp, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Spatial length:
|
//// Packed length:
|
||||||
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packedlength")));
|
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packedlength")));
|
||||||
|
|
||||||
m = new DoubleModel(component, "Length", UnitGroup.UNITS_LENGTH, 0);
|
m = new DoubleModel(component, "Length", UnitGroup.UNITS_LENGTH, 0);
|
||||||
@ -185,8 +185,13 @@ public class StreamerConfig extends RecoveryDeviceConfig {
|
|||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
|
||||||
panel.add(new UnitSelector(od), "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
|
//// Deployment
|
||||||
//// Deploys at:
|
//// Deploys at:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user