Skip to content

Commit

Permalink
Refactorize server properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarteau authored and Gustry committed Sep 16, 2021
1 parent 21c3f3f commit ee6acb0
Show file tree
Hide file tree
Showing 25 changed files with 670 additions and 460 deletions.
2 changes: 2 additions & 0 deletions python/core/auto_additions/qgsmaplayerserverproperties.py
@@ -0,0 +1,2 @@
# The following has been generated automatically from src/core/qgsmaplayerserverproperties.h
QgsServerWmsDimensionProperties.PredefinedWmsDimensionName.baseClass = QgsServerWmsDimensionProperties
2 changes: 0 additions & 2 deletions python/core/auto_additions/qgsvectorlayerserverproperties.py

This file was deleted.

20 changes: 7 additions & 13 deletions python/core/auto_generated/qgsmaplayer.sip.in
Expand Up @@ -376,24 +376,18 @@ Attribution indicates the provider of a layer or collection of layers.
%End



virtual QgsMapLayerServerProperties *serverProperties();
QgsMapLayerServerProperties *serverProperties();
%Docstring
Returns QGIS Server Properties for the map layer

.. versionadded:: 3.22
%End



void setMetadataUrl( const QString &metaUrl );
%Docstring
Sets the metadata URL of the layer
used by QGIS Server in GetCapabilities request.
MetadataUrl is a a link to the detailed, standardized metadata about the data.
Since QGIS 3.22, it edits the first metadata URL link. You should use setServerProperties.

.. seealso:: :py:func:`setServerProperties`
Since QGIS 3.22, it edits the first metadata URL link.

.. deprecated:: QGIS 3.22
%End
Expand All @@ -403,7 +397,7 @@ Since QGIS 3.22, it edits the first metadata URL link. You should use setServerP
Returns the metadata URL of the layer
used by QGIS Server in GetCapabilities request.
MetadataUrl is a a link to the detailed, standardized metadata about the data.
Since QGIS 3.22, it returns the first metadata URL link. You should use setServerProperties.
Since QGIS 3.22, it returns the first metadata URL link.

:return: the layer metadata URL

Expand All @@ -417,7 +411,7 @@ Since QGIS 3.22, it returns the first metadata URL link. You should use setServe
Set the metadata type of the layer
used by QGIS Server in GetCapabilities request
MetadataUrlType indicates the standard to which the metadata complies.
Since QGIS 3.22, it edits the first metadata URL type. You should use setServerProperties.
Since QGIS 3.22, it edits the first metadata URL type.

:return: the layer metadata type

Expand All @@ -431,7 +425,7 @@ Since QGIS 3.22, it edits the first metadata URL type. You should use setServerP
Returns the metadata type of the layer
used by QGIS Server in GetCapabilities request.
MetadataUrlType indicates the standard to which the metadata complies.
Since QGIS 3.22, it returns the first metadata URL type. You should use setServerProperties.
Since QGIS 3.22, it returns the first metadata URL type.

:return: the layer metadata type

Expand All @@ -445,7 +439,7 @@ Since QGIS 3.22, it returns the first metadata URL type. You should use setServe
Sets the metadata format of the layer
used by QGIS Server in GetCapabilities request.
MetadataUrlType indicates how the metadata is structured.
Since QGIS 3.22, it edits the first metadata URL format. You should use setServerProperties.
Since QGIS 3.22, it edits the first metadata URL format.

.. seealso:: :py:func:`mapLayerServerProperties`

Expand All @@ -457,7 +451,7 @@ Since QGIS 3.22, it edits the first metadata URL format. You should use setServe
Returns the metadata format of the layer
used by QGIS Server in GetCapabilities request.
MetadataUrlType indicates how the metadata is structured.
Since QGIS 3.22, it returns the first metadata URL format. You should use setServerProperties.
Since QGIS 3.22, it returns the first metadata URL format.

:return: the layer metadata format

Expand Down
198 changes: 186 additions & 12 deletions python/core/auto_generated/qgsmaplayerserverproperties.sip.in
Expand Up @@ -11,7 +11,7 @@



class QgsMapLayerServerProperties
class QgsServerMetadataUrlProperties
{
%Docstring(signature="appended")
Manages QGIS Server properties for a map layer
Expand Down Expand Up @@ -42,51 +42,225 @@ Constructor for MetadataUrl.
QString format;


bool operator==( const QgsMapLayerServerProperties::MetadataUrl &other ) const;
bool operator==( const QgsServerMetadataUrlProperties::MetadataUrl &other ) const;
};

QgsMapLayerServerProperties( QgsMapLayer *layer = 0 );
%Docstring
Constructor - Creates a Map Layer QGIS Server Properties

:param layer: The map layer
%End
virtual ~QgsServerMetadataUrlProperties();

QList <QgsMapLayerServerProperties::MetadataUrl> metadataUrls() const;
QList<QgsServerMetadataUrlProperties::MetadataUrl> metadataUrls() const;
%Docstring
Returns a list of metadataUrl resources associated for the layer.

