1390 Commits

Author SHA1 Message Date
Loïc Bartoletti
c6eca9361f QgsAbstrcatGeometry and childs: Add fuzzyEqual and fuzzyDistanceEqual. Replaces operator== with fuzzyEqual and uses epsilon=1E-8
The comparisons among QGIS were conducted on coordinates using a fixed epsilon:
specifically, 1e-8 for QgsPoint and the default value for qgsDoubleNear: 4 *
DBL_EPSILON.

Initially, I've standardized its use to 1e-8 universally; it's already
significantly adequate for our Cartesian cases (1e-3 should suffice for many),
potentially fitting just right for geographical contexts.

Furthermore, in response to precision concerns, we're using the fuzzyEqual
and fuzzyDistanceEqual methods. These methods enable users/developers to
compare geometries more easily and with a given precision.

The API remains intact as operator==/equals() have been shifted into fuzzyEqual
(with an epsilon of 1e-8).

To consolidate the code between fuzzyEqual and fuzzyDistanceEqual, helper
functions, fuzzyHelpers, have been introduced following the logic of the
respective segments to be executed.
2024-01-12 07:10:37 +10:00
Nyall Dawson
9099fa4f3e Add a physically based metal rough material
Adds a new material choice for a physically based metal/roughness
material. Options are available for setting the material base color,
metalness and roughness.

Internally this uses a clone of Qt's QMetalRoughMaterial class. We
use a copy of the Qt class instead of relying on Qt's implementation
as longer-term improvements (such as data defined base color) will
require a re-implementation anyway. By using our own material we
will avoid having two different code paths for the data-defined/
non-data defined scenarios.
2024-01-11 11:43:01 +10:00
Loïc Bartoletti
c9d4a02d96 dox: Adds a \warning tag. Adds a mention about caller's responsibility and adds a \since tag 2024-01-11 05:23:39 +10:00
Loïc Bartoletti
a590b0e4c6 QgsGeometryUtils: add sqrDistance3D and distance3d for QgsPoint using QgsGeometryUtilsBase functions 2024-01-11 05:23:39 +10:00
Loïc Bartoletti
2fdcc3c01e QgsGeometryUtilsBase: add sqrDistance3D and distance3D
As for the sqrDistance and Distance 2D functions, this adds functions for 3D.
To maintain the lowest level, the specific case where a Z could be NaN
is not handled.
It is left to the responsibility of other methods using these functions.
2024-01-11 05:23:39 +10:00
Julien Cabieces
0e644d1889 [PyQt6] remove QTextCodec arg instead of removing the method 2024-01-11 04:52:01 +10:00
Julien Cabieces
fa6ab5c9a9 [PyQt6] Fix conversions.sip 2024-01-11 04:52:01 +10:00
Julien Cabieces
062ce03b6d [PyQt6] remove QTextCodec and rename pyqt5_from_qvariant_by_type
QTextCodec is no longer existing in PyQt6 (only in QtCoreCompat in C++)
2024-01-11 04:52:01 +10:00
Nyall Dawson
13235351cd Perform backward compatibility of settings only for changed settings
The backward compatibility code is very expensive, as it triggers
a huge number of QSetting object creation and destruction.

We only need to perform this for settings which have changed,
so add API to flag changed settings and only perform backward
migration of changed settings.

This dramatically improves QgsApplication shutdown time (cuts
1.5 seconds off shutdown on a release build!!)
2024-01-10 18:19:56 +10:00
Nyall Dawson
976c86d03d Implement lazy initialization of default style library
Populating the style library from the database can be a time
consuming process, especially if a user has many symbols
present in their library.

But for many standalone scripts, and for qgis_process, the
style database may not be required.

Let's defer initialization of it until it's actually required,
saving the startup cost in qgis_process and 3rd party scripts.

On my system with a style database containing ~700 items this
cuts down qgis_process startup times by around 25%
2024-01-10 12:24:59 +10:00
Nyall Dawson
3c179214fc Use nicely formatted results in processing logs 2024-01-09 17:02:21 +10:00
Nyall Dawson
3e10cf9338 Add method to get HTML formatted versions of output values for
processing outputs
2024-01-09 17:02:21 +10:00
Nyall Dawson
b674a7c35d Add method to format processing output values as strings 2024-01-09 17:02:21 +10:00
Nyall Dawson
3e7d376953 Add method to push formatted text to Processing feedback
Provides a method for algorithms to push HTML contents to the log
(the other feedback methods all escape HTML strings to strip
formatting characters)
2024-01-09 17:02:21 +10:00
uclaros
c8468d45e0 cmon sip... 2024-01-08 05:20:26 -08:00
uclaros
02ab91329b address review 2024-01-08 05:20:26 -08:00
uclaros
103e6dd0e6 ok sip 2024-01-08 05:20:26 -08:00
Nyall Dawson
50a31065ab Add framework to temporarily halt flushing of QgsSettings to ini
This adds a mechanism where flushes of QgsSettings to the underlying
ini storage file can be temporarily suspended. It is intended for
code paths where many settings entries are consecutively read/written,
to avoid the very expensive cost of constructing and destructing
multiple QgsSettings objects for each in turn.

