23 Commits

Author SHA1 Message Date
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50:49 +01:00
Nyall Dawson
6893f4941d Properly fix doxygen warning 2016-01-27 14:40:51 +11:00
Nyall Dawson
59f418b763 Revert "Fix doxygen warning"
This reverts commit 9e1a2359ba7aab9094544f85ba04efceceedf5f6.
2016-01-27 14:40:01 +11:00
Nyall Dawson
9e1a2359ba Fix doxygen warning 2016-01-27 14:38:05 +11:00
Nyall Dawson
fe95e4eeea Show variables from symbol scope in symbol layer widget expression
builders. (This lets users know they are available).

Also swap some variable names to static strings for speed.
2016-01-27 13:58:32 +11:00
Nyall Dawson
8ad6ca08fe Fix some memory leaks identified by Coverity
Also improve the API for QgsExpressionContextUtils::updateSymbolScope
Previously it was hard to predict if the method would create storage,
which caused issues for the python bindings (eg, they had a choice of
either leaking or being crashy).
2016-01-24 15:17:17 +11:00
Matthias Kuhn
8d72f13a57 [25d] Improve convertability to other layers
* Move height and angle expressions for 2.5D renderer to layer
 * Apply color based on main symbol color

This makes the transition to other renderers easy.

Fixes #14132
2016-01-21 22:37:51 +01:00
Matthias Kuhn
4e9afcec4c Expression variable for the currently rendered part
During rendering, two new variables will be available:

  * `geometry_part_count`
  * `geometry_part_num` (1-based index)

Useful to apply different styles to different parts of multipart
features
2016-01-13 08:17:49 +01:00
Nyall Dawson
881074b194 Boost coverage of SIP bindings
Now all classes and members are either exposed to bindings or marked
as "not available in Python bindings" in the docs.

Drop test thresholds to 0. Now it should be much easier to determine
what missing members have been added which are causing test
failures.
2016-01-05 11:16:15 +11:00
Nyall Dawson
c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00
Nyall Dawson
a8f8cfefe5 Finish implementation of @value context variable 2015-10-01 15:42:02 +10:00
Nyall Dawson
390ea4e9ba Sort variables in variable editor 2015-09-11 17:11:48 +10:00
Nyall Dawson
bd2d78cea9 Ensure that select atlas variables are shown in expression builder
...even when they don't currently have a value assigned. This helps
users know which variables will be available in certain contexts.
2015-09-08 17:31:52 +10:00
Nyall Dawson
829ff50200 Expose map settings (rotation, scale) through expression contexts 2015-09-07 20:24:56 +10:00
Nyall Dawson
1c079ead02 Expression context fixes:
- Fix python API break in QgsExpression::Function
- Add convenience methods for retrieving feature/fields from a
context
2015-09-05 22:03:16 +10:00
Nyall Dawson
4bf8b131e3 Port conditional styles to expression contexts 2015-08-22 19:01:43 +10:00
Nyall Dawson
85bda6c05f Add method for highlighting variables in the expression builder 2015-08-22 19:01:42 +10:00
Nyall Dawson
f74db81b9a Hide contextual functions from builder unless provided by context 2015-08-22 19:01:42 +10:00
Nyall Dawson
a7d8519c7f Ensure context is available to builders from data defined buttons 2015-08-22 19:01:42 +10:00
Nyall Dawson
bfc8f56ad4 Display variables and functions from contexts in expression builder 2015-08-22 19:01:42 +10:00
Nyall Dawson
a0e35a3893 Switch some composer expressions to contexts 2015-08-22 19:01:39 +10:00
Nyall Dawson
d6542276e7 Add a bunch of layer related variables, including things like
metadata, extent, crs, feature count, geometry types, etc...
2015-08-22 19:01:39 +10:00
Nyall Dawson
f6e0ce788e New framework for context based expressions
This commit adds the ability for expressions to be evaluated against
specific contexts. It replaces the previous behaviour where
expressions were evaluated against a specific feature and could
utilise fragile global "special columns".

Now, expressions are instead evaluated using a context designed for
each individual expression. This is done via QgsExpressionContext
and QgsExpressionContextScope objects.

A QgsExpressionContextScope encapsulates the variables and functions
relating to a specific context. For instance, scopes can be created
for "global" variables (such as QGIS version, platform, and user-set
variables specified within the QGIS options dialog. Think things
like user name, work department, etc), or for "project" variables
(eg project path, title, filename, and user-set variables set
through the project properties dialog. Project version, reference
number, that kind of thing). Many more scopes are planned, including
map layer scopes (variables for layer name, id, user-set variables
through the layer properties dialog), composer scopes, etc...

QgsExpressionContextScopes are 'stacked' into a QgsExpressionContext
object. Scopes added later to a QgsExpressionContext will override
any variables or functions provided by earlier scopes, so for
instance a user could override their global 'author' variable set
within QGIS options with a different 'author' set via the project
properties dialog.

The intended use is that a QgsExpressionContext is created before
a batch set of QgsExpression evaluations. Scopes are then added to
the context based on what makes sense for that particular
expression. Eg, almost all contexts will consist of the global
scope and project scope, and then additional scopes as required.
So a composer label would be evaluated against a context
consisting of the global scope, project scope, composition scope
and finally composer item scope. The batch set of expression
evaluations would then be performed using this context, after which
the context is discarded. In other words, a context is designed
for use for one specific set of expression evaluations only.
2015-08-22 19:01:39 +10:00