Skip to content

Commit

Permalink
Update getprint
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 9, 2021
1 parent ebcbc30 commit 2e80141
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
31 changes: 3 additions & 28 deletions src/server/services/wms/qgswms.cpp
Expand Up @@ -66,34 +66,9 @@ namespace QgsWms
void executeRequest( const QgsServerRequest &request, QgsServerResponse &response,
const QgsProject *project ) override
{
const QgsWmsParameters parameters( request.serverParameters() );

QString version = parameters.version();
if ( version.isEmpty() )
{
// WMTVER needs to be supported by WMS 1.1.1 for backwards
// compatibility with WMS 1.0.0
version = parameters.wmtver();
}

// Set the default version
if ( version.isEmpty() || !parameters.versionIsValid( version ) )
{
version = mVersion;
}

// WMS 1.3.0 specification: If a version lower than any of those known
// to the server is requested, then the server shall send the lowest
// version it supports.
if ( QgsProjectVersion( 1, 1, 1 ) > parameters.versionAsNumber() )
{
version = "1.1.1";
}

// Get the request
const QgsWmsRequest wmsRequest( request );
const QString req = parameters.request();
const QString version = parameters.version();
const QString req = wmsRequest.wmsParameters().request();

if ( req.isEmpty() )
{
Expand All @@ -111,7 +86,7 @@ namespace QgsWms
}
else if ( QSTR_COMPARE( req, "GetMap" ) )
{
if QSTR_COMPARE( parameters.formatAsString(), "application/dxf" )
if QSTR_COMPARE( wmsRequest.wmsParameters().formatAsString(), "application/dxf" )
{
writeAsDxf( mServerIface, project, request, response );
}
Expand Down Expand Up @@ -153,7 +128,7 @@ namespace QgsWms
throw QgsServiceException( QgsServiceException::OGC_OperationNotSupported,
QStringLiteral( "Request %1 is not supported" ).arg( req ), 501 );
}
writeGetPrint( mServerIface, project, version, request, response );
writeGetPrint( mServerIface, project, request, response );
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/server/services/wms/qgswmsgetprint.cpp
Expand Up @@ -19,18 +19,18 @@
* *
***************************************************************************/
#include "qgswmsutils.h"
#include "qgswmsrequest.h"
#include "qgswmsgetprint.h"
#include "qgswmsrenderer.h"
#include "qgswmsserviceexception.h"

namespace QgsWms
{
void writeGetPrint( QgsServerInterface *serverIface, const QgsProject *project,
const QString &, const QgsServerRequest &request,
const QgsWmsRequest &request,
QgsServerResponse &response )
{
// get wms parameters from query
const QgsWmsParameters parameters( request.serverParameters() );
const QgsWmsParameters parameters = request.wmsParameters();

// GetPrint supports svg/png/pdf
const QgsWmsParameters::Format format = parameters.format();
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsgetprint.h
Expand Up @@ -26,7 +26,7 @@ namespace QgsWms
* Output GetPrint response
*/
void writeGetPrint( QgsServerInterface *serverIface, const QgsProject *project,
const QString &version, const QgsServerRequest &request,
const QgsWmsRequest &request,
QgsServerResponse &response );

} // namespace QgsWms
Expand Down

0 comments on commit 2e80141

Please sign in to comment.