6295 Commits

Author SHA1 Message Date
Matthias Kuhn
3a3b430825
Merge pull request #33259 from signedav/reload_provider
reloadData / forceReload on data providers
2020-01-09 10:57:14 +01:00
Nyall Dawson
1cd2e16fb1 Also expose setting for optionally overridding the decimal character 2020-01-09 19:51:50 +13:00
Nyall Dawson
1e82bbc417 Fix seealso link 2020-01-09 19:51:50 +13:00
Nyall Dawson
d3afd6d936 Allow users to override the default locale thousand separator within
specific numeric format objects

E.g. this allows users to set a specific thousand grouping character
to use for a particular scalebar number labels. Useful in the case of
creating maps for users outside of the current locale. Default is
always to use the QGIS locale character (this is an advanced setting!)
2020-01-09 19:51:50 +13:00
Nyall Dawson
16c2254141 [FEATURE][layouts] Add user control over scalebar numeric formats
Gives users control over all the formatting properties for the numbers
in scalebars, including whether they want thousand separators, decimal
places, scientific notation, etc

Fixes #21341
2020-01-09 19:51:50 +13:00
Nyall Dawson
ad6684bdb4 Add numeric formatting option to round to number of significant figures 2020-01-09 19:51:50 +13:00
Nyall Dawson
c0ad4303d2 [FEATURE] Add setting for format to show angular bearings to projects
and profile options

The Settings - Options - Map Tools tab contains a new setting for
controlling the default format to use for displaying angular bearings for
newly created projects. Whenever a new project is created, it will
inherit this default settings.

The Project Properties dialog also has a new setting for the project-specific
bearing format.

The intention is that whenever angular bearings are shown in QGIS,
they will be formatted using the current project's bearing format
settings.
2020-01-09 17:10:30 +13:00
Nyall Dawson
1f7140bfc5 New class QgsLocalDefaultSettings
This class contains a variety of default setting values. These values are local, profile
specific settings which may have been configured or tweaked by the user (as opposed to
global, fixed default settings).

The values encapsulated here should be inherited when creating new objects such as new
QGIS projects.

Typically, the QgsSettings backend is used to store and retrieve these local settings.

The intention here is to provide stable, structured and easily discoverable
methods for setting and retrieve these settings, rather than forcing raw QSetting
handling.
2020-01-09 17:10:30 +13:00
Nyall Dawson
410da5e358 New class QgsProjectDisplaySettings
This class (attached to a QgsProject object) provides a place to
store and retrieve settings related to project display behavior,
e.g. the numeric formats used for bearings and coordinates
2020-01-09 17:10:30 +13:00
Nyall Dawson
664ba234da Also respect other locale specific characters 2020-01-08 16:20:43 +13:00
Nyall Dawson
545edcf148 Dox++ 2020-01-08 16:20:43 +13:00
Nyall Dawson
124df2d78d Add display of sample values to numeric format selector widget 2020-01-08 16:20:43 +13:00
Nyall Dawson
6b9cafb71f Nicer sorting of numeric format choices 2020-01-08 16:20:43 +13:00
Nyall Dawson
591e1a28e0 Start on GUI work 2020-01-08 16:20:43 +13:00
Nyall Dawson
90184a59eb Add methods to store/recreate formats from XML elements, and tweak
serialization API
2020-01-08 16:20:43 +13:00
Nyall Dawson
ec3763521a Avoid ambiguous test data, force minimum of 1 decimal place for scientific notation format to avoid undefined results 2020-01-08 16:20:43 +13:00
Nyall Dawson
a72d8faef5 Fix dox 2020-01-08 16:20:43 +13:00
Nyall Dawson
7affde6624 Add numeric formatter for currency values 2020-01-08 16:20:43 +13:00
Nyall Dawson
d445487c0d Add numeric formatter for scientific notation 2020-01-08 16:20:43 +13:00
Nyall Dawson
8bcba4780e Add percentage numeric formatter 2020-01-08 16:20:43 +13:00
Nyall Dawson
d0b5a01729 [api] Add registry and interface for QgsNumericFormats
QgsNumericFormat subclasses provide a means to format a numeric value
as a string, applying various formatting options. E.g. a default
string to value formatter (included here) includes settings for
controlling the number of decimal places, whether a thousands separator
should be shown, whether a leading + sign should be shown, whether
trailing zeros should be shown.

