static bool TestTrace(const char *filename, unsigned ntrace, bool output=false) { FileLineReaderA reader(filename); if (reader.error()) { fprintf(stderr, "Failed to open %s\n", filename); return false; } printf("# %d", ntrace); Trace trace(1000, ntrace); char *line; int i = 0; for (; (line = reader.read()) != NULL; i++) { if (output && (i % 500 == 0)) { putchar('.'); fflush(stdout); } IGCFix fix; if (!IGCParseFix(line, fix)) continue; on_advance(trace, fix.location, fixed(30), Angle::zero(), fix.gps_altitude, fix.pressure_altitude, fixed(fix.time.GetSecondOfDay())); } putchar('\n'); printf("# samples %d\n", i); return true; }
bool DemoReplayGlue::Update() { if (!enabled) return false; if (!UpdateTime()) return true; fixed floor_alt = fixed_300; if (device_blackboard->Calculated().terrain_valid) { floor_alt += device_blackboard->Calculated().terrain_altitude; } ProtectedTaskManager::ExclusiveLease task_manager(*m_task_manager); ProtectedTaskAccessor ta(task_manager, floor_alt); bool retval = DemoReplay::Update(ta); const AircraftState s = aircraft.GetState(); on_advance(s.location, s.ground_speed, s.track, s.altitude, s.altitude, s.time); return retval; }
bool IgcReplay::Update() { if (!Enabled) return false; if (!update_time()) return true; // if need a new point while (cli.NeedData(t_simulation) && Enabled) { fixed t1 = fixed_zero; fixed Lat1, Lon1, Alt1, PAlt1; Enabled = ReadPoint(t1, Lat1, Lon1, Alt1, PAlt1); if (Enabled && positive(t1)) cli.Update(t1, Lon1, Lat1, Alt1, PAlt1); } if (t_simulation == fixed_zero) t_simulation = cli.GetMaxTime(); if (!Enabled) { Stop(); } else { fixed Alt, PAlt; GeoPoint Pos; cli.Interpolate(t_simulation, Pos, Alt, PAlt); const GeoVector v = cli.GetVector(t_simulation); on_advance(Pos, v.Distance, v.Bearing, Alt, PAlt, t_simulation); } return Enabled; }