mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-10-29 00:07:54 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			1839 lines
		
	
	
		
			50 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			1839 lines
		
	
	
		
			50 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| /************************************************************************
 | |
|  * This file has been generated automatically from                      *
 | |
|  *                                                                      *
 | |
|  * src/core/qgsmaplayer.h                                               *
 | |
|  *                                                                      *
 | |
|  * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | |
|  ************************************************************************/
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| enum class QgsMapLayerType
 | |
|   {
 | |
|   VectorLayer,
 | |
|   RasterLayer,
 | |
|   PluginLayer,
 | |
|   MeshLayer,
 | |
|   VectorTileLayer,
 | |
|   AnnotationLayer,
 | |
|   PointCloudLayer,
 | |
| };
 | |
| 
 | |
| class QgsMapLayer : QObject
 | |
| {
 | |
| %Docstring
 | |
| Base class for all map layer types.
 | |
| This is the base class for all map layer types (vector, raster).
 | |
| %End
 | |
| 
 | |
| %TypeHeaderCode
 | |
| #include "qgsmaplayer.h"
 | |
| %End
 | |
| %ConvertToSubClassCode
 | |
|     QgsMapLayer * layer = qobject_cast<QgsMapLayer *>( sipCpp );
 | |
| 
 | |
|     sipType = 0;
 | |
| 
 | |
|     if ( layer )
 | |
|     {
 | |
|       switch ( layer->type() )
 | |
|       {
 | |
|         case QgsMapLayerType::VectorLayer:
 | |
|           sipType = sipType_QgsVectorLayer;
 | |
|           break;
 | |
|         case QgsMapLayerType::RasterLayer:
 | |
|           sipType = sipType_QgsRasterLayer;
 | |
|           break;
 | |
|         case QgsMapLayerType::PluginLayer:
 | |
|           sipType = sipType_QgsPluginLayer;
 | |
|           break;
 | |
|         case QgsMapLayerType::MeshLayer:
 | |
|           sipType = sipType_QgsMeshLayer;
 | |
|           break;
 | |
|         case QgsMapLayerType::VectorTileLayer:
 | |
|           sipType = sipType_QgsVectorTileLayer;
 | |
|           break;
 | |
|         case QgsMapLayerType::AnnotationLayer:
 | |
|           sipType = sipType_QgsAnnotationLayer;
 | |
|           break;
 | |
|         case QgsMapLayerType::PointCloudLayer:
 | |
|           sipType = sipType_QgsPointCloudLayer;
 | |
|           break;
 | |
|         default:
 | |
|           sipType = nullptr;
 | |
|           break;
 | |
|       }
 | |
|     }
 | |
| %End
 | |
|   public:
 | |
| 
 | |
|     enum PropertyType
 | |
|     {
 | |
|       Style,
 | |
|       Metadata,
 | |
|     };
 | |
| 
 | |
|     enum LayerFlag
 | |
|     {
 | |
|       Identifiable,
 | |
|       Removable,
 | |
|       Searchable,
 | |
|       Private,
 | |
|     };
 | |
|     typedef QFlags<QgsMapLayer::LayerFlag> LayerFlags;
 | |
| 
 | |
| 
 | |
|     enum StyleCategory
 | |
|     {
 | |
|       LayerConfiguration,
 | |
|       Symbology,
 | |
|       Symbology3D,
 | |
|       Labeling,
 | |
|       Fields,
 | |
|       Forms,
 | |
|       Actions,
 | |
|       MapTips,
 | |
|       Diagrams,
 | |
|       AttributeTable,
 | |
|       Rendering,
 | |
|       CustomProperties,
 | |
|       GeometryOptions,
 | |
|       Relations,
 | |
|       Temporal,
 | |
|       Legend,
 | |
|       Elevation,
 | |
|       AllStyleCategories
 | |
|     };
 | |
|     typedef QFlags<QgsMapLayer::StyleCategory> StyleCategories;
 | |
| 
 | |
| 
 | |
|     QgsMapLayer( QgsMapLayerType type = QgsMapLayerType::VectorLayer, const QString &name = QString(), const QString &source = QString() );
 | |
| %Docstring
 | |
| Constructor for QgsMapLayer
 | |
| 
 | |
| :param type: layer type
 | |
| :param name: display name for the layer
 | |
| :param source: datasource of layer
 | |
| %End
 | |
| 
 | |
|     ~QgsMapLayer();
 | |
| 
 | |
| 
 | |
|     virtual QgsMapLayer *clone() const = 0;
 | |
| %Docstring
 | |
| Returns a new instance equivalent to this one except for the id which
 | |
| is still unique.
 | |
| 
 | |
| :return: a new layer instance
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     QgsMapLayerType type() const;
 | |
| %Docstring
 | |
| Returns the type of the layer.
 | |
| %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
 | |
| %End
 | |
| 
 | |
|     static QString extensionPropertyType( PropertyType type );
 | |
| %Docstring
 | |
| Returns the extension of a Property.
 | |
| 
 | |
| :return: The extension
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     QString id() const;
 | |
| %Docstring
 | |
| Returns the layer's unique ID, which is used to access this layer from :py:class:`QgsProject`.
 | |
| %End
 | |
| 
 | |
|     void setName( const QString &name );
 | |
| %Docstring
 | |
| Set the display ``name`` of the layer.
 | |
| 
 | |
| .. seealso:: :py:func:`name`
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     QString name() const;
 | |
| %Docstring
 | |
| Returns the display name of the layer.
 | |
| 
 | |
| .. seealso:: :py:func:`setName`
 | |
| %End
 | |
| 
 | |
|     virtual QgsDataProvider *dataProvider();
 | |
| %Docstring
 | |
| Returns the layer's data provider, it may be ``None``.
 | |
| %End
 | |
| 
 | |
| 
 | |
|     void setShortName( const QString &shortName );
 | |
| %Docstring
 | |
| Sets the short name of the layer
 | |
| used by QGIS Server to identify the layer.
 | |
| 
 | |
| :return: the layer short name
 | |
| 
 | |
| .. seealso:: :py:func:`shortName`
 | |
| %End
 | |
| 
 | |
|     QString shortName() const;
 | |
| %Docstring
 | |
| Returns the short name of the layer
 | |
| used by QGIS Server to identify the layer.
 | |
| 
 | |
| .. seealso:: :py:func:`setShortName`
 | |
| %End
 | |
| 
 | |
|     void setTitle( const QString &title );
 | |
| %Docstring
 | |
| Sets the title of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| 
 | |
| .. seealso:: :py:func:`title`
 | |
| %End
 | |
| 
 | |
|     QString title() const;
 | |
| %Docstring
 | |
| Returns the title of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| 
 | |
| :return: the layer title
 | |
| 
 | |
| .. seealso:: :py:func:`setTitle`
 | |
| %End
 | |
| 
 | |
|     void setAbstract( const QString &abstract );
 | |
| %Docstring
 | |
| Sets the abstract of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| 
 | |
| :return: the layer abstract
 | |
| 
 | |
| .. seealso:: :py:func:`abstract`
 | |
| %End
 | |
| 
 | |
|     QString abstract() const;
 | |
| %Docstring
 | |
| Returns the abstract of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| 
 | |
| :return: the layer abstract
 | |
| 
 | |
| .. seealso:: :py:func:`setAbstract`
 | |
| %End
 | |
| 
 | |
|     void setKeywordList( const QString &keywords );
 | |
| %Docstring
 | |
| Sets the keyword list of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| 
 | |
| :return: the layer keyword list
 | |
| 
 | |
| .. seealso:: :py:func:`keywordList`
 | |
| %End
 | |
| 
 | |
|     QString keywordList() const;
 | |
| %Docstring
 | |
| Returns the keyword list of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| 
 | |
| :return: the layer keyword list
 | |
| 
 | |
| .. seealso:: :py:func:`setKeywordList`
 | |
| %End
 | |
| 
 | |
| 
 | |
|     void setDataUrl( const QString &dataUrl );
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`dataUrl`
 | |
| %End
 | |
| 
 | |
|     QString dataUrl() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setDataUrl`
 | |
| %End
 | |
| 
 | |
|     void setDataUrlFormat( const QString &dataUrlFormat );
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`dataUrlFormat`
 | |
| %End
 | |
| 
 | |
|     QString dataUrlFormat() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setDataUrlFormat`
 | |
| %End
 | |
| 
 | |
| 
 | |
|     void setAttribution( const QString &attrib );
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`attribution`
 | |
| %End
 | |
| 
 | |
|     QString attribution() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setAttribution`
 | |
| %End
 | |
| 
 | |
|     void setAttributionUrl( const QString &attribUrl );
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`attributionUrl`
 | |
| %End
 | |
| 
 | |
|     QString attributionUrl() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setAttributionUrl`
 | |
| %End
 | |
| 
 | |
| 
 | |
|     void setMetadataUrl( const QString &metaUrl );
 | |
| %Docstring
 | |
| Sets the metadata URL of the layer
 | |
| used by QGIS Server in GetCapabilities request.
 | |
| MetadataUrl is a a link to the detailed, standardized metadata about the data.
 | |
| 
 | |
| :return: the layer metadata URL
 | |
| 
 | |
| .. seealso:: :py:func:`metadataUrl`
 | |
| %End
 | |
| 
 | |
|     QString metadataUrl() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setMetadataUrl`
 | |
| %End
 | |
| 
 | |
|     void setMetadataUrlType( const QString &metaUrlType );
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`metadataUrlType`
 | |
| %End
 | |
| 
 | |
|     QString metadataUrlType() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setMetadataUrlType`
 | |
| %End
 | |
| 
 | |
|     void setMetadataUrlFormat( const QString &metaUrlFormat );
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`metadataUrlFormat`
 | |
| %End
 | |
| 
 | |
|     QString metadataUrlFormat() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`setMetadataUrlFormat`
 | |
| %End
 | |
| 
 | |
|     void setBlendMode( QPainter::CompositionMode blendMode );
 | |
| %Docstring
 | |
| Set the blending mode used for rendering a layer.
 | |
| 
 | |
| :param blendMode: new blending mode
 | |
| 
 | |
| .. seealso:: :py:func:`blendMode`
 | |
| %End
 | |
| 
 | |
|     QPainter::CompositionMode blendMode() const;
 | |
| %Docstring
 | |
| Returns the current blending mode for a layer.
 | |
| 
 | |
| .. seealso:: :py:func:`setBlendMode`
 | |
| %End
 | |
| 
 | |
|     virtual void setOpacity( double opacity );
 | |
| %Docstring
 | |
| Sets the ``opacity`` for the layer, where ``opacity`` is a value between 0 (totally transparent)
 | |
| and 1.0 (fully opaque).
 | |
| 
 | |
| .. seealso:: :py:func:`opacity`
 | |
| 
 | |
| .. seealso:: :py:func:`opacityChanged`
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Prior to QGIS 3.18, this method was available for vector layers only
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|     virtual double opacity() const;
 | |
| %Docstring
 | |
| Returns the opacity for the layer, where opacity is a value between 0 (totally transparent)
 | |
| and 1.0 (fully opaque).
 | |
| 
 | |
| .. seealso:: :py:func:`setOpacity`
 | |
| 
 | |
| .. seealso:: :py:func:`opacityChanged`
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Prior to QGIS 3.18, this method was available for vector layers only
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|     bool readOnly() const;
 | |
| %Docstring
 | |
| Returns if this layer is read only.
 | |
| %End
 | |
| 
 | |
|     virtual void reload();
 | |
| %Docstring
 | |
| Synchronises with changes in the datasource
 | |
| %End
 | |
| 
 | |
|     virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) = 0 /Factory/;
 | |
