Skip to content
Permalink
Browse files

Reintroduce $map and optional canvas refresh debug logs

  • Loading branch information
wonder-sk committed Mar 25, 2014
1 parent 9e42c5b commit d8ad1d8861dd0a8345ae6f1c82ce330e32ac5cc3
Showing with 10 additions and 54 deletions.
  1. +10 −54 src/gui/qgsmapcanvas.cpp
@@ -588,60 +588,6 @@ void QgsMapCanvas::refresh()

// schedule a refresh
QTimer::singleShot( 1, this, SLOT( refreshMap() ) );

/*
// we can't draw again if already drawing...
if ( mDrawing )
return;
QSettings settings;
bool logRefresh = settings.value( "/Map/logCanvasRefreshEvent", false ).toBool();
QTime t;
if ( logRefresh )
{
t.start();
}
mDrawing = true;
//update $map variable to canvas
QgsExpression::setSpecialColumn( "$map", tr( "canvas" ) );
if ( mRenderFlag && !mFrozen )
{
clear();
// Tell the user we're going to be a while
QApplication::setOverrideCursor( Qt::WaitCursor );
mMap->render();
mDirty = false;
// notify any listeners that rendering is complete
QPainter p;
p.begin( &mMap->paintDevice() );
emit renderComplete( &p );
p.end();
// Tell the user we've finished going to be a while
QApplication::restoreOverrideCursor();
}
mDrawing = false;
if ( logRefresh )
{
QString logMsg = tr( "Canvas refresh: %1 ms" ).arg( t.elapsed() );
QObject* senderObj = QObject::sender();
if ( senderObj )
{
logMsg += tr( ", sender '%1'" ).arg( senderObj->metaObject()->className() );
}
QgsMessageLog::logMessage( logMsg, tr( "Rendering" ) );
}
*/

} // refresh

void QgsMapCanvas::refreshMap()
@@ -655,6 +601,9 @@ void QgsMapCanvas::refreshMap()
// from now on we can accept refresh requests again
mRefreshScheduled = false;

//update $map variable to canvas
QgsExpression::setSpecialColumn( "$map", tr( "canvas" ) );

// create the renderer job
Q_ASSERT( mJob == 0 );
mJobCancelled = false;
@@ -707,6 +656,13 @@ void QgsMapCanvas::rendererJobFinished()
QPainter p( &img );
emit renderComplete( &p );

QSettings settings;
if ( settings.value( "/Map/logCanvasRefreshEvent", false ).toBool() )
{
QString logMsg = tr( "Canvas refresh: %1 ms" ).arg( mJob->renderingTime() );
QgsMessageLog::logMessage( logMsg, tr( "Rendering" ) );
}

if ( mDrawRenderingStats )
{
int w = img.width(), h = img.height();

0 comments on commit d8ad1d8

Please sign in to comment.
You can’t perform that action at this time.