2310 Commits

Author SHA1 Message Date
Nyall Dawson
fdb6488b97 [expressions] Support date + time = datetime calculations 2016-05-23 07:45:30 +10:00
Matthias Kuhn
50c7970ed4 Use unittest assertXXX methods 2016-05-22 21:52:55 +02:00
Alessandro Pasotti
ff4532c3ac [server] Fix pep8 build error 2016-05-20 11:37:52 +02:00
Alessandro Pasotti
eef0486cd3 [server] Removed debug print from the test 2016-05-20 09:59:57 +02:00
Alessandro Pasotti
10e8807655 [server] Added regression test for #8656
Ref. commit b956874f02a9379
2016-05-20 09:57:17 +02:00
Nyall Dawson
d73210a5f8 Update test mask image 2016-05-19 21:04:50 +10:00
Nyall Dawson
c0799d4764 Fix deprecated warning 2016-05-19 15:11:03 +10:00
Denis Rouzaud
1602c02df7 Merge pull request #3009 from pblottiere/magnifier
[FEATURE] add a map canvas magnifier
2016-05-19 06:30:07 +02:00
Nyall Dawson
23a3a7717e Cleaner API for selecting features in QgsVectorLayer
- add selectByRect( QgsRectangle&, SelectBehaviour) and
selectByIds( QgsFeatureIds, SelectBehaviour) for selecting
by rect and ids respectively, with options to add to selection/
remove from selection/intersect with current selection
- deprecate select( QgsRectangle ) and setSelectedFeatures in
favour of new methods
- add unit tests
2016-05-19 12:30:32 +10:00
Nyall Dawson
b951d5a54d [FEATURE] new method QgsVectorLayer::selectByExpression(...)
Makes it simple for scripts to select by expression. The method
also accepts a parameter which dictates whether matching features
are added to an existing selection, removed from the selection
or intersected with the current selection.

The existing code from the select by expression dialog has been
moved to QgsVectorLayer, and optimised for maximum possible speed.

Also added unit tests.
2016-05-19 09:11:00 +10:00
Blottiere Paul
f15197da73 add unit test for scale 2016-05-18 14:40:47 +02:00
Martin Dobias
a9c1996bbc Merge pull request #3064 from wonder-sk/composer-map-follow-preset
Composer map to follow a visibility preset
2016-05-18 11:08:43 +08:00
Blottiere Paul
eb9ab8a4d9 add unit test for extent 2016-05-18 01:55:44 +02:00
Nyall Dawson
e92dc26c68 Followup feeeaf0, add unit tests 2016-05-18 09:33:17 +10:00
Even Rouault
aa66bc6a20 Merge pull request #3076 from rouault/delimitedtext_qt5_fix
Delimited text provider: fix parsing of subset URL parameter with QT 5 and fix tests
2016-05-17 17:00:36 +02:00
Even Rouault
8ee697bf2d Vector layer save as: usability tunings related to attribute selection
- The group is renamed as 'Select fields to export and their export options'
- It has no longer a checkbox. It is just collapsible. So
  QgsVectorLayerSaveAsDialog::attributeSelection() is deprecated and always
  return true.
- For most formats, all attributes are selected by default
- For CSV/XLSX/ODS, if they have edit widgets, the corresponding checkbox in
  "Replace with displayed values" column is also checked by default.
- For DXF, keep existing behaviour: attributes are unchecked and not checkable
- For KML, keep existing behaviour: attributes are unselected by default
2016-05-17 16:57:45 +02:00
Martin Dobias
7eb05e2c3c Fix composer map tests 2016-05-17 12:52:32 +08:00
Nyall Dawson
307aabd66a [FEATURE] Aggregates for expressions
This commit adds a number of different forms of aggregates to
the expression engine.

1. Aggregates within the current layer, eg sum("passengers")
Supports sub expressions (ie sum("passengers"/2) ), group by
( sum("passengers", group_by:="line_segment") ), and optional
filters ( sum("passengers", filter:= "station_class" > 3 ) )

2. Relational aggregates, which calculate an aggregate over
all matching child features from a relation, eg
relation_aggregate( 'my_relation', 'mean', "some_child_field" )

3. A summary aggregate function, for calculating aggregates
on other layers. Eg aggregate('rail_station_layer','sum',"passengers")
The summary aggregate function supports an optional filter,
making it possible to calculate things like:

aggregate('rail_stations','sum',"passengers",
  intersects(@atlas_geometry, $geometry ) )

for calculating the total number of passengers for the stations
inside the current atlas feature

In all cases the calculations are cached inside the expression
context, so they only need to be calculated once for each
set of expression evaluations.

