Rename multiburnchart
authorBill Kuker <bkuker@billkuker.com>
Mon, 22 Nov 2010 13:47:45 +0000 (13:47 +0000)
committerBill Kuker <bkuker@billkuker.com>
Mon, 22 Nov 2010 13:47:45 +0000 (13:47 +0000)
gui/com/billkuker/rocketry/motorsim/visual/workbench/MotorWorkbench.java
gui/com/billkuker/rocketry/motorsim/visual/workbench/MotorsEditor.java
gui/com/billkuker/rocketry/motorsim/visual/workbench/MultiBurnChart.java [deleted file]
gui/com/billkuker/rocketry/motorsim/visual/workbench/MultiMotorThrustChart.java [new file with mode: 0644]

index d3a2475f618597e21b0b005bbe864c037c34dff1..b3c5589232963f88ac39698a0c963ca695759e4a 100644 (file)
@@ -18,7 +18,7 @@ import com.billkuker.rocketry.motorsim.fuel.FuelsEditor;
 public class MotorWorkbench extends JFrame {\r
        private static final long serialVersionUID = 1L;\r
        \r
-       private MultiBurnChart mb;\r
+       private MultiMotorThrustChart mb;\r
        private JFrame allBurns;\r
        \r
        private JFrame fuelEditorFrame = new JFrame(){\r
@@ -46,7 +46,7 @@ public class MotorWorkbench extends JFrame {
                \r
                addMenu();\r
                \r
-               mb = new MultiBurnChart();\r
+               mb = new MultiMotorThrustChart();\r
                allBurns = new JFrame();\r
                allBurns.setTitle("All Burns");\r
                allBurns.setSize(800, 600);\r
index f0b2c24c9b83264e0d8698048299821d3a87d583..b94aa082d191392fb3b7b1a0fd751be76714d1ab 100644 (file)
@@ -23,7 +23,7 @@ import com.billkuker.rocketry.motorsim.visual.MultiObjectEditor;
 public class MotorsEditor extends MultiObjectEditor<Motor, MotorEditor> {\r
        private static final long serialVersionUID = 1L;\r
        \r
-       MultiBurnChart mbc = new MultiBurnChart();\r
+       MultiMotorThrustChart mbc = new MultiMotorThrustChart();\r
 \r
        public MotorsEditor(JFrame f) {\r
                super(f, "Motor");\r
diff --git a/gui/com/billkuker/rocketry/motorsim/visual/workbench/MultiBurnChart.java b/gui/com/billkuker/rocketry/motorsim/visual/workbench/MultiBurnChart.java
deleted file mode 100644 (file)
index 2234029..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.billkuker.rocketry.motorsim.visual.workbench;
-
-import java.awt.BorderLayout;
-import java.util.HashMap;
-
-import javax.measure.quantity.Duration;
-import javax.measure.quantity.Force;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
-import javax.swing.JPanel;
-
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.ChartPanel;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-
-import com.billkuker.rocketry.motorsim.Burn;
-import com.billkuker.rocketry.motorsim.RocketScience;
-
-public class MultiBurnChart extends JPanel implements BurnWatcher {
-       private static final long serialVersionUID = 1L;
-
-       private XYSeriesCollection dataset = new XYSeriesCollection();
-
-       private HashMap<Burn, XYSeries> burnToSeries = new HashMap<Burn, XYSeries>();
-       private Unit<Duration> time;
-       private Unit<Force> force;
-
-       public MultiBurnChart() {
-               this.setLayout(new BorderLayout());
-               time = RocketScience.UnitPreference.getUnitPreference()
-                               .getPreferredUnit(SI.SECOND);
-               force = RocketScience.UnitPreference.getUnitPreference()
-                               .getPreferredUnit(SI.NEWTON);
-               JFreeChart chart = ChartFactory.createXYLineChart(
-                               "", // Title
-                               "Time (" + time.toString() + ")", // x-axis Label
-                               "Thrust (" + force.toString() + ")", // y-axis Label
-                               dataset, PlotOrientation.VERTICAL, // Plot Orientation
-                               true, // Show Legend
-                               true, // Use tool tips
-                               false // Configure chart to generate URLs?
-                               );
-               add(new ChartPanel(chart));
-       }
-
-       public void addBurn(Burn b) {
-               XYSeries s = createSeries(b);
-               burnToSeries.put(b, s);
-               dataset.addSeries(s);
-       }
-
-       private XYSeries createSeries(Burn b) {
-               XYSeries s = new XYSeries(b.getMotor().getName());
-               for( Burn.Interval i : b.getData().values() ){
-                       s.add(i.time.doubleValue(time), i.thrust.doubleValue(force));
-               }
-               return s;
-       }
-
-       public void removeBurn(Burn b) {
-               XYSeries s = burnToSeries.get(b);
-               if (s == null)
-                       return;
-               dataset.removeSeries(s);
-       }
-
-       @Override
-       public void replace(Burn oldBurn, Burn newBurn) {
-               removeBurn(oldBurn);
-               addBurn(newBurn);
-       }
-}
diff --git a/gui/com/billkuker/rocketry/motorsim/visual/workbench/MultiMotorThrustChart.java b/gui/com/billkuker/rocketry/motorsim/visual/workbench/MultiMotorThrustChart.java
new file mode 100644 (file)
index 0000000..6a9d9fc
--- /dev/null
@@ -0,0 +1,75 @@
+package com.billkuker.rocketry.motorsim.visual.workbench;
+
+import java.awt.BorderLayout;
+import java.util.HashMap;
+
+import javax.measure.quantity.Duration;
+import javax.measure.quantity.Force;
+import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
+import javax.swing.JPanel;
+
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.ChartPanel;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import com.billkuker.rocketry.motorsim.Burn;
+import com.billkuker.rocketry.motorsim.RocketScience;
+
+public class MultiMotorThrustChart extends JPanel implements BurnWatcher {
+       private static final long serialVersionUID = 1L;
+
+       private XYSeriesCollection dataset = new XYSeriesCollection();
+
+       private HashMap<Burn, XYSeries> burnToSeries = new HashMap<Burn, XYSeries>();
+       private Unit<Duration> time;
+       private Unit<Force> force;
+
+       public MultiMotorThrustChart() {
+               this.setLayout(new BorderLayout());
+               time = RocketScience.UnitPreference.getUnitPreference()
+                               .getPreferredUnit(SI.SECOND);
+               force = RocketScience.UnitPreference.getUnitPreference()
+                               .getPreferredUnit(SI.NEWTON);
+               JFreeChart chart = ChartFactory.createXYLineChart(
+                               "", // Title
+                               "Time (" + time.toString() + ")", // x-axis Label
+                               "Thrust (" + force.toString() + ")", // y-axis Label
+                               dataset, PlotOrientation.VERTICAL, // Plot Orientation
+                               true, // Show Legend
+                               true, // Use tool tips
+                               false // Configure chart to generate URLs?
+                               );
+               add(new ChartPanel(chart));
+       }
+
+       public void addBurn(Burn b) {
+               XYSeries s = createSeries(b);
+               burnToSeries.put(b, s);
+               dataset.addSeries(s);
+       }
+
+       private XYSeries createSeries(Burn b) {
+               XYSeries s = new XYSeries(b.getMotor().getName());
+               for( Burn.Interval i : b.getData().values() ){
+                       s.add(i.time.doubleValue(time), i.thrust.doubleValue(force));
+               }
+               return s;
+       }
+
+       public void removeBurn(Burn b) {
+               XYSeries s = burnToSeries.get(b);
+               if (s == null)
+                       return;
+               dataset.removeSeries(s);
+       }
+
+       @Override
+       public void replace(Burn oldBurn, Burn newBurn) {
+               removeBurn(oldBurn);
+               addBurn(newBurn);
+       }
+}