[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble
From:       Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date:       2011-03-26 9:37:39
Message-ID: 20110326093739.9EEDFAC8CE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1226028 by beschow:

remove SunLocator API from MarbleMap and MarbleWidget

* there are more generic ways to induce the same behavior; see APIChanges-0.12.txt for
more details

 M  +9 -0      docs/release_notes/APIChanges-0.12.txt  
 M  +12 -28    src/lib/MarbleMap.cpp  
 M  +0 -3      src/lib/MarbleMap.h  
 M  +11 -21    src/lib/MarbleWidget.cpp  
 M  +0 -4      src/lib/MarbleWidget.h  
 M  +2 -2      src/lib/SunLocator.cpp  
 M  +1 -1      src/lib/SunLocator.h  
 M  +16 -15    src/lib/TextureLayer.h  
 M  +0 -2      src/plasmoid/worldclock.cpp  


--- trunk/KDE/kdeedu/marble/docs/release_notes/APIChanges-0.12.txt #1226027:1226028
@@ -62,3 +62,12 @@
     void addNewBookmarkFolder( const QString& name ) const;
   Instead, use the respective methods of BookmarkManager, accessible through MarbleModel.
   Hint: The methods bookmarkFolders() and loadBookmarkFile() are named folders() and \
loadFile() in BookmarkManager. +
+
+2011-03-25  Bernhard Beschow <bbeschow@cs.tu-berlin.de>
+
+* Remove from MarbleMap and MarbleWidget:
+    void updateSun();
+    void centerSun();
+  Use centerOn() with the appropriate (lat, lon) values instead of centerSun().
+  Call model()->sunLocator()->update() instead of updateSun().
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1226027:1226028
@@ -124,9 +124,9 @@
 
 
     m_parent->connect( m_model->sunLocator(), SIGNAL( updateSun() ),
-                       m_parent,              SLOT( updateSun() ) );
-    m_parent->connect( m_model->sunLocator(), SIGNAL( centerSun() ),
-                       m_parent,              SLOT( centerSun() ) );
+                       &m_textureLayer,       SLOT( update() ) );
+    m_parent->connect( m_model->sunLocator(), SIGNAL( centerSun( qreal, qreal ) ),
+                       m_parent,              SLOT( centerOn( qreal, qreal ) ) );
 
     m_parent->connect( &m_textureLayer, SIGNAL( tileLevelChanged( int ) ),
                        m_parent, SIGNAL( tileLevelChanged( int ) ) );
@@ -889,8 +889,16 @@
 
     d->m_model->setMapTheme( mapTheme );
 
-    centerSun();
+    SunLocator  *sunLocator = d->m_model->sunLocator();
 
+    if ( sunLocator && sunLocator->getCentered() ) {
+        qreal  lon = sunLocator->getLon();
+        qreal  lat = sunLocator->getLat();
+        centerOn( lon, lat );
+
+        mDebug() << "Centering on Sun at " << lat << lon;
+    }
+
     d->m_layerManager.syncViewParamsAndPlugins( mapTheme );
 }
 
@@ -1100,30 +1108,6 @@
     d->m_placemarkLayout.requestStyleReset();
 }
 
