diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 44069ec92..3366c7044 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -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 = Drag coefficient CD: ParachuteCfg.lbl.longB1 = The drag coefficient relative to the total area of the parachute.
@@ -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 diff --git a/core/src/net/sf/openrocket/preset/ComponentPreset.java b/core/src/net/sf/openrocket/preset/ComponentPreset.java index 7309998f8..7e700d209 100644 --- a/core/src/net/sf/openrocket/preset/ComponentPreset.java +++ b/core/src/net/sf/openrocket/preset/ComponentPreset.java @@ -151,15 +151,18 @@ public class ComponentPreset implements Comparable, 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, Serializabl public final static TypedKey FILLED = new TypedKey("Filled", Boolean.class); public final static TypedKey MASS = new TypedKey("Mass", Double.class, UnitGroup.UNITS_MASS); public final static TypedKey DIAMETER = new TypedKey("Diameter", Double.class, UnitGroup.UNITS_LENGTH); - public final static TypedKey SIDES = new TypedKey("Sides", Integer.class); - public static final TypedKey PARACHUTE_CD = new TypedKey("DragCoefficient", Double.class, UnitGroup.UNITS_COEFFICIENT); - public final static TypedKey PACKED_LENGTH = new TypedKey("PackedLength", Double.class, UnitGroup.UNITS_LENGTH); - public final static TypedKey PACKED_DIAMETER = new TypedKey("PackedDiameter", Double.class, UnitGroup.UNITS_LENGTH); - public final static TypedKey LINE_COUNT = new TypedKey("LineCount", Integer.class); - public final static TypedKey LINE_LENGTH = new TypedKey("LineLength", Double.class, UnitGroup.UNITS_LENGTH); - public final static TypedKey LINE_MATERIAL = new TypedKey("LineMaterial", Material.class); public final static TypedKey IMAGE = new TypedKey("Image", byte[].class); public final static TypedKey STANDOFF_HEIGHT = new TypedKey("StandoffHeight", Double.class, UnitGroup.UNITS_LENGTH); public final static TypedKey FLANGE_HEIGHT = new TypedKey("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 CANOPY_SHAPE = new TypedKey("CanopyShape", Shape.class); + // Parachute diameter declaration see: DIAMETER + public final static TypedKey SPILL_DIA = new TypedKey("SpillDia", Double.class, UnitGroup.UNITS_LENGTH); + public final static TypedKey SURFACE_AREA = new TypedKey("SurfaceArea", Double.class, UnitGroup.UNITS_LENGTH); + public static final TypedKey PARACHUTE_CD = new TypedKey("DragCoefficient", Double.class, UnitGroup.UNITS_COEFFICIENT); + // Parachute canopy material declaration see: MATERIAL + public final static TypedKey SIDES = new TypedKey("Sides", Integer.class); + public final static TypedKey LINE_COUNT = new TypedKey("LineCount", Integer.class); + public final static TypedKey LINE_LENGTH = new TypedKey("LineLength", Double.class, UnitGroup.UNITS_LENGTH); + public final static TypedKey LINE_MATERIAL = new TypedKey("LineMaterial", Material.class); + public final static TypedKey PACKED_LENGTH = new TypedKey("PackedLength", Double.class, UnitGroup.UNITS_LENGTH); + public final static TypedKey PACKED_DIAMETER = new TypedKey("PackedDiameter", Double.class, UnitGroup.UNITS_LENGTH); + // Parachute Mass declaration see: MASS + public final static List> 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, 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, diff --git a/swing/src/net/sf/openrocket/gui/preset/PresetEditorDialog.java b/swing/src/net/sf/openrocket/gui/preset/PresetEditorDialog.java index 00c172bdd..1aad92e50 100644 --- a/swing/src/net/sf/openrocket/gui/preset/PresetEditorDialog.java +++ b/swing/src/net/sf/openrocket/gui/preset/PresetEditorDialog.java @@ -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);