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


C++ InfoBoxWindow::SetInvalid方法代码示例

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


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

示例1:

void
InfoBoxContentNextLD::Update(InfoBoxWindow &infobox)
{
  // pilots want this to be assuming terminal flight to this wp, and this
  // is what current_leg gradient does.

  if (!XCSoarInterface::Calculated().task_stats.task_valid) {
    infobox.SetInvalid();
    return;
  }

  fixed gradient = XCSoarInterface::Calculated().task_stats.current_leg.gradient;

  if (!positive(gradient)) {
    infobox.SetValue(_T("+++"));
    return;
  }
  if (::GradientValid(gradient)) {
    TCHAR tmp[32];
    _stprintf(tmp, _T("%d"), (int)gradient);
    infobox.SetValue(tmp);
  } else {
    infobox.SetInvalid();
  }
}
开发者ID:galippi,项目名称:xcsoar,代码行数:25,代码来源:Task.cpp

示例2:

void
InfoBoxContentFinalETEVMG::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::Basic().GroundSpeedAvailable) {
    infobox.SetInvalid();
    return;
  }

  const fixed d = XCSoarInterface::Calculated().task_stats.
    total.remaining.get_distance();
  const fixed &v = XCSoarInterface::Basic().GroundSpeed;

  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      !positive(d) ||
      !positive(v)) {
    infobox.SetInvalid();
    return;
  }

  TCHAR HHMMSSsmart[32];
  TCHAR SSsmart[32];
  const int dd = (int)(d/v);
  Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);

  infobox.SetValue(HHMMSSsmart);
  infobox.SetComment(SSsmart);
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:27,代码来源:Task.cpp

示例3: if

