Skip to content
Permalink
Browse files
Added more debugging info to wms server. Also when compiled in debug …
…mode, it will write the last rendered image out to the system temp dir (overwriting it with each render)
  • Loading branch information
timlinux committed Dec 6, 2011
1 parent 6ddf1f6 commit a5d2844463d6e5c39d19d62dcd2d856ad658fbb0
Showing with 17 additions and 2 deletions.
  1. +3 −1 src/mapserver/qgis_map_serv.cpp
  2. +9 −1 src/mapserver/qgshttprequesthandler.cpp
  3. +5 −0 src/mapserver/qgswmsserver.cpp
@@ -346,7 +346,7 @@ int main( int argc, char * argv[] )
}
catch ( QgsMapServiceException& ex )
{
QgsDebugMsg( "Catched exception during GetMap request" );
QgsDebugMsg( "Caught exception during GetMap request" );
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
@@ -357,6 +357,7 @@ int main( int argc, char * argv[] )
{
QgsDebugMsg( "Sending GetMap response" );
theRequestHandler->sendGetMapResponse( serviceString, result );
QgsDebugMsg( "Response sent" );
}
else
{
@@ -477,6 +478,7 @@ int main( int argc, char * argv[] )
}

delete theMapRenderer;
QgsDebugMsg( "************* all done ***************" );
return 0;
}

@@ -29,6 +29,7 @@
#include <QStringList>
#include <QUrl>
#include <fcgi_stdio.h>
#include "qgslogger.h"

QgsHttpRequestHandler::QgsHttpRequestHandler(): QgsRequestHandler()
{
@@ -42,6 +43,7 @@ QgsHttpRequestHandler::~QgsHttpRequestHandler()

void QgsHttpRequestHandler::sendHttpResponse( QByteArray* ba, const QString& format ) const
{
QgsDebugMsg("Checking byte array is ok to send...");
if ( !ba )
{
return;
@@ -52,12 +54,16 @@ void QgsHttpRequestHandler::sendHttpResponse( QByteArray* ba, const QString& for
return;
}

QgsDebugMsg("Byte array looks good, returning response...");
QgsDebugMsg(QString("Content size: %1").arg(ba->size()));
QgsDebugMsg(QString("Content format: %1").arg(format));
printf( "Content-Type: " );
printf( format.toLocal8Bit() );
printf( "\n" );
printf( "Content-Length: %d\n", ba->size() );
printf( "\n" );
fwrite( ba->data(), ba->size(), 1, FCGI_stdout );
int result=fwrite( ba->data(), ba->size(), 1, FCGI_stdout );
QgsDebugMsg(QString("Sent %1 bytes").arg(result));
}

QString QgsHttpRequestHandler::formatToMimeType( const QString& format ) const
@@ -84,10 +90,12 @@ QString QgsHttpRequestHandler::formatToMimeType( const QString& format ) const
void QgsHttpRequestHandler::sendGetMapResponse( const QString& service, QImage* img ) const
{
Q_UNUSED( service );
QgsDebugMsg("Sending getmap response...");
if ( img )
{
if ( mFormat != "PNG" && mFormat != "JPG" )
{
QgsDebugMsg("service exception - incorrect image format requested...");
sendServiceException( QgsMapServiceException( "InvalidFormat", "Output format '" + mFormat + "' is not supported in the GetMap request" ) );
return;
}
@@ -581,7 +581,12 @@ QImage* QgsWMSServer::getMap()
restoreLayerFilters( originalLayerFilters );
clearFeatureSelections( selectedLayerIdList );

QgsDebugMsg("clearing filters");
QgsMapLayerRegistry::instance()->mapLayers().clear();

#ifdef QGISDEBUG
theImage->save( QDir::tempPath() + QDir::separator() + "lastrender.png" );
#endif
return theImage;
}

0 comments on commit a5d2844

Please sign in to comment.