本文整理汇总了C++中InfoBoxData::SetCommentFromDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoBoxData::SetCommentFromDistance方法的具体用法?C++ InfoBoxData::SetCommentFromDistance怎么用?C++ InfoBoxData::SetCommentFromDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InfoBoxData
的用法示例。
在下文中一共展示了InfoBoxData::SetCommentFromDistance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* 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: fixed
void
UpdateInfoBoxRadial(InfoBoxData &data)
{
const TaskStats &task_stats = CommonInterface::Calculated().task_stats;
const GeoVector &vector_remaining = task_stats.current_leg.vector_remaining;
if (!task_stats.task_valid || !vector_remaining.IsValid() ||
vector_remaining.distance <= fixed(10)) {
data.SetInvalid();
return;
}
// Set Value
data.SetValue(vector_remaining.bearing.Reciprocal());
data.SetValueColor(task_stats.inside_oz ? 3 : 0);
data.SetCommentFromDistance(vector_remaining.distance);
}
示例3:
void
UpdateInfoBoxGRCruise(InfoBoxData &data)
{
const auto &basic = CommonInterface::Basic();
const auto &calculated = CommonInterface::Calculated();
const auto cruise_gr = calculated.cruise_gr;
if (!::GradientValid(cruise_gr)) {
data.SetInvalid();
return;
}
// Set Value
data.SetValueFromGlideRatio(cruise_gr);
if (basic.location_available)
data.SetCommentFromDistance(basic.location.DistanceS(calculated.cruise_start_location));
else
data.SetCommentInvalid();
}