QGIS/python/core/auto_generated/qgsvectorlayereditbuffer.sip.in

321 lines
8.6 KiB
Plaintext
Raw Normal View History

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 *
************************************************************************/
2017-05-22 09:01:45 +02:00
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
class QgsVectorLayerEditBuffer : QObject
{
2017-05-22 09:01:45 +02:00
%TypeHeaderCode
#include "qgsvectorlayereditbuffer.h"
%End
public:
QgsVectorLayerEditBuffer( QgsVectorLayer *layer );
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
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
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
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
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
virtual bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
2017-05-22 09:01:45 +02:00
%Docstring
Change feature's geometry
%End
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)
%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
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
virtual bool deleteAttribute( int attr );
2017-05-22 09:01:45 +02:00
%Docstring
Delete an attribute field (but does not commit it)
%End
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
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
virtual void rollBack();
2017-05-22 09:01:45 +02:00
%Docstring
Stop editing and discard the edits
%End
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.
.. seealso:: :py:func:`isFeatureAdded`
2017-05-22 09:01:45 +02:00
%End
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
.. seealso:: :py:func:`addedFeatures`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-22 09:01:45 +02:00
%End
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.
.. seealso:: :py:func:`isFeatureAttributesChanged`
2017-05-22 09:01:45 +02:00
%End
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
.. seealso:: :py:func:`changedAttributeValues`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-22 09:01:45 +02:00
%End
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.
.. seealso:: :py:func:`isAttributeDeleted`
2017-05-22 09:01:45 +02:00
%End
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
.. seealso:: :py:func:`deletedAttributeIds`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-22 09:01:45 +02:00
%End
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
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
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
.. seealso:: :py:func:`changedGeometries`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-22 09:01:45 +02:00
%End
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.
.. seealso:: :py:func:`isFeatureDeleted`
2017-05-22 09:01:45 +02:00
%End
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
.. seealso:: :py:func:`deletedFeatureIds`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-05-22 09:01:45 +02:00
%End
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
void featureAdded( QgsFeatureId fid );
void featureDeleted( QgsFeatureId fid );
2016-08-02 07:26:11 +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
void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
void attributeAdded( int idx );
void attributeDeleted( int idx );
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
void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
2017-05-22 09:01:45 +02:00
%Docstring
Signals emitted after committing changes
%End
void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
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 );
void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
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
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
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:
[FEATURE] Add undo and redo on transaction groups (#4765) * [FEATURE] adds undo/redo for transaction groups [needs-docs] the undo/redo now works with transcation groups. Just check that there is no restriction in the transaction groups doc concerning undo. related to #14799 The undo/redo is implemented using SAVEPOINT. The QgsTransaction interface has been enlarged to allow savepoints creation and management. The savepoint is destroyed on rollbackToSavepoint to have the same behavior has the sql ROLLBACK TO SAVEPPOINT. To avoid the creation of a savepoint for each feature modified in bulk editing (e.g. paste, field calculator) the logic is a bit complicated: the savepoint is created on QgsVectorLayer::editCommandStarted and the first actual undo command (QgsVectorLayerUndoPassthroughCommand) is responsible for the re-creation of the savepoint in case of undo-redo. Since the behavior must be different in case edition doesn't take place inside an edit command, a member function has been added to QgsVectorLayer to expose the mEditCommandActive state. Another (commented) tricky bit is the modification of the database structure on add/delete attributes. On undo, the attribute is removed before the rollback to savepoint, i.e. there is a useless ALTER TABLE issued to restore the structure just before restoring it with the ROLLBACK TO SAVEPOINT. This is necessary to make the provider aware of the change of structure. It could be nicer/cleaner to have a way to reload providers metadata. The editPaste function has also been modified to use addFeatures instead of addFeature (plural/singular), this is at the expense of an additional "cpy" of the clipboard in memory, but it should improve perf with postgis provider. * fixup operator aliases
2017-09-15 14:55:43 +02: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 *
************************************************************************/