diff options
author | Keith Packard <keithp@keithp.com> | 2017-10-02 19:33:37 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-10-02 19:33:37 -0700 |
commit | 98dc29a7a964f8d653b73989c6751695d168844c (patch) | |
tree | 415e274078746fe853aad554aae1a2e5d1a57ca5 /micropeak/MicroPeak.java | |
parent | d75e8b9046295051c91696461e8d5f59c8260ccc (diff) |
altoslib: Add user-selectable filter width for data smoothing
Also switch smoothing window to Kaiser and change default accel filter
width to 1 second instead of 4 seconds.
Now users can play with the filter and see what it does.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroPeak.java')
-rw-r--r-- | micropeak/MicroPeak.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index 749d0f64..c6a2a3c9 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -27,7 +27,7 @@ import java.util.*; import org.altusmetrum.altoslib_12.*; import org.altusmetrum.altosuilib_12.*; -public class MicroPeak extends MicroFrame implements ActionListener, ItemListener { +public class MicroPeak extends MicroFrame implements ActionListener, ItemListener, AltosFilterListener { File filename; AltosGraph graph; @@ -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; @@ -267,7 +286,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene } }); - enable = new AltosUIEnable(); + enable = new AltosUIEnable(this); graph = new AltosGraph(enable); statsTable = new AltosFlightStatsTable(); |