Sponsored by Kanton of Zug, Switzerland
2016-05-17 10:53:25 +10:00
Nyall Dawson
ea066599a1 [relations] Add method to manager to retrieve relations by name
Also
- Begin unit tests for QgsRelationManager
- Make project optional when constructing QgsRelationManager
2016-05-17 10:53:25 +10:00
Nyall Dawson
84fc3c3b3d Implement method for caching values within expression contexts
Can be used to store the results of expensive sub-expression
calculations (eg layer aggregates), so that future expression
evaluation using the same context does not have to recalculate
the cached values.
2016-05-17 10:53:24 +10:00
Nyall Dawson
821134ca91 Add method to convert string to aggregate type 2016-05-17 10:53:24 +10:00
Nyall Dawson
dcc047af49 Add possibility to handle aggregate calculation at data provider
(not implemented for any providers yet)
2016-05-17 10:53:24 +10:00
Nyall Dawson
50e41c8133 New utility class QgsAggregateCalculator, simplifies calculating
aggregates from vector layer fields and expressions
2016-05-17 10:53:24 +10:00
Nyall Dawson
1c45b940a8 Add calculation of number of null values to QgsStatisticalSummary 2016-05-17 10:53:04 +10:00
Nyall Dawson
4dea723cae Add methods to stats calculators to accept values one at a time
This can be more efficient for large quantities of values, since
it avoids the need to create a list of all values in advance
2016-05-17 10:52:06 +10:00
Even Rouault
902953ca9a Delimited text provider: fix parsing of subset URL parameter with QT 5 and fix tests
In Qt 4, QUrl::queryItemValue() decodes a value that contains %25 as %, whereas
it doesn't with Qt5.
2016-05-16 23:41:00 +02:00
Juergen E. Fischer
c198b1afe9 indentation fix 2016-05-16 16:59:29 +02:00
Nyall Dawson
858914eef5 Ensure that providers fetch geometry for a QgsFeatureRequest
with an expression filter which requires geometry
2016-05-16 23:09:18 +10:00
Juergen E. Fischer
b514f521e6 cppcheck fixes 2016-05-16 14:14:14 +02:00
Matthias Kuhn
ee533a7dea Add test for attribute table sorting 2016-05-16 11:16:13 +02:00
Nyall Dawson
5c7f4c7664 Merge pull request #3072 from rouault/qt5_fix_testqgsfield
Make qgis_fieldtest all Qt 5.X compatible
2016-05-16 07:04:43 +10:00
Even Rouault
c4819adea4 Merge remote-tracking branch 'rouault/fix_qt5_wfs_ogcutils_tests' 2016-05-15 21:30:56 +02:00
Even Rouault
202420c70a Make qgis_fieldtest all Qt 5.X compatible
In https://codereview.qt-project.org/#/c/99815/ implemented in QT 5.5,
doubles are converted to strings using '%.17g', so short decimal values
might be expanded to long strings depending on their values.
https://wiki.qt.io/New_Features_in_Qt_5.7 has a logic to avoid this, but
if we select carefully the double to have both an exact binary and decimal
representation, that can work will all versions.

$ python -c "print('%.17g' % 9.7)"
9.6999999999999993

$ python -c "print('%.17g' % 1.25)"
1.25
2016-05-15 19:44:13 +02:00
Even Rouault
9a49c6aace Make ogcutils and WFS tests Qt 5 compatible 2016-05-15 19:17:58 +02:00
Nyall Dawson
a3d6227e2e Avoid detaching temporary containers 2016-05-15 20:50:44 +10:00
Nyall Dawson
57d114e2e2 Update test masks for Qt5, enable labeling tests 2016-05-15 20:38:38 +10:00
Even Rouault
abd182c50c Merge pull request #3061 from rouault/saveas_human_readable_values
[FEATURE] Export vector layer with "human-readable" values from edit widgets
2016-05-14 14:23:10 +02:00
Even Rouault
90cc0ed495 QgsVectorLayerSaveAsDialog: add checkboxes to decide which fields should be exported with their displayed values, and bind it in QgisApp with QgsVectorFileWriter 2016-05-14 12:33:10 +02:00
Even Rouault
038b3b7950 QgsVectorFileWriter: add capability to export displayed values of fields (typically coming from edit widgets) instead of their raw values 2016-05-14 12:33:10 +02:00
Matthias Kuhn
10134587ed Add note for failing Qt5 test 2016-05-14 00:38:19 +02:00
Matthias Kuhn
af1de6e3e0 Migrate more tests to Python3 2016-05-14 00:02:20 +02:00
Matthias Kuhn
7dfc69657f Migrate provider test to python 3 2016-05-13 22:23:03 +02:00
Even Rouault
8259b3fcc9 QgsSQLStatement::quotedIdentifierIfNeeded(): make it quote SQL reserved keywords 2016-05-12 23:24:39 +02:00
Even Rouault
84a797ea86 [FEATURE] [WFS provider] Add support for WFS 2.0 joins and other improvements
Second part of qgis/QGIS-Enhancement-Proposals#53
(QEP 35: WFS provider enhancements)

- URI parameter with sql with SELECT / FROM / JOIN / WHERE / ORDER BY clauses
- handle WFS 2.0 joins
- handle DateTime fields
- enable "Only request features overlapping the view extent" by default (and memorize the settings)
- rework DescribeFeatureType parsing to handle responses with several documents, and some support for attribute types being complexType
- rework feature transfer between downloader and iterator so as to avoid uncontrolled RAM usage when the iterator cannot keep up with the downloader
- turn on WAL journaling for better reader / writer concurrency
- add retry logic based on the 'Max retry in case of tile request errors' setting (renamed 'Max retry in case of tile or feature request errors')
- error to MessageBar in case of failed download
- in progress dialog, add a "Hide" button to mask the dialog
- improve automated testing
- add testing of the GUI of QgsWFSSourceSelect
2016-05-12 23:24:39 +02:00
Even Rouault
1da1c278e7 QgsOgcUtils: add conversion from QgsSQLStatement to OGC filters 2016-05-12 23:24:39 +02:00
Even Rouault
84129604a9 Add a QgsSQLComposerDialog GUI to edit QgsSQLStatement 2016-05-12 23:24:39 +02:00
Even Rouault
9df19e0133 Add QgsSQLStatement class to parse SELECT statements 2016-05-12 23:24:39 +02:00
Even Rouault
12a630f050 QgsGML: extend to be able to parse WFS 2.0 GetFeature response with join layers
And also fix handling srsDimension=3 on main GML geometry objects and not only posList
2016-05-12 23:23:44 +02:00
Even Rouault
b38a16fe2e Implement representValue() for Relation Reference widget 2016-05-12 19:52:26 +02:00
Blottiere Paul
b930a4b5e2 fix extent 2016-05-12 17:42:55 +02:00