Skip to content

Commit 9419284

Browse files
author
jef
committedSep 7, 2009
multi-layer identify:
- fix busy cursor - add progress bar - reduces CRS debugging noise git-svn-id: http://svn.osgeo.org/qgis/trunk@11580 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent de47033 commit 9419284

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed
 

‎src/app/qgsmaptoolidentify.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "qgsvectorlayer.h"
3232
#include "qgsproject.h"
3333
#include "qgsmaplayerregistry.h"
34+
#include "qgisapp.h"
3435

3536
#include <QSettings>
3637
#include <QMessageBox>
@@ -90,16 +91,26 @@ void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent * e )
9091
return;
9192
}
9293

94+
QApplication::setOverrideCursor( Qt::WaitCursor );
95+
9396
res = identifyLayer( layer, e->x(), e->y() );
97+
98+
QApplication::restoreOverrideCursor();
9499
}
95100
else
96101
{
102+
connect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
103+
104+
QApplication::setOverrideCursor( Qt::WaitCursor );
105+
97106
QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
98107

99108
for ( int i = 0; i < mCanvas->layerCount(); i++ )
100109
{
101110
QgsMapLayer *layer = mCanvas->layer( i );
102111

112+
emit identifyProgress( i, mCanvas->layerCount() );
113+
103114
if ( noIdentifyLayerIdList.contains( layer->getLayerID() ) )
104115
continue;
105116

@@ -110,6 +121,12 @@ void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent * e )
110121
break;
111122
}
112123
}
124+
125+
emit identifyProgress( mCanvas->layerCount(), mCanvas->layerCount() );
126+
127+
disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
128+
129+
QApplication::restoreOverrideCursor();
113130
}
114131

115132
if ( res )
@@ -178,8 +195,6 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
178195
calc.setEllipsoid( ellipsoid );
179196
calc.setSourceCrs( layer->srs().srsid() );
180197

181-
QApplication::setOverrideCursor( Qt::WaitCursor );
182-
183198
QgsFeatureList featureList;
184199

185200
// toLayerCoordinates will throw an exception for an 'invalid' point.
@@ -210,8 +225,6 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
210225
QgsDebugMsg( QString( "Caught CRS exception %1" ).arg( cse.what() ) );
211226
}
212227

213-
QApplication::restoreOverrideCursor();
214-
215228
QgsFeatureList::iterator f_it = featureList.begin();
216229

217230
for ( ; f_it != featureList.end(); ++f_it )
@@ -282,8 +295,6 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
282295

283296
QgsDebugMsg( "Feature count on identify: " + QString::number( featureCount ) );
284297

285-
QApplication::restoreOverrideCursor();
286-
287298
return featureCount > 0;
288299
}
289300

‎src/app/qgsmaptoolidentify.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class QgsMapToolIdentify : public QgsMapTool
6161

6262
virtual void deactivate();
6363

64+
signals:
65+
void identifyProgress( int, int );
66+
6467
private:
6568
bool identifyLayer( QgsMapLayer *layer, int x, int y );
6669
bool identifyRasterLayer( QgsRasterLayer *layer, int x, int y );

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,10 @@ void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
682682
mCRS = OSRNewSpatialReference( NULL );
683683
mIsValidFlag = OSRImportFromProj4( mCRS, theProj4String.toLatin1().constData() ) == OGRERR_NONE;
684684
setMapUnits();
685+
686+
#if defined(QGISDEBUG) && QGISDEBUG>=3
685687
debugPrint();
688+
#endif
686689

687690
setlocale( LC_NUMERIC, oldlocale );
688691
}
@@ -756,7 +759,7 @@ void QgsCoordinateReferenceSystem::setMapUnits()
756759
QgsDebugMsg( "Unsupported map units of " + unit );
757760
mMapUnits = QGis::UnknownUnit;
758761
}
759-
QgsDebugMsg( "Projection has angular units of " + unit );
762+
QgsDebugMsgLevel( "Projection has angular units of " + unit, 3 );
760763
}
761764
}
762765

@@ -882,11 +885,11 @@ bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSyste
882885
{
883886
if ( OSRExportToWkt( theSrs.mCRS, &otherStr ) == OGRERR_NONE )
884887
{
885-
QgsDebugMsg( QString( "Comparing " ) + thisStr );
886-
QgsDebugMsg( QString( " with " ) + otherStr );
888+
QgsDebugMsgLevel( QString( "Comparing " ) + thisStr, 3 );
889+
QgsDebugMsgLevel( QString( " with " ) + otherStr, 3 );
887890
if ( !strcmp( thisStr, otherStr ) )
888891
{
889-
QgsDebugMsg( QString( "MATCHED!" ) + otherStr );
892+
QgsDebugMsgLevel( QString( "MATCHED!" ) + otherStr, 3 );
890893
CPLFree( thisStr );
891894
CPLFree( otherStr );
892895
return true;

‎src/core/qgsdistancearea.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ double QgsDistanceArea::computePolygonArea( const QList<QgsPoint>& points )
586586
double Qbar1, Qbar2;
587587
double area;
588588

589-
QgsDebugMsg( "Ellipsoid: " + mEllipsoid );
589+
QgsDebugMsgLevel( "Ellipsoid: " + mEllipsoid, 3 );
590590
if (( ! mProjectionsEnabled ) || ( mEllipsoid == "NONE" ) )
591591
{
592592
return computePolygonFlatArea( points );

‎src/core/qgsscalecalculator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void QgsScaleCalculator::setMapUnits( QGis::UnitType mapUnits )
4747

4848
QGis::UnitType QgsScaleCalculator::mapUnits() const
4949
{
50-
QgsDebugMsg( QString( "Map units returned as %1" ).arg( QString::number( mMapUnits ) ) );
50+
QgsDebugMsgLevel( QString( "Map units returned as %1" ).arg( QString::number( mMapUnits ) ), 3 );
5151
return mMapUnits;
5252
}
5353

0 commit comments

Comments
 (0)
Please sign in to comment.