Skip to content

Commit 4b17a81

Browse files
committedJul 23, 2018
WMS parameters inherits from global parameters
1 parent 1c6b058 commit 4b17a81

11 files changed

+979
-1128
lines changed
 

‎src/server/qgsserverparameters.cpp

Lines changed: 231 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,211 @@ QString QgsServerParameterDefinition::typeName() const
3333
return QVariant::typeToName( mType );
3434
}
3535

36+
QColor QgsServerParameterDefinition::toColor( bool &ok ) const
37+
{
38+
ok = true;
39+
QColor color = mDefaultValue.value<QColor>();
40+
QString cStr = mValue.toString();
41+
42+
if ( !cStr.isEmpty() )
43+
{
44+
// support hexadecimal notation to define colors
45+
if ( cStr.startsWith( QStringLiteral( "0x" ), Qt::CaseInsensitive ) )
46+
{
47+
cStr.replace( 0, 2, QStringLiteral( "#" ) );
48+
}
49+
50+
color = QColor( cStr );
51+
52+
ok = color.isValid();
53+
}
54+
55+
return color;
56+
}
57+
58+
QString QgsServerParameterDefinition::toString() const
59+
{
60+
return mValue.toString();
61+
}
62+
63+
QStringList QgsServerParameterDefinition::toStringList( const char delimiter ) const
64+
{
65+
return toString().split( delimiter, QString::SkipEmptyParts );
66+
}
67+
68+
QList<QgsGeometry> QgsServerParameterDefinition::toGeomList( bool &ok, const char delimiter ) const
69+
{
70+
ok = true;
71+
QList<QgsGeometry> geoms;
72+
73+
for ( const auto &wkt : toStringList( delimiter ) )
74+
{
75+
const QgsGeometry g( QgsGeometry::fromWkt( wkt ) );
76+
77+
if ( g.isGeosValid() )
78+
{
79+
geoms.append( g );
80+
}
81+
else
82+
{
83+
ok = false;
84+
return QList<QgsGeometry>();
85+
}
86+
}
87+
88+
return geoms;
89+
}
90+
91+
QList<QColor> QgsServerParameterDefinition::toColorList( bool &ok, const char delimiter ) const
92+
{
93+
ok = true;
94+
QList<QColor> colors;
95+
96+
for ( const auto &part : toStringList( delimiter ) )
97+
{
98+
QString cStr( part );
99+
if ( !cStr.isEmpty() )
100+
{
101+
// support hexadecimal notation to define colors
102+
if ( cStr.startsWith( QStringLiteral( "0x" ), Qt::CaseInsensitive ) )
103+
{
104+
cStr.replace( 0, 2, QStringLiteral( "#" ) );
105+
}
106+
107+
const QColor color = QColor( cStr );
108+
ok = color.isValid();
109+
110+
if ( !ok )
111+
{
112+
return QList<QColor>();
113+
}
114+
115+
colors.append( color );
116+
}
117+
}
118+
119+
return colors;
120+
}
121+
122+
QList<int> QgsServerParameterDefinition::toIntList( bool &ok, const char delimiter ) const
123+
{
124+
ok = true;
125+
QList<int> ints;
126+
127+
for ( const auto &part : toStringList( delimiter ) )
128+
{
129+
const int val = part.toInt( &ok );
130+
131+
if ( !ok )
132+
{
133+
return QList<int>();
134+
}
135+
136+
ints.append( val );
137+
}
138+
139+
return ints;
140+
}
141+
142+
QList<float> QgsServerParameterDefinition::toFloatList( bool &ok, const char delimiter ) const
143+
{
144+
ok = true;
145+
QList<float> floats;
146+
147+
for ( const auto &part : toStringList( delimiter ) )
148+
{
149+
const float val = part.toFloat( &ok );
150+
151+
if ( !ok )
152+
{
153+
return QList<float>();
154+
}
155+
156+
floats.append( val );
157+
}
158+
159+
return floats;
160+
}
161+
162+
QgsRectangle QgsServerParameterDefinition::toRectangle( bool &ok ) const
163+
{
164+
ok = true;
165+
QgsRectangle extent;
166+
167+
if ( !mValue.toString().isEmpty() )
168+
{
169+
QStringList corners = mValue.toString().split( ',' );
170+
171+
if ( corners.size() == 4 )
172+
{
173+
double d[4];
174+
175+
for ( int i = 0; i < 4; i++ )
176+
{
177+
corners[i].replace( ' ', '+' );
178+
d[i] = corners[i].toDouble( &ok );
179+
if ( !ok )
180+
{
181+
return QgsRectangle();
182+
}
183+
}
184+
185+
if ( d[0] > d[2] || d[1] > d[3] )
186+
{
187+
ok = false;
188+
return QgsRectangle();
189+
}
190+
191+
extent = QgsRectangle( d[0], d[1], d[2], d[3] );
192+
}
193+
else
194+
{
195+
ok = false;
196+
return QgsRectangle();
197+
}
198+
}
199+
200+
return extent;
201+
}
202+
203+
int QgsServerParameterDefinition::toInt( bool &ok ) const
204+
{
205+
ok = true;
206+
int val = mDefaultValue.toInt();
207+
208+
if ( !mValue.toString().isEmpty() )
209+
{
210+
val = mValue.toInt( &ok );
211+
}
212+
213+
return val;
214+
}
215+
216+
bool QgsServerParameterDefinition::toBool() const
217+
{
218+
int val = mDefaultValue.toBool();
219+
220+
if ( !mValue.toString().isEmpty() )
221+
{
222+
val = mValue.toBool();
223+
}
224+
225+
return val;
226+
}
227+
228+
double QgsServerParameterDefinition::toDouble( bool &ok ) const
229+
{
230+
ok = true;
231+
double val = mDefaultValue.toDouble();
232+
233+
if ( !mValue.toString().isEmpty() )
234+
{
235+
val = mValue.toDouble( &ok );
236+
}
237+
238+
return val;
239+
}
240+
36241
bool QgsServerParameterDefinition::isValid() const
37242
{
38243
return mValue.canConvert( mType );
@@ -53,7 +258,7 @@ QgsServerParameter::QgsServerParameter( const QgsServerParameter::Name name,
53258
{
54259
}
55260

56-
QString QgsServerParameter::name( QgsServerParameter::Name name )
261+
QString QgsServerParameter::name( const QgsServerParameter::Name name )
57262
{
58263
const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerParameter::Name>() );
59264
return metaEnum.valueToKey( name );
@@ -165,13 +370,20 @@ QMap<QString, QString> QgsServerParameters::toMap() const
165370
{
166371
QMap<QString, QString> params = mUnmanagedParameters;
167372

168-
for ( auto parameter : mParameters.toStdMap() )
373+
for ( const auto &parameter : mParameters.toStdMap() )
169374
{
170375
if ( parameter.second.mValue.isNull() )
171376
continue;
172377

173-
const QString paramName = QgsServerParameter::name( parameter.first );
174-
params[paramName] = parameter.second.mValue.toString();
378+
if ( parameter.second.mName == QgsServerParameter::VERSION_SERVICE )
379+
{
380+
params["VERSION"] = parameter.second.mValue.toString();
381+
}
382+
else
383+
{
384+
const QString paramName = QgsServerParameter::name( parameter.first );
385+
params[paramName] = parameter.second.mValue.toString();
386+
}
175387
}
176388

177389
return params;
@@ -210,13 +422,27 @@ void QgsServerParameters::load( const QUrlQuery &query )
210422
mParameters[name].raiseError();
211423
}
212424
}
213-
else
425+
else if ( item.first.compare( QStringLiteral( "VERSION" ) ) == 0 )
426+
{
427+
const QgsServerParameter::Name name = QgsServerParameter::VERSION_SERVICE;
428+
mParameters[name].mValue = item.second;
429+
if ( ! mParameters[name].isValid() )
430+
{
431+
mParameters[name].raiseError();
432+
}
433+
}
434+
else if ( ! loadParameter( item ) )
214435
{
215436
mUnmanagedParameters[item.first.toUpper()] = item.second;
216437
}
217438
}
218439
}
219440

