GeoReverseGeocode::GeoReverseGeocode(QObject *parent) : AbstractTwitterModel(parent) , d(new Private) , m_latitude(0) , m_longitude(0) , m_max_results(0) { QHash<int, QByteArray> roles; roles[attrubutes_role] = "attributes"; roles[bounding_box_role] = "bounding_box"; roles[contained_within_role] = "contained_within"; roles[country_role] = "country"; roles[country_code_role] = "countryCode"; roles[full_name_role] = "full_name"; roles[id_role] = "id"; roles[id_str_role] = "id_str"; roles[name_role] = "name"; roles[place_type_role] = "placeType"; roles[url_role] = "url"; setRoleNames(roles); connect(&d->timer, SIGNAL(timeout()), this, SLOT(reload())); connect(this, SIGNAL(latitudeChanged(double)), &d->timer, SLOT(start())); connect(this, SIGNAL(longitudeChanged(double)), &d->timer, SLOT(start())); connect(this, SIGNAL(accuracyChanged(QString)), &d->timer, SLOT(start())); }
void QgsQuickPositionKit::onPositionUpdated( const QGeoPositionInfo &info ) { bool hasPosition = info.coordinate().isValid(); if ( hasPosition != mHasPosition ) { mHasPosition = hasPosition; emit hasPositionChanged(); } // Calculate position QgsPoint position = QgsPoint( info.coordinate().longitude(), info.coordinate().latitude(), info.coordinate().altitude() ); // can be NaN if ( position != mPosition ) { mPosition = position; emit positionChanged(); } // calculate accuracy double accuracy; if ( info.hasAttribute( QGeoPositionInfo::HorizontalAccuracy ) ) accuracy = info.attribute( QGeoPositionInfo::HorizontalAccuracy ); else accuracy = -1; if ( !qgsDoubleNear( accuracy, mAccuracy ) ) { mAccuracy = accuracy; emit accuracyChanged(); } // calculate direction double direction; if ( info.hasAttribute( QGeoPositionInfo::Direction ) ) direction = info.attribute( QGeoPositionInfo::Direction ); else direction = -1; if ( !qgsDoubleNear( direction, mDirection ) ) { mDirection = direction; emit directionChanged(); } // recalculate projected/screen variables onMapSettingsUpdated(); }
void TrackRecorder::positionUpdated(const QGeoPositionInfo &newPos) { if(newPos.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) { m_accuracy = newPos.attribute(QGeoPositionInfo::HorizontalAccuracy); } else { m_accuracy = -1; } emit accuracyChanged(); m_currentPosition = newPos.coordinate(); emit currentPositionChanged(); if(newPos.hasAttribute(QGeoPositionInfo::HorizontalAccuracy) && (newPos.attribute(QGeoPositionInfo::HorizontalAccuracy) > 30.0)) { return; } if(m_tracking) { m_points.append(newPos); emit pointsChanged(); emit timeChanged(); if(m_isEmpty) { m_isEmpty = false; m_minLat = m_maxLat = newPos.coordinate().latitude(); m_minLon = m_maxLon = newPos.coordinate().longitude(); emit isEmptyChanged(); } if(m_points.size() > 1) { // Next line triggers following compiler warning? // \usr\include\qt5\QtCore\qlist.h:452: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow] m_distance += m_points.at(m_points.size()-2).coordinate().distanceTo(m_points.at(m_points.size()-1).coordinate()); emit distanceChanged(); if(newPos.coordinate().latitude() < m_minLat) { m_minLat = newPos.coordinate().latitude(); } else if(newPos.coordinate().latitude() > m_maxLat) { m_maxLat = newPos.coordinate().latitude(); } if(newPos.coordinate().longitude() < m_minLon) { m_minLon = newPos.coordinate().longitude(); } else if(newPos.coordinate().longitude() > m_maxLon) { m_maxLon = newPos.coordinate().longitude(); } } emit newTrackPoint(newPos.coordinate()); } }
void Skill::setAccuracy(int accuracy) { m_accuracy = accuracy; emit accuracyChanged(accuracy); }