have AltosGraph use new AltosPressure to get imperial_units working
[fw/altos] / altosuilib / AltosGraph.java
index 2e6d428d744658210a5a4f1f2dcfdc330c348a1e..2dbd1612cad13ffd10959720605a6107e6be996a 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_3;
+package org.altusmetrum.altosuilib_11;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altoslib_11.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
@@ -80,29 +81,6 @@ class AltosNsat extends AltosUnits {
        }
 }
 
-class AltosPressure extends AltosUnits {
-
-       public double value(double p, boolean imperial_units) {
-               return p;
-       }
-
-       public double inverse(double p, boolean imperial_units) {
-               return p;
-       }
-
-       public String show_units(boolean imperial_units) {
-               return "Pa";
-       }
-
-       public String say_units(boolean imperial_units) {
-               return "pascals";
-       }
-
-       public int show_fraction(int width, boolean imperial_units) {
-               return 0;
-       }
-}
-
 class AltosDbm extends AltosUnits {
 
        public double value(double d, boolean imperial_units) {
@@ -329,48 +307,54 @@ public class AltosGraph extends AltosUIGraph {
                                  gps_nsat_solution_color,
                                  false,
                                  nsat_axis);
-                       addSeries("GPS Satellites in View",
-                                 AltosGraphDataPoint.data_gps_nsat_view,
-                                 nsat_units,
-                                 gps_nsat_view_color,
-                                 false,
-                                 nsat_axis);
-                       addSeries("GPS Course",
-                                 AltosGraphDataPoint.data_gps_course,
-                                 orient_units,
-                                 gps_course_color,
-                                 false,
-                                 course_axis);
-                       addSeries("GPS Ground Speed",
-                                 AltosGraphDataPoint.data_gps_ground_speed,
-                                 AltosConvert.speed,
-                                 gps_ground_speed_color,
-                                 enable_gps,
-                                 speed_axis);
-                       addSeries("GPS Climb Rate",
-                                 AltosGraphDataPoint.data_gps_climb_rate,
-                                 AltosConvert.speed,
-                                 gps_climb_rate_color,
-                                 enable_gps,
-                                 speed_axis);
+                       if (stats.has_gps_sats) {
+                               addSeries("GPS Satellites in View",
+                                         AltosGraphDataPoint.data_gps_nsat_view,
+                                         nsat_units,
+                                         gps_nsat_view_color,
+                                         false,
+                                         nsat_axis);
+                       }
+                       if (stats.has_gps_detail) {
+                               addSeries("GPS Course",
+                                         AltosGraphDataPoint.data_gps_course,
+                                         orient_units,
+                                         gps_course_color,
+                                         false,
+                                         course_axis);
+                               addSeries("GPS Ground Speed",
+                                         AltosGraphDataPoint.data_gps_ground_speed,
+                                         AltosConvert.speed,
+                                         gps_ground_speed_color,
+                                         enable_gps,
+                                         speed_axis);
+                               addSeries("GPS Climb Rate",
+                                         AltosGraphDataPoint.data_gps_climb_rate,
+                                         AltosConvert.speed,
+                                         gps_climb_rate_color,
+                                         enable_gps,
+                                         speed_axis);
+                       }
                        addSeries("GPS Position DOP",
                                  AltosGraphDataPoint.data_gps_pdop,
                                  dop_units,
                                  gps_pdop_color,
                                  false,
                                  dop_axis);
-                       addSeries("GPS Horizontal DOP",
-                                 AltosGraphDataPoint.data_gps_hdop,
-                                 dop_units,
-                                 gps_hdop_color,
-                                 false,
-                                 dop_axis);
-                       addSeries("GPS Vertical DOP",
-                                 AltosGraphDataPoint.data_gps_vdop,
-                                 dop_units,
-                                 gps_vdop_color,
-                                 false,
-                                 dop_axis);
+                       if (stats.has_gps_detail) {
+                               addSeries("GPS Horizontal DOP",
+                                         AltosGraphDataPoint.data_gps_hdop,
+                                         dop_units,
+                                         gps_hdop_color,
+                                         false,
+                                         dop_axis);
+                               addSeries("GPS Vertical DOP",
+                                         AltosGraphDataPoint.data_gps_vdop,
+                                         dop_units,
+                                         gps_vdop_color,
+                                         false,
+                                         dop_axis);
+                       }
                }
                if (stats.has_rssi)
                        addSeries("Received Signal Strength",