441+
bool QgsServerParameters::loadParameter( const QPair<QString, QString> &item )
442+
{
443+
return false;
444+
}
445+
220446
void QgsServerParameters::clear()
221447
{
222448
mParameters.clear();

‎src/server/qgsserverparameters.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <QObject>
2323
#include <QMetaEnum>
2424
#include <QUrlQuery>
25+
#include <QColor>
26+
#include "qgsgeometry.h"
2527
#include "qgis_server.h"
2628

2729
class SERVER_EXPORT QgsServerParameterDefinition
@@ -31,8 +33,19 @@ class SERVER_EXPORT QgsServerParameterDefinition
3133
const QVariant defaultValue = QVariant( "" ) );
3234

3335
QString typeName() const;
34-
35-
bool isValid() const;
36+
virtual bool isValid() const;
37+
38+
QString toString() const;
39+
QStringList toStringList( char delimiter = ',' ) const;
40+
QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
41+
QList<float> toFloatList( bool &ok, char delimiter = ',' ) const;
42+
QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
43+
QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
44+
QgsRectangle toRectangle( bool &ok ) const;
45+
int toInt( bool &ok ) const;
46+
double toDouble( bool &ok ) const;
47+
bool toBool() const;
48+
QColor toColor( bool &ok ) const;
3649