| %Docstring
 | |
| Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context
 | |
| 
 | |
| .. versionadded:: 2.4
 | |
| %End
 | |
| 
 | |
|     virtual QgsRectangle extent() const;
 | |
| %Docstring
 | |
| Returns the extent of the layer.
 | |
| %End
 | |
| 
 | |
|     bool isValid() const;
 | |
| %Docstring
 | |
| Returns the status of the layer. An invalid layer is one which has a bad datasource
 | |
| or other problem. Child classes set this flag when initialized.
 | |
| 
 | |
| :return: ``True`` if the layer is valid and can be accessed
 | |
| %End
 | |
| 
 | |
|     QString publicSource() const;
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. seealso:: :py:func:`source`
 | |
| %End
 | |
| 
 | |
|     QString source() const;
 | |
| %Docstring
 | |
| Returns the source for the layer. This source may contain usernames, passwords
 | |
| and other sensitive information.
 | |
| 
 | |
| .. seealso:: :py:func:`publicSource`
 | |
| %End
 | |
| 
 | |
|     virtual QStringList subLayers() const;
 | |
| %Docstring
 | |
| Returns the sublayers of this layer.
 | |
| (Useful for providers that manage their own layers, such as WMS).
 | |
| %End
 | |
| 
 | |
|     virtual void setLayerOrder( const QStringList &layers );
 | |
