1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vector/qgsvectorlayereditbuffer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
class QgsVectorLayerEditBuffer : QObject
{
%Docstring(signature="appended")
Stores queued vector layer edit operations prior to committing changes
to the layer's data provider.
%End
%TypeHeaderCode
#include "qgsvectorlayereditbuffer.h"
%End
public:
QgsVectorLayerEditBuffer( QgsVectorLayer *layer );
virtual bool isModified() const;
%Docstring
Returns ``True`` if the provider has been modified since the last commit
%End
virtual bool addFeature( QgsFeature &f );
%Docstring
Adds a feature
:param f: feature to add
:return: ``True`` in case of success and ``False`` in case of error
%End
virtual bool addFeatures( QgsFeatureList &features );
%Docstring
Insert a copy of the given features into the layer (but does not commit
it)
%End
virtual bool deleteFeature( QgsFeatureId fid );
%Docstring
Delete a feature from the layer (but does not commit it)
%End
virtual bool deleteFeatures( const QgsFeatureIds &fid );
%Docstring
Deletes a set of features from the layer (but does not commit it)
%End
virtual bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
%Docstring
Change feature's geometry
%End
virtual bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
%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
%End
virtual bool addAttribute( const QgsField &field );
%Docstring
Adds an attribute field (but does not commit it) returns ``True`` if the
field was added
%End
virtual bool deleteAttribute( int attr );
%Docstring
Deletes an attribute field (but does not commit it)
%End
virtual bool renameAttribute( int attr, const QString &newName );
%Docstring
Renames an attribute field (but does not commit it)
:param attr: attribute index
:param newName: new name of field
%End
virtual bool commitChanges( QStringList &commitErrors );
%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();
%Docstring
Stop editing and discard the edits
%End
QgsFeatureMap addedFeatures() const;
%Docstring
Returns a map of new features which are not committed.
.. seealso:: :py:func:`isFeatureAdded`
%End
QgsFeatureIds allAddedOrEditedFeatures() const;
%Docstring
Returns a list of the features IDs for all newly added or edited
features in the buffer.
.. versionadded:: 3.20
%End
bool isFeatureAdded( QgsFeatureId id ) const;
%Docstring
Returns ``True`` if the specified feature ID has been added but not
committed.
:param id: feature ID
.. seealso:: :py:func:`addedFeatures`
%End
QgsChangedAttributesMap changedAttributeValues() const;
%Docstring
Returns a map of features with changed attributes values which are not
committed.
.. seealso:: :py:func:`isFeatureAttributesChanged`
%End
bool isFeatureAttributesChanged( QgsFeatureId id ) const;
%Docstring
Returns ``True`` if the specified feature ID has had an attribute
changed but not committed.
:param id: feature ID
.. seealso:: :py:func:`changedAttributeValues`
%End
QgsAttributeList deletedAttributeIds() const;
%Docstring
Returns a list of deleted attributes fields which are not committed. The
list is kept sorted.
.. seealso:: :py:func:`isAttributeDeleted`
%End
bool isAttributeDeleted( int index ) const;
%Docstring
Returns ``True`` if the specified attribute has been deleted but not
committed.
:param index: attribute index
.. seealso:: :py:func:`deletedAttributeIds`
%End
QList<QgsField> addedAttributes() const;
%Docstring
Returns a list of added attributes fields which are not committed.
%End
QgsGeometryMap changedGeometries() const;
%Docstring
Returns a map of features with changed geometries which are not
committed.
.. seealso:: :py:func:`isFeatureGeometryChanged`
%End
bool isFeatureGeometryChanged( QgsFeatureId id ) const;
%Docstring
Returns ``True`` if the specified feature ID has had its geometry
changed but not committed.
:param id: feature ID
.. seealso:: :py:func:`changedGeometries`
%End
QgsFeatureIds deletedFeatureIds() const;
%Docstring
Returns a list of deleted feature IDs which are not committed.
.. seealso:: :py:func:`isFeatureDeleted`
%End
bool isFeatureDeleted( QgsFeatureId id ) const;
%Docstring
Returns ``True`` if the specified feature ID has been deleted but not
committed.
:param id: feature ID
.. seealso:: :py:func:`deletedFeatureIds`
%End
QgsVectorLayerEditBufferGroup *editBufferGroup() const;
%Docstring
Returns the parent edit buffer group for this edit buffer, or None if
not part of a group.
.. versionadded:: 3.26
%End
void setEditBufferGroup( QgsVectorLayerEditBufferGroup *editBufferGroup );
%Docstring
Set the parent edit buffer group for this edit buffer.
.. versionadded:: 3.26
%End
protected slots:
void undoIndexChanged( int index );
signals:
void layerModified();
%Docstring
Emitted when modifications has been done on layer
%End
void featureAdded( QgsFeatureId fid );
%Docstring
Emitted when a feature has been added to the buffer
%End
void featureDeleted( QgsFeatureId fid );
%Docstring
Emitted when a feature was deleted from the buffer
%End
void geometryChanged( QgsFeatureId fid, const QgsGeometry &geom );
%Docstring
Emitted when a feature's geometry is changed.
:param fid: feature ID
:param geom: new feature geometry
%End
void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
%Docstring
Emitted when a feature's attribute value has been changed.
%End
void attributeAdded( int idx );
%Docstring
Emitted when an attribute was added to the buffer.
%End
void attributeDeleted( int idx );
%Docstring
Emitted when an attribute was deleted from the buffer.
%End
void attributeRenamed( int idx, const QString &newName );
%Docstring
Emitted when an attribute has been renamed
:param idx: attribute index
:param newName: new attribute name
%End
void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
%Docstring
Emitted after attribute deletion has been committed to the layer.
%End
void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
%Docstring
Emitted after attribute addition has been committed to the layer.
%End
void committedAttributesRenamed( const QString &layerId, const QgsFieldNameMap &renamedAttributes );
%Docstring
Emitted after committing an attribute rename
:param layerId: ID of layer
:param renamedAttributes: map of field index to new name
%End
void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
%Docstring
Emitted after feature addition has been committed to the layer.
%End
void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
%Docstring
Emitted after feature removal has been committed to the layer.
%End
void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
%Docstring
Emitted after feature attribute value changes have been committed to the
layer.
%End
void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
%Docstring
Emitted after feature geometry changes have been committed to the layer.
%End
protected:
QgsVectorLayerEditBuffer();
void updateFeatureGeometry( QgsFeature &f );
%Docstring
Update feature with uncommitted geometry updates
%End
void updateChangedAttributes( QgsFeature &f );
%Docstring
Update feature with uncommitted attribute updates
%End
void handleAttributeAdded( int index, const QgsField &field );
%Docstring
Update added and changed features after addition of an attribute
%End
void handleAttributeDeleted( int index );
%Docstring
Update added and changed features after removal of an attribute
%End
void updateAttributeMapIndex( QgsAttributeMap &attrs, int index, int offset ) const;
%Docstring
Updates an index in an attribute map to a new value (for updates of
changed attributes)
%End
void updateLayerFields();
protected:
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vector/qgsvectorlayereditbuffer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|