diff --git a/python/core/qgsmaplayer.sip b/python/core/qgsmaplayer.sip index 5704ff532a5..a664e875b09 100644 --- a/python/core/qgsmaplayer.sip +++ b/python/core/qgsmaplayer.sip @@ -67,6 +67,15 @@ class QgsMapLayer : QObject virtual ~QgsMapLayer(); + virtual QgsMapLayer *clone( bool deep ) const = 0; +%Docstring + Returns a new instance equivalent to this one. + \param deep If true, a deep copy is done + :return: a new layer instance +.. versionadded:: 3.0 + :rtype: QgsMapLayer +%End + QgsMapLayer::LayerType type() const; %Docstring Returns the type of the layer. @@ -470,6 +479,13 @@ Invoked by QgsProject.read(). :rtype: QVariant %End + void setCustomProperties( const QgsObjectCustomProperties &properties ); +%Docstring + Set custom properties for layer. + \param properties The custom properties to set. +.. versionadded:: 3.0 +%End + void removeCustomProperty( const QString &key ); %Docstring Remove a custom property from layer. Properties are stored in a map and saved in project file. @@ -1028,6 +1044,16 @@ Signal emitted when the blend mode is changed, through QgsMapLayer.setBlendMode( %End protected: + + void clone( QgsMapLayer *layer, bool deep = false ) const; +%Docstring + Copies attributes like name, short name, ... into another layer. The + unique ID is copied too if deep parameter is true. + \param layer The copy recipient + \param deep To copy the unique ID or not +.. versionadded:: 3.0 +%End + virtual void setExtent( const QgsRectangle &rect ); %Docstring Set the extent diff --git a/python/core/qgsmaplayerstylemanager.sip b/python/core/qgsmaplayerstylemanager.sip index 070963b5ade..c1235f0ad71 100644 --- a/python/core/qgsmaplayerstylemanager.sip +++ b/python/core/qgsmaplayerstylemanager.sip @@ -133,6 +133,15 @@ Write configuration (for project saving) Return list of all defined style names :rtype: list of str %End + + QMap mapLayerStyles() const; +%Docstring + Gets available styles for the associated map layer. + :return: A map of map layer style by style name +.. versionadded:: 3.0 + :rtype: QMap +%End + QgsMapLayerStyle style( const QString &name ) const; %Docstring Return data of a stored style - accessed by its unique name diff --git a/python/core/qgspluginlayer.sip b/python/core/qgspluginlayer.sip index 8cdb885af38..240d976c6d8 100644 --- a/python/core/qgspluginlayer.sip +++ b/python/core/qgspluginlayer.sip @@ -26,6 +26,15 @@ In order to be readable from project files, they should set these attributes in QgsPluginLayer( const QString &layerType, const QString &layerName = QString() ); ~QgsPluginLayer(); + virtual QgsPluginLayer *clone( bool deep ) const = 0; +%Docstring + Returns a new instance equivalent to this one. + \param deep If true, a deep copy is done + :return: a new layer instance +.. versionadded:: 3.0 + :rtype: QgsPluginLayer +%End + QString pluginLayerType(); %Docstring Return plugin layer type (the same as used in QgsPluginLayerRegistry) diff --git a/python/core/qgsvectorlayer.sip b/python/core/qgsvectorlayer.sip index 944b8727011..59063d1fd72 100644 --- a/python/core/qgsvectorlayer.sip +++ b/python/core/qgsvectorlayer.sip @@ -334,6 +334,18 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator, QgsFeatureSin virtual ~QgsVectorLayer(); + virtual QgsVectorLayer *clone( bool deep = false ) const /Factory/; +%Docstring + Returns a new instance equivalent to this one. A new provider is + created for the same data source and renderers for features and diagrams + are cloned too. Moreover, each attributes (transparency, extent, selected + features and so on) are identicals. + \param deep If true, a deep copy is done (unique ID is copied too) + :return: a new layer instance +.. versionadded:: 3.0 + :rtype: QgsVectorLayer +%End + QString storageType() const; %Docstring Returns the permanent storage type for this layer as a friendly name. diff --git a/python/core/raster/qgsrasterlayer.sip b/python/core/raster/qgsrasterlayer.sip index 06de0b41614..3cbe0bea192 100644 --- a/python/core/raster/qgsrasterlayer.sip +++ b/python/core/raster/qgsrasterlayer.sip @@ -41,6 +41,14 @@ class QgsRasterLayer : QgsMapLayer /** \brief The destructor */ ~QgsRasterLayer(); + /** Returns a new instance equivalent to this one. A new provider is + * created for the same data source and renderer is cloned too. + * \param deep If true, a deep copy is done (unique ID is copy too) + * \returns a new layer instance + * \since QGIS 3.0 + */ + virtual QgsRasterLayer *clone( bool deep = true ) const /Factory/; + /** \brief This enumerator describes the types of shading that can be used */ enum ColorShadingAlgorithm {