| %Docstring
 | |
| Reorders the *previously selected* sublayers of this layer from bottom to top.
 | |
| (Useful for providers that manage their own layers, such as WMS).
 | |
| %End
 | |
| 
 | |
|     virtual void setSubLayerVisibility( const QString &name, bool visible );
 | |
| %Docstring
 | |
| Set the visibility of the given sublayer name.
 | |
| 
 | |
| :param name: sublayer name
 | |
| :param visible: sublayer visibility
 | |
| %End
 | |
| 
 | |
|     virtual bool isEditable() const;
 | |
| %Docstring
 | |
| Returns ``True`` if the layer can be edited.
 | |
| %End
 | |
| 
 | |
|     virtual bool isSpatial() const;
 | |
| %Docstring
 | |
| Returns ``True`` if the layer is considered a spatial layer, ie it has some form of geometry associated with it.
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     virtual bool isTemporary() const;
 | |
| %Docstring
 | |
| Returns ``True`` if the layer is considered a temporary layer.
 | |
| 
 | |
| These include memory-only layers such as those created by the "memory" data provider, layers
 | |
| stored inside a local temporary folder (such as the "/tmp" folder on Linux)
 | |
| or layer with temporary data (as temporary mesh layer dataset)
 | |
| 
 | |
| .. versionadded:: 3.10.1
 | |
| %End
 | |
| 
 | |
|     enum ReadFlag
 | |
|     {
 | |
|       FlagDontResolveLayers,
 | |
|       FlagTrustLayerMetadata,
 | |
|     };
 | |
|     typedef QFlags<QgsMapLayer::ReadFlag> ReadFlags;
 | |
| 
 | |
| 
 | |
|     bool readLayerXml( const QDomElement &layerElement, QgsReadWriteContext &context, QgsMapLayer::ReadFlags flags = QgsMapLayer::ReadFlags() );
 | |
| %Docstring
 | |
| Sets state from DOM document
 | |
| 
 | |
| :param layerElement: The DOM element corresponding to ``maplayer'' tag
 | |
| :param context: writing context (e.g. for conversion between relative and absolute paths)
 | |
| :param flags: optional argument which can be used to control layer reading behavior.
 | |
| \note
 | |
| 
 | |
| The DOM node corresponds to a DOM document project file XML element read
 | |
| by :py:class:`QgsProject`.
 | |
| 
 | |
| This, in turn, calls :py:func:`~QgsMapLayer.readXml` (and then :py:func:`~QgsMapLayer.readSymbology`), which is overridable
 | |
| by sub-classes so that they can read their own specific state from the given DOM node.
 | |
| 
 | |
| Invoked by :py:func:`QgsProject.read()`.
 | |
| 
 | |
| :return: ``True`` if successful
 | |
| %End
 | |
| 
 | |
|     bool writeLayerXml( QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
 | |
| %Docstring
 | |
| Stores state in DOM node
 | |
| 
 | |
| :param layerElement: is a DOM element corresponding to ``maplayer'' tag
 | |
| :param document: is a the DOM document being written
 | |
| :param context: reading context (e.g. for conversion between relative and absolute paths)
 | |
| \note
 | |
| 
 | |
| The DOM node corresponds to a DOM document project file XML element to be
 | |
| written by :py:class:`QgsProject`.
 | |
| 
 | |
| This, in turn, calls :py:func:`~QgsMapLayer.writeXml` (and then writeSymbology), which is over-rideable
 | |
| by sub-classes so that they can write their own specific state to the given DOM node.
 | |
| 
 | |
| Invoked by :py:func:`QgsProject.write()`.
 | |
| 
 | |
| :return: ``True`` if successful
 | |
| %End
 | |
| 
 | |
|     virtual void resolveReferences( QgsProject *project );
 | |
| %Docstring
 | |
| Resolve references to other layers (kept as layer IDs after reading XML) into layer objects.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     QStringList customPropertyKeys() const;
 | |
| %Docstring
 | |
| Returns list of all keys within custom properties. Properties are stored in a map and saved in project file.
 | |
| 
 | |
| .. seealso:: :py:func:`customProperty`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void setCustomProperty( const QString &key, const QVariant &value );
 | |
| %Docstring
 | |
| Set a custom property for layer. Properties are stored in a map and saved in project file.
 | |
| 
 | |
| .. seealso:: :py:func:`customProperty`
 | |
| 
 | |
| .. seealso:: :py:func:`removeCustomProperty`
 | |
| %End
 | |
| 
 | |
|     QVariant customProperty( const QString &value, const QVariant &defaultValue = QVariant() ) const;
 | |
| %Docstring
 | |
| Read a custom property from layer. Properties are stored in a map and saved in project file.
 | |
| 
 | |
| .. seealso:: :py:func:`setCustomProperty`
 | |
| %End
 | |
| 
 | |
|     void setCustomProperties( const QgsObjectCustomProperties &properties );
 | |
| %Docstring
 | |
| Set custom properties for layer. Current properties are dropped.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     const QgsObjectCustomProperties &customProperties() const;
 | |
| %Docstring
 | |
| Read all custom properties from layer. Properties are stored in a map and saved in project file.
 | |
| 
 | |
| .. seealso:: :py:func:`setCustomProperties`
 | |
| 
 | |
| .. versionadded:: 3.14
 | |
| %End
 | |
| 
 | |
|     void removeCustomProperty( const QString &key );
 | |
| %Docstring
 | |
| Remove a custom property from layer. Properties are stored in a map and saved in project file.
 | |
| 
 | |
| .. seealso:: :py:func:`setCustomProperty`
 | |
| %End
 | |
| 
 | |
|     virtual QgsError error() const;
 | |
| %Docstring
 | |
| Gets current status error. This error describes some principal problem
 | |
| for which layer cannot work and thus is not valid. It is not last error
 | |
| after accessing data by :py:func:`~QgsMapLayer.draw` etc.
 | |
| %End
 | |
| 
 | |
|     QgsCoordinateReferenceSystem crs() const;
 | |
| %Docstring
 | |
| Returns the layer's spatial reference system.
 | |
| 
 | |
| .. versionadded:: 1.4
 | |
| %End
 | |
| 
 | |
|     void setCrs( const QgsCoordinateReferenceSystem &srs, bool emitSignal = true );
 | |
| %Docstring
 | |
| Sets layer's spatial reference system
 | |
| %End
 | |
| 
 | |
|     QgsCoordinateTransformContext transformContext( ) const;
 | |
| %Docstring
 | |
| Returns the layer data provider coordinate transform context
 | |
| or a default transform context if the layer does not have a valid data provider.
 | |
| 
 | |
| .. versionadded:: 3.8
 | |
| %End
 | |
| 
 | |
| 
 | |
|     static QString formatLayerName( const QString &name );
 | |
| %Docstring
 | |
| A convenience function to capitalize and format a layer ``name``.
 | |
| 
 | |
| .. 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)
 | |
