15#ifndef QGSVECTORLAYEREDITBUFFER_H
16#define QGSVECTORLAYEREDITBUFFER_H
45 virtual bool isModified()
const;
67 virtual bool changeAttributeValue(
QgsFeatureId fid,
int field,
const QVariant &newValue,
const QVariant &oldValue = QVariant() );
79 virtual bool addAttribute(
const QgsField &field );
82 virtual bool deleteAttribute(
int attr );
89 virtual bool renameAttribute(
int attr,
const QString &newName );
106 virtual bool commitChanges( QStringList &commitErrors );
109 virtual void rollBack();
211 void undoIndexChanged(
int index );
297 void updateChangedAttributes(
QgsFeature &f );
300 void handleAttributeAdded(
int index );
303 void handleAttributeDeleted(
int index );
306 void updateAttributeMapIndex(
QgsAttributeMap &attrs,
int index,
int offset )
const;
308 void updateLayerFields();
360 int mBlockModifiedSignals = 0;
362 friend class QgsGrassProvider;
373 bool commitChangesCheckGeometryTypeCompatibility( QStringList &commitErrors );
381 bool commitChangesDeleteAttributes(
bool &attributesDeleted, QStringList &commitErrors );
389 bool commitChangesRenameAttributes(
bool &attributesRenamed, QStringList &commitErrors );
397 bool commitChangesAddAttributes(
bool &attributesAdded, QStringList &commitErrors );
405 bool commitChangesCheckAttributesModifications(
const QgsFields oldFields, QStringList &commitErrors );
413 bool commitChangesChangeAttributes(
bool &attributesChanged, QStringList &commitErrors );
421 bool commitChangesDeleteFeatures(
bool &featuresDeleted, QStringList &commitErrors );
429 bool commitChangesAddFeatures(
bool &featuresAdded, QStringList &commitErrors );
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
The edit buffer group manages a group of edit buffers.
Stores queued vector layer edit operations prior to committing changes to the layer's data provider.
void attributeRenamed(int idx, const QString &newName)
Emitted when an attribute has been renamed.
void committedAttributesDeleted(const QString &layerId, const QgsAttributeList &deletedAttributes)
Emitted after attribute deletion has been committed to the layer.
bool isFeatureDeleted(QgsFeatureId id) const
Returns true if the specified feature ID has been deleted but not committed.
QgsFeatureMap mAddedFeatures
New features which are not committed.
QgsFeatureIds deletedFeatureIds() const
Returns a list of deleted feature IDs which are not committed.
QgsChangedAttributesMap changedAttributeValues() const
Returns a map of features with changed attributes values which are not committed.
void committedAttributeValuesChanges(const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues)
Emitted after feature attribute value changes have been committed to the layer.
void geometryChanged(QgsFeatureId fid, const QgsGeometry &geom)
Emitted when a feature's geometry is changed.
bool isFeatureAdded(QgsFeatureId id) const
Returns true if the specified feature ID has been added but not committed.
void committedAttributesAdded(const QString &layerId, const QList< QgsField > &addedAttributes)
Emitted after attribute addition has been committed to the layer.
QgsVectorLayerEditBuffer()=default
QgsFieldNameMap mRenamedAttributes
Renamed attributes which are not committed.
QgsGeometryMap mChangedGeometries
Changed geometries which are not committed.
void committedAttributesRenamed(const QString &layerId, const QgsFieldNameMap &renamedAttributes)
Emitted after committing an attribute rename.
QgsAttributeList mDeletedAttributeIds
Deleted attributes fields which are not committed. The list is kept sorted.
QgsFeatureMap addedFeatures() const
Returns a map of new features which are not committed.
QgsFeatureIds mDeletedFeatureIds
Deleted feature IDs which are not committed.
bool isAttributeDeleted(int index) const
Returns true if the specified attribute has been deleted but not committed.
void committedFeaturesAdded(const QString &layerId, const QgsFeatureList &addedFeatures)
Emitted after feature addition has been committed to the layer.
void featureDeleted(QgsFeatureId fid)
Emitted when a feature was deleted from the buffer.
QgsGeometryMap changedGeometries() const
Returns a map of features with changed geometries which are not committed.
QList< QgsField > addedAttributes() const
Returns a list of added attributes fields which are not committed.
bool isFeatureAttributesChanged(QgsFeatureId id) const
Returns true if the specified feature ID has had an attribute changed but not committed.
bool isFeatureGeometryChanged(QgsFeatureId id) const
Returns true if the specified feature ID has had its geometry changed but not committed.
QgsAttributeList deletedAttributeIds() const
Returns a list of deleted attributes fields which are not committed.
void attributeAdded(int idx)
Emitted when an attribute was added to the buffer.
void committedGeometriesChanges(const QString &layerId, const QgsGeometryMap &changedGeometries)
Emitted after feature geometry changes have been committed to the layer.
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &value)
Emitted when a feature's attribute value has been changed.
void attributeDeleted(int idx)
Emitted when an attribute was deleted from the buffer.
void featureAdded(QgsFeatureId fid)
Emitted when a feature has been added to the buffer.
QgsChangedAttributesMap mChangedAttributeValues
Changed attributes values which are not committed.
QList< QgsField > mAddedAttributes
Added attributes fields which are not committed.
void layerModified()
Emitted when modifications has been done on layer.
void committedFeaturesRemoved(const QString &layerId, const QgsFeatureIds &deletedFeatureIds)
Emitted after feature removal has been committed to the layer.
Undo command for adding a new attribute to a vector layer.
Undo command for adding a feature to a vector layer.
Undo command for modifying an attribute of a feature from a vector layer.
Undo command for modifying the geometry of a feature from a vector layer.
Undo command for removing an existing attribute from a vector layer.
Undo command for deleting a feature from a vector layer.
Undo command for renaming an existing attribute of a vector layer.
Base class for undo commands within a QgsVectorLayerEditBuffer.
Undo command for adding attri to a vector layer in transaction group.
Undo command for adding a feature to a vector layer in transaction group mode.
Undo command for changing attr value from a vector layer in transaction group.
Undo command for changing attributes' values from a vector layer in transaction group.
Undo command for changing feature geometry from a vector layer in transaction group.
Undo command for deleting attri of a vector layer in transaction group.
Undo command for deleting features from a vector layer in transaction group.
Undo command for deleting attri of a vector layer in transaction group.
Undo command for running a specific sql query in transaction group.
Undo command for vector layer in transaction group mode.
Represents a vector layer which manages a vector based data sets.
QMap< int, QString > QgsFieldNameMap
QMap< int, QVariant > QgsAttributeMap
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList
QSet< int > QgsAttributeIds
QList< int > QgsAttributeList
QMap< QgsFeatureId, QgsFeature > QgsFeatureMap