QGIS API Documentation
4.3.0-Master (4ecdf0f3f59)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
vector
qgsvectorlayertoolscontext.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsvectorlayertoolscontext.cpp
3
------------------------
4
begin : May 2024
5
copyright : (C) 2024 by Mathieu Pellerin
6
email : mathieu at opengis dot ch
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#include "
qgsvectorlayertoolscontext.h
"
17
18
#include <memory>
19
20
#include "
qgsexpressioncontextutils.h
"
21
22
QgsVectorLayerToolsContext::QgsVectorLayerToolsContext
(
const
QgsVectorLayerToolsContext
&other )
23
: mParentWidget( other.mParentWidget )
24
, mShowModal( other.mShowModal )
25
, mHideParent( other.mHideParent )
26
{
27
if
( other.mAdditionalExpressionContextScope )
28
{
29
mAdditionalExpressionContextScope = std::make_unique<QgsExpressionContextScope>( *other.mAdditionalExpressionContextScope );
30
}
31
if ( other.mExpressionContext )
32
{
33
mExpressionContext = std::make_unique<QgsExpressionContext>( *other.mExpressionContext );
34
}
35
}
36
37
QgsVectorLayerToolsContext
&
QgsVectorLayerToolsContext::operator=
(
const
QgsVectorLayerToolsContext
&other )
38
{
39
if
( &other ==
this
)
40
return
*
this
;
41
42
mParentWidget = other.mParentWidget;
43
mShowModal = other.mShowModal;
44
mHideParent = other.mHideParent;
45
if
( other.mAdditionalExpressionContextScope )
46
{
47
mAdditionalExpressionContextScope = std::make_unique<QgsExpressionContextScope>( *other.mAdditionalExpressionContextScope );
48
}
49
if
( other.mExpressionContext )
50
{
51
mExpressionContext = std::make_unique<QgsExpressionContext>( *other.mExpressionContext );
52
}
53
else
54
{
55
mExpressionContext.reset();
56
}
57
return
*
this
;
58
}
59
60
void
QgsVectorLayerToolsContext::setExpressionContext
(
const
QgsExpressionContext
*context )
61
{
62
if
( context )
63
mExpressionContext = std::make_unique<QgsExpressionContext>( *context );
64
else
65
mExpressionContext.reset();
66
}
67
68
QgsExpressionContext
*
QgsVectorLayerToolsContext::expressionContext
()
const
69
{
70
return
mExpressionContext.get();
71
}
72
73
void
QgsVectorLayerToolsContext::setAdditionalExpressionContextScope
(
const
QgsExpressionContextScope
*scope )
74
{
75
if
( scope )
76
mAdditionalExpressionContextScope = std::make_unique<QgsExpressionContextScope>( *scope );
77
else
78
mAdditionalExpressionContextScope.reset();
79
}
80
81
const
QgsExpressionContextScope
*
QgsVectorLayerToolsContext::additionalExpressionContextScope
()
const
82
{
83
return
mAdditionalExpressionContextScope.get();
84
}
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition
qgsexpressioncontext.h:119
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition
qgsexpressioncontext.h:491
QgsVectorLayerToolsContext::QgsVectorLayerToolsContext
QgsVectorLayerToolsContext()=default
QgsVectorLayerToolsContext::additionalExpressionContextScope
const QgsExpressionContextScope * additionalExpressionContextScope() const
Returns an additional expression context scope to be made available when calculating expressions.
Definition
qgsvectorlayertoolscontext.cpp:81
QgsVectorLayerToolsContext::setExpressionContext
void setExpressionContext(const QgsExpressionContext *context)
Sets the optional expression context used by the vector layer tools.
Definition
qgsvectorlayertoolscontext.cpp:60
QgsVectorLayerToolsContext::operator=
QgsVectorLayerToolsContext & operator=(const QgsVectorLayerToolsContext &other)
Definition
qgsvectorlayertoolscontext.cpp:37
QgsVectorLayerToolsContext::expressionContext
QgsExpressionContext * expressionContext() const
Returns the optional expression context used by the vector layer tools.
Definition
qgsvectorlayertoolscontext.cpp:68
QgsVectorLayerToolsContext::setAdditionalExpressionContextScope
void setAdditionalExpressionContextScope(const QgsExpressionContextScope *scope)
Sets an additional expression context scope to be made available when calculating expressions.
Definition
qgsvectorlayertoolscontext.cpp:73
qgsexpressioncontextutils.h
qgsvectorlayertoolscontext.h
Generated on
for QGIS API Documentation by
1.17.0