/* * 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(); }
void InfoBoxContentHorizon::Update(InfoBoxData &data) { if (!CommonInterface::Basic().attitude.IsBankAngleUseable() && !CommonInterface::Basic().attitude.IsPitchAngleUseable()) { data.SetInvalid(); return; } data.SetCustom(); }
void InfoBoxContentThermalAssistant::Update(InfoBoxData &data) { if (!CommonInterface::Calculated().circling) { data.SetInvalid(); return; } data.SetCustom(); renderer.Update(CommonInterface::Basic().attitude, CommonInterface::Calculated()); }
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(); }
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(); }
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 }
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); }
void InfoBoxContentTaskProgress::Update(InfoBoxData &data) { data.SetCustom(); }
void InfoBoxContentThermalBand::Update(InfoBoxData &data) { data.SetCustom(); }