3750
static void raiseError( const QString &msg );
3851

@@ -63,7 +76,7 @@ class SERVER_EXPORT QgsServerParameter : public QgsServerParameterDefinition
6376

6477
void raiseError() const;
6578

66-
static QString name( QgsServerParameter::Name );
79+
static QString name( const QgsServerParameter::Name name );
6780
static QgsServerParameter::Name name( const QString &name );
6881

6982
QgsServerParameter::Name mName;
@@ -165,6 +178,9 @@ class SERVER_EXPORT QgsServerParameters
165178
*/
166179
QString version() const;
167180

181+
protected:
182+
virtual bool loadParameter( const QPair<QString, QString> &item );
183+
168184
private:
169185
void save( const QgsServerParameter &parameter );
170186
QVariant value( QgsServerParameter::Name name ) const;

‎src/server/services/wms/qgsdxfwriter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ namespace QgsWms
5454
Q_UNUSED( version );
5555

5656
QgsServerRequest::Parameters params = request.parameters();
57-
QgsRenderer renderer( serverIface, project, params );
57+
58+
QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) );
59+
QgsRenderer renderer( serverIface, project, wmsParameters );
5860

5961
QMap<QString, QString> formatOptionsMap = parseFormatOptions( params.value( QStringLiteral( "FORMAT_OPTIONS" ) ) );
6062

‎src/server/services/wms/qgswmsgetfeatureinfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ namespace QgsWms
3131
{
3232
Q_UNUSED( version );
3333
QgsServerRequest::Parameters params = request.parameters();
34-
QgsRenderer renderer( serverIface, project, params );
34+
35+
QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) );
36+
QgsRenderer renderer( serverIface, project, wmsParameters );
3537

3638
QString infoFormat = params.value( QStringLiteral( "INFO_FORMAT" ), QStringLiteral( "text/plain" ) );
3739

‎src/server/services/wms/qgswmsgetlegendgraphics.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ namespace QgsWms
3434
Q_UNUSED( version );
3535

3636
QgsServerRequest::Parameters params = request.parameters();
37-
QgsRenderer renderer( serverIface, project, params );
37+
38+
QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) );
39+
QgsRenderer renderer( serverIface, project, wmsParameters );
3840

3941
std::unique_ptr<QImage> result( renderer.getLegendGraphics() );
4042

‎src/server/services/wms/qgswmsgetmap.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ namespace QgsWms
3434
Q_UNUSED( version );
3535

3636
QgsServerRequest::Parameters params = request.parameters();
37-
QgsRenderer renderer( serverIface, project, params );
37+
38+
QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) );
39+
QgsRenderer renderer( serverIface, project, wmsParameters );
3840

3941
std::unique_ptr<QImage> result( renderer.getMap() );
4042
if ( result )

‎src/server/services/wms/qgswmsgetprint.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ namespace QgsWms
3232

3333
Q_UNUSED( version );
3434

35-
QgsRenderer renderer( serverIface, project, params );
35+
QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) );
36+
QgsRenderer renderer( serverIface, project, wmsParameters );
3637

3738
QString format = params.value( "FORMAT" );
3839
QString contentType;

‎src/server/services/wms/qgswmsparameters.cpp

Lines changed: 649 additions & 1037 deletions
Large diffs are not rendered by default.