| 
 | |
| 
 | |
| :return: - a QString with any status messages
 | |
|          - resultFlag: a reference to a flag that will be set to ``False`` if we did not manage to save the default metadata.
 | |
| 
 | |
| .. 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
 | |
|             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.
 | |
| :param resultFlag: a reference to a flag that will be set to ``False`` if
 | |
|                    we did not manage to save the default metadata.
 | |
| 
 | |
| :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
 | |
|             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.
 | |
| 
 | |
| :return: - a QString with any status messages
 | |
|          - resultFlag: a reference to a flag that will be set to ``False`` if we did not manage to load the default metadata.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual 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
 | |
|                    we did not manage to load the default metadata.
 | |
| 
 | |
| :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
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual QString styleURI() const;
 | |
| %Docstring
 | |
| 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
 | |
| 
 | |
| .. seealso:: :py:func:`also`
 | |
| %End
 | |
| 
 | |
|     virtual QString loadDefaultStyle( bool &resultFlag /Out/ );
 | |
| %Docstring
 | |
| 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)
 | |
| 
 | |
| 
 | |
| :return: - a QString with any status messages
 | |
|          - resultFlag: a reference to a flag that will be set to ``False`` if we did not manage to load the default style.
 | |
| 
 | |
| .. seealso:: :py:func:`also`
 | |
| %End
 | |
| 
 | |
|     virtual QString loadNamedStyle( const QString &uri, bool &resultFlag /Out/, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
 | |
| %Docstring
 | |
| 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)
 | |
| 
 | |
| :param uri: - the file name or other URI for the
 | |
|             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.
 | |
| :param categories: the style categories to be loaded.
 | |
| 
 | |
| :return: - a QString with any status messages
 | |
|          - resultFlag: a reference to a flag that will be set to ``False`` if we did not manage to load the default style.
 | |
| 
 | |
| .. seealso:: :py:func:`also`
 | |
| %End
 | |
| 
 | |
|     virtual bool loadNamedStyleFromDatabase( const QString &db, const QString &uri, QString &qml /Out/ );
 | |
| %Docstring
 | |
| Retrieve a named style for this layer from a sqlite database.
 | |
| 
 | |
| :param db: path to sqlite database
 | |
| :param uri: uri for table
 | |
| 
 | |
| :return: - ``True`` if style was successfully loaded
 | |
|          - qml: will be set to QML style content from database
 | |
| %End
 | |
| 
 | |
|     virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg /Out/,
 | |
|                                    QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
 | |
| %Docstring
 | |
| Import the properties of this layer from a QDomDocument
 | |
| 
 | |
| :param doc: source QDomDocument
 | |
| :param errorMsg: this QString will be initialized on error
 | |
|                  during the execution of readSymbology
 | |
| :param categories: the style categories to import
 | |
| 
 | |
| :return: ``True`` on success
 | |
| 
 | |
| .. versionadded:: 2.8
 | |
| %End
 | |
| 
 | |
|     virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg /Out/, const QgsReadWriteContext &context = QgsReadWriteContext(),
 | |
|                                    QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
 | |
| %Docstring
 | |
| Export the properties of this layer as named style in a QDomDocument
 | |
| 
 | |
| :param doc: the target QDomDocument
 | |
| :param errorMsg: this QString will be initialized on error
 | |
| :param context: read write context
 | |
| :param categories: the style categories to export
 | |
|                    during the execution of writeSymbology
 | |
| %End
 | |
| 
 | |
| 
 | |
|     virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;
 | |
| %Docstring
 | |
| Export the properties of this layer as SLD style in a QDomDocument
 | |
| 
 | |
| :param doc: the target QDomDocument
 | |
| :param errorMsg: this QString will be initialized on error
 | |
|                  during the execution of writeSymbology
 | |
| %End
 | |
| 
 | |
|     virtual QString saveDefaultStyle( bool &resultFlag /Out/ );
 | |
| %Docstring
 | |
| 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)
 | |
| 
 | |
| 
 | |
| :return: - a QString with any status messages
 | |
|          - resultFlag: a reference to a flag that will be set to ``False`` if we did not manage to save the default style.
 | |
