本文整理汇总了C++中InfoBoxData::SetValueUnit方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoBoxData::SetValueUnit方法的具体用法?C++ InfoBoxData::SetValueUnit怎么用?C++ InfoBoxData::SetValueUnit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InfoBoxData
的用法示例。
在下文中一共展示了InfoBoxData::SetValueUnit方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormatUserVerticalSpeed
static void
SetVSpeed(InfoBoxData &data, fixed value)
{
TCHAR buffer[32];
FormatUserVerticalSpeed(value, buffer, false);
data.SetValue(buffer[0] == _T('+') ? buffer + 1 : buffer);
data.SetValueUnit(Units::current.vertical_speed_unit);
}
示例2:
void
InfoBoxContentTemperatureForecast::Update(InfoBoxData &data)
{
auto temperature = CommonInterface::GetComputerSettings().forecast_temperature;
data.SetValue(_T("%2.1f"), temperature.ToUser());
data.SetValueUnit(Units::current.temperature_unit);
}
示例3:
void
UpdateInfoBoxTaskSpeedHour(InfoBoxData &data)
{
const WindowStats &window =
CommonInterface::Calculated().task_stats.last_hour;
if (negative(window.duration)) {
data.SetInvalid();
return;
}
data.SetValue(_T("%2.0f"), Units::ToUserTaskSpeed(window.speed));
data.SetValueUnit(Units::current.task_speed_unit);
}
示例4:
void
InfoBoxContentTemperature::Update(InfoBoxData &data)
{
const NMEAInfo &basic = XCSoarInterface::Basic();
if (!basic.temperature_available) {
data.SetInvalid();
return;
}
// Set Value
data.SetValue(_T("%2.1f"),
Units::ToUserTemperature(basic.temperature));
data.SetValueUnit(Units::current.temperature_unit);
}
示例5:
void
UpdateInfoBoxHeadWind(InfoBoxData &data)
{
const DerivedInfo &info = CommonInterface::Calculated();
if (!info.head_wind_available) {
data.SetInvalid();
return;
}
// Set Value
data.SetValue(_T("%2.0f"),
Units::ToUserWindSpeed(info.head_wind));
// Set Unit
data.SetValueUnit(Units::current.wind_speed_unit);
}
示例6: SetValueFromFixed
void
InfoBoxContentTaskSpeedInstant::Update(InfoBoxData &data)
{
const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
if (!task_stats.task_valid || !task_stats.IsPirkerSpeedAvailable()) {
data.SetInvalid();
return;
}
// Set Value
SetValueFromFixed(data, _T("%2.0f"),
Units::ToUserTaskSpeed(task_stats.get_pirker_speed()));
// Set Unit
data.SetValueUnit(Units::current.task_speed_unit);
}
示例7:
void
InfoBoxContentTaskSpeedAchieved::Update(InfoBoxData &data)
{
const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
if (!task_stats.task_valid ||
!task_stats.total.remaining_effective.IsDefined()) {
data.SetInvalid();
return;
}
// Set Value
data.SetValue(_T("%2.0f"),
Units::ToUserTaskSpeed(task_stats.total.remaining_effective.get_speed()));
// Set Unit
data.SetValueUnit(Units::current.task_speed_unit);
}
示例8:
void
InfoBoxContentNextMC0AltitudeDiff::Update(InfoBoxData &data)
{
const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
const GlideResult &next_solution = task_stats.current_leg.solution_mc0;
if (!task_stats.task_valid || !next_solution.IsDefined()) {
data.SetInvalid();
return;
}
// Set Value
TCHAR tmp[32];
Units::FormatUserAltitude(next_solution.altitude_difference, tmp, 32, false);
data.SetValue(tmp);
// Set Unit
data.SetValueUnit(Units::current.altitude_unit);
}
示例9: FormatSmallUserDistance
void
UpdateInfoBoxCircleDiameter(InfoBoxData &data)
{
if (!CommonInterface::Basic().airspeed_available.IsValid()) {
data.SetInvalid();
return;
}
const Angle turn_rate =
CommonInterface::Calculated().turn_rate_heading_smoothed.Absolute();
// deal with div zero and small turn rates
if (turn_rate < Angle::Degrees(1)) {
data.SetInvalid();
return;
}
const fixed circle_diameter = CommonInterface::Basic().true_airspeed
/ turn_rate.Radians()
* fixed(2); // convert turn rate to radians/s and double it to get estimated circle diameter
if (circle_diameter > fixed (2000)){ // arbitrary estimated that any diameter bigger than 2km will not be interesting
data.SetInvalid();
return;
}
TCHAR buffer[32];
Unit unit = FormatSmallUserDistance(buffer, circle_diameter, false, 0);
data.SetValue (buffer);
data.SetValueUnit(unit);
const fixed circle_duration =
Angle::FullCircle().Native() / turn_rate.Native();
StaticString<16> duration_buffer;
duration_buffer.Format(_T("%u s"), int(circle_duration));
_tcscpy (buffer, duration_buffer);
data.SetComment (buffer);
}