QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
qgswmsparameters.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgswmsparameters.h
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 #ifndef QGSWMSPARAMETERS_H
19 #define QGSWMSPARAMETERS_H
20 
21 #include <QMap>
22 #include <QMetaEnum>
23 #include <QColor>
24 
25 #include "qgsrectangle.h"
26 #include "qgslegendsettings.h"
27 #include "qgsprojectversion.h"
28 #include "qgsogcutils.h"
29 #include "qgsserverparameters.h"
30 #include "qgsdxfexport.h"
31 
32 namespace QgsWms
33 {
35  {
37  enum Type
38  {
40  SQL,
42  };
43 
44  QString mFilter;
47  };
48 
50  {
51  QString mNickname; // name, id or short name
52  int mOpacity = -1;
53  QList<QgsWmsParametersFilter> mFilter; // list of filter
54  QStringList mSelection; // list of string fid
55  QString mStyle;
56  };
57 
59  {
60  QString mName;
61  QString mUri;
62  };
63 
65  {
66  QString mName;
68  QString mSld;
69  QString mLabel;
70  QColor mColor;
71  int mSize = 0;
72  int mWeight = 0;
73  QString mFont;
74  float mBufferSize = 0;
75  QColor mBufferColor;
76  };
77 
79  {
80  int mId = 0; // composer map id
81  bool mHasExtent = false; // does the request contains extent for this composer map
82  QgsRectangle mExtent; // the request extent for this composer map
83  float mScale = -1;
84  float mRotation = 0;
85  float mGridX = 0;
86  float mGridY = 0;
87  QList<QgsWmsParametersLayer> mLayers; // list of layers for this composer map
88  QList<QgsWmsParametersExternalLayer> mExternalLayers; // list of external layers for this composer map
89  QList<QgsWmsParametersHighlightLayer> mHighlightLayers; // list of highlight layers for this composer map
90  };
91 
99  {
100  Q_GADGET
101 
102  public:
104  enum Name
105  {
148  I,
149  J,
150  X,
151  Y,
181  TILED
182  };
183  Q_ENUM( Name )
184 
185 
192  const QVariant::Type type = QVariant::String,
193  const QVariant defaultValue = QVariant( "" ) );
194 
198  virtual ~QgsWmsParameter() override = default;
199 
203  bool isValid() const override;
204 
212  QStringList toStyleList( const char delimiter = ',' ) const;
213 
220  QList<QgsGeometry> toGeomList( const char delimiter = ',' ) const;
221 
228  QList<int> toIntList( const char delimiter = ',' ) const;
229 
236  QList<double> toDoubleList( const char delimiter = ',' ) const;
237 
244  QList<QColor> toColorList( const char delimiter = ',' ) const;
245 
251  QgsRectangle toRectangle() const;
252 
258  int toInt() const;
259 
265  double toDouble() const;
266 
272  QColor toColor() const;
273 
280  QUrl toUrl() const;
281 
288  QString loadUrl() const;
289 
294  void raiseError() const;
295 
300  QString name() const;
301 
305  static QString name( const QgsWmsParameter::Name );
306 
311  static QgsWmsParameter::Name name( const QString &name );
312 
314  int mId = -1;
315  };
316 
324  {
325  Q_GADGET
326 
327  public:
328 
330  enum Format
331  {
341  JSON
342  };
343  Q_ENUM( Format )
344 
345 
347  {
354  FORCE_2D
355  };
356  Q_ENUM( DxfFormatOption )
357 
358 
362  QgsWmsParameters( const QgsServerParameters &parameters );
363 
368 
369  virtual ~QgsWmsParameters() override = default;
370 
375  QgsWmsParameter operator[]( QgsWmsParameter::Name name ) const;
376 
381  void set( QgsWmsParameter::Name name, const QVariant &value );
382 
386  void dump() const;
387 
392  QString crs() const;
393 
398  QString width() const;
399 
407  int widthAsInt() const;
408 
413  QString height() const;
414 
422  int heightAsInt() const;
423 
429  QString srcWidth() const;
430 
439  int srcWidthAsInt() const;
440 
446  QString srcHeight() const;
447 
456  int srcHeightAsInt() const;
457 
462  QgsProjectVersion versionAsNumber() const;
463 
468  bool versionIsValid( const QString version ) const;
469 
474  QString bbox() const;
475 
482  QgsRectangle bboxAsRectangle() const;
483 
488  QString sldBody() const;
489 
494  QStringList selections() const;
495 
500  QStringList filters() const;
501 
506  QString filterGeom() const;
507 
512  QStringList opacities() const;
513 
521  QList<int> opacitiesAsInt() const;
522 
527  QStringList allLayersNickname() const;
528 
533  QStringList queryLayersNickname() const;
534 
539  QStringList allStyles() const;
540 
545  QList<QgsWmsParametersLayer> layersParameters() const;
546 
552  QString polygonTolerance() const;
553 
559  QString lineTolerance() const;
560 
566  QString pointTolerance() const;
567 
573  int polygonToleranceAsInt() const;
574 
580  int lineToleranceAsInt() const;
581 
587  int pointToleranceAsInt() const;
588 
593  QString formatAsString() const;
594 
599  static QString formatAsString( Format format );
600 
606  Format format() const;
607 
612  QString infoFormatAsString() const;
613 
618  bool infoFormatIsImage() const;
619 
625  QString imageQuality() const;
626 
632  int imageQualityAsInt() const;
633 
639  QString tiled() const;
640 
646  bool tiledAsBool() const;
647 
653  Format infoFormat() const;
654 
660  int infoFormatVersion() const;
661 
666  QString i() const;
667 
675  int iAsInt() const;
676 
681  QString j() const;
682 
690  int jAsInt() const;
691 
696  QString x() const;
697 
705  int xAsInt() const;
706 
711  QString y() const;
712 
720  int yAsInt() const;
721 
726  QString rule() const;
727 
732  QString ruleLabel() const;
733 
740  bool ruleLabelAsBool() const;
741 
746  QString showFeatureCount() const;
747 
754  bool showFeatureCountAsBool() const;
755 
760  QString featureCount() const;
761 
768  int featureCountAsInt() const;
769 
774  QString scale() const;
775 
782  double scaleAsDouble() const;
783 
788  QString boxSpace() const;
789 
796  double boxSpaceAsDouble() const;
797 
802  QString layerSpace() const;
803 
810  double layerSpaceAsDouble() const;
811 
816  QString layerTitleSpace() const;
817 
824  double layerTitleSpaceAsDouble() const;
825 
830  QString symbolSpace() const;
831 
838  double symbolSpaceAsDouble() const;
839 
844  QString iconLabelSpace() const;
845 
852  double iconLabelSpaceAsDouble() const;
853 
858  QString symbolWidth() const;
859 
866  double symbolWidthAsDouble() const;
867 
872  QString symbolHeight() const;
873 
880  double symbolHeightAsDouble() const;
881 
887  QFont layerFont() const;
888 
893  QString layerFontFamily() const;
894 
899  QString layerFontBold() const;
900 
907  bool layerFontBoldAsBool() const;
908 
913  QString layerFontItalic() const;
914 
921  bool layerFontItalicAsBool() const;
922 
927  QString layerFontSize() const;
928 
935  double layerFontSizeAsDouble() const;
936 
941  QString layerFontColor() const;
942 
949  QColor layerFontColorAsColor() const;
950 
956  QFont itemFont() const;
957 
962  QString itemFontFamily() const;
963 
968  QString itemFontBold() const;
969 
976  bool itemFontBoldAsBool() const;
977 
982  QString itemFontItalic() const;
983 
990  bool itemFontItalicAsBool() const;
991 
996  QString itemFontSize() const;
997 
1004  double itemFontSizeAsDouble() const;
1005 
1010  QString itemFontColor() const;
1011 
1018  QColor itemFontColorAsColor() const;
1019 
1024  QString layerTitle() const;
1025 
1032  bool layerTitleAsBool() const;
1033 
1038  QgsLegendSettings legendSettings() const;
1039 
1044  QList<QgsWmsParametersHighlightLayer> highlightLayersParameters() const;
1045 
1050  QList<QgsWmsParametersExternalLayer> externalLayersParameters() const;
1051 
1056  QStringList highlightGeom() const;
1057 
1064  QList<QgsGeometry> highlightGeomAsGeom() const;
1065 
1070  QStringList highlightSymbol() const;
1071 
1076  QStringList highlightLabelString() const;
1077 
1082  QStringList highlightLabelColor() const;
1083 
1090  QList<QColor> highlightLabelColorAsColor() const;
1091 
1096  QStringList highlightLabelSize() const;
1097 
1104  QList<int> highlightLabelSizeAsInt() const;
1105 
1110  QStringList highlightLabelWeight() const;
1111 
1118  QList<int> highlightLabelWeightAsInt() const;
1119 
1124  QStringList highlightLabelFont() const;
1125 
1130  QStringList highlightLabelBufferSize() const;
1131 
1138  QList<double> highlightLabelBufferSizeAsFloat() const;
1139 
1144  QStringList highlightLabelBufferColor() const;
1145 
1152  QList<QColor> highlightLabelBufferColorAsColor() const;
1153 
1158  QString wmsPrecision() const;
1159 
1167  int wmsPrecisionAsInt() const;
1168 
1173  QString transparent() const;
1174 
1182  bool transparentAsBool() const;
1183 
1188  QString backgroundColor() const;
1189 
1197  QColor backgroundColorAsColor() const;
1198 
1203  QString dpi() const;
1204 
1212  double dpiAsDouble() const;
1213 
1218  QString composerTemplate() const;
1219 
1229  QgsWmsParametersComposerMap composerMapParameters( int mapId ) const;
1230 
1236  QString externalWMSUri( const QString &id ) const;
1237 
1242  bool withGeometry() const;
1243 
1248  bool withMapTip() const;
1249 
1254  QString wmtver() const;
1255 
1263  QString layoutParameter( const QString &id, bool &ok ) const;
1264 
1270  QStringList atlasPk() const;
1271 
1276  QMap<DxfFormatOption, QString> dxfFormatOptions() const;
1277 
1282  QStringList dxfLayerAttributes() const;
1283 
1288  bool dxfUseLayerTitleAsName() const;
1289 
1294  double dxfScale() const;
1295 
1300  QgsDxfExport::SymbologyExport dxfMode() const;
1301 
1306  QString dxfCodec() const;
1307 
1312  QMap<QString, QString> dimensionValues() const;
1313 
1320  bool noMText() const;
1321 
1328  bool isForce2D() const;
1329 
1330  private:
1331  static bool isExternalLayer( const QString &name );
1332 
1333  bool loadParameter( const QString &name, const QString &value ) override;
1334 
1335  void save( const QgsWmsParameter &parameter, bool multi = false );
1336 
1337  QgsWmsParameter idParameter( QgsWmsParameter::Name name, int id ) const;
1338 
1339  void raiseError( const QString &msg ) const;
1340  void log( const QString &msg ) const;
1341 
1342  QgsWmsParametersExternalLayer externalLayerParameter( const QString &name ) const;
1343 
1344  QMultiMap<QString, QgsWmsParametersFilter> layerFilters( const QStringList &layers ) const;
1345 
1346 
1347  QMap<QgsWmsParameter::Name, QgsWmsParameter> mWmsParameters;
1348  QMap<QString, QMap<QString, QString> > mExternalWMSParameters;
1349  QList<QgsProjectVersion> mVersions;
1350  };
1351 }
1352 
1353 #endif
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsWmsParameter::Name mName
QList< QgsWmsParametersLayer > mLayers
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:122
Format
Output format for the response.
const QgsCoordinateReferenceSystem & crs
DxfFormatOption
Options for DXF format.
A class to describe the version of a project.
Provides an interface to retrieve and manipulate WMS parameters received from the client...
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
QList< QgsWmsParametersHighlightLayer > mHighlightLayers
QgsWmsParametersFilter::Type mType
QgsOgcUtils::FilterVersion mVersion
FilterVersion
OGC filter version.
Definition: qgsogcutils.h:156
Median cut implementation.
QList< QgsWmsParametersExternalLayer > mExternalLayers
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
QList< QgsWmsParametersFilter > mFilter
WMS parameter received from the client.
Name
Available parameters for WMS requests.
Definition of a parameter with basic conversion methods.