This PR also includes a formatter for bearings, allowing various
formats of numeric bearings to be applied (e.g. control over decimal
places, etc + control over whether direction E/W suffixes are shown,
or whether values should be limited to either the +/- 180 range or
0-360 degree range)

When formatting values, a QgsNumericFormatContext class is used
to provide context. Currently, this includes the thousands and
decimal separators to apply when formatting (which are taken by
default from the user's locale).

A registry of formatters is included to allow easy addition of
other formats in future (e.g. currencies, percentages, scientific
notation, etc...) and to allow plugin based formats.

The intention is to follow this up with gui configuration widgets
for the formats, and then expose them in various places through
the qgis ui (e.g. in the range editor widget for fields, in scalebar
numbers, as an option for formatting numeric labels, etc)
2020-01-08 16:20:43 +13:00
Nyall Dawson
400e3dace1 [FEATURE][layouts] Allow layout attribute tables to be styled using the foreground
and background colors of matching conditional styles attached to the layer

When the new "Apply layer conditional styling colors" option is enabled in the
layout attribute table settings, any conditional styling rules present in the
layer will be applied inside the layout attribute table (foreground and
background colors only, for now!).

Refs #25712

Sponsored by City of Canning
2020-01-08 15:31:24 +13:00
Nyall Dawson
494b52b231 [gps] Sync some changes from a fork of nmealib, and add support for
handling HCHDG and HCHDT heading packets
2020-01-07 12:29:19 +13:00
Nyall Dawson
54629b8f21 [FEATURE][processing][API] New parameter type QgsProcessingParameterMapTheme
Allows for selection from existing map themes
2020-01-05 20:50:05 +10:00
Nyall Dawson
1c4d691ad2 Dox++ 2020-01-04 23:06:03 +10:00
Nyall Dawson
1a74938ba8 [processing] Add option for multiple field parameters to default to
selecting all available fields

For some algorithms this is better UX then defaulting to an empty list
2020-01-04 23:06:03 +10:00
Nyall Dawson
fe6abba251 [api] Add constructor for QgsSpatialIndex which allows for a callback
function during bulk index load from a feature iterator

Allows single-iteration of a source for dual purposes simultaneously,
e.g. doing other feature-based operations while still gaining the full
advantage of the bulk loaded spatial index without having to do multiple
feature iterations
2020-01-02 14:20:14 +10:00
Mathieu Pellerin
ddd2c6ea3d Expose QgsBearingUtils to QML 2019-12-27 09:08:38 +07:00
Nyall Dawson
f44c229405 Fix dox test 2019-12-26 13:18:10 +10:00
Nyall Dawson
1899f90a04 [needs-docs] Rework label engine "maximum line candidates" and "maximum polygon candidates"
settings and logic

The previous approach of a single fixed value which applied to ALL line and ALL polygon
features was... not ideal. It meant that all line features would be assigned the same
number of candidates, regardless of length. So a road of length 1 cm on the rendered
map would have an identical number of candidates as a 30cm road covering the length of the
whole map!! This resulted in both a lot of wasted calculations (generating a ridiculous
number of candidates for small lines at barely discernable distances from each other)
AND an insufficient number of candidates for lengthy features (resulting in worse label
placement for these features).

(The situation was similar, but even worse for polygons)

Now, the setting is reworked to "Number of line candidates per cm" and "number of
polygon candidates per cm2". This means that small features get much less candidates,
and large features get much more features! Both a win for map rendering speed in many
circumstances AND good cartography... now that's a nice Christmas gift for QGIS :)
2019-12-26 13:18:10 +10:00
Nyall Dawson
df102a98da [needs-docs] Drop setting for maximum number of point label candidates
This setting is easily replaced by automatically calculated, optimised
values for each separate point plcaement mode individually
2019-12-26 13:18:10 +10:00
David Marteau
907b27309c
Add missing parameter documentation 2019-12-21 13:28:31 +01:00
David Marteau
5bf8d2cd26
Pass project when creating relation from Xml
Fix dependency inconsistency to project from QgsRelationManager
    by forcing  'QgsRelation::createFromXml' to rely on project passed
    to 'QgsRelationManager' instead of using 'QgisProject::instance()'
2019-12-20 23:56:17 +01:00
Nyall Dawson
3e9aaaa6ea Move variant to CRS resolution out to QgsProcessingUtils for wider
usability
2019-12-21 05:07:39 +10:00
Nyall Dawson
fe622dd24a [API][processing] New parameter type for coordinate operations
Allows selection of the proj coordinate operation to use when
reprojecting between two CRSes
2019-12-21 05:07:39 +10:00
Matthias Kuhn
2a01772e46
Merge pull request #33436 from signedav/relating_values
List referenced layer values in Expression Builder
2019-12-20 17:29:10 +01:00
David Signer
ea912a170c since information 2019-12-20 09:39:50 +01:00
Peter Petrik
d211de2204
Other average methods 3d mesh (#33426)
[FEATURE] [MESH] add new 3d stacked mesh averaging methods (top, bottom, sigma, depth, height, elevation)

see https://fvwiki.tuflow.com/index.php?title=Depth_Averaging_Results for description of the methods. method can be selected for 3d stacked mesh dataset in the new widget added for QGIS 3.12 in the mesh layer styling dialog
2019-12-20 07:48:39 +01:00
Nyall Dawson
80be192d8f Fix doxygen warning 2019-12-20 12:13:06 +10:00
Nyall Dawson
b7a440938c Layout fixes 2019-12-20 12:13:06 +10:00
Nyall Dawson
fdf211a8a3 Add a method for retrieving a user friendly descriptive string for
a CRS

And use this wherever we show CRS values to users
2019-12-20 12:13:06 +10:00
Nyall Dawson
e152685d97 Cleanup handling of recent CRS list, add tests 2019-12-20 12:13:06 +10:00
Nyall Dawson
cbc1ee56cc Deprecate most methods which construct CRSes from internal CRS ids
These should NOT be used, and auth:code or WKT definitions used instead.

Unfortunately some use of these methods are very heavily entangled around
other code, so we can't deprecate all of them until 4.0
2019-12-20 12:13:06 +10:00
Nyall Dawson
c76813c434 Deprecate methods for constructing CRS from Postgis srids
Constructing CRS using Postgis srids is highly discouraged,
and instead CRSes should always be constructed using auth:id
codes or WKT strings.

QGIS 4.0: The logic should be isolated into the postgres
provider alone, and not exposed to stable API
2019-12-20 12:13:06 +10:00
Nyall Dawson
b37dd0984e Rip off a band aid, and deprecate all "proj4" calls from the API
Alias these across to new "proj" methods, which don't include the
version number.
2019-12-20 12:13:06 +10:00
David Signer
1f1a3fe6b7 pass field formatter context as a reference instead of a pointer to implify his not optionality 2019-12-19 21:08:02 +01:00
signedav
7f9aa3d2bb
Merge branch 'master' into relating_values 2019-12-19 14:12:38 +00:00
David Signer
e8b82c15b8 use of context to pass project and avoid QgsProject::instance() 2019-12-19 15:07:52 +01:00
Alessandro Pasotti
90ac90b4a9 Weak relations and auto-restore when loading a style 2019-12-19 10:33:24 +01:00
David Signer
9e5657c8fe use of QVariantList instead of QList<QVariant> 2019-12-19 10:15:33 +01:00