2017-05-22 09:01:45 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsvectorlayereditbuffer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
|
2012-12-17 21:22:42 +01:00
|
|
|
|
|
|
|
class QgsVectorLayerEditBuffer : QObject
|
|
|
|
{
|
2017-05-22 09:01:45 +02:00
|
|
|
|
2012-12-17 21:22:42 +01:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorlayereditbuffer.h"
|
|
|
|
%End
|
2013-01-28 01:39:58 +01:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsVectorLayerEditBuffer( QgsVectorLayer *layer );
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2015-11-30 21:18:49 +01:00
|
|
|
virtual bool isModified() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Returns true if the provider has been modified since the last commit
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool addFeature( QgsFeature &f );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Adds a feature
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param f: feature to add
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
:return: True in case of success and False in case of error
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool addFeatures( QgsFeatureList &features );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Insert a copy of the given features into the layer (but does not commit it)
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2015-11-30 21:18:49 +01:00
|
|
|
virtual bool deleteFeature( QgsFeatureId fid );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Delete a feature from the layer (but does not commit it)
|
|
|
|
%End
|
2015-11-30 21:18:49 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool deleteFeatures( const QgsFeatureIds &fid );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Deletes a set of features from the layer (but does not commit it)
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Change feature's geometry
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2015-11-30 21:18:49 +01:00
|
|
|
virtual bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Changed an attribute value (but does not commit it)
|
2018-01-23 13:07:35 +00:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues );
|
|
|
|
%Docstring
|
|
|
|
Changes values of attributes (but does not commit it).
|
|
|
|
|
|
|
|
:return: true if attributes are well updated, false otherwise
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2015-11-30 21:18:49 +01:00
|
|
|
virtual bool addAttribute( const QgsField &field );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Add an attribute field (but does not commit it)
|
2017-05-22 09:01:45 +02:00
|
|
|
returns true if the field was added *
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2015-11-30 21:18:49 +01:00
|
|
|
virtual bool deleteAttribute( int attr );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Delete an attribute field (but does not commit it)
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool renameAttribute( int attr, const QString &newName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Renames an attribute field (but does not commit it)
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param attr: attribute index
|
|
|
|
:param newName: new name of field
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool commitChanges( QStringList &commitErrors );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Attempts to commit any changes to disk. Returns the result of the attempt.
|
|
|
|
If a commit fails, the in-memory changes are left alone.
|
|
|
|
|
|
|
|
This allows editing to continue if the commit failed on e.g. a
|
|
|
|
disallowed value in a Postgres database - the user can re-edit and try
|
|
|
|
again.
|
|
|
|
|
|
|
|
The commits occur in distinct stages,
|
|
|
|
(add attributes, add features, change attribute values, change
|
|
|
|
geometries, delete features, delete attributes)
|
|
|
|
so if a stage fails, it's difficult to roll back cleanly.
|
|
|
|
Therefore any error message also includes which stage failed so
|
|
|
|
that the user has some chance of repairing the damage cleanly.
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2015-11-30 21:18:49 +01:00
|
|
|
virtual void rollBack();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Stop editing and discard the edits
|
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-11 10:37:45 +10:00
|
|
|
QgsFeatureMap addedFeatures() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a map of new features which are not committed.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isFeatureAdded`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-15 07:58:21 +10:00
|
|
|
bool isFeatureAdded( QgsFeatureId id ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the specified feature ID has been added but not committed.
|
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
:param id: feature ID
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`addedFeatures`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-07-11 10:37:45 +10:00
|
|
|
|
|
|
|
QgsChangedAttributesMap changedAttributeValues() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a map of features with changed attributes values which are not committed.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isFeatureAttributesChanged`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-15 07:58:21 +10:00
|
|
|
bool isFeatureAttributesChanged( QgsFeatureId id ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the specified feature ID has had an attribute changed but not committed.
|
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
:param id: feature ID
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`changedAttributeValues`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-11 10:37:45 +10:00
|
|
|
QgsAttributeList deletedAttributeIds() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of deleted attributes fields which are not committed. The list is kept sorted.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isAttributeDeleted`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-15 07:58:21 +10:00
|
|
|
bool isAttributeDeleted( int index ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the specified attribute has been deleted but not committed.
|
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
:param index: attribute index
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`deletedAttributeIds`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-07-15 07:58:21 +10:00
|
|
|
|
2016-07-11 10:37:45 +10:00
|
|
|
QList<QgsField> addedAttributes() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of added attributes fields which are not committed.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-11 10:37:45 +10:00
|
|
|
QgsGeometryMap changedGeometries() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a map of features with changed geometries which are not committed.
|
|
|
|
|
2018-05-25 09:00:58 +10:00
|
|
|
.. seealso:: :py:func:`isFeatureGeometryChanged`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-07-11 10:37:45 +10:00
|
|
|
|
2016-07-15 07:58:21 +10:00
|
|
|
bool isFeatureGeometryChanged( QgsFeatureId id ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the specified feature ID has had its geometry changed but not committed.
|
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
:param id: feature ID
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`changedGeometries`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-11 10:37:45 +10:00
|
|
|
QgsFeatureIds deletedFeatureIds() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of deleted feature IDs which are not committed.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`isFeatureDeleted`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2016-07-15 07:58:21 +10:00
|
|
|
bool isFeatureDeleted( QgsFeatureId id ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the specified feature ID has been deleted but not committed.
|
|
|
|
|
2017-12-15 21:36:08 -04:00
|
|
|
:param id: feature ID
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`deletedFeatureIds`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-07-15 07:58:21 +10:00
|
|
|
|
|
|
|
|
2013-01-28 01:39:58 +01:00
|
|
|
protected slots:
|
|
|
|
void undoIndexChanged( int index );
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void layerModified();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
This signal is emitted when modifications has been done on layer
|
|
|
|
%End
|
2013-01-28 01:39:58 +01:00
|
|
|
|
|
|
|
void featureAdded( QgsFeatureId fid );
|
|
|
|
void featureDeleted( QgsFeatureId fid );
|
2016-08-02 07:26:11 +10:00
|
|
|
|
2016-07-31 21:23:07 +10:00
|
|
|
void geometryChanged( QgsFeatureId fid, const QgsGeometry &geom );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when a feature's geometry is changed.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param fid: feature ID
|
|
|
|
:param geom: new feature geometry
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-08-02 07:26:11 +10:00
|
|
|
|
2013-01-28 01:39:58 +01:00
|
|
|
void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
|
|
|
|
void attributeAdded( int idx );
|
|
|
|
void attributeDeleted( int idx );
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void attributeRenamed( int idx, const QString &newName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted when an attribute has been renamed
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param idx: attribute index
|
|
|
|
:param newName: new attribute name
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-05-31 10:05:54 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Signals emitted after committing changes
|
|
|
|
%End
|
2017-05-01 16:42:33 +02:00
|
|
|
void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
|
2016-05-31 10:05:54 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void committedAttributesRenamed( const QString &layerId, const QgsFieldNameMap &renamedAttributes );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Emitted after committing an attribute rename
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param layerId: ID of layer
|
|
|
|
:param renamedAttributes: map of field index to new name
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
|
2017-05-01 16:42:33 +02:00
|
|
|
void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
|
|
|
|
void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
|
|
|
|
void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
|
2012-12-17 21:22:42 +01:00
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
protected:
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
QgsVectorLayerEditBuffer();
|
2017-11-11 15:22:19 +10:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsVectorLayerEditBuffer
|
|
|
|
%End
|
2017-05-22 09:01:45 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void updateFields( QgsFields &fields );
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
void updateFeatureGeometry( QgsFeature &f );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Update feature with uncommitted geometry updates
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
void updateChangedAttributes( QgsFeature &f );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Update feature with uncommitted attribute updates
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
void handleAttributeAdded( int index );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Update added and changed features after addition of an attribute
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
void handleAttributeDeleted( int index );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Update added and changed features after removal of an attribute
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void updateAttributeMapIndex( QgsAttributeMap &attrs, int index, int offset ) const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Updates an index in an attribute map to a new value (for updates of changed attributes)
|
|
|
|
%End
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
void updateLayerFields();
|
2017-05-22 09:01:45 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-15 14:55:43 +02:00
|
|
|
|
2012-12-17 21:22:42 +01:00
|
|
|
};
|
2017-05-22 09:01:45 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsvectorlayereditbuffer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|