QGIS API Documentation 3.38.0-Grenoble (exported)
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;
297
302 void readXml( const QDomNode &layer_node );
303
308 void reset();
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 QString title() const { return mTitle; }
345
353 void setAbstract( const QString &abstract ) { mAbstract = abstract; }
354
362 QString abstract() const { return mAbstract; }
363
371 void setKeywordList( const QString &keywords ) { mKeywordList = keywords; }
372
380 QString keywordList() const { return mKeywordList; }
381
391 void setDataUrl( const QString &dataUrl ) { mDataUrl = dataUrl; }
392
402 QString dataUrl() const { return mDataUrl; }
403
413 void setDataUrlFormat( const QString &dataUrlFormat ) { mDataUrlFormat = dataUrlFormat; }
414
424 QString dataUrlFormat() const { return mDataUrlFormat; }
425
435 void setAttribution( const QString &attrib ) { mAttribution = attrib; }
436
446 QString attribution() const { return mAttribution; }
447
457 void setAttributionUrl( const QString &url ) { mAttributionUrl = url; }
458
468 QString attributionUrl() const { return mAttributionUrl; }
469
471 const QgsMapLayer *layer() const override { return mLayer; };
472
473 private:
474 QgsMapLayer *mLayer = nullptr;
475
476 QString mShortName;
477 QString mTitle;
478
479 QString mAttribution;
480 QString mAttributionUrl;
481
482 QString mDataUrl;
483 QString mDataUrlFormat;
484
485 QString mAbstract;
486 QString mKeywordList;
487
488};
489
496// XXX How to make a proper SIP type alias ?
497//using QgsVectorLayerServerProperties = QgsMapLayerServerProperties;
499{
500 Q_GADGET
501};
502
503#endif // QGSMAPLAYERSERVERPROPERTIES_H
504
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 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.
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:75
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.