QGIS API Documentation 4.1.0-Master (659fe69c07c)
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#include <QString>
28
29#include "moc_qgswmsparameters.cpp"
30
31using namespace Qt::StringLiterals;
32
33const QString EXTERNAL_LAYER_PREFIX = u"EXTERNAL_WMS:"_s;
34
35namespace QgsWms
36{
37 //
38 // QgsWmsParameter
39 //
40 QgsWmsParameter::QgsWmsParameter( const QgsWmsParameter::Name name, const QMetaType::Type type, const QVariant defaultValue )
41 : QgsServerParameterDefinition( type, defaultValue )
42 , mName( name )
43 {}
44
49
51 {
52 const QString msg = QString( "%1 ('%2') cannot be converted into %3" ).arg( name( mName ), toString(), typeName() );
54 }
55
56 QStringList QgsWmsParameter::toStyleList( const char delimiter, bool skipEmptyParts ) const
57 {
58 return QgsServerParameterDefinition::toStringList( delimiter, skipEmptyParts );
59 }
60
61 QList<QgsGeometry> QgsWmsParameter::toGeomList( const char delimiter, bool skipEmptyParts ) const
62 {
63 bool ok = true;
64 const QList<QgsGeometry> geoms = QgsServerParameterDefinition::toGeomList( ok, delimiter, skipEmptyParts );
65
66 if ( !ok )
67 {
68 const QString msg = QString( "%1 ('%2') cannot be converted into a list of geometries" ).arg( name( mName ), toString() );
70 }
71
72 return geoms;
73 }
74
76 {
77 bool ok = true;
79
80 if ( !ok )
81 {
82 const QString msg = QString( "%1 ('%2') cannot be converted into a rectangle" ).arg( name( mName ), toString() );
84 }
85
86 return rect;
87 }
88
90 {
91 bool ok = false;
92 const int val = QgsServerParameterDefinition::toInt( ok );
93
94 if ( !ok )
95 {
96 raiseError();
97 }
98
99 return val;
100 }
101
103 {
104 // Check URL -- it will be used in error messages
105 const QUrl url = toUrl();
106
107 bool ok = false;
108 const QString content = QgsServerParameterDefinition::loadUrl( ok );
109
110 if ( !ok )
111 {
112 const QString msg = QString( "%1 request error for %2" ).arg( name( mName ), url.toString() );
114 }
115
116 return content;
117 }
118
120 {
121 bool ok = false;
122 const QUrl url = QgsServerParameterDefinition::toUrl( ok );
123
124 if ( !ok )
125 {
126 raiseError();
127 }
128
129 return url;
130 }
131
133 {
134 bool ok = false;
135 const QColor col = QgsServerParameterDefinition::toColor( ok );
136
137 if ( !ok )
138 {
139 raiseError();
140 }
141
142 return col;
143 }
144
145 QList<QColor> QgsWmsParameter::toColorList( const char delimiter, bool skipEmptyParts ) const
146 {
147 bool ok = false;
148 const QList<QColor> vals = QgsServerParameterDefinition::toColorList( ok, delimiter, skipEmptyParts );
149
150 if ( !ok )
151 {
152 const QString msg = QString( "%1 ('%2') cannot be converted into a list of colors" ).arg( name( mName ), toString() );
154 }
155
156 return vals;
157 }
158
159 QList<int> QgsWmsParameter::toIntList( const char delimiter, bool skipEmptyParts ) const
160 {
161 bool ok = false;
162 const QList<int> vals = QgsServerParameterDefinition::toIntList( ok, delimiter, skipEmptyParts );
163
164 if ( !ok )
165 {
166 const QString msg = QString( "%1 ('%2') cannot be converted into a list of int" ).arg( name( mName ), toString() );
168 }
169
170 return vals;
171 }
172
173 QList<double> QgsWmsParameter::toDoubleList( const char delimiter, bool skipEmptyParts ) const
174 {
175 bool ok = false;
176 const QList<double> vals = QgsServerParameterDefinition::toDoubleList( ok, delimiter, skipEmptyParts );
177
178 if ( !ok )
179 {
180 const QString msg = QString( "%1 ('%2') cannot be converted into a list of float" ).arg( name( mName ), toString() );
182 }
183
184 return vals;
185 }
186
188 {
189 bool ok = false;
190 const double val = QgsServerParameterDefinition::toDouble( ok );
191
192 if ( !ok )
193 {
194 raiseError();
195 }
196
197 return val;
198 }
199
200 QString QgsWmsParameter::name() const
201 {
203 }
204
206 {
207 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
208 return metaEnum.valueToKey( name );
209 }
210
212 {
213 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
214 return ( QgsWmsParameter::Name ) metaEnum.keyToValue( name.toUpper().toStdString().c_str() );
215 }
216
217 //
218 // QgsWmsParameters
219 //
222 {
223 // Available version number
224 mVersions.append( QgsProjectVersion( 1, 1, 1 ) );
225 mVersions.append( QgsProjectVersion( 1, 3, 0 ) );
226
227 // WMS parameters definition
228 const QgsWmsParameter pQuality( QgsWmsParameter::IMAGE_QUALITY, QMetaType::Type::Int, QVariant( 0 ) );
229 save( pQuality );
230
231 const QgsWmsParameter pTiled( QgsWmsParameter::TILED, QMetaType::Type::Bool, QVariant( false ) );
232 save( pTiled );
233
234 const QgsWmsParameter pBoxSpace( QgsWmsParameter::BOXSPACE, QMetaType::Type::Double, QVariant( 2.0 ) );
235 save( pBoxSpace );
236
237 const QgsWmsParameter pSymbSpace( QgsWmsParameter::SYMBOLSPACE, QMetaType::Type::Double, QVariant( 2.0 ) );
238 save( pSymbSpace );
239
240 const QgsWmsParameter pLayerSpace( QgsWmsParameter::LAYERSPACE, QMetaType::Type::Double, QVariant( 3.0 ) );
241 save( pLayerSpace );
242
243 const QgsWmsParameter pTitleSpace( QgsWmsParameter::LAYERTITLESPACE, QMetaType::Type::Double, QVariant( 3.0 ) );
244 save( pTitleSpace );
245
246 const QgsWmsParameter pSymbHeight( QgsWmsParameter::SYMBOLHEIGHT, QMetaType::Type::Double, QVariant( 4.0 ) );
247 save( pSymbHeight );
248
249 const QgsWmsParameter pSymbWidth( QgsWmsParameter::SYMBOLWIDTH, QMetaType::Type::Double, QVariant( 7.0 ) );
250 save( pSymbWidth );
251
252 const QgsWmsParameter pIcLabelSpace( QgsWmsParameter::ICONLABELSPACE, QMetaType::Type::Double, QVariant( 2.0 ) );
253 save( pIcLabelSpace );
254
256 save( pItFontFamily );
257
258 const QgsWmsParameter pItFontBold( QgsWmsParameter::ITEMFONTBOLD, QMetaType::Type::Bool, QVariant( false ) );
259 save( pItFontBold );
260
261 const QgsWmsParameter pItFontItalic( QgsWmsParameter::ITEMFONTITALIC, QMetaType::Type::Bool, QVariant( false ) );
262 save( pItFontItalic );
263
264 const QgsWmsParameter pItFontSize( QgsWmsParameter::ITEMFONTSIZE, QMetaType::Type::Double, QVariant( -1 ) );
265 save( pItFontSize );
266
267 const QgsWmsParameter pItFontColor( QgsWmsParameter::ITEMFONTCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
268 save( pItFontColor );
269
270 const QgsWmsParameter pHighlightGeom( QgsWmsParameter::HIGHLIGHT_GEOM );
271 save( pHighlightGeom );
272
273 const QgsWmsParameter pShowFeatureCount( QgsWmsParameter::SHOWFEATURECOUNT, QMetaType::Type::Bool, QVariant( false ) );
274 save( pShowFeatureCount );
275
276 const QgsWmsParameter pHighlightSymbol( QgsWmsParameter::HIGHLIGHT_SYMBOL );
277 save( pHighlightSymbol );
278
280 save( pHighlightLabel );
281
282 const QgsWmsParameter pHighlightColor( QgsWmsParameter::HIGHLIGHT_LABELCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
283 save( pHighlightColor );
284
285 const QgsWmsParameter pHighlightFontSize( QgsWmsParameter::HIGHLIGHT_LABELSIZE );
286 save( pHighlightFontSize );
287
288 const QgsWmsParameter pHighlightFontWeight( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT );
289 save( pHighlightFontWeight );
290
292 save( pHighlightFont );
293
294 const QgsWmsParameter pHighlightBufferColor( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
295 save( pHighlightBufferColor );
296
298 save( pHighlightBufferSize );
299
300 const QgsWmsParameter pHighlightFrameBackgroundColor( QgsWmsParameter::HIGHLIGHT_LABELFRAMEBACKGROUNDCOLOR );
301 save( pHighlightFrameBackgroundColor );
302
303 const QgsWmsParameter pHighlightFrameOutlineColor( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINECOLOR );
304 save( pHighlightFrameOutlineColor );
305
306 const QgsWmsParameter pHighlightFrameOutlineWidth( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINEWIDTH );
307 save( pHighlightFrameOutlineWidth );
308
310 save( pHighlightFrameSize );
311
312 const QgsWmsParameter pLabelRotation( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION, QMetaType::Type::Double );
313 save( pLabelRotation );
314
315 const QgsWmsParameter pLabelDistance( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE, QMetaType::Type::Double );
316 save( pLabelDistance );
317
319 save( pLabelHali );
320
322 save( pLabelVali );
323
325 save( pCRS );
326
328 save( pSRS );
329
330 const QgsWmsParameter pFormat( QgsWmsParameter::FORMAT, QMetaType::Type::QString, QVariant( "png" ) );
331 save( pFormat );
332
334 save( pInfoFormat );
335
336 const QgsWmsParameter pI( QgsWmsParameter::I, QMetaType::Type::Int, QVariant( -1 ) );
337 save( pI );
338
339 const QgsWmsParameter pJ( QgsWmsParameter::J, QMetaType::Type::Int, QVariant( -1 ) );
340 save( pJ );
341
342 const QgsWmsParameter pX( QgsWmsParameter::X, QMetaType::Type::Int, QVariant( -1 ) );
343 save( pX );
344
345 const QgsWmsParameter pY( QgsWmsParameter::Y, QMetaType::Type::Int, QVariant( -1 ) );
346 save( pY );
347
349 save( pRule );
350
351 const QgsWmsParameter pRuleLabel( QgsWmsParameter::RULELABEL, QMetaType::Type::Bool, QVariant( true ) );
352 save( pRuleLabel );
353
354 const QgsWmsParameter pShowRuleDetails( QgsWmsParameter::SHOWRULEDETAILS, QMetaType::Type::Bool, QVariant( false ) );
355 save( pShowRuleDetails );
356
357 const QgsWmsParameter pScale( QgsWmsParameter::SCALE, QMetaType::Type::Double, QVariant( -1 ) );
358 save( pScale );
359
360 const QgsWmsParameter pHeight( QgsWmsParameter::HEIGHT, QMetaType::Type::Int, QVariant( 0 ) );
361 save( pHeight );
362
363 const QgsWmsParameter pWidth( QgsWmsParameter::WIDTH, QMetaType::Type::Int, QVariant( 0 ) );
364 save( pWidth );
365
366 const QgsWmsParameter pSrcHeight( QgsWmsParameter::SRCHEIGHT, QMetaType::Type::Int, QVariant( 0 ) );
367 save( pSrcHeight );
368
369 const QgsWmsParameter pSrcWidth( QgsWmsParameter::SRCWIDTH, QMetaType::Type::Int, QVariant( 0 ) );
370 save( pSrcWidth );
371
373 save( pBbox );
374
376 save( pSld );
377
379 save( pSldBody );
380
382 save( pLayer );
383
385 save( pLayers );
386
388 save( pQueryLayers );
389
390 const QgsWmsParameter pFeatureCount( QgsWmsParameter::FEATURE_COUNT, QMetaType::Type::Int, QVariant( 1 ) );
391 save( pFeatureCount );
392
393 const QgsWmsParameter pLayerTitle( QgsWmsParameter::LAYERTITLE, QMetaType::Type::Bool, QVariant( true ) );
394 save( pLayerTitle );
395
397 save( pLayerFtFamily );
398
399 const QgsWmsParameter pLayerFtBold( QgsWmsParameter::LAYERFONTBOLD, QMetaType::Type::Bool, QVariant( false ) );
400 save( pLayerFtBold );
401
402 const QgsWmsParameter pLayerFtItalic( QgsWmsParameter::LAYERFONTITALIC, QMetaType::Type::Bool, QVariant( false ) );
403 save( pLayerFtItalic );
404
405 const QgsWmsParameter pLayerFtSize( QgsWmsParameter::LAYERFONTSIZE, QMetaType::Type::Double, QVariant( -1 ) );
406 save( pLayerFtSize );
407
408 const QgsWmsParameter pLayerFtColor( QgsWmsParameter::LAYERFONTCOLOR, QMetaType::Type::QString, QVariant( "black" ) );
409 save( pLayerFtColor );
410
412 save( pStyle );
413
415 save( pStyles );
416
418 save( pOpacities );
419
421 save( pFilter );
422
424 save( pFilterGeom );
425
426 const QgsWmsParameter pPolygTol( QgsWmsParameter::FI_POLYGON_TOLERANCE, QMetaType::Type::Double, QVariant( 0.0 ) );
427 save( pPolygTol );
428
429 const QgsWmsParameter pLineTol( QgsWmsParameter::FI_LINE_TOLERANCE, QMetaType::Type::Double, QVariant( 0.0 ) );
430 save( pLineTol );
431
432 const QgsWmsParameter pPointTol( QgsWmsParameter::FI_POINT_TOLERANCE, QMetaType::Type::Double, QVariant( 0.0 ) );
433 save( pPointTol );
434
436 save( pSelection );
437
438 const QgsWmsParameter pWmsPrecision( QgsWmsParameter::WMS_PRECISION, QMetaType::Type::Int, QVariant( -1 ) );
439 save( pWmsPrecision );
440
441 const QgsWmsParameter pTransparent( QgsWmsParameter::TRANSPARENT, QMetaType::Type::Bool, QVariant( false ) );
442 save( pTransparent );
443
444 const QgsWmsParameter pBgColor( QgsWmsParameter::BGCOLOR, QMetaType::Type::QString, QVariant( "white" ) );
445 save( pBgColor );
446
447 const QgsWmsParameter pDpi( QgsWmsParameter::DPI, QMetaType::Type::Int, QVariant( -1 ) );
448 save( pDpi );
449
451 save( pTemplate );
452
454 save( pExtent );
455
456 const QgsWmsParameter pRotation( QgsWmsParameter::ROTATION, QMetaType::Type::Double, QVariant( 0.0 ) );
457 save( pRotation );
458
459 const QgsWmsParameter pGridX( QgsWmsParameter::GRID_INTERVAL_X, QMetaType::Type::Double, QVariant( 0.0 ) );
460 save( pGridX );
461
462 const QgsWmsParameter pGridY( QgsWmsParameter::GRID_INTERVAL_Y, QMetaType::Type::Double, QVariant( 0.0 ) );
463 save( pGridY );
464
465 const QgsWmsParameter pWithGeometry( QgsWmsParameter::WITH_GEOMETRY, QMetaType::Type::Bool, QVariant( false ) );
466 save( pWithGeometry );
467
468 const QgsWmsParameter pWithMapTip( QgsWmsParameter::WITH_MAPTIP, QMetaType::Type::QString );
469 save( pWithMapTip );
470
471 const QgsWmsParameter pWithDisplayName( QgsWmsParameter::WITH_DISPLAY_NAME, QMetaType::Type::Bool, QVariant( false ) );
472 save( pWithDisplayName );
473
475 save( pWmtver );
476
477 const QgsWmsParameter pAtlasPk( QgsWmsParameter::ATLAS_PK, QMetaType::Type::QStringList );
478 save( pAtlasPk );
479
480 const QgsWmsParameter pFormatOpts( QgsWmsParameter::FORMAT_OPTIONS, QMetaType::Type::QString );
481 save( pFormatOpts );
482
483 const QgsWmsParameter pAddLayerGroups( QgsWmsParameter::ADDLAYERGROUPS, QMetaType::Type::Bool, QVariant( false ) );
484 save( pAddLayerGroups );
485 }
486
489 {
490 load( parameters.urlQuery() );
491
492 auto it = mWmsParameters.constFind( QgsWmsParameter::SLD );
493 if ( it != mWmsParameters.constEnd() && !it->toString().isEmpty() )
494 {
495 const QString sldBody = it->loadUrl();
496 if ( !sldBody.isEmpty() )
497 {
499 }
500 }
501 }
502
504 {
505 return mWmsParameters.value( name );
506 }
507
509 {
510 auto it = mWmsParameters.find( name );
511 if ( it == mWmsParameters.end() )
512 {
513 it = mWmsParameters.insert( name, QgsWmsParameter() );
514 }
515
516 it->mValue = value;
517 }
518
519 bool QgsWmsParameters::loadParameter( const QString &key, const QString &value )
520 {
521 bool loaded = false;
522
523 const thread_local QRegularExpression composerParamRegExp( u"^MAP\\d+:"_s, QRegularExpression::CaseInsensitiveOption );
524 if ( key.contains( composerParamRegExp ) )
525 {
526 const int mapId = QStringView { key }.mid( 3, key.indexOf( ':' ) - 3 ).toInt();
527 const QString theKey = key.mid( key.indexOf( ':' ) + 1 );
528 const QgsWmsParameter::Name name = QgsWmsParameter::name( theKey );
529
530 if ( name >= 0 )
531 {
532 QgsWmsParameter param = mWmsParameters.value( name );
533 param.mValue = value;
534 param.mMapId = mapId;
535
536 if ( !param.isValid() )
537 {
538 param.raiseError();
539 }
540
541 save( param, true ); // multi MAP parameters for composer
542 loaded = true;
543 }
544 }
545 else
546 {
548 if ( name >= 0 )
549 {
550 auto it = mWmsParameters.find( name );
551 if ( it == mWmsParameters.end() )
552 it = mWmsParameters.insert( name, QgsWmsParameter() );
553
554 it->mValue = value;
555 if ( !it->isValid() )
556 {
557 it->raiseError();
558 }
559
560 loaded = true;
561 }
562 else //maybe an external wms parameter?
563 {
564 int separator = key.indexOf( ':'_L1 );
565 if ( separator >= 1 )
566 {
567 QString id = key.left( separator );
568 QString param = key.right( key.length() - separator - 1 );
569 mExternalWMSParameters[id].insert( param, value );
570
571 loaded = true;
572 }
573 }
574 }
575
576 return loaded;
577 }
578
580 {
581 ( void ) log( u"WMS Request parameters:"_s );
582 for ( auto it = mWmsParameters.constBegin(); it != mWmsParameters.constEnd(); ++it )
583 {
584 const QString value = it->toString();
585
586 if ( !value.isEmpty() )
587 {
588 QString name = QgsWmsParameter::name( it.key() );
589
590 if ( it->mMapId >= 0 )
591 {
592 name = u"%1:%2"_s.arg( QString::number( it->mMapId ), name );
593 }
594
595 log( u" - %1 : %2"_s.arg( name, value ) );
596 }
597 }
598
599 if ( !version().isEmpty() )
600 log( u" - VERSION : %1"_s.arg( version() ) );
601 }
602
603 void QgsWmsParameters::save( const QgsWmsParameter &parameter, bool multi )
604 {
605 if ( multi )
606 {
607 mWmsParameters.insert( parameter.mName, parameter );
608 }
609 else
610 {
611 mWmsParameters.replace( parameter.mName, parameter );
612 }
613 }
614
616 {
617 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_GEOM ).toStringList( ';' );
618 }
619
620 QList<QgsGeometry> QgsWmsParameters::highlightGeomAsGeom() const
621 {
622 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_GEOM ).toGeomList( ';' );
623 }
624
626 {
627 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_SYMBOL ).toStringList( ';' );
628 }
629
630 QString QgsWmsParameters::crs() const
631 {
632 QString rs;
633 const QString srs = mWmsParameters.value( QgsWmsParameter::SRS ).toString();
634 const QString crs = mWmsParameters.value( QgsWmsParameter::CRS ).toString();
635
636 // both SRS/CRS are supported but there's a priority according to the
637 // specified version when both are defined in the request
638 if ( !srs.isEmpty() && crs.isEmpty() )
639 rs = srs;
640 else if ( srs.isEmpty() && !crs.isEmpty() )
641 rs = crs;
642 else if ( !srs.isEmpty() && !crs.isEmpty() )
643 {
644 if ( versionAsNumber() >= QgsProjectVersion( 1, 3, 0 ) )
645 rs = crs;
646 else
647 rs = srs;
648 }
649
650 return rs;
651 }
652
654 {
655 return mWmsParameters.value( QgsWmsParameter::BBOX ).toString();
656 }
657
659 {
660 return mWmsParameters.value( QgsWmsParameter::BBOX ).toRectangle();
661 }
662
664 {
665 return mWmsParameters.value( QgsWmsParameter::HEIGHT ).toString();
666 }
667
669 {
670 return mWmsParameters.value( QgsWmsParameter::WIDTH ).toString();
671 }
672
674 {
675 return mWmsParameters.value( QgsWmsParameter::HEIGHT ).toInt();
676 }
677
679 {
680 return mWmsParameters.value( QgsWmsParameter::WIDTH ).toInt();
681 }
682
684 {
685 return mWmsParameters.value( QgsWmsParameter::SRCHEIGHT ).toString();
686 }
687
689 {
690 return mWmsParameters.value( QgsWmsParameter::SRCWIDTH ).toString();
691 }
692
694 {
695 return mWmsParameters.value( QgsWmsParameter::SRCHEIGHT ).toInt();
696 }
697
699 {
700 return mWmsParameters.value( QgsWmsParameter::SRCWIDTH ).toInt();
701 }
702
703 QString QgsWmsParameters::dpi() const
704 {
705 return mWmsParameters.value( QgsWmsParameter::DPI ).toString();
706 }
707
709 {
710 return mWmsParameters.value( QgsWmsParameter::DPI ).toDouble();
711 }
712
714 {
716
717 if ( QgsServerParameters::request().compare( "GetProjectSettings"_L1, Qt::CaseInsensitive ) == 0 )
718 {
719 version = u"1.3.0"_s;
720 }
721 else if ( version.isEmpty() )
722 {
723 if ( !wmtver().isEmpty() )
724 {
725 version = wmtver();
726 }
727 else
728 {
729 version = u"1.3.0"_s;
730 }
731 }
732 else if ( !mVersions.contains( QgsProjectVersion( version ) ) )
733 {
734 // WMS 1.3.0 specification: If a version lower than any of those
735 // known to the server is requested, then the server shall send the
736 // lowest version it supports.
737 if ( QgsProjectVersion( 1, 1, 1 ) > QgsProjectVersion( version ) )
738 {
739 version = u"1.1.1"_s;
740 }
741 else
742 {
743 version = u"1.3.0"_s;
744 }
745 }
746
747 return version;
748 }
749
751 {
752 QString req = QgsServerParameters::request();
753
754 if ( version().compare( "1.1.1"_L1 ) == 0 && req.compare( "capabilities"_L1, Qt::CaseInsensitive ) == 0 )
755 {
756 req = u"GetCapabilities"_s;
757 }
758
759 return req;
760 }
761
766
767 bool QgsWmsParameters::versionIsValid( const QString version ) const
768 {
769 return mVersions.contains( QgsProjectVersion( version ) );
770 }
771
773 {
774 return mWmsParameters.value( QgsWmsParameter::FORMAT ).toString( true );
775 }
776
778 {
779 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameters::Format>() );
780 return metaEnum.valueToKey( format );
781 }
782
784 {
785 const QString fStr = formatAsString();
786
788 if ( fStr.compare( "image/png"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "png"_L1, Qt::CaseInsensitive ) == 0 )
789 {
790 f = Format::PNG;
791 }
792 else if ( fStr.compare( "jpg"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "jpeg"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "image/jpeg"_L1, Qt::CaseInsensitive ) == 0 )
793 {
794 f = Format::JPG;
795 }
796 else if ( fStr.compare( "image/svg"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "image/svg+xml"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "svg"_L1, Qt::CaseInsensitive ) == 0 )
797 {
798 f = Format::SVG;
799 }
800 else if ( fStr.compare( "application/pdf"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "pdf"_L1, Qt::CaseInsensitive ) == 0 )
801 {
802 f = Format::PDF;
803 }
804 else if ( fStr.compare( "application/json"_L1, Qt::CaseInsensitive ) == 0 || fStr.compare( "json"_L1, Qt::CaseInsensitive ) == 0 )
805 {
806 f = Format::JSON;
807 }
808 return f;
809 }
810
812 {
813 return mWmsParameters.value( QgsWmsParameter::INFO_FORMAT ).toString();
814 }
815
817 {
818 return infoFormat() == Format::PNG || infoFormat() == Format::JPG;
819 }
820
822 {
823 QString fStr = infoFormatAsString();
824
826 if ( fStr.isEmpty() )
827 return f;
828
829 if ( fStr.startsWith( "text/xml"_L1, Qt::CaseInsensitive ) )
830 f = Format::XML;
831 else if ( fStr.startsWith( "text/html"_L1, Qt::CaseInsensitive ) )
832 f = Format::HTML;
833 else if ( fStr.startsWith( "text/plain"_L1, Qt::CaseInsensitive ) )
834 f = Format::TEXT;
835 else if ( fStr.startsWith( "application/vnd.ogc.gml"_L1, Qt::CaseInsensitive ) )
836 f = Format::GML;
837 else if ( fStr.startsWith( "application/json"_L1, Qt::CaseInsensitive ) || fStr.startsWith( "application/geo+json"_L1, Qt::CaseInsensitive ) )
838 f = Format::JSON;
839 else
840 f = Format::NONE;
841
842 return f;
843 }
844
846 {
847 if ( infoFormat() != Format::GML )
848 return -1;
849
850 QString fStr = infoFormatAsString();
851 if ( fStr.startsWith( "application/vnd.ogc.gml/3"_L1, Qt::CaseInsensitive ) )
852 return 3;
853 else
854 return 2;
855 }
856
857 QString QgsWmsParameters::i() const
858 {
859 return mWmsParameters.value( QgsWmsParameter::I ).toString();
860 }
861
862 QString QgsWmsParameters::j() const
863 {
864 return mWmsParameters.value( QgsWmsParameter::J ).toString();
865 }
866
868 {
869 return mWmsParameters.value( QgsWmsParameter::I ).toInt();
870 }
871
873 {
874 return mWmsParameters.value( QgsWmsParameter::J ).toInt();
875 }
876
877 QString QgsWmsParameters::x() const
878 {
879 return mWmsParameters.value( QgsWmsParameter::X ).toString();
880 }
881
882 QString QgsWmsParameters::y() const
883 {
884 return mWmsParameters.value( QgsWmsParameter::Y ).toString();
885 }
886
888 {
889 return mWmsParameters.value( QgsWmsParameter::X ).toInt();
890 }
891
893 {
894 return mWmsParameters.value( QgsWmsParameter::Y ).toInt();
895 }
896
898 {
899 return mWmsParameters.value( QgsWmsParameter::RULE ).toString();
900 }
901
903 {
904 return mWmsParameters.value( QgsWmsParameter::SHOWRULEDETAILS ).toBool();
905 }
906
908 {
909 return mWmsParameters.value( QgsWmsParameter::RULELABEL ).toString();
910 }
911
913 {
914 return mWmsParameters.value( QgsWmsParameter::RULELABEL ).toBool();
915 }
916
918 {
919 return mWmsParameters.value( QgsWmsParameter::TRANSPARENT ).toString();
920 }
921
923 {
924 return mWmsParameters.value( QgsWmsParameter::TRANSPARENT ).toBool();
925 }
926
928 {
929 return mWmsParameters.value( QgsWmsParameter::SCALE ).toString();
930 }
931
933 {
934 return mWmsParameters.value( QgsWmsParameter::SCALE ).toDouble();
935 }
936
938 {
939 return mWmsParameters.value( QgsWmsParameter::IMAGE_QUALITY ).toString();
940 }
941
943 {
944 return mWmsParameters.value( QgsWmsParameter::IMAGE_QUALITY ).toInt();
945 }
946
948 {
949 return mWmsParameters.value( QgsWmsParameter::TILED ).toString();
950 }
951
953 {
954 return mWmsParameters.value( QgsWmsParameter::TILED ).toBool();
955 }
956
958 {
959 return mWmsParameters.value( QgsWmsParameter::ADDLAYERGROUPS ).toBool();
960 }
961
963 {
964 return mWmsParameters.value( QgsWmsParameter::SHOWFEATURECOUNT ).toString();
965 }
966
968 {
969 return mWmsParameters.value( QgsWmsParameter::SHOWFEATURECOUNT ).toBool();
970 }
971
973 {
974 return mWmsParameters.value( QgsWmsParameter::FEATURE_COUNT ).toString();
975 }
976
978 {
979 return mWmsParameters.value( QgsWmsParameter::FEATURE_COUNT ).toInt();
980 }
981
983 {
984 return mWmsParameters.value( QgsWmsParameter::BOXSPACE ).toString();
985 }
986
988 {
989 return mWmsParameters.value( QgsWmsParameter::BOXSPACE ).toDouble();
990 }
991
993 {
994 return mWmsParameters.value( QgsWmsParameter::LAYERSPACE ).toString();
995 }
996
998 {
999 return mWmsParameters.value( QgsWmsParameter::LAYERSPACE ).toDouble();
1000 }
1001
1003 {
1004 return mWmsParameters.value( QgsWmsParameter::LAYERTITLESPACE ).toString();
1005 }
1006
1008 {
1009 return mWmsParameters.value( QgsWmsParameter::LAYERTITLESPACE ).toDouble();
1010 }
1011
1013 {
1014 return mWmsParameters.value( QgsWmsParameter::SYMBOLSPACE ).toString();
1015 }
1016
1018 {
1019 return mWmsParameters.value( QgsWmsParameter::SYMBOLSPACE ).toDouble();
1020 }
1021
1023 {
1024 return mWmsParameters.value( QgsWmsParameter::SYMBOLHEIGHT ).toString();
1025 }
1026
1028 {
1029 return mWmsParameters.value( QgsWmsParameter::SYMBOLHEIGHT ).toDouble();
1030 }
1031
1033 {
1034 return mWmsParameters.value( QgsWmsParameter::SYMBOLWIDTH ).toString();
1035 }
1036
1038 {
1039 return mWmsParameters.value( QgsWmsParameter::SYMBOLWIDTH ).toDouble();
1040 }
1041
1043 {
1044 return mWmsParameters.value( QgsWmsParameter::ICONLABELSPACE ).toString();
1045 }
1046
1048 {
1049 return mWmsParameters.value( QgsWmsParameter::ICONLABELSPACE ).toDouble();
1050 }
1051
1053 {
1054 return mWmsParameters.value( QgsWmsParameter::LAYERFONTFAMILY ).toString();
1055 }
1056
1058 {
1059 return mWmsParameters.value( QgsWmsParameter::ITEMFONTFAMILY ).toString();
1060 }
1061
1063 {
1064 return mWmsParameters.value( QgsWmsParameter::LAYERFONTBOLD ).toString();
1065 }
1066
1068 {
1069 return mWmsParameters.value( QgsWmsParameter::LAYERFONTBOLD ).toBool();
1070 }
1071
1073 {
1074 return mWmsParameters.value( QgsWmsParameter::ITEMFONTBOLD ).toString();
1075 }
1076
1078 {
1079 return mWmsParameters.value( QgsWmsParameter::FI_POLYGON_TOLERANCE ).toString();
1080 }
1081
1083 {
1084 return mWmsParameters.value( QgsWmsParameter::FI_LINE_TOLERANCE ).toString();
1085 }
1086
1088 {
1089 return mWmsParameters.value( QgsWmsParameter::FI_POINT_TOLERANCE ).toString();
1090 }
1091
1093 {
1094 return mWmsParameters.value( QgsWmsParameter::FI_POLYGON_TOLERANCE ).toInt();
1095 }
1096
1098 {
1099 return mWmsParameters.value( QgsWmsParameter::FI_LINE_TOLERANCE ).toInt();
1100 }
1101
1103 {
1104 return mWmsParameters.value( QgsWmsParameter::FI_POINT_TOLERANCE ).toInt();
1105 }
1106
1108 {
1109 return mWmsParameters.value( QgsWmsParameter::ITEMFONTBOLD ).toBool();
1110 }
1111
1113 {
1114 return mWmsParameters.value( QgsWmsParameter::LAYERFONTITALIC ).toString();
1115 }
1116
1118 {
1119 return mWmsParameters.value( QgsWmsParameter::LAYERFONTITALIC ).toBool();
1120 }
1121
1123 {
1124 return mWmsParameters.value( QgsWmsParameter::ITEMFONTITALIC ).toString();
1125 }
1126
1128 {
1129 return mWmsParameters.value( QgsWmsParameter::ITEMFONTITALIC ).toBool();
1130 }
1131
1133 {
1134 return mWmsParameters.value( QgsWmsParameter::LAYERFONTSIZE ).toString();
1135 }
1136
1138 {
1139 return mWmsParameters.value( QgsWmsParameter::LAYERFONTSIZE ).toDouble();
1140 }
1141
1143 {
1144 return mWmsParameters.value( QgsWmsParameter::LAYERFONTCOLOR ).toString();
1145 }
1146
1148 {
1149 return mWmsParameters.value( QgsWmsParameter::LAYERFONTCOLOR ).toColor();
1150 }
1151
1153 {
1154 return mWmsParameters.value( QgsWmsParameter::ITEMFONTSIZE ).toString();
1155 }
1156
1158 {
1159 return mWmsParameters.value( QgsWmsParameter::ITEMFONTSIZE ).toDouble();
1160 }
1161
1163 {
1164 return mWmsParameters.value( QgsWmsParameter::ITEMFONTCOLOR ).toString();
1165 }
1166
1168 {
1169 return mWmsParameters.value( QgsWmsParameter::ITEMFONTCOLOR ).toColor();
1170 }
1171
1173 {
1174 QFont font;
1175 font.fromString( "" );
1176 font.setBold( layerFontBoldAsBool() );
1177 font.setItalic( layerFontItalicAsBool() );
1178
1179 if ( !layerFontSize().isEmpty() )
1180 font.setPointSizeF( layerFontSizeAsDouble() );
1181
1182 if ( !layerFontFamily().isEmpty() )
1184
1185 return font;
1186 }
1187
1189 {
1190 QFont font;
1191 font.fromString( "" );
1192
1193 font.setBold( itemFontBoldAsBool() );
1194 font.setItalic( itemFontItalicAsBool() );
1195
1196 if ( !itemFontSize().isEmpty() )
1197 font.setPointSizeF( itemFontSizeAsDouble() );
1198
1199 if ( !itemFontFamily().isEmpty() )
1201
1202 return font;
1203 }
1204
1206 {
1207 return mWmsParameters.value( QgsWmsParameter::LAYERTITLE ).toString();
1208 }
1209
1211 {
1212 return mWmsParameters.value( QgsWmsParameter::LAYERTITLE ).toBool();
1213 }
1214
1216 {
1217 QgsLegendSettings settings;
1218 settings.setTitle( QString() );
1219 settings.setBoxSpace( boxSpaceAsDouble() );
1220 settings.setSymbolSize( QSizeF( symbolWidthAsDouble(), symbolHeightAsDouble() ) );
1221
1224
1225 // text format must be set before setting the format's colors
1228
1229 if ( !itemFontColor().isEmpty() )
1230 {
1235 }
1236
1237 // Ok, this is tricky: because QgsLegendSettings's layerFontColor was added to the API after
1238 // fontColor, to fix regressions #21871 and #21870 and the previous behavior was to use fontColor
1239 // for the whole legend we need to preserve that behavior.
1240 // But, the 2.18 server parameters ITEMFONTCOLOR did not have effect on the layer titles too, so
1241 // we set explicitly layerFontColor to black if it's not overridden by LAYERFONTCOLOR argument.
1242 settings.rstyle( Qgis::LegendComponent::Group ).textFormat().setColor( layerFontColor().isEmpty() ? QColor( Qt::black ) : layerFontColorAsColor() );
1243 settings.rstyle( Qgis::LegendComponent::Subgroup ).textFormat().setColor( layerFontColor().isEmpty() ? QColor( Qt::black ) : layerFontColorAsColor() );
1244
1247
1248 // When processing a request involving an upstream WMS server, any responses from such a remote
1249 // server must be awaited. This was not the case for GetLegendGraphic requests (#42063). If not,
1250 // the response to the current request will never contain any data from upstream.
1251 // A quick way to fix this is to force upstream `GetLegendRequest' requests to be synchronous.
1252 // The problem with this approach is that if the GetLegendGraphic contains multiple layers, the
1253 // remote calls are made one at a time. This increases the response time. Making concurrent
1254 // asynchronous requests and waiting for them all would be a better approach.
1255 settings.setSynchronousLegendRequests( true );
1256
1257 return settings;
1258 }
1259
1260 QString QgsWmsParameters::layoutParameter( const QString &id, bool &ok ) const
1261 {
1262 QString label;
1263 ok = false;
1264
1265 if ( mUnmanagedParameters.contains( id.toUpper() ) )
1266 {
1267 label = mUnmanagedParameters[id.toUpper()];
1268 ok = true;
1269 }
1270
1271 return label;
1272 }
1273
1274 QStringList QgsWmsParameters::atlasPk() const
1275 {
1276 return mWmsParameters.value( QgsWmsParameter::ATLAS_PK ).toStringList();
1277 }
1278
1280 {
1281 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSTRING ).toStringList( ';', false );
1282 }
1283
1285 {
1286 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toStringList( ';', false );
1287 }
1288
1290 {
1291 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELSIZE ).toIntList( ';', false );
1292 }
1293
1295 {
1296 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toStringList( ';', false );
1297 }
1298
1300 {
1301 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELCOLOR ).toColorList( ';', false );
1302 }
1303
1305 {
1306 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toStringList( ';', false );
1307 }
1308
1310 {
1311 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ).toIntList( ';', false );
1312 }
1313
1315 {
1316 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFONT ).toStringList( ';', false );
1317 }
1318
1320 {
1321 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toStringList( ';', false );
1322 }
1323
1325 {
1326 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ).toColorList( ';', false );
1327 }
1328
1330 {
1331 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toStringList( ';', false );
1332 }
1333
1335 {
1336 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ).toDoubleList( ';', false );
1337 }
1338
1340 {
1341 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMEBACKGROUNDCOLOR ).toStringList( ';', false );
1342 }
1343
1345 {
1346 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMEBACKGROUNDCOLOR ).toColorList( ';', false );
1347 }
1348
1350 {
1351 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINECOLOR ).toStringList( ';', false );
1352 }
1353
1355 {
1356 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINECOLOR ).toColorList( ';', false );
1357 }
1358
1360 {
1361 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINEWIDTH ).toStringList( ';', false );
1362 }
1363
1365 {
1366 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINEWIDTH ).toDoubleList( ';', false );
1367 }
1368
1370 {
1371 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMESIZE ).toStringList( ';', false );
1372 }
1373
1375 {
1376 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABELFRAMESIZE ).toDoubleList( ';', false );
1377 }
1378
1380 {
1381 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION ).toDoubleList( ';', false );
1382 }
1383
1385 {
1386 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE ).toDoubleList( ';', false );
1387 }
1388
1390 {
1391 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT ).toStringList( ';', false );
1392 }
1393
1395 {
1396 return mWmsParameters.value( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT ).toStringList( ';', false );
1397 }
1398
1400 {
1401 return mWmsParameters.value( QgsWmsParameter::WMS_PRECISION ).toString();
1402 }
1403
1405 {
1406 return mWmsParameters.value( QgsWmsParameter::WMS_PRECISION ).toInt();
1407 }
1408
1410 {
1411 return mWmsParameters.value( QgsWmsParameter::SLD_BODY ).toString();
1412 }
1413
1414 QStringList QgsWmsParameters::filters() const
1415 {
1416 QStringList filters = mWmsParameters.value( QgsWmsParameter::FILTER ).toOgcFilterList();
1417 if ( filters.isEmpty() )
1418 filters = mWmsParameters.value( QgsWmsParameter::FILTER ).toExpressionList();
1419 return filters;
1420 }
1421
1423 {
1424 return mWmsParameters.value( QgsWmsParameter::FILTER_GEOM ).toString();
1425 }
1426
1428 {
1429 return mWmsParameters.value( QgsWmsParameter::SELECTION ).toStringList( ';' );
1430 }
1431
1433 {
1434 return mWmsParameters.value( QgsWmsParameter::OPACITIES ).toStringList();
1435 }
1436
1438 {
1439 return mWmsParameters.value( QgsWmsParameter::OPACITIES ).toIntList();
1440 }
1441
1443 {
1444 // We don't want duplicates but order does matter, so no QSet
1445 QStringList result;
1446
1447 // LAYER
1448 QList<QgsWmsParameter> cLayer { mWmsParameters.values( QgsWmsParameter::LAYER ) };
1449 // Sort by map id
1450 std::sort( cLayer.begin(), cLayer.end(), []( const QgsWmsParameter &a, const QgsWmsParameter &b ) -> bool { return a.mMapId < b.mMapId; } );
1451 for ( const QgsWmsParameter &param : std::as_const( cLayer ) )
1452 {
1453 const QStringList layersList { param.toStringList() };
1454 for ( const QString &layerName : std::as_const( layersList ) )
1455 {
1456 if ( !result.contains( layerName ) )
1457 result.append( layerName );
1458 }
1459 }
1460
1461 // LAYERS
1462 QList<QgsWmsParameter> cLayers { mWmsParameters.values( QgsWmsParameter::LAYERS ) };
1463 // Sort by map id
1464 std::sort( cLayers.begin(), cLayers.end(), []( const QgsWmsParameter &a, const QgsWmsParameter &b ) -> bool { return a.mMapId < b.mMapId; } );
1465 for ( const QgsWmsParameter &param : std::as_const( cLayers ) )
1466 {
1467 const QStringList layersList { param.toStringList() };
1468 for ( const QString &layerName : std::as_const( layersList ) )
1469 {
1470 if ( !result.contains( layerName ) )
1471 result.append( layerName );
1472 }
1473 }
1474 return result;
1475 }
1476
1478 {
1479 return mWmsParameters.value( QgsWmsParameter::QUERY_LAYERS ).toStringList();
1480 }
1481
1483 {
1484 QStringList style = mWmsParameters.value( QgsWmsParameter::STYLE ).toStyleList();
1485 const QStringList styles = mWmsParameters.value( QgsWmsParameter::STYLES ).toStyleList();
1486 return style << styles;
1487 }
1488
1489 QMultiMap<QString, QgsWmsParametersFilter> QgsWmsParameters::layerFilters( const QStringList &layers ) const
1490 {
1491 const QString nsWfs2 = u"http://www.opengis.net/fes/2.0"_s;
1492 const QString prefixWfs2 = u"<fes:"_s;
1493
1494 const QStringList rawFilters = filters();
1495 QMultiMap<QString, QgsWmsParametersFilter> filters;
1496 for ( int i = 0; i < rawFilters.size(); i++ )
1497 {
1498 const QString f = rawFilters[i];
1499 if ( f.startsWith( '<'_L1 ) && f.endsWith( "Filter>"_L1 ) && i < layers.size() )
1500 {
1502 filter.mFilter = f;
1505
1506 if ( filter.mFilter.contains( nsWfs2 ) || filter.mFilter.contains( prefixWfs2 ) )
1507 {
1509 }
1510
1511 filters.insert( layers[i], filter );
1512 }
1513 else if ( !f.isEmpty() )
1514 {
1515 // filter format: "LayerName,LayerName2:filterString;LayerName3:filterString2;..."
1516 // several filters can be defined for one layer
1517 const int colonIndex = f.indexOf( ':' );
1518 if ( colonIndex != -1 )
1519 {
1520 const QString layers = f.section( ':', 0, 0 );
1521 const QString filter = f.section( ':', 1 );
1522 const QStringList layersList = layers.split( ',' );
1523 for ( const QString &layer : layersList )
1524 {
1525 QgsWmsParametersFilter parametersFilter;
1526 parametersFilter.mFilter = filter;
1527 parametersFilter.mType = QgsWmsParametersFilter::SQL;
1528 filters.insert( layer, parametersFilter );
1529 }
1530 }
1531 else
1532 {
1533 QString filterStr = mWmsParameters.value( QgsWmsParameter::FILTER ).toString();
1534 raiseError( u"FILTER ('"_s + filterStr + u"') is not properly formatted"_s );
1535 }
1536 }
1537 }
1538 return filters;
1539 }
1540
1542 {
1543 bool force2D = false;
1544 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1545
1546 if ( options.contains( DxfFormatOption::FORCE_2D ) )
1547 {
1548 force2D = QVariant( options[DxfFormatOption::FORCE_2D] ).toBool();
1549 }
1550
1551 return force2D;
1552 }
1553
1555 {
1556 bool zeroWidth = false;
1557 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1558
1559 if ( options.contains( DxfFormatOption::EXPORT_LINES_WITH_ZERO_WIDTH ) )
1560 {
1561 zeroWidth = QVariant( options[DxfFormatOption::EXPORT_LINES_WITH_ZERO_WIDTH] ).toBool();
1562 }
1563
1564 return zeroWidth;
1565 }
1566
1568 {
1569 bool noMText = false;
1570 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1571
1572 if ( options.contains( DxfFormatOption::NO_MTEXT ) )
1573 {
1574 noMText = QVariant( options[DxfFormatOption::NO_MTEXT] ).toBool();
1575 }
1576
1577 return noMText;
1578 }
1579
1580
1581 QList<QgsWmsParametersLayer> QgsWmsParameters::layersParameters() const
1582 {
1583 const QStringList layers = allLayersNickname();
1584 const QStringList styles = allStyles();
1585 const QStringList selection = selections();
1586 const QList<int> opacities = opacitiesAsInt();
1587 const QMultiMap<QString, QgsWmsParametersFilter> filters = layerFilters( layers );
1588
1589 // selection format: "LayerName:id0,id1;LayerName2:id0,id1;..."
1590 // several filters can be defined for one layer
1591 QMultiMap<QString, QString> layerSelections;
1592 for ( const QString &s : selection )
1593 {
1594 const QStringList splits = s.split( ':' );
1595 if ( splits.size() == 2 )
1596 {
1597 layerSelections.insert( splits[0], splits[1] );
1598 }
1599 else
1600 {
1601 QString selStr = mWmsParameters.value( QgsWmsParameter::SELECTION ).toString();
1602 raiseError( u"SELECTION ('"_s + selStr + u"') is not properly formatted"_s );
1603 }
1604 }
1605
1606 QList<QgsWmsParametersLayer> parameters;
1607 for ( int i = 0; i < layers.size(); i++ )
1608 {
1609 QString layer = layers[i];
1610
1612 param.mNickname = layer;
1613
1614 if ( i < opacities.count() )
1615 param.mOpacity = opacities[i];
1616
1617 if ( isExternalLayer( layer ) )
1618 {
1619 const QgsWmsParametersExternalLayer extParam = externalLayerParameter( layer );
1620 param.mNickname = extParam.mName;
1621 param.mExternalUri = extParam.mUri;
1622 }
1623 else
1624 {
1625 if ( i < styles.count() )
1626 param.mStyle = styles[i];
1627
1628 if ( filters.contains( layer ) )
1629 {
1630 auto it = filters.find( layer );
1631 while ( it != filters.end() && it.key() == layer )
1632 {
1633 param.mFilter.append( it.value() );
1634 ++it;
1635 }
1636 }
1637
1638 if ( layerSelections.contains( layer ) )
1639 {
1640 QMultiMap<QString, QString>::const_iterator it;
1641 it = layerSelections.constFind( layer );
1642 while ( it != layerSelections.constEnd() && it.key() == layer )
1643 {
1644 param.mSelection << it.value().split( ',' );
1645 ++it;
1646 }
1647 }
1648 }
1649
1650 parameters.append( param );
1651 }
1652
1653 return parameters;
1654 }
1655
1656 QList<QgsWmsParametersHighlightLayer> QgsWmsParameters::highlightLayersParameters() const
1657 {
1658 QList<QgsWmsParametersHighlightLayer> params;
1659 const QList<QgsGeometry> geoms = highlightGeomAsGeom();
1660 const QStringList slds = highlightSymbol();
1661 const QStringList labels = highlightLabelString();
1662 const QList<QColor> colors = highlightLabelColorAsColor();
1663 const QList<int> sizes = highlightLabelSizeAsInt();
1664 const QList<int> weights = highlightLabelWeightAsInt();
1665 const QStringList fonts = highlightLabelFont();
1666 const QList<QColor> bufferColors = highlightLabelBufferColorAsColor();
1667 const QList<double> bufferSizes = highlightLabelBufferSizeAsFloat();
1668 const QList<QColor> frameBackgroundColors = highlightLabelFrameBackgroundColorAsColor();
1669 const QList<QColor> frameOutlineColors = highlightLabelFrameOutlineColorAsColor();
1670 const QList<double> frameOutlineWidths = highlightLabelFrameOutlineWidthAsFloat();
1671 const QList<double> frameSizes = highlightLabelFrameSizeAsFloat();
1672 const QList<double> rotation = highlightLabelRotation();
1673 const QList<double> distance = highlightLabelDistance();
1674 const QStringList hali = highlightLabelHorizontalAlignment();
1675 const QStringList vali = highlightLabelVerticalAlignment();
1676
1677 int nLayers = std::min( geoms.size(), slds.size() );
1678 for ( int i = 0; i < nLayers; i++ )
1679 {
1681 param.mName = u"highlight_"_s + QString::number( i );
1682 param.mGeom = geoms[i];
1683 param.mSld = slds[i];
1684
1685 if ( i < labels.count() )
1686 param.mLabel = labels[i];
1687
1688 if ( i < colors.count() )
1689 param.mColor = colors[i];
1690
1691 if ( i < sizes.count() )
1692 param.mSize = sizes[i];
1693
1694 if ( i < weights.count() )
1695 param.mWeight = weights[i];
1696
1697 if ( i < fonts.count() )
1698 param.mFont = fonts[i];
1699
1700 if ( i < bufferColors.count() )
1701 param.mBufferColor = bufferColors[i];
1702
1703 if ( i < bufferSizes.count() )
1704 param.mBufferSize = bufferSizes[i];
1705
1706 if ( i < frameBackgroundColors.count() )
1707 param.mFrameBackgroundColor = frameBackgroundColors[i];
1708
1709 if ( i < frameOutlineColors.count() )
1710 param.mFrameOutlineColor = frameOutlineColors[i];
1711
1712 if ( i < frameOutlineWidths.count() )
1713 param.mFrameOutlineWidth = frameOutlineWidths[i];
1714
1715 if ( i < frameSizes.count() )
1716 param.mFrameSize = frameSizes[i];
1717
1718 if ( i < rotation.count() )
1719 param.mLabelRotation = rotation[i];
1720
1721 if ( i < distance.count() )
1722 param.mLabelDistance = distance[i];
1723
1724 if ( i < hali.count() )
1725 param.mHali = hali[i];
1726
1727 if ( i < vali.count() )
1728 param.mVali = vali[i];
1729
1730
1731 params.append( param );
1732 }
1733
1734 return params;
1735 }
1736
1737 QList<QgsWmsParametersExternalLayer> QgsWmsParameters::externalLayersParameters() const
1738 {
1739 auto notExternalLayer = []( const QString &name ) { return !QgsWmsParameters::isExternalLayer( name ); };
1740
1741 QList<QgsWmsParametersExternalLayer> externalLayers;
1742
1743 QStringList layers = allLayersNickname();
1744 QStringList::iterator rit = std::remove_if( layers.begin(), layers.end(), notExternalLayer );
1745
1746 for ( QStringList::iterator it = layers.begin(); it != rit; ++it )
1747 {
1748 externalLayers << externalLayerParameter( *it );
1749 }
1750
1751 return externalLayers;
1752 }
1753
1755 {
1756 return mWmsParameters.value( QgsWmsParameter::BGCOLOR ).toString();
1757 }
1758
1760 {
1761 return mWmsParameters.value( QgsWmsParameter::BGCOLOR ).toColor();
1762 }
1763
1765 {
1766 return mWmsParameters.value( QgsWmsParameter::TEMPLATE ).toString();
1767 }
1768
1770 {
1771 QgsWmsParameter wmsParam;
1773 param.mId = mapId;
1774
1775 QString pMapId = u"MAP"_s + QString::number( mapId );
1776
1777 wmsParam = idParameter( QgsWmsParameter::EXTENT, mapId );
1778 QgsRectangle extent;
1779 if ( wmsParam.isValid() )
1780 {
1781 extent = wmsParam.toRectangle();
1782 }
1783
1784 param.mHasExtent = !extent.isEmpty();
1785 param.mExtent = extent;
1786
1787 // scale
1788 wmsParam = idParameter( QgsWmsParameter::SCALE, mapId );
1789 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1790 {
1791 param.mScale = wmsParam.toDouble();
1792 }
1793
1794 // rotation
1795 wmsParam = idParameter( QgsWmsParameter::ROTATION, mapId );
1796 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1797 {
1798 param.mRotation = wmsParam.toDouble();
1799 }
1800
1801 //grid space x / y
1802 double gridx( -1 ), gridy( -1 );
1803
1804 wmsParam = idParameter( QgsWmsParameter::GRID_INTERVAL_X, mapId );
1805 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1806 {
1807 gridx = wmsParam.toDouble();
1808 }
1809
1810 wmsParam = idParameter( QgsWmsParameter::GRID_INTERVAL_Y, mapId );
1811 if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1812 {
1813 gridy = wmsParam.toDouble();
1814 }
1815
1816 if ( gridx >= 0 && gridy >= 0 )
1817 {
1818 param.mGridX = gridx;
1819 param.mGridY = gridy;
1820 }
1821
1822 //layers
1823 QStringList allLayers;
1824 wmsParam = idParameter( QgsWmsParameter::LAYERS, mapId );
1825 if ( wmsParam.isValid() )
1826 {
1827 allLayers = wmsParam.toStringList();
1828 }
1829
1830 // external layers
1831 QStringList layers;
1832
1833 for ( const auto &layer : std::as_const( allLayers ) )
1834 {
1835 if ( isExternalLayer( layer ) )
1836 {
1837 const QgsWmsParametersExternalLayer extParam = externalLayerParameter( layer );
1838 layers << extParam.mName;
1839 }
1840 else
1841 {
1842 layers << layer;
1843 }
1844 }
1845
1846 QStringList styles;
1847 wmsParam = idParameter( QgsWmsParameter::STYLES, mapId );
1848 if ( wmsParam.isValid() )
1849 {
1850 styles = wmsParam.toStyleList();
1851 }
1852
1853 QList<QgsWmsParametersLayer> lParams;
1854 for ( int i = 0; i < layers.size(); i++ )
1855 {
1856 QString layer = layers[i];
1857 QgsWmsParametersLayer lParam;
1858 lParam.mNickname = layer;
1859
1860 if ( i < styles.count() )
1861 lParam.mStyle = styles[i];
1862
1863 lParams.append( lParam );
1864 }
1865 param.mLayers = lParams;
1866
1867 //highlight layers
1868 QList<QgsWmsParametersHighlightLayer> hParams;
1869
1870 QList<QgsGeometry> geoms;
1871 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_GEOM, mapId );
1872 if ( wmsParam.isValid() )
1873 {
1874 geoms = wmsParam.toGeomList( ';', false );
1875 }
1876
1877 QStringList slds;
1878 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_SYMBOL, mapId );
1879 if ( wmsParam.isValid() )
1880 {
1881 slds = wmsParam.toStringList( ';', false );
1882 }
1883
1884 QStringList labels;
1885 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSTRING, mapId );
1886 if ( wmsParam.isValid() )
1887 {
1888 labels = wmsParam.toStringList( ';', false );
1889 }
1890
1891 QStringList fonts;
1892 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFONT, mapId );
1893 if ( wmsParam.isValid() )
1894 {
1895 fonts = wmsParam.toStringList( ';', false );
1896 }
1897
1898 QList<QColor> colors;
1899 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELCOLOR, mapId );
1900 if ( wmsParam.isValid() )
1901 {
1902 colors = wmsParam.toColorList( ';', false );
1903 }
1904
1905 QList<int> sizes;
1906 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSIZE, mapId );
1907 if ( wmsParam.isValid() )
1908 {
1909 sizes = wmsParam.toIntList( ';', false );
1910 }
1911
1912 QList<int> weights;
1913 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT, mapId );
1914 if ( wmsParam.isValid() )
1915 {
1916 weights = wmsParam.toIntList( ';', false );
1917 }
1918
1919 QList<QColor> bufferColors;
1920 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR, mapId );
1921 if ( wmsParam.isValid() )
1922 {
1923 bufferColors = wmsParam.toColorList( ';', false );
1924 }
1925
1926 QList<double> bufferSizes;
1927 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE, mapId );
1928 if ( wmsParam.isValid() )
1929 {
1930 bufferSizes = wmsParam.toDoubleList( ';', false );
1931 }
1932
1933 QList<QColor> frameBackgroundColors;
1934 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFRAMEBACKGROUNDCOLOR, mapId );
1935 if ( wmsParam.isValid() )
1936 {
1937 frameBackgroundColors = wmsParam.toColorList( ';', false );
1938 }
1939
1940 QList<QColor> frameOutlineColors;
1941 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINECOLOR, mapId );
1942 if ( wmsParam.isValid() )
1943 {
1944 frameOutlineColors = wmsParam.toColorList( ';', false );
1945 }
1946
1947 QList<double> frameOutlineWidths;
1948 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFRAMEOUTLINEWIDTH, mapId );
1949 if ( wmsParam.isValid() )
1950 {
1951 frameOutlineWidths = wmsParam.toDoubleList( ';', false );
1952 }
1953
1954 QList<double> frameSizes;
1955 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFRAMESIZE, mapId );
1956 if ( wmsParam.isValid() )
1957 {
1958 frameSizes = wmsParam.toDoubleList( ';', false );
1959 }
1960
1961 QList<double> rotations;
1962 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_ROTATION, mapId );
1963 if ( wmsParam.isValid() )
1964 {
1965 rotations = wmsParam.toDoubleList( ';', false );
1966 }
1967
1968 QList<double> distances;
1969 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_DISTANCE, mapId );
1970 if ( wmsParam.isValid() )
1971 {
1972 distances = wmsParam.toDoubleList( ';', false );
1973 }
1974
1975 QStringList halis;
1976 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT, mapId );
1977 if ( wmsParam.isValid() )
1978 {
1979 halis = wmsParam.toStringList( ';', false );
1980 }
1981
1982 QStringList valis;
1983 wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT, mapId );
1984 if ( wmsParam.isValid() )
1985 {
1986 valis = wmsParam.toStringList( ';', false );
1987 }
1988
1989 int nHLayers = std::min( geoms.size(), slds.size() );
1990 for ( int i = 0; i < nHLayers; i++ )
1991 {
1993 hParam.mName = pMapId + u"_highlight_"_s + QString::number( i );
1994 hParam.mGeom = geoms[i];
1995 hParam.mSld = slds[i];
1996
1997 if ( i < labels.count() )
1998 hParam.mLabel = labels[i];
1999
2000 if ( i < colors.count() )
2001 hParam.mColor = colors[i];
2002
2003 if ( i < sizes.count() )
2004 hParam.mSize = sizes[i];
2005
2006 if ( i < weights.count() )
2007 hParam.mWeight = weights[i];
2008
2009 if ( i < fonts.count() )
2010 hParam.mFont = fonts[i];
2011
2012 if ( i < bufferColors.count() )
2013 hParam.mBufferColor = bufferColors[i];
2014
2015 if ( i < frameBackgroundColors.count() )
2016 hParam.mFrameBackgroundColor = frameBackgroundColors[i];
2017
2018 if ( i < frameOutlineColors.count() )
2019 hParam.mFrameOutlineColor = frameOutlineColors[i];
2020
2021 if ( i < frameOutlineWidths.count() )
2022 hParam.mFrameOutlineWidth = frameOutlineWidths[i];
2023
2024 if ( i < frameSizes.count() )
2025 hParam.mFrameSize = frameSizes[i];
2026
2027 if ( i < bufferSizes.count() )
2028 hParam.mBufferSize = bufferSizes[i];
2029
2030 if ( i < rotations.count() )
2031 hParam.mLabelRotation = rotations[i];
2032
2033 if ( i < distances.count() )
2034 hParam.mLabelDistance = distances[i];
2035
2036 if ( i < halis.count() )
2037 hParam.mHali = halis[i];
2038
2039 if ( i < valis.count() )
2040 hParam.mVali = valis[i];
2041
2042 hParams.append( hParam );
2043 }
2044 param.mHighlightLayers = hParams;
2045
2046 return param;
2047 }
2048
2049 QString QgsWmsParameters::externalWMSUri( const QString &layerId ) const
2050 {
2051 // Param names may be uppercased.
2052 QString id { layerId };
2053
2054 for ( auto it = mExternalWMSParameters.cbegin(); it != mExternalWMSParameters.cend(); ++it )
2055 {
2056 if ( it.key().compare( id, Qt::CaseSensitivity::CaseInsensitive ) == 0 )
2057 {
2058 id = it.key();
2059 break;
2060 }
2061 }
2062
2063 if ( !mExternalWMSParameters.contains( id ) )
2064 {
2065 return QString();
2066 }
2067
2068 QgsDataSourceUri wmsUri;
2069 const QMap<QString, QString> &paramMap = mExternalWMSParameters[id];
2070 QMap<QString, QString>::const_iterator paramIt = paramMap.constBegin();
2071 for ( ; paramIt != paramMap.constEnd(); ++paramIt )
2072 {
2073 QString paramName = paramIt.key().toLower();
2074 if ( paramName == "layers"_L1 || paramName == "styles"_L1 || paramName == "opacities"_L1 )
2075 {
2076 const QStringList values = paramIt.value().split( ',' );
2077 for ( const QString &value : values )
2078 wmsUri.setParam( paramName, value );
2079 }
2080 else if ( paramName == "ignorereportedlayerextents"_L1 )
2081 {
2082 wmsUri.setParam( u"IgnoreReportedLayerExtents"_s, paramIt.value() );
2083 }
2084 else if ( paramName == "smoothpixmaptransform"_L1 )
2085 {
2086 wmsUri.setParam( u"SmoothPixmapTransform"_s, paramIt.value() );
2087 }
2088 else if ( paramName == "ignoregetmapurl"_L1 )
2089 {
2090 wmsUri.setParam( u"IgnoreGetMapUrl"_s, paramIt.value() );
2091 }
2092 else if ( paramName == "ignoregetfeatureinfourl"_L1 )
2093 {
2094 wmsUri.setParam( u"IgnoreGetFeatureInfoUrl"_s, paramIt.value() );
2095 }
2096 else if ( paramName == "ignoreaxisorientation"_L1 )
2097 {
2098 wmsUri.setParam( u"IgnoreAxisOrientation"_s, paramIt.value() );
2099 }
2100 else if ( paramName == "invertaxisorientation"_L1 )
2101 {
2102 wmsUri.setParam( u"InvertAxisOrientation"_s, paramIt.value() );
2103 }
2104 else if ( paramName == "dpimode"_L1 )
2105 {
2106 wmsUri.setParam( u"dpiMode"_s, paramIt.value() );
2107 }
2108 else if ( paramName == "stepwidth"_L1 )
2109 {
2110 wmsUri.setParam( u"stepWidth"_s, paramIt.value() );
2111 }
2112 else if ( paramName == "stepheight"_L1 )
2113 {
2114 wmsUri.setParam( u"stepHeight"_s, paramIt.value() );
2115 }
2116 else
2117 {
2118 wmsUri.setParam( paramName, paramIt.value() );
2119 }
2120 }
2121 return wmsUri.encodedUri();
2122 }
2123
2125 {
2126 return mWmsParameters.value( QgsWmsParameter::WITH_GEOMETRY ).toBool();
2127 }
2128
2130 {
2131 return mWmsParameters.value( QgsWmsParameter::WITH_MAPTIP ).toString();
2132 }
2133
2135 {
2136 const QString mStr = withMapTipAsString();
2137
2138 if ( mStr.startsWith( "true"_L1, Qt::CaseInsensitive ) || mStr.startsWith( "on"_L1, Qt::CaseInsensitive ) || mStr.startsWith( "yes"_L1, Qt::CaseInsensitive ) || mStr.startsWith( '1'_L1 ) )
2139 return true;
2140 else
2141 return false;
2142 }
2143
2145 {
2146 const QString mStr = withMapTipAsString();
2147
2148 if ( mStr.startsWith( "html_fi_only_maptip"_L1, Qt::CaseInsensitive ) )
2149 return true;
2150 else
2151 return false;
2152 }
2153
2155 {
2156 return mWmsParameters.value( QgsWmsParameter::WITH_DISPLAY_NAME ).toBool();
2157 }
2158
2160 {
2161 return mWmsParameters.value( QgsWmsParameter::WMTVER ).toString();
2162 }
2163
2164 void QgsWmsParameters::log( const QString &msg, const char *file, const char *function, int line ) const
2165 {
2166 QgsMessageLog::logMessage( msg, u"Server"_s, Qgis::MessageLevel::Info, true, file, function, line );
2167 }
2168
2169 void QgsWmsParameters::raiseError( const QString &msg ) const
2170 {
2172 }
2173
2174 QgsWmsParameter QgsWmsParameters::idParameter( const QgsWmsParameter::Name name, const int id ) const
2175 {
2176 QgsWmsParameter p;
2177
2178 for ( const auto &param : mWmsParameters.values( name ) )
2179 {
2180 if ( param.mMapId == id )
2181 {
2182 p = param;
2183 }
2184 }
2185
2186 return p;
2187 }
2188
2189 QgsWmsParametersExternalLayer QgsWmsParameters::externalLayerParameter( const QString &name ) const
2190 {
2191 QgsWmsParametersExternalLayer param;
2192
2193 param.mName = name;
2194 param.mName.remove( 0, EXTERNAL_LAYER_PREFIX.size() );
2195 param.mUri = externalWMSUri( param.mName );
2196
2197 return param;
2198 }
2199
2200 bool QgsWmsParameters::isExternalLayer( const QString &name )
2201 {
2202 return name.startsWith( EXTERNAL_LAYER_PREFIX );
2203 }
2204
2206 {
2207 QStringList attributes;
2208 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2209
2210 if ( options.contains( DxfFormatOption::LAYERATTRIBUTES ) )
2211 {
2212 attributes = options[DxfFormatOption::LAYERATTRIBUTES].split( ',' );
2213 }
2214
2215 return attributes;
2216 }
2217
2219 {
2220 bool use = false;
2221 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2222
2223 if ( options.contains( DxfFormatOption::USE_TITLE_AS_LAYERNAME ) )
2224 {
2225 use = QVariant( options[DxfFormatOption::USE_TITLE_AS_LAYERNAME] ).toBool();
2226 }
2227
2228 return use;
2229 }
2230
2232 {
2233 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2234
2235 double scale = -1;
2236 if ( options.contains( DxfFormatOption::SCALE ) )
2237 {
2238 scale = options[DxfFormatOption::SCALE].toDouble();
2239 }
2240
2241 return scale;
2242 }
2243
2245 {
2246 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2247
2249
2250 if ( !options.contains( DxfFormatOption::MODE ) )
2251 {
2252 return symbol;
2253 }
2254
2255 const QString mode = options[DxfFormatOption::MODE];
2256 if ( mode.compare( "SymbolLayerSymbology"_L1, Qt::CaseInsensitive ) == 0 )
2257 {
2259 }
2260 else if ( mode.compare( "FeatureSymbology"_L1, Qt::CaseInsensitive ) == 0 )
2261 {
2263 }
2264
2265 return symbol;
2266 }
2267
2269 {
2270 QString codec = u"ISO-8859-1"_s;
2271
2273 {
2275 }
2276
2277 return codec;
2278 }
2279
2281 {
2282 bool geospatialPdf = false;
2283 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2284 if ( options.contains( PdfFormatOption::WRITE_GEO_PDF ) )
2285 {
2286 geospatialPdf = QVariant( options[PdfFormatOption::WRITE_GEO_PDF] ).toBool();
2287 }
2288 return geospatialPdf;
2289 }
2290
2292 {
2293 bool forceVector = false;
2294 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2295 if ( options.contains( PdfFormatOption::FORCE_VECTOR_OUTPUT ) )
2296 {
2297 forceVector = QVariant( options[PdfFormatOption::FORCE_VECTOR_OUTPUT] ).toBool();
2298 }
2299 return forceVector;
2300 }
2301
2303 {
2304 bool appendGeoref = true;
2305 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2306 if ( options.contains( PdfFormatOption::APPEND_GEOREFERENCE ) )
2307 {
2308 appendGeoref = QVariant( options[PdfFormatOption::APPEND_GEOREFERENCE] ).toBool();
2309 }
2310 return appendGeoref;
2311 }
2312
2314 {
2315 bool simplify = true;
2316 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2317 if ( options.contains( PdfFormatOption::SIMPLIFY_GEOMETRY ) )
2318 {
2319 simplify = QVariant( options[PdfFormatOption::SIMPLIFY_GEOMETRY] ).toBool();
2320 }
2321 return simplify;
2322 }
2323
2325 {
2326 bool exportMetadata = false;
2327 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2328 if ( options.contains( PdfFormatOption::EXPORT_METADATA ) )
2329 {
2330 exportMetadata = QVariant( options[PdfFormatOption::EXPORT_METADATA] ).toBool();
2331 }
2332 return exportMetadata;
2333 }
2334
2336 {
2338 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2339 if ( options.contains( PdfFormatOption::TEXT_RENDER_FORMAT ) )
2340 {
2341 if ( options[PdfFormatOption::TEXT_RENDER_FORMAT].compare( u"AlwaysText"_s, Qt::CaseInsensitive ) == 0 )
2342 {
2344 }
2345 else if ( options[PdfFormatOption::TEXT_RENDER_FORMAT].compare( u"PreferText"_s, Qt::CaseInsensitive ) == 0 )
2346 {
2348 }
2349 }
2350 return format;
2351 }
2352
2354 {
2355 bool losslessCompression = false;
2356 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2357 if ( options.contains( PdfFormatOption::LOSSLESS_IMAGE_COMPRESSION ) )
2358 {
2359 losslessCompression = QVariant( options[PdfFormatOption::LOSSLESS_IMAGE_COMPRESSION] ).toBool();
2360 }
2361 return losslessCompression;
2362 }
2363
2365 {
2366 bool disableTiledRaster = false;
2367 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2368 if ( options.contains( PdfFormatOption::DISABLE_TILED_RASTER_RENDERING ) )
2369 {
2370 disableTiledRaster = QVariant( options[PdfFormatOption::DISABLE_TILED_RASTER_RENDERING] ).toBool();
2371 }
2372 return disableTiledRaster;
2373 }
2374
2376 {
2377 bool useIso32000 = true;
2378 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2380 {
2381 useIso32000 = QVariant( options[PdfFormatOption::USE_ISO_32000_EXTENSION_FORMAT_GEOREFERENCING] ).toBool();
2382 }
2383 return useIso32000;
2384 }
2385
2387 {
2388 return false;
2389 }
2390
2392 {
2393 QStringList themes;
2394 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2395 if ( options.contains( PdfFormatOption::EXPORT_THEMES ) )
2396 {
2397 themes = options[PdfFormatOption::EXPORT_THEMES].split( ',' );
2398 }
2399 return themes;
2400 }
2401
2403 {
2404 QVector<qreal> scales;
2405 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2406 if ( options.contains( PdfFormatOption::PREDEFINED_MAP_SCALES ) )
2407 {
2408 const QStringList scaleList = options[PdfFormatOption::PREDEFINED_MAP_SCALES].split( ',' );
2409 for ( const QString &it : std::as_const( scaleList ) )
2410 {
2411 bool ok = false;
2412 qreal scale = it.toDouble( &ok );
2413 if ( ok )
2414 {
2415 scales.append( scale );
2416 }
2417 }
2418 }
2419 return scales;
2420 }
2421
2422 QMap<QString, QString> QgsWmsParameters::dimensionValues() const
2423 {
2424 QMap<QString, QString> dimValues;
2425 const QMetaEnum pnMetaEnum( QMetaEnum::fromType<QgsMapLayerServerProperties::PredefinedWmsDimensionName>() );
2426 const QStringList unmanagedNames = mUnmanagedParameters.keys();
2427 for ( const QString &key : unmanagedNames )
2428 {
2429 if ( key.startsWith( "DIM_"_L1 ) )
2430 {
2431 dimValues[key.mid( 4 )] = mUnmanagedParameters[key];
2432 }
2433 else if ( pnMetaEnum.keyToValue( key.toUpper().toStdString().c_str() ) != -1 )
2434 {
2435 dimValues[key] = mUnmanagedParameters[key];
2436 }
2437 }
2438 return dimValues;
2439 }
2440} // namespace QgsWms
@ Symbol
Symbol icon (excluding label).
Definition qgis.h:4992
@ Group
Legend group title.
Definition qgis.h:4990
@ Subgroup
Legend subgroup title.
Definition qgis.h:4991
@ Title
Legend title.
Definition qgis.h:4989
@ SymbolLabel
Symbol label (excluding icon).
Definition qgis.h:4993
@ Info
Information message.
Definition qgis.h:161
TextRenderFormat
Options for rendering text.
Definition qgis.h:2991
@ PreferText
Render text as text objects, unless doing so results in rendering artifacts or poor quality rendering...
Definition qgis.h:2998
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
Definition qgis.h:2992
@ AlwaysText
Always render text as text objects. While this mode preserves text objects as text for post-processin...
Definition qgis.h:2995
FeatureSymbologyExport
Options for exporting features considering their symbology.
Definition qgis.h:6180
@ PerFeature
Keeps the number of features and export symbology per feature.
Definition qgis.h:6182
@ PerSymbolLayer
Exports one feature per symbol layer (considering symbol levels).
Definition qgis.h:6183
@ NoSymbology
Export only data.
Definition qgis.h:6181
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(), Qgis::StringFormat format=Qgis::StringFormat::PlainText)
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 rounded to the spec...
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.
QList< double > highlightLabelFrameSizeAsFloat() const
Returns HIGHLIGHT_LABELFRAMESIZE as a list of float.
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.
QList< QColor > highlightLabelFrameBackgroundColorAsColor() const
Returns HIGHLIGHT_LABELFRAMEBACKGROUNDCOLOR as a list of colors.
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.
QStringList highlightLabelFrameSize() const
Returns HIGHLIGHT_LABELFRAMESIZE.
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.
QList< QColor > highlightLabelFrameOutlineColorAsColor() const
Returns HIGHLIGHT_LABELFRAMEOUTLINECOLOR as a list of colors.
QStringList highlightLabelBufferColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of string.
QStringList highlightLabelFrameOutlineWidth() const
Returns HIGHLIGHT_LABELFRAMEOUTLINEWIDTH.
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.
QStringList highlightLabelFrameOutlineColor() const
Returns HIGHLIGHT_LABELFRAMEOUTLINECOLOR.
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.
QStringList highlightLabelFrameBackgroundColor() const
Returns HIGHLIGHT_LABELFRAMEBACKGROUNDCOLOR.
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.
QList< double > highlightLabelFrameOutlineWidthAsFloat() const
Returns HIGHLIGHT_LABELFRAMEOUTLINEWIDTH as a list of widths.
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