1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsaggregatecalculator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsAggregateCalculator
{
%Docstring(signature="appended")
Utility class for calculating aggregates for a field (or expression)
over the features from a vector layer.
.. note::
It is recommended that :py:func:`QgsVectorLayer.aggregate()` is used rather then
directly using this class, as the :py:class:`QgsVectorLayer` method can handle delegating aggregate calculation
to a data provider for remote calculation.
%End
%TypeHeaderCode
#include "qgsaggregatecalculator.h"
%End
public:
struct AggregateInfo
{
QString function;
QString name;
QSet<QMetaType::Type> supportedTypes;
};
struct AggregateParameters
{
QString filter;
QString delimiter;
QgsFeatureRequest::OrderBy orderBy;
};
QgsAggregateCalculator( const QgsVectorLayer *layer );
%Docstring
Constructor for QgsAggregateCalculator.
:param layer: vector layer to calculate aggregate from
%End
QString lastError() const;
%Docstring
Returns the last error encountered during the aggregate calculation.
.. versionadded:: 3.22
%End
const QgsVectorLayer *layer() const;
%Docstring
Returns the associated vector layer.
%End
void setParameters( const AggregateParameters ¶meters );
%Docstring
Sets all aggregate parameters from a parameter bundle.
:param parameters: aggregate parameters
%End
void setFilter( const QString &filterExpression );
%Docstring
Sets a filter to limit the features used during the aggregate
calculation.
:param filterExpression: expression for filtering features, or empty
string to remove filter
.. seealso:: :py:func:`filter`
%End
void setFidsFilter( const QgsFeatureIds &fids );
%Docstring
Sets a filter to limit the features used during the aggregate
calculation. If an expression filter is set, it will override this
filter.
:param fids: feature ids for feature filtering, and empty list will
return no features.
.. seealso:: :py:func:`filter`
%End
QString filter() const;
%Docstring
Returns the filter which limits the features used during the aggregate
calculation.
.. seealso:: :py:func:`setFilter`
%End
void setDelimiter( const QString &delimiter );
%Docstring
Sets the delimiter to use for joining values with the StringConcatenate
aggregate.
:param delimiter: string delimiter
.. seealso:: :py:func:`delimiter`
%End
QString delimiter() const;
%Docstring
Returns the delimiter used for joining values with the StringConcatenate
aggregate.
.. seealso:: :py:func:`setDelimiter`
%End
QVariant calculate( Qgis::Aggregate aggregate, const QString &fieldOrExpression,
QgsExpressionContext *context = 0, bool *ok = 0, QgsFeedback *feedback = 0 ) const;
%Docstring
Calculates the value of an aggregate.
:param aggregate: aggregate to calculate
:param fieldOrExpression: source field or expression to use as basis for
aggregated values. If an expression is used,
then the context parameter must be set.
:param context: expression context for evaluating expressions
:param ok: if specified, will be set to ``True`` if aggregate
calculation was successful. If ``ok`` is ``False`` then
:py:func:`~QgsAggregateCalculator.lastError` can be used to
retrieve a descriptive error message.
:param feedback: optional feedback argument for early cancellation
(since QGIS 3.22). If set, this will take precedence
over any feedback object set on the expression
``context``.
:return: calculated aggregate value
%End
static Qgis::Aggregate stringToAggregate( const QString &string, bool *ok = 0 );
%Docstring
Converts a string to a aggregate type.
:param string: string to convert
:param ok: if specified, will be set to ``True`` if conversion was
successful
:return: aggregate type
%End
static QString displayName( Qgis::Aggregate aggregate );
%Docstring
Returns the friendly display name for a ``aggregate``.
.. versionadded:: 3.22
%End
static QList< QgsAggregateCalculator::AggregateInfo > aggregates();
%Docstring
Structured information for available aggregates.
.. versionadded:: 3.2
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsaggregatecalculator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|