2249 Commits

Author SHA1 Message Date
Alessandro Pasotti
f89fb2ae40 QgsFields: make icon for type static 2020-07-07 05:59:24 +10:00
Alessandro Pasotti
dc67a4edec DB Connections API: add fields method -> column info 2020-07-06 16:57:47 +02:00
Alessandro Pasotti
992b1f2aa8
Merge pull request #36967 from elpaso/bugfix-gh36962-fid-is-null
QgsFeature default constructor set fid to invalid
2020-07-06 11:47:16 +02:00
Nyall Dawson
398b55ec67 Use correct layer comparators when comparing layer sources in processing
Fixes #37394
2020-07-06 13:59:21 +10:00
Nyall Dawson
3263211d87 Minor api cleanups (use Maximum/Minimum instead of min/max), dox
fixes (\command instead of @command)
2020-07-06 10:50:24 +10:00
Nyall Dawson
b2cef7377c [feature][layouts] Expose option to control PDF image compression
method when exporting layouts to PDF

Options are for Lossy compression, which is the default JPEG compression
used, and Lossless compression (which creates bigger files in most
cases, but is much more suitable for professional printing outputs
or for post-production in Illustrator/etc)

The Bad news: this option is available in builds based on Qt 5.14
or later.
2020-07-05 15:40:48 +10:00
Nyall Dawson
61193fc841 Simplify some painter related operations and make safer 2020-07-04 19:11:10 +10:00
Nyall Dawson
c30c769ef5 [feature][layouts] Add automatic clipping settings for atlas maps
This feature allows users to enable map clipping for layout map items
so that the maps are clipped to the boundary of the current atlas feature.

(It's available for polygon atlas coverage layers only, for obvious reasons!)

Options exist for:
- Enabling or disabling the clipping on a per-map basis
- Specifying the clipping type:
   - "Clip During Render Only": applies a painter based clip, so that
     portions of vector features which sit outside the atlas feature become
     invisible
   - "Clip Feature Before Render": applies the clip before rendering features,
     so borders of features which fall partially outside the atlas feature
     will still be visible on the boundary of the atlas feature
   - "Render Intersecting Features Unchanged": just renders all features
     which intersect the current atlas feature, but without clipping their
     geometry
- Controlling whether labels should be forced placed inside the atlas feature,
or whether they may be placed outside the feature
- Restricting the clip to a subset of the layers in the project, so that
only some are clipped

Sponsored by City of Canning
2020-07-04 16:21:15 +10:00
Nyall Dawson
329a0fc110 [feature][symbology] Expose option to offset simple line dash patterns
by a preset amount

Allows for tweaking the positioning of dashes/spaces in the line, so
that the dashes/spaces can be placed at nicer positions to account
for corners in the line (also can be used potentially to "align"
adjacent dash pattern borders)

Offset can be set in different units, including map units, and can
be data defined
2020-07-04 16:20:34 +10:00
Harrissou Sant-anna
0876baece3 Fix code sample formatting 2020-07-04 07:04:29 +10:00
Matthias Kuhn
f7f9534eea
Merge pull request #37553 from 3nids/fix-pyqgis-formatting
[dox] fix code formatting
2020-07-03 19:22:30 +02:00
mhugent
a60ddc0b1f
Merge pull request #37474 from mhugent/layout_legend_maximum_marker_size
Layout legend maximum marker size
2020-07-03 13:06:21 +02:00
Denis Rouzaud
b5d9ccdf1f [dox] fix code formatting
fixes https://github.com/qgis/pyqgis/issues/45
2020-07-03 09:18:23 +02:00
Nyall Dawson
205273e7cd Add method to QgsAbstractGeometry to convert geometry to QPainterPath
Unlike QgsGeometry::asQPolygonF, this allows for correct handling
of multipolygons and rings, etc.

And potentially, the generated QPainterPaths could use arc segments
instead of segmentizing geometries. In fact, there's been disabled
code which seems to do this in place since the new geometry engine
was introduced back in 2.10! TODO: check if this code works correctly...
2020-07-03 15:24:32 +10:00
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
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
Marco Hugentobler
c399f08cda Move creation of minSize/maxSize symbol to QgsSymbolLayerUtils 2020-06-30 17:03:22 +02:00
Alexander Bruy
9734b76e59 doxymentation 2020-06-30 16:01:26 +03:00
Marco Hugentobler
80b3a81771 Move min/max symbol size handling to QgsSymbolLayerUtils 2020-06-30 14:47:38 +02: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
Marco Hugentobler
9ecded8b73 Comments 2020-06-30 13:06:53 +02:00
Marco Hugentobler
6ff2fe45ab Add possibility to set a minimum symbol size in layout legend. Minimum and maximum size are also valid for line widths 2020-06-29 17:37:02 +02:00
Marco Hugentobler
ab75840858 Sipify 2020-06-29 09:33:08 +02:00
Marco Hugentobler
f0ad33c8a9 [FEATURE] possibility to set a maximum marker size in layout legend 2020-06-29 09:02:05 +02: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
Alessandro Pasotti
0a4214499d Fix QgsFeature default ctor set fid to 0
The QgsFeature default constructors initialized
feature id to 0, which is a valid feature id
instead of initializing it fo FID_NULL.

This was just wrong and broke the validator for
UNIQUE constraints in case a feature with fid 0
existed in the data provider.

Fixes #36962
2020-06-22 15:22:46 +02: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
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