17654 Commits

Author SHA1 Message Date
Nyall Dawson
33f31d826a Fix QgsGeometry::asQPolygonF doesn't handle multipolygon inputs
gracefully
2020-07-03 04:03:47 +10:00
Nyall Dawson
5b8af77578 Rename enum values for clarity 2020-07-02 12:07:51 +10:00
Nyall Dawson
e028067926 Ensure map clip region is correctly handled during labeling
We don't want labels to be positioned using unclipped feature
geometries, rather we want them to be positioned nicely on the
visible portions of features
2020-07-02 12:07:51 +10:00
Nyall Dawson
5cbdc4c896 Ensure feature clipping occurs for render only, and doesn't affect
feature geometry when used in rule based renderers and other
geometry dependent rendering options
2020-07-02 12:07:51 +10:00
Nyall Dawson
bbd5d80e71 Add method to set a list of clipping regions for QgsMapSettings 2020-07-02 12:07:51 +10:00
Nyall Dawson
9a97892107 Respect map clipping regions during raster layer rendering 2020-07-02 12:07:51 +10:00
Nyall Dawson
0e67b65f8d Apply painter clip regions when rendering vector layers 2020-07-02 12:07:51 +10:00
Nyall Dawson
291dbe8cba Apply clipping regions with Intersect mode during vector layer rendering 2020-07-02 12:07:51 +10:00
Nyall Dawson
b10b16941b New class QgsMapClippingUtils with utility functions for helping
with map clipping
2020-07-02 12:07:51 +10:00
Nyall Dawson
b5ae07869e Add api to determine if a clip region applies to a particular layer 2020-07-02 12:07:51 +10:00
Nyall Dawson
e38bb541a6 Add clipping regions to QgsMapSettings/QgsRenderContext API 2020-07-02 12:07:51 +10:00
Nyall Dawson
04f51371fc Create new class QgsMapClippingRegion, for encapsulation of an area
and method to use to clip a map render
2020-07-02 12:07:51 +10:00
Håvard Tveite
2a786aede2
[feature][processing] Random points in polygons C++ algorithm
Offers the same functionality as the Random points inside polygons
algorithm, and in addition it includes (possible to opt-out) the attributes
from the containing polygon and the ability to specify a seed for the random
number generator.