‎src/server/services/wms/qgswmsparameters.h

Lines changed: 57 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include "qgswmsserviceexception.h"
2828
#include "qgsserverrequest.h"
2929
#include "qgslegendsettings.h"
30-
#include "qgsgeometry.h"
3130
#include "qgsprojectversion.h"
31+
#include "qgsserverparameters.h"
3232

3333
namespace QgsWms
3434
{
@@ -74,21 +74,23 @@ namespace QgsWms
7474
* \brief Interface to retrieve and manipulate WMS parameters received from the client.
7575
* \since QGIS 3.0
7676
*/
77-
class QgsWmsParameters
77+
class QgsWmsParameter : public QgsServerParameterDefinition
7878
{
7979
Q_GADGET
8080

8181
public:
8282
//! Available parameters for WMS requests
83-
enum ParameterName
83+
enum Name
8484
{
85+
UNKNOWN,
8586
BOXSPACE,
8687
CRS,
8788
SRS,
8889
WIDTH,
8990
HEIGHT,
9091
BBOX,
9192
ICONLABELSPACE,
93+
IMAGE_QUALITY,
9294
ITEMFONTFAMILY,
9395
ITEMFONTBOLD,
9496
ITEMFONTITALIC,
@@ -147,7 +149,37 @@ namespace QgsWms
147149
WITH_GEOMETRY,
148150
WITH_MAPTIP
149151
};
150-
Q_ENUM( ParameterName )
152+
Q_ENUM( Name )
153+
154+
QgsWmsParameter( const QgsWmsParameter::Name name = QgsWmsParameter::UNKNOWN,
155+
const QVariant::Type type = QVariant::String,
156+
const QVariant defaultValue = QVariant( "" ) );
157+
158+
bool isValid() const override;
159+
160+
QList<QgsGeometry> toGeomList( const char delimiter = ',' ) const;
161+
QList<int> toIntList( const char delimiter = ',' ) const;
162+
QList<float> toFloatList( const char delimiter = ',' ) const;
163+
QList<QColor> toColorList( const char delimiter = ',' ) const;
164+
QgsRectangle toRectangle() const;
165+
int toInt() const;
166+
double toDouble() const;
167+
QColor toColor() const;
168+
169+
void raiseError() const;
170+
171+
static QString name( const QgsWmsParameter::Name );
172+
static QgsWmsParameter::Name name( const QString &name );
173+
174+
QgsWmsParameter::Name mName;
175+
int mId = -1;
176+
};
177+
178+
class QgsWmsParameters : public QgsServerParameters
179+
{
180+
Q_GADGET
181+
182+
public:
151183

152184
//! Output format for the response
153185
enum Format
@@ -161,19 +193,13 @@ namespace QgsWms
161193
GML
162194
};
163195

164-
struct Parameter
165-
{
166-
ParameterName mName;
167-
QVariant::Type mType;
168-
QVariant mDefaultValue;
169-
QVariant mValue;
170-
};
171-
172196
/**
173197
* Constructor for WMS parameters with specific values.
174198
* \param parameters Map of parameters where keys are parameters' names.
175199
*/
176-
QgsWmsParameters( const QgsServerRequest::Parameters &parameters );
200+
// QgsWmsParameters( const QgsServerRequest::Parameters &parameters );
201+
202+
QgsWmsParameters( const QgsServerParameters &parameters );
177203

178204
/**
179205
* Constructor for WMS parameters with default values only.
@@ -184,7 +210,7 @@ namespace QgsWms
184210
* Loads new parameters.
185211
* \param parameters Map of parameters
186212
*/
187-
void load( const QgsServerRequest::Parameters &parameters );
213+
// void load( const QgsServerRequest::Parameters &parameters );
188214

189215
/**
190216
* Dumps parameters.
@@ -342,16 +368,20 @@ namespace QgsWms
342368
*/
343369
bool infoFormatIsImage() const;
344370

371+
QString imageQuality() const;
372+
373+
int imageQualityAsInt() const;
374+
345375
/**
346376
* Returns infoFormat. If the INFO_FORMAT parameter is not used, then the
347-
* default value is text/plain.
377+
* default value is text/plain.
348378
* \returns infoFormat
349379
*/
350380
Format infoFormat() const;
351381

352382
/**
353383
* Returns the infoFormat version for GML. If the INFO_FORMAT is not GML,
354-
* then the default value is -1.
384+
* then the default value is -1.
355385
* \returns infoFormat version
356386
*/
357387
int infoFormatVersion() const;
@@ -364,8 +394,8 @@ namespace QgsWms
364394

365395
/**
366396
* Returns I parameter as an int or its default value if not
367-
* defined. An exception is raised if I is defined and cannot be
368-
* converted.
397+
* defined. An exception is raised if I is defined and cannot be
398+
* converted.
369399
* \returns i parameter
370400
* \throws QgsBadRequestException
371401
*/
@@ -597,8 +627,7 @@ namespace QgsWms
597627

598628
/**
599629
* Returns LAYERFONTBOLD as a boolean or its default value if not
600-
* defined. An exception is raised if an
601-
* invalid parameter is found.
630+
* defined. An exception is raised if an invalid parameter is found.
602631
* \returns layerFontBold
603632
* \throws QgsBadRequestException
604633
*/
@@ -940,52 +969,18 @@ namespace QgsWms
940969
bool withMapTip() const;
941970

942971
private:
943-
QString name( ParameterName name ) const;
944-
void raiseError( ParameterName name ) const;
945-
void raiseError( ParameterName name, int mapId ) const;
972+
bool loadParameter( const QPair<QString, QString> &parameter ) override;
973+
974+
void save( const QgsWmsParameter &parameter, bool multi = false );
975+
976+
QgsWmsParameter idParameter( QgsWmsParameter::Name name, int id ) const;
977+
946978
void raiseError( const QString &msg ) const;
947-
void initParameters();
948-
void save( const Parameter &parameter );
949-
QVariant value( ParameterName name ) const;
950-
QVariant defaultValue( ParameterName name ) const;
951-
void save( const Parameter &parameter, int mapId );
952-
QVariant value( ParameterName name, int mapId ) const;
953-
QVariant defaultValue( ParameterName name, int mapId ) const;
954979
void log( const QString &msg ) const;
955-
double toDouble( const QVariant &value, const QVariant &defaultValue, bool *error = Q_NULLPTR ) const;
956-
double toDouble( ParameterName name ) const;
957-
double toDouble( ParameterName name, int mapId ) const;
958-
bool toBool( const QVariant &value, const QVariant &defaultValue ) const;
959-
bool toBool( ParameterName name ) const;
960-
bool toBool( ParameterName name, int mapId ) const;
961-
int toInt( const QVariant &value, const QVariant &defaultValue, bool *error = Q_NULLPTR ) const;
962-
int toInt( ParameterName name ) const;
963-
int toInt( ParameterName name, int mapId ) const;
964-
QColor toColor( const QVariant &value, const QVariant &defaultValue, bool *error = Q_NULLPTR ) const;
965-
QColor toColor( ParameterName name ) const;
966-
QColor toColor( ParameterName name, int mapId ) const;
967-
QgsRectangle toRectangle( const QVariant &value, bool *error = Q_NULLPTR ) const;
968-
QgsRectangle toRectangle( ParameterName name ) const;
969-
QgsRectangle toRectangle( ParameterName name, int mapId ) const;
970-
QStringList toStringList( ParameterName name, char delimiter = ',' ) const;
971-
QStringList toStringList( ParameterName name, int mapId, char delimiter = ',' ) const;
972-
QList<int> toIntList( const QStringList &l, bool *error = Q_NULLPTR ) const;
973-
QList<int> toIntList( const QStringList &l, ParameterName name ) const;
974-
QList<int> toIntList( const QStringList &l, ParameterName name, int mapId ) const;
975-
QList<float> toFloatList( const QStringList &l, bool *error = Q_NULLPTR ) const;
976-
QList<float> toFloatList( const QStringList &l, ParameterName name ) const;
977-
QList<float> toFloatList( const QStringList &l, ParameterName name, int mapId ) const;
978-
QList<QColor> toColorList( const QStringList &l, bool *error = Q_NULLPTR ) const;
979-
QList<QColor> toColorList( const QStringList &l, ParameterName name ) const;
980-
QList<QColor> toColorList( const QStringList &l, ParameterName name, int mapId ) const;
981-
QList<QgsGeometry> toGeomList( const QStringList &l, bool *error = Q_NULLPTR ) const;
982-
QList<QgsGeometry> toGeomList( const QStringList &l, ParameterName name ) const;
983-
QList<QgsGeometry> toGeomList( const QStringList &l, ParameterName name, int mapId ) const;
980+
984981
QMultiMap<QString, QString> getLayerFilters( const QStringList &layers ) const;
985982

986-
QgsServerRequest::Parameters mRequestParameters;
987-
QMap<ParameterName, Parameter> mParameters;
988-
QMap<int, QMap<ParameterName, Parameter>> mComposerParameters;
983+
QMap<QgsWmsParameter::Name, QgsWmsParameter> mWmsParameters;
989984
QMap<QString, QMap<QString, QString> > mExternalWMSParameters;
990985
QList<QgsProjectVersion> mVersions;
991986
};