| 
 | |
| .. seealso:: :py:func:`loadNamedStyle`
 | |
| %End
 | |
| 
 | |
|     virtual QString saveNamedStyle( const QString &uri, bool &resultFlag /Out/, StyleCategories categories = AllStyleCategories );
 | |
| %Docstring
 | |
| 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)
 | |
| 
 | |
| :param uri: the file name or other URI for the
 | |
|             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.
 | |
| :param categories: the style categories to be saved.
 | |
| 
 | |
| :return: - a QString with any status messages
 | |
|          - resultFlag: a reference to a flag that will be set to ``False`` if we did not manage to save the default style.
 | |
| 
 | |
| .. seealso:: :py:func:`saveDefaultStyle`
 | |
| %End
 | |
| 
 | |
|     virtual QString saveSldStyle( const QString &uri, bool &resultFlag ) const;
 | |
| %Docstring
 | |
| Saves the properties of this layer to an SLD format file.
 | |
| 
 | |
| :param uri: uri of destination for exported SLD file.
 | |
| :param resultFlag: a reference to a flag that will be set to ``False`` if
 | |
|                    the SLD file could not be generated
 | |
| 
 | |
| :return: a string with any status or error messages
 | |
| 
 | |
| .. seealso:: :py:func:`loadSldStyle`
 | |
| %End
 | |
| 
 | |
|     virtual QString loadSldStyle( const QString &uri, bool &resultFlag );
 | |
| %Docstring
 | |
| Attempts to style the layer using the formatting from an SLD type file.
 | |
| 
 | |
| :param uri: uri of source SLD file
 | |
| :param resultFlag: a reference to a flag that will be set to ``False`` if
 | |
|                    the SLD file could not be loaded
 | |
| 
 | |
| :return: a string with any status or error messages
 | |
| 
 | |
| .. seealso:: :py:func:`saveSldStyle`
 | |
| %End
 | |
| 
 | |
|     virtual bool readSld( const QDomNode &node, QString &errorMessage );
 | |
| 
 | |
| 
 | |
| 
 | |
|     virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
 | |
|                                 QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) = 0;
 | |
| %Docstring
 | |
| Read the symbology for the current layer from the DOM node supplied.
 | |
| 
 | |
| :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)
 | |
| :param categories: the style categories to be read
 | |
| 
 | |
| :return: ``True`` in case of success.
 | |
| %End
 | |
| 
 | |
|     virtual bool readStyle( const QDomNode &node, QString &errorMessage,
 | |
|                             QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories );
 | |
| %Docstring
 | |
| Read the style for the current layer from the DOM node supplied.
 | |
| 
 | |
| :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)
 | |
| :param categories: the style categories to be read
 | |
| 
 | |
| :return: ``True`` in case of success.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    To be implemented in subclasses. Default implementation does nothing and returns ``False``.
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
 | |
|                                  StyleCategories categories = AllStyleCategories ) const = 0;
 | |
| %Docstring
 | |
| Write the style for the layer into the docment provided.
 | |
| 
 | |
| :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)
 | |
| :param categories: the style categories to be written
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    There is a confusion of terms with the GUI. This method actually writes what is called a style in the application.
 | |
| 
 | |
| :return: ``True`` in case of success.
 | |
| %End
 | |
| 
 | |
|     virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
 | |
|                              StyleCategories categories = AllStyleCategories ) const;
 | |
| %Docstring
 | |
| Write just the symbology information for the layer into the document
 | |
| 
 | |
| :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)
 | |
| :param categories: the style categories to be written
 | |
| 
 | |
| :return: ``True`` in case of success.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    To be implemented in subclasses. Default implementation does nothing and returns ``False``.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    There is a confusion of terms with the GUI. This method actually writes what is known as the symbology in the application.
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
| 
 | |
|     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
 | |
| 
 | |
|     QUndoStack *undoStack();
 | |
| %Docstring
 | |
| Returns pointer to layer's undo stack
 | |
| %End
 | |
| 
 | |
|     QUndoStack *undoStackStyles();
 | |
| %Docstring
 | |
| Returns pointer to layer's style undo stack
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     void setLegendUrl( const QString &legendUrl );
 | |
| %Docstring
 | |
| Sets the URL for the layer's legend.
 | |
| %End
 | |
| 
 | |
|     QString legendUrl() const;
 | |
| %Docstring
 | |
| Returns the URL for the layer's legend.
 | |
| %End
 | |
| 
 | |
|     void setLegendUrlFormat( const QString &legendUrlFormat );
 | |
| %Docstring
 | |
| Sets the format for a URL based layer legend.
 | |
| %End
 | |
| 
 | |
|     QString legendUrlFormat() const;
 | |
| %Docstring
 | |
| Returns the format for a URL based layer legend.
 | |
| %End
 | |
| 
 | |
|     void setLegend( QgsMapLayerLegend *legend /Transfer/ );
 | |
| %Docstring
 | |
| Assign a legend controller to the map layer. The object will be responsible for providing legend items.
 | |
| 
 | |
| :param legend: Takes ownership of the object. Can be ``None``.
 | |
| 
 | |
| .. versionadded:: 2.6
 | |
| %End
 | |
| 
 | |
|     QgsMapLayerLegend *legend() const;
 | |
| %Docstring
 | |
| Can be ``None``.
 | |
| 
 | |
| .. versionadded:: 2.6
 | |
| %End
 | |
| 
 | |
|     QgsMapLayerStyleManager *styleManager() const;
 | |
| %Docstring
 | |
| Gets access to the layer's style manager. Style manager allows switching between multiple styles.
 | |
| 
 | |
| .. versionadded:: 2.8
 | |
| %End
 | |
| 
 | |
|     void setRenderer3D( QgsAbstract3DRenderer *renderer /Transfer/ );
 | |
| %Docstring
 | |
| Sets 3D renderer for the layer. Takes ownership of the renderer.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     QgsAbstract3DRenderer *renderer3D() const;
 | |
| %Docstring
 | |
