Skip to content

Commit

Permalink
Merge pull request #1337 from Oslandia/test_qgis_mapserver
Browse files Browse the repository at this point in the history
fix #10198
  • Loading branch information
mhugent committed May 13, 2014
2 parents 1ed94d0 + 06738d4 commit 436973d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/mapserver/qgis_map_serv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
#include "qgsmapserviceexception.h"
#include "qgspallabeling.h"
#include "qgsnetworkaccessmanager.h"
#include "qgsmaplayerregistry.h"

#include <QDomDocument>
#include <QNetworkDiskCache>
#include <QImage>
#include <QSettings>
#include <QDateTime>
#include <QScopedPointer>

//for CMAKE_INSTALL_PREFIX
#include "qgsconfig.h"
Expand Down Expand Up @@ -280,7 +282,7 @@ int main( int argc, char * argv[] )
QgsCapabilitiesCache capabilitiesCache;

//creating QgsMapRenderer is expensive (access to srs.db), so we do it here before the fcgi loop
QgsMapRenderer* theMapRenderer = new QgsMapRenderer();
QScopedPointer< QgsMapRenderer > theMapRenderer( new QgsMapRenderer );
theMapRenderer->setLabelingEngine( new QgsPalLabeling() );

#ifdef QGSMSDEBUG
Expand All @@ -291,6 +293,10 @@ int main( int argc, char * argv[] )

while ( fcgi_accept() >= 0 )
{
QgsMapLayerRegistry::instance()->removeAllMapLayers();
qgsapp.processEvents();


if ( !logFile.isEmpty() )
{
#ifdef Q_WS_WIN
Expand All @@ -303,7 +309,7 @@ int main( int argc, char * argv[] )
printRequestInfos(); //print request infos if in debug mode

//Request handler
QgsRequestHandler* theRequestHandler = createRequestHandler();
QScopedPointer<QgsRequestHandler> theRequestHandler( createRequestHandler() );
QMap<QString, QString> parameterMap;
try
{
Expand All @@ -327,7 +333,6 @@ int main( int argc, char * argv[] )
if ( paramIt == parameterMap.constEnd() )
{
theRequestHandler->sendServiceException( QgsMapServiceException( "ServiceNotSpecified", "Service not specified. The SERVICE parameter is mandatory" ) );
delete theRequestHandler;
continue;
}
else
Expand All @@ -342,7 +347,7 @@ int main( int argc, char * argv[] )
{
//error handling
}
QgsWCSServer wcsServer( configFilePath, parameterMap, p, theRequestHandler );
QgsWCSServer wcsServer( configFilePath, parameterMap, p, theRequestHandler.take() );
wcsServer.executeRequest();
}
else if ( serviceString == "WFS" )
Expand All @@ -352,7 +357,7 @@ int main( int argc, char * argv[] )
{
//error handling
}
QgsWFSServer wfsServer( configFilePath, parameterMap, p, theRequestHandler );
QgsWFSServer wfsServer( configFilePath, parameterMap, p, theRequestHandler.take() );
wfsServer.executeRequest();
}
else //WMS else
Expand All @@ -363,12 +368,11 @@ int main( int argc, char * argv[] )
//error handling
}
//adminConfigParser->loadLabelSettings( theMapRenderer->labelingEngine() );
QgsWMSServer wmsServer( configFilePath, parameterMap, p, theRequestHandler, theMapRenderer, &capabilitiesCache );
QgsWMSServer wmsServer( configFilePath, parameterMap, p, theRequestHandler.take(), theMapRenderer.data(), &capabilitiesCache );
wmsServer.executeRequest();
}
}

delete theMapRenderer;
return 0;
}

0 comments on commit 436973d

Please sign in to comment.