28 if ( fieldIndex < 0 || fieldIndex >=
fields().count() )
29 return QSet<QVariant>();
35 QSet<QVariant> values;
40 values.insert( f.
attribute( fieldIndex ) );
41 if ( limit > 0 && values.size() >= limit )
49 if ( fieldIndex < 0 || fieldIndex >=
fields().count() )
72 if ( fieldIndex < 0 || fieldIndex >=
fields().count() )
139 for (
const QgsField &field : sourceFields )
141 if ( requestedAttrs.contains( i ) )
142 outFields.
append( field );
168 for (
int i = 0; i < fieldCount; ++i )
170 if ( requestedAttrs.contains( i ) )
182 return layer.release();
Wrapper for iterator of features from vector data provider or vector layer.
virtual QgsRectangle sourceExtent() const
Returns the extent of all geometries from the source.
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
A rectangle specified with double values.
virtual QgsFields fields() const =0
Returns the fields associated with features in the source.
const Flags & flags() const
QSet< QgsFeatureId > QgsFeatureIds
virtual QgsWkbTypes::Type wkbType() const =0
Returns the geometry type for features returned by this source.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for feature's geometries, or an invalid QgsCoordi...
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
Container of fields for a vector layer.
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsVectorLayer * materialize(const QgsFeatureRequest &request, QgsFeedback *feedback=nullptr)
Materializes a request (query) made against this feature source, by running it over the source and re...
bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is greater than the second.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
int count() const
Return number of items.
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Type
The WKB type describes the number of dimensions a geometry has.
virtual QVariant minimumValue(int fieldIndex) const
Returns the minimum value for an attribute column or an invalid variant in case of error...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
bool append(const QgsField &field, FieldOrigin origin=OriginProvider, int originIndex=-1)
Append a field. The field must have unique name, otherwise it is rejected (returns false) ...
Encapsulate a field in an attribute table or data source.
Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
QgsGeometry geometry() const
Returns the geometry associated with this feature.
virtual QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const
Returns the set of unique values contained within the specified fieldIndex from this source...
QgsAttributeList subsetOfAttributes() const
Return the subset of attributes which at least need to be fetched.
virtual QgsCoordinateReferenceSystem sourceCrs() const =0
Returns the coordinate reference system for features in the source.
void combineExtentWith(const QgsRectangle &rect)
Expand the rectangle so that covers both the original rectangle and the given rectangle.
bool isCanceled() const
Tells whether the operation has been canceled already.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
This class represents a coordinate reference system (CRS).
static QgsVectorLayer * createMemoryLayer(const QString &name, const QgsFields &fields, QgsWkbTypes::Type geometryType=QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Creates a new memory layer using the specified parameters.
virtual QVariant maximumValue(int fieldIndex) const
Returns the maximum value for an attribute column or an invalid variant in case of error...
QList< int > QgsAttributeList
bool nextFeature(QgsFeature &f)
virtual QString sourceName() const =0
Returns a friendly display name for the source.
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Represents a vector layer which manages a vector based data sets.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
virtual QgsFeatureIds allFeatureIds() const
Returns a list of all feature IDs for features present in the source.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Set flags that affect how features will be fetched.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.