[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Sat Nov 14 00:15:08 CET 2009
SVN commit 1048807 by nienhueser:
Show altitude unit in current position.
BUG: 202494
M +9 -1 MarbleControlBox.cpp
M +4 -0 global.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1048806:1048807
@@ -400,29 +400,37 @@
if ( d->uiWidget.navigationCheckBox->isChecked() ) {
QString unitString;
QString speedString;
+ QString distanceUnitString;
+ QString distanceString;
qreal unitSpeed = 0.0;
+ qreal distance = 0.0;
switch ( d->m_locale->measureSystem() ) {
case Marble::Metric:
//kilometers per hour
unitString = tr("km/h");
unitSpeed = speed / 1000;
+ distanceUnitString = tr("m");
+ distance = in.altitude();
break;
case Marble::Imperial:
//miles per hour
unitString = tr("m/h");
unitSpeed = (speed/1000) * KM2MI;
+ distanceUnitString = tr("ft");
+ distance = in.altitude() * M2FT;
break;
}
// TODO read this value from the incoming signal
speedString = QLocale::system().toString( unitSpeed, 'f', 1);
+ distanceString = QString( "%1 %2" ).arg( distance, 0, 'f', 1, QChar(' ') ).arg( distanceUnitString );
d->uiWidget.speedLabel->setText( speedString.rightJustified(5) + ' ' + unitString );
d->uiWidget.longitudeValue->setText( in.lonToString() );
d->uiWidget.latitudeValue->setText( in.latToString() );
- d->uiWidget.altitudeValue->setText( QString::number( in.altitude() ) );
+ d->uiWidget.altitudeValue->setText( distanceString );
}
}
--- trunk/KDE/kdeedu/marble/src/lib/global.h #1048806:1048807
@@ -184,6 +184,10 @@
const qreal MI2KM = 1.609344;
const qreal KM2MI = 1.0 / MI2KM;
+// Conversion Metric / Imperial System: meter vs. feet
+const qreal M2FT = 3.2808;
+const qreal FT2M = 1.0 / M2FT;
+
// Conversion degree vs. radians
const qreal DEG2RAD = M_PI / 180.0;
const qreal RAD2DEG = 180.0 / M_PI;
More information about the Marble-commits
mailing list