예제 #1
0
파일: Task.cpp 프로젝트: istaveren/XCSoar
/*
 * The NextArrow infobox contains an arrow pointing at the next waypoint.
 * This function updates the text fields in the infobox.
 */
void
InfoBoxContentNextArrow::Update(InfoBoxData &data)
{
  // use proper non-terminal next task stats
  const NMEAInfo &basic = CommonInterface::Basic();
  const TaskStats &task_stats = CommonInterface::Calculated().task_stats;
  const GeoVector &vector_remaining = task_stats.current_leg.vector_remaining;

  // Check if data is valid
  bool distance_valid = task_stats.task_valid && vector_remaining.IsValid();
  bool angle_valid = distance_valid && basic.track_available;

  // Set title. Use waypoint name if available.
  const Waypoint *way_point = protected_task_manager != nullptr
    ? protected_task_manager->GetActiveWaypoint()
    : nullptr;
  if (!way_point)
    data.SetTitle(_("Next arrow"));
  else
    data.SetTitle(way_point->name.c_str());

  // Set value
  if (angle_valid)
    data.SetCustom(); // Enables OnCustomPaint
  else
    data.SetInvalid();

  // Set comment
  if (distance_valid)
    data.SetCommentFromDistance(vector_remaining.distance);
  else
    data.SetCommentInvalid();
}
예제 #2
0
void
InfoBoxContentHorizon::Update(InfoBoxData &data)
{
  if (!CommonInterface::Basic().attitude.IsBankAngleUseable() &&
      !CommonInterface::Basic().attitude.IsPitchAngleUseable()) {
    data.SetInvalid();
    return;
  }

  data.SetCustom();
}
예제 #3
0
void
InfoBoxContentThermalAssistant::Update(InfoBoxData &data)
{
  if (!CommonInterface::Calculated().circling) {
    data.SetInvalid();
    return;
  }

  data.SetCustom();

  renderer.Update(CommonInterface::Basic().attitude,
                  CommonInterface::Calculated());
}
예제 #4
0
파일: Trace.cpp 프로젝트: StefanL74/XCSoar
void
InfoBoxContentSpark::SetVSpeedComment(InfoBoxData &data,
                                      const TraceVariableHistory &var)
{
  if (var.empty())
    return;

  TCHAR sTmp[32];
  FormatUserVerticalSpeed(var.last(), sTmp,
                          ARRAY_SIZE(sTmp));
  data.SetComment(sTmp);

  data.SetCustom();
}
예제 #5
0
파일: Trace.cpp 프로젝트: StefanL74/XCSoar
void
InfoBoxContentBarogram::Update(InfoBoxData &data)
{
  const MoreData &basic = CommonInterface::Basic();
  TCHAR sTmp[32];

  if (basic.NavAltitudeAvailable()) {
    FormatUserAltitude(basic.nav_altitude, sTmp,
                       ARRAY_SIZE(sTmp));
    data.SetComment(sTmp);
  } else
    data.SetCommentInvalid();

  data.SetCustom();
}
예제 #6
0
파일: Other.cpp 프로젝트: rjsikarwar/XCSoar
void
InfoBoxContentHorizon::Update(InfoBoxData &data)
{
#ifdef NO_HORIZON
  data.SetInvalid();
  data.SetComment(_("Disabled"));
#else
  if (!CommonInterface::Basic().attitude.bank_angle_available &&
      !CommonInterface::Basic().attitude.pitch_angle_available) {
    data.SetInvalid();
    return;
  }

  data.SetCustom();
#endif
}
예제 #7
0
파일: Weather.cpp 프로젝트: Adrien81/XCSoar
void
InfoBoxContentWindArrow::Update(InfoBoxData &data)
{
  const DerivedInfo &info = CommonInterface::Calculated();
  if (!info.wind_available || info.wind.IsZero()) {
    data.SetInvalid();
    return;
  }

  data.SetCustom();

  TCHAR speed_buffer[16], bearing_buffer[16];
  FormatUserWindSpeed(info.wind.norm, speed_buffer, true, false);
  FormatBearing(bearing_buffer, ARRAY_SIZE(bearing_buffer), info.wind.bearing);

  StaticString<32> buffer;
  buffer.Format(_T("%s / %s"), bearing_buffer, speed_buffer);
  data.SetComment(buffer);
}
예제 #8
0
파일: Trace.cpp 프로젝트: StefanL74/XCSoar
void
InfoBoxContentTaskProgress::Update(InfoBoxData &data)
{
  data.SetCustom();
}
예제 #9
0
파일: Trace.cpp 프로젝트: StefanL74/XCSoar
void
InfoBoxContentThermalBand::Update(InfoBoxData &data)
{
  data.SetCustom();
}