X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosGraphDataChooser.java;h=caa14118244fc495c24acfbeb0941d683b2b2aa3;hp=1bf28454b1eca7a7edebb8c3b2166686cd8179f8;hb=d1dbe3b69e6f95ef8ecd4cf959863b922ab47c66;hpb=61590b8729831cb138b2ba6b88802c208d114753 diff --git a/ao-tools/altosui/AltosGraphDataChooser.java b/ao-tools/altosui/AltosGraphDataChooser.java index 1bf28454..caa14118 100644 --- a/ao-tools/altosui/AltosGraphDataChooser.java +++ b/ao-tools/altosui/AltosGraphDataChooser.java @@ -28,10 +28,9 @@ import java.text.*; import java.util.prefs.*; import altosui.AltosPreferences; -import altosui.AltosReader; -import altosui.AltosCsvReader; -import altosui.AltosEepromReader; -import altosui.AltosTelemetryReader; +import altosui.AltosDataPointReader; +import altosui.AltosEepromIterable; +import altosui.AltosTelemetryIterable; public class AltosGraphDataChooser extends JFileChooser { JFrame frame; @@ -56,7 +55,15 @@ public class AltosGraphDataChooser extends JFileChooser { return null; filename = file.getName(); try { - return new AltosCsvReader(new FileReader(file)); + if (filename.endsWith("eeprom")) { + FileInputStream in = new FileInputStream(file); + return new AltosDataPointReader(new AltosEepromIterable(in)); + } else if (filename.endsWith("telem")) { + FileInputStream in = new FileInputStream(file); + return new AltosDataPointReader(new AltosTelemetryIterable(in)); + } else { + throw new FileNotFoundException(); + } } catch (FileNotFoundException fe) { JOptionPane.showMessageDialog(frame, filename, @@ -71,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")); setCurrentDirectory(AltosPreferences.logdir()); } }