Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server external wms several layers #38161

Merged
merged 4 commits into from Aug 12, 2020

Conversation

mhugent
Copy link
Contributor

@mhugent mhugent commented Aug 5, 2020

An external WMS layer can sometimes request several WMS layers and styles. Up to know, the server passed this as parameter to the WMS client uri. However it seems that it only works if the layers and styles are set one-by-one with wmsUri.setParam. It needs several layers-Parameter with one layer instead one with all the layers (e.g. layers=A&layers=B instead of layers=A,B).

@mhugent mhugent requested a review from pblottiere August 5, 2020 16:28
@github-actions github-actions bot added this to the 3.16.0 milestone Aug 5, 2020
QString paramName = paramIt.key().toLower();
if ( paramName == QLatin1String( "layers" ) || paramName == QLatin1String( "styles" ) )
{
QStringList values = paramIt.value().split( "," );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
QStringList values = paramIt.value().split( "," );
QStringList values = paramIt.value().split( ',' );

{
QStringList values = paramIt.value().split( "," );
QStringList::const_iterator valuesIt = values.constBegin();
for ( ; valuesIt != values.constEnd(); ++valuesIt )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        const QStringList values = paramIt.value().split( ',' );
        for ( const QString &value : values )
          wmsUri.setParam( paramName, value );

should be much easier to read

{
wmsUri.setParam( paramName, *valuesIt );
}
QStringList values = paramIt.value().split( ',' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
QStringList values = paramIt.value().split( ',' );
const QStringList values = paramIt.value().split( ',' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants