46   for ( QVariantMap::const_iterator it = customVariables.constBegin(); it != customVariables.constEnd(); ++it )
 
   78   if ( vars.remove( name ) )
 
   97       const QString 
id = values.at( 0 ).toString();
 
  105       return c.variablesToMap();
 
  110       return new GetLayoutItemVariables( mLayout );
 
  123     GetLayoutMapLayerCredits( 
const QgsLayout *
c )
 
  127                                      << 
QgsExpressionFunction::Parameter( QStringLiteral( 
"layer_name_separator" ), true, QStringLiteral( 
": " ) ), QStringLiteral( 
"Layout" ) )
 
  136       const QString 
id = values.value( 0 ).toString();
 
  138       if ( 
QgsLayoutItemMap *map = qobject_cast< QgsLayoutItemMap * >( mLayout->itemById( 
id ) ) )
 
  141         const QVariantList mapLayers = 
c.variable( QStringLiteral( 
"map_layers" ) ).toList();
 
  143         const bool includeLayerNames = values.value( 1 ).toBool();
 
  144         const QString layerNameSeparator = values.value( 2 ).toString();
 
  147         for ( 
const QVariant &value : mapLayers )
 
  149           if ( 
const QgsMapLayer *layer = qobject_cast< const QgsMapLayer * >( value.value< QObject * >() ) )
 
  151             const QStringList credits = !layer->metadata().rights().isEmpty() ? layer->metadata().rights() : QStringList() << layer->attribution();
 
  152             for ( 
const QString &credit : credits )
 
  154               if ( credit.trimmed().isEmpty() )
 
  157               const QString creditString = includeLayerNames ? layer->name() + layerNameSeparator + credit
 
  160               if ( !res.contains( creditString ) )
 
  173       return new GetLayoutMapLayerCredits( mLayout );
 
  185     GetCurrentFormFieldValue( )
 
  191       const QString fieldName( values.at( 0 ).toString() );
 
  192       const QgsFeature feat( context->
variable( QStringLiteral( 
"current_feature" ) ).value<QgsFeature>() );
 
  193       if ( fieldName.isEmpty() || ! feat.isValid( ) )
 
  197       return feat.attribute( fieldName ) ;
 
  202       return new GetCurrentFormFieldValue( );
 
  215     GetCurrentParentFormFieldValue( )
 
  221       const QString fieldName( values.at( 0 ).toString() );
 
  222       const QgsFeature feat( context->
variable( QStringLiteral( 
"current_parent_feature" ) ).value<QgsFeature>() );
 
  223       if ( fieldName.isEmpty() || ! feat.isValid( ) )
 
  227       return feat.attribute( fieldName ) ;
 
  232       return new GetCurrentParentFormFieldValue( );
 
  246     GetProcessingParameterValue( 
const QVariantMap ¶ms )
 
  253       return mParams.value( values.at( 0 ).toString() );
 
  258       return new GetProcessingParameterValue( mParams );
 
  263     const QVariantMap mParams;
 
  273   scope->
addFunction( QStringLiteral( 
"current_value" ), 
new GetCurrentFormFieldValue( ) );
 
  275   scope->
setVariable( QStringLiteral( 
"current_feature" ), formFeature, 
true );
 
  276   scope->
setVariable( QStringLiteral( 
"form_mode" ), formMode, 
true );
 
  284   scope->
addFunction( QStringLiteral( 
"current_parent_value" ), 
new GetCurrentParentFormFieldValue( ) );
 
  285   scope->
setVariable( QStringLiteral( 
"current_parent_geometry" ), parentFormFeature.
geometry( ), 
true );
 
  286   scope->
setVariable( QStringLiteral( 
"current_parent_feature" ), parentFormFeature, 
true );
 
  287   scope->
setVariable( QStringLiteral( 
"parent_form_mode" ), parentFormMode, 
true );
 
  309   vars.insert( name, value );
 
  330   if ( vars.remove( name ) )
 
  342   const QStringList variableNames = layer->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  343   const QStringList variableValues = layer->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  346   for ( 
const QString &variableName : variableNames )
 
  348     if ( varIndex >= variableValues.length() )
 
  353     const QVariant varValue = variableValues.at( varIndex );
 
  355     scope->
setVariable( variableName, varValue, 
true );
 
  364   const QgsVectorLayer *vLayer = qobject_cast< const QgsVectorLayer * >( layer );
 
  379   QList<QgsExpressionContextScope *> scopes;
 
  398   QStringList variableNames = layer->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  399   QStringList variableValues = layer->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  401   variableNames << name;
 
  402   variableValues << value.toString();
 
  413   QStringList variableNames;
 
  414   QStringList variableValues;
 
  416   QVariantMap::const_iterator it = variables.constBegin();
 
  417   for ( ; it != variables.constEnd(); ++it )
 
  419     variableNames << it.key();
 
  420     variableValues << it.value().toString();
 
  474   QVariantList layersIds;
 
  476   const QList<QgsMapLayer *> layersInMap = mapSettings.
layers( 
true );
 
  477   layersIds.reserve( layersInMap.count() );
 
  478   layers.reserve( layersInMap.count() );
 
  481     layersIds << layer->id();
 
  494   scope->
addFunction( QStringLiteral( 
"is_layer_visible" ), 
new GetLayerVisibility( mapSettings.
layers( 
true ), mapSettings.
scale() ) );
 
  513   QVariantList matchList;
 
  517     QVariantMap matchMap;
 
  519     matchMap.insert( QStringLiteral( 
"valid" ), match.isValid() );
 
  520     matchMap.insert( QStringLiteral( 
"layer" ), QVariant::fromValue<QgsWeakMapLayerPointer>( 
QgsWeakMapLayerPointer( match.layer() ) ) );
 
  521     matchMap.insert( QStringLiteral( 
"feature_id" ), match.featureId() );
 
  522     matchMap.insert( QStringLiteral( 
"vertex_index" ), match.vertexIndex() );
 
  523     matchMap.insert( QStringLiteral( 
"distance" ), match.distance() );
 
  525     matchList.append( matchMap );
 
  555     return scope.release();
 
  558   const QStringList variableNames = layout->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  559   const QStringList variableValues = layout->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  563   for ( 
const QString &variableName : variableNames )
 
  565     if ( varIndex >= variableValues.length() )
 
  570     const QVariant varValue = variableValues.at( varIndex );
 
  572     scope->setVariable( variableName, varValue );
 
  588   QVariantList offsets;
 
  598   scope->addFunction( QStringLiteral( 
"item_variables" ), 
new GetLayoutItemVariables( layout ) );
 
  599   scope->addFunction( QStringLiteral( 
"map_credits" ), 
new GetLayoutMapLayerCredits( layout ) );
 
  611     scope->setFeature( atlasFeature );
 
  617   return scope.release();
 
  626   QStringList variableNames = layout->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  627   QStringList variableValues = layout->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  629   variableNames << name;
 
  630   variableValues << value.toString();
 
  641   QStringList variableNames;
 
  642   QStringList variableValues;
 
  644   QVariantMap::const_iterator it = variables.constBegin();
 
  645   for ( ; it != variables.constEnd(); ++it )
 
  647     variableNames << it.key();
 
  648     variableValues << it.value().toString();
 
  701   const QStringList variableNames = item->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  702   const QStringList variableValues = item->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  705   for ( 
const QString &variableName : variableNames )
 
  707     if ( varIndex >= variableValues.length() )
 
  712     const QVariant varValue = variableValues.at( varIndex );
 
  747   QStringList variableNames = item->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  748   QStringList variableValues = item->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  750   variableNames << name;
 
  751   variableValues << value.toString();
 
  762   QStringList variableNames;
 
  763   QStringList variableValues;
 
  765   QVariantMap::const_iterator it = variables.constBegin();
 
  766   for ( ; it != variables.constEnd(); ++it )
 
  768     variableNames << it.key();
 
  769     variableValues << it.value().toString();
 
  783   const QStringList variableNames = frame->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  784   const QStringList variableValues = frame->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  787   for ( 
const QString &variableName : variableNames )
 
  789     if ( varIndex >= variableValues.length() )
 
  794     const QVariant varValue = variableValues.at( varIndex );
 
  808   QStringList variableNames = frame->
customProperty( QStringLiteral( 
"variableNames" ) ).toStringList();
 
  809   QStringList variableValues = frame->
customProperty( QStringLiteral( 
"variableValues" ) ).toStringList();
 
  811   variableNames << name;
 
  812   variableValues << value.toString();
 
  823   QStringList variableNames;
 
  824   QStringList variableValues;
 
  826   QVariantMap::const_iterator it = variables.constBegin();
 
  827   for ( ; it != variables.constEnd(); ++it )
 
  829     variableNames << it.key();
 
  830     variableValues << it.value().toString();
 
  851   scope->addFunction( QStringLiteral( 
"parameter" ), 
new GetProcessingParameterValue( parameters ) );
 
  854     return scope.release();
 
  859   return scope.release();
 
  866   if ( !model->sourceFilePath().isEmpty() )
 
  868     modelPath = model->sourceFilePath();
 
  877   const QString modelFolder = !modelPath.isEmpty() ? QFileInfo( modelPath ).path() : QString();
 
  884   const QVariantMap customVariables = model->variables();
 
  885   for ( 
auto it = customVariables.constBegin(); it != customVariables.constEnd(); ++it )
 
  890   return modelScope.release();
 
  897   return scope.release();
 
  914   return mUsesGeometry;
 
  920   return mReferencedColumns;
 
  932 QgsExpressionContextUtils::GetLayerVisibility::GetLayerVisibility( 
const QList<QgsMapLayer *> &layers, 
double scale )
 
  934   , mLayers( _qgis_listRawToQPointer( layers ) )
 
  937   for ( 
const auto &layer : mLayers )
 
  939     if ( layer->hasScaleBasedVisibility() )
 
  941       mScaleBasedVisibilityDetails[ layer ] = qMakePair( layer->minimumScale(), layer->maximumScale() );
 
  946 QgsExpressionContextUtils::GetLayerVisibility::GetLayerVisibility()
 
  952   if ( mLayers.isEmpty() )
 
  957   bool isVisible = 
false;
 
  958   QgsMapLayer *layer = QgsExpressionUtils::getMapLayer( values.at( 0 ), parent );
 
  959   if ( layer && mLayers.contains( layer ) )
 
  962     if ( mScaleBasedVisibilityDetails.contains( layer ) && !
qgsDoubleNear( mScale, 0.0 ) )
 
  964       if ( ( !
qgsDoubleNear( mScaleBasedVisibilityDetails[ layer ].first, 0.0 ) && mScale > mScaleBasedVisibilityDetails[ layer ].first ) ||
 
  965            ( !
qgsDoubleNear( mScaleBasedVisibilityDetails[ layer ].second, 0.0 ) && mScale < mScaleBasedVisibilityDetails[ layer ].second ) )
 
  977   GetLayerVisibility *func = 
new GetLayerVisibility();
 
  978   func->mLayers = mLayers;
 
  979   func->mScale = mScale;
 
  980   func->mScaleBasedVisibilityDetails = mScaleBasedVisibilityDetails;
 
  992     CurrentVertexZValueExpressionFunction():
 
  995                                    QStringLiteral( 
"Meshes" ) )
 
 1005       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_vertex_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1008       int vertexIndex = context->
variable( QStringLiteral( 
"_mesh_vertex_index" ) ).toInt();
 
 1010       QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( qvariant_cast<QgsMapLayer *>( context->
variable( QStringLiteral( 
"_mesh_layer" ) ) ) );
 
 1030     CurrentVertexXValueExpressionFunction():
 
 1033                                    QStringLiteral( 
"Meshes" ) )
 
 1043       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_vertex_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1046       int vertexIndex = context->
