QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsmaplayerserverproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaplayerserverproperties.h
3 ------------------
4 begin : June 21, 2021
5 copyright : (C) 2021 by Etienne Trimaille
6 email : etrimaille 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 QGSMAPLAYERSERVERPROPERTIES_H
19#define QGSMAPLAYERSERVERPROPERTIES_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
28class QgsMapLayer;
29
30class QDomNode;
31class QDomDocument;
32
39{
40 Q_GADGET
41
42 public:
43
49 struct CORE_EXPORT MetadataUrl
50 {
51
55 MetadataUrl( const QString &url = QString(), const QString &type = QString(), const QString &format = QString() )
56 : url( url )
57 , type( type )
58 , format( format )
59 {}
60
64 QString url;
65
69 QString type;
70
74 QString format;
75
76 // TODO c++20 - replace with = default
77
80 };
81
83
89 QList<QgsServerMetadataUrlProperties::MetadataUrl> metadataUrls() const { return mMetadataUrls; };
90
96 void setMetadataUrls( const QList<QgsServerMetadataUrlProperties::MetadataUrl> &metaUrls ) { mMetadataUrls = metaUrls; };
97
102 void addMetadataUrl( const QgsServerMetadataUrlProperties::MetadataUrl &metaUrl ) { mMetadataUrls << metaUrl; };
103
105 virtual const QgsMapLayer *layer() const = 0;
106
107 protected:
109 void writeXml( QDomNode &layer_node, QDomDocument &document ) const SIP_SKIP;
110
112 void readXml( const QDomNode &layer_node ) SIP_SKIP;
113
119 void copyTo( QgsServerMetadataUrlProperties *properties ) const SIP_SKIP;
120
122 void reset() SIP_SKIP;
123
124 private:
125 QList<MetadataUrl> mMetadataUrls;
126
127};
128
129
136{
137 Q_GADGET
138
139 public:
140
145 {
148 ELEVATION
149 };
150 Q_ENUM( PredefinedWmsDimensionName )
151
152
156 struct CORE_EXPORT WmsDimensionInfo
157 {
158
164 {
165 AllValues = 0,
166 MinValue = 1,
167 MaxValue = 2,
168 ReferenceValue = 3,
169 };
170
174 explicit WmsDimensionInfo( const QString &dimName,
175 const QString &dimFieldName,
176 const QString &dimEndFieldName = QString(),
177 const QString &dimUnits = QString(),
178 const QString &dimUnitSymbol = QString(),
179 const int &dimDefaultDisplayType = QgsServerWmsDimensionProperties::WmsDimensionInfo::AllValues,
180 const QVariant &dimReferenceValue = QVariant() )
181 : name( dimName )
182 , fieldName( dimFieldName )
183 , endFieldName( dimEndFieldName )
184 , units( dimUnits )
185 , unitSymbol( dimUnitSymbol )
186 , defaultDisplayType( dimDefaultDisplayType )
187 , referenceValue( dimReferenceValue )
188 {}
189 QString name;
190 QString fieldName;
192 QString units;
193 QString unitSymbol;
196 };
197
199
204 static QMap<int, QString> wmsDimensionDefaultDisplayLabels();
205
212 bool addWmsDimension( const QgsServerWmsDimensionProperties::WmsDimensionInfo &wmsDimInfo );
213
219 bool removeWmsDimension( const QString &wmsDimName );
220
226 void setWmsDimensions( const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> &dimensions );
227
232 const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> wmsDimensions() const;
233
235 virtual const QgsMapLayer *layer() const = 0;
236
237 protected:
238
242 void writeXml( QDomNode &layer_node, QDomDocument &document ) const SIP_SKIP;
243
247 void readXml( const QDomNode &layer_node ) SIP_SKIP;
248
254 void copyTo( QgsServerWmsDimensionProperties *properties ) const SIP_SKIP;
255
259 void reset() SIP_SKIP;
260
261 private: // Private attributes
263 QList<WmsDimensionInfo> mWmsDimensions;
264};
265
266
273{
274 Q_GADGET
275
276 public:
277
283 QgsMapLayerServerProperties( QgsMapLayer *layer = nullptr );
284
290 void copyTo( QgsMapLayerServerProperties *properties ) const;
291
296 void writeXml( QDomNode &layer_node, QDomDocument &document ) const; // cppcheck-suppress duplInheritedMember
297
302 void readXml( const QDomNode &layer_node ); // cppcheck-suppress duplInheritedMember
303
308 void reset(); // cppcheck-suppress duplInheritedMember
309
317 void setShortName( const QString &name ) { mShortName = name; }
318
326 QString shortName() const { return mShortName; }
327
335 void setTitle( const QString &title ) { mTitle = title; }
336
344 void setWfsTitle( const QString &title ) { mWfsTitle = title; }
345
353 QString title() const { return mTitle; }
354
363 QString wfsTitle() const { return mWfsTitle.isEmpty() ? mTitle : mWfsTitle; }
364
372 void setAbstract( const QString &abstract ) { mAbstract = abstract; }
373
381 QString abstract() const { return mAbstract; }
382
390 void setKeywordList( const QString &keywords ) { mKeywordList = keywords; }
391
399 QString keywordList() const { return mKeywordList; }
400
410 void setDataUrl( const QString &dataUrl ) { mDataUrl = dataUrl; }
411
421 QString dataUrl() const { return mDataUrl; }
422
432 void setDataUrlFormat( const QString &dataUrlFormat ) { mDataUrlFormat = dataUrlFormat; }
433
443 QString dataUrlFormat() const { return mDataUrlFormat; }
444
454 void setAttribution( const QString &attrib ) { mAttribution = attrib; }
455
465 QString attribution() const { return mAttribution; }
466
476 void setAttributionUrl( const QString &url ) { mAttributionUrl = url; }
477
487 QString attributionUrl() const { return mAttributionUrl; }
488
490 const QgsMapLayer *layer() const override { return mLayer; };
491
492 private:
493 QgsMapLayer *mLayer = nullptr;
494
495 QString mShortName;
496 QString mTitle;
497 QString mWfsTitle; // optional WFS title
498
499 QString mAttribution;
500 QString mAttributionUrl;
501
502 QString mDataUrl;
503 QString mDataUrlFormat;
504
505 QString mAbstract;
506 QString mKeywordList;
507
508};
509
516// XXX How to make a proper SIP type alias ?
517//using QgsVectorLayerServerProperties = QgsMapLayerServerProperties;
519{
520 Q_GADGET
521};
522
523#endif // QGSMAPLAYERSERVERPROPERTIES_H
524
Manages QGIS Server properties for a map layer.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layerused by QGIS Server in GetCapabilities request.
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
void setAttributionUrl(const QString &url)
Sets the attribution url of the layer used by QGIS Server in GetCapabilities request.
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
void setShortName(const QString &name)
Sets the short name of the layer used by QGIS Server to identify the layer.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
QString keywordList() const
Returns the keyword list of the layerused by QGIS Server in GetCapabilities request.
QString wfsTitle() const
Returns the optional WFS title if set or the title of the layer used by QGIS WFS in GetCapabilities r...
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
const QgsMapLayer * layer() const override
Gets the parent layer.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void setKeywordList(const QString &keywords)
Sets the keywords list of the layerused by QGIS Server in GetCapabilities request.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setWfsTitle(const QString &title)
Sets the title of the layer used by QGIS Server in WFS GetCapabilities request.
QString abstract() const
Returns the abstract of the layerused by QGIS Server in GetCapabilities request.
Base class for all map layer types.
Definition qgsmaplayer.h:76
Manages QGIS Server properties for a map layer.
virtual ~QgsServerMetadataUrlProperties()=default
virtual const QgsMapLayer * layer() const =0
Gets the parent layer.
void addMetadataUrl(const QgsServerMetadataUrlProperties::MetadataUrl &metaUrl)
Add a metadataUrl for the layer.
void setMetadataUrls(const QList< QgsServerMetadataUrlProperties::MetadataUrl > &metaUrls)
Sets a the list of metadata URL for the layer.
QList< QgsServerMetadataUrlProperties::MetadataUrl > metadataUrls() const
Returns a list of metadataUrl resources associated for the layer.
Manages QGIS Server properties for Wms dimensions.
PredefinedWmsDimensionName
Predefined/Restricted WMS Dimension name.
virtual const QgsMapLayer * layer() const =0
Gets the parent layer.
virtual ~QgsServerWmsDimensionProperties()=default
Convenient class for API compatibility.
#define SIP_SKIP
Definition qgis_sip.h:126
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
MetadataUrl(const QString &url=QString(), const QString &type=QString(), const QString &format=QString())
Constructor for MetadataUrl.
QString format
Format specification of online resource.
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=QgsServerWmsDimensionProperties::WmsDimensionInfo::AllValues, const QVariant &dimReferenceValue=QVariant())
Constructor for WmsDimensionInfo.
DefaultDisplay
Selection behavior for QGIS Server WMS Dimension default display.