Skip to content

Commit

Permalink
WMS:
Browse files Browse the repository at this point in the history
- don't let failing (optional) GetLegendGraphic request block every following
  request
- don't refresh legend symbology everytime the extent changes
  (ie. don't GetLegendGraphic again and again)
  • Loading branch information
jef-n committed Nov 15, 2013
1 parent c0b8e9a commit 836e1a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -114,8 +114,11 @@ QgsLegend::QgsLegend( QgsMapCanvas *canvas, QWidget * parent, const char *name )

connect( mMapCanvas, SIGNAL( layersChanged() ),
this, SLOT( refreshCheckStates() ) );
#if 0
// too much
connect( mMapCanvas, SIGNAL( extentsChanged() ),
this, SLOT( updateLegendItemSymbologies() ) );
#endif

// Initialise the line indicator widget.
mInsertionLine = new QWidget( viewport() );
Expand Down
10 changes: 4 additions & 6 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -1019,13 +1019,13 @@ void QgsWmsProvider::readBlock( int bandNo, QgsRectangle const & viewExtent, in
Q_UNUSED( bandNo );
QgsDebugMsg( "Entered" );
// TODO: optimize to avoid writing to QImage
QImage* image = draw( viewExtent, pixelWidth, pixelHeight );

if ( ! image ) // should not happen
QImage *image = draw( viewExtent, pixelWidth, pixelHeight );
if ( !image ) // should not happen
{
QgsMessageLog::logMessage( tr( "image is NULL" ), tr( "WMS" ) );
return;
}

QgsDebugMsg( QString( "image height = %1 bytesPerLine = %2" ).arg( image->height() ) . arg( image->bytesPerLine() ) ) ;
size_t myExpectedSize = pixelWidth * pixelHeight * 4;
size_t myImageSize = image->height() * image->bytesPerLine();
Expand Down Expand Up @@ -4785,9 +4785,7 @@ void QgsWmsProvider::getLegendGraphicReplyFinished()
}
else
{
mErrorFormat = "text/plain";
mError = tr( "Download of GetLegendGraphic failed: %1" ).arg( mGetLegendGraphicReply->errorString() );
QgsMessageLog::logMessage( mError, tr( "WMS" ) );
QgsMessageLog::logMessage( tr( "Download of GetLegendGraphic failed: %1" ).arg( mGetLegendGraphicReply->errorString() ), tr( "WMS" ) );
mHttpGetLegendGraphicResponse.clear();
}

Expand Down

0 comments on commit 836e1a8

Please sign in to comment.