variable( QStringLiteral( 
"_mesh_vertex_index" ) ).toInt();
 
 1048       QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( qvariant_cast<QgsMapLayer *>( context->
variable( QStringLiteral( 
"_mesh_layer" ) ) ) );
 
 1068     CurrentVertexYValueExpressionFunction():
 
 1071                                    QStringLiteral( 
"Meshes" ) )
 
 1081       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_vertex_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1084       int vertexIndex = context->
variable( QStringLiteral( 
"_mesh_vertex_index" ) ).toInt();
 
 1086       QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( qvariant_cast<QgsMapLayer *>( context->
variable( QStringLiteral( 
"_mesh_layer" ) ) ) );
 
 1106     CurrentVertexExpressionFunction():
 
 1109                                    QStringLiteral( 
"Meshes" ) )
 
 1119       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_vertex_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1122       int vertexIndex = context->
variable( QStringLiteral( 
"_mesh_vertex_index" ) ).toInt();
 
 1124       QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( qvariant_cast<QgsMapLayer *>( context->
variable( QStringLiteral( 
"_mesh_layer" ) ) ) );
 
 1144     CurrentVertexIndexExpressionFunction():
 
 1147                                    QStringLiteral( 
"Meshes" ) )
 
 1157       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_vertex_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1160       return context->
variable( QStringLiteral( 
"_mesh_vertex_index" ) );
 
 1173     CurrentFaceAreaExpressionFunction():
 
 1176                                    QStringLiteral( 
"Meshes" ) )
 
 1186       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_face_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1189       int faceIndex = context->
variable( QStringLiteral( 
"_mesh_face_index" ) ).toInt();
 
 1191       QgsMeshLayer *layer = qobject_cast<QgsMeshLayer *>( qvariant_cast<QgsMapLayer *>( context->
variable( QStringLiteral( 
"_mesh_layer" ) ) ) );
 
 1196       if ( !face.isEmpty() )
 
 1204           return QVariant( area );
 
 1208           return QVariant( geom.
area() );
 
 1224     CurrentFaceIndexExpressionFunction():
 
 1227                                    QStringLiteral( 
"Meshes" ) )
 
 1237       if ( !context->
hasVariable( QStringLiteral( 
"_mesh_face_index" ) ) || !context->
hasVariable( QStringLiteral( 
"_mesh_layer" ) ) )
 
 1240       return context->
variable( QStringLiteral( 
"_mesh_face_index" ) ).toInt();
 
 1254   std::unique_ptr<QgsExpressionContextScope> scope = std::make_unique<QgsExpressionContextScope>();
 
 1256   switch ( elementType )
 
 1265       scope->addFunction( 
"$vertex_as_point", 
new CurrentVertexExpressionFunction );
 
 1266       scope->addFunction( 
"$vertex_x", 
new CurrentVertexXValueExpressionFunction );
 
 1267       scope->addFunction( 
"$vertex_y", 
new CurrentVertexYValueExpressionFunction );
 
 1268       scope->addFunction( 
"$vertex_z", 
new CurrentVertexZValueExpressionFunction );
 
 1269       scope->addFunction( 
"$vertex_index", 
new CurrentVertexIndexExpressionFunction );
 
 1276       scope->addFunction( 
"$face_area", 
new CurrentFaceAreaExpressionFunction );
 
 1277       scope->addFunction( 
"$face_index", 
new CurrentFaceIndexExpressionFunction );
 
 1284   return scope.release();
 
static QString version()
Version string.
 
static QString releaseName()
Release name.
 
static int versionInt()
Version number used for comparing versions using the "Check QGIS Version" function.
 
static void setCustomVariables(const QVariantMap &customVariables)
Custom expression variables for this application.
 
static QString osName()
Returns a string name of the operating system QGIS is running on.
 
