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

List:       kde-commits
Subject:    branches/KDE/4.1/kdeedu/marble
From:       Jens-Michael Hoffmann <jensmh () gmx ! de>
Date:       2008-07-17 22:06:50
Message-ID: 1216332410.340955.6586.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 834055 by jmhoffmann:

    Implement round robin algorithm for fetching tiles.
    This was brought up by the OpenStreetMap tile server admins.
    This was committed in trunk on 2008-07-16 and is part of the
    performance fix for downloading OSM tiles (Bug 162681).



 M  +12 -0     ChangeLog  
 M  +3 -1      data/maps/earth/openstreetmap/openstreetmap.dgml  
 M  +1 -1      src/lib/geodata/handlers/dgml/DgmlDownloadUrlTagHandler.cpp  
 M  +17 -7     src/lib/geodata/scene/GeoSceneTexture.cpp  
 M  +11 -3     src/lib/geodata/scene/GeoSceneTexture.h  


--- branches/KDE/4.1/kdeedu/marble/ChangeLog #834054:834055
@@ -1,3 +1,15 @@
+2008-07-18  Jens-Michael Hoffmann  <jensmh@gmx.de>
+
+    * src/lib/geodata/handlers/dgml/DgmlDownloadUrlTagHandler.cpp:
+    * src/lib/geodata/scene/GeoSceneTexture.cpp:
+    * src/lib/geodata/scene/GeoSceneTexture.h:
+    * data/maps/earth/openstreetmap/openstreetmap.dgml:
+
+    Implement round robin algorithm for fetching tiles.
+    This was brought up by the OpenStreetMap tile server admins.
+    This was committed in trunk on 2008-07-16 and is part of the
+    performance fix for downloading OSM tiles (Bug 162681).
+
 2008-07-07  Patrick Spendrin    <ps_ml@gmx.de>
 
     * src/lib/geodata/data/GeoDataPoint.{cpp,h}:
--- branches/KDE/4.1/kdeedu/marble/data/maps/earth/openstreetmap/openstreetmap.dgml \
#834054:834055 @@ -26,7 +26,9 @@
                     <sourcedir format="PNG"> earth/openstreetmap </sourcedir>
                     <storageLayout levelZeroColumns="1" levelZeroRows="1" \
mode="OpenStreetMap" />  <projection name="Mercator" />
-                    <downloadUrl protocol="http" host="tile.openstreetmap.org" \
path="/" /> +                    <downloadUrl protocol="http" \
host="a.tile.openstreetmap.org" path="/" /> +                    <downloadUrl \
protocol="http" host="b.tile.openstreetmap.org" path="/" /> +                    \
<downloadUrl protocol="http" host="c.tile.openstreetmap.org" path="/" />  </texture>
             </layer>
         </map>
--- branches/KDE/4.1/kdeedu/marble/src/lib/geodata/handlers/dgml/DgmlDownloadUrlTagHandler.cpp \
#834054:834055 @@ -78,6 +78,6 @@
     if ( !pathStr.isEmpty() )
         url.setPath( pathStr );
 
-    parentItem.nodeAs<GeoSceneTexture>()->setDownloadUrl( url );
+    parentItem.nodeAs<GeoSceneTexture>()->addDownloadUrl( url );
     return 0;
 }
--- branches/KDE/4.1/kdeedu/marble/src/lib/geodata/scene/GeoSceneTexture.cpp \
#834054:834055 @@ -35,14 +35,13 @@
       m_levelZeroColumns( defaultLevelZeroColumns ),
       m_levelZeroRows( defaultLevelZeroRows ),
       m_projection( Equirectangular ),
-      m_downloadUrl( "http://download.kde.org/apps/marble/" )
+      m_downloadUrls(),
+      m_nextUrl( m_downloadUrls.end() )
 {
-    /* NOOP */
 }
 
 GeoSceneTexture::~GeoSceneTexture()
 {
-    /* NOOP */
 }
 
 QString GeoSceneTexture::sourceDir() const
@@ -115,14 +114,25 @@
     m_projection = projection;
 }
 
-QUrl GeoSceneTexture::downloadUrl() const
+QUrl GeoSceneTexture::downloadUrl()
 {
-    return m_downloadUrl;
+    // default download url
+    if ( m_downloadUrls.empty() )
+        return QUrl( "http://download.kde.org/apps/marble/" );
+
+    if ( m_nextUrl == m_downloadUrls.end() )
+        m_nextUrl = m_downloadUrls.begin();
+
+    QUrl url = *m_nextUrl;
+    ++m_nextUrl;
+    return url;
 }
 
-void GeoSceneTexture::setDownloadUrl( const QUrl & url )
+void GeoSceneTexture::addDownloadUrl( const QUrl & url )
 {
-    m_downloadUrl = url;
+    m_downloadUrls.append( url );
+    // FIXME: this could be done only once
+    m_nextUrl = m_downloadUrls.begin();
 }
 
 QString GeoSceneTexture::type()
--- branches/KDE/4.1/kdeedu/marble/src/lib/geodata/scene/GeoSceneTexture.h \
#834054:834055 @@ -61,8 +61,11 @@
     Projection projection() const;
     void setProjection( const Projection );
 
-    QUrl downloadUrl() const;
-    void setDownloadUrl( const QUrl & );
+    // this method is a little more than just a stupid getter,
+    // it implements the round robin for the tile servers.
+    // on each invocation the next url is returned
+    QUrl downloadUrl();
+    void addDownloadUrl( const QUrl & );
 
     virtual QString type();
 
@@ -74,7 +77,12 @@
     int m_levelZeroColumns;
     int m_levelZeroRows;
     Projection m_projection;
-    QUrl m_downloadUrl;
+
+    /// List of Urls which are used in a round robin fashion
+    QVector<QUrl> m_downloadUrls;
+
+    /// Points to next Url for the round robin algorithm
+    QVector<QUrl>::const_iterator m_nextUrl;
 };
 
 #endif // GEOSCENETEXTURE_H


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

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