import java.awt.BorderLayout;\r
import java.awt.Color;\r
import java.awt.Dimension;\r
-import java.awt.GridLayout;\r
-import java.text.DecimalFormat;\r
import java.text.NumberFormat;\r
\r
import javax.measure.quantity.Duration;\r
import javax.measure.quantity.Velocity;\r
import javax.measure.unit.SI;\r
import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
import javax.swing.JPanel;\r
import javax.swing.JSlider;\r
import javax.swing.JSplitPane;\r
\r
import com.billkuker.rocketry.motorsim.Burn;\r
import com.billkuker.rocketry.motorsim.BurnSummary;\r
-import com.billkuker.rocketry.motorsim.RocketScience;\r
\r
public class BurnPanel extends JPanel {\r
private static final long serialVersionUID = 1L;\r
\r
add( new SL(), BorderLayout.SOUTH);\r
\r
- \r
+ BurnSummary bi = new BurnSummary(burn);\r
+ SummaryPanel text = new SummaryPanel(burn);\r
+ text.setBurnSummary(bi);\r
+ add(text, BorderLayout.NORTH);\r
\r
{\r
- BurnSummary bi = new BurnSummary(burn);\r
- JPanel text = new JPanel(new GridLayout(2, 5));\r
-\r
- text.add(new JLabel("Rating"));\r
- text.add(new JLabel("Total Impulse"));\r
- text.add(new JLabel("ISP"));\r
- text.add(new JLabel("Max Thrust"));\r
- text.add(new JLabel("Average Thust"));\r
- text.add(new JLabel("Max Pressure"));\r
- \r
- text.add(new JLabel("Safty Factor"));\r
\r
- text.add(new JLabel(bi.getRating()));\r
- text.add(new JLabel(RocketScience.ammountToRoundedString(bi.totalImpulse())));\r
- text.add(new JLabel(RocketScience.ammountToRoundedString(bi.specificImpulse())));\r
- text.add(new JLabel(RocketScience\r
- .ammountToRoundedString(bi.maxThrust())));\r
- text.add(new JLabel(RocketScience\r
- .ammountToRoundedString(bi.averageThrust())));\r
- text.add(new JLabel(RocketScience\r
- .ammountToRoundedString(bi.maxPressure())));\r
- \r
+ //Color in the Burst marker\r
Color saftyColor;\r
if ( bi.getSaftyFactor() == null ){\r
-\r
saftyColor = Color.BLACK;\r
- text.add(new JLabel("NA"));\r
} else {\r
double d = bi.getSaftyFactor();\r
if ( d >= 1.5 ){\r
} else {\r
saftyColor = RED;\r
}\r
- JLabel l = new JLabel( new DecimalFormat("##########.#").format(bi.getSaftyFactor()));\r
- l.setOpaque(true);\r
- l.setBackground(saftyColor);\r
- l.setForeground(Color.WHITE);\r
- text.add(l);\r
+ }\r
+ Amount<Pressure> burst = b.getMotor().getChamber().getBurstPressure();\r
+ if ( burst != null ){\r
+ pressure.addRangeMarker(burst, "Burst", saftyColor);\r
}\r
\r
-\r
- add(text, BorderLayout.NORTH);\r
- \r
+ //Add some additional Markers\r
thrust.addRangeMarker(bi.maxThrust(), "Max", Color.BLACK);\r
thrust.addRangeMarker(bi.averageThrust(), "Average", Color.BLACK);\r
pressure.addRangeMarker(bi.maxPressure(), "Max", Color.BLACK);\r
burnRate.addDomainMarker(bi.maxPressure(), "Max", RED);\r
\r
- Amount<Pressure> burst = b.getMotor().getChamber().getBurstPressure();\r
- if ( burst != null ){\r
- pressure.addRangeMarker(burst, "Burst", saftyColor);\r
- }\r
+\r
}\r
\r
\r
--- /dev/null
+package com.billkuker.rocketry.motorsim.visual;\r
+\r
+import java.awt.Color;\r
+import java.awt.GridLayout;\r
+import java.text.DecimalFormat;\r
+\r
+import javax.swing.JLabel;\r
+import javax.swing.JPanel;\r
+\r
+import com.billkuker.rocketry.motorsim.Burn;\r
+import com.billkuker.rocketry.motorsim.BurnSummary;\r
+import com.billkuker.rocketry.motorsim.RocketScience;\r
+\r
+public class SummaryPanel extends JPanel {\r
+ private static final long serialVersionUID = 1L;\r
+ private static final Color RED = new Color(196, 0, 0);\r
+ private static final Color GREEN = new Color(0, 196, 0);\r
+ private static final Color ORANGE = new Color(160, 96, 0);\r
+\r
+ public SummaryPanel(Burn b) {\r
+ super(new GridLayout(2, 5));\r
+ }\r
+\r
+ public void setBurnSummary(BurnSummary bi) {\r
+ {\r
+ this.add(new JLabel("Rating"));\r
+ this.add(new JLabel("Total Impulse"));\r
+ this.add(new JLabel("ISP"));\r
+ this.add(new JLabel("Max Thrust"));\r
+ this.add(new JLabel("Average Thust"));\r
+ this.add(new JLabel("Max Pressure"));\r
+\r
+ this.add(new JLabel("Safty Factor"));\r
+\r
+ this.add(new JLabel(bi.getRating()));\r
+ this.add(new JLabel(RocketScience.ammountToRoundedString(bi\r
+ .totalImpulse())));\r
+ this.add(new JLabel(RocketScience.ammountToRoundedString(bi\r
+ .specificImpulse())));\r
+ this.add(new JLabel(RocketScience.ammountToRoundedString(bi\r
+ .maxThrust())));\r
+ this.add(new JLabel(RocketScience.ammountToRoundedString(bi\r
+ .averageThrust())));\r
+ this.add(new JLabel(RocketScience.ammountToRoundedString(bi\r
+ .maxPressure())));\r
+\r
+ Color saftyColor;\r
+ if (bi.getSaftyFactor() == null) {\r
+\r
+ saftyColor = Color.BLACK;\r
+ this.add(new JLabel("NA"));\r
+ } else {\r
+ double d = bi.getSaftyFactor();\r
+ if (d >= 1.5) {\r
+ saftyColor = GREEN;\r
+ } else if (d > 1) {\r
+ saftyColor = ORANGE;\r
+ } else {\r
+ saftyColor = RED;\r
+ }\r
+ JLabel l = new JLabel(\r
+ new DecimalFormat("##########.#").format(bi\r
+ .getSaftyFactor()));\r
+ l.setOpaque(true);\r
+ l.setBackground(saftyColor);\r
+ l.setForeground(Color.WHITE);\r
+ this.add(l);\r
+ }\r
+\r
+ }\r
+ }\r
+}\r
import com.billkuker.rocketry.motorsim.Motor;\r
import com.billkuker.rocketry.motorsim.Nozzle;\r
import com.billkuker.rocketry.motorsim.RocketScience;\r
+import com.billkuker.rocketry.motorsim.cases.Schedule40;\r
import com.billkuker.rocketry.motorsim.fuel.KNSU;\r
import com.billkuker.rocketry.motorsim.grain.CSlot;\r
import com.billkuker.rocketry.motorsim.grain.CoredCylindricalGrain;\r
SwingUtilities.invokeLater(new Thread() {\r
public void run() {\r
remove(bar);\r
+ remove(progress);\r
add(bp, BorderLayout.CENTER);\r
\r
for (BurnWatcher bw : burnWatchers)\r
c.setID(Amount.valueOf(30, SI.MILLIMETER));\r
m.setChamber(c);\r
\r
+ Schedule40 pvc = new Schedule40();\r
+ pvc.setLength(Amount.valueOf(200, SI.MILLIMETER));\r
+ m.setChamber(pvc);\r
+ \r
CoredCylindricalGrain g = new CoredCylindricalGrain();\r
try {\r
g.setLength(Amount.valueOf(70, SI.MILLIMETER));\r
} catch (PropertyVetoException v) {\r
throw new Error(v);\r
}\r
+ \r
\r
m.setGrain(new MultiGrain(g, 2));\r
\r