本文整理汇总了C++中MoreData::HasTimeRetreatedSince方法的典型用法代码示例。如果您正苦于以下问题:C++ MoreData::HasTimeRetreatedSince方法的具体用法?C++ MoreData::HasTimeRetreatedSince怎么用?C++ MoreData::HasTimeRetreatedSince使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoreData
的用法示例。
在下文中一共展示了MoreData::HasTimeRetreatedSince方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/**
* Retrieves GPS data from the DeviceBlackboard
* @param nmea_info New GPS data
*/
void
GlideComputerBlackboard::ReadBlackboard(const MoreData &nmea_info)
{
_time_retreated = nmea_info.HasTimeRetreatedSince(gps_info);
if (_time_retreated) {
// backwards in time, so reset last
last_gps_info = nmea_info;
last_calculated_info = calculated_info;
_time_retreated = true;
} else if (nmea_info.time > gps_info.time) {
// forwards in time, so save state
last_gps_info = gps_info;
last_calculated_info = calculated_info;
}
gps_info = nmea_info;
// if time hasn't advanced, don't copy last calculated
}
示例2: UpdateGR
void
GlideComputerAirData::GR(const MoreData &basic, const MoreData &last_basic,
const DerivedInfo &calculated, VarioInfo &vario_info)
{
if (!basic.NavAltitudeAvailable() || !last_basic.NavAltitudeAvailable()) {
vario_info.ld_vario = INVALID_GR;
vario_info.gr = INVALID_GR;
return;
}
if (basic.HasTimeRetreatedSince(last_basic)) {
vario_info.ld_vario = INVALID_GR;
vario_info.gr = INVALID_GR;
}
const bool time_advanced = basic.HasTimeAdvancedSince(last_basic);
if (time_advanced) {
fixed DistanceFlown = basic.location.Distance(last_basic.location);
// Glide ratio over ground
vario_info.gr =
UpdateGR(vario_info.gr, DistanceFlown,
last_basic.nav_altitude - basic.nav_altitude, fixed(0.1));
if (calculated.flight.flying && !calculated.circling)
gr_calculator.Add((int)DistanceFlown, (int)basic.nav_altitude);
}
// Lift / drag instantaneous from vario, updated every reading..
if (basic.total_energy_vario_available && basic.airspeed_available &&
calculated.flight.flying) {
vario_info.ld_vario =
UpdateGR(vario_info.ld_vario, basic.indicated_airspeed,
-basic.total_energy_vario, fixed(0.3));
} else {
vario_info.ld_vario = INVALID_GR;
}
}