X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosGraphUI.java;h=cd158651402d2634e4763015c1d36214b7899fb4;hp=73f9502387af8345c747bf71894678df3728ec33;hb=357826aa9c7b42c59f5d52b8eb016d73b6da0c7f;hpb=61590b8729831cb138b2ba6b88802c208d114753 diff --git a/ao-tools/altosui/AltosGraphUI.java b/ao-tools/altosui/AltosGraphUI.java index 73f95023..cd158651 100644 --- a/ao-tools/altosui/AltosGraphUI.java +++ b/ao-tools/altosui/AltosGraphUI.java @@ -17,10 +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; - public class AltosGraphUI extends JFrame { static final private Color red = new Color(194,31,31); @@ -39,7 +35,7 @@ public class AltosGraphUI extends JFrame AltosGraphTime.Element speed = new AltosGraphTime.TimeSeries("Speed (m/s)", "Vertical Speed", green) { public void gotTimeData(double time, AltosDataPoint d) { - if (d.state() < 4) { + if (d.state() < Altos.ao_flight_drogue) { series.add(time, d.accel_speed()); } else { series.add(time, d.baro_speed()); @@ -81,13 +77,13 @@ public class AltosGraphUI extends JFrame } }; - AltosGraphTime.Element e_pad = new AltosGraphTime.StateMarker(2, "Pad"); - AltosGraphTime.Element e_boost = new AltosGraphTime.StateMarker(3, "Boost"); - AltosGraphTime.Element e_fast = new AltosGraphTime.StateMarker(4, "Fast"); - AltosGraphTime.Element e_coast = new AltosGraphTime.StateMarker(5, "Coast"); - AltosGraphTime.Element e_drogue = new AltosGraphTime.StateMarker(6, "Drogue"); - AltosGraphTime.Element e_main = new AltosGraphTime.StateMarker(7, "Main"); - AltosGraphTime.Element e_landed = new AltosGraphTime.StateMarker(8, "Landed"); + AltosGraphTime.Element e_pad = new AltosGraphTime.StateMarker(Altos.ao_flight_pad, "Pad"); + AltosGraphTime.Element e_boost = new AltosGraphTime.StateMarker(Altos.ao_flight_boost, "Boost"); + AltosGraphTime.Element e_fast = new AltosGraphTime.StateMarker(Altos.ao_flight_fast, "Fast"); + AltosGraphTime.Element e_coast = new AltosGraphTime.StateMarker(Altos.ao_flight_coast, "Coast"); + AltosGraphTime.Element e_drogue = new AltosGraphTime.StateMarker(Altos.ao_flight_drogue, "Drogue"); + AltosGraphTime.Element e_main = new AltosGraphTime.StateMarker(Altos.ao_flight_main, "Main"); + AltosGraphTime.Element e_landed = new AltosGraphTime.StateMarker(Altos.ao_flight_landed, "Landed"); protected AltosGraphTime myAltosGraphTime(String suffix) { return (new AltosGraphTime("Overall " + suffix)) @@ -130,7 +126,7 @@ public class AltosGraphUI extends JFrame return (new AltosGraphTime("Ascent " + suffix) { public void addData(AltosDataPoint d) { int state = d.state(); - if (3 <= state && state <= 5) { + if (Altos.ao_flight_boost <= state && state <= Altos.ao_flight_coast) { super.addData(d); } } @@ -145,7 +141,7 @@ public class AltosGraphUI extends JFrame return (new AltosGraphTime("Descent " + suffix) { public void addData(AltosDataPoint d) { int state = d.state(); - if (6 <= state && state <= 7) { + if (Altos.ao_flight_drogue <= state && state <= Altos.ao_flight_main) { super.addData(d); } } @@ -155,18 +151,15 @@ public class AltosGraphUI extends JFrame } } - public AltosGraphUI(JFrame frame) - { - super("Altos Graph"); + public AltosGraphUI(AltosRecordIterable records) { + super("Altos Graph"); - AltosGraphDataChooser chooser; - chooser = new AltosGraphDataChooser(frame); - Iterable reader = chooser.runDialog(); - if (reader == null) - return; + Iterable reader = new AltosDataPointReader (records); + if (reader == null) + return; - init(reader, 0); - } + init(reader, 0); + } public AltosGraphUI(Iterable data, int which) { @@ -228,26 +221,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...