- if ((process & process_kml) != 0) {
- String output = Altos.replace_extension(input,".kml");
- System.out.printf("Processing \"%s\" to \"%s\"\n", input, output);
- if (input.equals(output)) {
- System.out.printf("Not processing '%s'\n", input);
- } else {
- AltosWriter writer = open_kml(output);
- if (writer == null)
- return;
- writer.write(iterable);
- writer.close();
+ return recs;
+ }
+
+ static AltosReplayReader replay_file(String filename) {
+ AltosRecordIterable recs = record_iterable_file(filename);
+ if (recs == null)
+ return null;
+ return new AltosReplayReader(recs.iterator(), new File(filename));
+ }
+
+ static void process_replay(String filename) {
+ AltosReplayReader reader = replay_file(filename);
+ AltosFlightUI flight_ui = new AltosFlightUI(new AltosVoice(), reader);
+ flight_ui.set_exit_on_close();
+ }
+
+ static void process_graph(String filename) {
+ AltosRecordIterable recs = record_iterable_file(filename);
+ if (recs == null)
+ return;
+ try {
+ new AltosGraphUI(recs, filename);
+ } catch (InterruptedException ie) {
+ } catch (IOException ie) {
+ }
+ }
+
+ static void process_summary(String filename) {
+ AltosReplayReader reader = replay_file(filename);
+ try {
+ AltosFlightStats stats = new AltosFlightStats(reader);
+ if (stats.serial > 0)
+ System.out.printf("Serial: %5d\n", stats.serial);
+ if (stats.flight > 0)
+ System.out.printf("Flight: %5d\n", stats.flight);
+ if (stats.year > 0)
+ System.out.printf("Date: %04d-%02d-%02d\n",
+ stats.year, stats.month, stats.day);
+ if (stats.hour > 0)
+ System.out.printf("Time: %02d:%02d:%02d UTC\n",
+ stats.hour, stats.minute, stats.second);
+ System.out.printf("Max height: %6.0f m %6.0f ft\n",
+ stats.max_height,
+ AltosConvert.meters_to_feet(stats.max_height));
+ System.out.printf("Max speed: %6.0f m/s %6.0f ft/s %6.4f Mach\n",
+ stats.max_speed,
+ AltosConvert.meters_to_feet(stats.max_speed),
+ AltosConvert.meters_to_mach(stats.max_speed));
+ if (stats.max_acceleration != AltosRecord.MISSING) {
+ System.out.printf("Max accel: %6.0f m/s² %6.0f ft/s² %6.2f g\n",
+ stats.max_acceleration,
+ AltosConvert.meters_to_feet(stats.max_acceleration),
+ AltosConvert.meters_to_g(stats.max_acceleration));