QGIS API Documentation 4.1.0-Master (60fea48833c)
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_core.h"
22#include "qgis_sip.h"
23
24#include <QMap>
25#include <QMetaType>
26#include <QString>
27#include <QVariant>
28
29class QgsMapLayer;
30
31class QDomNode;
32class QDomDocument;
33
40{
41 Q_GADGET
42
43 public:
49 struct CORE_EXPORT MetadataUrl
50 {
54 MetadataUrl( const QString &url = QString(), const QString &type = QString(), const QString &format = QString() )
55 : url( url )
56 , type( type )
57 , format( format )
58 {}
59
63 QString url;
64
68 QString type;
69
73 QString format;
74
75 // TODO c++20 - replace with = default
76
79 };
80
82
88 QList<QgsServerMetadataUrlProperties::MetadataUrl> metadataUrls() const { return mMetadataUrls; };
89
95 void setMetadataUrls( const QList<QgsServerMetadataUrlProperties::MetadataUrl> &metaUrls ) { mMetadataUrls = metaUrls; };
96
101 void addMetadataUrl( const QgsServerMetadataUrlProperties::MetadataUrl &metaUrl ) { mMetadataUrls << metaUrl; };
102
104 virtual const QgsMapLayer *layer() const = 0;
105
106 // TODO c++20 - replace with = default
107
108 bool operator==( const QgsServerMetadataUrlProperties &other ) const;
109 bool operator!=( const QgsServerMetadataUrlProperties &other ) const;
110
111 protected:
113 void writeXml( QDomNode &layerNode, QDomDocument &document ) const SIP_SKIP;
114
116 void readXml( const QDomNode &layerNode ) SIP_SKIP;
117
123 void copyTo( QgsServerMetadataUrlProperties *properties ) const SIP_SKIP;
124
126 void reset() SIP_SKIP;
127
128 private:
129 QList<MetadataUrl> mMetadataUrls;
130};
131
132
139{
140 Q_GADGET
141
142 public:
152 Q_ENUM( PredefinedWmsDimensionName )
153
154
158 struct CORE_EXPORT WmsDimensionInfo
159 {
171
176 const QString &dimName,
177 const QString &dimFieldName,
178 const QString &dimEndFieldName = QString(),
179 const QString &dimUnits = QString(),
180 const QString &dimUnitSymbol = QString(),
181 const int &dimDefaultDisplayType = QgsServerWmsDimensionProperties::WmsDimensionInfo::AllValues,
182 const QVariant &dimReferenceValue = QVariant()
183 )
184 : name( dimName )
185 , fieldName( dimFieldName )
186 , endFieldName( dimEndFieldName )
187 , units( dimUnits )
188 , unitSymbol( dimUnitSymbol )
189 , defaultDisplayType( dimDefaultDisplayType )
190 , referenceValue( dimReferenceValue )
191 {}
192
193 bool operator==( const WmsDimensionInfo &other ) const;
194 bool operator!=( const WmsDimensionInfo &other ) const;
195
196 QString name;
197 QString fieldName;
199 QString units;
200 QString unitSymbol;
203 };
204
206
207 // TODO c++20 - replace with = default
208
209 bool operator==( const QgsServerWmsDimensionProperties &other ) const;
210 bool operator!=( const QgsServerWmsDimensionProperties &other ) const;
211
216 static QMap<int, QString> wmsDimensionDefaultDisplayLabels();
217
225
231 bool removeWmsDimension( const QString &wmsDimName );
232
238 void setWmsDimensions( const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> &dimensions );
239
244 const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> wmsDimensions() const;
245
247 virtual const QgsMapLayer *layer() const = 0;
248
249 protected:
253 void writeXml( QDomNode &layer_node, QDomDocument &document ) const SIP_SKIP;
254
258 void readXml( const QDomNode &layer_node ) SIP_SKIP;
259
265 void copyTo( QgsServerWmsDimensionProperties *properties ) const SIP_SKIP;
266
270 void reset() SIP_SKIP;
271
272 private: // Private attributes
274 QList<WmsDimensionInfo> mWmsDimensions;
275};
276
277
284{
285 Q_GADGET
286
287 public:
294
295 // TODO c++20 - replace with = default
296
297 bool operator==( const QgsMapLayerServerProperties &other ) const;
298 bool operator!=( const QgsMapLayerServerProperties &other ) const;
299
305 void copyTo( QgsMapLayerServerProperties *properties ) const;
306
311 void writeXml( QDomNode &layer_node, QDomDocument &document ) const; // cppcheck-suppress duplInheritedMember
312
317 void readXml( const QDomNode &layer_node ); // cppcheck-suppress duplInheritedMember
318
323 void reset(); // cppcheck-suppress duplInheritedMember
324
332 void setShortName( const QString &name ) { mShortName = name; }
333
341 QString shortName() const { return mShortName; }
342
347 QString wfsTypeName() const;
348
356 void setTitle( const QString &title ) { mTitle = title; }
357
365 void setWfsTitle( const QString &title ) { mWfsTitle = title; }
366
374 QString title() const { return mTitle; }
375
384 QString wfsTitle() const { return mWfsTitle.isEmpty() ? mTitle : mWfsTitle; }
385
393 void setAbstract( const QString &abstract ) { mAbstract = abstract; }
394
402 QString abstract() const { return mAbstract; }
403
411 void setKeywordList( const QString &keywords ) { mKeywordList = keywords; }
412
420 QString keywordList() const { return mKeywordList; }
421
431 void setDataUrl( const QString &dataUrl ) { mDataUrl = dataUrl; }
432
442 QString dataUrl() const { return mDataUrl; }
443
453 void setDataUrlFormat( const QString &dataUrlFormat ) { mDataUrlFormat = dataUrlFormat; }
454
464 QString dataUrlFormat() const { return mDataUrlFormat; }
465
475 void setAttribution( const QString &attrib ) { mAttribution = attrib; }
476
486 QString attribution() const { return mAttribution; }
487
497 void setAttributionUrl( const QString &url ) { mAttributionUrl = url; }
498
508 QString attributionUrl() const { return mAttributionUrl; }
509
515 void setLegendUrl( const QString &legendUrl ) { mLegendUrl = legendUrl; }
516
522 QString legendUrl() const { return mLegendUrl; }
523
529 void setLegendUrlFormat( const QString &legendUrlFormat ) { mLegendUrlFormat = legendUrlFormat; }
530
536 QString legendUrlFormat() const { return mLegendUrlFormat; }
537
539 const QgsMapLayer *layer() const override { return mLayer; };
540
541 private:
542 QgsMapLayer *mLayer = nullptr;
543
544 QString mShortName;
545 QString mTitle;
546 QString mWfsTitle; // optional WFS title
547
548 QString mAttribution;
549 QString mAttributionUrl;
550
551 QString mDataUrl;
552 QString mDataUrlFormat;
553
554 QString mAbstract;
555 QString mKeywordList;
556
558 QString mLegendUrl;
559 QString mLegendUrlFormat;
560};
561
562// XXX How to make a proper SIP type alias ?
563//using QgsVectorLayerServerProperties = QgsMapLayerServerProperties;
564
572{
573 Q_GADGET
574};
575
576#endif // QGSMAPLAYERSERVERPROPERTIES_H
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.
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(), const int &dimDefaultDisplayType=QgsServerWmsDimensionProperties::WmsDimensionInfo::AllValues, const QVariant &dimReferenceValue=QVariant())
Constructor for WmsDimensionInfo.
DefaultDisplay
Selection behavior for QGIS Server WMS Dimension default display.
@ MaxValue
Modify current selection to include only select features which match.