Skip to content

Commit 20a26a0

Browse files
committedMar 27, 2019
Minor cleaning
1 parent a159c01 commit 20a26a0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
 

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
using namespace QgsWms;
2424

25+
const double OGC_PX_M = 0.00028; // OGC reference pixel size in meter
26+
2527
QgsWmsRenderContext::QgsWmsRenderContext( const QgsProject *project, QgsServerInterface *interface )
2628
: mProject( project )
2729
, mInterface( interface )
@@ -146,11 +148,12 @@ qreal QgsWmsRenderContext::dotsPerMm() const
146148
// Apply DPI parameter if present. This is an extension of QGIS Server
147149
// compared to WMS 1.3.
148150
// Because of backwards compatibility, this parameter is optional
149-
double OGC_PX_M = 0.00028; // OGC reference pixel size in meter
150151
int dpm = 1 / OGC_PX_M;
151152

152153
if ( !mParameters.dpi().isEmpty() )
154+
{
153155
dpm = mParameters.dpiAsDouble() / 0.0254;
156+
}
154157

155158
return dpm / 1000.0;
156159
}
@@ -285,18 +288,18 @@ void QgsWmsRenderContext::initRestrictedLayers()
285288
mRestrictedLayers.clear();
286289

287290
// get name of restricted layers/groups in project
288-
QStringList restricted = QgsServerProjectUtils::wmsRestrictedLayers( *mProject );
291+
const QStringList restricted = QgsServerProjectUtils::wmsRestrictedLayers( *mProject );
289292

290293
// extract restricted layers from excluded groups
291294
QStringList restrictedLayersNames;
292295
QgsLayerTreeGroup *root = mProject->layerTreeRoot();
293296

294-
for ( const QString &l : restricted )
297+
for ( const QString &l : qgis::as_const( restricted ) )
295298
{
296-
QgsLayerTreeGroup *group = root->findGroup( l );
299+
const QgsLayerTreeGroup *group = root->findGroup( l );
297300
if ( group )
298301
{
299-
QList<QgsLayerTreeLayer *> groupLayers = group->findLayers();
302+
const QList<QgsLayerTreeLayer *> groupLayers = group->findLayers();
300303
for ( QgsLayerTreeLayer *treeLayer : groupLayers )
301304
{
302305
restrictedLayersNames.append( treeLayer->name() );
@@ -309,7 +312,7 @@ void QgsWmsRenderContext::initRestrictedLayers()
309312
}
310313

311314
// 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();
313316
for ( QgsLayerTreeLayer *layer : layers )
314317
{
315318
if ( restrictedLayersNames.contains( layer->name() ) )
@@ -429,7 +432,7 @@ void QgsWmsRenderContext::searchLayersToRenderStyle()
429432
layersFromGroup.push_front( nickname );
430433
}
431434

432-
for ( const auto name : layersFromGroup )
435+
for ( const auto &name : layersFromGroup )
433436
{
434437
mLayersToRender.append( mNicknameLayers[ name ] );
435438
}

0 commit comments

Comments
 (0)
Please sign in to comment.