QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
33 if ( fieldIndex < 0 || fieldIndex >=
fields().count() )
34 return QSet<QVariant>();
40 QSet<QVariant> values;
45 values.insert( f.
attribute( fieldIndex ) );
46 if ( limit > 0 && values.size() >= limit )
54 if ( fieldIndex < 0 || fieldIndex >=
fields().count() )
66 const QVariant v = f.
attribute( fieldIndex );
77 if ( fieldIndex < 0 || fieldIndex >=
fields().count() )
89 const QVariant v = f.
attribute( fieldIndex );
119 .setNoAttributes() );
146 if ( requestedAttrs.contains( i ) )
173 for (
int i = 0; i < fieldCount; ++i )
175 if ( requestedAttrs.contains( i ) )
187 return layer.release();
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
virtual QVariant minimumValue(int fieldIndex) const
Returns the minimum value for an attribute column or an invalid variant in case of error.
virtual SpatialIndexPresence hasSpatialIndex() const
Returns an enum value representing the presence of a valid spatial index on the source,...
virtual QgsCoordinateReferenceSystem sourceCrs() const =0
Returns the coordinate reference system for features in the source.
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle.
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.
const QgsCoordinateReferenceSystem & crs
int count() const
Returns number of items.
Container of fields for a vector layer.
bool isCanceled() const SIP_HOLDGIL
Tells whether the operation has been canceled already.
static QgsVectorLayer * createMemoryLayer(const QString &name, const QgsFields &fields, QgsWkbTypes::Type geometryType=QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) SIP_FACTORY
Creates a new memory layer using the specified parameters.
Type
The WKB type describes the number of dimensions a geometry has.
virtual QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const
Returns the set of unique values contained within the specified fieldIndex from 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.
bool append(const QgsField &field, FieldOrigin origin=OriginProvider, int originIndex=-1)
Appends a field. The field must have unique name, otherwise it is rejected (returns false)
QList< int > QgsAttributeList
A rectangle specified with double values.
@ SubsetOfAttributes
Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
Flags flags() const
Returns the flags which affect how features are fetched.
bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is greater than the second.
virtual QgsFeatureIds allFeatureIds() const
Returns a list of all feature IDs for features present in the source.
virtual FeatureAvailability hasFeatures() const
Determines if there are any features available in the source.
This class wraps a request for features to a vector layer (or directly its vector data provider).
virtual QVariant maximumValue(int fieldIndex) const
Returns the maximum value for an attribute column or an invalid variant in case of error.
virtual QString sourceName() const =0
Returns a friendly display name for the source.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
SpatialIndexPresence
Enumeration of spatial index presence states.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
virtual QgsRectangle sourceExtent() const
Returns the extent of all geometries from the source.
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
QSet< QgsFeatureId > QgsFeatureIds
This class represents a coordinate reference system (CRS).
virtual QgsFields fields() const =0
Returns the fields associated with features in the source.
FeatureAvailability
Possible return value for hasFeatures() to determine if a source is empty.
bool nextFeature(QgsFeature &f)
@ SpatialIndexUnknown
Spatial index presence cannot be determined, index may or may not exist.
virtual QgsWkbTypes::Type wkbType() const =0
Returns the geometry type for features returned by this source.
Represents a vector layer which manages a vector based data sets.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
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...
QgsAttributeList subsetOfAttributes() const
Returns the subset of attributes which at least need to be fetched.
@ FeaturesMaybeAvailable
There may be features available in this source.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
A vector of attributes. Mostly equal to QVector<QVariant>.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
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.
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
Encapsulate a field in an attribute table or data source.