ao-tools/ao-dump-up: Document --wait flag
[fw/altos] / micropeak / MicroPeak.java
index 4ca4dd0f0e63f9bd98c337e007fb6693d302ee1e..eee5bc07a04b0bd4c6711fa0efd4f386c993a01b 100644 (file)
@@ -24,13 +24,13 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_11.*;
-import org.altusmetrum.altosuilib_11.*;
+import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altosuilib_13.*;
 
-public class MicroPeak extends MicroFrame implements ActionListener, ItemListener {
+public class MicroPeak extends MicroFrame implements ActionListener, ItemListener, AltosFilterListener {
 
        File            filename;
-       AltosGraphNew   graph;
+       AltosGraph      graph;
        AltosUIEnable   enable;
        AltosFlightStatsTable   statsTable;
        MicroRaw        raw;
@@ -206,6 +206,25 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                Preferences();
        }
 
+       public void filter_changed(double speed_filter, double accel_filter) {
+               data.flight_series.set_filter(speed_filter, accel_filter);
+               graph.filter_changed();
+               data.flight_stats = new AltosFlightStats(data.flight_series);
+               statsTable.filter_changed(data.flight_stats);
+       }
+
+       public double speed_filter() {
+               if (data != null && data.flight_series != null)
+                       return data.flight_series.speed_filter_width;
+               return 4.0;
+       }
+
+       public double accel_filter() {
+               if (data != null && data.flight_series != null)
+                       return data.flight_series.accel_filter_width;
+               return 1.0;
+       }
+
        public MicroPeak() {
 
                ++number_of_windows;
@@ -262,13 +281,14 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                        @Override
                        public void windowClosing(WindowEvent e) {
                                statsTable.tell_closing();
+                               raw.tell_closing();
                                Close();
                        }
                });
 
-               enable = new AltosUIEnable();
+               enable = new AltosUIEnable(this);
 
-               graph = new AltosGraphNew(enable);
+               graph = new AltosGraph(enable);
                statsTable = new AltosFlightStatsTable();
                raw = new MicroRaw();
                pane.add(graph.panel, "Graph");