QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgswmsparameters.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgswmsparameters.cpp
3 --------------------
4 begin : March 17, 2017
5 copyright : (C) 2017 by Paul Blottiere
6 email : paul dot blottiere at oslandia dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgswmsparameters.h"
19
20#include "qgsdatasourceuri.h"
21#include "qgsfontutils.h"
23#include "qgsmessagelog.h"
25
26#include <QRegularExpression>
27
28#include "moc_qgswmsparameters.cpp"
29
30const QString EXTERNAL_LAYER_PREFIX = QStringLiteral( "EXTERNAL_WMS:" );
31
32namespace QgsWms
33{
34 //
35 // QgsWmsParameter
36 //
37 QgsWmsParameter::QgsWmsParameter( const QgsWmsParameter::Name name, const QMetaType::Type type, const QVariant defaultValue )
38 : QgsServerParameterDefinition( type, defaultValue )
39 , mName( name )
40 {
41 }
42
47
49 {
50 const QString msg = QString( "%1 ('%2') cannot be converted into %3" ).arg( name( mName ), toString(), typeName() );
52 }
53
54 QStringList QgsWmsParameter::toStyleList( const char delimiter, bool skipEmptyParts ) const
55 {
56 return QgsServerParameterDefinition::toStringList( delimiter, skipEmptyParts );
57 }
58
59 QList<QgsGeometry> QgsWmsParameter::toGeomList( const char delimiter, bool skipEmptyParts ) const
60 {
61 bool ok = true;
62 const QList<QgsGeometry> geoms = QgsServerParameterDefinition::toGeomList( ok, delimiter, skipEmptyParts );
63
64 if ( !ok )
65 {
66 const QString msg = QString( "%1 ('%2') cannot be converted into a list of geometries" ).arg( name( mName ), toString() );
68 }
69
70 return geoms;
71 }
72
74 {
75 bool ok = true;
77
78 if ( !ok )
79 {
80 const QString msg = QString( "%1 ('%2') cannot be converted into a rectangle" ).arg( name( mName ), toString() );
82 }
83
84 return rect;
85 }
86
88 {
89 bool ok = false;
90 const int val = QgsServerParameterDefinition::toInt( ok );
91
92 if ( !ok )
93 {
94 raiseError();
95 }
96
97 return val;
98 }
99
101 {
102 // Check URL -- it will be used in error messages
103 const QUrl url = toUrl();
104
105 bool ok = false;
106 const QString content = QgsServerParameterDefinition::loadUrl( ok );
107
108 if ( !ok )
109 {
110 const QString msg = QString( "%1 request error for %2" ).arg( name( mName ), url.toString() );
112 }
113
114 return content;
115 }
116
118 {
119 bool ok = false;
120 const QUrl url = QgsServerParameterDefinition::toUrl( ok );
121
122 if ( !ok )
123 {
124 raiseError();
125 }
126
127 return url;
128 }
129
131 {
132 bool ok = false;
133 const QColor col = QgsServerParameterDefinition::toColor( ok );
134
135 if ( !ok )
136 {
137 raiseError();
138 }
139
140 return col;
141 }
142
143 QList<QColor> QgsWmsParameter::toColorList( const char delimiter, bool skipEmptyParts ) const
144 {
145 bool ok = false;
146 const QList<QColor> vals = QgsServerParameterDefinition::toColorList( ok, delimiter, skipEmptyParts );
147
148 if ( !ok )
149 {
150 const QString msg = QString( "%1 ('%2') cannot be converted into a list of colors" ).arg( name( mName ), toString() );
152 }
153
154 return vals;
155 }
156
157 QList<int> QgsWmsParameter::toIntList( const char delimiter, bool skipEmptyParts ) const
158 {
159 bool ok = false;
160 const QList<int> vals = QgsServerParameterDefinition::toIntList( ok, delimiter, skipEmptyParts );
161
162 if ( !ok )
163 {
164 const QString msg = QString( "%1 ('%2') cannot be converted into a list of int" ).arg( name( mName ), toString() );
166 }
167
168 return vals;
169 }
170
171 QList<double> QgsWmsParameter::toDoubleList( const char delimiter, bool skipEmptyParts ) const
172 {
173 bool ok = false;
174 const QList<double> vals = QgsServerParameterDefinition::toDoubleList( ok, delimiter, skipEmptyParts );
175
176 if ( !ok )
177 {
178 const QString msg = QString( "%1 ('%2') cannot be converted into a list of float" ).arg( name( mName ), toString() );
180 }
181
182 return vals;
183 }
184
186 {
187 bool ok = false;
188 const double val = QgsServerParameterDefinition::toDouble( ok );
189
190 if ( !ok )
191 {
192 raiseError();
193 }
194
195 return val;
196 }
197
198 QString QgsWmsParameter::name() const
199 {
201 }
202
204 {
205 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
206 return metaEnum.valueToKey( name );
207 }
208
210 {
211 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
212 return ( QgsWmsParameter::Name ) metaEnum.keyToValue( name.toUpper().toStdString().c_str() );
213 }
214
215 //
216 // QgsWmsParameters
217 //
220 {
221 // Available version number
222 mVersions.append( QgsProjectVersion( 1, 1, 1 ) );
223 mVersions.append( QgsProjectVersion( 1, 3, 0 ) );
224
225 // WMS parameters definition
226 const QgsWmsParameter pQuality( QgsWmsParameter::IMAGE_QUALITY, QMetaType::Type::Int, QVariant( 0 ) );
227 save( pQuality );
228
229 const QgsWmsParameter pTiled( QgsWmsParameter::TILED, QMetaType::Type::Bool, QVariant( false ) );
230 save( pTiled );
231
232 const QgsWmsParameter pBoxSpace( QgsWmsParameter::BOXSPACE, QMetaType::Type::Double, QVariant( 2.0 ) );
233 save( pBoxSpace );
234
235 const QgsWmsParameter pSymbSpace( QgsWmsParameter::SYMBOLSPACE, QMetaType::Type::Double, QVariant( 2.0 ) );
236 save( pSymbSpace );
237
238 const QgsWmsParameter pLayerSpace( QgsWmsParameter::LAYERSPACE, QMetaType::Type::Double, QVariant( 3.0 ) );
239 save( pLayerSpace );
240
241 const QgsWmsParameter pTitleSpace( QgsWmsParameter::LAYERTITLESPACE, QMetaType::Type::Double, QVariant( 3.0 ) );
242 save( pTitleSpace );
243
244 const QgsWmsParameter pSymbHeight( QgsWmsParameter::SYMBOLHEIGHT, QMetaType::Type::Double, QVariant( 4.0 ) );
245 save( pSymbHeight );
246
247 const QgsWmsParameter pSymbWidth( QgsWmsParameter::SYMBOLWIDTH, QMetaType::Type::Double, QVariant( 7.0 ) );
248 save( pSymbWidth );
249
250 const QgsWmsParameter pIcLabelSpace( QgsWmsParameter::ICONLABELSPACE, QMetaType::Type::Double, QVariant( 2.0 ) );
251 save( pIcLabelSpace );
252
254 save( pItFontFamily );
255
256 const QgsWmsParameter pItFontBold( QgsWmsParameter::ITEMFONTBOLD, QMetaType::Type::Bool, QVariant( false ) );
257 save( pItFontBold );
258
259 const QgsWmsParameter pItFontItalic( QgsWmsParameter::ITEMFONTITALIC, QMetaType::Type::Bool, QVariant( false ) );
260 save( pItFontItalic );
261
262 const QgsWmsParameter pItFontSize( QgsWmsParameter::ITEMFONTSIZE, QMetaType::Type::Double, QVariant( -1 ) );
263 save( pItFontSize );
264
265 const QgsWmsParameter pItFontColor( QgsWmsParameter::ITEMFONTCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
266 save( pItFontColor );
267
268 const QgsWmsParameter pHighlightGeom( QgsWmsParameter::HIGHLIGHT_GEOM );
269 save( pHighlightGeom );
270
271 const QgsWmsParameter pShowFeatureCount( QgsWmsParameter::SHOWFEATURECOUNT, QMetaType::Type::Bool, QVariant( false ) );
272 save( pShowFeatureCount );
273
274 const QgsWmsParameter pHighlightSymbol( QgsWmsParameter::HIGHLIGHT_SYMBOL );
275 save( pHighlightSymbol );
276
278 save( pHighlightLabel );
279
280 const QgsWmsParameter pHighlightColor( QgsWmsParameter::HIGHLIGHT_LABELCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
281 save( pHighlightColor );
282
283 const QgsWmsParameter pHighlightFontSize( QgsWmsParameter::HIGHLIGHT_LABELSIZE );
284 save( pHighlightFontSize );
285
286 const QgsWmsParameter pHighlightFontWeight( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT );
287 save( pHighlightFontWeight );
288
290 save( pHighlightFont );
291
292 const QgsWmsParameter pHighlightBufferColor( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
293 save( pHighlightBufferColor );
294
296 save( pHighlightBufferSize );
297
298 const QgsWmsParameter pLabelRotation( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION, QMetaType::Type::Double );
299 save( pLabelRotation );
300
301 const QgsWmsParameter pLabelDistance( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE, QMetaType::Type::Double );
302 save( pLabelDistance );
303
305 save( pLabelHali );
306
308 save( pLabelVali );
309
311 save( pCRS );
312
314 save( pSRS );
315
316 const QgsWmsParameter pFormat( QgsWmsParameter::FORMAT, QMetaType::Type::QString, QVariant( "png" ) );
317 save( pFormat );
318
320 save( pInfoFormat );
321
322 const QgsWmsParameter pI( QgsWmsParameter::I, QMetaType::Type::Int, QVariant( -1 ) );
323 save( pI );
324
325 const QgsWmsParameter pJ( QgsWmsParameter::J, QMetaType::Type::Int, QVariant( -1 ) );
326 save( pJ );
327
328 const QgsWmsParameter pX( QgsWmsParameter::X, QMetaType::Type::Int, QVariant( -1 ) );
329 save( pX );
330
331 const QgsWmsParameter pY( QgsWmsParameter::Y, QMetaType::Type::Int, QVariant( -1 ) );
332 save( pY );
333
335 save( pRule );
336
337 const QgsWmsParameter pRuleLabel( QgsWmsParameter::RULELABEL, QMetaType::Type::Bool, QVariant( true ) );
338 save( pRuleLabel );
339
340 const QgsWmsParameter pShowRuleDetails( QgsWmsParameter::SHOWRULEDETAILS, QMetaType::Type::Bool, QVariant( false ) );
341 save( pShowRuleDetails );
342
343 const QgsWmsParameter pScale( QgsWmsParameter::SCALE, QMetaType::Type::Double, QVariant( -1 ) );
344 save( pScale );
345
346 const QgsWmsParameter pHeight( QgsWmsParameter::HEIGHT, QMetaType::Type::Int, QVariant( 0 ) );
347 save( pHeight );
348
349 const QgsWmsParameter pWidth( QgsWmsParameter::WIDTH, QMetaType::Type::Int, QVariant( 0 ) );
350 save( pWidth );
351
352 const QgsWmsParameter pSrcHeight( QgsWmsParameter::SRCHEIGHT, QMetaType::Type::Int, QVariant( 0 ) );
353 save( pSrcHeight );
354
355 const QgsWmsParameter pSrcWidth( QgsWmsParameter::SRCWIDTH, QMetaType::Type::Int, QVariant( 0 ) );
356 save( pSrcWidth );
357
359 save( pBbox );
360
362 save( pSld );
363
365 save( pSldBody );
366
368 save( pLayer );
369
371 save( pLayers );
372
374 save( pQueryLayers );
375
376 const QgsWmsParameter pFeatureCount( QgsWmsParameter::FEATURE_COUNT, QMetaType::Type::Int, QVariant( 1 ) );
377 save( pFeatureCount );
378
379 const QgsWmsParameter pLayerTitle( QgsWmsParameter::LAYERTITLE, QMetaType::Type::Bool, QVariant( true ) );
380 save( pLayerTitle );
381
383 save( pLayerFtFamily );
384
385 const QgsWmsParameter pLayerFtBold( QgsWmsParameter::LAYERFONTBOLD, QMetaType::Type::Bool, QVariant( false ) );
386 save( pLayerFtBold );
387
388 const QgsWmsParameter pLayerFtItalic( QgsWmsParameter::LAYERFONTITALIC, QMetaType::Type::Bool, QVariant( false ) );
389 save( pLayerFtItalic );
390
391 const QgsWmsParameter pLayerFtSize( QgsWmsParameter::LAYERFONTSIZE, QMetaType::Type::Double, QVariant( -1 ) );
392 save( pLayerFtSize );
393
394 const QgsWmsParameter pLayerFtColor( QgsWmsParameter::LAYERFONTCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
395 save( pLayerFtColor );
396
398 save( pStyle );
399
401 save( pStyles );
402
404 save( pOpacities );
405
407 save( pFilter );
408
410 save( pFilterGeom );
411
412 const QgsWmsParameter pPolygTol( QgsWmsParameter::FI_POLYGON_TOLERANCE, QMetaType::Type::Double, QVariant( 0.0 ) );
413 save( pPolygTol );
414
415 const QgsWmsParameter pLineTol( QgsWmsParameter::FI_LINE_TOLERANCE, QMetaType::Type::Double, QVariant( 0.0 ) );
416 save( pLineTol );
417
418 const QgsWmsParameter pPointTol( QgsWmsParameter::FI_POINT_TOLERANCE, QMetaType::Type::Double, QVariant( 0.0 ) );
419 save( pPointTol );
420
422 save( pSelection );
423
424 const QgsWmsParameter pWmsPrecision( QgsWmsParameter::WMS_PRECISION, QMetaType::Type::Int, QVariant( -1 ) );
425 save( pWmsPrecision );
426
427 const QgsWmsParameter pTransparent( QgsWmsParameter::TRANSPARENT, QMetaType::Type::Bool, QVariant( false ) );
428 save( pTransparent );
429
430 const QgsWmsParameter pBgColor( QgsWmsParameter::BGCOLOR, QMetaType::Type::QString, QVariant( "white" ) );
431 save( pBgColor );
432
433 const QgsWmsParameter pDpi( QgsWmsParameter::DPI, QMetaType::Type::Int, QVariant( -1 ) );
434 save( pDpi );
435
437 save( pTemplate );
438
440 save( pExtent );
441
442 const QgsWmsParameter pRotation( QgsWmsParameter::ROTATION, QMetaType::Type::Double, QVariant( 0.0 ) );
443 save( pRotation );
444
445 const QgsWmsParameter pGridX( QgsWmsParameter::GRID_INTERVAL_X, QMetaType::Type::Double, QVariant( 0.0 ) );
446 save( pGridX );
447
448 const QgsWmsParameter pGridY( QgsWmsParameter::GRID_INTERVAL_Y, QMetaType::Type::Double, QVariant( 0.0 ) );
449 save( pGridY );
450
451 const QgsWmsParameter pWithGeometry( QgsWmsParameter::WITH_GEOMETRY, QMetaType::Type::Bool, QVariant( false ) );
452 save( pWithGeometry );
453
454 const QgsWmsParameter pWithMapTip( QgsWmsParameter::WITH_MAPTIP, QMetaType::Type::QString );
455 save( pWithMapTip );
456
457 const QgsWmsParameter pWithDisplayName( QgsWmsParameter::WITH_DISPLAY_NAME, QMetaType::Type::Bool, QVariant( false ) );
458 save( pWithDisplayName );
459
461 save( pWmtver );
462
463 const QgsWmsParameter pAtlasPk( QgsWmsParameter::ATLAS_PK, QMetaType::Type::QStringList );
464 save( pAtlasPk );
465
466 const QgsWmsParameter pFormatOpts( QgsWmsParameter::FORMAT_OPTIONS, QMetaType::Type::QString );
467 save( pFormatOpts );
468
469 const QgsWmsParameter pAddLayerGroups( QgsWmsParameter::ADDLAYERGROUPS, QMetaType::Type::Bool, QVariant( false ) );
470 save( pAddLayerGroups );
471 }
472
475 {
476 load( parameters.urlQuery() );
477
478 auto it = mWmsParameters.constFind( QgsWmsParameter::SLD );
479 if ( it != mWmsParameters.constEnd() && !it->toString().isEmpty() )
480 {
481 const QString sldBody = it->loadUrl();
482 if ( !sldBody.isEmpty() )
483 {
485 }
486 }
487 }
488
490 {
491 return mWmsParameters.value( name );
492 }
493
495 {
496 auto it = mWmsParameters.find( name );
497 if ( it == mWmsParameters.end() )
498 {
499 it = mWmsParameters.insert( name, QgsWmsParameter() );
500 }
501
502 it->mValue = value;
503 }
504
505 bool QgsWmsParameters::loadParameter( const QString &key, const QString &value )
506 {
507 bool loaded = false;
508
509 const thread_local QRegularExpression composerParamRegExp( QStringLiteral( "^MAP\\d+:" ), QRegularExpression::CaseInsensitiveOption );
510 if ( key.contains( composerParamRegExp ) )
511 {
512 const int mapId = QStringView { key }.mid( 3, key.indexOf( ':' ) - 3 ).toInt();
513 const QString theKey = key.mid( key.indexOf( ':' ) + 1 );
514 const QgsWmsParameter::Name name = QgsWmsParameter::name( theKey );
515
516 if ( name >= 0 )
517 {
518 QgsWmsParameter param = mWmsParameters.value( name );
519 param.mValue = value;
520 param.mMapId = mapId;
521
522 if ( !param.isValid() )
523 {
524 param.raiseError();
525 }
526
527 save( param, true ); // multi MAP parameters for composer
528 loaded = true;
529 }
530 }
531 else
532 {
534 if ( name >= 0 )
535 {
536 auto it = mWmsParameters.find( name );
537 if ( it == mWmsParameters.end() )
538 it = mWmsParameters.insert( name, QgsWmsParameter() );
539
540 it->mValue = value;
541 if ( !it->isValid() )
542 {
543 it->raiseError();
544 }
545
546 loaded = true;
547 }
548 else //maybe an external wms parameter?
549 {
550 int separator = key.indexOf( QLatin1Char( ':' ) );
551 if ( separator >= 1 )
552 {
553 QString id = key.left( separator );
554 QString param = key.right( key.length() - separator - 1 );
555 mExternalWMSParameters[id].insert( param, value );
556
557 loaded = true;
558 }
559 }
560 }
561
562 return loaded;
563 }
564
566 {
567 log( QStringLiteral( "WMS Request parameters:" ) );
568 for ( auto it = mWmsParameters.constBegin(); it != mWmsParameters.constEnd(); ++it )
569 {
570 const QString value = it->toString();
571
572 if ( !value.isEmpty() )
573 {
574 QString name = QgsWmsParameter::name( it.key() );
575
576 if ( it->mMapId >= 0 )
577 {
578 name = QStringLiteral( "%1:%2" ).arg( QString::number( it->mMapId ), name );
579 }
580
581 log( QStringLiteral( " - %1 : %2" ).arg( name, value ) );
582 }
583 }
584
585 if ( !version().isEmpty() )
586 log( QStringLiteral( " - VERSION : %1" ).arg( version() ) );
587 }
588
589 void QgsWmsParameters::save( const QgsWmsParameter &parameter, bool multi )
590 {
591 if ( multi )
592 {
593 mWmsParameters.insert( parameter.mName, parameter );
594 }
595 else
596 {
597 mWmsParameters.replace( parameter.mName, parameter );
598 }
599 }
600
602 {
603 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_GEOM ).toStringList( ';' );
604 }
605
606 QList<QgsGeometry> QgsWmsParameters::highlightGeomAsGeom() const
607 {
608 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_GEOM ).toGeomList( ';' );
609 }
610
612 {
613 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_SYMBOL ).toStringList( ';' );
614 }
615
616 QString QgsWmsParameters::crs() const
617 {
618 QString rs;
619 const QString srs = mWmsParameters.value( QgsWmsParameter::SRS ).toString();
620 const QString crs = mWmsParameters.value( QgsWmsParameter::CRS ).toString();
621
622 // both SRS/CRS are supported but there's a priority according to the
623 // specified version when both are defined in the request
624 if ( !srs.isEmpty() && crs.isEmpty() )
625 rs = srs;
626 else if ( srs.isEmpty() && !crs.isEmpty() )
627 rs = crs;
628 else if ( !srs.isEmpty() && !crs.isEmpty() )
629 {
630 if ( versionAsNumber() >= QgsProjectVersion( 1, 3, 0 ) )
631 rs = crs;
632 else
633 rs = srs;
634 }
635
636 return rs;
637 }
638
640 {
641 return mWmsParameters.value( QgsWmsParameter::BBOX ).toString();
642 }
643
645 {
646 return mWmsParameters.value( QgsWmsParameter::BBOX ).toRectangle();
647 }
648
650 {
651 return mWmsParameters.value( QgsWmsParameter::HEIGHT ).toString();
652 }
653
655 {
656 return mWmsParameters.value( QgsWmsParameter::WIDTH ).toString();
657 }
658
660 {
661 return mWmsParameters.value( QgsWmsParameter::HEIGHT ).toInt();
662 }
663
665 {
666 return mWmsParameters.value( QgsWmsParameter::WIDTH ).toInt();
667 }
668
670 {
671 return mWmsParameters.value( QgsWmsParameter::SRCHEIGHT ).toString();
672 }
673
675 {
676 return mWmsParameters.value( QgsWmsParameter::SRCWIDTH ).toString();
677 }
678
680 {
681 return mWmsParameters.value( QgsWmsParameter::SRCHEIGHT ).toInt();
682 }
683
685 {
686 return mWmsParameters.value( QgsWmsParameter::SRCWIDTH ).toInt();
687 }
688
689 QString QgsWmsParameters::dpi() const
690 {
691 return mWmsParameters.value( QgsWmsParameter::DPI ).toString();
692 }
693
695 {
696 return mWmsParameters.value( QgsWmsParameter::DPI ).toDouble();
697 }
698
700 {
702
703 if ( QgsServerParameters::request().compare( QLatin1String( "GetProjectSettings" ), Qt::CaseInsensitive ) == 0 )
704 {
705 version = QStringLiteral( "1.3.0" );
706 }
707 else if ( version.isEmpty() )
708 {
709 if ( !wmtver().isEmpty() )
710 {
711 version = wmtver();
712 }
713 else
714 {
715 version = QStringLiteral( "1.3.0" );
716 }
717 }
718 else if ( !mVersions.contains( QgsProjectVersion( version ) ) )
719 {
720 // WMS 1.3.0 specification: If a version lower than any of those
721 // known to the server is requested, then the server shall send the
722 // lowest version it supports.
723 if ( QgsProjectVersion( 1, 1, 1 ) > QgsProjectVersion( version ) )
724 {
725 version = QStringLiteral( "1.1.1" );
726 }
727 else
728 {
729 version = QStringLiteral( "1.3.0" );
730 }
731 }
732
733 return version;
734 }
735
737 {
738 QString req = QgsServerParameters::request();
739
740 if ( version().compare( QLatin1String( "1.1.1" ) ) == 0
741 && req.compare( QLatin1String( "capabilities" ), Qt::CaseInsensitive ) == 0 )
742 {
743 req = QStringLiteral( "GetCapabilities" );
744 }
745
746 return req;
747 }
748
753
754 bool QgsWmsParameters::versionIsValid( const QString version ) const
755 {
756 return mVersions.contains( QgsProjectVersion( version ) );
757 }
758
760 {
761 return mWmsParameters.value( QgsWmsParameter::FORMAT ).toString( true );
762 }
763
765 {
766 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameters::Format>() );
767 return metaEnum.valueToKey( format );
768 }
769
771 {
772 const QString fStr = formatAsString();
773
775 if ( fStr.compare( QLatin1String( "image/png" ), Qt::CaseInsensitive ) == 0 || fStr.compare( QLatin1String( "png" ), Qt::CaseInsensitive ) == 0 )
776 {
777 f = Format::PNG;
778 }
779 else if ( fStr.compare( QLatin1String( "jpg" ), Qt::CaseInsensitive ) == 0
780 || fStr.compare( QLatin1String( "jpeg" ), Qt::CaseInsensitive ) == 0
781 || fStr.compare( QLatin1String( "image/jpeg" ), Qt::CaseInsensitive ) == 0 )
782 {
783 f = Format::JPG;
784 }
785 else if ( fStr.compare( QLatin1String( "image/svg" ), Qt::CaseInsensitive ) == 0 || fStr.compare( QLatin1String( "image/svg+xml" ), Qt::CaseInsensitive ) == 0 || fStr.compare( QLatin1String( "svg" ), Qt::CaseInsensitive ) == 0 )
786 {
787 f = Format::SVG;
788 }
789 else if ( fStr.compare( QLatin1String( "application/pdf" ), Qt::CaseInsensitive ) == 0 || fStr.compare( QLatin1String( "pdf" ), Qt::CaseInsensitive ) == 0 )
790 {
791 f = Format::PDF;
792 }
793 else if ( fStr.compare( QLatin1String( "application/json" ), Qt::CaseInsensitive ) == 0 || fStr.compare( QLatin1String( "json" ), Qt::CaseInsensitive ) == 0 )
794 {
795 f = Format::JSON;
796 }
797 return f;
798 }
799
801 {
802 return mWmsParameters.value( QgsWmsParameter::INFO_FORMAT ).toString();
803 }
804
806 {
807 return infoFormat() == Format::PNG || infoFormat() == Format::JPG;
808 }
809
811 {
812 QString fStr = infoFormatAsString();
813
815 if ( fStr.isEmpty() )
816 return f;
817
818 if ( fStr.startsWith( QLatin1String( "text/xml" ), Qt::CaseInsensitive ) )
819 f = Format::XML;
820 else if ( fStr.startsWith( QLatin1String( "text/html" ), Qt::CaseInsensitive ) )
821 f = Format::HTML;
822 else if ( fStr.startsWith( QLatin1String( "text/plain" ), Qt::CaseInsensitive ) )
823 f = Format::TEXT;
824 else if ( fStr.startsWith( QLatin1String( "application/vnd.ogc.gml" ), Qt::CaseInsensitive ) )
825 f = Format::GML;
826 else if ( fStr.startsWith( QLatin1String( "application/json" ), Qt::CaseInsensitive )
827 || fStr.startsWith( QLatin1String( "application/geo+json" ), Qt::CaseInsensitive ) )
828 f = Format::JSON;
829 else
830 f = Format::NONE;
831
832 return f;
833 }
834
836 {
837 if ( infoFormat() != Format::GML )
838 return -1;
839
840 QString fStr = infoFormatAsString();
841 if ( fStr.startsWith( QLatin1String( "application/vnd.ogc.gml/3" ), Qt::CaseInsensitive ) )
842 return 3;
843 else
844 return 2;
845 }
846
847 QString QgsWmsParameters::i() const
848 {
849 return mWmsParameters.value( QgsWmsParameter::I ).toString();
850 }
851
852 QString QgsWmsParameters::j() const
853 {
854 return mWmsParameters.value( QgsWmsParameter::J ).toString();
855 }
856
858 {
859 return mWmsParameters.value( QgsWmsParameter::I ).toInt();
860 }
861
863 {
864 return mWmsParameters.value( QgsWmsParameter::J ).toInt();
865 }
866
867 QString QgsWmsParameters::x() const
868 {
869 return mWmsParameters.value( QgsWmsParameter::X ).toString();
870 }
871
872 QString QgsWmsParameters::y() const
873 {
874 return mWmsParameters.value( QgsWmsParameter::Y ).toString();
875 }
876
878 {
879 return mWmsParameters.value( QgsWmsParameter::X ).toInt();
880 }
881
883 {
884 return mWmsParameters.value( QgsWmsParameter::Y ).toInt();
885 }
886
888 {
889 return mWmsParameters.value( QgsWmsParameter::RULE ).toString();
890 }
891
893 {
894 return mWmsParameters.value( QgsWmsParameter::SHOWRULEDETAILS ).toBool();
895 }
896
898 {
899 return mWmsParameters.value( QgsWmsParameter::RULELABEL ).toString();
900 }
901
903 {
904 return mWmsParameters.value( QgsWmsParameter::RULELABEL ).toBool();
905 }
906
908 {
909 return mWmsParameters.value( QgsWmsParameter::TRANSPARENT ).toString();
910 }
911
913 {
914 return mWmsParameters.value( QgsWmsParameter::TRANSPARENT ).toBool();
915 }
916
918 {
919 return mWmsParameters.value( QgsWmsParameter::SCALE ).toString();
920 }
921
923 {
924 return mWmsParameters.value( QgsWmsParameter::SCALE ).toDouble();
925 }
926
928 {
929 return mWmsParameters.value( QgsWmsParameter::IMAGE_QUALITY ).toString();
930 }
931
933 {
934 return mWmsParameters.value( QgsWmsParameter::IMAGE_QUALITY ).toInt();
935 }
936
938 {
939 return mWmsParameters.value( QgsWmsParameter::TILED ).toString();
940 }
941
943 {
944 return mWmsParameters.value( QgsWmsParameter::TILED ).toBool();
945 }
946
948 {
949 return mWmsParameters.value( QgsWmsParameter::ADDLAYERGROUPS ).toBool();
950 }
951
953 {
954 return mWmsParameters.value( QgsWmsParameter::SHOWFEATURECOUNT ).toString();
955 }
956
958 {
959 return mWmsParameters.value( QgsWmsParameter::SHOWFEATURECOUNT ).toBool();
960 }
961
963 {
964 return mWmsParameters.value( QgsWmsParameter::FEATURE_COUNT ).toString();
965 }
966
968 {
969 return mWmsParameters.value( QgsWmsParameter::FEATURE_COUNT ).toInt();
970 }
971
973 {
974 return mWmsParameters.value( QgsWmsParameter::BOXSPACE ).toString();
975 }
976
978 {
979 return mWmsParameters.value( QgsWmsParameter::BOXSPACE ).toDouble();
980 }
981
983 {
984 return mWmsParameters.value( QgsWmsParameter::LAYERSPACE ).toString();
985 }
986
988 {
989 return mWmsParameters.value( QgsWmsParameter::LAYERSPACE ).toDouble();
990 }
991
993 {
994 return mWmsParameters.value( QgsWmsParameter::LAYERTITLESPACE ).toString();
995 }
996
998 {
999 return mWmsParameters.value( QgsWmsParameter::LAYERTITLESPACE ).toDouble();
1000 }
1001
1003 {
1004 return mWmsParameters.value( QgsWmsParameter::SYMBOLSPACE ).toString();
1005 }
1006
1008 {
1009 return mWmsParameters.value( QgsWmsParameter::SYMBOLSPACE ).toDouble();
1010 }
1011
1013 {
1014 return mWmsParameters.value( QgsWmsParameter::SYMBOLHEIGHT ).toString();
1015 }
1016
1018 {
1019 return mWmsParameters.value( QgsWmsParameter::SYMBOLHEIGHT ).toDouble();
1020 }
1021
1023 {
1024 return mWmsParameters.value( QgsWmsParameter::SYMBOLWIDTH ).toString();
1025 }
1026
1028 {
1029 return mWmsParameters.value( QgsWmsParameter::SYMBOLWIDTH ).toDouble();
1030 }
1031
1033 {
1034 return mWmsParameters.value( QgsWmsParameter::ICONLABELSPACE ).toString();
1035 }
1036
1038 {
1039 return mWmsParameters.value( QgsWmsParameter::ICONLABELSPACE ).toDouble();
1040 }
1041
1043 {
1044 return mWmsParameters.value( QgsWmsParameter::LAYERFONTFAMILY ).toString();
1045 }
1046
1048 {
1049 return mWmsParameters.value( QgsWmsParameter::ITEMFONTFAMILY ).toString();
1050 }
1051
1053 {
1054 return mWmsParameters.value( QgsWmsParameter::LAYERFONTBOLD ).toString();
1055 }
1056
1058 {
1059 return mWmsParameters.value( QgsWmsParameter::LAYERFONTBOLD ).toBool();
1060 }
1061
1063 {
1064 return mWmsParameters.value( QgsWmsParameter::ITEMFONTBOLD ).toString();
1065 }
1066
1068 {
1069 return mWmsParameters.value( QgsWmsParameter::FI_POLYGON_TOLERANCE ).toString();
1070 }
1071
1073 {
1074 return mWmsParameters.value( QgsWmsParameter::FI_LINE_TOLERANCE ).toString();
1075 }
1076
1078 {
1079 return mWmsParameters.value( QgsWmsParameter::FI_POINT_TOLERANCE ).toString();
1080 }
1081
1083 {
1084 return mWmsParameters.value( QgsWmsParameter::FI_POLYGON_TOLERANCE ).toInt();
1085 }
1086
1088 {
1089 return mWmsParameters.value( QgsWmsParameter::FI_LINE_TOLERANCE ).toInt();
1090 }
1091
1093 {
1094 return mWmsParameters.value( QgsWmsParameter::FI_POINT_TOLERANCE ).toInt();
1095 }
1096
1098 {
1099 return mWmsParameters.value( QgsWmsParameter::ITEMFONTBOLD ).toBool();
1100 }
1101
1103 {
1104 return mWmsParameters.value( QgsWmsParameter::LAYERFONTITALIC ).toString();
1105 }
1106
1108 {
1109 return mWmsParameters.value( QgsWmsParameter::LAYERFONTITALIC ).toBool();
1110 }
1111
1113 {
1114 return mWmsParameters.value( QgsWmsParameter::ITEMFONTITALIC ).toString();
1115 }
1116
1118 {
1119 return mWmsParameters.value( QgsWmsParameter::ITEMFONTITALIC ).toBool();
1120 }
1121
1123 {
1124 return mWmsParameters.value( QgsWmsParameter::LAYERFONTSIZE ).toString();
1125 }
1126
1128 {
1129 return mWmsParameters.value( QgsWmsParameter::LAYERFONTSIZE ).toDouble();
1130 }
1131
1133 {
1134 return mWmsParameters.value( QgsWmsParameter::LAYERFONTCOLOR ).toString();
1135 }
1136
1138 {
1139 return mWmsParameters.value( QgsWmsParameter::LAYERFONTCOLOR ).toColor();
1140 }
1141
1143 {
1144 return mWmsParameters.value( QgsWmsParameter::ITEMFONTSIZE ).toString();
1145 }
1146
1148 {
1149 return mWmsParameters.value( QgsWmsParameter::ITEMFONTSIZE ).toDouble();
1150 }
1151
1153 {
1154 return mWmsParameters.value( QgsWmsParameter::ITEMFONTCOLOR ).toString();
1155 }
1156
1158 {
1159 return mWmsParameters.value( QgsWmsParameter::ITEMFONTCOLOR ).toColor();
1160 }
1161
1163 {
1164 QFont font;
1165 font.fromString( "" );
1166 font.setBold( layerFontBoldAsBool() );
1167 font.setItalic( layerFontItalicAsBool() );
1168
1169 if ( !layerFontSize().isEmpty() )
1170 font.setPointSizeF( layerFontSizeAsDouble() );
1171
1172 if ( !layerFontFamily().isEmpty() )
1174
1175 return font;
1176 }
1177
1179 {
1180 QFont font;
1181 font.fromString( "" );
1182
1183 font.setBold( itemFontBoldAsBool() );
1184 font.setItalic( itemFontItalicAsBool() );
1185
1186 if ( !itemFontSize().isEmpty() )
1187 font.setPointSizeF( itemFontSizeAsDouble() );
1188
1189 if ( !itemFontFamily().isEmpty() )
1191
1192 return font;
1193 }
1194
1196 {
1197 return mWmsParameters.value( QgsWmsParameter::LAYERTITLE ).toString();
1198 }
1199
1201 {
1202 return mWmsParameters.value( QgsWmsParameter::LAYERTITLE ).toBool();
1203 }
1204
1206 {
1207 QgsLegendSettings settings;
1208 settings.setTitle( QString() );
1209 settings.setBoxSpace( boxSpaceAsDouble() );
1210 settings.setSymbolSize( QSizeF( symbolWidthAsDouble(), symbolHeightAsDouble() ) );
1211
1214
1215 // text format must be set before setting the format's colors
1218
1219 if ( !itemFontColor().isEmpty() )
1220 {
1225 }
1226
1227 // Ok, this is tricky: because QgsLegendSettings's layerFontColor was added to the API after
1228 // fontColor, to fix regressions #21871 and #21870 and the previous behavior was to use fontColor
1229 // for the whole legend we need to preserve that behavior.
1230 // But, the 2.18 server parameters ITEMFONTCOLOR did not have effect on the layer titles too, so
1231 // we set explicitly layerFontColor to black if it's not overridden by LAYERFONTCOLOR argument.
1232 settings.rstyle( Qgis::LegendComponent::Group ).textFormat().setColor( layerFontColor().isEmpty() ? QColor( Qt::black ) : layerFontColorAsColor() );
1233 settings.rstyle( Qgis::LegendComponent::Subgroup ).textFormat().setColor( layerFontColor().isEmpty() ? QColor( Qt::black ) : layerFontColorAsColor() );
1234
1237
1238 // When processing a request involving an upstream WMS server, any responses from such a remote
1239 // server must be awaited. This was not the case for GetLegendGraphic requests (#42063). If not,
1240 // the response to the current request will never contain any data from upstream.
1241 // A quick way to fix this is to force upstream `GetLegendRequest' requests to be synchronous.
1242 // The problem with this approach is that if the GetLegendGraphic contains multiple layers, the
1243 // remote calls are made one at a time. This increases the response time. Making concurrent
1244 // asynchronous requests and waiting for them all would be a better approach.
1245 settings.setSynchronousLegendRequests( true );
1246
1247 return settings;
1248 }
1249
1250 QString QgsWmsParameters::layoutParameter( const QString &id, bool &ok ) const
1251 {
1252 QString label;
1253 ok = false;
1254
1255 if ( mUnmanagedParameters.contains( id.toUpper() ) )
1256 {
1257 label = mUnmanagedParameters[id.toUpper()];
1258 ok = true;
1259 }
1260
1261 return label;
1262 }
1263
1264 QStringList QgsWmsParameters::atlasPk() const
1265 {
1266 return mWmsParameters.value( QgsWmsParameter::ATLAS_PK ).toStringList();
1267 }
1268
1270 {
1271 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSTRING ).toStringList( ';', false );
1272 }
1273
1275 {
1276 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toStringList( ';', false );
1277 }
1278
1280 {
1281 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toIntList( ';', false );
1282 }
1283
1285 {
1286 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toStringList( ';', false );
1287 }
1288
1290 {
1291 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toColorList( ';', false );
1292 }
1293
1295 {
1296 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toStringList( ';', false );
1297 }
1298
1300 {
1301 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toIntList( ';', false );
1302 }
1303
1305 {
1306 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFONT ).toStringList( ';', false );
1307 }
1308
1310 {
1311 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toStringList( ';', false );
1312 }
1313
1315 {
1316 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toColorList( ';', false );
1317 }
1318
1320 {
1321 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toStringList( ';', false );
1322 }
1323
1325 {
1326 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toDoubleList( ';', false );
1327 }
1328
1330 {
1331 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION ).toDoubleList( ';', false );
1332 }
1333
1335 {
1336 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE ).toDoubleList( ';', false );
1337 }
1338
1340 {
1341 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT ).toStringList( ';', false );
1342 }
1343
1345 {
1346 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT ).toStringList( ';', false );
1347 }
1348
1350 {
1351 return mWmsParameters.value( QgsWmsParameter::WMS_PRECISION ).toString();
1352 }
1353
1355 {
1356 return mWmsParameters.value( QgsWmsParameter::WMS_PRECISION ).toInt();
1357 }
1358
1360 {
1361 return mWmsParameters.value( QgsWmsParameter::SLD_BODY ).toString();
1362 }
1363
1364 QStringList QgsWmsParameters::filters() const
1365 {
1366 QStringList filters = mWmsParameters.value( QgsWmsParameter::FILTER ).toOgcFilterList();
1367 if ( filters.isEmpty() )
1368 filters = mWmsParameters.value( QgsWmsParameter::FILTER ).toExpressionList();
1369 return filters;
1370 }
1371
1373 {
1374 return mWmsParameters.value( QgsWmsParameter::FILTER_GEOM ).toString();
1375 }
1376
1378 {
1379 return mWmsParameters.value( QgsWmsParameter::SELECTION ).toStringList( ';' );
1380 }
1381
1383 {
1384 return mWmsParameters.value( QgsWmsParameter::OPACITIES ).toStringList();
1385 }
1386
1388 {
1389 return mWmsParameters.value( QgsWmsParameter::OPACITIES ).toIntList();
1390 }
1391
1393 {
1394 // We don't want duplicates but order does matter, so no QSet
1395 QStringList result;
1396
1397 // LAYER
1398 QList<QgsWmsParameter> cLayer { mWmsParameters.values( QgsWmsParameter::LAYER ) };
1399 // Sort by map id
1400 std::sort( cLayer.begin(), cLayer.end(), []( const QgsWmsParameter &a, const QgsWmsParameter &b ) -> bool { return a.mMapId < b.mMapId; } );
1401 for ( const QgsWmsParameter &param : std::as_const( cLayer ) )
1402 {
1403 const QStringList layersList { param.toStringList() };
1404 for ( const QString &layerName : std::as_const( layersList ) )
1405 {
1406 if ( !result.contains( layerName ) )
1407 result.append( layerName );
1408 }
1409 }
1410
1411 // LAYERS
1412 QList<QgsWmsParameter> cLayers { mWmsParameters.values( QgsWmsParameter::LAYERS ) };
1413 // Sort by map id
1414 std::sort( cLayers.begin(), cLayers.end(), []( const QgsWmsParameter &a, const QgsWmsParameter &b ) -> bool { return a.mMapId < b.mMapId; } );
1415 for ( const QgsWmsParameter &param : std::as_const( cLayers ) )
1416 {
1417 const QStringList layersList { param.toStringList() };
1418 for ( const QString &layerName : std::as_const( layersList ) )
1419 {
1420 if ( !result.contains( layerName ) )
1421 result.append( layerName );
1422 }
1423 }
1424 return result;
1425 }
1426
1428 {
1429 return mWmsParameters.value( QgsWmsParameter::QUERY_LAYERS ).toStringList();
1430 }
1431
1433 {
1434 QStringList style = mWmsParameters.value( QgsWmsParameter::STYLE ).toStyleList();
1435 const QStringList styles = mWmsParameters.value( QgsWmsParameter::STYLES ).toStyleList();
1436 return style << styles;
1437 }
1438
1439 QMultiMap<QString, QgsWmsParametersFilter> QgsWmsParameters::layerFilters( const QStringList &layers ) const
1440 {
1441 const QString nsWfs2 = QStringLiteral( "http://www.opengis.net/fes/2.0" );
1442 const QString prefixWfs2 = QStringLiteral( "<fes:" );
1443
1444 const QStringList rawFilters = filters();
1445 QMultiMap<QString, QgsWmsParametersFilter> filters;
1446 for ( int i = 0; i < rawFilters.size(); i++ )
1447 {
1448 const QString f = rawFilters[i];
1449 if ( f.startsWith( QLatin1Char( '<' ) )
1450 && f.endsWith( QLatin1String( "Filter>" ) )
1451 && i < layers.size() )
1452 {
1454 filter.mFilter = f;
1457
1458 if ( filter.mFilter.contains( nsWfs2 )
1459 || filter.mFilter.contains( prefixWfs2 ) )
1460 {
1462 }
1463
1464 filters.insert( layers[i], filter );
1465 }
1466 else if ( !f.isEmpty() )
1467 {
1468 // filter format: "LayerName,LayerName2:filterString;LayerName3:filterString2;..."
1469 // several filters can be defined for one layer
1470 const int colonIndex = f.indexOf( ':' );
1471 if ( colonIndex != -1 )
1472 {
1473 const QString layers = f.section( ':', 0, 0 );
1474 const QString filter = f.section( ':', 1 );
1475 const QStringList layersList = layers.split( ',' );
1476 for ( const QString &layer : layersList )
1477 {
1478 QgsWmsParametersFilter parametersFilter;
1479 parametersFilter.mFilter = filter;
1480 parametersFilter.mType = QgsWmsParametersFilter::SQL;
1481 filters.insert( layer, parametersFilter );
1482 }
1483 }
1484 else
1485 {
1486 QString filterStr = mWmsParameters.value( QgsWmsParameter::FILTER ).toString();
1487 raiseError( QStringLiteral( "FILTER ('" ) + filterStr + QStringLiteral( "') is not properly formatted" ) );
1488 }
1489 }
1490 }
1491 return filters;
1492 }
1493
1495 {
1496 bool force2D = false;
1497 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1498
1499 if ( options.contains( DxfFormatOption::FORCE_2D ) )
1500 {
1501 force2D = QVariant( options[DxfFormatOption::FORCE_2D] ).toBool();
1502 }
1503
1504 return force2D;
1505 }
1506
1508 {
1509 bool zeroWidth = false;
1510 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1511
1512 if ( options.contains( DxfFormatOption::EXPORT_LINES_WITH_ZERO_WIDTH ) )
1513 {
1514 zeroWidth = QVariant( options[DxfFormatOption::EXPORT_LINES_WITH_ZERO_WIDTH] ).toBool();
1515 }
1516
1517 return zeroWidth;
1518 }
1519
1521 {
1522 bool noMText = false;
1523 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1524
1525 if ( options.contains( DxfFormatOption::NO_MTEXT ) )
1526 {
1527 noMText = QVariant( options[DxfFormatOption::NO_MTEXT] ).toBool();
1528 }
1529
1530 return noMText;
1531 }
1532
1533
1534 QList<QgsWmsParametersLayer> QgsWmsParameters::layersParameters() const
1535 {
1536 const QStringList layers = allLayersNickname();
1537 const QStringList styles = allStyles();
1538 const QStringList selection = selections();
1539 const QList<int> opacities = opacitiesAsInt();
1540 const QMultiMap<QString, QgsWmsParametersFilter> filters = layerFilters( layers );
1541
1542 // selection format: "LayerName:id0,id1;LayerName2:id0,id1;..."
1543 // several filters can be defined for one layer
1544 QMultiMap<QString, QString> layerSelections;
1545 for ( const QString &s : selection )
1546 {
1547 const QStringList splits = s.split( ':' );
1548 if ( splits.size() == 2 )
1549 {
1550 layerSelections.insert( splits[0], splits[1] );
1551 }
1552 else
1553 {
1554 QString selStr = mWmsParameters.value( QgsWmsParameter::SELECTION ).toString();
1555 raiseError( QStringLiteral( "SELECTION ('" ) + selStr + QStringLiteral( "') is not properly formatted" ) );
1556 }
1557 }
1558
1559 QList<QgsWmsParametersLayer> parameters;
1560 for ( int i = 0; i < layers.size(); i++ )
1561 {
1562 QString layer = layers[i];
1563
1565 param.mNickname = layer;
1566
1567 if ( i < opacities.count() )
1568 param.mOpacity = opacities[i];
1569
1570 if ( isExternalLayer( layer ) )
1571 {
1572 const QgsWmsParametersExternalLayer extParam = externalLayerParameter( layer );
1573 param.mNickname = extParam.mName;
1574 param.mExternalUri = extParam.mUri;
1575 }
1576 else
1577 {
1578 if ( i < styles.count() )
1579 param.mStyle = styles[i];
1580
1581 if ( filters.contains( layer ) )
1582 {
1583 auto it = filters.find( layer );
1584 while ( it != filters.end() && it.key() == layer )
1585 {
1586 param.mFilter.append( it.value() );
1587 ++it;
1588 }
1589 }
1590
1591 if ( layerSelections.contains( layer ) )
1592 {
1593 QMultiMap<QString, QString>::const_iterator it;
1594 it = layerSelections.constFind( layer );
1595 while ( it != layerSelections.constEnd() && it.key() == layer )
1596 {
1597 param.mSelection << it.value().split( ',' );
1598 ++it;
1599 }
1600 }
1601 }
1602
1603 parameters.append( param );
1604 }
1605
1606 return parameters;
1607 }
1608
1609 QList<QgsWmsParametersHighlightLayer> QgsWmsParameters::highlightLayersParameters() const
1610 {
1611 QList<QgsWmsParametersHighlightLayer> params;
1612 const QList<QgsGeometry> geoms = highlightGeomAsGeom();
1613 const QStringList slds = highlightSymbol();
1614 const QStringList labels = highlightLabelString();
1615 const QList<QColor> colors = highlightLabelColorAsColor();
1616 const QList<int> sizes = highlightLabelSizeAsInt();
1617 const QList<int> weights = highlightLabelWeightAsInt();
1618 const QStringList fonts = highlightLabelFont();
1619 const QList<QColor> bufferColors = highlightLabelBufferColorAsColor();
1620 const QList<double> bufferSizes = highlightLabelBufferSizeAsFloat();
1621 const QList<double> rotation = highlightLabelRotation();
1622 const QList<double> distance = highlightLabelDistance();
1623 const QStringList hali = highlightLabelHorizontalAlignment();
1624 const QStringList vali = highlightLabelVerticalAlignment();
1625
1626 int nLayers = std::min( geoms.size(), slds.size() );
1627 for ( int i = 0; i < nLayers; i++ )
1628 {
1630 param.mName = QStringLiteral( "highlight_" ) + QString::number( i );
1631 param.mGeom = geoms[i];
1632 param.mSld = slds[i];
1633
1634 if ( i < labels.count() )
1635 param.mLabel = labels[i];
1636
1637 if ( i < colors.count() )
1638 param.mColor = colors[i];
1639
1640 if ( i < sizes.count() )
1641 param.mSize = sizes[i];
1642
1643 if ( i < weights.count() )
1644 param.mWeight = weights[i];
1645
1646 if ( i < fonts.count() )
1647 param.mFont = fonts[i];
1648
1649 if ( i < bufferColors.count() )
1650 param.mBufferColor = bufferColors[i];
1651
1652 if ( i < bufferSizes.count() )
1653 param.mBufferSize = bufferSizes[i];
1654
1655 if ( i < rotation.count() )
1656 param.mLabelRotation = rotation[i];
1657
1658 if ( i < distance.count() )
1659 param.mLabelDistance = distance[i];
1660
1661 if ( i < hali.count() )
1662 param.mHali = hali[i];
1663
1664 if ( i < vali.count() )
1665 param.mVali = vali[i];
1666
1667
1668 params.append( param );
1669 }
1670
1671 return params;
1672 }
1673
1674 QList<QgsWmsParametersExternalLayer> QgsWmsParameters::externalLayersParameters() const
1675 {
1676 auto notExternalLayer = []( const QString &name ) { return !QgsWmsParameters::isExternalLayer( name ); };
1677
1678 QList<QgsWmsParametersExternalLayer> externalLayers;
1679
1680 QStringList layers = allLayersNickname();
1681 QStringList::iterator rit = std::remove_if( layers.begin(), layers.end(), notExternalLayer );
1682
1683 for ( QStringList::iterator it = layers.begin(); it != rit; ++it )
1684 {
1685 externalLayers << externalLayerParameter( *it );
1686 }
1687
1688 return externalLayers;
1689 }
1690
1692 {
1693 return mWmsParameters.value( QgsWmsParameter::BGCOLOR ).toString();
1694 }
1695
1697 {
1698 return mWmsParameters.value( QgsWmsParameter::BGCOLOR ).toColor();
1699 }
1700
1702 {
1703 return mWmsParameters.value( QgsWmsParameter::TEMPLATE ).toString();
1704 }
1705
1707 {
1708 QgsWmsParameter wmsParam;
1710 param.mId = mapId;
1711
1712 QString pMapId = QStringLiteral( "MAP" ) + QString::number( mapId );
1713
1714 wmsParam = idParameter( QgsWmsParameter::EXTENT, mapId );
1715 QgsRectangle extent;
1716 if ( wmsParam.isValid() )
1717 {
1718 extent = wmsParam.toRectangle();
1719 }
1720
1721 param.mHasExtent = !extent.isEmpty();
1722 param.mExtent = extent;
1723
1724 // scale
1725 wmsParam = idParameter( QgsWmsParameter::SCALE, mapId );
1726 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1727 {
1728 param.mScale = wmsParam.toDouble();
1729 }
1730
1731 // rotation
1732 wmsParam = idParameter( QgsWmsParameter::ROTATION, mapId );
1733 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1734 {
1735 param.mRotation = wmsParam.toDouble();
1736 }
1737
1738 //grid space x / y
1739 double gridx( -1 ), gridy( -1 );
1740
1741 wmsParam = idParameter( QgsWmsParameter::GRID_INTERVAL_X, mapId );
1742 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1743 {
1744 gridx = wmsParam.toDouble();
1745 }
1746
1747 wmsParam = idParameter( QgsWmsParameter::GRID_INTERVAL_Y, mapId );
1748 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1749 {
1750 gridy = wmsParam.toDouble();
1751 }
1752
1753 if ( gridx >= 0 && gridy >= 0 )
1754 {
1755 param.mGridX = gridx;
1756 param.mGridY = gridy;
1757 }
1758
1759 //layers
1760 QStringList allLayers;
1761 wmsParam = idParameter( QgsWmsParameter::LAYERS, mapId );
1762 if ( wmsParam.isValid() )
1763 {
1764 allLayers = wmsParam.toStringList();
1765 }
1766
1767 // external layers
1768 QStringList layers;
1769
1770 for ( const auto &layer : std::as_const( allLayers ) )
1771 {
1772 if ( isExternalLayer( layer ) )
1773 {
1774 const QgsWmsParametersExternalLayer extParam = externalLayerParameter( layer );
1775 layers << extParam.mName;
1776 }
1777 else
1778 {
1779 layers << layer;
1780 }
1781 }
1782
1783 QStringList styles;
1784 wmsParam = idParameter( QgsWmsParameter::STYLES, mapId );
1785 if ( wmsParam.isValid() )
1786 {
1787 styles = wmsParam.toStyleList();
1788 }
1789
1790 QList<QgsWmsParametersLayer> lParams;
1791 for ( int i = 0; i < layers.size(); i++ )
1792 {
1793 QString layer = layers[i];
1794 QgsWmsParametersLayer lParam;
1795 lParam.mNickname = layer;
1796
1797 if ( i < styles.count() )
1798 lParam.mStyle = styles[i];
1799
1800 lParams.append( lParam );
1801 }
1802 param.mLayers = lParams;
1803
1804 //highlight layers
1805 QList<QgsWmsParametersHighlightLayer> hParams;
1806
1807 QList<QgsGeometry> geoms;
1808 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_GEOM, mapId );
1809 if ( wmsParam.isValid() )
1810 {
1811 geoms = wmsParam.toGeomList( ';', false );
1812 }
1813
1814 QStringList slds;
1815 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_SYMBOL, mapId );
1816 if ( wmsParam.isValid() )
1817 {
1818 slds = wmsParam.toStringList( ';', false );
1819 }
1820
1821 QStringList labels;
1822 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSTRING, mapId );
1823 if ( wmsParam.isValid() )
1824 {
1825 labels = wmsParam.toStringList( ';', false );
1826 }
1827
1828 QStringList fonts;
1829 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFONT, mapId );
1830 if ( wmsParam.isValid() )
1831 {
1832 fonts = wmsParam.toStringList( ';', false );
1833 }
1834
1835 QList<QColor> colors;
1836 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELCOLOR, mapId );
1837 if ( wmsParam.isValid() )
1838 {
1839 colors = wmsParam.toColorList( ';', false );
1840 }
1841
1842 QList<int> sizes;
1843 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSIZE, mapId );
1844 if ( wmsParam.isValid() )
1845 {
1846 sizes = wmsParam.toIntList( ';', false );
1847 }
1848
1849 QList<int> weights;
1850 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT, mapId );
1851 if ( wmsParam.isValid() )
1852 {
1853 weights = wmsParam.toIntList( ';', false );
1854 }
1855
1856 QList<QColor> bufferColors;
1857 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR, mapId );
1858 if ( wmsParam.isValid() )
1859 {
1860 bufferColors = wmsParam.toColorList( ';', false );
1861 }
1862
1863 QList<double> bufferSizes;
1864 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE, mapId );
1865 if ( wmsParam.isValid() )
1866 {
1867 bufferSizes = wmsParam.toDoubleList( ';', false );
1868 }
1869
1870 QList<double> rotations;
1871 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION, mapId );
1872 if ( wmsParam.isValid() )
1873 {
1874 rotations = wmsParam.toDoubleList( ';', false );
1875 }
1876
1877 QList<double> distances;
1878 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE, mapId );
1879 if ( wmsParam.isValid() )
1880 {
1881 distances = wmsParam.toDoubleList( ';', false );
1882 }
1883
1884 QStringList halis;
1885 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT, mapId );
1886 if ( wmsParam.isValid() )
1887 {
1888 halis = wmsParam.toStringList( ';', false );
1889 }
1890
1891 QStringList valis;
1892 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT, mapId );
1893 if ( wmsParam.isValid() )
1894 {
1895 valis = wmsParam.toStringList( ';', false );
1896 }
1897
1898 int nHLayers = std::min( geoms.size(), slds.size() );
1899 for ( int i = 0; i < nHLayers; i++ )
1900 {
1902 hParam.mName = pMapId + QStringLiteral( "_highlight_" ) + QString::number( i );
1903 hParam.mGeom = geoms[i];
1904 hParam.mSld = slds[i];
1905
1906 if ( i < labels.count() )
1907 hParam.mLabel = labels[i];
1908
1909 if ( i < colors.count() )
1910 hParam.mColor = colors[i];
1911
1912 if ( i < sizes.count() )
1913 hParam.mSize = sizes[i];
1914
1915 if ( i < weights.count() )
1916 hParam.mWeight = weights[i];
1917
1918 if ( i < fonts.count() )
1919 hParam.mFont = fonts[i];
1920
1921 if ( i < bufferColors.count() )
1922 hParam.mBufferColor = bufferColors[i];
1923
1924 if ( i < bufferSizes.count() )
1925 hParam.mBufferSize = bufferSizes[i];
1926
1927 if ( i < rotations.count() )
1928 hParam.mLabelRotation = rotations[i];
1929
1930 if ( i < distances.count() )
1931 hParam.mLabelDistance = distances[i];
1932
1933 if ( i < halis.count() )
1934 hParam.mHali = halis[i];
1935
1936 if ( i < valis.count() )
1937 hParam.mVali = valis[i];
1938
1939 hParams.append( hParam );
1940 }
1941 param.mHighlightLayers = hParams;
1942
1943 return param;
1944 }
1945
1946 QString QgsWmsParameters::externalWMSUri( const QString &layerId ) const
1947 {
1948 // Param names may be uppercased.
1949 QString id { layerId };
1950
1951 for ( auto it = mExternalWMSParameters.cbegin(); it != mExternalWMSParameters.cend(); ++it )
1952 {
1953 if ( it.key().compare( id, Qt::CaseSensitivity::CaseInsensitive ) == 0 )
1954 {
1955 id = it.key();
1956 break;
1957 }
1958 }
1959
1960 if ( !mExternalWMSParameters.contains( id ) )
1961 {
1962 return QString();
1963 }
1964
1965 QgsDataSourceUri wmsUri;
1966 const QMap<QString, QString> &paramMap = mExternalWMSParameters[id];
1967 QMap<QString, QString>::const_iterator paramIt = paramMap.constBegin();
1968 for ( ; paramIt != paramMap.constEnd(); ++paramIt )
1969 {
1970 QString paramName = paramIt.key().toLower();
1971 if ( paramName == QLatin1String( "layers" ) || paramName == QLatin1String( "styles" ) || paramName == QLatin1String( "opacities" ) )
1972 {
1973 const QStringList values = paramIt.value().split( ',' );
1974 for ( const QString &value : values )
1975 wmsUri.setParam( paramName, value );
1976 }
1977 else if ( paramName == QLatin1String( "ignorereportedlayerextents" ) )
1978 {
1979 wmsUri.setParam( QStringLiteral( "IgnoreReportedLayerExtents" ), paramIt.value() );
1980 }
1981 else if ( paramName == QLatin1String( "smoothpixmaptransform" ) )
1982 {
1983 wmsUri.setParam( QStringLiteral( "SmoothPixmapTransform" ), paramIt.value() );
1984 }
1985 else if ( paramName == QLatin1String( "ignoregetmapurl" ) )
1986 {
1987 wmsUri.setParam( QStringLiteral( "IgnoreGetMapUrl" ), paramIt.value() );
1988 }
1989 else if ( paramName == QLatin1String( "ignoregetfeatureinfourl" ) )
1990 {
1991 wmsUri.setParam( QStringLiteral( "IgnoreGetFeatureInfoUrl" ), paramIt.value() );
1992 }
1993 else if ( paramName == QLatin1String( "ignoreaxisorientation" ) )
1994 {
1995 wmsUri.setParam( QStringLiteral( "IgnoreAxisOrientation" ), paramIt.value() );
1996 }
1997 else if ( paramName == QLatin1String( "invertaxisorientation" ) )
1998 {
1999 wmsUri.setParam( QStringLiteral( "InvertAxisOrientation" ), paramIt.value() );
2000 }
2001 else if ( paramName == QLatin1String( "dpimode" ) )
2002 {
2003 wmsUri.setParam( QStringLiteral( "dpiMode" ), paramIt.value() );
2004 }
2005 else if ( paramName == QLatin1String( "stepwidth" ) )
2006 {
2007 wmsUri.setParam( QStringLiteral( "stepWidth" ), paramIt.value() );
2008 }
2009 else if ( paramName == QLatin1String( "stepheight" ) )
2010 {
2011 wmsUri.setParam( QStringLiteral( "stepHeight" ), paramIt.value() );
2012 }
2013 else
2014 {
2015 wmsUri.setParam( paramName, paramIt.value() );
2016 }
2017 }
2018 return wmsUri.encodedUri();
2019 }
2020
2022 {
2023 return mWmsParameters.value( QgsWmsParameter::WITH_GEOMETRY ).toBool();
2024 }
2025
2027 {
2028 return mWmsParameters.value( QgsWmsParameter::WITH_MAPTIP ).toString();
2029 }
2030
2032 {
2033 const QString mStr = withMapTipAsString();
2034
2035 if ( mStr.startsWith( QLatin1String( "true" ), Qt::CaseInsensitive ) || mStr.startsWith( QLatin1String( "on" ), Qt::CaseInsensitive ) || mStr.startsWith( QLatin1String( "yes" ), Qt::CaseInsensitive ) || mStr.startsWith( QLatin1Char( '1' ) ) )
2036 return true;
2037 else
2038 return false;
2039 }
2040
2042 {
2043 const QString mStr = withMapTipAsString();
2044
2045 if ( mStr.startsWith( QLatin1String( "html_fi_only_maptip" ), Qt::CaseInsensitive ) )
2046 return true;
2047 else
2048 return false;
2049 }
2050
2052 {
2053 return mWmsParameters.value( QgsWmsParameter::WITH_DISPLAY_NAME ).toBool();
2054 }
2055
2057 {
2058 return mWmsParameters.value( QgsWmsParameter::WMTVER ).toString();
2059 }
2060
2061 void QgsWmsParameters::log( const QString &msg, const char *file, const char *function, int line ) const
2062 {
2063 QgsMessageLog::logMessage( msg, QStringLiteral( "Server" ), Qgis::MessageLevel::Info, true, file, function, line );
2064 }
2065
2066 void QgsWmsParameters::raiseError( const QString &msg ) const
2067 {
2069 }
2070
2071 QgsWmsParameter QgsWmsParameters::idParameter( const QgsWmsParameter::Name name, const int id ) const
2072 {
2073 QgsWmsParameter p;
2074
2075 for ( const auto &param : mWmsParameters.values( name ) )
2076 {
2077 if ( param.mMapId == id )
2078 {
2079 p = param;
2080 }
2081 }
2082
2083 return p;
2084 }
2085
2086 QgsWmsParametersExternalLayer QgsWmsParameters::externalLayerParameter( const QString &name ) const
2087 {
2088 QgsWmsParametersExternalLayer param;
2089
2090 param.mName = name;
2091 param.mName.remove( 0, EXTERNAL_LAYER_PREFIX.size() );
2092 param.mUri = externalWMSUri( param.mName );
2093
2094 return param;
2095 }
2096
2097 bool QgsWmsParameters::isExternalLayer( const QString &name )
2098 {
2099 return name.startsWith( EXTERNAL_LAYER_PREFIX );
2100 }
2101
2103 {
2104 QStringList attributes;
2105 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2106
2107 if ( options.contains( DxfFormatOption::LAYERATTRIBUTES ) )
2108 {
2109 attributes = options[DxfFormatOption::LAYERATTRIBUTES].split( ',' );
2110 }
2111
2112 return attributes;
2113 }
2114
2116 {
2117 bool use = false;
2118 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2119
2120 if ( options.contains( DxfFormatOption::USE_TITLE_AS_LAYERNAME ) )
2121 {
2122 use = QVariant( options[DxfFormatOption::USE_TITLE_AS_LAYERNAME] ).toBool();
2123 }
2124
2125 return use;
2126 }
2127
2129 {
2130 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2131
2132 double scale = -1;
2133 if ( options.contains( DxfFormatOption::SCALE ) )
2134 {
2135 scale = options[DxfFormatOption::SCALE].toDouble();
2136 }
2137
2138 return scale;
2139 }
2140
2142 {
2143 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2144
2146
2147 if ( !options.contains( DxfFormatOption::MODE ) )
2148 {
2149 return symbol;
2150 }
2151
2152 const QString mode = options[DxfFormatOption::MODE];
2153 if ( mode.compare( QLatin1String( "SymbolLayerSymbology" ), Qt::CaseInsensitive ) == 0 )
2154 {
2156 }
2157 else if ( mode.compare( QLatin1String( "FeatureSymbology" ), Qt::CaseInsensitive ) == 0 )
2158 {
2160 }
2161
2162 return symbol;
2163 }
2164
2166 {
2167 QString codec = QStringLiteral( "ISO-8859-1" );
2168
2170 {
2172 }
2173
2174 return codec;
2175 }
2176
2178 {
2179 bool geospatialPdf = false;
2180 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2181 if ( options.contains( PdfFormatOption::WRITE_GEO_PDF ) )
2182 {
2183 geospatialPdf = QVariant( options[PdfFormatOption::WRITE_GEO_PDF] ).toBool();
2184 }
2185 return geospatialPdf;
2186 }
2187
2189 {
2190 bool forceVector = false;
2191 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2192 if ( options.contains( PdfFormatOption::FORCE_VECTOR_OUTPUT ) )
2193 {
2194 forceVector = QVariant( options[PdfFormatOption::FORCE_VECTOR_OUTPUT] ).toBool();
2195 }
2196 return forceVector;
2197 }
2198
2200 {
2201 bool appendGeoref = true;
2202 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2203 if ( options.contains( PdfFormatOption::APPEND_GEOREFERENCE ) )
2204 {
2205 appendGeoref = QVariant( options[PdfFormatOption::APPEND_GEOREFERENCE] ).toBool();
2206 }
2207 return appendGeoref;
2208 }
2209
2211 {
2212 bool simplify = true;
2213 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2214 if ( options.contains( PdfFormatOption::SIMPLIFY_GEOMETRY ) )
2215 {
2216 simplify = QVariant( options[PdfFormatOption::SIMPLIFY_GEOMETRY] ).toBool();
2217 }
2218 return simplify;
2219 }
2220
2222 {
2223 bool exportMetadata = false;
2224 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2225 if ( options.contains( PdfFormatOption::EXPORT_METADATA ) )
2226 {
2227 exportMetadata = QVariant( options[PdfFormatOption::EXPORT_METADATA] ).toBool();
2228 }
2229 return exportMetadata;
2230 }
2231
2233 {
2235 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2236 if ( options.contains( PdfFormatOption::TEXT_RENDER_FORMAT ) )
2237 {
2238 if ( options[PdfFormatOption::TEXT_RENDER_FORMAT].compare( QStringLiteral( "AlwaysText" ), Qt::CaseInsensitive ) == 0 )
2239 {
2241 }
2242 else if ( options[PdfFormatOption::TEXT_RENDER_FORMAT].compare( QStringLiteral( "PreferText" ), Qt::CaseInsensitive ) == 0 )
2243 {
2245 }
2246 }
2247 return format;
2248 }
2249
2251 {
2252 bool losslessCompression = false;
2253 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2254 if ( options.contains( PdfFormatOption::LOSSLESS_IMAGE_COMPRESSION ) )
2255 {
2256 losslessCompression = QVariant( options[PdfFormatOption::LOSSLESS_IMAGE_COMPRESSION] ).toBool();
2257 }
2258 return losslessCompression;
2259 }
2260
2262 {
2263 bool disableTiledRaster = false;
2264 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2265 if ( options.contains( PdfFormatOption::DISABLE_TILED_RASTER_RENDERING ) )
2266 {
2267 disableTiledRaster = QVariant( options[PdfFormatOption::DISABLE_TILED_RASTER_RENDERING] ).toBool();
2268 }
2269 return disableTiledRaster;
2270 }
2271
2273 {
2274 bool useIso32000 = true;
2275 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2277 {
2278 useIso32000 = QVariant( options[PdfFormatOption::USE_ISO_32000_EXTENSION_FORMAT_GEOREFERENCING] ).toBool();
2279 }
2280 return useIso32000;
2281 }
2282
2284 {
2285 return false;
2286 }
2287
2289 {
2290 QStringList themes;
2291 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2292 if ( options.contains( PdfFormatOption::EXPORT_THEMES ) )
2293 {
2294 themes = options[PdfFormatOption::EXPORT_THEMES].split( ',' );
2295 }
2296 return themes;
2297 }
2298
2300 {
2301 QVector<qreal> scales;
2302 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2303 if ( options.contains( PdfFormatOption::PREDEFINED_MAP_SCALES ) )
2304 {
2305 const QStringList scaleList = options[PdfFormatOption::PREDEFINED_MAP_SCALES].split( ',' );
2306 for ( const QString &it : std::as_const( scaleList ) )
2307 {
2308 bool ok = false;
2309 qreal scale = it.toDouble( &ok );
2310 if ( ok )
2311 {
2312 scales.append( scale );
2313 }
2314 }
2315 }
2316 return scales;
2317 }
2318
2319 QMap<QString, QString> QgsWmsParameters::dimensionValues() const
2320 {
2321 QMap<QString, QString> dimValues;
2322 const QMetaEnum pnMetaEnum( QMetaEnum::fromType<QgsMapLayerServerProperties::PredefinedWmsDimensionName>() );
2323 const QStringList unmanagedNames = mUnmanagedParameters.keys();
2324 for ( const QString &key : unmanagedNames )
2325 {
2326 if ( key.startsWith( QLatin1String( "DIM_" ) ) )
2327 {
2328 dimValues[key.mid( 4 )] = mUnmanagedParameters[key];
2329 }
2330 else if ( pnMetaEnum.keyToValue( key.toUpper().toStdString().c_str() ) != -1 )
2331 {
2332 dimValues[key] = mUnmanagedParameters[key];
2333 }
2334 }
2335 return dimValues;
2336 }
2337} // namespace QgsWms
@ Symbol
Symbol icon (excluding label).
Definition qgis.h:4581
@ Group
Legend group title.
Definition qgis.h:4579
@ Subgroup
Legend subgroup title.
Definition qgis.h:4580
@ Title
Legend title.
Definition qgis.h:4578
@ SymbolLabel
Symbol label (excluding icon).
Definition qgis.h:4582
@ Info
Information message.
Definition qgis.h:157
TextRenderFormat
Options for rendering text.
Definition qgis.h:2826
@ PreferText
Render text as text objects, unless doing so results in rendering artifacts or poor quality rendering...
Definition qgis.h:2829
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
Definition qgis.h:2827
@ AlwaysText
Always render text as text objects. While this mode preserves text objects as text for post-processin...
Definition qgis.h:2828
FeatureSymbologyExport
Options for exporting features considering their symbology.
Definition qgis.h:5557
@ PerFeature
Keeps the number of features and export symbology per feature.
Definition qgis.h:5559
@ PerSymbolLayer
Exports one feature per symbol layer (considering symbol levels).
Definition qgis.h:5560
@ NoSymbology
Export only data.
Definition qgis.h:5558
Exception thrown in case of malformed requests.
Stores the component parts of a data source URI (e.g.
QByteArray encodedUri() const
Returns the complete encoded URI as a byte array.
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
static void setFontFamily(QFont &font, const QString &family)
Sets the family for a font object.
Stores the appearance and layout settings for legend drawing with QgsLegendRenderer.
QgsLegendStyle & rstyle(Qgis::LegendComponent s)
Returns modifiable reference to the style for a legend component.
void setTitle(const QString &t)
Sets the title for the legend, which will be rendered above all legend items.
void setBoxSpace(double s)
Sets the legend box space (in millimeters), which is the empty margin around the inside of the legend...
void setSynchronousLegendRequests(bool b)
Sets whether to request legend graphics synchronously.
void setSymbolSize(QSizeF s)
Sets the default symbol size (in millimeters) used for legend items.
QgsTextFormat & textFormat()
Returns the text format used for rendering this legend component.
void setMargin(Side side, double margin)
Sets the margin (in mm) for the specified side of the component.
@ Left
Left side.
@ Bottom
Bottom side.
void setTextFormat(const QgsTextFormat &format)
Sets the text format used for rendering this legend component.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
Describes the version of a project.
A rectangle specified with double values.
Q_INVOKABLE QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
QList< QColor > toColorList(bool &ok, char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of colors.
QString loadUrl(bool &ok) const
Loads the data associated to the parameter converted into an url.
QUrl toUrl(bool &ok) const
Converts the parameter into an url.
QList< int > toIntList(bool &ok, char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of integers.
QString toString(bool defaultValue=false) const
Converts the parameter into a string.
QgsServerParameterDefinition(const QMetaType::Type type=QMetaType::Type::QString, const QVariant defaultValue=QVariant(""))
Constructor for QgsServerParameterDefinition.
QStringList toStringList(char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of strings.
virtual bool isValid() const
Returns true if the parameter is valid, false otherwise.
QString typeName() const
Returns the type of the parameter as a string.
static void raiseError(const QString &msg)
Raises an exception in case of an invalid parameters.
int toInt(bool &ok) const
Converts the parameter into an integer.
QList< QgsGeometry > toGeomList(bool &ok, char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of geometries.
QColor toColor(bool &ok) const
Converts the parameter into a color.
double toDouble(bool &ok) const
Converts the parameter into a double.
QList< double > toDoubleList(bool &ok, char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of doubles.
QgsRectangle toRectangle(bool &ok) const
Converts the parameter into a rectangle.
virtual QString request() const
Returns REQUEST parameter as a string or an empty string if not defined.
QUrlQuery urlQuery() const
Returns a url query with underlying parameters.
QMap< QString, QString > mUnmanagedParameters
void load(const QUrlQuery &query)
Loads new parameters.
virtual QString version() const
Returns VERSION parameter as a string or an empty string if not defined.
QString value(const QString &key) const
Returns the value of a parameter.
void setColor(const QColor &color)
Sets the color that text will be rendered in.
static QgsTextFormat fromQFont(const QFont &font)
Returns a text format matching the settings from an input font.
WMS parameter received from the client.
int toInt() const
Converts the parameter into an integer.
QList< QgsGeometry > toGeomList(const char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of geometries.
double toDouble() const
Converts the parameter into a double.
void raiseError() const
Raises an error in case of an invalid conversion.
QgsWmsParameter(const QgsWmsParameter::Name name=QgsWmsParameter::UNKNOWN, const QMetaType::Type type=QMetaType::Type::QString, const QVariant defaultValue=QVariant(""))
Constructor for QgsWmsParameter.
QList< double > toDoubleList(const char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of doubles.
QStringList toStyleList(const char delimiter=',', bool skipEmptyParts=false) const
Converts the parameter into a list of strings and keeps empty parts Default style value is an empty s...
Name
Available parameters for WMS requests.
QUrl toUrl() const
Converts the parameter into an url.
bool isValid() const override
Returns true if the parameter is valid, false otherwise.
QString name() const
Returns the name of the parameter.
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
QList< int > toIntList(const char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of integers.
QColor toColor() const
Converts the parameter into a color.
QgsWmsParameter::Name mName
QList< QColor > toColorList(const char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of colors.
QString loadUrl() const
Loads the data associated to the parameter converted into an url.
bool htmlInfoOnlyMapTip() const
Returns true if only maptip information is requested for HTML feature info response.
QString rule() const
Returns RULE parameter or an empty string if none is defined.
QString layerTitle() const
Returns LAYERTITLE parameter or an empty string if not defined.
double layerSpaceAsDouble() const
Returns LAYERSPACE as a double or its default value if not defined.
QString boxSpace() const
Returns BOXSPACE parameter or an empty string if not defined.
QString wmsPrecision() const
Returns WMS_PRECISION parameter or an empty string if not defined.
double dxfScale() const
Returns the DXF SCALE parameter.
QString featureCount() const
Returns FEATURE_COUNT parameter or an empty string if none is defined.
QFont layerFont() const
Returns the layer font (built thanks to the LAYERFONTFAMILY, LAYERFONTSIZE, LAYERFONTBOLD,...
QList< int > opacitiesAsInt() const
Returns the list of opacities found in OPACITIES parameter as integers.
bool transparentAsBool() const
Returns TRANSPARENT parameter as a bool or its default value if not defined.
QString transparent() const
Returns TRANSPARENT parameter or an empty string if not defined.
QList< int > highlightLabelWeightAsInt() const
Returns HIGHLIGHT_LABELWEIGHT as a list of int.
QString iconLabelSpace() const
Returns ICONLABELSPACE parameter or an empty string if not defined.
QString layerTitleSpace() const
Returns LAYERTITLESPACE parameter or an empty string if not defined.
QString x() const
Returns X parameter or an empty string if not defined.
QgsWmsParameters(const QgsServerParameters &parameters)
Constructor for WMS parameters with specific values.
QString layerSpace() const
Returns LAYERSPACE parameter or an empty string if not defined.
int wmsPrecisionAsInt() const
Returns WMS_PRECISION parameter as an int or its default value if not defined.
QStringList highlightLabelBufferSize() const
Returns HIGHLIGHT_LABELBUFFERSIZE.
QStringList allLayersNickname() const
Returns nickname of layers found in LAYER and LAYERS parameters.
QString formatAsString() const
Returns FORMAT parameter as a string.
double layerFontSizeAsDouble() const
Returns LAYERFONTSIZE as a double.
QString externalWMSUri(const QString &id) const
Returns the external WMS uri.
QgsProjectVersion versionAsNumber() const
Returns VERSION parameter if defined or its default value.
QString scale() const
Returns SCALE parameter or an empty string if none is defined.
QString ruleLabel() const
Returns RULELABEL parameter or an empty string if none is defined.
double scaleAsDouble() const
Returns SCALE as a double.
bool layerFontItalicAsBool() const
Returns LAYERFONTITALIC as a boolean or its default value if not defined.
QgsWmsParametersComposerMap composerMapParameters(int mapId) const
Returns the requested parameters for a composer map parameter.
QgsRectangle bboxAsRectangle() const
Returns BBOX as a rectangle if defined and valid.
bool withGeometry() const
Returns if the client wants the feature info response with geometry information.
QStringList highlightLabelString() const
Returns HIGHLIGHT_LABELSTRING as a list of string.
QString tiled() const
Returns TILED parameter or an empty string if not defined.
QString layerFontSize() const
Returns LAYERFONTSIZE parameter or an empty string if not defined.
QList< QColor > highlightLabelColorAsColor() const
Returns HIGHLIGHT_LABELCOLOR as a list of color.
bool itemFontBoldAsBool() const
Returns ITEMFONTBOLD as a boolean or its default value if not defined.
QStringList highlightLabelHorizontalAlignment() const
Returns HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT as a list of string.
void set(QgsWmsParameter::Name name, const QVariant &value)
Sets a parameter value thanks to its name.
QString pointTolerance() const
Returns FI_POINT_TOLERANCE parameter or an empty string if not defined.
QString filterGeom() const
Returns the filter geometry found in FILTER_GEOM parameter.
QString composerTemplate() const
Returns TEMPLATE parameter or an empty string if not defined.
Format infoFormat() const
Returns infoFormat.
QString dxfCodec() const
Returns the DXF CODEC parameter.
QString y() const
Returns Y parameter or an empty string if not defined.
QString srcHeight() const
Returns SRCHEIGHT parameter or an empty string if not defined.
double dpiAsDouble() const
Returns DPI parameter as an int or its default value if not defined.
QStringList highlightLabelVerticalAlignment() const
Returns HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT as a list of string.
void dump() const
Dumps parameters.
int pointToleranceAsInt() const
Returns FI_POINT_TOLERANCE parameter as an integer.
bool withMapTip() const
withMapTip
QString polygonTolerance() const
Returns FI_POLYGON_TOLERANCE parameter or an empty string if not defined.
QStringList highlightGeom() const
Returns HIGHLIGHT_GEOM as a list of string in WKT.
QString i() const
Returns I parameter or an empty string if not defined.
bool pdfLosslessImageCompression() const
Returns true if images embedded in pdf must be compressed using a lossless algorithm.
QList< QColor > highlightLabelBufferColorAsColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of colors.
QString request() const override
Returns REQUEST parameter as a string or an empty string if not defined.
double layerTitleSpaceAsDouble() const
Returns LAYERTITLESPACE as a double.
QList< QgsWmsParametersLayer > layersParameters() const
Returns parameters for each layer found in LAYER/LAYERS.
int lineToleranceAsInt() const
Returns FI_LINE_TOLERANCE parameter as an integer.
QList< double > highlightLabelBufferSizeAsFloat() const
Returns HIGHLIGHT_LABELBUFFERSIZE as a list of float.
QString lineTolerance() const
Returns FI_LINE_TOLERANCE parameter or an empty string if not defined.
bool showFeatureCountAsBool() const
Returns SHOWFEATURECOUNT as a bool.
QStringList pdfExportMapThemes() const
Returns map themes for geospatial PDF export.
Q_DECL_DEPRECATED bool pdfUseOgcBestPracticeFormatGeoreferencing() const
Returns true if OGC best practice georeferencing shall be used.
QStringList highlightLabelColor() const
Returns HIGHLIGHT_LABELCOLOR as a list of string.
bool pdfExportMetadata() const
Returns true if metadata shall be added to the pdf.
bool versionIsValid(const QString version) const
Returns true if version is valid, false otherwise.
QString j() const
Returns J parameter or an empty string if not defined.
int xAsInt() const
Returns X parameter as an int or its default value if not defined.
QColor layerFontColorAsColor() const
Returns LAYERFONTCOLOR as a color or its defined value if not defined.
QString bbox() const
Returns BBOX if defined or an empty string.
QgsWmsParameters()
Constructor for WMS parameters with default values only.
int heightAsInt() const
Returns HEIGHT parameter as an int or its default value if not defined.
QStringList highlightLabelWeight() const
Returns HIGHLIGHT_LABELWEIGHT as a list of string.
QString backgroundColor() const
Returns BGCOLOR parameter or an empty string if not defined.
QStringList allStyles() const
Returns styles found in STYLE and STYLES parameters.
double symbolWidthAsDouble() const
Returns SYMBOLWIDTH as a double or its default value if not defined.
QColor backgroundColorAsColor() const
Returns BGCOLOR parameter as a QColor or its default value if not defined.
Format format() const
Returns format.
QgsWmsParameter operator[](QgsWmsParameter::Name name) const
Returns the parameter corresponding to name.
QString itemFontSize() const
Returns ITEMFONTSIZE parameter or an empty string if not defined.
QStringList atlasPk() const
Returns the ATLAS_PK parameter.
QList< QgsGeometry > highlightGeomAsGeom() const
Returns HIGHLIGHT_GEOM as a list of geometries.
QString layerFontFamily() const
Returns LAYERFONTFAMILY parameter or an empty string if not defined.
QString withMapTipAsString() const
withMapTipAsString
QList< QgsWmsParametersHighlightLayer > highlightLayersParameters() const
Returns parameters for each highlight layer.
int iAsInt() const
Returns I parameter as an int or its default value if not defined.
QStringList highlightLabelBufferColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of string.
bool pdfAppendGeoreference() const
Returns true if georeference info shall be added to the pdf.
int polygonToleranceAsInt() const
Returns FI_POLYGON_TOLERANCE parameter as an integer.
bool ruleLabelAsBool() const
Returns RULELABEL as a bool.
QList< double > highlightLabelDistance() const
Returns HIGHLIGHT_LABEL_DISTANCE as a list of double.
QList< int > highlightLabelSizeAsInt() const
Returns HIGHLIGHT_LABELSIZE as a list of int An exception is raised if an invalid size is found.
int widthAsInt() const
Returns WIDTH parameter as an int or its default value if not defined.
QString sldBody() const
Returns SLD_body if defined or an empty string.
bool itemFontItalicAsBool() const
Returns ITEMFONTITALIC as a boolean or its default value if not defined.
bool pdfDisableTiledRasterRendering() const
Returns true if rasters shall be untiled in the pdf.
QColor itemFontColorAsColor() const
Returns ITEMFONTCOLOR as a color.
double itemFontSizeAsDouble() const
Returns ITEMFONTSIZE as a double.
QString layerFontColor() const
Returns LAYERFONTCOLOR parameter or an empty string if not defined.
QString layoutParameter(const QString &id, bool &ok) const
Returns a layout parameter thanks to its id.
bool dxfUseLayerTitleAsName() const
Returns the DXF USE_TITLE_AS_LAYERNAME parameter.
QString symbolHeight() const
Returns SYMBOLHEIGHT parameter or an empty string if not defined.
int imageQualityAsInt() const
Returns IMAGE_QUALITY parameter as an integer.
bool pdfForceVectorOutput() const
Returns if pdf should be exported as vector.
bool writeGeospatialPdf() const
Returns if a geospatial PDF shall be exported.
bool pdfUseIso32000ExtensionFormatGeoreferencing() const
Returns true, if Iso32000 georeferencing shall be used.
QMap< QString, QString > dimensionValues() const
Returns the dimensions parameter.
QList< QgsWmsParametersExternalLayer > externalLayersParameters() const
Returns parameters for each external layer.
bool withDisplayName() const
withDisplayName
int infoFormatVersion() const
Returns the infoFormat version for GML.
QString layerFontBold() const
Returns LAYERFONTBOLD parameter or an empty string if not defined.
QgsLegendSettings legendSettings() const
Returns legend settings.
int srcHeightAsInt() const
Returns SRCHEIGHT parameter as an int or its default value if not defined.
QString symbolSpace() const
Returns SYMBOLSPACE parameter or an empty string if not defined.
QString itemFontBold() const
Returns ITEMFONTBOLD parameter or an empty string if not defined.
double symbolSpaceAsDouble() const
Returns SYMBOLSPACE as a double or its default value if not defined.
QString infoFormatAsString() const
Returns INFO_FORMAT parameter as a string.
QStringList highlightLabelFont() const
Returns HIGHLIGHT_LABELFONT.
Qgis::TextRenderFormat pdfTextRenderFormat() const
Returns text render format for pdf export.
QString wmtver() const
Returns WMTVER parameter or an empty string if not defined.
QStringList dxfLayerAttributes() const
Returns the DXF LAYERATTRIBUTES parameter.
QString srcWidth() const
Returns SRCWIDTH parameter or an empty string if not defined.
Qgis::FeatureSymbologyExport dxfMode() const
Returns the DXF MODE parameter.
QStringList highlightLabelSize() const
Returns HIGHLIGHT_LABELSIZE as a list of string.
QString imageQuality() const
Returns IMAGE_QUALITY parameter or an empty string if not defined.
QList< double > highlightLabelRotation() const
Returns HIGHLIGHT_LABEL_ROTATION as a list of double.
QString height() const
Returns HEIGHT parameter or an empty string if not defined.
QString crs() const
Returns CRS or an empty string if none is defined.
bool showRuleDetailsAsBool() const
Returns SHOWRULEDETAILS as a bool.
QStringList selections() const
Returns the list of feature selection found in SELECTION parameter.
int featureCountAsInt() const
Returns FEATURE_COUNT as an integer.
int yAsInt() const
Returns Y parameter as an int or its default value if not defined.
bool layerTitleAsBool() const
Returns LAYERTITLE as a bool or its default value if not defined.
QMap< T, QString > formatOptions() const
Returns the format options for an output format.
QString itemFontColor() const
Returns ITEMFONTCOLOR parameter or an empty string if not defined.
double boxSpaceAsDouble() const
Returns BOXSPACE as a double or its default value if not defined.
bool addLayerGroups() const
Returns true if layer groups shall be added to GetLegendGraphic results.
QString symbolWidth() const
Returns SYMBOLWIDTH parameter or an empty string if not defined.
bool tiledAsBool() const
Returns TILED parameter as a boolean.
Format
Output format for the response.
QString width() const
Returns WIDTH parameter or an empty string if not defined.
QFont itemFont() const
Returns the item font (built thanks to the ITEMFONTFAMILY, ITEMFONTSIZE, ITEMFONTBOLD,...
QStringList opacities() const
Returns the list of opacities found in OPACITIES parameter.
QString version() const override
Returns VERSION parameter as a string or an empty string if not defined.
QString layerFontItalic() const
Returns LAYERFONTITALIC parameter or an empty string if not defined.
QString itemFontItalic() const
Returns ITEMFONTITALIC parameter or an empty string if not defined.
QStringList filters() const
Returns the list of filters found in FILTER parameter.
QString dpi() const
Returns DPI parameter or an empty string if not defined.
QString itemFontFamily() const
Returns ITEMFONTFAMILY parameter or an empty string if not defined.
int jAsInt() const
Returns J parameter as an int or its default value if not defined.
QVector< qreal > pdfPredefinedMapScales() const
Returns list of map scales.
QString showFeatureCount() const
Returns SHOWFEATURECOUNT parameter or an empty string if none is defined.
bool pdfSimplifyGeometries() const
Returns if geometries shall to be simplified.
bool layerFontBoldAsBool() const
Returns LAYERFONTBOLD as a boolean or its default value if not defined.
double iconLabelSpaceAsDouble() const
Returns ICONLABELSPACE as a double or its default value if not defined.
QStringList highlightSymbol() const
Returns HIGHLIGHT_SYMBOL as a list of string.
QStringList queryLayersNickname() const
Returns nickname of layers found in QUERY_LAYERS parameter.
double symbolHeightAsDouble() const
Returns SYMBOLHEIGHT as a double or its default value if not defined.
bool infoFormatIsImage() const
Checks if INFO_FORMAT parameter is one of the image formats (PNG, JPG).
int srcWidthAsInt() const
Returns SRCWIDTH parameter as an int or its default value if not defined.
Median cut implementation.
const QString EXTERNAL_LAYER_PREFIX
QList< QgsWmsParametersLayer > mLayers
QList< QgsWmsParametersHighlightLayer > mHighlightLayers
QgsWmsParametersFilter::Type mType
QgsOgcUtils::FilterVersion mVersion
QList< QgsWmsParametersFilter > mFilter