mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
QgsVectorLayerJoinBuffer inherits from QgsFeatureSink
This commit is contained in:
parent
f27764d2ba
commit
1fb88a778c
@ -14,7 +14,7 @@
|
|||||||
typedef QList< QgsVectorLayerJoinInfo > QgsVectorJoinList;
|
typedef QList< QgsVectorLayerJoinInfo > QgsVectorJoinList;
|
||||||
|
|
||||||
|
|
||||||
class QgsVectorLayerJoinBuffer : QObject
|
class QgsVectorLayerJoinBuffer : QObject, QgsFeatureSink
|
||||||
{
|
{
|
||||||
%Docstring
|
%Docstring
|
||||||
Manages joined fields for a vector layer*
|
Manages joined fields for a vector layer*
|
||||||
@ -132,23 +132,8 @@ Quick way to test if there is any join at all
|
|||||||
:rtype: QgsVectorLayerJoinBuffer
|
:rtype: QgsVectorLayerJoinBuffer
|
||||||
%End
|
%End
|
||||||
|
|
||||||
bool addFeature( const QgsFeature &feature ) const;
|
virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 );
|
||||||
%Docstring
|
|
||||||
Adds a feature in joined layers. The feature given in parameter is the
|
|
||||||
one added in target layer. If a corresponding joined feature yet exists
|
|
||||||
in a joined layer, then this feature is just updated. Note that if a
|
|
||||||
corresponding joined feature has only empty fields, then it's not
|
|
||||||
created nor added.
|
|
||||||
|
|
||||||
\param feature The feature added in the target layer.
|
|
||||||
|
|
||||||
:return: false if an error happened, true otherwise
|
|
||||||
|
|
||||||
.. versionadded:: 3.0
|
|
||||||
:rtype: bool
|
|
||||||
%End
|
|
||||||
|
|
||||||
bool addFeatures( const QgsFeatureList &features ) const;
|
|
||||||
%Docstring
|
%Docstring
|
||||||
Adds a list of features in joined layers. Features given in parameter
|
Adds a list of features in joined layers. Features given in parameter
|
||||||
are those added in target layer. If a corresponding joined feature yet
|
are those added in target layer. If a corresponding joined feature yet
|
||||||
@ -157,6 +142,7 @@ Quick way to test if there is any join at all
|
|||||||
created nor added.
|
created nor added.
|
||||||
|
|
||||||
\param features The list of features added in the target layer
|
\param features The list of features added in the target layer
|
||||||
|
\param flags Unused parameter
|
||||||
|
|
||||||
:return: false if an error happened, true otherwise
|
:return: false if an error happened, true otherwise
|
||||||
|
|
||||||
@ -164,7 +150,7 @@ Quick way to test if there is any join at all
|
|||||||
:rtype: bool
|
:rtype: bool
|
||||||
%End
|
%End
|
||||||
|
|
||||||
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() ) const;
|
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
|
||||||
%Docstring
|
%Docstring
|
||||||
Changes attribute value in joined layers. The feature id given in
|
Changes attribute value in joined layers. The feature id given in
|
||||||
parameter is the one added in target layer. If the corresponding joined
|
parameter is the one added in target layer. If the corresponding joined
|
||||||
|
@ -135,7 +135,6 @@ void QgsVectorLayerJoinBuffer::cacheJoinLayer( QgsVectorLayerJoinInfo &joinInfo
|
|||||||
|
|
||||||
QgsFeatureRequest request;
|
QgsFeatureRequest request;
|
||||||
request.setFlags( QgsFeatureRequest::NoGeometry );
|
request.setFlags( QgsFeatureRequest::NoGeometry );
|
||||||
|
|
||||||
// maybe user requested just a subset of layer's attributes
|
// maybe user requested just a subset of layer's attributes
|
||||||
// so we do not have to cache everything
|
// so we do not have to cache everything
|
||||||
bool hasSubset = joinInfo.joinFieldNamesSubset();
|
bool hasSubset = joinInfo.joinFieldNamesSubset();
|
||||||
@ -518,12 +517,7 @@ void QgsVectorLayerJoinBuffer::connectJoinedLayer( QgsVectorLayer *vl )
|
|||||||
connect( vl, &QgsVectorLayer::willBeDeleted, this, &QgsVectorLayerJoinBuffer::joinedLayerWillBeDeleted, Qt::UniqueConnection );
|
connect( vl, &QgsVectorLayer::willBeDeleted, this, &QgsVectorLayerJoinBuffer::joinedLayerWillBeDeleted, Qt::UniqueConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsVectorLayerJoinBuffer::addFeature( const QgsFeature &feature ) const
|
bool QgsVectorLayerJoinBuffer::addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags )
|
||||||
{
|
|
||||||
return addFeatures( QgsFeatureList() << feature );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QgsVectorLayerJoinBuffer::addFeatures( const QgsFeatureList &features ) const
|
|
||||||
{
|
{
|
||||||
if ( !containsJoins() )
|
if ( !containsJoins() )
|
||||||
return false;
|
return false;
|
||||||
@ -598,7 +592,7 @@ bool QgsVectorLayerJoinBuffer::addFeatures( const QgsFeatureList &features ) con
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsVectorLayerJoinBuffer::changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue ) const
|
bool QgsVectorLayerJoinBuffer::changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue )
|
||||||
{
|
{
|
||||||
if ( mLayer->fields().fieldOrigin( field ) != QgsFields::OriginJoin )
|
if ( mLayer->fields().fieldOrigin( field ) != QgsFields::OriginJoin )
|
||||||
return false;
|
return false;
|
||||||
|
@ -31,7 +31,7 @@ typedef QList< QgsVectorLayerJoinInfo > QgsVectorJoinList;
|
|||||||
|
|
||||||
/** \ingroup core
|
/** \ingroup core
|
||||||
* Manages joined fields for a vector layer*/
|
* Manages joined fields for a vector layer*/
|
||||||
class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
|
class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject, public QgsFeatureSink
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -109,21 +109,6 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
|
|||||||
//! \since QGIS 2.6
|
//! \since QGIS 2.6
|
||||||
QgsVectorLayerJoinBuffer *clone() const SIP_FACTORY;
|
QgsVectorLayerJoinBuffer *clone() const SIP_FACTORY;
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a feature in joined layers. The feature given in parameter is the
|
|
||||||
* one added in target layer. If a corresponding joined feature yet exists
|
|
||||||
* in a joined layer, then this feature is just updated. Note that if a
|
|
||||||
* corresponding joined feature has only empty fields, then it's not
|
|
||||||
* created nor added.
|
|
||||||
*
|
|
||||||
* \param feature The feature added in the target layer.
|
|
||||||
*
|
|
||||||
* \returns false if an error happened, true otherwise
|
|
||||||
*
|
|
||||||
* \since QGIS 3.0
|
|
||||||
*/
|
|
||||||
bool addFeature( const QgsFeature &feature ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a list of features in joined layers. Features given in parameter
|
* Adds a list of features in joined layers. Features given in parameter
|
||||||
* are those added in target layer. If a corresponding joined feature yet
|
* are those added in target layer. If a corresponding joined feature yet
|
||||||
@ -132,12 +117,13 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
|
|||||||
* created nor added.
|
* created nor added.
|
||||||
*
|
*
|
||||||
* \param features The list of features added in the target layer
|
* \param features The list of features added in the target layer
|
||||||
|
* \param flags Unused parameter
|
||||||
*
|
*
|
||||||
* \returns false if an error happened, true otherwise
|
* \returns false if an error happened, true otherwise
|
||||||
*
|
*
|
||||||
* \since QGIS 3.0
|
* \since QGIS 3.0
|
||||||
*/
|
*/
|
||||||
bool addFeatures( const QgsFeatureList &features ) const;
|
bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes attribute value in joined layers. The feature id given in
|
* Changes attribute value in joined layers. The feature id given in
|
||||||
@ -154,7 +140,7 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
|
|||||||
*
|
*
|
||||||
* \since QGIS 3.0
|
* \since QGIS 3.0
|
||||||
*/
|
*/
|
||||||
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() ) const;
|
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a feature from joined layers. The feature id given in
|
* Deletes a feature from joined layers. The feature id given in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user