Skip to content
Permalink
Browse files

WMS:

- 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 836e1a86368f9eace236d24ba40b7af77a6bc63d
Showing with 7 additions and 6 deletions.
  1. +3 −0 src/app/legend/qgslegend.cpp
  2. +4 −6 src/providers/wms/qgswmsprovider.cpp
@@ -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() );
@@ -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();
@@ -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();
}

0 comments on commit 836e1a8

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