QGIS API Documentation 4.3.0-Master (c789d26cbf6)
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.h"
22#include "qgis_core.h"
23#include "qgis_sip.h"
24
25#include <QMap>
26#include <QMetaType>
27#include <QString>
28#include <QVariant>
29
30class QgsMapLayer;
31
32class QDomNode;
33class QDomDocument;
34
41{
42 Q_GADGET
43
44 public:
50 struct CORE_EXPORT MetadataUrl
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 // TODO c++20 - replace with = default
108
109 bool operator==( const QgsServerMetadataUrlProperties &other ) const;
110 bool operator!=( const QgsServerMetadataUrlProperties &other ) const;
111
112 protected:
114 void writeXml( QDomNode &layerNode, QDomDocument &document ) const SIP_SKIP;
115
117 void readXml( const QDomNode &layerNode ) SIP_SKIP;
118
124 void copyTo( QgsServerMetadataUrlProperties *properties ) const SIP_SKIP;
125
127 void reset() SIP_SKIP;
128
129 private:
130 QList<MetadataUrl> mMetadataUrls;
131};
132
133
140{
141 Q_GADGET
142
143 public:
153 Q_ENUM( PredefinedWmsDimensionName )
154
155
159 struct CORE_EXPORT WmsDimensionInfo
160 {
165 const QString &dimName,
166 const QString &dimFieldName,
167 const QString &dimEndFieldName = QString(),
168 const QString &dimUnits = QString(),
169 const QString &dimUnitSymbol = QString(),
171 const QVariant &dimReferenceValue = QVariant()
172 )
173 : name( dimName )
174 , fieldName( dimFieldName )
175 , endFieldName( dimEndFieldName )
176 , units( dimUnits )
177 , unitSymbol( dimUnitSymbol )
178 , defaultDisplayType( dimDefaultDisplayType )
179 , referenceValue( dimReferenceValue )
180 {}
181
182 bool operator==( const WmsDimensionInfo &other ) const;
183 bool operator!=( const WmsDimensionInfo &other ) const;
184
185 QString name;
186 QString fieldName;
188 QString units;
189 QString unitSymbol;
192 };
193
195
196 // TODO c++20 - replace with = default
197
198 bool operator==( const QgsServerWmsDimensionProperties &other ) const;
199 bool operator!=( const QgsServerWmsDimensionProperties &other ) const;
200
205 static QMap<int, QString> wmsDimensionDefaultDisplayLabels();
206
213 static QMap<Qgis::WmsDimensionDefaultDisplay, QString> wmsDimensionDefaultDisplayDescriptions() SIP_SKIP;
214
222
228 bool removeWmsDimension( const QString &wmsDimName );
229
235 void setWmsDimensions( const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> &dimensions );
236
242
244 virtual const QgsMapLayer *layer() const = 0;
245
246 protected:
250 void writeXml( QDomNode &layer_node, QDomDocument &document ) const SIP_SKIP;
251
255 void readXml( const QDomNode &layer_node ) SIP_SKIP;
256
262 void copyTo( QgsServerWmsDimensionProperties *properties ) const SIP_SKIP;
263
267 void reset() SIP_SKIP;
268
269 private: // Private attributes
271 QList<WmsDimensionInfo> mWmsDimensions;
272};
273
274
281{
282 Q_GADGET
283
284 public:
291
292 // TODO c++20 - replace with = default
293
294 bool operator==( const QgsMapLayerServerProperties &other ) const;
295 bool operator!=( const QgsMapLayerServerProperties &other ) const;
296
302 void copyTo( QgsMapLayerServerProperties *properties ) const;
303
308 void writeXml( QDomNode &layer_node, QDomDocument &document ) const; // cppcheck-suppress duplInheritedMember
309
314 void readXml( const QDomNode &layer_node ); // cppcheck-suppress duplInheritedMember
315
320 void reset(); // cppcheck-suppress duplInheritedMember
321
329 void setShortName( const QString &name ) { mShortName = name; }
330
338 QString shortName() const { return mShortName; }
339
344 QString wfsTypeName() const;
345
353 void setTitle( const QString &title ) { mTitle = title; }
354
362 void setWfsTitle( const QString &title ) { mWfsTitle = title; }
363
371 QString title() const { return mTitle; }
372
381 QString wfsTitle() const { return mWfsTitle.isEmpty() ? mTitle : mWfsTitle; }
382
390 void setAbstract( const QString &abstract ) { mAbstract = abstract; }
391
399 QString abstract() const { return mAbstract; }
400
408 void setKeywordList( const QString &keywords ) { mKeywordList = keywords; }
409
417 QString keywordList() const { return mKeywordList; }
418
428 void setDataUrl( const QString &dataUrl ) { mDataUrl = dataUrl; }
429
439 QString dataUrl() const { return mDataUrl; }
440
450 void setDataUrlFormat( const QString &dataUrlFormat ) { mDataUrlFormat = dataUrlFormat; }
451
461 QString dataUrlFormat() const { return mDataUrlFormat; }
462
472 void setAttribution( const QString &attrib ) { mAttribution = attrib; }
473
483 QString attribution() const { return mAttribution; }
484
494 void setAttributionUrl( const QString &url ) { mAttributionUrl = url; }
495
505 QString attributionUrl() const { return mAttributionUrl; }
506
512 void setLegendUrl( const QString &legendUrl ) { mLegendUrl = legendUrl; }
513
519 QString legendUrl() const { return mLegendUrl; }
520
526 void setLegendUrlFormat( const QString &legendUrlFormat ) { mLegendUrlFormat = legendUrlFormat; }
527
533 QString legendUrlFormat() const { return mLegendUrlFormat; }
534
536 const QgsMapLayer *layer() const override { return mLayer; };
537
538 private:
539 QgsMapLayer *mLayer = nullptr;
540
541 QString mShortName;
542 QString mTitle;
543 QString mWfsTitle; // optional WFS title
544
545 QString mAttribution;
546 QString mAttributionUrl;
547
548 QString mDataUrl;
549 QString mDataUrlFormat;
550
551 QString mAbstract;
552 QString mKeywordList;
553
555 QString mLegendUrl;
556 QString mLegendUrlFormat;
557};
558
559// XXX How to make a proper SIP type alias ?
560//using QgsVectorLayerServerProperties = QgsMapLayerServerProperties;
561
569{
570 Q_GADGET
571};
572
573#endif // QGSMAPLAYERSERVERPROPERTIES_H
WmsDimensionDefaultDisplay
QGIS Server WMS Dimension default display types.
Definition qgis.h:7003
@ AllValues
Display all values of the dimension.
Definition qgis.h:7004
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
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.
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
void copyTo(QgsMapLayerServerProperties *properties) const
Copy properties to another instance.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
QgsMapLayerServerProperties(QgsMapLayer *layer=nullptr)
Constructor - Creates a Map Layer QGIS Server Properties.
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 writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves server properties to xml under the layer node.
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 reset()
Reset properties to default.
void setWfsTitle(const QString &title)
Sets the title of the layer used by QGIS Server in WFS GetCapabilities request.
QString legendUrl() const
Returns the URL for the layer's legend.
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:83
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 writeXml(QDomNode &layerNode, QDomDocument &document) const
Saves server properties to xml under the layer node.
void reset()
Reset properties to default.
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.
void copyTo(QgsServerMetadataUrlProperties *properties) const
Copy properties to another instance.
void readXml(const QDomNode &layerNode)
Reads server properties from project file.
Manages QGIS Server properties for WMS dimensions.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
PredefinedWmsDimensionName
Predefined/Restricted WMS Dimension name.
static QMap< int, QString > wmsDimensionDefaultDisplayLabels()
Returns WMS Dimension default display labels.
void writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves server properties to xml under the layer node.
void reset()
Reset properties to default.
bool addWmsDimension(const QgsServerWmsDimensionProperties::WmsDimensionInfo &wmsDimInfo)
Adds a QGIS Server WMS Dimension.
virtual const QgsMapLayer * layer() const =0
Gets the parent layer.
void copyTo(QgsServerWmsDimensionProperties *properties) const
Copy properties to another instance.
static QMap< Qgis::WmsDimensionDefaultDisplay, QString > wmsDimensionDefaultDisplayDescriptions()
Returns WMS Dimension default display descriptions.
virtual ~QgsServerWmsDimensionProperties()=default
bool removeWmsDimension(const QString &wmsDimName)
Removes a QGIS Server WMS Dimension.
const QList< QgsServerWmsDimensionProperties::WmsDimensionInfo > wmsDimensions() const
Returns the QGIS Server WMS Dimension list.
void setWmsDimensions(const QList< QgsServerWmsDimensionProperties::WmsDimensionInfo > &dimensions)
Set WMS Dimensions.
Convenient class for API compatibility.
#define SIP_SKIP
Definition qgis_sip.h:133
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
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(), Qgis::WmsDimensionDefaultDisplay dimDefaultDisplayType=Qgis::WmsDimensionDefaultDisplay::AllValues, const QVariant &dimReferenceValue=QVariant())
Constructor for WmsDimensionInfo.