16 #ifndef QGSVECTORLAYERUTILS_H 17 #define QGSVECTORLAYERUTILS_H 19 #include "qgis_core.h" 53 QList<QgsVectorLayer *> layers()
const;
63 QMap<QgsVectorLayer *, QgsFeatureIds> mDuplicatedFeatures;
95 static QList< QVariant >
getValues(
const QgsVectorLayer *layer,
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
QgsFeedback *feedback =
nullptr );
110 static QList< double >
getDoubleValues(
const QgsVectorLayer *layer,
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
int *nullCount =
nullptr,
QgsFeedback *feedback =
nullptr );
161 #endif // QGSVECTORLAYERUTILS_H Wrapper for iterator of features from vector data provider or vector layer.
static QgsFeature createFeature(QgsVectorLayer *layer, const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap(), QgsExpressionContext *context=nullptr)
Creates a new feature ready for insertion into a layer.
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.
Contains mainly the QMap with QgsVectorLayer and QgsFeatureIds do list all the duplicated features...
QSet< QgsFeatureId > QgsFeatureIds
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.
A geometry is the spatial representation of a feature.
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.
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...
static QgsFeatureIterator getValuesIterator(const QgsVectorLayer *layer, const QString &fieldOrExpression, bool &ok, bool selectedOnly)
Create a feature iterator for a specified field name or expression.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void seed(uint32_t value)
QMap< int, QVariant > QgsAttributeMap
Reads and writes project states.
Contains utility methods for working with QgsVectorLayers.
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...
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).
Represents a vector layer which manages a vector based data sets.