当前位置: 首页>>代码示例>>C++>>正文


C++ Trace::EraseEarlierThan方法代码示例

本文整理汇总了C++中Trace::EraseEarlierThan方法的典型用法代码示例。如果您正苦于以下问题:C++ Trace::EraseEarlierThan方法的具体用法?C++ Trace::EraseEarlierThan怎么用?C++ Trace::EraseEarlierThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Trace的用法示例。


在下文中一共展示了Trace::EraseEarlierThan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: point

static void
Run(DebugReplay &replay, Result &result,
    Trace &full_trace, Trace &triangle_trace, Trace &sprint_trace)
{
  CirclingSettings circling_settings;
  circling_settings.SetDefaults();

  bool released = false;

  GeoPoint last_location = GeoPoint::Invalid();
  constexpr Angle max_longitude_change = Angle::Degrees(30);
  constexpr Angle max_latitude_change = Angle::Degrees(1);

  while (replay.Next()) {
    ComputeCircling(replay, circling_settings);

    const MoreData &basic = replay.Basic();

    Update(basic, replay.Calculated(), result);
    flight_phase_detector.Update(replay.Basic(), replay.Calculated());

    if (!basic.time_available || !basic.location_available ||
        !basic.NavAltitudeAvailable())
      continue;

    if (last_location.IsValid() &&
        ((last_location.latitude - basic.location.latitude).Absolute() > max_latitude_change ||
         (last_location.longitude - basic.location.longitude).Absolute() > max_longitude_change))
      /* there was an implausible warp, which is usually triggered by
         an invalid point declared "valid" by a bugged logger; if that
         happens, we stop the analysis, because the IGC file is
         obviously broken */
      break;

    last_location = basic.location;

    if (!released && !negative(replay.Calculated().flight.release_time)) {
      released = true;

      full_trace.EraseEarlierThan(replay.Calculated().flight.release_time);
      triangle_trace.EraseEarlierThan(replay.Calculated().flight.release_time);
      sprint_trace.EraseEarlierThan(replay.Calculated().flight.release_time);
    }

    if (released && !replay.Calculated().flight.flying)
      /* the aircraft has landed, stop here */
      /* TODO: at some point, we might want to emit the analysis of
         all flights in this IGC file */
      break;

    const TracePoint point(basic);
    full_trace.push_back(point);
    triangle_trace.push_back(point);
    sprint_trace.push_back(point);
  }

  Update(replay.Basic(), replay.Calculated(), result);
  Finish(replay.Basic(), replay.Calculated(), result);
  flight_phase_detector.Finish();
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:60,代码来源:AnalyseFlight.cpp

示例2: point

static int
TestOLC(DebugReplay &replay)
{
  bool released = false;

  for (int i = 1; replay.Next(); i++) {
    if (i % 500 == 0) {
      putchar('.');
      fflush(stdout);
    }

    const MoreData &basic = replay.Basic();
    if (!basic.time_available || !basic.location_available ||
        !basic.NavAltitudeAvailable())
      continue;

    if (!released && !negative(replay.Calculated().flight.release_time)) {
      released = true;

      triangle_trace.EraseEarlierThan(replay.Calculated().flight.release_time);
      full_trace.EraseEarlierThan(replay.Calculated().flight.release_time);
      sprint_trace.EraseEarlierThan(replay.Calculated().flight.release_time);
    }

    const TracePoint point(basic);
    triangle_trace.push_back(point);
    full_trace.push_back(point);
    sprint_trace.push_back(point);

    olc_sprint.UpdateIdle();
    olc_league.UpdateIdle();
  }

  olc_classic.SolveExhaustive();
  olc_fai.SolveExhaustive();
  olc_league.SolveExhaustive();
  olc_plus.SolveExhaustive();
  dmst.SolveExhaustive();
  xcontest.SolveExhaustive();
  sis_at.SolveExhaustive();
  olc_netcoupe.SolveExhaustive();

  putchar('\n');

  std::cout << "classic\n";
  PrintHelper::print(olc_classic.GetStats().GetResult());
  std::cout << "league\n";
  std::cout << "# league\n";
  PrintHelper::print(olc_league.GetStats().GetResult(0));
  std::cout << "# classic\n";
  PrintHelper::print(olc_league.GetStats().GetResult(1));
  std::cout << "fai\n";
  PrintHelper::print(olc_fai.GetStats().GetResult());
  std::cout << "sprint\n";
  PrintHelper::print(olc_sprint.GetStats().GetResult());
  std::cout << "plus\n";
  std::cout << "# classic\n";
  PrintHelper::print(olc_plus.GetStats().GetResult(0));
  std::cout << "# triangle\n";
  PrintHelper::print(olc_plus.GetStats().GetResult(1));
  std::cout << "# plus\n";
  PrintHelper::print(olc_plus.GetStats().GetResult(2));

  std::cout << "dmst\n";
  PrintHelper::print(dmst.GetStats().GetResult());

  std::cout << "xcontest\n";
  std::cout << "# free\n";
  PrintHelper::print(xcontest.GetStats().GetResult(0));
  std::cout << "# triangle\n";
  PrintHelper::print(xcontest.GetStats().GetResult(1));

  std::cout << "sis_at\n";
  PrintHelper::print(sis_at.GetStats().GetResult(0));

  std::cout << "netcoupe\n";
  PrintHelper::print(olc_netcoupe.GetStats().GetResult());

  olc_classic.Reset();
  olc_fai.Reset();
  olc_sprint.Reset();
  olc_league.Reset();
  olc_plus.Reset();
  dmst.Reset();
  olc_netcoupe.Reset();
  full_trace.clear();
  sprint_trace.clear();

  return 0;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:90,代码来源:RunOLCAnalysis.cpp


注:本文中的Trace::EraseEarlierThan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。