本文整理汇总了C++中InfoBoxData::SetValueColor方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoBoxData::SetValueColor方法的具体用法?C++ InfoBoxData::SetValueColor怎么用?C++ InfoBoxData::SetValueColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InfoBoxData
的用法示例。
在下文中一共展示了InfoBoxData::SetValueColor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: assert
void
UpdateInfoBoxTaskAATimeDelta(InfoBoxData &data)
{
const auto &calculated = CommonInterface::Calculated();
const TaskStats &task_stats = calculated.ordered_task_stats;
const CommonStats &common_stats = calculated.common_stats;
if (!task_stats.has_targets ||
!task_stats.total.IsAchievable()) {
data.SetInvalid();
return;
}
assert(!negative(task_stats.total.time_remaining_start));
fixed diff = task_stats.total.time_remaining_start -
common_stats.aat_time_remaining;
TCHAR value[32];
TCHAR comment[32];
const int dd = abs((int)diff);
FormatTimeTwoLines(value, comment, dd);
data.UnsafeFormatValue(negative(diff) ? _T("-%s") : _T("%s"), value);
data.SetComment(comment);
// Set Color (red/blue/black)
data.SetValueColor(negative(diff) ? 1 :
task_stats.total.time_remaining_start >
common_stats.aat_time_remaining + fixed(5*60) ? 2 : 0);
}
示例4: assert
void
InfoBoxContentTaskAATimeDelta::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 || !task_stats.total.IsAchievable()) {
data.SetInvalid();
return;
}
assert(!negative(task_stats.total.time_remaining));
fixed diff = task_stats.total.time_remaining -
common_stats.aat_time_remaining;
TCHAR HHMMSSsmart[32];
TCHAR SSsmart[32];
const int dd = abs((int)diff);
Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);
data.UnsafeFormatValue(negative(diff) ? _T("-%s") : _T("%s"), HHMMSSsmart);
data.SetComment(SSsmart);
// Set Color (red/blue/black)
data.SetValueColor(negative(diff) ? 1 :
task_stats.total.time_remaining >
common_stats.aat_time_remaining + fixed(5*60) ? 2 : 0);
}
示例5: lease
void
InfoBoxContentAlternateGR::Update(InfoBoxData &data)
{
if (protected_task_manager == NULL) {
data.SetInvalid();
return;
}
ProtectedTaskManager::Lease lease(*protected_task_manager);
const AlternateList &alternates = lease->GetAlternates();
const AlternatePoint *alternate;
if (!alternates.empty()) {
if (index >= alternates.size())
index = alternates.size() - 1;
alternate = &alternates[index];
} else {
alternate = NULL;
}
data.FormatTitle(_T("Altn %d GR"), index + 1);
if (alternate == NULL) {
data.SetInvalid();
return;
}
data.SetComment(alternate->waypoint.name.c_str());
fixed gradient =
::AngleToGradient(alternate->solution.DestinationAngleGround());
if (negative(gradient)) {
data.SetValueColor(0);
data.SetValue(_T("+++"));
return;
}
if (::GradientValid(gradient)) {
data.SetValueFromGlideRatio(gradient);
} else {
data.SetInvalid();
}
// Set Color (blue/black)
data.SetValueColor(alternate->solution.IsFinalGlide() ? 2 : 0);
}
示例6: SetVSpeed
void
UpdateInfoBoxThermal30s(InfoBoxData &data)
{
SetVSpeed(data, CommonInterface::Calculated().average);
// Set Color (red/black)
data.SetValueColor(Double(CommonInterface::Calculated().average) <
CommonInterface::Calculated().common_stats.current_risk_mc ? 1 : 0);
}
示例7: arrival_s
void
UpdateInfoBoxStartOpenArrival(InfoBoxData &data)
{
const NMEAInfo &basic = CommonInterface::Basic();
const auto &calculated = CommonInterface::Calculated();
const TaskStats &task_stats = calculated.ordered_task_stats;
const GlideResult ¤t_remaining =
task_stats.current_leg.solution_remaining;
const CommonStats &common_stats = CommonInterface::Calculated().common_stats;
const RoughTimeSpan &open = common_stats.start_open_time_span;
/* reset color that may have been set by a previous call */
data.SetValueColor(0);
if (!basic.time_available || !task_stats.task_valid ||
common_stats.ordered_summary.active != 0 ||
!open.IsDefined() ||
!current_remaining.IsOk()) {
data.SetInvalid();
return;
}
const unsigned arrival_s(basic.time + current_remaining.time_elapsed);
const RoughTime arrival = RoughTime::FromSecondOfDayChecked(arrival_s);
if (open.HasEnded(arrival)) {
data.SetValueInvalid();
data.SetComment(_("Closed"));
} else if (open.HasBegun(arrival)) {
if (open.GetEnd().IsValid()) {
unsigned seconds = SecondsUntil(arrival_s, open.GetEnd());
data.UnsafeFormatValue(_T("%02u:%02u"), seconds / 60, seconds % 60);
data.SetValueColor(3);
} else
data.SetValueInvalid();
data.SetComment(_("Open"));
} else {
unsigned seconds = SecondsUntil(arrival_s, open.GetStart());
data.UnsafeFormatValue(_T("%02u:%02u"), seconds / 60, seconds % 60);
data.SetValueColor(2);
data.SetComment(_("Waiting"));
}
}
示例8: SetVSpeed
void
InfoBoxContentVarioDistance::Update(InfoBoxData &data)
{
if (!XCSoarInterface::Calculated().task_stats.task_valid) {
data.SetInvalid();
return;
}
SetVSpeed(data,
XCSoarInterface::Calculated().task_stats.total.vario.get_value());
// Set Color (red/black)
data.SetValueColor(negative(
XCSoarInterface::Calculated().task_stats.total.vario.get_value()) ? 1 : 0);
}
示例9: fixed
void
UpdateInfoBoxBearing(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);
data.SetValueColor(task_stats.inside_oz ? 3 : 0);
}
示例10:
void
InfoBoxContentAltitudeAGL::Update(InfoBoxData &data)
{
const DerivedInfo &calculated = CommonInterface::Calculated();
if (!calculated.altitude_agl_valid) {
data.SetInvalid();
return;
}
data.SetValueFromAltitude(calculated.altitude_agl);
data.SetCommentFromAlternateAltitude(calculated.altitude_agl);
// Set Color (red/black)
data.SetValueColor(calculated.altitude_agl <
XCSoarInterface::GetComputerSettings().task.route_planner.safety_height_terrain ? 1 : 0);
}
示例11: FormatTimeTwoLines
void
InfoBoxContentTaskAATime::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 || !task_stats.total.IsAchievable()) {
data.SetInvalid();
return;
}
TCHAR value[32];
TCHAR comment[32];
FormatTimeTwoLines(value, comment,
abs((int) common_stats.aat_time_remaining));
data.UnsafeFormatValue(negative(common_stats.aat_time_remaining) ?
_T("-%s") : _T("%s"), value);
data.SetValueColor(negative(common_stats.aat_time_remaining) ? 1 : 0);
data.SetComment(comment);
}
示例12: FormatTimeTwoLines
void
UpdateInfoBoxTaskAATime(InfoBoxData &data)
{
const auto &calculated = CommonInterface::Calculated();
const TaskStats &task_stats = calculated.ordered_task_stats;
const CommonStats &common_stats = calculated.common_stats;
if (!task_stats.has_targets ||
!task_stats.total.IsAchievable()) {
data.SetInvalid();
return;
}
TCHAR value[32];
TCHAR comment[32];
FormatTimeTwoLines(value, comment,
abs((int) common_stats.aat_time_remaining));
data.UnsafeFormatValue(common_stats.aat_time_remaining < 0 ?
_T("-%s") : _T("%s"), value);
data.SetValueColor(common_stats.aat_time_remaining < 0 ? 1 : 0);
data.SetComment(comment);
}