22
22
23
23
using namespace QgsWms ;
24
24
25
+ const double OGC_PX_M = 0.00028 ; // OGC reference pixel size in meter
26
+
25
27
QgsWmsRenderContext::QgsWmsRenderContext ( const QgsProject *project, QgsServerInterface *interface )
26
28
: mProject( project )
27
29
, mInterface( interface )
@@ -146,11 +148,12 @@ qreal QgsWmsRenderContext::dotsPerMm() const
146
148
// Apply DPI parameter if present. This is an extension of QGIS Server
147
149
// compared to WMS 1.3.
148
150
// Because of backwards compatibility, this parameter is optional
149
- double OGC_PX_M = 0.00028 ; // OGC reference pixel size in meter
150
151
int dpm = 1 / OGC_PX_M;
151
152
152
153
if ( !mParameters .dpi ().isEmpty () )
154
+ {
153
155
dpm = mParameters .dpiAsDouble () / 0.0254 ;
156
+ }
154
157
155
158
return dpm / 1000.0 ;
156
159
}
@@ -285,18 +288,18 @@ void QgsWmsRenderContext::initRestrictedLayers()
285
288
mRestrictedLayers .clear ();
286
289
287
290
// get name of restricted layers/groups in project
288
- QStringList restricted = QgsServerProjectUtils::wmsRestrictedLayers ( *mProject );
291
+ const QStringList restricted = QgsServerProjectUtils::wmsRestrictedLayers ( *mProject );
289
292
290
293
// extract restricted layers from excluded groups
291
294
QStringList restrictedLayersNames;
292
295
QgsLayerTreeGroup *root = mProject ->layerTreeRoot ();
293
296
294
- for ( const QString &l : restricted )
297
+ for ( const QString &l : qgis::as_const ( restricted ) )
295
298
{
296
- QgsLayerTreeGroup *group = root->findGroup ( l );
299
+ const QgsLayerTreeGroup *group = root->findGroup ( l );
297
300
if ( group )
298
301
{
299
- QList<QgsLayerTreeLayer *> groupLayers = group->findLayers ();
302
+ const QList<QgsLayerTreeLayer *> groupLayers = group->findLayers ();
300
303
for ( QgsLayerTreeLayer *treeLayer : groupLayers )
301
304
{
302
305
restrictedLayersNames.append ( treeLayer->name () );
@@ -309,7 +312,7 @@ void QgsWmsRenderContext::initRestrictedLayers()
309
312
}
310
313
311
314
// build output with names, ids or short name according to the configuration
312
- QList<QgsLayerTreeLayer *> layers = root->findLayers ();
315
+ const QList<QgsLayerTreeLayer *> layers = root->findLayers ();
313
316
for ( QgsLayerTreeLayer *layer : layers )
314
317
{
315
318
if ( restrictedLayersNames.contains ( layer->name () ) )
@@ -429,7 +432,7 @@ void QgsWmsRenderContext::searchLayersToRenderStyle()
429
432
layersFromGroup.push_front ( nickname );
430
433
}
431
434
432
- for ( const auto name : layersFromGroup )
435
+ for ( const auto & name : layersFromGroup )
433
436
{
434
437
mLayersToRender .append ( mNicknameLayers [ name ] );
435
438
}
0 commit comments