本文整理汇总了C++中TPosition::Speed方法的典型用法代码示例。如果您正苦于以下问题:C++ TPosition::Speed方法的具体用法?C++ TPosition::Speed怎么用?C++ TPosition::Speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPosition
的用法示例。
在下文中一共展示了TPosition::Speed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeliverPositionerResults
void XQLocationPrivate::DeliverPositionerResults(TPositionSatelliteInfo aPositionInfo)
{
TPosition pos;
aPositionInfo.GetPosition(pos);
// Handle speed reporting
float speed = 0;
if (speedAvailable) {
// Positioning module is able to offer speed information
TCourse course;
aPositionInfo.GetCourse(course);
speed = course.Speed();
if (isnan(speed)) {
speed = 0;
}
} else {
// Positioning module does not offer speed information
// => Speed is calculated using position information & timestamps
TTime posTime;
TTimeIntervalSeconds interval;
for (int i = iPositions.Count()-1 ; i >= 0; i--) {
if (pos.Time().SecondsFrom(iPositions[i].Time(),interval) == KErrNone) {
if (interval.Int() > 10) {
pos.Speed(iPositions[i], speed);
break;
}
}
}
while (iPositions.Count() > 0) {
if (pos.Time().SecondsFrom(iPositions[0].Time(),interval) == KErrNone) {
if (interval.Int() > 60) {
iPositions.Remove(0);
} else {
break;
}
}
}
if (iPositions.Count() > 0) {
if (pos.Time().SecondsFrom(iPositions[iPositions.Count()-1].Time(),interval) == KErrNone) {
if (interval.Int() > 1) {
iPositions.Append(pos);
}
}
} else {
iPositions.Append(pos);
}
// Accept speed from range 0.01 m/s (0.036 km/h) to 200 m/s (720 km/h)
if (speed < 0.01 || speed > 200) {
speed = 0;
}
}
if (speed != iPreviousSpeed) {
emit ipParent->speedChanged(speed);
}
iPreviousSpeed = speed;
// Handle satellite information reporting
if (satelliteInfoAvailable) {
if (aPositionInfo.NumSatellitesInView() != iPreviousNumSatellitesInView) {
emit ipParent->numberOfSatellitesInViewChanged(aPositionInfo.NumSatellitesInView());
}
iPreviousNumSatellitesInView = aPositionInfo.NumSatellitesInView();
if (aPositionInfo.NumSatellitesUsed() != iPreviousNumSatellitesUsed) {
emit ipParent->numberOfSatellitesUsedChanged(aPositionInfo.NumSatellitesUsed());
}
iPreviousNumSatellitesUsed = aPositionInfo.NumSatellitesUsed();
}
// Handle position information reporting
if (iPreviousPosition.Latitude() != pos.Latitude() ||
iPreviousPosition.Longitude() != pos.Longitude() ||
iPreviousPosition.Altitude() != pos.Altitude()) {
if (!isnan(pos.Latitude()) || !isnan(pos.Longitude()) || !isnan(pos.Altitude())) {
emit ipParent->locationChanged(pos.Latitude(),pos.Longitude(),pos.Altitude(),speed);
}
if (iPreviousPosition.Latitude() != pos.Latitude()) {
if (!isnan(pos.Latitude())) {
emit ipParent->latitudeChanged(pos.Latitude(),pos.HorizontalAccuracy());
}
}
if (iPreviousPosition.Longitude() != pos.Longitude()) {
if (!isnan(pos.Longitude())) {
emit ipParent->longitudeChanged(pos.Longitude(),pos.HorizontalAccuracy());
}
}
if (iPreviousPosition.Altitude() != pos.Altitude()) {
if (!isnan(pos.Altitude())) {
emit ipParent->altitudeChanged(pos.Altitude(),pos.VerticalAccuracy());
}
}
}
iPreviousPosition = pos;
if (iSingleUpdate) {
stopUpdates();
iSingleUpdate = EFalse;
}
}