QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 #include "qgsdatasourceuri.h"
20 #include "qgsmessagelog.h"
21 #include "qgswmsserviceexception.h"
22 
23 const QString EXTERNAL_LAYER_PREFIX = QStringLiteral( "EXTERNAL_WMS:" );
24 
25 namespace QgsWms
26 {
27  //
28  // QgsWmsParameter
29  //
31  const QVariant::Type type,
32  const QVariant defaultValue )
33  : QgsServerParameterDefinition( type, defaultValue )
34  , mName( name )
35  {
36  }
37 
39  {
41  }
42 
44  {
45  const QString msg = QString( "%1 ('%2') cannot be converted into %3" ).arg( name( mName ), toString(), typeName() );
47  }
48 
49  QStringList QgsWmsParameter::toStyleList( const char delimiter ) const
50  {
51  return QgsServerParameterDefinition::toStringList( delimiter, false );
52  }
53 
54  QList<QgsGeometry> QgsWmsParameter::toGeomList( const char delimiter ) const
55  {
56  bool ok = true;
57  const QList<QgsGeometry> geoms = QgsServerParameterDefinition::toGeomList( ok, delimiter );
58 
59  if ( !ok )
60  {
61  const QString msg = QString( "%1 ('%2') cannot be converted into a list of geometries" ).arg( name( mName ), toString(), typeName() );
63  }
64 
65  return geoms;
66  }
67 
69  {
70  bool ok = true;
72 
73  if ( !ok )
74  {
75  const QString msg = QString( "%1 ('%2') cannot be converted into a rectangle" ).arg( name( mName ), toString(), typeName() );
77  }
78 
79  return rect;
80  }
81 
83  {
84  bool ok = false;
85  const int val = QgsServerParameterDefinition::toInt( ok );
86 
87  if ( !ok )
88  {
89  raiseError();
90  }
91 
92  return val;
93  }
94 
95  QString QgsWmsParameter::loadUrl() const
96  {
97  // Check URL -- it will be used in error messages
98  const QUrl url = toUrl();
99 
100  bool ok = false;
101  const QString content = QgsServerParameterDefinition::loadUrl( ok );
102 
103  if ( !ok )
104  {
105  const QString msg = QString( "%1 request error for %2" ).arg( name( mName ), url.toString() );
107  }
108 
109  return content;
110  }
111 
113  {
114  bool ok = false;
115  const QUrl url = QgsServerParameterDefinition::toUrl( ok );
116 
117  if ( !ok )
118  {
119  raiseError();
120  }
121 
122  return url;
123  }
124 
126  {
127  bool ok = false;
128  const QColor col = QgsServerParameterDefinition::toColor( ok );
129 
130  if ( !ok )
131  {
132  raiseError();
133  }
134 
135  return col;
136  }
137 
138  QList<QColor> QgsWmsParameter::toColorList( const char delimiter ) const
139  {
140  bool ok = false;
141  const QList<QColor> vals = QgsServerParameterDefinition::toColorList( ok, delimiter );
142 
143  if ( !ok )
144  {
145  const QString msg = QString( "%1 ('%2') cannot be converted into a list of colors" ).arg( name( mName ), toString(), typeName() );
147  }
148 
149  return vals;
150  }
151 
152  QList<int> QgsWmsParameter::toIntList( const char delimiter ) const
153  {
154  bool ok = false;
155  const QList<int> vals = QgsServerParameterDefinition::toIntList( ok, delimiter );
156 
157  if ( !ok )
158  {
159  const QString msg = QString( "%1 ('%2') cannot be converted into a list of int" ).arg( name( mName ), toString(), typeName() );
161  }
162 
163  return vals;
164  }
165 
166  QList<double> QgsWmsParameter::toDoubleList( const char delimiter ) const
167  {
168  bool ok = false;
169  const QList<double> vals = QgsServerParameterDefinition::toDoubleList( ok, delimiter );
170 
171  if ( !ok )
172  {
173  const QString msg = QString( "%1 ('%2') cannot be converted into a list of float" ).arg( name( mName ), toString(), typeName() );
175  }
176 
177  return vals;
178  }
179 
181  {
182  bool ok = false;
183  const double val = QgsServerParameterDefinition::toDouble( ok );
184 
185  if ( !ok )
186  {
187  raiseError();
188  }
189 
190  return val;
191  }
192 
193  QString QgsWmsParameter::name() const
194  {
195  return QgsWmsParameter::name( mName );
196  }
197 
199  {
200  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
201  return metaEnum.valueToKey( name );
202  }
203 
205  {
206  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
207  return ( QgsWmsParameter::Name ) metaEnum.keyToValue( name.toUpper().toStdString().c_str() );
208  }
209 
210  //
211  // QgsWmsParameters
212  //
215  {
216  // Available version number
217  mVersions.append( QgsProjectVersion( 1, 1, 1 ) );
218  mVersions.append( QgsProjectVersion( 1, 3, 0 ) );
219 
220  // WMS parameters definition
222  QVariant::Int,
223  QVariant( 0 ) );
224  save( pQuality );
225 
227  QVariant::Double,
228  QVariant( 2.0 ) );
229  save( pBoxSpace );
230 
232  QVariant::Double,
233  QVariant( 2.0 ) );
234  save( pSymbSpace );
235 
236  const QgsWmsParameter pLayerSpace( QgsWmsParameter::LAYERSPACE,
237  QVariant::Double,
238  QVariant( 3.0 ) );
239  save( pLayerSpace );
240 
242  QVariant::Double,
243  QVariant( 3.0 ) );
244  save( pTitleSpace );
245 
247  QVariant::Double,
248  QVariant( 4.0 ) );
249  save( pSymbHeight );
250 
252  QVariant::Double,
253  QVariant( 7.0 ) );
254  save( pSymbWidth );
255 
257  QVariant::Double,
258  QVariant( 2.0 ) );
259  save( pIcLabelSpace );
260 
261  const QgsWmsParameter pItFontFamily( QgsWmsParameter::ITEMFONTFAMILY );
262  save( pItFontFamily );
263 
265  QVariant::Bool,
266  QVariant( false ) );
267  save( pItFontBold );
268 
270  QVariant::Bool,
271  QVariant( false ) );
272  save( pItFontItalic );
273 
275  QVariant::Double,
276  QVariant( -1 ) );
277  save( pItFontSize );
278 
280  QVariant::String,
281  QVariant( "black" ) );
282  save( pItFontColor );
283 
284  const QgsWmsParameter pHighlightGeom( QgsWmsParameter::HIGHLIGHT_GEOM );
285  save( pHighlightGeom );
286 
287  const QgsWmsParameter pShowFeatureCount( QgsWmsParameter::SHOWFEATURECOUNT,
288  QVariant::Bool,
289  QVariant( false ) );
290  save( pShowFeatureCount );
291 
292  const QgsWmsParameter pHighlightSymbol( QgsWmsParameter::HIGHLIGHT_SYMBOL );
293  save( pHighlightSymbol );
294 
296  save( pHighlightLabel );
297 
299  QVariant::String,
300  QVariant( "black" ) );
301  save( pHighlightColor );
302 
303  const QgsWmsParameter pHighlightFontSize( QgsWmsParameter::HIGHLIGHT_LABELSIZE );
304  save( pHighlightFontSize );
305 
306  const QgsWmsParameter pHighlightFontWeight( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT );
307  save( pHighlightFontWeight );
308 
310  save( pHighlightFont );
311 
313  QVariant::String,
314  QVariant( "black" ) );
315  save( pHighlightBufferColor );
316 
317  const QgsWmsParameter pHighlightBufferSize( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE );
318  save( pHighlightBufferSize );
319 
321  save( pCRS );
322 
324  save( pSRS );
325 
327  QVariant::String,
328  QVariant( "png" ) );
329  save( pFormat );
330 
331  const QgsWmsParameter pInfoFormat( QgsWmsParameter::INFO_FORMAT );
332  save( pInfoFormat );
333 
335  QVariant::Int,
336  QVariant( -1 ) );
337  save( pI );
338 
340  QVariant::Int,
341  QVariant( -1 ) );
342  save( pJ );
343 
345  QVariant::Int,
346  QVariant( -1 ) );
347  save( pX );
348 
350  QVariant::Int,
351  QVariant( -1 ) );
352  save( pY );
353 
354  const QgsWmsParameter pRule( QgsWmsParameter::RULE );
355  save( pRule );
356 
358  QVariant::Bool,
359  QVariant( true ) );
360  save( pRuleLabel );
361 
363  QVariant::Double,
364  QVariant( -1 ) );
365  save( pScale );
366 
368  QVariant::Int,
369  QVariant( 0 ) );
370  save( pHeight );
371 
373  QVariant::Int,
374  QVariant( 0 ) );
375  save( pWidth );
376 
378  QVariant::Int,
379  QVariant( 0 ) );
380  save( pSrcHeight );
381 
383  QVariant::Int,
384  QVariant( 0 ) );
385  save( pSrcWidth );
386 
387  const QgsWmsParameter pBbox( QgsWmsParameter::BBOX );
388  save( pBbox );
389 
391  save( pSld );
392 
393  const QgsWmsParameter pSldBody( QgsWmsParameter::SLD_BODY );
394  save( pSldBody );
395 
396  const QgsWmsParameter pLayer( QgsWmsParameter::LAYER );
397  save( pLayer );
398 
399  const QgsWmsParameter pLayers( QgsWmsParameter::LAYERS );
400  save( pLayers );
401 
402  const QgsWmsParameter pQueryLayers( QgsWmsParameter::QUERY_LAYERS );
403  save( pQueryLayers );
404 
405  const QgsWmsParameter pFeatureCount( QgsWmsParameter::FEATURE_COUNT,
406  QVariant::Int,
407  QVariant( 1 ) );
408  save( pFeatureCount );
409 
410  const QgsWmsParameter pLayerTitle( QgsWmsParameter::LAYERTITLE,
411  QVariant::Bool,
412  QVariant( true ) );
413  save( pLayerTitle );
414 
415  const QgsWmsParameter pLayerFtFamily( QgsWmsParameter::LAYERFONTFAMILY );
416  save( pLayerFtFamily );
417 
419  QVariant::Bool,
420  QVariant( false ) );
421  save( pLayerFtBold );
422 
424  QVariant::Bool,
425  QVariant( false ) );
426  save( pLayerFtItalic );
427 
429  QVariant::Double,
430  QVariant( -1 ) );
431  save( pLayerFtSize );
432 
434  QVariant::String,
435  QVariant( "black" ) );
436  save( pLayerFtColor );
437 
438  const QgsWmsParameter pStyle( QgsWmsParameter::STYLE );
439  save( pStyle );
440 
441  const QgsWmsParameter pStyles( QgsWmsParameter::STYLES );
442  save( pStyles );
443 
444  const QgsWmsParameter pOpacities( QgsWmsParameter::OPACITIES );
445  save( pOpacities );
446 
447  const QgsWmsParameter pFilter( QgsWmsParameter::FILTER );
448  save( pFilter );
449 
450  const QgsWmsParameter pFilterGeom( QgsWmsParameter::FILTER_GEOM );
451  save( pFilterGeom );
452 
454  QVariant::Double,
455  QVariant( 0.0 ) );
456  save( pPolygTol );
457 
459  QVariant::Double,
460  QVariant( 0.0 ) );
461  save( pLineTol );
462 
464  QVariant::Double,
465  QVariant( 0.0 ) );
466  save( pPointTol );
467 
468  const QgsWmsParameter pSelection( QgsWmsParameter::SELECTION );
469  save( pSelection );
470 
471  const QgsWmsParameter pWmsPrecision( QgsWmsParameter::WMS_PRECISION,
472  QVariant::Int,
473  QVariant( -1 ) );
474  save( pWmsPrecision );
475 
476  const QgsWmsParameter pTransparent( QgsWmsParameter::TRANSPARENT,
477  QVariant::Bool,
478  QVariant( false ) );
479  save( pTransparent );
480 
482  QVariant::String,
483  QVariant( "white" ) );
484  save( pBgColor );
485 
487  QVariant::Int,
488  QVariant( -1 ) );
489  save( pDpi );
490 
491  const QgsWmsParameter pTemplate( QgsWmsParameter::TEMPLATE );
492  save( pTemplate );
493 
494  const QgsWmsParameter pExtent( QgsWmsParameter::EXTENT );
495  save( pExtent );
496 
498  QVariant::Double,
499  QVariant( 0.0 ) );
500  save( pRotation );
501 
503  QVariant::Double,
504  QVariant( 0.0 ) );
505  save( pGridX );
506 
508  QVariant::Double,
509  QVariant( 0.0 ) );
510  save( pGridY );
511 
512  const QgsWmsParameter pWithGeometry( QgsWmsParameter::WITH_GEOMETRY,
513  QVariant::Bool,
514  QVariant( false ) );
515  save( pWithGeometry );
516 
518  QVariant::Bool,
519  QVariant( false ) );
520  save( pWithMapTip );
521 
522  const QgsWmsParameter pWmtver( QgsWmsParameter::WMTVER );
523  save( pWmtver );
524 
526  QVariant::StringList );
527  save( pAtlasPk );
528 
530  QVariant::String );
531  save( pFormatOpts );
532  }
533 
535  : QgsWmsParameters()
536  {
537  load( parameters.urlQuery() );
538 
539  const QString sld = mWmsParameters[ QgsWmsParameter::SLD ].toString();
540  if ( !sld.isEmpty() )
541  {
542  const QString sldBody = mWmsParameters[ QgsWmsParameter::SLD ].loadUrl();
543  if ( !sldBody.isEmpty() )
544  {
545  loadParameter( QgsWmsParameter::name( QgsWmsParameter::SLD_BODY ), sldBody );
546  }
547  }
548  }
549 
551  {
552  return mWmsParameters[name];
553  }
554 
555  void QgsWmsParameters::set( QgsWmsParameter::Name name, const QVariant &value )
556  {
557  mWmsParameters[name].mValue = value;
558  }
559 
560  bool QgsWmsParameters::loadParameter( const QString &key, const QString &value )
561  {
562  bool loaded = false;
563 
564  const QRegExp composerParamRegExp( QStringLiteral( "^MAP\\d+:" ), Qt::CaseInsensitive );
565  if ( key.contains( composerParamRegExp ) )
566  {
567  const int mapId = key.midRef( 3, key.indexOf( ':' ) - 3 ).toInt();
568  const QString theKey = key.mid( key.indexOf( ':' ) + 1 );
569  const QgsWmsParameter::Name name = QgsWmsParameter::name( theKey );
570 
571  if ( name >= 0 )
572  {
573  QgsWmsParameter param = mWmsParameters[name];
574  param.mValue = value;
575  param.mId = mapId;
576 
577  if ( ! param.isValid() )
578  {
579  param.raiseError();
580  }
581 
582  save( param, true ); // multi MAP parameters for composer
583  loaded = true;
584  }
585  }
586  else
587  {
588  const QgsWmsParameter::Name name = QgsWmsParameter::name( key );
589  if ( name >= 0 )
590  {
591  mWmsParameters[name].mValue = value;
592  if ( ! mWmsParameters[name].isValid() )
593  {
594  mWmsParameters[name].raiseError();
595  }
596 
597  loaded = true;
598  }
599  else //maybe an external wms parameter?
600  {
601  int separator = key.indexOf( QStringLiteral( ":" ) );
602  if ( separator >= 1 )
603  {
604  QString id = key.left( separator );
605  QString param = key.right( key.length() - separator - 1 );
606  mExternalWMSParameters[id].insert( param, value );
607 
608  loaded = true;
609  }
610  }
611  }
612 
613  return loaded;
614  }
615 
617  {
618  log( QStringLiteral( "WMS Request parameters:" ) );
619  for ( auto parameter : mWmsParameters.toStdMap() )
620  {
621  const QString value = parameter.second.toString();
622 
623  if ( ! value.isEmpty() )
624  {
625  QString name = QgsWmsParameter::name( parameter.first );
626 
627  if ( parameter.second.mId >= 0 )
628  {
629  name = QStringLiteral( "%1:%2" ).arg( QString::number( parameter.second.mId ), name );
630  }
631 
632  log( QStringLiteral( " - %1 : %2" ).arg( name, value ) );
633  }
634  }
635 
636  if ( !version().isEmpty() )
637  log( QStringLiteral( " - VERSION : %1" ).arg( version() ) );
638  }
639 
640  void QgsWmsParameters::save( const QgsWmsParameter &parameter, bool multi )
641  {
642  if ( multi )
643  {
644  mWmsParameters.insertMulti( parameter.mName, parameter );
645  }
646  else
647  {
648  mWmsParameters[ parameter.mName ] = parameter;
649  }
650  }
651 
653  {
654  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_GEOM ].toStringList( ';' );
655  }
656 
657  QList<QgsGeometry> QgsWmsParameters::highlightGeomAsGeom() const
658  {
659  return mWmsParameters[QgsWmsParameter::HIGHLIGHT_GEOM].toGeomList( ';' );
660  }
661 
663  {
664  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_SYMBOL ].toStringList( ';' );
665  }
666 
667  QString QgsWmsParameters::crs() const
668  {
669  QString rs;
670  const QString srs = mWmsParameters[ QgsWmsParameter::SRS ].toString();
671  const QString crs = mWmsParameters[ QgsWmsParameter::CRS ].toString();
672 
673  // both SRS/CRS are supported but there's a priority according to the
674  // specified version when both are defined in the request
675  if ( !srs.isEmpty() && crs.isEmpty() )
676  rs = srs;
677  else if ( srs.isEmpty() && !crs.isEmpty() )
678  rs = crs;
679  else if ( !srs.isEmpty() && !crs.isEmpty() )
680  {
681  if ( versionAsNumber() >= QgsProjectVersion( 1, 3, 0 ) )
682  rs = crs;
683  else
684  rs = srs;
685  }
686 
687  return rs;
688  }
689 
690  QString QgsWmsParameters::bbox() const
691  {
692  return mWmsParameters[ QgsWmsParameter::BBOX ].toString();
693  }
694 
696  {
697  return mWmsParameters[ QgsWmsParameter::BBOX ].toRectangle();
698  }
699 
700  QString QgsWmsParameters::height() const
701  {
702  return mWmsParameters[ QgsWmsParameter::HEIGHT ].toString();
703  }
704 
705  QString QgsWmsParameters::width() const
706  {
707  return mWmsParameters[ QgsWmsParameter::WIDTH ].toString();
708  }
709 
711  {
712  return mWmsParameters[ QgsWmsParameter::HEIGHT ].toInt();
713  }
714 
716  {
717  return mWmsParameters[ QgsWmsParameter::WIDTH ].toInt();
718  }
719 
721  {
722  return mWmsParameters[ QgsWmsParameter::SRCHEIGHT ].toString();
723  }
724 
726  {
727  return mWmsParameters[ QgsWmsParameter::SRCWIDTH ].toString();
728  }
729 
731  {
732  return mWmsParameters[ QgsWmsParameter::SRCHEIGHT ].toInt();
733  }
734 
736  {
737  return mWmsParameters[ QgsWmsParameter::SRCWIDTH ].toInt();
738  }
739 
740  QString QgsWmsParameters::dpi() const
741  {
742  return mWmsParameters[ QgsWmsParameter::DPI ].toString();
743  }
744 
746  {
747  return mWmsParameters[ QgsWmsParameter::DPI ].toDouble();
748  }
749 
751  {
752  const QString vStr = version();
753 
755 
756  if ( vStr.isEmpty() )
757  {
758  version = QgsProjectVersion( 1, 3, 0 ); // default value
759  }
760  else if ( mVersions.contains( QgsProjectVersion( vStr ) ) )
761  {
762  version = QgsProjectVersion( vStr );
763  }
764 
765  return version;
766  }
767 
768  bool QgsWmsParameters::versionIsValid( const QString version ) const
769  {
770  return mVersions.contains( QgsProjectVersion( version ) );
771  }
772 
774  {
775  return mWmsParameters[ QgsWmsParameter::FORMAT ].toString( true );
776  }
777 
779  {
780  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameters::Format>() );
781  return metaEnum.valueToKey( format );
782  }
783 
785  {
786  const QString fStr = formatAsString();
787 
788  Format f = Format::NONE;
789  if ( fStr.compare( QLatin1String( "image/png" ), Qt::CaseInsensitive ) == 0 ||
790  fStr.compare( QLatin1String( "png" ), Qt::CaseInsensitive ) == 0 )
791  {
792  f = Format::PNG;
793  }
794  else if ( fStr.compare( QLatin1String( "jpg" ), Qt::CaseInsensitive ) == 0
795  || fStr.compare( QLatin1String( "jpeg" ), Qt::CaseInsensitive ) == 0
796  || fStr.compare( QLatin1String( "image/jpeg" ), Qt::CaseInsensitive ) == 0 )
797  {
798  f = Format::JPG;
799  }
800  else if ( fStr.compare( QLatin1String( "image/svg" ), Qt::CaseInsensitive ) == 0 ||
801  fStr.compare( QLatin1String( "image/svg+xml" ), Qt::CaseInsensitive ) == 0 ||
802  fStr.compare( QLatin1String( "svg" ), Qt::CaseInsensitive ) == 0 )
803  {
804  f = Format::SVG;
805  }
806  else if ( fStr.compare( QLatin1String( "application/pdf" ), Qt::CaseInsensitive ) == 0 ||
807  fStr.compare( QLatin1String( "pdf" ), Qt::CaseInsensitive ) == 0 )
808  {
809  f = Format::PDF;
810  }
811 
812  return f;
813  }
814 
816  {
817  return mWmsParameters[ QgsWmsParameter::INFO_FORMAT ].toString();
818  }
819 
821  {
822  return infoFormat() == Format::PNG || infoFormat() == Format::JPG;
823  }
824 
826  {
827  QString fStr = infoFormatAsString();
828 
829  Format f = Format::TEXT;
830  if ( fStr.isEmpty() )
831  return f;
832 
833  if ( fStr.startsWith( QLatin1String( "text/xml" ), Qt::CaseInsensitive ) )
834  f = Format::XML;
835  else if ( fStr.startsWith( QLatin1String( "text/html" ), Qt::CaseInsensitive ) )
836  f = Format::HTML;
837  else if ( fStr.startsWith( QLatin1String( "text/plain" ), Qt::CaseInsensitive ) )
838  f = Format::TEXT;
839  else if ( fStr.startsWith( QLatin1String( "application/vnd.ogc.gml" ), Qt::CaseInsensitive ) )
840  f = Format::GML;
841  else if ( fStr.startsWith( QLatin1String( "application/json" ), Qt::CaseInsensitive )
842  || fStr.startsWith( QLatin1String( "application/geo+json" ), Qt::CaseInsensitive ) )
843  f = Format::JSON;
844  else
845  f = Format::NONE;
846 
847  return f;
848  }
849 
851  {
852  if ( infoFormat() != Format::GML )
853  return -1;
854 
855  QString fStr = infoFormatAsString();
856  if ( fStr.startsWith( QLatin1String( "application/vnd.ogc.gml/3" ), Qt::CaseInsensitive ) )
857  return 3;
858  else
859  return 2;
860  }
861 
862  QString QgsWmsParameters::i() const
863  {
864  return mWmsParameters[ QgsWmsParameter::I ].toString();
865  }
866 
867  QString QgsWmsParameters::j() const
868  {
869  return mWmsParameters[ QgsWmsParameter::J ].toString();
870  }
871 
873  {
874  return mWmsParameters[ QgsWmsParameter::I ].toInt();
875  }
876 
878  {
879  return mWmsParameters[ QgsWmsParameter::J ].toInt();
880  }
881 
882  QString QgsWmsParameters::x() const
883  {
884  return mWmsParameters[ QgsWmsParameter::X ].toString();
885  }
886 
887  QString QgsWmsParameters::y() const
888  {
889  return mWmsParameters[ QgsWmsParameter::Y ].toString();
890  }
891 
893  {
894  return mWmsParameters[ QgsWmsParameter::X ].toInt();
895  }
896 
898  {
899  return mWmsParameters[ QgsWmsParameter::Y ].toInt();
900  }
901 
902  QString QgsWmsParameters::rule() const
903  {
904  return mWmsParameters[ QgsWmsParameter::RULE ].toString();
905  }
906 
908  {
909  return mWmsParameters[ QgsWmsParameter::RULELABEL ].toString();
910  }
911 
913  {
914  return mWmsParameters[ QgsWmsParameter::RULELABEL ].toBool();
915  }
916 
918  {
919  return mWmsParameters[ QgsWmsParameter::TRANSPARENT ].toString();
920  }
921 
923  {
924  return mWmsParameters[ QgsWmsParameter::TRANSPARENT ].toBool();
925  }
926 
927  QString QgsWmsParameters::scale() const
928  {
929  return mWmsParameters[ QgsWmsParameter::SCALE ].toString();
930  }
931 
933  {
934  return mWmsParameters[ QgsWmsParameter::SCALE ].toDouble();
935  }
936 
938  {
939  return mWmsParameters[ QgsWmsParameter::IMAGE_QUALITY ].toString();
940  }
941 
943  {
944  return mWmsParameters[ QgsWmsParameter::IMAGE_QUALITY ].toInt();
945  }
946 
948  {
949  return mWmsParameters[ QgsWmsParameter::SHOWFEATURECOUNT ].toString();
950  }
951 
953  {
954  return mWmsParameters[ QgsWmsParameter::SHOWFEATURECOUNT ].toBool();
955  }
956 
958  {
959  return mWmsParameters[ QgsWmsParameter::FEATURE_COUNT ].toString();
960  }
961 
963  {
964  return mWmsParameters[ QgsWmsParameter::FEATURE_COUNT ].toInt();
965  }
966 
968  {
969  return mWmsParameters[ QgsWmsParameter::BOXSPACE ].toString();
970  }
971 
973  {
974  return mWmsParameters[ QgsWmsParameter::BOXSPACE ].toDouble();
975  }
976 
978  {
979  return mWmsParameters[ QgsWmsParameter::LAYERSPACE ].toString();
980  }
981 
983  {
984  return mWmsParameters[ QgsWmsParameter::LAYERSPACE ].toDouble();
985  }
986 
988  {
989  return mWmsParameters[ QgsWmsParameter::LAYERTITLESPACE ].toString();
990  }
991 
993  {
994  return mWmsParameters[ QgsWmsParameter::LAYERTITLESPACE ].toDouble();
995  }
996 
998  {
999  return mWmsParameters[ QgsWmsParameter::SYMBOLSPACE ].toString();
1000  }
1001 
1003  {
1004  return mWmsParameters[ QgsWmsParameter::SYMBOLSPACE ].toDouble();
1005  }
1006 
1008  {
1009  return mWmsParameters[ QgsWmsParameter::SYMBOLHEIGHT ].toString();
1010  }
1011 
1013  {
1014  return mWmsParameters[ QgsWmsParameter::SYMBOLHEIGHT ].toDouble();
1015  }
1016 
1018  {
1019  return mWmsParameters[ QgsWmsParameter::SYMBOLWIDTH ].toString();
1020  }
1021 
1023  {
1024  return mWmsParameters[ QgsWmsParameter::SYMBOLWIDTH ].toDouble();
1025  }
1026 
1028  {
1029  return mWmsParameters[ QgsWmsParameter::ICONLABELSPACE ].toString();
1030  }
1031 
1033  {
1034  return mWmsParameters[ QgsWmsParameter::ICONLABELSPACE ].toDouble();
1035  }
1036 
1038  {
1039  return mWmsParameters[ QgsWmsParameter::LAYERFONTFAMILY ].toString();
1040  }
1041 
1043  {
1044  return mWmsParameters[ QgsWmsParameter::ITEMFONTFAMILY ].toString();
1045  }
1046 
1048  {
1049  return mWmsParameters[ QgsWmsParameter::LAYERFONTBOLD ].toString();
1050  }
1051 
1053  {
1054  return mWmsParameters[ QgsWmsParameter::LAYERFONTBOLD ].toBool();
1055  }
1056 
1058  {
1059  return mWmsParameters[ QgsWmsParameter::ITEMFONTBOLD ].toString();
1060  }
1061 
1063  {
1064  return mWmsParameters[ QgsWmsParameter::FI_POLYGON_TOLERANCE ].toString();
1065  }
1066 
1068  {
1069  return mWmsParameters[ QgsWmsParameter::FI_LINE_TOLERANCE ].toString();
1070  }
1071 
1073  {
1074  return mWmsParameters[ QgsWmsParameter::FI_POINT_TOLERANCE ].toString();
1075  }
1076 
1078  {
1079  return mWmsParameters[ QgsWmsParameter::FI_POLYGON_TOLERANCE ].toInt();
1080  }
1081 
1083  {
1084  return mWmsParameters[ QgsWmsParameter::FI_LINE_TOLERANCE ].toInt();
1085  }
1086 
1088  {
1089  return mWmsParameters[ QgsWmsParameter::FI_POINT_TOLERANCE ].toInt();
1090  }
1091 
1093  {
1094  return mWmsParameters[ QgsWmsParameter::ITEMFONTBOLD ].toBool();
1095  }
1096 
1098  {
1099  return mWmsParameters[ QgsWmsParameter::LAYERFONTITALIC ].toString();
1100  }
1101 
1103  {
1104  return mWmsParameters[ QgsWmsParameter::LAYERFONTITALIC ].toBool();
1105  }
1106 
1108  {
1109  return mWmsParameters[ QgsWmsParameter::ITEMFONTITALIC ].toString();
1110  }
1111 
1113  {
1114  return mWmsParameters[ QgsWmsParameter::ITEMFONTITALIC ].toBool();
1115  }
1116 
1118  {
1119  return mWmsParameters[ QgsWmsParameter::LAYERFONTSIZE ].toString();
1120  }
1121 
1123  {
1124  return mWmsParameters[ QgsWmsParameter::LAYERFONTSIZE ].toDouble();
1125  }
1126 
1128  {
1129  return mWmsParameters[ QgsWmsParameter::LAYERFONTCOLOR ].toString();
1130  }
1131 
1133  {
1134  return mWmsParameters[ QgsWmsParameter::LAYERFONTCOLOR ].toColor();
1135  }
1136 
1138  {
1139  return mWmsParameters[ QgsWmsParameter::ITEMFONTSIZE ].toString();
1140  }
1141 
1143  {
1144  return mWmsParameters[ QgsWmsParameter::ITEMFONTSIZE ].toDouble();
1145  }
1146 
1148  {
1149  return mWmsParameters[ QgsWmsParameter::ITEMFONTCOLOR ].toString();
1150  }
1151 
1153  {
1154  return mWmsParameters[ QgsWmsParameter::ITEMFONTCOLOR ].toColor();
1155  }
1156 
1158  {
1159  QFont font;
1160  font.fromString( "" );
1161  font.setBold( layerFontBoldAsBool() );
1162  font.setItalic( layerFontItalicAsBool() );
1163 
1164  if ( ! layerFontSize().isEmpty() )
1165  font.setPointSizeF( layerFontSizeAsDouble() );
1166 
1167  if ( !layerFontFamily().isEmpty() )
1168  font.setFamily( layerFontFamily() );
1169 
1170  return font;
1171  }
1172 
1174  {
1175  QFont font;
1176  font.fromString( "" );
1177 
1178  font.setBold( itemFontBoldAsBool() );
1179  font.setItalic( itemFontItalicAsBool() );
1180 
1181  if ( ! itemFontSize().isEmpty() )
1182  font.setPointSizeF( itemFontSizeAsDouble() );
1183 
1184  if ( !itemFontFamily().isEmpty() )
1185  font.setFamily( itemFontFamily() );
1186 
1187  return font;
1188  }
1189 
1191  {
1192  return mWmsParameters[ QgsWmsParameter::LAYERTITLE ].toString();
1193  }
1194 
1196  {
1197  return mWmsParameters[ QgsWmsParameter::LAYERTITLE ].toBool();
1198  }
1199 
1201  {
1202  QgsLegendSettings settings;
1203  settings.setTitle( QString() );
1204  settings.setBoxSpace( boxSpaceAsDouble() );
1205  settings.setSymbolSize( QSizeF( symbolWidthAsDouble(), symbolHeightAsDouble() ) );
1206 
1207  settings.rstyle( QgsLegendStyle::Style::Subgroup ).setMargin( QgsLegendStyle::Side::Top, layerSpaceAsDouble() );
1208  settings.rstyle( QgsLegendStyle::Style::Subgroup ).setMargin( QgsLegendStyle::Side::Bottom, layerTitleSpaceAsDouble() );
1209  settings.rstyle( QgsLegendStyle::Style::Subgroup ).setFont( layerFont() );
1210 
1211  if ( !itemFontColor().isEmpty() )
1212  {
1213  settings.setFontColor( itemFontColorAsColor() );
1214  }
1215 
1216  // Ok, this is tricky: because QgsLegendSettings's layerFontColor was added to the API after
1217  // fontColor, to fix regressions #21871 and #21870 and the previous behavior was to use fontColor
1218  // for the whole legend we need to preserve that behavior.
1219  // But, the 2.18 server parameters ITEMFONTCOLOR did not have effect on the layer titles too, so
1220  // we set explicitly layerFontColor to black if it's not overridden by LAYERFONTCOLOR argument.
1221  settings.setLayerFontColor( layerFontColor().isEmpty() ? QColor( Qt::black ) : layerFontColorAsColor() );
1222 
1223  settings.rstyle( QgsLegendStyle::Style::SymbolLabel ).setFont( itemFont() );
1224  settings.rstyle( QgsLegendStyle::Style::Symbol ).setMargin( QgsLegendStyle::Side::Top, symbolSpaceAsDouble() );
1225  settings.rstyle( QgsLegendStyle::Style::SymbolLabel ).setMargin( QgsLegendStyle::Side::Left, iconLabelSpaceAsDouble() );
1226 
1227  return settings;
1228  }
1229 
1230  QString QgsWmsParameters::layoutParameter( const QString &id, bool &ok ) const
1231  {
1232  QString label;
1233  ok = false;
1234 
1235  if ( mUnmanagedParameters.contains( id.toUpper() ) )
1236  {
1237  label = mUnmanagedParameters[id.toUpper()];
1238  ok = true;
1239  }
1240 
1241  return label;
1242  }
1243 
1244  QStringList QgsWmsParameters::atlasPk() const
1245  {
1246  return mWmsParameters[ QgsWmsParameter::ATLAS_PK ].toStringList();
1247  }
1248 
1250  {
1251  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELSTRING ].toStringList( ';' );
1252  }
1253 
1255  {
1256  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELSIZE ].toStringList( ';' );
1257  }
1258 
1260  {
1261  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELSIZE ].toIntList( ';' );
1262  }
1263 
1265  {
1266  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELCOLOR ].toStringList( ';' );
1267  }
1268 
1270  {
1271  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELCOLOR ].toColorList( ';' );
1272  }
1273 
1275  {
1276  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ].toStringList( ';' );
1277  }
1278 
1280  {
1281  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELWEIGHT ].toIntList( ';' );
1282  }
1283 
1285  {
1286  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELFONT ].toStringList( ';' );
1287  }
1288 
1290  {
1291  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ].toStringList( ';' );
1292  }
1293 
1295  {
1296  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR ].toColorList( ';' );
1297  }
1298 
1300  {
1301  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ].toStringList( ';' );
1302  }
1303 
1305  {
1306  return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE ].toDoubleList( ';' );
1307  }
1308 
1310  {
1311  return mWmsParameters[ QgsWmsParameter::WMS_PRECISION ].toString();
1312  }
1313 
1315  {
1316  return mWmsParameters[ QgsWmsParameter::WMS_PRECISION ].toInt();
1317  }
1318 
1320  {
1321  return mWmsParameters[ QgsWmsParameter::SLD_BODY ].toString();
1322  }
1323 
1324  QStringList QgsWmsParameters::filters() const
1325  {
1326  const QString filter = mWmsParameters[ QgsWmsParameter::FILTER ].toString();
1327  QStringList results;
1328  int pos = 0;
1329  while ( pos < filter.size() )
1330  {
1331  if ( pos + 1 < filter.size() && filter[pos] == '(' && filter[pos + 1] == '<' )
1332  {
1333  // OGC filter on multiple layers
1334  int posEnd = filter.indexOf( "Filter>)", pos );
1335  if ( posEnd < 0 )
1336  {
1337  posEnd = filter.size();
1338  }
1339  results.append( filter.mid( pos + 1, posEnd - pos + 6 ) );
1340  pos = posEnd + 8;
1341  }
1342  else if ( pos + 1 < filter.size() && filter[pos] == '(' && filter[pos + 1] == ')' )
1343  {
1344  // empty OGC filter
1345  results.append( "" );
1346  pos += 2;
1347  }
1348  else if ( filter[pos] == '<' )
1349  {
1350  // Single OGC filter
1351  results.append( filter.mid( pos ) );
1352  break;
1353  }
1354  else
1355  {
1356  // QGIS specific filter
1357  int posEnd = filter.indexOf( ';', pos + 1 );
1358  if ( posEnd < 0 )
1359  {
1360  posEnd = filter.size();
1361  }
1362  results.append( filter.mid( pos, posEnd - pos ) );
1363  pos = posEnd + 1;
1364  }
1365  }
1366  return results;
1367  }
1368 
1370  {
1371  return mWmsParameters[ QgsWmsParameter::FILTER_GEOM ].toString();
1372  }
1373 
1374  QStringList QgsWmsParameters::selections() const
1375  {
1376  return mWmsParameters[ QgsWmsParameter::SELECTION ].toStringList( ';' );
1377  }
1378 
1379  QStringList QgsWmsParameters::opacities() const
1380  {
1381  return mWmsParameters[ QgsWmsParameter::OPACITIES ].toStringList();
1382  }
1383 
1385  {
1386  return mWmsParameters[ QgsWmsParameter::OPACITIES ].toIntList();
1387  }
1388 
1390  {
1391  QStringList layer = mWmsParameters[ QgsWmsParameter::LAYER ].toStringList();
1392  const QStringList layers = mWmsParameters[ QgsWmsParameter::LAYERS ].toStringList();
1393  return layer << layers;
1394  }
1395 
1397  {
1398  return mWmsParameters[ QgsWmsParameter::QUERY_LAYERS ].toStringList();
1399  }
1400 
1401  QStringList QgsWmsParameters::allStyles() const
1402  {
1403  QStringList style = mWmsParameters[ QgsWmsParameter::STYLE ].toStyleList();
1404  const QStringList styles = mWmsParameters[ QgsWmsParameter::STYLES ].toStyleList();
1405  return style << styles;
1406  }
1407 
1408  QMultiMap<QString, QgsWmsParametersFilter> QgsWmsParameters::layerFilters( const QStringList &layers ) const
1409  {
1410  const QString nsWfs2 = QStringLiteral( "http://www.opengis.net/fes/2.0" );
1411  const QString prefixWfs2 = QStringLiteral( "<fes:" );
1412 
1413  const QStringList rawFilters = filters();
1414  QMultiMap<QString, QgsWmsParametersFilter> filters;
1415  for ( int i = 0; i < rawFilters.size(); i++ )
1416  {
1417  const QString f = rawFilters[i];
1418  if ( f.startsWith( QLatin1String( "<" ) ) \
1419  && f.endsWith( QLatin1String( "Filter>" ) ) \
1420  && i < layers.size() )
1421  {
1422  QgsWmsParametersFilter filter;
1423  filter.mFilter = f;
1426 
1427  if ( filter.mFilter.contains( nsWfs2 ) \
1428  || filter.mFilter.contains( prefixWfs2 ) )
1429  {
1431  }
1432 
1433  filters.insert( layers[i], filter );
1434  }
1435  else if ( !f.isEmpty() )
1436  {
1437  // filter format: "LayerName,LayerName2:filterString;LayerName3:filterString2;..."
1438  // several filters can be defined for one layer
1439  const int colonIndex = f.indexOf( ':' );
1440  if ( colonIndex != -1 )
1441  {
1442  const QString layers = f.section( ':', 0, 0 );
1443  const QString filter = f.section( ':', 1 );
1444  const QStringList layersList = layers.split( ',' );
1445  for ( const QString &layer : layersList )
1446  {
1447  QgsWmsParametersFilter parametersFilter;
1448  parametersFilter.mFilter = filter;
1449  parametersFilter.mType = QgsWmsParametersFilter::SQL;
1450  filters.insert( layer, parametersFilter );
1451  }
1452  }
1453  else
1454  {
1455  QString filterStr = mWmsParameters[ QgsWmsParameter::FILTER ].toString();
1456  raiseError( QStringLiteral( "FILTER ('" ) + filterStr + QStringLiteral( "') is not properly formatted" ) );
1457  }
1458  }
1459  }
1460  return filters;
1461  }
1462 
1463  QList<QgsWmsParametersLayer> QgsWmsParameters::layersParameters() const
1464  {
1465  const QStringList layers = allLayersNickname();
1466  const QStringList styles = allStyles();
1467  const QStringList selection = selections();
1468  const QList<int> opacities = opacitiesAsInt();
1469  const QMultiMap<QString, QgsWmsParametersFilter> filters = layerFilters( layers );
1470 
1471  // selection format: "LayerName:id0,id1;LayerName2:id0,id1;..."
1472  // several filters can be defined for one layer
1473  QMultiMap<QString, QString> layerSelections;
1474  for ( const QString &s : selection )
1475  {
1476  const QStringList splits = s.split( ':' );
1477  if ( splits.size() == 2 )
1478  {
1479  layerSelections.insert( splits[0], splits[1] );
1480  }
1481  else
1482  {
1483  QString selStr = mWmsParameters[ QgsWmsParameter::SELECTION ].toString();
1484  raiseError( QStringLiteral( "SELECTION ('" ) + selStr + QStringLiteral( "') is not properly formatted" ) );
1485  }
1486  }
1487 
1488  QList<QgsWmsParametersLayer> parameters;
1489  for ( int i = 0; i < layers.size(); i++ )
1490  {
1491  QString layer = layers[i];
1492 
1493  if ( isExternalLayer( layer ) )
1494  continue;
1495 
1496  QgsWmsParametersLayer param;
1497  param.mNickname = layer;
1498 
1499  if ( i < styles.count() )
1500  param.mStyle = styles[i];
1501 
1502  if ( i < opacities.count() )
1503  param.mOpacity = opacities[i];
1504 
1505  if ( filters.contains( layer ) )
1506  {
1507  auto it = filters.find( layer );
1508  while ( it != filters.end() && it.key() == layer )
1509  {
1510  param.mFilter.append( it.value() );
1511  ++it;
1512  }
1513  }
1514 
1515  if ( layerSelections.contains( layer ) )
1516  {
1517  QMultiMap<QString, QString>::const_iterator it;
1518  it = layerSelections.constFind( layer );
1519  while ( it != layerSelections.constEnd() && it.key() == layer )
1520  {
1521  param.mSelection << it.value().split( ',' );
1522  ++it;
1523  }
1524  }
1525 
1526  parameters.append( param );
1527  }
1528 
1529  return parameters;
1530  }
1531 
1532  QList<QgsWmsParametersHighlightLayer> QgsWmsParameters::highlightLayersParameters() const
1533  {
1534  QList<QgsWmsParametersHighlightLayer> params;
1535  QList<QgsGeometry> geoms = highlightGeomAsGeom();
1536  QStringList slds = highlightSymbol();
1537  QStringList labels = highlightLabelString();
1538  QList<QColor> colors = highlightLabelColorAsColor();
1539  QList<int> sizes = highlightLabelSizeAsInt();
1540  QList<int> weights = highlightLabelWeightAsInt();
1541  QStringList fonts = highlightLabelFont();
1542  QList<QColor> bufferColors = highlightLabelBufferColorAsColor();
1543  QList<double> bufferSizes = highlightLabelBufferSizeAsFloat();
1544 
1545  int nLayers = std::min( geoms.size(), slds.size() );
1546  for ( int i = 0; i < nLayers; i++ )
1547  {
1549  param.mName = QStringLiteral( "highlight_" ) + QString::number( i );
1550  param.mGeom = geoms[i];
1551  param.mSld = slds[i];
1552 
1553  if ( i < labels.count() )
1554  param.mLabel = labels[i];
1555 
1556  if ( i < colors.count() )
1557  param.mColor = colors[i];
1558 
1559  if ( i < sizes.count() )
1560  param.mSize = sizes[i];
1561 
1562  if ( i < weights.count() )
1563  param.mWeight = weights[i];
1564 
1565  if ( i < fonts.count() )
1566  param.mFont = fonts[ i ];
1567 
1568  if ( i < bufferColors.count() )
1569  param.mBufferColor = bufferColors[i];
1570 
1571  if ( i < bufferSizes.count() )
1572  param.mBufferSize = bufferSizes[i];
1573 
1574  params.append( param );
1575  }
1576 
1577  return params;
1578  }
1579 
1580  QList<QgsWmsParametersExternalLayer> QgsWmsParameters::externalLayersParameters() const
1581  {
1582  auto notExternalLayer = []( const QString & name ) { return ! QgsWmsParameters::isExternalLayer( name ); };
1583 
1584  QList<QgsWmsParametersExternalLayer> externalLayers;
1585 
1586  QStringList layers = allLayersNickname();
1587  QStringList::iterator rit = std::remove_if( layers.begin(), layers.end(), notExternalLayer );
1588 
1589  for ( QStringList::iterator it = layers.begin(); it != rit; ++it )
1590  {
1591  externalLayers << externalLayerParameter( *it );
1592  }
1593 
1594  return externalLayers;
1595  }
1596 
1598  {
1599  return mWmsParameters[ QgsWmsParameter::BGCOLOR ].toString();
1600  }
1601 
1603  {
1604  return mWmsParameters[ QgsWmsParameter::BGCOLOR ].toColor();
1605  }
1606 
1608  {
1609  return mWmsParameters[ QgsWmsParameter::TEMPLATE ].toString();
1610  }
1611 
1613  {
1614  QgsWmsParameter wmsParam;
1616  param.mId = mapId;
1617 
1618  //map extent is mandatory
1619  QString extentStr;
1620  wmsParam = idParameter( QgsWmsParameter::EXTENT, mapId );
1621  if ( wmsParam.isValid() )
1622  {
1623  extentStr = wmsParam.toString();
1624  }
1625 
1626  if ( extentStr.isEmpty() )
1627  {
1628  return param;
1629  }
1630 
1631  QString pMapId = QStringLiteral( "MAP" ) + QString::number( mapId );
1632 
1633  wmsParam = idParameter( QgsWmsParameter::EXTENT, mapId );
1634  QgsRectangle extent;
1635  if ( wmsParam.isValid() )
1636  {
1637  extent = wmsParam.toRectangle();
1638  }
1639 
1640  if ( extent.isEmpty() )
1641  return param;
1642 
1643  param.mHasExtent = !extent.isEmpty();
1644  param.mExtent = extent;
1645 
1646  // scale
1647  wmsParam = idParameter( QgsWmsParameter::SCALE, mapId );
1648  if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1649  {
1650  param.mScale = wmsParam.toDouble();
1651  }
1652 
1653  // rotation
1654  wmsParam = idParameter( QgsWmsParameter::ROTATION, mapId );
1655  if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1656  {
1657  param.mRotation = wmsParam.toDouble();
1658  }
1659 
1660  //grid space x / y
1661  double gridx( -1 ), gridy( -1 );
1662 
1663  wmsParam = idParameter( QgsWmsParameter::GRID_INTERVAL_X, mapId );
1664  if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1665  {
1666  gridx = wmsParam.toDouble();
1667  }
1668 
1669  wmsParam = idParameter( QgsWmsParameter::GRID_INTERVAL_Y, mapId );
1670  if ( wmsParam.isValid() && !wmsParam.toString().isEmpty() )
1671  {
1672  gridy = wmsParam.toDouble();
1673  }
1674 
1675  if ( gridx != -1 && gridy != -1 )
1676  {
1677  param.mGridX = gridx;
1678  param.mGridY = gridy;
1679  }
1680 
1681  //layers
1682  QStringList allLayers;
1683  wmsParam = idParameter( QgsWmsParameter::LAYERS, mapId );
1684  if ( wmsParam.isValid() )
1685  {
1686  allLayers = wmsParam.toStringList();
1687  }
1688 
1689  // external layers
1690  QStringList layers;
1691  QList<QgsWmsParametersExternalLayer> eParams;
1692 
1693  for ( const auto &layer : qgis::as_const( allLayers ) )
1694  {
1695  if ( isExternalLayer( layer ) )
1696  {
1697  eParams << externalLayerParameter( layer );
1698  }
1699  else
1700  {
1701  layers << layer;
1702  }
1703  }
1704  param.mExternalLayers = eParams;
1705 
1706  QStringList styles;
1707  wmsParam = idParameter( QgsWmsParameter::STYLES, mapId );
1708  if ( wmsParam.isValid() )
1709  {
1710  styles = wmsParam.toStyleList();
1711  }
1712 
1713  QList<QgsWmsParametersLayer> lParams;
1714  for ( int i = 0; i < layers.size(); i++ )
1715  {
1716  QString layer = layers[i];
1717  QgsWmsParametersLayer lParam;
1718  lParam.mNickname = layer;
1719 
1720  if ( i < styles.count() )
1721  lParam.mStyle = styles[i];
1722 
1723  lParams.append( lParam );
1724  }
1725  param.mLayers = lParams;
1726 
1727  //highlight layers
1728  QList<QgsWmsParametersHighlightLayer> hParams;
1729 
1730  QList<QgsGeometry> geoms;
1731  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_GEOM, mapId );
1732  if ( wmsParam.isValid() )
1733  {
1734  geoms = wmsParam.toGeomList( ';' );
1735  }
1736 
1737  QStringList slds;
1738  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_SYMBOL, mapId );
1739  if ( wmsParam.isValid() )
1740  {
1741  slds = wmsParam.toStringList( ';' );
1742  }
1743 
1744  QStringList labels;
1745  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSTRING, mapId );
1746  if ( wmsParam.isValid() )
1747  {
1748  labels = wmsParam.toStringList( ';' );
1749  }
1750 
1751  QStringList fonts;
1752  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELFONT, mapId );
1753  if ( wmsParam.isValid() )
1754  {
1755  fonts = wmsParam.toStringList( ';' );
1756  }
1757 
1758  QList<QColor> colors;
1759  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELCOLOR, mapId );
1760  if ( wmsParam.isValid() )
1761  {
1762  colors = wmsParam.toColorList( ';' );
1763  }
1764 
1765  QList<int> sizes;
1766  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELSIZE, mapId );
1767  if ( wmsParam.isValid() )
1768  {
1769  sizes = wmsParam.toIntList( ';' );
1770  }
1771 
1772  QList<int> weights;
1773  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELWEIGHT, mapId );
1774  if ( wmsParam.isValid() )
1775  {
1776  weights = wmsParam.toIntList( ';' );
1777  }
1778 
1779  QList<QColor> bufferColors;
1780  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERCOLOR, mapId );
1781  if ( wmsParam.isValid() )
1782  {
1783  bufferColors = wmsParam.toColorList( ';' );
1784  }
1785 
1786  QList<double> bufferSizes;
1787  wmsParam = idParameter( QgsWmsParameter::HIGHLIGHT_LABELBUFFERSIZE, mapId );
1788  if ( wmsParam.isValid() )
1789  {
1790  bufferSizes = wmsParam.toDoubleList( ';' );
1791  }
1792 
1793  int nHLayers = std::min( geoms.size(), slds.size() );
1794  for ( int i = 0; i < nHLayers; i++ )
1795  {
1797  hParam.mName = pMapId + QStringLiteral( "_highlight_" ) + QString::number( i );
1798  hParam.mGeom = geoms[i];
1799  hParam.mSld = slds[i];
1800 
1801  if ( i < labels.count() )
1802  hParam.mLabel = labels[i];
1803 
1804  if ( i < colors.count() )
1805  hParam.mColor = colors[i];
1806 
1807  if ( i < sizes.count() )
1808  hParam.mSize = sizes[i];
1809 
1810  if ( i < weights.count() )
1811  hParam.mWeight = weights[i];
1812 
1813  if ( i < fonts.count() )
1814  hParam.mFont = fonts[ i ];
1815 
1816  if ( i < bufferColors.count() )
1817  hParam.mBufferColor = bufferColors[i];
1818 
1819  if ( i < bufferSizes.count() )
1820  hParam.mBufferSize = bufferSizes[i];
1821 
1822  hParams.append( hParam );
1823  }
1824  param.mHighlightLayers = hParams;
1825 
1826  return param;
1827  }
1828 
1829  QString QgsWmsParameters::externalWMSUri( const QString &id ) const
1830  {
1831  if ( !mExternalWMSParameters.contains( id ) )
1832  {
1833  return QString();
1834  }
1835 
1836  QgsDataSourceUri wmsUri;
1837  const QMap<QString, QString> &paramMap = mExternalWMSParameters[ id ];
1838  QMap<QString, QString>::const_iterator paramIt = paramMap.constBegin();
1839  for ( ; paramIt != paramMap.constEnd(); ++paramIt )
1840  {
1841  wmsUri.setParam( paramIt.key().toLower(), paramIt.value() );
1842  }
1843  return wmsUri.encodedUri();
1844  }
1845 
1847  {
1848  return mWmsParameters[ QgsWmsParameter::WITH_GEOMETRY ].toBool();
1849  }
1850 
1852  {
1853  return mWmsParameters[ QgsWmsParameter::WITH_MAPTIP ].toBool();
1854  }
1855 
1857  {
1858  return mWmsParameters[ QgsWmsParameter::WMTVER ].toString();
1859  }
1860 
1861  void QgsWmsParameters::log( const QString &msg ) const
1862  {
1863  QgsMessageLog::logMessage( msg, QStringLiteral( "Server" ), Qgis::Info );
1864  }
1865 
1866  void QgsWmsParameters::raiseError( const QString &msg ) const
1867  {
1869  }
1870 
1871  QgsWmsParameter QgsWmsParameters::idParameter( const QgsWmsParameter::Name name, const int id ) const
1872  {
1873  QgsWmsParameter p;
1874 
1875  for ( const auto &param : mWmsParameters.values( name ) )
1876  {
1877  if ( param.mId == id )
1878  {
1879  p = param;
1880  }
1881  }
1882 
1883  return p;
1884  }
1885 
1886  QgsWmsParametersExternalLayer QgsWmsParameters::externalLayerParameter( const QString &name ) const
1887  {
1889 
1890  param.mName = name;
1891  param.mName.remove( 0, EXTERNAL_LAYER_PREFIX.size() );
1892  param.mUri = externalWMSUri( param.mName );
1893 
1894  return param;
1895  }
1896 
1897  bool QgsWmsParameters::isExternalLayer( const QString &name )
1898  {
1899  return name.startsWith( EXTERNAL_LAYER_PREFIX );
1900  }
1901 
1903  {
1904  QStringList attributes;
1905  const QMap<DxfFormatOption, QString> options = dxfFormatOptions();
1906 
1907  if ( options.contains( DxfFormatOption::LAYERATTRIBUTES ) )
1908  {
1909  attributes = options[ DxfFormatOption::LAYERATTRIBUTES ].split( ',' );
1910  }
1911 
1912  return attributes;
1913  }
1914 
1916  {
1917  bool use = false;
1918  const QMap<DxfFormatOption, QString> options = dxfFormatOptions();
1919 
1920  if ( options.contains( DxfFormatOption::USE_TITLE_AS_LAYERNAME ) )
1921  {
1922  use = QVariant( options[ DxfFormatOption::USE_TITLE_AS_LAYERNAME ] ).toBool();
1923  }
1924 
1925  return use;
1926  }
1927 
1929  {
1930  const QMap<DxfFormatOption, QString> options = dxfFormatOptions();
1931 
1932  double scale = -1;
1933  if ( options.contains( DxfFormatOption::SCALE ) )
1934  {
1935  scale = options[ DxfFormatOption::SCALE ].toDouble();
1936  }
1937 
1938  return scale;
1939  }
1940 
1942  {
1943  const QMap<DxfFormatOption, QString> options = dxfFormatOptions();
1944 
1946 
1947  if ( ! options.contains( DxfFormatOption::MODE ) )
1948  {
1949  return symbol;
1950  }
1951 
1952  const QString mode = options[ DxfFormatOption::MODE ];
1953  if ( mode.compare( QLatin1String( "SymbolLayerSymbology" ), Qt::CaseInsensitive ) == 0 )
1954  {
1956  }
1957  else if ( mode.compare( QLatin1String( "FeatureSymbology" ), Qt::CaseInsensitive ) == 0 )
1958  {
1960  }
1961 
1962  return symbol;
1963  }
1964 
1966  {
1967  QString codec = QStringLiteral( "ISO-8859-1" );
1968 
1969  if ( dxfFormatOptions().contains( DxfFormatOption::CODEC ) )
1970  {
1971  codec = dxfFormatOptions()[ DxfFormatOption::CODEC ];
1972  }
1973 
1974  return codec;
1975  }
1976 
1977  QMap<QgsWmsParameters::DxfFormatOption, QString> QgsWmsParameters::dxfFormatOptions() const
1978  {
1979  QMap<QgsWmsParameters::DxfFormatOption, QString> options;
1980 
1981  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameters::DxfFormatOption>() );
1982  const QStringList opts = mWmsParameters[ QgsWmsParameter::FORMAT_OPTIONS ].toStringList( ';' );
1983 
1984  for ( auto it = opts.constBegin(); it != opts.constEnd(); ++it )
1985  {
1986  const int equalIdx = it->indexOf( ':' );
1987  if ( equalIdx > 0 && equalIdx < ( it->length() - 1 ) )
1988  {
1989  const QString name = it->left( equalIdx ).toUpper();
1990  const QgsWmsParameters::DxfFormatOption option =
1991  ( QgsWmsParameters::DxfFormatOption ) metaEnum.keyToValue( name.toStdString().c_str() );
1992  const QString value = it->right( it->length() - equalIdx - 1 );
1993  options.insert( option, value );
1994  }
1995  }
1996 
1997  return options;
1998  }
1999 }
bool versionIsValid(const QString version) const
Returns true if version is valid, false otherwise.
Export only data.
Definition: qgsdxfexport.h:86
QList< QgsWmsParametersHighlightLayer > highlightLayersParameters() const
Returns parameters for each highlight layer.
int srcHeightAsInt() const
Returns SRCHEIGHT parameter as an int or its default value if not defined.
QFont layerFont() const
Returns the layer font (built thanks to the LAYERFONTFAMILY, LAYERFONTSIZE, LAYERFONTBOLD, ...
QString layerFontSize() const
Returns LAYERFONTSIZE parameter or an empty string if not defined.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
void dump() const
Dumps parameters.
int imageQualityAsInt() const
Returns IMAGE_QUALITY parameter as an integer.
QStringList highlightLabelWeight() const
Returns HIGHLIGHT_LABELWEIGHT as a list of string.
void setBoxSpace(double s)
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
QList< double > highlightLabelBufferSizeAsFloat() const
Returns HIGHLIGHT_LABELBUFFERSIZE as a list of float.
QString typeName() const
Returns the type of the parameter as a string.
double symbolHeightAsDouble() const
Returns SYMBOLHEIGHT as a double or its default value if not defined.
QUrl toUrl() const
Converts the parameter into an url.
QString transparent() const
Returns TRANSPARENT parameter or an empty string if not defined.
QString i() const
Returns I parameter or an empty string if not defined.
QList< QColor > highlightLabelColorAsColor() const
Returns HIGHLIGHT_LABELCOLOR as a list of color.
QMap< QString, QString > mUnmanagedParameters
const QString EXTERNAL_LAYER_PREFIX
int featureCountAsInt() const
Returns FEATURE_COUNT as an integer.
QStringList filters() const
Returns the list of filters found in FILTER parameter.
QString itemFontSize() const
Returns ITEMFONTSIZE parameter or an empty string if not defined.
QgsRectangle bboxAsRectangle() const
Returns BBOX as a rectangle if defined and valid.
QString j() const
Returns J parameter or an empty string if not defined.
QStringList highlightLabelBufferSize() const
Returns HIGHLIGHT_LABELBUFFERSIZE.
QString backgroundColor() const
Returns BGCOLOR parameter or an empty string if not defined.
QgsWmsParameter::Name mName
QList< QgsWmsParametersLayer > mLayers
QString srcWidth() const
Returns SRCWIDTH parameter or an empty string if not defined.
QString dxfCodec() const
Returns the DXF CODEC parameter.
int toInt() const
Converts the parameter into an integer.
QString scale() const
Returns SCALE parameter or an empty string if none is defined.
void setSymbolSize(QSizeF s)
QList< QColor > toColorList(const char delimiter=',') const
Converts the parameter into a list of colors.
QString layerFontBold() const
Returns LAYERFONTBOLD parameter or an empty string if not defined.
QString value(const QString &key) const
Returns the value of a parameter.
QgsLegendSettings legendSettings() const
Returns legend settings.
QList< QgsGeometry > toGeomList(const char delimiter=',') const
Converts the parameter into a list of geometries.
QString sldBody() const
Returns SLD_body if defined or an empty string.
QgsDxfExport::SymbologyExport dxfMode() const
Returns the DXF MODE parameter.
static void raiseError(const QString &msg)
Raises an exception in case of an invalid parameters.
int yAsInt() const
Returns Y parameter as an int or its default value if not defined.
double symbolSpaceAsDouble() const
Returns SYMBOLSPACE as a double or its default value if not defined.
double dpiAsDouble() const
Returns DPI parameter as an int or its default value if not defined.
double toDouble() const
Converts the parameter into a double.
QString loadUrl(bool &ok) const
Loads the data associated to the parameter converted into an url.
bool dxfUseLayerTitleAsName() const
Returns the DXF USE_TITLE_AS_LAYERNAME parameter.
bool isValid() const override
Returns true if the parameter is valid, false otherwise.
Format
Output format for the response.
QList< int > highlightLabelWeightAsInt() const
Returns HIGHLIGHT_LABELWEIGHT as a list of int.
int widthAsInt() const
Returns WIDTH parameter as an int or its default value if not defined.
void load(const QUrlQuery &query)
Loads new parameters.
double layerTitleSpaceAsDouble() const
Returns LAYERTITLESPACE as a double.
QString layerTitle() const
Returns LAYERTITLE parameter or an empty string if not defined.
QString symbolSpace() const
Returns SYMBOLSPACE parameter or an empty string if not defined.
QString layerFontColor() const
Returns LAYERFONTCOLOR parameter or an empty string if not defined.
Exception thrown in case of malformed request.
Format infoFormat() const
Returns infoFormat.
double layerSpaceAsDouble() const
Returns LAYERSPACE as a double or its default value if not defined.
QString featureCount() const
Returns FEATURE_COUNT parameter or an empty string if none is defined.
bool transparentAsBool() const
Returns TRANSPARENT parameter as a bool or its default value if not defined.
QString layerFontFamily() const
Returns LAYERFONTFAMILY parameter or an empty string if not defined.
DxfFormatOption
Options for DXF format.
QString symbolWidth() const
Returns SYMBOLWIDTH parameter or an empty string if not defined.
QStringList selections() const
Returns the list of feature selection found in SELECTION parameter.
bool withMapTip() const
withMapTip
QString bbox() const
Returns BBOX if defined or an empty string.
double iconLabelSpaceAsDouble() const
Returns ICONLABELSPACE as a double or its default value if not defined.
bool ruleLabelAsBool() const
Returns RULELABEL as a bool.
void raiseError() const
Raises an error in case of an invalid conversion.
bool showFeatureCountAsBool() const
Returns SHOWFEATURECOUNT as a bool.
QStringList highlightSymbol() const
Returns HIGHLIGHT_SYMBOL as a list of string.
QList< int > highlightLabelSizeAsInt() const
Returns HIGHLIGHT_LABELSIZE as a list of int An exception is raised if an invalid size is found...
double itemFontSizeAsDouble() const
Returns ITEMFONTSIZE as a double.
double toDouble(bool &ok) const
Converts the parameter into a double.
QStringList allLayersNickname() const
Returns nickname of layers found in LAYER and LAYERS parameters.
int lineToleranceAsInt() const
Returns FI_LINE_TOLERANCE parameter as an integer.
QUrl toUrl(bool &ok) const
Converts the parameter into an url.
void setFont(const QFont &font)
The font for this style.
QStringList opacities() const
Returns the list of opacities found in OPACITIES parameter.
QString x() const
Returns X parameter or an empty string if not defined.
QString layoutParameter(const QString &id, bool &ok) const
Returns a layout parameter thanks to its id.
QList< double > toDoubleList(bool &ok, char delimiter=',') const
Converts the parameter into a list of doubles.
QString itemFontColor() const
Returns ITEMFONTCOLOR parameter or an empty string if not defined.
QString itemFontItalic() const
Returns ITEMFONTITALIC parameter or an empty string if not defined.
QStringList highlightLabelString() const
Returns HIGHLIGHT_LABELSTRING as a list of string.
QString crs() const
Returns CRS or an empty string if none is defined.
bool isEmpty() const
Returns true if the rectangle is empty.
Definition: qgsrectangle.h:426
QList< int > toIntList(bool &ok, char delimiter=',') const
Converts the parameter into a list of integers.
QgsRectangle toRectangle(bool &ok) const
Converts the parameter into a rectangle.
QString filterGeom() const
Returns the filter geometry found in FILTER_GEOM parameter.
QString layerSpace() const
Returns LAYERSPACE parameter or an empty string if not defined.
A class to describe the version of a project.
QStringList highlightLabelSize() const
Returns HIGHLIGHT_LABELSIZE as a list of string.
Provides an interface to retrieve and manipulate WMS parameters received from the client...
int infoFormatVersion() const
Returns the infoFormat version for GML.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QStringList highlightLabelBufferColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of string.
QString version() const
Returns VERSION parameter as a string or an empty string if not defined.
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
QUrlQuery urlQuery() const
Returns a url query with underlying parameters.
QString imageQuality() const
Returns IMAGE_QUALITY parameter or an empty string if not defined.
QList< QgsWmsParametersHighlightLayer > mHighlightLayers
QString loadUrl() const
Loads the data associated to the parameter converted into an url.
void setTitle(const QString &t)
QString composerTemplate() const
Returns TEMPLATE parameter or an empty string if not defined.
QgsProjectVersion versionAsNumber() const
Returns VERSION parameter if defined or its default value.
QgsWmsParameters()
Constructor for WMS parameters with default values only.
void setMargin(Side side, double margin)
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
QColor toColor(bool &ok) const
Converts the parameter into a color.
QStringList toStringList(char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of strings.
QStringList queryLayersNickname() const
Returns nickname of layers found in QUERY_LAYERS parameter.
void setFontColor(const QColor &c)
QgsWmsParametersFilter::Type mType
int pointToleranceAsInt() const
Returns FI_POINT_TOLERANCE parameter as an integer.
Format format() const
Returns format.
Keeps the number of features and export symbology per feature (using the first symbol level) ...
Definition: qgsdxfexport.h:87
QgsOgcUtils::FilterVersion mVersion
void set(QgsWmsParameter::Name name, const QVariant &value)
Sets a parameter value thanks to its name.
bool itemFontItalicAsBool() const
Returns ITEMFONTITALIC as a boolean or its default value if not defined.
int polygonToleranceAsInt() const
Returns FI_POLYGON_TOLERANCE parameter as an integer.
QList< double > toDoubleList(const char delimiter=',') const
Converts the parameter into a list of doubles.
bool layerTitleAsBool() const
Returns LAYERTITLE as a bool or its default value if not defined.
Median cut implementation.
bool withGeometry() const
Returns if the client wants the feature info response with geometry information.
double symbolWidthAsDouble() const
Returns SYMBOLWIDTH as a double or its default value if not defined.
void setLayerFontColor(const QColor &fontColor)
Sets layer font color to fontColor Overrides fontColor()
int heightAsInt() const
Returns HEIGHT parameter as an int or its default value if not defined.
QString layerTitleSpace() const
Returns LAYERTITLESPACE 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.
double boxSpaceAsDouble() const
Returns BOXSPACE as a double or its default value if not defined.
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns reference to modifiable style.
int toInt(bool &ok) const
Converts the parameter into an integer.
QList< QgsWmsParametersExternalLayer > mExternalLayers
QStringList allStyles() const
Returns styles found in STYLE and STYLES parameters.
int jAsInt() const
Returns J parameter as an int or its default value if not defined.
double scaleAsDouble() const
Returns SCALE as a double.
QFont itemFont() const
Returns the item font (built thanks to the ITEMFONTFAMILY, ITEMFONTSIZE, ITEMFONTBOLD, ...
QColor layerFontColorAsColor() const
Returns LAYERFONTCOLOR as a color or its defined value if not defined.
QgsWmsParameter operator[](QgsWmsParameter::Name name) const
Returns the parameter corresponding to name.
QString name() const
Returns the name of the parameter.
QString pointTolerance() const
Returns FI_POINT_TOLERANCE parameter or an empty string if not defined.
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
QByteArray encodedUri() const
Returns the complete encoded URI as a byte array.
QString toString(bool defaultValue=false) const
Converts the parameter into a string.
double dxfScale() const
Returns the DXF SCALE parameter.
QString boxSpace() const
Returns BOXSPACE parameter or an empty string if not defined.
QString width() const
Returns WIDTH parameter or an empty string if not defined.
virtual bool isValid() const
Returns true if the parameter is valid, false otherwise.
bool itemFontBoldAsBool() const
Returns ITEMFONTBOLD as a boolean or its default value if not defined.
QgsWmsParameter(const QgsWmsParameter::Name name=QgsWmsParameter::UNKNOWN, const QVariant::Type type=QVariant::String, const QVariant defaultValue=QVariant(""))
Constructor for QgsWmsParameter.
QString polygonTolerance() const
Returns FI_POLYGON_TOLERANCE parameter or an empty string if not defined.
QString symbolHeight() const
Returns SYMBOLHEIGHT parameter or an empty string if not defined.
QStringList atlasPk() const
Returns the ATLAS_PK parameter.
QList< int > opacitiesAsInt() const
Returns the list of opacities found in OPACITIES parameter as integers.
QList< int > toIntList(const char delimiter=',') const
Converts the parameter into a list of integers.
QColor itemFontColorAsColor() const
Returns ITEMFONTCOLOR as a color.
QString formatAsString() const
Returns FORMAT parameter as a string.
QStringList dxfLayerAttributes() const
Returns the DXF LAYERATTRIBUTES parameter.
bool layerFontBoldAsBool() const
Returns LAYERFONTBOLD as a boolean or its default value if not defined.
QString lineTolerance() const
Returns FI_LINE_TOLERANCE parameter or an empty string if not defined.
QString height() const
Returns HEIGHT parameter or an empty string if not defined.
QString rule() const
Returns RULE parameter or an empty string if none is defined.
QStringList toStyleList(const char delimiter=',') const
Converts the parameter into a list of strings and keeps empty parts Default style value is an empty s...
QString y() const
Returns Y parameter or an empty string if not defined.
int srcWidthAsInt() const
Returns SRCWIDTH parameter as an int or its default value if not defined.
QColor backgroundColorAsColor() const
Returns BGCOLOR parameter as a QColor or its default value if not defined.
QList< QgsGeometry > toGeomList(bool &ok, char delimiter=',') const
Converts the parameter into a list of geometries.
QString layerFontItalic() const
Returns LAYERFONTITALIC parameter or an empty string if not defined.
QString wmtver() const
Returns WMTVER parameter or an empty string if not defined.
QMap< DxfFormatOption, QString > dxfFormatOptions() const
Returns a map of DXF options defined within FORMAT_OPTIONS parameter.
QString showFeatureCount() const
Returns SHOWFEATURECOUNT parameter or an empty string if none is defined.
QString srcHeight() const
Returns SRCHEIGHT parameter or an empty string if not defined.
Class for storing the component parts of a RDBMS data source URI (e.g.
QList< QgsWmsParametersExternalLayer > externalLayersParameters() const
Returns parameters for each external layer.
QString dpi() const
Returns DPI parameter or an empty string if not defined.
QString infoFormatAsString() const
Returns INFO_FORMAT parameter as a string.
int iAsInt() const
Returns I parameter as an int or its default value if not defined.
bool layerFontItalicAsBool() const
Returns LAYERFONTITALIC as a boolean or its default value if not defined.
QList< QgsWmsParametersLayer > layersParameters() const
Returns parameters for each layer found in LAYER/LAYERS.
bool infoFormatIsImage() const
Checks if INFO_FORMAT parameter is one of the image formats (PNG, JPG).
QString itemFontBold() const
Returns ITEMFONTBOLD parameter or an empty string if not defined.
QgsWmsParametersComposerMap composerMapParameters(int mapId) const
Returns the requested parameters for a composer map parameter.
QString iconLabelSpace() const
Returns ICONLABELSPACE parameter or an empty string if not defined.
QList< QColor > toColorList(bool &ok, char delimiter=',') const
Converts the parameter into a list of colors.
QList< QgsWmsParametersFilter > mFilter
QStringList highlightLabelColor() const
Returns HIGHLIGHT_LABELCOLOR as a list of string.
QColor toColor() const
Converts the parameter into a color.
WMS parameter received from the client.
double layerFontSizeAsDouble() const
Returns LAYERFONTSIZE as a double.
QStringList highlightGeom() const
Returns HIGHLIGHT_GEOM as a list of string in WKT.
QList< QgsGeometry > highlightGeomAsGeom() const
Returns HIGHLIGHT_GEOM as a list of geometries.
QList< QColor > highlightLabelBufferColorAsColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of colors.
QString ruleLabel() const
Returns RULELABEL parameter or an empty string if none is defined.
QString externalWMSUri(const QString &id) const
Returns the external WMS uri.
QString itemFontFamily() const
Returns ITEMFONTFAMILY parameter or an empty string if not defined.
QString wmsPrecision() const
Returns WMS_PRECISION parameter or an empty string if not defined.
int xAsInt() const
Returns X parameter as an int or its default value if not defined.
QStringList highlightLabelFont() const
Returns HIGHLIGHT_LABELFONT.
Name
Available parameters for WMS requests.
Exports one feature per symbol layer (considering symbol levels)
Definition: qgsdxfexport.h:88
Definition of a parameter with basic conversion methods.