本文整理汇总了C++中InfoBoxData::SetValueFromDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoBoxData::SetValueFromDistance方法的具体用法?C++ InfoBoxData::SetValueFromDistance怎么用?C++ InfoBoxData::SetValueFromDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InfoBoxData
的用法示例。
在下文中一共展示了InfoBoxData::SetValueFromDistance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
UpdateInfoBoxNextDistance(InfoBoxData &data)
{
const Waypoint* way_point = protected_task_manager != NULL
? protected_task_manager->GetActiveWaypoint()
: NULL;
// Set title
if (!way_point)
data.SetTitle(_("WP Dist"));
else
data.SetTitle(way_point->name.c_str());
// 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;
if (!task_stats.task_valid || !vector_remaining.IsValid()) {
data.SetInvalid();
return;
}
// Set Value
data.SetValueFromDistance(vector_remaining.distance);
data.SetValueColor(task_stats.inside_oz ? 3 : 0);
if (basic.track_available) {
Angle bd = vector_remaining.bearing - basic.track;
data.SetCommentFromBearingDifference(bd);
} else
data.SetCommentInvalid();
}
示例2: vector
void
UpdateInfoBoxNextDistanceNominal(InfoBoxData &data)
{
const Waypoint* way_point = protected_task_manager != NULL
? protected_task_manager->GetActiveWaypoint()
: NULL;
if (!way_point) {
data.SetInvalid();
return;
}
const NMEAInfo &basic = CommonInterface::Basic();
const TaskStats &task_stats = CommonInterface::Calculated().task_stats;
if (!task_stats.task_valid || !basic.location_available) {
data.SetInvalid();
return;
}
const GeoVector vector(basic.location, way_point->location);
if (!vector.IsValid()) {
data.SetInvalid();
return;
}
// Set Value
data.SetValueFromDistance(vector.distance);
data.SetValueColor(task_stats.inside_oz ? 3 : 0);
data.SetComment(vector.bearing);
}
示例3:
void
InfoBoxContentOLC::Update(InfoBoxData &data)
{
const ComputerSettings &settings_computer =
CommonInterface::GetComputerSettings();
if (!settings_computer.contest.enable || !protected_task_manager) {
data.SetInvalid();
return;
}
int result_index =
(settings_computer.contest.contest == Contest::OLC_LEAGUE) ? 0 : -1;
const ContestResult& result_olc =
CommonInterface::Calculated().contest_stats.GetResult(result_index);
if (result_olc.score < fixed(1)) {
data.SetInvalid();
return;
}
// Set Value
data.SetValueFromDistance(result_olc.distance);
data.UnsafeFormatComment(_T("%.1f pts"), (double)result_olc.score);
}
示例4: FindNearestHorizontalAirspace
void
InfoBoxContentNearestAirspaceHorizontal::Update(InfoBoxData &data)
{
NearestAirspace nearest = FindNearestHorizontalAirspace();
if (!nearest.IsDefined()) {
data.SetInvalid();
return;
}
data.SetValueFromDistance(nearest.distance);
data.SetComment(nearest.airspace->GetName());
}
示例5:
void
UpdateInfoBoxTerrainCollision(InfoBoxData &data)
{
const NMEAInfo &basic = CommonInterface::Basic();
const TerrainInfo &calculated = CommonInterface::Calculated();
if (!basic.location_available || !calculated.terrain_warning) {
data.SetInvalid();
return;
}
fixed distance =
basic.location.Distance(calculated.terrain_warning_location);
data.SetValueFromDistance(distance);
}
示例6:
void
InfoBoxContentTaskAADistanceMin::Update(InfoBoxData &data)
{
const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;
if (!common_stats.ordered_has_targets ||
!task_stats.task_valid) {
data.SetInvalid();
return;
}
// Set Value
data.SetValueFromDistance(task_stats.distance_min);
}
示例7: vector
void
UpdateInfoBoxTakeoffDistance(InfoBoxData &data)
{
const NMEAInfo &basic = CommonInterface::Basic();
const FlyingState &flight = CommonInterface::Calculated().flight;
if (!basic.location_available || !flight.flying ||
!flight.takeoff_location.IsValid()) {
data.SetInvalid();
return;
}
const GeoVector vector(basic.location, flight.takeoff_location);
data.SetValueFromDistance(vector.distance);
if (basic.track_available)
data.SetCommentFromBearingDifference(vector.bearing - basic.track);
else
data.SetCommentInvalid();
}
示例8:
void
UpdateInfoBoxHomeDistance(InfoBoxData &data)
{
const NMEAInfo &basic = CommonInterface::Basic();
const CommonStats &common_stats = CommonInterface::Calculated().common_stats;
if (!common_stats.vector_home.IsValid()) {
data.SetInvalid();
return;
}
// Set Value
data.SetValueFromDistance(common_stats.vector_home.distance);
if (basic.track_available) {
Angle bd = common_stats.vector_home.bearing - basic.track;
data.SetCommentFromBearingDifference(bd);
} else
data.SetCommentInvalid();
}
示例9: if
void
UpdateInfoBoxTeamDistance(InfoBoxData &data)
{
const TeamCodeSettings &settings =
CommonInterface::GetComputerSettings().team_code;
const TeamInfo &teamcode_info = CommonInterface::Calculated();
// Set Value
if (teamcode_info.teammate_available)
data.SetValueFromDistance(teamcode_info.teammate_vector.distance);
else
data.SetValueInvalid();
// Set Comment
if (!settings.team_flarm_id.IsDefined())
data.SetCommentInvalid();
else if (!StringIsEmpty(settings.team_flarm_callsign))
data.SetComment(settings.team_flarm_callsign);
else
data.SetComment(_T("???"));
data.SetCommentColor(teamcode_info.flarm_teammate_code_current ? 2 : 1);
}