| Returns 3D renderer associated with the layer. May be ``None``.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     bool isInScaleRange( double scale ) const;
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. seealso:: :py:func:`minimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`maximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`hasScaleBasedVisibility`
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     double minimumScale() const;
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
 | |
| 
 | |
| .. seealso:: :py:func:`setMinimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`maximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`hasScaleBasedVisibility`
 | |
| 
 | |
| .. seealso:: :py:func:`isInScaleRange`
 | |
| %End
 | |
| 
 | |
|     double maximumScale() const;
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
 | |
| 
 | |
| .. seealso:: :py:func:`setMaximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`minimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`hasScaleBasedVisibility`
 | |
| 
 | |
| .. seealso:: :py:func:`isInScaleRange`
 | |
| %End
 | |
| 
 | |
|     bool hasScaleBasedVisibility() const;
 | |
| %Docstring
 | |
| Returns whether scale based visibility is enabled for the layer.
 | |
| 
 | |
| :return: ``True`` if scale based visibility is enabled
 | |
| 
 | |
| .. seealso:: :py:func:`minimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`maximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`setScaleBasedVisibility`
 | |
| 
 | |
| .. seealso:: :py:func:`isInScaleRange`
 | |
| %End
 | |
| 
 | |
|     bool hasAutoRefreshEnabled() const;
 | |
| %Docstring
 | |
| Returns ``True`` if auto refresh is enabled for the layer.
 | |
| 
 | |
| .. seealso:: :py:func:`autoRefreshInterval`
 | |
| 
 | |
| .. seealso:: :py:func:`setAutoRefreshEnabled`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     int autoRefreshInterval() const;
 | |
| %Docstring
 | |
| Returns the auto refresh interval (in milliseconds). Note that
 | |
| auto refresh is only active when :py:func:`~QgsMapLayer.hasAutoRefreshEnabled` is ``True``.
 | |
| 
 | |
| .. seealso:: :py:func:`hasAutoRefreshEnabled`
 | |
| 
 | |
| .. seealso:: :py:func:`setAutoRefreshInterval`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void setAutoRefreshInterval( int interval );
 | |
| %Docstring
 | |
| 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 :py:func:`~QgsMapLayer.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.
 | |
| 
 | |
| .. seealso:: :py:func:`autoRefreshInterval`
 | |
| 
 | |
| .. seealso:: :py:func:`setAutoRefreshEnabled`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void setAutoRefreshEnabled( bool enabled );
 | |
| %Docstring
 | |
| Sets whether auto refresh is enabled for the layer.
 | |
| 
 | |
| .. seealso:: :py:func:`hasAutoRefreshEnabled`
 | |
| 
 | |
| .. seealso:: :py:func:`setAutoRefreshInterval`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual const QgsLayerMetadata &metadata() const;
 | |
| %Docstring
 | |
| Returns a reference to the layer's metadata store.
 | |
| 
 | |
| .. seealso:: :py:func:`setMetadata`
 | |
| 
 | |
| .. seealso:: :py:func:`metadataChanged`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual void setMetadata( const QgsLayerMetadata &metadata );
 | |
| %Docstring
 | |
| Sets the layer's ``metadata`` store.
 | |
| 
 | |
| .. seealso:: :py:func:`metadata`
 | |
| 
 | |
| .. seealso:: :py:func:`metadataChanged`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual QString htmlMetadata() const;
 | |
| %Docstring
 | |
| Obtain a formatted HTML string containing assorted metadata for this layer.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %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
 | |
| Gets the list of dependencies. This includes data dependencies set by the user (:py:func:`setDataDependencies`)
 | |
| as well as dependencies given by the provider
 | |
| 
 | |
| :return: a set of QgsMapLayerDependency
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     QString refreshOnNotifyMessage() const;
 | |
| %Docstring
 | |
| Returns the message that should be notified by the provider to triggerRepaint
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     bool isRefreshOnNotifyEnabled() const;
 | |
| %Docstring
 | |
| Returns ``True`` if the refresh on provider nofification is enabled
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     QString originalXmlProperties() const;
 | |
| %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
 | |
| 
 | |
|     void setOriginalXmlProperties( const QString &originalXmlProperties );
 | |
| %Docstring
 | |
| Sets the original XML properties for the layer to  ``originalXmlProperties``
 | |
| 
 | |
| The storage format for the XML is qlr
 | |
| 
 | |
| .. versionadded:: 3.6
 | |
| %End
 | |
| 
 | |
|     static QString generateId( const QString &layerName );
 | |
| %Docstring
 | |
| Generates an unique identifier for this layer, the generate ID is prefixed by ``layerName``
 | |
| 
 | |
| .. versionadded:: 3.8
 | |
| %End
 | |
| 
 | |
|     virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
 | |
| %Docstring
 | |
| Accepts the specified symbology ``visitor``, causing it to visit all symbols associated
 | |
| with the layer.
 | |
| 
 | |
| Returns ``True`` if the visitor should continue visiting other objects, or ``False`` if visiting
 | |
| should be canceled.
 | |
| 
 | |
| .. versionadded:: 3.10
 | |
| %End
 | |
| 
 | |
|     virtual QgsMapLayerTemporalProperties *temporalProperties();
 | |
| %Docstring
 | |
| Returns the layer's temporal properties. This may be ``None``, depending on the layer type.
 | |
| 
 | |
| .. versionadded:: 3.14
 | |
| %End
 | |
| 
 | |
|     virtual QgsMapLayerElevationProperties *elevationProperties();
 | |
| %Docstring
 | |
| Returns the layer's elevation properties. This may be ``None``, depending on the layer type.
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|   public slots:
 | |
| 
 | |
|     void setMinimumScale( double scale );
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
 | |
| 
 | |
| .. seealso:: :py:func:`minimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`setMaximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`setScaleBasedVisibility`
 | |
| %End
 | |
| 
 | |
|     void setMaximumScale( double scale );
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Scale based visibility is only used if :py:func:`~QgsMapLayer.setScaleBasedVisibility` is set to ``True``.
 | |
| 
 | |
| .. seealso:: :py:func:`maximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`setMinimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`setScaleBasedVisibility`
 | |
| %End
 | |
| 
 | |
|     void setScaleBasedVisibility( bool enabled );
 | |
| %Docstring
 | |
| Sets whether scale based visibility is enabled for the layer.
 | |
| 
 | |
| :param enabled: set to ``True`` to enable scale based visibility
 | |
| 
 | |
| .. seealso:: :py:func:`setMinimumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`setMaximumScale`
 | |