-void MarbleMap::updateSun()
-{
-    // Update the sun shading.
-    //SunLocator  *sunLocator = d->m_model->sunLocator();
-
-    mDebug() << "MarbleMap: Updating the sun shading map...";
-    d->m_textureLayer.update();
-    d->m_textureLayer.setNeedsUpdate();
-    //mDebug() << "Finished updating the sun shading map";
-}
-
-void MarbleMap::centerSun()
-{
-    SunLocator  *sunLocator = d->m_model->sunLocator();
-
-    if ( sunLocator && sunLocator->getCentered() ) {
-        qreal  lon = sunLocator->getLon();
-        qreal  lat = sunLocator->getLat();
-        centerOn( lon, lat );
-
-        mDebug() << "Centering on Sun at " << lat << lon;
-    }
-}
-
 QList<RenderPlugin *> MarbleMap::renderPlugins() const
 {
     return d->m_layerManager.renderPlugins();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.h #1226027:1226028
@@ -429,9 +429,6 @@
 
  public Q_SLOTS:
 
-    void updateSun();
-    void centerSun();
-
     /**
      * @brief Paint the map using a give painter.
      * @param painter  The painter to use.
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1226027:1226028
@@ -233,8 +233,8 @@
     m_widget->connect( m_model->sunLocator(), SIGNAL( updateStars() ),
                        m_widget, SLOT( update() ) );
 
-    m_widget->connect( m_model->sunLocator(), SIGNAL( centerSun() ),
-                       m_widget, SLOT( centerSun() ) );
+    m_widget->connect( m_model->sunLocator(), SIGNAL( centerSun( qreal, qreal ) ),
+                       m_widget, SLOT( centerOn( qreal, qreal ) ) );
 
     m_widget->setInputHandler( new MarbleWidgetDefaultInputHandler( m_widget ) );
     m_widget->setMouseTracking( m_widget );
@@ -813,8 +813,16 @@
     setAttribute( Qt::WA_NoSystemBackground,
                   false );
 
-    centerSun();
+    SunLocator  *sunLocator = d->m_model->sunLocator();
 
+    if ( sunLocator && sunLocator->getCentered() ) {
+        qreal  lon = sunLocator->getLon();
+        qreal  lat = sunLocator->getLat();
+        centerOn( lon, lat );
+
+        setInputEnabled( false );
+    }
+
     repaint();
 }
 
@@ -1132,24 +1140,6 @@
     return map()->distanceString();
 }
 
-void MarbleWidget::updateSun()
-{
-    d->m_map->updateSun();
-}
-
-void MarbleWidget::centerSun()
-{
-    SunLocator  *sunLocator = d->m_model->sunLocator();
-
-    if ( sunLocator && sunLocator->getCentered() ) {
-        qreal  lon = sunLocator->getLon();
-        qreal  lat = sunLocator->getLat();
-        centerOn( lon, lat );
-
-        setInputEnabled( false );
-    }
-}
-
 void MarbleWidget::setInputEnabled( bool enabled )
 {
     //if input is set as enabled
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #1226027:1226028
@@ -922,10 +922,6 @@
     /// @name Display update slots
     //@{
 
-    void updateSun();
-    void centerSun();
-//    void repaintMap();
-
     /**
      * Schedule repaint
      */
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.cpp #1226027:1226028
@@ -238,7 +238,7 @@
         if ( d->m_show )
             emit updateSun();
         if ( d->m_centered )
-            emit centerSun();
+            emit centerSun( getLon(), getLat() );
         return;
     }
 
@@ -269,7 +269,7 @@
     d->m_centered = centered;
     if ( d->m_centered ) {
         updatePosition();
-        emit centerSun();
+        emit centerSun( getLon(), getLat() );
     } else
         emit enableWidgetInput( true );
 }
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.h #1226027:1226028
@@ -68,7 +68,7 @@
  Q_SIGNALS:
     void updateStars();
     void updateSun();
-    void centerSun();
+    void centerSun( qreal lon, qreal lat );
     void enableWidgetInput( bool );
 
  private:
--- trunk/KDE/kdeedu/marble/src/lib/TextureLayer.h #1226027:1226028
@@ -41,6 +41,22 @@
     TextureLayer( MapThemeManager *mapThemeManager, HttpDownloadManager *downloadManager, \
SunLocator *sunLocator );  ~TextureLayer();
 
+    /**
+     * @brief Return the current tile zoom level. For example for OpenStreetMap
+     *        possible values are 1..18, for BlueMarble 0..6.
+     */
+    int tileZoomLevel() const;
+
+    QSize tileSize() const;
+
+    GeoSceneTexture::Projection tileProjection() const;
+
+    int tileColumnCount( int level ) const;
+    int tileRowCount( int level ) const;
+
+    qint64 volatileCacheLimit() const;
+
+ public Q_SLOTS:
     void paintGlobe( GeoPainter *painter,
                      ViewParams *viewParams,
                      const QRect& dirtyRect );
@@ -65,21 +81,6 @@
 
     void downloadTile( const TileId &tileId );
 
-    /**
-     * @brief Return the current tile zoom level. For example for OpenStreetMap
-     *        possible values are 1..18, for BlueMarble 0..6.
-     */
-    int tileZoomLevel() const;
-
-    QSize tileSize() const;
-
-    GeoSceneTexture::Projection tileProjection() const;
-
-    int tileColumnCount( int level ) const;
-    int tileRowCount( int level ) const;
-
-    qint64 volatileCacheLimit() const;
-
  Q_SIGNALS:
     void tileLevelChanged( int );
     void repaintNeeded( const QRegion & );
--- trunk/KDE/kdeedu/marble/src/plasmoid/worldclock.cpp #1226027:1226028
@@ -105,7 +105,6 @@
          m_sun->setCentered(true);
 
     m_sun->update();
-    m_map->updateSun();
 
     m_customTz = cg.readEntry("customtz", false );
     m_locationkey = KSystemTimeZones::local().name();
@@ -208,7 +207,6 @@
                                                m_localtime );
     //kDebug() << "Adjusted Time = " << m_time;
     m_sun->update();
-    m_map->updateSun();
     update();
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic