QGIS API Documentation 3.43.0-Master (c67cf405802)
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 // 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
134
141{
142 Q_GADGET
143
144 public:
145
150 {
153 ELEVATION
154 };
155 Q_ENUM( PredefinedWmsDimensionName )
156
157
161 struct CORE_EXPORT WmsDimensionInfo
162 {
163
169 {
170 AllValues = 0,
171 MinValue = 1,
172 MaxValue = 2,
173 ReferenceValue = 3,
174 };
175
179 explicit WmsDimensionInfo( const QString &dimName,
180 const QString &dimFieldName,
181 const QString &dimEndFieldName = QString(),
182 const QString &dimUnits = QString(),
183 const QString &dimUnitSymbol = QString(),
184 const int &dimDefaultDisplayType = QgsServerWmsDimensionProperties::WmsDimensionInfo::AllValues,
185 const QVariant &dimReferenceValue = QVariant() )
186 : name( dimName )
187 , fieldName( dimFieldName )
188 , endFieldName( dimEndFieldName )
189 , units( dimUnits )
190 , unitSymbol( dimUnitSymbol )
191 , defaultDisplayType( dimDefaultDisplayType )
192 , referenceValue( dimReferenceValue )
193 {}
194
195 bool operator==( const WmsDimensionInfo &other ) const;
196 bool operator!=( const WmsDimensionInfo &other ) const;
197
198 QString name;
199 QString fieldName;
201 QString units;
202 QString unitSymbol;
205 };
206
208
209 // TODO c++20 - replace with = default
210
211 bool operator==( const QgsServerWmsDimensionProperties &other ) const;
212 bool operator!=( const QgsServerWmsDimensionProperties &other ) const;
213
218 static QMap<int, QString> wmsDimensionDefaultDisplayLabels();
219
226 bool addWmsDimension( const QgsServerWmsDimensionProperties::WmsDimensionInfo &wmsDimInfo );
227
233 bool removeWmsDimension( const QString &wmsDimName );
234
240 void setWmsDimensions( const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> &dimensions );
241
246 const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> wmsDimensions() const;
247
249 virtual const QgsMapLayer *layer() const = 0;
250
251 protected:
252
256 void writeXml( QDomNode &layer_node, QDomDocument &document ) const SIP_SKIP;
257
261 void readXml( const QDomNode &layer_node ) SIP_SKIP;
262
268 void copyTo( QgsServerWmsDimensionProperties *properties ) const SIP_SKIP;
269
273 void reset() SIP_SKIP;
274
275 private: // Private attributes
277 QList<WmsDimensionInfo> mWmsDimensions;
278};
279
280
287{
288 Q_GADGET
289
290 public:
291
297 QgsMapLayerServerProperties( QgsMapLayer *layer = nullptr );
298
299 // TODO c++20 - replace with = default
300
301 bool operator==( const QgsMapLayerServerProperties &other ) const;
302 bool operator!=( const QgsMapLayerServerProperties &other ) const;
303
309 void copyTo( QgsMapLayerServerProperties *properties ) const;
310
315 void writeXml( QDomNode &layer_node, QDomDocument &document ) const; // cppcheck-suppress duplInheritedMember
316
321 void readXml( const QDomNode &layer_node ); // cppcheck-suppress duplInheritedMember
322
327 void reset(); // cppcheck-suppress duplInheritedMember
328
336 void setShortName( const QString &name ) { mShortName = name; }
337
345 QString shortName() const { return mShortName; }
346
354 void setTitle( const QString &title ) { mTitle = title; }
355
363 void setWfsTitle( const QString &title ) { mWfsTitle = title; }
364
372 QString title() const { return mTitle; }
373
382 QString wfsTitle() const { return mWfsTitle.isEmpty() ? mTitle : mWfsTitle; }
383
391 void setAbstract( const QString &abstract ) { mAbstract = abstract; }
392
400 QString abstract() const { return mAbstract; }
401
409 void setKeywordList( const QString &keywords ) { mKeywordList = keywords; }
410
418 QString keywordList() const { return mKeywordList; }
419
429 void setDataUrl( const QString &dataUrl ) { mDataUrl = dataUrl; }
430
440 QString dataUrl() const { return mDataUrl; }
441
451 void setDataUrlFormat( const QString &dataUrlFormat ) { mDataUrlFormat = dataUrlFormat; }
452
462 QString dataUrlFormat() const { return mDataUrlFormat; }
463
473 void setAttribution( const QString &attrib ) { mAttribution = attrib; }
474
484 QString attribution() const { return mAttribution; }
485
495 void setAttributionUrl( const QString &url ) { mAttributionUrl = url; }
496
506 QString attributionUrl() const { return mAttributionUrl; }
507
513 void setLegendUrl( const QString &legendUrl ) { mLegendUrl = legendUrl; }
514
520 QString legendUrl() const { return mLegendUrl; }
521
527 void setLegendUrlFormat( const QString &legendUrlFormat ) { mLegendUrlFormat = legendUrlFormat; }
528
534 QString legendUrlFormat() const { return mLegendUrlFormat; }
535
537 const QgsMapLayer *layer() const override { return mLayer; };
538
539 private:
540 QgsMapLayer *mLayer = nullptr;
541
542 QString mShortName;
543 QString mTitle;
544 QString mWfsTitle; // optional WFS title
545
546 QString mAttribution;
547 QString mAttributionUrl;
548
549 QString mDataUrl;
550 QString mDataUrlFormat;
551
552 QString mAbstract;
553 QString mKeywordList;
554
556 QString mLegendUrl;
557 QString mLegendUrlFormat;
558};
559
560// XXX How to make a proper SIP type alias ?
561//using QgsVectorLayerServerProperties = QgsMapLayerServerProperties;
562
570{
571 Q_GADGET
572};
573
574#endif // QGSMAPLAYERSERVERPROPERTIES_H
Manages QGIS Server properties for a map layer.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
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.
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 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:77
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)
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.