Skip to content

Commit

Permalink
Add hAccuracy and vAccuracy.
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenD98 committed Sep 1, 2024
1 parent f88ec6f commit 2bb7bfd
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/core/positioning/positioningmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void PositioningModel::refreshData()
double distanceUnitFactor = QgsUnitTypes::fromUnitToUnitFactor( Qgis::DistanceUnit::Meters, distanceUnits() );
QString distanceUnitAbbreviation = QgsUnitTypes::toAbbreviatedString( distanceUnits() );


QString coord1Label;
QString coord2Label;

Expand Down Expand Up @@ -84,9 +83,6 @@ void PositioningModel::refreshData()
}
}

updateInfo( coord1Label, coord1Value );
updateInfo( coord2Label, coord2Value );

QString altitude = "";
if ( positioningSource()->positionInformation().elevationValid() )
{
Expand Down Expand Up @@ -115,15 +111,31 @@ void PositioningModel::refreshData()
altitude = tr( "N/A" );
}

updateInfo( "Altitude", altitude );

QString speed = "";
if ( positioningSource()->positionInformation().speedValid() )
speed = QLocale::system().toString( positioningSource()->positionInformation().speed(), 'f', 3 ) + " m/s";
else
speed = tr( "N/A" );


QString hAccuracy = "";
if ( positioningSource()->positionInformation().haccValid() )
hAccuracy = QLocale::system().toString( positioningSource()->positionInformation().hacc() * distanceUnitFactor, 'f', 3 ) + ' ' + distanceUnitAbbreviation;
else
hAccuracy = tr( "N/A" );

QString vAccuracy = "";
if ( positioningSource()->positionInformation().vaccValid() )
vAccuracy = QLocale::system().toString( positioningSource()->positionInformation().vacc() * distanceUnitFactor, 'f', 3 ) + ' ' + distanceUnitAbbreviation;
else
vAccuracy = tr( "N/A" );

updateInfo( coord1Label, coord1Value );
updateInfo( coord2Label, coord2Value );
updateInfo( "Altitude", altitude );
updateInfo( "Speed", speed );
updateInfo( "H. Accuracy", hAccuracy );
updateInfo( "V. Accuracy", vAccuracy );
}

void PositioningModel::updateInfo( const QString &name, const QVariant &value )
Expand Down

0 comments on commit 2bb7bfd

Please sign in to comment.