QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
30 static int sAddedIdLowWaterMark = -1;
33 sAddedIdLowWaterMark--;
35 QgsDebugMsgLevel(
"Assigned feature id " + QString::number( sAddedIdLowWaterMark ), 4 );
40 f.
setId( sAddedIdLowWaterMark );
74 mOldAddedFeature = it.value();
111 , mNewGeom( newGeom )
117 mOldGeom = ( it.value().geometry() );
129 if ( other->id() !=
id() )
136 if ( merge->mFid != mFid )
139 mNewGeom = merge->mNewGeom;
152 it.value().setGeometry( mOldGeom );
186 it.value().setGeometry( mNewGeom );
199 , mFieldIndex( fieldIndex )
200 , mOldValue( oldValue )
201 , mNewValue( newValue )
202 , mFirstChange( true )
210 if ( it.value().attribute( mFieldIndex ).isValid() )
212 mOldValue = it.value().attribute( mFieldIndex );
213 mFirstChange =
false;
227 if ( it->contains( mFieldIndex ) )
230 mFirstChange =
false;
243 QVariant original = mOldValue;
257 it.value().setAttribute( mFieldIndex, mOldValue );
260 else if ( mFirstChange )
267 if ( !mOldValue.isValid() )
295 it.value().setAttribute( mFieldIndex, mNewValue );
346 , mFieldIndex( fieldIndex )
352 mFieldName = fields.
field( mFieldIndex ).
name();
354 if ( !mProviderField )
369 mDeletedValues.insert( f.
id(), f.
attribute( mFieldIndex ) );
376 if ( attrs.contains( mFieldIndex ) )
377 mDeletedValues.insert( it.key(), attrs[mFieldIndex] );
383 if ( mProviderField )
396 if ( !mOldName.isEmpty() )
409 for ( QMap<QgsFeatureId, QVariant>::const_iterator it = mDeletedValues.constBegin(); it != mDeletedValues.constEnd(); ++it )
414 attrs.insert( mFieldIndex, it.value() );
426 if ( mProviderField )
445 , mFieldIndex( fieldIndex )
446 , mOldName( layer()->fields().at( fieldIndex ).name() )
447 , mNewName( newName )
457 if ( mProviderField )
472 if ( mProviderField )
@ OriginProvider
Field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
QgsVectorLayerUndoCommandChangeGeometry(QgsVectorLayerEditBuffer *buffer, QgsFeatureId fid, const QgsGeometry &newGeom)
Constructor for QgsVectorLayerUndoCommandChangeGeometry.
QList< QgsField > mAddedAttributes
Added attributes fields which are not committed.
QgsVectorLayerEditBuffer * mBuffer
Associated edit buffer.
QgsVectorLayerUndoCommandChangeAttribute(QgsVectorLayerEditBuffer *buffer, QgsFeatureId fid, int fieldIndex, const QVariant &newValue, const QVariant &oldValue)
Constructor for QgsVectorLayerUndoCommandChangeAttribute.
void setId(QgsFeatureId id)
Sets the feature id for this feature.
QgsFeatureIds mDeletedFeatureIds
Deleted feature IDs which are not committed.
#define QgsDebugMsgLevel(str, level)
int count() const
Returns number of items.
Container of fields for a vector layer.
QgsAttributeList mDeletedAttributeIds
Deleted attributes fields which are not committed. The list is kept sorted.
bool mergeWith(const QUndoCommand *other) override
QgsVectorLayerUndoCommandAddFeature(QgsVectorLayerEditBuffer *buffer, QgsFeature &f)
Constructor for QgsVectorLayerUndoCommandAddFeature.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QList< int > QgsAttributeList
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &)
void geometryChanged(QgsFeatureId fid, const QgsGeometry &geom)
Emitted when a feature's geometry is changed.
QgsVectorLayerUndoCommandRenameAttribute(QgsVectorLayerEditBuffer *buffer, int fieldIndex, const QString &newName)
Constructor for QgsVectorLayerUndoCommandRenameAttribute.
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Sets the feature ID that should be fetched.
QgsVectorLayer * layer()
Returns the layer associated with the undo command.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureMap mAddedFeatures
New features which are not committed.
void featureDeleted(QgsFeatureId fid)
void featureAdded(QgsFeatureId fid)
QgsVectorLayerUndoCommandDeleteFeature(QgsVectorLayerEditBuffer *buffer, QgsFeatureId fid)
Constructor for QgsVectorLayerUndoCommandDeleteFeature.
FieldOrigin fieldOrigin(int fieldIdx) const
Returns the field's origin (value from an enumeration).
QMap< int, QVariant > QgsAttributeMap
void attributeDeleted(int idx)
Undo command for modifying the geometry of a feature from a vector layer.
QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
void attributeRenamed(int idx, const QString &newName)
Emitted when an attribute has been renamed.
void attributeAdded(int idx)
QgsField field(int fieldIdx) const
Returns the field at particular index (must be in range 0..N-1).
bool setAttribute(int field, const QVariant &attr)
Sets an attribute's value by field index.
Base class for undo commands within a QgsVectorLayerEditBuffer.
QgsFieldNameMap mRenamedAttributes
Renamed attributes which are not committed.
void handleAttributeDeleted(int index)
Update added and changed features after removal of an attribute.
QgsVectorLayerUndoCommandDeleteAttribute(QgsVectorLayerEditBuffer *buffer, int fieldIndex)
Constructor for QgsVectorLayerUndoCommandDeleteAttribute.
bool nextFeature(QgsFeature &f)
A geometry is the spatial representation of a feature.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
QgsEditFormConfig editFormConfig
int fieldOriginIndex(int fieldIdx) const
Returns the field's origin index (its meaning is specific to each type of origin).
void setEditFormConfig(const QgsEditFormConfig &editFormConfig)
Sets the editFormConfig (configuration) of the form used to represent this vector layer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
QgsGeometryMap mChangedGeometries
Changed geometries which are not committed.
Wrapper for iterator of features from vector data provider or vector layer.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
void handleAttributeAdded(int index)
Update added and changed features after addition of an attribute.
@ OriginJoin
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
QgsVectorLayerUndoCommandAddAttribute(QgsVectorLayerEditBuffer *buffer, const QgsField &field)
Constructor for QgsVectorLayerUndoCommandAddAttribute.
QgsChangedAttributesMap mChangedAttributeValues
Changed attributes values which are not committed.
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Encapsulate a field in an attribute table or data source.