When QgsSettings::holdFlush() is called, then a temporary thread local
QgsSettings object will be created and ALL access to settings entries
will use this same object (preventing flushing of it to ini files).
An accompanying QgsSettings::releaseFlush() call MUST be made from
the same thread to destroy the thread local QgsSettings, flush it
to disk, and resume normal operation.

This helps avoid the VERY costly backward migration of settings,
and cuts the run time for qgis_process commands like `qgis_process list`
by at least half (and considerably more in common setups).
2024-01-08 18:58:14 +10:00
Nyall Dawson
5ac17746de Lazy initialize authentication framework
QCA and SSL certificate initialize can be costly -- so defer
startup of authentication framework until it is actually required.

This has no effect on QGIS desktop, as the news feed request
and other startup network requests will immediately trigger
an initialization of the framework. The use case here is improving
the core application startup time to benefit non-app based clients,
eg. qgis_process.
2024-01-08 17:21:07 +10:00
Nyall Dawson
f6addcd0ca Promote 3d point symbol shape to enum class 2023-12-25 17:54:44 +10:00
Nyall Dawson
7b41268c99 Ensure that default shape properties for 3d symbols are only
stored in a single place, and that we always use the default
value when its not overwise set

This has two benefits:
1. The user doesn't see confusing "0" values for radius/length etc,
which are silently treated as some other fixed value when rendering
2. The default values are correctly accounted for when calculating
the layer's AABB, otherwise we end up with a flat AABB by
default
2023-12-23 06:38:43 +10:00
Nyall Dawson
4c00af517d Allow source widgets to specify the group name for layer source
properties

Allows overriding the default "Layer Source" group box title
2023-12-22 14:00:13 +10:00
Loïc Bartoletti
bc6fdf73a8 Add \since QGIS 3.34
3.34 here, since it has been backported

Co-authored-by: Nicolas Godet <39594821+nicogodet@users.noreply.github.com>
2023-12-21 07:09:36 +10:00
Loïc Bartoletti
f009536438 QgisInterface: add meshMenu to iface.
Fixes #55604
2023-12-21 07:09:36 +10:00
Loïc Bartoletti
6b38cb5ad6
Add fuzzy equal methods
Add fuzzy equal methods
2023-12-19 12:25:44 +01:00
Martin Dobias
fa49d149fe sip fixes 2023-12-18 12:07:17 +01:00
Loïc Bartoletti
41ff06f813 QgsPointXY: add a method distanceCompare using fuzzyDistancEqual 2023-12-14 20:35:02 +01:00
Loïc Bartoletti
491d133a05 QgsGeometryUtilsBase: Add a fuzzy compare method for comparing pairs
This method will be used where multiple calls to `qgsDoubleNear(x1, y1, eps) &&
qgsDoubleNear(x2, y2, eps) && ... && qgsDoubleNear(xn, yn, eps)` are possible.
2023-12-14 20:17:25 +01:00
Loïc Bartoletti
b5c5029e93 qgis.h: proposes a generic templated method from qgsDoubleNear and qgsNumberNear 2023-12-14 19:55:36 +01:00
Nyall Dawson
eecae55ac8 Word wrap long json in results dialog 2023-12-15 04:47:42 +10:00
Alessandro Pasotti
431495689a
Merge pull request #55284 from elpaso/feed-enhancements
NewsFeed enhancements
2023-12-14 16:31:58 +01:00
Alessandro Pasotti
2bc6aaac92 qt6 2023-12-14 13:23:33 +01:00
Alessandro Pasotti
d85ff3ced9 Fix spelling workflow (unescaped paths) 2023-12-14 13:04:11 +01:00
Loïc Bartoletti
2910e24d87 Add const SIP_FACTORY for measuredLine methods 2023-12-14 05:52:21 +10:00
Alessandro Pasotti
8fd88f62b9 Qt6 SIP 2023-12-13 11:59:54 +01:00
Nyall Dawson
9e8d8d845c
Sipify 2023-12-13 09:54:47 +10:00
Julien Cabieces
1ead52c9b4 update sip PyQt6 after rebase 2023-12-13 05:36:44 +10:00
Julien Cabieces
e8093a8ce5 Only mock non class enums 2023-12-13 05:36:44 +10:00
Julien Cabieces
7f586d8742 PyQt6 sip files 2023-12-13 05:36:44 +10:00
Julien Cabieces
bb3c36a69b Initialize sip bindings for PyQt6
use exactly the ones from PyQt5 so we can study the difference when
generating for PyQt6
2023-12-08 03:38:42 +10:00