@@ -187,7 +187,7 @@ namespace QgsWms
187
187
if ( !mWmsParameters .bbox ().isEmpty () )
188
188
{
189
189
QgsMapSettings mapSettings;
190
- image.reset ( createImage ( getWidthAsInt (), getHeightAsInt (), false ) );
190
+ image.reset ( createImage ( width (), height (), false ) );
191
191
configureMapSettings ( image.get (), mapSettings );
192
192
legendSettings.setMapScale ( mapSettings.scale () );
193
193
legendSettings.setMapUnitsPerPixel ( mapSettings.mapUnitsPerPixel () );
@@ -1045,8 +1045,8 @@ namespace QgsWms
1045
1045
}
1046
1046
1047
1047
// create the mapSettings and the output image
1048
- int imageWidth = getWidthAsInt ();
1049
- int imageHeight = getHeightAsInt ();
1048
+ int imageWidth = mWmsParameters . widthAsInt ();
1049
+ int imageHeight = mWmsParameters . heightAsInt ();
1050
1050
1051
1051
// Provide default image width/height values if format is not image
1052
1052
if ( !( imageWidth && imageHeight ) && ! mWmsParameters .infoFormatIsImage () )
@@ -1123,10 +1123,10 @@ namespace QgsWms
1123
1123
QImage *QgsRenderer::createImage ( int width, int height, bool useBbox ) const
1124
1124
{
1125
1125
if ( width < 0 )
1126
- width = getWidthAsInt ();
1126
+ width = this -> width ();
1127
1127
1128
1128
if ( height < 0 )
1129
- height = getHeightAsInt ();
1129
+ height = this -> height ();
1130
1130
1131
1131
// Adapt width / height if the aspect ratio does not correspond with the BBOX.
1132
1132
// Required by WMS spec. 1.3.
@@ -1315,8 +1315,8 @@ namespace QgsWms
1315
1315
i = mWmsParameters .xAsInt ();
1316
1316
j = mWmsParameters .yAsInt ();
1317
1317
}
1318
- int width = getWidthAsInt ();
1319
- int height = getHeightAsInt ();
1318
+ int width = mWmsParameters . widthAsInt ();
1319
+ int height = mWmsParameters . heightAsInt ();
1320
1320
if ( ( i != -1 && j != -1 && width != 0 && height != 0 ) && ( width != outputImage->width () || height != outputImage->height () ) )
1321
1321
{
1322
1322
i *= ( outputImage->width () / static_cast <double >( width ) );
@@ -1994,14 +1994,14 @@ namespace QgsWms
1994
1994
{
1995
1995
// test if maxWidth / maxHeight set and WIDTH / HEIGHT parameter is in the range
1996
1996
int wmsMaxWidth = QgsServerProjectUtils::wmsMaxWidth ( *mProject );
1997
- int width = getWidthAsInt ();
1997
+ int width = this -> width ();
1998
1998
if ( wmsMaxWidth != -1 && width > wmsMaxWidth )
1999
1999
{
2000
2000
return false ;
2001
2001
}
2002
2002
2003
2003
int wmsMaxHeight = QgsServerProjectUtils::wmsMaxHeight ( *mProject );
2004
- int height = getHeightAsInt ();
2004
+ int height = this -> height ();
2005
2005
if ( wmsMaxHeight != -1 && height > wmsMaxHeight )
2006
2006
{
2007
2007
return false ;
@@ -3206,8 +3206,8 @@ namespace QgsWms
3206
3206
// WIDTH / HEIGHT parameters. If not, the image has to be scaled (required
3207
3207
// by WMS spec)
3208
3208
QImage *scaledImage = nullptr ;
3209
- int width = getWidthAsInt ();
3210
- int height = getHeightAsInt ();
3209
+ int width = this -> width ();
3210
+ int height = this -> height ();
3211
3211
if ( width != image->width () || height != image->height () )
3212
3212
{
3213
3213
scaledImage = new QImage ( image->scaled ( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
@@ -3418,20 +3418,22 @@ namespace QgsWms
3418
3418
}
3419
3419
}
3420
3420
3421
- int QgsRenderer::getHeightAsInt () const
3421
+ int QgsRenderer::height () const
3422
3422
{
3423
- if ( mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphic" ), Qt::CaseInsensitive ) == 0 ||
3424
- mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphics" ), Qt::CaseInsensitive ) )
3423
+ if ( ( mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphic" ), Qt::CaseInsensitive ) == 0 ||
3424
+ mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphics" ), Qt::CaseInsensitive ) == 0 ) &&
3425
+ mWmsParameters .srcHeightAsInt () > 0 )
3425
3426
return mWmsParameters .srcHeightAsInt ();
3426
3427
return mWmsParameters .heightAsInt ();
3427
3428
}
3428
3429
3429
- int QgsRenderer::getWidthAsInt () const
3430
+ int QgsRenderer::width () const
3430
3431
{
3431
- if ( mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphic" ), Qt::CaseInsensitive ) == 0 ||
3432
- mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphics" ), Qt::CaseInsensitive ) )
3432
+ if ( ( mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphic" ), Qt::CaseInsensitive ) == 0 ||
3433
+ mWmsParameters .request ().compare ( QStringLiteral ( " GetLegendGraphics" ), Qt::CaseInsensitive ) == 0 ) &&
3434
+ mWmsParameters .srcWidthAsInt () > 0 )
3433
3435
return mWmsParameters .srcWidthAsInt ();
3434
- return mWmsParameters .heightAsInt ();
3436
+ return mWmsParameters .widthAsInt ();
3435
3437
}
3436
3438
3437
3439
} // namespace QgsWms
0 commit comments