[QGIS Commit] r11580 - in trunk/qgis/src: app core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Sep 7 05:42:29 EDT 2009


Author: jef
Date: 2009-09-07 05:42:28 -0400 (Mon, 07 Sep 2009)
New Revision: 11580

Modified:
   trunk/qgis/src/app/qgsmaptoolidentify.cpp
   trunk/qgis/src/app/qgsmaptoolidentify.h
   trunk/qgis/src/core/qgscoordinatereferencesystem.cpp
   trunk/qgis/src/core/qgsdistancearea.cpp
   trunk/qgis/src/core/qgsscalecalculator.cpp
Log:
multi-layer identify:
- fix busy cursor
- add progress bar
- reduces CRS debugging noise


Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp	2009-09-06 22:08:21 UTC (rev 11579)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp	2009-09-07 09:42:28 UTC (rev 11580)
@@ -31,6 +31,7 @@
 #include "qgsvectorlayer.h"
 #include "qgsproject.h"
 #include "qgsmaplayerregistry.h"
+#include "qgisapp.h"
 
 #include <QSettings>
 #include <QMessageBox>
@@ -90,16 +91,26 @@
       return;
     }
 
+    QApplication::setOverrideCursor( Qt::WaitCursor );
+
     res = identifyLayer( layer, e->x(), e->y() );
+
+    QApplication::restoreOverrideCursor();
   }
   else
   {
+    connect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
+
+    QApplication::setOverrideCursor( Qt::WaitCursor );
+
     QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
 
     for ( int i = 0; i < mCanvas->layerCount(); i++ )
     {
       QgsMapLayer *layer = mCanvas->layer( i );
 
+      emit identifyProgress( i, mCanvas->layerCount() );
+
       if ( noIdentifyLayerIdList.contains( layer->getLayerID() ) )
         continue;
 
@@ -110,6 +121,12 @@
           break;
       }
     }
+
+    emit identifyProgress( mCanvas->layerCount(), mCanvas->layerCount() );
+
+    disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
+
+    QApplication::restoreOverrideCursor();
   }
 
   if ( res )
@@ -178,8 +195,6 @@
   calc.setEllipsoid( ellipsoid );
   calc.setSourceCrs( layer->srs().srsid() );
 
-  QApplication::setOverrideCursor( Qt::WaitCursor );
-
   QgsFeatureList featureList;
 
   // toLayerCoordinates will throw an exception for an 'invalid' point.
@@ -210,8 +225,6 @@
     QgsDebugMsg( QString( "Caught CRS exception %1" ).arg( cse.what() ) );
   }
 
-  QApplication::restoreOverrideCursor();
-
   QgsFeatureList::iterator f_it = featureList.begin();
 
   for ( ; f_it != featureList.end(); ++f_it )
@@ -282,8 +295,6 @@
 
   QgsDebugMsg( "Feature count on identify: " + QString::number( featureCount ) );
 
-  QApplication::restoreOverrideCursor();
-
   return featureCount > 0;
 }
 

Modified: trunk/qgis/src/app/qgsmaptoolidentify.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.h	2009-09-06 22:08:21 UTC (rev 11579)
+++ trunk/qgis/src/app/qgsmaptoolidentify.h	2009-09-07 09:42:28 UTC (rev 11580)
@@ -61,6 +61,9 @@
 
     virtual void deactivate();
 
+  signals:
+    void identifyProgress( int, int );
+
   private:
     bool identifyLayer( QgsMapLayer *layer, int x, int y );
     bool identifyRasterLayer( QgsRasterLayer *layer, int x, int y );

Modified: trunk/qgis/src/core/qgscoordinatereferencesystem.cpp
===================================================================
--- trunk/qgis/src/core/qgscoordinatereferencesystem.cpp	2009-09-06 22:08:21 UTC (rev 11579)
+++ trunk/qgis/src/core/qgscoordinatereferencesystem.cpp	2009-09-07 09:42:28 UTC (rev 11580)
@@ -682,7 +682,10 @@
   mCRS = OSRNewSpatialReference( NULL );
   mIsValidFlag = OSRImportFromProj4( mCRS, theProj4String.toLatin1().constData() ) == OGRERR_NONE;
   setMapUnits();
+
+#if defined(QGISDEBUG) && QGISDEBUG>=3
   debugPrint();
+#endif
 
   setlocale( LC_NUMERIC, oldlocale );
 }
@@ -756,7 +759,7 @@
       QgsDebugMsg( "Unsupported map units of " + unit );
       mMapUnits = QGis::UnknownUnit;
     }
-    QgsDebugMsg( "Projection has angular units of " + unit );
+    QgsDebugMsgLevel( "Projection has angular units of " + unit, 3 );
   }
 }
 
@@ -882,11 +885,11 @@
   {
     if ( OSRExportToWkt( theSrs.mCRS, &otherStr ) == OGRERR_NONE )
     {
-      QgsDebugMsg( QString( "Comparing " ) + thisStr );
-      QgsDebugMsg( QString( "     with " ) + otherStr );
+      QgsDebugMsgLevel( QString( "Comparing " ) + thisStr, 3 );
+      QgsDebugMsgLevel( QString( "     with " ) + otherStr, 3 );
       if ( !strcmp( thisStr, otherStr ) )
       {
-        QgsDebugMsg( QString( "MATCHED!" ) + otherStr );
+        QgsDebugMsgLevel( QString( "MATCHED!" ) + otherStr, 3 );
         CPLFree( thisStr );
         CPLFree( otherStr );
         return true;

Modified: trunk/qgis/src/core/qgsdistancearea.cpp
===================================================================
--- trunk/qgis/src/core/qgsdistancearea.cpp	2009-09-06 22:08:21 UTC (rev 11579)
+++ trunk/qgis/src/core/qgsdistancearea.cpp	2009-09-07 09:42:28 UTC (rev 11580)
@@ -586,7 +586,7 @@
   double Qbar1, Qbar2;
   double area;
 
-  QgsDebugMsg( "Ellipsoid: " + mEllipsoid );
+  QgsDebugMsgLevel( "Ellipsoid: " + mEllipsoid, 3 );
   if (( ! mProjectionsEnabled ) || ( mEllipsoid == "NONE" ) )
   {
     return computePolygonFlatArea( points );

Modified: trunk/qgis/src/core/qgsscalecalculator.cpp
===================================================================
--- trunk/qgis/src/core/qgsscalecalculator.cpp	2009-09-06 22:08:21 UTC (rev 11579)
+++ trunk/qgis/src/core/qgsscalecalculator.cpp	2009-09-07 09:42:28 UTC (rev 11580)
@@ -47,7 +47,7 @@
 
 QGis::UnitType QgsScaleCalculator::mapUnits() const
 {
-  QgsDebugMsg( QString( "Map units returned as %1" ).arg( QString::number( mMapUnits ) ) );
+  QgsDebugMsgLevel( QString( "Map units returned as %1" ).arg( QString::number( mMapUnits ) ), 3 );
   return mMapUnits;
 }
 



More information about the QGIS-commit mailing list