// From a QvariantMap representing a location response from the Location Manager fill the lists of // QGeoSatelliteInfo instances intended to be emitted via satellitesInUseUpdated() and // satellitesInViewUpdated() signals. void QGeoSatelliteInfoSourceBbPrivate::populateSatelliteLists(const QVariantMap &map) { // populate _currentSatelliteInfo QVariantMap datMap = map.value("dat").toMap(); QVariantList satelliteList = datMap.value("satellites").toList(); _satellitesInView.clear(); _satellitesInUse.clear(); Q_FOREACH (const QVariant &satelliteData, satelliteList) { datMap = satelliteData.toMap(); QGeoSatelliteInfo satelliteInfo = QGeoSatelliteInfo(); if (datMap.contains("id")) satelliteInfo.setSatelliteIdentifier(static_cast<int>(datMap.value("id").toDouble())); satelliteInfo.setSatelliteSystem(determineSatSystem(satelliteInfo.satelliteIdentifier())); if (datMap.contains("cno")) satelliteInfo.setSignalStrength(static_cast<int>(datMap.value("cno").toDouble())); // attributes if (datMap.contains("elevation")) satelliteInfo.setAttribute(QGeoSatelliteInfo::Elevation, static_cast<qreal>(datMap.value("elevation").toDouble())); else satelliteInfo.removeAttribute(QGeoSatelliteInfo::Elevation); if (datMap.contains("azimuth")) satelliteInfo.setAttribute(QGeoSatelliteInfo::Azimuth, static_cast<qreal>(datMap.value("azimuth").toDouble())); else satelliteInfo.removeAttribute(QGeoSatelliteInfo::Azimuth); // each satellite in this list is considered "in view" _satellitesInView.append(satelliteInfo); if (datMap.value("used").toBool() == true) _satellitesInUse.append(satelliteInfo); }
QT_BEGIN_NAMESPACE inline bool operator<(const QGeoSatelliteInfo& a, const QGeoSatelliteInfo& b) { return a.satelliteIdentifier() < b.satelliteIdentifier(); }