static QString platform()
Returns the QGIS platform name, e.g., "desktop", "server", "qgis_process" or "external" (for external...
 
static QVariantMap customVariables()
Custom expression variables for this application.
 
static QString locale()
Returns the QGIS locale.
 
static void setCustomVariable(const QString &name, const QVariant &value)
Set a single custom expression variable.
 
static QString userFullName()
Returns the user's operating system login account full display name.
 
static QString userLoginName()
Returns the user's operating system login account name.
 
QString toProj() const
Returns a Proj string representation of this CRS.
 
QString ellipsoidAcronym() const
Returns the ellipsoid acronym for the ellipsoid used by the CRS.
 
QString projectionAcronym() const
Returns the projection acronym for the projection used by the CRS.
 
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
 
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
 
QgsProjOperation operation() const
Returns information about the PROJ operation associated with the coordinate reference system,...
 
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
 
double measureArea(const QgsGeometry &geometry) const
Measures the area of a geometry.
 
double convertAreaMeasurement(double area, QgsUnitTypes::AreaUnit toUnits) const
Takes an area measurement calculated by this QgsDistanceArea object and converts it to a different ar...
 
Single scope for storing variables and functions for use within a QgsExpressionContext.
 
void setFields(const QgsFields &fields)
Convenience function for setting a fields for the scope.
 
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the scope.
 
void addFunction(const QString &name, QgsScopedExpressionFunction *function)
Adds a function to the scope.
 
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
 
void setVariable(const QString &name, const QVariant &value, bool isStatic=false)
Convenience method for setting a variable in the context scope by name name and value.
 
static QgsExpressionContextScope * layoutItemScope(const QgsLayoutItem *item)
Creates a new scope which contains variables and functions relating to a QgsLayoutItem.
 
static void setLayoutMultiFrameVariable(QgsLayoutMultiFrame *frame, const QString &name, const QVariant &value)
Sets a layout multi frame context variable, with the given name and value.
 
static void setLayerVariable(QgsMapLayer *layer, const QString &name, const QVariant &value)
Sets a layer context variable.
 
static QgsExpressionContextScope * processingModelAlgorithmScope(const QgsProcessingModelAlgorithm *model, const QVariantMap ¶meters, QgsProcessingContext &context)
Creates a new scope which contains variables and functions relating to a processing model algorithm,...
 
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
 
static void setProjectVariables(QgsProject *project, const QVariantMap &variables)
Sets all project context variables.
 
static QgsExpressionContextScope * layoutScope(const QgsLayout *layout)
Creates a new scope which contains variables and functions relating to a QgsLayout layout.
 
static QgsExpressionContext createFeatureBasedContext(const QgsFeature &feature, const QgsFields &fields)
Helper function for creating an expression context which contains just a feature and fields collectio...
 
static QgsExpressionContextScope * meshExpressionScope(QgsMesh::ElementType elementType)
Creates a new scope which contains functions relating to mesh layer element elementType.
 
static void removeProjectVariable(QgsProject *project, const QString &name)
Remove project context variable.
 
static void setLayerVariables(QgsMapLayer *layer, const QVariantMap &variables)
Sets all layer context variables.
 
static void setGlobalVariables(const QVariantMap &variables)
Sets all global context variables.
 
static void setLayoutItemVariables(QgsLayoutItem *item, const QVariantMap &variables)
Sets all layout item context variables for an item.
 
static void setLayoutMultiFrameVariables(QgsLayoutMultiFrame *frame, const QVariantMap &variables)
Sets all layout multiframe context variables for an frame.
 
static QgsExpressionContextScope * processingAlgorithmScope(const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context)
Creates a new scope which contains variables and functions relating to a processing algorithm,...
 
static QgsExpressionContextScope * notificationScope(const QString &message=QString())
Creates a new scope which contains variables and functions relating to provider notifications.
 
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
 
static QgsExpressionContextScope * parentFormScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current parent attribute form/tab...
 
static void setLayoutVariable(QgsLayout *layout, const QString &name, const QVariant &value)
Sets a layout context variable.
 
static QgsExpressionContextScope * formScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current attribute form/table form...
 
static QgsExpressionContextScope * multiFrameScope(const QgsLayoutMultiFrame *frame)
Creates a new scope which contains variables and functions relating to a QgsLayoutMultiFrame.
 
static void setLayoutItemVariable(QgsLayoutItem *item, const QString &name, const QVariant &value)
Sets a layout item context variable, with the given name and value.
 
static QgsExpressionContextScope * mapToolCaptureScope(const QList< QgsPointLocator::Match > &matches)
Sets the expression context variables which are available for expressions triggered by a map tool cap...
 
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
 
static void registerContextFunctions()
Registers all known core functions provided by QgsExpressionContextScope objects.
 
static void setLayoutVariables(QgsLayout *layout, const QVariantMap &variables)
Sets all layout context variables.
 
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
 
static void removeGlobalVariable(const QString &name)
Remove a global context variable.
 
static void setGlobalVariable(const QString &name, const QVariant &value)
Sets a global context variable.
 
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
 
static void setProjectVariable(QgsProject *project, const QString &name, const QVariant &value)
Sets a project context variable.
 
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
 
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
 
bool hasVariable(const QString &name) const
Check whether a variable is specified by any scope within the context.
 
static const QString EXPR_SYMBOL_ANGLE
Inbuilt variable name for symbol angle variable.
 
QVariant variable(const QString &name) const
Fetches a matching variable from the context.
 
A abstract base class for defining QgsExpression functions.
 
static bool allParamsStatic(const QgsExpressionNodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context)
This will return true if all the params for the provided function node are static within the constrai...
 
An expression node for expression functions.
 
Class for parsing and evaluation of expressions (formerly called "search strings").
 
static bool registerFunction(QgsExpressionFunction *function, bool transferOwnership=false)
Registers a function to the expression engine.
 
QgsUnitTypes::AreaUnit areaUnits() const
Returns the desired areal units for calculations involving geomCalculator(), e.g.,...
 
QgsDistanceArea * geomCalculator()
Returns calculator used for distance and area calculations (used by $length, $area and $perimeter fun...
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
bool isValid() const
Returns the validity of this feature.
 
Container of fields for a vector layer.
 
A geometry is the spatial representation of a feature.
 
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
 
static QgsGeometry fromPointXY(const QgsPointXY &point) SIP_HOLDGIL
Creates a new geometry from a QgsPointXY object.
 
double area() const
Returns the planar, 2-dimensional area of the geometry.
 
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
 
QString nameForPage(int page) const
Returns the calculated name for a specified atlas page number.
 
QgsVectorLayer * coverageLayer() const
Returns the coverage layer used for the atlas features.
 
QgsLayout * layout() override
Returns the layout associated with the iterator.
 
bool enabled() const
Returns whether the atlas generation is enabled.
 
QString currentFilename() const
Returns the current feature filename.
 
int count() const override
Returns the number of features to iterate over.
 
int currentFeatureNumber() const
Returns the current feature number, where a value of 0 corresponds to the first feature.
 
Layout graphical items for displaying a map.
 
Item representing the paper in a layout.
 
Base class for graphical items within a QgsLayout.
 
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
 
int page() const
Returns the page the item is currently on, with the first page returning 0.
 
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
 
virtual QString uuid() const
Returns the item identification string.
 
QString id() const
Returns the item's ID name.
 
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
 
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the object.
 
const QgsLayout * layout() const
Returns the layout the object is attached to.
 
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the object.
 
QPointF pagePositionToLayoutPosition(int page, const QgsLayoutPoint &position) const
Converts a position on a page to an absolute position in layout coordinates.
 
int pageCount() const
Returns the number of pages in the collection.
 
QgsLayoutItemPage * page(int pageNumber)
Returns a specific page (by pageNumber) from the collection.
 
This class provides a method of storing points, consisting of an x and y coordinate,...
 
double dpi() const
Returns the dpi for outputting the layout.
 
QgsFeature feature() const
Returns the current feature for evaluating the layout.
 
QgsVectorLayer * layer() const
Returns the vector layer associated with the layout's context.
 
QSizeF toQSizeF() const
Converts the layout size to a QSizeF.
 
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
 
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the layout.
 
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
 
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout.
 
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the layout.
 
QgsLayoutReportContext & reportContext()
Returns a reference to the layout's report context, which stores information relating to the current ...
 
Base class for all map layer types.
 
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
 
QgsCoordinateReferenceSystem crs
 
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
 
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
 
The QgsMapSettings class contains configuration for rendering of the map.
 
QList< QgsMapLayer * > layers(bool expandGroupLayers=false) const
Returns the list of layers which will be rendered in the map.
 
double scale() const
Returns the calculated map scale.
 
QgsUnitTypes::DistanceUnit mapUnits() const
Returns the units of the map's geographical coordinates - used for scale calculation.
 
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
 
double rotation() const
Returns the rotation of the resulting map image, in degrees clockwise.
 
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
 
A marker symbol type, for rendering Point and MultiPoint geometries.
 
double angle() const
Returns the marker angle for the whole symbol.
 
Interface for master layout type objects, such as print layouts and reports.
 
Represents a mesh layer supporting display of data on structured or unstructured meshes.
 
QgsMesh * nativeMesh()
Returns native mesh (nullptr before rendering or calling to updateMesh)
 
Point geometry type, with support for z-dimension and m-values.
 
bool isEmpty() const override SIP_HOLDGIL
Returns true if the geometry is empty.
 
Abstract base class for processing algorithms.
 
QString id() const
Returns the unique ID for the algorithm, which is a combination of the algorithm provider's ID and th...
 
Contains information about the context in which a processing algorithm is executed.
 
QgsProject * project() const
Returns the project in which the algorithm is being executed.
 
QString description() const
Description.
 
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
QgsExpressionContextScope * createExpressionContextScope() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
 
QString absoluteFilePath() const
Returns full absolute path to the project file if the project is stored in a file system - derived fr...
 
QVariantMap customVariables() const
A map of custom project variables.
 
void setCustomVariables(const QVariantMap &customVariables)
A map of custom project variables.
 
QgsProjectStorage * projectStorage() const
Returns pointer to project storage implementation that handles read/write of the project file.
 
double height() const SIP_HOLDGIL
Returns the height of the rectangle.
 
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
 
QgsPointXY center() const SIP_HOLDGIL
Returns the center point of the rectangle.
 
Expression function for use within a QgsExpressionContextScope.
 
QSet< QString > referencedColumns(const QgsExpressionNodeFunction *node) const override
Returns a set of field names which are required for this function.
 
bool isStatic(const QgsExpressionNodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context) const override
Will be called during prepare to determine if the function is static.
 
bool usesGeometry(const QgsExpressionNodeFunction *node) const override
Does this function use a geometry object.
 
QVariant func(const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction *node) override=0
Returns result of evaluating the function.
 
virtual QgsScopedExpressionFunction * clone() const =0
Returns a clone of the function.
 
Abstract base class for all rendered symbols.
 
QColor color() const
Returns the symbol's color.
 
const QgsDateTimeRange & temporalRange() const
Returns the datetime range for the object.
 
bool isTemporal() const
Returns true if the object's temporal range is enabled, and the object will be filtered when renderin...
 
static Q_INVOKABLE QString toString(QgsUnitTypes::DistanceUnit unit)
Returns a translated string representing a distance unit.
 
Represents a vector layer which manages a vector based data sets.
 
QgsFields fields() const FINAL
Returns the list of fields of this layer.
 
static double scaleToZoom(double mapScale, double z0Scale=559082264.0287178)
Finds zoom level given map scale denominator.
 
static int scaleToZoomLevel(double mapScale, int sourceMinZoom, int sourceMaxZoom, double z0Scale=559082264.0287178)
Finds the best fitting zoom level given a map scale denominator and allowed zoom level range.
 
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
 
CORE_EXPORT QgsGeometry toGeometry(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns face as polygon geometry.
 
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
 
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
 
QVector< int > QgsMeshFace
List of vertex indexes.
 
Single variable definition for use within a QgsExpressionContextScope.
 
int vertexCount() const
Returns number of vertices.
 
QVector< QgsMeshVertex > vertices
 
QgsMeshFace face(int index) const
Returns a face at the index.
 
int faceCount() const
Returns number of faces.
 
ElementType
Defines type of mesh elements.
 
QgsMeshVertex vertex(int index) const
Returns a vertex at the index.