2017-04-10 17:07:50 +10:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsmaplayer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2018-03-18 21:49:59 +01:00
|
|
|
|
2008-11-14 23:42:08 +00:00
|
|
|
class QgsMapLayer : QObject
|
2007-01-09 02:39:15 +00:00
|
|
|
{
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Base class for all map layer types.
|
|
|
|
This is the base class for all map layer types (vector, raster).
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsmaplayer.h"
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
%ConvertToSubClassCode
|
2017-04-10 17:07:50 +10:00
|
|
|
QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( sipCpp );
|
2016-10-17 10:47:08 +02:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
sipType = 0;
|
2016-10-17 10:47:08 +02:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
if ( layer )
|
2010-01-26 15:43:54 +00:00
|
|
|
{
|
2017-04-10 17:07:50 +10:00
|
|
|
switch ( layer->type() )
|
|
|
|
{
|
|
|
|
case QgsMapLayer::VectorLayer:
|
|
|
|
sipType = sipType_QgsVectorLayer;
|
|
|
|
break;
|
|
|
|
case QgsMapLayer::RasterLayer:
|
|
|
|
sipType = sipType_QgsRasterLayer;
|
|
|
|
break;
|
|
|
|
case QgsMapLayer::PluginLayer:
|
|
|
|
sipType = sipType_QgsPluginLayer;
|
|
|
|
break;
|
2018-04-06 16:11:50 +02:00
|
|
|
case QgsMapLayer::MeshLayer:
|
|
|
|
sipType = sipType_QgsMeshLayer;
|
|
|
|
break;
|
2017-04-10 17:07:50 +10:00
|
|
|
default:
|
2017-06-12 09:00:04 +02:00
|
|
|
sipType = nullptr;
|
2017-04-10 17:07:50 +10:00
|
|
|
break;
|
|
|
|
}
|
2010-01-26 15:43:54 +00:00
|
|
|
}
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
public:
|
2016-07-11 11:07:06 +10:00
|
|
|
|
2008-10-16 20:44:22 +00:00
|
|
|
enum LayerType
|
|
|
|
{
|
2012-09-24 02:28:15 +02:00
|
|
|
VectorLayer,
|
|
|
|
RasterLayer,
|
2018-04-06 16:11:50 +02:00
|
|
|
PluginLayer,
|
|
|
|
MeshLayer
|
2008-10-16 20:44:22 +00:00
|
|
|
};
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2018-01-02 18:58:05 +03:00
|
|
|
enum PropertyType
|
|
|
|
{
|
|
|
|
Style,
|
|
|
|
Metadata,
|
|
|
|
};
|
|
|
|
|
2018-09-08 07:54:21 -04:00
|
|
|
enum LayerFlag
|
|
|
|
{
|
|
|
|
Identifiable,
|
|
|
|
Removable,
|
|
|
|
Searchable,
|
|
|
|
};
|
|
|
|
typedef QFlags<QgsMapLayer::LayerFlag> LayerFlags;
|
|
|
|
|
|
|
|
|
2018-09-12 11:38:37 -04:00
|
|
|
enum StyleCategory
|
|
|
|
{
|
|
|
|
LayerConfiguration,
|
|
|
|
Symbology,
|
2018-09-13 08:48:29 -04:00
|
|
|
Symbology3D,
|
|
|
|
Labeling,
|
2018-09-12 11:38:37 -04:00
|
|
|
Fields,
|
|
|
|
Forms,
|
|
|
|
Actions,
|
|
|
|
MapTips,
|
|
|
|
Diagrams,
|
|
|
|
AttributeTable,
|
|
|
|
Rendering,
|
|
|
|
CustomProperties,
|
2018-09-19 12:12:53 +02:00
|
|
|
GeometryOptions,
|
2018-09-13 14:11:31 -04:00
|
|
|
AllStyleCategories
|
2018-09-12 11:38:37 -04:00
|
|
|
};
|
|
|
|
typedef QFlags<QgsMapLayer::StyleCategory> StyleCategories;
|
|
|
|
|
|
|
|
|
2017-04-10 17:17:17 +10:00
|
|
|
QgsMapLayer( QgsMapLayer::LayerType type = VectorLayer, const QString &name = QString(), const QString &source = QString() );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor for QgsMapLayer
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param type: layer type
|
|
|
|
:param name: display name for the layer
|
|
|
|
:param source: datasource of layer
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
~QgsMapLayer();
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-26 11:31:56 +02:00
|
|
|
|
2017-05-17 08:53:52 +02:00
|
|
|
virtual QgsMapLayer *clone() const = 0;
|
2017-05-16 13:34:18 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a new instance equivalent to this one except for the id which
|
|
|
|
is still unique.
|
|
|
|
|
|
|
|
:return: a new layer instance
|
|
|
|
|
2017-05-16 13:34:18 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2008-10-16 20:44:22 +00:00
|
|
|
QgsMapLayer::LayerType type() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the type of the layer.
|
2018-09-08 07:54:21 -04:00
|
|
|
%End
|
|
|
|
|
|
|
|
QgsMapLayer::LayerFlags flags() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the flags for this layer.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Flags are options specified by the user used for the UI but are not preventing any API call.
|
|
|
|
For instance, even if the Removable flag is not set, the layer can still be removed with the API
|
|
|
|
but the action will not be listed in the legend menu.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setFlags( QgsMapLayer::LayerFlags flags );
|
|
|
|
%Docstring
|
|
|
|
Returns the flags for this layer.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Flags are options specified by the user used for the UI but are not preventing any API call.
|
|
|
|
For instance, even if the Removable flag is not set, the layer can still be removed with the API
|
|
|
|
but the action will not be listed in the legend menu.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2018-01-02 18:58:05 +03:00
|
|
|
%End
|
|
|
|
|
|
|
|
static QString extensionPropertyType( PropertyType type );
|
|
|
|
%Docstring
|
|
|
|
Returns the extension of a Property.
|
|
|
|
|
|
|
|
:return: The extension
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2011-02-13 20:24:55 +00:00
|
|
|
QString id() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-19 11:43:52 -04:00
|
|
|
Returns the layer's unique ID, which is used to access this layer from :py:class:`QgsProject`.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setName( const QString &name );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the display ``name`` of the layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`name`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2011-02-13 20:24:55 +00:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString name() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the display name of the layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setName`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-18 11:11:36 +10:00
|
|
|
virtual QgsDataProvider *dataProvider();
|
|
|
|
%Docstring
|
2018-10-30 16:35:48 +01:00
|
|
|
Returns the layer's data provider, it may be null.
|
2017-04-18 11:11:36 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void setShortName( const QString &shortName );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the short name of the layer
|
|
|
|
used by QGIS Server to identify the layer.
|
|
|
|
|
|
|
|
:return: the layer short name
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`shortName`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-01-26 12:11:25 -07:00
|
|
|
|
2015-12-07 18:17:06 +01:00
|
|
|
QString shortName() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the short name of the layer
|
|
|
|
used by QGIS Server to identify the layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setShortName`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setTitle( const QString &title );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the title of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`title`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2015-12-07 18:17:06 +01:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString title() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the title of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
|
|
|
|
:return: the layer title
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setTitle`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setAbstract( const QString &abstract );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the abstract of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
|
|
|
|
:return: the layer abstract
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`abstract`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2011-12-16 11:58:09 +01:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString abstract() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the abstract of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
|
|
|
|
:return: the layer abstract
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAbstract`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setKeywordList( const QString &keywords );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the keyword list of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
|
|
|
|
:return: the layer keyword list
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`keywordList`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2011-12-16 11:58:09 +01:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString keywordList() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the keyword list of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
|
|
|
|
:return: the layer keyword list
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setKeywordList`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-04-29 16:16:58 +02:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void setDataUrl( const QString &dataUrl );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the DataUrl of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
DataUrl is a a link to the underlying data represented by a particular layer.
|
|
|
|
|
|
|
|
:return: the layer DataUrl
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`dataUrl`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-05-29 21:38:33 +02:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString dataUrl() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the DataUrl of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
DataUrl is a a link to the underlying data represented by a particular layer.
|
|
|
|
|
|
|
|
:return: the layer DataUrl
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setDataUrl`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setDataUrlFormat( const QString &dataUrlFormat );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the DataUrl format of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
DataUrl is a a link to the underlying data represented by a particular layer.
|
|
|
|
|
|
|
|
:return: the layer DataUrl format
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`dataUrlFormat`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-07-11 11:07:06 +10:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString dataUrlFormat() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the DataUrl format of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
DataUrl is a a link to the underlying data represented by a particular layer.
|
|
|
|
|
|
|
|
:return: the layer DataUrl format
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setDataUrlFormat`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-04-29 16:16:58 +02:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void setAttribution( const QString &attrib );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the attribution of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
Attribution indicates the provider of a layer or collection of layers.
|
|
|
|
|
|
|
|
:return: the layer attribution
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`attribution`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString attribution() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the attribution of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
Attribution indicates the provider of a layer or collection of layers.
|
|
|
|
|
|
|
|
:return: the layer attribution
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAttribution`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setAttributionUrl( const QString &attribUrl );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the attribution URL of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
Attribution indicates the provider of a layer or collection of layers.
|
|
|
|
|
|
|
|
:return: the layer attribution URL
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`attributionUrl`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-07-11 11:07:06 +10:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString attributionUrl() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the attribution URL of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
Attribution indicates the provider of a layer or collection of layers.
|
|
|
|
|
|
|
|
:return: the layer attribution URL
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAttributionUrl`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-04-29 16:16:58 +02:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void setMetadataUrl( const QString &metaUrl );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
|
|
|
|
|
|
|
:return: the layer metadata URL
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadataUrl`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-05-29 21:38:33 +02:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString metadataUrl() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
|
|
|
|
|
|
|
:return: the layer metadata URL
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMetadataUrl`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMetadataUrlType( const QString &metaUrlType );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the metadata type of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request
|
|
|
|
MetadataUrlType indicates the standard to which the metadata complies.
|
|
|
|
|
|
|
|
:return: the layer metadata type
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadataUrlType`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-07-11 11:07:06 +10:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString metadataUrlType() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the metadata type of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
MetadataUrlType indicates the standard to which the metadata complies.
|
|
|
|
|
|
|
|
:return: the layer metadata type
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMetadataUrlType`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMetadataUrlFormat( const QString &metaUrlFormat );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the metadata format of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
MetadataUrlType indicates how the metadata is structured.
|
|
|
|
|
|
|
|
:return: the layer metadata format
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadataUrlFormat`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-07-11 11:07:06 +10:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString metadataUrlFormat() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the metadata format of the layer
|
|
|
|
used by QGIS Server in GetCapabilities request.
|
|
|
|
MetadataUrlType indicates how the metadata is structured.
|
|
|
|
|
|
|
|
:return: the layer metadata format
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMetadataUrlFormat`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-05-29 15:25:53 +02:00
|
|
|
|
2016-02-02 19:46:18 +11:00
|
|
|
void setBlendMode( QPainter::CompositionMode blendMode );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the blending mode used for rendering a layer.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param blendMode: new blending mode
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`blendMode`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-07-11 11:07:06 +10:00
|
|
|
|
2013-06-23 16:00:16 +02:00
|
|
|
QPainter::CompositionMode blendMode() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the current blending mode for a layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setBlendMode`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2016-03-23 15:05:21 +01:00
|
|
|
bool readOnly() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
Returns if this layer is read only.
|
|
|
|
%End
|
2016-03-23 15:05:21 +01:00
|
|
|
|
2010-09-20 11:27:12 +00:00
|
|
|
virtual void reload();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Synchronises with changes in the datasource
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2010-09-20 11:27:12 +00:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) = 0 /Factory/;
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.4
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
virtual QgsRectangle extent() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the extent of the layer.
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
bool isValid() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the status of the layer. An invalid layer is one which has a bad datasource
|
2017-12-15 10:36:55 -04:00
|
|
|
or other problem. Child classes set this flag when initialized.
|
|
|
|
|
|
|
|
:return: true if the layer is valid and can be accessed
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
QString publicSource() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Gets a version of the internal layer definition that has sensitive
|
|
|
|
bits removed (for example, the password). This function should
|
|
|
|
be used when displaying the source name for general viewing.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`source`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString source() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the source for the layer. This source may contain usernames, passwords
|
|
|
|
and other sensitive information.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`publicSource`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual QStringList subLayers() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the sublayers of this layer.
|
|
|
|
(Useful for providers that manage their own layers, such as WMS).
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
virtual void setLayerOrder( const QStringList &layers );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reorders the *previously selected* sublayers of this layer from bottom to top.
|
|
|
|
(Useful for providers that manage their own layers, such as WMS).
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
virtual void setSubLayerVisibility( const QString &name, bool visible );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the visibility of the given sublayer name.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param name: sublayer name
|
|
|
|
:param visible: sublayer visibility
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2010-01-26 15:43:54 +00:00
|
|
|
virtual bool isEditable() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
Returns true if the layer can be edited.
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-03-16 12:35:45 +11:00
|
|
|
virtual bool isSpatial() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated with it.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
2018-02-06 13:37:28 -04:00
|
|
|
bool readLayerXml( const QDomElement &layerElement, QgsReadWriteContext &context );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-09-13 08:48:29 -04:00
|
|
|
Sets state from DOM document
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
:param layerElement: The DOM element corresponding to ``maplayer'' tag
|
2017-12-15 10:36:55 -04:00
|
|
|
:param context: writing context (e.g. for conversion between relative and absolute paths)
|
2017-04-10 17:07:50 +10:00
|
|
|
\note
|
2017-04-20 13:48:50 +02:00
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
The DOM node corresponds to a DOM document project file XML element read
|
2017-12-19 11:43:52 -04:00
|
|
|
by :py:class:`QgsProject`.
|
2017-04-20 13:48:50 +02:00
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
This, in turn, calls readXml() (and then readSymbology()), which is overridable
|
|
|
|
by sub-classes so that they can read their own specific state from the given DOM node.
|
2017-04-20 13:48:50 +02:00
|
|
|
|
2017-12-19 11:43:52 -04:00
|
|
|
Invoked by :py:func:`QgsProject.read()`
|
2017-04-20 13:48:50 +02:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
:return: true if successful
|
|
|
|
%End
|
|
|
|
|
2017-05-12 17:31:01 +08:00
|
|
|
bool writeLayerXml( QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-09-13 08:48:29 -04:00
|
|
|
Stores state in DOM node
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
:param layerElement: is a DOM element corresponding to ``maplayer'' tag
|
|
|
|
:param document: is a the DOM document being written
|
2017-12-15 10:36:55 -04:00
|
|
|
:param context: reading context (e.g. for conversion between relative and absolute paths)
|
|
|
|
\note
|
2017-04-10 17:07:50 +10:00
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
The DOM node corresponds to a DOM document project file XML element to be
|
2017-12-19 11:43:52 -04:00
|
|
|
written by :py:class:`QgsProject`.
|
2017-04-10 17:07:50 +10:00
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
This, in turn, calls writeXml() (and then writeSymbology), which is over-rideable
|
2018-09-13 08:48:29 -04:00
|
|
|
by sub-classes so that they can write their own specific state to the given DOM node.
|
2017-04-10 17:07:50 +10:00
|
|
|
|
2017-12-19 11:43:52 -04:00
|
|
|
Invoked by :py:func:`QgsProject.write()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: true if successful
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-07-29 12:16:07 +02:00
|
|
|
virtual void resolveReferences( QgsProject *project );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Resolve references to other layers (kept as layer IDs after reading XML) into layer objects.
|
|
|
|
|
2017-07-29 12:16:07 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-05-15 17:42:11 +08:00
|
|
|
QStringList customPropertyKeys() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns list of all keys within custom properties. Properties are stored in a map and saved in project file.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`customProperty`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-15 17:42:11 +08:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void setCustomProperty( const QString &key, const QVariant &value );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set a custom property for layer. Properties are stored in a map and saved in project file.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`customProperty`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`removeCustomProperty`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QVariant customProperty( const QString &value, const QVariant &defaultValue = QVariant() ) const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Read a custom property from layer. Properties are stored in a map and saved in project file.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setCustomProperty`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-05-16 13:34:18 +02:00
|
|
|
void setCustomProperties( const QgsObjectCustomProperties &properties );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set custom properties for layer. Current properties are dropped.
|
|
|
|
|
2017-05-16 13:34:18 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void removeCustomProperty( const QString &key );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Remove a custom property from layer. Properties are stored in a map and saved in project file.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setCustomProperty`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-03-16 12:35:45 +11:00
|
|
|
|
2013-06-23 16:00:16 +02:00
|
|
|
virtual QgsError error() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-26 18:44:30 +10:00
|
|
|
Gets current status error. This error describes some principal problem
|
2017-12-15 10:36:55 -04:00
|
|
|
for which layer cannot work and thus is not valid. It is not last error
|
|
|
|
after accessing data by draw() etc.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2016-07-11 14:46:08 +10:00
|
|
|
QgsCoordinateReferenceSystem crs() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the layer's spatial reference system.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 1.4
|
|
|
|
%End
|
2009-11-07 08:47:44 +00:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void setCrs( const QgsCoordinateReferenceSystem &srs, bool emitSignal = true );
|
|
|
|
%Docstring
|
|
|
|
Sets layer's spatial reference system
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-11-12 15:54:25 +10:00
|
|
|
static QString formatLayerName( const QString &name );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A convenience function to capitalize and format a layer ``name``.
|
|
|
|
|
2018-01-02 18:58:05 +03:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString metadataUri() const;
|
|
|
|
%Docstring
|
|
|
|
Retrieve the metadata URI for this layer
|
|
|
|
(either as a .qmd file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
|
|
|
|
|
|
|
:return: a QString with the metadata file name
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
void exportNamedMetadata( QDomDocument &doc, QString &errorMsg ) const;
|
|
|
|
%Docstring
|
|
|
|
Export the current metadata of this layer as named metadata in a QDomDocument
|
|
|
|
|
|
|
|
:param doc: the target QDomDocument
|
|
|
|
:param errorMsg: this QString will be initialized on error
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString saveDefaultMetadata( bool &resultFlag /Out/ );
|
|
|
|
%Docstring
|
|
|
|
Save the current metadata of this layer as the default metadata
|
|
|
|
(either as a .qmd file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
|
|
|
|
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to save the default metadata.
|
2018-01-02 18:58:05 +03:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString saveNamedMetadata( const QString &uri, bool &resultFlag );
|
|
|
|
%Docstring
|
|
|
|
Save the current metadata of this layer as a named metadata
|
|
|
|
(either as a .qmd file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
|
|
|
|
|
|
|
:param uri: the file name or other URI for the
|
2018-05-24 21:21:14 +10:00
|
|
|
metadata file. First an attempt will be made to see if this
|
|
|
|
is a file and save to that, if that fails the qgis.db metadata
|
|
|
|
table will be used to create a metadata entry who's
|
|
|
|
key matches the URI.
|
2018-01-02 18:58:05 +03:00
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to save the default metadata.
|
2018-01-02 18:58:05 +03:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString loadNamedMetadata( const QString &uri, bool &resultFlag /Out/ );
|
|
|
|
%Docstring
|
|
|
|
Retrieve a named metadata for this layer if one
|
|
|
|
exists (either as a .qmd file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
|
|
|
|
|
|
|
:param uri: - the file name or other URI for the
|
2018-05-24 21:21:14 +10:00
|
|
|
metadata file. First an attempt will be made to see if this
|
|
|
|
is a file and load that, if that fails the qgis.db metadata
|
|
|
|
table will be consulted to see if there is a metadata who's
|
|
|
|
key matches the URI.
|
2018-01-02 18:58:05 +03:00
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to load the default metadata.
|
2018-01-02 18:58:05 +03:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString loadDefaultMetadata( bool &resultFlag );
|
|
|
|
%Docstring
|
|
|
|
Retrieve the default metadata for this layer if one
|
|
|
|
exists (either as a .qmd file on disk or as a
|
|
|
|
record in the users metadata table in their personal qgis.db)
|
|
|
|
|
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to load the default metadata.
|
2018-01-02 18:58:05 +03:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool loadNamedMetadataFromDatabase( const QString &db, const QString &uri, QString &qmd );
|
|
|
|
%Docstring
|
|
|
|
Retrieve a named metadata for this layer from a sqlite database.
|
|
|
|
|
|
|
|
:param db: path to sqlite database
|
|
|
|
:param uri: uri for table
|
|
|
|
:param qmd: will be set to QMD xml metadata content from database
|
|
|
|
|
|
|
|
:return: true if style was successfully loaded
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
|
|
|
|
%Docstring
|
|
|
|
Import the metadata of this layer from a QDomDocument
|
|
|
|
|
|
|
|
:param document: source QDomDocument
|
|
|
|
:param errorMessage: this QString will be initialized on error
|
|
|
|
|
|
|
|
:return: true on success
|
|
|
|
|
2017-11-12 15:54:25 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2008-10-21 19:27:41 +00:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
virtual QString styleURI() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve the style URI for this layer
|
|
|
|
(either as a .qml file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
|
|
|
|
|
|
|
:return: a QString with the style file name
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`also`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString loadDefaultStyle( bool &resultFlag /Out/ );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve the default style for this layer if one
|
|
|
|
exists (either as a .qml file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to load the default style.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`also`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2018-09-14 00:09:36 -04:00
|
|
|
virtual QString loadNamedStyle( const QString &uri, bool &resultFlag /Out/, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve a named style for this layer if one
|
|
|
|
exists (either as a .qml file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param uri: - the file name or other URI for the
|
2018-05-24 21:21:14 +10:00
|
|
|
style file. First an attempt will be made to see if this
|
|
|
|
is a file and load that, if that fails the qgis.db styles
|
|
|
|
table will be consulted to see if there is a style who's
|
|
|
|
key matches the URI.
|
2017-12-15 10:36:55 -04:00
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to load the default style.
|
2018-09-14 00:09:36 -04:00
|
|
|
:param categories: the style categories to be loaded.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`also`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2012-04-24 21:41:50 -03:00
|
|
|
|
2017-02-06 09:21:38 +10:00
|
|
|
virtual bool loadNamedStyleFromDatabase( const QString &db, const QString &uri, QString &qml /Out/ );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve a named style for this layer from a sqlite database.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param db: path to sqlite database
|
|
|
|
:param uri: uri for table
|
|
|
|
:param qml: will be set to QML style content from database
|
|
|
|
|
|
|
|
:return: true if style was successfully loaded
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2018-09-12 14:24:29 -04:00
|
|
|
virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg /Out/,
|
2018-09-13 14:11:31 -04:00
|
|
|
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Import the properties of this layer from a QDomDocument
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param doc: source QDomDocument
|
|
|
|
:param errorMsg: this QString will be initialized on error
|
2018-05-24 21:21:14 +10:00
|
|
|
during the execution of readSymbology
|
2018-09-12 14:24:29 -04:00
|
|
|
:param categories: the style categories to import
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: true on success
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2008-10-21 19:27:41 +00:00
|
|
|
|
2018-09-13 14:11:31 -04:00
|
|
|
virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg /Out/, const QgsReadWriteContext &context = QgsReadWriteContext(),
|
|
|
|
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Export the properties of this layer as named style in a QDomDocument
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param doc: the target QDomDocument
|
|
|
|
:param errorMsg: this QString will be initialized on error
|
2018-09-13 14:11:31 -04:00
|
|
|
:param context: read write context
|
2018-09-12 14:24:29 -04:00
|
|
|
:param categories: the style categories to export
|
|
|
|
during the execution of writeSymbology
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Export the properties of this layer as SLD style in a QDomDocument
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param doc: the target QDomDocument
|
|
|
|
:param errorMsg: this QString will be initialized on error
|
2018-05-24 21:21:14 +10:00
|
|
|
during the execution of writeSymbology
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString saveDefaultStyle( bool &resultFlag /Out/ );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Save the properties of this layer as the default style
|
|
|
|
(either as a .qml file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to save the default style.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`loadNamedStyle`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2018-09-13 14:49:12 -04:00
|
|
|
virtual QString saveNamedStyle( const QString &uri, bool &resultFlag /Out/, StyleCategories categories = AllStyleCategories );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Save the properties of this layer as a named style
|
|
|
|
(either as a .qml file on disk or as a
|
|
|
|
record in the users style table in their personal qgis.db)
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param uri: the file name or other URI for the
|
2018-05-24 21:21:14 +10:00
|
|
|
style file. First an attempt will be made to see if this
|
|
|
|
is a file and save to that, if that fails the qgis.db styles
|
|
|
|
table will be used to create a style entry who's
|
|
|
|
key matches the URI.
|
2017-12-15 10:36:55 -04:00
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
we did not manage to save the default style.
|
2018-09-13 16:28:03 -04:00
|
|
|
:param categories: the style categories to be saved.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: a QString with any status messages
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`saveDefaultStyle`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
virtual QString saveSldStyle( const QString &uri, bool &resultFlag ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Saves the properties of this layer to an SLD format file.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param uri: uri of destination for exported SLD file.
|
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
the SLD file could not be generated
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: a string with any status or error messages
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`loadSldStyle`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-07-15 08:08:24 +10:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
virtual QString loadSldStyle( const QString &uri, bool &resultFlag );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Attempts to style the layer using the formatting from an SLD type file.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param uri: uri of source SLD file
|
|
|
|
:param resultFlag: a reference to a flag that will be set to false if
|
2018-05-24 21:21:14 +10:00
|
|
|
the SLD file could not be loaded
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: a string with any status or error messages
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`saveSldStyle`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2014-01-03 23:06:49 +01:00
|
|
|
virtual bool readSld( const QDomNode &node, QString &errorMessage );
|
2017-04-10 17:07:50 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
|
2018-09-13 14:11:31 -04:00
|
|
|
QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) = 0;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-09-13 08:48:29 -04:00
|
|
|
Read the symbology for the current layer from the DOM node supplied.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param node: node that will contain the symbology definition for this layer.
|
|
|
|
:param errorMessage: reference to string that will be updated with any error messages
|
|
|
|
:param context: reading context (used for transform from relative to absolute paths)
|
2018-09-13 14:11:31 -04:00
|
|
|
:param categories: the style categories to be read
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: true in case of success.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
virtual bool readStyle( const QDomNode &node, QString &errorMessage,
|
2018-09-13 14:11:31 -04:00
|
|
|
QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-09-13 08:48:29 -04:00
|
|
|
Read the style for the current layer from the DOM node supplied.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param node: node that will contain the style definition for this layer.
|
|
|
|
:param errorMessage: reference to string that will be updated with any error messages
|
|
|
|
:param context: reading context (used for transform from relative to absolute paths)
|
2018-09-13 14:11:31 -04:00
|
|
|
:param categories: the style categories to be read
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: true in case of success.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
To be implemented in subclasses. Default implementation does nothing and returns false.
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
|
2018-09-13 14:11:31 -04:00
|
|
|
StyleCategories categories = AllStyleCategories ) const = 0;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-09-07 14:32:59 -04:00
|
|
|
Write the style for the layer into the docment provided.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param node: the node that will have the style element added to it.
|
|
|
|
:param doc: the document that will have the QDomNode added.
|
|
|
|
:param errorMessage: reference to string that will be updated with any error messages
|
|
|
|
:param context: writing context (used for transform from absolute to relative paths)
|
2018-09-13 14:11:31 -04:00
|
|
|
:param categories: the style categories to be written
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
There is a confusion of terms with the GUI. This method actually writes what is called a style in the application.
|
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:return: true in case of success.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
|
2018-09-13 14:11:31 -04:00
|
|
|
StyleCategories categories = AllStyleCategories ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-09-07 14:32:59 -04:00
|
|
|
Write just the symbology information for the layer into the document
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param node: the node that will have the style element added to it.
|
|
|
|
:param doc: the document that will have the QDomNode added.
|
|
|
|
:param errorMessage: reference to string that will be updated with any error messages
|
|
|
|
:param context: writing context (used for transform from absolute to relative paths)
|
2018-09-13 14:11:31 -04:00
|
|
|
:param categories: the style categories to be written
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: true in case of success.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
To be implemented in subclasses. Default implementation does nothing and returns false.
|
2018-05-28 11:31:08 -04:00
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
There is a confusion of terms with the GUI. This method actually writes what is known as the symbology in the application.
|
|
|
|
|
2018-05-28 11:31:08 -04:00
|
|
|
.. versionadded:: 2.16
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2018-10-30 13:35:51 +01:00
|
|
|
|
|
|
|
virtual void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag = false );
|
|
|
|
%Docstring
|
|
|
|
Updates the data source of the layer. The layer's renderer and legend will be preserved only
|
|
|
|
if the geometry type of the new data source matches the current geometry type of the layer.
|
|
|
|
|
|
|
|
Subclasses should override this method: default implementation does nothing.
|
|
|
|
|
|
|
|
:param dataSource: new layer data source
|
|
|
|
:param baseName: base name of the layer
|
|
|
|
:param provider: provider string
|
|
|
|
:param options: provider options
|
|
|
|
:param loadDefaultStyleFlag: set to true to reset the layer's style to the default for the
|
|
|
|
data source
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`dataSourceChanged`
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString providerType() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the provider type (provider key) for this layer
|
|
|
|
%End
|
|
|
|
|
2014-01-03 23:06:49 +01:00
|
|
|
QUndoStack *undoStack();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns pointer to layer's undo stack
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2009-06-14 14:17:18 +00:00
|
|
|
|
2016-05-10 10:32:30 +10:00
|
|
|
QUndoStack *undoStackStyles();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns pointer to layer's style undo stack
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setLegendUrl( const QString &legendUrl );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the URL for the layer's legend.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-05-10 10:32:30 +10:00
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString legendUrl() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the URL for the layer's legend.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setLegendUrlFormat( const QString &legendUrlFormat );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the format for a URL based layer legend.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2015-10-27 14:03:00 +11:00
|
|
|
QString legendUrlFormat() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the format for a URL based layer legend.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setLegend( QgsMapLayerLegend *legend /Transfer/ );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Assign a legend controller to the map layer. The object will be responsible for providing legend items.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param legend: Takes ownership of the object. Can be null pointer
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.6
|
|
|
|
%End
|
|
|
|
|
|
|
|
QgsMapLayerLegend *legend() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Can be null.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.6
|
|
|
|
%End
|
|
|
|
|
|
|
|
QgsMapLayerStyleManager *styleManager() const;
|
|
|
|
%Docstring
|
2018-05-26 18:44:30 +10:00
|
|
|
Gets access to the layer's style manager. Style manager allows switching between multiple styles.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2014-05-18 15:22:26 +02:00
|
|
|
|
2017-09-15 16:44:42 +02:00
|
|
|
void setRenderer3D( QgsAbstract3DRenderer *renderer /Transfer/ );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets 3D renderer for the layer. Takes ownership of the renderer.
|
|
|
|
|
2017-09-15 16:44:42 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-07-26 17:01:12 +02:00
|
|
|
|
2017-09-15 16:44:42 +02:00
|
|
|
QgsAbstract3DRenderer *renderer3D() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns 3D renderer associated with the layer. May be null.
|
|
|
|
|
2017-09-15 16:44:42 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-07-26 17:01:12 +02:00
|
|
|
|
2016-03-03 15:56:38 +01:00
|
|
|
bool isInScaleRange( double scale ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Tests whether the layer should be visible at the specified ``scale``.
|
|
|
|
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
|
|
|
|
:return: true if the layer is visible at the given scale.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`minimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`maximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`hasScaleBasedVisibility`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-03-03 15:56:38 +01:00
|
|
|
|
2016-03-10 10:33:25 +11:00
|
|
|
double minimumScale() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the minimum map scale (i.e. most "zoomed out" scale) at which the layer will be visible.
|
|
|
|
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
A scale of 0 indicates no minimum scale visibility.
|
|
|
|
|
2017-06-04 09:31:10 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMinimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`maximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`hasScaleBasedVisibility`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isInScaleRange`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-12-05 14:05:55 +11:00
|
|
|
|
2016-03-10 10:33:25 +11:00
|
|
|
double maximumScale() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the maximum map scale (i.e. most "zoomed in" scale) at which the layer will be visible.
|
|
|
|
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
A scale of 0 indicates no maximum scale visibility.
|
|
|
|
|
2017-06-04 09:31:10 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMaximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`minimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`hasScaleBasedVisibility`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isInScaleRange`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-12-05 14:05:55 +11:00
|
|
|
|
|
|
|
bool hasScaleBasedVisibility() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether scale based visibility is enabled for the layer.
|
|
|
|
|
|
|
|
:return: true if scale based visibility is enabled
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`minimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`maximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setScaleBasedVisibility`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isInScaleRange`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-12-05 14:05:55 +11:00
|
|
|
|
2017-02-06 16:24:10 +10:00
|
|
|
bool hasAutoRefreshEnabled() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if auto refresh is enabled for the layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`autoRefreshInterval`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAutoRefreshEnabled`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-02-06 16:24:10 +10:00
|
|
|
int autoRefreshInterval() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the auto refresh interval (in milliseconds). Note that
|
|
|
|
auto refresh is only active when hasAutoRefreshEnabled() is true.
|
|
|
|
|
2018-05-25 09:00:58 +10:00
|
|
|
.. seealso:: :py:func:`hasAutoRefreshEnabled`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAutoRefreshInterval`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-02-06 16:24:10 +10:00
|
|
|
void setAutoRefreshInterval( int interval );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the auto refresh interval (in milliseconds) for the layer. This
|
|
|
|
will cause the layer to be automatically redrawn on a matching interval.
|
|
|
|
Note that auto refresh must be enabled by calling setAutoRefreshEnabled().
|
|
|
|
|
|
|
|
Note that auto refresh triggers deferred repaints of the layer. Any map
|
|
|
|
canvas must be refreshed separately in order to view the refreshed layer.
|
2017-04-10 17:07:50 +10:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`autoRefreshInterval`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAutoRefreshEnabled`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
2017-02-06 16:24:10 +10:00
|
|
|
void setAutoRefreshEnabled( bool enabled );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets whether auto refresh is enabled for the layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`hasAutoRefreshEnabled`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAutoRefreshInterval`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2017-02-06 16:24:10 +10:00
|
|
|
|
2017-04-10 16:41:36 +10:00
|
|
|
virtual const QgsLayerMetadata &metadata() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a reference to the layer's metadata store.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMetadata`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadataChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 16:41:36 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual void setMetadata( const QgsLayerMetadata &metadata );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the layer's ``metadata`` store.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadata`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadataChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-10 16:41:36 +10:00
|
|
|
%End
|
|
|
|
|
2017-04-10 11:36:14 +10:00
|
|
|
virtual QString htmlMetadata() const;
|
2017-04-10 17:12:14 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Obtain a formatted HTML string containing assorted metadata for this layer.
|
|
|
|
|
2017-04-10 11:36:14 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:12:14 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QDateTime timestamp() const;
|
|
|
|
%Docstring
|
|
|
|
Time stamp of data source in the moment when data/metadata were loaded by provider
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QSet<QgsMapLayerDependency> dependencies() const;
|
|
|
|
%Docstring
|
2018-01-09 17:26:37 -04:00
|
|
|
Gets the list of dependencies. This includes data dependencies set by the user (:py:func:`setDataDependencies`)
|
2017-12-15 10:36:55 -04:00
|
|
|
as well as dependencies given by the provider
|
|
|
|
|
|
|
|
:return: a set of QgsMapLayerDependency
|
2017-04-10 17:12:14 +10:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-10-09 10:21:35 +10:00
|
|
|
QString refreshOnNotifyMessage() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the message that should be notified by the provider to triggerRepaint
|
|
|
|
|
2017-10-09 10:21:35 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool isRefreshOnNotifyEnabled() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the refresh on provider nofification is enabled
|
|
|
|
|
2017-10-09 10:21:35 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2018-11-03 11:28:55 +01:00
|
|
|
QString originalXmlProperties() const;
|
2018-10-30 14:47:00 +01:00
|
|
|
%Docstring
|
|
|
|
Returns the XML properties of the original layer as they were when the layer
|
|
|
|
was first read from the project file. In case of new layers this is normally empty.
|
|
|
|
|
|
|
|
The storage format for the XML is qlr
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
%End
|
|
|
|
|
2018-11-03 11:28:55 +01:00
|
|
|
void setOriginalXmlProperties( const QString &originalXmlProperties );
|
2018-10-30 14:47:00 +01:00
|
|
|
%Docstring
|
|
|
|
Sets the original XML properties for the layer to ``originalXmlProperties``
|
|
|
|
|
|
|
|
The storage format for the XML is qlr
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
%End
|
2018-10-30 13:35:51 +01:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
public slots:
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
void setMinimumScale( double scale );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the minimum map ``scale`` (i.e. most "zoomed out" scale) at which the layer will be visible.
|
|
|
|
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
A ``scale`` of 0 indicates no minimum scale visibility.
|
|
|
|
|
2017-06-04 09:31:10 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`minimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMaximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setScaleBasedVisibility`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-12-05 14:05:55 +11:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
void setMaximumScale( double scale );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the maximum map ``scale`` (i.e. most "zoomed in" scale) at which the layer will be visible.
|
|
|
|
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
A ``scale`` of 0 indicates no maximum scale visibility.
|
|
|
|
|
2017-06-04 09:31:10 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`maximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMinimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setScaleBasedVisibility`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2018-06-04 21:56:07 +10:00
|
|
|
void setScaleBasedVisibility( bool enabled );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets whether scale based visibility is enabled for the layer.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param enabled: set to true to enable scale based visibility
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMinimumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMaximumScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-05-25 09:00:58 +10:00
|
|
|
.. seealso:: :py:func:`hasScaleBasedVisibility`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-12-05 14:05:55 +11:00
|
|
|
|
2017-02-06 15:33:42 +10:00
|
|
|
void triggerRepaint( bool deferredUpdate = false );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
|
|
|
|
Will emit a repaintRequested() signal.
|
|
|
|
If ``deferredUpdate`` is true then the layer will only be repainted when the canvas is next
|
|
|
|
re-rendered, and will not trigger any canvas redraws itself.
|
2017-04-10 17:07:50 +10:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
in 2.6 function moved from vector/raster subclasses to QgsMapLayer
|
|
|
|
%End
|
2014-09-11 23:52:21 +07:00
|
|
|
|
2016-06-27 14:03:36 +10:00
|
|
|
void emitStyleChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Triggers an emission of the styleChanged() signal.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the list of dependencies.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`dependencies`
|
2017-04-10 17:07:50 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layers: set of QgsMapLayerDependency. Only user-defined dependencies will be added
|
|
|
|
|
|
|
|
:return: false if a dependency cycle has been detected
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-06-27 14:03:36 +10:00
|
|
|
|
[FEATURE] layer refresh and trigger actions on provider notification
[needs-docs]
In vector layer properties (only usefull for postgres datasources)
**in the rendering tab**
A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.
For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.
If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.
**in the actions tab**
A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.
Note that, as opposed to the "layer refresh" that
Exemple:
- QGIS side "Execute if notification message matches" `^trigger my action`
- Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
- Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
- Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action
Please note that if the `^`, which means "starts with", in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`
A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:
```python
print('[% @notification_message %]')
```
The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```
User Warning:
For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.
Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.
IMPLEMENTATION DETAILS:
A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.
For the moment only the postgres provider implements the notification.
QgsAction has a notificationMessage member function that holds the regex
to match to trigger action
QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.
The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.
For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.
It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.
Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.
The service will not restart in the next qgis session though.
If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
2017-09-08 16:42:30 +02:00
|
|
|
void setRefreshOnNotifyEnabled( bool enabled );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set whether provider notification is connected to triggerRepaint
|
[FEATURE] layer refresh and trigger actions on provider notification
[needs-docs]
In vector layer properties (only usefull for postgres datasources)
**in the rendering tab**
A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.
For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.
If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.
**in the actions tab**
A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.
Note that, as opposed to the "layer refresh" that
Exemple:
- QGIS side "Execute if notification message matches" `^trigger my action`
- Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
- Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
- Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action
Please note that if the `^`, which means "starts with", in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`
A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:
```python
print('[% @notification_message %]')
```
The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```
User Warning:
For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.
Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.
IMPLEMENTATION DETAILS:
A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.
For the moment only the postgres provider implements the notification.
QgsAction has a notificationMessage member function that holds the regex
to match to trigger action
QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.
The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.
For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.
It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.
Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.
The service will not restart in the next qgis session though.
If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
2017-09-08 16:42:30 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setRefreshOnNofifyMessage( const QString &message );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the notification message that triggers repaine
|
|
|
|
If refresh on notification is enabled, the notification will triggerRepaint only
|
|
|
|
if the notification message is equal to:param message:
|
[FEATURE] layer refresh and trigger actions on provider notification
[needs-docs]
In vector layer properties (only usefull for postgres datasources)
**in the rendering tab**
A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.
For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.
If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.
**in the actions tab**
A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.
Note that, as opposed to the "layer refresh" that
Exemple:
- QGIS side "Execute if notification message matches" `^trigger my action`
- Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
- Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
- Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action
Please note that if the `^`, which means "starts with", in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`
A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:
```python
print('[% @notification_message %]')
```
The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```
User Warning:
For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.
Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.
IMPLEMENTATION DETAILS:
A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.
For the moment only the postgres provider implements the notification.
QgsAction has a notificationMessage member function that holds the regex
to match to trigger action
QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.
The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.
For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.
It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.
Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.
The service will not restart in the next qgis session though.
If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
2017-09-08 16:42:30 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
signals:
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void statusChanged( const QString &status );
|
|
|
|
%Docstring
|
|
|
|
Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar)
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-07-04 01:10:10 +02:00
|
|
|
void nameChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the name has been changed
|
2017-04-10 17:07:50 +10:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-07-04 01:10:10 +02:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
void crsChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
Emit a signal that layer's CRS has been reset
|
|
|
|
%End
|
2009-12-11 15:44:48 +00:00
|
|
|
|
2017-02-06 15:33:42 +10:00
|
|
|
void repaintRequested( bool deferredUpdate = false );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
By emitting this signal the layer tells that either appearance or content have been changed
|
|
|
|
and any view showing the rendered layer should refresh itself.
|
|
|
|
If ``deferredUpdate`` is true then the layer will only be repainted when the canvas is next
|
|
|
|
re-rendered, and will not trigger any canvas redraws itself.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
void recalculateExtents() const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
This is used to send a request that any mapcanvas using this layer update its extents
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void dataChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
Data of layer changed
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-02-02 19:46:18 +11:00
|
|
|
void blendModeChanged( QPainter::CompositionMode blendMode );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-19 11:43:52 -04:00
|
|
|
Signal emitted when the blend mode is changed, through :py:func:`QgsMapLayer.setBlendMode()`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2013-09-09 09:47:05 +02:00
|
|
|
|
2014-05-26 11:59:13 +07:00
|
|
|
void rendererChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Signal emitted when renderer is changed.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`styleChanged`
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-05-26 11:59:13 +07:00
|
|
|
|
2016-06-27 14:03:36 +10:00
|
|
|
void styleChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Signal emitted whenever a change affects the layer's style. Ie this may be triggered
|
|
|
|
by renderer changes, label style changes, or other style changes such as blend
|
|
|
|
mode or layer opacity changes.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`rendererChanged`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-06-27 14:03:36 +10:00
|
|
|
|
2014-07-17 20:45:24 +02:00
|
|
|
void legendChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Signal emitted when legend of the layer has changed
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 2.6
|
2017-07-26 17:01:12 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
void renderer3DChanged();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Signal emitted when 3D renderer associated with the layer has changed.
|
|
|
|
|
2017-07-26 17:01:12 +02:00
|
|
|
.. versionadded:: 3.0
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2014-07-17 20:45:24 +02:00
|
|
|
|
2016-06-03 15:13:42 +02:00
|
|
|
void configChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted whenever the configuration is changed. The project listens to this signal
|
|
|
|
to be marked as dirty.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-06-03 15:13:42 +02:00
|
|
|
|
2016-09-01 09:58:37 +02:00
|
|
|
void dependenciesChanged();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when dependencies are changed.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2016-09-01 09:58:37 +02:00
|
|
|
|
2017-01-16 16:51:44 +08:00
|
|
|
void willBeDeleted();
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted in the destructor when the layer is about to be deleted,
|
|
|
|
but it is still in a perfectly valid state: the last chance for
|
|
|
|
other pieces of code for some cleanup if they use the layer.
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-01-16 16:51:44 +08:00
|
|
|
|
2017-02-06 16:24:10 +10:00
|
|
|
void autoRefreshIntervalChanged( int interval );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the auto refresh interval changes.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAutoRefreshInterval`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-04-10 16:41:36 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void metadataChanged();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when the layer's metadata is changed.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setMetadata`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`metadata`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-04-10 16:41:36 +10:00
|
|
|
.. versionadded:: 3.0
|
2018-09-11 12:14:50 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
void flagsChanged();
|
|
|
|
%Docstring
|
|
|
|
Emitted when layer's flags have been modified.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setFlags`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`flags`
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2018-10-30 13:35:51 +01:00
|
|
|
%End
|
|
|
|
|
|
|
|
void dataSourceChanged();
|
|
|
|
%Docstring
|
|
|
|
Emitted whenever the layer's data source has been changed.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setDataSource`
|
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2017-02-06 16:24:10 +10:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
2017-05-16 13:34:18 +02:00
|
|
|
|
2017-05-17 08:53:52 +02:00
|
|
|
void clone( QgsMapLayer *layer ) const;
|
2017-05-16 13:34:18 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Copies attributes like name, short name, ... into another layer.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layer: The copy recipient
|
|
|
|
|
2017-05-16 13:34:18 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void setExtent( const QgsRectangle &rect );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the extent
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2010-01-26 15:43:54 +00:00
|
|
|
void setValid( bool valid );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets whether layer is valid or not - should be used in constructor.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2010-01-26 15:43:54 +00:00
|
|
|
|
2018-02-06 13:37:28 -04:00
|
|
|
virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Called by readLayerXML(), used by children to read state specific to them from
|
|
|
|
project files.
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-05-12 17:31:01 +08:00
|
|
|
virtual bool writeXml( QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context ) const;
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Called by writeLayerXML(), used by children to write state specific to them to
|
|
|
|
project files.
|
2018-05-03 12:10:54 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const;
|
|
|
|
%Docstring
|
|
|
|
Called by writeLayerXML(), used by derived classes to encode provider's specific data
|
|
|
|
source to project files. Typically resolving absolute or relative paths, usernames and
|
|
|
|
passwords or drivers prefixes ("HDF5:")
|
|
|
|
|
|
|
|
:param source: data source to encode, typically :py:func:`QgsMapLayer.source()`
|
|
|
|
:param context: writing context (e.g. for conversion between relative and absolute paths)
|
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
:return: encoded source, typically to be written in the DOM element "datasource"
|
2018-05-03 12:10:54 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QString decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const;
|
|
|
|
%Docstring
|
|
|
|
Called by readLayerXML(), used by derived classes to decode provider's specific data
|
|
|
|
source from project files. Typically resolving absolute or relative paths, usernames and
|
|
|
|
passwords or drivers prefixes ("HDF5:")
|
|
|
|
|
2018-09-13 08:48:29 -04:00
|
|
|
:param source: data source to decode, typically read from layer's DOM element "datasource"
|
|
|
|
:param dataProvider: string identification of data provider (e.g. "ogr"), typically read from layer's DOM element
|
2018-05-03 12:10:54 +02:00
|
|
|
:param context: reading context (e.g. for conversion between relative and absolute paths)
|
|
|
|
|
|
|
|
:return: decoded source, typically to be used as the layer's datasource
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-10 17:17:17 +10:00
|
|
|
void readCustomProperties( const QDomNode &layerNode, const QString &keyStartsWith = QString() );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Read custom properties from project file.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerNode: note to read from
|
|
|
|
:param keyStartsWith: reads only properties starting with the specified string (or all if the string is empty)*
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc ) const;
|
|
|
|
%Docstring
|
|
|
|
Write custom properties to project file.
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
void readStyleManager( const QDomNode &layerNode );
|
|
|
|
%Docstring
|
|
|
|
Read style manager's configuration (if any). To be called by subclasses.
|
|
|
|
%End
|
|
|
|
void writeStyleManager( QDomNode &layerNode, QDomDocument &doc ) const;
|
|
|
|
%Docstring
|
|
|
|
Write style manager's configuration (if exists). To be called by subclasses.
|
|
|
|
%End
|
2015-01-07 20:15:11 +07:00
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
|
|
|
|
const QgsReadWriteContext &context,
|
2018-09-13 14:11:31 -04:00
|
|
|
StyleCategories categories = AllStyleCategories ) const;
|
2017-12-01 17:57:50 +01:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write style data common to all layer types
|
|
|
|
|
2017-12-01 17:57:50 +01:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
void readCommonStyle( const QDomElement &layerElement, const QgsReadWriteContext &context,
|
2018-09-13 14:11:31 -04:00
|
|
|
StyleCategories categories = AllStyleCategories );
|
2017-12-01 17:57:50 +01:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Read style data common to all layer types
|
|
|
|
|
2017-12-01 17:57:50 +01:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2018-10-30 13:35:51 +01:00
|
|
|
void setProviderType( const QString &providerType );
|
|
|
|
%Docstring
|
|
|
|
Sets the ``providerType`` (provider key)
|
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-07-11 11:07:06 +10:00
|
|
|
void appendError( const QgsErrorMessage &error );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
|
|
|
Add error message
|
|
|
|
%End
|
2016-07-11 11:07:06 +10:00
|
|
|
void setError( const QgsError &error );
|
2017-04-10 17:07:50 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets error message
|
2017-04-10 17:07:50 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool hasDependencyCycle( const QSet<QgsMapLayerDependency> &layers ) const;
|
|
|
|
%Docstring
|
|
|
|
Checks whether a new set of dependencies will introduce a cycle
|
|
|
|
%End
|
2016-07-21 11:21:28 +02:00
|
|
|
|
[FEATURE] layer refresh and trigger actions on provider notification
[needs-docs]
In vector layer properties (only usefull for postgres datasources)
**in the rendering tab**
A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.
For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.
If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.
**in the actions tab**
A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.
Note that, as opposed to the "layer refresh" that
Exemple:
- QGIS side "Execute if notification message matches" `^trigger my action`
- Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
- Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
- Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action
Please note that if the `^`, which means "starts with", in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`
A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:
```python
print('[% @notification_message %]')
```
The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```
User Warning:
For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.
Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.
IMPLEMENTATION DETAILS:
A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.
For the moment only the postgres provider implements the notification.
QgsAction has a notificationMessage member function that holds the regex
to match to trigger action
QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.
The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.
For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.
It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.
Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.
The service will not restart in the next qgis session though.
If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
2017-09-08 16:42:30 +02:00
|
|
|
|
2018-10-30 13:35:51 +01:00
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
};
|
2017-04-10 17:07:50 +10:00
|
|
|
|
2018-09-08 07:54:21 -04:00
|
|
|
QFlags<QgsMapLayer::LayerFlag> operator|(QgsMapLayer::LayerFlag f1, QFlags<QgsMapLayer::LayerFlag> f2);
|
|
|
|
|
2018-09-12 11:38:37 -04:00
|
|
|
QFlags<QgsMapLayer::StyleCategory> operator|(QgsMapLayer::StyleCategory f1, QFlags<QgsMapLayer::StyleCategory> f2);
|
|
|
|
|
|
|
|
|
2017-04-10 17:07:50 +10:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsmaplayer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|