| 
 | |
| .. seealso:: :py:func:`hasScaleBasedVisibility`
 | |
| %End
 | |
| 
 | |
|     void triggerRepaint( bool deferredUpdate = false );
 | |
| %Docstring
 | |
| Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
 | |
| Will emit a :py:func:`~QgsMapLayer.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.
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    in 2.6 function moved from vector/raster subclasses to QgsMapLayer
 | |
| %End
 | |
| 
 | |
|     void trigger3DUpdate();
 | |
| %Docstring
 | |
| Will advise any 3D maps that this layer requires to be updated in the scene.
 | |
| Will emit a :py:func:`~QgsMapLayer.request3DUpdate` signal.
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|     void emitStyleChanged();
 | |
| %Docstring
 | |
| Triggers an emission of the :py:func:`~QgsMapLayer.styleChanged` signal.
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers );
 | |
| %Docstring
 | |
| Sets the list of dependencies.
 | |
| 
 | |
| .. seealso:: :py:func:`dependencies`
 | |
| 
 | |
| :param layers: set of QgsMapLayerDependency. Only user-defined dependencies will be added
 | |
| 
 | |
| :return: ``False`` if a dependency cycle has been detected
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void setRefreshOnNotifyEnabled( bool enabled );
 | |
| %Docstring
 | |
| Set whether provider notification is connected to triggerRepaint
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void setRefreshOnNofifyMessage( const QString &message );
 | |
| %Docstring
 | |
| Set the notification message that triggers repaint
 | |
| If refresh on notification is enabled, the notification will triggerRepaint only
 | |
| if the notification message is equal to:param message:
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext ) = 0;
 | |
| %Docstring
 | |
| Sets the coordinate transform context to ``transformContext``
 | |
| 
 | |
| .. versionadded:: 3.8
 | |
| %End
 | |
| 
 | |
|     SIP_PYOBJECT __repr__();
 | |
| %MethodCode
 | |
|     QString str = QStringLiteral( "<QgsMapLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
 | |
|     sipRes = PyUnicode_FromString( str.toUtf8().constData() );
 | |
| %End
 | |
| 
 | |
|   signals:
 | |
| 
 | |
|     void beforeResolveReferences( QgsProject *project );
 | |
| %Docstring
 | |
| Emitted when all layers are loaded and references can be resolved,
 | |
| just before the references of this layer are resolved.
 | |
| 
 | |
| .. versionadded:: 3.10
 | |
| %End
 | |
| 
 | |
|     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
 | |
| 
 | |
|     void nameChanged();
 | |
| %Docstring
 | |
| Emitted when the name has been changed
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     void crsChanged();
 | |
| %Docstring
 | |
| Emit a signal that layer's CRS has been reset
 | |
| %End
 | |
| 
 | |
|     void repaintRequested( bool deferredUpdate = false );
 | |
| %Docstring
 | |
| 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.
 | |
| %End
 | |
| 
 | |
|     void recalculateExtents() const;
 | |
| %Docstring
 | |
| This is used to send a request that any mapcanvas using this layer update its extents
 | |
| %End
 | |
| 
 | |
|     void dataChanged();
 | |
| %Docstring
 | |
| Data of layer changed
 | |
| %End
 | |
| 
 | |
|     void blendModeChanged( QPainter::CompositionMode blendMode );
 | |
| %Docstring
 | |
| Signal emitted when the blend mode is changed, through :py:func:`QgsMapLayer.setBlendMode()`
 | |
| %End
 | |
| 
 | |
|     void opacityChanged( double opacity );
 | |
| %Docstring
 | |
| Emitted when the layer's opacity is changed, where ``opacity`` is a value between 0 (transparent)
 | |
| and 1 (opaque).
 | |
| 
 | |
| .. seealso:: :py:func:`setOpacity`
 | |
| 
 | |
| .. seealso:: :py:func:`opacity`
 | |
| 
 | |
| .. note::
 | |
| 
 | |
|    Prior to QGIS 3.18, this signal was available for vector layers only
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|     void rendererChanged();
 | |
| %Docstring
 | |
| Signal emitted when renderer is changed.
 | |
| 
 | |
| .. seealso:: :py:func:`styleChanged`
 | |
| %End
 | |
| 
 | |
|     void styleChanged();
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. seealso:: :py:func:`rendererChanged`
 | |
| 
 | |
| .. versionadded:: 2.16
 | |
| %End
 | |
| 
 | |
|     void legendChanged();
 | |
| %Docstring
 | |
| Signal emitted when legend of the layer has changed
 | |
| 
 | |
| .. versionadded:: 2.6
 | |
| %End
 | |
| 
 | |
|     void renderer3DChanged();
 | |
| %Docstring
 | |
| Signal emitted when 3D renderer associated with the layer has changed.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void request3DUpdate();
 | |
| %Docstring
 | |
| Signal emitted when a layer requires an update in any 3D maps.
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|     void configChanged();
 | |
| %Docstring
 | |
| Emitted whenever the configuration is changed. The project listens to this signal
 | |
| to be marked as dirty.
 | |
| %End
 | |
| 
 | |
|     void dependenciesChanged();
 | |
| %Docstring
 | |
| Emitted when dependencies are changed.
 | |
| %End
 | |
| 
 | |
|     void willBeDeleted();
 | |
| %Docstring
 | |
| 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.
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void autoRefreshIntervalChanged( int interval );
 | |
| %Docstring
 | |
| Emitted when the auto refresh interval changes.
 | |
| 
 | |
| .. seealso:: :py:func:`setAutoRefreshInterval`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void metadataChanged();
 | |
| %Docstring
 | |
| Emitted when the layer's metadata is changed.
 | |
| 
 | |
| .. seealso:: :py:func:`setMetadata`
 | |
| 
 | |
| .. seealso:: :py:func:`metadata`
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void flagsChanged();
 | |
| %Docstring
 | |
| Emitted when layer's flags have been modified.
 | |
| 
 | |
| .. seealso:: :py:func:`setFlags`
 | |
| 
 | |
| .. seealso:: :py:func:`flags`
 | |
| 
 | |
| .. versionadded:: 3.4
 | |
| %End
 | |
| 
 | |
|     void dataSourceChanged();
 | |
| %Docstring
 | |
| Emitted whenever the layer's data source has been changed.
 | |
| 
 | |
| .. seealso:: :py:func:`setDataSource`
 | |
| 
 | |
| .. versionadded:: 3.5
 | |
| %End
 | |
| 
 | |
|     void styleLoaded( QgsMapLayer::StyleCategories categories );
 | |
| %Docstring
 | |
| Emitted when a style has been loaded
 | |
| 
 | |
| :param categories: style categories
 | |
| 
 | |
| .. versionadded:: 3.12
 | |
| %End
 | |
| 
 | |
|     void isValidChanged();
 | |
| %Docstring
 | |
| Emitted when the validity of this layer changed.
 | |
| 
 | |
| .. versionadded:: 3.16
 | |
| %End
 | |
| 
 | |
|     void customPropertyChanged( const QString &key );
 | |
| %Docstring
 | |
| Emitted when a custom property of the layer has been changed or removed.
 | |
| 
 | |
| .. versionadded:: 3.18
 | |
| %End
 | |
| 
 | |
|   protected:
 | |
| 
 | |
|     void clone( QgsMapLayer *layer ) const;
 | |
| %Docstring
 | |
| Copies attributes like name, short name, ... into another layer.
 | |
| 
 | |
| :param layer: The copy recipient
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     virtual void setExtent( const QgsRectangle &rect );
 | |
| %Docstring
 | |
| Sets the extent
 | |
| %End
 | |
| 
 | |
|     void setValid( bool valid );
 | |
| %Docstring
 | |
| Sets whether layer is valid or not
 | |
| %End
 | |
| 
 | |
|     virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context );
 | |
| %Docstring
 | |
| Called by :py:func:`~QgsMapLayer.readLayerXML`, used by children to read state specific to them from
 | |
| project files.
 | |
| %End
 | |
| 
 | |
|     virtual bool writeXml( QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context ) const;
 | |
| %Docstring
 | |
| Called by :py:func:`~QgsMapLayer.writeLayerXML`, used by children to write state specific to them to
 | |
| project files.
 | |
| %End
 | |
| 
 | |
|     virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const;
 | |
| %Docstring
 | |
| Called by :py:func:`~QgsMapLayer.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)
 | |
