本文整理汇总了C++中GeoDataCoordinates::lonToString方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataCoordinates::lonToString方法的具体用法?C++ GeoDataCoordinates::lonToString怎么用?C++ GeoDataCoordinates::lonToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoDataCoordinates
的用法示例。
在下文中一共展示了GeoDataCoordinates::lonToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: receiveGpsCoordinates
void CurrentLocationWidgetPrivate::receiveGpsCoordinates( const GeoDataCoordinates &position, qreal speed )
{
m_currentPosition = position;
QString unitString;
QString altitudeUnitString;
QString distanceUnitString;
qreal unitSpeed = 0.0;
qreal altitude = 0.0;
qreal length = m_widget->model()->positionTracking()->length( m_widget->model()->planetRadius() );
QString html = "<html><body>";
html += "<table cellspacing=\"2\" cellpadding=\"2\">";
html += "<tr><td>Longitude</td><td><a href=\"http://edu.kde.org/marble\">%1</a></td></tr>";
html += "<tr><td>Latitude</td><td><a href=\"http://edu.kde.org/marble\">%2</a></td></tr>";
html += "<tr><td>Altitude</td><td>%3</td></tr>";
html += "<tr><td>Speed</td><td>%4</td></tr>";
html += "<tr><td>Distance</td><td>%5</td></tr>";
html += "</table>";
html += "</body></html>";
switch ( MarbleGlobal::getInstance()->locale()->measurementSystem() ) {
case QLocale::MetricSystem:
//kilometers per hour
unitString = QObject::tr("km/h");
unitSpeed = speed * HOUR2SEC * METER2KM;
altitudeUnitString = QObject::tr("m");
distanceUnitString = QObject::tr("m");
if ( length > 1000.0 ) {
length /= 1000.0;
distanceUnitString = QObject::tr("km");
}
altitude = position.altitude();
break;
case QLocale::ImperialSystem:
//miles per hour
unitString = QObject::tr("m/h");
unitSpeed = speed * HOUR2SEC * METER2KM * KM2MI;
altitudeUnitString = QObject::tr("ft");
distanceUnitString = QObject::tr("ft");
altitude = position.altitude() * M2FT;
length *= M2FT;
break;
}
// TODO read this value from the incoming signal
const QString speedString = QLocale::system().toString( unitSpeed, 'f', 1);
const QString altitudeString = QString( "%1 %2" ).arg( altitude, 0, 'f', 1, QChar(' ') ).arg( altitudeUnitString );
const QString distanceString = QString( "%1 %2" ).arg( length, 0, 'f', 1, QChar(' ') ).arg( distanceUnitString );
html = html.arg( position.lonToString() ).arg( position.latToString() );
html = html.arg( altitudeString ).arg( speedString + ' ' + unitString );
html = html.arg( distanceString );
m_currentLocationUi.locationLabel->setText( html );
m_currentLocationUi.showTrackCheckBox->setEnabled( true );
m_currentLocationUi.saveTrackButton->setEnabled( true );
m_currentLocationUi.clearTrackButton->setEnabled( true );
}