16 #include <QRegularExpression> 46 std::unique_ptr<QgsExpression> expression;
56 if ( expression->hasParserError() || !expression->prepare( &context ) )
65 lst.insert( fieldOrExpression );
67 lst = expression->referencedColumns();
70 .
setFlags( ( expression && expression->needsGeometry() ) ?
88 QList<QVariant> values;
92 std::unique_ptr<QgsExpression> expression;
109 QVariant v = expression->evaluate( &context );
128 QList<double> values;
133 QList<QVariant> variantValues =
getValues( layer, fieldOrExpression, ok, selectedOnly, feedback );
138 const auto constVariantValues = variantValues;
139 for (
const QVariant &value : constVariantValues )
141 double val = value.toDouble( &convertOk );
144 else if ( value.isNull() )
165 if ( fieldIndex < 0 || fieldIndex >= fields.
count() )
168 QString fieldName = fields.
at( fieldIndex ).
name();
176 int limit = ignoreIds.size() + 1;
186 if ( ignoreIds.contains( feat.
id() ) )
202 if ( fieldIndex < 0 || fieldIndex >= fields.
count() )
210 QVariant newVar( maxVal.toLongLong() + 1 );
218 switch ( field.
type() )
220 case QVariant::String:
223 if ( seed.isValid() )
224 base = seed.toString();
226 if ( !base.isEmpty() )
229 QRegularExpression rx( QStringLiteral(
"(.*)_\\d+" ) );
230 QRegularExpressionMatch match = rx.match( base );
231 if ( match.hasMatch() )
233 base = match.captured( 1 );
245 base = f.
attribute( fieldIndex ).toString();
252 if ( !base.isEmpty() && !vals.contains( base ) )
255 for (
int i = 1; i < 10000; ++i )
257 QString testVal = base +
'_' + QString::number( i );
258 if ( !vals.contains( testVal ) )
282 if ( fieldIndex < 0 || fieldIndex >= fields.
count() )
289 QVariant maxVal = existingValues.isEmpty() ? 0 : *std::max_element( existingValues.begin(), existingValues.end() );
290 QVariant newVar( maxVal.toLongLong() + 1 );
298 switch ( field.
type() )
300 case QVariant::String:
303 if ( seed.isValid() )
304 base = seed.toString();
306 if ( !base.isEmpty() )
309 QRegularExpression rx( QStringLiteral(
"(.*)_\\d+" ) );
310 QRegularExpressionMatch match = rx.match( base );
311 if ( match.hasMatch() )
313 base = match.captured( 1 );
320 base = existingValues.isEmpty() ? QString() : existingValues.values().first().toString();
325 for (
const auto &v : qgis::as_const( existingValues ) )
327 if ( v.toString().startsWith( base ) )
328 vals.push_back( v.toString() );
332 if ( !base.isEmpty() && !vals.contains( base ) )
335 for (
int i = 1; i < 10000; ++i )
337 QString testVal = base +
'_' + QString::number( i );
338 if ( !vals.contains( testVal ) )
362 if ( attributeIndex < 0 || attributeIndex >= layer->
fields().
count() )
367 QVariant value = feature.
attribute( attributeIndex );
382 valid = expr.
evaluate( &context ).toBool();
384 if ( expr.hasParserError() )
386 errors << QObject::tr(
"parser error: %1" ).arg( expr.parserErrorString() );
388 else if ( expr.hasEvalError() )
390 errors << QObject::tr(
"evaluation error: %1" ).arg( expr.evalErrorString() );
412 valid = valid && !value.isNull();
414 if ( value.isNull() )
416 errors << QObject::tr(
"value is NULL" );
436 valid = valid && !alreadyExists;
440 errors << QObject::tr(
"value is not unique" );
452 return features.isEmpty() ?
QgsFeature() : features.first();
461 result.reserve( featuresData.length() );
464 std::unique_ptr< QgsExpressionContext > tempContext;
469 evalContext = tempContext.get();
475 QMap<int, QSet<QVariant>> uniqueValueCaches;
477 for (
const auto &fd : qgis::as_const( featuresData ) )
486 for (
int idx = 0; idx < fields.
count(); ++idx )
489 bool checkUnique =
true;
494 if ( fd.attributes().contains( idx ) )
496 v = fd.attributes().value( idx );
500 if ( hasUniqueConstraint && ! uniqueValueCaches.contains( idx ) )
505 std::unique_ptr<QgsVectorLayer> unfilteredClone { layer->
clone( ) };
507 uniqueValueCaches[ idx ] = unfilteredClone->uniqueValues( idx );
518 if ( ( v.isNull() || ( hasUniqueConstraint
519 && uniqueValueCaches[ idx ].contains( v ) )
521 && defaultValueDefinition.
isValid() )
526 v = layer->
defaultValue( idx, newFeature, evalContext );
531 if ( ( v.isNull() || ( hasUniqueConstraint
532 && uniqueValueCaches[ idx ].contains( v ) ) )
537 if ( !providerDefault.isEmpty() )
546 if ( ( v.isNull() || ( checkUnique && hasUniqueConstraint
547 && uniqueValueCaches[ idx ].contains( v ) ) )
561 if ( v.isNull() && fd.attributes().contains( idx ) )
563 v = fd.attributes().value( idx );
569 if ( checkUnique && hasUniqueConstraint )
571 if ( uniqueValueCaches[ idx ].contains( v ) )
575 if ( uniqueValue.isValid() )
579 if ( hasUniqueConstraint )
580 uniqueValueCaches[ idx ].insert( v );
583 result.append( newFeature );
614 while ( relatedFeaturesIt.
nextFeature( childFeature ) )
617 relation.referencingLayer()->startEditing();
619 const auto pairs = relation.fieldPairs();
625 childFeatureIds.insert(
duplicateFeature( relation.referencingLayer(), childFeature, project, depth, duplicateFeatureContext ).
id() );
629 duplicateFeatureContext.setDuplicatedFeatures( relation.referencingLayer(), childFeatureIds );
640 std::unique_ptr<QgsVectorLayerFeatureSource> featureSource;
644 #if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) 645 Q_ASSERT( QThread::currentThread() == qApp->thread() || feedback );
659 return featureSource;
667 attributes.reserve( fields.
size() );
669 for (
const QgsField &field : fields )
672 attributes.append( index >= 0 ? feature.
attribute( index ) : QVariant( field.type() ) );
680 if ( lengthDiff > 0 )
686 else if ( lengthDiff < 0 )
690 attributes.reserve( fields.
count() );
693 attributes.append( QVariant( fields.
at( i ).
type() ) );
710 bool newFHasGeom = newFGeomType !=
711 QgsWkbTypes::GeometryType::UnknownGeometry &&
712 newFGeomType != QgsWkbTypes::GeometryType::NullGeometry;
713 bool layerHasGeom = inputWkbType !=
714 QgsWkbTypes::Type::NoGeometry &&
715 inputWkbType != QgsWkbTypes::Type::Unknown;
717 if ( newFHasGeom && ! layerHasGeom )
721 resultFeatures.append( _f );
726 if ( newFHasGeom && layerHasGeom && newF.
geometry().
wkbType() != inputWkbType )
751 std::unique_ptr< QgsAbstractGeometry > exterior( ( *part )->clone() );
752 if (
QgsCurve *curve = qgsgeometry_cast< QgsCurve * >( exterior.get() ) )
756 std::unique_ptr< QgsCurvePolygon > cp = qgis::make_unique< QgsCurvePolygon >();
757 cp->setExteriorRing( curve );
759 gc->addGeometry( cp.release() );
763 std::unique_ptr< QgsPolygon > p = qgis::make_unique< QgsPolygon >();
764 p->setExteriorRing( qgsgeometry_cast< QgsLineString * >( curve ) );
766 gc->addGeometry( p.release() );
780 std::unique_ptr< QgsMultiPoint > mp = qgis::make_unique< QgsMultiPoint >();
782 QSet< QgsPoint > added;
783 for (
auto vertex = source.vertices_begin(); vertex != source.vertices_end(); ++vertex )
785 if ( added.contains( *vertex ) )
787 mp->addGeometry( ( *vertex ).clone() );
788 added.insert( *vertex );
831 const QgsGeometryCollection *parts( static_cast< const QgsGeometryCollection * >( newGeom.constGet() ) );
837 resultFeatures.reserve( parts->partCount() );
838 for (
int i = 0; i < parts->partCount( ); i++ )
842 resultFeatures.append( _f );
847 resultFeatures.append( newF );
852 resultFeatures.append( newF );
855 return resultFeatures;
864 for (
const auto &_f : features )
866 resultFeatures.append( _f );
869 return resultFeatures;
874 QList<QgsVectorLayer *> layers;
875 QMap<QgsVectorLayer *, QgsFeatureIds>::const_iterator i;
876 for ( i = mDuplicatedFeatures.begin(); i != mDuplicatedFeatures.end(); ++i )
877 layers.append( i.key() );
883 return mDuplicatedFeatures[layer];
888 mDuplicatedFeatures.insert( layer, ids );
898 mGeometry( geometry ),
899 mAttributes( attributes )
933 if ( !joinedFeature.
isValid() )
962 if ( labelSettingsEntity->settings().format().mask().enabled() )
964 for (
const auto &r : labelSettingsEntity->settings().format().mask().maskedSymbolLayers() )
966 masks[currentRule][r.layerId()].insert( r.symbolLayerId() );
973 QHash<QString, QHash<QString, QSet<QgsSymbolLayerId>>> masks;
981 LabelMasksVisitor visitor;
983 return std::move( visitor.masks );
999 void visitSymbol(
const QgsSymbol *symbol )
1004 for (
const auto &mask : sl->
masks() )
1006 masks[mask.layerId()].insert( mask.symbolLayerId() );
1011 visitSymbol( subSymbol );
1020 if ( symbolEntity->symbol() )
1021 visitSymbol( symbolEntity->symbol() );
1025 QHash<QString, QSet<QgsSymbolLayerId>> masks;
1028 SymbolLayerVisitor visitor;
1030 return visitor.masks;
1039 exp.prepare( &context );
1040 QString displayString = exp.evaluate( &context ).toString();
1042 return displayString;
bool isMeasure() const
Returns true if the geometry contains m values.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
bool _fieldIsEditable(const QgsVectorLayer *layer, int fieldIndex, const QgsFeature &feature)
bool isValid() const
Returns the validity of this feature.
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
A symbol entity for QgsStyle databases.
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
QSet< QgsFeatureId > QgsFeatureIds
static bool valueExists(const QgsVectorLayer *layer, int fieldIndex, const QVariant &value, const QgsFeatureIds &ignoreIds=QgsFeatureIds())
Returns true if the specified value already exists within a field.
int size() const
Returns number of items.
FieldOrigin fieldOrigin(int fieldIdx) const
Gets field's origin (value from an enumeration)
virtual QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
void setFields(const QgsFields &fields, bool initAttributes=false)
Assign a field map with the feature to allow attribute access by attribute name.
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
ConstraintStrength constraintStrength(Constraint constraint) const
Returns the strength of a field constraint, or ConstraintStrengthNotSet if the constraint is not pres...
Abstract base class for all rendered symbols.
bool isValid() const
Returns if this default value should be applied.
static std::unique_ptr< QgsVectorLayerFeatureSource > getFeatureSource(QPointer< QgsVectorLayer > layer, QgsFeedback *feedback=nullptr)
Gets the feature source from a QgsVectorLayer pointer.
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type.
The QgsDefaultValue class provides a container for managing client side default values for fields...
Contains mainly the QMap with QgsVectorLayer and QgsFeatureIds do list all the duplicated features...
QList< QgsVectorLayer * > layers() const
Returns all the layers on which features have been duplicated.
Q_INVOKABLE QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
QList< QgsFeature > QgsFeatureList
QgsWkbTypes::Type wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
ConstraintOrigin
Origin of constraints.
static QList< double > getDoubleValues(const QgsVectorLayer *layer, const QString &fieldOrExpression, bool &ok, bool selectedOnly=false, int *nullCount=nullptr, QgsFeedback *feedback=nullptr)
Fetches all double values from a specified field name or expression.
QgsAbstractGeometry::const_part_iterator const_parts_end() const
Returns STL-style iterator pointing to the imaginary part after the last part of the geometry...
QgsAbstractGeometry::const_part_iterator const_parts_begin() const
Returns STL-style const iterator pointing to the first part of the geometry.
static QgsFeatureList createFeatures(const QgsVectorLayer *layer, const QgsFeaturesDataList &featuresData, QgsExpressionContext *context=nullptr)
Creates a set of new features ready for insertion into a layer.
QVariant evaluate()
Evaluate the feature and return the result.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
bool convertCompatible(QVariant &v) const
Converts the provided variant to a compatible format.
static std::unique_ptr< QgsGeometryCollection > createCollectionOfType(QgsWkbTypes::Type type)
Returns a new geometry collection matching a specified WKB type.
Container of fields for a vector layer.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
A geometry is the spatial representation of a feature.
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
bool setAttribute(int field, const QVariant &attr)
Set an attribute's value by field index.
static QList< QVariant > getValues(const QgsVectorLayer *layer, const QString &fieldOrExpression, bool &ok, bool selectedOnly=false, QgsFeedback *feedback=nullptr)
Fetches all values from a specified field name or expression.
int symbolLayerCount() const
Returns the total number of symbol layers contained in the symbol.
virtual QgsAbstractGeometry * boundary() const =0
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
Stores information about constraints which may be present on a field.
Field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static bool validateAttribute(const QgsVectorLayer *layer, const QgsFeature &feature, int attributeIndex, QStringList &errors, QgsFieldConstraints::ConstraintStrength strength=QgsFieldConstraints::ConstraintStrengthNotSet, QgsFieldConstraints::ConstraintOrigin origin=QgsFieldConstraints::ConstraintOriginNotSet)
Tests an attribute value to check whether it passes all constraints which are present on the correspo...
An interface for classes which can visit style entity (e.g.
static QString getFeatureDisplayString(const QgsVectorLayer *layer, const QgsFeature &feature)
static QHash< QString, QSet< QgsSymbolLayerId > > symbolLayerMasks(const QgsVectorLayer *)
Returns all masks that may be defined on symbol layers for a given vector layer.
int count() const
Returns number of items.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
static QgsFeatureIterator getValuesIterator(const QgsVectorLayer *layer, const QString &fieldOrExpression, bool &ok, bool selectedOnly)
Create a feature iterator for a specified field name or expression.
QList< QgsRelation > referencedRelations(const QgsVectorLayer *layer=nullptr) const
Gets all relations where this layer is the referenced part (i.e.
Constraint was set at data provider.
Field has an expression constraint set. See constraintExpression().
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
int fieldOriginIndex(int fieldIdx) const
Gets field's origin index (its meaning is specific to each type of origin)
Base class for feedback objects to be used for cancellation of something running in a worker thread...
virtual bool skipConstraintCheck(int fieldIndex, QgsFieldConstraints::Constraint constraint, const QVariant &value=QVariant()) const
Returns true if a constraint check should be skipped for a specified field (e.g., if the value return...
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
Type
The WKB type describes the number of dimensions a geometry has.
QStringList uniqueStringsMatching(int index, const QString &substring, int limit=-1, QgsFeedback *feedback=nullptr) const
Returns unique string values of an attribute which contain a specified subset string.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Defines a relation between matching fields of the two involved tables of a relation.
QgsVectorLayer * joinLayer() const
Returns joined layer (may be nullptr if the reference was set by layer ID and not resolved yet) ...
static void matchAttributesToFields(QgsFeature &feature, const QgsFields &fields)
Matches the attributes in feature to the specified fields.
static QVariant createUniqueValueFromCache(const QgsVectorLayer *layer, int fieldIndex, const QSet< QVariant > &existingValues, const QVariant &seed=QVariant())
Returns a new attribute value for the specified field index which is guaranteed to be unique within r...
virtual QgsSymbolLayerReferenceList masks() const
Returns masks defined by this symbol layer.
QgsFeatureIterator getSelectedFeatures(QgsFeatureRequest request=QgsFeatureRequest()) const
Returns an iterator of the selected features.
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
QgsFeatureData(const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap())
Constructs a new QgsFeatureData with given geometry and attributes.
QString constraintDescription() const
Returns the descriptive name for the constraint expression.
void initAttributes(int fieldCount)
Initialize this feature with the given number of fields.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsAttributeMap attributes() const
Returns attributes.
static QgsFeature createFeature(const QgsVectorLayer *layer, const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap(), QgsExpressionContext *context=nullptr)
Creates a new feature ready for insertion into a layer.
Encapsulate geometry and attributes for new features, to be passed to createFeatures.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling...
Defines left outer join from our vector layer to some other vector layer.
QMap< int, QVariant > QgsAttributeMap
static GeometryType geometryType(Type type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
virtual QString defaultValueClause(int fieldIndex) const
Returns any default value clauses which are present at the provider for a specified field index...
Contains information relating to a node (i.e.
QgsStyleEntityVisitorInterface::NodeType type
Node type.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
QgsAttributeMap toMap() const
Returns a QgsAttributeMap of the attribute values.
QgsFeatureRenderer * renderer()
Returns renderer.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Abstract base class for curved geometry type.
Encapsulate a field in an attribute table or data source.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
QgsRelationManager relationManager
QgsEditFormConfig editFormConfig
QgsExpressionContext createExpressionContext() const FINAL
This method needs to be reimplemented in all classes which implement this interface and return an exp...
static bool runOnMainThread(const Func &func, QgsFeedback *feedback=nullptr)
Guarantees that func is executed on the main thread.
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
QString displayExpression
static QgsFeatureList makeFeaturesCompatible(const QgsFeatureList &features, const QgsVectorLayer *layer)
Converts input features to be compatible with the given layer.
QgsVectorLayerJoinBuffer * joinBuffer()
Returns the join buffer object.
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
QgsAbstractGeometry * get()
Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Rule based symbology or label child rule.
static QVariant createUniqueValue(const QgsVectorLayer *layer, int fieldIndex, const QVariant &seed=QVariant())
Returns a new attribute value for the specified field index which is guaranteed to be unique...
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
QgsGeometry geometry() const
Returns geometry.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
void setValid(bool validity)
Sets the validity of the feature.
QgsDefaultValue defaultValueDefinition(int index) const
Returns the definition of the expression used when calculating the default value for a field...
virtual QgsStyle::StyleEntity type() const =0
Returns the type of style entity.
QgsFieldConstraints constraints
static QHash< QString, QHash< QString, QSet< QgsSymbolLayerId > > > labelMasks(const QgsVectorLayer *)
Returns masks defined in labeling options of a layer.
bool convertToMultiType()
Converts single type geometry into multitype geometry e.g.
bool isCanceled() const
Tells whether the operation has been canceled already.
QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const FINAL
Calculates a list of unique values contained within an attribute in the layer.
ConstraintStrength
Strength of constraints.
static QgsFeature duplicateFeature(QgsVectorLayer *layer, const QgsFeature &feature, QgsProject *project, int depth, QgsDuplicateFeatureContext &duplicateFeatureContext)
Duplicates a feature and it's children (one level deep).
static bool isCurvedType(Type type)
Returns true if the WKB type is a curved type or can contain curved geometries.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
QgsFeatureIds duplicatedFeatures(QgsVectorLayer *layer) const
Returns the duplicated features in the given layer.
A label settings entity for QgsStyle databases.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
const QgsVectorLayerJoinInfo * joinForFieldIndex(int index, const QgsFields &fields, int &sourceFieldIndex) const
Finds the vector join for a layer field index.
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=nullptr) FINAL
Adds a single feature to the sink.
QgsFeatureRequest & setLimit(long limit)
Set the maximum number of features to request.
bool isEmpty() const
Checks whether the container is empty.
QgsFeature joinedFeatureOf(const QgsVectorLayerJoinInfo *info, const QgsFeature &feature) const
Returns the joined feature corresponding to the feature.
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
ConstraintOrigin constraintOrigin(Constraint constraint) const
Returns the origin of a field constraint, or ConstraintOriginNotSet if the constraint is not present ...
void appendScopes(const QList< QgsExpressionContextScope *> &scopes)
Appends a list of scopes to the end of the context.
QgsWkbTypes::GeometryType type
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
QList< int > QgsAttributeList
bool isEditable() const
Returns whether joined fields may be edited through the form of the target layer. ...
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
bool hasUpsertOnEdit() const
Returns whether a feature created on the target layer has to impact the joined layer by creating a ne...
bool nextFeature(QgsFeature &f)
const QgsStyleEntityInterface * entity
Reference to style entity being visited.
static QString quotedValue(const QVariant &value)
Returns a string representation of a literal value, including appropriate quotations where required...
QString constraintExpression() const
Returns the constraint expression for the field, if set.
static QgsFeatureList makeFeatureCompatible(const QgsFeature &feature, const QgsVectorLayer *layer)
Converts input feature to be compatible with the given layer.
Geometry is not required. It may still be returned if e.g. required for a filter condition.
QVariant maximumValue(int index) const FINAL
Returns the maximum value for an attribute column or an invalid variant in case of error...
Represents a vector layer which manages a vector based data sets.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
virtual QgsAbstractGeometry * segmentize(double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a version of the geometry without curves.
static bool fieldIsEditable(const QgsVectorLayer *layer, int fieldIndex, const QgsFeature &feature)
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
Allows modification of attribute values.
Contains information relating to the style entity currently being visited.
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
Fix relation, related elements are part of the parent and a parent copy will copy any children or del...
QList< QgsVectorLayerUtils::QgsFeatureData > QgsFeaturesDataList
Alias for list of QgsFeatureData.
QgsVectorLayer * clone() const override
Returns a new instance equivalent to this one.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
QVariant defaultValue(int index, const QgsFeature &feature=QgsFeature(), QgsExpressionContext *context=nullptr) const
Returns the calculated default value for the specified field index.
QString identifier
A string identifying the node.
Field must have a unique value.
virtual QVariant defaultValue(int fieldIndex) const
Returns any literal default values which are present at the provider for a specified field index...