2488 Commits

Author SHA1 Message Date
Even Rouault
f3b635dcbb [GDAL provider] Ignore nodata value that are not representable in the data type.
This is related to commit e0d38ba3f912b7ae6b34e66a44e529ec37394458. In case
we have to deal with an inconsitent raster where the nodata value is set to
a value not representable in the data type, ignore it. Otherwise, a NaN value
in a Byte raster would be cast as 0.
2016-05-29 12:55:23 +02:00
Patrick Valsecchi
69bed21837 WMS: Better logic to pick the legend URL
QGIS had two problems:
1) It was using the specified legend URL only if its mime type was matching
   the layer's mime type. There is no reason for that.
2) When QGIS was using the default layer (empty string), it was not even
   trying to find out in what style to pick the legend URL.
2016-05-29 12:47:57 +02:00
Patrick Valsecchi
e79a327ab7 WMS GetCapabilities: override parent's style if they have the same name
When there is a layer group with several sub-layers, the group has a
"default" style and the sub-layers each have a "default" layer. QGIS
was showing two "default" styles for the sub-layers, which would be
confusing to the user and could pick the wrong legend for the
sub-layer if the user picked the wrong entry (the first one).

Had to create a static lib for wmsprovider in order to unittest it.
2016-05-29 12:47:57 +02:00
Even Rouault
147a68c0a0 Do not print excessive decimals when identifying value on a Float32 raster
Was reported in https://lists.osgeo.org/pipermail/qgis-user/2016-April/036045.html
2016-05-29 12:43:20 +02:00
Nyall Dawson
1b06324d24 Fix failing server label test 2016-05-29 16:11:46 +10:00
Nyall Dawson
7cab60bc43 [FEATURE][expressions] If a feature is passed to a function
expecting geometry inputs, then use that feature's geometry
instead of throwing an error

eg

buffer(@atlas_feature,100)

or

buffer(get_feature('my_layer','id=54'))
2016-05-29 15:32:16 +10:00
Mathieu Pellerin
36ff0ba333 [FEATURE] add a char() function to the expression engine (#3137) 2016-05-29 14:38:53 +10:00
Nyall Dawson
bae8a0e5e0 [FEATURE] Georeference outputs (eg PDF) from composer
This commit makes composer automatically georeference outputs
(where output format makes this possible, eg TIF and PDF).

The existing option to create a world file has been separated
from the map selection for georeferencing. The new behaviour
is to always georeference outputs, and only create the
separate world file if that option is checked.
2016-05-29 00:46:39 +10:00
Nyall Dawson
bc779a06ed QgsActionManager: improve docs + add tests 2016-05-29 00:45:17 +10:00
Even Rouault
e0d38ba3f9 QgsRasterFileWriter::writeDataRaster(): do not set nodata on output when unneeded
Currently if the source raster has no nodata value, the writer will still write
nan as the output nodata value, ignoring the flag that specifies if there is a
nodata value or not. On a raster with byte data type, this will cause
confusion on reading since the nodata value will be somehow cast as 0.

Make QgsRasterChecker check for nodata consistency between source and target, and
add a test file that shows the issue.
2016-05-28 10:52:36 +02:00
Even Rouault
2861cf1dc3 QgsGdalProvider::buildPyramids(): do not crash if an invalid option is provided 2016-05-28 00:53:48 +02:00
Alvaro Huarte
6969a1a401 Fix travis errors 2016-05-25 22:53:01 +02:00
Alvaro Huarte
51f06edbf7 Allow override WkbPtr and define WkbSimplifierPtr class
This commit simplifies the geometry just before to paint it in the
current QPainter device.

This commit allows to override the '>>' operators of the QgsWkbPtr
class. Also, It defines a new QgsWkbSimplifierPtr class to automatically
simplify the input point stream.
2016-05-25 22:50:28 +02:00
Alessandro Pasotti
6b715c5bd6 Adapted test to new provider changes 2016-05-25 16:55:49 +02:00
Alessandro Pasotti
921069aef5 Renamed test 2016-05-25 16:55:49 +02:00
Alessandro Pasotti
92874025aa [server] WFS-T server and provider integration tests
Integration tests for WFS-T provider and WFS-T server.
The tests perform WFS-T CRUD operations on a QGIS Server
instance through WFS-T data provider.

Funded by Boundless
2016-05-25 16:55:49 +02:00
Matthias Kuhn
0627ac3f42 Followup f300715, adjust test 2016-05-25 16:03:48 +02:00
Nyall Dawson
fcaffa260f Make QgsCoordinateReferenceSystem implicitly shared 2016-05-25 15:41:04 +10:00
Nyall Dawson
4089cc5226 Add test for color button that setting color to transparent
will retain non-alpha color components
2016-05-25 15:41:04 +10:00
Nyall Dawson
f2b70cf5e2 Always mark features as valid when added to memory provider
For other providers features will automatically be made valid
through the proces of adding to the provider's storage itself
and then later retrieving via iterators. But the memory
provider uses a direct copy of the feature, so if we don't
explicitly mark features as valid the provider may be
returning features incorrectly marked as invalid.

...and add tests to ensure all providers always return valid
features
2016-05-25 15:41:04 +10:00
Nyall Dawson
8ddcf76d2a [FEATURE][expressions] Expanded support for date/time calcs
Adds support for date - date, time - time and datetime - datetime
type calculations which return an interval.
2016-05-24 17:18:45 +10:00
Nyall Dawson
7a8c3e0d2a Followup 73733a, fix crash when running invalid python strings 2016-05-24 05:02:55 +10:00
Nyall Dawson
1c4811fa12 Add Is Not Null and Is Not Between type search/filters 2016-05-24 00:26:15 +10:00
Nyall Dawson
02c0174d41 Add a "Between" type search/filter in filter form mode
When Between searches are selected, two search widget wrappers
will be created to allow entry of the minimum/maximum allowed
values.
2016-05-24 00:26:15 +10:00
Nyall Dawson
026e352cd9 [FEATURE] Add a search widget wrapper for datetime widgets 2016-05-24 00:26:15 +10:00
Nyall Dawson
195b4dee5a [FEATURE] Add search widget wrapper for check box widget 2016-05-24 00:26:14 +10:00
Nyall Dawson
ca5c7e2cd4 [FEATURE] Form based select/filter in attribute table
This commit adds a new mode to the attribute table dialog for searching
and filtering features. When activated (using a button on the toolbar
or by pressng CTRL+F), the dialog will switch to form view and all
widgets are replaced with their search widget wrapper variant.

Alongside each widget is a tool button with options for controlling
the search/filter behaviour for that field, eg "equal to", "not equal
to", "is null", "greater than", etc.., with the options presented
matching themselves to the corresponding field and widget type.

New buttons appear at the bottom of the form for either selecting
matching features (with options for add to selection/remove from
selection/select within current selection) or filtering features
in the table (with options for adding features to a current filter
or further restricting a current filter).

Sponsored by SIGE
2016-05-24 00:26:14 +10:00
Nyall Dawson
eb3a34cc92 Fix QgsComposerAttributeTableV2 setting displayed fields under qt5
Also don't run QgsComposerAttributeTable test when disable
deprecated flag is set.
2016-05-23 14:52:46 +10:00
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