[Marble-commits] KDE/kdeedu/marble/src

Dennis Nienhüser earthwings at gentoo.org
Tue Aug 31 19:20:52 CEST 2010


SVN commit 1170361 by nienhueser:

The position marker is a bit hard to spot on the N900 when there's only time for a quick glance at the screen. To improve that paint a half-transparent red circle at the current position (all versions). To give it a right to exist other than enhanced visibility, its size depends on the accuracy of the current position. The circle can be interpreted as "the device is pretty sure that the real position is within the colored circle".
RB: 5168
Use a less transparent color and a minimum circle size for small screen devices to enhance the visibility of the position marker there.

 M  +6 -1      lib/PositionTracking.cpp  
 M  +1 -0      lib/PositionTracking.h  
 M  +2 -0      lib/PositionTracking_p.h  
 M  +6 -0      lib/geodata/data/GeoDataAccuracy.h  
 M  +8 -3      plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.cpp  
 M  +2 -4      plugins/positionprovider/maemo/MaemoPositionProviderPlugin.cpp  
 M  +21 -0     plugins/render/positionmarker/PositionMarker.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/PositionTracking.cpp #1170360:1170361
@@ -29,7 +29,7 @@
 void PositionTrackingPrivate::setPosition( GeoDataCoordinates position,
                                            GeoDataAccuracy accuracy )
 {
-    Q_UNUSED( accuracy );
+    m_accuracy = accuracy;
     if ( m_positionProvider && m_positionProvider->status() ==
         PositionProviderStatusAvailable )
     {
@@ -178,5 +178,10 @@
 
 }
 
+GeoDataAccuracy PositionTracking::accuracy() const
+{
+    return d->m_accuracy;
+}
+
 #include "PositionTracking.moc"
 #include "PositionTracking_p.moc"
--- trunk/KDE/kdeedu/marble/src/lib/PositionTracking.h #1170360:1170361
@@ -59,6 +59,7 @@
      */
     qreal direction() const;
 
+    GeoDataAccuracy accuracy() const;
     /**
      * @brief provides the visibility of the Position Tracking document
      */
--- trunk/KDE/kdeedu/marble/src/lib/PositionTracking_p.h #1170360:1170361
@@ -60,6 +60,8 @@
     GeoDataLineString  *m_currentLineString;
 
     PositionProviderPlugin* m_positionProvider;
+
+    GeoDataAccuracy m_accuracy;
 };
 }
 
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataAccuracy.h #1170360:1170361
@@ -44,6 +44,12 @@
      * @brief Vertical accuracy in meters.
      */
     qreal vertical;
+
+    GeoDataAccuracy() {
+        level = none;
+        horizontal = 0;
+        vertical = 0;
+    }
 };
 
 }
--- trunk/KDE/kdeedu/marble/src/plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.cpp #1170360:1170361
@@ -66,11 +66,16 @@
         if (data.fix.mode == MODE_2D) {
             m_position.setAltitude(0);
         }
+
         m_accuracy.level = GeoDataAccuracy::Detailed;
-        // FIXME: Add real values here
-        m_accuracy.horizontal = 5;
-        m_accuracy.vertical = 5;
+        if ( !isnan( data.fix.epx ) && !isnan( data.fix.epy ) ) {
+            m_accuracy.horizontal = qMax( data.fix.epx, data.fix.epy );
+        }
 
+        if ( !isnan( data.fix.epv ) ) {
+            m_accuracy.vertical = data.fix.epv;
+        }
+
         if( !isnan(data.fix.speed ) )
         {
             m_speed = data.fix.speed;
--- trunk/KDE/kdeedu/marble/src/plugins/positionprovider/maemo/MaemoPositionProviderPlugin.cpp #1170360:1170361
@@ -98,12 +98,10 @@
 {
     GeoDataAccuracy result;
 
-    // FIXME: I'm not sure what is expected here, the documentation in
-    // Marble is a bit coarse and I did not find any class using it
     if ( status() == PositionProviderStatusAvailable ) {
         result.level = GeoDataAccuracy::Detailed;
-        result.horizontal = d->m_device->fix->eph; // horizontal position accuracy in centimeter
-        result.vertical = d->m_device->fix->epv; // vertical position accuracy in meter
+        result.horizontal = d->m_device->fix->eph / 100.0; // cm => meter
+        result.vertical = d->m_device->fix->epv; // meter
     }
     else {
         result.level = GeoDataAccuracy::none;
--- trunk/KDE/kdeedu/marble/src/plugins/render/positionmarker/PositionMarker.cpp #1170360:1170361
@@ -132,6 +132,7 @@
                 << position + relativeLeft
                 << position + relativeTip
                 << position + relativeRight;
+
         m_dirtyRegion = QRegion();
         m_dirtyRegion += ( m_arrow.boundingRect().toRect() );
         m_dirtyRegion += ( m_previousArrow.boundingRect().toRect() );
@@ -152,9 +153,29 @@
         update();
         painter->save();
         painter->autoMapQuality();
+
+        GeoDataAccuracy accuracy = dataFacade()->positionTracking()->accuracy();
+        if ( accuracy.horizontal > 0 && accuracy.horizontal < 1000 ) {
+            // Paint a red circle indicating the position accuracy
+            painter->setPen( Qt::transparent );
+            QColor transparentRed = oxygenBrickRed4;
+            int width = qRound( accuracy.horizontal * viewport->radius() / EARTH_RADIUS );
+            if ( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ) {
+                transparentRed.setAlpha( 80 );
+                int arrowSize = qMax<int>( m_arrow.boundingRect().width(), m_arrow.boundingRect().height() );
+                width = qMax<int>( width, arrowSize + 10 );
+            } else {
+                transparentRed.setAlpha( 40 );
+            }
+
+            painter->setBrush( transparentRed );
+            painter->drawEllipse( m_currentPosition, width, width );
+        }
+
         painter->setPen( Qt::black );
         painter->setBrush( Qt::white );
         painter->drawPolygon( m_arrow );
+
         painter->restore();
         m_previousArrow = m_arrow;
     }


More information about the Marble-commits mailing list