Could replace the Python algorithm Random points inside polygons, but
this C++ implementation only supports "Points count" ("number of points
for each feature") directly, while "Points density" is supported by allowing the
point count to be data defined (using the polygon area to calculate the
number of points).
2020-07-02 08:25:42 +10:00
Vincent Cloarec
6be16a5bfe
Memory dataset group and possibility to persist it (#37389)
[FEATURE] Introduces memory dataset groups for mesh layer. These dataset groups are temporary and are not kept when the project is closed.

Memory dataset groups can be created from the mesh calculator with a new option.

Allows the possibility to remove or save these memory dataset groups to a file with specified driver.
2020-07-01 10:18:27 +02:00
Alexander Bruy
6a6f7ff885 typo 2020-07-01 07:01:58 +03:00
Alexander Bruy
9734b76e59 doxymentation 2020-06-30 16:01:26 +03:00
Alexander Bruy
0214b4f01a move gamma correction code inside brightness/contrast filter 2020-06-30 15:42:33 +03:00
Alexander Bruy
cfa5c5bf83 fix tests 2020-06-30 15:42:33 +03:00
Alexander Bruy
80544696b4 gamma correction filter pipe for rasters (fix #13512) 2020-06-30 15:41:57 +03:00
Nyall Dawson
5b85cb93c1 Sipify 2020-06-30 12:07:21 +10:00
Matthias Kuhn
af670a264e Improve security warning on console 2020-06-29 07:23:20 +10:00
signedav
9b8e983d3c ITEM_NAME_ROLE in QgsExpressionItem to store the field name to use it on getting the example values in the expression builder
and still be able to store generic labels on the item (like the field name and the field alias)
This fixes that there has been no example values in the expression builder on the fields when an alias has been used
2020-06-28 15:55:44 +10:00
Nyall Dawson
edfdbdb427 Try to fix windows build 2020-06-28 15:50:10 +10:00
Nyall Dawson
ae8dbd884e More fine tuned profiling for vector layer loading in projects 2020-06-28 15:50:10 +10:00
Nyall Dawson
005ac8af2b [FEATURE] Add project load profile times to debugging tools dock
Now it's possible to get a breakdown of the various stages of
project load, in order to identify the causes of slow project
load times.

TODO: in 99% of cases this will be caused by one or more layers,
so it would be nice to further break down the individual layer load
times, e.g. so that for a WFS layer we see the time taken for
the initial server capabilities queries, etc...
For now, you just get the overall load time of each individual
layer.
2020-06-28 15:50:10 +10:00
Nyall Dawson
42a1ed1ce0 Fix clearing groups 2020-06-28 15:50:10 +10:00
Nyall Dawson
5c842a6286 [api] Rework QgsRuntimeProfiler for flexibility
- Make profiler thread safe
- Allow profiling of other, non-startup task groups (e.g. project
load times, map render times)
2020-06-28 15:50:10 +10:00
Germán Carrillo
4af5597e76 Clear ongoing drawing on map canvas when closing layer's edit session (fix #36292) 2020-06-20 04:32:52 +10:00
Germán Carrillo
f3d473cb27 Getter/setter for linking a map canvas with its QgsProject; link app canvases to QgsProject::instance(); rationale: using the QgsProject singleton is discouraged 2020-06-20 04:32:52 +10:00
nedjima
7d8a03b1fe Executed sipify_all script to fix the setDirectionalLights header definition 2020-06-20 04:31:10 +10:00
nedjima
9556bd2147 [Feature] directional lights support for QGIS 3D 2020-06-20 04:31:10 +10:00
Alessandro Pasotti
672d6ec5b2 Fix test: cast to float 2020-06-20 04:30:18 +10:00
Alessandro Pasotti
4304d8636d Fix precision in test 2020-06-20 04:30:18 +10:00
Alessandro Pasotti
50f66ba3cb Increase tolerance when comparing floats in processing tests 2020-06-20 04:30:18 +10:00
Alessandro Pasotti
7fa6f38689 Memory provider: roll back on errors
Long story short: calling provider's addFeatures
is implemented for some providers in a way that
will roll back all changes on errors, leaving
the backend storage unchanged.

Adding a QgsFeatureSink flag to control this
behavior allows certain providers to support
partial feature addition.

The issue comes from QgsVectorDataProvider::commitChanges
that is documented to leave the provider unchanged (roll
back) on any error, giving the client code the possibility
to fix errors (in the editing buffer) and re-commit.

Without a full rollback implementation in the memory
provider and after the type check introduction in this
PR we ended up with situations like this:

vl = ... an empty memory layer
self.assertTrue(vl.addFeatures([valid, invalid]))
self.assertFalse(vl.commitChanges())
self.assertEqual(vl.featureCount(), 1)  <--- fails!
We actually had 3 features from vl.getFeatures():
[valid, invalid, valid] (the first from the provider
the second and third from the editing buffer).

On the other hand, QgsFeatureSink would probably assume
that addFeatures will allow partial additions.

BTW: This is for sure the longest commit message I've ever
     written.
2020-06-20 04:30:18 +10:00
Alessandro Pasotti
f3bbc4d81c Use QgsField::convertCompatible to check for errors 2020-06-20 04:30:18 +10:00
Alessandro Pasotti
39068c1cd5 Sipify 2020-06-20 04:30:18 +10:00
Alessandro Pasotti
68baf74906 Add type check to file writer an memory layer
Fixes #36715

Adds a method to check for QVariant conversions, also
check for integral type narrowing so that for example
floating point 123.45 does not get down casted to integer
without raising an error.
2020-06-20 04:30:18 +10:00
Even Rouault
93bc7c2f04 Raster rendering: enable provider-side resampling when available, and reprojection is done 2020-06-20 04:29:36 +10:00
Even Rouault
47da98c070 Raster resampling: add provider-level settings, and a switch at rasterpipe level between resamplingFilter and provider resampling
Also
* in settings UI, add a 'Early resampling' checkbox
* in raster properties UI, add similar checkbox
* serialize/deserialize new settings in QgsRasterLayer XML
2020-06-20 04:29:36 +10:00
Even Rouault
f32026c8e0 [GDAL provider] Fix misalignment of raster with overviews
Fixes #36820

The way QGIS is currently handling resampling is sub-optimal given GDAL >= 2
capability of having sub-pixel accuracy. So when a QgsRasterResampleFilter
is set, make it try to delegate resampling back to the underlying input interface,
and implement that improved resampling in the GDAL provider.

The GDAL resampling will take into account the settings of the QGIS resample
filter: zoom-in resampling kernel, zoom-out resampling kernel and max resampling
factor. The later is important to avoid performance issues if not enough overview
levels are generated (in the case, we will fallback to the generic method, which
may introduce sub-pixel shifts)
2020-06-20 04:29:36 +10:00
Harrissou Sant-anna
f2f7236fc8
Layout new name dialog
Make the new layout dialog use the qgsnewnamedialog class
Add/enable help button to open user manual chapters
2020-06-20 04:28:18 +10:00
Alessandro Pasotti
4b362629e8 GPKG and spatialite AUTOINCREMENT: get next value from sequence
for PK default value, fixes #37222

Also, fix dangling transactions for spatialite.
2020-06-20 04:24:55 +10:00
Nyall Dawson
4dc9b38142 Add API to retrieve QGIS version used to save a QgsProject
project.lastSaveVersion()

now returns the version number used to save the project.
Also cleanup QgsProjectVersion code

Fixes #37288
2020-06-20 04:21:53 +10:00
Denis Rouzaud
0cb8408425
more flags warnings fixes for Qt 5.15 (#37309)
* more flags warnings fixes for Qt 5.15

* fix sip compilation
2020-06-19 12:02:00 +02:00
Denis Rouzaud
7fb552d62d fix layout 2020-06-19 08:47:23 +10:00
Denis Rouzaud
044a05d828 run sipify 2020-06-19 08:47:23 +10:00
Ivan Ivanov
c0f8dea17a Sipify 2020-06-18 05:53:23 +10:00
Nyall Dawson
b7eac07721 Add a render context flag so we know when a render operation is
occurring for drawing a symbol preview

Because these have no map association, certain settings like
sizes in "meters in map units" will have no meaning, and may need
special handling

Refs #28690
2020-06-17 08:02:49 +10:00
Nyall Dawson
75c86786c1 Add QgsCodeEditorJavascript subclass of QgsCodeEditor
Allows plugins to create a nice editor for JSON content -- not easy
to do if we don't expose this through the QGIS api!
2020-06-16 17:13:59 +10:00