|
24 | 24 | #include <memory> |
25 | 25 | #include <deque> |
26 | 26 |
|
| 27 | +#include "qgsexpressioncontext.h" |
27 | 28 | #include "qgsrectangle.h" |
28 | 29 | #include "qgspoint.h" |
29 | 30 | #include "qgis.h" |
@@ -409,6 +410,24 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView |
409 | 410 | */ |
410 | 411 | void setSnappingUtils( QgsSnappingUtils* utils ); |
411 | 412 |
|
| 413 | + /** Sets an expression context scope for the map canvas. This scope is injected into the expression |
| 414 | + * context used for rendering the map, and can be used to apply specific variable overrides for |
| 415 | + * expression evaluation for the map canvas render. This method will overwrite the existing expression |
| 416 | + * context scope for the canvas. |
| 417 | + * @param scope new expression context scope |
| 418 | + * @note added in QGIS 2.12 |
| 419 | + * @see expressionContextScope() |
| 420 | + */ |
| 421 | + void setExpressionContextScope( const QgsExpressionContextScope& scope ) { mExpressionContextScope = scope; } |
| 422 | + |
| 423 | + /** Returns a reference to the expression context scope for the map canvas. This scope is injected |
| 424 | + * into the expression context used for rendering the map, and can be used to apply specific variable |
| 425 | + * overrides for expression evaluation for the map canvas render. |
| 426 | + * @note added in QGIS 2.12 |
| 427 | + * @see setExpressionContextScope() |
| 428 | + */ |
| 429 | + QgsExpressionContextScope& expressionContextScope() { return mExpressionContextScope; } |
| 430 | + |
412 | 431 | public slots: |
413 | 432 |
|
414 | 433 | /** Repaints the canvas map*/ |
@@ -698,6 +717,8 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView |
698 | 717 |
|
699 | 718 | QgsSnappingUtils* mSnappingUtils; |
700 | 719 |
|
| 720 | + QgsExpressionContextScope mExpressionContextScope; |
| 721 | + |
701 | 722 | }; // class QgsMapCanvas |
702 | 723 | Q_NOWARN_DEPRECATED_POP |
703 | 724 |
|
|
0 commit comments