[QGIS Commit] r13150 - in trunk/qgis/src: app providers/wms

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Mar 23 16:00:37 EDT 2010


Author: jef
Date: 2010-03-23 16:00:37 -0400 (Tue, 23 Mar 2010)
New Revision: 13150

Modified:
   trunk/qgis/src/app/qgswmssourceselect.cpp
   trunk/qgis/src/providers/wms/qgswmsprovider.cpp
Log:
use SE corner as WMS-C origin, wms metadata display & selection cosmetics

Modified: trunk/qgis/src/app/qgswmssourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.cpp	2010-03-23 19:57:26 UTC (rev 13149)
+++ trunk/qgis/src/app/qgswmssourceselect.cpp	2010-03-23 20:00:37 UTC (rev 13150)
@@ -5,7 +5,7 @@
     copyright            :
     original             : (C) 2005 by Brendan Morley email  : morb at ozemail dot com dot au
     wms search           : (C) 2009 Mathias Walker <mwa at sourcepole.ch>, Sourcepole AG
-    wms-c support        : (C) 2010 Jürgen E. Fischer < jef at norbit dot de >, norBIT GmbH
+    wms-c support        : (C) 2010 Juergen E. Fischer < jef at norbit dot de >, norBIT GmbH
 
  ***************************************************************************/
 
@@ -56,14 +56,17 @@
   setupUi( this );
 
   mAddButton = new QPushButton( tr( "&Add" ) );
+  mAddButton->setToolTip( tr( "Add selected layers to map" ) );
   buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole );
   connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClicked() ) );
 
   QPushButton *pb = new QPushButton( tr( "&Save" ) );
+  pb->setToolTip( tr( "Save WMS server connections to file" ) );
   buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
   connect( pb, SIGNAL( clicked() ), this, SLOT( saveClicked() ) );
 
   pb = new QPushButton( tr( "&Load" ) );
+  pb->setToolTip( tr( "Load WMS server connections from file" ) );
   buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
   connect( pb, SIGNAL( clicked() ), this, SLOT( loadClicked() ) );
 

Modified: trunk/qgis/src/providers/wms/qgswmsprovider.cpp
===================================================================
--- trunk/qgis/src/providers/wms/qgswmsprovider.cpp	2010-03-23 19:57:26 UTC (rev 13149)
+++ trunk/qgis/src/providers/wms/qgswmsprovider.cpp	2010-03-23 20:00:37 UTC (rev 13150)
@@ -568,26 +568,32 @@
     double ymax = std::min( viewExtent.yMaximum(), layerExtent.yMaximum() );
 
     // snap to tile coordinates
-    double x0 = floor( xmin / dx ) * dx;
-    double y0 = floor( ymin / dy ) * dy;
+    double x0 = floor(( xmin - layerExtent.xMinimum() ) / dx ) * dx + layerExtent.xMinimum();
+    double y0 = floor(( ymin - layerExtent.yMinimum() ) / dy ) * dy + layerExtent.yMinimum();
 
 #ifdef QGISDEBUG
     // calculate number of tiles
     int n = ceil(( xmax - xmin ) / dx ) * ceil(( ymax - ymin ) / dy );
 #endif
 
+    QgsDebugMsg( QString( "layer extent: %1,%2 %3x%4" )
+                 .arg( layerExtent.xMinimum(), 0, 'f' )
+                 .arg( layerExtent.yMinimum(), 0, 'f' )
+                 .arg( layerExtent.width() )
+                 .arg( layerExtent.height() )
+               );
     QgsDebugMsg( QString( "view extent: %1,%2 %3x%4  res:%5" )
-                 .arg( viewExtent.xMinimum() )
-                 .arg( viewExtent.yMinimum() )
+                 .arg( viewExtent.xMinimum(), 0, 'f' )
+                 .arg( viewExtent.yMinimum(), 0, 'f' )
                  .arg( viewExtent.width() )
                  .arg( viewExtent.height() )
-                 .arg( vres )
+                 .arg( vres, 0, 'f' )
                );
     QgsDebugMsg( QString( "tile extent: %1,%2 %3x%4 pixel:%5x%6 res:%7" )
-                 .arg( x0 ).arg( y0 )
-                 .arg( dx ).arg( dy )
+                 .arg( x0, 0, 'f' ).arg( y0, 0, 'f' )
+                 .arg( dx, 0, 'f' ).arg( dy, 0, 'f' )
                  .arg( mTileWidth ).arg( mTileHeight )
-                 .arg( tres )
+                 .arg( tres, 0, 'f' )
                );
     QgsDebugMsg( QString( "tile number: %1x%2 = %3" )
                  .arg( ceil(( xmax - xmin ) / dx ) )
@@ -643,29 +649,29 @@
         tileReplies << reply;
         connect( reply, SIGNAL( finished() ), this, SLOT( tileReplyFinished() ) );
       }
+    }
 
-      mWaiting = true;
+    mWaiting = true;
 
-      QTime t;
-      t.start();
+    QTime t;
+    t.start();
 
