Example #1
0
void
InfoBoxContentTeamDistance::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::SettingsComputer().TeammateCodeValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  TCHAR tmp[32];
  Units::FormatUserDistance(XCSoarInterface::Calculated().TeammateRange,
                            tmp, 32, false);
  infobox.SetValue(tmp);

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

  // 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);
}
Example #2
0
void
InfoBoxContentTeamBearing::Update(InfoBoxWindow &infobox)
{
  if (XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined() ||
      XCSoarInterface::SettingsComputer().TeammateCodeValid == true){
    // Set Value
    infobox.SetValue(XCSoarInterface::Calculated().TeammateBearing,
                     _T("T"));
  }
  else
    infobox.SetValueInvalid();

  // 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);
}
Example #3
0
void
InfoBoxContentTeamCode::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::SettingsComputer().TeamCodeRefWaypoint) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  infobox.SetValue(XCSoarInterface::Calculated().OwnTeamCode.GetCode());

  // Set Comment
  if (XCSoarInterface::SettingsComputer().TeammateCodeValid == true){
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeammateCode.GetCode());
    if (!XCSoarInterface::SettingsComputer().TeamFlarmTracking)
      infobox.SetColorBottom(0);
    else if (XCSoarInterface::Basic().flarm.FindTraffic(
        XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
      infobox.SetColorBottom(2);
    else
      infobox.SetColorBottom(1);
  }
  else
    infobox.SetCommentInvalid();
}
Example #4
0
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);
}
Example #5
0
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);
}
Example #6
0
void
InfoBoxContentTeamBearing::Update(InfoBoxWindow &infobox)
{
  // Set Value
  TCHAR tmp[32];
  _stprintf(tmp, _T("%2.0f")_T(DEG)_T("T"), (double)
            XCSoarInterface::Calculated().TeammateBearing.value_degrees());
  infobox.SetValue(tmp);

  // 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);
}