void
InfoBoxContentTeamBearingDiff::Update(InfoBoxWindow &infobox)
{
#ifndef OLD_TASK
  infobox.SetInvalid();
  return;
#else
  if (!way_points.verify_index(XCSoarInterface::SettingsComputer().
      TeamCodeRefWaypoint)
      || !XCSoarInterface::SettingsComputer().TeammateCodeValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Angle Value = XCSoarInterface::Calculated().TeammateBearing -
                 XCSoarInterface::Basic().TrackBearing;

  SetValueBearingDifference(infobox, Value);
#endif

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetCommentInvalid();
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
开发者ID:galippi,项目名称:xcsoar,代码行数:35,代码来源:Team.cpp

示例4: if

void
InfoBoxContentTeamBearingDiff::Update(InfoBoxWindow &infobox)
{
#ifndef OLD_TASK
  infobox.SetInvalid();
  return;
#else
  if (!way_points.verify_index(XCSoarInterface::SettingsComputer().
      TeamCodeRefWaypoint)
      || !XCSoarInterface::SettingsComputer().TeammateCodeValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  TCHAR tmp[32];
  double Value = XCSoarInterface::Calculated().TeammateBearing -
                 XCSoarInterface::Basic().TrackBearing;

  if (Value < -180.0)
    Value += 360.0;
  else if (Value > 180.0)
    Value -= 360.0;

#ifndef __MINGW32__
  if (Value > 1)
    _stprintf(tmp, TEXT("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, TEXT("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, TEXT("«»"));
#else
  if (Value > 1)
    _stprintf(tmp, TEXT("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, TEXT("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, TEXT("«»"));
#endif
  infobox.SetValue(tmp);
#endif

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetComment(_T("---"));
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:56,代码来源:Team.cpp

示例5: fixed

void
InfoBoxContentTaskTimeUnderMaxHeight::Update(InfoBoxWindow &infobox)
{
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  const fixed maxheight = fixed(protected_task_manager->
                                get_ordered_task_behaviour().start_max_height);

  if (!task_stats.task_valid || !positive(maxheight)
      || !protected_task_manager
      || !positive(common_stats.TimeUnderStartMaxHeight)) {
    infobox.SetInvalid();
    return;
  }

  const int dd = (int)(XCSoarInterface::Basic().Time -
      common_stats.TimeUnderStartMaxHeight);

  TCHAR HHMMSSsmart[32];
  TCHAR SSsmart[32];
  Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);

  infobox.SetValue(HHMMSSsmart);
  infobox.SetComment(_("Time Below"));
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:25,代码来源:Task.cpp

示例6: abs

void
InfoBoxContentTaskAATimeDelta::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;

  if (!task_stats.task_valid || !task_stats.total.achievable() ||
      !positive(task_stats.total.TimeRemaining) ||
      !positive(common_stats.aat_time_remaining)) {
    infobox.SetInvalid();
    return;
  }

  fixed diff = task_stats.total.TimeRemaining -
    common_stats.aat_time_remaining;

  TCHAR HHMMSSsmart[32];
  TCHAR SSsmart[32];
  const int dd = abs((int)diff);
  Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);

  TCHAR tmp[32];
  _stprintf(tmp, negative(diff) ? _T("-%s") : _T("%s"), HHMMSSsmart);
  infobox.SetValue(tmp);

  infobox.SetComment(SSsmart);

  // Set Color (red/blue/black)
  infobox.SetColor(negative(diff) ? 1 :
                   task_stats.total.TimeRemaining <
                       common_stats.aat_time_remaining + fixed(5) ? 2 : 0);
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:32,代码来源:Task.cpp

示例7: DetectCurrentTime

void
InfoBoxContentNextETA::Update(InfoBoxWindow &infobox)
{
  // use proper non-terminal next task stats

  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      !XCSoarInterface::Calculated().task_stats.current_leg.achievable()) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  int dd = (int)(XCSoarInterface::Calculated().task_stats.current_leg.
                 solution_remaining.TimeElapsed) +
    DetectCurrentTime(XCSoarInterface::Basic());
  const BrokenTime t = BrokenTime::FromSecondOfDayChecked(abs(dd));

  // Set Value
  _stprintf(tmp, _T("%02u:%02u"), t.hour, t.minute);
  infobox.SetValue(tmp);

  // Set Comment
  _stprintf(tmp, _T("%02u"), t.second);
  infobox.SetComment(tmp);
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:25,代码来源:Task.cpp

示例8: SystemFreeRAM

void
InfoBoxContentFreeRAM::Update(InfoBoxWindow &infobox)
{
#ifdef HAVE_MEM_INFO
  TCHAR tmp[32];
  TCHAR unit;
  unsigned long freeRAM = SystemFreeRAM();
  double f = freeRAM;
  if (freeRAM >= 1024 * 1024 *1024) {
    f /= (1024 * 1024 * 1024);
    unit = _T('G');
  } else if (freeRAM >= 1024 * 1024) {
    f /= (1024 * 1024);
    unit = _T('M');
  } else if (freeRAM >= 1024) {
    f /= 1024;
    unit = _T('K');
  } else
    unit = _T('B');
  _stprintf(tmp, _T("%.1f%c"), f, unit);
  infobox.SetValue(tmp);
#else
  infobox.SetInvalid();
#endif
}
开发者ID:macsux,项目名称:XCSoar,代码行数:25,代码来源:Other.cpp

示例9: sizeof

void
InfoBoxContentAltitudeAGL::Update(InfoBoxWindow &infobox)
{
  const DERIVED_INFO &calculated = CommonInterface::Calculated();
  TCHAR sTmp[32];

  if (!calculated.AltitudeAGLValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(calculated.AltitudeAGL, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(calculated.AltitudeAGL, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);

  // Set Color (red/black)
  infobox.SetColor(calculated.AltitudeAGL <
      XCSoarInterface::SettingsComputer().route_planner.safety_height_terrain ? 1 : 0);
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:28,代码来源:Altitude.cpp

示例10: if

void
InfoBoxContentBearingDiff::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      XCSoarInterface::Calculated().task_stats.current_leg.solution_remaining.
      Vector.Distance <= fixed(10)) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  TCHAR tmp[32];
  double Value =
      (XCSoarInterface::Calculated().task_stats.current_leg.
       solution_remaining.Vector.Bearing - XCSoarInterface::Basic().
       TrackBearing).as_delta().value_degrees();

#ifndef __MINGW32__
  if (Value > 1)
    _stprintf(tmp, _T("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, _T("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, _T("«»"));
#else
  if (Value > 1)
    _stprintf(tmp, _T("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, _T("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, _T("«»"));
#endif

  infobox.SetValue(tmp);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:35,代码来源:Task.cpp

示例11:

void
InfoBoxContentAltitudeAGL::Update(InfoBoxWindow &infobox)
{
  const DerivedInfo &calculated = CommonInterface::Calculated();
  TCHAR sTmp[32];

  if (!calculated.altitude_agl_valid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(calculated.altitude_agl, sTmp,
                            ARRAY_SIZE(sTmp), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(calculated.altitude_agl, sTmp,
                                     ARRAY_SIZE(sTmp));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);

  // Set Color (red/black)
  infobox.SetColor(calculated.altitude_agl <
      XCSoarInterface::SettingsComputer().task.route_planner.safety_height_terrain ? 1 : 0);
}
开发者ID:macsux,项目名称:XCSoar,代码行数:28,代码来源:Altitude.cpp

示例12: abs

void
InfoBoxContentFinalETE::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;

  if (!task_stats.task_valid || !task_stats.total.achievable() ||
      !positive(task_stats.total.TimeRemaining)) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  int dd = abs((int)task_stats.total.TimeRemaining) % (3600 * 24);
  int hours = (dd / 3600);
  int mins = (dd / 60 - hours * 60);
  int seconds = (dd - mins * 60 - hours * 3600);
  hours = hours % 24;

  if (hours > 0) { // hh:mm, ss
    // Set Value
    _stprintf(tmp, _T("%02d:%02d"), hours, mins);
    infobox.SetValue(tmp);

    // Set Comment
    _stprintf(tmp, _T("%02d"), seconds);
    infobox.SetComment(tmp);
  } else { // mm:ss
    // Set Value
    _stprintf(tmp, _T("%02d:%02d"), mins, seconds);
    infobox.SetValue(tmp);

    // Set Comment
    infobox.SetComment(_T(""));
  }
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:35,代码来源:Task.cpp

示例13: sizeof

void
InfoBoxContentAltitudeAGL::Update(InfoBoxWindow &infobox)
{
  TCHAR sTmp[32];

  if (!XCSoarInterface::Calculated().TerrainValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(XCSoarInterface::Basic().AltitudeAGL, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(XCSoarInterface::Basic().AltitudeAGL, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::AltitudeUnit);

  if (XCSoarInterface::Basic().AltitudeAGL <
      XCSoarInterface::SettingsComputer().safety_height_terrain)
    // red
    infobox.SetColor(1);
  else
    infobox.SetColor(0);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:30,代码来源:Altitude.cpp

示例14: iround

void
InfoBoxContentFlightLevel::Update(InfoBoxWindow &infobox)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  const SETTINGS_COMPUTER &settings_computer =
    CommonInterface::SettingsComputer();
  TCHAR sTmp[32];

  if (basic.pressure_altitude_available) {
    fixed Altitude = Units::ToUserUnit(basic.pressure_altitude, unFeet);

    // Title color black
    infobox.SetColorTop(0);

    // Set Value
    _stprintf(sTmp, _T("%03d"), iround(Altitude/100));
    infobox.SetValue(sTmp);

    // Set Comment
    _stprintf(sTmp, _T("%dft"), iround(Altitude));
    infobox.SetComment(sTmp);

  } else if (basic.gps_altitude_available &&
             settings_computer.pressure_available) {
    // Take gps altitude as baro altitude. This is inaccurate but still fits our needs.
    const AtmosphericPressure &qnh = settings_computer.pressure;
    fixed Altitude = Units::ToUserUnit(qnh.QNHAltitudeToPressureAltitude(basic.gps_altitude), unFeet);

    // Title color red
    infobox.SetColorTop(1);

    // Set Value
    _stprintf(sTmp, _T("%03d"), iround(Altitude/100));
    infobox.SetValue(sTmp);

    // Set Comment
    _stprintf(sTmp, _T("%dft"), iround(Altitude));
    infobox.SetComment(sTmp);

  } else if ((basic.baro_altitude_available || basic.gps_altitude_available) &&
             !settings_computer.pressure_available) {
    infobox.SetInvalid();
    infobox.SetComment(_("no QNH"));
  } else {
    infobox.SetInvalid();
  }
}
开发者ID:macsux,项目名称:XCSoar,代码行数:47,代码来源:Altitude.cpp

示例15: SetCommentFromWaypointName

void
InfoBoxContentAlternateGR::Update(InfoBoxWindow &infobox)
{
  if (protected_task_manager == NULL) {
    infobox.SetInvalid();
    return;
  }

  const AbortTask::AlternateVector alternates =
    protected_task_manager->getAlternates();

  if (alternates.size() > 0 && index >= alternates.size())
    index = alternates.size() - 1;

  TCHAR tmp[32];
  _stprintf(tmp, _T("Altrn %d GR"), index+1);
  infobox.SetTitle(tmp);

  const Waypoint* way_point = (alternates.size()>index) ? &alternates[index].first : NULL;

  SetCommentFromWaypointName(infobox, way_point);
  if (!way_point) {
    infobox.SetInvalid();
    return;
  }

  const GlideResult& solution = alternates[index].second;
  fixed gradient = ::AngleToGradient(solution.destination_angle_ground());

  if (negative(gradient)) {
    infobox.SetColor(0);
    infobox.SetValue(_T("+++"));
    return;
  }
  if (::GradientValid(gradient)) {
    TCHAR tmp[32];
    _stprintf(tmp, _T("%d"), (int)gradient);
    infobox.SetValue(tmp);
  } else {
    infobox.SetInvalid();
  }

  // Set Color (blue/black)
  infobox.SetColor(solution.glide_reachable(true) ? 2 : 0);
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:45,代码来源:Alternate.cpp


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