:return: the list of metadata URLs

.. seealso:: :py:func:`setMetadataUrls`
%End

void setMetadataUrls( const QList<QgsMapLayerServerProperties::MetadataUrl> &metaUrls );
void setMetadataUrls( const QList<QgsServerMetadataUrlProperties::MetadataUrl> &metaUrls );
%Docstring
Sets a the list of metadata URL for the layer

.. seealso:: :py:func:`metadataUrls`

.. seealso:: :py:func:`addMetadataUrl`
%End
void addMetadataUrl( const MetadataUrl &metaUrl );
void addMetadataUrl( const QgsServerMetadataUrlProperties::MetadataUrl &metaUrl );
%Docstring
Add a metadataUrl for the layer

.. seealso:: :py:func:`setMetadataUrls`
%End
virtual const QgsMapLayer *layer() const = 0;
%Docstring
Get parent layer
%End

protected:




};


class QgsServerWmsDimensionProperties
{
%Docstring(signature="appended")
Manages QGIS Server properties for Wms dimensions

.. versionadded:: 3.22
%End

%TypeHeaderCode
#include "qgsmaplayerserverproperties.h"
%End
public:
static const QMetaObject staticMetaObject;

public:

enum PredefinedWmsDimensionName
{
TIME,
DATE,
ELEVATION
};

struct WmsDimensionInfo
{

enum DefaultDisplay
{
AllValues,
MinValue,
MaxValue,
ReferenceValue,
};

explicit 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() );
%Docstring
Constructor for WmsDimensionInfo.
%End
QString name;
QString fieldName;
QString endFieldName;
QString units;
QString unitSymbol;
int defaultDisplayType;
QVariant referenceValue;
};

virtual ~QgsServerWmsDimensionProperties();

static QMap<int, QString> wmsDimensionDefaultDisplayLabels();
%Docstring
Returns WMS Dimension default display labels

.. versionadded:: 3.10
%End

bool addWmsDimension( const QgsServerWmsDimensionProperties::WmsDimensionInfo &wmsDimInfo );
%Docstring
Adds a QGIS Server WMS Dimension

:param wmsDimInfo: QGIS Server WMS Dimension object with, name, field, etc

:return: ``True`` if QGIS Server WMS Dimension has been successfully added

.. versionadded:: 3.10
%End

bool removeWmsDimension( const QString &wmsDimName );
%Docstring
Removes a QGIS Server WMS Dimension

:return: ``True`` if QGIS Server WMS Dimension was found and successfully removed

.. versionadded:: 3.10
%End

void setWmsDimensions( const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> &dimensions );
%Docstring
Set WMS Dimensions

:param the: new dimensions that replace the current ones.
%End

const QList<QgsServerWmsDimensionProperties::WmsDimensionInfo> wmsDimensions() const;
%Docstring
Returns the QGIS Server WMS Dimension list.

.. versionadded:: 3.10
%End

virtual const QgsMapLayer *layer() const = 0;
%Docstring
Get parent layer
%End

protected:





};


class QgsMapLayerServerProperties: QgsServerMetadataUrlProperties, QgsServerWmsDimensionProperties
{
%Docstring(signature="appended")
Manages QGIS Server properties for a map layer

.. versionadded:: 3.10
%End

%TypeHeaderCode
#include "qgsmaplayerserverproperties.h"
%End
public:
static const QMetaObject staticMetaObject;

public:

QgsMapLayerServerProperties( QgsMapLayer *layer = 0 );
%Docstring
Constructor - Creates a Map Layer QGIS Server Properties

:param layer: The map layer
%End

void clone( QgsMapLayerServerProperties *properties ) const;
%Docstring
Copy properties to another instance

:param properties: The properties to copy to
%End

void writeXml( QDomNode &layer_node, QDomDocument &document ) const;
%Docstring
Saves server properties to xml under the layer node

.. versionadded:: 3.10
%End

void readXml( const QDomNode &layer_node );
%Docstring
Reads server properties from project file.

.. versionadded:: 3.10
%End

void reset();
%Docstring
Reset properties to default

.. versionadded:: 3.22
%End

virtual const QgsMapLayer *layer() const;
%Docstring
Get Parent layer
%End
};

class QgsVectorLayerServerProperties: QgsMapLayerServerProperties
{

%TypeHeaderCode
#include "qgsmaplayerserverproperties.h"
%End
public:
static const QMetaObject staticMetaObject;

};


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
7 changes: 0 additions & 7 deletions python/core/auto_generated/vector/qgsvectorlayer.sip.in
Expand Up @@ -616,13 +616,6 @@ which is used by the layer, so any changes are immediately applied.
%End


QgsMapLayerServerProperties *serverProperties() const;
%Docstring
Returns QGIS Server Properties of the vector layer

.. versionadded:: 3.10
%End

int selectedFeatureCount() const;
%Docstring
Returns the number of features that are selected in this layer.
Expand Down

0 comments on commit ee6acb0

Please sign in to comment.