65 Commits

Author SHA1 Message Date
Nyall Dawson
44289084e9 Optimise passing of variables by ref/value 2016-10-24 10:36:23 +10:00
Matthias Kuhn
96a649e37f Add missing bindings 2016-10-23 21:14:42 +02:00
Matthias Kuhn
54b953f433 Cleanup and modernize QgsProject code 2016-10-23 20:54:41 +02:00
Matthias Kuhn
85c105d6b0 Move management of avoidIntersectionLayers to QgsProject 2016-10-20 12:56:35 +02:00
Matthias Kuhn
5c919fbcca Move topological editing setting management fully to QgsProject 2016-10-20 12:56:35 +02:00
Denis Rouzaud
64d3c788f1 Use toolbar or status bar for snapping config 2016-10-20 12:56:35 +02:00
Matthias Kuhn
e0fc641402 Show commit errors in transaction mode 2016-10-18 15:47:42 +02:00
Nyall Dawson
ecee43814a Fix changing project CRS from legend doesn't correctly set CRS
Also avoid fragile duplicated code for setting/retrieving
common project properties

Fixes #15717
2016-10-18 09:55:56 +10:00
Nyall Dawson
fe65063c2b Remove many deprecated methods 2016-09-15 18:34:15 +10:00
Matthias Kuhn
bcae877fab Fix doxygen 2016-08-19 16:53:54 +02:00
Matthias Kuhn
58ea21124e Streamline expression context generation (#3350)
* Save more data to QML

 * Virtual fields
 * Map tips
 * Display expression
 * Read only flag

* Streamline expression context generation

Whenever an object is able to generate an expression context it
implements the method createExpressionContext() declared in
QgsExpressionContextGenerator.

This makes a cleaner API and allows using QgsFieldExpressionWidget and
QgsDataDefinedButton from python because standard OO programming
approaches are used instead of callbacks and void pointers.

* Colorize output of doc and sip tests

* Fix build

* Fix sip complaints

* Fix rebase problems

* Workaround failing bindings test
2016-08-10 19:44:30 +02:00
Matthias Kuhn
3e33e686c1 Rename visibility presets to map themes
Because it is not only more descriptive for what it does but also
sounds more interesting.

[needs-docs]
2016-08-01 12:23:44 +02:00
Nyall Dawson
f6f5010131 Move QGis::UnitType to QgsUnitTypes::DistanceUnit
This change consolidates more unit handling and conversion into
QgsUnitTypes.

Additionally, UnknownUnit was renamed to UnknownDistanceUnit.
All methods which accepted QGis::UnitType parameters have been
updated to take QgsUnitTypes::DistanceUnit instead.

ALso remove the unit handling methods toLiteral, fromLiteral, tr,
fromTr, and fromUnitToUnitFactor from QGis. Their corresponding
counterparts in QgsUnitTypes should be used instead.
2016-07-25 14:47:16 +10:00
Nyall Dawson
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
Nyall Dawson
c7ffdfa5e9 Make sure variable editor widgets always show current variables
On behalf of Faunalia, sponsored by ENEL
2016-07-19 12:00:35 +10:00
Nyall Dawson
4145e337ab Add missing SIP bindings 2016-07-11 08:42:52 +10:00
Nyall Dawson
3a34368efb Cleanup qgsproject.h/.cpp
- Conslidate doxygen in qgsproject.h
- Remove TODOs from docs, move to comments
- Cosmetic formatting changes to match QGIS standards
- Remove doxygen groups (we sort doxygen by name now)
- Clarified and improved some docs
- Remove mega outdated XML samples
2016-06-14 10:24:20 +10:00
Matthias Kuhn
95f81391d3 sip bindings 2016-06-03 15:13:42 +02:00
Sandro Mani
bded2b518c Remove QgsBillboardRegistry 2016-06-03 12:58:03 +02:00
Sandro Mani
3e73064c4a Store QgsBillBoardRegistry in QgsProject instead of making it a singleton 2016-05-28 17:10:10 +02:00
Matthias Kuhn
4586a787b0 Move AutoTransaction setting to project properties
Was in global app settings
2016-04-06 12:17:38 +02:00
Matthias Kuhn
9c0a291046 Deprecate QgsProject::dirty( bool ) in favor of QgsProject::setDirty 2016-04-05 14:47:56 +02:00
Matthias Kuhn
54219c571f Centralize handling of non-identifiable layers in QgsProject 2016-03-29 08:27:53 +02:00
Juergen E. Fischer
5c4bf99ce2 debian packaging update: manually merge some changes from PR#2818 and
some spelling fixes.
2016-02-20 16:55:16 +01:00
Nyall Dawson
dfdcec8922 Fix project unit confusion (pt 3): add area unit settings with a
ton of available area units (eg m2, km2, mi2, ft2, yd2, ha, ac,
etc)

Adds a new option in both the QGIS setting and project properties to
set the units used for area measurements. Just like the distance
setting, this defaults to the units set in QGIS options, but can
then be overridden for specific projects.

The setting is respected for area calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values

Also adds unit tests to ensure that area calculated by attribute table
update bar, field calculator and identify tool are consistent wrt
ellipsoidal calculations and area units.

TODO: make measure tool respect area setting

(refs #13209, #4252 and fixes #12939, #2402, #4857)
2016-02-15 12:47:36 +11:00
Nyall Dawson
ddbdcf8ab1 Fix project unit confusion (pt 2): add project distance unit setting
Adds a new option in project properties to set the units used for
distance measurements. This setting defaults to the units set in
QGIS options, but can then be overridden for specific projects.

The setting is respected for length and perimeter calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values
- Default unit shown in measure dialog

Also adds unit tests to ensure that length and perimeter calculated
by attribute table update bar, field calculator and identify tool
are consistent wrt ellipsoidal calculations and distance units.

(refs #13209, #12939, #2402, #4857, #4252)
2016-02-14 21:04:41 +11:00
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50: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
Matthias Kuhn
d795e508cc Merge pull request #469 from olivierdalang/SanitizeEntryNames
Warning about invalid entry names
2015-11-20 18:03:44 +01:00
Nyall Dawson
fe221d54bf Don't return QStrings by reference, since they're implicitly shared
anyway
2015-10-28 09:47:44 +11:00
Nyall Dawson
f1633a1796 Change all signals to use const refs for non trivial objects 2015-10-26 22:46:25 +11:00
Nyall Dawson
70bff3f6aa Finish flipping a lot of methods to take const references for
non-trivial types
2015-10-26 22:46:14 +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
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
Nyall Dawson
73522dce7e Refactor visibility presets, so that all non-app specific
methods are now in core

A new QgsVisibilityPresetCollection object has been created
which stores a set of visibility presets. QgsProject now
contains a preset collection object.

This allows plugins and other core objects to retrieve and
modify visibility presets.
2015-08-19 19:07:23 +10:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Juergen E. Fischer
e2e23f0c8e snapping dialog: block signals when reloading snapping options
QgsProject: also apply default when property is not available and not only if
an existing one is invalid

fixes #12192
2015-02-15 13:55:43 +01:00
Juergen E. Fischer
b49da36c7f * Save and restore visiblity state of embedded group layers (fixes #4097)
* Adds support for lists in custom properties
2015-01-13 14:55:03 +01:00
Juergen E. Fischer
9ceb5ceab6 sip sync 2014-11-21 01:17:21 +01:00
Nathan Woodrow
e5850f38b1 Fix #10858 - Set relative path to QLR save folder. Load relative to QLR file 2014-10-06 22:55:27 +10:00
Martin Dobias
73358c3a7e [layertree] Add python bindings - part one (core) 2014-06-03 19:27:28 +07:00
olivierdalang
313fe6a98f check validity of keys used by writeEntry and readEntry
and print a message in the console in case of invalid key

update of docstrings (obsolete note removed, note added)
2014-06-01 14:58:20 +02:00
Juergen E. Fischer
a3628a6702 fix sip sync merge 2014-05-27 23:51:29 +02:00
Juergen E. Fischer
c4c131ef75 sip sync 2014-05-27 23:32:42 +02:00
Juergen E. Fischer
74e7314c36 update sip bindings II 2014-01-27 09:22:53 +01:00
Juergen E. Fischer
d4e369414b update sip bindings 2014-01-26 18:36:29 +01:00
Juergen E. Fischer
fa0a9b75fe don't reload the whole browser model when the project home changes (fixes #7520) 2013-05-12 23:23:24 +02:00
Matthias Kuhn
def681c226 Add API to write and read custom data to the layer in a .qgs-file.
New signals:
 * void QgsProject::writeMapLayer( QgsMapLayer*, QDomElement&,  QDomDocument& )
 * void QgsProject::readMapLayer( QgsMapLayer*, const QDomElement& )

Changed method signature:
 * bool QgsMapLayer::readXML( const QDomNode& )
   => bool QgsMapLayer::readLayerXML( const QDomElement& )
 * bool QgsMapLayer::writeXML( QDomNode&, QDomDocument& )
   => bool QgsMapLayer::writeLayerXML( QDomElement&, QDomDocument& )
2013-05-02 09:40:26 +02:00
Denis Rouzaud
706ac99a83 switched default and ok arguments 2013-03-06 15:07:04 +01:00
Denis Rouzaud
978d6773cb Added default value argument for readEntryList 2013-03-06 14:19:37 +01:00