altosui: Remove ability to graph data in .csv files
authorKeith Packard <keithp@keithp.com>
Wed, 6 Oct 2010 23:25:49 +0000 (16:25 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 6 Oct 2010 23:44:06 +0000 (16:44 -0700)
There's no reason to support these files when the raw .eeprom or
.telem files which generate them should be used instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosCsvReader.java [deleted file]
ao-tools/altosui/AltosGraphDataChooser.java
ao-tools/altosui/AltosGraphUI.java
ao-tools/altosui/AltosUI.java
ao-tools/altosui/Makefile.am

diff --git a/ao-tools/altosui/AltosCsvReader.java b/ao-tools/altosui/AltosCsvReader.java
deleted file mode 100644 (file)
index 600788f..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-
-// Copyright (c) 2010 Anthony Towns
-// GPL v2 or later
-
-package altosui;
-
-import java.lang.UnsupportedOperationException;
-import java.util.HashMap;
-import java.util.NoSuchElementException;
-import java.util.Iterator;
-import java.io.*;
-import com.csvreader.CsvReader;
-
-import altosui.AltosDataPoint;
-
-class AltosCsvReader implements Iterable<AltosDataPoint>
-{
-    public CsvReader csv;
-    public AltosDataPoint next = null;
-
-    static protected String [] headers = "version serial flight call time rssi state state_name acceleration pressure altitude height accel_speed baro_speed temperature battery_voltage drogue_voltage main_voltage connected locked nsat latitude longitude altitude year month day hour minute second pad_dist pad_range pad_az pad_el".split(" ");
-
-    AltosCsvReader(Reader stream) {
-        csv = new CsvReader(stream);
-        csv.setComment('#');
-        csv.setUseComments(true);
-        csv.setHeaders(headers);
-    }
-    AltosCsvReader(String filename) throws FileNotFoundException {
-        csv = new CsvReader(filename);
-        csv.setComment('#');
-        csv.setUseComments(true);
-        csv.setHeaders(headers);
-    }
-
-    public Iterator<AltosDataPoint> iterator() {
-        return new Iterator<AltosDataPoint>() {
-            public void remove() { 
-                throw new UnsupportedOperationException(); 
-            }
-            public boolean hasNext() {
-                if (next == null) {
-                    try {
-                        if (csv.readRecord()) {
-                            next = new CsvRow();
-                        } else {
-                            close();
-                            return false;
-                        }
-                    } catch (IOException e) {
-                        close();
-                        return false;
-                    }
-                }
-                return true;
-            }
-            public AltosDataPoint next() {
-                if (!hasNext())
-                    throw new NoSuchElementException();
-                AltosDataPoint res = next;
-                next = null;
-                return res;
-            }
-        };
-    }
-
-    public void close() {
-        csv.close();
-    }
-
-    private class CsvRow extends HashMap<String,String>
-            implements AltosDataPoint 
-    {
-        CsvRow() throws IOException {
-            for (int i = 0; i < headers.length; i++) {
-                this.put(headers[i], csv.get(headers[i]).trim());
-            }
-        }
-
-        private int intField(String name) {
-            return Integer.parseInt(get(name).trim());
-        }
-        private double doubleField(String name) {
-            return Double.valueOf(get(name)).doubleValue();
-        }
-        private String stringField(String name) {
-            return get(name);
-        }
-
-        public int version() { return intField("version"); }
-        public int serial() { return intField("serial"); }
-        public int flight() { return intField("flight"); }
-        public String callsign() { return stringField("call"); }
-        public double time() { return doubleField("time"); }
-        public double rssi() { return doubleField("rssi"); }
-
-        public int state() { return intField("state"); }
-        public String state_name() { return stringField("state_name"); }
-
-        public double acceleration() { return doubleField("acceleration"); }
-        public double pressure() { return doubleField("pressure"); }
-        public double altitude() { return doubleField("altitude"); }
-        public double height() { return doubleField("height"); }
-        public double accel_speed() { return doubleField("accel_speed"); }
-        public double baro_speed() { return doubleField("baro_speed"); }
-        public double temperature() { return doubleField("temperature"); }
-        public double battery_voltage() { 
-            return doubleField("battery_voltage"); 
-        }
-        public double drogue_voltage() { return doubleField("drogue_voltage"); }
-        public double main_voltage() { return doubleField("main_voltage"); }
-    }
-}
index 667d99f7d2dfc8d4ab656acbfa0f4fd23b56254f..caa14118244fc495c24acfbeb0941d683b2b2aa3 100644 (file)
@@ -28,7 +28,6 @@ import java.text.*;
 import java.util.prefs.*;
 
 import altosui.AltosPreferences;
-import altosui.AltosCsvReader;
 import altosui.AltosDataPointReader;
 import altosui.AltosEepromIterable;
 import altosui.AltosTelemetryIterable;
@@ -62,8 +61,6 @@ public class AltosGraphDataChooser extends JFileChooser {
                 } else if (filename.endsWith("telem")) {
                     FileInputStream in = new FileInputStream(file);
                     return new AltosDataPointReader(new AltosTelemetryIterable(in));
-                } else if (filename.endsWith("csv")) {
-                                   return new AltosCsvReader(new FileReader(file));
                 } else {
                     throw new FileNotFoundException();
                 }
@@ -81,7 +78,7 @@ public class AltosGraphDataChooser extends JFileChooser {
                frame = in_frame;
                setDialogTitle("Select Flight Record File");
                setFileFilter(new FileNameExtensionFilter("Flight data file",
-                                                         "csv", "telem", "eeprom"));
+                                                         "telem", "eeprom"));
                setCurrentDirectory(AltosPreferences.logdir());
        }
 }