| 
 | |
| :return: encoded source, typically to be written in the DOM element "datasource"
 | |
| 
 | |
| .. versionadded:: 3.2
 | |
| %End
 | |
| 
 | |
|     virtual QString decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const;
 | |
| %Docstring
 | |
| Called by :py:func:`~QgsMapLayer.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:")
 | |
| 
 | |
| :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
 | |
| :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
 | |
| %End
 | |
| 
 | |
|     void readCustomProperties( const QDomNode &layerNode, const QString &keyStartsWith = QString() );
 | |
| %Docstring
 | |
| Read custom properties from project file.
 | |
| 
 | |
| :param layerNode: note to read from
 | |
| :param keyStartsWith: reads only properties starting with the specified string (or all if the string is empty)
 | |
| %End
 | |
| 
 | |
|     void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc ) const;
 | |
| %Docstring
 | |
| Write custom properties to project file.
 | |
| %End
 | |
| 
 | |
|     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
 | |
| 
 | |
|     void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
 | |
|                            const QgsReadWriteContext &context,
 | |
|                            StyleCategories categories = AllStyleCategories ) const;
 | |
| %Docstring
 | |
| Write style data common to all layer types
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void readCommonStyle( const QDomElement &layerElement, const QgsReadWriteContext &context,
 | |
|                           StyleCategories categories = AllStyleCategories );
 | |
| %Docstring
 | |
| Read style data common to all layer types
 | |
| 
 | |
| .. versionadded:: 3.0
 | |
| %End
 | |
| 
 | |
|     void setProviderType( const QString &providerType );
 | |
| %Docstring
 | |
| Sets the ``providerType`` (provider key)
 | |
| %End
 | |
| 
 | |
| 
 | |
|     void appendError( const QgsErrorMessage &error );
 | |
| %Docstring
 | |
| Add error message
 | |
| %End
 | |
|     void setError( const QgsError &error );
 | |
| %Docstring
 | |
| Sets error message
 | |
| %End
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|  bool hasDependencyCycle( const QSet<QgsMapLayerDependency> & ) const;
 | |
| %Docstring
 | |
| Checks whether a new set of dependencies will introduce a cycle
 | |
| this method is now deprecated and always return ``False``, because circular dependencies are now correctly managed.
 | |
| 
 | |
| .. deprecated:: QGIS 3.10
 | |
| %End
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| };
 | |
| 
 | |
| QFlags<QgsMapLayer::LayerFlag> operator|(QgsMapLayer::LayerFlag f1, QFlags<QgsMapLayer::LayerFlag> f2);
 | |
| 
 | |
| QFlags<QgsMapLayer::StyleCategory> operator|(QgsMapLayer::StyleCategory f1, QFlags<QgsMapLayer::StyleCategory> f2);
 | |
| 
 | |
| QFlags<QgsMapLayer::ReadFlag> operator|(QgsMapLayer::ReadFlag f1, QFlags<QgsMapLayer::ReadFlag> f2);
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| /************************************************************************
 | |
|  * This file has been generated automatically from                      *
 | |
|  *                                                                      *
 | |
|  * src/core/qgsmaplayer.h                                               *
 | |
|  *                                                                      *
 | |
|  * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | |
|  ************************************************************************/
 |