Merge pull request #1347 from hcraigmiller/Preparation-for-Spill-Hole-Inclusion

Adds additional presets for use in .orc files without throwing errors
This commit is contained in:
SiboVG 2022-05-18 00:37:42 +02:00 committed by GitHub
commit b9f758b095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 46 deletions

View File

@ -1075,8 +1075,12 @@ NoseConeCfg.tab.Shoulder = Shoulder
NoseConeCfg.tab.ttip.Shoulder = Shoulder properties
! ParachuteConfig
Parachute.Parachute = Parachute
ParachuteCfg.lbl.Canopy = Canopy:
ParachuteCfg.lbl.CanopyShape = Canopy shape:
ParachuteCfg.lbl.Diameter = Diameter:
ParachuteCfg.lbl.SpillDia = Spill hole diameter:
ParachuteCfg.lbl.SurfaceArea = Surface area:
ParachuteCfg.combo.MaterialModel = The component material affects the weight of the component.
ParachuteCfg.lbl.longA1 = <html>Drag coefficient C<sub>D</sub>:
ParachuteCfg.lbl.longB1 = <html>The drag coefficient relative to the total area of the parachute.<br>
@ -1400,7 +1404,6 @@ material.mylar = Mylar
material.polyethylene_thin = Polyethylene (thin)
material.polyethylene_heavy = Polyethylene (heavy)
material.silk = Silk
material.paper_office = Paper (office)
material.cellophane = Cellophane
material.crepe_paper = Cr\u00eape paper
! LINE_MATERIAL
@ -1521,8 +1524,7 @@ MassComponent.Tracker = Tracker
MassComponent.Payload = Payload
MassComponent.RecoveryHardware = Recovery Hardware
MassComponent.Battery = Battery
! Parachute
Parachute.Parachute = Parachute
! ShockCord
ShockCord.ShockCord = Shock Cord
! Bulkhead

View File

