summaryrefslogtreecommitdiff
path: root/ao-tools
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-10-06 16:25:49 -0700
committerKeith Packard <keithp@keithp.com>2010-10-06 16:44:06 -0700
commitc2c4d515ef9cc2cae8a8f2803e9498bb0794c4ed (patch)
tree0b106a7e38c77de4b3479cacb72250a775c1f660 /ao-tools
parentd5caf6f2f4d9257e26aa4305b26c02d1b263fa24 (diff)
altosui: Remove ability to graph data in .csv files
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>
Diffstat (limited to 'ao-tools')
-rw-r--r--ao-tools/altosui/AltosCsvReader.java113
-rw-r--r--ao-tools/altosui/AltosGraphDataChooser.java5
-rw-r--r--ao-tools/altosui/AltosGraphUI.java21
-rw-r--r--ao-tools/altosui/AltosUI.java4
-rw-r--r--ao-tools/altosui/Makefile.am1
5 files changed, 1 insertions, 143 deletions
diff --git a/ao-tools/altosui/AltosCsvReader.java b/ao-tools/altosui/AltosCsvReader.java
deleted file mode 100644
index 600788f4..00000000
--- a/ao-tools/altosui/AltosCsvReader.java
+++ /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"); }
- }
-}
diff --git a/ao-tools/altosui/AltosGraphDataChooser.java b/ao-tools/altosui/AltosGraphDataChooser.java
index 667d99f7..caa14118 100644
--- a/ao-tools/altosui/AltosGraphDataChooser.java
+++ b/ao-tools/altosui/AltosGraphDataChooser.java
@@ -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());
}
}
diff --git a/ao-tools/altosui/AltosGraphUI.java b/ao-tools/altosui/AltosGraphUI.java
index d945c333..25643c76 100644
--- a/ao-tools/altosui/AltosGraphUI.java
+++ b/ao-tools/altosui/AltosGraphUI.java
@@ -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...
diff --git a/ao-tools/altosui/AltosUI.java b/ao-tools/altosui/AltosUI.java
index 71481519..28ed42fb 100644
--- a/ao-tools/altosui/AltosUI.java
+++ b/ao-tools/altosui/AltosUI.java
@@ -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) {
diff --git a/ao-tools/altosui/Makefile.am b/ao-tools/altosui/Makefile.am
index 4e2a5027..58c1517f 100644
--- a/ao-tools/altosui/Makefile.am
+++ b/ao-tools/altosui/Makefile.am
@@ -56,7 +56,6 @@ altosui_JAVA = \
AltosUI.java \
AltosWriter.java \
AltosDataPointReader.java \
- AltosCsvReader.java \
AltosDataPoint.java \
AltosGraph.java \
AltosGraphTime.java \