static void Update(const MoreData &basic, const DerivedInfo &calculated) { const TeamInfo &teamcode_info = calculated; const TeamCodeSettings &settings = CommonInterface::GetComputerSettings().team_code; StaticString<100> buffer; if (teamcode_info.teammate_available && basic.track_available) { FormatAngleDelta(buffer.buffer(), buffer.MAX_SIZE, teamcode_info.teammate_vector.bearing - basic.track); } else { buffer = _T("---"); } SetFormValue(*wf, _T("prpRelBearing"), buffer); if (teamcode_info.teammate_available) { LoadFormProperty(*wf, _T("prpBearing"), teamcode_info.teammate_vector.bearing.Degrees()); LoadFormProperty(*wf, _T("prpRange"), UnitGroup::DISTANCE, teamcode_info.teammate_vector.distance); } SetFormValue(*wf, _T("prpOwnCode"), teamcode_info.own_teammate_code.GetCode()); SetFormValue(*wf, _T("prpMateCode"), settings.team_code.GetCode()); SetFormValue(*wf, _T("prpFlarmLock"), settings.team_flarm_id.IsDefined() ? settings.team_flarm_callsign.c_str() : _T("")); }
void TeamCodeWidget::Update(const MoreData &basic, const DerivedInfo &calculated) { const TeamInfo &teamcode_info = calculated; const TeamCodeSettings &settings = CommonInterface::GetComputerSettings().team_code; SetText(RELATIVE_BEARING, teamcode_info.teammate_available && basic.track_available ? FormatAngleDelta(teamcode_info.teammate_vector.bearing - basic.track).c_str() : _T("---")); if (teamcode_info.teammate_available) { SetText(BEARING, FormatBearing(teamcode_info.teammate_vector.bearing).c_str()); SetText(RANGE, FormatUserDistanceSmart(teamcode_info.teammate_vector.distance)); } SetText(OWN_CODE, teamcode_info.own_teammate_code.GetCode()); SetText(MATE_CODE, settings.team_code.GetCode()); SetText(FLARM_LOCK, settings.team_flarm_id.IsDefined() ? settings.team_flarm_callsign.c_str() : _T("")); }
gcc_const static inline StringBuffer<TCHAR, 16> FormatAngleDelta(Angle value) { StringBuffer<TCHAR, 16> buffer; FormatAngleDelta(buffer.data(), buffer.capacity(), value); return buffer; }
/** * Updates all the dialogs fields, that are changing frequently. * e.g. climb speed, distance, height */ void FlarmTrafficDetailsWidget::UpdateChanging(const MoreData &basic) { TCHAR tmp[40]; const TCHAR *value; const FlarmTraffic* target = basic.flarm.traffic.FindTraffic(target_id); bool target_ok = target && target->IsDefined(); // Fill distance/direction field if (target_ok) { FormatUserDistanceSmart(target->distance, tmp, 20, fixed(1000)); TCHAR *p = tmp + _tcslen(tmp); *p++ = _T(' '); FormatAngleDelta(p, 20, target->Bearing() - basic.track); value = tmp; } else value = _T("--"); SetText(DISTANCE, value); // Fill altitude field if (target_ok) { TCHAR *p = tmp; if (target->altitude_available) { FormatUserAltitude(target->altitude, p, 20); p += _tcslen(p); *p++ = _T(' '); } Angle dir = Angle::FromXY(target->distance, target->relative_altitude); FormatVerticalAngleDelta(p, 20, dir); value = tmp; } else value = _T("--"); SetText(ALTITUDE, value); // Fill climb speed field if (target_ok && target->climb_rate_avg30s_available) { FormatUserVerticalSpeed(target->climb_rate_avg30s, tmp, 20); value = tmp; } else value = _T("--"); SetText(VARIO, value); }
/** * Updates all the dialogs fields, that are changing frequently. * e.g. climb speed, distance, height */ static void UpdateChanging() { TCHAR tmp[20]; const FlarmTraffic* target = XCSoarInterface::Basic().flarm.traffic.FindTraffic(target_id); bool target_ok = target && target->IsDefined(); // Fill distance field if (target_ok) FormatUserDistanceSmart(target->distance, tmp, 20, fixed(1000)); else _tcscpy(tmp, _T("--")); SetFormValue(*wf, _T("prpDistance"), tmp); // Fill horizontal direction field if (target_ok) FormatAngleDelta(tmp, ARRAY_SIZE(tmp), target->Bearing() - CommonInterface::Basic().track); else _tcscpy(tmp, _T("--")); SetFormValue(*wf, _T("prpDirectionH"), tmp); // Fill altitude field if (target_ok && target->altitude_available) FormatUserAltitude(target->altitude, tmp, 20); else _tcscpy(tmp, _T("--")); SetFormValue(*wf, _T("prpAltitude"), tmp); // Fill vertical direction field if (target_ok) { Angle dir = Angle::Radians((fixed)atan2(target->relative_altitude, target->distance)).AsDelta(); FormatVerticalAngleDelta(tmp, ARRAY_SIZE(tmp), dir); } else _tcscpy(tmp, _T("--")); SetFormValue(*wf, _T("prpDirectionV"), tmp); // Fill climb speed field if (target_ok && target->climb_rate_avg30s_available) FormatUserVerticalSpeed(target->climb_rate_avg30s, tmp, 20); else _tcscpy(tmp, _T("--")); SetFormValue(*wf, _T("prpVSpeed"), tmp); }
void InfoBoxData::SetCommentFromBearingDifference(Angle delta) { FormatAngleDelta(comment.buffer(), comment.MAX_SIZE, delta); }
void InfoBoxData::SetValueFromBearingDifference(Angle delta) { FormatAngleDelta(value.buffer(), value.MAX_SIZE, delta); }