@@ -418,7 +418,7 @@ namespace QgsWms
418
418
QgsLayoutSize layoutSize ( layout->pageCollection ()->page ( 0 )->sizeWithUnits () );
419
419
QgsLayoutMeasurement width ( layout->convertFromLayoutUnits ( layoutSize.width (), QgsUnitTypes::LayoutUnit::LayoutMillimeters ) );
420
420
QgsLayoutMeasurement height ( layout->convertFromLayoutUnits ( layoutSize.height (), QgsUnitTypes::LayoutUnit::LayoutMillimeters ) );
421
- exportSettings.imageSize = QSize ( ( int ) ( width.length () * dpi / 25.4 ), ( int ) ( height.length () * dpi / 25.4 ) );
421
+ exportSettings.imageSize = QSize ( static_cast < int > ( width.length () * dpi / 25.4 ), static_cast < int > ( height.length () * dpi / 25.4 ) );
422
422
// Export first page only (unless it's a pdf, see below)
423
423
exportSettings.pages .append ( 0 );
424
424
QgsLayoutExporter exporter ( layout.get () );
@@ -1019,11 +1019,11 @@ namespace QgsWms
1019
1019
if ( !mapExtent.isEmpty () && height > 0 && width > 0 )
1020
1020
{
1021
1021
double mapWidthHeightRatio = mapExtent.width () / mapExtent.height ();
1022
- double imageWidthHeightRatio = ( double )width / ( double )height ;
1022
+ double imageWidthHeightRatio = static_cast < double >( width ) / static_cast < double >( height ) ;
1023
1023
if ( !qgsDoubleNear ( mapWidthHeightRatio, imageWidthHeightRatio, 0.0001 ) )
1024
1024
{
1025
1025
// inspired by MapServer, mapdraw.c L115
1026
- double cellsize = ( mapExtent.width () / ( double )width ) * 0.5 + ( mapExtent.height () / ( double )height ) * 0.5 ;
1026
+ double cellsize = ( mapExtent.width () / static_cast < double >( width ) ) * 0.5 + ( mapExtent.height () / static_cast < double >( height ) ) * 0.5 ;
1027
1027
width = mapExtent.width () / cellsize;
1028
1028
height = mapExtent.height () / cellsize;
1029
1029
}
@@ -1174,8 +1174,8 @@ namespace QgsWms
1174
1174
int height = mWmsParameters .heightAsInt ();
1175
1175
if ( ( i != -1 && j != -1 && width != 0 && height != 0 ) && ( width != outputImage->width () || height != outputImage->height () ) )
1176
1176
{
1177
- i *= ( outputImage->width () / ( double )width );
1178
- j *= ( outputImage->height () / ( double )height );
1177
+ i *= ( outputImage->width () / static_cast < double >( width ) );
1178
+ j *= ( outputImage->height () / static_cast < double >( height ) );
1179
1179
}
1180
1180
1181
1181
// init search variables
@@ -1573,11 +1573,13 @@ namespace QgsWms
1573
1573
1574
1574
QDomElement attributeElement = infoDocument.createElement ( QStringLiteral ( " Attribute" ) );
1575
1575
attributeElement.setAttribute ( QStringLiteral ( " name" ), attributeName );
1576
+ const QgsEditorWidgetSetup setup = layer->editorWidgetSetup ( i );
1576
1577
attributeElement.setAttribute ( QStringLiteral ( " value" ),
1577
- replaceValueMapAndRelation (
1578
- layer, i,
1579
- featureAttributes[i].isNull () ? QString () : QgsExpression::replaceExpressionText ( featureAttributes[i].toString (), &renderContext.expressionContext () )
1580
- )
1578
+ QgsExpression::replaceExpressionText (
1579
+ replaceValueMapAndRelation (
1580
+ layer, i,
1581
+ featureAttributes[i] ),
1582
+ &renderContext.expressionContext () )
1581
1583
);
1582
1584
featureElement.appendChild ( attributeElement );
1583
1585
}
@@ -1878,11 +1880,11 @@ namespace QgsWms
1878
1880
1879
1881
const int bytes_per_line = ( ( width * depth + 31 ) >> 5 ) << 2 ; // bytes per scanline (must be multiple of 4)
1880
1882
1881
- if ( std::numeric_limits<int >::max () / depth < ( uint )width
1883
+ if ( std::numeric_limits<int >::max () / depth < static_cast <uint>( width )
1882
1884
|| bytes_per_line <= 0
1883
1885
|| height <= 0
1884
- || std::numeric_limits<int >::max () / uint ( bytes_per_line ) < ( uint )height
1885
- || std::numeric_limits<int >::max () / sizeof ( uchar * ) < uint ( height ) )
1886
+ || std::numeric_limits<int >::max () / static_cast < uint> ( bytes_per_line ) < static_cast <uint>( height )
1887
+ || std::numeric_limits<int >::max () / sizeof ( uchar * ) < static_cast < uint> ( height ) )
1886
1888
return false ;
1887
1889
1888
1890
return true ;
@@ -2245,7 +2247,7 @@ namespace QgsWms
2245
2247
QString fieldTextString = featureAttributes.at ( i ).toString ();
2246
2248
if ( layer )
2247
2249
{
2248
- fieldTextString = replaceValueMapAndRelation ( layer, i, QgsExpression::replaceExpressionText ( fieldTextString, &expressionContext ) );
2250
+ fieldTextString = QgsExpression::replaceExpressionText ( replaceValueMapAndRelation ( layer, i, fieldTextString ) , &expressionContext );
2249
2251
}
2250
2252
QDomText fieldText = doc.createTextNode ( fieldTextString );
2251
2253
fieldElem.appendChild ( fieldText );
@@ -2270,7 +2272,7 @@ namespace QgsWms
2270
2272
return typeNameElement;
2271
2273
}
2272
2274
2273
- QString QgsRenderer::replaceValueMapAndRelation ( QgsVectorLayer *vl, int idx, const QString &attributeVal )
2275
+ QString QgsRenderer::replaceValueMapAndRelation ( QgsVectorLayer *vl, int idx, const QVariant &attributeVal )
2274
2276
{
2275
2277
const QgsEditorWidgetSetup setup = vl->editorWidgetSetup ( idx );
2276
2278
QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry ()->fieldFormatter ( setup.type () );
0 commit comments