@ -151,15 +151,18 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
ComponentPreset.MANUFACTURER,
ComponentPreset.PARTNO,
ComponentPreset.DESCRIPTION,
ComponentPreset.CANOPY_SHAPE,
ComponentPreset.DIAMETER,
ComponentPreset.SPILL_DIA,
ComponentPreset.SURFACE_AREA,
ComponentPreset.MATERIAL,
ComponentPreset.SIDES,
ComponentPreset.PARACHUTE_CD,
ComponentPreset.PACKED_DIAMETER,
ComponentPreset.PACKED_LENGTH,
ComponentPreset.LINE_COUNT,
ComponentPreset.LINE_LENGTH,
ComponentPreset.LINE_MATERIAL,
ComponentPreset.MATERIAL });
ComponentPreset.PARACHUTE_CD,
ComponentPreset.PACKED_DIAMETER,
ComponentPreset.PACKED_LENGTH });
TypedKey<?>[] displayedColumns;
@ -210,18 +213,30 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
public final static TypedKey<Boolean> FILLED = new TypedKey<Boolean>("Filled", Boolean.class);
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);
public final static TypedKey<byte[]> IMAGE = new TypedKey<byte[]>("Image", byte[].class);
public final static TypedKey<Double> STANDOFF_HEIGHT = new TypedKey<Double>("StandoffHeight", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Double> FLANGE_HEIGHT = new TypedKey<Double>("FlangeHeight", Double.class, UnitGroup.UNITS_LENGTH);
// PARACHUTE SPECIFIC
// Parachute Manufacturer declaration see: MANUFACTURER
// Parachute Part Number declaration see: PARTNO
// Parachute Description declaration see: DESCRIPTION
public final static TypedKey<Shape> CANOPY_SHAPE = new TypedKey<Shape>("CanopyShape", Shape.class);
// Parachute diameter declaration see: DIAMETER
public final static TypedKey<Double> SPILL_DIA = new TypedKey<Double>("SpillDia", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Double> SURFACE_AREA = new TypedKey<Double>("SurfaceArea", Double.class, UnitGroup.UNITS_LENGTH);
public static final TypedKey<Double> PARACHUTE_CD = new TypedKey<Double>("DragCoefficient", Double.class, UnitGroup.UNITS_COEFFICIENT);
// Parachute canopy material declaration see: MATERIAL
public final static TypedKey<Integer> SIDES = new TypedKey<Integer>("Sides", 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<Material> LINE_MATERIAL = new TypedKey<Material>("LineMaterial", Material.class);
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);
// Parachute Mass declaration see: MASS
public final static List<TypedKey<?>> ORDERED_KEY_LIST = Collections.unmodifiableList(Arrays.asList(
// DO NOT add to this list without redefining table.column
LEGACY,
MANUFACTURER,
PARTNO,
@ -243,11 +258,6 @@ 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,

View File

@ -188,13 +188,20 @@ public class PresetEditorDialog extends JDialog implements ItemListener {
private DoubleModel stMass;
private ImageIcon stImage;
private JButton stImageBtn;
// Parachute Specific
private JTextField pcPartNoTextField;
private JTextField pcDescTextField;
private DoubleModel pcDiameter;
private DoubleModel pcSpillDia;
private DoubleModel pcSurfaceArea;
private DoubleModel pcDragCoefficient;
// Canopy material = private MaterialChooser materialChooser;
private JTextField pcSides;
private JTextField pcLineCount;
private DoubleModel pcDiameter;
private DoubleModel pcLineLength;
private DoubleModel pcPackedLength;
private DoubleModel pcPackedDiameter;
private MaterialChooser pcLineMaterialChooser;
private DoubleModel pcMass;
private ImageIcon pcImage;
@ -1597,34 +1604,46 @@ public class PresetEditorDialog extends JDialog implements ItemListener {
case PARACHUTE:
setMaterial(materialChooser, preset, matHolder, Material.Type.SURFACE, ComponentPreset.MATERIAL);
typeCombo.setSelectedItem(trans.get(PARACHUTE_KEY));
pcPartNoTextField.setText(preset.get(ComponentPreset.PARTNO));
pcDescTextField.setText(preset.get(ComponentPreset.DESCRIPTION));
if (preset.has(ComponentPreset.LINE_COUNT)) {
pcLineCount.setText(preset.get(ComponentPreset.LINE_COUNT).toString());
}
if (preset.has(ComponentPreset.SIDES)) {
pcSides.setText(preset.get(ComponentPreset.SIDES).toString());
}
if (preset.has(ComponentPreset.MASS)) {
pcMass.setValue(preset.get(ComponentPreset.MASS));
pcMass.setCurrentUnit(UnitGroup.UNITS_MASS.getDefaultUnit());
}
if (preset.has(ComponentPreset.DIAMETER)) {
pcDiameter.setValue(preset.get(ComponentPreset.DIAMETER));
pcDiameter.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
}
if (preset.has(ComponentPreset.PARACHUTE_CD)) {
pcDragCoefficient.setValue(preset.get(ComponentPreset.PARACHUTE_CD));
pcDragCoefficient.setCurrentUnit(UnitGroup.UNITS_COEFFICIENT.getDefaultUnit());
}
setMaterial(materialChooser, preset, matHolder, Material.Type.SURFACE, ComponentPreset.MATERIAL);
if (preset.has(ComponentPreset.SIDES)) {
pcSides.setText(preset.get(ComponentPreset.SIDES).toString());
}
if (preset.has(ComponentPreset.LINE_COUNT)) {
pcLineCount.setText(preset.get(ComponentPreset.LINE_COUNT).toString());
}
if (preset.has(ComponentPreset.LINE_LENGTH)) {
pcLineLength.setValue(preset.get(ComponentPreset.LINE_LENGTH));
pcLineLength.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
}
pcPartNoTextField.setText(preset.get(ComponentPreset.PARTNO));
setMaterial(pcLineMaterialChooser, preset, matHolder, Material.Type.LINE, ComponentPreset.LINE_MATERIAL);
// pcLineMaterialChooser.setModel(new MaterialModel(PresetEditorDialog.this, Material.Type.LINE));
// pcLineMaterialChooser.getModel().setSelectedItem(preset.get(ComponentPreset.LINE_MATERIAL));
if (preset.has(ComponentPreset.PACKED_LENGTH)) {
pcPackedLength.setValue(preset.get(ComponentPreset.PACKED_LENGTH));
pcPackedLength.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
}
if (preset.has(ComponentPreset.PACKED_DIAMETER)) {
pcPackedDiameter.setValue(preset.get(ComponentPreset.PACKED_DIAMETER));
pcPackedDiameter.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
}
if (preset.has(ComponentPreset.MASS)) {
pcMass.setValue(preset.get(ComponentPreset.MASS));
pcMass.setCurrentUnit(UnitGroup.UNITS_MASS.getDefaultUnit());
}
if (preset.has(ComponentPreset.IMAGE)) {
pcImage = new ImageIcon(byteArrayToImage(preset.get(ComponentPreset.IMAGE)));
pcImageBtn.setIcon(pcImage);
}
setMaterial(pcLineMaterialChooser, preset, matHolder, Material.Type.LINE, ComponentPreset.LINE_MATERIAL);
// pcLineMaterialChooser.setModel(new MaterialModel(PresetEditorDialog.this, Material.Type.LINE));
// pcLineMaterialChooser.getModel().setSelectedItem(preset.get(ComponentPreset.LINE_MATERIAL));
break;
case STREAMER:
setMaterial(materialChooser, preset, matHolder, Material.Type.SURFACE, ComponentPreset.MATERIAL);
@ -2157,17 +2176,10 @@ public class PresetEditorDialog extends JDialog implements ItemListener {
TypedPropertyMap props = new TypedPropertyMap();
try {
props.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
props.put(ComponentPreset.DIAMETER, pcDiameter.getValue());
props.put(ComponentPreset.DESCRIPTION, pcDescTextField.getText());
props.put(ComponentPreset.PARTNO, pcPartNoTextField.getText());
props.put(ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer(mfgTextField.getText()));
if (!pcLineCount.getText().equals("")) {
props.put(ComponentPreset.LINE_COUNT, Integer.parseInt(pcLineCount.getText()));
}
if (!pcSides.getText().equals("")) {
props.put(ComponentPreset.SIDES, Integer.parseInt(pcSides.getText()));
}
props.put(ComponentPreset.LINE_LENGTH, pcLineLength.getValue());
props.put(ComponentPreset.PARTNO, pcPartNoTextField.getText());
props.put(ComponentPreset.DESCRIPTION, pcDescTextField.getText());
props.put(ComponentPreset.PARACHUTE_CD, pcDragCoefficient.getValue());
Material material = (Material) materialChooser.getSelectedItem();
if (material != null) {
props.put(ComponentPreset.MATERIAL, material);
@ -2176,6 +2188,13 @@ public class PresetEditorDialog extends JDialog implements ItemListener {
JOptionPane.showMessageDialog(null, "A material must be selected.", "Error", JOptionPane.ERROR_MESSAGE);
return null;
}
if (!pcLineCount.getText().equals("")) {
props.put(ComponentPreset.LINE_COUNT, Integer.parseInt(pcLineCount.getText()));
}
if (!pcSides.getText().equals("")) {
props.put(ComponentPreset.SIDES, Integer.parseInt(pcSides.getText()));
}
props.put(ComponentPreset.LINE_LENGTH, pcLineLength.getValue());
material = (Material) pcLineMaterialChooser.getSelectedItem();
if (material != null) {
props.put(ComponentPreset.LINE_MATERIAL, material);