QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
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() );
132 if ( other->id() !=
id() )
139 if ( merge->mFid != mFid )
142 mNewGeom = merge->mNewGeom;
155 it.value().setGeometry( mOldGeom );
189 it.value().setGeometry( mNewGeom );
202 , mFieldIndex( fieldIndex )
203 , mOldValue( oldValue )
204 , mNewValue( newValue )
205 , mFirstChange( true )
212 if ( it.value().attribute( mFieldIndex ).isValid() )
214 mOldValue = it.value().attribute( mFieldIndex );
215 mFirstChange =
false;
221 mFirstChange =
false;
228 QVariant original = mOldValue;
235 it.value().setAttribute( mFieldIndex, mOldValue );
237 else if ( mFirstChange )
244 if ( !mOldValue.isValid() )
272 it.value().setAttribute( mFieldIndex, mNewValue );
323 , mFieldIndex( fieldIndex )
329 mFieldName = fields.
field( mFieldIndex ).
name();
331 if ( !mProviderField )
346 mDeletedValues.insert( f.
id(), f.
attribute( mFieldIndex ) );
353 if ( attrs.contains( mFieldIndex ) )
354 mDeletedValues.insert( it.key(), attrs[mFieldIndex] );
360 if ( mProviderField )
373 if ( !mOldName.isEmpty() )
386 for ( QMap<QgsFeatureId, QVariant>::const_iterator it = mDeletedValues.constBegin(); it != mDeletedValues.constEnd(); ++it )
391 attrs.insert( mFieldIndex, it.value() );
403 if ( mProviderField )
422 , mFieldIndex( fieldIndex )
423 , mOldName( layer()->fields().at( fieldIndex ).name() )
424 , mNewName( newName )
434 if ( mProviderField )
449 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.
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 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
Gets field's origin (value from an enumeration)
QMap< int, QVariant > QgsAttributeMap
void attributeDeleted(int idx)
bool mergeWith(const QUndoCommand *) override
Undo command for modifying the geometry of a feature from a vector layer.
QVariant attribute(const QString &name) const
Lookup attribute value from 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
Gets field at particular index (must be in range 0..N-1)
bool setAttribute(int field, const QVariant &attr)
Set 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
Gets 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 id, geometry and a list of field/values...
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.