- public void show(AltosState state, int crc_errors) {
- bearing.show(state, crc_errors);
- distance.show(state, crc_errors);
- lat.show(state, crc_errors);
- lon.show(state, crc_errors);
- height.show(state, crc_errors);
- speed.show(state, crc_errors);
- accel.show(state, crc_errors);
+ public void set_font() {
+ lat.set_font();
+ lon.set_font();
+ bearing.set_font();
+ distance.set_font();
+ height.set_font();
+ speed.set_font();
+ accel.set_font();
+ }
+
+ public void show(AltosState state, AltosListenerState listener_state) {
+ if (state.gps != null && state.gps.connected) {
+ bearing.show(state, listener_state);
+ distance.show(state, listener_state);
+ lat.show(state, listener_state);
+ lon.show(state, listener_state);
+ } else {
+ bearing.hide();
+ distance.hide();
+ lat.hide();
+ lon.hide();
+ }
+ height.show(state, listener_state);
+ speed.show(state, listener_state);
+ accel.show(state, listener_state);
+ if (reader.backing_file() != null)
+ graph.setEnabled(true);
+ }
+
+ JButton graph;
+ AltosFlightReader reader;
+
+ public void actionPerformed(ActionEvent e) {
+ String cmd = e.getActionCommand();
+
+ if (cmd.equals("graph")) {
+ File file = reader.backing_file();
+ if (file != null) {
+ String filename = file.getName();
+ try {
+ AltosStateIterable states = null;
+ if (filename.endsWith("eeprom")) {
+ FileInputStream in = new FileInputStream(file);
+ states = new AltosEepromFile(in);
+ } else if (filename.endsWith("telem")) {
+ FileInputStream in = new FileInputStream(file);
+ states = new AltosTelemetryFile(in);
+ } else {
+ throw new FileNotFoundException(filename);
+ }
+ try {
+ new AltosGraphUI(states, file);
+ } catch (InterruptedException ie) {
+ } catch (IOException ie) {
+ }
+ } catch (FileNotFoundException fe) {
+ JOptionPane.showMessageDialog(null,
+ fe.getMessage(),
+ "Cannot open file",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }