Add callsign/serial/flight to graph title
authorAnthony Towns <aj@erisian.com.au>
Tue, 28 Sep 2010 05:27:07 +0000 (15:27 +1000)
committerAnthony Towns <aj@erisian.com.au>
Tue, 28 Sep 2010 05:27:07 +0000 (15:27 +1000)
ao-tools/altosui/AltosGraphTime.java

index c0f99c596d939381a4d483772e8e018b037fa240..ab01b88888dabdd75ef0fe4938727f2852585adb 100644 (file)
@@ -131,6 +131,10 @@ class AltosGraphTime extends AltosGraph {
         }
     }
 
         }
     }
 
+    private String callsign = null;
+    private Integer serial = null;
+    private Integer flight = null; 
+
     private String title;
     private ArrayList<Element> elements;
     private HashMap<String,Integer> axes;
     private String title;
     private ArrayList<Element> elements;
     private HashMap<String,Integer> axes;
@@ -186,6 +190,9 @@ class AltosGraphTime extends AltosGraph {
         for (Element e : elements) {
             e.gotTimeData(time, d);
         }
         for (Element e : elements) {
             e.gotTimeData(time, d);
         }
+        if (callsign == null) callsign = d.callsign();
+        if (serial == null) serial = new Integer(d.serial());
+        if (flight == null) flight = new Integer(d.flight());
     }
 
     public JFreeChart createChart() {
     }
 
     public JFreeChart createChart() {
@@ -197,6 +204,13 @@ class AltosGraphTime extends AltosGraph {
         plot.setRenderer(renderer);
         plot.setOrientation(PlotOrientation.VERTICAL);
 
         plot.setRenderer(renderer);
         plot.setOrientation(PlotOrientation.VERTICAL);
 
+        if (serial != null && flight != null) {
+            title = serial + "/" + flight + ": " + title;
+        }
+        if (callsign != null) {
+            title = callsign + " - " + title;
+        }
+
         renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
         JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
                                 plot, true);
         renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
         JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
                                 plot, true);