Class: QgsVectorLayerEditBuffer¶
-
class
qgis.core.
QgsVectorLayerEditBuffer
(layer: QgsVectorLayer)¶ Bases:
PyQt5.QtCore.QObject
QgsVectorLayerEditBuffer() Constructor for QgsVectorLayerEditBuffer
Enums
Methods
Add an attribute field (but does not commit it) returns true if the field was added *
Adds a feature
Insert a copy of the given features into the layer (but does not commit it)
Returns a list of added attributes fields which are not committed.
Returns a map of new features which are not committed.
Changed an attribute value (but does not commit it)
Changes values of attributes (but does not commit it).
Change feature’s geometry
Returns a map of features with changed attributes values which are not committed.
Returns a map of features with changed geometries which are not committed.
Attempts to commit any changes to disk.
Delete an attribute field (but does not commit it)
Delete a feature from the layer (but does not commit it)
Deletes a set of features from the layer (but does not commit it)
Returns a list of deleted attributes fields which are not committed.
Returns a list of deleted feature IDs which are not committed.
Update added and changed features after addition of an attribute
Update added and changed features after removal of an attribute
Returns true if the specified attribute has been deleted but not committed.
Returns true if the specified feature ID has been added but not committed.
Returns true if the specified feature ID has had an attribute changed but not committed.
Returns true if the specified feature ID has been deleted but not committed.
Returns true if the specified feature ID has had its geometry changed but not committed.
Returns true if the provider has been modified since the last commit
Renames an attribute field (but does not commit it)
Stop editing and discard the edits
Updates an index in an attribute map to a new value (for updates of changed attributes)
Update feature with uncommitted attribute updates
Update feature with uncommitted geometry updates
Signals
attributeAdded(self, int) [signal]
attributeDeleted(self, int) [signal]
Emitted when an attribute has been renamed
attributeValueChanged(self, int, int, Any) [signal]
committedAttributeValuesChanges(self, str, object) [signal]
committedAttributesAdded(self, str, object) [signal]
Signals emitted after committing changes [signal]
Emitted after committing an attribute rename
committedFeaturesAdded(self, str, object) [signal]
committedFeaturesRemoved(self, str, object) [signal]
committedGeometriesChanges(self, str, object) [signal]
featureAdded(self, int) [signal]
featureDeleted(self, int) [signal]
Emitted when a feature’s geometry is changed.
This signal is emitted when modifications has been done on layer [signal]
Attributes
-
addAttribute
(self, field: QgsField) → bool¶ Add an attribute field (but does not commit it) returns true if the field was added *
-
addFeature
(self, f: QgsFeature) → bool¶ Adds a feature
- Parameters
f – feature to add
- Returns
True in case of success and False in case of error
-
addFeatures
(self, features: object) → bool¶ Insert a copy of the given features into the layer (but does not commit it)
-
addedAttributes
(self) → object¶ Returns a list of added attributes fields which are not committed.
-
addedFeatures
(self) → object¶ Returns a map of new features which are not committed.
See also
-
attributeAdded
¶ attributeAdded(self, int) [signal]
-
attributeDeleted
¶ attributeDeleted(self, int) [signal]
-
attributeRenamed
¶ Emitted when an attribute has been renamed
- Parameters
idx – attribute index
newName – new attribute name
New in version 2.16: [signal]
-
attributeValueChanged
¶ attributeValueChanged(self, int, int, Any) [signal]
-
changeAttributeValue
(self, fid: int, field: int, newValue: Any, oldValue: Any = None) → bool¶ Changed an attribute value (but does not commit it)
-
changeAttributeValues
(self, fid: int, newValues: Dict[int, Any], oldValues: Dict[int, Any]) → bool¶ Changes values of attributes (but does not commit it).
- Returns
true if attributes are well updated, false otherwise
New in version 3.0.
-
changeGeometry
(self, fid: int, geom: QgsGeometry) → bool¶ Change feature’s geometry
-
changedAttributeValues
(self) → object¶ Returns a map of features with changed attributes values which are not committed.
See also
-
changedGeometries
(self) → object¶ Returns a map of features with changed geometries which are not committed.
See also
-
childEvent
()¶
-
commitChanges
(self, commitErrors: Iterable[str]) → bool¶ 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.
-
committedAttributeValuesChanges
¶ committedAttributeValuesChanges(self, str, object) [signal]
-
committedAttributesAdded
¶ committedAttributesAdded(self, str, object) [signal]
-
committedAttributesDeleted
¶ Signals emitted after committing changes [signal]
-
committedAttributesRenamed
¶ Emitted after committing an attribute rename
- Parameters
layerId – ID of layer
renamedAttributes – map of field index to new name
New in version 2.16: [signal]
-
committedFeaturesAdded
¶ committedFeaturesAdded(self, str, object) [signal]
-
committedFeaturesRemoved
¶ committedFeaturesRemoved(self, str, object) [signal]
-
committedGeometriesChanges
¶ committedGeometriesChanges(self, str, object) [signal]
-
connectNotify
()¶
-
customEvent
()¶
-
deleteAttribute
(self, attr: int) → bool¶ Delete an attribute field (but does not commit it)
-
deleteFeature
(self, fid: int) → bool¶ Delete a feature from the layer (but does not commit it)
-
deleteFeatures
(self, fid: object) → bool¶ Deletes a set of features from the layer (but does not commit it)
-
deletedAttributeIds
(self) → List[int]¶ Returns a list of deleted attributes fields which are not committed. The list is kept sorted.
See also
-
deletedFeatureIds
(self) → object¶ Returns a list of deleted feature IDs which are not committed.
See also
-
disconnectNotify
()¶
-
featureAdded
¶ featureAdded(self, int) [signal]
-
featureDeleted
¶ featureDeleted(self, int) [signal]
-
geometryChanged
¶ Emitted when a feature’s geometry is changed.
- Parameters
fid – feature ID
geom – new feature geometry [signal]
-
handleAttributeAdded
(self, index: int)¶ Update added and changed features after addition of an attribute
-
handleAttributeDeleted
(self, index: int)¶ Update added and changed features after removal of an attribute
-
isAttributeDeleted
(self, index: int) → bool¶ Returns true if the specified attribute has been deleted but not committed.
- Parameters
index – attribute index
See also
New in version 3.0.
-
isFeatureAdded
(self, id: int) → bool¶ Returns true if the specified feature ID has been added but not committed.
- Parameters
id – feature ID
See also
New in version 3.0.
-
isFeatureAttributesChanged
(self, id: int) → bool¶ Returns true if the specified feature ID has had an attribute changed but not committed.
- Parameters
id – feature ID
See also
New in version 3.0.
-
isFeatureDeleted
(self, id: int) → bool¶ Returns true if the specified feature ID has been deleted but not committed.
- Parameters
id – feature ID
See also
New in version 3.0.
-
isFeatureGeometryChanged
(self, id: int) → bool¶ Returns true if the specified feature ID has had its geometry changed but not committed.
- Parameters
id – feature ID
See also
New in version 3.0.
-
isModified
(self) → bool¶ Returns true if the provider has been modified since the last commit
-
isSignalConnected
()¶
-
layerModified
¶ This signal is emitted when modifications has been done on layer [signal]
-
receivers
()¶
-
renameAttribute
(self, attr: int, newName: str) → bool¶ Renames an attribute field (but does not commit it)
- Parameters
attr – attribute index
newName – new name of field
New in version 2.16.
-
rollBack
(self)¶ Stop editing and discard the edits
-
sender
()¶
-
senderSignalIndex
()¶
-
timerEvent
()¶
-
undoIndexChanged
(self, index: int)¶
-
updateAttributeMapIndex
(self, attrs: Dict[int, Any], index: int, offset: int)¶ Updates an index in an attribute map to a new value (for updates of changed attributes)
-
updateChangedAttributes
(self, f: QgsFeature)¶ Update feature with uncommitted attribute updates
-
updateFeatureGeometry
(self, f: QgsFeature)¶ Update feature with uncommitted geometry updates
-
updateFields
(self, fields: QgsFields)¶
-
updateLayerFields
(self)¶
-