QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsvectorlayerserverproperties.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerserverproperties.h
3  ------------------
4  begin : August 23, 2019
5  copyright : (C) 2019 by RenĂ©-Luc D'Hont
6  email : rldhont at 3liz 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 QGSVECTORLAYERSERVERPROPERTIES_H
19 #define QGSVECTORLAYERSERVERPROPERTIES_H
20 
21 #include "qgis_sip.h"
22 #include "qgis_core.h"
23 #include <QMap>
24 #include <QString>
25 #include <QMetaType>
26 #include <QVariant>
27 
28 class QgsVectorLayer;
29 
30 class QDomNode;
31 class QDomDocument;
32 
39 {
40  Q_GADGET
41 
42  public:
43 
49  {
52  ELEVATION
53  };
54  Q_ENUM( PredefinedWmsDimensionName )
55 
56 
60  struct CORE_EXPORT WmsDimensionInfo
61  {
62 
68  {
69  AllValues = 0,
70  MinValue = 1,
71  MaxValue = 2,
72  ReferenceValue = 3,
73  };
74 
78  explicit WmsDimensionInfo( const QString &dimName,
79  const QString &dimFieldName,
80  const QString &dimEndFieldName = QString(),
81  const QString &dimUnits = QString(),
82  const QString &dimUnitSymbol = QString(),
83  const int &dimDefaultDisplayType = QgsVectorLayerServerProperties::WmsDimensionInfo::AllValues,
84  const QVariant &dimReferenceValue = QVariant() )
85  : name( dimName )
86  , fieldName( dimFieldName )
87  , endFieldName( dimEndFieldName )
88  , units( dimUnits )
89  , unitSymbol( dimUnitSymbol )
90  , defaultDisplayType( dimDefaultDisplayType )
91  , referenceValue( dimReferenceValue )
92  {}
93  QString name;
94  QString fieldName;
95  QString endFieldName;
96  QString units;
97  QString unitSymbol;
99  QVariant referenceValue;
100  };
101 
108 
113  static QMap<int, QString> wmsDimensionDefaultDisplayLabels();
114 
121  bool addWmsDimension( const QgsVectorLayerServerProperties::WmsDimensionInfo &wmsDimInfo );
122 
128  bool removeWmsDimension( const QString &wmsDimName );
129 
134  const QList<QgsVectorLayerServerProperties::WmsDimensionInfo> wmsDimensions() const;
135 
136 
141  void writeXml( QDomNode &layer_node, QDomDocument &document ) const;
142 
147  void readXml( const QDomNode &layer_node );
148 
149  private: // Private attributes
150 
151  QgsVectorLayer *mLayer = nullptr;
152 
154  QList<QgsVectorLayerServerProperties::WmsDimensionInfo> mWmsDimensions;
155 };
156 
157 #endif // QGSVECTORLAYERSERVERPROPERTIES_H
Manages QGIS Server properties for a vector layer.
PredefinedWmsDimensionName
Predefined/Restricted WMS Dimension name.
Represents a vector layer which manages a vector based data sets.
Setting to define QGIS Server WMS Dimension.
WmsDimensionInfo(const QString &dimName, const QString &dimFieldName, const QString &dimEndFieldName=QString(), const QString &dimUnits=QString(), const QString &dimUnitSymbol=QString(), const int &dimDefaultDisplayType=QgsVectorLayerServerProperties::WmsDimensionInfo::AllValues, const QVariant &dimReferenceValue=QVariant())
Constructor for WmsDimensionInfo.
DefaultDisplay
Selection behavior for QGIS Server WMS Dimension default display.