Skip to content

Commit

Permalink
multi-layer identify:
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jef committed Sep 7, 2009
1 parent de47033 commit 9419284
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
23 changes: 17 additions & 6 deletions src/app/qgsmaptoolidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "qgsvectorlayer.h"
#include "qgsproject.h"
#include "qgsmaplayerregistry.h"
#include "qgisapp.h"

#include <QSettings>
#include <QMessageBox>
Expand Down Expand Up @@ -90,16 +91,26 @@ void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent * e )
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;

Expand All @@ -110,6 +121,12 @@ void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent * e )
break;
}
}

emit identifyProgress( mCanvas->layerCount(), mCanvas->layerCount() );

disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );

QApplication::restoreOverrideCursor();
}

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

QApplication::setOverrideCursor( Qt::WaitCursor );

QgsFeatureList featureList;

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

QApplication::restoreOverrideCursor();

QgsFeatureList::iterator f_it = featureList.begin();

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

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

QApplication::restoreOverrideCursor();

return featureCount > 0;
}

Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmaptoolidentify.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class QgsMapToolIdentify : public QgsMapTool

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 );
Expand Down
11 changes: 7 additions & 4 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,10 @@ void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
mCRS = OSRNewSpatialReference( NULL );
mIsValidFlag = OSRImportFromProj4( mCRS, theProj4String.toLatin1().constData() ) == OGRERR_NONE;
setMapUnits();

#if defined(QGISDEBUG) && QGISDEBUG>=3
debugPrint();
#endif

setlocale( LC_NUMERIC, oldlocale );
}
Expand Down Expand Up @@ -756,7 +759,7 @@ void QgsCoordinateReferenceSystem::setMapUnits()
QgsDebugMsg( "Unsupported map units of " + unit );
mMapUnits = QGis::UnknownUnit;
}
QgsDebugMsg( "Projection has angular units of " + unit );
QgsDebugMsgLevel( "Projection has angular units of " + unit, 3 );
}
}

Expand Down Expand Up @@ -882,11 +885,11 @@ bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSyste
{
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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsdistancearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ double QgsDistanceArea::computePolygonArea( const QList<QgsPoint>& points )
double Qbar1, Qbar2;
double area;

QgsDebugMsg( "Ellipsoid: " + mEllipsoid );
QgsDebugMsgLevel( "Ellipsoid: " + mEllipsoid, 3 );
if (( ! mProjectionsEnabled ) || ( mEllipsoid == "NONE" ) )
{
return computePolygonFlatArea( points );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsscalecalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void QgsScaleCalculator::setMapUnits( QGis::UnitType mapUnits )

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;
}

Expand Down

0 comments on commit 9419284

Please sign in to comment.