index d945c333cffa870e62e313f21595d1cea82d6df4..25643c766257fcdbbd1581de265136095964a6e8 100644 (file)
@@ -17,7 +17,6 @@ import org.jfree.chart.axis.AxisLocation;
 import org.jfree.ui.ApplicationFrame;
 import org.jfree.ui.RefineryUtilities;
 
-import altosui.AltosCsvReader;
 import altosui.AltosDataPoint;
 import altosui.AltosGraphTime;
 
@@ -228,26 +227,6 @@ public class AltosGraphUI extends JFrame
 
         return graph;
     }
-
-    public static void main(String[] args) 
-        throws java.io.FileNotFoundException, java.io.IOException 
-    {
-        if (args.length < 1 || 2 < args.length)
-        {
-            System.out.println("Please specify telemetry csv");
-            return;
-        }
-
-        AltosCsvReader csv = new AltosCsvReader(args[0]);
-        if (args.length == 1) {
-            for (AltosGraph g : createGraphs(csv)) {
-                g.toPNG();
-            }
-        } else {
-            int which = Integer.parseInt(args[1].trim());
-            AltosGraphUI demo = new AltosGraphUI(csv, which);
-        }
-    }
 }
 
 /* gnuplot bits...
index 71481519910ece9d9f75e1d060c240b663e45402..28ed42fbe4f89848db63fcaa2d11c46cb82ef59e 100644 (file)
@@ -59,10 +59,6 @@ public class AltosUI extends JFrame {
        private AltosLog altos_log;
        private Box vbox;
 
-       private Font statusFont = new Font("SansSerif", Font.BOLD, 24);
-       private Font infoLabelFont = new Font("SansSerif", Font.PLAIN, 14);
-       private Font infoValueFont = new Font("Monospaced", Font.PLAIN, 14);
-
        public AltosVoice voice = new AltosVoice();
 
        public static boolean load_library(Frame frame) {
index 4e2a50276ec684b1d32f4dd21542d6d407487175..58c1517fdbe4ad307f2039843fb7b73ae6822fac 100644 (file)
@@ -56,7 +56,6 @@ altosui_JAVA = \
        AltosUI.java \
        AltosWriter.java \
        AltosDataPointReader.java \
-       AltosCsvReader.java \
        AltosDataPoint.java \
        AltosGraph.java \
        AltosGraphTime.java \