‎src/server/services/wms/qgswmsrenderer.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,14 @@ namespace QgsWms
127127

128128
QgsRenderer::QgsRenderer( QgsServerInterface *serverIface,
129129
const QgsProject *project,
130-
const QgsServerRequest::Parameters &parameters )
131-
: mParameters( parameters )
130+
const QgsWmsParameters &parameters )
131+
: mWmsParameters( parameters )
132132
#ifdef HAVE_SERVER_PYTHON_PLUGINS
133133
, mAccessControl( serverIface->accessControls() )
134134
#endif
135135
, mSettings( *serverIface->serverSettings() )
136136
, mProject( project )
137137
{
138-
mWmsParameters.load( parameters );
139138
mWmsParameters.dump();
140139

141140
initRestrictedLayers();
@@ -1402,7 +1401,7 @@ namespace QgsWms
14021401
{
14031402
searchRect = layerFilterGeom->boundingBox();
14041403
}
1405-
else if ( mParameters.contains( QStringLiteral( "BBOX" ) ) )
1404+
else if ( !mWmsParameters.bbox().isEmpty() )
14061405
{
14071406
searchRect = layerRect;
14081407
}
@@ -2267,21 +2266,15 @@ namespace QgsWms
22672266

22682267
int QgsRenderer::getImageQuality() const
22692268
{
2270-
22712269
// First taken from QGIS project
22722270
int imageQuality = QgsServerProjectUtils::wmsImageQuality( *mProject );
22732271

22742272
// Then checks if a parameter is given, if so use it instead
2275-
if ( mParameters.contains( QStringLiteral( "IMAGE_QUALITY" ) ) )
2273+
if ( !mWmsParameters.imageQuality().isEmpty() )
22762274
{
2277-
bool conversionSuccess;
2278-
int imageQualityParameter;
2279-
imageQualityParameter = mParameters[ QStringLiteral( "IMAGE_QUALITY" )].toInt( &conversionSuccess );
2280-
if ( conversionSuccess )
2281-
{
2282-
imageQuality = imageQualityParameter;
2283-
}
2275+
imageQuality = mWmsParameters.imageQualityAsInt();
22842276
}
2277+
22852278
return imageQuality;
22862279
}
22872280

‎src/server/services/wms/qgswmsrenderer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace QgsWms
7777
QgsConfigParser and QgsCapabilitiesCache*/
7878
QgsRenderer( QgsServerInterface *serverIface,
7979
const QgsProject *project,
80-
const QgsServerRequest::Parameters &parameters );
80+
const QgsWmsParameters &parameters );
8181

8282
~QgsRenderer();
8383

@@ -292,7 +292,8 @@ namespace QgsWms
292292

293293
private:
294294

295-
const QgsServerRequest::Parameters &mParameters;
295+
QgsServerRequest::Parameters mParameters;
296+
const QgsWmsParameters &mWmsParameters;
296297

297298
#ifdef HAVE_SERVER_PYTHON_PLUGINS
298299
//! The access control helper
@@ -302,7 +303,6 @@ namespace QgsWms
302303

303304
const QgsServerSettings &mSettings;
304305
const QgsProject *mProject = nullptr;
305-
QgsWmsParameters mWmsParameters;
306306
QStringList mRestrictedLayers;
307307
QMap<QString, QgsMapLayer *> mNicknameLayers;
308308
QMap<QString, QList<QgsMapLayer *> > mLayerGroups;

0 commit comments

Comments
 (0)
Please sign in to comment.