-      // draw everything that is retrieved within a second
-      // and the rest asynchronously
-      while ( !tileReplies.isEmpty() && t.elapsed() < WMS_THRESHOLD )
-      {
-        QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents, WMS_THRESHOLD );
-      }
+    // draw everything that is retrieved within a second
+    // and the rest asynchronously
+    while ( !tileReplies.isEmpty() && t.elapsed() < WMS_THRESHOLD )
+    {
+      QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents, WMS_THRESHOLD );
+    }
 
-      mWaiting = false;
+    mWaiting = false;
 
 #ifdef QGISDEBUG
-      emit statusChanged( tr( "%n tile requests in background", "tile request count", tileReplies.count() )
-                          + tr( ", %n cache hits", "tile cache hits", mCacheHits )
-                          + tr( ", %n cache misses.", "tile cache missed", mCacheMisses )
-                          + tr( ", %n errors.", "errors", mErrors )
-                        );
+    emit statusChanged( tr( "%n tile requests in background", "tile request count", tileReplies.count() )
+                        + tr( ", %n cache hits", "tile cache hits", mCacheHits )
+                        + tr( ", %n cache misses.", "tile cache missed", mCacheMisses )
+                        + tr( ", %n errors.", "errors", mErrors )
+                      );
 #endif
-    }
   }
 
   return cachedImage;
@@ -688,7 +694,7 @@
 
   QgsDebugMsg( QString( "tile reply %1 (%2) tile:%3 rect:%4,%5 %6x%7) fromcache:%8 error:%9" )
                .arg( tileReqNo ).arg( mTileReqNo ).arg( tileNo )
-               .arg( r.left() ).arg( r.bottom() ).arg( r.width() ).arg( r.height() )
+               .arg( r.left(), 0, 'f' ).arg( r.bottom(), 0, 'f' ).arg( r.width(), 0, 'f' ).arg( r.height(), 0, 'f' )
                .arg( fromCache )
                .arg( reply->errorString() )
              );
@@ -2109,9 +2115,34 @@
 {
   QString myMetadataQString = "";
 
+  myMetadataQString += "<tr><td>";
+
+  myMetadataQString += "<a href=\"#serverproperties\">";
+  myMetadataQString += tr( "Server Properties" );
+  myMetadataQString += "</a> ";
+
+  myMetadataQString += "<a href=\"#layerproperties\">";
+  myMetadataQString += tr( "Layer Properties" );
+  myMetadataQString += "</a> ";
+
+  if ( tilesetsSupported.size() > 0 )
+  {
+    myMetadataQString += "<a href=\"#tilesetproperties\">";
+    myMetadataQString += tr( "Tileset Properties" );
+    myMetadataQString += "</a> ";
+
+#if QT_VERSION >= 0x40500
+    myMetadataQString += "<a href=\"#cachestats\">";
+    myMetadataQString += tr( "Cache Stats" );
+    myMetadataQString += "</a> ";
+#endif
+  }
+
+  myMetadataQString += "</td></tr>";
+
   // Server Properties section
-  myMetadataQString += "<tr><td bgcolor=\"gray\">";
-  myMetadataQString += tr( "Server Properties:" );
+  myMetadataQString += "<tr><td bgcolor=\"gray\"><a name=\"serverproperties\"></a>";
+  myMetadataQString += tr( "Server Properties" );
   myMetadataQString += "</td></tr>";
 
   // Use a nested table
@@ -2242,7 +2273,7 @@
   myMetadataQString += "</td></tr>";
 
   // Layer properties
-  myMetadataQString += "<tr><td bgcolor=\"gray\">";
+  myMetadataQString += "<tr><td bgcolor=\"gray\"><a name=\"layerproperties\"></a>";
   myMetadataQString += tr( "Layer Properties:" );
   myMetadataQString += "</td></tr>";
 
@@ -2436,8 +2467,8 @@
   // Tileset properties
   if ( tilesetsSupported.size() > 0 )
   {
-    myMetadataQString += "<tr><td bgcolor=\"gray\">";
-    myMetadataQString += tr( "Tileset Properties:" );
+    myMetadataQString += "<tr><td bgcolor=\"gray\"><a name=\"tilesetproperties\"></a>";
+    myMetadataQString += tr( "Tileset Properties" );
     myMetadataQString += "</td></tr>";
 
     // Iterate through tilesets
@@ -2501,10 +2532,13 @@
       myMetadataQString += "</td></tr>";
     }
 
+    myMetadataQString += "</table></td></tr>";
+
+#if QT_VERSION >= 0x40500
     if ( mTiled )
     {
-      myMetadataQString += "<tr><td bgcolor=\"gray\">";
-      myMetadataQString += tr( "Cache stats:" );
+      myMetadataQString += "<tr><td bgcolor=\"gray\"><a name=\"cachestats\"></a>";
+      myMetadataQString += tr( "Cache stats" );
       myMetadataQString += "</td></tr>";
 
       // Iterate through tilesets
@@ -2536,8 +2570,9 @@
       myMetadataQString += QString::number( mErrors );
       myMetadataQString += "</td></tr>";
 
-      myMetadataQString += "</table>";
+      myMetadataQString += "</table></td></tr>";
     }
+#endif
   }
 
   myMetadataQString += "</table>";



More information about the QGIS-commit mailing list